diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index 357a79715a..1c401ae80e 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG 97d717d + GIT_TAG d8059ff SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 5fe8f6ea13..10677f0208 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG d4b3967 + GIT_TAG 41d4f95 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx index 3bd7b7f4c6..b543879b3c 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/14-reference/03-connector/03-cpp.mdx @@ -176,6 +176,14 @@ The base API is used to do things like create database connections and provide a Set the current default database to `db`. +- `int taos_get_current_db(TAOS *taos, char *database, int len, int *required)` + + - The variables database and len are applied by the user outside and allocated space. The current database name and length will be assigned to database and len. + - As long as the db name is not assigned to the database normally (including truncation), an error will be returned with the return value of -1, and then the user can use taos_errstr(NULL) to get error message. + - If database==NULL or len<=0, returns an error, the space required to store the db (including the last '\0') in the variable required + - If len is less than the space required to store the db (including the last '\0'), an error is returned. The truncated data assigned in the database ends with '\0'. + - If len is greater than or equal to the space required to store the db (including the last '\0'), return normal 0, and assign the db name ending with '\0' in the database. + - `void taos_close(TAOS *taos)` Closes the connection, where `taos` is the handle returned by `taos_connect()`. @@ -404,5 +412,17 @@ In addition to writing data using the SQL method or the parameter binding API, w Note that the timestamp resolution parameter only takes effect when the protocol type is `SML_LINE_PROTOCOL`. For OpenTSDB's text protocol, timestamp resolution follows its official resolution rules - time precision is confirmed by the number of characters contained in the timestamp. - **Supported Versions** - This feature interface is supported from version 2.3.0.0. + schemaless 其他相关的接口 +- `TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision)` +- `TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid)` + + **Description** + - The above seven interfaces are extension interfaces, which are mainly used to pass ttl and reqid parameters, and can be used as needed. + - Withing _raw interfaces represent data through the passed parameters lines and len. In order to solve the problem that the original interface data contains '\0' and is truncated. The totalRows pointer returns the number of parsed data rows. + - Withing _ttl interfaces can pass the ttl parameter to control the ttl expiration time of the table. + - Withing _reqid interfaces can track the entire call chain by passing the reqid parameter. diff --git a/docs/en/14-reference/03-connector/07-python.mdx b/docs/en/14-reference/03-connector/07-python.mdx index 34435a7c0d..c885d416c8 100644 --- a/docs/en/14-reference/03-connector/07-python.mdx +++ b/docs/en/14-reference/03-connector/07-python.mdx @@ -32,7 +32,7 @@ We recommend using the latest version of `taospy`, regardless of the version of ### Preparation -1. Install Python. The recent taospy package requires Python 3.6+. The earlier versions of taospy require Python 3.7+. The taos-ws-py package requires Python 3.7+. If Python is not available on your system, refer to the [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) to install it. +1. Install Python. The recent taospy package requires Python 3.6.2+. The earlier versions of taospy require Python 3.7+. The taos-ws-py package requires Python 3.7+. If Python is not available on your system, refer to the [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) to install it. 2. Install [pip](https://pypi.org/project/pip/). In most cases, the Python installer comes with the pip utility. If not, please refer to [pip documentation](https://pip.pypa.io/en/stable/installation/) to install it. If you use a native connection, you will also need to [Install Client Driver](/reference/connector#Install-Client-Driver). The client install package includes the TDengine client dynamic link library (`libtaos.so` or `taos.dll`) and the TDengine CLI. diff --git a/docs/en/14-reference/03-connector/index.mdx b/docs/en/14-reference/03-connector/index.mdx index 2df73b8592..a35d5bc2d1 100644 --- a/docs/en/14-reference/03-connector/index.mdx +++ b/docs/en/14-reference/03-connector/index.mdx @@ -61,7 +61,7 @@ The different database framework specifications for various programming language | **Connection Management** | Support | Support | Support | Support | Support | Support | | **Regular Query** | Support | Support | Support | Support | Support | Support | | **Parameter Binding** | Not Supported | Not Supported | Support | Support | Not Supported | Support | -| **Subscription (TMQ) ** | Not Supported | Support | Support | Not Supported | Not Supported | Support | +| **Subscription (TMQ) ** | Supported | Support | Support | Not Supported | Not Supported | Support | | **Schemaless** | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | | **Bulk Pulling (based on WebSocket) ** | Support | Support | Support | Support | Support | Support | | **DataFrame** | Not Supported | Support | Not Supported | Not Supported | Not Supported | Not Supported | diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md index f20018d5e0..a76074f507 100644 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -599,7 +599,7 @@ The charset that takes effect is UTF-8. | Applicable | Client only | | Meaning | Whether schemaless columns are consistently ordered, depat, discarded since 3.0.3.0| | Value Range | 0: not consistent; 1: consistent. | -| Default | 1 | +| Default | 0 | ## Compress Parameters diff --git a/docs/en/14-reference/13-schemaless/13-schemaless.md b/docs/en/14-reference/13-schemaless/13-schemaless.md index 1099ceabfe..3f75364081 100644 --- a/docs/en/14-reference/13-schemaless/13-schemaless.md +++ b/docs/en/14-reference/13-schemaless/13-schemaless.md @@ -84,7 +84,7 @@ You can configure smlChildTableName in taos.cfg to specify table names, for exam :::tip All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed -16KB. See [TDengine SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area. +48KB, and the total length of tag value cannot exceed 16KB. See [TDengine SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area. ::: diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index a8a5c7af6f..7d45110bb0 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.9 + + + ## 2.4.8 diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index 3ea4b10a96..cad6f99ac8 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -263,6 +263,14 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) - `int taos_select_db(TAOS *taos, const char *db)` 将当前的缺省数据库设置为 `db`。 + +- `int taos_get_current_db(TAOS *taos, char *database, int len, int *required)` + + - database,len为用户在外面申请的空间,内部会把当前db赋值到database里。 + - 只要是没有正常把db名赋值到database中(包括截断),返回错误,返回值为-1,然后用户可以通过 taos_errstr(NULL) 来获取错误提示。 + - 如果,database == NULL 或者 len<=0 返回错误,required里保存存储db需要的空间(包含最后的'\0') + - 如果,len 小于 存储db需要的空间(包含最后的'\0'),返回错误,database里赋值截断的数据,以’\0‘结尾。 + - 如果,len 大于等于 存储db需要的空间(包含最后的'\0'),返回正常0,database里赋值以’\0‘结尾的db名。 - `void taos_close(TAOS *taos)` @@ -493,5 +501,17 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 需要注意的是,时间戳分辨率参数只在协议类型为 `SML_LINE_PROTOCOL` 的时候生效。 对于 OpenTSDB 的文本协议,时间戳的解析遵循其官方解析规则 — 按照时间戳包含的字符的数量来确认时间精度。 - **支持版本** - 该功能接口从 2.3.0.0 版本开始支持。 + **schemaless 其他相关的接口** +- `TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision)` +- `TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid)` + + **说明** + - 上面这7个接口是扩展接口,主要用于在schemaless写入时传递ttl、reqid参数,可以根据需要使用。 + - 带_raw的接口通过传递的参数lines指针和长度len来表示数据,为了解决原始接口数据包含'\0'而被截断的问题。totalRows指针返回解析出来的数据行数。 + - 带_ttl的接口可以传递ttl参数来控制建表的ttl到期时间。 + - 带_reqid的接口可以通过传递reqid参数来追踪整个的调用链。 diff --git a/docs/zh/08-connector/30-python.mdx b/docs/zh/08-connector/30-python.mdx index 9c88402bb4..b57f02ac80 100644 --- a/docs/zh/08-connector/30-python.mdx +++ b/docs/zh/08-connector/30-python.mdx @@ -32,7 +32,7 @@ Python 连接器的源码托管在 [GitHub](https://github.com/taosdata/taos-con ### 准备 -1. 安装 Python。新近版本 taospy 包要求 Python 3.6+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 +1. 安装 Python。新近版本 taospy 包要求 Python 3.6.2+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 2. 安装 [pip](https://pypi.org/project/pip/)。大部分情况下 Python 的安装包都自带了 pip 工具, 如果没有请参考 [pip documentation](https://pip.pypa.io/en/stable/installation/) 安装。 3. 如果使用原生连接,还需[安装客户端驱动](../#安装客户端驱动)。客户端软件包含了 TDengine 客户端动态链接库(libtaos.so 或 taos.dll) 和 TDengine CLI。 diff --git a/docs/zh/08-connector/index.md b/docs/zh/08-connector/index.md index f3f0f23b34..eb1f3a9a9a 100644 --- a/docs/zh/08-connector/index.md +++ b/docs/zh/08-connector/index.md @@ -60,7 +60,7 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器 | **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **参数绑定** | 暂不支持 | 暂不支持 | 支持 | 支持 | 暂不支持 | 支持 | -| **数据订阅(TMQ)** | 暂不支持 | 支持 | 支持 | 暂不支持 | 暂不支持 | 支持 | +| **数据订阅(TMQ)** | 支持 | 支持 | 支持 | 暂不支持 | 暂不支持 | 支持 | | **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | | **批量拉取(基于 WebSocket)** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | diff --git a/docs/zh/14-reference/07-tdinsight/index.mdx b/docs/zh/14-reference/07-tdinsight/index.mdx index 8ec11378ee..319fa8df53 100644 --- a/docs/zh/14-reference/07-tdinsight/index.mdx +++ b/docs/zh/14-reference/07-tdinsight/index.mdx @@ -140,10 +140,10 @@ Install and configure TDinsight dashboard in Grafana on Ubuntu 18.04/20.04 syste | -n | --tdengine-ds-name | TDENGINE_DS_NAME | TDengine 数据源名称,默认为 TDengine。 | | -a | --tdengine-api | TDENGINE_API | TDengine REST API 端点。默认为`http://127.0.0.1:6041`。 | | -u | --tdengine-user | TDENGINE_USER | TDengine 用户名。 [默认值:root] | -| -p | --tdengine-密码 | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | +| -p | --tdengine-password | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | | -i | --tdinsight-uid | TDINSIGHT_DASHBOARD_UID | TDinsight 仪表盘`uid`。 [默认值:tdinsight] | | -t | --tdinsight-title | TDINSIGHT_DASHBOARD_TITLE | TDinsight 仪表盘标题。 [默认:TDinsight] | -| -e | --tdinsight-可编辑 | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | +| -e | --tdinsight-editable | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | | -E | --external-notifier | EXTERNAL_NOTIFIER | 将外部通知程序 uid 应用于 TDinsight 仪表盘。 | 假设您在主机 `tdengine` 上启动 TDengine 数据库,HTTP API 端口为 `6041`,用户为 `root1`,密码为 `pass5ord`。执行脚本: diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index f8724fcf96..6eeb577ab5 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -609,7 +609,7 @@ charset 的有效值是 UTF-8。 | 适用范围 | 仅客户端适用 | | 含义 | schemaless 列数据是否顺序一致,从3.0.3.0开始,该配置废弃 | | 值域 | 0:不一致;1: 一致 | -| 缺省值 | 1 | +| 缺省值 | 0 | ## 其他 diff --git a/docs/zh/14-reference/13-schemaless/13-schemaless.md b/docs/zh/14-reference/13-schemaless/13-schemaless.md index 3d0bac25d2..e5f232c1fc 100644 --- a/docs/zh/14-reference/13-schemaless/13-schemaless.md +++ b/docs/zh/14-reference/13-schemaless/13-schemaless.md @@ -87,7 +87,7 @@ st,t1=3,t2=4,t3=t3 c1=3i64,c3="passit",c2=false,c4=4f64 1626006833639000000 :::tip 无模式所有的处理逻辑,仍会遵循 TDengine 对数据结构的底层限制,例如每行数据的总长度不能超过 -16KB。这方面的具体限制约束请参见 [TDengine SQL 边界限制](/taos-sql/limit) +48KB,标签值的总长度不超过16KB。这方面的具体限制约束请参见 [TDengine SQL 边界限制](/taos-sql/limit) ::: diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index a69c901fcb..a9c9ea5ac7 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.9 + + + ## 2.4.8 diff --git a/include/common/tglobal.h b/include/common/tglobal.h index b35b460211..ac75b84762 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -74,6 +74,10 @@ extern int32_t tsHeartbeatTimeout; // vnode extern int64_t tsVndCommitMaxIntervalMs; +// mnode +extern int64_t tsMndSdbWriteDelta; +extern int64_t tsMndLogRetention; + // monitor extern bool tsEnableMonitor; extern int32_t tsMonitorInterval; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index cd63f7d278..17fde6a536 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -66,6 +66,15 @@ extern int32_t tMsgDict[]; typedef uint16_t tmsg_t; +static inline bool tmsgIsValid(tmsg_t type) { + if (type < TDMT_DND_MAX_MSG || type < TDMT_MND_MAX_MSG || type < TDMT_VND_MAX_MSG || type < TDMT_SCH_MAX_MSG || + type < TDMT_STREAM_MAX_MSG || type < TDMT_MON_MAX_MSG || type < TDMT_SYNC_MAX_MSG || type < TDMT_VND_STREAM_MSG || + type < TDMT_VND_TMQ_MSG || type < TDMT_VND_TMQ_MAX_MSG) { + return true; + } else { + return false; + } +} static inline bool vnodeIsMsgBlock(tmsg_t type) { return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) || (type == TDMT_VND_UPDATE_TAG_VAL) || (type == TDMT_VND_ALTER_CONFIRM); @@ -603,6 +612,7 @@ typedef struct { char user[TSDB_USER_LEN]; char passwd[TSDB_PASSWORD_LEN]; int64_t startTime; + char sVer[TSDB_VERSION_LEN]; } SConnectReq; int32_t tSerializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq); @@ -929,12 +939,19 @@ typedef struct { int32_t minRows; int32_t maxRows; int32_t walFsyncPeriod; + int16_t hashPrefix; + int16_t hashSuffix; int8_t walLevel; int8_t precision; int8_t compression; int8_t replications; int8_t strict; int8_t cacheLast; + int32_t tsdbPageSize; + int32_t walRetentionPeriod; + int32_t walRollPeriod; + int64_t walRetentionSize; + int64_t walSegmentSize; int32_t numOfRetensions; SArray* pRetensions; int8_t schemaless; @@ -1015,7 +1032,8 @@ int32_t tDeserializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchR void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp); typedef struct { - char db[TSDB_DB_FNAME_LEN]; + char db[TSDB_DB_FNAME_LEN]; + STimeWindow timeRange; } SCompactDbReq; int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq); @@ -1274,9 +1292,10 @@ int32_t tSerializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq); int32_t tDeserializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq); typedef struct { - int64_t dbUid; - char db[TSDB_DB_FNAME_LEN]; - int64_t compactStartTime; + int64_t dbUid; + char db[TSDB_DB_FNAME_LEN]; + int64_t compactStartTime; + STimeWindow tw; } SCompactVnodeReq; int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq); @@ -1812,7 +1831,7 @@ typedef struct { #define STREAM_TRIGGER_AT_ONCE 1 #define STREAM_TRIGGER_WINDOW_CLOSE 2 #define STREAM_TRIGGER_MAX_DELAY 3 -#define STREAM_DEFAULT_IGNORE_EXPIRED 0 +#define STREAM_DEFAULT_IGNORE_EXPIRED 1 #define STREAM_FILL_HISTORY_ON 1 #define STREAM_FILL_HISTORY_OFF 0 #define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF @@ -1904,10 +1923,10 @@ typedef struct { } SMqConsumerLostMsg, SMqConsumerRecoverMsg, SMqConsumerClearMsg; typedef struct { - int64_t consumerId; - char cgroup[TSDB_CGROUP_LEN]; - char clientId[256]; - SArray* topicNames; // SArray + int64_t consumerId; + char cgroup[TSDB_CGROUP_LEN]; + char clientId[256]; + SArray* topicNames; // SArray } SCMSubscribeReq; static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) { @@ -2684,7 +2703,7 @@ typedef struct { char subKey[TSDB_SUBSCRIBE_KEY_LEN]; int8_t subType; int8_t withMeta; - char* qmsg; + char* qmsg; // SubPlanToString int64_t suid; } SMqRebVgReq; diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index d1a81fd996..1235dd3447 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -110,169 +110,169 @@ #define TK_TABLE_SUFFIX 92 #define TK_NK_COLON 93 #define TK_MAX_SPEED 94 -#define TK_TABLE 95 -#define TK_NK_LP 96 -#define TK_NK_RP 97 -#define TK_STABLE 98 -#define TK_ADD 99 -#define TK_COLUMN 100 -#define TK_MODIFY 101 -#define TK_RENAME 102 -#define TK_TAG 103 -#define TK_SET 104 -#define TK_NK_EQ 105 -#define TK_USING 106 -#define TK_TAGS 107 -#define TK_COMMENT 108 -#define TK_BOOL 109 -#define TK_TINYINT 110 -#define TK_SMALLINT 111 -#define TK_INT 112 -#define TK_INTEGER 113 -#define TK_BIGINT 114 -#define TK_FLOAT 115 -#define TK_DOUBLE 116 -#define TK_BINARY 117 -#define TK_TIMESTAMP 118 -#define TK_NCHAR 119 -#define TK_UNSIGNED 120 -#define TK_JSON 121 -#define TK_VARCHAR 122 -#define TK_MEDIUMBLOB 123 -#define TK_BLOB 124 -#define TK_VARBINARY 125 -#define TK_DECIMAL 126 -#define TK_MAX_DELAY 127 -#define TK_WATERMARK 128 -#define TK_ROLLUP 129 -#define TK_TTL 130 -#define TK_SMA 131 -#define TK_DELETE_MARK 132 -#define TK_FIRST 133 -#define TK_LAST 134 -#define TK_SHOW 135 -#define TK_PRIVILEGES 136 -#define TK_DATABASES 137 -#define TK_TABLES 138 -#define TK_STABLES 139 -#define TK_MNODES 140 -#define TK_QNODES 141 -#define TK_FUNCTIONS 142 -#define TK_INDEXES 143 -#define TK_ACCOUNTS 144 -#define TK_APPS 145 -#define TK_CONNECTIONS 146 -#define TK_LICENCES 147 -#define TK_GRANTS 148 -#define TK_QUERIES 149 -#define TK_SCORES 150 -#define TK_TOPICS 151 -#define TK_VARIABLES 152 -#define TK_CLUSTER 153 -#define TK_BNODES 154 -#define TK_SNODES 155 -#define TK_TRANSACTIONS 156 -#define TK_DISTRIBUTED 157 -#define TK_CONSUMERS 158 -#define TK_SUBSCRIPTIONS 159 -#define TK_VNODES 160 -#define TK_ALIVE 161 -#define TK_LIKE 162 -#define TK_TBNAME 163 -#define TK_QTAGS 164 -#define TK_AS 165 -#define TK_INDEX 166 -#define TK_FUNCTION 167 -#define TK_INTERVAL 168 -#define TK_COUNT 169 -#define TK_LAST_ROW 170 -#define TK_TOPIC 171 -#define TK_WITH 172 -#define TK_META 173 -#define TK_CONSUMER 174 -#define TK_GROUP 175 -#define TK_DESC 176 -#define TK_DESCRIBE 177 -#define TK_RESET 178 -#define TK_QUERY 179 -#define TK_CACHE 180 -#define TK_EXPLAIN 181 -#define TK_ANALYZE 182 -#define TK_VERBOSE 183 -#define TK_NK_BOOL 184 -#define TK_RATIO 185 -#define TK_NK_FLOAT 186 -#define TK_OUTPUTTYPE 187 -#define TK_AGGREGATE 188 -#define TK_BUFSIZE 189 -#define TK_LANGUAGE 190 -#define TK_STREAM 191 -#define TK_INTO 192 -#define TK_TRIGGER 193 -#define TK_AT_ONCE 194 -#define TK_WINDOW_CLOSE 195 -#define TK_IGNORE 196 -#define TK_EXPIRED 197 -#define TK_FILL_HISTORY 198 -#define TK_UPDATE 199 -#define TK_SUBTABLE 200 -#define TK_KILL 201 -#define TK_CONNECTION 202 -#define TK_TRANSACTION 203 -#define TK_BALANCE 204 -#define TK_VGROUP 205 -#define TK_MERGE 206 -#define TK_REDISTRIBUTE 207 -#define TK_SPLIT 208 -#define TK_DELETE 209 -#define TK_INSERT 210 -#define TK_NULL 211 -#define TK_NK_QUESTION 212 -#define TK_NK_ARROW 213 -#define TK_ROWTS 214 -#define TK_QSTART 215 -#define TK_QEND 216 -#define TK_QDURATION 217 -#define TK_WSTART 218 -#define TK_WEND 219 -#define TK_WDURATION 220 -#define TK_IROWTS 221 -#define TK_ISFILLED 222 -#define TK_CAST 223 -#define TK_NOW 224 -#define TK_TODAY 225 -#define TK_TIMEZONE 226 -#define TK_CLIENT_VERSION 227 -#define TK_SERVER_VERSION 228 -#define TK_SERVER_STATUS 229 -#define TK_CURRENT_USER 230 -#define TK_CASE 231 -#define TK_END 232 -#define TK_WHEN 233 -#define TK_THEN 234 -#define TK_ELSE 235 -#define TK_BETWEEN 236 -#define TK_IS 237 -#define TK_NK_LT 238 -#define TK_NK_GT 239 -#define TK_NK_LE 240 -#define TK_NK_GE 241 -#define TK_NK_NE 242 -#define TK_MATCH 243 -#define TK_NMATCH 244 -#define TK_CONTAINS 245 -#define TK_IN 246 -#define TK_JOIN 247 -#define TK_INNER 248 -#define TK_SELECT 249 -#define TK_DISTINCT 250 -#define TK_WHERE 251 -#define TK_PARTITION 252 -#define TK_BY 253 -#define TK_SESSION 254 -#define TK_STATE_WINDOW 255 -#define TK_EVENT_WINDOW 256 -#define TK_START 257 +#define TK_START 95 +#define TK_WITH 96 +#define TK_TIMESTAMP 97 +#define TK_END 98 +#define TK_TABLE 99 +#define TK_NK_LP 100 +#define TK_NK_RP 101 +#define TK_STABLE 102 +#define TK_ADD 103 +#define TK_COLUMN 104 +#define TK_MODIFY 105 +#define TK_RENAME 106 +#define TK_TAG 107 +#define TK_SET 108 +#define TK_NK_EQ 109 +#define TK_USING 110 +#define TK_TAGS 111 +#define TK_COMMENT 112 +#define TK_BOOL 113 +#define TK_TINYINT 114 +#define TK_SMALLINT 115 +#define TK_INT 116 +#define TK_INTEGER 117 +#define TK_BIGINT 118 +#define TK_FLOAT 119 +#define TK_DOUBLE 120 +#define TK_BINARY 121 +#define TK_NCHAR 122 +#define TK_UNSIGNED 123 +#define TK_JSON 124 +#define TK_VARCHAR 125 +#define TK_MEDIUMBLOB 126 +#define TK_BLOB 127 +#define TK_VARBINARY 128 +#define TK_DECIMAL 129 +#define TK_MAX_DELAY 130 +#define TK_WATERMARK 131 +#define TK_ROLLUP 132 +#define TK_TTL 133 +#define TK_SMA 134 +#define TK_DELETE_MARK 135 +#define TK_FIRST 136 +#define TK_LAST 137 +#define TK_SHOW 138 +#define TK_PRIVILEGES 139 +#define TK_DATABASES 140 +#define TK_TABLES 141 +#define TK_STABLES 142 +#define TK_MNODES 143 +#define TK_QNODES 144 +#define TK_FUNCTIONS 145 +#define TK_INDEXES 146 +#define TK_ACCOUNTS 147 +#define TK_APPS 148 +#define TK_CONNECTIONS 149 +#define TK_LICENCES 150 +#define TK_GRANTS 151 +#define TK_QUERIES 152 +#define TK_SCORES 153 +#define TK_TOPICS 154 +#define TK_VARIABLES 155 +#define TK_CLUSTER 156 +#define TK_BNODES 157 +#define TK_SNODES 158 +#define TK_TRANSACTIONS 159 +#define TK_DISTRIBUTED 160 +#define TK_CONSUMERS 161 +#define TK_SUBSCRIPTIONS 162 +#define TK_VNODES 163 +#define TK_ALIVE 164 +#define TK_LIKE 165 +#define TK_TBNAME 166 +#define TK_QTAGS 167 +#define TK_AS 168 +#define TK_INDEX 169 +#define TK_FUNCTION 170 +#define TK_INTERVAL 171 +#define TK_COUNT 172 +#define TK_LAST_ROW 173 +#define TK_TOPIC 174 +#define TK_META 175 +#define TK_CONSUMER 176 +#define TK_GROUP 177 +#define TK_DESC 178 +#define TK_DESCRIBE 179 +#define TK_RESET 180 +#define TK_QUERY 181 +#define TK_CACHE 182 +#define TK_EXPLAIN 183 +#define TK_ANALYZE 184 +#define TK_VERBOSE 185 +#define TK_NK_BOOL 186 +#define TK_RATIO 187 +#define TK_NK_FLOAT 188 +#define TK_OUTPUTTYPE 189 +#define TK_AGGREGATE 190 +#define TK_BUFSIZE 191 +#define TK_LANGUAGE 192 +#define TK_STREAM 193 +#define TK_INTO 194 +#define TK_TRIGGER 195 +#define TK_AT_ONCE 196 +#define TK_WINDOW_CLOSE 197 +#define TK_IGNORE 198 +#define TK_EXPIRED 199 +#define TK_FILL_HISTORY 200 +#define TK_UPDATE 201 +#define TK_SUBTABLE 202 +#define TK_KILL 203 +#define TK_CONNECTION 204 +#define TK_TRANSACTION 205 +#define TK_BALANCE 206 +#define TK_VGROUP 207 +#define TK_MERGE 208 +#define TK_REDISTRIBUTE 209 +#define TK_SPLIT 210 +#define TK_DELETE 211 +#define TK_INSERT 212 +#define TK_NULL 213 +#define TK_NK_QUESTION 214 +#define TK_NK_ARROW 215 +#define TK_ROWTS 216 +#define TK_QSTART 217 +#define TK_QEND 218 +#define TK_QDURATION 219 +#define TK_WSTART 220 +#define TK_WEND 221 +#define TK_WDURATION 222 +#define TK_IROWTS 223 +#define TK_ISFILLED 224 +#define TK_CAST 225 +#define TK_NOW 226 +#define TK_TODAY 227 +#define TK_TIMEZONE 228 +#define TK_CLIENT_VERSION 229 +#define TK_SERVER_VERSION 230 +#define TK_SERVER_STATUS 231 +#define TK_CURRENT_USER 232 +#define TK_CASE 233 +#define TK_WHEN 234 +#define TK_THEN 235 +#define TK_ELSE 236 +#define TK_BETWEEN 237 +#define TK_IS 238 +#define TK_NK_LT 239 +#define TK_NK_GT 240 +#define TK_NK_LE 241 +#define TK_NK_GE 242 +#define TK_NK_NE 243 +#define TK_MATCH 244 +#define TK_NMATCH 245 +#define TK_CONTAINS 246 +#define TK_IN 247 +#define TK_JOIN 248 +#define TK_INNER 249 +#define TK_SELECT 250 +#define TK_DISTINCT 251 +#define TK_WHERE 252 +#define TK_PARTITION 253 +#define TK_BY 254 +#define TK_SESSION 255 +#define TK_STATE_WINDOW 256 +#define TK_EVENT_WINDOW 257 #define TK_SLIDING 258 #define TK_FILL 259 #define TK_VALUE 260 diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 095d2f6d10..c3d2010351 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -219,6 +219,7 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo); int32_t qStreamRestoreParam(qTaskInfo_t tinfo); bool qStreamRecoverScanFinished(qTaskInfo_t tinfo); void qStreamCloseTsdbReader(void* task); +void resetTaskInfo(qTaskInfo_t tinfo); #ifdef __cplusplus } diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e9d6aca1f9..fefcc28bc2 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -41,14 +41,15 @@ extern "C" { #define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_ALIVE_RESULT_COLS 1 -#define PRIVILEGE_TYPE_MASK(n) (1 << n) -#define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0) -#define PRIVILEGE_TYPE_READ PRIVILEGE_TYPE_MASK(1) -#define PRIVILEGE_TYPE_WRITE PRIVILEGE_TYPE_MASK(2) -#define PRIVILEGE_TYPE_SUBSCRIBE PRIVILEGE_TYPE_MASK(3) +#define BIT_FLAG_MASK(n) (1 << n) +#define BIT_FLAG_SET_MASK(val, mask) ((val) |= (mask)) +#define BIT_FLAG_TEST_MASK(val, mask) (((val) & (mask)) != 0) -#define PRIVILEGE_TYPE_TEST_MASK(val, mask) (((val) & (mask)) != 0) +#define PRIVILEGE_TYPE_ALL BIT_FLAG_MASK(0) +#define PRIVILEGE_TYPE_READ BIT_FLAG_MASK(1) +#define PRIVILEGE_TYPE_WRITE BIT_FLAG_MASK(2) +#define PRIVILEGE_TYPE_SUBSCRIBE BIT_FLAG_MASK(3) typedef struct SDatabaseOptions { ENodeType type; @@ -127,6 +128,8 @@ typedef struct STrimDatabaseStmt { typedef struct SCompactDatabaseStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; + SNode* pStart; + SNode* pEnd; } SCompactDatabaseStmt; typedef struct STableOptions { @@ -265,6 +268,7 @@ typedef struct SShowStmt { typedef struct SShowCreateDatabaseStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; void* pCfg; // SDbCfgInfo } SShowCreateDatabaseStmt; @@ -392,6 +396,15 @@ typedef struct SKillQueryStmt { char queryId[TSDB_QUERY_ID_LEN]; } SKillQueryStmt; +typedef enum EStreamOptionsSetFlag { + SOPT_TRIGGER_TYPE_SET = BIT_FLAG_MASK(0), + SOPT_WATERMARK_SET = BIT_FLAG_MASK(1), + SOPT_DELETE_MARK_SET = BIT_FLAG_MASK(2), + SOPT_FILL_HISTORY_SET = BIT_FLAG_MASK(3), + SOPT_IGNORE_EXPIRED_SET = BIT_FLAG_MASK(4), + SOPT_IGNORE_UPDATE_SET = BIT_FLAG_MASK(5), +} EStreamOptionsSetFlag; + typedef struct SStreamOptions { ENodeType type; int8_t triggerType; @@ -401,6 +414,7 @@ typedef struct SStreamOptions { int8_t fillHistory; int8_t ignoreExpired; int8_t ignoreUpdate; + int64_t setFlag; } SStreamOptions; typedef struct SCreateStreamStmt { diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 5e37da4f3f..189484d1a6 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -35,7 +35,6 @@ extern "C" { #define SYNC_MAX_RECV_TIME_RANGE_MS 1200 #define SYNC_DEL_WAL_MS (1000 * 60) #define SYNC_ADD_QUORUM_COUNT 3 -#define SYNC_MNODE_LOG_RETENTION 10000 #define SYNC_VNODE_LOG_RETENTION (TSDB_SYNC_LOG_BUFFER_RETENTION + 1) #define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10 #define SNAPSHOT_WAIT_MS 1000 * 30 diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 29f36f3d0c..0d959271c0 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -116,6 +116,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B) #define TSDB_CODE_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x012C) #define TSDB_CODE_MSG_ENCODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x012D) +#define TSDB_CODE_NO_ENOUGH_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012E) #define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) // #define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) // diff --git a/include/util/tversion.h b/include/util/tversion.h index c924752a01..f5c42b2a22 100644 --- a/include/util/tversion.h +++ b/include/util/tversion.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_UTIL_VERSION_H_ -#define _TD_UTIL_VERSION_H_ +#ifndef _TD_UTIL_TVERSION_H_ +#define _TD_UTIL_TVERSION_H_ #include "os.h" @@ -25,9 +25,11 @@ extern "C" { int32_t taosVersionStrToInt(const char *vstr, int32_t *vint); int32_t taosVersionIntToStr(int32_t vint, char *vstr, int32_t len); int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t comparedSegments); +int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion, + int32_t comparedSegments); #ifdef __cplusplus } #endif -#endif /*_TD_UTIL_VERSION_H_*/ +#endif /*_TD_UTIL_TVERSION_H_*/ diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 5aeff0e2fa..2495e177e1 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -34,6 +34,7 @@ benchmarkName="taosBenchmark" dumpName="taosdump" demoName="taosdemo" xname="taosx" +explorerName="${clientName}-explorer" clientName2="taos" serverName2="taosd" @@ -214,6 +215,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/${benchmarkName} || : ${csudo}rm -f ${bin_link_dir}/${dumpName} || : ${csudo}rm -f ${bin_link_dir}/${xname} || : + ${csudo}rm -f ${bin_link_dir}/${explorerName} || : ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : @@ -228,6 +230,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || : [ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || : [ -x ${install_main_dir}/bin/${xname} ] && ${csudo}ln -s ${install_main_dir}/bin/${xname} ${bin_link_dir}/${xname} || : + [ -x ${install_main_dir}/bin/${explorerName} ] && ${csudo}ln -s ${install_main_dir}/bin/${explorerName} ${bin_link_dir}/${explorerName} || : [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index f5ed1cdf66..3996495aca 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -70,6 +70,9 @@ if %Enterprise% == TRUE ( if exist %binary_dir%\\build\\bin\\taosx.exe ( copy %binary_dir%\\build\\bin\\taosx.exe %target_dir% > nul ) + if exist %binary_dir%\\build\\bin\\taos-explorer.exe ( + copy %binary_dir%\\build\\bin\\taos-explorer.exe %target_dir% > nul + ) if exist %binary_dir%\\build\\bin\\tmq_sim.exe ( copy %binary_dir%\\build\\bin\\tmq_sim.exe %target_dir% > nul ) @@ -91,6 +94,9 @@ if %Enterprise% == TRUE ( if exist %binary_dir%\\build\\bin\\create_table.exe ( copy %binary_dir%\\build\\bin\\create_table.exe %target_dir% > nul ) + if exist %binary_dir%\\build\\bin\\*explorer.exe ( + copy %binary_dir%\\build\\bin\\*explorer.exe %target_dir% > nul + ) ) copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 5725560bd6..87c72c6a7c 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -200,6 +200,7 @@ function install_bin() { [ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/udfd ] && ${csudo}cp -r ${binary_dir}/build/bin/udfd ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/taosx ] && ${csudo}cp -r ${binary_dir}/build/bin/taosx ${install_main_dir}/bin || : + [ -f ${binary_dir}/build/bin/*explorer ] && ${csudo}cp -r ${binary_dir}/build/bin/*explorer ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || : ${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin || : @@ -212,6 +213,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump > /dev/null 2>&1 || : [ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosx ] && ${csudo}ln -s ${install_main_dir}/bin/taosx ${bin_link_dir}/taosx > /dev/null 2>&1 || : + [ -x ${install_main_dir}/bin/*explorer ] && ${csudo}ln -s ${install_main_dir}/bin/*explorer ${bin_link_dir}/*explorer > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} > /dev/null 2>&1 || : fi } diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 0a34d81b7f..7ad3cf7b0a 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -89,11 +89,13 @@ else ${build_dir}/bin/tdengine-datasource.zip \ ${build_dir}/bin/tdengine-datasource.zip.md5sum" [ -f ${build_dir}/bin/taosx ] && taosx_bin="${build_dir}/bin/taosx" + explorer_bin_files=$(find ${build_dir}/bin/ -name '*-explorer') bin_files="${build_dir}/bin/${serverName} \ ${build_dir}/bin/${clientName} \ ${taostools_bin_files} \ ${taosx_bin} \ + ${explorer_bin_files} \ ${build_dir}/bin/taosadapter \ ${build_dir}/bin/udfd \ ${script_dir}/remove.sh \ diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 78eb7f7587..b2fc488a19 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -185,6 +185,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/taosdump || : ${csudo}rm -f ${bin_link_dir}/rmtaos || : ${csudo}rm -f ${bin_link_dir}/set_core || : + ${csudo}rm -f ${bin_link_dir}/*explorer || : ${csudo}chmod 0555 ${bin_dir}/* @@ -220,6 +221,9 @@ function install_bin() { if [ -x ${bin_dir}/taoskeeper ]; then ${csudo}ln -sf ${bin_dir}/taoskeeper ${bin_link_dir}/taoskeeper 2>>${install_log_path} || return 1 fi + if [ -x ${bin_dir}/*explorer ]; then + ${csudo}ln -s ${bin_dir}/*explorer ${bin_link_dir}/*explorer 2>>${install_log_path} || return 1 + fi log_print "install bin success" } diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 9c50c4582d..2479e48670 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -119,6 +119,7 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : ${csudo}rm -f ${bin_link_dir}/taoskeeper || : ${csudo}rm -f ${bin_link_dir}/taosx || : + ${csudo}rm -f ${bin_link_dir}/taos-explorer || : if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then ${csudo}rm -f ${bin_link_dir}/${clientName2} || : diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 7cc7a1717a..b10daa9c21 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -66,7 +66,8 @@ enum { typedef struct SAppInstInfo SAppInstInfo; typedef struct { - char* key; + char* key; + int32_t idx; // statistics int32_t reportCnt; int32_t connKeyCnt; diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 3dcba673bf..d8d41d8be6 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -190,7 +190,7 @@ typedef struct { // SArray *preLineTagKV; SArray *maxTagKVs; - SArray *preLineColKV; + SArray *masColKVs; SSmlLineInfo preLine; STableMeta *currSTableMeta; diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 79c5baf43d..e3e20ee85d 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -159,9 +159,9 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) { rpcInit.retryMaxInterval = tsRedirectMaxPeriod; rpcInit.retryMaxTimouet = tsMaxRetryWaitTime; - int32_t connLimitNum = tsNumOfRpcSessions / (tsNumOfRpcThreads * 5); + int32_t connLimitNum = tsNumOfRpcSessions / (tsNumOfRpcThreads * 3); connLimitNum = TMAX(connLimitNum, 10); - connLimitNum = TMIN(connLimitNum, 500); + connLimitNum = TMIN(connLimitNum, 1000); rpcInit.connLimitNum = connLimitNum; rpcInit.timeToGetConn = tsTimeToGetAvailableConn; diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index b5838386db..c9c2e7a5f8 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -303,8 +303,12 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { } static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { + if (0 == atomic_load_8(&clientHbMgr.inited)) { + goto _return; + } + static int32_t emptyRspNum = 0; - char *key = (char *)param; + int32_t idx = *(int32_t *)param; SClientHbBatchRsp pRsp = {0}; if (TSDB_CODE_SUCCESS == code) { tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp); @@ -319,22 +323,24 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { int32_t rspNum = taosArrayGetSize(pRsp.rsps); - taosThreadMutexLock(&appInfo.mutex); + taosThreadMutexLock(&clientHbMgr.lock); - SAppInstInfo **pInst = taosHashGet(appInfo.pInstMap, key, strlen(key)); - if (pInst == NULL || NULL == *pInst) { - taosThreadMutexUnlock(&appInfo.mutex); - tscError("cluster not exist, key:%s", key); + SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, idx); + if (pAppHbMgr == NULL) { + taosThreadMutexUnlock(&clientHbMgr.lock); + tscError("appHbMgr not exist, idx:%d", idx); taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); tFreeClientHbBatchRsp(&pRsp); return -1; } + SAppInstInfo *pInst = pAppHbMgr->pAppInstInfo; + if (code != 0) { - (*pInst)->onlineDnodes = ((*pInst)->totalDnodes ? 0 : -1); - tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), (*pInst)->onlineDnodes, - (*pInst)->totalDnodes); + pInst->onlineDnodes = pInst->totalDnodes ? 0 : -1; + tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), pInst->onlineDnodes, + pInst->totalDnodes); } if (rspNum) { @@ -346,15 +352,17 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { for (int32_t i = 0; i < rspNum; ++i) { SClientHbRsp *rsp = taosArrayGet(pRsp.rsps, i); - code = (*clientHbMgr.rspHandle[rsp->connKey.connType])((*pInst)->pAppHbMgr, rsp); + code = (*clientHbMgr.rspHandle[rsp->connKey.connType])(pAppHbMgr, rsp); if (code) { break; } } - taosThreadMutexUnlock(&appInfo.mutex); + taosThreadMutexUnlock(&clientHbMgr.lock); tFreeClientHbBatchRsp(&pRsp); + +_return: taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); return code; @@ -788,7 +796,8 @@ static void *hbThreadFunc(void *param) { pInfo->msgInfo.pData = buf; pInfo->msgInfo.len = tlen; pInfo->msgType = TDMT_MND_HEARTBEAT; - pInfo->param = taosStrdup(pAppHbMgr->key); + pInfo->param = taosMemoryMalloc(sizeof(int32_t)); + *(int32_t *)pInfo->param = i; pInfo->paramFreeFp = taosMemoryFree; pInfo->requestId = generateRequestId(); pInfo->requestObjRefId = 0; @@ -874,6 +883,7 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) { taosThreadMutexLock(&clientHbMgr.lock); taosArrayPush(clientHbMgr.appHbMgrs, &pAppHbMgr); + pAppHbMgr->idx = taosArrayGetSize(clientHbMgr.appHbMgrs) - 1; taosThreadMutexUnlock(&clientHbMgr.lock); return pAppHbMgr; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d19f9dce79..d5247d4b8a 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1307,6 +1307,7 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) { tstrncpy(connectReq.app, appInfo.appName, sizeof(connectReq.app)); tstrncpy(connectReq.user, pObj->user, sizeof(connectReq.user)); tstrncpy(connectReq.passwd, pObj->pass, sizeof(connectReq.passwd)); + tstrncpy(connectReq.sVer, version, sizeof(connectReq.sVer)); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = taosMemoryMalloc(contLen); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 025d38e15d..63db9a679c 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -271,6 +271,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { SReqResultInfo *pResultInfo; if (msg->resIter == -1) { pResultInfo = tmqGetNextResInfo(res, true); + tscDebug("consumer:0x%" PRIx64 ", vgId:%d, numOfRows:%" PRId64 ", total rows:%" PRId64, msg->rsp.head.consumerId, + msg->vgId, pResultInfo->numOfRows, pResultInfo->totalRows); } else { pResultInfo = tmqGetCurResInfo(res); } @@ -281,7 +283,13 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { return pResultInfo->row; } else { pResultInfo = tmqGetNextResInfo(res, true); - if (pResultInfo == NULL) return NULL; + if (pResultInfo == NULL) { + return NULL; + } + + tscDebug("consumer:0x%" PRIx64 " vgId:%d, numOfRows:%" PRId64 ", total rows:%" PRId64, msg->rsp.head.consumerId, + msg->vgId, pResultInfo->numOfRows, pResultInfo->totalRows); + doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; return pResultInfo->row; diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 375925d577..21590022b1 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -18,10 +18,12 @@ #include "clientLog.h" #include "os.h" #include "query.h" -#include "tdef.h" -#include "tname.h" -#include "tdatablock.h" #include "systable.h" +#include "tdatablock.h" +#include "tdef.h" +#include "tglobal.h" +#include "tname.h" +#include "tversion.h" static void setErrno(SRequestObj* pRequest, int32_t code) { pRequest->code = code; @@ -47,11 +49,11 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) { } int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { - SRequestObj *pRequest = acquireRequest(*(int64_t*)param); + SRequestObj* pRequest = acquireRequest(*(int64_t*)param); if (NULL == pRequest) { goto End; } - + if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); tsem_post(&pRequest->body.rspSem); @@ -65,7 +67,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { tsem_post(&pRequest->body.rspSem); goto End; } - + SConnectRsp connectRsp = {0}; if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) { code = TSDB_CODE_TSC_INVALID_VERSION; @@ -74,6 +76,12 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { goto End; } + if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 2)) != 0) { + setErrno(pRequest, code); + tsem_post(&pRequest->body.rspSem); + goto End; + } + int32_t now = taosGetTimestampSec(); int32_t delta = abs(now - connectRsp.svrTimestamp); if (delta > timestampDeltaLimit) { @@ -127,14 +135,14 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, pTscObj->pAppInfo->numOfConns); - + tsem_post(&pRequest->body.rspSem); End: if (pRequest) { releaseRequest(pRequest->self); } - + taosMemoryFree(param); taosMemoryFree(pMsg->pEpSet); taosMemoryFree(pMsg->pData); @@ -166,18 +174,18 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) { struct SCatalog* pCatalog = NULL; int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { - STscObj* pTscObj = pRequest->pTscObj; + STscObj* pTscObj = pRequest->pTscObj; SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; - char dbFName[TSDB_DB_FNAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); - } + } } if (pRequest->body.queryFp) { @@ -197,7 +205,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp); struct SCatalog* pCatalog = NULL; - if (usedbRsp.vgVersion >= 0) { // cached in local + if (usedbRsp.vgVersion >= 0) { // cached in local uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId; int32_t code1 = catalogGetHandle(clusterId, &pCatalog); if (code1 != TSDB_CODE_SUCCESS) { @@ -289,7 +297,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { } int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) { - if(pMsg == NULL || param == NULL){ + if (pMsg == NULL || param == NULL) { return TSDB_CODE_TSC_INVALID_INPUT; } SRequestObj* pRequest = param; @@ -344,13 +352,13 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid); - STscObj* pTscObj = pRequest->pTscObj; + STscObj* pTscObj = pRequest->pTscObj; SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; - char dbFName[TSDB_DB_FNAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); @@ -474,8 +482,9 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS); blockDataDestroy(pBlock); - if(len != rspSize - sizeof(SRetrieveTableRsp)){ - uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, (uint64_t) (rspSize - sizeof(SRetrieveTableRsp))); + if (len != rspSize - sizeof(SRetrieveTableRsp)) { + uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, + (uint64_t)(rspSize - sizeof(SRetrieveTableRsp))); return TSDB_CODE_TSC_INVALID_INPUT; } diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6e60f4ba21..32f748d4a9 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1073,8 +1073,6 @@ void smlDestroyInfo(SSmlHandle *info) { taosArrayDestroy(info->valueJsonArray); taosArrayDestroy(info->preLineTagKV); - taosArrayDestroy(info->maxTagKVs); - taosArrayDestroy(info->preLineColKV); if (!info->dataFormat) { for (int i = 0; i < info->lineNum; i++) { @@ -1117,8 +1115,6 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) { info->tagJsonArray = taosArrayInit(8, POINTER_BYTES); info->valueJsonArray = taosArrayInit(8, POINTER_BYTES); info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv)); - info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv)); - info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv)); if (NULL == info->pVgHash || NULL == info->childTables || NULL == info->superTables) { uError("create SSmlHandle failed"); @@ -1141,6 +1137,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) { for (size_t i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); + if(terrno == TSDB_CODE_DUP_KEY){return terrno;} } taosArrayPush(colsArray, &kvHash); @@ -1207,6 +1204,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SSmlSTableMeta *meta = smlBuildSTableMeta(info->dataFormat); smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags); + if(terrno == TSDB_CODE_DUP_KEY){return terrno;} smlInsertMeta(meta->colHash, meta->cols, elements->colArray); taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); } diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 34f0561d9a..4609dd68b0 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -683,13 +683,10 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - SSmlSTableMeta *sMeta = NULL; + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if (pTableMeta == NULL) { @@ -700,18 +697,16 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -747,58 +742,21 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo return TSDB_CODE_SUCCESS; } - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); cnt++; @@ -1214,7 +1172,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * return TSDB_CODE_INVALID_TIMESTAMP; } else if (elements->timestamp[0] == '{') { char tmp = elements->timestamp[elements->timestampLen]; - elements->cols[elements->timestampLen] = '\0'; + elements->timestamp[elements->timestampLen] = '\0'; cJSON *tsJson = cJSON_Parse(elements->timestamp); ts = smlParseTSFromJSON(info, tsJson); if (unlikely(ts < 0)) { diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index a2f752edb9..66f1316cd5 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -144,13 +144,11 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); @@ -162,18 +160,16 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -252,58 +248,23 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin return TSDB_CODE_SUCCESS; } - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); @@ -344,9 +305,6 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *currElement, bool isSameMeasure, bool isSameCTable) { int cnt = 0; - SArray *preLineKV = info->preLineColKV; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameCTable)) { SSmlTableInfo **oneTable = @@ -361,7 +319,6 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); if (pTableMeta == NULL) { @@ -369,17 +326,23 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin info->reRun = true; return TSDB_CODE_SUCCESS; } - sMeta = smlBuildSTableMeta(info->dataFormat); - sMeta->tableMeta = pTableMeta; - taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); - tmp = &sMeta; + *tmp = smlBuildSTableMeta(info->dataFormat); + (*tmp)->tableMeta = pTableMeta; + taosHashPut(info->superTables, currElement->measure, currElement->measureLen, tmp, POINTER_BYTES); + + for(int i = 0; i < pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type }; + if(tag->type == TSDB_DATA_TYPE_NCHAR){ + kv.length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + }else if(tag->type == TSDB_DATA_TYPE_BINARY){ + kv.length = tag->bytes - VARSTR_HEADER_SIZE; + } + taosArrayPush((*tmp)->cols, &kv); + } } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->cols; - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(preLineKV); + info->masColKVs = (*tmp)->cols; } } @@ -478,69 +441,26 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin info->reRun = true; return TSDB_CODE_SUCCESS; } + if (cnt >= taosArrayGetSize(info->masColKVs)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->masColKVs, cnt); + if (kv.type != maxKV->type) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } - if (isSameMeasure) { - if (cnt >= taosArrayGetSize(preLineKV)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(preLineKV, cnt); - if (kv.type != maxKV->type) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - - if (unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->cols, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.type != maxKV->type)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - - if (IS_VAR_DATA_TYPE(kv.type)) { - if (kv.length > maxKV->length) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(preLineKV, &kv); + if (unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } } else { if (currElement->colArray == NULL) { diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index ab071305fa..ccf79cfc64 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -79,13 +79,10 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (!isSameMeasure) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - SSmlSTableMeta *sMeta = NULL; + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if (pTableMeta == NULL) { @@ -96,18 +93,16 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -175,59 +170,21 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS info->reRun = true; return TSDB_CODE_SUCCESS; } - - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); cnt++; diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index d913b32642..9f24deff94 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -192,6 +192,7 @@ typedef struct { SMqClientTopic* pTopic; int32_t vgId; tsem_t rspSem; + uint64_t requestId; // request id for debug purpose } SMqPollCbParam; typedef struct { @@ -1054,7 +1055,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { pTmq->hbLiveTimer = taosTmrStart(tmqSendHbReq, 1000, pRefId, tmqMgmt.timer); } - tscInfo("consumer:0x%" PRIx64 " is setup, consumer groupId %s", pTmq->consumerId, pTmq->groupId); + tscInfo("consumer:0x%" PRIx64 " is setup, groupId:%s", pTmq->consumerId, pTmq->groupId); return pTmq; FAIL: @@ -1075,7 +1076,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { SCMSubscribeReq req = {0}; int32_t code = 0; - tscDebug("consumer:0x%" PRIx64 " subscribe %d topics", tmq->consumerId, sz); + tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz); req.consumerId = tmq->consumerId; tstrncpy(req.clientId, tmq->clientId, 256); @@ -1161,7 +1162,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { int32_t retryCnt = 0; while (TSDB_CODE_MND_CONSUMER_NOT_READY == tmqAskEp(tmq, false)) { - if (retryCnt++ > 10) { + if (retryCnt++ > 40) { goto FAIL; } @@ -1212,30 +1213,39 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { return -1; } - int32_t epoch = pParam->epoch; - int32_t vgId = pParam->vgId; + int32_t epoch = pParam->epoch; + int32_t vgId = pParam->vgId; + uint64_t requestId = pParam->requestId; + taosMemoryFree(pParam); + if (code != 0) { - tscWarn("msg discard from vgId:%d, epoch %d, since %s", vgId, epoch, terrstr()); + tscWarn("consumer:0x%"PRIx64" msg from vgId:%d discarded, epoch %d, since %s, reqId:0x%"PRIx64, tmq->consumerId, vgId, + epoch, tstrerror(code), requestId); + if (pMsg->pData) taosMemoryFree(pMsg->pData); if (pMsg->pEpSet) taosMemoryFree(pMsg->pEpSet); + // in case of consumer mismatch, wait for 500ms and retry if (code == TSDB_CODE_TMQ_CONSUMER_MISMATCH) { + taosMsleep(500); atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__RECOVER); - goto CREATE_MSG_FAIL; - } - if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { + tscDebug("consumer:0x%" PRIx64" wait for the re-balance, wait for 500ms and set status to be RECOVER", tmq->consumerId); + } else if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { - tscWarn("msg discard from vgId:%d, epoch %d since out of memory", vgId, epoch); + tscWarn("consumer:0x%" PRIx64 " msg from vgId:%d discarded, epoch %d since out of memory, reqId:0x%" PRIx64, + tmq->consumerId, vgId, epoch, requestId); goto CREATE_MSG_FAIL; } + pRspWrapper->tmqRspType = TMQ_MSG_TYPE__END_RSP; /*pRspWrapper->vgHandle = pVg;*/ /*pRspWrapper->topicHandle = pTopic;*/ taosWriteQitem(tmq->mqueue, pRspWrapper); tsem_post(&tmq->rspSem); } + goto CREATE_MSG_FAIL; } @@ -1243,8 +1253,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { int32_t tmqEpoch = atomic_load_32(&tmq->epoch); if (msgEpoch < tmqEpoch) { // do not write into queue since updating epoch reset - tscWarn("msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d", vgId, msgEpoch, - tmqEpoch); + tscWarn("consumer:0x%" PRIx64 " msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d, reqId:0x%"PRIx64, + tmq->consumerId, vgId, msgEpoch, tmqEpoch, requestId); + tsem_post(&tmq->rspSem); taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); @@ -1252,7 +1263,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } if (msgEpoch != tmqEpoch) { - tscWarn("mismatch rsp from vgId:%d, epoch %d, current epoch %d", vgId, msgEpoch, tmqEpoch); + tscWarn("consumer:0x%"PRIx64" mismatch rsp from vgId:%d, epoch %d, current epoch %d, reqId:0x%"PRIx64, tmq->consumerId, vgId, + msgEpoch, tmqEpoch, requestId); } // handle meta rsp @@ -1262,7 +1274,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { if (pRspWrapper == NULL) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - tscWarn("msg discard from vgId:%d, epoch %d since out of memory", vgId, epoch); + tscWarn("consumer:0x%"PRIx64" msg discard from vgId:%d, epoch %d since out of memory", tmq->consumerId, vgId, epoch); goto CREATE_MSG_FAIL; } @@ -1277,10 +1289,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead)); - tscDebug("consumer:0x%" PRIx64 ", recv poll: vgId:%d, req offset %" PRId64 ", rsp offset %" PRId64 " type %d", + tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req offset:%" PRId64 ", rsp offset:%" PRId64 " type %d, reqId:0x%"PRIx64, tmq->consumerId, pVg->vgId, pRspWrapper->dataRsp.reqOffset.version, pRspWrapper->dataRsp.rspOffset.version, - rspType); - + rspType, requestId); } else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); @@ -1298,16 +1309,19 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue %p", tmq->consumerId, pRspWrapper); + tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue, total in queue:%d, reqId:0x%" PRIx64, tmq->consumerId, + tmq->mqueue->numOfItems, requestId); taosWriteQitem(tmq->mqueue, pRspWrapper); tsem_post(&tmq->rspSem); return 0; + CREATE_MSG_FAIL: if (epoch == tmq->epoch) { atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); } + tsem_post(&tmq->rspSem); return -1; } @@ -1344,7 +1358,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) { sprintf(vgKey, "%s:%d", pTopicCur->topicName, pVgCur->vgId); char buf[80]; tFormatOffset(buf, 80, &pVgCur->currentOffset); - tscDebug("consumer:0x%" PRIx64 ", epoch %d vgId:%d vgKey is %s, offset is %s", tmq->consumerId, epoch, + tscDebug("consumer:0x%" PRIx64 ", epoch:%d vgId:%d vgKey:%s, offset:%s", tmq->consumerId, epoch, pVgCur->vgId, vgKey, buf); taosHashPut(pHash, vgKey, strlen(vgKey), &pVgCur->currentOffset, sizeof(STqOffsetVal)); } @@ -1552,7 +1566,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) { .handle = NULL, }; - sendInfo->requestId = tmq->consumerId; + sendInfo->requestId = generateRequestId(); sendInfo->requestObjRefId = 0; sendInfo->param = pParam; sendInfo->fp = tmqAskEpCb; @@ -1560,7 +1574,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); tscDebug("consumer:0x%" PRIx64 " ask ep from mnode, async:%d, reqId:0x%" PRIx64, tmq->consumerId, async, - tmq->consumerId); + sendInfo->requestId); int64_t transporterId = 0; asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); @@ -1674,6 +1688,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p pParam->pVg = pVg; // pVg may be released,fix it pParam->pTopic = pTopic; pParam->vgId = pVg->vgId; + pParam->requestId = req.reqId; SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { @@ -1698,7 +1713,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p char offsetFormatBuf[80]; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->currentOffset); - tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, epoch %d, req offset:%s, reqId:0x%" PRIx64, + tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, epoch %d, req:%s, reqId:0x%" PRIx64, pTmq->consumerId, pTopic->topicName, pVg->vgId, pTmq->epoch, offsetFormatBuf, req.reqId); asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); @@ -1722,10 +1737,9 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { int32_t vgStatus = atomic_val_compare_exchange_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE, TMQ_VG_STATUS__WAIT); if (vgStatus == TMQ_VG_STATUS__WAIT) { int32_t vgSkipCnt = atomic_add_fetch_32(&pVg->vgSkipCnt, 1); - tscDebug("consumer:0x%" PRIx64 " epoch %d wait poll-rsp, skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, + tscTrace("consumer:0x%" PRIx64 " epoch %d wait poll-rsp, skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, pVg->vgId, vgSkipCnt); continue; - /*if (vgSkipCnt < 10000) continue;*/ #if 0 if (skipCnt < 30000) { continue; @@ -1767,7 +1781,7 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset) } void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { - tscDebug("consumer:0x%" PRIx64 " start to handle the rsp", tmq->consumerId); + tscDebug("consumer:0x%" PRIx64 " start to handle the rsp, total:%d", tmq->consumerId, tmq->qall->numOfItems); while (1) { SMqRspWrapper* rspWrapper = NULL; @@ -1785,25 +1799,32 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__END_RSP) { taosFreeQitem(rspWrapper); terrno = TSDB_CODE_TQ_NO_COMMITTED_OFFSET; + tscError("consumer:0x%" PRIx64 " unexpected rsp from poll, code:%s", tmq->consumerId, tstrerror(terrno)); return NULL; } else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)rspWrapper; - tscDebug("consumer:0x%" PRIx64 " process poll rsp", tmq->consumerId); + /*atomic_sub_fetch_32(&tmq->readyRequest, 1);*/ int32_t consumerEpoch = atomic_load_32(&tmq->epoch); if (pollRspWrapper->dataRsp.head.epoch == consumerEpoch) { SMqClientVg* pVg = pollRspWrapper->vgHandle; - /*printf("vgId:%d, offset %" PRId64 " up to %" PRId64 "\n", pVg->vgId, pVg->currentOffset, - * rspMsg->msg.rspOffset);*/ pVg->currentOffset = pollRspWrapper->dataRsp.rspOffset; atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); + if (pollRspWrapper->dataRsp.blockNum == 0) { + tscDebug("consumer:0x%" PRIx64 " empty block received, vgId:%d", tmq->consumerId, pVg->vgId); taosFreeQitem(pollRspWrapper); rspWrapper = NULL; continue; } + // build rsp + char buf[80]; + tFormatOffset(buf, 80, &pVg->currentOffset); SMqRspObj* pRsp = tmqBuildRspFromWrapper(pollRspWrapper); + tscDebug("consumer:0x%" PRIx64 " process poll rsp, vgId:%d, offset:%s, blocks:%d", tmq->consumerId, + pVg->vgId, buf, pollRspWrapper->dataRsp.blockNum); + taosFreeQitem(pollRspWrapper); return pRsp; } else { @@ -1876,6 +1897,8 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { } } } + + tscDebug("consumer:0x%" PRIx64 " handle the rsp completed", tmq->consumerId); } TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { @@ -1896,17 +1919,18 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { // in no topic status, delayed task also need to be processed if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__INIT) { tscDebug("consumer:0x%" PRIx64 " poll return since consumer is init", tmq->consumerId); + taosMsleep(500); // sleep for a while return NULL; } if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER) { int32_t retryCnt = 0; while (TSDB_CODE_MND_CONSUMER_NOT_READY == tmqAskEp(tmq, false)) { - if (retryCnt++ > 10) { + if (retryCnt++ > 40) { return NULL; } - tscDebug("consumer:0x%" PRIx64 " not ready, retry:%d/10 in 500ms", tmq->consumerId, retryCnt); + tscDebug("consumer:0x%" PRIx64 " not ready, retry:%d/40 in 500ms", tmq->consumerId, retryCnt); taosMsleep(500); } } diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 59c931d9aa..2f3d600019 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -925,7 +925,7 @@ TEST(clientCase, subscription_test) { // 创建订阅 topics 列表 tmq_list_t* topicList = tmq_list_new(); - tmq_list_append(topicList, "topic_t1"); +// tmq_list_append(topicList, "topic_t1"); // 启动订阅 tmq_subscribe(tmq, topicList); @@ -938,6 +938,8 @@ TEST(clientCase, subscription_test) { int32_t msgCnt = 0; int32_t timeout = 5000; + int32_t count = 0; + while (1) { TAOS_RES* pRes = tmq_consumer_poll(tmq, timeout); if (pRes) { @@ -952,6 +954,11 @@ TEST(clientCase, subscription_test) { printf("db: %s\n", dbName); printf("vgroup id: %d\n", vgroupId); + if (count ++ > 20) { + tmq_unsubscribe(tmq); + break; + } + while (1) { TAOS_ROW row = taos_fetch_row(pRes); if (row == NULL) break; diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 6198f923f4..4aa47a3819 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -33,6 +33,7 @@ static const SSysDbTableSchema dnodesSchema[] = { {.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, + {.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; @@ -42,6 +43,7 @@ static const SSysDbTableSchema mnodesSchema[] = { {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, + {.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, }; static const SSysDbTableSchema modulesSchema[] = { diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 88eb3bdb97..453e4a8d8e 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -2003,7 +2003,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_TIMESTAMP: memset(pBuf, 0, sizeof(pBuf)); - formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI); + formatTimestamp(pBuf, *(uint64_t*)var, pColInfoData->info.precision); len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf); if (len >= size - 1) return dumpBuf; break; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 99795fcc79..8058f9fddd 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -41,8 +41,8 @@ bool tsPrintAuth = false; // queue & threads int32_t tsNumOfRpcThreads = 1; -int32_t tsNumOfRpcSessions = 5000; -int32_t tsTimeToGetAvailableConn = 100000; +int32_t tsNumOfRpcSessions = 10000; +int32_t tsTimeToGetAvailableConn = 500000; int32_t tsNumOfCommitThreads = 2; int32_t tsNumOfTaskQueueThreads = 4; int32_t tsNumOfMnodeQueryThreads = 4; @@ -56,6 +56,7 @@ int32_t tsNumOfQnodeQueryThreads = 4; int32_t tsNumOfQnodeFetchThreads = 1; int32_t tsNumOfSnodeStreamThreads = 4; int32_t tsNumOfSnodeWriteThreads = 1; + // sync raft int32_t tsElectInterval = 25 * 1000; int32_t tsHeartbeatInterval = 1000; @@ -64,6 +65,10 @@ int32_t tsHeartbeatTimeout = 20 * 1000; // vnode int64_t tsVndCommitMaxIntervalMs = 600 * 1000; +// mnode +int64_t tsMndSdbWriteDelta = 200; +int64_t tsMndLogRetention = 2000; + // monitor bool tsEnableMonitor = true; int32_t tsMonitorInterval = 30; @@ -327,6 +332,10 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1; if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1; + tsNumOfRpcThreads = tsNumOfCores / 2; + tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS); + if (cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, 0) != 0) return -1; + tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 100000); if (cfgAddInt32(pCfg, "numOfRpcSessions", tsNumOfRpcSessions, 1, 100000, 0) != 0) return -1; @@ -456,6 +465,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt64(pCfg, "vndCommitMaxInterval", tsVndCommitMaxIntervalMs, 1000, 1000 * 60 * 60, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "mndSdbWriteDelta", tsMndSdbWriteDelta, 20, 10000, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "mndLogRetention", tsMndLogRetention, 500, 10000, 0) != 0) return -1; + if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1; if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1; if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1; @@ -521,7 +533,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem = cfgGetItem(tsCfg, "numOfRpcSessions"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsNumOfRpcSessions = 2000; tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000); pItem->i32 = tsNumOfRpcSessions; pItem->stype = stype; @@ -529,7 +540,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem = cfgGetItem(tsCfg, "timeToGetAvailableConn"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsTimeToGetAvailableConn = 1000; tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000); pItem->i32 = tsTimeToGetAvailableConn; pItem->stype = stype; @@ -717,6 +727,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; + tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32; tsNumOfRpcSessions = cfgGetItem(pCfg, "numOfRpcSessions")->i32; tsTimeToGetAvailableConn = cfgGetItem(pCfg, "timeToGetAvailableConn")->i32; @@ -803,6 +814,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsVndCommitMaxIntervalMs = cfgGetItem(pCfg, "vndCommitMaxInterval")->i64; + tsMndSdbWriteDelta = cfgGetItem(pCfg, "mndSdbWriteDelta")->i64; + tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64; + tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); tstrncpy(tsUdfdLdLibPath, cfgGetItem(pCfg, "udfdLdLibPath")->str, sizeof(tsUdfdLdLibPath)); @@ -1240,6 +1254,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32, false); if (taosMulModeMkDir(tsLogDir, 0777) != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to create dir:%s since %s", tsLogDir, terrstr()); cfgCleanup(pCfg); return -1; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e180959d1e..6dd28094cb 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2531,6 +2531,8 @@ int32_t tSerializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq) if (tStartEncode(&encoder) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; + if (tEncodeI64(&encoder, pReq->timeRange.skey) < 0) return -1; + if (tEncodeI64(&encoder, pReq->timeRange.ekey) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -2544,6 +2546,8 @@ int32_t tDeserializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq if (tStartDecode(&decoder) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->timeRange.skey) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->timeRange.ekey) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); @@ -2865,12 +2869,19 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) { if (tEncodeI32(&encoder, pRsp->minRows) < 0) return -1; if (tEncodeI32(&encoder, pRsp->maxRows) < 0) return -1; if (tEncodeI32(&encoder, pRsp->walFsyncPeriod) < 0) return -1; + if (tEncodeI16(&encoder, pRsp->hashPrefix) < 0) return -1; + if (tEncodeI16(&encoder, pRsp->hashSuffix) < 0) return -1; if (tEncodeI8(&encoder, pRsp->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pRsp->precision) < 0) return -1; if (tEncodeI8(&encoder, pRsp->compression) < 0) return -1; if (tEncodeI8(&encoder, pRsp->replications) < 0) return -1; if (tEncodeI8(&encoder, pRsp->strict) < 0) return -1; if (tEncodeI8(&encoder, pRsp->cacheLast) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->tsdbPageSize) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->walRetentionPeriod) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->walRollPeriod) < 0) return -1; + if (tEncodeI64(&encoder, pRsp->walRetentionSize) < 0) return -1; + if (tEncodeI64(&encoder, pRsp->walSegmentSize) < 0) return -1; if (tEncodeI32(&encoder, pRsp->numOfRetensions) < 0) return -1; for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) { SRetention *pRetension = taosArrayGet(pRsp->pRetensions, i); @@ -2905,12 +2916,19 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) { if (tDecodeI32(&decoder, &pRsp->minRows) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->maxRows) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->walFsyncPeriod) < 0) return -1; + if (tDecodeI16(&decoder, &pRsp->hashPrefix) < 0) return -1; + if (tDecodeI16(&decoder, &pRsp->hashSuffix) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->precision) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->compression) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->replications) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->strict) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->cacheLast) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->tsdbPageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->walRetentionPeriod) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->walRollPeriod) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->walRetentionSize) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->walSegmentSize) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->numOfRetensions) < 0) return -1; if (pRsp->numOfRetensions > 0) { pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention)); @@ -3723,6 +3741,7 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; if (tEncodeCStrWithLen(&encoder, pReq->passwd, TSDB_PASSWORD_LEN) < 0) return -1; if (tEncodeI64(&encoder, pReq->startTime) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->sVer) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -3742,6 +3761,12 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->passwd) < 0) return -1; if (tDecodeI64(&decoder, &pReq->startTime) < 0) return -1; + // Check the client version from version 3.0.3.0 + if (tDecodeIsEnd(&decoder)) { + tDecoderClear(&decoder); + return TSDB_CODE_VERSION_NOT_COMPATIBLE; + } + if (tDecodeCStrTo(&decoder, pReq->sVer) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); @@ -4090,6 +4115,11 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq * if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; if (tEncodeI64(&encoder, pReq->compactStartTime) < 0) return -1; + + // 1.1 add tw.skey and tw.ekey + if (tEncodeI64(&encoder, pReq->tw.skey) < 0) return -1; + if (tEncodeI64(&encoder, pReq->tw.ekey) < 0) return -1; + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -4102,11 +4132,21 @@ int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq tDecoderInit(&decoder, buf, bufLen); if (tStartDecode(&decoder) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; if (tDecodeI64(&decoder, &pReq->compactStartTime) < 0) return -1; - tEndDecode(&decoder); + // 1.1 + if (tDecodeIsEnd(&decoder)) { + pReq->tw.skey = TSKEY_MIN; + pReq->tw.ekey = TSKEY_MAX; + } else { + if (tDecodeI64(&decoder, &pReq->tw.skey) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->tw.ekey) < 0) return -1; + } + + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; } @@ -6570,7 +6610,7 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { } else if (pVal->type == TMQ_OFFSET__LOG) { snprintf(buf, maxLen, "offset(log) ver:%" PRId64, pVal->version); } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) { - snprintf(buf, maxLen, "offset(ss data) uid:%" PRId64 ", ts:%" PRId64, pVal->uid, pVal->ts); + snprintf(buf, maxLen, "offset(snapshot) uid:%" PRId64 " ts:%" PRId64, pVal->uid, pVal->ts); } else { ASSERT(0); } diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 0724fcc63a..228f301aec 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -61,6 +61,16 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) { rpcFreeCont(pRsp->pCont); } +void dmEpSetToStr(char *buf, int32_t len, SEpSet *epSet) { + int32_t n = 0; + n += snprintf(buf + n, len - n, "%s", "{"); + for (int i = 0; i < epSet->numOfEps; i++) { + n += snprintf(buf + n, len - n, "%s:%d%s", epSet->eps[i].fqdn, epSet->eps[i].port, + (i + 1 < epSet->numOfEps ? ", " : "")); + } + n += snprintf(buf + n, len - n, "%s", "}"); +} + void dmSendStatusReq(SDnodeMgmt *pMgmt) { SStatusReq req = {0}; @@ -119,11 +129,10 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { dmGetMnodeEpSet(pMgmt->pData, &epSet); rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp); if (rpcRsp.code != 0) { - dError("failed to send status req since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps, - epSet.inUse); - for (int32_t i = 0; i < epSet.numOfEps; ++i) { - dDebug("index:%d, mnode ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port); - } + dmRotateMnodeEpSet(pMgmt->pData); + char tbuf[256]; + dmEpSetToStr(tbuf, sizeof(tbuf), &epSet); + dError("failed to send status req since %s, epSet:%s, inUse:%d", tstrerror(rpcRsp.code), tbuf, epSet.inUse); } dmProcessStatusRsp(pMgmt, &rpcRsp); } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 5cf408a905..d7f91b74a8 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -20,6 +20,8 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) { pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoad)); if (pInfo->pVloads == NULL) return; + tfsUpdateSize(pMgmt->pTfs); + taosThreadRwlockRdlock(&pMgmt->lock); void *pIter = taosHashIterate(pMgmt->hash, NULL); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index c1b3cde9ea..7aa1c9f56a 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -192,8 +192,8 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp taosWriteQitem(pVnode->pFetchQ, pMsg); break; case WRITE_QUEUE: - if (!osDataSpaceAvailable()) { - terrno = TSDB_CODE_NO_DISKSPACE; + if (!osDataSpaceSufficient()) { + terrno = TSDB_CODE_NO_ENOUGH_DISKSPACE; code = terrno; dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code)); break; diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 55ee6d6973..cfdea40477 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -166,6 +166,7 @@ int32_t dmReadEps(SDnodeData *pData); int32_t dmWriteEps(SDnodeData *pData); void dmUpdateEps(SDnodeData *pData, SArray *pDnodeEps); void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet); +void dmRotateMnodeEpSet(SDnodeData *pData); void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet); void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet); bool dmUpdateDnodeInfo(void *pData, int32_t *dnodeId, int64_t *clusterId, char *fqdn, uint16_t *port); diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c index e9ab8a0460..784d2b425b 100644 --- a/source/dnode/mgmt/node_util/src/dmEps.c +++ b/source/dnode/mgmt/node_util/src/dmEps.c @@ -325,6 +325,28 @@ void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) { taosThreadRwlockUnlock(&pData->lock); } +static FORCE_INLINE void dmSwapEps(SEp *epLhs, SEp *epRhs) { + SEp epTmp; + + epTmp.port = epLhs->port; + tstrncpy(epTmp.fqdn, epLhs->fqdn, tListLen(epTmp.fqdn)); + + epLhs->port = epRhs->port; + tstrncpy(epLhs->fqdn, epRhs->fqdn, tListLen(epLhs->fqdn)); + + epRhs->port = epTmp.port; + tstrncpy(epRhs->fqdn, epTmp.fqdn, tListLen(epRhs->fqdn)); +} + +void dmRotateMnodeEpSet(SDnodeData *pData) { + taosThreadRwlockRdlock(&pData->lock); + SEpSet *pEpSet = &pData->mnodeEps; + for (int i = 1; i < pEpSet->numOfEps; i++) { + dmSwapEps(&pEpSet->eps[i - 1], &pEpSet->eps[i]); + } + taosThreadRwlockUnlock(&pData->lock); +} + void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet) { dmGetMnodeEpSet(pData, pEpSet); dTrace("msg is redirected, handle:%p num:%d use:%d", pMsg->info.handle, pEpSet->numOfEps, pEpSet->inUse); diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 25a4397b7d..493ba48601 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -2,8 +2,9 @@ aux_source_directory(src MNODE_SRC) IF (TD_PRIVILEGE) ADD_DEFINITIONS(-D_PRIVILEGE) ENDIF () -IF (TD_PRIVILEGE) +IF (TD_ENTERPRISE) LIST(APPEND MNODE_SRC ${TD_ENTERPRISE_DIR}/src/plugins/privilege/src/privilege.c) + LIST(APPEND MNODE_SRC ${TD_ENTERPRISE_DIR}/src/plugins/mnode/src/mndDb.c) ENDIF () add_library(mnode STATIC ${MNODE_SRC}) diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index 9edfd9bf3b..97d047d7a3 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -33,6 +33,8 @@ bool mndIsDbReady(SMnode *pMnode, SDbObj *pDb); SSdbRaw *mndDbActionEncode(SDbObj *pDb); const char *mndGetDbStr(const char *src); +int32_t mndProcessCompactDbReq(SRpcMsg *pReq); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index ac0c68f652..fe2c58e29e 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -108,7 +108,8 @@ typedef enum { TRN_STAGE_UNDO_ACTION = 3, TRN_STAGE_COMMIT = 4, TRN_STAGE_COMMIT_ACTION = 5, - TRN_STAGE_FINISHED = 6 + TRN_STAGE_FINISHED = 6, + TRN_STAGE_PRE_FINISH = 7 } ETrnStage; typedef enum { @@ -542,7 +543,7 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer typedef struct { int32_t vgId; - char* qmsg; + char* qmsg; //SubPlanToString SEpSet epSet; } SMqVgEp; diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 51eb24f402..0229735952 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -43,7 +43,8 @@ int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVg int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force); int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup, SArray *pArray); -int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs); +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw); void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 280f3b0ecc..f1ef83aca5 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -26,18 +26,18 @@ #define MND_CONSUMER_VER_NUMBER 1 #define MND_CONSUMER_RESERVE_SIZE 64 -#define MND_CONSUMER_LOST_HB_CNT 3 +#define MND_CONSUMER_LOST_HB_CNT 6 #define MND_CONSUMER_LOST_CLEAR_THRESHOLD 43200 -static int8_t mqRebInExecCnt = 0; +static int32_t mqRebInExecCnt = 0; static const char *mndConsumerStatusName(int status); static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer); static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer); -static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pConsumer, SMqConsumerObj *pNewConsumer); +static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, SMqConsumerObj *pNewConsumer); static int32_t mndProcessConsumerMetaMsg(SRpcMsg *pMsg); -static int32_t mndRetrieveConsumer(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); +static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter); static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg); @@ -76,15 +76,36 @@ int32_t mndInitConsumer(SMnode *pMnode) { void mndCleanupConsumer(SMnode *pMnode) {} bool mndRebTryStart() { - int8_t old = atomic_val_compare_exchange_8(&mqRebInExecCnt, 0, 1); + int32_t old = atomic_val_compare_exchange_32(&mqRebInExecCnt, 0, 1); + mInfo("tq timer, rebalance counter old val:%d", old); return old == 0; } -void mndRebEnd() { atomic_sub_fetch_8(&mqRebInExecCnt, 1); } +void mndRebEnd() { + mndRebCntDec(); +} -void mndRebCntInc() { atomic_add_fetch_8(&mqRebInExecCnt, 1); } +void mndRebCntInc() { + int32_t val = atomic_add_fetch_32(&mqRebInExecCnt, 1); + mInfo("rebalance trans start, rebalance counter:%d", val); +} -void mndRebCntDec() { atomic_sub_fetch_8(&mqRebInExecCnt, 1); } +void mndRebCntDec() { + while (1) { + int32_t val = atomic_load_32(&mqRebInExecCnt); + if (val <= 0) { + mError("rebalance trans end, rebalance counter:%d should not be less equalled than 0, ignore counter desc", val); + break; + } + + int32_t newVal = val - 1; + int32_t oldVal = atomic_val_compare_exchange_32(&mqRebInExecCnt, val, newVal); + if (oldVal == val) { + mInfo("rebalance trans end, rebalance counter:%d", newVal); + break; + } + } +} static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; @@ -298,6 +319,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { taosRUnLockLatch(&pConsumer->lock); } else if (status == MQ_CONSUMER_STATUS__MODIFY) { taosRLockLatch(&pConsumer->lock); + int32_t newTopicNum = taosArrayGetSize(pConsumer->rebNewTopics); for (int32_t i = 0; i < newTopicNum; i++) { char key[TSDB_SUBSCRIBE_KEY_LEN]; @@ -334,7 +356,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { } else { taosHashCleanup(pRebMsg->rebSubHash); rpcFreeCont(pRebMsg); - mTrace("mq rebalance finished, no modification"); + mInfo("mq rebalance finished, no modification"); mndRebEnd(); } return 0; @@ -611,10 +633,11 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { pExistedConsumer = mndAcquireConsumer(pMnode, consumerId); if (pExistedConsumer == NULL) { - mInfo("receive subscribe request from new consumer:0x%" PRIx64" cgroup:%s", consumerId, subscribe.cgroup); + mInfo("receive subscribe request from new consumer:0x%" PRIx64" cgroup:%s, numOfTopics:%d", consumerId, + subscribe.cgroup, (int32_t) taosArrayGetSize(pTopicList)); pConsumerNew = tNewSMqConsumerObj(consumerId, cgroup); - tstrncpy(pConsumerNew->clientId, subscribe.clientId, 256); + tstrncpy(pConsumerNew->clientId, subscribe.clientId, tListLen(pConsumerNew->clientId)); // set the update type pConsumerNew->updateType = CONSUMER_UPDATE__MODIFY; @@ -943,8 +966,9 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; atomic_add_fetch_32(&pOldConsumer->epoch, 1); - mDebug("consumer:0x%" PRIx64 " state %s -> %s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", - pOldConsumer->consumerId, mndConsumerStatusName(status), mndConsumerStatusName(pOldConsumer->status), + mDebug("consumer:0x%" PRIx64 " state (%d)%s -> (%d)%s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", + pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status, + mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime, (int)taosArrayGetSize(pOldConsumer->currentTopics)); } else if (pNewConsumer->updateType == CONSUMER_UPDATE__REMOVE) { /*A(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0);*/ @@ -1002,8 +1026,9 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; atomic_add_fetch_32(&pOldConsumer->epoch, 1); - mDebug("consumer:0x%" PRIx64 " state %s -> %s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", - pOldConsumer->consumerId, mndConsumerStatusName(status), mndConsumerStatusName(pOldConsumer->status), + mDebug("consumer:0x%" PRIx64 " state %d(%s) -> %d(%s), new epoch:%d, reb-time:%" PRId64 ", current topics:%d", + pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status, + mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime, (int)taosArrayGetSize(pOldConsumer->currentTopics)); } @@ -1044,7 +1069,6 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock * } taosRLockLatch(&pConsumer->lock); - mDebug("showing consumer:0x%" PRIx64, pConsumer->consumerId); int32_t topicSz = taosArrayGetSize(pConsumer->assignedTopics); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 3efd8fb249..af76971304 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -41,12 +41,15 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq); static int32_t mndProcessAlterDbReq(SRpcMsg *pReq); static int32_t mndProcessDropDbReq(SRpcMsg *pReq); static int32_t mndProcessUseDbReq(SRpcMsg *pReq); -static int32_t mndProcessCompactDbReq(SRpcMsg *pReq); static int32_t mndProcessTrimDbReq(SRpcMsg *pReq); static int32_t mndRetrieveDbs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity); static void mndCancelGetNextDb(SMnode *pMnode, void *pIter); static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq); +#ifndef TD_ENTERPRISE +int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } +#endif + int32_t mndInitDb(SMnode *pMnode) { SSdbTable table = { .sdbType = SDB_DB, @@ -884,12 +887,19 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) { cfgRsp.minRows = pDb->cfg.minRows; cfgRsp.maxRows = pDb->cfg.maxRows; cfgRsp.walFsyncPeriod = pDb->cfg.walFsyncPeriod; + cfgRsp.hashPrefix = pDb->cfg.hashPrefix; + cfgRsp.hashSuffix = pDb->cfg.hashSuffix; cfgRsp.walLevel = pDb->cfg.walLevel; cfgRsp.precision = pDb->cfg.precision; cfgRsp.compression = pDb->cfg.compression; cfgRsp.replications = pDb->cfg.replications; cfgRsp.strict = pDb->cfg.strict; cfgRsp.cacheLast = pDb->cfg.cacheLast; + cfgRsp.tsdbPageSize = pDb->cfg.tsdbPageSize; + cfgRsp.walRetentionPeriod = pDb->cfg.walRetentionPeriod; + cfgRsp.walRollPeriod = pDb->cfg.walRollPeriod; + cfgRsp.walRetentionSize = pDb->cfg.walRetentionSize; + cfgRsp.walSegmentSize = pDb->cfg.walSegmentSize; cfgRsp.numOfRetensions = pDb->cfg.numOfRetensions; cfgRsp.pRetensions = pDb->cfg.pRetensions; cfgRsp.schemaless = pDb->cfg.schemaless; @@ -1395,98 +1405,6 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, return 0; } -static int32_t mndSetCompactDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { - SDbObj dbObj = {0}; - memcpy(&dbObj, pDb, sizeof(SDbObj)); - dbObj.compactStartTime = compactTs; - - SSdbRaw *pCommitRaw = mndDbActionEncode(&dbObj); - if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { - sdbFreeRaw(pCommitRaw); - return -1; - } - - (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); - return 0; -} - -static int32_t mndSetCompactDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { - SSdb *pSdb = pMnode->pSdb; - void *pIter = NULL; - - while (1) { - SVgObj *pVgroup = NULL; - pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); - if (pIter == NULL) break; - - if (mndVgroupInDb(pVgroup, pDb->uid)) { - if (mndBuildCompactVgroupAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) { - sdbCancelFetch(pSdb, pIter); - sdbRelease(pSdb, pVgroup); - return -1; - } - } - - sdbRelease(pSdb, pVgroup); - } - - return 0; -} - -static int32_t mndCompactDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) { - int64_t compactTs = taosGetTimestampMs(); - int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "compact-db"); - if (pTrans == NULL) goto _OVER; - - mInfo("trans:%d, used to compact db:%s", pTrans->id, pDb->name); - mndTransSetDbName(pTrans, pDb->name, NULL); - if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; - if (mndSetCompactDbCommitLogs(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; - if (mndSetCompactDbRedoActions(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; - if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; - code = 0; - -_OVER: - mndTransDrop(pTrans); - return code; -} - -static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { - SMnode *pMnode = pReq->info.node; - int32_t code = -1; - SDbObj *pDb = NULL; - SCompactDbReq compactReq = {0}; - - if (tDeserializeSCompactDbReq(pReq->pCont, pReq->contLen, &compactReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - goto _OVER; - } - - mInfo("db:%s, start to compact", compactReq.db); - - pDb = mndAcquireDb(pMnode, compactReq.db); - if (pDb == NULL) { - goto _OVER; - } - - if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_COMPACT_DB, pDb) != 0) { - goto _OVER; - } - - code = mndCompactDb(pMnode, pReq, pDb); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; - -_OVER: - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("db:%s, failed to process compact db req since %s", compactReq.db, terrstr()); - } - - mndReleaseDb(pMnode, pDb); - return code; -} - static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 5dd1742e5e..1d9db37a7d 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -1074,6 +1074,9 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->rebootTime, false); + char *b = taosMemoryCalloc(VARSTR_HEADER_SIZE + strlen(offlineReason[pDnode->offlineReason]) + 1, 1); STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 53a5548b2f..d83b969e2d 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -344,8 +344,8 @@ static int32_t mndInitWal(SMnode *pMnode) { .fsyncPeriod = 0, .rollPeriod = -1, .segSize = -1, - .retentionPeriod = -1, - .retentionSize = -1, + .retentionPeriod = 0, + .retentionSize = 0, .level = TAOS_WAL_FSYNC, }; @@ -370,7 +370,6 @@ static int32_t mndInitSdb(SMnode *pMnode) { opt.path = pMnode->path; opt.pMnode = pMnode; opt.pWal = pMnode->pWal; - opt.sync = pMnode->syncMgmt.sync; pMnode->pSdb = sdbInit(&opt); if (pMnode->pSdb == NULL) { @@ -552,16 +551,7 @@ void mndPreClose(SMnode *pMnode) { if (pMnode != NULL) { syncLeaderTransfer(pMnode->syncMgmt.sync); syncPreStop(pMnode->syncMgmt.sync); -#if 0 - while (syncSnapshotRecving(pMnode->syncMgmt.sync)) { - mInfo("vgId:1, snapshot is recving"); - taosMsleep(300); - } - while (syncSnapshotSending(pMnode->syncMgmt.sync)) { - mInfo("vgId:1, snapshot is sending"); - taosMsleep(300); - } -#endif + sdbWriteFile(pMnode->pSdb, 0); } } @@ -716,6 +706,9 @@ int32_t mndProcessRpcMsg(SRpcMsg *pMsg) { } else if (code == 0) { mGTrace("msg:%p, successfully processed", pMsg); } else { + if (code == -1) { + code = terrno; + } mGError("msg:%p, failed to process since %s, app:%p type:%s", pMsg, tstrerror(code), pMsg->info.ahandle, TMSG_INFO(pMsg->msgType)); } diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index aada00296e..50fab447e3 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -644,6 +644,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->stateStartTime, false); + numOfRows++; sdbRelease(pSdb, pObj); } diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 41dc57f32e..41dea50731 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -24,7 +24,7 @@ #include "mndStb.h" #include "mndUser.h" #include "tglobal.h" -#include "version.h" +#include "tversion.h" typedef struct { uint32_t id; @@ -221,11 +221,18 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { char ip[24] = {0}; const STraceId *trace = &pReq->info.traceId; - if (tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; + if ((code = tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq)) != 0) { + terrno = (-1 == code ? TSDB_CODE_INVALID_MSG : code); goto _OVER; } + if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 2)) != 0) { + terrno = code; + goto _OVER; + } + + code = -1; + taosIp2String(pReq->info.conn.clientIp, ip); if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONNECT) != 0) { mGError("user:%s, failed to login from %s since %s", pReq->info.conn.user, ip, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 2a05511134..b7f80f6b0e 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1223,7 +1223,7 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock // node id pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - int32_t nodeId = TMAX(pTask->nodeId, 0); + int64_t nodeId = TMAX(pTask->nodeId, 0); colDataSetVal(pColInfo, numOfRows, (const char *)&nodeId, false); // level diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 8544994c3e..4d19110f31 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -224,7 +224,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq re-balance remove vgId:%d from consumer:%" PRId64, sub, pVgEp->vgId, consumerId); + mInfo("sub:%s mq re-balance remove vgId:%d from consumer:%" PRIx64, sub, pVgEp->vgId, consumerId); } taosArrayDestroy(pConsumerEp->vgs); taosHashRemove(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); @@ -263,7 +263,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR imbConsumerNum = totalVgNum % afterRebConsumerNum; } - mInfo("sub:%s mq re-balance %d consumers: at least %d vg each, %d consumer has more vg", sub, + mInfo("sub:%s mq re-balance %d consumers: at least %d vgs each, %d consumers has more vgs", sub, afterRebConsumerNum, minVgCnt, imbConsumerNum); // 4. first scan: remove consumer more than wanted, put to remove hash @@ -296,7 +296,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } imbCnt++; @@ -311,7 +311,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } } @@ -329,7 +329,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR newConsumerEp.vgs = taosArrayInit(0, sizeof(void *)); taosHashPut(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t), &newConsumerEp, sizeof(SMqConsumerEp)); taosArrayPush(pOutput->newConsumers, &consumerId); - mInfo("sub:%s mq rebalance add new consumer:%" PRId64, sub, consumerId); + mInfo("sub:%s mq rebalance add new consumer:%" PRIx64, sub, consumerId); } } @@ -357,7 +357,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); pRebVg->newConsumerId = pConsumerEp->consumerId; taosArrayPush(pOutput->rebVgs, pRebVg); - mInfo("mq rebalance: add vgId:%d to consumer:%" PRId64 " (second scan) (not enough)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: add vgId:%d to consumer:%" PRIx64 " (second scan) (not enough)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); } } @@ -387,12 +387,12 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); pRebVg->newConsumerId = pConsumerEp->consumerId; if (pRebVg->newConsumerId == pRebVg->oldConsumerId) { - mInfo("mq rebalance: skip vg %d for same consumer:%" PRId64 " (second scan)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: skip vg %d for same consumer:%" PRIx64 " (second scan)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); continue; } taosArrayPush(pOutput->rebVgs, pRebVg); - mInfo("mq rebalance: add vgId:%d to consumer:%" PRId64 " (second scan) (unassigned)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: add vgId:%d to consumer:%" PRIx64 " (second scan) (unassigned)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); } } else { @@ -427,10 +427,10 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; int32_t sz = taosArrayGetSize(pConsumerEp->vgs); - mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRId64 " has %d vg", sub, pConsumerEp->consumerId, sz); + mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRIx64 " has %d vg", sub, pConsumerEp->consumerId, sz); for (int32_t i = 0; i < sz; i++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i); - mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRId64, sub, pVgEp->vgId, + mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRIx64, sub, pVgEp->vgId, pConsumerEp->consumerId); } } @@ -444,7 +444,9 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) { STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "tmq-reb"); - if (pTrans == NULL) return -1; + if (pTrans == NULL) { + return -1; + } mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL); if (mndTrancCheckConflict(pMnode, pTrans) != 0) { @@ -591,13 +593,13 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { rebOutput.pSub = mndCreateSubscription(pMnode, pTopic, pRebInfo->key); if (rebOutput.pSub == NULL) { - mError("mq rebalance %s failed create sub since %s, abort", pRebInfo->key, terrstr()); + mError("mq rebalance %s failed create sub since %s, ignore", pRebInfo->key, terrstr()); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); continue; } - memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); + memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); @@ -616,9 +618,9 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { // if add more consumer to balanced subscribe, // possibly no vg is changed - + // when each topic is re-balanced, issue an trans to save the results in sdb. if (mndPersistRebResult(pMnode, pMsg, &rebOutput) < 0) { - mError("mq re-balance persist re-balance output error, possibly vnode splitted or dropped"); + mError("mq re-balance persist output error, possibly vnode splitted or dropped"); } taosArrayDestroy(pRebInfo->lostConsumers); @@ -770,7 +772,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { if (pSub->unassignedVgs != NULL) { int32_t size = (int32_t)taosArrayGetSize(pSub->unassignedVgs); for (int32_t i = 0; i < size; ++i) { - SMqVgEp *pMqVgEp = taosArrayGet(pSub->unassignedVgs, i); + SMqVgEp *pMqVgEp = (SMqVgEp *)taosArrayGetP(pSub->unassignedVgs, i); tmsgUpdateDnodeEpSet(&pMqVgEp->epSet); } } @@ -780,7 +782,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { SMqConsumerEp *pConsumerEp = pIter; int32_t size = (int32_t)taosArrayGetSize(pConsumerEp->vgs); for (int32_t i = 0; i < size; ++i) { - SMqVgEp *pMqVgEp = taosArrayGet(pConsumerEp->vgs, i); + SMqVgEp *pMqVgEp = (SMqVgEp *)taosArrayGetP(pConsumerEp->vgs, i); tmsgUpdateDnodeEpSet(&pMqVgEp->epSet); } pIter = taosHashIterate(pSub->consumerHash, pIter); @@ -1017,7 +1019,7 @@ int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pConsumerEp->consumerId, false); - mDebug("mnd show subscriptions: topic %s, consumer %" PRId64 " cgroup %s vgid %d", varDataVal(topic), + mDebug("mnd show subscriptions: topic %s, consumer:%" PRIx64 " cgroup %s vgid %d", varDataVal(topic), pConsumerEp->consumerId, varDataVal(cgroup), pVgEp->vgId); // offset diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index f618b8afae..f702d8f148 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -118,12 +118,12 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta transId, pTrans->createdTime, pMgmt->transId); mndTransExecute(pMnode, pTrans, false); mndReleaseTrans(pMnode, pTrans); - // sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); } else { mError("trans:%d, not found while execute in mnode since %s", transId, terrstr()); } } + sdbWriteFile(pMnode->pSdb, tsMndSdbWriteDelta); return 0; } @@ -319,6 +319,7 @@ int32_t mndInitSync(SMnode *pMnode) { mError("failed to open sync since %s", terrstr()); return -1; } + pMnode->pSdb->sync = pMgmt->sync; mInfo("mnode-sync is opened, id:%" PRId64, pMgmt->sync); return 0; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index a34dfff4d6..39b4252618 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -460,6 +460,8 @@ static const char *mndTransStr(ETrnStage stage) { return "commitAction"; case TRN_STAGE_FINISHED: return "finished"; + case TRN_STAGE_PRE_FINISH: + return "pre-finish"; default: return "invalid"; } @@ -503,14 +505,15 @@ static TransCbFp mndTransGetCbFp(ETrnFunc ftype) { } static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { - mTrace("trans:%d, perform insert action, row:%p stage:%s", pTrans->id, pTrans, mndTransStr(pTrans->stage)); + mInfo("trans:%d, perform insert action, row:%p stage:%s, callfunc:1, startFunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), + pTrans->startFunc); if (pTrans->startFunc > 0) { TransCbFp fp = mndTransGetCbFp(pTrans->startFunc); if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->startFunc = 0; + // pTrans->startFunc = 0; } return 0; @@ -546,14 +549,15 @@ static void mndTransDropData(STrans *pTrans) { } static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) { - mTrace("trans:%d, perform delete action, row:%p stage:%s callfunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), - callFunc); + mInfo("trans:%d, perform delete action, row:%p stage:%s callfunc:%d, stopFunc:%d", pTrans->id, pTrans, + mndTransStr(pTrans->stage), callFunc, pTrans->stopFunc); + if (pTrans->stopFunc > 0 && callFunc) { TransCbFp fp = mndTransGetCbFp(pTrans->stopFunc); if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->stopFunc = 0; + // pTrans->stopFunc = 0; } mndTransDropData(pTrans); @@ -572,7 +576,7 @@ static void mndTransUpdateActions(SArray *pOldArray, SArray *pNewArray) { } static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { - mTrace("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64, + mInfo("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64, pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage), pNew->createdTime); @@ -598,10 +602,15 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { } if (pOld->stage == TRN_STAGE_ROLLBACK) { - pOld->stage = TRN_STAGE_REDO_ACTION; + pOld->stage = TRN_STAGE_UNDO_ACTION; mTrace("trans:%d, stage from rollback to undoAction since perform update action", pNew->id); } + if (pOld->stage == TRN_STAGE_PRE_FINISH) { + pOld->stage = TRN_STAGE_FINISHED; + mTrace("trans:%d, stage from pre-finish to finished since perform update action", pNew->id); + } + return 0; } @@ -866,6 +875,7 @@ int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) { } } + if (mndCheckTransConflict(pMnode, pTrans)) { terrno = TSDB_CODE_MND_TRANS_CONFLICT; mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -931,6 +941,16 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) { return 0; } +static int32_t mndTransPreFinish(SMnode *pMnode, STrans *pTrans) { + mInfo("trans:%d, pre-finish transaction", pTrans->id); + if (mndTransSync(pMnode, pTrans) != 0) { + mError("trans:%d, failed to pre-finish since %s", pTrans->id, terrstr()); + return -1; + } + mInfo("trans:%d, pre-finish finished", pTrans->id); + return 0; +} + static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) { bool sendRsp = false; int32_t code = pTrans->code; @@ -1437,7 +1457,7 @@ static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans) { if (code == 0) { pTrans->code = 0; - pTrans->stage = TRN_STAGE_FINISHED; + pTrans->stage = TRN_STAGE_FINISHED; // TRN_STAGE_PRE_FINISH is not necessary mInfo("trans:%d, stage from commitAction to finished", pTrans->id); continueExec = true; } else { @@ -1455,8 +1475,8 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) { int32_t code = mndTransExecuteUndoActions(pMnode, pTrans); if (code == 0) { - pTrans->stage = TRN_STAGE_FINISHED; - mInfo("trans:%d, stage from undoAction to finished", pTrans->id); + pTrans->stage = TRN_STAGE_PRE_FINISH; + mInfo("trans:%d, stage from undoAction to pre-finish", pTrans->id); continueExec = true; } else if (code == TSDB_CODE_ACTION_IN_PROGRESS) { mInfo("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code)); @@ -1489,6 +1509,25 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) { return continueExec; } +static bool mndTransPerfromPreFinishedStage(SMnode *pMnode, STrans *pTrans) { + if (mndCannotExecuteTransAction(pMnode)) return false; + + bool continueExec = true; + int32_t code = mndTransPreFinish(pMnode, pTrans); + + if (code == 0) { + pTrans->stage = TRN_STAGE_FINISHED; + mInfo("trans:%d, stage from pre-finish to finish", pTrans->id); + continueExec = true; + } else { + pTrans->failedTimes++; + mError("trans:%d, stage keep on pre-finish since %s, failedTimes:%d", pTrans->id, terrstr(), pTrans->failedTimes); + continueExec = false; + } + + return continueExec; +} + static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) { bool continueExec = false; @@ -1545,6 +1584,14 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) { case TRN_STAGE_UNDO_ACTION: continueExec = mndTransPerformUndoActionStage(pMnode, pTrans); break; + case TRN_STAGE_PRE_FINISH: + if (isLeader) { + continueExec = mndTransPerfromPreFinishedStage(pMnode, pTrans); + } else { + mInfo("trans:%d, can not pre-finish since not leader", pTrans->id); + continueExec = false; + } + break; case TRN_STAGE_FINISHED: continueExec = mndTransPerfromFinishedStage(pMnode, pTrans); break; @@ -1645,8 +1692,6 @@ void mndTransPullup(SMnode *pMnode) { } mndReleaseTrans(pMnode, pTrans); } - - sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); taosArrayDestroy(pArray); } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index b7bcaf41fd..b5d9353b68 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -2209,11 +2209,12 @@ _OVER: bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid) { return !pVgroup->isTsma && pVgroup->dbUid == dbUid; } -static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, - int64_t compactTs) { +static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, int64_t compactTs, + STimeWindow tw) { SCompactVnodeReq compactReq = {0}; compactReq.dbUid = pDb->uid; compactReq.compactStartTime = compactTs; + compactReq.tw = tw; tstrncpy(compactReq.db, pDb->name, TSDB_DB_FNAME_LEN); mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId); @@ -2239,13 +2240,13 @@ static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgrou return pReq; } -static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, - int64_t compactTs) { +static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw) { STransAction action = {0}; action.epSet = mndGetVgroupEpset(pMnode, pVgroup); int32_t contLen = 0; - void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs); + void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs, tw); if (pReq == NULL) return -1; action.pCont = pReq; @@ -2260,7 +2261,8 @@ static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj * return 0; } -int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs) { - if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) return -1; +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw) { + if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs, tw) != 0) return -1; return 0; } \ No newline at end of file diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 2ae113e051..6ab6d364cb 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -32,13 +32,14 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { connectReq.pid = 1234; char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); strcpy(connectReq.app, "mnode_test_profile"); strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); @@ -66,7 +67,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -75,6 +76,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { strcpy(connectReq.db, "invalid_db"); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index 0ccefa7ca2..2e67ffa946 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -55,7 +55,7 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { TEST_F(MndTestShow, 03_ShowMsg_Conn) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -64,6 +64,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 8d2cec478c..e9a9e425e3 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -37,8 +37,6 @@ extern "C" { #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} // clang-format on -#define SDB_WRITE_DELTA 20 - #define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \ { \ if (func(pRaw, dataPos, val) != 0) { \ diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c index bb8040da07..9797dd8337 100644 --- a/source/dnode/mnode/sdb/src/sdb.c +++ b/source/dnode/mnode/sdb/src/sdb.c @@ -53,7 +53,6 @@ SSdb *sdbInit(SSdbOpt *pOption) { } pSdb->pWal = pOption->pWal; - pSdb->sync = pOption->sync; pSdb->applyIndex = -1; pSdb->applyTerm = -1; pSdb->applyConfig = -1; diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index c2d27ad713..2e182ec10b 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -472,10 +472,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { taosThreadMutexLock(&pSdb->filelock); if (pSdb->pWal != NULL) { - // code = walBeginSnapshot(pSdb->pWal, pSdb->applyIndex, 0); - if (pSdb->sync == 0) { - code = 0; - } else { + if (pSdb->sync > 0) { code = syncBeginSnapshot(pSdb->sync, pSdb->applyIndex); } } @@ -484,11 +481,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { } if (code == 0) { if (pSdb->pWal != NULL) { - // code = walEndSnapshot(pSdb->pWal); - - if (pSdb->sync == 0) { - code = 0; - } else { + if (pSdb->sync > 0) { code = syncEndSnapshot(pSdb->sync); } } diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index cc3dba2e07..569c78a68c 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -160,6 +160,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * if (insertFp != NULL) { code = (*insertFp)(pSdb, pRow->pObj); if (code != 0) { + if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR; code = terrno; taosHashRemove(hash, pRow->pObj, keySize); sdbFreeRow(pSdb, pRow, false); diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 8b13d8f02b..8dc3f46ae3 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -14,7 +14,6 @@ target_sources( "src/vnd/vnodeSvr.c" "src/vnd/vnodeSync.c" "src/vnd/vnodeSnapshot.c" - "src/vnd/vnodeCompact.c" "src/vnd/vnodeRetention.c" # meta @@ -53,7 +52,6 @@ target_sources( "src/tsdb/tsdbCacheRead.c" "src/tsdb/tsdbRetention.c" "src/tsdb/tsdbDiskData.c" - "src/tsdb/tsdbCompact.c" "src/tsdb/tsdbMergeTree.c" "src/tsdb/tsdbDataIter.c" @@ -69,10 +67,20 @@ target_sources( "src/tq/tqSnapshot.c" "src/tq/tqOffsetSnapshot.c" ) + +IF (TD_VNODE_PLUGINS) + target_sources( + vnode + PRIVATE + ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/tsdbCompact.c + ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/vnodeCompact.c + ) +ENDIF () + target_include_directories( vnode PUBLIC "inc" - PRIVATE "src/inc" + PUBLIC "src/inc" PUBLIC "${TD_SOURCE_DIR}/include/libs/scalar" ) target_link_libraries( diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index acfaccafe2..1d14829891 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -264,7 +264,7 @@ int32_t tqReaderSetTbUidList(STqReader *pReader, const SArray *tbUidList); int32_t tqReaderAddTbUidList(STqReader *pReader, const SArray *tbUidList); int32_t tqReaderRemoveTbUidList(STqReader *pReader, const SArray *tbUidList); -int32_t tqSeekVer(STqReader *pReader, int64_t ver); +int32_t tqSeekVer(STqReader *pReader, int64_t ver, const char* id); int32_t tqNextBlock(STqReader *pReader, SFetchRet *ret); int32_t tqReaderSetSubmitReq2(STqReader *pReader, void *msgStr, int32_t msgLen, int64_t ver); diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index 104e0945ba..792fed2309 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -67,7 +67,7 @@ typedef struct { // tqExec typedef struct { - char* qmsg; + char* qmsg; // SubPlanToString } STqExecCol; typedef struct { diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 44b7e95f9e..15087e90f0 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -766,6 +766,7 @@ typedef struct SCacheRowsReader { TdThreadMutex readerMutex; SVnode *pVnode; STSchema *pSchema; + STSchema *pCurrSchema; uint64_t uid; uint64_t suid; char **transferBuf; // todo remove it soon diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 88cd1d99e1..134909090f 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -106,10 +106,6 @@ int32_t vnodeSyncCommit(SVnode* pVnode); int32_t vnodeAsyncCommit(SVnode* pVnode); bool vnodeShouldRollback(SVnode* pVnode); -// vnodeCompact.c -int32_t vnodeAsyncCompact(SVnode* pVnode); -int32_t vnodeSyncCompact(SVnode* pVnode); - // vnodeSync.c int32_t vnodeSyncOpen(SVnode* pVnode, char* path); int32_t vnodeSyncStart(SVnode* pVnode); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index c0d017e350..0dff2420ec 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -457,9 +457,10 @@ struct SCommitInfo { }; struct SCompactInfo { - SVnode* pVnode; - int32_t flag; - int64_t commitID; + SVnode* pVnode; + int32_t flag; + int64_t commitID; + STimeWindow tw; }; #ifdef __cplusplus diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index c465617975..4d21a2e7f3 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -488,7 +488,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { // 2. check rebalance if (pHandle->consumerId != consumerId) { - tqError("tmq poll: consumer:0x%" PRIx64 " vgId:%d, subkey %s, mismatch for saved handle consumer:0x%" PRIx64, + tqDebug("ERROR tmq poll: consumer:0x%" PRIx64 " vgId:%d, subkey %s, mismatch for saved handle consumer:0x%" PRIx64, consumerId, TD_VID(pTq->pVnode), req.subKey, pHandle->consumerId); terrno = TSDB_CODE_TMQ_CONSUMER_MISMATCH; return -1; @@ -575,7 +575,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { return -1; } -#if 1 // till now, all data has been rsp to consumer, new data needs to push client once arrived. if (dataRsp.blockNum == 0 && dataRsp.reqOffset.type == TMQ_OFFSET__LOG && dataRsp.reqOffset.version == dataRsp.rspOffset.version) { @@ -597,7 +596,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { return 0; } } -#endif taosWUnLockLatch(&pTq->pushLock); if (tqSendDataRsp(pTq, pMsg, &req, &dataRsp) < 0) { @@ -613,10 +611,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } // for taosx - /*A(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN);*/ - SMqMetaRsp metaRsp = {0}; - STaosxRsp taosxRsp = {0}; tqInitTaosxRsp(&taosxRsp, &req); @@ -827,6 +822,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg pHandle = &tqHandle; /*taosInitRWLatch(&pExec->lock);*/ + uint64_t oldConsumerId = pHandle->consumerId; memcpy(pHandle->subKey, req.subKey, TSDB_SUBSCRIBE_KEY_LEN); pHandle->consumerId = req.newConsumerId; pHandle->epoch = -1; @@ -889,13 +885,16 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg (SSnapContext**)(&handle.sContext)); pHandle->execHandle.task = qCreateQueueExecTaskInfo(NULL, &handle, NULL, NULL); } + taosHashPut(pTq->pHandle, req.subKey, strlen(req.subKey), pHandle, sizeof(STqHandle)); - tqDebug("try to persist handle %s consumer:0x%" PRIx64, req.subKey, pHandle->consumerId); + tqDebug("try to persist handle %s consumer:0x%" PRIx64" , old consumer:0x%"PRIx64, req.subKey, pHandle->consumerId, + oldConsumerId); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { return -1; } } else { // TODO handle qmsg and exec modification + tqInfo("update the consumer info, old consumer id:0x%"PRIx64", new Id:0x%"PRIx64, pHandle->consumerId, req.newConsumerId); atomic_store_32(&pHandle->epoch, -1); atomic_store_64(&pHandle->consumerId, req.newConsumerId); atomic_add_fetch_32(&pHandle->epoch, 1); @@ -903,6 +902,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { qStreamCloseTsdbReader(pHandle->execHandle.task); } + if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { return -1; } diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 5638228641..f97c5ce93c 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -147,7 +147,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } tqDebug("tmqsnap task execute end, get %p", pDataBlock); - if (pDataBlock != NULL) { + if (pDataBlock != NULL && pDataBlock->info.rows > 0) { if (pRsp->withTbName) { if (pOffset->type == TMQ_OFFSET__LOG) { int64_t uid = pExec->pExecReader->lastBlkUid; diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 5352ebe6d4..bf73cca925 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -290,14 +290,14 @@ void tqCloseReader(STqReader* pReader) { taosMemoryFree(pReader); } -int32_t tqSeekVer(STqReader* pReader, int64_t ver) { +int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) { // todo set the correct vgId - tqDebug("tmq poll: vgId:%d wal seek to version:%"PRId64, 0, ver); + tqDebug("tmq poll: wal seek to version:%"PRId64" %s", ver, id); if (walReadSeekVer(pReader->pWalReader, ver) < 0) { - tqError("tmq poll: wal reader failed to seek to ver:%"PRId64, ver); + tqError("tmq poll: wal reader failed to seek to ver:%"PRId64" code:%s, %s", ver, tstrerror(terrno), id); return -1; } else { - tqDebug("tmq poll: wal reader seek to ver:%"PRId64, ver); + tqDebug("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id); return 0; } } @@ -307,36 +307,26 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { while (1) { if (!fromProcessedMsg) { - SWalReader* pWalReader = pReader->pWalReader; - - if (walNextValidMsg(pWalReader) < 0) { - pReader->ver = pWalReader->curVersion - (pWalReader->curInvalid | pWalReader->curStopped); + if (walNextValidMsg(pReader->pWalReader) < 0) { +// pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; + if(pReader->pWalReader->curInvalid == 0){ + pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; + }else{ + pReader->ver = walGetLastVer(pReader->pWalReader->pWal); + } ret->offset.type = TMQ_OFFSET__LOG; + ret->offset.version = pReader->ver; ret->fetchType = FETCH_TYPE__NONE; - tqDebug("return offset %" PRId64 ", no more valid", ret->offset.version); + tqDebug("return offset %" PRId64 ", no more valid msg in wal", ret->offset.version); return -1; } - void* body = POINTER_SHIFT(pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg)); - int32_t bodyLen = pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg); - int64_t ver = pWalReader->pHead->head.version; + void* body = POINTER_SHIFT(pReader->pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg)); + int32_t bodyLen = pReader->pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg); + int64_t ver = pReader->pWalReader->pHead->head.version; - tqDebug("tmq poll: extract submit msg from wal, version:%"PRId64" len:%d", ver, bodyLen); - -#if 0 - if (pWalReader->pHead->head.msgType != TDMT_VND_SUBMIT) { - // TODO do filter - ret->fetchType = FETCH_TYPE__META; - ret->meta = pWalReader->pHead->head.body; - return 0; - } else { -#endif tqReaderSetSubmitReq2(pReader, body, bodyLen, ver); - /*tqReaderSetDataMsg(pReader, body, pWalReader->pHead->head.version);*/ -#if 0 - } -#endif } while (tqNextDataBlock2(pReader)) { diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 79e0ccc3e3..dcf7286c00 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -257,9 +257,6 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, TS SLastCol lastCol = {.ts = keyTs, .colVal = colVal}; if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) { - SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol); - taosMemoryFree(pLastCol->colVal.value.pData); - lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData); if (lastCol.colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -378,9 +375,6 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb SLastCol lastCol = {.ts = keyTs, .colVal = colVal}; if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) { - SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol); - taosMemoryFree(pLastCol->colVal.value.pData); - lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData); if (lastCol.colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -1265,17 +1259,58 @@ _err: return code; } -static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) { - int32_t code = 0; +static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) { + SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol)); + if (NULL == pColArray) { + return TSDB_CODE_OUT_OF_MEMORY; + } + for (int32_t i = 0; i < pTSchema->numOfCols; ++i) { + SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)}; + taosArrayPush(pColArray, &col); + } + *ppColArray = pColArray; + return TSDB_CODE_SUCCESS; +} + +static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) { + int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols; + *ppDst = taosMemoryMalloc(len); + if (NULL == *ppDst) { + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(*ppDst, pSrc, len); + return TSDB_CODE_SUCCESS; +} + +static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) { + if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) { + return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema); + } + + if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) { + return TSDB_CODE_SUCCESS; + } + + taosMemoryFreeClear(pReader->pCurrSchema); + return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema); +} + +static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) { STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1); - int16_t nCol = pTSchema->numOfCols; + int16_t nLastCol = pTSchema->numOfCols; int16_t iCol = 0; int16_t noneCol = 0; bool setNoneCol = false; - SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol)); + bool hasRow = false; + SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; + int32_t code = initLastColArray(pTSchema, &pColArray); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + TSKEY lastRowTs = TSKEY_MAX; CacheNextRowIter iter = {0}; @@ -1290,6 +1325,15 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo break; } + hasRow = true; + + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; + int16_t nCol = pTSchema->numOfCols; + TSKEY rowTs = TSDBROW_TS(pRow); if (lastRowTs == TSKEY_MAX) { @@ -1297,29 +1341,27 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs}); - if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } + taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}); for (iCol = 1; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } + SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (pCol->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) { - lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData); - if (lastCol.colVal.value.pData == NULL) { + pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); + if (pCol->colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - - if (taosArrayPush(pColArray, &lastCol) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; + memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); } if (COL_VAL_IS_NONE(pColVal) && !setNoneCol) { @@ -1376,6 +1418,9 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo //*ppColArray = NULL; // taosArrayDestroy(pColArray); //} else { + if (!hasRow) { + taosArrayClear(pColArray); + } *ppColArray = pColArray; //} @@ -1391,16 +1436,19 @@ _err: } static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) { - int32_t code = 0; - STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1); - int16_t nCol = pTSchema->numOfCols; - int16_t iCol = 0; + int16_t nLastCol = pTSchema->numOfCols; int16_t noneCol = 0; bool setNoneCol = false; - SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol)); + bool hasRow = false; + SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; + int32_t code = initLastColArray(pTSchema, &pColArray); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + TSKEY lastRowTs = TSKEY_MAX; CacheNextRowIter iter = {0}; @@ -1415,6 +1463,15 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach break; } + hasRow = true; + + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; + int16_t nCol = pTSchema->numOfCols; + TSKEY rowTs = TSDBROW_TS(pRow); if (lastRowTs == TSKEY_MAX) { @@ -1422,28 +1479,27 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs}); - if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } + taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}); - for (iCol = 1; iCol < nCol; ++iCol) { + for (int16_t iCol = 1; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } + SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (pCol->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) { - lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData); - if (lastCol.colVal.value.pData == NULL) { + pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); + if (pCol->colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - - if (taosArrayPush(pColArray, &lastCol) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; + memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); } if (!COL_VAL_IS_VALUE(pColVal) && !setNoneCol) { @@ -1461,10 +1517,16 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach // merge into pColArray setNoneCol = false; - for (iCol = noneCol; iCol < nCol; ++iCol) { + for (int16_t iCol = noneCol; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } // high version's column value SLastCol *lastColVal = (SLastCol *)taosArrayGet(pColArray, iCol); - SColVal *tColVal = &lastColVal->colVal; + if (lastColVal->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } + SColVal *tColVal = &lastColVal->colVal; tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); if (!COL_VAL_IS_VALUE(tColVal) && COL_VAL_IS_VALUE(pColVal)) { @@ -1494,6 +1556,9 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach //*ppLastArray = NULL; // taosArrayDestroy(pColArray); //} else { + if (!hasRow) { + taosArrayClear(pColArray); + } *ppLastArray = pColArray; //} diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 97b13a3c37..5528b6313c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -38,16 +38,17 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p *(int64_t*)p->buf = pColVal->ts; allNullRow = false; } else { - int32_t slotId = slotIds[i]; - SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); - + int32_t slotId = slotIds[i]; // add check for null value, caused by the modification of table schema (new column added). - if (pColVal == NULL) { + if (slotId >= taosArrayGetSize(pRow)) { p->ts = 0; p->isNull = true; + colDataSetNULL(pColInfoData, numOfRows); continue; } + SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); + p->ts = pColVal->ts; p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal); allNullRow = p->isNull & allNullRow; @@ -79,7 +80,12 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, 0); colDataSetVal(pColInfoData, numOfRows, (const char*)&pColVal->ts, false); } else { - int32_t slotId = slotIds[i]; + int32_t slotId = slotIds[i]; + // add check for null value, caused by the modification of table schema (new column added). + if (slotId >= taosArrayGetSize(pRow)) { + colDataSetNULL(pColInfoData, numOfRows); + continue; + } SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); SColVal* pVal = &pColVal->colVal; @@ -209,6 +215,8 @@ void* tsdbCacherowsReaderClose(void* pReader) { taosMemoryFree(p->pSchema); } + taosMemoryFree(p->pCurrSchema); + destroyLastBlockLoadInfo(p->pLoadInfo); taosMemoryFree((void*)p->idstr); @@ -290,7 +298,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } for (int32_t j = 0; j < pr->numOfCols; ++j) { - pRes[j] = taosMemoryCalloc(1, sizeof(SFirstLastRes) + pr->pSchema->columns[slotIds[j]].bytes + VARSTR_HEADER_SIZE); + pRes[j] = taosMemoryCalloc( + 1, sizeof(SFirstLastRes) + pr->pSchema->columns[-1 == slotIds[j] ? 0 : slotIds[j]].bytes + VARSTR_HEADER_SIZE); SFirstLastRes* p = (SFirstLastRes*)varDataVal(pRes[j]); p->ts = INT64_MIN; } @@ -303,7 +312,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 for (int32_t i = 0; i < pr->pSchema->numOfCols; ++i) { struct STColumn* pCol = &pr->pSchema->columns[i]; - SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type}; + SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type, .colVal.flag = CV_FLAG_NULL}; if (IS_VAR_DATA_TYPE(pCol->type)) { p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char)); diff --git a/source/dnode/vnode/src/tsdb/tsdbCompact.c b/source/dnode/vnode/src/tsdb/tsdbCompact.c deleted file mode 100644 index 1cd11a3039..0000000000 --- a/source/dnode/vnode/src/tsdb/tsdbCompact.c +++ /dev/null @@ -1,664 +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 . - */ - -#include "tsdb.h" - -extern int32_t tsdbUpdateTableSchema(SMeta *pMeta, int64_t suid, int64_t uid, SSkmInfo *pSkmInfo); -extern int32_t tsdbWriteDataBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SMapData *mDataBlk, int8_t cmprAlg); -extern int32_t tsdbWriteSttBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SArray *aSttBlk, int8_t cmprAlg); - -typedef struct { - STsdb *pTsdb; - int64_t commitID; - int8_t cmprAlg; - int32_t maxRows; - int32_t minRows; - - STsdbFS fs; - - int32_t fid; - TABLEID tbid; - SSkmInfo tbSkm; - - // Tombstone - SDelFReader *pDelFReader; - SArray *aDelIdx; // SArray - SArray *aDelData; // SArray - SArray *aSkyLine; // SArray - int32_t iDelIdx; - int32_t iSkyLine; - TSDBKEY *pDKey; - TSDBKEY dKey; - - // Reader - SDataFReader *pReader; - STsdbDataIter2 *iterList; // list of iterators - STsdbDataIter2 *pIter; - SRBTree rbt; - - // Writer - SDataFWriter *pWriter; - SArray *aBlockIdx; // SArray - SMapData mDataBlk; // SMapData - SArray *aSttBlk; // SArray - SBlockData bData; - SBlockData sData; -} STsdbCompactor; - -static int32_t tsdbAbortCompact(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - STsdb *pTsdb = pCompactor->pTsdb; - code = tsdbFSRollback(pTsdb); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); - } else { - tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); - } - return code; -} - -static int32_t tsdbCompactWriteTableDataStart(STsdbCompactor *pCompactor, TABLEID *pId) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->tbid = *pId; - - // tombstone - for (;;) { - if (pCompactor->iDelIdx >= taosArrayGetSize(pCompactor->aDelIdx)) { - pCompactor->pDKey = NULL; - break; - } - - SDelIdx *pDelIdx = (SDelIdx *)taosArrayGet(pCompactor->aDelIdx, pCompactor->iDelIdx); - int32_t c = tTABLEIDCmprFn(pDelIdx, &pCompactor->tbid); - if (c < 0) { - pCompactor->iDelIdx++; - } else if (c == 0) { - pCompactor->iDelIdx++; - - code = tsdbReadDelData(pCompactor->pDelFReader, pDelIdx, pCompactor->aDelData); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbBuildDeleteSkyline(pCompactor->aDelData, 0, taosArrayGetSize(pCompactor->aDelData) - 1, - pCompactor->aSkyLine); - TSDB_CHECK_CODE(code, lino, _exit); - - pCompactor->iSkyLine = 0; - if (pCompactor->iSkyLine < taosArrayGetSize(pCompactor->aSkyLine)) { - TSDBKEY *pKey = (TSDBKEY *)taosArrayGet(pCompactor->aSkyLine, pCompactor->iSkyLine); - - pCompactor->dKey.version = 0; - pCompactor->dKey.ts = pKey->ts; - pCompactor->pDKey = &pCompactor->dKey; - } else { - pCompactor->pDKey = NULL; - } - break; - } else { - pCompactor->pDKey = NULL; - break; - } - } - - // writer - code = tsdbUpdateTableSchema(pCompactor->pTsdb->pVnode->pMeta, pId->suid, pId->uid, &pCompactor->tbSkm); - TSDB_CHECK_CODE(code, lino, _exit); - - tMapDataReset(&pCompactor->mDataBlk); - - code = tBlockDataInit(&pCompactor->bData, pId, pCompactor->tbSkm.pTSchema, NULL, 0); - TSDB_CHECK_CODE(code, lino, _exit); - - if (!TABLE_SAME_SCHEMA(pCompactor->sData.suid, pCompactor->sData.uid, pId->suid, pId->uid)) { - if (pCompactor->sData.nRow > 0) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - - TABLEID tbid = {.suid = pId->suid, .uid = pId->suid ? 0 : pId->uid}; - code = tBlockDataInit(&pCompactor->sData, &tbid, pCompactor->tbSkm.pTSchema, NULL, 0); - TSDB_CHECK_CODE(code, lino, _exit); - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else { - tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pId->suid, - pId->uid); - } - return code; -} - -static int32_t tsdbCompactWriteTableDataEnd(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - if (pCompactor->bData.nRow > 0) { - if (pCompactor->bData.nRow < pCompactor->minRows) { - for (int32_t iRow = 0; iRow < pCompactor->bData.nRow; iRow++) { - code = tBlockDataAppendRow(&pCompactor->sData, &tsdbRowFromBlockData(&pCompactor->bData, iRow), NULL, - pCompactor->tbid.uid); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->sData.nRow >= pCompactor->maxRows) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - tBlockDataClear(&pCompactor->bData); - } else { - code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - - if (pCompactor->mDataBlk.nItem > 0) { - SBlockIdx *pBlockIdx = (SBlockIdx *)taosArrayReserve(pCompactor->aBlockIdx, 1); - if (pBlockIdx == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - pBlockIdx->suid = pCompactor->tbid.suid; - pBlockIdx->uid = pCompactor->tbid.uid; - - code = tsdbWriteDataBlk(pCompactor->pWriter, &pCompactor->mDataBlk, pBlockIdx); - TSDB_CHECK_CODE(code, lino, _exit); - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else { - tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, - pCompactor->tbid.suid, pCompactor->tbid.uid); - } - return code; -} - -static bool tsdbCompactRowIsDeleted(STsdbCompactor *pCompactor, TSDBROW *pRow) { - TSDBKEY tKey = TSDBROW_KEY(pRow); - TSDBKEY *aKey = (TSDBKEY *)TARRAY_DATA(pCompactor->aSkyLine); - int32_t nKey = TARRAY_SIZE(pCompactor->aSkyLine); - - if (tKey.ts > pCompactor->pDKey->ts) { - do { - pCompactor->pDKey->version = aKey[pCompactor->iSkyLine].version; - pCompactor->iSkyLine++; - if (pCompactor->iSkyLine < nKey) { - pCompactor->dKey.ts = aKey[pCompactor->iSkyLine].ts; - } else { - if (pCompactor->pDKey->version == 0) { - pCompactor->pDKey = NULL; - return false; - } else { - pCompactor->pDKey->ts = INT64_MAX; - } - } - } while (tKey.ts > pCompactor->pDKey->ts); - } - - if (tKey.ts < pCompactor->pDKey->ts) { - if (tKey.version > pCompactor->pDKey->version) { - return false; - } else { - return true; - } - } else if (tKey.ts == pCompactor->pDKey->ts) { - ASSERT(pCompactor->iSkyLine < nKey); - if (tKey.version > TMAX(pCompactor->pDKey->version, aKey[pCompactor->iSkyLine].version)) { - return false; - } else { - return true; - } - } - - return false; -} - -static int32_t tsdbCompactWriteTableData(STsdbCompactor *pCompactor, SRowInfo *pRowInfo) { - int32_t code = 0; - int32_t lino = 0; - - // start a new table data write if need - if (pRowInfo == NULL || pRowInfo->uid != pCompactor->tbid.uid) { - if (pCompactor->tbid.uid) { - code = tsdbCompactWriteTableDataEnd(pCompactor); - TSDB_CHECK_CODE(code, lino, _exit); - } - - if (pRowInfo == NULL) { - if (pCompactor->sData.nRow > 0) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - return code; - } - - code = tsdbCompactWriteTableDataStart(pCompactor, (TABLEID *)pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - } - - // check if row is deleted - if (pCompactor->pDKey && tsdbCompactRowIsDeleted(pCompactor, &pRowInfo->row)) goto _exit; - - if (tBlockDataTryUpsertRow(&pCompactor->bData, &pRowInfo->row, pRowInfo->uid) > pCompactor->maxRows) { - code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tBlockDataUpsertRow(&pCompactor->bData, &pRowInfo->row, NULL, pRowInfo->uid); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else if (pRowInfo) { - tsdbTrace("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64 " ts:%" PRId64 " version:%" PRId64, - TD_VID(pCompactor->pTsdb->pVnode), __func__, pRowInfo->suid, pRowInfo->uid, TSDBROW_TS(&pRowInfo->row), - TSDBROW_VERSION(&pRowInfo->row)); - } - return code; -} - -static bool tsdbCompactTableIsDropped(STsdbCompactor *pCompactor) { - SMetaInfo info; - - if (pCompactor->pIter->rowInfo.uid == pCompactor->tbid.uid) return false; - if (metaGetInfo(pCompactor->pTsdb->pVnode->pMeta, pCompactor->pIter->rowInfo.uid, &info, NULL)) { - return true; - } - return false; -} -static int32_t tsdbCompactNextRow(STsdbCompactor *pCompactor, SRowInfo **ppRowInfo) { - int32_t code = 0; - int32_t lino = 0; - - for (;;) { - if (pCompactor->pIter) { - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter->rowInfo.suid == 0 && pCompactor->pIter->rowInfo.uid == 0) { - pCompactor->pIter = NULL; - } else { - SRBTreeNode *pNode = tRBTreeMin(&pCompactor->rbt); - if (pNode) { - int32_t c = tsdbDataIterCmprFn(&pCompactor->pIter->rbtn, pNode); - if (c > 0) { - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - pCompactor->pIter = NULL; - } else if (c == 0) { - ASSERT(0); - } - } - } - } - - if (pCompactor->pIter == NULL) { - SRBTreeNode *pNode = tRBTreeDropMin(&pCompactor->rbt); - if (pNode) { - pCompactor->pIter = TSDB_RBTN_TO_DATA_ITER(pNode); - } - } - - if (pCompactor->pIter) { - if (tsdbCompactTableIsDropped(pCompactor)) { - TABLEID tbid = {.suid = pCompactor->pIter->rowInfo.suid, .uid = pCompactor->pIter->rowInfo.uid}; - tRBTreeClear(&pCompactor->rbt); - for (pCompactor->pIter = pCompactor->iterList; pCompactor->pIter; pCompactor->pIter = pCompactor->pIter->next) { - code = tsdbDataIterNext2(pCompactor->pIter, - &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_TABLEID, .tbid = tbid}); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid) { - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - } - } else { - *ppRowInfo = &pCompactor->pIter->rowInfo; - break; - } - } else { - *ppRowInfo = NULL; - break; - } - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } - return code; -} - -static int32_t tsdbCompactFileSetStart(STsdbCompactor *pCompactor, SDFileSet *pSet) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->fid = pSet->fid; - pCompactor->tbid = (TABLEID){0}; - - /* tombstone */ - pCompactor->iDelIdx = 0; - - /* reader */ - code = tsdbDataFReaderOpen(&pCompactor->pReader, pCompactor->pTsdb, pSet); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbOpenDataFileDataIter(pCompactor->pReader, &pCompactor->pIter); - TSDB_CHECK_CODE(code, lino, _exit); - - tRBTreeCreate(&pCompactor->rbt, tsdbDataIterCmprFn); - if (pCompactor->pIter) { - pCompactor->pIter->next = pCompactor->iterList; - pCompactor->iterList = pCompactor->pIter; - - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - - for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { - code = tsdbOpenSttFileDataIter(pCompactor->pReader, iStt, &pCompactor->pIter); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter) { - pCompactor->pIter->next = pCompactor->iterList; - pCompactor->iterList = pCompactor->pIter; - - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - } - pCompactor->pIter = NULL; - - /* writer */ - code = tsdbDataFWriterOpen(&pCompactor->pWriter, pCompactor->pTsdb, - &(SDFileSet){.fid = pCompactor->fid, - .diskId = pSet->diskId, - .pHeadF = &(SHeadFile){.commitID = pCompactor->commitID}, - .pDataF = &(SDataFile){.commitID = pCompactor->commitID}, - .pSmaF = &(SSmaFile){.commitID = pCompactor->commitID}, - .nSttF = 1, - .aSttF = {&(SSttFile){.commitID = pCompactor->commitID}}}); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->aBlockIdx) { - taosArrayClear(pCompactor->aBlockIdx); - } else if ((pCompactor->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - tMapDataReset(&pCompactor->mDataBlk); - - if (pCompactor->aSttBlk) { - taosArrayClear(pCompactor->aSttBlk); - } else if ((pCompactor->aSttBlk = taosArrayInit(0, sizeof(SSttBlk))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - tBlockDataReset(&pCompactor->bData); - tBlockDataReset(&pCompactor->sData); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - } else { - tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); - } - return code; -} - -static int32_t tsdbCompactFileSetEnd(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - ASSERT(pCompactor->bData.nRow == 0); - ASSERT(pCompactor->sData.nRow == 0); - - /* update files */ - code = tsdbWriteSttBlk(pCompactor->pWriter, pCompactor->aSttBlk); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbWriteBlockIdx(pCompactor->pWriter, pCompactor->aBlockIdx); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbUpdateDFileSetHeader(pCompactor->pWriter); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbFSUpsertFSet(&pCompactor->fs, &pCompactor->pWriter->wSet); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbDataFWriterClose(&pCompactor->pWriter, 1); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbDataFReaderClose(&pCompactor->pReader); - TSDB_CHECK_CODE(code, lino, _exit); - - /* do clear */ - while ((pCompactor->pIter = pCompactor->iterList) != NULL) { - pCompactor->iterList = pCompactor->pIter->next; - tsdbCloseDataIter2(pCompactor->pIter); - } - - tBlockDataReset(&pCompactor->bData); - tBlockDataReset(&pCompactor->sData); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - } else { - tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); - } - return code; -} - -static int32_t tsdbCompactFileSet(STsdbCompactor *pCompactor, SDFileSet *pSet) { - int32_t code = 0; - int32_t lino = 0; - - // start compact - code = tsdbCompactFileSetStart(pCompactor, pSet); - TSDB_CHECK_CODE(code, lino, _exit); - - // do compact, end with a NULL row - SRowInfo *pRowInfo; - do { - code = tsdbCompactNextRow(pCompactor, &pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbCompactWriteTableData(pCompactor, pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - } while (pRowInfo); - - // end compact - code = tsdbCompactFileSetEnd(pCompactor); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - if (pCompactor->pWriter) tsdbDataFWriterClose(&pCompactor->pWriter, 0); - while ((pCompactor->pIter = pCompactor->iterList)) { - pCompactor->iterList = pCompactor->pIter->next; - tsdbCloseDataIter2(pCompactor->pIter); - } - if (pCompactor->pReader) tsdbDataFReaderClose(&pCompactor->pReader); - } - return code; -} - -static void tsdbEndCompact(STsdbCompactor *pCompactor) { - // writer - tBlockDataDestroy(&pCompactor->sData); - tBlockDataDestroy(&pCompactor->bData); - taosArrayDestroy(pCompactor->aSttBlk); - tMapDataClear(&pCompactor->mDataBlk); - taosArrayDestroy(pCompactor->aBlockIdx); - - // reader - - // tombstone - taosArrayDestroy(pCompactor->aSkyLine); - taosArrayDestroy(pCompactor->aDelData); - taosArrayDestroy(pCompactor->aDelIdx); - - // others - tDestroyTSchema(pCompactor->tbSkm.pTSchema); - tsdbFSDestroy(&pCompactor->fs); - - tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->commitID); -} - -static int32_t tsdbBeginCompact(STsdb *pTsdb, SCompactInfo *pInfo, STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->pTsdb = pTsdb; - pCompactor->commitID = pInfo->commitID; - pCompactor->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression; - pCompactor->maxRows = pTsdb->pVnode->config.tsdbCfg.maxRows; - pCompactor->minRows = pTsdb->pVnode->config.tsdbCfg.minRows; - pCompactor->fid = INT32_MIN; - - code = tsdbFSCopy(pTsdb, &pCompactor->fs); - TSDB_CHECK_CODE(code, lino, _exit); - - /* tombstone */ - if (pCompactor->fs.pDelFile) { - code = tsdbDelFReaderOpen(&pCompactor->pDelFReader, pCompactor->fs.pDelFile, pTsdb); - TSDB_CHECK_CODE(code, lino, _exit); - - if ((pCompactor->aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - if ((pCompactor->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - if ((pCompactor->aSkyLine = taosArrayInit(0, sizeof(TSDBKEY))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tsdbReadDelIdx(pCompactor->pDelFReader, pCompactor->aDelIdx); - TSDB_CHECK_CODE(code, lino, _exit); - } - - /* reader */ - - /* writer */ - code = tBlockDataCreate(&pCompactor->bData); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tBlockDataCreate(&pCompactor->sData); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->commitID); - tBlockDataDestroy(&pCompactor->sData); - tBlockDataDestroy(&pCompactor->bData); - if (pCompactor->fs.pDelFile) { - taosArrayDestroy(pCompactor->aSkyLine); - taosArrayDestroy(pCompactor->aDelData); - taosArrayDestroy(pCompactor->aDelIdx); - if (pCompactor->pDelFReader) tsdbDelFReaderClose(&pCompactor->pDelFReader); - } - tsdbFSDestroy(&pCompactor->fs); - } else { - tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, pCompactor->commitID); - } - return code; -} - -int32_t tsdbCompact(STsdb *pTsdb, SCompactInfo *pInfo) { - int32_t code = 0; - - STsdbCompactor *pCompactor = &(STsdbCompactor){0}; - - if ((code = tsdbBeginCompact(pTsdb, pInfo, pCompactor))) return code; - - for (;;) { - SDFileSet *pSet = (SDFileSet *)taosArraySearch(pCompactor->fs.aDFileSet, &(SDFileSet){.fid = pCompactor->fid}, - tDFileSetCmprFn, TD_GT); - if (pSet == NULL) { - pCompactor->fid = INT32_MAX; - break; - } - - if ((code = tsdbCompactFileSet(pCompactor, pSet))) goto _exit; - } - - if ((code = tsdbFSUpsertDelFile(&pCompactor->fs, NULL))) goto _exit; - -_exit: - if (code) { - tsdbAbortCompact(pCompactor); - } else { - tsdbFSPrepareCommit(pTsdb, &pCompactor->fs); - } - tsdbEndCompact(pCompactor); - return code; -} - -int32_t tsdbCommitCompact(STsdb *pTsdb) { - int32_t code = 0; - int32_t lino = 0; - - taosThreadRwlockWrlock(&pTsdb->rwLock); - - code = tsdbFSCommit(pTsdb); - if (code) { - taosThreadRwlockUnlock(&pTsdb->rwLock); - TSDB_CHECK_CODE(code, lino, _exit); - } - - taosThreadRwlockUnlock(&pTsdb->rwLock); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); - } else { - tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); - } - return code; -} diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index d4af0422d7..d9d60442ff 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -404,7 +404,7 @@ void tLDataIterNextBlock(SLDataIter *pIter, const char *idStr) { tsdbDebug("try next last file block:%d from %d, trigger by uid:%" PRIu64 ", file index:%d, %s", pIter->iSttBlk, oldIndex, pIter->uid, pIter->iStt, idStr); } else { - tsdbDebug("no more last block qualified, uid:%" PRIu64 ", file index::%d, %s", pIter->uid, oldIndex, idStr); + tsdbDebug("no more last block qualified, uid:%" PRIu64 ", file index:%d, %s", pIter->uid, oldIndex, idStr); } } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index f18547e2b3..31153f0832 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -44,6 +44,7 @@ typedef struct SBlockIndex { typedef struct STableBlockScanInfo { uint64_t uid; TSKEY lastKey; + TSKEY lastKeyInStt; // last accessed key in stt SMapData mapData; // block info (compressed) SArray* pBlockList; // block data index list, SArray SIterInfo iter; // mem buffer skip list iterator @@ -192,7 +193,7 @@ static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbRe static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader, SRowMerger* pMerger); static int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, - SRowMerger* pMerger, SVersionRange* pVerRange); + SRowMerger* pMerger, SVersionRange* pVerRange, const char* id); static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader); static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pTSRow, @@ -314,11 +315,11 @@ static int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) } if (pBuf->numOfTables > 0) { - STableBlockScanInfo **p = (STableBlockScanInfo**)taosArrayPop(pBuf->pData); + STableBlockScanInfo** p = (STableBlockScanInfo**)taosArrayPop(pBuf->pData); taosMemoryFree(*p); pBuf->numOfTables /= pBuf->numPerBucket; } - + int32_t num = (numOfTables - pBuf->numOfTables) / pBuf->numPerBucket; int32_t remainder = (numOfTables - pBuf->numOfTables) % pBuf->numPerBucket; if (pBuf->pData == NULL) { @@ -402,9 +403,11 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf if (ASCENDING_TRAVERSE(pTsdbReader->order)) { int64_t skey = pTsdbReader->window.skey; pScanInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey; + pScanInfo->lastKeyInStt = skey; } else { int64_t ekey = pTsdbReader->window.ekey; pScanInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; + pScanInfo->lastKeyInStt = ekey; } taosHashPut(pTableMap, &pScanInfo->uid, sizeof(uint64_t), &pScanInfo, POINTER_BYTES); @@ -1797,21 +1800,18 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc while (1) { bool hasVal = tMergeTreeNext(&pLastBlockReader->mergeTree); - if (!hasVal) { + if (!hasVal) { // the next value will be the accessed key in stt + pScanInfo->lastKeyInStt += step; return false; } TSDBROW row = tMergeTreeGetRow(&pLastBlockReader->mergeTree); TSDBKEY k = TSDBROW_KEY(&row); - if (hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { - pScanInfo->lastKey = k.ts; - } else { + pScanInfo->lastKeyInStt = k.ts; + + if (!hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { // the qualifed ts may equal to k.ts, only a greater version one. // here we need to fallback one step. - if (pScanInfo->lastKey == k.ts) { - pScanInfo->lastKey -= step; - } - return true; } } @@ -1951,7 +1951,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == k.ts) { @@ -1999,7 +1999,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == key) { @@ -2052,7 +2052,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(&merge, &fRow1); - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr); code = tsdbRowMergerGetRow(&merge, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -2070,7 +2070,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, return code; } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr); // merge with block data if ts == key if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) { @@ -2123,7 +2123,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(&merge, &fRow1); - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange, pReader->idStr); code = tsdbRowMergerGetRow(&merge, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -2232,7 +2232,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == ik.ts) { @@ -2323,7 +2323,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == key) { @@ -2474,9 +2474,9 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan int32_t step = ASCENDING_TRAVERSE(pLBlockReader->order) ? 1 : -1; STimeWindow w = pLBlockReader->window; if (ASCENDING_TRAVERSE(pLBlockReader->order)) { - w.skey = pScanInfo->lastKey + step; + w.skey = pScanInfo->lastKeyInStt; } else { - w.ekey = pScanInfo->lastKey + step; + w.ekey = pScanInfo->lastKeyInStt; } tsdbDebug("init last block reader, window:%" PRId64 "-%" PRId64 ", uid:%" PRIu64 ", %s", w.skey, w.ekey, @@ -3514,6 +3514,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn CHECK_FILEBLOCK_STATE* state) { SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SBlockData* pBlockData = &pReader->status.fileBlockData; + bool asc = ASCENDING_TRAVERSE(pReader->order); *state = CHECK_FILEBLOCK_QUIT; int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1; @@ -3524,7 +3525,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) { pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step); - if (pDumpInfo->rowIndex >= pDumpInfo->totalRows) { + if ((pDumpInfo->rowIndex >= pDumpInfo->totalRows && asc) || (pDumpInfo->rowIndex < 0 && !asc)) { *state = CHECK_FILEBLOCK_CONT; } } @@ -3569,13 +3570,16 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc } int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, - SRowMerger* pMerger, SVersionRange* pVerRange) { + SRowMerger* pMerger, SVersionRange* pVerRange, const char* idStr) { while (nextRowFromLastBlocks(pLastBlockReader, pScanInfo, pVerRange)) { int64_t next1 = getCurrentKeyInLastBlock(pLastBlockReader); if (next1 == ts) { TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(pMerger, &fRow1); } else { + tsdbTrace("uid:%" PRIu64 " last del index:%d, del range:%d, lastKeyInStt:%" PRId64 ", %s", pScanInfo->uid, + pScanInfo->lastBlockDelIndex, (int32_t)taosArrayGetSize(pScanInfo->delSkyline), pScanInfo->lastKeyInStt, + idStr); break; } } @@ -3925,7 +3929,8 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n if (code) { return code; } - pReader->status.uidList.tableUidList = (uint64_t*)taosMemoryRealloc(pReader->status.uidList.tableUidList, sizeof(uint64_t) * num); + pReader->status.uidList.tableUidList = + (uint64_t*)taosMemoryRealloc(pReader->status.uidList.tableUidList, sizeof(uint64_t) * num); } taosHashClear(pReader->status.pTableMap); @@ -3938,6 +3943,17 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n pInfo->uid = pList[i].uid; pUidList->tableUidList[i] = pList[i].uid; + // todo extract method + if (ASCENDING_TRAVERSE(pReader->order)) { + int64_t skey = pReader->window.skey; + pInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey; + pInfo->lastKeyInStt = skey; + } else { + int64_t ekey = pReader->window.ekey; + pInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; + pInfo->lastKeyInStt = ekey; + } + taosHashPut(pReader->status.pTableMap, &pInfo->uid, sizeof(uint64_t), &pInfo, POINTER_BYTES); } @@ -4723,11 +4739,10 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) { } static int32_t getBucketIndex(int32_t startRow, int32_t bucketRange, int32_t numOfRows, int32_t numOfBucket) { - int32_t bucketIndex = ((numOfRows - startRow) / bucketRange); + int32_t bucketIndex = ((numOfRows - startRow) / bucketRange); if (bucketIndex == numOfBucket) { bucketIndex -= 1; } - return bucketIndex; } @@ -4741,6 +4756,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa // find the start data block in file + // find the start data block in file tsdbAcquireReader(pReader); if (pReader->suspended) { tsdbReaderResume(pReader); diff --git a/source/dnode/vnode/src/vnd/vnodeCompact.c b/source/dnode/vnode/src/vnd/vnodeCompact.c deleted file mode 100644 index 2b7abee99a..0000000000 --- a/source/dnode/vnode/src/vnd/vnodeCompact.c +++ /dev/null @@ -1,120 +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 . - */ - -#include "vnd.h" - -extern int32_t tsdbCommitCompact(STsdb *pTsdb); - -static int32_t vnodeCompactTask(void *param) { - int32_t code = 0; - int32_t lino = 0; - - SCompactInfo *pInfo = (SCompactInfo *)param; - SVnode *pVnode = pInfo->pVnode; - - // do compact - code = tsdbCompact(pInfo->pVnode->pTsdb, pInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - // end compact - char dir[TSDB_FILENAME_LEN] = {0}; - if (pVnode->pTfs) { - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); - } else { - snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); - } - - vnodeCommitInfo(dir); - - tsdbCommitCompact(pVnode->pTsdb); - -_exit: - tsem_post(&pInfo->pVnode->canCommit); - taosMemoryFree(pInfo); - return code; -} -static int32_t vnodePrepareCompact(SVnode *pVnode, SCompactInfo *pInfo) { - int32_t code = 0; - int32_t lino = 0; - - tsem_wait(&pVnode->canCommit); - - pInfo->pVnode = pVnode; - pInfo->flag = 0; - pInfo->commitID = ++pVnode->state.commitID; - - char dir[TSDB_FILENAME_LEN] = {0}; - SVnodeInfo info = {0}; - - if (pVnode->pTfs) { - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); - } else { - snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); - } - - if (vnodeLoadInfo(dir, &info) < 0) { - code = terrno; - goto _exit; - } - - info.state.commitID = pInfo->commitID; - - if (vnodeSaveInfo(dir, &info) < 0) { - code = terrno; - goto _exit; - } - -_exit: - if (code) { - vError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pVnode), __func__, lino, tstrerror(code), - pVnode->state.commitID); - } else { - vDebug("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pVnode), __func__, pVnode->state.commitID); - } - return code; -} -int32_t vnodeAsyncCompact(SVnode *pVnode) { - int32_t code = 0; - int32_t lino = 0; - - SCompactInfo *pInfo = taosMemoryCalloc(1, sizeof(*pInfo)); - if (pInfo == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - vnodeAsyncCommit(pVnode); - - code = vnodePrepareCompact(pVnode, pInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - vnodeScheduleTask(vnodeCompactTask, pInfo); - -_exit: - if (code) { - vError("vgId:%d %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); - if (pInfo) taosMemoryFree(pInfo); - } else { - vInfo("vgId:%d %s done", TD_VID(pVnode), __func__); - } - return code; -} - -int32_t vnodeSyncCompact(SVnode *pVnode) { - vnodeAsyncCompact(pVnode); - tsem_wait(&pVnode->canCommit); - tsem_post(&pVnode->canCommit); - return 0; -} \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 192a3615e1..fb8d230eba 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -211,6 +211,11 @@ static int32_t vnodePreProcessSubmitMsg(SVnode *pVnode, SRpcMsg *pMsg) { SDecoder *pCoder = &(SDecoder){0}; + if (taosHton64(((SSubmitReq2Msg *)pMsg->pCont)->version) != 1) { + code = TSDB_CODE_INVALID_MSG; + TSDB_CHECK_CODE(code, lino, _exit); + } + tDecoderInit(pCoder, (uint8_t *)pMsg->pCont + sizeof(SSubmitReq2Msg), pMsg->contLen - sizeof(SSubmitReq2Msg)); if (tStartDecode(pCoder) < 0) { @@ -599,16 +604,10 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq, vInfo("vgId:%d, trim vnode request will be processed, time:%d", pVnode->config.vgId, trimReq.timestamp); -// process -#if 0 - code = tsdbDoRetention(pVnode->pTsdb, trimReq.timestamp); - if (code) goto _exit; - - code = smaDoRetention(pVnode->pSma, trimReq.timestamp); - if (code) goto _exit; -#else + // process vnodeAsyncRentention(pVnode, trimReq.timestamp); -#endif + tsem_wait(&pVnode->canCommit); + tsem_post(&pVnode->canCommit); _exit: return code; @@ -633,18 +632,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p tqUpdateTbUidList(pVnode->pTq, tbUids, false); } -#if 0 - // process - ret = tsdbDoRetention(pVnode->pTsdb, ttlReq.timestamp); - if (ret) goto end; - - ret = smaDoRetention(pVnode->pSma, ttlReq.timestamp); - if (ret) goto end; -#else vnodeAsyncRentention(pVnode, ttlReq.timestamp); - tsem_wait(&pVnode->canCommit); - tsem_post(&pVnode->canCommit); -#endif end: taosArrayDestroy(tbUids); @@ -1228,6 +1216,49 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq tDecoderClear(&dc); } + // scan + TSKEY now = taosGetTimestamp(pVnode->config.tsdbCfg.precision); + TSKEY minKey = now - tsTickPerMin[pVnode->config.tsdbCfg.precision] * pVnode->config.tsdbCfg.keep2; + TSKEY maxKey = tsMaxKeyByPrecision[pVnode->config.tsdbCfg.precision]; + for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) { + SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i); + + if (pSubmitTbData->pCreateTbReq && pSubmitTbData->pCreateTbReq->uid == 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + + if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) { + if (TARRAY_SIZE(pSubmitTbData->aCol) <= 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + + SColData *pColData = (SColData *)taosArrayGet(pSubmitTbData->aCol, 0); + TSKEY *aKey = (TSKEY *)(pColData->pData); + + for (int32_t iRow = 0; iRow < pColData->nVal; iRow++) { + if (aKey[iRow] < minKey || aKey[iRow] > maxKey || (iRow > 0 && aKey[iRow] <= aKey[iRow - 1])) { + code = TSDB_CODE_INVALID_MSG; + vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version); + goto _exit; + } + } + + } else { + int32_t nRow = TARRAY_SIZE(pSubmitTbData->aRowP); + SRow **aRow = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP); + + for (int32_t iRow = 0; iRow < nRow; ++iRow) { + if (aRow[iRow]->ts < minKey || aRow[iRow]->ts > maxKey || (iRow > 0 && aRow[iRow]->ts <= aRow[iRow - 1]->ts)) { + code = TSDB_CODE_INVALID_MSG; + vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version); + goto _exit; + } + } + } + } + for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) { SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i); @@ -1641,17 +1672,14 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *p return TSDB_CODE_SUCCESS; } +extern int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp); + static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { - SCompactVnodeReq req = {0}; - if (tDeserializeSCompactVnodeReq(pReq, len, &req) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - return TSDB_CODE_INVALID_MSG; - } - vInfo("vgId:%d, compact msg will be processed, db:%s dbUid:%" PRId64 " compactStartTime:%" PRId64, TD_VID(pVnode), - req.db, req.dbUid, req.compactStartTime); - - vnodeAsyncCompact(pVnode); - vnodeBegin(pVnode); + return vnodeProcessCompactVnodeReqImpl(pVnode, version, pReq, len, pRsp); +} +#ifndef TD_ENTERPRISE +int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { return 0; } +#endif diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 1e96a76170..e71b03d2af 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -292,7 +292,7 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) code = vnodePreProcessWriteMsg(pVnode, pMsg); if (code != 0) { - vGError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, terrstr()); + vGError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, tstrerror(code)); if (terrno != 0) code = terrno; vnodeHandleProposeError(pVnode, pMsg, code); rpcFreeCont(pMsg->pCont); diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index f88701afe2..c862a75ed3 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -248,13 +248,13 @@ static const char* cacheModelStr(int8_t cacheModel) { return TSDB_CACHE_MODEL_NONE_STR; } -static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, SDbCfgInfo* pCfg) { +static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, char* dbFName, SDbCfgInfo* pCfg) { blockDataEnsureCapacity(pBlock, 1); pBlock->info.rows = 1; SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0); char buf1[SHOW_CREATE_DB_RESULT_FIELD1_LEN] = {0}; - STR_TO_VARSTR(buf1, dbFName); + STR_TO_VARSTR(buf1, dbName); colDataSetVal(pCol1, 0, buf1, false); SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1); @@ -277,16 +277,20 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S } char* retentions = buildRetension(pCfg->pRetensions); + int32_t dbFNameLen = strlen(dbFName); + int32_t hashPrefix = (pCfg->hashPrefix > (dbFNameLen + 1)) ? (pCfg->hashPrefix - dbFNameLen - 1) : 0; len += sprintf( buf2 + VARSTR_HEADER_SIZE, "CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm " "WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d " - "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d", - dbFName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, + "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d " + "WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " WAL_ROLL_PERIOD %d WAL_SEGMENT_SIZE %" PRId64, + dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2, pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups, - 1 == pCfg->numOfStables); + 1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, + pCfg->walRetentionSize, pCfg->walRollPeriod, pCfg->walSegmentSize); if (retentions) { len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions); @@ -404,7 +408,7 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT SSDataBlock* pBlock = NULL; int32_t code = buildCreateDBResultDataBlock(&pBlock); if (TSDB_CODE_SUCCESS == code) { - setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->pCfg); + setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->dbFName, pStmt->pCfg); } if (TSDB_CODE_SUCCESS == code) { code = buildRetrieveTableRsp(pBlock, SHOW_CREATE_DB_RESULT_COLS, pRsp); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index be79054c1b..0b55eb4a45 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -881,6 +881,7 @@ SExprInfo* createExpr(SNodeList* pNodeList, int32_t* numOfExprs); void copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResultRow* pRow, SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const int32_t* rowEntryOffset, SExecTaskInfo* pTaskInfo); void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExprs, const int32_t* rowEntryOffset); +void doClearBufferedBlocks(SStreamScanInfo* pInfo); #ifdef __cplusplus } diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c index 49e2d5bc4a..559fce5224 100644 --- a/source/libs/executor/src/eventwindowoperator.c +++ b/source/libs/executor/src/eventwindowoperator.c @@ -29,7 +29,7 @@ typedef struct SEventWindowOperatorInfo { SWindowRowsSup winSup; int32_t tsSlotId; // primary timestamp column slot id STimeWindowAggSupp twAggSup; - uint64_t groupId; // current group id, used to identify the data block from different groups + uint64_t groupId; // current group id, used to identify the data block from different groups SFilterInfo* pStartCondInfo; SFilterInfo* pEndCondInfo; bool inWindow; @@ -310,6 +310,7 @@ int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* p pSup->rowEntryInfoOffset, pTaskInfo); pRes->info.rows += pInfo->pRow->numOfRows; + pInfo->pRow->numOfRows = 0; pInfo->inWindow = false; rowIndex += 1; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 9537751ff0..0ac458af49 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -957,9 +957,7 @@ static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SN STUidTagInfo* pInfo = taosArrayGet(pUidTagList, i); taosArrayPush(pUidList, &pInfo->uid); } - terrno = 0; - goto end; } else { if ((condType == FILTER_NO_LOGIC || condType == FILTER_AND) && status != SFLT_NOT_INDEX) { code = metaGetTableTagsByUids(metaHandle, pListInfo->suid, pUidTagList); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c2bf001c86..04d54a95ae 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -93,6 +93,23 @@ static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) { return 0; } +static void clearStreamBlock(SOperatorInfo* pOperator) { + if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + if (pOperator->numOfDownstream == 1) { + return clearStreamBlock(pOperator->pDownstream[0]); + } + } else { + SStreamScanInfo* pInfo = pOperator->info; + doClearBufferedBlocks(pInfo); + } +} + +void resetTaskInfo(qTaskInfo_t tinfo) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + pTaskInfo->code = 0; + clearStreamBlock(pTaskInfo->pRoot); +} + static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { @@ -608,6 +625,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { } if (isTaskKilled(pTaskInfo)) { + clearStreamBlock(pTaskInfo->pRoot); atomic_store_64(&pTaskInfo->owner, 0); qDebug("%s already killed, abort", GET_TASKID(pTaskInfo)); return TSDB_CODE_SUCCESS; @@ -1068,7 +1086,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT tsdbReaderClose(pTSInfo->base.dataReader); pTSInfo->base.dataReader = NULL; // let's seek to the next version in wal file - if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { + if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, pTaskInfo->id.str) < 0) { return -1; } } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 9c85ebae9d..5a2cdffa92 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1197,16 +1197,11 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - // expand the result datablock capacity - if (pRow->numOfRows > pBlock->info.capacity) { - blockDataEnsureCapacity(pBlock, pRow->numOfRows); - qDebug("datablock capacity not sufficient, expand to requried:%d, current capacity:%d, %s", pRow->numOfRows, - pBlock->info.capacity, GET_TASKID(pTaskInfo)); + blockDataEnsureCapacity(pBlock, pBlock->info.rows + pRow->numOfRows); + qDebug("datablock capacity not sufficient, expand to required:%d, current capacity:%d, %s", + (pRow->numOfRows+pBlock->info.rows), + pBlock->info.capacity, GET_TASKID(pTaskInfo)); // todo set the pOperator->resultInfo size - } else { - releaseBufPage(pBuf, page); - break; - } } pGroupResInfo->index += 1; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index e1594b13a8..2f3b757241 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -945,7 +945,8 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* return pOperator; } -static FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) { +FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) { + qDebug("clear buff blocks:%d", (int32_t)taosArrayGetSize(pInfo->pBlockLists)); taosArrayClear(pInfo->pBlockLists); pInfo->validBlockIndex = 0; } @@ -1609,6 +1610,8 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { if (pResult && pResult->info.rows > 0) { qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64, pResult->info.rows, pResult->info.window.skey, pResult->info.window.ekey); + qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64, pResult->info.rows, + pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion); pTaskInfo->streamInfo.returned = 1; return pResult; } else { @@ -1618,7 +1621,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { pTSInfo->base.dataReader = NULL; tqOffsetResetToLog(&pTaskInfo->streamInfo.prepareStatus, pTaskInfo->streamInfo.snapshotVer); qDebug("queue scan tsdb over, switch to wal ver %" PRId64 "", pTaskInfo->streamInfo.snapshotVer + 1); - if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1) < 0) { + if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1, pTaskInfo->id.str) < 0) { tqOffsetResetToLog(&pTaskInfo->streamInfo.lastStatus, pTaskInfo->streamInfo.snapshotVer); return NULL; } @@ -1632,8 +1635,12 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { while (1) { SFetchRet ret = {0}; if (tqNextBlock(pInfo->tqReader, &ret) < 0) { - qError("failed to get next log block since %s", terrstr()); + // if the end is reached, terrno is 0 + if (terrno != 0) { + qError("failed to get next log block since %s", terrstr()); + } } + if (ret.fetchType == FETCH_TYPE__DATA) { blockDataCleanup(pInfo->pRes); setBlockIntoRes(pInfo, &ret.data, true); @@ -1651,8 +1658,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { } else if (ret.fetchType == FETCH_TYPE__NONE || (ret.fetchType == FETCH_TYPE__SEP && pOperator->status == OP_EXEC_RECV)) { pTaskInfo->streamInfo.lastStatus = ret.offset; - ASSERT(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version); - ASSERT(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion); char formatBuf[80]; tFormatOffset(formatBuf, 80, &ret.offset); qDebug("queue scan log return null, offset %s", formatBuf); @@ -1660,16 +1665,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { return NULL; } } -#if 0 - } else if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) { - SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp); - if (pResult && pResult->info.rows > 0) { - qDebug("stream scan tsdb return %d rows", pResult->info.rows); - return pResult; - } - qDebug("stream scan tsdb return null"); - return NULL; -#endif } else { qError("unexpected streamInfo prepare type: %d", pTaskInfo->streamInfo.prepareStatus.type); return NULL; @@ -1919,7 +1914,9 @@ FETCH_NEXT_BLOCK: doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); - return pInfo->pRes; + if (pInfo->pRes->info.rows > 0) { + return pInfo->pRes; + } } break; case STREAM_SCAN_FROM_DELETE_DATA: { generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes); diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index f8c339e256..fbc60041b2 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1940,6 +1940,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { } if (pInfo->algo != APERCT_ALGO_TDIGEST) { + buildHistogramInfo(pInfo); qDebug("%s after merge, total:%" PRId64 ", numOfEntry:%d, %p", __FUNCTION__, pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries, pInfo->pHisto); } @@ -2461,6 +2462,9 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer int32_t numOfElems = 0; for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + if (colDataIsNull_s(pCol, i)) { + continue; + } char* data = colDataGetData(pCol, i); SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data); int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 024130b5f8..22afc7ef55 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -963,8 +963,6 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_USERS_STMT: case QUERY_NODE_SHOW_LICENCES_STMT: case QUERY_NODE_SHOW_VGROUPS_STMT: - case QUERY_NODE_SHOW_DB_ALIVE_STMT: - case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: case QUERY_NODE_SHOW_TOPICS_STMT: case QUERY_NODE_SHOW_CONSUMERS_STMT: case QUERY_NODE_SHOW_CONNECTIONS_STMT: diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 6d36660261..10d4adf17d 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -151,7 +151,7 @@ SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, STo SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions); SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed); -SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName); +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd); SNode* createDefaultTableOptions(SAstCreateContext* pCxt); SNode* createAlterTableOptions(SAstCreateContext* pCxt); SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal); @@ -215,6 +215,8 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool const SToken* pLibPath, SDataType dataType, int32_t bufSize, const SToken* pLanguage); SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName); SNode* createStreamOptions(SAstCreateContext* pCxt); +SNode* setStreamOptions(SAstCreateContext* pCxt, SNode* pOptions, EStreamOptionsSetFlag setflag, SToken* pToken, + SNode* pNode); SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols); SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pStreamName); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index c1dafef085..994f99a797 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -167,7 +167,7 @@ cmd ::= USE db_name(A). cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); } cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); } cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); } -cmd ::= COMPACT DATABASE db_name(A). { pCxt->pRootNode = createCompactStmt(pCxt, &A); } +cmd ::= COMPACT DATABASE db_name(A) start_opt(B) end_opt(C). { pCxt->pRootNode = createCompactStmt(pCxt, &A, B, C); } %type not_exists_opt { bool } %destructor not_exists_opt { } @@ -259,6 +259,16 @@ retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). speed_opt(A) ::= . { A = 0; } speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } +start_opt(A) ::= . { A = NULL; } +start_opt(A) ::= START WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +start_opt(A) ::= START WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } +start_opt(A) ::= START WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } + +end_opt(A) ::= . { A = NULL; } +end_opt(A) ::= END WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +end_opt(A) ::= END WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } +end_opt(A) ::= END WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } + /************************************************ create/drop table/stable ********************************************/ cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } @@ -567,14 +577,14 @@ tag_def_or_ref_opt(A) ::= tags_def(B). tag_def_or_ref_opt(A) ::= TAGS NK_LP col_name_list(B) NK_RP. { A = B; } stream_options(A) ::= . { A = createStreamOptions(pCxt); } -stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } -stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } -stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10); A = B; } -stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { ((SStreamOptions*)B)->fillHistory = taosStr2Int8(C.z, NULL, 10); A = B; } -stream_options(A) ::= stream_options(B) DELETE_MARK duration_literal(C). { ((SStreamOptions*)B)->pDeleteMark = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreUpdate = taosStr2Int8(C.z, NULL, 10); A = B; } +stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY(C) duration_literal(D). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, releaseRawExprNode(pCxt, D)); } +stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, C)); } +stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_EXPIRED_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_FILL_HISTORY_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) DELETE_MARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, C)); } +stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_UPDATE_SET, &C, NULL); } subtable_opt(A) ::= . { A = NULL; } subtable_opt(A) ::= SUBTABLE NK_LP expression(B) NK_RP. { A = releaseRawExprNode(pCxt, B); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index bb94e94cba..a761b7a7b0 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1105,7 +1105,7 @@ SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t return (SNode*)pStmt; } -SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) { +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd) { CHECK_PARSER_STATUS(pCxt); if (!checkDbName(pCxt, pDbName, false)) { return NULL; @@ -1113,6 +1113,8 @@ SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) { SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)nodesMakeNode(QUERY_NODE_COMPACT_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); + pStmt->pStart = pStart; + pStmt->pEnd = pEnd; return (SNode*)pStmt; } @@ -1827,13 +1829,66 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); SStreamOptions* pOptions = (SStreamOptions*)nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); CHECK_OUT_OF_MEM(pOptions); - pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; + pOptions->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; pOptions->fillHistory = STREAM_DEFAULT_FILL_HISTORY; pOptions->ignoreExpired = STREAM_DEFAULT_IGNORE_EXPIRED; pOptions->ignoreUpdate = STREAM_DEFAULT_IGNORE_UPDATE; return (SNode*)pOptions; } +static int8_t getTriggerType(uint32_t tokenType) { + switch (tokenType) { + case TK_AT_ONCE: + return STREAM_TRIGGER_AT_ONCE; + case TK_WINDOW_CLOSE: + return STREAM_TRIGGER_WINDOW_CLOSE; + case TK_MAX_DELAY: + return STREAM_TRIGGER_MAX_DELAY; + default: + break; + } + return STREAM_TRIGGER_WINDOW_CLOSE; +} + +SNode* setStreamOptions(SAstCreateContext* pCxt, SNode* pOptions, EStreamOptionsSetFlag setflag, SToken* pToken, + SNode* pNode) { + SStreamOptions* pStreamOptions = (SStreamOptions*)pOptions; + if (BIT_FLAG_TEST_MASK(setflag, pStreamOptions->setFlag)) { + pCxt->errCode = + generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "stream options each item is only set once"); + return pOptions; + } + + switch (setflag) { + case SOPT_TRIGGER_TYPE_SET: + pStreamOptions->triggerType = getTriggerType(pToken->type); + if (STREAM_TRIGGER_MAX_DELAY == pStreamOptions->triggerType) { + pStreamOptions->pDelay = pNode; + } + break; + case SOPT_WATERMARK_SET: + pStreamOptions->pWatermark = pNode; + break; + case SOPT_DELETE_MARK_SET: + pStreamOptions->pDeleteMark = pNode; + break; + case SOPT_FILL_HISTORY_SET: + pStreamOptions->fillHistory = taosStr2Int8(pToken->z, NULL, 10); + break; + case SOPT_IGNORE_EXPIRED_SET: + pStreamOptions->ignoreExpired = taosStr2Int8(pToken->z, NULL, 10); + break; + case SOPT_IGNORE_UPDATE_SET: + pStreamOptions->ignoreUpdate = taosStr2Int8(pToken->z, NULL, 10); + break; + default: + break; + } + BIT_FLAG_SET_MASK(pStreamOptions->setFlag, setflag); + + return pOptions; +} + SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols) { CHECK_PARSER_STATUS(pCxt); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 126027c78f..cd4b455e02 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -166,7 +166,8 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, const c code = reserveDnodeRequiredInCache(pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code && - (0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) || 0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) && + (0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) || + 0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) && QUERY_NODE_SELECT_STMT == nodeType(pCxt->pStmt)) { code = collectMetaKeyFromInsTags(pCxt); } @@ -605,6 +606,10 @@ static int32_t collectMetaKeyFromShowSubscriptions(SCollectMetaKeyCxt* pCxt, SSh pCxt->pMetaCache); } +static int32_t collectMetaKeyFromCompactDatabase(SCollectMetaKeyCxt* pCxt, SCompactDatabaseStmt* pStmt) { + return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { pCxt->pStmt = pStmt; switch (nodeType(pStmt)) { @@ -636,6 +641,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt); case QUERY_NODE_DESCRIBE_STMT: return collectMetaKeyFromDescribe(pCxt, (SDescribeStmt*)pStmt); + case QUERY_NODE_COMPACT_DATABASE_STMT: + return collectMetaKeyFromCompactDatabase(pCxt, (SCompactDatabaseStmt*)pStmt); case QUERY_NODE_CREATE_STREAM_STMT: return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt); case QUERY_NODE_SHOW_DNODES_STMT: diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index d4f4949df0..b2fc88add1 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -320,6 +320,79 @@ static int32_t calcConstInsert(SCalcConstContext* pCxt, SInsertStmt* pInsert) { return code; } +static SNodeList* getChildProjection(SNode* pStmt) { + switch (nodeType(pStmt)) { + case QUERY_NODE_SELECT_STMT: + return ((SSelectStmt*)pStmt)->pProjectionList; + case QUERY_NODE_SET_OPERATOR: + return ((SSetOperator*)pStmt)->pProjectionList; + default: + break; + } + return NULL; +} + +static void eraseSetOpChildProjection(SSetOperator* pSetOp, int32_t index) { + SNodeList* pLeftProjs = getChildProjection(pSetOp->pLeft); + nodesListErase(pLeftProjs, nodesListGetCell(pLeftProjs, index)); + SNodeList* pRightProjs = getChildProjection(pSetOp->pRight); + nodesListErase(pRightProjs, nodesListGetCell(pRightProjs, index)); +} + +typedef struct SNotRefByOrderByCxt { + SColumnNode* pCol; + bool hasThisCol; +} SNotRefByOrderByCxt; + +static EDealRes notRefByOrderByImpl(SNode* pNode, void* pContext) { + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + SNotRefByOrderByCxt* pCxt = (SNotRefByOrderByCxt*)pContext; + if (nodesEqualNode((SNode*)pCxt->pCol, pNode)) { + pCxt->hasThisCol = true; + return DEAL_RES_END; + } + } + return DEAL_RES_CONTINUE; +} + +static bool notRefByOrderBy(SColumnNode* pCol, SNodeList* pOrderByList) { + SNotRefByOrderByCxt cxt = {.pCol = pCol, .hasThisCol = false}; + nodesWalkExprs(pOrderByList, notRefByOrderByImpl, &cxt); + return !cxt.hasThisCol; +} + +static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) { + int32_t index = 0; + SNode* pProj = NULL; + WHERE_EACH(pProj, pSetOp->pProjectionList) { + if (subquery && notRefByOrderBy((SColumnNode*)pProj, pSetOp->pOrderByList) && isUselessCol((SExprNode*)pProj)) { + ERASE_NODE(pSetOp->pProjectionList); + eraseSetOpChildProjection(pSetOp, index); + continue; + } + ++index; + WHERE_NEXT; + } + if (0 == LIST_LENGTH(pSetOp->pProjectionList)) { + return nodesListStrictAppend(pSetOp->pProjectionList, createConstantValue()); + } + return TSDB_CODE_SUCCESS; +} + +static int32_t calcConstSetOperator(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) { + int32_t code = calcConstSetOpProjections(pCxt, pSetOp, subquery); + if (TSDB_CODE_SUCCESS == code) { + code = calcConstQuery(pCxt, pSetOp->pLeft, false); + } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstQuery(pCxt, pSetOp->pRight, false); + } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstList(pSetOp->pOrderByList); + } + return code; +} + static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subquery) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pStmt)) { @@ -330,11 +403,7 @@ static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subque code = calcConstQuery(pCxt, ((SExplainStmt*)pStmt)->pQuery, subquery); break; case QUERY_NODE_SET_OPERATOR: { - SSetOperator* pSetOp = (SSetOperator*)pStmt; - code = calcConstQuery(pCxt, pSetOp->pLeft, false); - if (TSDB_CODE_SUCCESS == code) { - code = calcConstQuery(pCxt, pSetOp->pRight, false); - } + code = calcConstSetOperator(pCxt, (SSetOperator*)pStmt, subquery); break; } case QUERY_NODE_DELETE_STMT: diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c3816fa854..fdc0a08371 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1211,7 +1211,8 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } else { res = translateNormalValue(pCxt, pVal, targetDt, strict); } - pVal->node.resType = targetDt; + pVal->node.resType.type = targetDt.type; + pVal->node.resType.bytes = targetDt.bytes; pVal->node.resType.scale = pVal->unit; pVal->translate = true; if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) { @@ -2499,6 +2500,12 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { STempTableNode* pTempTable = (STempTableNode*)pTable; code = translateSubquery(pCxt, pTempTable->pSubquery); if (TSDB_CODE_SUCCESS == code) { + if (QUERY_NODE_SELECT_STMT == nodeType(pTempTable->pSubquery) && + ((SSelectStmt*)pTempTable->pSubquery)->isEmptyResult && + isSelectStmt(pCxt->pCurrStmt)) { + ((SSelectStmt*)pCxt->pCurrStmt)->isEmptyResult = true; + } + pTempTable->table.precision = getStmtPrecision(pTempTable->pSubquery); pTempTable->table.singleTable = stmtIsSingleTable(pTempTable->pSubquery); code = addNamespace(pCxt, pTempTable); @@ -2796,6 +2803,10 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) { bool other; int32_t code = translateOrderByPosition(pCxt, pSelect->pProjectionList, pSelect->pOrderByList, &other); if (TSDB_CODE_SUCCESS == code) { + if (0 == LIST_LENGTH(pSelect->pOrderByList)) { + NODES_DESTORY_LIST(pSelect->pOrderByList); + return TSDB_CODE_SUCCESS; + } if (!other) { return TSDB_CODE_SUCCESS; } @@ -5621,12 +5632,36 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt) return refreshGetTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta); } +static int32_t translateCompactRange(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt, SCompactDbReq* pReq) { + SDbCfgInfo dbCfg = {0}; + int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg); + if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pStart) { + ((SValueNode*)pStmt->pStart)->node.resType.precision = dbCfg.precision; + ((SValueNode*)pStmt->pStart)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; + code = doTranslateValue(pCxt, (SValueNode*)pStmt->pStart); + } + if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pEnd) { + ((SValueNode*)pStmt->pEnd)->node.resType.precision = dbCfg.precision; + ((SValueNode*)pStmt->pEnd)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; + code = doTranslateValue(pCxt, (SValueNode*)pStmt->pEnd); + } + if (TSDB_CODE_SUCCESS == code) { + pReq->timeRange.skey = NULL != pStmt->pStart ? ((SValueNode*)pStmt->pStart)->datum.i : INT64_MIN; + pReq->timeRange.ekey = NULL != pStmt->pEnd ? ((SValueNode*)pStmt->pEnd)->datum.i : INT64_MAX; + } + return code; +} + static int32_t translateCompact(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt) { SCompactDbReq compactReq = {0}; SName name; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, compactReq.db); - return buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq); + int32_t code = translateCompactRange(pCxt, pStmt, &compactReq); + if (TSDB_CODE_SUCCESS == code) { + code = buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq); + } + return code; } static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt) { @@ -6379,15 +6414,15 @@ static int32_t translateDropFunction(STranslateContext* pCxt, SDropFunctionStmt* static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { SAlterUserReq req = {0}; - if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || - (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && - PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { + if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || + (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && + BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { req.alterType = TSDB_ALTER_USER_ADD_ALL_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { req.alterType = TSDB_ALTER_USER_ADD_READ_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { req.alterType = TSDB_ALTER_USER_ADD_WRITE_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC; } strcpy(req.user, pStmt->userName); @@ -6397,15 +6432,15 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) { SAlterUserReq req = {0}; - if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || - (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && - PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { + if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || + (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && + BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { req.alterType = TSDB_ALTER_USER_REMOVE_ALL_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { req.alterType = TSDB_ALTER_USER_REMOVE_READ_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { req.alterType = TSDB_ALTER_USER_REMOVE_WRITE_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC; } strcpy(req.user, pStmt->userName); @@ -6477,6 +6512,11 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD if (NULL == pStmt->pCfg) { return TSDB_CODE_OUT_OF_MEMORY; } + + SName name; + tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + tNameGetFullDbName(&name, pStmt->dbFName); + return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index b434ba706f..ab0571206b 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 471 +#define YYNOCODE 473 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNode* yy140; - EFillMode yy174; - int32_t yy214; - SNodeList* yy220; - int64_t yy303; - bool yy587; - SDataType yy682; - ENullOrder yy697; - EOperatorType yy794; - SAlterOption yy809; - EJoinType yy852; - int8_t yy857; - EOrder yy866; - SToken yy881; + EOperatorType yy62; + SToken yy63; + EOrder yy158; + SNodeList* yy222; + SAlterOption yy233; + int32_t yy332; + int64_t yy393; + EJoinType yy574; + bool yy669; + ENullOrder yy675; + SDataType yy686; + int8_t yy707; + EFillMode yy822; + SNode* yy828; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 745 -#define YYNRULE 565 +#define YYNSTATE 753 +#define YYNRULE 573 #define YYNTOKEN 329 -#define YY_MAX_SHIFT 744 -#define YY_MIN_SHIFTREDUCE 1105 -#define YY_MAX_SHIFTREDUCE 1669 -#define YY_ERROR_ACTION 1670 -#define YY_ACCEPT_ACTION 1671 -#define YY_NO_ACTION 1672 -#define YY_MIN_REDUCE 1673 -#define YY_MAX_REDUCE 2237 +#define YY_MAX_SHIFT 752 +#define YY_MIN_SHIFTREDUCE 1119 +#define YY_MAX_SHIFTREDUCE 1691 +#define YY_ERROR_ACTION 1692 +#define YY_ACCEPT_ACTION 1693 +#define YY_NO_ACTION 1694 +#define YY_MIN_REDUCE 1695 +#define YY_MAX_REDUCE 2267 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,821 +216,773 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3086) +#define YY_ACTTAB_COUNT (2833) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 483, 384, 484, 1709, 1925, 492, 1818, 484, 1709, 161, - /* 10 */ 35, 289, 45, 43, 1597, 190, 360, 2031, 1829, 178, - /* 20 */ 381, 633, 1446, 38, 37, 1878, 2049, 44, 42, 41, - /* 30 */ 40, 39, 1867, 1527, 386, 1444, 2213, 1873, 1875, 1471, - /* 40 */ 2208, 482, 38, 37, 487, 1715, 44, 42, 41, 40, - /* 50 */ 39, 1673, 2027, 2033, 615, 609, 2212, 2067, 1522, 27, - /* 60 */ 2209, 2211, 489, 644, 18, 612, 65, 2152, 485, 176, - /* 70 */ 2017, 1452, 650, 1946, 633, 131, 130, 129, 128, 127, - /* 80 */ 126, 125, 124, 123, 45, 43, 139, 1472, 1944, 621, - /* 90 */ 348, 1929, 381, 2149, 1446, 194, 14, 48, 341, 619, - /* 100 */ 572, 1880, 2048, 501, 2208, 1527, 2084, 1444, 346, 109, - /* 110 */ 2050, 654, 2052, 2053, 649, 106, 644, 1878, 741, 2214, - /* 120 */ 182, 179, 426, 2137, 2209, 598, 633, 375, 2133, 140, - /* 130 */ 1522, 2036, 83, 1529, 1530, 82, 18, 1819, 1471, 1556, - /* 140 */ 1473, 184, 2031, 1452, 44, 42, 41, 40, 39, 2163, - /* 150 */ 167, 464, 268, 2145, 608, 1781, 133, 607, 61, 1446, - /* 160 */ 2208, 1471, 331, 1502, 1512, 373, 609, 2213, 14, 1528, - /* 170 */ 1531, 2208, 1444, 164, 1803, 596, 182, 2027, 2033, 597, - /* 180 */ 2209, 598, 1829, 2208, 1447, 2067, 1445, 2212, 644, 1910, - /* 190 */ 741, 2209, 2210, 591, 1874, 1875, 1557, 139, 596, 182, - /* 200 */ 1308, 1309, 48, 2209, 598, 1529, 1530, 1601, 1452, 198, - /* 210 */ 197, 1450, 1451, 1471, 1501, 1504, 1505, 1506, 1507, 1508, - /* 220 */ 1509, 1510, 1511, 646, 642, 1520, 1521, 1523, 1524, 1525, - /* 230 */ 1526, 2, 463, 533, 532, 1502, 1512, 688, 634, 590, - /* 240 */ 122, 1528, 1531, 121, 120, 119, 118, 117, 116, 115, - /* 250 */ 114, 113, 132, 712, 710, 741, 1447, 491, 1445, 522, - /* 260 */ 487, 1715, 611, 180, 2145, 2146, 620, 137, 2150, 1827, - /* 270 */ 34, 379, 1551, 1552, 1553, 1554, 1555, 1559, 1560, 1561, - /* 280 */ 1562, 1363, 1364, 1450, 1451, 270, 1501, 1504, 1505, 1506, - /* 290 */ 1507, 1508, 1509, 1510, 1511, 646, 642, 1520, 1521, 1523, - /* 300 */ 1524, 1525, 1526, 2, 1503, 11, 45, 43, 1742, 1471, - /* 310 */ 1946, 185, 1880, 499, 381, 1939, 1446, 1696, 1625, 359, - /* 320 */ 2049, 1447, 372, 1445, 592, 1943, 621, 1527, 1878, 1444, - /* 330 */ 1265, 676, 675, 674, 1269, 673, 1271, 1272, 672, 1274, - /* 340 */ 669, 444, 1280, 666, 1282, 1283, 663, 660, 1450, 1451, - /* 350 */ 443, 2067, 1522, 1695, 1472, 185, 1503, 1470, 18, 651, - /* 360 */ 1157, 2017, 1156, 634, 2017, 1452, 650, 584, 583, 1623, - /* 370 */ 1624, 1626, 1627, 1628, 537, 536, 535, 132, 45, 43, - /* 380 */ 1532, 688, 136, 531, 527, 61, 381, 530, 1446, 1985, - /* 390 */ 14, 1158, 529, 534, 1827, 587, 2048, 2017, 528, 1527, - /* 400 */ 2084, 1444, 1880, 109, 2050, 654, 2052, 2053, 649, 369, - /* 410 */ 644, 1138, 741, 142, 1674, 149, 2108, 2137, 1878, 31, - /* 420 */ 634, 375, 2133, 61, 1522, 38, 37, 1529, 1530, 44, - /* 430 */ 42, 41, 40, 39, 187, 122, 238, 1452, 121, 120, - /* 440 */ 119, 118, 117, 116, 115, 114, 113, 537, 536, 535, - /* 450 */ 1140, 1827, 1143, 1144, 1452, 136, 531, 1502, 1512, 1558, - /* 460 */ 530, 1225, 46, 1528, 1531, 529, 534, 1380, 1381, 38, - /* 470 */ 37, 528, 560, 44, 42, 41, 40, 39, 1447, 86, - /* 480 */ 1445, 593, 588, 581, 741, 38, 37, 246, 271, 44, - /* 490 */ 42, 41, 40, 39, 420, 49, 2010, 1227, 419, 1529, - /* 500 */ 1530, 1537, 1823, 1379, 1382, 1450, 1451, 1471, 1501, 1504, - /* 510 */ 1505, 1506, 1507, 1508, 1509, 1510, 1511, 646, 642, 1520, - /* 520 */ 1521, 1523, 1524, 1525, 1526, 2, 61, 90, 92, 1502, - /* 530 */ 1512, 413, 604, 32, 744, 1528, 1531, 236, 185, 2213, - /* 540 */ 572, 235, 572, 1563, 2208, 1804, 2208, 166, 296, 1685, - /* 550 */ 1447, 679, 1445, 176, 415, 411, 1473, 100, 1636, 2214, - /* 560 */ 182, 2214, 182, 175, 2209, 598, 2209, 598, 620, 734, - /* 570 */ 730, 726, 722, 294, 1613, 1930, 185, 1450, 1451, 1820, - /* 580 */ 1501, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 646, - /* 590 */ 642, 1520, 1521, 1523, 1524, 1525, 1526, 2, 45, 43, - /* 600 */ 620, 89, 336, 221, 1880, 358, 381, 553, 1446, 86, - /* 610 */ 107, 374, 2049, 287, 1157, 618, 1156, 1939, 171, 1527, - /* 620 */ 1878, 1444, 11, 350, 518, 514, 510, 506, 218, 220, - /* 630 */ 38, 37, 1822, 1659, 44, 42, 41, 40, 39, 700, - /* 640 */ 542, 1694, 1474, 2067, 1522, 1158, 630, 629, 185, 1939, - /* 650 */ 1503, 612, 634, 686, 427, 552, 2017, 1452, 650, 280, - /* 660 */ 281, 41, 40, 39, 279, 87, 54, 428, 216, 234, - /* 670 */ 45, 43, 154, 153, 683, 682, 681, 151, 381, 185, - /* 680 */ 1446, 274, 46, 1827, 545, 2017, 273, 609, 2048, 539, - /* 690 */ 1816, 1527, 2084, 1444, 233, 109, 2050, 654, 2052, 2053, - /* 700 */ 649, 270, 644, 1407, 741, 1812, 241, 179, 634, 2137, - /* 710 */ 1814, 634, 634, 375, 2133, 11, 1522, 9, 139, 1529, - /* 720 */ 1530, 636, 424, 2109, 1880, 425, 434, 1925, 597, 1452, - /* 730 */ 567, 69, 2208, 1693, 68, 2164, 215, 209, 192, 1827, - /* 740 */ 1879, 214, 1827, 1827, 497, 1686, 1925, 596, 182, 1502, - /* 750 */ 1512, 237, 2209, 598, 14, 1528, 1531, 196, 551, 38, - /* 760 */ 37, 207, 605, 44, 42, 41, 40, 39, 33, 353, - /* 770 */ 1447, 549, 1445, 547, 38, 37, 741, 2017, 44, 42, - /* 780 */ 41, 40, 39, 1880, 181, 2145, 2146, 248, 137, 2150, - /* 790 */ 385, 1529, 1530, 1671, 2152, 2011, 1810, 1450, 1451, 1878, - /* 800 */ 1501, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 646, - /* 810 */ 642, 1520, 1521, 1523, 1524, 1525, 1526, 2, 1420, 1421, - /* 820 */ 2148, 1502, 1512, 334, 2152, 1469, 680, 1528, 1531, 1871, - /* 830 */ 678, 354, 457, 352, 351, 471, 524, 634, 470, 384, - /* 840 */ 526, 572, 1447, 141, 1445, 2208, 2108, 164, 1692, 1691, - /* 850 */ 2147, 449, 61, 440, 684, 472, 1829, 1871, 442, 394, - /* 860 */ 2214, 182, 525, 393, 685, 2209, 598, 1871, 1827, 1450, - /* 870 */ 1451, 1690, 1501, 1504, 1505, 1506, 1507, 1508, 1509, 1510, - /* 880 */ 1511, 646, 642, 1520, 1521, 1523, 1524, 1525, 1526, 2, - /* 890 */ 387, 152, 2017, 2017, 165, 2003, 1689, 634, 164, 309, - /* 900 */ 349, 1739, 1802, 2212, 638, 572, 2109, 1829, 641, 2208, - /* 910 */ 164, 450, 430, 307, 72, 2017, 1594, 71, 303, 1830, - /* 920 */ 701, 1857, 1797, 243, 2214, 182, 8, 1666, 1827, 2209, - /* 930 */ 598, 13, 12, 1143, 1144, 203, 479, 477, 474, 418, - /* 940 */ 2017, 417, 468, 401, 53, 462, 461, 460, 459, 456, - /* 950 */ 455, 454, 453, 452, 448, 447, 446, 445, 333, 437, - /* 960 */ 436, 435, 1688, 432, 431, 347, 416, 718, 717, 716, - /* 970 */ 715, 391, 61, 714, 713, 143, 708, 707, 706, 705, - /* 980 */ 704, 703, 702, 156, 698, 697, 696, 390, 389, 693, - /* 990 */ 692, 691, 690, 689, 38, 37, 1782, 609, 44, 42, - /* 1000 */ 41, 40, 39, 1474, 645, 185, 2017, 1687, 38, 37, - /* 1010 */ 686, 108, 44, 42, 41, 40, 39, 2177, 686, 1684, - /* 1020 */ 73, 1683, 558, 601, 526, 2049, 1665, 1570, 139, 154, - /* 1030 */ 153, 683, 682, 681, 151, 634, 634, 154, 153, 683, - /* 1040 */ 682, 681, 151, 265, 634, 634, 525, 634, 634, 500, - /* 1050 */ 1824, 2017, 80, 79, 423, 1548, 2067, 189, 239, 568, - /* 1060 */ 634, 613, 617, 2017, 651, 2017, 1827, 1827, 572, 2017, - /* 1070 */ 81, 650, 2208, 585, 284, 1827, 1827, 332, 1827, 1827, - /* 1080 */ 409, 219, 407, 403, 399, 396, 416, 2214, 182, 259, - /* 1090 */ 634, 1827, 2209, 598, 183, 2145, 2146, 1682, 137, 2150, - /* 1100 */ 634, 2048, 634, 2049, 631, 2084, 1681, 2035, 109, 2050, - /* 1110 */ 654, 2052, 2053, 649, 632, 644, 290, 1474, 2031, 1680, - /* 1120 */ 2228, 1827, 2137, 1729, 1679, 185, 375, 2133, 392, 634, - /* 1130 */ 1678, 1827, 1677, 1827, 2067, 1590, 2049, 2171, 2157, 1590, - /* 1140 */ 1676, 2017, 651, 388, 51, 538, 3, 2017, 191, 650, - /* 1150 */ 2017, 163, 1805, 2027, 2033, 362, 145, 555, 134, 554, - /* 1160 */ 1827, 2035, 1593, 2017, 644, 1455, 226, 2067, 2017, 224, - /* 1170 */ 600, 1934, 2031, 1454, 2017, 651, 2017, 1722, 228, 2048, - /* 1180 */ 2017, 227, 650, 2084, 2017, 2068, 109, 2050, 654, 2052, - /* 1190 */ 2053, 649, 230, 644, 232, 229, 147, 231, 2228, 540, - /* 1200 */ 2137, 1710, 152, 2049, 375, 2133, 2035, 2027, 2033, 363, - /* 1210 */ 1720, 152, 2048, 63, 63, 2184, 2084, 2031, 644, 109, - /* 1220 */ 2050, 654, 2052, 2053, 649, 252, 644, 152, 1668, 1669, - /* 1230 */ 1868, 2228, 543, 2137, 2067, 378, 377, 375, 2133, 47, - /* 1240 */ 13, 12, 651, 2167, 277, 1460, 610, 2017, 579, 650, - /* 1250 */ 52, 602, 2027, 2033, 376, 1415, 1527, 571, 1453, 2038, - /* 1260 */ 70, 105, 247, 644, 1418, 150, 1622, 1621, 2049, 152, - /* 1270 */ 63, 102, 47, 47, 658, 267, 150, 152, 254, 2048, - /* 1280 */ 616, 1522, 135, 2084, 150, 1187, 109, 2050, 654, 2052, - /* 1290 */ 2053, 649, 1377, 644, 1452, 694, 264, 282, 2228, 2067, - /* 1300 */ 2137, 2049, 1, 4, 375, 2133, 695, 651, 2040, 395, - /* 1310 */ 400, 1400, 2017, 626, 650, 2202, 1458, 1206, 286, 1716, - /* 1320 */ 345, 1188, 1258, 1564, 1457, 1513, 302, 1286, 1204, 1290, - /* 1330 */ 1297, 297, 2067, 195, 429, 1295, 1935, 155, 1474, 433, - /* 1340 */ 651, 640, 466, 438, 2048, 2017, 1469, 650, 2084, 451, - /* 1350 */ 1927, 109, 2050, 654, 2052, 2053, 649, 458, 644, 465, - /* 1360 */ 473, 467, 475, 2228, 476, 2137, 200, 478, 736, 375, - /* 1370 */ 2133, 480, 1475, 481, 490, 1477, 493, 2048, 206, 1472, - /* 1380 */ 2156, 2084, 494, 208, 109, 2050, 654, 2052, 2053, 649, - /* 1390 */ 1476, 644, 495, 1478, 496, 211, 2112, 2049, 2137, 498, - /* 1400 */ 213, 84, 375, 2133, 502, 85, 217, 1461, 1160, 1456, - /* 1410 */ 519, 520, 112, 521, 335, 557, 523, 1994, 1991, 1817, - /* 1420 */ 223, 1990, 559, 88, 1813, 225, 157, 148, 2067, 569, - /* 1430 */ 240, 298, 158, 1815, 1464, 1466, 651, 1811, 159, 160, - /* 1440 */ 563, 2017, 562, 650, 561, 242, 586, 642, 1520, 1521, - /* 1450 */ 1523, 1524, 1525, 1526, 244, 566, 2183, 2168, 2049, 2178, - /* 1460 */ 576, 624, 2182, 582, 364, 7, 589, 2159, 260, 595, - /* 1470 */ 258, 577, 250, 2048, 253, 172, 575, 2084, 261, 574, - /* 1480 */ 109, 2050, 654, 2052, 2053, 649, 606, 644, 603, 2067, - /* 1490 */ 365, 262, 2110, 2231, 2137, 1590, 266, 651, 375, 2133, - /* 1500 */ 2207, 263, 2017, 138, 650, 1473, 614, 2153, 2049, 368, - /* 1510 */ 1940, 1479, 622, 299, 627, 272, 95, 623, 1954, 1953, - /* 1520 */ 1952, 371, 300, 628, 1828, 1872, 97, 60, 99, 101, - /* 1530 */ 2118, 2049, 301, 304, 2048, 293, 737, 50, 2084, 2067, - /* 1540 */ 738, 109, 2050, 654, 2052, 2053, 649, 651, 644, 1798, - /* 1550 */ 328, 337, 2017, 637, 650, 2137, 656, 2009, 740, 375, - /* 1560 */ 2133, 313, 2067, 327, 317, 306, 338, 308, 2008, 2007, - /* 1570 */ 651, 77, 2004, 397, 398, 2017, 1437, 650, 1438, 188, - /* 1580 */ 402, 2049, 2002, 404, 2048, 405, 406, 2001, 2084, 408, - /* 1590 */ 2000, 110, 2050, 654, 2052, 2053, 649, 410, 644, 1999, - /* 1600 */ 412, 1998, 414, 78, 1403, 2137, 1402, 2048, 1966, 2136, - /* 1610 */ 2133, 2084, 2067, 1965, 110, 2050, 654, 2052, 2053, 649, - /* 1620 */ 651, 644, 1964, 421, 422, 2017, 1963, 650, 2137, 1962, - /* 1630 */ 1354, 2049, 639, 2133, 1918, 1917, 1915, 144, 1914, 1913, - /* 1640 */ 1916, 1912, 1911, 1909, 1908, 1907, 193, 439, 2049, 1906, - /* 1650 */ 441, 1920, 1905, 1904, 1903, 1902, 1901, 652, 1900, 1899, - /* 1660 */ 1898, 2084, 2067, 1897, 110, 2050, 654, 2052, 2053, 649, - /* 1670 */ 648, 644, 1896, 1895, 1894, 2017, 1893, 650, 2137, 2067, - /* 1680 */ 1892, 1891, 340, 2133, 1890, 1889, 1888, 651, 146, 1919, - /* 1690 */ 1887, 1886, 2017, 1356, 650, 469, 1882, 1881, 2049, 1885, - /* 1700 */ 1884, 1883, 1745, 1233, 1744, 199, 201, 2048, 1743, 1741, - /* 1710 */ 1705, 2084, 204, 177, 325, 2050, 654, 2052, 2053, 649, - /* 1720 */ 647, 644, 635, 2102, 2048, 202, 75, 1146, 2084, 2067, - /* 1730 */ 2037, 168, 2050, 654, 2052, 2053, 649, 651, 644, 486, - /* 1740 */ 1145, 488, 2017, 1704, 650, 205, 76, 1981, 1973, 1961, - /* 1750 */ 210, 212, 1960, 1938, 1806, 1740, 1738, 503, 1180, 505, - /* 1760 */ 1736, 2049, 504, 507, 508, 1734, 509, 511, 513, 512, - /* 1770 */ 1732, 515, 573, 2174, 2048, 1719, 517, 1718, 2084, 516, - /* 1780 */ 1701, 169, 2050, 654, 2052, 2053, 649, 1808, 644, 1301, - /* 1790 */ 1807, 1730, 2067, 62, 1302, 709, 1224, 1223, 1222, 1221, - /* 1800 */ 651, 222, 711, 1218, 1217, 2017, 1216, 650, 1215, 1723, - /* 1810 */ 355, 356, 1721, 544, 357, 1700, 541, 546, 1699, 1698, - /* 1820 */ 548, 550, 2049, 111, 1980, 1972, 55, 1411, 564, 1425, - /* 1830 */ 1427, 1424, 1429, 599, 2229, 26, 66, 2048, 1959, 1409, - /* 1840 */ 565, 2084, 1957, 361, 110, 2050, 654, 2052, 2053, 649, - /* 1850 */ 570, 644, 162, 2067, 2213, 19, 16, 578, 2137, 580, - /* 1860 */ 58, 651, 20, 2134, 59, 256, 2017, 28, 650, 1638, - /* 1870 */ 245, 251, 2049, 1620, 257, 249, 2038, 170, 5, 255, - /* 1880 */ 30, 64, 29, 21, 17, 1653, 1958, 6, 2049, 57, - /* 1890 */ 1652, 366, 1657, 1656, 1612, 1658, 91, 367, 2048, 1659, - /* 1900 */ 269, 1956, 2084, 2067, 1587, 168, 2050, 654, 2052, 2053, - /* 1910 */ 649, 651, 644, 56, 1586, 173, 2017, 1955, 650, 2067, - /* 1920 */ 1937, 94, 93, 275, 22, 625, 278, 651, 276, 1618, - /* 1930 */ 283, 67, 2017, 1936, 650, 96, 98, 288, 23, 102, - /* 1940 */ 12, 1462, 2087, 643, 1549, 1517, 1515, 2175, 2048, 2049, - /* 1950 */ 1539, 10, 2084, 174, 186, 319, 2050, 654, 2052, 2053, - /* 1960 */ 649, 36, 644, 1514, 2048, 2049, 1538, 285, 2084, 15, - /* 1970 */ 24, 169, 2050, 654, 2052, 2053, 649, 1486, 644, 1494, - /* 1980 */ 2067, 25, 655, 657, 1287, 370, 383, 659, 651, 1284, - /* 1990 */ 661, 662, 1279, 2017, 1281, 650, 2067, 664, 665, 594, - /* 2000 */ 1275, 667, 1273, 670, 648, 668, 671, 1264, 1278, 2017, - /* 2010 */ 103, 650, 677, 1277, 291, 1296, 1292, 104, 1276, 74, - /* 2020 */ 687, 653, 1212, 1178, 2230, 2048, 1211, 2049, 1210, 2084, - /* 2030 */ 1209, 1208, 326, 2050, 654, 2052, 2053, 649, 1207, 644, - /* 2040 */ 1231, 2048, 1205, 1203, 2049, 2084, 1202, 1201, 325, 2050, - /* 2050 */ 654, 2052, 2053, 649, 699, 644, 1199, 2103, 2067, 292, - /* 2060 */ 1198, 1197, 2049, 380, 1196, 1195, 651, 1194, 1193, 1228, - /* 2070 */ 1226, 2017, 1190, 650, 1189, 2067, 1186, 1184, 1185, 1183, - /* 2080 */ 382, 1737, 719, 651, 720, 721, 1735, 723, 2017, 725, - /* 2090 */ 650, 1733, 727, 2067, 1731, 729, 724, 728, 733, 731, - /* 2100 */ 1717, 651, 732, 2048, 735, 1135, 2017, 2084, 650, 1697, - /* 2110 */ 326, 2050, 654, 2052, 2053, 649, 739, 644, 295, 1448, - /* 2120 */ 2048, 305, 742, 743, 2084, 2049, 1672, 326, 2050, 654, - /* 2130 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, 556, 1672, - /* 2140 */ 1672, 1672, 2084, 1672, 1672, 321, 2050, 654, 2052, 2053, - /* 2150 */ 649, 1672, 644, 1672, 1672, 1672, 2067, 1672, 1672, 1672, - /* 2160 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 2170 */ 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2180 */ 1672, 1672, 1672, 1672, 1672, 1672, 2049, 1672, 1672, 1672, - /* 2190 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2200 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 310, 2050, - /* 2210 */ 654, 2052, 2053, 649, 1672, 644, 1672, 2067, 1672, 1672, - /* 2220 */ 1672, 2049, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2230 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2240 */ 1672, 1672, 1672, 1672, 2049, 1672, 1672, 1672, 1672, 1672, - /* 2250 */ 1672, 1672, 2067, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2260 */ 651, 1672, 2048, 1672, 1672, 2017, 2084, 650, 1672, 311, - /* 2270 */ 2050, 654, 2052, 2053, 649, 2067, 644, 1672, 1672, 1672, - /* 2280 */ 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, - /* 2290 */ 650, 1672, 1672, 1672, 1672, 1672, 1672, 2048, 1672, 1672, - /* 2300 */ 1672, 2084, 1672, 1672, 312, 2050, 654, 2052, 2053, 649, - /* 2310 */ 1672, 644, 1672, 2049, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2320 */ 2048, 1672, 1672, 1672, 2084, 1672, 1672, 318, 2050, 654, - /* 2330 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 2049, 1672, 1672, - /* 2340 */ 1672, 1672, 1672, 1672, 2067, 1672, 1672, 1672, 1672, 1672, - /* 2350 */ 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, 650, - /* 2360 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2067, 1672, - /* 2370 */ 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, - /* 2380 */ 1672, 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 2048, - /* 2390 */ 1672, 1672, 1672, 2084, 1672, 2049, 322, 2050, 654, 2052, - /* 2400 */ 2053, 649, 1672, 644, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2410 */ 1672, 1672, 1672, 2048, 1672, 1672, 2049, 2084, 1672, 1672, - /* 2420 */ 314, 2050, 654, 2052, 2053, 649, 2067, 644, 1672, 1672, - /* 2430 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 2440 */ 1672, 650, 1672, 1672, 1672, 2049, 1672, 2067, 1672, 1672, - /* 2450 */ 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2460 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2470 */ 1672, 2048, 1672, 1672, 1672, 2084, 2067, 1672, 323, 2050, - /* 2480 */ 654, 2052, 2053, 649, 651, 644, 1672, 1672, 1672, 2017, - /* 2490 */ 1672, 650, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 315, - /* 2500 */ 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, - /* 2510 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2049, - /* 2520 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 324, 2050, - /* 2530 */ 654, 2052, 2053, 649, 1672, 644, 1672, 1672, 2049, 1672, - /* 2540 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2550 */ 2067, 1672, 1672, 1672, 2049, 1672, 1672, 1672, 651, 1672, - /* 2560 */ 1672, 1672, 1672, 2017, 1672, 650, 1672, 1672, 1672, 2067, - /* 2570 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, - /* 2580 */ 1672, 1672, 2017, 1672, 650, 2067, 1672, 1672, 1672, 1672, - /* 2590 */ 1672, 1672, 1672, 651, 1672, 2048, 1672, 1672, 2017, 2084, - /* 2600 */ 650, 1672, 316, 2050, 654, 2052, 2053, 649, 1672, 644, - /* 2610 */ 1672, 1672, 1672, 1672, 2048, 1672, 2049, 1672, 2084, 1672, - /* 2620 */ 1672, 329, 2050, 654, 2052, 2053, 649, 1672, 644, 1672, - /* 2630 */ 2048, 1672, 1672, 1672, 2084, 1672, 1672, 330, 2050, 654, - /* 2640 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 2067, 1672, 1672, - /* 2650 */ 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2660 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2670 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2049, 1672, 1672, - /* 2680 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2690 */ 1672, 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 2061, - /* 2700 */ 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 2067, 1672, - /* 2710 */ 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, - /* 2720 */ 1672, 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2730 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2740 */ 1672, 1672, 1672, 1672, 1672, 1672, 2049, 1672, 1672, 1672, - /* 2750 */ 1672, 1672, 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, - /* 2760 */ 2060, 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 1672, - /* 2770 */ 1672, 1672, 2049, 1672, 1672, 1672, 1672, 2067, 1672, 1672, - /* 2780 */ 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, - /* 2790 */ 2017, 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2800 */ 1672, 1672, 1672, 2067, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2810 */ 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, 650, 1672, - /* 2820 */ 1672, 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 2059, - /* 2830 */ 2050, 654, 2052, 2053, 649, 2049, 644, 1672, 1672, 1672, - /* 2840 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 2048, 1672, - /* 2850 */ 1672, 1672, 2084, 1672, 2049, 342, 2050, 654, 2052, 2053, - /* 2860 */ 649, 1672, 644, 1672, 1672, 1672, 2067, 1672, 1672, 1672, - /* 2870 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 2880 */ 1672, 650, 1672, 1672, 1672, 2067, 1672, 1672, 1672, 1672, - /* 2890 */ 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, - /* 2900 */ 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2910 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 2049, 343, 2050, - /* 2920 */ 654, 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, 1672, - /* 2930 */ 2048, 1672, 1672, 2049, 2084, 1672, 1672, 339, 2050, 654, - /* 2940 */ 2052, 2053, 649, 1672, 644, 1672, 1672, 1672, 2067, 1672, - /* 2950 */ 1672, 1672, 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, - /* 2960 */ 1672, 2017, 1672, 650, 2067, 1672, 1672, 1672, 1672, 1672, - /* 2970 */ 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, 1672, 650, - /* 2980 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 2990 */ 1672, 1672, 1672, 2048, 1672, 2049, 1672, 2084, 1672, 1672, - /* 3000 */ 344, 2050, 654, 2052, 2053, 649, 1672, 644, 1672, 652, - /* 3010 */ 1672, 1672, 1672, 2084, 1672, 1672, 321, 2050, 654, 2052, - /* 3020 */ 2053, 649, 1672, 644, 1672, 1672, 2067, 1672, 1672, 1672, - /* 3030 */ 1672, 1672, 1672, 1672, 651, 1672, 1672, 1672, 1672, 2017, - /* 3040 */ 1672, 650, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 3050 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 3060 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, - /* 3070 */ 1672, 2048, 1672, 1672, 1672, 2084, 1672, 1672, 320, 2050, - /* 3080 */ 654, 2052, 2053, 649, 1672, 644, + /* 0 */ 2065, 2243, 1976, 167, 2079, 2238, 491, 377, 492, 1731, + /* 10 */ 1803, 2061, 45, 43, 1619, 164, 1976, 1974, 629, 2065, + /* 20 */ 385, 2242, 1468, 617, 1859, 2239, 2241, 2079, 376, 1493, + /* 30 */ 2061, 1973, 629, 1549, 166, 1466, 1707, 2097, 1848, 44, + /* 40 */ 42, 41, 40, 39, 641, 620, 2057, 2063, 366, 2061, + /* 50 */ 2047, 500, 658, 492, 1731, 388, 139, 652, 1544, 176, + /* 60 */ 2097, 1493, 1910, 161, 18, 2057, 2063, 367, 659, 350, + /* 70 */ 364, 1474, 1859, 2047, 178, 658, 652, 497, 1908, 1908, + /* 80 */ 352, 1959, 2078, 493, 2057, 2063, 2114, 1897, 641, 109, + /* 90 */ 2080, 662, 2082, 2083, 657, 652, 652, 749, 35, 291, + /* 100 */ 14, 179, 617, 2167, 627, 2078, 430, 379, 2163, 2114, + /* 110 */ 45, 43, 168, 2080, 662, 2082, 2083, 657, 385, 652, + /* 120 */ 1468, 184, 270, 2175, 616, 1764, 133, 615, 2066, 2193, + /* 130 */ 2238, 1549, 1171, 1466, 1170, 139, 1551, 1552, 490, 2061, + /* 140 */ 605, 495, 1737, 1623, 2238, 604, 182, 222, 333, 1493, + /* 150 */ 2239, 606, 1695, 581, 2204, 1152, 1544, 1834, 141, 604, + /* 160 */ 182, 2138, 18, 1172, 2239, 606, 1524, 1534, 48, 1474, + /* 170 */ 1761, 509, 1550, 1553, 2057, 2063, 131, 130, 129, 128, + /* 180 */ 127, 126, 125, 124, 123, 652, 1469, 641, 1467, 176, + /* 190 */ 61, 545, 544, 543, 1154, 749, 1157, 1158, 14, 136, + /* 200 */ 539, 181, 2175, 2176, 538, 137, 2180, 1385, 1386, 537, + /* 210 */ 542, 1960, 468, 1472, 1473, 536, 1523, 1526, 1527, 1528, + /* 220 */ 1529, 1530, 1531, 1532, 1533, 654, 650, 1542, 1543, 1545, + /* 230 */ 1546, 1547, 1548, 2, 1551, 1552, 726, 725, 724, 723, + /* 240 */ 395, 600, 722, 721, 143, 716, 715, 714, 713, 712, + /* 250 */ 711, 710, 156, 706, 705, 704, 394, 393, 701, 700, + /* 260 */ 699, 698, 697, 1616, 1524, 1534, 595, 48, 696, 694, + /* 270 */ 1550, 1553, 122, 198, 197, 121, 120, 119, 118, 117, + /* 280 */ 116, 115, 114, 113, 1469, 694, 1467, 154, 153, 691, + /* 290 */ 690, 689, 151, 38, 37, 1525, 467, 44, 42, 41, + /* 300 */ 40, 39, 1492, 154, 153, 691, 690, 689, 151, 1693, + /* 310 */ 2182, 1472, 1473, 273, 1523, 1526, 1527, 1528, 1529, 1530, + /* 320 */ 1531, 1532, 1533, 654, 650, 1542, 1543, 1545, 1546, 1547, + /* 330 */ 1548, 2, 11, 45, 43, 390, 2179, 2097, 1903, 1905, + /* 340 */ 185, 385, 1296, 1468, 499, 599, 49, 495, 1737, 345, + /* 350 */ 601, 596, 589, 1940, 1549, 61, 1466, 92, 1287, 684, + /* 360 */ 683, 682, 1291, 681, 1293, 1294, 680, 677, 86, 1302, + /* 370 */ 674, 1304, 1305, 671, 668, 1696, 31, 398, 2079, 1544, + /* 380 */ 568, 397, 38, 37, 65, 18, 44, 42, 41, 40, + /* 390 */ 39, 598, 1474, 1853, 1578, 628, 122, 1494, 11, 121, + /* 400 */ 120, 119, 118, 117, 116, 115, 114, 113, 38, 37, + /* 410 */ 628, 2097, 44, 42, 41, 40, 39, 185, 749, 656, + /* 420 */ 1496, 14, 642, 580, 2047, 1474, 658, 2238, 11, 1910, + /* 430 */ 9, 45, 43, 1554, 628, 687, 363, 2015, 187, 385, + /* 440 */ 1250, 1468, 2244, 182, 507, 1908, 1969, 2239, 606, 1718, + /* 450 */ 1579, 1647, 1549, 1249, 1466, 1857, 2078, 1551, 1552, 626, + /* 460 */ 2114, 1969, 2243, 327, 2080, 662, 2082, 2083, 657, 655, + /* 470 */ 652, 643, 2132, 545, 544, 543, 1239, 1544, 617, 1495, + /* 480 */ 61, 136, 539, 637, 240, 1969, 538, 1524, 1534, 2242, + /* 490 */ 1474, 537, 542, 1550, 1553, 2047, 185, 536, 592, 591, + /* 500 */ 1645, 1646, 1648, 1649, 1650, 185, 708, 1469, 448, 1467, + /* 510 */ 1615, 139, 1241, 1330, 1331, 477, 749, 447, 152, 46, + /* 520 */ 541, 540, 34, 383, 1573, 1574, 1575, 1576, 1577, 1581, + /* 530 */ 1582, 1583, 1584, 1495, 1472, 1473, 575, 1523, 1526, 1527, + /* 540 */ 1528, 1529, 1530, 1531, 1532, 1533, 654, 650, 1542, 1543, + /* 550 */ 1545, 1546, 1547, 1548, 2, 1551, 1552, 38, 37, 1846, + /* 560 */ 1681, 44, 42, 41, 40, 39, 38, 37, 250, 1717, + /* 570 */ 44, 42, 41, 40, 39, 53, 619, 180, 2175, 2176, + /* 580 */ 2079, 137, 2180, 642, 605, 1524, 1534, 1708, 2238, 38, + /* 590 */ 37, 1550, 1553, 44, 42, 41, 40, 39, 2243, 132, + /* 600 */ 1842, 642, 2238, 604, 182, 1469, 530, 1467, 2239, 606, + /* 610 */ 1716, 1493, 644, 2097, 2139, 2047, 1857, 132, 2242, 239, + /* 620 */ 2068, 659, 2239, 2240, 535, 27, 2047, 272, 658, 646, + /* 630 */ 185, 2139, 1472, 1473, 1857, 1523, 1526, 1527, 1528, 1529, + /* 640 */ 1530, 1531, 1532, 1533, 654, 650, 1542, 1543, 1545, 1546, + /* 650 */ 1547, 1548, 2, 45, 43, 86, 2047, 2079, 2078, 1658, + /* 660 */ 424, 385, 2114, 1468, 423, 109, 2080, 662, 2082, 2083, + /* 670 */ 657, 354, 652, 2070, 1549, 142, 1466, 149, 2138, 2167, + /* 680 */ 1852, 272, 1580, 379, 2163, 1442, 1443, 1468, 38, 37, + /* 690 */ 2097, 61, 44, 42, 41, 40, 39, 1910, 659, 1544, + /* 700 */ 1466, 617, 2182, 2047, 373, 658, 580, 642, 33, 709, + /* 710 */ 2238, 1819, 1474, 1908, 38, 37, 1904, 1905, 44, 42, + /* 720 */ 41, 40, 39, 54, 1844, 2244, 182, 1688, 2178, 238, + /* 730 */ 2239, 606, 642, 237, 139, 2078, 1474, 642, 749, 2114, + /* 740 */ 1857, 46, 169, 2080, 662, 2082, 2083, 657, 621, 652, + /* 750 */ 357, 45, 43, 428, 32, 1171, 608, 1170, 388, 385, + /* 760 */ 1910, 1468, 749, 391, 1585, 1857, 164, 378, 282, 283, + /* 770 */ 1857, 164, 1549, 281, 1466, 1859, 1908, 1551, 1552, 1835, + /* 780 */ 1859, 1635, 1715, 38, 37, 1832, 1172, 44, 42, 41, + /* 790 */ 40, 39, 89, 340, 607, 2259, 362, 1544, 561, 2079, + /* 800 */ 183, 2175, 2176, 1714, 137, 2180, 106, 1524, 1534, 2182, + /* 810 */ 1474, 720, 718, 1550, 1553, 642, 358, 534, 356, 355, + /* 820 */ 417, 532, 140, 147, 1687, 534, 1910, 1469, 2047, 1467, + /* 830 */ 1849, 429, 2097, 389, 8, 2177, 749, 559, 533, 14, + /* 840 */ 659, 185, 1908, 419, 415, 2047, 533, 658, 1857, 2047, + /* 850 */ 557, 1469, 555, 1467, 1472, 1473, 1713, 1523, 1526, 1527, + /* 860 */ 1528, 1529, 1530, 1531, 1532, 1533, 654, 650, 1542, 1543, + /* 870 */ 1545, 1546, 1547, 1548, 2, 1551, 1552, 2078, 1472, 1473, + /* 880 */ 623, 2114, 13, 12, 110, 2080, 662, 2082, 2083, 657, + /* 890 */ 100, 652, 1496, 1559, 41, 40, 39, 694, 2167, 1493, + /* 900 */ 105, 1712, 2047, 2164, 164, 1524, 1534, 642, 642, 1494, + /* 910 */ 102, 1550, 1553, 1860, 1850, 154, 153, 691, 690, 689, + /* 920 */ 151, 1910, 1496, 438, 453, 1469, 580, 1467, 38, 37, + /* 930 */ 2238, 1804, 44, 42, 41, 40, 39, 1909, 1955, 688, + /* 940 */ 1857, 1857, 1901, 163, 1711, 2244, 182, 2047, 1833, 190, + /* 950 */ 2239, 606, 1472, 1473, 73, 1523, 1526, 1527, 1528, 1529, + /* 960 */ 1530, 1531, 1532, 1533, 654, 650, 1542, 1543, 1545, 1546, + /* 970 */ 1547, 1548, 2, 61, 336, 165, 1491, 2040, 382, 381, + /* 980 */ 311, 1955, 1592, 461, 1254, 550, 475, 2079, 1482, 474, + /* 990 */ 2047, 1955, 192, 305, 309, 72, 1887, 1253, 71, 1549, + /* 1000 */ 560, 1475, 196, 81, 444, 194, 476, 1710, 431, 446, + /* 1010 */ 1709, 696, 692, 609, 236, 1901, 205, 487, 485, 482, + /* 1020 */ 2097, 432, 1706, 580, 1544, 1402, 1403, 2238, 659, 553, + /* 1030 */ 1157, 1158, 1705, 2047, 547, 658, 1840, 1474, 642, 235, + /* 1040 */ 191, 1704, 2244, 182, 1612, 1525, 83, 2239, 606, 82, + /* 1050 */ 248, 1703, 1702, 2047, 625, 353, 2047, 61, 422, 479, + /* 1060 */ 421, 1401, 1404, 648, 1493, 2078, 612, 434, 2047, 2114, + /* 1070 */ 249, 1857, 109, 2080, 662, 2082, 2083, 657, 2047, 652, + /* 1080 */ 69, 1701, 2065, 68, 2142, 420, 2167, 2047, 1700, 693, + /* 1090 */ 379, 2163, 1901, 2061, 90, 108, 472, 2047, 2047, 466, + /* 1100 */ 465, 464, 463, 460, 459, 458, 457, 456, 452, 451, + /* 1110 */ 450, 449, 335, 441, 440, 439, 642, 436, 435, 351, + /* 1120 */ 686, 228, 642, 185, 226, 1699, 642, 2047, 2057, 2063, + /* 1130 */ 380, 642, 392, 2033, 2047, 80, 79, 427, 454, 652, + /* 1140 */ 189, 2079, 508, 2187, 1612, 642, 51, 1854, 3, 1857, + /* 1150 */ 1477, 145, 1483, 134, 1478, 1857, 649, 642, 245, 1857, + /* 1160 */ 334, 241, 1751, 413, 1857, 411, 407, 403, 400, 420, + /* 1170 */ 642, 2047, 2079, 576, 2097, 563, 653, 562, 1857, 1486, + /* 1180 */ 1488, 405, 620, 267, 546, 152, 286, 2047, 642, 658, + /* 1190 */ 1857, 1476, 650, 1542, 1543, 1545, 1546, 1547, 1548, 642, + /* 1200 */ 1698, 642, 1744, 1857, 639, 2097, 230, 185, 152, 229, + /* 1210 */ 1525, 232, 2207, 659, 231, 640, 63, 292, 2047, 2078, + /* 1220 */ 658, 1857, 2079, 2114, 548, 1742, 109, 2080, 662, 2082, + /* 1230 */ 2083, 657, 1857, 652, 1857, 63, 47, 254, 179, 2079, + /* 1240 */ 2167, 610, 1437, 579, 379, 2163, 2047, 551, 234, 152, + /* 1250 */ 2078, 233, 13, 12, 2114, 2097, 47, 109, 2080, 662, + /* 1260 */ 2082, 2083, 657, 659, 652, 1440, 2194, 1738, 2047, 2258, + /* 1270 */ 658, 2167, 2097, 1644, 593, 379, 2163, 279, 1690, 1691, + /* 1280 */ 659, 221, 70, 261, 150, 2047, 2201, 658, 2098, 152, + /* 1290 */ 1732, 63, 1643, 1535, 256, 396, 613, 47, 666, 2079, + /* 1300 */ 2078, 150, 152, 1480, 2114, 1570, 624, 168, 2080, 662, + /* 1310 */ 2082, 2083, 657, 1399, 652, 52, 744, 2078, 1964, 2079, + /* 1320 */ 1898, 2114, 135, 150, 109, 2080, 662, 2082, 2083, 657, + /* 1330 */ 2197, 652, 2097, 1201, 284, 702, 2258, 752, 2167, 634, + /* 1340 */ 659, 288, 379, 2163, 1479, 2047, 1280, 658, 1586, 2205, + /* 1350 */ 618, 298, 2097, 2214, 304, 1308, 703, 1220, 1312, 1319, + /* 1360 */ 659, 269, 266, 1, 4, 2047, 175, 658, 404, 1202, + /* 1370 */ 399, 349, 742, 738, 734, 730, 296, 2078, 1218, 1317, + /* 1380 */ 155, 2114, 1422, 299, 109, 2080, 662, 2082, 2083, 657, + /* 1390 */ 195, 652, 433, 1496, 1965, 437, 2258, 2078, 2167, 470, + /* 1400 */ 1491, 2114, 379, 2163, 109, 2080, 662, 2082, 2083, 657, + /* 1410 */ 442, 652, 455, 587, 1957, 462, 2258, 107, 2167, 469, + /* 1420 */ 289, 471, 379, 2163, 480, 481, 478, 199, 2079, 200, + /* 1430 */ 483, 484, 2041, 2232, 202, 223, 1497, 486, 488, 489, + /* 1440 */ 498, 1499, 501, 1494, 502, 208, 210, 1498, 2079, 503, + /* 1450 */ 171, 1500, 638, 504, 506, 1174, 526, 522, 518, 514, + /* 1460 */ 220, 2097, 510, 213, 215, 84, 85, 219, 527, 659, + /* 1470 */ 528, 529, 112, 339, 2047, 531, 658, 565, 580, 1847, + /* 1480 */ 567, 2097, 2238, 88, 148, 300, 570, 276, 225, 659, + /* 1490 */ 242, 1843, 275, 227, 2047, 157, 658, 2244, 182, 158, + /* 1500 */ 1845, 87, 2239, 606, 218, 1841, 2078, 2024, 1429, 2021, + /* 1510 */ 2114, 243, 569, 109, 2080, 662, 2082, 2083, 657, 159, + /* 1520 */ 652, 2020, 2079, 160, 246, 2258, 2078, 2167, 571, 574, + /* 1530 */ 2114, 379, 2163, 109, 2080, 662, 2082, 2083, 657, 244, + /* 1540 */ 652, 577, 2186, 2198, 584, 2140, 2079, 2167, 2208, 594, + /* 1550 */ 632, 379, 2163, 590, 2213, 2097, 252, 368, 255, 597, + /* 1560 */ 7, 603, 582, 659, 2212, 585, 611, 583, 2047, 265, + /* 1570 */ 658, 217, 211, 369, 614, 2261, 216, 1612, 505, 2097, + /* 1580 */ 138, 1495, 622, 2183, 372, 274, 1501, 659, 95, 301, + /* 1590 */ 1970, 630, 2047, 260, 658, 209, 2079, 631, 1984, 263, + /* 1600 */ 2078, 2189, 264, 172, 2114, 566, 1983, 109, 2080, 662, + /* 1610 */ 2082, 2083, 657, 2079, 652, 1982, 302, 2237, 268, 645, + /* 1620 */ 262, 2167, 635, 303, 2078, 379, 2163, 375, 2114, 2097, + /* 1630 */ 97, 110, 2080, 662, 2082, 2083, 657, 659, 652, 1858, + /* 1640 */ 636, 60, 2047, 2148, 658, 2167, 2097, 99, 101, 2166, + /* 1650 */ 2163, 580, 664, 306, 659, 2238, 295, 1820, 1902, 2047, + /* 1660 */ 745, 658, 746, 748, 341, 50, 330, 342, 308, 315, + /* 1670 */ 2244, 182, 310, 2079, 2078, 2239, 606, 2039, 2114, 2038, + /* 1680 */ 2037, 321, 2080, 662, 2082, 2083, 657, 77, 652, 329, + /* 1690 */ 2034, 2078, 319, 2079, 401, 2114, 402, 1459, 110, 2080, + /* 1700 */ 662, 2082, 2083, 657, 1460, 652, 2097, 188, 406, 2032, + /* 1710 */ 408, 409, 2167, 410, 659, 2031, 647, 2163, 412, 2047, + /* 1720 */ 2030, 658, 414, 2029, 416, 602, 2097, 2028, 418, 78, + /* 1730 */ 1425, 1424, 1996, 1995, 659, 1994, 425, 426, 1993, 2047, + /* 1740 */ 1992, 658, 1376, 1948, 1947, 1945, 144, 1944, 1943, 1946, + /* 1750 */ 1942, 660, 1941, 1939, 1938, 2114, 2079, 1937, 110, 2080, + /* 1760 */ 662, 2082, 2083, 657, 193, 652, 443, 1936, 445, 1950, + /* 1770 */ 1935, 2078, 2167, 1934, 1933, 2114, 344, 2163, 169, 2080, + /* 1780 */ 662, 2082, 2083, 657, 146, 652, 1932, 1931, 1930, 2097, + /* 1790 */ 1929, 1928, 1927, 1926, 374, 1925, 1924, 659, 1923, 1922, + /* 1800 */ 1921, 1920, 2047, 1919, 658, 1918, 1949, 1917, 1916, 1915, + /* 1810 */ 1914, 1378, 1913, 473, 2079, 1912, 1911, 337, 338, 1251, + /* 1820 */ 1767, 201, 1766, 203, 1255, 1765, 204, 1763, 1727, 1247, + /* 1830 */ 2067, 2260, 1160, 1159, 2078, 1726, 2011, 2003, 2114, 2079, + /* 1840 */ 1991, 328, 2080, 662, 2082, 2083, 657, 2097, 652, 1990, + /* 1850 */ 214, 494, 75, 206, 1968, 656, 1836, 1762, 177, 1760, + /* 1860 */ 2047, 207, 658, 76, 496, 212, 511, 1758, 513, 515, + /* 1870 */ 1756, 517, 2097, 519, 1754, 1741, 1740, 384, 512, 523, + /* 1880 */ 659, 516, 521, 1723, 1838, 2047, 525, 658, 1194, 520, + /* 1890 */ 62, 1323, 2078, 524, 1837, 1324, 2114, 1238, 1237, 327, + /* 1900 */ 2080, 662, 2082, 2083, 657, 1752, 652, 1236, 2133, 717, + /* 1910 */ 719, 1230, 2079, 1235, 1232, 1231, 1229, 2078, 359, 1745, + /* 1920 */ 360, 2114, 361, 549, 328, 2080, 662, 2082, 2083, 657, + /* 1930 */ 1743, 652, 552, 2079, 1722, 1721, 554, 556, 1720, 558, + /* 1940 */ 111, 1447, 1449, 1446, 2010, 2097, 224, 1451, 26, 1431, + /* 1950 */ 386, 66, 2002, 659, 1433, 162, 1989, 1987, 2047, 572, + /* 1960 */ 658, 2243, 2079, 259, 16, 19, 2097, 58, 59, 258, + /* 1970 */ 20, 30, 64, 2068, 659, 21, 1675, 28, 17, 2047, + /* 1980 */ 1674, 658, 251, 2079, 5, 586, 1660, 6, 588, 370, + /* 1990 */ 2078, 253, 57, 1642, 2114, 2097, 1634, 328, 2080, 662, + /* 2000 */ 2082, 2083, 657, 659, 652, 1680, 1679, 1678, 2047, 170, + /* 2010 */ 658, 564, 257, 29, 371, 2114, 2097, 271, 323, 2080, + /* 2020 */ 662, 2082, 2083, 657, 659, 652, 55, 578, 91, 2047, + /* 2030 */ 1681, 658, 573, 2079, 1609, 173, 1988, 1608, 247, 365, + /* 2040 */ 2078, 1986, 1985, 1967, 2114, 94, 93, 312, 2080, 662, + /* 2050 */ 2082, 2083, 657, 22, 652, 277, 278, 633, 2079, 96, + /* 2060 */ 1640, 2078, 280, 285, 67, 2114, 2097, 1966, 313, 2080, + /* 2070 */ 662, 2082, 2083, 657, 659, 652, 98, 102, 290, 2047, + /* 2080 */ 287, 658, 23, 1561, 1560, 12, 1484, 2117, 10, 663, + /* 2090 */ 1539, 2097, 651, 2079, 1537, 36, 174, 15, 56, 659, + /* 2100 */ 1536, 24, 186, 1508, 2047, 25, 658, 1516, 1309, 665, + /* 2110 */ 667, 2078, 1571, 387, 1306, 2114, 2079, 669, 314, 2080, + /* 2120 */ 662, 2082, 2083, 657, 670, 652, 2097, 1303, 672, 673, + /* 2130 */ 661, 1297, 675, 676, 659, 1295, 2078, 678, 1301, 2047, + /* 2140 */ 2114, 658, 1300, 320, 2080, 662, 2082, 2083, 657, 2097, + /* 2150 */ 652, 679, 1286, 103, 293, 1299, 685, 659, 1298, 1318, + /* 2160 */ 104, 74, 2047, 1314, 658, 1192, 1226, 695, 1225, 1224, + /* 2170 */ 1223, 2078, 1222, 1221, 2079, 2114, 1245, 1219, 324, 2080, + /* 2180 */ 662, 2082, 2083, 657, 1217, 652, 1216, 1215, 707, 294, + /* 2190 */ 1213, 1212, 1211, 2079, 2078, 1210, 1209, 1208, 2114, 1207, + /* 2200 */ 1242, 316, 2080, 662, 2082, 2083, 657, 2097, 652, 1240, + /* 2210 */ 1198, 1204, 1203, 1200, 1199, 659, 1197, 1759, 727, 728, + /* 2220 */ 2047, 729, 658, 1757, 731, 733, 2097, 1755, 732, 735, + /* 2230 */ 737, 1753, 736, 739, 659, 740, 741, 1739, 743, 2047, + /* 2240 */ 1149, 658, 1719, 297, 1470, 747, 751, 307, 1694, 750, + /* 2250 */ 1694, 1694, 2078, 1694, 2079, 1694, 2114, 1694, 1694, 325, + /* 2260 */ 2080, 662, 2082, 2083, 657, 1694, 652, 1694, 1694, 1694, + /* 2270 */ 1694, 2078, 1694, 1694, 1694, 2114, 1694, 1694, 317, 2080, + /* 2280 */ 662, 2082, 2083, 657, 1694, 652, 1694, 2097, 1694, 1694, + /* 2290 */ 1694, 1694, 1694, 1694, 1694, 659, 1694, 1694, 1694, 1694, + /* 2300 */ 2047, 1694, 658, 1694, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2310 */ 1694, 1694, 2079, 1694, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2320 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 2079, 1694, + /* 2330 */ 1694, 1694, 2078, 1694, 1694, 1694, 2114, 1694, 1694, 326, + /* 2340 */ 2080, 662, 2082, 2083, 657, 2097, 652, 1694, 1694, 1694, + /* 2350 */ 1694, 1694, 1694, 659, 1694, 1694, 1694, 1694, 2047, 1694, + /* 2360 */ 658, 2097, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 659, + /* 2370 */ 1694, 1694, 1694, 1694, 2047, 1694, 658, 1694, 1694, 1694, + /* 2380 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2390 */ 2078, 2079, 1694, 1694, 2114, 1694, 1694, 318, 2080, 662, + /* 2400 */ 2082, 2083, 657, 1694, 652, 1694, 2078, 2079, 1694, 1694, + /* 2410 */ 2114, 1694, 1694, 331, 2080, 662, 2082, 2083, 657, 1694, + /* 2420 */ 652, 1694, 1694, 1694, 2097, 1694, 2079, 1694, 1694, 1694, + /* 2430 */ 1694, 1694, 659, 1694, 1694, 1694, 1694, 2047, 1694, 658, + /* 2440 */ 2097, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 659, 1694, + /* 2450 */ 1694, 1694, 1694, 2047, 1694, 658, 1694, 1694, 1694, 2097, + /* 2460 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 659, 1694, 2078, + /* 2470 */ 1694, 1694, 2047, 2114, 658, 1694, 332, 2080, 662, 2082, + /* 2480 */ 2083, 657, 1694, 652, 1694, 2078, 1694, 1694, 1694, 2114, + /* 2490 */ 2079, 1694, 2091, 2080, 662, 2082, 2083, 657, 1694, 652, + /* 2500 */ 1694, 1694, 1694, 1694, 2078, 1694, 1694, 2079, 2114, 1694, + /* 2510 */ 1694, 2090, 2080, 662, 2082, 2083, 657, 1694, 652, 1694, + /* 2520 */ 1694, 1694, 1694, 2097, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2530 */ 1694, 659, 1694, 1694, 1694, 1694, 2047, 1694, 658, 1694, + /* 2540 */ 2097, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 659, 1694, + /* 2550 */ 1694, 1694, 1694, 2047, 1694, 658, 1694, 1694, 1694, 1694, + /* 2560 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 2079, 2078, 1694, + /* 2570 */ 1694, 1694, 2114, 1694, 1694, 2089, 2080, 662, 2082, 2083, + /* 2580 */ 657, 1694, 652, 1694, 1694, 2078, 1694, 2079, 1694, 2114, + /* 2590 */ 1694, 1694, 346, 2080, 662, 2082, 2083, 657, 1694, 652, + /* 2600 */ 2097, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 659, 1694, + /* 2610 */ 1694, 1694, 1694, 2047, 1694, 658, 1694, 1694, 1694, 1694, + /* 2620 */ 2097, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 659, 1694, + /* 2630 */ 1694, 1694, 1694, 2047, 1694, 658, 1694, 1694, 1694, 1694, + /* 2640 */ 1694, 1694, 1694, 1694, 1694, 2078, 1694, 1694, 1694, 2114, + /* 2650 */ 1694, 1694, 347, 2080, 662, 2082, 2083, 657, 1694, 652, + /* 2660 */ 1694, 2079, 1694, 1694, 1694, 2078, 1694, 1694, 1694, 2114, + /* 2670 */ 1694, 1694, 343, 2080, 662, 2082, 2083, 657, 2079, 652, + /* 2680 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2690 */ 1694, 1694, 1694, 1694, 2097, 1694, 1694, 1694, 1694, 1694, + /* 2700 */ 1694, 1694, 659, 1694, 1694, 1694, 1694, 2047, 1694, 658, + /* 2710 */ 1694, 2097, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 659, + /* 2720 */ 1694, 1694, 1694, 1694, 2047, 1694, 658, 1694, 1694, 1694, + /* 2730 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 2078, + /* 2740 */ 2079, 1694, 1694, 2114, 1694, 1694, 348, 2080, 662, 2082, + /* 2750 */ 2083, 657, 1694, 652, 1694, 1694, 660, 1694, 1694, 1694, + /* 2760 */ 2114, 1694, 1694, 323, 2080, 662, 2082, 2083, 657, 1694, + /* 2770 */ 652, 1694, 1694, 2097, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2780 */ 1694, 659, 1694, 1694, 1694, 1694, 2047, 1694, 658, 1694, + /* 2790 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2800 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, + /* 2810 */ 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 2078, 1694, + /* 2820 */ 1694, 1694, 2114, 1694, 1694, 322, 2080, 662, 2082, 2083, + /* 2830 */ 657, 1694, 652, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 336, 355, 338, 339, 371, 336, 365, 338, 339, 363, - /* 10 */ 430, 431, 12, 13, 14, 382, 370, 376, 372, 362, - /* 20 */ 20, 20, 22, 8, 9, 379, 332, 12, 13, 14, - /* 30 */ 15, 16, 375, 33, 374, 35, 441, 377, 378, 20, - /* 40 */ 445, 337, 8, 9, 340, 341, 12, 13, 14, 15, - /* 50 */ 16, 0, 411, 412, 395, 340, 461, 363, 58, 44, - /* 60 */ 465, 466, 14, 422, 64, 371, 4, 414, 20, 363, - /* 70 */ 376, 71, 378, 378, 20, 24, 25, 26, 27, 28, - /* 80 */ 29, 30, 31, 32, 12, 13, 371, 20, 393, 394, - /* 90 */ 384, 385, 20, 440, 22, 58, 96, 96, 64, 20, - /* 100 */ 441, 363, 408, 63, 445, 33, 412, 35, 370, 415, - /* 110 */ 416, 417, 418, 419, 420, 344, 422, 379, 118, 460, - /* 120 */ 461, 427, 340, 429, 465, 466, 20, 433, 434, 358, - /* 130 */ 58, 365, 95, 133, 134, 98, 64, 366, 20, 105, - /* 140 */ 20, 447, 376, 71, 12, 13, 14, 15, 16, 455, - /* 150 */ 347, 80, 437, 438, 439, 352, 441, 442, 96, 22, - /* 160 */ 445, 20, 380, 163, 164, 355, 340, 441, 96, 169, - /* 170 */ 170, 445, 35, 363, 0, 460, 461, 411, 412, 441, - /* 180 */ 465, 466, 372, 445, 184, 363, 186, 461, 422, 0, - /* 190 */ 118, 465, 466, 371, 377, 378, 162, 371, 460, 461, - /* 200 */ 133, 134, 96, 465, 466, 133, 134, 14, 71, 138, - /* 210 */ 139, 211, 212, 20, 214, 215, 216, 217, 218, 219, + /* 0 */ 367, 443, 380, 347, 332, 447, 336, 357, 338, 339, + /* 10 */ 354, 378, 12, 13, 14, 365, 380, 395, 396, 367, + /* 20 */ 20, 463, 22, 340, 374, 467, 468, 332, 392, 20, + /* 30 */ 378, 395, 396, 33, 331, 35, 333, 365, 367, 12, + /* 40 */ 13, 14, 15, 16, 20, 373, 413, 414, 415, 378, + /* 50 */ 378, 336, 380, 338, 339, 357, 373, 424, 58, 365, + /* 60 */ 365, 20, 365, 365, 64, 413, 414, 415, 373, 372, + /* 70 */ 372, 71, 374, 378, 364, 380, 424, 14, 381, 381, + /* 80 */ 386, 387, 410, 20, 413, 414, 414, 377, 20, 417, + /* 90 */ 418, 419, 420, 421, 422, 424, 424, 97, 432, 433, + /* 100 */ 100, 429, 340, 431, 20, 410, 340, 435, 436, 414, + /* 110 */ 12, 13, 417, 418, 419, 420, 421, 422, 20, 424, + /* 120 */ 22, 449, 439, 440, 441, 0, 443, 444, 367, 457, + /* 130 */ 447, 33, 20, 35, 22, 373, 136, 137, 337, 378, + /* 140 */ 443, 340, 341, 14, 447, 462, 463, 35, 382, 20, + /* 150 */ 467, 468, 0, 458, 459, 4, 58, 0, 427, 462, + /* 160 */ 463, 430, 64, 51, 467, 468, 166, 167, 100, 71, + /* 170 */ 0, 63, 172, 173, 413, 414, 24, 25, 26, 27, + /* 180 */ 28, 29, 30, 31, 32, 424, 186, 20, 188, 365, + /* 190 */ 100, 66, 67, 68, 43, 97, 45, 46, 100, 74, + /* 200 */ 75, 439, 440, 441, 79, 443, 444, 166, 167, 84, + /* 210 */ 85, 387, 80, 213, 214, 90, 216, 217, 218, 219, /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - /* 230 */ 230, 231, 161, 349, 350, 163, 164, 63, 340, 417, - /* 240 */ 21, 169, 170, 24, 25, 26, 27, 28, 29, 30, - /* 250 */ 31, 32, 354, 349, 350, 118, 184, 337, 186, 361, - /* 260 */ 340, 341, 436, 437, 438, 439, 340, 441, 442, 371, - /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - /* 280 */ 246, 163, 164, 211, 212, 165, 214, 215, 216, 217, - /* 290 */ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - /* 300 */ 228, 229, 230, 231, 163, 233, 12, 13, 0, 20, - /* 310 */ 378, 249, 363, 387, 20, 389, 22, 332, 211, 370, - /* 320 */ 332, 184, 390, 186, 20, 393, 394, 33, 379, 35, - /* 330 */ 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - /* 340 */ 119, 152, 121, 122, 123, 124, 125, 126, 211, 212, - /* 350 */ 161, 363, 58, 332, 20, 249, 163, 20, 64, 371, - /* 360 */ 20, 376, 22, 340, 376, 71, 378, 260, 261, 262, - /* 370 */ 263, 264, 265, 266, 66, 67, 68, 354, 12, 13, - /* 380 */ 14, 63, 74, 75, 361, 96, 20, 79, 22, 359, - /* 390 */ 96, 51, 84, 85, 371, 168, 408, 376, 90, 33, - /* 400 */ 412, 35, 363, 415, 416, 417, 418, 419, 420, 370, - /* 410 */ 422, 4, 118, 425, 0, 427, 428, 429, 379, 2, - /* 420 */ 340, 433, 434, 96, 58, 8, 9, 133, 134, 12, - /* 430 */ 13, 14, 15, 16, 354, 21, 406, 71, 24, 25, - /* 440 */ 26, 27, 28, 29, 30, 31, 32, 66, 67, 68, - /* 450 */ 43, 371, 45, 46, 71, 74, 75, 163, 164, 162, - /* 460 */ 79, 35, 96, 169, 170, 84, 85, 133, 134, 8, - /* 470 */ 9, 90, 107, 12, 13, 14, 15, 16, 184, 346, - /* 480 */ 186, 254, 255, 256, 118, 8, 9, 58, 58, 12, - /* 490 */ 13, 14, 15, 16, 395, 96, 395, 71, 399, 133, - /* 500 */ 134, 14, 369, 169, 170, 211, 212, 20, 214, 215, - /* 510 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - /* 520 */ 226, 227, 228, 229, 230, 231, 96, 98, 98, 163, - /* 530 */ 164, 179, 44, 236, 19, 169, 170, 128, 249, 3, - /* 540 */ 441, 132, 441, 246, 445, 0, 445, 331, 33, 333, - /* 550 */ 184, 107, 186, 363, 202, 203, 20, 344, 97, 460, - /* 560 */ 461, 460, 461, 48, 465, 466, 465, 466, 340, 54, - /* 570 */ 55, 56, 57, 58, 97, 385, 249, 211, 212, 366, - /* 580 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - /* 590 */ 224, 225, 226, 227, 228, 229, 230, 231, 12, 13, - /* 600 */ 340, 192, 193, 33, 363, 196, 20, 198, 22, 346, - /* 610 */ 95, 370, 332, 98, 20, 387, 22, 389, 48, 33, - /* 620 */ 379, 35, 233, 360, 54, 55, 56, 57, 58, 35, - /* 630 */ 8, 9, 369, 97, 12, 13, 14, 15, 16, 71, - /* 640 */ 4, 332, 20, 363, 58, 51, 131, 387, 249, 389, - /* 650 */ 163, 371, 340, 108, 22, 19, 376, 71, 378, 127, - /* 660 */ 128, 14, 15, 16, 132, 95, 354, 35, 98, 33, - /* 670 */ 12, 13, 127, 128, 129, 130, 131, 132, 20, 249, - /* 680 */ 22, 166, 96, 371, 48, 376, 171, 340, 408, 53, - /* 690 */ 364, 33, 412, 35, 58, 415, 416, 417, 418, 419, - /* 700 */ 420, 165, 422, 188, 118, 364, 191, 427, 340, 429, - /* 710 */ 364, 340, 340, 433, 434, 233, 58, 235, 371, 133, - /* 720 */ 134, 426, 354, 428, 363, 354, 354, 371, 441, 71, - /* 730 */ 400, 95, 445, 332, 98, 455, 166, 167, 382, 371, - /* 740 */ 379, 171, 371, 371, 174, 333, 371, 460, 461, 163, - /* 750 */ 164, 127, 465, 466, 96, 169, 170, 382, 21, 8, - /* 760 */ 9, 191, 274, 12, 13, 14, 15, 16, 2, 37, - /* 770 */ 184, 34, 186, 36, 8, 9, 118, 376, 12, 13, - /* 780 */ 14, 15, 16, 363, 437, 438, 439, 165, 441, 442, - /* 790 */ 370, 133, 134, 329, 414, 395, 364, 211, 212, 379, - /* 800 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - /* 810 */ 224, 225, 226, 227, 228, 229, 230, 231, 194, 195, - /* 820 */ 440, 163, 164, 18, 414, 20, 373, 169, 170, 376, - /* 830 */ 364, 99, 27, 101, 102, 30, 104, 340, 33, 355, - /* 840 */ 108, 441, 184, 425, 186, 445, 428, 363, 332, 332, - /* 850 */ 440, 354, 96, 48, 373, 50, 372, 376, 53, 395, - /* 860 */ 460, 461, 130, 399, 373, 465, 466, 376, 371, 211, - /* 870 */ 212, 332, 214, 215, 216, 217, 218, 219, 220, 221, - /* 880 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - /* 890 */ 355, 44, 376, 376, 18, 0, 332, 340, 363, 23, - /* 900 */ 95, 0, 0, 3, 426, 441, 428, 372, 64, 445, - /* 910 */ 363, 354, 107, 37, 38, 376, 4, 41, 356, 372, - /* 920 */ 351, 359, 353, 364, 460, 461, 39, 176, 371, 465, - /* 930 */ 466, 1, 2, 45, 46, 59, 60, 61, 62, 183, - /* 940 */ 376, 185, 137, 48, 97, 140, 141, 142, 143, 144, - /* 950 */ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - /* 960 */ 155, 156, 332, 158, 159, 160, 210, 66, 67, 68, - /* 970 */ 69, 70, 96, 72, 73, 74, 75, 76, 77, 78, - /* 980 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - /* 990 */ 89, 90, 91, 92, 8, 9, 352, 340, 12, 13, - /* 1000 */ 14, 15, 16, 20, 364, 249, 376, 332, 8, 9, - /* 1010 */ 108, 135, 12, 13, 14, 15, 16, 386, 108, 332, - /* 1020 */ 107, 332, 395, 44, 108, 332, 275, 97, 371, 127, - /* 1030 */ 128, 129, 130, 131, 132, 340, 340, 127, 128, 129, - /* 1040 */ 130, 131, 132, 469, 340, 340, 130, 340, 340, 354, - /* 1050 */ 354, 376, 176, 177, 178, 211, 363, 181, 354, 354, - /* 1060 */ 340, 354, 354, 376, 371, 376, 371, 371, 441, 376, - /* 1070 */ 157, 378, 445, 458, 354, 371, 371, 201, 371, 371, - /* 1080 */ 204, 342, 206, 207, 208, 209, 210, 460, 461, 452, - /* 1090 */ 340, 371, 465, 466, 437, 438, 439, 332, 441, 442, - /* 1100 */ 340, 408, 340, 332, 354, 412, 332, 365, 415, 416, - /* 1110 */ 417, 418, 419, 420, 354, 422, 354, 20, 376, 332, - /* 1120 */ 427, 371, 429, 0, 332, 249, 433, 434, 342, 340, - /* 1130 */ 332, 371, 332, 371, 363, 248, 332, 444, 247, 248, - /* 1140 */ 332, 376, 371, 354, 42, 22, 44, 376, 165, 378, - /* 1150 */ 376, 165, 0, 411, 412, 413, 42, 197, 44, 199, - /* 1160 */ 371, 365, 250, 376, 422, 35, 100, 363, 376, 103, - /* 1170 */ 270, 386, 376, 35, 376, 371, 376, 0, 100, 408, - /* 1180 */ 376, 103, 378, 412, 376, 363, 415, 416, 417, 418, - /* 1190 */ 419, 420, 100, 422, 100, 103, 44, 103, 427, 22, - /* 1200 */ 429, 339, 44, 332, 433, 434, 365, 411, 412, 413, - /* 1210 */ 0, 44, 408, 44, 44, 444, 412, 376, 422, 415, - /* 1220 */ 416, 417, 418, 419, 420, 44, 422, 44, 133, 134, - /* 1230 */ 375, 427, 22, 429, 363, 12, 13, 433, 434, 44, - /* 1240 */ 1, 2, 371, 386, 44, 22, 443, 376, 444, 378, - /* 1250 */ 165, 272, 411, 412, 413, 97, 33, 172, 35, 47, - /* 1260 */ 44, 96, 165, 422, 97, 44, 97, 97, 332, 44, - /* 1270 */ 44, 106, 44, 44, 44, 462, 44, 44, 97, 408, - /* 1280 */ 97, 58, 44, 412, 44, 35, 415, 416, 417, 418, - /* 1290 */ 419, 420, 97, 422, 71, 13, 435, 97, 427, 363, - /* 1300 */ 429, 332, 446, 251, 433, 434, 13, 371, 96, 410, - /* 1310 */ 48, 182, 376, 97, 378, 444, 186, 35, 97, 0, - /* 1320 */ 409, 71, 97, 97, 186, 97, 97, 97, 35, 97, - /* 1330 */ 97, 397, 363, 42, 383, 97, 386, 97, 20, 383, - /* 1340 */ 371, 118, 162, 381, 408, 376, 20, 378, 412, 340, - /* 1350 */ 340, 415, 416, 417, 418, 419, 420, 383, 422, 381, - /* 1360 */ 340, 381, 94, 427, 348, 429, 340, 340, 49, 433, - /* 1370 */ 434, 340, 20, 334, 334, 20, 403, 408, 346, 20, - /* 1380 */ 444, 412, 378, 346, 415, 416, 417, 418, 419, 420, - /* 1390 */ 20, 422, 341, 20, 396, 346, 427, 332, 429, 341, - /* 1400 */ 346, 346, 433, 434, 340, 346, 346, 184, 52, 186, - /* 1410 */ 343, 343, 340, 334, 334, 200, 363, 376, 376, 363, - /* 1420 */ 363, 376, 407, 96, 363, 363, 363, 405, 363, 340, - /* 1430 */ 344, 403, 363, 363, 211, 212, 371, 363, 363, 363, - /* 1440 */ 402, 376, 190, 378, 189, 401, 259, 224, 225, 226, - /* 1450 */ 227, 228, 229, 230, 344, 378, 451, 386, 332, 386, - /* 1460 */ 376, 258, 451, 376, 376, 267, 376, 454, 450, 175, - /* 1470 */ 453, 269, 391, 408, 391, 451, 268, 412, 449, 252, - /* 1480 */ 415, 416, 417, 418, 419, 420, 273, 422, 271, 363, - /* 1490 */ 276, 448, 427, 470, 429, 248, 463, 371, 433, 434, - /* 1500 */ 464, 410, 376, 371, 378, 20, 340, 414, 332, 341, - /* 1510 */ 389, 20, 376, 391, 167, 344, 344, 376, 376, 376, - /* 1520 */ 376, 376, 391, 388, 371, 376, 344, 96, 344, 96, - /* 1530 */ 432, 332, 359, 340, 408, 344, 36, 398, 412, 363, - /* 1540 */ 335, 415, 416, 417, 418, 419, 420, 371, 422, 353, - /* 1550 */ 404, 392, 376, 427, 378, 429, 367, 0, 334, 433, - /* 1560 */ 434, 357, 363, 357, 357, 345, 392, 330, 0, 0, - /* 1570 */ 371, 42, 0, 35, 205, 376, 35, 378, 35, 35, - /* 1580 */ 205, 332, 0, 35, 408, 35, 205, 0, 412, 205, - /* 1590 */ 0, 415, 416, 417, 418, 419, 420, 35, 422, 0, - /* 1600 */ 22, 0, 35, 192, 186, 429, 184, 408, 0, 433, - /* 1610 */ 434, 412, 363, 0, 415, 416, 417, 418, 419, 420, - /* 1620 */ 371, 422, 0, 180, 179, 376, 0, 378, 429, 0, - /* 1630 */ 47, 332, 433, 434, 0, 0, 0, 42, 0, 0, - /* 1640 */ 0, 0, 0, 0, 0, 0, 152, 35, 332, 0, - /* 1650 */ 152, 0, 0, 0, 0, 0, 0, 408, 0, 0, - /* 1660 */ 0, 412, 363, 0, 415, 416, 417, 418, 419, 420, - /* 1670 */ 371, 422, 0, 0, 0, 376, 0, 378, 429, 363, - /* 1680 */ 0, 0, 433, 434, 0, 0, 0, 371, 42, 0, - /* 1690 */ 0, 0, 376, 22, 378, 136, 0, 0, 332, 0, - /* 1700 */ 0, 0, 0, 35, 0, 58, 58, 408, 0, 0, - /* 1710 */ 0, 412, 42, 44, 415, 416, 417, 418, 419, 420, - /* 1720 */ 421, 422, 423, 424, 408, 58, 39, 14, 412, 363, - /* 1730 */ 47, 415, 416, 417, 418, 419, 420, 371, 422, 47, - /* 1740 */ 14, 47, 376, 0, 378, 40, 39, 0, 0, 0, - /* 1750 */ 39, 175, 0, 0, 0, 0, 0, 35, 65, 39, - /* 1760 */ 0, 332, 48, 35, 48, 0, 39, 35, 39, 48, - /* 1770 */ 0, 35, 456, 457, 408, 0, 39, 0, 412, 48, - /* 1780 */ 0, 415, 416, 417, 418, 419, 420, 0, 422, 22, - /* 1790 */ 0, 0, 363, 105, 35, 44, 35, 35, 35, 35, - /* 1800 */ 371, 103, 44, 35, 35, 376, 22, 378, 35, 0, - /* 1810 */ 22, 22, 0, 35, 22, 0, 50, 35, 0, 0, - /* 1820 */ 35, 22, 332, 20, 0, 0, 165, 22, 22, 35, - /* 1830 */ 35, 35, 97, 467, 468, 96, 96, 408, 0, 35, - /* 1840 */ 165, 412, 0, 165, 415, 416, 417, 418, 419, 420, - /* 1850 */ 173, 422, 187, 363, 3, 44, 253, 232, 429, 257, - /* 1860 */ 44, 371, 253, 434, 44, 44, 376, 96, 378, 97, - /* 1870 */ 167, 97, 332, 97, 47, 96, 47, 96, 172, 96, - /* 1880 */ 44, 3, 96, 44, 253, 35, 0, 172, 332, 44, - /* 1890 */ 35, 35, 35, 35, 97, 97, 96, 35, 408, 97, - /* 1900 */ 47, 0, 412, 363, 97, 415, 416, 417, 418, 419, - /* 1910 */ 420, 371, 422, 247, 97, 47, 376, 0, 378, 363, - /* 1920 */ 0, 39, 96, 47, 96, 168, 96, 371, 97, 97, - /* 1930 */ 96, 96, 376, 0, 378, 39, 96, 47, 44, 106, - /* 1940 */ 2, 22, 96, 96, 211, 97, 97, 457, 408, 332, - /* 1950 */ 232, 234, 412, 47, 47, 415, 416, 417, 418, 419, - /* 1960 */ 420, 96, 422, 97, 408, 332, 232, 166, 412, 96, - /* 1970 */ 96, 415, 416, 417, 418, 419, 420, 97, 422, 22, - /* 1980 */ 363, 96, 107, 35, 97, 368, 35, 96, 371, 97, - /* 1990 */ 35, 96, 120, 376, 97, 378, 363, 35, 96, 459, - /* 2000 */ 97, 35, 97, 35, 371, 96, 96, 22, 120, 376, - /* 2010 */ 96, 378, 108, 120, 44, 35, 22, 96, 120, 96, - /* 2020 */ 64, 213, 35, 65, 468, 408, 35, 332, 35, 412, - /* 2030 */ 35, 35, 415, 416, 417, 418, 419, 420, 35, 422, - /* 2040 */ 71, 408, 35, 35, 332, 412, 35, 35, 415, 416, - /* 2050 */ 417, 418, 419, 420, 93, 422, 35, 424, 363, 44, - /* 2060 */ 35, 35, 332, 368, 22, 35, 371, 35, 35, 71, - /* 2070 */ 35, 376, 35, 378, 35, 363, 35, 22, 35, 35, - /* 2080 */ 368, 0, 35, 371, 48, 39, 0, 35, 376, 39, - /* 2090 */ 378, 0, 35, 363, 0, 39, 48, 48, 39, 35, - /* 2100 */ 0, 371, 48, 408, 35, 35, 376, 412, 378, 0, - /* 2110 */ 415, 416, 417, 418, 419, 420, 21, 422, 22, 22, - /* 2120 */ 408, 22, 21, 20, 412, 332, 471, 415, 416, 417, - /* 2130 */ 418, 419, 420, 471, 422, 471, 471, 471, 408, 471, - /* 2140 */ 471, 471, 412, 471, 471, 415, 416, 417, 418, 419, - /* 2150 */ 420, 471, 422, 471, 471, 471, 363, 471, 471, 471, - /* 2160 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 2170 */ 471, 378, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2180 */ 471, 471, 471, 471, 471, 471, 332, 471, 471, 471, - /* 2190 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2200 */ 471, 408, 471, 471, 471, 412, 471, 471, 415, 416, - /* 2210 */ 417, 418, 419, 420, 471, 422, 471, 363, 471, 471, - /* 2220 */ 471, 332, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2230 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2240 */ 471, 471, 471, 471, 332, 471, 471, 471, 471, 471, - /* 2250 */ 471, 471, 363, 471, 471, 471, 471, 471, 471, 471, - /* 2260 */ 371, 471, 408, 471, 471, 376, 412, 378, 471, 415, - /* 2270 */ 416, 417, 418, 419, 420, 363, 422, 471, 471, 471, - /* 2280 */ 471, 471, 471, 371, 471, 471, 471, 471, 376, 471, - /* 2290 */ 378, 471, 471, 471, 471, 471, 471, 408, 471, 471, - /* 2300 */ 471, 412, 471, 471, 415, 416, 417, 418, 419, 420, - /* 2310 */ 471, 422, 471, 332, 471, 471, 471, 471, 471, 471, - /* 2320 */ 408, 471, 471, 471, 412, 471, 471, 415, 416, 417, - /* 2330 */ 418, 419, 420, 471, 422, 471, 471, 332, 471, 471, - /* 2340 */ 471, 471, 471, 471, 363, 471, 471, 471, 471, 471, - /* 2350 */ 471, 471, 371, 471, 471, 471, 471, 376, 471, 378, - /* 2360 */ 471, 471, 471, 471, 471, 471, 471, 471, 363, 471, - /* 2370 */ 471, 471, 471, 471, 471, 471, 371, 471, 471, 471, - /* 2380 */ 471, 376, 471, 378, 471, 471, 471, 471, 471, 408, - /* 2390 */ 471, 471, 471, 412, 471, 332, 415, 416, 417, 418, - /* 2400 */ 419, 420, 471, 422, 471, 471, 471, 471, 471, 471, - /* 2410 */ 471, 471, 471, 408, 471, 471, 332, 412, 471, 471, - /* 2420 */ 415, 416, 417, 418, 419, 420, 363, 422, 471, 471, - /* 2430 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 2440 */ 471, 378, 471, 471, 471, 332, 471, 363, 471, 471, - /* 2450 */ 471, 471, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2460 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2470 */ 471, 408, 471, 471, 471, 412, 363, 471, 415, 416, - /* 2480 */ 417, 418, 419, 420, 371, 422, 471, 471, 471, 376, - /* 2490 */ 471, 378, 408, 471, 471, 471, 412, 471, 471, 415, - /* 2500 */ 416, 417, 418, 419, 420, 471, 422, 471, 471, 471, - /* 2510 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 332, - /* 2520 */ 471, 408, 471, 471, 471, 412, 471, 471, 415, 416, - /* 2530 */ 417, 418, 419, 420, 471, 422, 471, 471, 332, 471, - /* 2540 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2550 */ 363, 471, 471, 471, 332, 471, 471, 471, 371, 471, - /* 2560 */ 471, 471, 471, 376, 471, 378, 471, 471, 471, 363, - /* 2570 */ 471, 471, 471, 471, 471, 471, 471, 371, 471, 471, - /* 2580 */ 471, 471, 376, 471, 378, 363, 471, 471, 471, 471, - /* 2590 */ 471, 471, 471, 371, 471, 408, 471, 471, 376, 412, - /* 2600 */ 378, 471, 415, 416, 417, 418, 419, 420, 471, 422, - /* 2610 */ 471, 471, 471, 471, 408, 471, 332, 471, 412, 471, - /* 2620 */ 471, 415, 416, 417, 418, 419, 420, 471, 422, 471, - /* 2630 */ 408, 471, 471, 471, 412, 471, 471, 415, 416, 417, - /* 2640 */ 418, 419, 420, 471, 422, 471, 471, 363, 471, 471, - /* 2650 */ 471, 471, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2660 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2670 */ 471, 471, 471, 471, 471, 471, 471, 332, 471, 471, - /* 2680 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2690 */ 471, 471, 408, 471, 471, 471, 412, 471, 471, 415, - /* 2700 */ 416, 417, 418, 419, 420, 471, 422, 471, 363, 471, - /* 2710 */ 471, 471, 471, 471, 471, 471, 371, 471, 471, 471, - /* 2720 */ 471, 376, 471, 378, 471, 471, 471, 471, 471, 471, - /* 2730 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2740 */ 471, 471, 471, 471, 471, 471, 332, 471, 471, 471, - /* 2750 */ 471, 471, 471, 408, 471, 471, 471, 412, 471, 471, - /* 2760 */ 415, 416, 417, 418, 419, 420, 471, 422, 471, 471, - /* 2770 */ 471, 471, 332, 471, 471, 471, 471, 363, 471, 471, - /* 2780 */ 471, 471, 471, 471, 471, 371, 471, 471, 471, 471, - /* 2790 */ 376, 471, 378, 471, 471, 471, 471, 471, 471, 471, - /* 2800 */ 471, 471, 471, 363, 471, 471, 471, 471, 471, 471, - /* 2810 */ 471, 371, 471, 471, 471, 471, 376, 471, 378, 471, - /* 2820 */ 471, 471, 408, 471, 471, 471, 412, 471, 471, 415, - /* 2830 */ 416, 417, 418, 419, 420, 332, 422, 471, 471, 471, - /* 2840 */ 471, 471, 471, 471, 471, 471, 471, 471, 408, 471, - /* 2850 */ 471, 471, 412, 471, 332, 415, 416, 417, 418, 419, - /* 2860 */ 420, 471, 422, 471, 471, 471, 363, 471, 471, 471, - /* 2870 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 2880 */ 471, 378, 471, 471, 471, 363, 471, 471, 471, 471, - /* 2890 */ 471, 471, 471, 371, 471, 471, 471, 471, 376, 471, - /* 2900 */ 378, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2910 */ 471, 408, 471, 471, 471, 412, 471, 332, 415, 416, - /* 2920 */ 417, 418, 419, 420, 471, 422, 471, 471, 471, 471, - /* 2930 */ 408, 471, 471, 332, 412, 471, 471, 415, 416, 417, - /* 2940 */ 418, 419, 420, 471, 422, 471, 471, 471, 363, 471, - /* 2950 */ 471, 471, 471, 471, 471, 471, 371, 471, 471, 471, - /* 2960 */ 471, 376, 471, 378, 363, 471, 471, 471, 471, 471, - /* 2970 */ 471, 471, 371, 471, 471, 471, 471, 376, 471, 378, - /* 2980 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2990 */ 471, 471, 471, 408, 471, 332, 471, 412, 471, 471, - /* 3000 */ 415, 416, 417, 418, 419, 420, 471, 422, 471, 408, - /* 3010 */ 471, 471, 471, 412, 471, 471, 415, 416, 417, 418, - /* 3020 */ 419, 420, 471, 422, 471, 471, 363, 471, 471, 471, - /* 3030 */ 471, 471, 471, 471, 371, 471, 471, 471, 471, 376, - /* 3040 */ 471, 378, 471, 471, 471, 471, 471, 471, 471, 471, - /* 3050 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 3060 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 3070 */ 471, 408, 471, 471, 471, 412, 471, 471, 415, 416, - /* 3080 */ 417, 418, 419, 420, 471, 422, + /* 230 */ 230, 231, 232, 233, 136, 137, 66, 67, 68, 69, + /* 240 */ 70, 20, 72, 73, 74, 75, 76, 77, 78, 79, + /* 250 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + /* 260 */ 90, 91, 92, 4, 166, 167, 171, 100, 63, 112, + /* 270 */ 172, 173, 21, 141, 142, 24, 25, 26, 27, 28, + /* 280 */ 29, 30, 31, 32, 186, 112, 188, 130, 131, 132, + /* 290 */ 133, 134, 135, 8, 9, 166, 164, 12, 13, 14, + /* 300 */ 15, 16, 20, 130, 131, 132, 133, 134, 135, 329, + /* 310 */ 416, 213, 214, 58, 216, 217, 218, 219, 220, 221, + /* 320 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + /* 330 */ 232, 233, 234, 12, 13, 376, 442, 365, 379, 380, + /* 340 */ 250, 20, 97, 22, 337, 373, 100, 340, 341, 64, + /* 350 */ 255, 256, 257, 0, 33, 100, 35, 102, 113, 114, + /* 360 */ 115, 116, 117, 118, 119, 120, 121, 122, 346, 124, + /* 370 */ 125, 126, 127, 128, 129, 0, 2, 397, 332, 58, + /* 380 */ 111, 401, 8, 9, 4, 64, 12, 13, 14, 15, + /* 390 */ 16, 419, 71, 371, 109, 340, 21, 20, 234, 24, + /* 400 */ 25, 26, 27, 28, 29, 30, 31, 32, 8, 9, + /* 410 */ 340, 365, 12, 13, 14, 15, 16, 250, 97, 373, + /* 420 */ 20, 100, 340, 443, 378, 71, 380, 447, 234, 365, + /* 430 */ 236, 12, 13, 14, 340, 111, 372, 361, 356, 20, + /* 440 */ 22, 22, 462, 463, 389, 381, 391, 467, 468, 332, + /* 450 */ 165, 213, 33, 35, 35, 373, 410, 136, 137, 389, + /* 460 */ 414, 391, 3, 417, 418, 419, 420, 421, 422, 423, + /* 470 */ 424, 425, 426, 66, 67, 68, 35, 58, 340, 20, + /* 480 */ 100, 74, 75, 389, 408, 391, 79, 166, 167, 3, + /* 490 */ 71, 84, 85, 172, 173, 378, 250, 90, 260, 261, + /* 500 */ 262, 263, 264, 265, 266, 250, 71, 186, 155, 188, + /* 510 */ 251, 373, 71, 136, 137, 97, 97, 164, 44, 100, + /* 520 */ 351, 352, 237, 238, 239, 240, 241, 242, 243, 244, + /* 530 */ 245, 246, 247, 20, 213, 214, 402, 216, 217, 218, + /* 540 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + /* 550 */ 229, 230, 231, 232, 233, 136, 137, 8, 9, 366, + /* 560 */ 101, 12, 13, 14, 15, 16, 8, 9, 168, 332, + /* 570 */ 12, 13, 14, 15, 16, 101, 438, 439, 440, 441, + /* 580 */ 332, 443, 444, 340, 443, 166, 167, 333, 447, 8, + /* 590 */ 9, 172, 173, 12, 13, 14, 15, 16, 443, 356, + /* 600 */ 366, 340, 447, 462, 463, 186, 363, 188, 467, 468, + /* 610 */ 332, 20, 428, 365, 430, 378, 373, 356, 463, 130, + /* 620 */ 47, 373, 467, 468, 363, 44, 378, 168, 380, 428, + /* 630 */ 250, 430, 213, 214, 373, 216, 217, 218, 219, 220, + /* 640 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + /* 650 */ 231, 232, 233, 12, 13, 346, 378, 332, 410, 101, + /* 660 */ 397, 20, 414, 22, 401, 417, 418, 419, 420, 421, + /* 670 */ 422, 362, 424, 100, 33, 427, 35, 429, 430, 431, + /* 680 */ 371, 168, 165, 435, 436, 196, 197, 22, 8, 9, + /* 690 */ 365, 100, 12, 13, 14, 15, 16, 365, 373, 58, + /* 700 */ 35, 340, 416, 378, 372, 380, 443, 340, 2, 353, + /* 710 */ 447, 355, 71, 381, 8, 9, 379, 380, 12, 13, + /* 720 */ 14, 15, 16, 356, 366, 462, 463, 178, 442, 131, + /* 730 */ 467, 468, 340, 135, 373, 410, 71, 340, 97, 414, + /* 740 */ 373, 100, 417, 418, 419, 420, 421, 422, 356, 424, + /* 750 */ 37, 12, 13, 356, 237, 20, 270, 22, 357, 20, + /* 760 */ 365, 22, 97, 357, 247, 373, 365, 372, 130, 131, + /* 770 */ 373, 365, 33, 135, 35, 374, 381, 136, 137, 0, + /* 780 */ 374, 101, 332, 8, 9, 0, 51, 12, 13, 14, + /* 790 */ 15, 16, 194, 195, 469, 470, 198, 58, 200, 332, + /* 800 */ 439, 440, 441, 332, 443, 444, 344, 166, 167, 416, + /* 810 */ 71, 351, 352, 172, 173, 340, 103, 112, 105, 106, + /* 820 */ 181, 108, 360, 44, 275, 112, 365, 186, 378, 188, + /* 830 */ 368, 356, 365, 372, 39, 442, 97, 21, 133, 100, + /* 840 */ 373, 250, 381, 204, 205, 378, 133, 380, 373, 378, + /* 850 */ 34, 186, 36, 188, 213, 214, 332, 216, 217, 218, + /* 860 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + /* 870 */ 229, 230, 231, 232, 233, 136, 137, 410, 213, 214, + /* 880 */ 397, 414, 1, 2, 417, 418, 419, 420, 421, 422, + /* 890 */ 344, 424, 20, 14, 14, 15, 16, 112, 431, 20, + /* 900 */ 100, 332, 378, 436, 365, 166, 167, 340, 340, 20, + /* 910 */ 110, 172, 173, 374, 368, 130, 131, 132, 133, 134, + /* 920 */ 135, 365, 20, 356, 356, 186, 443, 188, 8, 9, + /* 930 */ 447, 354, 12, 13, 14, 15, 16, 381, 373, 375, + /* 940 */ 373, 373, 378, 168, 332, 462, 463, 378, 0, 384, + /* 950 */ 467, 468, 213, 214, 111, 216, 217, 218, 219, 220, + /* 960 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + /* 970 */ 231, 232, 233, 100, 18, 18, 20, 397, 12, 13, + /* 980 */ 23, 373, 101, 27, 22, 4, 30, 332, 22, 33, + /* 990 */ 378, 373, 384, 358, 37, 38, 361, 35, 41, 33, + /* 1000 */ 19, 35, 384, 160, 48, 58, 50, 332, 22, 53, + /* 1010 */ 332, 63, 375, 44, 33, 378, 59, 60, 61, 62, + /* 1020 */ 365, 35, 332, 443, 58, 136, 137, 447, 373, 48, + /* 1030 */ 45, 46, 332, 378, 53, 380, 366, 71, 340, 58, + /* 1040 */ 168, 332, 462, 463, 249, 166, 99, 467, 468, 102, + /* 1050 */ 58, 332, 332, 378, 356, 99, 378, 100, 185, 97, + /* 1060 */ 187, 172, 173, 97, 20, 410, 44, 111, 378, 414, + /* 1070 */ 168, 373, 417, 418, 419, 420, 421, 422, 378, 424, + /* 1080 */ 99, 332, 367, 102, 429, 212, 431, 378, 332, 375, + /* 1090 */ 435, 436, 378, 378, 102, 138, 140, 378, 378, 143, + /* 1100 */ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + /* 1110 */ 154, 155, 156, 157, 158, 159, 340, 161, 162, 163, + /* 1120 */ 366, 104, 340, 250, 107, 332, 340, 378, 413, 414, + /* 1130 */ 415, 340, 356, 0, 378, 178, 179, 180, 356, 424, + /* 1140 */ 183, 332, 356, 248, 249, 340, 42, 356, 44, 373, + /* 1150 */ 35, 42, 186, 44, 188, 373, 64, 340, 366, 373, + /* 1160 */ 203, 356, 0, 206, 373, 208, 209, 210, 211, 212, + /* 1170 */ 340, 378, 332, 356, 365, 199, 366, 201, 373, 213, + /* 1180 */ 214, 48, 373, 471, 22, 44, 356, 378, 340, 380, + /* 1190 */ 373, 35, 226, 227, 228, 229, 230, 231, 232, 340, + /* 1200 */ 332, 340, 0, 373, 356, 365, 104, 250, 44, 107, + /* 1210 */ 166, 104, 388, 373, 107, 356, 44, 356, 378, 410, + /* 1220 */ 380, 373, 332, 414, 22, 0, 417, 418, 419, 420, + /* 1230 */ 421, 422, 373, 424, 373, 44, 44, 44, 429, 332, + /* 1240 */ 431, 272, 101, 96, 435, 436, 378, 22, 104, 44, + /* 1250 */ 410, 107, 1, 2, 414, 365, 44, 417, 418, 419, + /* 1260 */ 420, 421, 422, 373, 424, 101, 457, 0, 378, 429, + /* 1270 */ 380, 431, 365, 101, 460, 435, 436, 44, 136, 137, + /* 1280 */ 373, 342, 44, 454, 44, 378, 446, 380, 365, 44, + /* 1290 */ 339, 44, 101, 101, 101, 342, 274, 44, 44, 332, + /* 1300 */ 410, 44, 44, 188, 414, 213, 101, 417, 418, 419, + /* 1310 */ 420, 421, 422, 101, 424, 168, 49, 410, 388, 332, + /* 1320 */ 377, 414, 44, 44, 417, 418, 419, 420, 421, 422, + /* 1330 */ 388, 424, 365, 35, 101, 13, 429, 19, 431, 101, + /* 1340 */ 373, 101, 435, 436, 188, 378, 101, 380, 101, 459, + /* 1350 */ 445, 33, 365, 446, 101, 101, 13, 35, 101, 101, + /* 1360 */ 373, 464, 437, 448, 252, 378, 48, 380, 48, 71, + /* 1370 */ 412, 411, 54, 55, 56, 57, 58, 410, 35, 101, + /* 1380 */ 101, 414, 184, 399, 417, 418, 419, 420, 421, 422, + /* 1390 */ 42, 424, 385, 20, 388, 385, 429, 410, 431, 165, + /* 1400 */ 20, 414, 435, 436, 417, 418, 419, 420, 421, 422, + /* 1410 */ 383, 424, 340, 446, 340, 385, 429, 99, 431, 383, + /* 1420 */ 102, 383, 435, 436, 98, 350, 95, 349, 332, 340, + /* 1430 */ 94, 348, 397, 446, 340, 33, 20, 340, 340, 334, + /* 1440 */ 334, 20, 405, 20, 380, 346, 346, 20, 332, 341, + /* 1450 */ 48, 20, 134, 398, 341, 52, 54, 55, 56, 57, + /* 1460 */ 58, 365, 340, 346, 346, 346, 346, 346, 343, 373, + /* 1470 */ 343, 334, 340, 334, 378, 365, 380, 202, 443, 365, + /* 1480 */ 409, 365, 447, 100, 407, 405, 192, 169, 365, 373, + /* 1490 */ 344, 365, 174, 365, 378, 365, 380, 462, 463, 365, + /* 1500 */ 365, 99, 467, 468, 102, 365, 410, 378, 190, 378, + /* 1510 */ 414, 193, 191, 417, 418, 419, 420, 421, 422, 365, + /* 1520 */ 424, 378, 332, 365, 344, 429, 410, 431, 404, 380, + /* 1530 */ 414, 435, 436, 417, 418, 419, 420, 421, 422, 403, + /* 1540 */ 424, 340, 446, 388, 378, 429, 332, 431, 388, 259, + /* 1550 */ 258, 435, 436, 378, 453, 365, 393, 378, 393, 378, + /* 1560 */ 267, 177, 253, 373, 453, 269, 271, 268, 378, 412, + /* 1570 */ 380, 169, 170, 276, 273, 472, 174, 249, 176, 365, + /* 1580 */ 373, 20, 340, 416, 341, 344, 20, 373, 344, 393, + /* 1590 */ 391, 378, 378, 455, 380, 193, 332, 378, 378, 451, + /* 1600 */ 410, 456, 450, 453, 414, 397, 378, 417, 418, 419, + /* 1610 */ 420, 421, 422, 332, 424, 378, 393, 466, 465, 429, + /* 1620 */ 452, 431, 170, 361, 410, 435, 436, 378, 414, 365, + /* 1630 */ 344, 417, 418, 419, 420, 421, 422, 373, 424, 373, + /* 1640 */ 390, 100, 378, 434, 380, 431, 365, 344, 100, 435, + /* 1650 */ 436, 443, 369, 340, 373, 447, 344, 355, 378, 378, + /* 1660 */ 36, 380, 335, 334, 394, 400, 406, 394, 345, 359, + /* 1670 */ 462, 463, 330, 332, 410, 467, 468, 0, 414, 0, + /* 1680 */ 0, 417, 418, 419, 420, 421, 422, 42, 424, 359, + /* 1690 */ 0, 410, 359, 332, 35, 414, 207, 35, 417, 418, + /* 1700 */ 419, 420, 421, 422, 35, 424, 365, 35, 207, 0, + /* 1710 */ 35, 35, 431, 207, 373, 0, 435, 436, 207, 378, + /* 1720 */ 0, 380, 35, 0, 22, 461, 365, 0, 35, 194, + /* 1730 */ 188, 186, 0, 0, 373, 0, 182, 181, 0, 378, + /* 1740 */ 0, 380, 47, 0, 0, 0, 42, 0, 0, 0, + /* 1750 */ 0, 410, 0, 0, 0, 414, 332, 0, 417, 418, + /* 1760 */ 419, 420, 421, 422, 155, 424, 35, 0, 155, 0, + /* 1770 */ 0, 410, 431, 0, 0, 414, 435, 436, 417, 418, + /* 1780 */ 419, 420, 421, 422, 42, 424, 0, 0, 0, 365, + /* 1790 */ 0, 0, 0, 0, 370, 0, 0, 373, 0, 0, + /* 1800 */ 0, 0, 378, 0, 380, 0, 0, 0, 0, 0, + /* 1810 */ 0, 22, 0, 139, 332, 0, 0, 96, 96, 22, + /* 1820 */ 0, 58, 0, 58, 22, 0, 58, 0, 0, 35, + /* 1830 */ 47, 470, 14, 14, 410, 0, 0, 0, 414, 332, + /* 1840 */ 0, 417, 418, 419, 420, 421, 422, 365, 424, 0, + /* 1850 */ 177, 47, 39, 42, 0, 373, 0, 0, 44, 0, + /* 1860 */ 378, 40, 380, 39, 47, 39, 35, 0, 39, 35, + /* 1870 */ 0, 39, 365, 35, 0, 0, 0, 370, 48, 35, + /* 1880 */ 373, 48, 39, 0, 0, 378, 39, 380, 65, 48, + /* 1890 */ 109, 22, 410, 48, 0, 35, 414, 35, 35, 417, + /* 1900 */ 418, 419, 420, 421, 422, 0, 424, 35, 426, 44, + /* 1910 */ 44, 22, 332, 35, 35, 35, 35, 410, 22, 0, + /* 1920 */ 22, 414, 22, 50, 417, 418, 419, 420, 421, 422, + /* 1930 */ 0, 424, 35, 332, 0, 0, 35, 35, 0, 22, + /* 1940 */ 20, 35, 35, 35, 0, 365, 107, 101, 100, 35, + /* 1950 */ 370, 100, 0, 373, 22, 189, 0, 0, 378, 22, + /* 1960 */ 380, 3, 332, 47, 254, 44, 365, 44, 44, 44, + /* 1970 */ 254, 44, 3, 47, 373, 44, 35, 100, 254, 378, + /* 1980 */ 35, 380, 100, 332, 96, 98, 101, 96, 95, 35, + /* 1990 */ 410, 101, 44, 101, 414, 365, 101, 417, 418, 419, + /* 2000 */ 420, 421, 422, 373, 424, 101, 35, 35, 378, 100, + /* 2010 */ 380, 410, 100, 100, 35, 414, 365, 47, 417, 418, + /* 2020 */ 419, 420, 421, 422, 373, 424, 168, 175, 100, 378, + /* 2030 */ 101, 380, 168, 332, 101, 47, 0, 101, 170, 168, + /* 2040 */ 410, 0, 0, 0, 414, 39, 100, 417, 418, 419, + /* 2050 */ 420, 421, 422, 100, 424, 47, 101, 171, 332, 39, + /* 2060 */ 101, 410, 100, 100, 100, 414, 365, 0, 417, 418, + /* 2070 */ 419, 420, 421, 422, 373, 424, 100, 110, 47, 378, + /* 2080 */ 169, 380, 44, 98, 98, 2, 22, 100, 235, 111, + /* 2090 */ 101, 365, 100, 332, 101, 100, 47, 100, 248, 373, + /* 2100 */ 101, 100, 47, 101, 378, 100, 380, 22, 101, 35, + /* 2110 */ 100, 410, 213, 35, 101, 414, 332, 35, 417, 418, + /* 2120 */ 419, 420, 421, 422, 100, 424, 365, 101, 35, 100, + /* 2130 */ 215, 101, 35, 100, 373, 101, 410, 35, 123, 378, + /* 2140 */ 414, 380, 123, 417, 418, 419, 420, 421, 422, 365, + /* 2150 */ 424, 100, 22, 100, 44, 123, 112, 373, 123, 35, + /* 2160 */ 100, 100, 378, 22, 380, 65, 35, 64, 35, 35, + /* 2170 */ 35, 410, 35, 35, 332, 414, 71, 35, 417, 418, + /* 2180 */ 419, 420, 421, 422, 35, 424, 35, 35, 93, 44, + /* 2190 */ 35, 35, 35, 332, 410, 22, 35, 35, 414, 35, + /* 2200 */ 71, 417, 418, 419, 420, 421, 422, 365, 424, 35, + /* 2210 */ 22, 35, 35, 35, 35, 373, 35, 0, 35, 48, + /* 2220 */ 378, 39, 380, 0, 35, 39, 365, 0, 48, 35, + /* 2230 */ 39, 0, 48, 35, 373, 48, 39, 0, 35, 378, + /* 2240 */ 35, 380, 0, 22, 22, 21, 20, 22, 473, 21, + /* 2250 */ 473, 473, 410, 473, 332, 473, 414, 473, 473, 417, + /* 2260 */ 418, 419, 420, 421, 422, 473, 424, 473, 473, 473, + /* 2270 */ 473, 410, 473, 473, 473, 414, 473, 473, 417, 418, + /* 2280 */ 419, 420, 421, 422, 473, 424, 473, 365, 473, 473, + /* 2290 */ 473, 473, 473, 473, 473, 373, 473, 473, 473, 473, + /* 2300 */ 378, 473, 380, 473, 473, 473, 473, 473, 473, 473, + /* 2310 */ 473, 473, 332, 473, 473, 473, 473, 473, 473, 473, + /* 2320 */ 473, 473, 473, 473, 473, 473, 473, 473, 332, 473, + /* 2330 */ 473, 473, 410, 473, 473, 473, 414, 473, 473, 417, + /* 2340 */ 418, 419, 420, 421, 422, 365, 424, 473, 473, 473, + /* 2350 */ 473, 473, 473, 373, 473, 473, 473, 473, 378, 473, + /* 2360 */ 380, 365, 473, 473, 473, 473, 473, 473, 473, 373, + /* 2370 */ 473, 473, 473, 473, 378, 473, 380, 473, 473, 473, + /* 2380 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2390 */ 410, 332, 473, 473, 414, 473, 473, 417, 418, 419, + /* 2400 */ 420, 421, 422, 473, 424, 473, 410, 332, 473, 473, + /* 2410 */ 414, 473, 473, 417, 418, 419, 420, 421, 422, 473, + /* 2420 */ 424, 473, 473, 473, 365, 473, 332, 473, 473, 473, + /* 2430 */ 473, 473, 373, 473, 473, 473, 473, 378, 473, 380, + /* 2440 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2450 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 365, + /* 2460 */ 473, 473, 473, 473, 473, 473, 473, 373, 473, 410, + /* 2470 */ 473, 473, 378, 414, 380, 473, 417, 418, 419, 420, + /* 2480 */ 421, 422, 473, 424, 473, 410, 473, 473, 473, 414, + /* 2490 */ 332, 473, 417, 418, 419, 420, 421, 422, 473, 424, + /* 2500 */ 473, 473, 473, 473, 410, 473, 473, 332, 414, 473, + /* 2510 */ 473, 417, 418, 419, 420, 421, 422, 473, 424, 473, + /* 2520 */ 473, 473, 473, 365, 473, 473, 473, 473, 473, 473, + /* 2530 */ 473, 373, 473, 473, 473, 473, 378, 473, 380, 473, + /* 2540 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2550 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 473, + /* 2560 */ 473, 473, 473, 473, 473, 473, 473, 332, 410, 473, + /* 2570 */ 473, 473, 414, 473, 473, 417, 418, 419, 420, 421, + /* 2580 */ 422, 473, 424, 473, 473, 410, 473, 332, 473, 414, + /* 2590 */ 473, 473, 417, 418, 419, 420, 421, 422, 473, 424, + /* 2600 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2610 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 473, + /* 2620 */ 365, 473, 473, 473, 473, 473, 473, 473, 373, 473, + /* 2630 */ 473, 473, 473, 378, 473, 380, 473, 473, 473, 473, + /* 2640 */ 473, 473, 473, 473, 473, 410, 473, 473, 473, 414, + /* 2650 */ 473, 473, 417, 418, 419, 420, 421, 422, 473, 424, + /* 2660 */ 473, 332, 473, 473, 473, 410, 473, 473, 473, 414, + /* 2670 */ 473, 473, 417, 418, 419, 420, 421, 422, 332, 424, + /* 2680 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2690 */ 473, 473, 473, 473, 365, 473, 473, 473, 473, 473, + /* 2700 */ 473, 473, 373, 473, 473, 473, 473, 378, 473, 380, + /* 2710 */ 473, 365, 473, 473, 473, 473, 473, 473, 473, 373, + /* 2720 */ 473, 473, 473, 473, 378, 473, 380, 473, 473, 473, + /* 2730 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 410, + /* 2740 */ 332, 473, 473, 414, 473, 473, 417, 418, 419, 420, + /* 2750 */ 421, 422, 473, 424, 473, 473, 410, 473, 473, 473, + /* 2760 */ 414, 473, 473, 417, 418, 419, 420, 421, 422, 473, + /* 2770 */ 424, 473, 473, 365, 473, 473, 473, 473, 473, 473, + /* 2780 */ 473, 373, 473, 473, 473, 473, 378, 473, 380, 473, + /* 2790 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2800 */ 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, + /* 2810 */ 473, 473, 473, 473, 473, 473, 473, 473, 410, 473, + /* 2820 */ 473, 473, 414, 473, 473, 417, 418, 419, 420, 421, + /* 2830 */ 422, 473, 424, }; -#define YY_SHIFT_COUNT (744) +#define YY_SHIFT_COUNT (752) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2109) +#define YY_SHIFT_MAX (2242) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 876, 0, 72, 0, 294, 294, 294, 294, 294, 294, - /* 10 */ 294, 294, 294, 294, 294, 366, 586, 586, 658, 586, - /* 20 */ 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, - /* 30 */ 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, - /* 40 */ 586, 586, 586, 586, 586, 586, 586, 586, 106, 289, - /* 50 */ 756, 1, 430, 327, 399, 327, 1, 1, 1223, 1223, - /* 60 */ 1223, 327, 1223, 1223, 62, 327, 19, 334, 54, 54, - /* 70 */ 334, 407, 407, 118, 67, 48, 48, 54, 54, 54, - /* 80 */ 54, 54, 54, 54, 79, 54, 54, 40, 19, 54, - /* 90 */ 54, 304, 54, 19, 54, 79, 54, 79, 19, 54, - /* 100 */ 54, 19, 54, 19, 19, 19, 54, 318, 805, 34, - /* 110 */ 34, 219, 381, 137, 137, 137, 137, 137, 137, 137, - /* 120 */ 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - /* 130 */ 137, 137, 732, 536, 118, 67, 426, 120, 120, 120, - /* 140 */ 174, 482, 482, 426, 337, 337, 337, 40, 365, 389, - /* 150 */ 19, 383, 19, 383, 383, 444, 568, 221, 221, 221, - /* 160 */ 221, 221, 221, 221, 221, 515, 414, 308, 622, 751, - /* 170 */ 107, 594, 227, 193, 487, 340, 983, 888, 916, 1097, - /* 180 */ 891, 887, 900, 891, 1102, 912, 141, 1052, 1262, 1129, - /* 190 */ 1291, 1318, 1291, 1180, 1326, 1326, 1291, 1180, 1180, 1326, - /* 200 */ 1268, 1326, 1326, 1326, 1352, 1352, 1355, 40, 1359, 40, - /* 210 */ 1370, 1373, 40, 1370, 40, 40, 40, 1326, 40, 1356, - /* 220 */ 1356, 1352, 19, 19, 19, 19, 19, 19, 19, 19, - /* 230 */ 19, 19, 19, 1326, 1352, 383, 383, 383, 1215, 1327, - /* 240 */ 1355, 318, 1252, 1255, 1359, 318, 1326, 1318, 1318, 383, - /* 250 */ 1187, 1203, 383, 1187, 1203, 383, 383, 19, 1198, 1294, - /* 260 */ 1187, 1202, 1208, 1227, 1052, 1214, 1213, 1217, 1247, 337, - /* 270 */ 1485, 1326, 1370, 318, 318, 1491, 1203, 383, 383, 383, - /* 280 */ 383, 383, 1203, 383, 1347, 318, 444, 318, 337, 1431, - /* 290 */ 1433, 383, 568, 1326, 318, 1500, 1352, 3086, 3086, 3086, - /* 300 */ 3086, 3086, 3086, 3086, 3086, 3086, 901, 570, 51, 636, - /* 310 */ 461, 15, 477, 545, 417, 766, 986, 902, 1000, 1000, - /* 320 */ 1000, 1000, 1000, 1000, 1000, 1000, 1000, 910, 409, 132, - /* 330 */ 132, 71, 352, 189, 37, 737, 624, 532, 532, 647, - /* 340 */ 930, 297, 647, 647, 647, 895, 847, 632, 1114, 913, - /* 350 */ 1152, 1066, 1078, 1092, 1094, 1123, 1177, 1210, 960, 1158, - /* 360 */ 1167, 429, 1169, 1170, 1181, 1095, 979, 488, 1085, 1183, - /* 370 */ 1195, 1200, 1216, 1221, 1225, 1239, 1226, 1130, 1138, 844, - /* 380 */ 1228, 1212, 1229, 1230, 1232, 1233, 1238, 1240, 1165, 1282, - /* 390 */ 1293, 1250, 1319, 1557, 1568, 1569, 1529, 1572, 1538, 1369, - /* 400 */ 1541, 1543, 1544, 1375, 1582, 1548, 1550, 1381, 1587, 1384, - /* 410 */ 1590, 1562, 1599, 1578, 1601, 1567, 1411, 1418, 1422, 1608, - /* 420 */ 1613, 1622, 1443, 1445, 1626, 1629, 1583, 1634, 1635, 1636, - /* 430 */ 1595, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1494, - /* 440 */ 1612, 1649, 1498, 1651, 1652, 1653, 1654, 1655, 1656, 1658, - /* 450 */ 1659, 1660, 1663, 1672, 1673, 1674, 1676, 1680, 1681, 1646, - /* 460 */ 1684, 1685, 1686, 1689, 1690, 1691, 1671, 1699, 1700, 1701, - /* 470 */ 1559, 1696, 1697, 1702, 1647, 1668, 1704, 1648, 1708, 1667, - /* 480 */ 1709, 1710, 1670, 1687, 1669, 1683, 1713, 1692, 1726, 1694, - /* 490 */ 1743, 1705, 1707, 1747, 1748, 1749, 1711, 1576, 1752, 1753, - /* 500 */ 1754, 1693, 1755, 1756, 1722, 1714, 1720, 1760, 1728, 1716, - /* 510 */ 1727, 1765, 1732, 1721, 1729, 1770, 1736, 1731, 1737, 1775, - /* 520 */ 1777, 1780, 1787, 1688, 1698, 1759, 1767, 1790, 1761, 1762, - /* 530 */ 1763, 1764, 1751, 1758, 1768, 1769, 1784, 1773, 1791, 1788, - /* 540 */ 1809, 1789, 1766, 1812, 1792, 1778, 1815, 1782, 1818, 1785, - /* 550 */ 1819, 1799, 1803, 1794, 1795, 1796, 1735, 1739, 1824, 1661, - /* 560 */ 1740, 1804, 1805, 1825, 1665, 1806, 1675, 1703, 1838, 1842, - /* 570 */ 1678, 1677, 1851, 1811, 1603, 1771, 1772, 1779, 1706, 1625, - /* 580 */ 1715, 1602, 1774, 1816, 1820, 1776, 1781, 1783, 1786, 1797, - /* 590 */ 1821, 1827, 1829, 1800, 1836, 1609, 1798, 1802, 1878, 1839, - /* 600 */ 1631, 1850, 1855, 1856, 1857, 1858, 1862, 1807, 1817, 1853, - /* 610 */ 1666, 1845, 1868, 1886, 1901, 1917, 1920, 1826, 1882, 1683, - /* 620 */ 1876, 1828, 1831, 1832, 1830, 1834, 1757, 1835, 1933, 1896, - /* 630 */ 1801, 1840, 1833, 1683, 1890, 1894, 1718, 1717, 1734, 1938, - /* 640 */ 1919, 1733, 1846, 1848, 1847, 1849, 1865, 1866, 1906, 1873, - /* 650 */ 1874, 1907, 1880, 1957, 1808, 1885, 1875, 1887, 1948, 1951, - /* 660 */ 1891, 1892, 1955, 1895, 1897, 1962, 1902, 1903, 1966, 1909, - /* 670 */ 1905, 1968, 1910, 1872, 1888, 1893, 1898, 1985, 1904, 1914, - /* 680 */ 1970, 1921, 1980, 1923, 1970, 1970, 1994, 1958, 1956, 1987, - /* 690 */ 1991, 1993, 1995, 1996, 2003, 2007, 2008, 2011, 2012, 1969, - /* 700 */ 1961, 2015, 2021, 2025, 2026, 2042, 2030, 2032, 2033, 1998, - /* 710 */ 1751, 2035, 1758, 2037, 2039, 2041, 2043, 2055, 2044, 2081, - /* 720 */ 2047, 2036, 2046, 2086, 2052, 2048, 2050, 2091, 2057, 2049, - /* 730 */ 2056, 2094, 2064, 2054, 2059, 2100, 2069, 2070, 2109, 2096, - /* 740 */ 2095, 2097, 2099, 2101, 2103, + /* 0 */ 957, 0, 98, 0, 321, 321, 321, 321, 321, 321, + /* 10 */ 321, 321, 321, 321, 321, 419, 641, 641, 739, 641, + /* 20 */ 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, + /* 30 */ 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, + /* 40 */ 641, 641, 641, 641, 641, 641, 641, 641, 167, 591, + /* 50 */ 873, 68, 255, 90, 246, 90, 68, 68, 966, 966, + /* 60 */ 966, 90, 966, 966, 380, 90, 9, 889, 24, 24, + /* 70 */ 889, 151, 151, 41, 377, 63, 63, 24, 24, 24, + /* 80 */ 24, 24, 24, 24, 84, 24, 24, 108, 9, 24, + /* 90 */ 24, 221, 24, 9, 24, 84, 24, 84, 9, 24, + /* 100 */ 24, 9, 24, 9, 9, 9, 24, 205, 956, 285, + /* 110 */ 285, 251, 407, 665, 665, 665, 665, 665, 665, 665, + /* 120 */ 665, 665, 665, 665, 665, 665, 665, 665, 665, 665, + /* 130 */ 665, 665, 713, 459, 41, 377, 441, 513, 513, 513, + /* 140 */ 948, 194, 194, 441, 282, 282, 282, 108, 269, 164, + /* 150 */ 9, 354, 9, 354, 354, 324, 435, 245, 245, 245, + /* 160 */ 245, 245, 245, 245, 245, 1318, 375, 125, 400, 549, + /* 170 */ 238, 112, 95, 129, 879, 735, 872, 985, 705, 902, + /* 180 */ 895, 795, 486, 895, 1104, 259, 1044, 1112, 1320, 1198, + /* 190 */ 1348, 1373, 1348, 1234, 1380, 1380, 1348, 1234, 1234, 1326, + /* 200 */ 1331, 1380, 1336, 1380, 1380, 1380, 1416, 1416, 1421, 108, + /* 210 */ 1423, 108, 1427, 1431, 108, 1427, 108, 108, 108, 1380, + /* 220 */ 108, 1403, 1403, 1416, 9, 9, 9, 9, 9, 9, + /* 230 */ 9, 9, 9, 9, 9, 1380, 1416, 354, 354, 354, + /* 240 */ 1275, 1383, 1421, 205, 1294, 1321, 1423, 205, 1380, 1373, + /* 250 */ 1373, 354, 1290, 1292, 354, 1290, 1292, 354, 354, 9, + /* 260 */ 1293, 1384, 1290, 1296, 1299, 1309, 1112, 1297, 1301, 1295, + /* 270 */ 1328, 282, 1561, 1380, 1427, 205, 205, 1566, 1292, 354, + /* 280 */ 354, 354, 354, 354, 1292, 354, 1452, 205, 324, 205, + /* 290 */ 282, 1541, 1548, 354, 435, 1380, 205, 1624, 1416, 2833, + /* 300 */ 2833, 2833, 2833, 2833, 2833, 2833, 2833, 2833, 170, 1402, + /* 310 */ 152, 981, 558, 581, 680, 157, 374, 706, 775, 785, + /* 320 */ 920, 920, 920, 920, 920, 920, 920, 920, 920, 173, + /* 330 */ 598, 27, 27, 132, 639, 353, 947, 418, 962, 816, + /* 340 */ 489, 638, 638, 880, 881, 517, 880, 880, 880, 1133, + /* 350 */ 474, 986, 1109, 843, 779, 1017, 1102, 1107, 1144, 1162, + /* 360 */ 1202, 1225, 976, 1141, 1164, 992, 1172, 1191, 1193, 1142, + /* 370 */ 969, 1022, 1147, 1205, 1212, 1233, 1238, 1240, 1245, 1251, + /* 380 */ 1247, 1115, 1156, 1092, 1192, 573, 1253, 1254, 1257, 1258, + /* 390 */ 1278, 1279, 800, 1322, 1343, 1298, 1267, 1677, 1679, 1680, + /* 400 */ 1645, 1690, 1659, 1489, 1662, 1669, 1672, 1501, 1709, 1675, + /* 410 */ 1676, 1506, 1715, 1511, 1720, 1687, 1723, 1702, 1727, 1693, + /* 420 */ 1535, 1542, 1545, 1732, 1733, 1735, 1554, 1556, 1738, 1740, + /* 430 */ 1695, 1743, 1744, 1745, 1704, 1747, 1748, 1749, 1750, 1752, + /* 440 */ 1753, 1754, 1757, 1609, 1731, 1767, 1613, 1769, 1770, 1773, + /* 450 */ 1774, 1786, 1787, 1788, 1790, 1791, 1792, 1793, 1795, 1796, + /* 460 */ 1798, 1799, 1800, 1742, 1801, 1803, 1805, 1806, 1807, 1808, + /* 470 */ 1789, 1809, 1810, 1812, 1674, 1815, 1816, 1797, 1721, 1802, + /* 480 */ 1722, 1820, 1763, 1794, 1822, 1765, 1825, 1768, 1827, 1828, + /* 490 */ 1811, 1813, 1814, 1783, 1818, 1804, 1819, 1817, 1835, 1821, + /* 500 */ 1824, 1836, 1837, 1840, 1826, 1673, 1849, 1854, 1856, 1823, + /* 510 */ 1857, 1859, 1831, 1830, 1829, 1867, 1834, 1833, 1832, 1870, + /* 520 */ 1838, 1841, 1843, 1874, 1844, 1845, 1847, 1875, 1876, 1883, + /* 530 */ 1884, 1781, 1839, 1860, 1869, 1894, 1862, 1863, 1872, 1878, + /* 540 */ 1865, 1866, 1879, 1880, 1889, 1881, 1905, 1896, 1919, 1898, + /* 550 */ 1873, 1930, 1900, 1897, 1934, 1901, 1935, 1902, 1938, 1917, + /* 560 */ 1920, 1906, 1907, 1908, 1846, 1848, 1944, 1858, 1851, 1914, + /* 570 */ 1932, 1952, 1766, 1937, 1864, 1868, 1956, 1957, 1871, 1852, + /* 580 */ 1958, 1921, 1710, 1877, 1885, 1882, 1888, 1887, 1891, 1893, + /* 590 */ 1890, 1923, 1924, 1892, 1909, 1912, 1913, 1895, 1925, 1916, + /* 600 */ 1926, 1928, 1927, 1716, 1904, 1929, 1969, 1931, 1724, 1941, + /* 610 */ 1945, 1954, 1971, 1972, 1979, 1933, 1936, 1970, 1850, 1948, + /* 620 */ 1988, 2036, 2041, 2042, 2043, 1946, 2006, 1783, 2008, 1953, + /* 630 */ 1955, 1959, 1962, 1963, 1886, 1964, 2067, 2020, 1911, 1976, + /* 640 */ 1967, 1783, 2031, 2038, 1985, 1853, 1986, 2083, 2064, 1899, + /* 650 */ 1987, 1989, 1992, 1993, 1995, 1999, 2049, 1997, 2001, 2055, + /* 660 */ 2002, 2085, 1915, 2005, 1978, 2007, 2074, 2078, 2010, 2013, + /* 670 */ 2082, 2024, 2026, 2093, 2029, 2030, 2097, 2033, 2034, 2102, + /* 680 */ 2051, 2015, 2019, 2032, 2035, 2130, 2044, 2053, 2110, 2060, + /* 690 */ 2124, 2061, 2110, 2110, 2141, 2100, 2103, 2131, 2133, 2134, + /* 700 */ 2135, 2137, 2138, 2142, 2149, 2151, 2152, 2105, 2095, 2145, + /* 710 */ 2155, 2156, 2157, 2173, 2161, 2162, 2164, 2129, 1865, 2174, + /* 720 */ 1866, 2176, 2177, 2178, 2179, 2188, 2181, 2217, 2183, 2171, + /* 730 */ 2182, 2223, 2189, 2180, 2186, 2227, 2194, 2184, 2191, 2231, + /* 740 */ 2198, 2187, 2197, 2237, 2203, 2205, 2242, 2221, 2224, 2222, + /* 750 */ 2225, 2228, 2226, }; -#define YY_REDUCE_COUNT (305) -#define YY_REDUCE_MIN (-420) -#define YY_REDUCE_MAX (2663) +#define YY_REDUCE_COUNT (307) +#define YY_REDUCE_MIN (-442) +#define YY_REDUCE_MAX (2408) static const short yy_reduce_ofst[] = { - /* 0 */ 464, -306, -12, 280, 693, 771, 804, 871, 936, 969, - /* 10 */ 1065, 1126, 1176, 1199, 1249, 1299, 1316, 1366, 1429, 1490, - /* 20 */ 1540, 1556, 1617, 1633, 1695, 1712, 1730, 1793, 1854, 1889, - /* 30 */ 1912, 1981, 2005, 2063, 2084, 2113, 2187, 2206, 2222, 2284, - /* 40 */ 2345, 2414, 2440, 2503, 2522, 2585, 2601, 2663, -285, -262, - /* 50 */ 99, -174, -341, 101, 400, 627, 347, 657, 742, 796, - /* 60 */ 841, 287, -359, -234, -405, -274, -354, -68, -102, 23, - /* 70 */ -305, -336, -331, -294, -340, -296, -80, 80, 312, 368, - /* 80 */ 371, 372, 497, 557, -74, 695, 696, 263, -51, 704, - /* 90 */ 705, -178, 707, 39, 708, 228, 720, 260, -190, 750, - /* 100 */ 760, 241, 762, 484, 420, 535, 789, -229, -218, -420, - /* 110 */ -420, 216, -197, -15, 21, 309, 401, 516, 517, 539, - /* 120 */ 564, 630, 675, 687, 689, 765, 774, 787, 792, 798, - /* 130 */ 800, 808, -343, -347, 190, -183, -116, -347, 380, 410, - /* 140 */ 213, 295, 478, -96, -367, 356, 375, 133, 30, 418, - /* 150 */ 547, 453, 361, 481, 491, 562, 569, 326, 341, 346, - /* 160 */ 432, 466, 559, 640, 466, 330, 412, 644, 631, 574, - /* 170 */ 615, 739, 637, 822, 822, 786, 785, 862, 855, 857, - /* 180 */ 803, 803, 813, 803, 861, 856, 822, 899, 911, 934, - /* 190 */ 951, 950, 956, 962, 1009, 1010, 974, 978, 980, 1020, - /* 200 */ 1016, 1026, 1027, 1031, 1039, 1040, 973, 1032, 1004, 1037, - /* 210 */ 1051, 998, 1049, 1058, 1054, 1055, 1059, 1064, 1060, 1067, - /* 220 */ 1068, 1079, 1053, 1056, 1057, 1061, 1062, 1063, 1069, 1070, - /* 230 */ 1074, 1075, 1076, 1072, 1080, 1041, 1042, 1045, 1015, 1022, - /* 240 */ 1028, 1086, 1038, 1044, 1077, 1110, 1089, 1071, 1073, 1084, - /* 250 */ 1005, 1081, 1087, 1011, 1083, 1088, 1090, 822, 1013, 1017, - /* 260 */ 1024, 1018, 1029, 1043, 1091, 1023, 1036, 1033, 803, 1132, - /* 270 */ 1093, 1166, 1168, 1171, 1172, 1121, 1122, 1136, 1141, 1142, - /* 280 */ 1143, 1144, 1131, 1145, 1135, 1182, 1173, 1184, 1153, 1098, - /* 290 */ 1189, 1149, 1196, 1193, 1191, 1205, 1224, 1139, 1146, 1159, - /* 300 */ 1174, 1204, 1206, 1207, 1220, 1237, + /* 0 */ -20, -328, 248, 809, 840, 907, 967, 987, 1096, 655, + /* 10 */ 1116, 1190, 1214, 1281, 1341, 46, -305, 325, 467, 890, + /* 20 */ 1264, 1361, 1424, 1482, 1507, 1580, 1601, 1630, 1651, 1701, + /* 30 */ 1726, 1761, 1784, 1842, 1861, 1922, 1980, 1996, 2059, 2075, + /* 40 */ 2094, 2158, 2175, 2235, 2255, 2329, 2346, 2408, -317, -303, + /* 50 */ 263, 138, 483, 580, 1035, 1208, -238, 361, -367, -348, + /* 60 */ 715, 141, -329, -239, -442, 155, -302, -364, 243, 261, + /* 70 */ -378, -330, -285, -306, -41, -199, 7, 82, 367, 397, + /* 80 */ 475, 567, 568, 782, 55, 786, 791, 309, 64, 805, + /* 90 */ 817, -28, 392, 332, 698, 70, 830, 94, -350, 848, + /* 100 */ 859, 395, 861, 401, 461, 406, 776, 462, -234, -334, + /* 110 */ -334, -297, -344, 117, 237, 278, 450, 471, 524, 569, + /* 120 */ 612, 675, 678, 690, 700, 709, 719, 720, 749, 756, + /* 130 */ 793, 868, -290, -106, -176, 337, 169, -106, 286, 393, + /* 140 */ 546, 184, 201, 460, 565, 608, 618, 22, 76, -269, + /* 150 */ 539, 564, 556, 637, 714, 635, 356, 193, 234, 358, + /* 160 */ 670, 754, 792, 810, 754, 134, 254, 577, 824, 712, + /* 170 */ 814, 939, 829, 923, 923, 953, 930, 951, 943, 942, + /* 180 */ 905, 905, 897, 905, 925, 915, 923, 958, 960, 984, + /* 190 */ 1007, 1006, 1010, 1027, 1072, 1074, 1030, 1036, 1038, 1075, + /* 200 */ 1078, 1089, 1083, 1094, 1097, 1098, 1105, 1106, 1037, 1099, + /* 210 */ 1064, 1100, 1108, 1055, 1117, 1113, 1118, 1119, 1120, 1122, + /* 220 */ 1121, 1125, 1127, 1137, 1110, 1114, 1123, 1126, 1128, 1130, + /* 230 */ 1134, 1135, 1140, 1154, 1158, 1132, 1139, 1129, 1131, 1143, + /* 240 */ 1071, 1077, 1080, 1146, 1124, 1136, 1149, 1180, 1201, 1155, + /* 250 */ 1160, 1166, 1101, 1163, 1175, 1111, 1165, 1179, 1181, 923, + /* 260 */ 1145, 1138, 1150, 1168, 1148, 1152, 1157, 1103, 1151, 1153, + /* 270 */ 905, 1207, 1167, 1242, 1243, 1241, 1244, 1199, 1196, 1213, + /* 280 */ 1219, 1220, 1228, 1237, 1223, 1249, 1250, 1286, 1262, 1303, + /* 290 */ 1266, 1209, 1283, 1280, 1302, 1313, 1312, 1327, 1329, 1265, + /* 300 */ 1260, 1270, 1273, 1310, 1330, 1333, 1323, 1342, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 10 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 20 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 30 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 40 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 50 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 60 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 70 */ 1670, 1670, 1670, 1928, 1670, 1670, 1670, 1670, 1670, 1670, - /* 80 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1749, 1670, 1670, - /* 90 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 100 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1747, 1921, 2139, - /* 110 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 120 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 130 */ 1670, 1670, 1670, 2151, 1670, 1670, 1670, 2151, 2151, 2151, - /* 140 */ 1747, 2111, 2111, 1670, 1670, 1670, 1670, 1749, 1984, 1670, - /* 150 */ 1670, 1670, 1670, 1670, 1670, 1856, 1670, 1670, 1670, 1670, - /* 160 */ 1670, 1880, 1670, 1670, 1670, 1974, 1670, 1670, 2176, 2232, - /* 170 */ 1670, 1670, 2179, 1670, 1670, 1670, 1933, 1670, 1809, 2166, - /* 180 */ 2143, 2157, 2216, 2144, 2141, 2160, 1670, 2170, 1670, 1967, - /* 190 */ 1926, 1670, 1926, 1923, 1670, 1670, 1926, 1923, 1923, 1670, - /* 200 */ 1800, 1670, 1670, 1670, 1670, 1670, 1670, 1749, 1670, 1749, - /* 210 */ 1670, 1670, 1749, 1670, 1749, 1749, 1749, 1670, 1749, 1727, - /* 220 */ 1727, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 230 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1996, 1982, - /* 240 */ 1670, 1747, 1978, 1976, 1670, 1747, 1670, 1670, 1670, 1670, - /* 250 */ 2187, 2185, 1670, 2187, 2185, 1670, 1670, 1670, 2201, 2197, - /* 260 */ 2187, 2205, 2203, 2172, 2170, 2235, 2222, 2218, 2157, 1670, - /* 270 */ 1670, 1670, 1670, 1747, 1747, 1670, 2185, 1670, 1670, 1670, - /* 280 */ 1670, 1670, 2185, 1670, 1670, 1747, 1670, 1747, 1670, 1670, - /* 290 */ 1825, 1670, 1670, 1670, 1747, 1702, 1670, 1969, 1987, 1951, - /* 300 */ 1951, 1859, 1859, 1859, 1750, 1675, 1670, 1670, 1670, 1670, - /* 310 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 2200, 2199, - /* 320 */ 2066, 1670, 2115, 2114, 2113, 2104, 2065, 1821, 1670, 2064, - /* 330 */ 2063, 1670, 1670, 1670, 1670, 1670, 1670, 1942, 1941, 2057, - /* 340 */ 1670, 1670, 2058, 2056, 2055, 1670, 1670, 1670, 1670, 1670, - /* 350 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 360 */ 1670, 1670, 1670, 1670, 1670, 1670, 2219, 2223, 1670, 1670, - /* 370 */ 1670, 1670, 1670, 1670, 1670, 2140, 1670, 1670, 1670, 1670, - /* 380 */ 1670, 2039, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 390 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 400 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 410 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 420 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 430 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 440 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 450 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 460 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 470 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 480 */ 1670, 1670, 1670, 1670, 1707, 2044, 1670, 1670, 1670, 1670, - /* 490 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 500 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 510 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 520 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 530 */ 1670, 1670, 1788, 1787, 1670, 1670, 1670, 1670, 1670, 1670, - /* 540 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 550 */ 1670, 1670, 1670, 1670, 1670, 1670, 2048, 1670, 1670, 1670, - /* 560 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 570 */ 1670, 1670, 2215, 2173, 1670, 1670, 1670, 1670, 1670, 1670, - /* 580 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 590 */ 1670, 1670, 2039, 1670, 2198, 1670, 1670, 2213, 1670, 2217, - /* 600 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 2150, 2146, 1670, - /* 610 */ 1670, 2142, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 2047, - /* 620 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 630 */ 1670, 1670, 1670, 2038, 1670, 2101, 1670, 1670, 1670, 2135, - /* 640 */ 1670, 1670, 2086, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 650 */ 1670, 1670, 2048, 1670, 2051, 1670, 1670, 1670, 1670, 1670, - /* 660 */ 1853, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 670 */ 1670, 1670, 1670, 1838, 1836, 1835, 1834, 1670, 1831, 1670, - /* 680 */ 1866, 1670, 1670, 1670, 1862, 1861, 1670, 1670, 1670, 1670, - /* 690 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 700 */ 1670, 1768, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 710 */ 1760, 1670, 1759, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 720 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 730 */ 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, 1670, - /* 740 */ 1670, 1670, 1670, 1670, 1670, + /* 0 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 10 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 20 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 30 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 40 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 50 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 60 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 70 */ 1692, 1692, 1692, 1958, 1692, 1692, 1692, 1692, 1692, 1692, + /* 80 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1771, 1692, 1692, + /* 90 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 100 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1769, 1951, 2169, + /* 110 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 120 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 130 */ 1692, 1692, 1692, 2181, 1692, 1692, 1692, 2181, 2181, 2181, + /* 140 */ 1769, 2141, 2141, 1692, 1692, 1692, 1692, 1771, 2014, 1692, + /* 150 */ 1692, 1692, 1692, 1692, 1692, 1886, 1692, 1692, 1692, 1692, + /* 160 */ 1692, 1910, 1692, 1692, 1692, 2004, 1692, 1692, 2206, 2262, + /* 170 */ 1692, 1692, 2209, 1692, 1692, 1692, 1963, 1692, 1839, 2196, + /* 180 */ 2173, 2187, 2246, 2174, 2171, 2190, 1692, 2200, 1692, 1997, + /* 190 */ 1956, 1692, 1956, 1953, 1692, 1692, 1956, 1953, 1953, 1828, + /* 200 */ 1824, 1692, 1822, 1692, 1692, 1692, 1692, 1692, 1692, 1771, + /* 210 */ 1692, 1771, 1692, 1692, 1771, 1692, 1771, 1771, 1771, 1692, + /* 220 */ 1771, 1749, 1749, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 230 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 240 */ 2026, 2012, 1692, 1769, 2008, 2006, 1692, 1769, 1692, 1692, + /* 250 */ 1692, 1692, 2217, 2215, 1692, 2217, 2215, 1692, 1692, 1692, + /* 260 */ 2231, 2227, 2217, 2235, 2233, 2202, 2200, 2265, 2252, 2248, + /* 270 */ 2187, 1692, 1692, 1692, 1692, 1769, 1769, 1692, 2215, 1692, + /* 280 */ 1692, 1692, 1692, 1692, 2215, 1692, 1692, 1769, 1692, 1769, + /* 290 */ 1692, 1692, 1855, 1692, 1692, 1692, 1769, 1724, 1692, 1999, + /* 300 */ 2017, 1981, 1981, 1889, 1889, 1889, 1772, 1697, 1692, 1692, + /* 310 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 320 */ 2230, 2229, 2096, 1692, 2145, 2144, 2143, 2134, 2095, 1851, + /* 330 */ 1692, 2094, 2093, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 340 */ 1692, 1972, 1971, 2087, 1692, 1692, 2088, 2086, 2085, 1692, + /* 350 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 360 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 370 */ 2249, 2253, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 2170, + /* 380 */ 1692, 1692, 1692, 1692, 1692, 2069, 1692, 1692, 1692, 1692, + /* 390 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 400 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 410 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 420 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 430 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 440 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 450 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 460 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 470 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 480 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 490 */ 1692, 1692, 1729, 2074, 1692, 1692, 1692, 1692, 1692, 1692, + /* 500 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 510 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 520 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 530 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 540 */ 1810, 1809, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 550 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 560 */ 1692, 1692, 1692, 1692, 2078, 1692, 1692, 1692, 1692, 1692, + /* 570 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 580 */ 2245, 2203, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 590 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 600 */ 2069, 1692, 2228, 1692, 1692, 2243, 1692, 2247, 1692, 1692, + /* 610 */ 1692, 1692, 1692, 1692, 1692, 2180, 2176, 1692, 1692, 2172, + /* 620 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 2077, 1692, 1692, + /* 630 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 640 */ 1692, 2068, 1692, 2131, 1692, 1692, 1692, 2165, 1692, 1692, + /* 650 */ 2116, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 660 */ 2078, 1692, 2081, 1692, 1692, 1692, 1692, 1692, 1883, 1692, + /* 670 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 680 */ 1692, 1868, 1866, 1865, 1864, 1692, 1861, 1692, 1896, 1692, + /* 690 */ 1692, 1692, 1892, 1891, 1692, 1692, 1692, 1692, 1692, 1692, + /* 700 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1790, + /* 710 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1782, 1692, + /* 720 */ 1781, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 730 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 740 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, + /* 750 */ 1692, 1692, 1692, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1145,6 +1097,10 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLE_SUFFIX => nothing */ 0, /* NK_COLON => nothing */ 0, /* MAX_SPEED => nothing */ + 0, /* START => nothing */ + 0, /* WITH => nothing */ + 0, /* TIMESTAMP => nothing */ + 277, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1168,7 +1124,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* FLOAT => nothing */ 0, /* DOUBLE => nothing */ 0, /* BINARY => nothing */ - 0, /* TIMESTAMP => nothing */ 0, /* NCHAR => nothing */ 0, /* UNSIGNED => nothing */ 0, /* JSON => nothing */ @@ -1222,7 +1177,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ 0, /* TOPIC => nothing */ - 0, /* WITH => nothing */ 0, /* META => nothing */ 0, /* CONSUMER => nothing */ 0, /* GROUP => nothing */ @@ -1282,7 +1236,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* SERVER_STATUS => nothing */ 0, /* CURRENT_USER => nothing */ 0, /* CASE => nothing */ - 277, /* END => ABORT */ 0, /* WHEN => nothing */ 0, /* THEN => nothing */ 0, /* ELSE => nothing */ @@ -1307,7 +1260,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* SESSION => nothing */ 0, /* STATE_WINDOW => nothing */ 0, /* EVENT_WINDOW => nothing */ - 0, /* START => nothing */ 0, /* SLIDING => nothing */ 0, /* FILL => nothing */ 0, /* VALUE => nothing */ @@ -1561,169 +1513,169 @@ static const char *const yyTokenName[] = { /* 92 */ "TABLE_SUFFIX", /* 93 */ "NK_COLON", /* 94 */ "MAX_SPEED", - /* 95 */ "TABLE", - /* 96 */ "NK_LP", - /* 97 */ "NK_RP", - /* 98 */ "STABLE", - /* 99 */ "ADD", - /* 100 */ "COLUMN", - /* 101 */ "MODIFY", - /* 102 */ "RENAME", - /* 103 */ "TAG", - /* 104 */ "SET", - /* 105 */ "NK_EQ", - /* 106 */ "USING", - /* 107 */ "TAGS", - /* 108 */ "COMMENT", - /* 109 */ "BOOL", - /* 110 */ "TINYINT", - /* 111 */ "SMALLINT", - /* 112 */ "INT", - /* 113 */ "INTEGER", - /* 114 */ "BIGINT", - /* 115 */ "FLOAT", - /* 116 */ "DOUBLE", - /* 117 */ "BINARY", - /* 118 */ "TIMESTAMP", - /* 119 */ "NCHAR", - /* 120 */ "UNSIGNED", - /* 121 */ "JSON", - /* 122 */ "VARCHAR", - /* 123 */ "MEDIUMBLOB", - /* 124 */ "BLOB", - /* 125 */ "VARBINARY", - /* 126 */ "DECIMAL", - /* 127 */ "MAX_DELAY", - /* 128 */ "WATERMARK", - /* 129 */ "ROLLUP", - /* 130 */ "TTL", - /* 131 */ "SMA", - /* 132 */ "DELETE_MARK", - /* 133 */ "FIRST", - /* 134 */ "LAST", - /* 135 */ "SHOW", - /* 136 */ "PRIVILEGES", - /* 137 */ "DATABASES", - /* 138 */ "TABLES", - /* 139 */ "STABLES", - /* 140 */ "MNODES", - /* 141 */ "QNODES", - /* 142 */ "FUNCTIONS", - /* 143 */ "INDEXES", - /* 144 */ "ACCOUNTS", - /* 145 */ "APPS", - /* 146 */ "CONNECTIONS", - /* 147 */ "LICENCES", - /* 148 */ "GRANTS", - /* 149 */ "QUERIES", - /* 150 */ "SCORES", - /* 151 */ "TOPICS", - /* 152 */ "VARIABLES", - /* 153 */ "CLUSTER", - /* 154 */ "BNODES", - /* 155 */ "SNODES", - /* 156 */ "TRANSACTIONS", - /* 157 */ "DISTRIBUTED", - /* 158 */ "CONSUMERS", - /* 159 */ "SUBSCRIPTIONS", - /* 160 */ "VNODES", - /* 161 */ "ALIVE", - /* 162 */ "LIKE", - /* 163 */ "TBNAME", - /* 164 */ "QTAGS", - /* 165 */ "AS", - /* 166 */ "INDEX", - /* 167 */ "FUNCTION", - /* 168 */ "INTERVAL", - /* 169 */ "COUNT", - /* 170 */ "LAST_ROW", - /* 171 */ "TOPIC", - /* 172 */ "WITH", - /* 173 */ "META", - /* 174 */ "CONSUMER", - /* 175 */ "GROUP", - /* 176 */ "DESC", - /* 177 */ "DESCRIBE", - /* 178 */ "RESET", - /* 179 */ "QUERY", - /* 180 */ "CACHE", - /* 181 */ "EXPLAIN", - /* 182 */ "ANALYZE", - /* 183 */ "VERBOSE", - /* 184 */ "NK_BOOL", - /* 185 */ "RATIO", - /* 186 */ "NK_FLOAT", - /* 187 */ "OUTPUTTYPE", - /* 188 */ "AGGREGATE", - /* 189 */ "BUFSIZE", - /* 190 */ "LANGUAGE", - /* 191 */ "STREAM", - /* 192 */ "INTO", - /* 193 */ "TRIGGER", - /* 194 */ "AT_ONCE", - /* 195 */ "WINDOW_CLOSE", - /* 196 */ "IGNORE", - /* 197 */ "EXPIRED", - /* 198 */ "FILL_HISTORY", - /* 199 */ "UPDATE", - /* 200 */ "SUBTABLE", - /* 201 */ "KILL", - /* 202 */ "CONNECTION", - /* 203 */ "TRANSACTION", - /* 204 */ "BALANCE", - /* 205 */ "VGROUP", - /* 206 */ "MERGE", - /* 207 */ "REDISTRIBUTE", - /* 208 */ "SPLIT", - /* 209 */ "DELETE", - /* 210 */ "INSERT", - /* 211 */ "NULL", - /* 212 */ "NK_QUESTION", - /* 213 */ "NK_ARROW", - /* 214 */ "ROWTS", - /* 215 */ "QSTART", - /* 216 */ "QEND", - /* 217 */ "QDURATION", - /* 218 */ "WSTART", - /* 219 */ "WEND", - /* 220 */ "WDURATION", - /* 221 */ "IROWTS", - /* 222 */ "ISFILLED", - /* 223 */ "CAST", - /* 224 */ "NOW", - /* 225 */ "TODAY", - /* 226 */ "TIMEZONE", - /* 227 */ "CLIENT_VERSION", - /* 228 */ "SERVER_VERSION", - /* 229 */ "SERVER_STATUS", - /* 230 */ "CURRENT_USER", - /* 231 */ "CASE", - /* 232 */ "END", - /* 233 */ "WHEN", - /* 234 */ "THEN", - /* 235 */ "ELSE", - /* 236 */ "BETWEEN", - /* 237 */ "IS", - /* 238 */ "NK_LT", - /* 239 */ "NK_GT", - /* 240 */ "NK_LE", - /* 241 */ "NK_GE", - /* 242 */ "NK_NE", - /* 243 */ "MATCH", - /* 244 */ "NMATCH", - /* 245 */ "CONTAINS", - /* 246 */ "IN", - /* 247 */ "JOIN", - /* 248 */ "INNER", - /* 249 */ "SELECT", - /* 250 */ "DISTINCT", - /* 251 */ "WHERE", - /* 252 */ "PARTITION", - /* 253 */ "BY", - /* 254 */ "SESSION", - /* 255 */ "STATE_WINDOW", - /* 256 */ "EVENT_WINDOW", - /* 257 */ "START", + /* 95 */ "START", + /* 96 */ "WITH", + /* 97 */ "TIMESTAMP", + /* 98 */ "END", + /* 99 */ "TABLE", + /* 100 */ "NK_LP", + /* 101 */ "NK_RP", + /* 102 */ "STABLE", + /* 103 */ "ADD", + /* 104 */ "COLUMN", + /* 105 */ "MODIFY", + /* 106 */ "RENAME", + /* 107 */ "TAG", + /* 108 */ "SET", + /* 109 */ "NK_EQ", + /* 110 */ "USING", + /* 111 */ "TAGS", + /* 112 */ "COMMENT", + /* 113 */ "BOOL", + /* 114 */ "TINYINT", + /* 115 */ "SMALLINT", + /* 116 */ "INT", + /* 117 */ "INTEGER", + /* 118 */ "BIGINT", + /* 119 */ "FLOAT", + /* 120 */ "DOUBLE", + /* 121 */ "BINARY", + /* 122 */ "NCHAR", + /* 123 */ "UNSIGNED", + /* 124 */ "JSON", + /* 125 */ "VARCHAR", + /* 126 */ "MEDIUMBLOB", + /* 127 */ "BLOB", + /* 128 */ "VARBINARY", + /* 129 */ "DECIMAL", + /* 130 */ "MAX_DELAY", + /* 131 */ "WATERMARK", + /* 132 */ "ROLLUP", + /* 133 */ "TTL", + /* 134 */ "SMA", + /* 135 */ "DELETE_MARK", + /* 136 */ "FIRST", + /* 137 */ "LAST", + /* 138 */ "SHOW", + /* 139 */ "PRIVILEGES", + /* 140 */ "DATABASES", + /* 141 */ "TABLES", + /* 142 */ "STABLES", + /* 143 */ "MNODES", + /* 144 */ "QNODES", + /* 145 */ "FUNCTIONS", + /* 146 */ "INDEXES", + /* 147 */ "ACCOUNTS", + /* 148 */ "APPS", + /* 149 */ "CONNECTIONS", + /* 150 */ "LICENCES", + /* 151 */ "GRANTS", + /* 152 */ "QUERIES", + /* 153 */ "SCORES", + /* 154 */ "TOPICS", + /* 155 */ "VARIABLES", + /* 156 */ "CLUSTER", + /* 157 */ "BNODES", + /* 158 */ "SNODES", + /* 159 */ "TRANSACTIONS", + /* 160 */ "DISTRIBUTED", + /* 161 */ "CONSUMERS", + /* 162 */ "SUBSCRIPTIONS", + /* 163 */ "VNODES", + /* 164 */ "ALIVE", + /* 165 */ "LIKE", + /* 166 */ "TBNAME", + /* 167 */ "QTAGS", + /* 168 */ "AS", + /* 169 */ "INDEX", + /* 170 */ "FUNCTION", + /* 171 */ "INTERVAL", + /* 172 */ "COUNT", + /* 173 */ "LAST_ROW", + /* 174 */ "TOPIC", + /* 175 */ "META", + /* 176 */ "CONSUMER", + /* 177 */ "GROUP", + /* 178 */ "DESC", + /* 179 */ "DESCRIBE", + /* 180 */ "RESET", + /* 181 */ "QUERY", + /* 182 */ "CACHE", + /* 183 */ "EXPLAIN", + /* 184 */ "ANALYZE", + /* 185 */ "VERBOSE", + /* 186 */ "NK_BOOL", + /* 187 */ "RATIO", + /* 188 */ "NK_FLOAT", + /* 189 */ "OUTPUTTYPE", + /* 190 */ "AGGREGATE", + /* 191 */ "BUFSIZE", + /* 192 */ "LANGUAGE", + /* 193 */ "STREAM", + /* 194 */ "INTO", + /* 195 */ "TRIGGER", + /* 196 */ "AT_ONCE", + /* 197 */ "WINDOW_CLOSE", + /* 198 */ "IGNORE", + /* 199 */ "EXPIRED", + /* 200 */ "FILL_HISTORY", + /* 201 */ "UPDATE", + /* 202 */ "SUBTABLE", + /* 203 */ "KILL", + /* 204 */ "CONNECTION", + /* 205 */ "TRANSACTION", + /* 206 */ "BALANCE", + /* 207 */ "VGROUP", + /* 208 */ "MERGE", + /* 209 */ "REDISTRIBUTE", + /* 210 */ "SPLIT", + /* 211 */ "DELETE", + /* 212 */ "INSERT", + /* 213 */ "NULL", + /* 214 */ "NK_QUESTION", + /* 215 */ "NK_ARROW", + /* 216 */ "ROWTS", + /* 217 */ "QSTART", + /* 218 */ "QEND", + /* 219 */ "QDURATION", + /* 220 */ "WSTART", + /* 221 */ "WEND", + /* 222 */ "WDURATION", + /* 223 */ "IROWTS", + /* 224 */ "ISFILLED", + /* 225 */ "CAST", + /* 226 */ "NOW", + /* 227 */ "TODAY", + /* 228 */ "TIMEZONE", + /* 229 */ "CLIENT_VERSION", + /* 230 */ "SERVER_VERSION", + /* 231 */ "SERVER_STATUS", + /* 232 */ "CURRENT_USER", + /* 233 */ "CASE", + /* 234 */ "WHEN", + /* 235 */ "THEN", + /* 236 */ "ELSE", + /* 237 */ "BETWEEN", + /* 238 */ "IS", + /* 239 */ "NK_LT", + /* 240 */ "NK_GT", + /* 241 */ "NK_LE", + /* 242 */ "NK_GE", + /* 243 */ "NK_NE", + /* 244 */ "MATCH", + /* 245 */ "NMATCH", + /* 246 */ "CONTAINS", + /* 247 */ "IN", + /* 248 */ "JOIN", + /* 249 */ "INNER", + /* 250 */ "SELECT", + /* 251 */ "DISTINCT", + /* 252 */ "WHERE", + /* 253 */ "PARTITION", + /* 254 */ "BY", + /* 255 */ "SESSION", + /* 256 */ "STATE_WINDOW", + /* 257 */ "EVENT_WINDOW", /* 258 */ "SLIDING", /* 259 */ "FILL", /* 260 */ "VALUE", @@ -1815,128 +1767,130 @@ static const char *const yyTokenName[] = { /* 346 */ "exists_opt", /* 347 */ "alter_db_options", /* 348 */ "speed_opt", - /* 349 */ "integer_list", - /* 350 */ "variable_list", - /* 351 */ "retention_list", - /* 352 */ "alter_db_option", - /* 353 */ "retention", - /* 354 */ "full_table_name", - /* 355 */ "column_def_list", - /* 356 */ "tags_def_opt", - /* 357 */ "table_options", - /* 358 */ "multi_create_clause", - /* 359 */ "tags_def", - /* 360 */ "multi_drop_clause", - /* 361 */ "alter_table_clause", - /* 362 */ "alter_table_options", - /* 363 */ "column_name", - /* 364 */ "type_name", - /* 365 */ "signed_literal", - /* 366 */ "create_subtable_clause", - /* 367 */ "specific_cols_opt", - /* 368 */ "expression_list", - /* 369 */ "drop_table_clause", - /* 370 */ "col_name_list", - /* 371 */ "table_name", - /* 372 */ "column_def", - /* 373 */ "duration_list", - /* 374 */ "rollup_func_list", - /* 375 */ "alter_table_option", - /* 376 */ "duration_literal", - /* 377 */ "rollup_func_name", - /* 378 */ "function_name", - /* 379 */ "col_name", - /* 380 */ "db_name_cond_opt", - /* 381 */ "like_pattern_opt", - /* 382 */ "table_name_cond", - /* 383 */ "from_db_opt", - /* 384 */ "tag_list_opt", - /* 385 */ "tag_item", - /* 386 */ "column_alias", - /* 387 */ "full_index_name", - /* 388 */ "index_options", - /* 389 */ "index_name", - /* 390 */ "func_list", - /* 391 */ "sliding_opt", - /* 392 */ "sma_stream_opt", - /* 393 */ "func", - /* 394 */ "sma_func_name", - /* 395 */ "query_or_subquery", - /* 396 */ "cgroup_name", - /* 397 */ "analyze_opt", - /* 398 */ "explain_options", - /* 399 */ "insert_query", - /* 400 */ "agg_func_opt", - /* 401 */ "bufsize_opt", - /* 402 */ "language_opt", - /* 403 */ "stream_name", - /* 404 */ "stream_options", - /* 405 */ "col_list_opt", - /* 406 */ "tag_def_or_ref_opt", - /* 407 */ "subtable_opt", - /* 408 */ "expression", - /* 409 */ "dnode_list", - /* 410 */ "where_clause_opt", - /* 411 */ "signed", - /* 412 */ "literal_func", - /* 413 */ "literal_list", - /* 414 */ "table_alias", - /* 415 */ "expr_or_subquery", - /* 416 */ "pseudo_column", - /* 417 */ "column_reference", - /* 418 */ "function_expression", - /* 419 */ "case_when_expression", - /* 420 */ "star_func", - /* 421 */ "star_func_para_list", - /* 422 */ "noarg_func", - /* 423 */ "other_para_list", - /* 424 */ "star_func_para", - /* 425 */ "when_then_list", - /* 426 */ "case_when_else_opt", - /* 427 */ "common_expression", - /* 428 */ "when_then_expr", - /* 429 */ "predicate", - /* 430 */ "compare_op", - /* 431 */ "in_op", - /* 432 */ "in_predicate_value", - /* 433 */ "boolean_value_expression", - /* 434 */ "boolean_primary", - /* 435 */ "from_clause_opt", - /* 436 */ "table_reference_list", - /* 437 */ "table_reference", - /* 438 */ "table_primary", - /* 439 */ "joined_table", - /* 440 */ "alias_opt", - /* 441 */ "subquery", - /* 442 */ "parenthesized_joined_table", - /* 443 */ "join_type", - /* 444 */ "search_condition", - /* 445 */ "query_specification", - /* 446 */ "set_quantifier_opt", - /* 447 */ "select_list", - /* 448 */ "partition_by_clause_opt", - /* 449 */ "range_opt", - /* 450 */ "every_opt", - /* 451 */ "fill_opt", - /* 452 */ "twindow_clause_opt", - /* 453 */ "group_by_clause_opt", - /* 454 */ "having_clause_opt", - /* 455 */ "select_item", - /* 456 */ "partition_list", - /* 457 */ "partition_item", - /* 458 */ "fill_mode", - /* 459 */ "group_by_list", - /* 460 */ "query_expression", - /* 461 */ "query_simple", - /* 462 */ "order_by_clause_opt", - /* 463 */ "slimit_clause_opt", - /* 464 */ "limit_clause_opt", - /* 465 */ "union_query_expression", - /* 466 */ "query_simple_or_subquery", - /* 467 */ "sort_specification_list", - /* 468 */ "sort_specification", - /* 469 */ "ordering_specification_opt", - /* 470 */ "null_ordering_opt", + /* 349 */ "start_opt", + /* 350 */ "end_opt", + /* 351 */ "integer_list", + /* 352 */ "variable_list", + /* 353 */ "retention_list", + /* 354 */ "alter_db_option", + /* 355 */ "retention", + /* 356 */ "full_table_name", + /* 357 */ "column_def_list", + /* 358 */ "tags_def_opt", + /* 359 */ "table_options", + /* 360 */ "multi_create_clause", + /* 361 */ "tags_def", + /* 362 */ "multi_drop_clause", + /* 363 */ "alter_table_clause", + /* 364 */ "alter_table_options", + /* 365 */ "column_name", + /* 366 */ "type_name", + /* 367 */ "signed_literal", + /* 368 */ "create_subtable_clause", + /* 369 */ "specific_cols_opt", + /* 370 */ "expression_list", + /* 371 */ "drop_table_clause", + /* 372 */ "col_name_list", + /* 373 */ "table_name", + /* 374 */ "column_def", + /* 375 */ "duration_list", + /* 376 */ "rollup_func_list", + /* 377 */ "alter_table_option", + /* 378 */ "duration_literal", + /* 379 */ "rollup_func_name", + /* 380 */ "function_name", + /* 381 */ "col_name", + /* 382 */ "db_name_cond_opt", + /* 383 */ "like_pattern_opt", + /* 384 */ "table_name_cond", + /* 385 */ "from_db_opt", + /* 386 */ "tag_list_opt", + /* 387 */ "tag_item", + /* 388 */ "column_alias", + /* 389 */ "full_index_name", + /* 390 */ "index_options", + /* 391 */ "index_name", + /* 392 */ "func_list", + /* 393 */ "sliding_opt", + /* 394 */ "sma_stream_opt", + /* 395 */ "func", + /* 396 */ "sma_func_name", + /* 397 */ "query_or_subquery", + /* 398 */ "cgroup_name", + /* 399 */ "analyze_opt", + /* 400 */ "explain_options", + /* 401 */ "insert_query", + /* 402 */ "agg_func_opt", + /* 403 */ "bufsize_opt", + /* 404 */ "language_opt", + /* 405 */ "stream_name", + /* 406 */ "stream_options", + /* 407 */ "col_list_opt", + /* 408 */ "tag_def_or_ref_opt", + /* 409 */ "subtable_opt", + /* 410 */ "expression", + /* 411 */ "dnode_list", + /* 412 */ "where_clause_opt", + /* 413 */ "signed", + /* 414 */ "literal_func", + /* 415 */ "literal_list", + /* 416 */ "table_alias", + /* 417 */ "expr_or_subquery", + /* 418 */ "pseudo_column", + /* 419 */ "column_reference", + /* 420 */ "function_expression", + /* 421 */ "case_when_expression", + /* 422 */ "star_func", + /* 423 */ "star_func_para_list", + /* 424 */ "noarg_func", + /* 425 */ "other_para_list", + /* 426 */ "star_func_para", + /* 427 */ "when_then_list", + /* 428 */ "case_when_else_opt", + /* 429 */ "common_expression", + /* 430 */ "when_then_expr", + /* 431 */ "predicate", + /* 432 */ "compare_op", + /* 433 */ "in_op", + /* 434 */ "in_predicate_value", + /* 435 */ "boolean_value_expression", + /* 436 */ "boolean_primary", + /* 437 */ "from_clause_opt", + /* 438 */ "table_reference_list", + /* 439 */ "table_reference", + /* 440 */ "table_primary", + /* 441 */ "joined_table", + /* 442 */ "alias_opt", + /* 443 */ "subquery", + /* 444 */ "parenthesized_joined_table", + /* 445 */ "join_type", + /* 446 */ "search_condition", + /* 447 */ "query_specification", + /* 448 */ "set_quantifier_opt", + /* 449 */ "select_list", + /* 450 */ "partition_by_clause_opt", + /* 451 */ "range_opt", + /* 452 */ "every_opt", + /* 453 */ "fill_opt", + /* 454 */ "twindow_clause_opt", + /* 455 */ "group_by_clause_opt", + /* 456 */ "having_clause_opt", + /* 457 */ "select_item", + /* 458 */ "partition_list", + /* 459 */ "partition_item", + /* 460 */ "fill_mode", + /* 461 */ "group_by_list", + /* 462 */ "query_expression", + /* 463 */ "query_simple", + /* 464 */ "order_by_clause_opt", + /* 465 */ "slimit_clause_opt", + /* 466 */ "limit_clause_opt", + /* 467 */ "union_query_expression", + /* 468 */ "query_simple_or_subquery", + /* 469 */ "sort_specification_list", + /* 470 */ "sort_specification", + /* 471 */ "ordering_specification_opt", + /* 472 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2016,7 +1970,7 @@ static const char *const yyRuleName[] = { /* 69 */ "cmd ::= ALTER DATABASE db_name alter_db_options", /* 70 */ "cmd ::= FLUSH DATABASE db_name", /* 71 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 72 */ "cmd ::= COMPACT DATABASE db_name", + /* 72 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", /* 73 */ "not_exists_opt ::= IF NOT EXISTS", /* 74 */ "not_exists_opt ::=", /* 75 */ "exists_opt ::= IF EXISTS", @@ -2073,442 +2027,450 @@ static const char *const yyRuleName[] = { /* 126 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", /* 127 */ "speed_opt ::=", /* 128 */ "speed_opt ::= MAX_SPEED NK_INTEGER", - /* 129 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 130 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 131 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 132 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 133 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 134 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 135 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 136 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 137 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 138 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 139 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 140 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 141 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 142 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 143 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 144 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 145 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 146 */ "multi_create_clause ::= create_subtable_clause", - /* 147 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 148 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", - /* 149 */ "multi_drop_clause ::= drop_table_clause", - /* 150 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 151 */ "drop_table_clause ::= exists_opt full_table_name", - /* 152 */ "specific_cols_opt ::=", - /* 153 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 154 */ "full_table_name ::= table_name", - /* 155 */ "full_table_name ::= db_name NK_DOT table_name", - /* 156 */ "column_def_list ::= column_def", - /* 157 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 158 */ "column_def ::= column_name type_name", - /* 159 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 160 */ "type_name ::= BOOL", - /* 161 */ "type_name ::= TINYINT", - /* 162 */ "type_name ::= SMALLINT", - /* 163 */ "type_name ::= INT", - /* 164 */ "type_name ::= INTEGER", - /* 165 */ "type_name ::= BIGINT", - /* 166 */ "type_name ::= FLOAT", - /* 167 */ "type_name ::= DOUBLE", - /* 168 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 169 */ "type_name ::= TIMESTAMP", - /* 170 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 171 */ "type_name ::= TINYINT UNSIGNED", - /* 172 */ "type_name ::= SMALLINT UNSIGNED", - /* 173 */ "type_name ::= INT UNSIGNED", - /* 174 */ "type_name ::= BIGINT UNSIGNED", - /* 175 */ "type_name ::= JSON", - /* 176 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 177 */ "type_name ::= MEDIUMBLOB", - /* 178 */ "type_name ::= BLOB", - /* 179 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 180 */ "type_name ::= DECIMAL", - /* 181 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 182 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 183 */ "tags_def_opt ::=", - /* 184 */ "tags_def_opt ::= tags_def", - /* 185 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 186 */ "table_options ::=", - /* 187 */ "table_options ::= table_options COMMENT NK_STRING", - /* 188 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 189 */ "table_options ::= table_options WATERMARK duration_list", - /* 190 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 191 */ "table_options ::= table_options TTL NK_INTEGER", - /* 192 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 193 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 194 */ "alter_table_options ::= alter_table_option", - /* 195 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 196 */ "alter_table_option ::= COMMENT NK_STRING", - /* 197 */ "alter_table_option ::= TTL NK_INTEGER", - /* 198 */ "duration_list ::= duration_literal", - /* 199 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 200 */ "rollup_func_list ::= rollup_func_name", - /* 201 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 202 */ "rollup_func_name ::= function_name", - /* 203 */ "rollup_func_name ::= FIRST", - /* 204 */ "rollup_func_name ::= LAST", - /* 205 */ "col_name_list ::= col_name", - /* 206 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 207 */ "col_name ::= column_name", - /* 208 */ "cmd ::= SHOW DNODES", - /* 209 */ "cmd ::= SHOW USERS", - /* 210 */ "cmd ::= SHOW USER PRIVILEGES", - /* 211 */ "cmd ::= SHOW DATABASES", - /* 212 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 213 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 214 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 215 */ "cmd ::= SHOW MNODES", - /* 216 */ "cmd ::= SHOW QNODES", - /* 217 */ "cmd ::= SHOW FUNCTIONS", - /* 218 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 219 */ "cmd ::= SHOW STREAMS", - /* 220 */ "cmd ::= SHOW ACCOUNTS", - /* 221 */ "cmd ::= SHOW APPS", - /* 222 */ "cmd ::= SHOW CONNECTIONS", - /* 223 */ "cmd ::= SHOW LICENCES", - /* 224 */ "cmd ::= SHOW GRANTS", - /* 225 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 226 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 227 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 228 */ "cmd ::= SHOW QUERIES", - /* 229 */ "cmd ::= SHOW SCORES", - /* 230 */ "cmd ::= SHOW TOPICS", - /* 231 */ "cmd ::= SHOW VARIABLES", - /* 232 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 233 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 234 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 235 */ "cmd ::= SHOW BNODES", - /* 236 */ "cmd ::= SHOW SNODES", - /* 237 */ "cmd ::= SHOW CLUSTER", - /* 238 */ "cmd ::= SHOW TRANSACTIONS", - /* 239 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 240 */ "cmd ::= SHOW CONSUMERS", - /* 241 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 242 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 243 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 244 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 245 */ "cmd ::= SHOW VNODES NK_STRING", - /* 246 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 247 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 248 */ "db_name_cond_opt ::=", - /* 249 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 250 */ "like_pattern_opt ::=", - /* 251 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 252 */ "table_name_cond ::= table_name", - /* 253 */ "from_db_opt ::=", - /* 254 */ "from_db_opt ::= FROM db_name", - /* 255 */ "tag_list_opt ::=", - /* 256 */ "tag_list_opt ::= tag_item", - /* 257 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 258 */ "tag_item ::= TBNAME", - /* 259 */ "tag_item ::= QTAGS", - /* 260 */ "tag_item ::= column_name", - /* 261 */ "tag_item ::= column_name column_alias", - /* 262 */ "tag_item ::= column_name AS column_alias", - /* 263 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 264 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 265 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 266 */ "full_index_name ::= index_name", - /* 267 */ "full_index_name ::= db_name NK_DOT index_name", - /* 268 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 269 */ "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", - /* 270 */ "func_list ::= func", - /* 271 */ "func_list ::= func_list NK_COMMA func", - /* 272 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 273 */ "sma_func_name ::= function_name", - /* 274 */ "sma_func_name ::= COUNT", - /* 275 */ "sma_func_name ::= FIRST", - /* 276 */ "sma_func_name ::= LAST", - /* 277 */ "sma_func_name ::= LAST_ROW", - /* 278 */ "sma_stream_opt ::=", - /* 279 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 280 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 281 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 282 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 283 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 284 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 285 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 286 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 287 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 288 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 289 */ "cmd ::= DESC full_table_name", - /* 290 */ "cmd ::= DESCRIBE full_table_name", - /* 291 */ "cmd ::= RESET QUERY CACHE", - /* 292 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 293 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 294 */ "analyze_opt ::=", - /* 295 */ "analyze_opt ::= ANALYZE", - /* 296 */ "explain_options ::=", - /* 297 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 298 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 299 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 300 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 301 */ "agg_func_opt ::=", - /* 302 */ "agg_func_opt ::= AGGREGATE", - /* 303 */ "bufsize_opt ::=", - /* 304 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 305 */ "language_opt ::=", - /* 306 */ "language_opt ::= LANGUAGE NK_STRING", - /* 307 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 308 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 309 */ "col_list_opt ::=", - /* 310 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 311 */ "tag_def_or_ref_opt ::=", - /* 312 */ "tag_def_or_ref_opt ::= tags_def", - /* 313 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 314 */ "stream_options ::=", - /* 315 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 316 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 317 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 318 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 319 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 320 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 321 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 322 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 323 */ "subtable_opt ::=", - /* 324 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 325 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 326 */ "cmd ::= KILL QUERY NK_STRING", - /* 327 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 328 */ "cmd ::= BALANCE VGROUP", - /* 329 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 330 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 331 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 332 */ "dnode_list ::= DNODE NK_INTEGER", - /* 333 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 334 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 335 */ "cmd ::= query_or_subquery", - /* 336 */ "cmd ::= insert_query", - /* 337 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 338 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 339 */ "literal ::= NK_INTEGER", - /* 340 */ "literal ::= NK_FLOAT", - /* 341 */ "literal ::= NK_STRING", - /* 342 */ "literal ::= NK_BOOL", - /* 343 */ "literal ::= TIMESTAMP NK_STRING", - /* 344 */ "literal ::= duration_literal", - /* 345 */ "literal ::= NULL", - /* 346 */ "literal ::= NK_QUESTION", - /* 347 */ "duration_literal ::= NK_VARIABLE", - /* 348 */ "signed ::= NK_INTEGER", - /* 349 */ "signed ::= NK_PLUS NK_INTEGER", - /* 350 */ "signed ::= NK_MINUS NK_INTEGER", - /* 351 */ "signed ::= NK_FLOAT", - /* 352 */ "signed ::= NK_PLUS NK_FLOAT", - /* 353 */ "signed ::= NK_MINUS NK_FLOAT", - /* 354 */ "signed_literal ::= signed", - /* 355 */ "signed_literal ::= NK_STRING", - /* 356 */ "signed_literal ::= NK_BOOL", - /* 357 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 358 */ "signed_literal ::= duration_literal", - /* 359 */ "signed_literal ::= NULL", - /* 360 */ "signed_literal ::= literal_func", - /* 361 */ "signed_literal ::= NK_QUESTION", - /* 362 */ "literal_list ::= signed_literal", - /* 363 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 364 */ "db_name ::= NK_ID", - /* 365 */ "table_name ::= NK_ID", - /* 366 */ "column_name ::= NK_ID", - /* 367 */ "function_name ::= NK_ID", - /* 368 */ "table_alias ::= NK_ID", - /* 369 */ "column_alias ::= NK_ID", - /* 370 */ "user_name ::= NK_ID", - /* 371 */ "topic_name ::= NK_ID", - /* 372 */ "stream_name ::= NK_ID", - /* 373 */ "cgroup_name ::= NK_ID", - /* 374 */ "index_name ::= NK_ID", - /* 375 */ "expr_or_subquery ::= expression", - /* 376 */ "expression ::= literal", - /* 377 */ "expression ::= pseudo_column", - /* 378 */ "expression ::= column_reference", - /* 379 */ "expression ::= function_expression", - /* 380 */ "expression ::= case_when_expression", - /* 381 */ "expression ::= NK_LP expression NK_RP", - /* 382 */ "expression ::= NK_PLUS expr_or_subquery", - /* 383 */ "expression ::= NK_MINUS expr_or_subquery", - /* 384 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 385 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 386 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 387 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 388 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 389 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 390 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 391 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 392 */ "expression_list ::= expr_or_subquery", - /* 393 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 394 */ "column_reference ::= column_name", - /* 395 */ "column_reference ::= table_name NK_DOT column_name", - /* 396 */ "pseudo_column ::= ROWTS", - /* 397 */ "pseudo_column ::= TBNAME", - /* 398 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 399 */ "pseudo_column ::= QSTART", - /* 400 */ "pseudo_column ::= QEND", - /* 401 */ "pseudo_column ::= QDURATION", - /* 402 */ "pseudo_column ::= WSTART", - /* 403 */ "pseudo_column ::= WEND", - /* 404 */ "pseudo_column ::= WDURATION", - /* 405 */ "pseudo_column ::= IROWTS", - /* 406 */ "pseudo_column ::= ISFILLED", - /* 407 */ "pseudo_column ::= QTAGS", - /* 408 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 409 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 410 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 411 */ "function_expression ::= literal_func", - /* 412 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 413 */ "literal_func ::= NOW", - /* 414 */ "noarg_func ::= NOW", - /* 415 */ "noarg_func ::= TODAY", - /* 416 */ "noarg_func ::= TIMEZONE", - /* 417 */ "noarg_func ::= DATABASE", - /* 418 */ "noarg_func ::= CLIENT_VERSION", - /* 419 */ "noarg_func ::= SERVER_VERSION", - /* 420 */ "noarg_func ::= SERVER_STATUS", - /* 421 */ "noarg_func ::= CURRENT_USER", - /* 422 */ "noarg_func ::= USER", - /* 423 */ "star_func ::= COUNT", - /* 424 */ "star_func ::= FIRST", - /* 425 */ "star_func ::= LAST", - /* 426 */ "star_func ::= LAST_ROW", - /* 427 */ "star_func_para_list ::= NK_STAR", - /* 428 */ "star_func_para_list ::= other_para_list", - /* 429 */ "other_para_list ::= star_func_para", - /* 430 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 431 */ "star_func_para ::= expr_or_subquery", - /* 432 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 433 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 434 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 435 */ "when_then_list ::= when_then_expr", - /* 436 */ "when_then_list ::= when_then_list when_then_expr", - /* 437 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 438 */ "case_when_else_opt ::=", - /* 439 */ "case_when_else_opt ::= ELSE common_expression", - /* 440 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 441 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 442 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 443 */ "predicate ::= expr_or_subquery IS NULL", - /* 444 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 445 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 446 */ "compare_op ::= NK_LT", - /* 447 */ "compare_op ::= NK_GT", - /* 448 */ "compare_op ::= NK_LE", - /* 449 */ "compare_op ::= NK_GE", - /* 450 */ "compare_op ::= NK_NE", - /* 451 */ "compare_op ::= NK_EQ", - /* 452 */ "compare_op ::= LIKE", - /* 453 */ "compare_op ::= NOT LIKE", - /* 454 */ "compare_op ::= MATCH", - /* 455 */ "compare_op ::= NMATCH", - /* 456 */ "compare_op ::= CONTAINS", - /* 457 */ "in_op ::= IN", - /* 458 */ "in_op ::= NOT IN", - /* 459 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 460 */ "boolean_value_expression ::= boolean_primary", - /* 461 */ "boolean_value_expression ::= NOT boolean_primary", - /* 462 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 463 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 464 */ "boolean_primary ::= predicate", - /* 465 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 466 */ "common_expression ::= expr_or_subquery", - /* 467 */ "common_expression ::= boolean_value_expression", - /* 468 */ "from_clause_opt ::=", - /* 469 */ "from_clause_opt ::= FROM table_reference_list", - /* 470 */ "table_reference_list ::= table_reference", - /* 471 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 472 */ "table_reference ::= table_primary", - /* 473 */ "table_reference ::= joined_table", - /* 474 */ "table_primary ::= table_name alias_opt", - /* 475 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 476 */ "table_primary ::= subquery alias_opt", - /* 477 */ "table_primary ::= parenthesized_joined_table", - /* 478 */ "alias_opt ::=", - /* 479 */ "alias_opt ::= table_alias", - /* 480 */ "alias_opt ::= AS table_alias", - /* 481 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 482 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 483 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 484 */ "join_type ::=", - /* 485 */ "join_type ::= INNER", - /* 486 */ "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", - /* 487 */ "set_quantifier_opt ::=", - /* 488 */ "set_quantifier_opt ::= DISTINCT", - /* 489 */ "set_quantifier_opt ::= ALL", - /* 490 */ "select_list ::= select_item", - /* 491 */ "select_list ::= select_list NK_COMMA select_item", - /* 492 */ "select_item ::= NK_STAR", - /* 493 */ "select_item ::= common_expression", - /* 494 */ "select_item ::= common_expression column_alias", - /* 495 */ "select_item ::= common_expression AS column_alias", - /* 496 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 497 */ "where_clause_opt ::=", - /* 498 */ "where_clause_opt ::= WHERE search_condition", - /* 499 */ "partition_by_clause_opt ::=", - /* 500 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 501 */ "partition_list ::= partition_item", - /* 502 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 503 */ "partition_item ::= expr_or_subquery", - /* 504 */ "partition_item ::= expr_or_subquery column_alias", - /* 505 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 506 */ "twindow_clause_opt ::=", - /* 507 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 508 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 509 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 510 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 511 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 512 */ "sliding_opt ::=", - /* 513 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 514 */ "fill_opt ::=", - /* 515 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 516 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 517 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", - /* 518 */ "fill_mode ::= NONE", - /* 519 */ "fill_mode ::= PREV", - /* 520 */ "fill_mode ::= NULL", - /* 521 */ "fill_mode ::= NULL_F", - /* 522 */ "fill_mode ::= LINEAR", - /* 523 */ "fill_mode ::= NEXT", - /* 524 */ "group_by_clause_opt ::=", - /* 525 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 526 */ "group_by_list ::= expr_or_subquery", - /* 527 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 528 */ "having_clause_opt ::=", - /* 529 */ "having_clause_opt ::= HAVING search_condition", - /* 530 */ "range_opt ::=", - /* 531 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 532 */ "every_opt ::=", - /* 533 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 534 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 535 */ "query_simple ::= query_specification", - /* 536 */ "query_simple ::= union_query_expression", - /* 537 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 538 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 539 */ "query_simple_or_subquery ::= query_simple", - /* 540 */ "query_simple_or_subquery ::= subquery", - /* 541 */ "query_or_subquery ::= query_expression", - /* 542 */ "query_or_subquery ::= subquery", - /* 543 */ "order_by_clause_opt ::=", - /* 544 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 545 */ "slimit_clause_opt ::=", - /* 546 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 547 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 548 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 549 */ "limit_clause_opt ::=", - /* 550 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 551 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 552 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 553 */ "subquery ::= NK_LP query_expression NK_RP", - /* 554 */ "subquery ::= NK_LP subquery NK_RP", - /* 555 */ "search_condition ::= common_expression", - /* 556 */ "sort_specification_list ::= sort_specification", - /* 557 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 558 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 559 */ "ordering_specification_opt ::=", - /* 560 */ "ordering_specification_opt ::= ASC", - /* 561 */ "ordering_specification_opt ::= DESC", - /* 562 */ "null_ordering_opt ::=", - /* 563 */ "null_ordering_opt ::= NULLS FIRST", - /* 564 */ "null_ordering_opt ::= NULLS LAST", + /* 129 */ "start_opt ::=", + /* 130 */ "start_opt ::= START WITH NK_INTEGER", + /* 131 */ "start_opt ::= START WITH NK_STRING", + /* 132 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 133 */ "end_opt ::=", + /* 134 */ "end_opt ::= END WITH NK_INTEGER", + /* 135 */ "end_opt ::= END WITH NK_STRING", + /* 136 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 137 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 138 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 139 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 140 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 141 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 142 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 143 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 144 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 145 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 146 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 147 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 148 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 149 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 150 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 151 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 152 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 153 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 154 */ "multi_create_clause ::= create_subtable_clause", + /* 155 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 156 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", + /* 157 */ "multi_drop_clause ::= drop_table_clause", + /* 158 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 159 */ "drop_table_clause ::= exists_opt full_table_name", + /* 160 */ "specific_cols_opt ::=", + /* 161 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 162 */ "full_table_name ::= table_name", + /* 163 */ "full_table_name ::= db_name NK_DOT table_name", + /* 164 */ "column_def_list ::= column_def", + /* 165 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 166 */ "column_def ::= column_name type_name", + /* 167 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 168 */ "type_name ::= BOOL", + /* 169 */ "type_name ::= TINYINT", + /* 170 */ "type_name ::= SMALLINT", + /* 171 */ "type_name ::= INT", + /* 172 */ "type_name ::= INTEGER", + /* 173 */ "type_name ::= BIGINT", + /* 174 */ "type_name ::= FLOAT", + /* 175 */ "type_name ::= DOUBLE", + /* 176 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 177 */ "type_name ::= TIMESTAMP", + /* 178 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 179 */ "type_name ::= TINYINT UNSIGNED", + /* 180 */ "type_name ::= SMALLINT UNSIGNED", + /* 181 */ "type_name ::= INT UNSIGNED", + /* 182 */ "type_name ::= BIGINT UNSIGNED", + /* 183 */ "type_name ::= JSON", + /* 184 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 185 */ "type_name ::= MEDIUMBLOB", + /* 186 */ "type_name ::= BLOB", + /* 187 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 188 */ "type_name ::= DECIMAL", + /* 189 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 190 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 191 */ "tags_def_opt ::=", + /* 192 */ "tags_def_opt ::= tags_def", + /* 193 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 194 */ "table_options ::=", + /* 195 */ "table_options ::= table_options COMMENT NK_STRING", + /* 196 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 197 */ "table_options ::= table_options WATERMARK duration_list", + /* 198 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 199 */ "table_options ::= table_options TTL NK_INTEGER", + /* 200 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 201 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 202 */ "alter_table_options ::= alter_table_option", + /* 203 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 204 */ "alter_table_option ::= COMMENT NK_STRING", + /* 205 */ "alter_table_option ::= TTL NK_INTEGER", + /* 206 */ "duration_list ::= duration_literal", + /* 207 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 208 */ "rollup_func_list ::= rollup_func_name", + /* 209 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 210 */ "rollup_func_name ::= function_name", + /* 211 */ "rollup_func_name ::= FIRST", + /* 212 */ "rollup_func_name ::= LAST", + /* 213 */ "col_name_list ::= col_name", + /* 214 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 215 */ "col_name ::= column_name", + /* 216 */ "cmd ::= SHOW DNODES", + /* 217 */ "cmd ::= SHOW USERS", + /* 218 */ "cmd ::= SHOW USER PRIVILEGES", + /* 219 */ "cmd ::= SHOW DATABASES", + /* 220 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 221 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 222 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 223 */ "cmd ::= SHOW MNODES", + /* 224 */ "cmd ::= SHOW QNODES", + /* 225 */ "cmd ::= SHOW FUNCTIONS", + /* 226 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 227 */ "cmd ::= SHOW STREAMS", + /* 228 */ "cmd ::= SHOW ACCOUNTS", + /* 229 */ "cmd ::= SHOW APPS", + /* 230 */ "cmd ::= SHOW CONNECTIONS", + /* 231 */ "cmd ::= SHOW LICENCES", + /* 232 */ "cmd ::= SHOW GRANTS", + /* 233 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 234 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 235 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 236 */ "cmd ::= SHOW QUERIES", + /* 237 */ "cmd ::= SHOW SCORES", + /* 238 */ "cmd ::= SHOW TOPICS", + /* 239 */ "cmd ::= SHOW VARIABLES", + /* 240 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 241 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 242 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 243 */ "cmd ::= SHOW BNODES", + /* 244 */ "cmd ::= SHOW SNODES", + /* 245 */ "cmd ::= SHOW CLUSTER", + /* 246 */ "cmd ::= SHOW TRANSACTIONS", + /* 247 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 248 */ "cmd ::= SHOW CONSUMERS", + /* 249 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 250 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 251 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 252 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 253 */ "cmd ::= SHOW VNODES NK_STRING", + /* 254 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 255 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 256 */ "db_name_cond_opt ::=", + /* 257 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 258 */ "like_pattern_opt ::=", + /* 259 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 260 */ "table_name_cond ::= table_name", + /* 261 */ "from_db_opt ::=", + /* 262 */ "from_db_opt ::= FROM db_name", + /* 263 */ "tag_list_opt ::=", + /* 264 */ "tag_list_opt ::= tag_item", + /* 265 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 266 */ "tag_item ::= TBNAME", + /* 267 */ "tag_item ::= QTAGS", + /* 268 */ "tag_item ::= column_name", + /* 269 */ "tag_item ::= column_name column_alias", + /* 270 */ "tag_item ::= column_name AS column_alias", + /* 271 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 272 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 273 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 274 */ "full_index_name ::= index_name", + /* 275 */ "full_index_name ::= db_name NK_DOT index_name", + /* 276 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 277 */ "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", + /* 278 */ "func_list ::= func", + /* 279 */ "func_list ::= func_list NK_COMMA func", + /* 280 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 281 */ "sma_func_name ::= function_name", + /* 282 */ "sma_func_name ::= COUNT", + /* 283 */ "sma_func_name ::= FIRST", + /* 284 */ "sma_func_name ::= LAST", + /* 285 */ "sma_func_name ::= LAST_ROW", + /* 286 */ "sma_stream_opt ::=", + /* 287 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 288 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 289 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 290 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 291 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 292 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 293 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 294 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 295 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 296 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 297 */ "cmd ::= DESC full_table_name", + /* 298 */ "cmd ::= DESCRIBE full_table_name", + /* 299 */ "cmd ::= RESET QUERY CACHE", + /* 300 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 301 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 302 */ "analyze_opt ::=", + /* 303 */ "analyze_opt ::= ANALYZE", + /* 304 */ "explain_options ::=", + /* 305 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 306 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 307 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 308 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 309 */ "agg_func_opt ::=", + /* 310 */ "agg_func_opt ::= AGGREGATE", + /* 311 */ "bufsize_opt ::=", + /* 312 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 313 */ "language_opt ::=", + /* 314 */ "language_opt ::= LANGUAGE NK_STRING", + /* 315 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 316 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 317 */ "col_list_opt ::=", + /* 318 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 319 */ "tag_def_or_ref_opt ::=", + /* 320 */ "tag_def_or_ref_opt ::= tags_def", + /* 321 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 322 */ "stream_options ::=", + /* 323 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 324 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 325 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 326 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 327 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 328 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 329 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 330 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 331 */ "subtable_opt ::=", + /* 332 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 333 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 334 */ "cmd ::= KILL QUERY NK_STRING", + /* 335 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 336 */ "cmd ::= BALANCE VGROUP", + /* 337 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 338 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 339 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 340 */ "dnode_list ::= DNODE NK_INTEGER", + /* 341 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 342 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 343 */ "cmd ::= query_or_subquery", + /* 344 */ "cmd ::= insert_query", + /* 345 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 346 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 347 */ "literal ::= NK_INTEGER", + /* 348 */ "literal ::= NK_FLOAT", + /* 349 */ "literal ::= NK_STRING", + /* 350 */ "literal ::= NK_BOOL", + /* 351 */ "literal ::= TIMESTAMP NK_STRING", + /* 352 */ "literal ::= duration_literal", + /* 353 */ "literal ::= NULL", + /* 354 */ "literal ::= NK_QUESTION", + /* 355 */ "duration_literal ::= NK_VARIABLE", + /* 356 */ "signed ::= NK_INTEGER", + /* 357 */ "signed ::= NK_PLUS NK_INTEGER", + /* 358 */ "signed ::= NK_MINUS NK_INTEGER", + /* 359 */ "signed ::= NK_FLOAT", + /* 360 */ "signed ::= NK_PLUS NK_FLOAT", + /* 361 */ "signed ::= NK_MINUS NK_FLOAT", + /* 362 */ "signed_literal ::= signed", + /* 363 */ "signed_literal ::= NK_STRING", + /* 364 */ "signed_literal ::= NK_BOOL", + /* 365 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 366 */ "signed_literal ::= duration_literal", + /* 367 */ "signed_literal ::= NULL", + /* 368 */ "signed_literal ::= literal_func", + /* 369 */ "signed_literal ::= NK_QUESTION", + /* 370 */ "literal_list ::= signed_literal", + /* 371 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 372 */ "db_name ::= NK_ID", + /* 373 */ "table_name ::= NK_ID", + /* 374 */ "column_name ::= NK_ID", + /* 375 */ "function_name ::= NK_ID", + /* 376 */ "table_alias ::= NK_ID", + /* 377 */ "column_alias ::= NK_ID", + /* 378 */ "user_name ::= NK_ID", + /* 379 */ "topic_name ::= NK_ID", + /* 380 */ "stream_name ::= NK_ID", + /* 381 */ "cgroup_name ::= NK_ID", + /* 382 */ "index_name ::= NK_ID", + /* 383 */ "expr_or_subquery ::= expression", + /* 384 */ "expression ::= literal", + /* 385 */ "expression ::= pseudo_column", + /* 386 */ "expression ::= column_reference", + /* 387 */ "expression ::= function_expression", + /* 388 */ "expression ::= case_when_expression", + /* 389 */ "expression ::= NK_LP expression NK_RP", + /* 390 */ "expression ::= NK_PLUS expr_or_subquery", + /* 391 */ "expression ::= NK_MINUS expr_or_subquery", + /* 392 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 393 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 394 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 395 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 396 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 397 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 398 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 399 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 400 */ "expression_list ::= expr_or_subquery", + /* 401 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 402 */ "column_reference ::= column_name", + /* 403 */ "column_reference ::= table_name NK_DOT column_name", + /* 404 */ "pseudo_column ::= ROWTS", + /* 405 */ "pseudo_column ::= TBNAME", + /* 406 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 407 */ "pseudo_column ::= QSTART", + /* 408 */ "pseudo_column ::= QEND", + /* 409 */ "pseudo_column ::= QDURATION", + /* 410 */ "pseudo_column ::= WSTART", + /* 411 */ "pseudo_column ::= WEND", + /* 412 */ "pseudo_column ::= WDURATION", + /* 413 */ "pseudo_column ::= IROWTS", + /* 414 */ "pseudo_column ::= ISFILLED", + /* 415 */ "pseudo_column ::= QTAGS", + /* 416 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 417 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 418 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 419 */ "function_expression ::= literal_func", + /* 420 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 421 */ "literal_func ::= NOW", + /* 422 */ "noarg_func ::= NOW", + /* 423 */ "noarg_func ::= TODAY", + /* 424 */ "noarg_func ::= TIMEZONE", + /* 425 */ "noarg_func ::= DATABASE", + /* 426 */ "noarg_func ::= CLIENT_VERSION", + /* 427 */ "noarg_func ::= SERVER_VERSION", + /* 428 */ "noarg_func ::= SERVER_STATUS", + /* 429 */ "noarg_func ::= CURRENT_USER", + /* 430 */ "noarg_func ::= USER", + /* 431 */ "star_func ::= COUNT", + /* 432 */ "star_func ::= FIRST", + /* 433 */ "star_func ::= LAST", + /* 434 */ "star_func ::= LAST_ROW", + /* 435 */ "star_func_para_list ::= NK_STAR", + /* 436 */ "star_func_para_list ::= other_para_list", + /* 437 */ "other_para_list ::= star_func_para", + /* 438 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 439 */ "star_func_para ::= expr_or_subquery", + /* 440 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 441 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 442 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 443 */ "when_then_list ::= when_then_expr", + /* 444 */ "when_then_list ::= when_then_list when_then_expr", + /* 445 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 446 */ "case_when_else_opt ::=", + /* 447 */ "case_when_else_opt ::= ELSE common_expression", + /* 448 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 449 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 450 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 451 */ "predicate ::= expr_or_subquery IS NULL", + /* 452 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 453 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 454 */ "compare_op ::= NK_LT", + /* 455 */ "compare_op ::= NK_GT", + /* 456 */ "compare_op ::= NK_LE", + /* 457 */ "compare_op ::= NK_GE", + /* 458 */ "compare_op ::= NK_NE", + /* 459 */ "compare_op ::= NK_EQ", + /* 460 */ "compare_op ::= LIKE", + /* 461 */ "compare_op ::= NOT LIKE", + /* 462 */ "compare_op ::= MATCH", + /* 463 */ "compare_op ::= NMATCH", + /* 464 */ "compare_op ::= CONTAINS", + /* 465 */ "in_op ::= IN", + /* 466 */ "in_op ::= NOT IN", + /* 467 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 468 */ "boolean_value_expression ::= boolean_primary", + /* 469 */ "boolean_value_expression ::= NOT boolean_primary", + /* 470 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 471 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 472 */ "boolean_primary ::= predicate", + /* 473 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 474 */ "common_expression ::= expr_or_subquery", + /* 475 */ "common_expression ::= boolean_value_expression", + /* 476 */ "from_clause_opt ::=", + /* 477 */ "from_clause_opt ::= FROM table_reference_list", + /* 478 */ "table_reference_list ::= table_reference", + /* 479 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 480 */ "table_reference ::= table_primary", + /* 481 */ "table_reference ::= joined_table", + /* 482 */ "table_primary ::= table_name alias_opt", + /* 483 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 484 */ "table_primary ::= subquery alias_opt", + /* 485 */ "table_primary ::= parenthesized_joined_table", + /* 486 */ "alias_opt ::=", + /* 487 */ "alias_opt ::= table_alias", + /* 488 */ "alias_opt ::= AS table_alias", + /* 489 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 490 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 491 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 492 */ "join_type ::=", + /* 493 */ "join_type ::= INNER", + /* 494 */ "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", + /* 495 */ "set_quantifier_opt ::=", + /* 496 */ "set_quantifier_opt ::= DISTINCT", + /* 497 */ "set_quantifier_opt ::= ALL", + /* 498 */ "select_list ::= select_item", + /* 499 */ "select_list ::= select_list NK_COMMA select_item", + /* 500 */ "select_item ::= NK_STAR", + /* 501 */ "select_item ::= common_expression", + /* 502 */ "select_item ::= common_expression column_alias", + /* 503 */ "select_item ::= common_expression AS column_alias", + /* 504 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 505 */ "where_clause_opt ::=", + /* 506 */ "where_clause_opt ::= WHERE search_condition", + /* 507 */ "partition_by_clause_opt ::=", + /* 508 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 509 */ "partition_list ::= partition_item", + /* 510 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 511 */ "partition_item ::= expr_or_subquery", + /* 512 */ "partition_item ::= expr_or_subquery column_alias", + /* 513 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 514 */ "twindow_clause_opt ::=", + /* 515 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 516 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 517 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 518 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 519 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 520 */ "sliding_opt ::=", + /* 521 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 522 */ "fill_opt ::=", + /* 523 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 524 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 525 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", + /* 526 */ "fill_mode ::= NONE", + /* 527 */ "fill_mode ::= PREV", + /* 528 */ "fill_mode ::= NULL", + /* 529 */ "fill_mode ::= NULL_F", + /* 530 */ "fill_mode ::= LINEAR", + /* 531 */ "fill_mode ::= NEXT", + /* 532 */ "group_by_clause_opt ::=", + /* 533 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 534 */ "group_by_list ::= expr_or_subquery", + /* 535 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 536 */ "having_clause_opt ::=", + /* 537 */ "having_clause_opt ::= HAVING search_condition", + /* 538 */ "range_opt ::=", + /* 539 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 540 */ "every_opt ::=", + /* 541 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 542 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 543 */ "query_simple ::= query_specification", + /* 544 */ "query_simple ::= union_query_expression", + /* 545 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 546 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 547 */ "query_simple_or_subquery ::= query_simple", + /* 548 */ "query_simple_or_subquery ::= subquery", + /* 549 */ "query_or_subquery ::= query_expression", + /* 550 */ "query_or_subquery ::= subquery", + /* 551 */ "order_by_clause_opt ::=", + /* 552 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 553 */ "slimit_clause_opt ::=", + /* 554 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 555 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 556 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 557 */ "limit_clause_opt ::=", + /* 558 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 559 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 560 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 561 */ "subquery ::= NK_LP query_expression NK_RP", + /* 562 */ "subquery ::= NK_LP subquery NK_RP", + /* 563 */ "search_condition ::= common_expression", + /* 564 */ "sort_specification_list ::= sort_specification", + /* 565 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 566 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 567 */ "ordering_specification_opt ::=", + /* 568 */ "ordering_specification_opt ::= ASC", + /* 569 */ "ordering_specification_opt ::= DESC", + /* 570 */ "null_ordering_opt ::=", + /* 571 */ "null_ordering_opt ::= NULLS FIRST", + /* 572 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2639,82 +2601,84 @@ static void yy_destructor( case 332: /* literal */ case 345: /* db_options */ case 347: /* alter_db_options */ - case 353: /* retention */ - case 354: /* full_table_name */ - case 357: /* table_options */ - case 361: /* alter_table_clause */ - case 362: /* alter_table_options */ - case 365: /* signed_literal */ - case 366: /* create_subtable_clause */ - case 369: /* drop_table_clause */ - case 372: /* column_def */ - case 376: /* duration_literal */ - case 377: /* rollup_func_name */ - case 379: /* col_name */ - case 380: /* db_name_cond_opt */ - case 381: /* like_pattern_opt */ - case 382: /* table_name_cond */ - case 383: /* from_db_opt */ - case 385: /* tag_item */ - case 387: /* full_index_name */ - case 388: /* index_options */ - case 391: /* sliding_opt */ - case 392: /* sma_stream_opt */ - case 393: /* func */ - case 395: /* query_or_subquery */ - case 398: /* explain_options */ - case 399: /* insert_query */ - case 404: /* stream_options */ - case 407: /* subtable_opt */ - case 408: /* expression */ - case 410: /* where_clause_opt */ - case 411: /* signed */ - case 412: /* literal_func */ - case 415: /* expr_or_subquery */ - case 416: /* pseudo_column */ - case 417: /* column_reference */ - case 418: /* function_expression */ - case 419: /* case_when_expression */ - case 424: /* star_func_para */ - case 426: /* case_when_else_opt */ - case 427: /* common_expression */ - case 428: /* when_then_expr */ - case 429: /* predicate */ - case 432: /* in_predicate_value */ - case 433: /* boolean_value_expression */ - case 434: /* boolean_primary */ - case 435: /* from_clause_opt */ - case 436: /* table_reference_list */ - case 437: /* table_reference */ - case 438: /* table_primary */ - case 439: /* joined_table */ - case 441: /* subquery */ - case 442: /* parenthesized_joined_table */ - case 444: /* search_condition */ - case 445: /* query_specification */ - case 449: /* range_opt */ - case 450: /* every_opt */ - case 451: /* fill_opt */ - case 452: /* twindow_clause_opt */ - case 454: /* having_clause_opt */ - case 455: /* select_item */ - case 457: /* partition_item */ - case 460: /* query_expression */ - case 461: /* query_simple */ - case 463: /* slimit_clause_opt */ - case 464: /* limit_clause_opt */ - case 465: /* union_query_expression */ - case 466: /* query_simple_or_subquery */ - case 468: /* sort_specification */ + case 349: /* start_opt */ + case 350: /* end_opt */ + case 355: /* retention */ + case 356: /* full_table_name */ + case 359: /* table_options */ + case 363: /* alter_table_clause */ + case 364: /* alter_table_options */ + case 367: /* signed_literal */ + case 368: /* create_subtable_clause */ + case 371: /* drop_table_clause */ + case 374: /* column_def */ + case 378: /* duration_literal */ + case 379: /* rollup_func_name */ + case 381: /* col_name */ + case 382: /* db_name_cond_opt */ + case 383: /* like_pattern_opt */ + case 384: /* table_name_cond */ + case 385: /* from_db_opt */ + case 387: /* tag_item */ + case 389: /* full_index_name */ + case 390: /* index_options */ + case 393: /* sliding_opt */ + case 394: /* sma_stream_opt */ + case 395: /* func */ + case 397: /* query_or_subquery */ + case 400: /* explain_options */ + case 401: /* insert_query */ + case 406: /* stream_options */ + case 409: /* subtable_opt */ + case 410: /* expression */ + case 412: /* where_clause_opt */ + case 413: /* signed */ + case 414: /* literal_func */ + case 417: /* expr_or_subquery */ + case 418: /* pseudo_column */ + case 419: /* column_reference */ + case 420: /* function_expression */ + case 421: /* case_when_expression */ + case 426: /* star_func_para */ + case 428: /* case_when_else_opt */ + case 429: /* common_expression */ + case 430: /* when_then_expr */ + case 431: /* predicate */ + case 434: /* in_predicate_value */ + case 435: /* boolean_value_expression */ + case 436: /* boolean_primary */ + case 437: /* from_clause_opt */ + case 438: /* table_reference_list */ + case 439: /* table_reference */ + case 440: /* table_primary */ + case 441: /* joined_table */ + case 443: /* subquery */ + case 444: /* parenthesized_joined_table */ + case 446: /* search_condition */ + case 447: /* query_specification */ + case 451: /* range_opt */ + case 452: /* every_opt */ + case 453: /* fill_opt */ + case 454: /* twindow_clause_opt */ + case 456: /* having_clause_opt */ + case 457: /* select_item */ + case 459: /* partition_item */ + case 462: /* query_expression */ + case 463: /* query_simple */ + case 465: /* slimit_clause_opt */ + case 466: /* limit_clause_opt */ + case 467: /* union_query_expression */ + case 468: /* query_simple_or_subquery */ + case 470: /* sort_specification */ { - nodesDestroyNode((yypminor->yy140)); + nodesDestroyNode((yypminor->yy828)); } break; case 330: /* account_options */ case 331: /* alter_account_options */ case 333: /* alter_account_option */ case 348: /* speed_opt */ - case 401: /* bufsize_opt */ + case 403: /* bufsize_opt */ { } @@ -2724,19 +2688,19 @@ static void yy_destructor( case 340: /* db_name */ case 341: /* topic_name */ case 342: /* dnode_endpoint */ - case 363: /* column_name */ - case 371: /* table_name */ - case 378: /* function_name */ - case 386: /* column_alias */ - case 389: /* index_name */ - case 394: /* sma_func_name */ - case 396: /* cgroup_name */ - case 402: /* language_opt */ - case 403: /* stream_name */ - case 414: /* table_alias */ - case 420: /* star_func */ - case 422: /* noarg_func */ - case 440: /* alias_opt */ + case 365: /* column_name */ + case 373: /* table_name */ + case 380: /* function_name */ + case 388: /* column_alias */ + case 391: /* index_name */ + case 396: /* sma_func_name */ + case 398: /* cgroup_name */ + case 404: /* language_opt */ + case 405: /* stream_name */ + case 416: /* table_alias */ + case 422: /* star_func */ + case 424: /* noarg_func */ + case 442: /* alias_opt */ { } @@ -2756,79 +2720,79 @@ static void yy_destructor( case 343: /* force_opt */ case 344: /* not_exists_opt */ case 346: /* exists_opt */ - case 397: /* analyze_opt */ - case 400: /* agg_func_opt */ - case 446: /* set_quantifier_opt */ + case 399: /* analyze_opt */ + case 402: /* agg_func_opt */ + case 448: /* set_quantifier_opt */ { } break; - case 349: /* integer_list */ - case 350: /* variable_list */ - case 351: /* retention_list */ - case 355: /* column_def_list */ - case 356: /* tags_def_opt */ - case 358: /* multi_create_clause */ - case 359: /* tags_def */ - case 360: /* multi_drop_clause */ - case 367: /* specific_cols_opt */ - case 368: /* expression_list */ - case 370: /* col_name_list */ - case 373: /* duration_list */ - case 374: /* rollup_func_list */ - case 384: /* tag_list_opt */ - case 390: /* func_list */ - case 405: /* col_list_opt */ - case 406: /* tag_def_or_ref_opt */ - case 409: /* dnode_list */ - case 413: /* literal_list */ - case 421: /* star_func_para_list */ - case 423: /* other_para_list */ - case 425: /* when_then_list */ - case 447: /* select_list */ - case 448: /* partition_by_clause_opt */ - case 453: /* group_by_clause_opt */ - case 456: /* partition_list */ - case 459: /* group_by_list */ - case 462: /* order_by_clause_opt */ - case 467: /* sort_specification_list */ + case 351: /* integer_list */ + case 352: /* variable_list */ + case 353: /* retention_list */ + case 357: /* column_def_list */ + case 358: /* tags_def_opt */ + case 360: /* multi_create_clause */ + case 361: /* tags_def */ + case 362: /* multi_drop_clause */ + case 369: /* specific_cols_opt */ + case 370: /* expression_list */ + case 372: /* col_name_list */ + case 375: /* duration_list */ + case 376: /* rollup_func_list */ + case 386: /* tag_list_opt */ + case 392: /* func_list */ + case 407: /* col_list_opt */ + case 408: /* tag_def_or_ref_opt */ + case 411: /* dnode_list */ + case 415: /* literal_list */ + case 423: /* star_func_para_list */ + case 425: /* other_para_list */ + case 427: /* when_then_list */ + case 449: /* select_list */ + case 450: /* partition_by_clause_opt */ + case 455: /* group_by_clause_opt */ + case 458: /* partition_list */ + case 461: /* group_by_list */ + case 464: /* order_by_clause_opt */ + case 469: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy220)); + nodesDestroyList((yypminor->yy222)); } break; - case 352: /* alter_db_option */ - case 375: /* alter_table_option */ + case 354: /* alter_db_option */ + case 377: /* alter_table_option */ { } break; - case 364: /* type_name */ + case 366: /* type_name */ { } break; - case 430: /* compare_op */ - case 431: /* in_op */ + case 432: /* compare_op */ + case 433: /* in_op */ { } break; - case 443: /* join_type */ + case 445: /* join_type */ { } break; - case 458: /* fill_mode */ + case 460: /* fill_mode */ { } break; - case 469: /* ordering_specification_opt */ + case 471: /* ordering_specification_opt */ { } break; - case 470: /* null_ordering_opt */ + case 472: /* null_ordering_opt */ { } @@ -3199,7 +3163,7 @@ static const struct { { 329, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ { 329, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */ { 329, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ - { 329, -3 }, /* (72) cmd ::= COMPACT DATABASE db_name */ + { 329, -5 }, /* (72) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ { 344, -3 }, /* (73) not_exists_opt ::= IF NOT EXISTS */ { 344, 0 }, /* (74) not_exists_opt ::= */ { 346, -2 }, /* (75) exists_opt ::= IF EXISTS */ @@ -3237,461 +3201,469 @@ static const struct { { 345, -3 }, /* (107) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ { 347, -1 }, /* (108) alter_db_options ::= alter_db_option */ { 347, -2 }, /* (109) alter_db_options ::= alter_db_options alter_db_option */ - { 352, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ - { 352, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ - { 352, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 352, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 352, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ - { 352, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ - { 352, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ - { 352, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ - { 352, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 352, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 349, -1 }, /* (120) integer_list ::= NK_INTEGER */ - { 349, -3 }, /* (121) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 350, -1 }, /* (122) variable_list ::= NK_VARIABLE */ - { 350, -3 }, /* (123) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 351, -1 }, /* (124) retention_list ::= retention */ - { 351, -3 }, /* (125) retention_list ::= retention_list NK_COMMA retention */ - { 353, -3 }, /* (126) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 354, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ + { 354, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ + { 354, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 354, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 354, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ + { 354, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ + { 354, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ + { 354, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ + { 354, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 354, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 351, -1 }, /* (120) integer_list ::= NK_INTEGER */ + { 351, -3 }, /* (121) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 352, -1 }, /* (122) variable_list ::= NK_VARIABLE */ + { 352, -3 }, /* (123) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 353, -1 }, /* (124) retention_list ::= retention */ + { 353, -3 }, /* (125) retention_list ::= retention_list NK_COMMA retention */ + { 355, -3 }, /* (126) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ { 348, 0 }, /* (127) speed_opt ::= */ { 348, -2 }, /* (128) speed_opt ::= MAX_SPEED NK_INTEGER */ - { 329, -9 }, /* (129) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 329, -3 }, /* (130) cmd ::= CREATE TABLE multi_create_clause */ - { 329, -9 }, /* (131) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 329, -3 }, /* (132) cmd ::= DROP TABLE multi_drop_clause */ - { 329, -4 }, /* (133) cmd ::= DROP STABLE exists_opt full_table_name */ - { 329, -3 }, /* (134) cmd ::= ALTER TABLE alter_table_clause */ - { 329, -3 }, /* (135) cmd ::= ALTER STABLE alter_table_clause */ - { 361, -2 }, /* (136) alter_table_clause ::= full_table_name alter_table_options */ - { 361, -5 }, /* (137) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 361, -4 }, /* (138) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 361, -5 }, /* (139) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 361, -5 }, /* (140) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 361, -5 }, /* (141) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 361, -4 }, /* (142) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 361, -5 }, /* (143) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 361, -5 }, /* (144) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 361, -6 }, /* (145) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 358, -1 }, /* (146) multi_create_clause ::= create_subtable_clause */ - { 358, -2 }, /* (147) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 366, -10 }, /* (148) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - { 360, -1 }, /* (149) multi_drop_clause ::= drop_table_clause */ - { 360, -3 }, /* (150) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - { 369, -2 }, /* (151) drop_table_clause ::= exists_opt full_table_name */ - { 367, 0 }, /* (152) specific_cols_opt ::= */ - { 367, -3 }, /* (153) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 354, -1 }, /* (154) full_table_name ::= table_name */ - { 354, -3 }, /* (155) full_table_name ::= db_name NK_DOT table_name */ - { 355, -1 }, /* (156) column_def_list ::= column_def */ - { 355, -3 }, /* (157) column_def_list ::= column_def_list NK_COMMA column_def */ - { 372, -2 }, /* (158) column_def ::= column_name type_name */ - { 372, -4 }, /* (159) column_def ::= column_name type_name COMMENT NK_STRING */ - { 364, -1 }, /* (160) type_name ::= BOOL */ - { 364, -1 }, /* (161) type_name ::= TINYINT */ - { 364, -1 }, /* (162) type_name ::= SMALLINT */ - { 364, -1 }, /* (163) type_name ::= INT */ - { 364, -1 }, /* (164) type_name ::= INTEGER */ - { 364, -1 }, /* (165) type_name ::= BIGINT */ - { 364, -1 }, /* (166) type_name ::= FLOAT */ - { 364, -1 }, /* (167) type_name ::= DOUBLE */ - { 364, -4 }, /* (168) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 364, -1 }, /* (169) type_name ::= TIMESTAMP */ - { 364, -4 }, /* (170) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 364, -2 }, /* (171) type_name ::= TINYINT UNSIGNED */ - { 364, -2 }, /* (172) type_name ::= SMALLINT UNSIGNED */ - { 364, -2 }, /* (173) type_name ::= INT UNSIGNED */ - { 364, -2 }, /* (174) type_name ::= BIGINT UNSIGNED */ - { 364, -1 }, /* (175) type_name ::= JSON */ - { 364, -4 }, /* (176) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 364, -1 }, /* (177) type_name ::= MEDIUMBLOB */ - { 364, -1 }, /* (178) type_name ::= BLOB */ - { 364, -4 }, /* (179) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 364, -1 }, /* (180) type_name ::= DECIMAL */ - { 364, -4 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 364, -6 }, /* (182) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 356, 0 }, /* (183) tags_def_opt ::= */ - { 356, -1 }, /* (184) tags_def_opt ::= tags_def */ - { 359, -4 }, /* (185) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 357, 0 }, /* (186) table_options ::= */ - { 357, -3 }, /* (187) table_options ::= table_options COMMENT NK_STRING */ - { 357, -3 }, /* (188) table_options ::= table_options MAX_DELAY duration_list */ - { 357, -3 }, /* (189) table_options ::= table_options WATERMARK duration_list */ - { 357, -5 }, /* (190) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 357, -3 }, /* (191) table_options ::= table_options TTL NK_INTEGER */ - { 357, -5 }, /* (192) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 357, -3 }, /* (193) table_options ::= table_options DELETE_MARK duration_list */ - { 362, -1 }, /* (194) alter_table_options ::= alter_table_option */ - { 362, -2 }, /* (195) alter_table_options ::= alter_table_options alter_table_option */ - { 375, -2 }, /* (196) alter_table_option ::= COMMENT NK_STRING */ - { 375, -2 }, /* (197) alter_table_option ::= TTL NK_INTEGER */ - { 373, -1 }, /* (198) duration_list ::= duration_literal */ - { 373, -3 }, /* (199) duration_list ::= duration_list NK_COMMA duration_literal */ - { 374, -1 }, /* (200) rollup_func_list ::= rollup_func_name */ - { 374, -3 }, /* (201) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 377, -1 }, /* (202) rollup_func_name ::= function_name */ - { 377, -1 }, /* (203) rollup_func_name ::= FIRST */ - { 377, -1 }, /* (204) rollup_func_name ::= LAST */ - { 370, -1 }, /* (205) col_name_list ::= col_name */ - { 370, -3 }, /* (206) col_name_list ::= col_name_list NK_COMMA col_name */ - { 379, -1 }, /* (207) col_name ::= column_name */ - { 329, -2 }, /* (208) cmd ::= SHOW DNODES */ - { 329, -2 }, /* (209) cmd ::= SHOW USERS */ - { 329, -3 }, /* (210) cmd ::= SHOW USER PRIVILEGES */ - { 329, -2 }, /* (211) cmd ::= SHOW DATABASES */ - { 329, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 329, -4 }, /* (213) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 329, -3 }, /* (214) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 329, -2 }, /* (215) cmd ::= SHOW MNODES */ - { 329, -2 }, /* (216) cmd ::= SHOW QNODES */ - { 329, -2 }, /* (217) cmd ::= SHOW FUNCTIONS */ - { 329, -5 }, /* (218) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 329, -2 }, /* (219) cmd ::= SHOW STREAMS */ - { 329, -2 }, /* (220) cmd ::= SHOW ACCOUNTS */ - { 329, -2 }, /* (221) cmd ::= SHOW APPS */ - { 329, -2 }, /* (222) cmd ::= SHOW CONNECTIONS */ - { 329, -2 }, /* (223) cmd ::= SHOW LICENCES */ - { 329, -2 }, /* (224) cmd ::= SHOW GRANTS */ - { 329, -4 }, /* (225) cmd ::= SHOW CREATE DATABASE db_name */ - { 329, -4 }, /* (226) cmd ::= SHOW CREATE TABLE full_table_name */ - { 329, -4 }, /* (227) cmd ::= SHOW CREATE STABLE full_table_name */ - { 329, -2 }, /* (228) cmd ::= SHOW QUERIES */ - { 329, -2 }, /* (229) cmd ::= SHOW SCORES */ - { 329, -2 }, /* (230) cmd ::= SHOW TOPICS */ - { 329, -2 }, /* (231) cmd ::= SHOW VARIABLES */ - { 329, -3 }, /* (232) cmd ::= SHOW CLUSTER VARIABLES */ - { 329, -3 }, /* (233) cmd ::= SHOW LOCAL VARIABLES */ - { 329, -5 }, /* (234) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - { 329, -2 }, /* (235) cmd ::= SHOW BNODES */ - { 329, -2 }, /* (236) cmd ::= SHOW SNODES */ - { 329, -2 }, /* (237) cmd ::= SHOW CLUSTER */ - { 329, -2 }, /* (238) cmd ::= SHOW TRANSACTIONS */ - { 329, -4 }, /* (239) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 329, -2 }, /* (240) cmd ::= SHOW CONSUMERS */ - { 329, -2 }, /* (241) cmd ::= SHOW SUBSCRIPTIONS */ - { 329, -5 }, /* (242) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 329, -7 }, /* (243) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { 329, -3 }, /* (244) cmd ::= SHOW VNODES NK_INTEGER */ - { 329, -3 }, /* (245) cmd ::= SHOW VNODES NK_STRING */ - { 329, -3 }, /* (246) cmd ::= SHOW db_name_cond_opt ALIVE */ - { 329, -3 }, /* (247) cmd ::= SHOW CLUSTER ALIVE */ - { 380, 0 }, /* (248) db_name_cond_opt ::= */ - { 380, -2 }, /* (249) db_name_cond_opt ::= db_name NK_DOT */ - { 381, 0 }, /* (250) like_pattern_opt ::= */ - { 381, -2 }, /* (251) like_pattern_opt ::= LIKE NK_STRING */ - { 382, -1 }, /* (252) table_name_cond ::= table_name */ - { 383, 0 }, /* (253) from_db_opt ::= */ - { 383, -2 }, /* (254) from_db_opt ::= FROM db_name */ - { 384, 0 }, /* (255) tag_list_opt ::= */ - { 384, -1 }, /* (256) tag_list_opt ::= tag_item */ - { 384, -3 }, /* (257) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - { 385, -1 }, /* (258) tag_item ::= TBNAME */ - { 385, -1 }, /* (259) tag_item ::= QTAGS */ - { 385, -1 }, /* (260) tag_item ::= column_name */ - { 385, -2 }, /* (261) tag_item ::= column_name column_alias */ - { 385, -3 }, /* (262) tag_item ::= column_name AS column_alias */ - { 329, -8 }, /* (263) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - { 329, -9 }, /* (264) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - { 329, -4 }, /* (265) cmd ::= DROP INDEX exists_opt full_index_name */ - { 387, -1 }, /* (266) full_index_name ::= index_name */ - { 387, -3 }, /* (267) full_index_name ::= db_name NK_DOT index_name */ - { 388, -10 }, /* (268) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 388, -12 }, /* (269) 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 */ - { 390, -1 }, /* (270) func_list ::= func */ - { 390, -3 }, /* (271) func_list ::= func_list NK_COMMA func */ - { 393, -4 }, /* (272) func ::= sma_func_name NK_LP expression_list NK_RP */ - { 394, -1 }, /* (273) sma_func_name ::= function_name */ - { 394, -1 }, /* (274) sma_func_name ::= COUNT */ - { 394, -1 }, /* (275) sma_func_name ::= FIRST */ - { 394, -1 }, /* (276) sma_func_name ::= LAST */ - { 394, -1 }, /* (277) sma_func_name ::= LAST_ROW */ - { 392, 0 }, /* (278) sma_stream_opt ::= */ - { 392, -3 }, /* (279) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { 392, -3 }, /* (280) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { 392, -3 }, /* (281) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { 329, -6 }, /* (282) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 329, -7 }, /* (283) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 329, -9 }, /* (284) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 329, -7 }, /* (285) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 329, -9 }, /* (286) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 329, -4 }, /* (287) cmd ::= DROP TOPIC exists_opt topic_name */ - { 329, -7 }, /* (288) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 329, -2 }, /* (289) cmd ::= DESC full_table_name */ - { 329, -2 }, /* (290) cmd ::= DESCRIBE full_table_name */ - { 329, -3 }, /* (291) cmd ::= RESET QUERY CACHE */ - { 329, -4 }, /* (292) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 329, -4 }, /* (293) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - { 397, 0 }, /* (294) analyze_opt ::= */ - { 397, -1 }, /* (295) analyze_opt ::= ANALYZE */ - { 398, 0 }, /* (296) explain_options ::= */ - { 398, -3 }, /* (297) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 398, -3 }, /* (298) explain_options ::= explain_options RATIO NK_FLOAT */ - { 329, -11 }, /* (299) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - { 329, -4 }, /* (300) cmd ::= DROP FUNCTION exists_opt function_name */ - { 400, 0 }, /* (301) agg_func_opt ::= */ - { 400, -1 }, /* (302) agg_func_opt ::= AGGREGATE */ - { 401, 0 }, /* (303) bufsize_opt ::= */ - { 401, -2 }, /* (304) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 402, 0 }, /* (305) language_opt ::= */ - { 402, -2 }, /* (306) language_opt ::= LANGUAGE NK_STRING */ - { 329, -12 }, /* (307) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - { 329, -4 }, /* (308) cmd ::= DROP STREAM exists_opt stream_name */ - { 405, 0 }, /* (309) col_list_opt ::= */ - { 405, -3 }, /* (310) col_list_opt ::= NK_LP col_name_list NK_RP */ - { 406, 0 }, /* (311) tag_def_or_ref_opt ::= */ - { 406, -1 }, /* (312) tag_def_or_ref_opt ::= tags_def */ - { 406, -4 }, /* (313) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - { 404, 0 }, /* (314) stream_options ::= */ - { 404, -3 }, /* (315) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 404, -3 }, /* (316) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 404, -4 }, /* (317) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 404, -3 }, /* (318) stream_options ::= stream_options WATERMARK duration_literal */ - { 404, -4 }, /* (319) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 404, -3 }, /* (320) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { 404, -3 }, /* (321) stream_options ::= stream_options DELETE_MARK duration_literal */ - { 404, -4 }, /* (322) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - { 407, 0 }, /* (323) subtable_opt ::= */ - { 407, -4 }, /* (324) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 329, -3 }, /* (325) cmd ::= KILL CONNECTION NK_INTEGER */ - { 329, -3 }, /* (326) cmd ::= KILL QUERY NK_STRING */ - { 329, -3 }, /* (327) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 329, -2 }, /* (328) cmd ::= BALANCE VGROUP */ - { 329, -4 }, /* (329) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 329, -4 }, /* (330) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 329, -3 }, /* (331) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 409, -2 }, /* (332) dnode_list ::= DNODE NK_INTEGER */ - { 409, -3 }, /* (333) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 329, -4 }, /* (334) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 329, -1 }, /* (335) cmd ::= query_or_subquery */ - { 329, -1 }, /* (336) cmd ::= insert_query */ - { 399, -7 }, /* (337) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 399, -4 }, /* (338) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - { 332, -1 }, /* (339) literal ::= NK_INTEGER */ - { 332, -1 }, /* (340) literal ::= NK_FLOAT */ - { 332, -1 }, /* (341) literal ::= NK_STRING */ - { 332, -1 }, /* (342) literal ::= NK_BOOL */ - { 332, -2 }, /* (343) literal ::= TIMESTAMP NK_STRING */ - { 332, -1 }, /* (344) literal ::= duration_literal */ - { 332, -1 }, /* (345) literal ::= NULL */ - { 332, -1 }, /* (346) literal ::= NK_QUESTION */ - { 376, -1 }, /* (347) duration_literal ::= NK_VARIABLE */ - { 411, -1 }, /* (348) signed ::= NK_INTEGER */ - { 411, -2 }, /* (349) signed ::= NK_PLUS NK_INTEGER */ - { 411, -2 }, /* (350) signed ::= NK_MINUS NK_INTEGER */ - { 411, -1 }, /* (351) signed ::= NK_FLOAT */ - { 411, -2 }, /* (352) signed ::= NK_PLUS NK_FLOAT */ - { 411, -2 }, /* (353) signed ::= NK_MINUS NK_FLOAT */ - { 365, -1 }, /* (354) signed_literal ::= signed */ - { 365, -1 }, /* (355) signed_literal ::= NK_STRING */ - { 365, -1 }, /* (356) signed_literal ::= NK_BOOL */ - { 365, -2 }, /* (357) signed_literal ::= TIMESTAMP NK_STRING */ - { 365, -1 }, /* (358) signed_literal ::= duration_literal */ - { 365, -1 }, /* (359) signed_literal ::= NULL */ - { 365, -1 }, /* (360) signed_literal ::= literal_func */ - { 365, -1 }, /* (361) signed_literal ::= NK_QUESTION */ - { 413, -1 }, /* (362) literal_list ::= signed_literal */ - { 413, -3 }, /* (363) literal_list ::= literal_list NK_COMMA signed_literal */ - { 340, -1 }, /* (364) db_name ::= NK_ID */ - { 371, -1 }, /* (365) table_name ::= NK_ID */ - { 363, -1 }, /* (366) column_name ::= NK_ID */ - { 378, -1 }, /* (367) function_name ::= NK_ID */ - { 414, -1 }, /* (368) table_alias ::= NK_ID */ - { 386, -1 }, /* (369) column_alias ::= NK_ID */ - { 334, -1 }, /* (370) user_name ::= NK_ID */ - { 341, -1 }, /* (371) topic_name ::= NK_ID */ - { 403, -1 }, /* (372) stream_name ::= NK_ID */ - { 396, -1 }, /* (373) cgroup_name ::= NK_ID */ - { 389, -1 }, /* (374) index_name ::= NK_ID */ - { 415, -1 }, /* (375) expr_or_subquery ::= expression */ - { 408, -1 }, /* (376) expression ::= literal */ - { 408, -1 }, /* (377) expression ::= pseudo_column */ - { 408, -1 }, /* (378) expression ::= column_reference */ - { 408, -1 }, /* (379) expression ::= function_expression */ - { 408, -1 }, /* (380) expression ::= case_when_expression */ - { 408, -3 }, /* (381) expression ::= NK_LP expression NK_RP */ - { 408, -2 }, /* (382) expression ::= NK_PLUS expr_or_subquery */ - { 408, -2 }, /* (383) expression ::= NK_MINUS expr_or_subquery */ - { 408, -3 }, /* (384) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 408, -3 }, /* (385) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 408, -3 }, /* (386) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 408, -3 }, /* (387) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 408, -3 }, /* (388) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 408, -3 }, /* (389) expression ::= column_reference NK_ARROW NK_STRING */ - { 408, -3 }, /* (390) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 408, -3 }, /* (391) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 368, -1 }, /* (392) expression_list ::= expr_or_subquery */ - { 368, -3 }, /* (393) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 417, -1 }, /* (394) column_reference ::= column_name */ - { 417, -3 }, /* (395) column_reference ::= table_name NK_DOT column_name */ - { 416, -1 }, /* (396) pseudo_column ::= ROWTS */ - { 416, -1 }, /* (397) pseudo_column ::= TBNAME */ - { 416, -3 }, /* (398) pseudo_column ::= table_name NK_DOT TBNAME */ - { 416, -1 }, /* (399) pseudo_column ::= QSTART */ - { 416, -1 }, /* (400) pseudo_column ::= QEND */ - { 416, -1 }, /* (401) pseudo_column ::= QDURATION */ - { 416, -1 }, /* (402) pseudo_column ::= WSTART */ - { 416, -1 }, /* (403) pseudo_column ::= WEND */ - { 416, -1 }, /* (404) pseudo_column ::= WDURATION */ - { 416, -1 }, /* (405) pseudo_column ::= IROWTS */ - { 416, -1 }, /* (406) pseudo_column ::= ISFILLED */ - { 416, -1 }, /* (407) pseudo_column ::= QTAGS */ - { 418, -4 }, /* (408) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 418, -4 }, /* (409) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 418, -6 }, /* (410) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 418, -1 }, /* (411) function_expression ::= literal_func */ - { 412, -3 }, /* (412) literal_func ::= noarg_func NK_LP NK_RP */ - { 412, -1 }, /* (413) literal_func ::= NOW */ - { 422, -1 }, /* (414) noarg_func ::= NOW */ - { 422, -1 }, /* (415) noarg_func ::= TODAY */ - { 422, -1 }, /* (416) noarg_func ::= TIMEZONE */ - { 422, -1 }, /* (417) noarg_func ::= DATABASE */ - { 422, -1 }, /* (418) noarg_func ::= CLIENT_VERSION */ - { 422, -1 }, /* (419) noarg_func ::= SERVER_VERSION */ - { 422, -1 }, /* (420) noarg_func ::= SERVER_STATUS */ - { 422, -1 }, /* (421) noarg_func ::= CURRENT_USER */ - { 422, -1 }, /* (422) noarg_func ::= USER */ - { 420, -1 }, /* (423) star_func ::= COUNT */ - { 420, -1 }, /* (424) star_func ::= FIRST */ - { 420, -1 }, /* (425) star_func ::= LAST */ - { 420, -1 }, /* (426) star_func ::= LAST_ROW */ - { 421, -1 }, /* (427) star_func_para_list ::= NK_STAR */ - { 421, -1 }, /* (428) star_func_para_list ::= other_para_list */ - { 423, -1 }, /* (429) other_para_list ::= star_func_para */ - { 423, -3 }, /* (430) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 424, -1 }, /* (431) star_func_para ::= expr_or_subquery */ - { 424, -3 }, /* (432) star_func_para ::= table_name NK_DOT NK_STAR */ - { 419, -4 }, /* (433) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 419, -5 }, /* (434) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 425, -1 }, /* (435) when_then_list ::= when_then_expr */ - { 425, -2 }, /* (436) when_then_list ::= when_then_list when_then_expr */ - { 428, -4 }, /* (437) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 426, 0 }, /* (438) case_when_else_opt ::= */ - { 426, -2 }, /* (439) case_when_else_opt ::= ELSE common_expression */ - { 429, -3 }, /* (440) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 429, -5 }, /* (441) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 429, -6 }, /* (442) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 429, -3 }, /* (443) predicate ::= expr_or_subquery IS NULL */ - { 429, -4 }, /* (444) predicate ::= expr_or_subquery IS NOT NULL */ - { 429, -3 }, /* (445) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 430, -1 }, /* (446) compare_op ::= NK_LT */ - { 430, -1 }, /* (447) compare_op ::= NK_GT */ - { 430, -1 }, /* (448) compare_op ::= NK_LE */ - { 430, -1 }, /* (449) compare_op ::= NK_GE */ - { 430, -1 }, /* (450) compare_op ::= NK_NE */ - { 430, -1 }, /* (451) compare_op ::= NK_EQ */ - { 430, -1 }, /* (452) compare_op ::= LIKE */ - { 430, -2 }, /* (453) compare_op ::= NOT LIKE */ - { 430, -1 }, /* (454) compare_op ::= MATCH */ - { 430, -1 }, /* (455) compare_op ::= NMATCH */ - { 430, -1 }, /* (456) compare_op ::= CONTAINS */ - { 431, -1 }, /* (457) in_op ::= IN */ - { 431, -2 }, /* (458) in_op ::= NOT IN */ - { 432, -3 }, /* (459) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 433, -1 }, /* (460) boolean_value_expression ::= boolean_primary */ - { 433, -2 }, /* (461) boolean_value_expression ::= NOT boolean_primary */ - { 433, -3 }, /* (462) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 433, -3 }, /* (463) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 434, -1 }, /* (464) boolean_primary ::= predicate */ - { 434, -3 }, /* (465) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 427, -1 }, /* (466) common_expression ::= expr_or_subquery */ - { 427, -1 }, /* (467) common_expression ::= boolean_value_expression */ - { 435, 0 }, /* (468) from_clause_opt ::= */ - { 435, -2 }, /* (469) from_clause_opt ::= FROM table_reference_list */ - { 436, -1 }, /* (470) table_reference_list ::= table_reference */ - { 436, -3 }, /* (471) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 437, -1 }, /* (472) table_reference ::= table_primary */ - { 437, -1 }, /* (473) table_reference ::= joined_table */ - { 438, -2 }, /* (474) table_primary ::= table_name alias_opt */ - { 438, -4 }, /* (475) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 438, -2 }, /* (476) table_primary ::= subquery alias_opt */ - { 438, -1 }, /* (477) table_primary ::= parenthesized_joined_table */ - { 440, 0 }, /* (478) alias_opt ::= */ - { 440, -1 }, /* (479) alias_opt ::= table_alias */ - { 440, -2 }, /* (480) alias_opt ::= AS table_alias */ - { 442, -3 }, /* (481) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 442, -3 }, /* (482) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 439, -6 }, /* (483) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 443, 0 }, /* (484) join_type ::= */ - { 443, -1 }, /* (485) join_type ::= INNER */ - { 445, -12 }, /* (486) 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 */ - { 446, 0 }, /* (487) set_quantifier_opt ::= */ - { 446, -1 }, /* (488) set_quantifier_opt ::= DISTINCT */ - { 446, -1 }, /* (489) set_quantifier_opt ::= ALL */ - { 447, -1 }, /* (490) select_list ::= select_item */ - { 447, -3 }, /* (491) select_list ::= select_list NK_COMMA select_item */ - { 455, -1 }, /* (492) select_item ::= NK_STAR */ - { 455, -1 }, /* (493) select_item ::= common_expression */ - { 455, -2 }, /* (494) select_item ::= common_expression column_alias */ - { 455, -3 }, /* (495) select_item ::= common_expression AS column_alias */ - { 455, -3 }, /* (496) select_item ::= table_name NK_DOT NK_STAR */ - { 410, 0 }, /* (497) where_clause_opt ::= */ - { 410, -2 }, /* (498) where_clause_opt ::= WHERE search_condition */ - { 448, 0 }, /* (499) partition_by_clause_opt ::= */ - { 448, -3 }, /* (500) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 456, -1 }, /* (501) partition_list ::= partition_item */ - { 456, -3 }, /* (502) partition_list ::= partition_list NK_COMMA partition_item */ - { 457, -1 }, /* (503) partition_item ::= expr_or_subquery */ - { 457, -2 }, /* (504) partition_item ::= expr_or_subquery column_alias */ - { 457, -3 }, /* (505) partition_item ::= expr_or_subquery AS column_alias */ - { 452, 0 }, /* (506) twindow_clause_opt ::= */ - { 452, -6 }, /* (507) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 452, -4 }, /* (508) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 452, -6 }, /* (509) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 452, -8 }, /* (510) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 452, -7 }, /* (511) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - { 391, 0 }, /* (512) sliding_opt ::= */ - { 391, -4 }, /* (513) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 451, 0 }, /* (514) fill_opt ::= */ - { 451, -4 }, /* (515) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 451, -6 }, /* (516) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 451, -6 }, /* (517) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ - { 458, -1 }, /* (518) fill_mode ::= NONE */ - { 458, -1 }, /* (519) fill_mode ::= PREV */ - { 458, -1 }, /* (520) fill_mode ::= NULL */ - { 458, -1 }, /* (521) fill_mode ::= NULL_F */ - { 458, -1 }, /* (522) fill_mode ::= LINEAR */ - { 458, -1 }, /* (523) fill_mode ::= NEXT */ - { 453, 0 }, /* (524) group_by_clause_opt ::= */ - { 453, -3 }, /* (525) group_by_clause_opt ::= GROUP BY group_by_list */ - { 459, -1 }, /* (526) group_by_list ::= expr_or_subquery */ - { 459, -3 }, /* (527) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 454, 0 }, /* (528) having_clause_opt ::= */ - { 454, -2 }, /* (529) having_clause_opt ::= HAVING search_condition */ - { 449, 0 }, /* (530) range_opt ::= */ - { 449, -6 }, /* (531) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 450, 0 }, /* (532) every_opt ::= */ - { 450, -4 }, /* (533) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 460, -4 }, /* (534) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 461, -1 }, /* (535) query_simple ::= query_specification */ - { 461, -1 }, /* (536) query_simple ::= union_query_expression */ - { 465, -4 }, /* (537) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 465, -3 }, /* (538) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 466, -1 }, /* (539) query_simple_or_subquery ::= query_simple */ - { 466, -1 }, /* (540) query_simple_or_subquery ::= subquery */ - { 395, -1 }, /* (541) query_or_subquery ::= query_expression */ - { 395, -1 }, /* (542) query_or_subquery ::= subquery */ - { 462, 0 }, /* (543) order_by_clause_opt ::= */ - { 462, -3 }, /* (544) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 463, 0 }, /* (545) slimit_clause_opt ::= */ - { 463, -2 }, /* (546) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 463, -4 }, /* (547) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 463, -4 }, /* (548) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 464, 0 }, /* (549) limit_clause_opt ::= */ - { 464, -2 }, /* (550) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 464, -4 }, /* (551) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 464, -4 }, /* (552) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 441, -3 }, /* (553) subquery ::= NK_LP query_expression NK_RP */ - { 441, -3 }, /* (554) subquery ::= NK_LP subquery NK_RP */ - { 444, -1 }, /* (555) search_condition ::= common_expression */ - { 467, -1 }, /* (556) sort_specification_list ::= sort_specification */ - { 467, -3 }, /* (557) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 468, -3 }, /* (558) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 469, 0 }, /* (559) ordering_specification_opt ::= */ - { 469, -1 }, /* (560) ordering_specification_opt ::= ASC */ - { 469, -1 }, /* (561) ordering_specification_opt ::= DESC */ - { 470, 0 }, /* (562) null_ordering_opt ::= */ - { 470, -2 }, /* (563) null_ordering_opt ::= NULLS FIRST */ - { 470, -2 }, /* (564) null_ordering_opt ::= NULLS LAST */ + { 349, 0 }, /* (129) start_opt ::= */ + { 349, -3 }, /* (130) start_opt ::= START WITH NK_INTEGER */ + { 349, -3 }, /* (131) start_opt ::= START WITH NK_STRING */ + { 349, -4 }, /* (132) start_opt ::= START WITH TIMESTAMP NK_STRING */ + { 350, 0 }, /* (133) end_opt ::= */ + { 350, -3 }, /* (134) end_opt ::= END WITH NK_INTEGER */ + { 350, -3 }, /* (135) end_opt ::= END WITH NK_STRING */ + { 350, -4 }, /* (136) end_opt ::= END WITH TIMESTAMP NK_STRING */ + { 329, -9 }, /* (137) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 329, -3 }, /* (138) cmd ::= CREATE TABLE multi_create_clause */ + { 329, -9 }, /* (139) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 329, -3 }, /* (140) cmd ::= DROP TABLE multi_drop_clause */ + { 329, -4 }, /* (141) cmd ::= DROP STABLE exists_opt full_table_name */ + { 329, -3 }, /* (142) cmd ::= ALTER TABLE alter_table_clause */ + { 329, -3 }, /* (143) cmd ::= ALTER STABLE alter_table_clause */ + { 363, -2 }, /* (144) alter_table_clause ::= full_table_name alter_table_options */ + { 363, -5 }, /* (145) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 363, -4 }, /* (146) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 363, -5 }, /* (147) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 363, -5 }, /* (148) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 363, -5 }, /* (149) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 363, -4 }, /* (150) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 363, -5 }, /* (151) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 363, -5 }, /* (152) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 363, -6 }, /* (153) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 360, -1 }, /* (154) multi_create_clause ::= create_subtable_clause */ + { 360, -2 }, /* (155) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 368, -10 }, /* (156) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + { 362, -1 }, /* (157) multi_drop_clause ::= drop_table_clause */ + { 362, -3 }, /* (158) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + { 371, -2 }, /* (159) drop_table_clause ::= exists_opt full_table_name */ + { 369, 0 }, /* (160) specific_cols_opt ::= */ + { 369, -3 }, /* (161) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 356, -1 }, /* (162) full_table_name ::= table_name */ + { 356, -3 }, /* (163) full_table_name ::= db_name NK_DOT table_name */ + { 357, -1 }, /* (164) column_def_list ::= column_def */ + { 357, -3 }, /* (165) column_def_list ::= column_def_list NK_COMMA column_def */ + { 374, -2 }, /* (166) column_def ::= column_name type_name */ + { 374, -4 }, /* (167) column_def ::= column_name type_name COMMENT NK_STRING */ + { 366, -1 }, /* (168) type_name ::= BOOL */ + { 366, -1 }, /* (169) type_name ::= TINYINT */ + { 366, -1 }, /* (170) type_name ::= SMALLINT */ + { 366, -1 }, /* (171) type_name ::= INT */ + { 366, -1 }, /* (172) type_name ::= INTEGER */ + { 366, -1 }, /* (173) type_name ::= BIGINT */ + { 366, -1 }, /* (174) type_name ::= FLOAT */ + { 366, -1 }, /* (175) type_name ::= DOUBLE */ + { 366, -4 }, /* (176) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 366, -1 }, /* (177) type_name ::= TIMESTAMP */ + { 366, -4 }, /* (178) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 366, -2 }, /* (179) type_name ::= TINYINT UNSIGNED */ + { 366, -2 }, /* (180) type_name ::= SMALLINT UNSIGNED */ + { 366, -2 }, /* (181) type_name ::= INT UNSIGNED */ + { 366, -2 }, /* (182) type_name ::= BIGINT UNSIGNED */ + { 366, -1 }, /* (183) type_name ::= JSON */ + { 366, -4 }, /* (184) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 366, -1 }, /* (185) type_name ::= MEDIUMBLOB */ + { 366, -1 }, /* (186) type_name ::= BLOB */ + { 366, -4 }, /* (187) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 366, -1 }, /* (188) type_name ::= DECIMAL */ + { 366, -4 }, /* (189) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 366, -6 }, /* (190) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 358, 0 }, /* (191) tags_def_opt ::= */ + { 358, -1 }, /* (192) tags_def_opt ::= tags_def */ + { 361, -4 }, /* (193) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 359, 0 }, /* (194) table_options ::= */ + { 359, -3 }, /* (195) table_options ::= table_options COMMENT NK_STRING */ + { 359, -3 }, /* (196) table_options ::= table_options MAX_DELAY duration_list */ + { 359, -3 }, /* (197) table_options ::= table_options WATERMARK duration_list */ + { 359, -5 }, /* (198) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 359, -3 }, /* (199) table_options ::= table_options TTL NK_INTEGER */ + { 359, -5 }, /* (200) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 359, -3 }, /* (201) table_options ::= table_options DELETE_MARK duration_list */ + { 364, -1 }, /* (202) alter_table_options ::= alter_table_option */ + { 364, -2 }, /* (203) alter_table_options ::= alter_table_options alter_table_option */ + { 377, -2 }, /* (204) alter_table_option ::= COMMENT NK_STRING */ + { 377, -2 }, /* (205) alter_table_option ::= TTL NK_INTEGER */ + { 375, -1 }, /* (206) duration_list ::= duration_literal */ + { 375, -3 }, /* (207) duration_list ::= duration_list NK_COMMA duration_literal */ + { 376, -1 }, /* (208) rollup_func_list ::= rollup_func_name */ + { 376, -3 }, /* (209) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 379, -1 }, /* (210) rollup_func_name ::= function_name */ + { 379, -1 }, /* (211) rollup_func_name ::= FIRST */ + { 379, -1 }, /* (212) rollup_func_name ::= LAST */ + { 372, -1 }, /* (213) col_name_list ::= col_name */ + { 372, -3 }, /* (214) col_name_list ::= col_name_list NK_COMMA col_name */ + { 381, -1 }, /* (215) col_name ::= column_name */ + { 329, -2 }, /* (216) cmd ::= SHOW DNODES */ + { 329, -2 }, /* (217) cmd ::= SHOW USERS */ + { 329, -3 }, /* (218) cmd ::= SHOW USER PRIVILEGES */ + { 329, -2 }, /* (219) cmd ::= SHOW DATABASES */ + { 329, -4 }, /* (220) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 329, -4 }, /* (221) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 329, -3 }, /* (222) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 329, -2 }, /* (223) cmd ::= SHOW MNODES */ + { 329, -2 }, /* (224) cmd ::= SHOW QNODES */ + { 329, -2 }, /* (225) cmd ::= SHOW FUNCTIONS */ + { 329, -5 }, /* (226) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 329, -2 }, /* (227) cmd ::= SHOW STREAMS */ + { 329, -2 }, /* (228) cmd ::= SHOW ACCOUNTS */ + { 329, -2 }, /* (229) cmd ::= SHOW APPS */ + { 329, -2 }, /* (230) cmd ::= SHOW CONNECTIONS */ + { 329, -2 }, /* (231) cmd ::= SHOW LICENCES */ + { 329, -2 }, /* (232) cmd ::= SHOW GRANTS */ + { 329, -4 }, /* (233) cmd ::= SHOW CREATE DATABASE db_name */ + { 329, -4 }, /* (234) cmd ::= SHOW CREATE TABLE full_table_name */ + { 329, -4 }, /* (235) cmd ::= SHOW CREATE STABLE full_table_name */ + { 329, -2 }, /* (236) cmd ::= SHOW QUERIES */ + { 329, -2 }, /* (237) cmd ::= SHOW SCORES */ + { 329, -2 }, /* (238) cmd ::= SHOW TOPICS */ + { 329, -2 }, /* (239) cmd ::= SHOW VARIABLES */ + { 329, -3 }, /* (240) cmd ::= SHOW CLUSTER VARIABLES */ + { 329, -3 }, /* (241) cmd ::= SHOW LOCAL VARIABLES */ + { 329, -5 }, /* (242) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + { 329, -2 }, /* (243) cmd ::= SHOW BNODES */ + { 329, -2 }, /* (244) cmd ::= SHOW SNODES */ + { 329, -2 }, /* (245) cmd ::= SHOW CLUSTER */ + { 329, -2 }, /* (246) cmd ::= SHOW TRANSACTIONS */ + { 329, -4 }, /* (247) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 329, -2 }, /* (248) cmd ::= SHOW CONSUMERS */ + { 329, -2 }, /* (249) cmd ::= SHOW SUBSCRIPTIONS */ + { 329, -5 }, /* (250) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 329, -7 }, /* (251) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + { 329, -3 }, /* (252) cmd ::= SHOW VNODES NK_INTEGER */ + { 329, -3 }, /* (253) cmd ::= SHOW VNODES NK_STRING */ + { 329, -3 }, /* (254) cmd ::= SHOW db_name_cond_opt ALIVE */ + { 329, -3 }, /* (255) cmd ::= SHOW CLUSTER ALIVE */ + { 382, 0 }, /* (256) db_name_cond_opt ::= */ + { 382, -2 }, /* (257) db_name_cond_opt ::= db_name NK_DOT */ + { 383, 0 }, /* (258) like_pattern_opt ::= */ + { 383, -2 }, /* (259) like_pattern_opt ::= LIKE NK_STRING */ + { 384, -1 }, /* (260) table_name_cond ::= table_name */ + { 385, 0 }, /* (261) from_db_opt ::= */ + { 385, -2 }, /* (262) from_db_opt ::= FROM db_name */ + { 386, 0 }, /* (263) tag_list_opt ::= */ + { 386, -1 }, /* (264) tag_list_opt ::= tag_item */ + { 386, -3 }, /* (265) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + { 387, -1 }, /* (266) tag_item ::= TBNAME */ + { 387, -1 }, /* (267) tag_item ::= QTAGS */ + { 387, -1 }, /* (268) tag_item ::= column_name */ + { 387, -2 }, /* (269) tag_item ::= column_name column_alias */ + { 387, -3 }, /* (270) tag_item ::= column_name AS column_alias */ + { 329, -8 }, /* (271) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + { 329, -9 }, /* (272) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + { 329, -4 }, /* (273) cmd ::= DROP INDEX exists_opt full_index_name */ + { 389, -1 }, /* (274) full_index_name ::= index_name */ + { 389, -3 }, /* (275) full_index_name ::= db_name NK_DOT index_name */ + { 390, -10 }, /* (276) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 390, -12 }, /* (277) 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 */ + { 392, -1 }, /* (278) func_list ::= func */ + { 392, -3 }, /* (279) func_list ::= func_list NK_COMMA func */ + { 395, -4 }, /* (280) func ::= sma_func_name NK_LP expression_list NK_RP */ + { 396, -1 }, /* (281) sma_func_name ::= function_name */ + { 396, -1 }, /* (282) sma_func_name ::= COUNT */ + { 396, -1 }, /* (283) sma_func_name ::= FIRST */ + { 396, -1 }, /* (284) sma_func_name ::= LAST */ + { 396, -1 }, /* (285) sma_func_name ::= LAST_ROW */ + { 394, 0 }, /* (286) sma_stream_opt ::= */ + { 394, -3 }, /* (287) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + { 394, -3 }, /* (288) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + { 394, -3 }, /* (289) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + { 329, -6 }, /* (290) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 329, -7 }, /* (291) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 329, -9 }, /* (292) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 329, -7 }, /* (293) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 329, -9 }, /* (294) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 329, -4 }, /* (295) cmd ::= DROP TOPIC exists_opt topic_name */ + { 329, -7 }, /* (296) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 329, -2 }, /* (297) cmd ::= DESC full_table_name */ + { 329, -2 }, /* (298) cmd ::= DESCRIBE full_table_name */ + { 329, -3 }, /* (299) cmd ::= RESET QUERY CACHE */ + { 329, -4 }, /* (300) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 329, -4 }, /* (301) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + { 399, 0 }, /* (302) analyze_opt ::= */ + { 399, -1 }, /* (303) analyze_opt ::= ANALYZE */ + { 400, 0 }, /* (304) explain_options ::= */ + { 400, -3 }, /* (305) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 400, -3 }, /* (306) explain_options ::= explain_options RATIO NK_FLOAT */ + { 329, -11 }, /* (307) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + { 329, -4 }, /* (308) cmd ::= DROP FUNCTION exists_opt function_name */ + { 402, 0 }, /* (309) agg_func_opt ::= */ + { 402, -1 }, /* (310) agg_func_opt ::= AGGREGATE */ + { 403, 0 }, /* (311) bufsize_opt ::= */ + { 403, -2 }, /* (312) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 404, 0 }, /* (313) language_opt ::= */ + { 404, -2 }, /* (314) language_opt ::= LANGUAGE NK_STRING */ + { 329, -12 }, /* (315) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + { 329, -4 }, /* (316) cmd ::= DROP STREAM exists_opt stream_name */ + { 407, 0 }, /* (317) col_list_opt ::= */ + { 407, -3 }, /* (318) col_list_opt ::= NK_LP col_name_list NK_RP */ + { 408, 0 }, /* (319) tag_def_or_ref_opt ::= */ + { 408, -1 }, /* (320) tag_def_or_ref_opt ::= tags_def */ + { 408, -4 }, /* (321) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + { 406, 0 }, /* (322) stream_options ::= */ + { 406, -3 }, /* (323) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 406, -3 }, /* (324) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 406, -4 }, /* (325) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 406, -3 }, /* (326) stream_options ::= stream_options WATERMARK duration_literal */ + { 406, -4 }, /* (327) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 406, -3 }, /* (328) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + { 406, -3 }, /* (329) stream_options ::= stream_options DELETE_MARK duration_literal */ + { 406, -4 }, /* (330) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + { 409, 0 }, /* (331) subtable_opt ::= */ + { 409, -4 }, /* (332) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 329, -3 }, /* (333) cmd ::= KILL CONNECTION NK_INTEGER */ + { 329, -3 }, /* (334) cmd ::= KILL QUERY NK_STRING */ + { 329, -3 }, /* (335) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 329, -2 }, /* (336) cmd ::= BALANCE VGROUP */ + { 329, -4 }, /* (337) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 329, -4 }, /* (338) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 329, -3 }, /* (339) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 411, -2 }, /* (340) dnode_list ::= DNODE NK_INTEGER */ + { 411, -3 }, /* (341) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 329, -4 }, /* (342) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 329, -1 }, /* (343) cmd ::= query_or_subquery */ + { 329, -1 }, /* (344) cmd ::= insert_query */ + { 401, -7 }, /* (345) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 401, -4 }, /* (346) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + { 332, -1 }, /* (347) literal ::= NK_INTEGER */ + { 332, -1 }, /* (348) literal ::= NK_FLOAT */ + { 332, -1 }, /* (349) literal ::= NK_STRING */ + { 332, -1 }, /* (350) literal ::= NK_BOOL */ + { 332, -2 }, /* (351) literal ::= TIMESTAMP NK_STRING */ + { 332, -1 }, /* (352) literal ::= duration_literal */ + { 332, -1 }, /* (353) literal ::= NULL */ + { 332, -1 }, /* (354) literal ::= NK_QUESTION */ + { 378, -1 }, /* (355) duration_literal ::= NK_VARIABLE */ + { 413, -1 }, /* (356) signed ::= NK_INTEGER */ + { 413, -2 }, /* (357) signed ::= NK_PLUS NK_INTEGER */ + { 413, -2 }, /* (358) signed ::= NK_MINUS NK_INTEGER */ + { 413, -1 }, /* (359) signed ::= NK_FLOAT */ + { 413, -2 }, /* (360) signed ::= NK_PLUS NK_FLOAT */ + { 413, -2 }, /* (361) signed ::= NK_MINUS NK_FLOAT */ + { 367, -1 }, /* (362) signed_literal ::= signed */ + { 367, -1 }, /* (363) signed_literal ::= NK_STRING */ + { 367, -1 }, /* (364) signed_literal ::= NK_BOOL */ + { 367, -2 }, /* (365) signed_literal ::= TIMESTAMP NK_STRING */ + { 367, -1 }, /* (366) signed_literal ::= duration_literal */ + { 367, -1 }, /* (367) signed_literal ::= NULL */ + { 367, -1 }, /* (368) signed_literal ::= literal_func */ + { 367, -1 }, /* (369) signed_literal ::= NK_QUESTION */ + { 415, -1 }, /* (370) literal_list ::= signed_literal */ + { 415, -3 }, /* (371) literal_list ::= literal_list NK_COMMA signed_literal */ + { 340, -1 }, /* (372) db_name ::= NK_ID */ + { 373, -1 }, /* (373) table_name ::= NK_ID */ + { 365, -1 }, /* (374) column_name ::= NK_ID */ + { 380, -1 }, /* (375) function_name ::= NK_ID */ + { 416, -1 }, /* (376) table_alias ::= NK_ID */ + { 388, -1 }, /* (377) column_alias ::= NK_ID */ + { 334, -1 }, /* (378) user_name ::= NK_ID */ + { 341, -1 }, /* (379) topic_name ::= NK_ID */ + { 405, -1 }, /* (380) stream_name ::= NK_ID */ + { 398, -1 }, /* (381) cgroup_name ::= NK_ID */ + { 391, -1 }, /* (382) index_name ::= NK_ID */ + { 417, -1 }, /* (383) expr_or_subquery ::= expression */ + { 410, -1 }, /* (384) expression ::= literal */ + { 410, -1 }, /* (385) expression ::= pseudo_column */ + { 410, -1 }, /* (386) expression ::= column_reference */ + { 410, -1 }, /* (387) expression ::= function_expression */ + { 410, -1 }, /* (388) expression ::= case_when_expression */ + { 410, -3 }, /* (389) expression ::= NK_LP expression NK_RP */ + { 410, -2 }, /* (390) expression ::= NK_PLUS expr_or_subquery */ + { 410, -2 }, /* (391) expression ::= NK_MINUS expr_or_subquery */ + { 410, -3 }, /* (392) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 410, -3 }, /* (393) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 410, -3 }, /* (394) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 410, -3 }, /* (395) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 410, -3 }, /* (396) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 410, -3 }, /* (397) expression ::= column_reference NK_ARROW NK_STRING */ + { 410, -3 }, /* (398) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 410, -3 }, /* (399) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 370, -1 }, /* (400) expression_list ::= expr_or_subquery */ + { 370, -3 }, /* (401) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 419, -1 }, /* (402) column_reference ::= column_name */ + { 419, -3 }, /* (403) column_reference ::= table_name NK_DOT column_name */ + { 418, -1 }, /* (404) pseudo_column ::= ROWTS */ + { 418, -1 }, /* (405) pseudo_column ::= TBNAME */ + { 418, -3 }, /* (406) pseudo_column ::= table_name NK_DOT TBNAME */ + { 418, -1 }, /* (407) pseudo_column ::= QSTART */ + { 418, -1 }, /* (408) pseudo_column ::= QEND */ + { 418, -1 }, /* (409) pseudo_column ::= QDURATION */ + { 418, -1 }, /* (410) pseudo_column ::= WSTART */ + { 418, -1 }, /* (411) pseudo_column ::= WEND */ + { 418, -1 }, /* (412) pseudo_column ::= WDURATION */ + { 418, -1 }, /* (413) pseudo_column ::= IROWTS */ + { 418, -1 }, /* (414) pseudo_column ::= ISFILLED */ + { 418, -1 }, /* (415) pseudo_column ::= QTAGS */ + { 420, -4 }, /* (416) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 420, -4 }, /* (417) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 420, -6 }, /* (418) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 420, -1 }, /* (419) function_expression ::= literal_func */ + { 414, -3 }, /* (420) literal_func ::= noarg_func NK_LP NK_RP */ + { 414, -1 }, /* (421) literal_func ::= NOW */ + { 424, -1 }, /* (422) noarg_func ::= NOW */ + { 424, -1 }, /* (423) noarg_func ::= TODAY */ + { 424, -1 }, /* (424) noarg_func ::= TIMEZONE */ + { 424, -1 }, /* (425) noarg_func ::= DATABASE */ + { 424, -1 }, /* (426) noarg_func ::= CLIENT_VERSION */ + { 424, -1 }, /* (427) noarg_func ::= SERVER_VERSION */ + { 424, -1 }, /* (428) noarg_func ::= SERVER_STATUS */ + { 424, -1 }, /* (429) noarg_func ::= CURRENT_USER */ + { 424, -1 }, /* (430) noarg_func ::= USER */ + { 422, -1 }, /* (431) star_func ::= COUNT */ + { 422, -1 }, /* (432) star_func ::= FIRST */ + { 422, -1 }, /* (433) star_func ::= LAST */ + { 422, -1 }, /* (434) star_func ::= LAST_ROW */ + { 423, -1 }, /* (435) star_func_para_list ::= NK_STAR */ + { 423, -1 }, /* (436) star_func_para_list ::= other_para_list */ + { 425, -1 }, /* (437) other_para_list ::= star_func_para */ + { 425, -3 }, /* (438) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 426, -1 }, /* (439) star_func_para ::= expr_or_subquery */ + { 426, -3 }, /* (440) star_func_para ::= table_name NK_DOT NK_STAR */ + { 421, -4 }, /* (441) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 421, -5 }, /* (442) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 427, -1 }, /* (443) when_then_list ::= when_then_expr */ + { 427, -2 }, /* (444) when_then_list ::= when_then_list when_then_expr */ + { 430, -4 }, /* (445) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 428, 0 }, /* (446) case_when_else_opt ::= */ + { 428, -2 }, /* (447) case_when_else_opt ::= ELSE common_expression */ + { 431, -3 }, /* (448) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 431, -5 }, /* (449) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 431, -6 }, /* (450) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 431, -3 }, /* (451) predicate ::= expr_or_subquery IS NULL */ + { 431, -4 }, /* (452) predicate ::= expr_or_subquery IS NOT NULL */ + { 431, -3 }, /* (453) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 432, -1 }, /* (454) compare_op ::= NK_LT */ + { 432, -1 }, /* (455) compare_op ::= NK_GT */ + { 432, -1 }, /* (456) compare_op ::= NK_LE */ + { 432, -1 }, /* (457) compare_op ::= NK_GE */ + { 432, -1 }, /* (458) compare_op ::= NK_NE */ + { 432, -1 }, /* (459) compare_op ::= NK_EQ */ + { 432, -1 }, /* (460) compare_op ::= LIKE */ + { 432, -2 }, /* (461) compare_op ::= NOT LIKE */ + { 432, -1 }, /* (462) compare_op ::= MATCH */ + { 432, -1 }, /* (463) compare_op ::= NMATCH */ + { 432, -1 }, /* (464) compare_op ::= CONTAINS */ + { 433, -1 }, /* (465) in_op ::= IN */ + { 433, -2 }, /* (466) in_op ::= NOT IN */ + { 434, -3 }, /* (467) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 435, -1 }, /* (468) boolean_value_expression ::= boolean_primary */ + { 435, -2 }, /* (469) boolean_value_expression ::= NOT boolean_primary */ + { 435, -3 }, /* (470) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 435, -3 }, /* (471) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 436, -1 }, /* (472) boolean_primary ::= predicate */ + { 436, -3 }, /* (473) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 429, -1 }, /* (474) common_expression ::= expr_or_subquery */ + { 429, -1 }, /* (475) common_expression ::= boolean_value_expression */ + { 437, 0 }, /* (476) from_clause_opt ::= */ + { 437, -2 }, /* (477) from_clause_opt ::= FROM table_reference_list */ + { 438, -1 }, /* (478) table_reference_list ::= table_reference */ + { 438, -3 }, /* (479) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 439, -1 }, /* (480) table_reference ::= table_primary */ + { 439, -1 }, /* (481) table_reference ::= joined_table */ + { 440, -2 }, /* (482) table_primary ::= table_name alias_opt */ + { 440, -4 }, /* (483) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 440, -2 }, /* (484) table_primary ::= subquery alias_opt */ + { 440, -1 }, /* (485) table_primary ::= parenthesized_joined_table */ + { 442, 0 }, /* (486) alias_opt ::= */ + { 442, -1 }, /* (487) alias_opt ::= table_alias */ + { 442, -2 }, /* (488) alias_opt ::= AS table_alias */ + { 444, -3 }, /* (489) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 444, -3 }, /* (490) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 441, -6 }, /* (491) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 445, 0 }, /* (492) join_type ::= */ + { 445, -1 }, /* (493) join_type ::= INNER */ + { 447, -12 }, /* (494) 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 */ + { 448, 0 }, /* (495) set_quantifier_opt ::= */ + { 448, -1 }, /* (496) set_quantifier_opt ::= DISTINCT */ + { 448, -1 }, /* (497) set_quantifier_opt ::= ALL */ + { 449, -1 }, /* (498) select_list ::= select_item */ + { 449, -3 }, /* (499) select_list ::= select_list NK_COMMA select_item */ + { 457, -1 }, /* (500) select_item ::= NK_STAR */ + { 457, -1 }, /* (501) select_item ::= common_expression */ + { 457, -2 }, /* (502) select_item ::= common_expression column_alias */ + { 457, -3 }, /* (503) select_item ::= common_expression AS column_alias */ + { 457, -3 }, /* (504) select_item ::= table_name NK_DOT NK_STAR */ + { 412, 0 }, /* (505) where_clause_opt ::= */ + { 412, -2 }, /* (506) where_clause_opt ::= WHERE search_condition */ + { 450, 0 }, /* (507) partition_by_clause_opt ::= */ + { 450, -3 }, /* (508) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 458, -1 }, /* (509) partition_list ::= partition_item */ + { 458, -3 }, /* (510) partition_list ::= partition_list NK_COMMA partition_item */ + { 459, -1 }, /* (511) partition_item ::= expr_or_subquery */ + { 459, -2 }, /* (512) partition_item ::= expr_or_subquery column_alias */ + { 459, -3 }, /* (513) partition_item ::= expr_or_subquery AS column_alias */ + { 454, 0 }, /* (514) twindow_clause_opt ::= */ + { 454, -6 }, /* (515) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 454, -4 }, /* (516) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 454, -6 }, /* (517) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 454, -8 }, /* (518) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 454, -7 }, /* (519) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + { 393, 0 }, /* (520) sliding_opt ::= */ + { 393, -4 }, /* (521) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 453, 0 }, /* (522) fill_opt ::= */ + { 453, -4 }, /* (523) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 453, -6 }, /* (524) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 453, -6 }, /* (525) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ + { 460, -1 }, /* (526) fill_mode ::= NONE */ + { 460, -1 }, /* (527) fill_mode ::= PREV */ + { 460, -1 }, /* (528) fill_mode ::= NULL */ + { 460, -1 }, /* (529) fill_mode ::= NULL_F */ + { 460, -1 }, /* (530) fill_mode ::= LINEAR */ + { 460, -1 }, /* (531) fill_mode ::= NEXT */ + { 455, 0 }, /* (532) group_by_clause_opt ::= */ + { 455, -3 }, /* (533) group_by_clause_opt ::= GROUP BY group_by_list */ + { 461, -1 }, /* (534) group_by_list ::= expr_or_subquery */ + { 461, -3 }, /* (535) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 456, 0 }, /* (536) having_clause_opt ::= */ + { 456, -2 }, /* (537) having_clause_opt ::= HAVING search_condition */ + { 451, 0 }, /* (538) range_opt ::= */ + { 451, -6 }, /* (539) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 452, 0 }, /* (540) every_opt ::= */ + { 452, -4 }, /* (541) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 462, -4 }, /* (542) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 463, -1 }, /* (543) query_simple ::= query_specification */ + { 463, -1 }, /* (544) query_simple ::= union_query_expression */ + { 467, -4 }, /* (545) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 467, -3 }, /* (546) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 468, -1 }, /* (547) query_simple_or_subquery ::= query_simple */ + { 468, -1 }, /* (548) query_simple_or_subquery ::= subquery */ + { 397, -1 }, /* (549) query_or_subquery ::= query_expression */ + { 397, -1 }, /* (550) query_or_subquery ::= subquery */ + { 464, 0 }, /* (551) order_by_clause_opt ::= */ + { 464, -3 }, /* (552) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 465, 0 }, /* (553) slimit_clause_opt ::= */ + { 465, -2 }, /* (554) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 465, -4 }, /* (555) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 465, -4 }, /* (556) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 466, 0 }, /* (557) limit_clause_opt ::= */ + { 466, -2 }, /* (558) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 466, -4 }, /* (559) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 466, -4 }, /* (560) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 443, -3 }, /* (561) subquery ::= NK_LP query_expression NK_RP */ + { 443, -3 }, /* (562) subquery ::= NK_LP subquery NK_RP */ + { 446, -1 }, /* (563) search_condition ::= common_expression */ + { 469, -1 }, /* (564) sort_specification_list ::= sort_specification */ + { 469, -3 }, /* (565) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 470, -3 }, /* (566) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 471, 0 }, /* (567) ordering_specification_opt ::= */ + { 471, -1 }, /* (568) ordering_specification_opt ::= ASC */ + { 471, -1 }, /* (569) ordering_specification_opt ::= DESC */ + { 472, 0 }, /* (570) null_ordering_opt ::= */ + { 472, -2 }, /* (571) null_ordering_opt ::= NULLS FIRST */ + { 472, -2 }, /* (572) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3828,78 +3800,78 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,332,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy0, yymsp[0].minor.yy857); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy63, &yymsp[-1].minor.yy0, yymsp[0].minor.yy707); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy63, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy63, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy63, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy63); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy857 = 1; } +{ yymsp[1].minor.yy707 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy857 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy707 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy393, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy393, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); -{ yylhsminor.yy303 = yymsp[0].minor.yy303; } - yymsp[0].minor.yy303 = yylhsminor.yy303; +{ yylhsminor.yy393 = yymsp[0].minor.yy393; } + yymsp[0].minor.yy393 = yylhsminor.yy393; break; case 35: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy303 = yymsp[-2].minor.yy303 | yymsp[0].minor.yy303; } - yymsp[-2].minor.yy303 = yylhsminor.yy303; +{ yylhsminor.yy393 = yymsp[-2].minor.yy393 | yymsp[0].minor.yy393; } + yymsp[-2].minor.yy393 = yylhsminor.yy393; break; case 38: /* priv_type ::= READ */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_READ; } break; case 39: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy393 = PRIVILEGE_TYPE_WRITE; } break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy881 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy881 = yylhsminor.yy881; +{ yylhsminor.yy63 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy63 = yylhsminor.yy63; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy881 = yymsp[-2].minor.yy881; } - yymsp[-2].minor.yy881 = yylhsminor.yy881; +{ yylhsminor.yy63 = yymsp[-2].minor.yy63; } + yymsp[-2].minor.yy63 = yylhsminor.yy63; break; case 42: /* priv_level ::= topic_name */ - case 273: /* sma_func_name ::= function_name */ yytestcase(yyruleno==273); - case 479: /* alias_opt ::= table_alias */ yytestcase(yyruleno==479); -{ yylhsminor.yy881 = yymsp[0].minor.yy881; } - yymsp[0].minor.yy881 = yylhsminor.yy881; + case 281: /* sma_func_name ::= function_name */ yytestcase(yyruleno==281); + case 487: /* alias_opt ::= table_alias */ yytestcase(yyruleno==487); +{ yylhsminor.yy63 = yymsp[0].minor.yy63; } + yymsp[0].minor.yy63 = yylhsminor.yy63; break; case 43: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy881, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy63, NULL); } break; case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0); } break; case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy587); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy669); } break; case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy587); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy669); } break; case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3916,50 +3888,50 @@ static YYACTIONTYPE yy_reduce( case 51: /* dnode_endpoint ::= NK_STRING */ case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 274: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==274); - case 275: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==275); - case 276: /* sma_func_name ::= LAST */ yytestcase(yyruleno==276); - case 277: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==277); - case 364: /* db_name ::= NK_ID */ yytestcase(yyruleno==364); - case 365: /* table_name ::= NK_ID */ yytestcase(yyruleno==365); - case 366: /* column_name ::= NK_ID */ yytestcase(yyruleno==366); - case 367: /* function_name ::= NK_ID */ yytestcase(yyruleno==367); - case 368: /* table_alias ::= NK_ID */ yytestcase(yyruleno==368); - case 369: /* column_alias ::= NK_ID */ yytestcase(yyruleno==369); - case 370: /* user_name ::= NK_ID */ yytestcase(yyruleno==370); - case 371: /* topic_name ::= NK_ID */ yytestcase(yyruleno==371); - case 372: /* stream_name ::= NK_ID */ yytestcase(yyruleno==372); - case 373: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==373); - case 374: /* index_name ::= NK_ID */ yytestcase(yyruleno==374); - case 414: /* noarg_func ::= NOW */ yytestcase(yyruleno==414); - case 415: /* noarg_func ::= TODAY */ yytestcase(yyruleno==415); - case 416: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==416); - case 417: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==417); - case 418: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==418); - case 419: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==419); - case 420: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==420); - case 421: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==421); - case 422: /* noarg_func ::= USER */ yytestcase(yyruleno==422); - case 423: /* star_func ::= COUNT */ yytestcase(yyruleno==423); - case 424: /* star_func ::= FIRST */ yytestcase(yyruleno==424); - case 425: /* star_func ::= LAST */ yytestcase(yyruleno==425); - case 426: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==426); -{ yylhsminor.yy881 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy881 = yylhsminor.yy881; + case 282: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==282); + case 283: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==283); + case 284: /* sma_func_name ::= LAST */ yytestcase(yyruleno==284); + case 285: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==285); + case 372: /* db_name ::= NK_ID */ yytestcase(yyruleno==372); + case 373: /* table_name ::= NK_ID */ yytestcase(yyruleno==373); + case 374: /* column_name ::= NK_ID */ yytestcase(yyruleno==374); + case 375: /* function_name ::= NK_ID */ yytestcase(yyruleno==375); + case 376: /* table_alias ::= NK_ID */ yytestcase(yyruleno==376); + case 377: /* column_alias ::= NK_ID */ yytestcase(yyruleno==377); + case 378: /* user_name ::= NK_ID */ yytestcase(yyruleno==378); + case 379: /* topic_name ::= NK_ID */ yytestcase(yyruleno==379); + case 380: /* stream_name ::= NK_ID */ yytestcase(yyruleno==380); + case 381: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==381); + case 382: /* index_name ::= NK_ID */ yytestcase(yyruleno==382); + case 422: /* noarg_func ::= NOW */ yytestcase(yyruleno==422); + case 423: /* noarg_func ::= TODAY */ yytestcase(yyruleno==423); + case 424: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==424); + case 425: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==425); + case 426: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==426); + case 427: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==427); + case 428: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==428); + case 429: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==429); + case 430: /* noarg_func ::= USER */ yytestcase(yyruleno==430); + case 431: /* star_func ::= COUNT */ yytestcase(yyruleno==431); + case 432: /* star_func ::= FIRST */ yytestcase(yyruleno==432); + case 433: /* star_func ::= LAST */ yytestcase(yyruleno==433); + case 434: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==434); +{ yylhsminor.yy63 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy63 = yylhsminor.yy63; break; case 54: /* force_opt ::= */ case 74: /* not_exists_opt ::= */ yytestcase(yyruleno==74); case 76: /* exists_opt ::= */ yytestcase(yyruleno==76); - case 294: /* analyze_opt ::= */ yytestcase(yyruleno==294); - case 301: /* agg_func_opt ::= */ yytestcase(yyruleno==301); - case 487: /* set_quantifier_opt ::= */ yytestcase(yyruleno==487); -{ yymsp[1].minor.yy587 = false; } + case 302: /* analyze_opt ::= */ yytestcase(yyruleno==302); + case 309: /* agg_func_opt ::= */ yytestcase(yyruleno==309); + case 495: /* set_quantifier_opt ::= */ yytestcase(yyruleno==495); +{ yymsp[1].minor.yy669 = false; } break; case 55: /* force_opt ::= FORCE */ - case 295: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==295); - case 302: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==302); - case 488: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==488); -{ yymsp[0].minor.yy587 = true; } + case 303: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==303); + case 310: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==310); + case 496: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==496); +{ yymsp[0].minor.yy669 = true; } break; case 56: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3992,1383 +3964,1400 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy587, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy669, &yymsp[-1].minor.yy63, yymsp[0].minor.yy828); } break; case 67: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; case 68: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy63); } break; case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy828); } break; case 70: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy63); } break; case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy214); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy332); } break; - case 72: /* cmd ::= COMPACT DATABASE db_name */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[0].minor.yy881); } + case 72: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy63, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; case 73: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy587 = true; } +{ yymsp[-2].minor.yy669 = true; } break; case 75: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy587 = true; } +{ yymsp[-1].minor.yy669 = true; } break; case 77: /* db_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy828 = createDefaultDatabaseOptions(pCxt); } break; case 78: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 79: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 80: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 81: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 82: /* db_options ::= db_options DURATION NK_INTEGER */ case 83: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==83); -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 84: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 85: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 86: /* db_options ::= db_options KEEP integer_list */ case 87: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==87); -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_KEEP, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_KEEP, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 88: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 89: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 90: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 91: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 92: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 93: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 94: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 95: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_RETENTIONS, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_RETENTIONS, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 96: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 97: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 98: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 100: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-3].minor.yy828, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 102: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-3].minor.yy828, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; case 103: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 104: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 105: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 106: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 107: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setDatabaseOption(pCxt, yymsp[-2].minor.yy828, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 108: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy140 = createAlterDatabaseOptions(pCxt); yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yylhsminor.yy140, &yymsp[0].minor.yy809); } - yymsp[0].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = createAlterDatabaseOptions(pCxt); yylhsminor.yy828 = setAlterDatabaseOption(pCxt, yylhsminor.yy828, &yymsp[0].minor.yy233); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; case 109: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy140, &yymsp[0].minor.yy809); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy828, &yymsp[0].minor.yy233); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; case 110: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 111: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 112: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 113: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 114: /* alter_db_option ::= KEEP integer_list */ case 115: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==115); -{ yymsp[-1].minor.yy809.type = DB_OPTION_KEEP; yymsp[-1].minor.yy809.pList = yymsp[0].minor.yy220; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_KEEP; yymsp[-1].minor.yy233.pList = yymsp[0].minor.yy222; } break; case 116: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_PAGES; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_PAGES; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 117: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 118: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_WAL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_WAL; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 119: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy233.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; case 120: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; +{ yylhsminor.yy222 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; case 121: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 333: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==333); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; + case 341: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==341); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; break; case 122: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy220 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; +{ yylhsminor.yy222 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; case 123: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; break; case 124: /* retention_list ::= retention */ - case 146: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==146); - case 149: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==149); - case 156: /* column_def_list ::= column_def */ yytestcase(yyruleno==156); - case 200: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==200); - case 205: /* col_name_list ::= col_name */ yytestcase(yyruleno==205); - case 256: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==256); - case 270: /* func_list ::= func */ yytestcase(yyruleno==270); - case 362: /* literal_list ::= signed_literal */ yytestcase(yyruleno==362); - case 429: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==429); - case 435: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==435); - case 490: /* select_list ::= select_item */ yytestcase(yyruleno==490); - case 501: /* partition_list ::= partition_item */ yytestcase(yyruleno==501); - case 556: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==556); -{ yylhsminor.yy220 = createNodeList(pCxt, yymsp[0].minor.yy140); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 154: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==154); + case 157: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==157); + case 164: /* column_def_list ::= column_def */ yytestcase(yyruleno==164); + case 208: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==208); + case 213: /* col_name_list ::= col_name */ yytestcase(yyruleno==213); + case 264: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==264); + case 278: /* func_list ::= func */ yytestcase(yyruleno==278); + case 370: /* literal_list ::= signed_literal */ yytestcase(yyruleno==370); + case 437: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==437); + case 443: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==443); + case 498: /* select_list ::= select_item */ yytestcase(yyruleno==498); + case 509: /* partition_list ::= partition_item */ yytestcase(yyruleno==509); + case 564: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==564); +{ yylhsminor.yy222 = createNodeList(pCxt, yymsp[0].minor.yy828); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; case 125: /* retention_list ::= retention_list NK_COMMA retention */ - case 150: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==150); - case 157: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==157); - case 201: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==201); - case 206: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==206); - case 257: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==257); - case 271: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==271); - case 363: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==363); - case 430: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==430); - case 491: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==491); - case 502: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==502); - case 557: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==557); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; + case 158: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==158); + case 165: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==165); + case 209: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==209); + case 214: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==214); + case 265: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==265); + case 279: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==279); + case 371: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==371); + case 438: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==438); + case 499: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==499); + case 510: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==510); + case 565: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==565); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, yymsp[0].minor.yy828); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; break; case 126: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy140 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; +{ yylhsminor.yy828 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; case 127: /* speed_opt ::= */ - case 303: /* bufsize_opt ::= */ yytestcase(yyruleno==303); -{ yymsp[1].minor.yy214 = 0; } + case 311: /* bufsize_opt ::= */ yytestcase(yyruleno==311); +{ yymsp[1].minor.yy332 = 0; } break; case 128: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 304: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==304); -{ yymsp[-1].minor.yy214 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 312: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==312); +{ yymsp[-1].minor.yy332 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 129: /* start_opt ::= */ + case 133: /* end_opt ::= */ yytestcase(yyruleno==133); + case 258: /* like_pattern_opt ::= */ yytestcase(yyruleno==258); + case 331: /* subtable_opt ::= */ yytestcase(yyruleno==331); + case 446: /* case_when_else_opt ::= */ yytestcase(yyruleno==446); + case 476: /* from_clause_opt ::= */ yytestcase(yyruleno==476); + case 505: /* where_clause_opt ::= */ yytestcase(yyruleno==505); + case 514: /* twindow_clause_opt ::= */ yytestcase(yyruleno==514); + case 520: /* sliding_opt ::= */ yytestcase(yyruleno==520); + case 522: /* fill_opt ::= */ yytestcase(yyruleno==522); + case 536: /* having_clause_opt ::= */ yytestcase(yyruleno==536); + case 538: /* range_opt ::= */ yytestcase(yyruleno==538); + case 540: /* every_opt ::= */ yytestcase(yyruleno==540); + case 553: /* slimit_clause_opt ::= */ yytestcase(yyruleno==553); + case 557: /* limit_clause_opt ::= */ yytestcase(yyruleno==557); +{ yymsp[1].minor.yy828 = NULL; } + break; + case 130: /* start_opt ::= START WITH NK_INTEGER */ + case 134: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==134); +{ yymsp[-2].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 131: /* start_opt ::= START WITH NK_STRING */ + case 135: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==135); +{ yymsp[-2].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 132: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 136: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==136); +{ yymsp[-3].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 137: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 139: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==139); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy669, yymsp[-5].minor.yy828, yymsp[-3].minor.yy222, yymsp[-1].minor.yy222, yymsp[0].minor.yy828); } + break; + case 138: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy222); } + break; + case 140: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy222); } + break; + case 141: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy669, yymsp[0].minor.yy828); } + break; + case 142: /* cmd ::= ALTER TABLE alter_table_clause */ + case 343: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==343); + case 344: /* cmd ::= insert_query */ yytestcase(yyruleno==344); +{ pCxt->pRootNode = yymsp[0].minor.yy828; } + break; + case 143: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy828); } + break; + case 144: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy828 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; + break; + case 145: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 146: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy828 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy828, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy63); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; + break; + case 147: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 148: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy828 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 149: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; + break; + case 150: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy828 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy828, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy63); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; + break; + case 151: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy828 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 129: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 131: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==131); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy220, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } + case 152: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy828 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy828, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 130: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy220); } + case 153: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy828 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy828, &yymsp[-2].minor.yy63, yymsp[0].minor.yy828); } + yymsp[-5].minor.yy828 = yylhsminor.yy828; break; - case 132: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy220); } + case 155: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 444: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==444); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-1].minor.yy222, yymsp[0].minor.yy828); } + yymsp[-1].minor.yy222 = yylhsminor.yy222; break; - case 133: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } + case 156: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ +{ yylhsminor.yy828 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy669, yymsp[-8].minor.yy828, yymsp[-6].minor.yy828, yymsp[-5].minor.yy222, yymsp[-2].minor.yy222, yymsp[0].minor.yy828); } + yymsp[-9].minor.yy828 = yylhsminor.yy828; break; - case 134: /* cmd ::= ALTER TABLE alter_table_clause */ - case 335: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==335); - case 336: /* cmd ::= insert_query */ yytestcase(yyruleno==336); -{ pCxt->pRootNode = yymsp[0].minor.yy140; } + case 159: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy828 = createDropTableClause(pCxt, yymsp[-1].minor.yy669, yymsp[0].minor.yy828); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 135: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy140); } + case 160: /* specific_cols_opt ::= */ + case 191: /* tags_def_opt ::= */ yytestcase(yyruleno==191); + case 263: /* tag_list_opt ::= */ yytestcase(yyruleno==263); + case 317: /* col_list_opt ::= */ yytestcase(yyruleno==317); + case 319: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==319); + case 507: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==507); + case 532: /* group_by_clause_opt ::= */ yytestcase(yyruleno==532); + case 551: /* order_by_clause_opt ::= */ yytestcase(yyruleno==551); +{ yymsp[1].minor.yy222 = NULL; } break; - case 136: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy140 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 161: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 318: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==318); +{ yymsp[-2].minor.yy222 = yymsp[-1].minor.yy222; } break; - case 137: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 162: /* full_table_name ::= table_name */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy63, NULL); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 138: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 163: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 139: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 166: /* column_def ::= column_name type_name */ +{ yylhsminor.yy828 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy63, yymsp[0].minor.yy686, NULL); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 140: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 167: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy828 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy63, yymsp[-2].minor.yy686, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 141: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 168: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 142: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 169: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 143: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 170: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 144: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 171: /* type_name ::= INT */ + case 172: /* type_name ::= INTEGER */ yytestcase(yyruleno==172); +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 145: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy140 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy140, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + case 173: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 147: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 436: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==436); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy220 = yylhsminor.yy220; + case 174: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 148: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy140 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy587, yymsp[-8].minor.yy140, yymsp[-6].minor.yy140, yymsp[-5].minor.yy220, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-9].minor.yy140 = yylhsminor.yy140; + case 175: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 151: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy140 = createDropTableClause(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 176: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 152: /* specific_cols_opt ::= */ - case 183: /* tags_def_opt ::= */ yytestcase(yyruleno==183); - case 255: /* tag_list_opt ::= */ yytestcase(yyruleno==255); - case 309: /* col_list_opt ::= */ yytestcase(yyruleno==309); - case 311: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==311); - case 499: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==499); - case 524: /* group_by_clause_opt ::= */ yytestcase(yyruleno==524); - case 543: /* order_by_clause_opt ::= */ yytestcase(yyruleno==543); -{ yymsp[1].minor.yy220 = NULL; } + case 177: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 153: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 310: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==310); -{ yymsp[-2].minor.yy220 = yymsp[-1].minor.yy220; } + case 178: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 154: /* full_table_name ::= table_name */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy881, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 179: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 155: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 180: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 158: /* column_def ::= column_name type_name */ -{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682, NULL); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 181: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 159: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-2].minor.yy682, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 182: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy686 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 160: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 183: /* type_name ::= JSON */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 161: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 184: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 162: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 185: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 163: /* type_name ::= INT */ - case 164: /* type_name ::= INTEGER */ yytestcase(yyruleno==164); -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_INT); } + case 186: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 165: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 187: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 166: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 188: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy686 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 167: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 189: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy686 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 168: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 190: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy686 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 169: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 192: /* tags_def_opt ::= tags_def */ + case 320: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==320); + case 436: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==436); +{ yylhsminor.yy222 = yymsp[0].minor.yy222; } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; - case 170: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 193: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 321: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==321); +{ yymsp[-3].minor.yy222 = yymsp[-1].minor.yy222; } break; - case 171: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 194: /* table_options ::= */ +{ yymsp[1].minor.yy828 = createDefaultTableOptions(pCxt); } break; - case 172: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 195: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 173: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UINT); } + case 196: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 174: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 197: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 175: /* type_name ::= JSON */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_JSON); } + case 198: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-4].minor.yy828, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy222); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 176: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 199: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 177: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 200: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-4].minor.yy828, TABLE_OPTION_SMA, yymsp[-1].minor.yy222); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 178: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 201: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-2].minor.yy828, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy222); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 179: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 202: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy828 = createAlterTableOptions(pCxt); yylhsminor.yy828 = setTableOption(pCxt, yylhsminor.yy828, yymsp[0].minor.yy233.type, &yymsp[0].minor.yy233.val); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 180: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 203: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy828 = setTableOption(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy233.type, &yymsp[0].minor.yy233.val); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 204: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy233.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; - case 182: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 205: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy233.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy233.val = yymsp[0].minor.yy0; } break; - case 184: /* tags_def_opt ::= tags_def */ - case 312: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==312); - case 428: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==428); -{ yylhsminor.yy220 = yymsp[0].minor.yy220; } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 206: /* duration_list ::= duration_literal */ + case 400: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==400); +{ yylhsminor.yy222 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; - case 185: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 313: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==313); -{ yymsp[-3].minor.yy220 = yymsp[-1].minor.yy220; } + case 207: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 401: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==401); +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; break; - case 186: /* table_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultTableOptions(pCxt); } + case 210: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy828 = createFunctionNode(pCxt, &yymsp[0].minor.yy63, NULL); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 187: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 211: /* rollup_func_name ::= FIRST */ + case 212: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==212); + case 267: /* tag_item ::= QTAGS */ yytestcase(yyruleno==267); +{ yylhsminor.yy828 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 188: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 215: /* col_name ::= column_name */ + case 268: /* tag_item ::= column_name */ yytestcase(yyruleno==268); +{ yylhsminor.yy828 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy63); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 189: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 190: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy220); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 191: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 192: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_SMA, yymsp[-1].minor.yy220); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 193: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 194: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy140 = createAlterTableOptions(pCxt); yylhsminor.yy140 = setTableOption(pCxt, yylhsminor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 195: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; - break; - case 196: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy809.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 197: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 198: /* duration_list ::= duration_literal */ - case 392: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==392); -{ yylhsminor.yy220 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 199: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 393: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==393); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 202: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy881, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 203: /* rollup_func_name ::= FIRST */ - case 204: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==204); - case 259: /* tag_item ::= QTAGS */ yytestcase(yyruleno==259); -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 207: /* col_name ::= column_name */ - case 260: /* tag_item ::= column_name */ yytestcase(yyruleno==260); -{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 208: /* cmd ::= SHOW DNODES */ + case 216: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 209: /* cmd ::= SHOW USERS */ + case 217: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 210: /* cmd ::= SHOW USER PRIVILEGES */ + case 218: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 211: /* cmd ::= SHOW DATABASES */ + case 219: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 212: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } + case 220: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, OP_TYPE_LIKE); } break; - case 213: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } + case 221: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, OP_TYPE_LIKE); } break; - case 214: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy140, NULL, OP_TYPE_LIKE); } + case 222: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy828, NULL, OP_TYPE_LIKE); } break; - case 215: /* cmd ::= SHOW MNODES */ + case 223: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 216: /* cmd ::= SHOW QNODES */ + case 224: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 217: /* cmd ::= SHOW FUNCTIONS */ + case 225: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 218: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } + case 226: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy828, yymsp[-1].minor.yy828, OP_TYPE_EQUAL); } break; - case 219: /* cmd ::= SHOW STREAMS */ + case 227: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 220: /* cmd ::= SHOW ACCOUNTS */ + case 228: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 221: /* cmd ::= SHOW APPS */ + case 229: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 222: /* cmd ::= SHOW CONNECTIONS */ + case 230: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 223: /* cmd ::= SHOW LICENCES */ - case 224: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==224); + case 231: /* cmd ::= SHOW LICENCES */ + case 232: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==232); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 225: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } + case 233: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy63); } break; - case 226: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy140); } + case 234: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy828); } break; - case 227: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy140); } + case 235: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy828); } break; - case 228: /* cmd ::= SHOW QUERIES */ + case 236: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 229: /* cmd ::= SHOW SCORES */ + case 237: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 230: /* cmd ::= SHOW TOPICS */ + case 238: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 231: /* cmd ::= SHOW VARIABLES */ - case 232: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==232); + case 239: /* cmd ::= SHOW VARIABLES */ + case 240: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==240); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 233: /* cmd ::= SHOW LOCAL VARIABLES */ + case 241: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 234: /* 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.yy140); } + case 242: /* 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.yy828); } break; - case 235: /* cmd ::= SHOW BNODES */ + case 243: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 236: /* cmd ::= SHOW SNODES */ + case 244: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 237: /* cmd ::= SHOW CLUSTER */ + case 245: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 238: /* cmd ::= SHOW TRANSACTIONS */ + case 246: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 239: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy140); } + case 247: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy828); } break; - case 240: /* cmd ::= SHOW CONSUMERS */ + case 248: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 241: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 249: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 242: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } + case 250: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy828, yymsp[-1].minor.yy828, OP_TYPE_EQUAL); } break; - case 243: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140, yymsp[-3].minor.yy220); } + case 251: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy828, yymsp[-3].minor.yy222); } break; - case 244: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 252: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 245: /* cmd ::= SHOW VNODES NK_STRING */ + case 253: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 246: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy140, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 254: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy828, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 247: /* cmd ::= SHOW CLUSTER ALIVE */ + case 255: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 248: /* db_name_cond_opt ::= */ - case 253: /* from_db_opt ::= */ yytestcase(yyruleno==253); -{ yymsp[1].minor.yy140 = createDefaultDatabaseCondValue(pCxt); } + case 256: /* db_name_cond_opt ::= */ + case 261: /* from_db_opt ::= */ yytestcase(yyruleno==261); +{ yymsp[1].minor.yy828 = createDefaultDatabaseCondValue(pCxt); } break; - case 249: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 257: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy828 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 250: /* like_pattern_opt ::= */ - case 323: /* subtable_opt ::= */ yytestcase(yyruleno==323); - case 438: /* case_when_else_opt ::= */ yytestcase(yyruleno==438); - case 468: /* from_clause_opt ::= */ yytestcase(yyruleno==468); - case 497: /* where_clause_opt ::= */ yytestcase(yyruleno==497); - case 506: /* twindow_clause_opt ::= */ yytestcase(yyruleno==506); - case 512: /* sliding_opt ::= */ yytestcase(yyruleno==512); - case 514: /* fill_opt ::= */ yytestcase(yyruleno==514); - case 528: /* having_clause_opt ::= */ yytestcase(yyruleno==528); - case 530: /* range_opt ::= */ yytestcase(yyruleno==530); - case 532: /* every_opt ::= */ yytestcase(yyruleno==532); - case 545: /* slimit_clause_opt ::= */ yytestcase(yyruleno==545); - case 549: /* limit_clause_opt ::= */ yytestcase(yyruleno==549); -{ yymsp[1].minor.yy140 = NULL; } + case 259: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 251: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 260: /* table_name_cond ::= table_name */ +{ yylhsminor.yy828 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy63); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 252: /* table_name_cond ::= table_name */ -{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 262: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy828 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy63); } break; - case 254: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } + case 266: /* tag_item ::= TBNAME */ +{ yylhsminor.yy828 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 258: /* tag_item ::= TBNAME */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 269: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy828 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy63), &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 261: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy881), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 270: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy828 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy63), &yymsp[0].minor.yy63); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 262: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy881), &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 271: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy669, yymsp[-3].minor.yy828, yymsp[-1].minor.yy828, NULL, yymsp[0].minor.yy828); } break; - case 263: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy587, yymsp[-3].minor.yy140, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } + case 272: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy669, yymsp[-5].minor.yy828, yymsp[-3].minor.yy828, yymsp[-1].minor.yy222, NULL); } break; - case 264: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy140, yymsp[-1].minor.yy220, NULL); } + case 273: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy669, yymsp[0].minor.yy828); } break; - case 265: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } + case 274: /* full_index_name ::= index_name */ +{ yylhsminor.yy828 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy63); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 266: /* full_index_name ::= index_name */ -{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 275: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy828 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 267: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 276: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy828 = createIndexOption(pCxt, yymsp[-7].minor.yy222, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), NULL, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 268: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy140 = createIndexOption(pCxt, yymsp[-7].minor.yy220, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 277: /* 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.yy828 = createIndexOption(pCxt, yymsp[-9].minor.yy222, releaseRawExprNode(pCxt, yymsp[-5].minor.yy828), releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 269: /* 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.yy140 = createIndexOption(pCxt, yymsp[-9].minor.yy220, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 280: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy828 = createFunctionNode(pCxt, &yymsp[-3].minor.yy63, yymsp[-1].minor.yy222); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 272: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 286: /* sma_stream_opt ::= */ + case 322: /* stream_options ::= */ yytestcase(yyruleno==322); +{ yymsp[1].minor.yy828 = createStreamOptions(pCxt); } break; - case 278: /* sma_stream_opt ::= */ - case 314: /* stream_options ::= */ yytestcase(yyruleno==314); -{ yymsp[1].minor.yy140 = createStreamOptions(pCxt); } + case 287: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy828)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); yylhsminor.yy828 = yymsp[-2].minor.yy828; } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 279: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - case 318: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==318); -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 288: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy828)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); yylhsminor.yy828 = yymsp[-2].minor.yy828; } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 280: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 289: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy828)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); yylhsminor.yy828 = yymsp[-2].minor.yy828; } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 281: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - case 321: /* stream_options ::= stream_options DELETE_MARK duration_literal */ yytestcase(yyruleno==321); -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 290: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy669, &yymsp[-2].minor.yy63, yymsp[0].minor.yy828); } break; - case 282: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } + case 291: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy669, &yymsp[-3].minor.yy63, &yymsp[0].minor.yy63, false); } break; - case 283: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy881, false); } + case 292: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy669, &yymsp[-5].minor.yy63, &yymsp[0].minor.yy63, true); } break; - case 284: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, &yymsp[0].minor.yy881, true); } + case 293: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy669, &yymsp[-3].minor.yy63, yymsp[0].minor.yy828, false); } break; - case 285: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, yymsp[0].minor.yy140, false); } + case 294: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy669, &yymsp[-5].minor.yy63, yymsp[0].minor.yy828, true); } break; - case 286: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, yymsp[0].minor.yy140, true); } + case 295: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; - case 287: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 296: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy669, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63); } break; - case 288: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } + case 297: /* cmd ::= DESC full_table_name */ + case 298: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==298); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy828); } break; - case 289: /* cmd ::= DESC full_table_name */ - case 290: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==290); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy140); } - break; - case 291: /* cmd ::= RESET QUERY CACHE */ + case 299: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 292: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 293: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==293); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy587, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 300: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 301: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==301); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy669, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 296: /* explain_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultExplainOptions(pCxt); } + case 304: /* explain_options ::= */ +{ yymsp[1].minor.yy828 = createDefaultExplainOptions(pCxt); } break; - case 297: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy140 = setExplainVerbose(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 305: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy828 = setExplainVerbose(pCxt, yymsp[-2].minor.yy828, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 298: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy140 = setExplainRatio(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 306: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy828 = setExplainRatio(pCxt, yymsp[-2].minor.yy828, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 299: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy587, yymsp[-9].minor.yy587, &yymsp[-6].minor.yy881, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy682, yymsp[-1].minor.yy214, &yymsp[0].minor.yy881); } + case 307: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy669, yymsp[-9].minor.yy669, &yymsp[-6].minor.yy63, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy686, yymsp[-1].minor.yy332, &yymsp[0].minor.yy63); } break; - case 300: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 308: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; - case 305: /* language_opt ::= */ -{ yymsp[1].minor.yy881 = nil_token; } + case 313: /* language_opt ::= */ +{ yymsp[1].minor.yy63 = nil_token; } break; - case 306: /* language_opt ::= LANGUAGE NK_STRING */ -{ yymsp[-1].minor.yy881 = yymsp[0].minor.yy0; } + case 314: /* language_opt ::= LANGUAGE NK_STRING */ +{ yymsp[-1].minor.yy63 = yymsp[0].minor.yy0; } break; - case 307: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy587, &yymsp[-8].minor.yy881, yymsp[-5].minor.yy140, yymsp[-7].minor.yy140, yymsp[-3].minor.yy220, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, yymsp[-4].minor.yy220); } + case 315: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy669, &yymsp[-8].minor.yy63, yymsp[-5].minor.yy828, yymsp[-7].minor.yy828, yymsp[-3].minor.yy222, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, yymsp[-4].minor.yy222); } break; - case 308: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 316: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy669, &yymsp[0].minor.yy63); } break; - case 315: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 323: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 324: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==324); +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 316: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 325: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-3].minor.yy828, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 317: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy140)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy140)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-3].minor.yy140; } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 326: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 319: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy140)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy140 = yymsp[-3].minor.yy140; } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 327: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-3].minor.yy828, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 320: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 328: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 322: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy140)->ignoreUpdate = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy140 = yymsp[-3].minor.yy140; } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 329: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-2].minor.yy828, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 324: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 513: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==513); - case 533: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==533); -{ yymsp[-3].minor.yy140 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy140); } + case 330: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy828 = setStreamOptions(pCxt, yymsp[-3].minor.yy828, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 325: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 332: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 521: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==521); + case 541: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==541); +{ yymsp[-3].minor.yy828 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy828); } + break; + case 333: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 326: /* cmd ::= KILL QUERY NK_STRING */ + case 334: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 327: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 335: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 328: /* cmd ::= BALANCE VGROUP */ + case 336: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 329: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 337: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 330: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy220); } + case 338: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy222); } break; - case 331: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 339: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 332: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 340: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy222 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 334: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 342: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 337: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy140 = createInsertStmt(pCxt, yymsp[-4].minor.yy140, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } + case 345: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy828 = createInsertStmt(pCxt, yymsp[-4].minor.yy828, yymsp[-2].minor.yy222, yymsp[0].minor.yy828); } break; - case 338: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy140 = createInsertStmt(pCxt, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } + case 346: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy828 = createInsertStmt(pCxt, yymsp[-1].minor.yy828, NULL, yymsp[0].minor.yy828); } break; - case 339: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 347: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 340: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 348: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 341: /* literal ::= NK_STRING */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 349: /* literal ::= NK_STRING */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 342: /* literal ::= NK_BOOL */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 350: /* literal ::= NK_BOOL */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 343: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 351: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 344: /* literal ::= duration_literal */ - case 354: /* signed_literal ::= signed */ yytestcase(yyruleno==354); - case 375: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==375); - case 376: /* expression ::= literal */ yytestcase(yyruleno==376); - case 377: /* expression ::= pseudo_column */ yytestcase(yyruleno==377); - case 378: /* expression ::= column_reference */ yytestcase(yyruleno==378); - case 379: /* expression ::= function_expression */ yytestcase(yyruleno==379); - case 380: /* expression ::= case_when_expression */ yytestcase(yyruleno==380); - case 411: /* function_expression ::= literal_func */ yytestcase(yyruleno==411); - case 460: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==460); - case 464: /* boolean_primary ::= predicate */ yytestcase(yyruleno==464); - case 466: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==466); - case 467: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==467); - case 470: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==470); - case 472: /* table_reference ::= table_primary */ yytestcase(yyruleno==472); - case 473: /* table_reference ::= joined_table */ yytestcase(yyruleno==473); - case 477: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==477); - case 535: /* query_simple ::= query_specification */ yytestcase(yyruleno==535); - case 536: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==536); - case 539: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==539); - case 541: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==541); -{ yylhsminor.yy140 = yymsp[0].minor.yy140; } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 352: /* literal ::= duration_literal */ + case 362: /* signed_literal ::= signed */ yytestcase(yyruleno==362); + case 383: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==383); + case 384: /* expression ::= literal */ yytestcase(yyruleno==384); + case 385: /* expression ::= pseudo_column */ yytestcase(yyruleno==385); + case 386: /* expression ::= column_reference */ yytestcase(yyruleno==386); + case 387: /* expression ::= function_expression */ yytestcase(yyruleno==387); + case 388: /* expression ::= case_when_expression */ yytestcase(yyruleno==388); + case 419: /* function_expression ::= literal_func */ yytestcase(yyruleno==419); + case 468: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==468); + case 472: /* boolean_primary ::= predicate */ yytestcase(yyruleno==472); + case 474: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==474); + case 475: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==475); + case 478: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==478); + case 480: /* table_reference ::= table_primary */ yytestcase(yyruleno==480); + case 481: /* table_reference ::= joined_table */ yytestcase(yyruleno==481); + case 485: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==485); + case 543: /* query_simple ::= query_specification */ yytestcase(yyruleno==543); + case 544: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==544); + case 547: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==547); + case 549: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==549); +{ yylhsminor.yy828 = yymsp[0].minor.yy828; } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 345: /* literal ::= NULL */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 353: /* literal ::= NULL */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 346: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 354: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 347: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 355: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 348: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 356: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 349: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 357: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 350: /* signed ::= NK_MINUS NK_INTEGER */ + case 358: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 351: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 359: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 352: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 360: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 353: /* signed ::= NK_MINUS NK_FLOAT */ + case 361: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 355: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 363: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 356: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 364: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 357: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 365: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 358: /* signed_literal ::= duration_literal */ - case 360: /* signed_literal ::= literal_func */ yytestcase(yyruleno==360); - case 431: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==431); - case 493: /* select_item ::= common_expression */ yytestcase(yyruleno==493); - case 503: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==503); - case 540: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==540); - case 542: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==542); - case 555: /* search_condition ::= common_expression */ yytestcase(yyruleno==555); -{ yylhsminor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 366: /* signed_literal ::= duration_literal */ + case 368: /* signed_literal ::= literal_func */ yytestcase(yyruleno==368); + case 439: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==439); + case 501: /* select_item ::= common_expression */ yytestcase(yyruleno==501); + case 511: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==511); + case 548: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==548); + case 550: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==550); + case 563: /* search_condition ::= common_expression */ yytestcase(yyruleno==563); +{ yylhsminor.yy828 = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 359: /* signed_literal ::= NULL */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 367: /* signed_literal ::= NULL */ +{ yylhsminor.yy828 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 361: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy140 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 369: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy828 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 381: /* expression ::= NK_LP expression NK_RP */ - case 465: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==465); - case 554: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==554); -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 389: /* expression ::= NK_LP expression NK_RP */ + case 473: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==473); + case 562: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==562); +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 382: /* expression ::= NK_PLUS expr_or_subquery */ + case 390: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 383: /* expression ::= NK_MINUS expr_or_subquery */ + case 391: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy828), NULL)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 384: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 392: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 385: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 393: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 386: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 394: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 387: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 395: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 388: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 396: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 389: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 397: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 390: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 398: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 391: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 399: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 394: /* column_reference ::= column_name */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy881, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 402: /* column_reference ::= column_name */ +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy63, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy63)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 395: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 403: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63, createColumnNode(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy63)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 396: /* pseudo_column ::= ROWTS */ - case 397: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==397); - case 399: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==399); - case 400: /* pseudo_column ::= QEND */ yytestcase(yyruleno==400); - case 401: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==401); - case 402: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==402); - case 403: /* pseudo_column ::= WEND */ yytestcase(yyruleno==403); - case 404: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==404); - case 405: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==405); - case 406: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==406); - case 407: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==407); - case 413: /* literal_func ::= NOW */ yytestcase(yyruleno==413); -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 404: /* pseudo_column ::= ROWTS */ + case 405: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==405); + case 407: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==407); + case 408: /* pseudo_column ::= QEND */ yytestcase(yyruleno==408); + case 409: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==409); + case 410: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==410); + case 411: /* pseudo_column ::= WEND */ yytestcase(yyruleno==411); + case 412: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==412); + case 413: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==413); + case 414: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==414); + case 415: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==415); + case 421: /* literal_func ::= NOW */ yytestcase(yyruleno==421); +{ yylhsminor.yy828 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 398: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy881)))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 406: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy63)))); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 408: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 409: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==409); -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 416: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 417: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==417); +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy63, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy63, yymsp[-1].minor.yy222)); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 410: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy682)); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + case 418: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-1].minor.yy686)); } + yymsp[-5].minor.yy828 = yylhsminor.yy828; break; - case 412: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy881, NULL)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 420: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy63, NULL)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 427: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy220 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 435: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy222 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; - case 432: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 496: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==496); -{ yylhsminor.yy140 = createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 440: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 504: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==504); +{ yylhsminor.yy828 = createColumnNode(pCxt, &yymsp[-2].minor.yy63, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 433: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 441: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy222, yymsp[-1].minor.yy828)); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 434: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 442: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-2].minor.yy222, yymsp[-1].minor.yy828)); } + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 437: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy140 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + case 445: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy828 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828)); } break; - case 439: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } + case 447: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy828 = releaseRawExprNode(pCxt, yymsp[0].minor.yy828); } break; - case 440: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 445: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==445); + case 448: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 453: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==453); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy794, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy62, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 441: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 449: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy828), releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + yymsp[-4].minor.yy828 = yylhsminor.yy828; break; - case 442: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 450: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy828), releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + yymsp[-5].minor.yy828 = yylhsminor.yy828; break; - case 443: /* predicate ::= expr_or_subquery IS NULL */ + case 451: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), NULL)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 444: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 452: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), NULL)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 446: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_THAN; } + case 454: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy62 = OP_TYPE_LOWER_THAN; } break; - case 447: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_THAN; } + case 455: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy62 = OP_TYPE_GREATER_THAN; } break; - case 448: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_EQUAL; } + case 456: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy62 = OP_TYPE_LOWER_EQUAL; } break; - case 449: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_EQUAL; } + case 457: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy62 = OP_TYPE_GREATER_EQUAL; } break; - case 450: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy794 = OP_TYPE_NOT_EQUAL; } + case 458: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy62 = OP_TYPE_NOT_EQUAL; } break; - case 451: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy794 = OP_TYPE_EQUAL; } + case 459: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy62 = OP_TYPE_EQUAL; } break; - case 452: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy794 = OP_TYPE_LIKE; } + case 460: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy62 = OP_TYPE_LIKE; } break; - case 453: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_LIKE; } + case 461: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy62 = OP_TYPE_NOT_LIKE; } break; - case 454: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy794 = OP_TYPE_MATCH; } + case 462: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy62 = OP_TYPE_MATCH; } break; - case 455: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy794 = OP_TYPE_NMATCH; } + case 463: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy62 = OP_TYPE_NMATCH; } break; - case 456: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy794 = OP_TYPE_JSON_CONTAINS; } + case 464: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy62 = OP_TYPE_JSON_CONTAINS; } break; - case 457: /* in_op ::= IN */ -{ yymsp[0].minor.yy794 = OP_TYPE_IN; } + case 465: /* in_op ::= IN */ +{ yymsp[0].minor.yy62 = OP_TYPE_IN; } break; - case 458: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_IN; } + case 466: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy62 = OP_TYPE_NOT_IN; } break; - case 459: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 467: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy222)); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 461: /* boolean_value_expression ::= NOT boolean_primary */ + case 469: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy828), NULL)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 462: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 470: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 463: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 471: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy828); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy828); + yylhsminor.yy828 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 469: /* from_clause_opt ::= FROM table_reference_list */ - case 498: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==498); - case 529: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==529); -{ yymsp[-1].minor.yy140 = yymsp[0].minor.yy140; } + case 477: /* from_clause_opt ::= FROM table_reference_list */ + case 506: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==506); + case 537: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==537); +{ yymsp[-1].minor.yy828 = yymsp[0].minor.yy828; } break; - case 471: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy140 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 479: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy828 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy828, yymsp[0].minor.yy828, NULL); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 474: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 482: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 475: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 483: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy828 = createRealTableNode(pCxt, &yymsp[-3].minor.yy63, &yymsp[-1].minor.yy63, &yymsp[0].minor.yy63); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 476: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy140 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 484: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy828 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828), &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 478: /* alias_opt ::= */ -{ yymsp[1].minor.yy881 = nil_token; } + case 486: /* alias_opt ::= */ +{ yymsp[1].minor.yy63 = nil_token; } break; - case 480: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy881 = yymsp[0].minor.yy881; } + case 488: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy63 = yymsp[0].minor.yy63; } break; - case 481: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 482: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==482); -{ yymsp[-2].minor.yy140 = yymsp[-1].minor.yy140; } + case 489: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 490: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==490); +{ yymsp[-2].minor.yy828 = yymsp[-1].minor.yy828; } break; - case 483: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy140 = createJoinTableNode(pCxt, yymsp[-4].minor.yy852, yymsp[-5].minor.yy140, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + case 491: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy828 = createJoinTableNode(pCxt, yymsp[-4].minor.yy574, yymsp[-5].minor.yy828, yymsp[-2].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-5].minor.yy828 = yylhsminor.yy828; break; - case 484: /* join_type ::= */ -{ yymsp[1].minor.yy852 = JOIN_TYPE_INNER; } + case 492: /* join_type ::= */ +{ yymsp[1].minor.yy574 = JOIN_TYPE_INNER; } break; - case 485: /* join_type ::= INNER */ -{ yymsp[0].minor.yy852 = JOIN_TYPE_INNER; } + case 493: /* join_type ::= INNER */ +{ yymsp[0].minor.yy574 = JOIN_TYPE_INNER; } break; - case 486: /* 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 494: /* 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.yy140 = createSelectStmt(pCxt, yymsp[-10].minor.yy587, yymsp[-9].minor.yy220, yymsp[-8].minor.yy140); - yymsp[-11].minor.yy140 = addWhereClause(pCxt, yymsp[-11].minor.yy140, yymsp[-7].minor.yy140); - yymsp[-11].minor.yy140 = addPartitionByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-6].minor.yy220); - yymsp[-11].minor.yy140 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy140, yymsp[-2].minor.yy140); - yymsp[-11].minor.yy140 = addGroupByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-1].minor.yy220); - yymsp[-11].minor.yy140 = addHavingClause(pCxt, yymsp[-11].minor.yy140, yymsp[0].minor.yy140); - yymsp[-11].minor.yy140 = addRangeClause(pCxt, yymsp[-11].minor.yy140, yymsp[-5].minor.yy140); - yymsp[-11].minor.yy140 = addEveryClause(pCxt, yymsp[-11].minor.yy140, yymsp[-4].minor.yy140); - yymsp[-11].minor.yy140 = addFillClause(pCxt, yymsp[-11].minor.yy140, yymsp[-3].minor.yy140); + yymsp[-11].minor.yy828 = createSelectStmt(pCxt, yymsp[-10].minor.yy669, yymsp[-9].minor.yy222, yymsp[-8].minor.yy828); + yymsp[-11].minor.yy828 = addWhereClause(pCxt, yymsp[-11].minor.yy828, yymsp[-7].minor.yy828); + yymsp[-11].minor.yy828 = addPartitionByClause(pCxt, yymsp[-11].minor.yy828, yymsp[-6].minor.yy222); + yymsp[-11].minor.yy828 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy828, yymsp[-2].minor.yy828); + yymsp[-11].minor.yy828 = addGroupByClause(pCxt, yymsp[-11].minor.yy828, yymsp[-1].minor.yy222); + yymsp[-11].minor.yy828 = addHavingClause(pCxt, yymsp[-11].minor.yy828, yymsp[0].minor.yy828); + yymsp[-11].minor.yy828 = addRangeClause(pCxt, yymsp[-11].minor.yy828, yymsp[-5].minor.yy828); + yymsp[-11].minor.yy828 = addEveryClause(pCxt, yymsp[-11].minor.yy828, yymsp[-4].minor.yy828); + yymsp[-11].minor.yy828 = addFillClause(pCxt, yymsp[-11].minor.yy828, yymsp[-3].minor.yy828); } break; - case 489: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy587 = false; } + case 497: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy669 = false; } break; - case 492: /* select_item ::= NK_STAR */ -{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 500: /* select_item ::= NK_STAR */ +{ yylhsminor.yy828 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy828 = yylhsminor.yy828; break; - case 494: /* select_item ::= common_expression column_alias */ - case 504: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==504); -{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 502: /* select_item ::= common_expression column_alias */ + case 512: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==512); +{ yylhsminor.yy828 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828), &yymsp[0].minor.yy63); } + yymsp[-1].minor.yy828 = yylhsminor.yy828; break; - case 495: /* select_item ::= common_expression AS column_alias */ - case 505: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==505); -{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 503: /* select_item ::= common_expression AS column_alias */ + case 513: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==513); +{ yylhsminor.yy828 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), &yymsp[0].minor.yy63); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 500: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 525: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==525); - case 544: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==544); -{ yymsp[-2].minor.yy220 = yymsp[0].minor.yy220; } + case 508: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 533: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==533); + case 552: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==552); +{ yymsp[-2].minor.yy222 = yymsp[0].minor.yy222; } break; - case 507: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy140 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 515: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy828 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } break; - case 508: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy140 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 516: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy828 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } break; - case 509: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 517: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy828 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), NULL, yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 510: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 518: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy828 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy828), releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), yymsp[-1].minor.yy828, yymsp[0].minor.yy828); } break; - case 511: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy140 = createEventWindowNode(pCxt, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } + case 519: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy828 = createEventWindowNode(pCxt, yymsp[-3].minor.yy828, yymsp[0].minor.yy828); } break; - case 515: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy140 = createFillNode(pCxt, yymsp[-1].minor.yy174, NULL); } + case 523: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy828 = createFillNode(pCxt, yymsp[-1].minor.yy822, NULL); } break; - case 516: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + case 524: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy828 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy222)); } break; - case 517: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + case 525: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy828 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy222)); } break; - case 518: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy174 = FILL_MODE_NONE; } + case 526: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy822 = FILL_MODE_NONE; } break; - case 519: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy174 = FILL_MODE_PREV; } + case 527: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy822 = FILL_MODE_PREV; } break; - case 520: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy174 = FILL_MODE_NULL; } + case 528: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy822 = FILL_MODE_NULL; } break; - case 521: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy174 = FILL_MODE_NULL_F; } + case 529: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy822 = FILL_MODE_NULL_F; } break; - case 522: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy174 = FILL_MODE_LINEAR; } + case 530: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy822 = FILL_MODE_LINEAR; } break; - case 523: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy174 = FILL_MODE_NEXT; } + case 531: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy822 = FILL_MODE_NEXT; } break; - case 526: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy220 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 534: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy222 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } + yymsp[0].minor.yy222 = yylhsminor.yy222; break; - case 527: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; + case 535: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy222 = addNodeToList(pCxt, yymsp[-2].minor.yy222, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy828))); } + yymsp[-2].minor.yy222 = yylhsminor.yy222; break; - case 531: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy140 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 539: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy828 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy828), releaseRawExprNode(pCxt, yymsp[-1].minor.yy828)); } break; - case 534: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 542: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy140 = addOrderByClause(pCxt, yymsp[-3].minor.yy140, yymsp[-2].minor.yy220); - yylhsminor.yy140 = addSlimitClause(pCxt, yylhsminor.yy140, yymsp[-1].minor.yy140); - yylhsminor.yy140 = addLimitClause(pCxt, yylhsminor.yy140, yymsp[0].minor.yy140); + yylhsminor.yy828 = addOrderByClause(pCxt, yymsp[-3].minor.yy828, yymsp[-2].minor.yy222); + yylhsminor.yy828 = addSlimitClause(pCxt, yylhsminor.yy828, yymsp[-1].minor.yy828); + yylhsminor.yy828 = addLimitClause(pCxt, yylhsminor.yy828, yymsp[0].minor.yy828); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 537: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 545: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy828 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-3].minor.yy828 = yylhsminor.yy828; break; - case 538: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 546: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy828 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy828, yymsp[0].minor.yy828); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 546: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 550: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==550); -{ yymsp[-1].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 554: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 558: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==558); +{ yymsp[-1].minor.yy828 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 547: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 551: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==551); -{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 555: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 559: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==559); +{ yymsp[-3].minor.yy828 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 548: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 552: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==552); -{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 556: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 560: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==560); +{ yymsp[-3].minor.yy828 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 553: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy140); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 561: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy828 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy828); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 558: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy140 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), yymsp[-1].minor.yy866, yymsp[0].minor.yy697); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 566: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy828 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy828), yymsp[-1].minor.yy158, yymsp[0].minor.yy675); } + yymsp[-2].minor.yy828 = yylhsminor.yy828; break; - case 559: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy866 = ORDER_ASC; } + case 567: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy158 = ORDER_ASC; } break; - case 560: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy866 = ORDER_ASC; } + case 568: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy158 = ORDER_ASC; } break; - case 561: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy866 = ORDER_DESC; } + case 569: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy158 = ORDER_DESC; } break; - case 562: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy697 = NULL_ORDER_DEFAULT; } + case 570: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy675 = NULL_ORDER_DEFAULT; } break; - case 563: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy697 = NULL_ORDER_FIRST; } + case 571: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy675 = NULL_ORDER_FIRST; } break; - case 564: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy697 = NULL_ORDER_LAST; } + case 572: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy675 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index c3f6c3ac72..1af214bfb4 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -226,6 +226,7 @@ void generateDatabases(MockCatalogService* mcs) { generateTestTables(g_mockCatalogService.get(), "cache_db"); generateTestStables(g_mockCatalogService.get(), "cache_db"); mcs->createDatabase("rollup_db", true); + mcs->createDatabase("testus", false, 0, TSDB_TIME_PRECISION_NANO); } } // namespace @@ -252,7 +253,8 @@ int32_t __catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableNam return code; } -int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta) { +int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, + STableMeta** pTableMeta) { int32_t code = g_mockCatalogService->catalogGetTableMeta(pTableName, pTableMeta, true); if (code) return code; code = g_mockCatalogService->catalogGetTableHashVgroup(pTableName, pVgroup, true); diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 71b7c1a678..4d1ef597d0 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -346,12 +346,13 @@ class MockCatalogServiceImpl { dnode_.insert(std::make_pair(dnodeId, epSet)); } - void createDatabase(const string& db, bool rollup, int8_t cacheLast) { + void createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) { SDbCfgInfo cfg = {0}; if (rollup) { cfg.pRetensions = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SRetention)); } cfg.cacheLast = cacheLast; + cfg.precision = precision; dbCfg_.insert(std::make_pair(db, cfg)); } @@ -681,8 +682,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const string& host, int16_ impl_->createDnode(dnodeId, host, port); } -void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast) { - impl_->createDatabase(db, rollup, cacheLast); +void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) { + impl_->createDatabase(db, rollup, cacheLast, precision); } int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, diff --git a/source/libs/parser/test/mockCatalogService.h b/source/libs/parser/test/mockCatalogService.h index acd7fab8e1..cc955df2b0 100644 --- a/source/libs/parser/test/mockCatalogService.h +++ b/source/libs/parser/test/mockCatalogService.h @@ -65,7 +65,8 @@ class MockCatalogService { void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize); void createSmaIndex(const SMCreateSmaReq* pReq); void createDnode(int32_t dnodeId, const std::string& host, int16_t port); - void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0); + void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0, + int8_t precision = TSDB_TIME_PRECISION_MILLI); int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, bool onlyCache = false) const; int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo, bool onlyCache = false) const; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 19ed7975d0..2dffdae934 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -24,12 +24,16 @@ namespace ParserTest { class ParserInitialCTest : public ParserDdlTest {}; /* - * COMPACT DATABASE db_name + * COMPACT DATABASE db_name [START WITH start_time] [END WITH END_time] */ TEST_F(ParserInitialCTest, compact) { SCompactDbReq expect = {0}; - auto setCompactDbReq = [&](const char* pDb) { snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); }; + auto setCompactDbReq = [&](const char* pDb, int64_t start = INT64_MIN, int64_t end = INT64_MAX) { + snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); + expect.timeRange.skey = start; + expect.timeRange.ekey = end; + }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_COMPACT_DATABASE_STMT); @@ -37,10 +41,21 @@ TEST_F(ParserInitialCTest, compact) { SCompactDbReq req = {0}; ASSERT_EQ(tDeserializeSCompactDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(std::string(req.db), std::string(expect.db)); + ASSERT_EQ(req.timeRange.skey, expect.timeRange.skey); + ASSERT_EQ(req.timeRange.ekey, expect.timeRange.ekey); }); - setCompactDbReq("wxy_db"); - run("COMPACT DATABASE wxy_db"); + setCompactDbReq("test"); + run("COMPACT DATABASE test"); + + setCompactDbReq("test", 1678168883000, 1678255283000); + run("COMPACT DATABASE test START WITH '2023-03-07 14:01:23' END WITH '2023-03-08 14:01:23'"); + + setCompactDbReq("testus", 1673071283000000000); + run("COMPACT DATABASE testus START WITH TIMESTAMP '2023-01-07 14:01:23'"); + + setCompactDbReq("testus", INT64_MIN, 1675749683000000000); + run("COMPACT DATABASE testus END WITH 1675749683000000000"); } /* @@ -797,16 +812,10 @@ TEST_F(ParserInitialCTest, createStream) { snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); expect.igExists = igExists; expect.sql = taosStrdup(pSql); - expect.createStb = STREAM_CREATE_STABLE_TRUE; - expect.triggerType = STREAM_TRIGGER_AT_ONCE; - expect.maxDelay = 0; - expect.watermark = 0; - expect.fillHistory = STREAM_DEFAULT_FILL_HISTORY; - expect.igExpired = STREAM_DEFAULT_IGNORE_EXPIRED; }; auto setStreamOptions = - [&](int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t triggerType = STREAM_TRIGGER_AT_ONCE, + [&](int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t triggerType = STREAM_TRIGGER_WINDOW_CLOSE, int64_t maxDelay = 0, int64_t watermark = 0, int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED, int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY, int8_t igUpdate = STREAM_DEFAULT_IGNORE_UPDATE) { expect.createStb = createStb; @@ -868,6 +877,7 @@ TEST_F(ParserInitialCTest, createStream) { }); setCreateStreamReq("s1", "test", "create stream s1 into st3 as select count(*) from t1 interval(10s)", "st3"); + setStreamOptions(); run("CREATE STREAM s1 INTO st3 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); @@ -888,6 +898,7 @@ TEST_F(ParserInitialCTest, createStream) { "st3"); addTag("tname", TSDB_DATA_TYPE_VARCHAR, 10 + VARSTR_HEADER_SIZE); addTag("id", TSDB_DATA_TYPE_INT); + setStreamOptions(); run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " "AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, tag1 id INTERVAL(10S)"); clearCreateStreamReq(); diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp index f18dd4f17f..dfe9fcf96e 100644 --- a/source/libs/parser/test/parTestUtil.cpp +++ b/source/libs/parser/test/parTestUtil.cpp @@ -65,15 +65,16 @@ int32_t getLogLevel() { return g_logLevel; } class ParserTestBaseImpl { public: - ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) {} + ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) { + caseEnv_.numOfSkipSql_ = g_skipSql; + caseEnv_.numOfLimitSql_ = g_limitSql; + } void login(const std::string& user) { caseEnv_.user_ = user; } void useDb(const string& acctId, const string& db) { caseEnv_.acctId_ = acctId; caseEnv_.db_ = db; - caseEnv_.numOfSkipSql_ = g_skipSql; - caseEnv_.numOfLimitSql_ = g_limitSql; } void run(const string& sql, int32_t expect, ParserStage checkStage) { diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 3fe016d444..4d803cb638 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -915,6 +915,7 @@ int32_t vectorConvertSingleCol(SScalarParam *input, SScalarParam *output, int32_ SDataType t = {.type = type}; t.bytes = IS_VAR_DATA_TYPE(t.type)? input->columnData->info.bytes:tDataTypes[type].bytes; + t.precision = input->columnData->info.precision; int32_t code = sclCreateColumnInfoData(&t, input->numOfRows, output); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index f2b1db19e8..7e7c23f98a 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -278,6 +278,7 @@ int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecov msg.contLen = tlen + sizeof(SMsgHead); msg.pCont = buf; msg.msgType = TDMT_STREAM_RECOVER_FINISH; + msg.info.noResp = 1; tmsgSendReq(pEpSet, &msg); @@ -522,4 +523,3 @@ FREE: taosFreeQitem(pBlock); return code; } - diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 9226d6ebb8..cb9774b584 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -20,6 +20,11 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* pRes) { int32_t code; void* exec = pTask->exec.executor; + while(atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + qError("stream task wait for the end of fill history"); + taosMsleep(2); + continue; + } // set input const SStreamQueueItem* pItem = (const SStreamQueueItem*)data; @@ -58,6 +63,9 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* SSDataBlock* output = NULL; uint64_t ts = 0; if ((code = qExecTask(exec, &output, &ts)) < 0) { + if (code == TSDB_CODE_QRY_IN_EXEC) { + resetTaskInfo(exec); + } /*ASSERT(false);*/ qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId, terrstr()); @@ -121,8 +129,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { SSDataBlock* output = NULL; uint64_t ts = 0; if (qExecTask(exec, &output, &ts) < 0) { - taosArrayDestroy(pRes); - return -1; + continue; } if (output == NULL) { if (qStreamRecoverScanFinished(exec)) { diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index 061b211ddf..87058bf490 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -168,7 +168,7 @@ int32_t streamRestoreParam(SStreamTask* pTask) { return qStreamRestoreParam(exec); } int32_t streamSetStatusNormal(SStreamTask* pTask) { - pTask->taskStatus = TASK_STATUS__NORMAL; + atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL); return 0; } diff --git a/source/libs/sync/inc/syncReplication.h b/source/libs/sync/inc/syncReplication.h index f2e240344f..a55fd7ead3 100644 --- a/source/libs/sync/inc/syncReplication.h +++ b/source/libs/sync/inc/syncReplication.h @@ -51,7 +51,7 @@ int32_t syncNodeHeartbeatPeers(SSyncNode* pSyncNode); int32_t syncNodeSendHeartbeat(SSyncNode* pSyncNode, const SRaftId* pDestId, SRpcMsg* pMsg); int32_t syncNodeReplicate(SSyncNode* pSyncNode); -int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot); +int32_t syncNodeReplicateReset(SSyncNode* pSyncNode, SRaftId* pDestId); int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode); int32_t syncNodeSendAppendEntries(SSyncNode* pNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index b07c05dcfe..04e4859c5e 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -285,7 +285,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) { if (syncNodeIsMnode(pSyncNode)) { // mnode - logRetention = SYNC_MNODE_LOG_RETENTION; + logRetention = tsMndLogRetention; } else { // vnode if (pSyncNode->replicaNum > 1) { @@ -301,7 +301,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) { syncNodeRelease(pSyncNode); return 0; } - logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex); + logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex + logRetention); } _DEL_WAL: diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index faa44a626c..cc1a40a430 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -742,7 +742,8 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) { term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1); - if (term < 0 || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { + if ((index + 1 < firstVer) || (term < 0) || + (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); if (syncNodeStartSnapshot(pNode, &destId) < 0) { sError("vgId:%d, failed to start snapshot for peer dnode:%d", pNode->vgId, DID(&destId)); diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c index 68e735cf0d..bd15567c87 100644 --- a/source/libs/sync/src/syncRaftStore.c +++ b/source/libs/sync/src/syncRaftStore.c @@ -139,7 +139,7 @@ int32_t raftStoreWriteFile(SSyncNode *pNode) { if (taosRenameFile(file, realfile) != 0) goto _OVER; code = 0; - sInfo("vgId:%d, succeed to write raft store file:%s, len:%d", pNode->vgId, realfile, len); + sInfo("vgId:%d, succeed to write raft store file:%s, term:%" PRId64, pNode->vgId, realfile, pStore->currentTerm); _OVER: if (pJson != NULL) tjsonDelete(pJson); diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 8cdf821cff..1d94b288d3 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -48,6 +48,15 @@ int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); +int32_t syncNodeReplicateReset(SSyncNode* pNode, SRaftId* pDestId) { + SSyncLogBuffer* pBuf = pNode->pLogBuf; + taosThreadMutexLock(&pBuf->mutex); + SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId); + syncLogReplMgrReset(pMgr); + taosThreadMutexUnlock(&pBuf->mutex); + return 0; +} + int32_t syncNodeReplicate(SSyncNode* pNode) { SSyncLogBuffer* pBuf = pNode->pLogBuf; taosThreadMutexLock(&pBuf->mutex); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 381327d4d7..413d6adf05 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -992,8 +992,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return 0; } @@ -1018,8 +1017,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack"); sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq); snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return -1; } @@ -1027,8 +1025,6 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { _ERROR: snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); - + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return -1; } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 526b4bfc6f..b6f995b11e 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -13,7 +13,6 @@ */ #include "transComm.h" -#include "tutil.h" typedef struct { int32_t numOfConn; @@ -121,6 +120,9 @@ typedef struct SCliThrd { SCliMsg* stopMsg; bool quit; + + int newConnCount; + SHashObj* msgCount; } SCliThrd; typedef struct SCliObj { @@ -423,6 +425,21 @@ void cliHandleResp(SCliConn* conn) { tDebug("%s conn %p ref by app", CONN_GET_INST_LABEL(conn), conn); } + // if (TMSG_INFO(pHead->msgType - 1) != 0) { + // char buf[128] = {0}; + // sprintf(buf, "%s", TMSG_INFO(pHead->msgType - 1)); + // int* count = taosHashGet(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1))); + // if (NULL == 0) { + // int localCount = 1; + // taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount, + // sizeof(localCount)); + // } else { + // int localCount = *count - 1; + // taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount, + // sizeof(localCount)); + // } + // } + STraceId* trace = &transMsg.info.traceId; tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, code str:%s", CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), conn->dst, conn->src, pHead->msgLen, tstrerror(transMsg.code)); @@ -675,6 +692,7 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { } list->numOfConn++; } + tTrace("%s numOfConn: %d, limit: %d", pTransInst->label, list->numOfConn, pTransInst->connLimitNum); return NULL; } @@ -786,7 +804,6 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { SCliConn* conn = handle->data; SConnBuffer* pBuf = &conn->readBuf; - tTrace("%s conn %p alloc read buf", CONN_GET_INST_LABEL(conn), conn); transAllocBuffer(pBuf, buf); } static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { @@ -860,10 +877,12 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) { static void cliDestroyConn(SCliConn* conn, bool clear) { SCliThrd* pThrd = conn->hostThrd; tTrace("%s conn %p remove from conn pool", CONN_GET_INST_LABEL(conn), conn); - + conn->broken = true; QUEUE_REMOVE(&conn->q); QUEUE_INIT(&conn->q); + conn->broken = true; + if (conn->list != NULL) { SConnList* connList = conn->list; connList->list->numOfConn--; @@ -873,6 +892,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { connList->list->numOfConn--; } conn->list = NULL; + pThrd->newConnCount--; transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); @@ -1098,6 +1118,19 @@ void cliSend(SCliConn* pConn) { msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); } + // if (tmsgIsValid(pHead->msgType)) { + // char buf[128] = {0}; + // sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); + // int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + // if (NULL == 0) { + // int localCount = 1; + // taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + // } else { + // int localCount = *count + 1; + // taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + // } + // } + tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen); @@ -1173,7 +1206,8 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(pList->port); tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst); - int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4); + pThrd->newConnCount++; + int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(TAOS_SYSTEM_ERROR(errno))); @@ -1230,7 +1264,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) { } else { tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen, p->batchSize); - if (!uv_is_closing((uv_handle_t*)&conn->stream)) { + if (!uv_is_closing((uv_handle_t*)&conn->stream) && conn->broken == false) { if (nxtBatch != NULL) { conn->pBatch = nxtBatch; cliSendBatch(conn); @@ -1491,6 +1525,18 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { destroyCmsg(pMsg); return; } + if (tmsgIsValid(pMsg->msg.msgType)) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType)); + int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + if (NULL == 0) { + int localCount = 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count + 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } + } char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet); uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet); @@ -1546,6 +1592,7 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(port); tGTrace("%s conn %p try to connect to %s", pTransInst->label, conn, conn->ip); + pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4); if (fd == -1) { tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1735,6 +1782,19 @@ static void cliAsyncCb(uv_async_t* handle) { QUEUE_MOVE(&item->qmsg, &wq); taosThreadMutexUnlock(&item->mtx); + void* pIter = taosHashIterate(pThrd->msgCount, NULL); + while (pIter != NULL) { + int* count = pIter; + size_t len = 0; + char* key = taosHashGetKey(pIter, &len); + if (*count != 0) { + tDebug("key: %s count: %d", key, *count); + } + + pIter = taosHashIterate(pThrd->msgCount, pIter); + } + tDebug("all conn count: %d", pThrd->newConnCount); + int8_t supportBatch = pTransInst->supportBatch; if (supportBatch == 0) { cliNoBatchDealReq(&wq, pThrd); @@ -1969,6 +2029,9 @@ static SCliThrd* createThrdObj(void* trans) { pThrd->batchCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); pThrd->quit = false; + + pThrd->newConnCount = 0; + pThrd->msgCount = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); return pThrd; } static void destroyThrdObj(SCliThrd* pThrd) { @@ -2014,6 +2077,7 @@ static void destroyThrdObj(SCliThrd* pThrd) { pIter = (void**)taosHashIterate(pThrd->batchCache, pIter); } taosHashCleanup(pThrd->batchCache); + taosHashCleanup(pThrd->msgCount); taosMemoryFree(pThrd); } @@ -2316,6 +2380,18 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } } + if (tmsgIsValid(pResp->msgType - 1)) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); + int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + if (NULL == 0) { + int localCount = 0; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count - 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } + } if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 04e094ae9a..28fb474972 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -677,14 +677,21 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { SServerObj* pObj = container_of(stream, SServerObj, server); uv_tcp_t* cli = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); - uv_tcp_init(pObj->loop, cli); + if (cli == NULL) return; - if (uv_accept(stream, (uv_stream_t*)cli) == 0) { + int err = uv_tcp_init(pObj->loop, cli); + if (err != 0) { + tError("failed to create tcp: %s", uv_err_name(err)); + taosMemoryFree(cli); + return; + } + err = uv_accept(stream, (uv_stream_t*)cli); + if (err == 0) { #if defined(WINDOWS) || defined(DARWIN) if (pObj->numOfWorkerReady < pObj->numOfThreads) { tError("worker-threads are not ready for all, need %d instead of %d.", pObj->numOfThreads, pObj->numOfWorkerReady); - uv_close((uv_handle_t*)cli, NULL); + uv_close((uv_handle_t*)cli, uvFreeCb); return; } #endif @@ -700,8 +707,10 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb); } else { if (!uv_is_closing((uv_handle_t*)cli)) { - uv_close((uv_handle_t*)cli, NULL); + tError("failed to accept tcp: %s", uv_err_name(err)); + uv_close((uv_handle_t*)cli, uvFreeCb); } else { + tError("failed to accept tcp: %s", uv_err_name(err)); taosMemoryFree(cli); } } diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 7bfd3df9e0..3e1e36ccc1 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -200,6 +200,7 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) { pReader->curVersion, pReader->curInvalid, ver); pReader->curVersion = ver; + pReader->curInvalid = 0; return 0; } @@ -210,8 +211,8 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { return 0; } - pReader->curInvalid = 1; - pReader->curVersion = ver; +// pReader->curInvalid = 1; +// pReader->curVersion = ver; if (ver > pWal->vers.lastVer || ver < pWal->vers.firstVer) { wDebug("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId, @@ -219,8 +220,8 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; } - if (ver < pWal->vers.snapshotVer) { - } +// if (ver < pWal->vers.snapshotVer) { +// } if (walReadSeekVerImpl(pReader, ver) < 0) { return -1; @@ -239,8 +240,8 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { if (pRead->curInvalid || pRead->curVersion != fetchVer) { if (walReadSeekVer(pRead, fetchVer) < 0) { - pRead->curVersion = fetchVer; - pRead->curInvalid = 1; +// pRead->curVersion = fetchVer; +// pRead->curInvalid = 1; return -1; } seeked = true; @@ -259,11 +260,11 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } } - pRead->curInvalid = 0; +// pRead->curInvalid = 0; return 0; } @@ -295,13 +296,14 @@ static int32_t walFetchBodyNew(SWalReader *pReader) { pReader->pWal->cfg.vgId, pReader->pHead->head.version, ver); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pReader->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } if (walValidBodyCksum(pReader->pHead) != 0) { wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pReader->pWal->cfg.vgId, ver); - pReader->curInvalid = 1; +// pRead->curInvalid = 1; + terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -317,7 +319,7 @@ static int32_t walSkipFetchBodyNew(SWalReader *pRead) { code = taosLSeekFile(pRead->pLogFile, pRead->pHead->head.bodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } @@ -345,8 +347,8 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { if (pRead->curInvalid || pRead->curVersion != ver) { code = walReadSeekVer(pRead, ver); if (code < 0) { - pRead->curVersion = ver; - pRead->curInvalid = 1; +// pRead->curVersion = ver; +// pRead->curInvalid = 1; return -1; } seeked = true; @@ -366,7 +368,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } } @@ -379,7 +381,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { return -1; } - pRead->curInvalid = 0; +// pRead->curInvalid = 0; return 0; } @@ -394,7 +396,7 @@ int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) { code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } @@ -433,14 +435,14 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { pRead->pWal->cfg.vgId, pReadHead->version, ver); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } if (pReadHead->version != ver) { wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId, pReadHead->version, ver); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -448,7 +450,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { if (walValidBodyCksum(*ppHead) != 0) { wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -544,7 +546,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { if (pReader->pHead->head.version != ver) { wError("vgId:%d, unexpected wal log, index:%" PRId64 ", read request index:%" PRId64, pReader->pWal->cfg.vgId, pReader->pHead->head.version, ver); - pReader->curInvalid = 1; +// pReader->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pReader->mutex); return -1; @@ -557,7 +559,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { uint32_t readCkSum = walCalcBodyCksum(pReader->pHead->head.body, pReader->pHead->head.bodyLen); uint32_t logCkSum = pReader->pHead->cksumBody; wError("checksum written into log:%u, checksum calculated:%u", logCkSum, readCkSum); - pReader->curInvalid = 1; +// pReader->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pReader->mutex); return -1; @@ -575,5 +577,6 @@ void walReadReset(SWalReader *pReader) { taosCloseFile(&pReader->pLogFile); pReader->curInvalid = 1; pReader->curFileFirstVer = -1; + pReader->curVersion = -1; taosThreadMutexUnlock(&pReader->mutex); } diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index a992c951fa..00ad7a3d67 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -328,8 +328,8 @@ int32_t walEndSnapshot(SWal *pWal) { "), new tot size %" PRId64, pWal->cfg.vgId, iter->firstVer, iter->fileSize, iter->closeTs, newTotSize); if (((pWal->cfg.retentionSize == 0) || (pWal->cfg.retentionSize != -1 && newTotSize > pWal->cfg.retentionSize)) || - ((pWal->cfg.retentionPeriod == 0) || - (pWal->cfg.retentionPeriod != -1 && iter->closeTs + pWal->cfg.retentionPeriod > ts))) { + ((pWal->cfg.retentionPeriod == 0) || (pWal->cfg.retentionPeriod != -1 && iter->closeTs != -1 && + iter->closeTs + pWal->cfg.retentionPeriod < ts))) { // delete according to file size or close time wDebug("vgId:%d, check pass", pWal->cfg.vgId); deleteCnt++; @@ -387,20 +387,33 @@ END: int32_t walRollImpl(SWal *pWal) { int32_t code = 0; + if (pWal->pIdxFile != NULL) { + code = taosFsyncFile(pWal->pIdxFile); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto END; + } code = taosCloseFile(&pWal->pIdxFile); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto END; } } + if (pWal->pLogFile != NULL) { + code = taosFsyncFile(pWal->pLogFile); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto END; + } code = taosCloseFile(&pWal->pLogFile); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto END; } } + TdFilePtr pIdxFile, pLogFile; // create new file int64_t newFileFirstVer = pWal->vers.lastVer + 1; diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c index b466f89a1d..1c7c825ce8 100644 --- a/source/os/src/osMath.c +++ b/source/os/src/osMath.c @@ -18,20 +18,6 @@ #include #include "talgo.h" -#ifdef WINDOWS -void swapStr(char* j, char* J, int width) { - int i; - char tmp; - for (i = 0; i < width; i++) { - tmp = *j; - *j = *J; - *J = tmp; - j++; - J++; - } -} -#endif - int32_t qsortHelper(const void* p1, const void* p2, const void* param) { __compar_fn_t comparFn = param; return comparFn(p1, p2); diff --git a/source/os/src/osSleep.c b/source/os/src/osSleep.c index a2373f952f..f6cc7d608d 100644 --- a/source/os/src/osSleep.c +++ b/source/os/src/osSleep.c @@ -22,6 +22,7 @@ #endif void taosSsleep(int32_t s) { + if (s < 0) return; #ifdef WINDOWS Sleep(1000 * s); #else @@ -30,6 +31,7 @@ void taosSsleep(int32_t s) { } void taosMsleep(int32_t ms) { + if (ms < 0) return; #ifdef WINDOWS Sleep(ms); #else @@ -38,6 +40,7 @@ void taosMsleep(int32_t ms) { } void taosUsleep(int32_t us) { + if (us < 0) return; #ifdef WINDOWS HANDLE timer; LARGE_INTEGER interval; diff --git a/source/os/src/osString.c b/source/os/src/osString.c index ae4a8a5cad..0f459b58cd 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -94,21 +94,21 @@ int32_t tasoUcs4Compare(TdUcs4 *f1_ucs4, TdUcs4 *f2_ucs4, int32_t bytes) { return 0; -#if 0 - int32_t ucs4_max_len = bytes + 4; - char *f1_mbs = taosMemoryCalloc(bytes, 1); - char *f2_mbs = taosMemoryCalloc(bytes, 1); - if (taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0) { - return -1; - } - if (taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0) { - return -1; - } - int32_t ret = strcmp(f1_mbs, f2_mbs); - taosMemoryFree(f1_mbs); - taosMemoryFree(f2_mbs); - return ret; -#endif +//#if 0 +// int32_t ucs4_max_len = bytes + 4; +// char *f1_mbs = taosMemoryCalloc(bytes, 1); +// char *f2_mbs = taosMemoryCalloc(bytes, 1); +// if (taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0) { +// return -1; +// } +// if (taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0) { +// return -1; +// } +// int32_t ret = strcmp(f1_mbs, f2_mbs); +// taosMemoryFree(f1_mbs); +// taosMemoryFree(f2_mbs); +// return ret; +//#endif } TdUcs4 *tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) { diff --git a/source/os/src/osTimer.c b/source/os/src/osTimer.c index 5a57007d17..b8eb54e10e 100644 --- a/source/os/src/osTimer.c +++ b/source/os/src/osTimer.c @@ -114,27 +114,28 @@ static void *taosProcessAlarmSignal(void *tharg) { taosThreadCleanupPush(taosDeleteTimer, &timerId); - struct itimerspec ts; - ts.it_value.tv_sec = 0; - ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK; - ts.it_interval.tv_sec = 0; - ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK; + do { + struct itimerspec ts; + ts.it_value.tv_sec = 0; + ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK; + ts.it_interval.tv_sec = 0; + ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK; - if (timer_settime(timerId, 0, &ts, NULL)) { - // printf("Failed to init timer"); - return NULL; - } - - int signo; - while (!stopTimer) { - if (sigwait(&sigset, &signo)) { - // printf("Failed to wait signal: number %d", signo); - continue; + if (timer_settime(timerId, 0, &ts, NULL)) { + // printf("Failed to init timer"); + break; } - /* //printf("Signal handling: number %d ......\n", signo); */ - callback(0); - } + int signo; + while (!stopTimer) { + if (sigwait(&sigset, &signo)) { + // printf("Failed to wait signal: number %d", signo); + continue; + } + /* //printf("Signal handling: number %d ......\n", signo); */ + callback(0); + } + } while (0); taosThreadCleanupPop(1); diff --git a/source/os/test/CMakeLists.txt b/source/os/test/CMakeLists.txt index 21fb2ee630..fba4d23e3f 100644 --- a/source/os/test/CMakeLists.txt +++ b/source/os/test/CMakeLists.txt @@ -17,8 +17,64 @@ INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc) # osTests add_executable(osTests "osTests.cpp") -target_link_libraries(osTests os util gtest_main) +target_link_libraries(osTests os util gtest_main) add_test( NAME osTests COMMAND osTests +) + +add_executable(osSystemTests "osSystemTests.cpp") +target_link_libraries(osSystemTests os util gtest_main) +add_test( + NAME osSystemTests + COMMAND osSystemTests +) + +add_executable(osMathTests "osMathTests.cpp") +target_link_libraries(osMathTests os util gtest_main) +add_test( + NAME osMathTests + COMMAND osMathTests +) + +add_executable(osSignalTests "osSignalTests.cpp") +target_link_libraries(osSignalTests os util gtest_main) +add_test( + NAME osSignalTests + COMMAND osSignalTests +) + +add_executable(osSleepTests "osSleepTests.cpp") +target_link_libraries(osSleepTests os util gtest_main) +add_test( + NAME osSleepTests + COMMAND osSleepTests +) + +add_executable(osStringTests "osStringTests.cpp") +target_link_libraries(osStringTests os util gtest_main) +add_test( + NAME osStringTests + COMMAND osStringTests +) + +add_executable(osThreadTests "osThreadTests.cpp") +target_link_libraries(osThreadTests os util gtest_main) +add_test( + NAME osThreadTests + COMMAND osThreadTests +) + +add_executable(osTimeTests "osTimeTests.cpp") +target_link_libraries(osTimeTests os util gtest_main) +add_test( + NAME osTimeTests + COMMAND osTimeTests +) + +add_executable(osAtomicTests "osAtomicTests.cpp") +target_link_libraries(osAtomicTests os util gtest_main) +add_test( + NAME osAtomicTests + COMMAND osAtomicTests ) \ No newline at end of file diff --git a/source/os/test/osAtomicTests.cpp b/source/os/test/osAtomicTests.cpp new file mode 100644 index 0000000000..eebc1574c3 --- /dev/null +++ b/source/os/test/osAtomicTests.cpp @@ -0,0 +1,115 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osAtomicTests, Exchange16) { + int16_t value = 123; + int16_t new_value = 456; + int16_t result = atomic_exchange_16(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, Exchange32) { + int32_t value = 123; + int32_t new_value = 456; + int32_t result = atomic_exchange_32(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, Exchange64) { + int64_t value = 123; + int64_t new_value = 456; + int64_t result = atomic_exchange_64(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, ExchangePtr) { + int value1 = 123; + int value2 = 456; + int* ptr = &value1; + int* result = (int*)atomic_exchange_ptr(&ptr, &value2); + EXPECT_EQ(result, &value1); + EXPECT_EQ(*ptr, 456); +} + +TEST(osAtomicTests, ValCompareExchange8) { + int8_t value = 12; + int8_t oldval = 12; + int8_t newval = 45; + int8_t result = atomic_val_compare_exchange_8(&value, oldval, newval); + EXPECT_EQ(result, 12); + EXPECT_EQ(value, 45); + + oldval = 78; + result = atomic_val_compare_exchange_8(&value, oldval, newval); + EXPECT_EQ(result, 45); + EXPECT_EQ(value, 45); +} + +TEST(osAtomicTests, ValCompareExchange16) { + int16_t value = 123; + int16_t oldval = 123; + int16_t newval = 456; + int16_t result = atomic_val_compare_exchange_16(&value, oldval, newval); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); + + oldval = 789; + result = atomic_val_compare_exchange_16(&value, oldval, newval); + EXPECT_EQ(result, 456); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, TestAtomicExchange8) { + volatile int8_t value = 42; + int8_t new_value = 100; + int8_t old_value = atomic_exchange_8(&value, new_value); + EXPECT_EQ(old_value, 42); + EXPECT_EQ(value, new_value); +} + +TEST(osAtomicTests, TestAtomicAddFetch16) { + volatile int16_t value = 42; + int16_t increment = 10; + int16_t new_value = atomic_add_fetch_16(&value, increment); + EXPECT_EQ(new_value, 52); + EXPECT_EQ(value, 52); +} + +//TEST(osAtomicTests, AddFetchPtr) { +// uintptr_t val = 0; +// uintptr_t* ptr = &val; +// uintptr_t ret = atomic_add_fetch_ptr(ptr, 10); +// EXPECT_EQ(ret, 10); +// EXPECT_EQ(val, 10); +//} diff --git a/source/os/test/osMathTests.cpp b/source/os/test/osMathTests.cpp new file mode 100644 index 0000000000..93c8d1f8da --- /dev/null +++ b/source/os/test/osMathTests.cpp @@ -0,0 +1,62 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +struct TestStruct { + int a; + float b; +}; + +// Define a custom comparison function for testing +int cmpFunc(const void* a, const void* b) { + const TestStruct* pa = reinterpret_cast(a); + const TestStruct* pb = reinterpret_cast(b); + if (pa->a < pb->a) { + return -1; + } else if (pa->a > pb->a) { + return 1; + } else { + return 0; + } +} + +TEST(osMathTests, taosSort) { + // Create an array of test data + TestStruct arr[] = {{4, 2.5}, {2, 1.5}, {1, 3.5}, {3, 4.5}}; + + // Sort the array using taosSort + taosSort(arr, 4, sizeof(TestStruct), cmpFunc); + + // Check that the array is sorted correctly + EXPECT_EQ(arr[0].a, 1); + EXPECT_EQ(arr[1].a, 2); + EXPECT_EQ(arr[2].a, 3); + EXPECT_EQ(arr[3].a, 4); +} \ No newline at end of file diff --git a/source/os/test/osSignalTests.cpp b/source/os/test/osSignalTests.cpp new file mode 100644 index 0000000000..f4cc6e9e58 --- /dev/null +++ b/source/os/test/osSignalTests.cpp @@ -0,0 +1,40 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSignalTests, taosSetSignal) { + // Set up SIGINT handler using taosSetSignal + //taosSetSignal(SIGINT, sigint_handler); + + // Print PID for testing purposes + // printf("PID: %d\n", getpid()); + + // Wait for signal to be received +} diff --git a/source/os/test/osSleepTests.cpp b/source/os/test/osSleepTests.cpp new file mode 100644 index 0000000000..5faa837a0a --- /dev/null +++ b/source/os/test/osSleepTests.cpp @@ -0,0 +1,63 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSleepTests, taosUsleep) { + const int sleep_time1 = 1000; // sleep for 1000 microseconds + taosUsleep(sleep_time1); + + const int sleep_time2 = 0; // sleep for 0 microseconds + taosUsleep(sleep_time2); + + const int sleep_time3 = -1; // sleep for negative time + taosUsleep(sleep_time3); +} + +TEST(osSleepTests, taosSsleep) { + const int sleep_time1 = 1; + taosSsleep(sleep_time1); + + const int sleep_time2 = 0; + taosSsleep(sleep_time2); + + const int sleep_time3 = -1; + taosSsleep(sleep_time3); +} + +TEST(osSleepTests, taosMsleep) { + const int sleep_time1 = 1000; + taosMsleep(sleep_time1); + + const int sleep_time2 = 0; + taosMsleep(sleep_time2); + + const int sleep_time3 = -1; // sleep for negative time + taosMsleep(sleep_time3); +} diff --git a/source/os/test/osStringTests.cpp b/source/os/test/osStringTests.cpp new file mode 100644 index 0000000000..5e07636b1f --- /dev/null +++ b/source/os/test/osStringTests.cpp @@ -0,0 +1,113 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +#ifdef WINDOWS +TEST(osStringTests, strsepNormalInput) { + char str[] = "This is a test string."; + char * ptr = str; + char * tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strsepEmptyInput) { + char* str = ""; + char* ptr = str; + char* tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strsepNullInput) { + char * str = NULL; + char * ptr = str; + char * tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strndupNormalInput) { + const char s[] = "This is a test string."; + int size = strlen(s) + 1; + char * s2 = strndup(s, size); + + EXPECT_STREQ(s, s2); + + free(s2); +} +#endif + +TEST(osStringTests, osUcs4Tests1) { + TdUcs4 f1_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + TdUcs4 f2_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + + EXPECT_EQ(tasoUcs4Compare(f1_ucs4, f2_ucs4, sizeof(f1_ucs4)), 0); + + TdUcs4 f3_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0020, 0x0077, + 0x006F, 0x0072, 0x006C, 0x0064, 0x0021, 0x0000}; + TdUcs4 f4_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + + EXPECT_GT(tasoUcs4Compare(f3_ucs4, f4_ucs4, sizeof(f3_ucs4)), 0); + + TdUcs4 f5_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + TdUcs4 f6_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0020, 0x0077, + 0x006F, 0x0072, 0x006C, 0x0064, 0x0021, 0x0000}; + + EXPECT_LT(tasoUcs4Compare(f5_ucs4, f6_ucs4, sizeof(f5_ucs4)), 0); +} + +TEST(osStringTests, osUcs4lenTests2) { + TdUcs4 ucs4_1[] = {'H', 'e', 'l', 'l', 'o', '\0'}; + EXPECT_EQ(taosUcs4len(ucs4_1), 5); + + TdUcs4 ucs4_2[] = {'\0'}; + EXPECT_EQ(taosUcs4len(ucs4_2), 0); + + TdUcs4 ucs4_3[] = {'C', 'h', 'i', 'n', 'a', 0x4E2D, 0x6587, '\0'}; + EXPECT_EQ(taosUcs4len(ucs4_3), 7); +} diff --git a/source/os/test/osSystemTests.cpp b/source/os/test/osSystemTests.cpp new file mode 100644 index 0000000000..dfc92a1b72 --- /dev/null +++ b/source/os/test/osSystemTests.cpp @@ -0,0 +1,41 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSystemTest, osSystem1) { + char tmp[4096] = "test"; +#ifdef _TD_DARWIN_64 + taosLogTraceToBuf(tmp, sizeof(tmp), 4); +#elif !defined(WINDOWS) + taosLogTraceToBuf(tmp, sizeof(tmp), 3); +#else + taosLogTraceToBuf(tmp, sizeof(tmp), 8); +#endif +} diff --git a/source/os/test/osThreadTests.cpp b/source/os/test/osThreadTests.cpp new file mode 100644 index 0000000000..e7fc4f1356 --- /dev/null +++ b/source/os/test/osThreadTests.cpp @@ -0,0 +1,34 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osThreadTests, osThreadTests1) { + +} diff --git a/source/os/test/osTimeTests.cpp b/source/os/test/osTimeTests.cpp new file mode 100644 index 0000000000..366c3fc720 --- /dev/null +++ b/source/os/test/osTimeTests.cpp @@ -0,0 +1,48 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osTimeTests, taosLocalTimeNolock) { + time_t currentTime; + // Test when result is NULL + struct tm* result = taosLocalTimeNolock(NULL, ¤tTime, 0); + // Test when result is not NULL + struct tm expectedTime; + result = taosLocalTimeNolock(&expectedTime, ¤tTime, 1); + EXPECT_EQ(expectedTime.tm_year, result->tm_year); + EXPECT_EQ(expectedTime.tm_mon, result->tm_mon); + EXPECT_EQ(expectedTime.tm_mday, result->tm_mday); + EXPECT_EQ(expectedTime.tm_hour, result->tm_hour); + EXPECT_EQ(expectedTime.tm_min, result->tm_min); + EXPECT_EQ(expectedTime.tm_sec, result->tm_sec); + EXPECT_EQ(expectedTime.tm_wday, result->tm_wday); + EXPECT_EQ(expectedTime.tm_yday, result->tm_yday); + EXPECT_EQ(expectedTime.tm_isdst, result->tm_isdst); +} diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 07c0a20439..b5890d7083 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -94,6 +94,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_NO_AVAIL_DISK, "No available disk") TAOS_DEFINE_ERROR(TSDB_CODE_NOT_FOUND, "Not found") TAOS_DEFINE_ERROR(TSDB_CODE_NO_DISKSPACE, "Out of disk space") TAOS_DEFINE_ERROR(TSDB_CODE_TIMEOUT_ERROR, "Operation timeout") +TAOS_DEFINE_ERROR(TSDB_CODE_NO_ENOUGH_DISKSPACE, "No enough disk space") TAOS_DEFINE_ERROR(TSDB_CODE_APP_IS_STARTING, "Database is starting up") TAOS_DEFINE_ERROR(TSDB_CODE_APP_IS_STOPPING, "Database is closing down") @@ -434,7 +435,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_NOT_IN_TXN, "TQ meta key not in tx TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_DUP_IN_TXN, "TQ met key dup in txn") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_GROUP_NOT_SET, "TQ group not exist") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND, "TQ table schema not found") -TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no commited offset") +TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no committed offset") // wal TAOS_DEFINE_ERROR(TSDB_CODE_WAL_FILE_CORRUPTED, "WAL file is corrupted") diff --git a/source/util/src/tversion.c b/source/util/src/tversion.c index c70fdc87a6..dc357c61a1 100644 --- a/source/util/src/tversion.c +++ b/source/util/src/tversion.c @@ -89,3 +89,20 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t return -1; } } + +int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion, + int32_t comparedSegments) { + int32_t clientVersion = 0; + int32_t serverVersion = 0; + int32_t code = taosVersionStrToInt(pClientVersion, &clientVersion); + if (TSDB_CODE_SUCCESS == code) { + code = taosVersionStrToInt(pServerVersion, &serverVersion); + } + if (TSDB_CODE_SUCCESS == code) { + code = taosCheckVersionCompatible(clientVersion, serverVersion, comparedSegments); + } + if (TSDB_CODE_SUCCESS != code) { + code = terrno; + } + return code; +} \ No newline at end of file diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index e5a79074ef..5574a59ec2 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") self.restartTaosd(1, dbname='scd') @@ -60,17 +60,17 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.execute('drop database scd') diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 9938bba1b2..dfb8230cc7 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -632,6 +632,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -R +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/tb_100w_data_order.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py @@ -655,6 +657,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tagFilter.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py ,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 @@ -680,8 +683,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3 -#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3 @@ -730,7 +733,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py @@ -738,7 +741,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py +# ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py @@ -854,6 +857,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 3 @@ -952,6 +956,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 4 @@ -1070,6 +1075,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index ddb3bfaa26..360843c46c 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -45,6 +45,8 @@ class TDSimClient: "supportVnodes": "1024", "enableQueryHb": "1", "telemetryReporting": "0", + "tqDebugflag": "135", + "wDebugflag":"135", } def getLogDir(self): diff --git a/tests/script/api/insertSameTs.c b/tests/script/api/insertSameTs.c new file mode 100644 index 0000000000..ff5e4dd154 --- /dev/null +++ b/tests/script/api/insertSameTs.c @@ -0,0 +1,136 @@ +/* + * 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 . + */ + +// TAOS standard API example. The same syntax as MySQL, but only a subset +// to compile: gcc -o demo demo.c -ltaos + +#include +#include +#include +#include +#include "taos.h" // TAOS header file + +static void queryDB(TAOS *taos, char *command) { + int i; + TAOS_RES *pSql = NULL; + int32_t code = -1; + + for (i = 0; i < 5; i++) { + if (NULL != pSql) { + taos_free_result(pSql); + pSql = NULL; + } + + pSql = taos_query(taos, command); + code = taos_errno(pSql); + if (0 == code) { + break; + } + } + + if (code != 0) { + fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql)); + taos_free_result(pSql); + taos_close(taos); + exit(EXIT_FAILURE); + } + + taos_free_result(pSql); +} + +void Test(TAOS *taos, char *qstr); + +int main(int argc, char *argv[]) { + char qstr[1024]; + + // connect to server + if (argc < 2) { + printf("please input server-ip \n"); + return 0; + } + + TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0); + if (taos == NULL) { + printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/); + exit(1); + } + Test(taos, qstr); + taos_close(taos); + taos_cleanup(); +} +void Test(TAOS *taos, char *qstr) { + queryDB(taos, "drop database if exists demo"); + queryDB(taos, "create database demo vgroups 1 minrows 10"); + TAOS_RES *result; + queryDB(taos, "use demo"); + + queryDB(taos, "create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))"); + printf("success to create table\n"); + + int i = 0; + for (int32_t n = 0; n < 10; ++n) { + for (i = 0; i < 10; ++i) { + int32_t v = n * 10 + i; + sprintf(qstr, "insert into m1 values (%" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", (uint64_t)1546300800000, v, v, v, v*10000000, v*1.0, v*2.0, "hello"); + printf("qstr: %s\n", qstr); + + TAOS_RES *result1 = taos_query(taos, qstr); + if (result1 == NULL || taos_errno(result1) != 0) { + printf("failed to insert row, reason:%s\n", taos_errstr(result1)); + taos_free_result(result1); + exit(1); + } else { + printf("insert row: %i\n", v); + } + taos_free_result(result1); + + strcpy(qstr, "flush database demo"); + result1 = taos_query(taos, qstr); + if (result1 == NULL || taos_errno(result1) != 0) { + printf("failed to fluash database, reason:%s\n", taos_errstr(result1)); + taos_free_result(result1); + exit(1); + } + taos_free_result(result1); + } + } + + // query the records + sprintf(qstr, "SELECT * FROM m1 order by ts desc"); + result = taos_query(taos, qstr); + if (result == NULL || taos_errno(result) != 0) { + printf("failed to select, reason:%s\n", taos_errstr(result)); + taos_free_result(result); + exit(1); + } + + TAOS_ROW row; + int rows = 0; + int num_fields = taos_field_count(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + printf("num_fields = %d\n", num_fields); + printf("select * from table order by ts desc, result:\n"); + // fetch the records row by row + while ((row = taos_fetch_row(result))) { + char temp[1024] = {0}; + rows++; + taos_print_row(temp, row, fields, num_fields); + printf("%s\n", temp); + } + + taos_free_result(result); +} + diff --git a/tests/script/api/makefile b/tests/script/api/makefile index 75a2273f12..6739794cc8 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -14,6 +14,7 @@ exe: gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS) gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS) gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS) + gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS) clean: rm $(ROOT)batchprepare diff --git a/tests/script/tsim/dnode/offline_reason.sim b/tests/script/tsim/dnode/offline_reason.sim index 6b1686dbb4..8c4d8b47f7 100644 --- a/tests/script/tsim/dnode/offline_reason.sim +++ b/tests/script/tsim/dnode/offline_reason.sim @@ -8,10 +8,10 @@ sql connect sql create dnode $hostname port 7200 sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(2)[6] +print dnode1 off: $data(1)[7] +print dnode2 off: $data(2)[7] -if $data(2)[6] != @status not received@ then +if $data(2)[7] != @status not received@ then return -1 endi @@ -50,9 +50,9 @@ step3: return -1 endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(2)[6] -if $data(2)[6] != @status msg timeout@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(2)[7] +if $data(2)[7] != @status msg timeout@ then goto step3 endi @@ -77,9 +77,9 @@ step5: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(3)[6] -if $data(3)[6] != @dnodeId not match@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(3)[7] +if $data(3)[7] != @dnodeId not match@ then goto step5 endi @@ -98,10 +98,10 @@ step6: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(3)[6] -print dnode3 off: $data(4)[6] -if $data(4)[6] != @interval not match@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(3)[7] +print dnode3 off: $data(4)[67 +if $data(4)[7] != @interval not match@ then goto step6 endi @@ -120,11 +120,11 @@ step7: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode3 off: $data(3)[6] -print dnode4 off: $data(4)[6] -print dnode5 off: $data(5)[6] -if $data(5)[6] != @locale not match@ then +print dnode1 off: $data(1)[7] +print dnode3 off: $data(3)[7] +print dnode4 off: $data(4)[7] +print dnode5 off: $data(5)[7] +if $data(5)[7] != @locale not match@ then goto step7 endi @@ -143,12 +143,12 @@ step8: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode3 off: $data(3)[6] -print dnode4 off: $data(4)[6] -print dnode5 off: $data(5)[6] -print dnode6 off: $data(6)[6] -if $data(6)[6] != @charset not match@ then +print dnode1 off: $data(1)[7] +print dnode3 off: $data(3)[7] +print dnode4 off: $data(4)[7] +print dnode5 off: $data(5)[7] +print dnode6 off: $data(6)[7] +if $data(6)[7] != @charset not match@ then goto step8 endi diff --git a/tests/script/tsim/parser/sliding.sim b/tests/script/tsim/parser/sliding.sim index b9353e2c61..45a49fbc4e 100644 --- a/tests/script/tsim/parser/sliding.sim +++ b/tests/script/tsim/parser/sliding.sim @@ -49,9 +49,23 @@ while $i < $tbNum $nchar = $nchar . $c $nchar = $nchar . ' - sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) - $tstart = $tstart + 30 - $x = $x + 1 + $next = $tstart + 30 + $f = $x + 1 + $c1 = $f / 100 + $c1 = $c1 * 100 + $c1 = $f - $c1 + + $binary1 = ' . binary + $binary1 = $binary1 . $c1 + $binary1 = $binary1 . ' + + $nchar1 = ' . nchar + $nchar1 = $nchar1 . $c1 + $nchar1 = $nchar1 . ' + + sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) ($next , $c1 , $c1 , $c1 , $c1 , $c1 , $c1 , $c1 , $binary1 , $nchar1 ) + $tstart = $tstart + 60 + $x = $x + 2 endw $i = $i + 1 diff --git a/tests/script/tsim/stream/basic0.sim b/tests/script/tsim/stream/basic0.sim index 8e3e99978b..68c5894cbf 100644 --- a/tests/script/tsim/stream/basic0.sim +++ b/tests/script/tsim/stream/basic0.sim @@ -48,24 +48,35 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop0: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb + print rows: $rows print $data00 $data01 $data02 $data03 if $rows != 1 then - return -1 + goto loop0 endi if $data01 != 234 then - return -1 + goto loop0 endi if $data02 != 234 then - return -1 + goto loop0 endi if $data03 != 234 then print expect 234, actual $data03 - return -1 + goto loop0 endi #=================================================================== @@ -77,23 +88,34 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop1: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb + print rows: $rows print $data00 $data01 $data02 $data03 if $rows != 1 then - return -1 + goto loop1 endi if $data01 != -111 then - return -1 + goto loop1 endi if $data02 != 234 then - return -1 + goto loop1 endi if $data03 != 123 then - return -1 + goto loop1 endi #=================================================================== @@ -105,36 +127,46 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop2: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb print rows: $rows print $data00 $data01 $data02 $data03 print $data10 $data11 $data12 $data13 if $rows != 2 then - return -1 + goto loop2 endi if $data01 != -111 then - return -1 + goto loop2 endi if $data02 != 234 then - return -1 + goto loop2 endi if $data03 != 123 then - return -1 + goto loop2 endi if $data11 != 789 then - return -1 + goto loop2 endi if $data12 != 789 then - return -1 + goto loop2 endi if $data13 != 789 then - return -1 + goto loop2 endi _OVER: diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index c61c7667f8..e69875d69f 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); sql insert into t1 values(1648791233002,3,2,3,2.1); @@ -545,8 +545,8 @@ sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); sql create table t5 using st tags(2,2,2); -sql create stream streams2 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3,max(b) c4 from st partition by tbname interval(10s); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(a) c3,max(b) c4, now c5 from st partition by tbname interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3,max(b) c4 from st partition by tbname interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(a) c3,max(b) c4, now c5 from st partition by tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1,1.0) t2 values(1648791213000,2,2,2,2.0) t3 values(1648791213000,3,3,3,3.0) t4 values(1648791213000,4,4,4,4.0); @@ -667,7 +667,7 @@ sql create database test3 vgroups 1; sql use test3; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from ts1 interval(10s) ; +sql create stream stream_t3 trigger at_once IGNORE EXPIRED 0 into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from ts1 interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sleep 50 @@ -701,7 +701,7 @@ endi sql create database test4 vgroups 1; sql use test4; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from t1 where a > 5 interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from t1 where a > 5 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); $loop_count = 0 @@ -797,8 +797,8 @@ sql create database test5 vgroups 1; sql use test5; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream streams5 trigger at_once into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; -sql create stream streams6 trigger at_once into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ; +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ; sql_error create stream streams7 trigger at_once into streamt7 as select _wstart, count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; sql_error create stream streams8 trigger at_once into streamt8 as select count(*), _wstart, _wstart, _wend, max(a) from ts1 interval(10s) ; @@ -840,7 +840,7 @@ sql create database test7 vgroups 1; sql use test7; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream streams7 trigger at_once into streamt7 as select _wstart, count(*) from ts1 interval(10s) ; +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart, count(*) from ts1 interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sql_error insert into ts1 values(-1648791211000,1,2,3); @@ -887,4 +887,20 @@ if $rows != 1 then goto loop19 endi +print select * from information_schema.ins_stream_tasks; +sql select * from information_schema.ins_stream_tasks; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + +print select * from information_schema.ins_streams; +sql select * from information_schema.ins_streams; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/deleteInterval.sim b/tests/script/tsim/stream/deleteInterval.sim index 7532b2d5de..9540e448d4 100644 --- a/tests/script/tsim/stream/deleteInterval.sim +++ b/tests/script/tsim/stream/deleteInterval.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -193,7 +193,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); @@ -419,7 +419,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); diff --git a/tests/script/tsim/stream/deleteSession.sim b/tests/script/tsim/stream/deleteSession.sim index c3c64a5977..3645939178 100644 --- a/tests/script/tsim/stream/deleteSession.sim +++ b/tests/script/tsim/stream/deleteSession.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 session(ts, 5s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -191,7 +191,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); @@ -422,7 +422,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); sql insert into t1 values(1648791210000,1,1,1,NULL); sql insert into t1 values(1648791210001,2,2,2,NULL); @@ -532,8 +532,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); +print create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); sql insert into t1 values(1648791210000,1,2,3); sql insert into t1 values(1648791220000,2,2,3); diff --git a/tests/script/tsim/stream/deleteState.sim b/tests/script/tsim/stream/deleteState.sim index 45d9bc3e39..dd74b73dce 100644 --- a/tests/script/tsim/stream/deleteState.sim +++ b/tests/script/tsim/stream/deleteState.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(a); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(a); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -197,8 +197,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); +print create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); sql insert into t1 values(1648791210000,1,2,1); sql insert into t1 values(1648791220000,2,2,2); diff --git a/tests/script/tsim/stream/distributeIntervalRetrive0.sim b/tests/script/tsim/stream/distributeIntervalRetrive0.sim index ae2f9afdb5..529a2a1b30 100644 --- a/tests/script/tsim/stream/distributeIntervalRetrive0.sim +++ b/tests/script/tsim/stream/distributeIntervalRetrive0.sim @@ -44,7 +44,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -243,7 +243,7 @@ sql use test1; sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as c0, count(*) c1, count(a) c2 from st interval(10s) ; +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as c0, count(*) c1, count(a) c2 from st interval(10s) ; sql insert into t1 values(1648791211000,1,2,3); diff --git a/tests/script/tsim/stream/distributeSession0.sim b/tests/script/tsim/stream/distributeSession0.sim index d752f5c29c..25ac479a38 100644 --- a/tests/script/tsim/stream/distributeSession0.sim +++ b/tests/script/tsim/stream/distributeSession0.sim @@ -39,7 +39,7 @@ sql use test; sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; sleep 1000 diff --git a/tests/script/tsim/stream/fillHistoryBasic1.sim b/tests/script/tsim/stream/fillHistoryBasic1.sim index 772a09c017..e7a8da90e2 100644 --- a/tests/script/tsim/stream/fillHistoryBasic1.sim +++ b/tests/script/tsim/stream/fillHistoryBasic1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream stream1 trigger at_once fill_history 1 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream stream1 trigger at_once fill_history 1 IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); @@ -479,7 +479,7 @@ sql insert into t1 values(1648791233002,3,2,3,2.1); sql insert into t1 values(1648791243003,4,2,3,3.1); sql insert into t1 values(1648791213004,4,2,3,4.1); -sql create stream stream2 trigger at_once fill_history 1 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream stream2 trigger at_once fill_history 1 IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sleep 5000 sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; diff --git a/tests/script/tsim/stream/fillHistoryBasic2.sim b/tests/script/tsim/stream/fillHistoryBasic2.sim index 3af198259d..2f6c3ea92d 100644 --- a/tests/script/tsim/stream/fillHistoryBasic2.sim +++ b/tests/script/tsim/stream/fillHistoryBasic2.sim @@ -79,7 +79,7 @@ sql insert into ts3 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) sql insert into ts4 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ; sql insert into ts3 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ; -sql create stream stream_t1 trigger at_once fill_history 1 watermark 1d into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once fill_history 1 watermark 1d IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -211,7 +211,7 @@ sql insert into ts1 values(1648791222001,2,2,3); sql insert into ts2 values(1648791211000,1,2,3); sql insert into ts2 values(1648791222001,2,2,3); -sql create stream stream_t2 trigger at_once fill_history 1 watermark 20s into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; +sql create stream stream_t2 trigger at_once fill_history 1 watermark 20s IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; $loop_count = 0 loop2: @@ -241,7 +241,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; +sql create stream stream_t3 trigger at_once IGNORE EXPIRED 0 into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sleep 50 diff --git a/tests/script/tsim/stream/fillHistoryBasic3.sim b/tests/script/tsim/stream/fillHistoryBasic3.sim index db8d6bc2d0..44d7ee9d9e 100644 --- a/tests/script/tsim/stream/fillHistoryBasic3.sim +++ b/tests/script/tsim/stream/fillHistoryBasic3.sim @@ -17,7 +17,7 @@ sql create table t2 using st tags(2,2,2); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); -sql create stream streams2 trigger at_once fill_history 1 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams2 trigger at_once fill_history 1 IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sleep 3000 diff --git a/tests/script/tsim/stream/fillIntervalDelete0.sim b/tests/script/tsim/stream/fillIntervalDelete0.sim index 1c0647d57b..41b018a862 100644 --- a/tests/script/tsim/stream/fillIntervalDelete0.sim +++ b/tests/script/tsim/stream/fillIntervalDelete0.sim @@ -16,11 +16,11 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791213000,1,1,1,1.0,'aaa'); sleep 200 @@ -256,11 +256,11 @@ sql use test6; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(1,1,1); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once IGNORE EXPIRED 0 into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,1,1,1,1.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalDelete1.sim b/tests/script/tsim/stream/fillIntervalDelete1.sim index 0206b88fdc..108f5f862d 100644 --- a/tests/script/tsim/stream/fillIntervalDelete1.sim +++ b/tests/script/tsim/stream/fillIntervalDelete1.sim @@ -18,11 +18,11 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); @@ -221,11 +221,11 @@ sql use test6; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(1,1,1); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once IGNORE EXPIRED 0 into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791215000,6,8,8,8.0,'bbb'); @@ -353,11 +353,11 @@ sql drop database if exists test7; sql create database test7 vgroups 1; sql use test7; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams11 trigger at_once into streamt11 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(NULL); -sql create stream streams12 trigger at_once into streamt12 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(value,100.0,200); -sql create stream streams13 trigger at_once into streamt13 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(next); -sql create stream streams14 trigger at_once into streamt14 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(prev); -sql create stream streams15 trigger at_once into streamt15 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(linear); +sql create stream streams11 trigger at_once IGNORE EXPIRED 0 into streamt11 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(NULL); +sql create stream streams12 trigger at_once IGNORE EXPIRED 0 into streamt12 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(value,100.0,200); +sql create stream streams13 trigger at_once IGNORE EXPIRED 0 into streamt13 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(next); +sql create stream streams14 trigger at_once IGNORE EXPIRED 0 into streamt14 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(prev); +sql create stream streams15 trigger at_once IGNORE EXPIRED 0 into streamt15 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalLinear.sim b/tests/script/tsim/stream/fillIntervalLinear.sim index b9f301d81b..3fa369d8d5 100644 --- a/tests/script/tsim/stream/fillIntervalLinear.sim +++ b/tests/script/tsim/stream/fillIntervalLinear.sim @@ -16,7 +16,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); @@ -205,7 +205,7 @@ sql drop database if exists test2; sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); @@ -393,7 +393,7 @@ sql drop database if exists test3; sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); diff --git a/tests/script/tsim/stream/fillIntervalPartitionBy.sim b/tests/script/tsim/stream/fillIntervalPartitionBy.sim index 168452fdc8..6a11b9952c 100644 --- a/tests/script/tsim/stream/fillIntervalPartitionBy.sim +++ b/tests/script/tsim/stream/fillIntervalPartitionBy.sim @@ -18,11 +18,11 @@ sql use test1; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear); sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); diff --git a/tests/script/tsim/stream/fillIntervalPrevNext.sim b/tests/script/tsim/stream/fillIntervalPrevNext.sim index 99f7dcb5cb..ec963e1d4a 100644 --- a/tests/script/tsim/stream/fillIntervalPrevNext.sim +++ b/tests/script/tsim/stream/fillIntervalPrevNext.sim @@ -15,8 +15,8 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); @@ -263,8 +263,8 @@ sql drop database if exists test5; sql create database test5 vgroups 1; sql use test5; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalPrevNext1.sim b/tests/script/tsim/stream/fillIntervalPrevNext1.sim index 8058065bcf..40ef895c5a 100644 --- a/tests/script/tsim/stream/fillIntervalPrevNext1.sim +++ b/tests/script/tsim/stream/fillIntervalPrevNext1.sim @@ -16,8 +16,8 @@ sql drop database if exists test7; sql create database test7 vgroups 1; sql use test7; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), b+c, s from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), 1, b+1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), b+c, s from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), 1, b+1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); diff --git a/tests/script/tsim/stream/fillIntervalRange.sim b/tests/script/tsim/stream/fillIntervalRange.sim index a0905141f2..0e0dfb46d8 100644 --- a/tests/script/tsim/stream/fillIntervalRange.sim +++ b/tests/script/tsim/stream/fillIntervalRange.sim @@ -13,7 +13,7 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; -sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 interval(1s) fill(NULL); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, count(*) c1 from t1 interval(1s) fill(NULL); sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa'); sleep 100 sql insert into t1 values(1648795308000,1,2,3,1.0,'aaa'); @@ -126,10 +126,10 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); print create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); -sql create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); print create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); -sql create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa'); sleep 100 diff --git a/tests/script/tsim/stream/fillIntervalValue.sim b/tests/script/tsim/stream/fillIntervalValue.sim index 2cd419397f..b447e9a559 100644 --- a/tests/script/tsim/stream/fillIntervalValue.sim +++ b/tests/script/tsim/stream/fillIntervalValue.sim @@ -13,8 +13,8 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; -sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); -sql create stream streams1a trigger at_once into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); +sql create stream streams1a trigger at_once IGNORE EXPIRED 0 into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sleep 100 sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); @@ -146,7 +146,7 @@ sql drop database if exists test2; sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value, 100,200); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value, 100,200); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); @@ -280,7 +280,7 @@ sql drop database if exists test3; sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(b), a+b, c from t1 where ts >= 1648791200000 and ts < 1648791261000 interval(10s) sliding(3s) fill(value, 100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(b), a+b, c from t1 where ts >= 1648791200000 and ts < 1648791261000 interval(10s) sliding(3s) fill(value, 100,200,300); sql insert into t1 values(1648791220000,1,1,1,1.0,'aaa'); sleep 100 @@ -471,8 +471,8 @@ sql create stable st(ts timestamp,a int,b int,c int, d double, s varchar(20) ) t sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams4 trigger at_once into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL); -sql create stream streams4a trigger at_once into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL); +sql create stream streams4a trigger at_once IGNORE EXPIRED 0 into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791273000,1,2,3,1.0,'aaa'); diff --git a/tests/script/tsim/stream/ignoreCheckUpdate.sim b/tests/script/tsim/stream/ignoreCheckUpdate.sim index 7f99c534c8..2cd0117feb 100644 --- a/tests/script/tsim/stream/ignoreCheckUpdate.sim +++ b/tests/script/tsim/stream/ignoreCheckUpdate.sim @@ -12,9 +12,9 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int); -print create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); +print create stream streams0 trigger at_once IGNORE EXPIRED 0 ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); -sql create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); sql insert into t1 values(1648791213000,1,1,1); sql insert into t1 values(1648791213000,2,2,2); diff --git a/tests/script/tsim/stream/partitionby.sim b/tests/script/tsim/stream/partitionby.sim index bc2c07b951..e63459e97d 100644 --- a/tests/script/tsim/stream/partitionby.sim +++ b/tests/script/tsim/stream/partitionby.sim @@ -12,7 +12,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into test0.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into test0.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -67,7 +67,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -98,7 +98,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once watermark 20s into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; +sql create stream stream_t2 trigger at_once watermark 20s IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/partitionby1.sim b/tests/script/tsim/stream/partitionby1.sim index b29666cad7..c8bb25e0dd 100644 --- a/tests/script/tsim/stream/partitionby1.sim +++ b/tests/script/tsim/stream/partitionby1.sim @@ -11,7 +11,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -43,7 +43,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by tbname interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by tbname interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -74,7 +74,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; +sql create stream stream_t2 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/partitionbyColumnInterval.sim b/tests/script/tsim/stream/partitionbyColumnInterval.sim index 2e57e8d699..94053990e4 100644 --- a/tests/script/tsim/stream/partitionbyColumnInterval.sim +++ b/tests/script/tsim/stream/partitionbyColumnInterval.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -197,7 +197,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -284,7 +284,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -481,7 +481,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams4 trigger at_once into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,2,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); @@ -571,7 +571,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams5 trigger at_once into test.streamt5 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into test.streamt5 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); diff --git a/tests/script/tsim/stream/partitionbyColumnSession.sim b/tests/script/tsim/stream/partitionbyColumnSession.sim index 1742d52cf0..bb3f6015c7 100644 --- a/tests/script/tsim/stream/partitionbyColumnSession.sim +++ b/tests/script/tsim/stream/partitionbyColumnSession.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a session(ts, 5s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -196,7 +196,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b session(ts, 5s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -282,7 +282,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -478,7 +478,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams4 trigger at_once into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); sql insert into t1 values(1648791213000,2,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); diff --git a/tests/script/tsim/stream/partitionbyColumnState.sim b/tests/script/tsim/stream/partitionbyColumnState.sim index 75d01b17ec..62262a490c 100644 --- a/tests/script/tsim/stream/partitionbyColumnState.sim +++ b/tests/script/tsim/stream/partitionbyColumnState.sim @@ -11,7 +11,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a state_window(b); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a state_window(b); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -191,7 +191,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d int); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(d) c3, _group_key(a+b) c4 from t1 partition by a+b state_window(c); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(d) c3, _group_key(a+b) c4 from t1 partition by a+b state_window(c); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); diff --git a/tests/script/tsim/stream/schedSnode.sim b/tests/script/tsim/stream/schedSnode.sim index 2caecf50a2..6a4d6f79bb 100644 --- a/tests/script/tsim/stream/schedSnode.sim +++ b/tests/script/tsim/stream/schedSnode.sim @@ -20,7 +20,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into target.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into target.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 diff --git a/tests/script/tsim/stream/session0.sim b/tests/script/tsim/stream/session0.sim index 5e95428e0a..622c5f7c6d 100644 --- a/tests/script/tsim/stream/session0.sim +++ b/tests/script/tsim/stream/session0.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL,1); sql insert into t1 values(1648791223001,10,2,3,1.1,2); sql insert into t1 values(1648791233002,3,2,3,2.1,3); @@ -179,7 +179,7 @@ endi sql create database test2 vgroups 1; sql use test2; sql create table t2(ts timestamp, a int, b int , c int, d double, id int); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 watermark 1d into streamt2 as select _wstart,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); sql insert into t2 values(1648791213001,1,1,3,1.0,1); sql insert into t2 values(1648791213002,2,2,6,3.4,2); sql insert into t2 values(1648791213003,4,9,3,4.8,3); @@ -229,13 +229,13 @@ endi sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once watermark 1d into streamt3 as select _wstart, min(b), a,c from t1 session(ts,10s); -sql create stream streams4 trigger at_once watermark 1d into streamt4 as select _wstart, max(b), a,c from t1 session(ts,10s); -# sql create stream streams5 trigger at_once watermark 1d into streamt5 as select _wstart, top(b,3), a,c from t1 session(ts,10s); -# sql create stream streams6 trigger at_once watermark 1d into streamt6 as select _wstart, bottom(b,3), a,c from t1 session(ts,10s); -# sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); -sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), hyperloglog(a) from t1 session(ts,10s); -# sql create stream streams8 trigger at_once watermark 1d into streamt8 as select _wstart, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); +sql create stream streams3 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt3 as select _wstart, min(b), a,c from t1 session(ts,10s); +sql create stream streams4 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt4 as select _wstart, max(b), a,c from t1 session(ts,10s); +# sql create stream streams5 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt5 as select _wstart, top(b,3), a,c from t1 session(ts,10s); +# sql create stream streams6 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt6 as select _wstart, bottom(b,3), a,c from t1 session(ts,10s); +# sql create stream streams7 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt7 as select _wstart, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); +sql create stream streams7 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt7 as select _wstart, spread(a), hyperloglog(a) from t1 session(ts,10s); +# sql create stream streams8 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt8 as select _wstart, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); sql insert into t1 values(1648791213001,1,1,1,1.0); sql insert into t1 values(1648791213002,2,3,2,3.4); sql insert into t1 values(1648791213003,4,9,3,4.8); diff --git a/tests/script/tsim/stream/session1.sim b/tests/script/tsim/stream/session1.sim index f535fd619f..3ad7c6f04e 100644 --- a/tests/script/tsim/stream/session1.sim +++ b/tests/script/tsim/stream/session1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams2 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791210000,1,1,1,1.1,1); sql insert into t1 values(1648791220000,2,2,2,2.1,2); sql insert into t1 values(1648791230000,3,3,3,3.1,3); @@ -200,7 +200,7 @@ endi sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1 from t1 where a > 5 session(ts, 5s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1 from t1 where a > 5 session(ts, 5s); sql insert into t1 values(1648791213000,1,2,3,1.0); $loop_count = 0 diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 8287274cd2..e12e3c6686 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -17,10 +17,10 @@ sql use test; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); -sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream streams2 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream stream_t2 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); sql insert into t1 values(1648791210000,1,2,3,1.0); sql insert into t1 values(1648791216000,2,2,3,1.1); @@ -309,8 +309,8 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams11 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); -sql create stream streams12 trigger at_once into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sql create stream streams11 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams12 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); @@ -442,9 +442,9 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams21 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); -sql create stream streams22 trigger at_once into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); -sql create stream streams23 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); +sql create stream streams21 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams22 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sql create stream streams23 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791223001,2,2,2,1.1); @@ -683,7 +683,7 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791243000,2,1,1,1.0); diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim index 07abdc0040..d009f742b7 100644 --- a/tests/script/tsim/stream/state0.sim +++ b/tests/script/tsim/stream/state0.sim @@ -17,9 +17,9 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams1 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); +print create stream streams1 trigger at_once IGNORE EXPIRED 0 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); -sql create stream streams1 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); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 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); sql insert into t1 values(1648791213000,1,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,2); @@ -453,9 +453,9 @@ sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print 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); +print create stream streams2 trigger at_once IGNORE EXPIRED 0 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); -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); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 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); sql insert into t1 values(1648791212000,2,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,1); @@ -501,9 +501,9 @@ sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); +print create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 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); @@ -553,9 +553,9 @@ sql create table st (ts timestamp, c1 tinyint, c2 smallint) tags (t1 tinyint) ; sql create table t1 using st tags (-81) ; sql create table t2 using st tags (-81) ; -print create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); +print create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0 into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); -sql create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); +sql create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0 into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); sql insert into t1 (ts, c1) values (1668073288209, 11); sql insert into t1 (ts, c1) values (1668073288210, 11); @@ -742,9 +742,9 @@ sql create table tb (ts timestamp, a int); sql insert into tb values (now + 1m , 1 ); sql create table b (c timestamp, d int, e int , f int, g double); -print create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); +print create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); sql insert into b values(1648791213000,NULL,NULL,NULL,NULL); sql select * from streamt order by c1, c2, c3; diff --git a/tests/script/tsim/stream/triggerInterval0.sim b/tests/script/tsim/stream/triggerInterval0.sim index b522dcf035..1c62f689ac 100644 --- a/tests/script/tsim/stream/triggerInterval0.sim +++ b/tests/script/tsim/stream/triggerInterval0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger window_close into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger window_close IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213001,1,2,3,1.0); sleep 300 diff --git a/tests/script/tsim/stream/triggerSession0.sim b/tests/script/tsim/stream/triggerSession0.sim index 4c664cf7c7..81a016be2b 100644 --- a/tests/script/tsim/stream/triggerSession0.sim +++ b/tests/script/tsim/stream/triggerSession0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test; sql create table t2(ts timestamp, a int, b int , c int, d double); -sql create stream streams2 trigger window_close into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); +sql create stream streams2 trigger window_close IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); sql insert into t2 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791222999,1,2,3,1.0); diff --git a/tests/script/tsim/stream/udTableAndTag0.sim b/tests/script/tsim/stream/udTableAndTag0.sim index 8bf34dc54c..e3ab344bbe 100644 --- a/tests/script/tsim/stream/udTableAndTag0.sim +++ b/tests/script/tsim/stream/udTableAndTag0.sim @@ -20,8 +20,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -#sql_error create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE(concat("aaa-", tbname)) as select _wstart, count(*) c1 from st partition by tbname interval(10s); +#sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE(concat("aaa-", tbname)) as select _wstart, count(*) c1 from st partition by tbname interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -88,7 +88,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as cc interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as cc interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -173,7 +173,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -285,7 +285,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); @@ -404,7 +404,7 @@ sql create table t1 using st tags("1",1,1); sql create table t2 using st tags("2",2,2); sql create table t3 using st tags("3",3,3); -sql create stream streams6 trigger at_once into result6.streamt6 TAGS(dd int) as select _wstart, count(*) c1 from st partition by concat(ta, "0") as dd, tbname interval(10s); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into result6.streamt6 TAGS(dd int) as select _wstart, count(*) c1 from st partition by concat(ta, "0") as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); diff --git a/tests/script/tsim/stream/udTableAndTag1.sim b/tests/script/tsim/stream/udTableAndTag1.sim index 4229de2cf0..fbedaa6e4e 100644 --- a/tests/script/tsim/stream/udTableAndTag1.sim +++ b/tests/script/tsim/stream/udTableAndTag1.sim @@ -20,8 +20,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -#sql_error create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE( concat("aaa-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by a interval(10s); +#sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE( concat("aaa-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by a interval(10s); print ===== insert into 1 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -87,7 +87,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as cc interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as cc interval(10s); print ===== insert into 2 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -171,7 +171,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as dd, a interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as dd, a interval(10s); print ===== insert into 3 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -283,7 +283,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", dd)) as select _wstart, count(*) c1 from st partition by concat("t", cast(a as varchar(10) ) ) as dd interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", dd)) as select _wstart, count(*) c1 from st partition by concat("t", cast(a as varchar(10) ) ) as dd interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); diff --git a/tests/script/tsim/stream/udTableAndTag2.sim b/tests/script/tsim/stream/udTableAndTag2.sim index bacc301ad0..c0e72712df 100644 --- a/tests/script/tsim/stream/udTableAndTag2.sim +++ b/tests/script/tsim/stream/udTableAndTag2.sim @@ -20,7 +20,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 1 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -93,7 +93,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 2 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -195,7 +195,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1") ) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1") ) as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 3 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -305,7 +305,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1")) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1")) as select _wstart, count(*) c1 from st interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); @@ -375,9 +375,9 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams51 trigger at_once into result5.streamt51 SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams52 trigger at_once into result5.streamt52 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams53 trigger at_once into result5.streamt53 TAGS(dd varchar(100)) SUBTABLE(concat("aaa-", "1") ) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams51 trigger at_once IGNORE EXPIRED 0 into result5.streamt51 SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams52 trigger at_once IGNORE EXPIRED 0 into result5.streamt52 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams53 trigger at_once IGNORE EXPIRED 0 into result5.streamt53 TAGS(dd varchar(100)) SUBTABLE(concat("aaa-", "1") ) as select _wstart, count(*) c1 from st interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); diff --git a/tests/script/tsim/tag/tbNameIn.sim b/tests/script/tsim/tag/tbNameIn.sim index 1af4bd6a9e..f5119208ba 100644 --- a/tests/script/tsim/tag/tbNameIn.sim +++ b/tests/script/tsim/tag/tbNameIn.sim @@ -99,4 +99,14 @@ if $rows != 7 then return -1 endi +sql select * from st1 where tbname in('tb1') and tbname in ('tb2'); +if $rows != 0 then + return -1 +endi + +sql select * from st1 where tbname in ('tb1') and tbname != 'tb1'; +if $rows != 0 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/consume.sh b/tests/script/tsim/tmq/consume.sh index 001ce6ae49..f0c9197a59 100755 --- a/tests/script/tsim/tmq/consume.sh +++ b/tests/script/tsim/tmq/consume.sh @@ -79,15 +79,15 @@ CFG_DIR=$PRG_DIR/cfg LOG_DIR=$PRG_DIR/log echo "------------------------------------------------------------------------" +echo "TOP_DIR: $TOP_DIR" echo "BUILD_DIR: $BUILD_DIR" echo "SIM_DIR : $SIM_DIR" echo "CFG_DIR : $CFG_DIR" - -echo "PROGRAM: $PROGRAM -echo "CFG_DIR: $CFG_DIR -echo "POLL_DELAY: $POLL_DELAY -echo "DB_NAME: $DB_NAME +echo "PROGRAM: $PROGRAM" +echo "CFG_DIR: $CFG_DIR" +echo "POLL_DELAY: $POLL_DELAY" +echo "DB_NAME: $DB_NAME" echo "------------------------------------------------------------------------" if [ "$EXEC_OPTON" = "start" ]; then diff --git a/tests/script/tsim/trans/create_stb.sim b/tests/script/tsim/trans/create_stb.sim new file mode 100644 index 0000000000..94041645d5 --- /dev/null +++ b/tests/script/tsim/trans/create_stb.sim @@ -0,0 +1,72 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode2 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode3 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode4 -c transPullupInterval -v 1 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start +sql connect + +print =============== step1: create dnodes +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi +sql select * from information_schema.ins_dnodes -x step1 +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi + +print =============== step2: create mnode 2 and 3 +sql create mnode on dnode 2 +sql create mnode on dnode 3 +sql create database db vgroups 2 + +print =============== step3: kill dnode4 +system sh/exec.sh -n dnode4 -s stop -x SIGKILL +sql use db +sql_error create table stb (ts timestamp, i int) tags (j int) + +print =============== step4: create database +sql show transactions +if $rows != 1 then + return -1 +endi + +sleep 3000 +system sh/exec.sh -n dnode4 -s start + +$wt = 0 +step4: +$wt = $wt + 1 +sleep 1000 +if $wt == 200 then + print ====> transaction already running + return -1 +endi + +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto step4 +endi + diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index a5cded7a6b..21d307ce37 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -3,6 +3,8 @@ import taos import sys import os import time +import inspect +from taos.tmq import Consumer from pathlib import Path from util.log import * @@ -99,6 +101,7 @@ class TDTestCase: def run(self): + scriptsPath = os.path.dirname(os.path.realpath(__file__)) distro_id = distro.id() if distro_id == "alpine": tdLog.info(f"alpine skip compatibility test") @@ -128,19 +131,18 @@ class TDTestCase: tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{BASEVERSION}") tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") - sleep(3) + os.system(f"LD_LIBRARY_PATH=/usr/lib taos -s 'use test;create stream current_stream into current_stream_output_stb as select _wstart as `start`, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);' ") + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;create stream power_stream into power_stream_output_stb as select ts, concat_ws(\\".\\", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname;" ') + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show streams;" ') + os.system(f"sed -i 's/\/etc\/taos/{cPath}/' 0-others/tmqBasic.json ") + # os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/tmqBasic.json -y ") + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "create topic if not exists tmq_test_topic as select current,voltage,phase from test.meters where voltage <= 106 and current <= 5;" ') + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show topics;" ') - # tdsqlF.query(f"select count(*) from {stb}") - # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) - os.system("pkill taosd") - self.checkProcessPid("taosd") - - print(f"start taosd: nohup taosd -c {cPath} & ") - os.system(f" nohup taosd -c {cPath} & " ) - sleep(10) tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ") os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y") - os.system("pkill taosd") # make sure all the data are saved in disk. + os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database db4096 '") + os.system("pkill taosd") # make sure all the data are saved in disk. self.checkProcessPid("taosd") @@ -161,10 +163,12 @@ class TDTestCase: tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") tdsql.query(f"select count(*) from {stb}") - tdsql.checkData(0,0,tableNumbers*recordNumbers1) - os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") - tdsql.query(f"select count(*) from {stb}") - tdsql.checkData(0,0,tableNumbers*recordNumbers2) + tdsql.checkData(0,0,tableNumbers*recordNumbers1) + # tdsql.query("show streams;") + # os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") + # tdsql.query("show streams;") + # tdsql.query(f"select count(*) from {stb}") + # tdsql.checkData(0,0,tableNumbers*recordNumbers2) tdsql.query(f"select count(*) from db4096.stb0") tdsql.checkData(0,0,50000) @@ -183,13 +187,58 @@ class TDTestCase: tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);") tdsql.query("select * from db.ct4") tdsql.checkData(0,1,14) + print(1) + tdsql=tdCom.newTdSql() tdsql.query("describe information_schema.ins_databases;") qRows=tdsql.queryRows - for i in range(qRows) : - if tdsql.queryResult[i][0]=="retentions" : - return True - else: - return False + comFlag=True + j=0 + while comFlag: + for i in range(qRows) : + if tdsql.queryResult[i][0] == "retentions" : + print("parameters include retentions") + comFlag=False + break + else : + comFlag=True + j=j+1 + if j == qRows: + print("parameters don't include retentions") + caller = inspect.getframeinfo(inspect.stack()[0][0]) + args = (caller.filename, caller.lineno) + tdLog.exit("%s(%d) failed" % args) + tdsql.query("show streams;") + tdsql.checkRows(2) + tdsql.execute("insert into test.d80 values (now+1s, 11, 103, 0.21);") + tdsql.execute("insert into test.d9 values (now+5s, 4.3, 104, 0.4);") + + conn = taos.connect() + + consumer = Consumer( + { + "group.id": "tg75", + "client.id": "124", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "enable.auto.commit": "true", + "experimental.snapshot.enable": "true", + } + ) + consumer.subscribe(["tmq_test_topic"]) + + while True: + res = consumer.poll(10) + if not res: + break + err = res.error() + if err is not None: + raise err + val = res.value() + + for block in val: + print(block.fetchall()) + tdsql.query("show topics;") + tdsql.checkRows(1) def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index b5d6a0d1a3..3e176fe251 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -11,14 +11,13 @@ # -*- coding: utf-8 -*- - +import re from util.log import * from util.cases import * from util.sql import * from util.common import * from util.sqlset import * - class TDTestCase: def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) @@ -28,10 +27,35 @@ class TDTestCase: self.ins_param_list = ['dnodes','mnodes','qnodes','cluster','functions','users','grants','topics','subscriptions','streams'] self.perf_param = ['apps','connections','consumers','queries','transactions'] self.perf_param_list = ['apps','connections','consumers','queries','trans'] - + self.dbname = "db" + self.vgroups = 10 + self.stbname = f'`{tdCom.getLongName(5)}`' + self.tbname = f'`{tdCom.getLongName(3)}`' + self.db_param = { + "database":f"{self.dbname}", + "buffer":100, + "cachemodel":"'none'", + "cachesize":1, + "comp":2, + "maxrows":1000, + "minrows":200, + "pages":512, + "pagesize":16, + "precision":"'ms'", + "replica":1, + "wal_level":1, + "wal_fsync_period":6000, + "wal_roll_period":0, + "wal_segment_size":1024, + "vgroups":self.vgroups, + "stt_trigger":1, + "tsdb_pagesize":16 + } def ins_check(self): tdSql.prepare() for param in self.ins_param_list: + if param.lower() == 'qnodes': + tdSql.execute('create qnode on dnode 1') tdSql.query(f'show {param}') show_result = tdSql.queryResult tdSql.query(f'select * from information_schema.ins_{param}') @@ -59,11 +83,32 @@ class TDTestCase: tag_sql += f"{k} {v}, " create_stb_sql = f'create stable {stbname} ({column_sql[:-2]}) tags ({tag_sql[:-2]})' return create_stb_sql - def show_sql(self): - tdSql.prepare() - tdSql.execute('use db') - stbname = f'`{tdCom.getLongName(5)}`' - tbname = f'`{tdCom.getLongName(3)}`' + + def set_create_database_sql(self,sql_dict): + create_sql = 'create' + for key,value in sql_dict.items(): + create_sql += f' {key} {value}' + return create_sql + def show_create_sql(self): + create_db_sql = self.set_create_database_sql(self.db_param) + print(create_db_sql) + tdSql.execute(create_db_sql) + tdSql.query(f'show create database {self.dbname}') + tdSql.checkEqual(self.dbname,tdSql.queryResult[0][0]) + for key,value in self.db_param.items(): + if key == 'database': + continue + else: + param = f'{key} {value}' + if param in tdSql.queryResult[0][1].lower(): + tdLog.info(f'show create database check success with {key} {value}') + continue + else: + tdLog.exit(f"show create database check failed with {key} {value}") + tdSql.query('show vnodes 1') + tdSql.checkRows(self.vgroups) + tdSql.execute(f'use {self.dbname}') + column_dict = { '`ts`': 'timestamp', '`col1`': 'tinyint', @@ -98,25 +143,56 @@ class TDTestCase: '`t14`': 'timestamp' } - create_table_sql = self.set_stb_sql(stbname,column_dict,tag_dict) + create_table_sql = self.set_stb_sql(self.stbname,column_dict,tag_dict) tdSql.execute(create_table_sql) - tdSql.query(f'show create table {stbname}') + tdSql.query(f'show create stable {self.stbname}') query_result = tdSql.queryResult tdSql.checkEqual(query_result[0][1].lower(),create_table_sql) - tdSql.execute(f'create table {tbname} using {stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)') + tdSql.execute(f'create table {self.tbname} using {self.stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)') tag_sql = '(' for tag_keys in tag_dict.keys(): tag_sql += f'{tag_keys}, ' tags = f'{tag_sql[:-2]})' - sql = f'create table {tbname} using {stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)' - tdSql.query(f'show create table {tbname}') + sql = f'create table {self.tbname} using {self.stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)' + tdSql.query(f'show create table {self.tbname}') query_result = tdSql.queryResult tdSql.checkEqual(query_result[0][1].lower(),sql) - tdSql.execute('drop database db') + tdSql.execute(f'drop database {self.dbname}') + def check_gitinfo(self): + taosd_gitinfo_sql = '' + tdSql.query('show dnode 1 variables') + for i in tdSql.queryResult: + if i[1].lower() == "gitinfo": + taosd_gitinfo_sql = f"gitinfo: {i[2]}" + taos_gitinfo_sql = '' + tdSql.query('show local variables') + for i in tdSql.queryResult: + if i[0].lower() == "gitinfo": + taos_gitinfo_sql = f"gitinfo: {i[1]}" + taos_info = os.popen('taos -V').read() + taos_gitinfo = re.findall("^gitinfo.*",taos_info,re.M) + tdSql.checkEqual(taos_gitinfo_sql,taos_gitinfo[0]) + taosd_info = os.popen('taosd -V').read() + taosd_gitinfo = re.findall("^gitinfo.*",taosd_info,re.M) + tdSql.checkEqual(taosd_gitinfo_sql,taosd_gitinfo[0]) + + def show_base(self): + for sql in ['dnodes','mnodes','cluster']: + tdSql.query(f'show {sql}') + print(tdSql.queryResult) + tdSql.checkRows(1) + tdSql.query('show grants') + grants_info = tdSql.queryResult + tdSql.query('show licences') + licences_info = tdSql.queryResult + tdSql.checkEqual(grants_info,licences_info) + def run(self): + self.check_gitinfo() + self.show_base() self.ins_check() self.perf_check() - self.show_sql() + self.show_create_sql() def stop(self): tdSql.close() @@ -124,4 +200,3 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) - diff --git a/tests/system-test/0-others/testRoll.py b/tests/system-test/0-others/testRoll.py new file mode 100644 index 0000000000..56e5b3630a --- /dev/null +++ b/tests/system-test/0-others/testRoll.py @@ -0,0 +1,83 @@ +from taos.tmq import Consumer +import taos +import taosrest +import socket + + +def init_tmq_env(db, topic): + conn = taos.connect() + # conn.execute("create dnode test209") + # conn.execute("create dnode test216") + # conn.execute("create mnode on dnode 2") + # conn.execute("create mnode on dnode 3") + + conn.execute("drop topic if exists {}".format(topic)) + conn.execute("drop database if exists {}".format(db)) + conn.execute("create database if not exists {} replica 1 ".format(db)) + conn.select_db(db) + conn.execute( + "create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))") + conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')") + conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')") + conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')") + conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic)) + conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')") + conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')") + conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')") + conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')") + +def init_tmq_rest_env(db, topic): + host = socket.gethostname() + conn = taosrest.connect(url=f"http://{host}:6041") + + # conn.execute("create dnode test209") + # conn.execute("create dnode test216") + # conn.execute("create mnode on dnode 2") + # conn.execute("create mnode on dnode 3") + + conn.execute("drop topic if exists {}".format(topic)) + conn.execute("drop database if exists {}".format(db)) + conn.execute("create database if not exists {} replica 3 ".format(db)) + conn.select_db(db) + conn.execute( + "create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))") + conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')") + conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')") + conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')") + conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic)) + conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')") + conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')") + conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')") + conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')") + + + + +if __name__ == '__main__': + conn = taos.connect() + + init_tmq_env("tmq_test", "tmq_test_topic") # init env + # init_tmq_rest_env("tmq_test", "tmq_test_topic") + consumer = Consumer( + { + "group.id": "tg75", + "client.id": "124", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "enable.auto.commit": "true", + "experimental.snapshot.enable": "true", + } + ) + consumer.subscribe(["tmq_test_topic"]) + + while True: + res = consumer.poll(10) + if not res: + break + err = res.error() + if err is not None: + raise err + val = res.value() + + for block in val: + print(block.fetchall()) \ No newline at end of file diff --git a/tests/system-test/0-others/tmqBasic.json b/tests/system-test/0-others/tmqBasic.json new file mode 100644 index 0000000000..24e815708a --- /dev/null +++ b/tests/system-test/0-others/tmqBasic.json @@ -0,0 +1,24 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "tmq_info": { + "concurrent": 1, + "poll_delay": 10000, + "group.id": "grpId_0", + "client.id": "clientId", + "auto.offset.reset": "earliest", + "enable.auto.commit": "true", + "auto.commit.interval.ms": 1000, + "enable.heartbeat.background": "true", + "experimental.snapshot.enable": "true", + "msg.with.table.name": "false", + "topic_list": [ + {"name": "tmq_topic_1", "sql": "select current,voltage,phase from test.meters where voltage <= 106 ;"} + ] + } +} \ No newline at end of file diff --git a/tests/system-test/1-insert/database_pre_suf.py b/tests/system-test/1-insert/database_pre_suf.py index 488dfebff5..a6ff95ab3f 100755 --- a/tests/system-test/1-insert/database_pre_suf.py +++ b/tests/system-test/1-insert/database_pre_suf.py @@ -108,7 +108,7 @@ class TDTestCase: # create stream - tdSql.execute('''create stream current_stream into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') + tdSql.execute('''create stream current_stream trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') # insert data for i in range(num_random*n): diff --git a/tests/system-test/1-insert/drop.py b/tests/system-test/1-insert/drop.py index c15a9bbc35..a8bfea2741 100644 --- a/tests/system-test/1-insert/drop.py +++ b/tests/system-test/1-insert/drop.py @@ -138,14 +138,14 @@ class TDTestCase: stream_name = tdCom.getLongName(5,"letters") tdSql.execute(f'create table {stbname} (ts timestamp,c0 int) tags(t0 int)') tdSql.execute(f'create table tb using {stbname} tags(1)') - tdSql.execute(f'create stream {stream_name} into stb as select * from {self.dbname}.{stbname} partition by tbname') + tdSql.execute(f'create stream {stream_name} trigger at_once ignore expired 0 into stb as select * from {self.dbname}.{stbname} partition by tbname') tdSql.query(f'select * from information_schema.ins_streams where stream_name = "{stream_name}"') print(tdSql.queryResult) - tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} into stb as select * from {self.dbname}.{stbname} partition by tbname') + tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} trigger at_once ignore expired 0 into stb as select * from {self.dbname}.{stbname} partition by tbname') tdSql.execute(f'drop stream {stream_name}') - tdSql.execute(f'create stream {stream_name} into stb1 as select * from tb') + tdSql.execute(f'create stream {stream_name} trigger at_once ignore expired 0 into stb1 as select * from tb') tdSql.query(f'select * from information_schema.ins_streams where stream_name = "{stream_name}"') - tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} into stb1 as select * from tb') + tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} trigger at_once ignore expired 0 into stb1 as select * from tb') tdSql.execute(f'drop database {self.dbname}') def run(self): self.drop_ntb_check() diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py index 2325b01c35..f26f0abda0 100644 --- a/tests/system-test/2-query/odbc.py +++ b/tests/system-test/2-query/odbc.py @@ -22,7 +22,7 @@ class TDTestCase: tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)") tdSql.query("select count(*) from information_schema.ins_columns") - tdSql.checkData(0, 0, 269) + tdSql.checkData(0, 0, 271) tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'") tdSql.checkRows(14) diff --git a/tests/system-test/2-query/projectionDesc.py b/tests/system-test/2-query/projectionDesc.py new file mode 100644 index 0000000000..1edceaa6f2 --- /dev/null +++ b/tests/system-test/2-query/projectionDesc.py @@ -0,0 +1,48 @@ +from wsgiref.headers import tspecials +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.batchNum = 5 + self.ts = 1537146000000 + + def run(self): + dbname = "db" + tdSql.prepare() + + intData = [] + floatData = [] + + tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')") + for n in range(self.batchNum): + for i in range(self.rowNum): + tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + intData.append(i + 1) + floatData.append(i + 0.1) + tdSql.execute(f"flush database {dbname}") + + tdSql.query(f"select * from {dbname}.stb_1 order by ts desc") + tdSql.checkRows(1) + #tdSql.checkData(0,0,1537146000000) + tdSql.checkData(0,1,10) + + tdSql.query(f"select * from {dbname}.stb_1 order by 'aaa' desc") + + 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/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index 106d43ea38..4f415550b8 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -86,7 +86,7 @@ class TDTestCase: self.ctbNums=ctbNums rowNUms=5000 ts=1451606400000 - tdSql.execute(f"create database {dbname};") + tdSql.execute(f"create database {dbname} cachemodel 'both';") tdSql.execute(f"use {dbname} ") tdSql.execute(f''' create table {stabname1} (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30),load_capacity double,fuel_capacity double,nominal_fuel_consumption double); diff --git a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py index 66c2fdd14f..04c69ad618 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py @@ -143,7 +143,8 @@ class TDTestCase: stableName= '%s_%d'%(paraDict['stbName'],i) newTdSql=tdCom.newTdSql() threads.append(threading.Thread(target=clusterComCreate.insert_data, args=(newTdSql, paraDict["dbName"],stableName,paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]))) - threads.append(threading.Thread(target=self.reCreateUser,args=(newTdSql,i,"user","passwd"))) + createTdSql=tdCom.newTdSql() + threads.append(threading.Thread(target=self.reCreateUser,args=(createTdSql,i,"user","passwd"))) for tr in threads: tr.start() diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py index 4dcc0b963f..c11159c6e5 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info("pkill consume processor") tdCom.killProcessor("tmq_sim") - # time.sleep(10) + time.sleep(10) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() diff --git a/tests/system-test/7-tmq/tmqDelete-1ctb.py b/tests/system-test/7-tmq/tmqDelete-1ctb.py index 4b45b1a834..b09efdd1e6 100644 --- a/tests/system-test/7-tmq/tmqDelete-1ctb.py +++ b/tests/system-test/7-tmq/tmqDelete-1ctb.py @@ -80,16 +80,16 @@ class TDTestCase: tdLog.debug("del data ............ [OK]") return - def threadFunctionForDeletaData(self, **paraDict): + def threadFunctionForDeletaData(self, paraDict): # create new connector for new tdSql instance in my thread newTdSql = tdCom.newTdSql() self.delData(newTdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["startTs"],paraDict["endTs"],paraDict["ctbStartIdx"]) return - def asyncDeleteData(self, paraDict): - pThread = threading.Thread(target=self.threadFunctionForDeletaData, kwargs=paraDict) - pThread.start() - return pThread + # def asyncDeleteData(self, paraDict): + # pThread = threading.Thread(target=self.threadFunctionForDeletaData, kwargs=paraDict) + # pThread.start() + # return pThread def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") @@ -109,7 +109,7 @@ class TDTestCase: 'batchNum': 3000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'endTs': 0, - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -194,7 +194,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 5000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -296,7 +296,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 5000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -340,7 +340,8 @@ class TDTestCase: # del some data rowsOfDelete = int(self.rowsPerTbl / 4 ) paraDict["endTs"] = paraDict["startTs"] + rowsOfDelete - 1 - pDeleteThread = self.asyncDeleteData(paraDict) + # pDeleteThread = self.asyncDeleteData(paraDict) + self.threadFunctionForDeletaData(paraDict) tdLog.info("start consume processor") tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 655fef383e..05183a036c 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1048,26 +1048,28 @@ void *shellThreadLoop(void *arg) { taosGetOldTerminalMode(); taosThreadCleanupPush(shellCleanup, NULL); - char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE); - if (command == NULL) { - printf("failed to malloc command\r\n"); - return NULL; - } - do { - memset(command, 0, SHELL_MAX_COMMAND_SIZE); - taosSetTerminalMode(); - - if (shellReadCommand(command) != 0) { + char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE); + if (command == NULL) { + printf("failed to malloc command\r\n"); break; } - taosResetTerminalMode(); - } while (shellRunCommand(command, true) == 0); + do { + memset(command, 0, SHELL_MAX_COMMAND_SIZE); + taosSetTerminalMode(); - taosMemoryFreeClear(command); - shellWriteHistory(); - shellExit(); + if (shellReadCommand(command) != 0) { + break; + } + + taosResetTerminalMode(); + } while (shellRunCommand(command, true) == 0); + + taosMemoryFreeClear(command); + shellWriteHistory(); + shellExit(); + } while (0); taosThreadCleanupPop(1); return NULL; diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 1a5f5a64e0..73c4454178 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -137,6 +137,8 @@ int smlProcess_json1_Test() { for (int i = 0; i < 1; i++) { taosMemoryFree(sql1[i]); } + ASSERT(code == 0); + const char *sql2[] = { "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344041,\"value\":13,\"tags\":{\"host\":\"web01\",\"dc\":\"lga\"}" @@ -164,6 +166,34 @@ int smlProcess_json1_Test() { taosMemoryFree(sql3[i]); } + ASSERT(code == 0); + + + // TD-22903 + const char *sql4[] = { + "[{\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833639, \"type\": \"ms\"}, \"value\": true, \"tags\": {\"t0\": true}}, {\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833638, \"type\": \"ms\"}, \"value\": false, \"tags\": {\"t0\": true}}]" + }; + char *sql5[1] = {0}; + for (int i = 0; i < 1; i++) { + sql5[i] = taosMemoryCalloc(1, 1024); + strncpy(sql5[i], sql4[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql5, sizeof(sql5) / sizeof(sql5[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + code = taos_errno(pRes); + if (code != 0) { + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + } else { + printf("%s result:success\n", __FUNCTION__); + } + taos_free_result(pRes); + + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql5[i]); + } + ASSERT(code == 0); + taos_close(taos); return code; @@ -927,6 +957,71 @@ int sml_ts2164_Test() { return code; } +int sml_td22898_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = + taos_query(taos, "CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"); + taos_free_result(pRes); + + const char *sql[] = { + "svlzxdfutx,id=nyavpjyfas,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64 1626006833639" + }; + + pRes = taos_query(taos, "use line_test"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + + const char *sql1[] = { + "svlzxdfutx,id=nyavpjyfas,t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"tgqkvsws\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"htvnnldm\",c8=L\"ncharColValue\",c9=7u64 1626006833639" + }; + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from svlzxdfutx"); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + +int sml_td22900_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = + taos_query(taos, "CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"); + taos_free_result(pRes); + + const char *sql[] = { + "qddkgilwfu,id=qddkgilwfu_42383_49198,t0=t,t1=127i8 c4=9223372036854775807i64,c6=11.12345f32,c6=22.123456789f64 1626006833639" + }; + + pRes = taos_query(taos, "use line_test"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + taos_close(taos); + + return code; +} + int sml_ttl_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1106,6 +1201,10 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_ts2164_Test(); ASSERT(!ret); + ret = sml_td22898_Test(); + ASSERT(!ret); + ret = sml_td22900_Test(); + ASSERT(ret); ret = smlProcess_influx_Test(); ASSERT(!ret); ret = smlProcess_telnet_Test(); diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index 3d458d90c1..1f25eae366 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -409,7 +409,7 @@ int buildStable(TAOS* pConn, TAOS_RES* pRes) { taos_free_result(pRes); pRes = taos_query(pConn, - "create stream meters_summary_s into meters_summary as select _wstart, max(current) as current, " + "create stream meters_summary_s trigger at_once IGNORE EXPIRED 0 into meters_summary as select _wstart, max(current) as current, " "groupid, location from meters partition by groupid, location interval(10m)"); if (taos_errno(pRes) != 0) { printf("failed to create super table meters_summary, reason:%s\n", taos_errstr(pRes));