diff --git a/cmake/apr-util_CMakeLists.txt.in b/cmake/apr-util_CMakeLists.txt.in index 015084e710..a39100897b 100644 --- a/cmake/apr-util_CMakeLists.txt.in +++ b/cmake/apr-util_CMakeLists.txt.in @@ -11,7 +11,7 @@ ExternalProject_Add(aprutil-1 BUILD_IN_SOURCE TRUE BUILD_ALWAYS 1 #UPDATE_COMMAND "" - CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --with-apr=$ENV{HOME}/.cos-local.1 --without-expat + CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --with-apr=$ENV{HOME}/.cos-local.1 #CONFIGURE_COMMAND ./configure --with-apr=/usr/local/apr BUILD_COMMAND make INSTALL_COMMAND make install diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx index 5af3897afd..42a9f3af5a 100644 --- a/docs/en/07-develop/07-tmq.mdx +++ b/docs/en/07-develop/07-tmq.mdx @@ -113,7 +113,19 @@ Set subscription() throws SQLException; ConsumerRecords poll(Duration timeout) throws SQLException; +Set assignment() throws SQLException; +long position(TopicPartition partition) throws SQLException; +Map position(String topic) throws SQLException; +Map beginningOffsets(String topic) throws SQLException; +Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; + +void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; + void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; void close() throws SQLException; ``` diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md old mode 100644 new mode 100755 index b28d5acb18..7ef47f2131 --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -7,9 +7,9 @@ description: This document describes how to query data in TDengine. ## Syntax ```sql -SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} +SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE() | CURRENT_USER() | USER() } -SELECT [DISTINCT] select_list +SELECT [hints] [DISTINCT] [TAGS] select_list from_clause [WHERE condition] [partition_by_clause] @@ -21,6 +21,11 @@ SELECT [DISTINCT] select_list [LIMIT limit_val [OFFSET offset_val]] [>> export_file] +hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */ + +hint: + BATCH_SCAN | NO_BATCH_SCAN + select_list: select_expr [, select_expr] ... @@ -70,6 +75,29 @@ order_expr: {expr | position | c_alias} [DESC | ASC] [NULLS FIRST | NULLS LAST] ``` +## Hints + +Hints are a means of user control over query optimization for individual statements. Hints will be ignore automatically if they are not applicable to the current query statement. The specific instructions are as follows: + +- Hints syntax starts with `/*+` and ends with `*/`, spaces are allowed before or after. +- Hints syntax can only follow the SELECT keyword. +- Each hints can contain multiple hint, separated by spaces. When multiple hints conflict or are identical, whichever comes first takes effect. +- When an error occurs with a hint in hints, the effective hint before the error is still valid, and the current and subsequent hints are ignored. +- hint_param_list are arguments to each hint, which varies according to each hint. + +The list of currently supported Hints is as follows: + +| **Hint** | **Params** | **Comment** | **Scopt** | +| :-----------: | -------------- | -------------------------- | -------------------------- | +| BATCH_SCAN | None | Batch table scan | JOIN statment for stable | +| NO_BATCH_SCAN | None | Sequential table scan | JOIN statment for stable | + +For example: + +```sql +SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0 and a.ts = b.ts; +``` + ## Lists A query can be performed on some or all columns. Data and tag columns can all be included in the SELECT list. @@ -167,7 +195,7 @@ The following SQL statement returns the number of subtables within the meters su SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters); ``` -In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause. For example: +In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause. **\_QSTART and \_QEND** @@ -197,6 +225,14 @@ The \_IROWTS pseudocolumn can only be used with INTERP function. This pseudocolu select _irowts, interp(current) from meters range('2020-01-01 10:00:00', '2020-01-01 10:30:00') every(1s) fill(linear); ``` +### TAGS Query + +The TAGS keyword returns only tag columns from all child tables when only tag columns are specified. One row containing tag columns is returned for each child table. + +```sql +SELECT TAGS tag_name [, tag_name ...] FROM stb_name +``` + ## Query Objects `FROM` can be followed by a number of tables or super tables, or can be followed by a sub-query. @@ -209,8 +245,7 @@ You can perform INNER JOIN statements based on the primary key. The following co 3. For supertables, the ON condition must be equivalent to the primary key. In addition, the tag columns of the tables on which the INNER JOIN is performed must have a one-to-one relationship. You cannot specify an OR condition. 4. The tables that are included in a JOIN clause must be of the same type (supertable, standard table, or subtable). 5. You can include subqueries before and after the JOIN keyword. -6. You cannot include more than ten tables in a JOIN clause. -7. You cannot include a FILL clause and a JOIN clause in the same statement. +6. You cannot include a FILL clause and a JOIN clause in the same statement. ## GROUP BY @@ -301,6 +336,12 @@ SELECT TODAY(); SELECT TIMEZONE(); ``` +### Obtain Current User + +```sql +SELECT CURRENT_USER(); +``` + ## Regular Expression ### Syntax @@ -355,7 +396,7 @@ SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) F ## JOIN -TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables. +TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables, primary key and other conditions must be combined with `AND` operator. For standard tables: diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index 234625bfb4..b0c5f82985 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -1275,6 +1275,14 @@ SELECT SERVER_STATUS(); **Description**: The server status. +### CURRENT_USER + +```sql +SELECT CURRENT_USER(); +``` + +**Description**: get current user. + ## Geometry Functions diff --git a/docs/en/12-taos-sql/20-keywords.md b/docs/en/12-taos-sql/20-keywords.md index d563181b87..983d4f63c9 100644 --- a/docs/en/12-taos-sql/20-keywords.md +++ b/docs/en/12-taos-sql/20-keywords.md @@ -178,7 +178,7 @@ The following list shows all reserved keywords: - MATCH - MAX_DELAY -- MAX_SPEED +- BWLIMIT - MAXROWS - MERGE - META diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md index b663fbd435..7a58343f24 100644 --- a/docs/en/12-taos-sql/24-show.md +++ b/docs/en/12-taos-sql/24-show.md @@ -22,6 +22,14 @@ SHOW CLUSTER; Shows information about the current cluster. +## SHOW CLUSTER ALIVE + +```sql +SHOW CLUSTER ALIVE; +``` + +It is used to check whether the cluster is available or not. Return value: 0 means unavailable, 1 means available, 2 means partially available (some dnodes are offline, the other dnodes are available) + ## SHOW CONNECTIONS ```sql diff --git a/docs/en/12-taos-sql/28-recovery.md b/docs/en/12-taos-sql/28-recovery.md index b4da25ea0c..1c1838f616 100644 --- a/docs/en/12-taos-sql/28-recovery.md +++ b/docs/en/12-taos-sql/28-recovery.md @@ -17,7 +17,7 @@ You can use the SHOW CONNECTIONS statement to find the conn_id. ## Terminate a Query ```sql -KILL QUERY kill_id; +KILL QUERY 'kill_id'; ``` You can use the SHOW QUERIES statement to find the kill_id. diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx index 3e1a0f9545..f6ebf0fe47 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/14-reference/03-connector/03-cpp.mdx @@ -168,6 +168,12 @@ The base API is used to do things like create database connections and provide a ::: +- `TAOS *taos_connect_auth(const char *host, const char *user, const char *auth, const char *db, uint16_t port)` + + The function is the same as taos_connect. Except that the pass parameter is replaced by auth, other parameters are the same as taos_connect. + + - auth: the 32-bit lowercase md5 of the raw password + - `char *taos_get_server_info(TAOS *taos)` Get server-side version information. @@ -184,6 +190,14 @@ The base API is used to do things like create database connections and provide a - 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. +- `int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)` + + Set the event callback function. + + - fp: event callback function pointer. Declaration:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type);Param is a user-defined parameter, ext is an extended parameter (depending on the event type, and returns the user password version for TAOS_NOTIFY_PASSVER), and type is the event type + - param: user-defined parameter + - type: event type. Value range: 1) TAOS_NOTIFY_PASSVER: User password changed + - `void taos_close(TAOS *taos)` Closes the connection, where `taos` is the handle returned by `taos_connect()`. @@ -307,21 +321,20 @@ The specific functions related to the interface are as follows (see also the [pr Parse a SQL command, and bind the parsed result and parameter information to `stmt`. If the parameter length is greater than 0, use this parameter as the length of the SQL command. If it is equal to 0, the length of the SQL command will be determined automatically. -- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind)` +- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind)` Not as efficient as `taos_stmt_bind_param_batch()`, but can support non-INSERT type SQL statements. To bind parameters, bind points to an array (representing the row of data to be bound), making sure that the number and order of the elements in this array are the same as the parameters in the SQL statement. taos_bind is used similarly to MYSQL_BIND in MySQL, as defined below. ```c - typedef struct TAOS_BIND { + typedef struct TAOS_MULTI_BIND { int buffer_type; - void * buffer; - uintptr_t buffer_length; // not in use - uintptr_t * length; - int * is_null; - int is_unsigned; // not in use - int * error; // not in use - } TAOS_BIND; + void *buffer; + uintptr_t buffer_length; + uint32_t *length; + char *is_null; + int num; + } TAOS_MULTI_BIND; ``` - `int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name)` @@ -329,7 +342,7 @@ The specific functions related to the interface are as follows (see also the [pr (Available in 2.1.1.0 and later versions, only supported for replacing parameter values in INSERT statements) When the table name in the SQL command uses `? ` placeholder, you can use this function to bind a specific table name. -- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags)` +- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_MULTI_BIND* tags)` (Available in 2.1.2.0 and later versions, only supported for replacing parameter values in INSERT statements) When the table name and TAGS in the SQL command both use `? `, you can use this function to bind the specific table name and the specific TAGS value. The most typical usage scenario is an INSERT statement that uses the automatic table building function (the current version does not support specifying specific TAGS columns.) The number of columns in the TAGS parameter needs to be the same as the number of TAGS requested in the SQL command. @@ -358,6 +371,14 @@ The specific functions related to the interface are as follows (see also the [pr Execute the prepared statement. Currently, a statement can only be executed once. +- `int taos_stmt_affected_rows(TAOS_STMT *stmt)` + + Gets the number of rows affected by executing bind statements multiple times. + +- `int taos_stmt_affected_rows_once(TAOS_STMT *stmt)` + + Gets the number of rows affected by executing a bind statement once. + - `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)` Gets the result set of a statement. Use the result set in the same way as in the non-parametric call. When finished, `taos_free_result()` should be called on this result set to free resources. diff --git a/docs/en/14-reference/03-connector/04-java.mdx b/docs/en/14-reference/03-connector/04-java.mdx index b12ef38ea8..7e580a52d4 100644 --- a/docs/en/14-reference/03-connector/04-java.mdx +++ b/docs/en/14-reference/03-connector/04-java.mdx @@ -36,6 +36,7 @@ REST connection supports all platforms that can run Java. | taos-jdbcdriver version | major changes | TDengine version | | :---------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------: | +| 3.2.5 | Subscription add committed() and assignment() method | 3.1.0.3 or later | | 3.2.4 | Subscription add the enable.auto.commit parameter and the unsubscribe() method in the WebSocket connection | - | | 3.2.3 | Fixed resultSet data parsing failure in some cases | - | | 3.2.2 | Subscription add seek function | 3.0.5.0 or later | @@ -1019,14 +1020,19 @@ while(true) { #### Assignment subscription Offset ```java +// get topicPartition +Set assignment() throws SQLException; // get offset long position(TopicPartition partition) throws SQLException; Map position(String topic) throws SQLException; Map beginningOffsets(String topic) throws SQLException; Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; // Overrides the fetch offsets that the consumer will use on the next poll(timeout). void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; ``` Example usage is as follows. @@ -1052,6 +1058,18 @@ try (TaosConsumer consumer = new TaosConsumer<>(properties)) { } ``` +#### Commit offset + +If `enable.auto.commit` is false, offset can be submitted manually. + +```java +void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; +// async commit only support jni connection +void commitAsync(OffsetCommitCallback callback) throws SQLException; +void commitAsync(Map offsets, OffsetCommitCallback callback) throws SQLException; +``` + #### Close subscriptions ```java diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx index 718462295a..203d44fe02 100644 --- a/docs/en/14-reference/03-connector/09-csharp.mdx +++ b/docs/en/14-reference/03-connector/09-csharp.mdx @@ -30,6 +30,10 @@ The source code of `TDengine.Connector` is hosted on [GitHub](https://github.com The supported platforms are the same as those supported by the TDengine client driver. +:::note +Please note TDengine does not support 32bit Windows any more. +::: + ## Version support Please refer to [version support list](/reference/connector#version-support) diff --git a/docs/en/14-reference/06-taosdump.md b/docs/en/14-reference/06-taosdump.md index 6d5547e7a9..baf07d6b9e 100644 --- a/docs/en/14-reference/06-taosdump.md +++ b/docs/en/14-reference/06-taosdump.md @@ -102,6 +102,8 @@ Usage: taosdump [OPTION...] dbname [tbname ...] -L, --loose-mode Use loose mode if the table name and column name use letter and number only. Default is NOT. -n, --no-escape No escape char '`'. Default is using it. + -Q, --dot-replace Repalce dot character with underline character in + the table name. -T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is 8. -C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service diff --git a/docs/en/20-third-party/01-grafana.mdx b/docs/en/20-third-party/01-grafana.mdx index 64acefe6b8..0ccdfe7254 100644 --- a/docs/en/20-third-party/01-grafana.mdx +++ b/docs/en/20-third-party/01-grafana.mdx @@ -74,7 +74,7 @@ grafana-cli plugins install tdengine-datasource sudo -u grafana grafana-cli plugins install tdengine-datasource ``` -You can also download zip files from [GitHub](https://github.com/taosdata/grafanaplugin/releases/tag/latest) or [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) and install manually. The commands are as follows: +You can also download zip files from [GitHub](https://github.com/taosdata/grafanaplugin/releases/latest) or [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) and install manually. The commands are as follows: ```bash GF_VERSION=3.3.1 diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index ff6a36440f..c02b3227ca 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://t import Release from "/components/ReleaseV3"; +## 3.1.0.3 + + + ## 3.1.0.2 diff --git a/docs/examples/c/async_query_example.c b/docs/examples/c/async_query_example.c index 0618c09f36..9b4b6c943e 100644 --- a/docs/examples/c/async_query_example.c +++ b/docs/examples/c/async_query_example.c @@ -78,6 +78,7 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); diff --git a/docs/examples/c/multi_bind_example.c b/docs/examples/c/multi_bind_example.c index 02e6568e9e..3d0bd3ccef 100644 --- a/docs/examples/c/multi_bind_example.c +++ b/docs/examples/c/multi_bind_example.c @@ -51,7 +51,7 @@ void insertData(TAOS *taos) { int code = taos_stmt_prepare(stmt, sql, 0); checkErrorCode(stmt, code, "failed to execute taos_stmt_prepare"); // bind table name and tags - TAOS_BIND tags[2]; + TAOS_MULTI_BIND tags[2]; char *location = "California.SanFrancisco"; int groupId = 2; tags[0].buffer_type = TSDB_DATA_TYPE_BINARY; @@ -144,4 +144,4 @@ int main() { } // output: -// successfully inserted 2 rows \ No newline at end of file +// successfully inserted 2 rows diff --git a/docs/examples/c/query_example.c b/docs/examples/c/query_example.c index 88c031abc6..f483371a97 100644 --- a/docs/examples/c/query_example.c +++ b/docs/examples/c/query_example.c @@ -76,6 +76,7 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); diff --git a/docs/examples/c/stmt_example.c b/docs/examples/c/stmt_example.c index 28dae5f9d5..290a6bee66 100644 --- a/docs/examples/c/stmt_example.c +++ b/docs/examples/c/stmt_example.c @@ -58,7 +58,7 @@ void insertData(TAOS *taos) { int code = taos_stmt_prepare(stmt, sql, 0); checkErrorCode(stmt, code, "failed to execute taos_stmt_prepare"); // bind table name and tags - TAOS_BIND tags[2]; + TAOS_MULTI_BIND tags[2]; char* location = "California.SanFrancisco"; int groupId = 2; tags[0].buffer_type = TSDB_DATA_TYPE_BINARY; @@ -82,7 +82,7 @@ void insertData(TAOS *taos) { {1648432611749, 12.6, 218, 0.33}, }; - TAOS_BIND values[4]; + TAOS_MULTI_BIND values[4]; values[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP; values[0].buffer_length = sizeof(int64_t); values[0].length = &values[0].buffer_length; @@ -138,4 +138,4 @@ int main() { // output: -// successfully inserted 2 rows \ No newline at end of file +// successfully inserted 2 rows diff --git a/docs/zh/02-intro.md b/docs/zh/02-intro.md index 888f779966..68a2541717 100644 --- a/docs/zh/02-intro.md +++ b/docs/zh/02-intro.md @@ -6,7 +6,14 @@ toc_max_heading_level: 2 TDengine 是一款开源、高性能、云原生的[时序数据库](https://tdengine.com/tsdb/),且针对物联网、车联网、工业互联网、金融、IT 运维等场景进行了优化。TDengine 的代码,包括集群功能,都在 GNU AGPL v3.0 下开源。除核心的时序数据库功能外,TDengine 还提供[缓存](../develop/cache/)、[数据订阅](../develop/tmq)、[流式计算](../develop/stream)等其它功能以降低系统复杂度及研发和运维成本。 -本章节介绍 TDengine 的主要功能、竞争优势、适用场景、与其他数据库的对比测试等等,让大家对 TDengine 有个整体的了解。 +本章节介绍 TDengine 的主要产品和功能、竞争优势、适用场景、与其他数据库的对比测试等等,让大家对 TDengine 有个整体的了解。 + +## 主要产品 + +TDengine 有三个主要产品:TDengine Pro (即 TDengine 企业版),TDengine Cloud,和 TDengine OSS,关于它们的具体定义请参考 +- [TDengine 企业版](https://www.taosdata.com/tdengine-pro) +- [TDengine 云服务](https://cloud.taosdata.com/?utm_source=menu&utm_medium=webcn) +- [TDengine 开源版](https://www.taosdata.com/tdengine-oss) ## 主要功能 diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx index 6852d5551e..a73d43cd04 100644 --- a/docs/zh/07-develop/07-tmq.mdx +++ b/docs/zh/07-develop/07-tmq.mdx @@ -115,7 +115,19 @@ Set subscription() throws SQLException; ConsumerRecords poll(Duration timeout) throws SQLException; +Set assignment() throws SQLException; +long position(TopicPartition partition) throws SQLException; +Map position(String topic) throws SQLException; +Map beginningOffsets(String topic) throws SQLException; +Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; + +void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; + void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; void close() throws SQLException; ``` diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index 12bbffa4f9..e5dc2ec8c8 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -256,6 +256,12 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) ::: +- `TAOS *taos_connect_auth(const char *host, const char *user, const char *auth, const char *db, uint16_t port)` + + 功能同 taos_connect。除 pass 参数替换为 auth 外,其他参数同 taos_connect。 + + - auth: 原始密码取 32 位小写 md5 + - `char *taos_get_server_info(TAOS *taos)` 获取服务端版本信息。 @@ -272,6 +278,14 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) - 如果,len 小于 存储db需要的空间(包含最后的'\0'),返回错误,database里赋值截断的数据,以'\0'结尾。 - 如果,len 大于等于 存储db需要的空间(包含最后的'\0'),返回正常0,database里赋值以'\0‘结尾的db名。 +- `int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)` + + 设置事件回调函数。 + + - fp 事件回调函数指针。函数声明:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type);其中, param 为用户自定义参数,ext 为扩展参数(依赖事件类型,针对 TAOS_NOTIFY_PASSVER 返回用户密码版本),type 为事件类型 + - param 用户自定义参数 + - type 事件类型。取值范围:1)TAOS_NOTIFY_PASSVER: 用户密码改变 + - `void taos_close(TAOS *taos)` 关闭连接,其中`taos`是 `taos_connect()` 返回的句柄。 @@ -396,21 +410,20 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 解析一条 SQL 语句,将解析结果和参数信息绑定到 stmt 上,如果参数 length 大于 0,将使用此参数作为 SQL 语句的长度,如等于 0,将自动判断 SQL 语句的长度。 -- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind)` +- `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind)` 不如 `taos_stmt_bind_param_batch()` 效率高,但可以支持非 INSERT 类型的 SQL 语句。 - 进行参数绑定,bind 指向一个数组(代表所要绑定的一行数据),需保证此数组中的元素数量和顺序与 SQL 语句中的参数完全一致。TAOS_BIND 的使用方法与 MySQL 中的 MYSQL_BIND 类似,具体定义如下: + 进行参数绑定,bind 指向一个数组(代表所要绑定的一行数据),需保证此数组中的元素数量和顺序与 SQL 语句中的参数完全一致。TAOS_MULTI_BIND 的使用方法与 MySQL 中的 MYSQL_BIND 类似,具体定义如下: ```c - typedef struct TAOS_BIND { + typedef struct TAOS_MULTI_BIND { int buffer_type; - void * buffer; - uintptr_t buffer_length; // not in use - uintptr_t * length; - int * is_null; - int is_unsigned; // not in use - int * error; // not in use - } TAOS_BIND; + void *buffer; + uintptr_t buffer_length; + uint32_t *length; + char *is_null; + int num; // the number of columns + } TAOS_MULTI_BIND; ``` - `int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name)` @@ -418,7 +431,7 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 (2.1.1.0 版本新增,仅支持用于替换 INSERT 语句中的参数值) 当 SQL 语句中的表名使用了 `?` 占位时,可以使用此函数绑定一个具体的表名。 -- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags)` +- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_MULTI_BIND* tags)` (2.1.2.0 版本新增,仅支持用于替换 INSERT 语句中的参数值) 当 SQL 语句中的表名和 TAGS 都使用了 `?` 占位时,可以使用此函数绑定具体的表名和具体的 TAGS 取值。最典型的使用场景是使用了自动建表功能的 INSERT 语句(目前版本不支持指定具体的 TAGS 列)。TAGS 参数中的列数量需要与 SQL 语句中要求的 TAGS 数量完全一致。 @@ -428,17 +441,6 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 (2.1.1.0 版本新增,仅支持用于替换 INSERT 语句中的参数值) 以多列的方式传递待绑定的数据,需要保证这里传递的数据列的顺序、列的数量与 SQL 语句中的 VALUES 参数完全一致。TAOS_MULTI_BIND 的具体定义如下: - ```c - typedef struct TAOS_MULTI_BIND { - int buffer_type; - void * buffer; - uintptr_t buffer_length; - uintptr_t * length; - char * is_null; - int num; // the number of columns - } TAOS_MULTI_BIND; - ``` - - `int taos_stmt_add_batch(TAOS_STMT *stmt)` 将当前绑定的参数加入批处理中,调用此函数后,可以再次调用 `taos_stmt_bind_param()` 或 `taos_stmt_bind_param_batch()` 绑定新的参数。需要注意,此函数仅支持 INSERT/IMPORT 语句,如果是 SELECT 等其他 SQL 语句,将返回错误。 @@ -447,6 +449,14 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 执行准备好的语句。目前,一条语句只能执行一次。 +- `int taos_stmt_affected_rows(TAOS_STMT *stmt)` + + 获取执行多次绑定语句影响的行数。 + +- `int taos_stmt_affected_rows_once(TAOS_STMT *stmt)` + + 获取执行一次绑定语句影响的行数。 + - `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)` 获取语句的结果集。结果集的使用方式与非参数化调用时一致,使用完成后,应对此结果集调用 `taos_free_result()` 以释放资源。 diff --git a/docs/zh/08-connector/14-java.mdx b/docs/zh/08-connector/14-java.mdx index 36eacd26a4..0ff00d1710 100644 --- a/docs/zh/08-connector/14-java.mdx +++ b/docs/zh/08-connector/14-java.mdx @@ -36,6 +36,7 @@ REST 连接支持所有能运行 Java 的平台。 | taos-jdbcdriver 版本 | 主要变化 | TDengine 版本 | | :------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------: | +| 3.2.5 | 数据订阅增加 committed()、assignment() 方法 | 3.1.0.3 及更高版本 | | 3.2.4 | 数据订阅在 WebSocket 连接下增加 enable.auto.commit 参数,以及 unsubscribe() 方法。 | - | | 3.2.3 | 修复 ResultSet 在一些情况数据解析失败 | - | | 3.2.2 | 新增功能:数据订阅支持 seek 功能。 | 3.0.5.0 及更高版本 | @@ -1022,14 +1023,19 @@ while(true) { #### 指定订阅 Offset ```java +// 获取订阅的 topicPartition +Set assignment() throws SQLException; // 获取 offset long position(TopicPartition partition) throws SQLException; Map position(String topic) throws SQLException; Map beginningOffsets(String topic) throws SQLException; Map endOffsets(String topic) throws SQLException; +Map committed(Set partitions) throws SQLException; // 指定下一次 poll 中使用的 offset void seek(TopicPartition partition, long offset) throws SQLException; +void seekToBeginning(Collection partitions) throws SQLException; +void seekToEnd(Collection partitions) throws SQLException; ``` 示例代码: @@ -1055,6 +1061,18 @@ try (TaosConsumer consumer = new TaosConsumer<>(properties)) { } ``` +#### 提交 Offset + +当`enable.auto.commit`为 false 时,可以手动提交 offset。 + +```java +void commitSync() throws SQLException; +void commitSync(Map offsets) throws SQLException; +// 异步提交仅在 native 连接下有效 +void commitAsync(OffsetCommitCallback callback) throws SQLException; +void commitAsync(Map offsets, OffsetCommitCallback callback) throws SQLException; +``` + #### 关闭订阅 ```java diff --git a/docs/zh/08-connector/40-csharp.mdx b/docs/zh/08-connector/40-csharp.mdx index 3a945e77fd..325c71da88 100644 --- a/docs/zh/08-connector/40-csharp.mdx +++ b/docs/zh/08-connector/40-csharp.mdx @@ -29,6 +29,10 @@ import CSAsyncQuery from "../07-develop/04-query-data/_cs_async.mdx" 支持的平台和 TDengine 客户端驱动支持的平台一致。 +:::note +注意 TDengine 不再支持 32 位 Windows 平台。 +::: + ## 版本支持 请参考[版本支持列表](../#版本支持) diff --git a/docs/zh/08-connector/45-php.mdx b/docs/zh/08-connector/45-php.mdx index a5c3a1a400..0f32b29bf7 100644 --- a/docs/zh/08-connector/45-php.mdx +++ b/docs/zh/08-connector/45-php.mdx @@ -143,6 +143,7 @@ phpize && ./configure --enable-swoole && make -j && make install | `TDengine\TSDB_DATA_TYPE_FLOAT` | float | | `TDengine\TSDB_DATA_TYPE_DOUBLE` | double | | `TDengine\TSDB_DATA_TYPE_BINARY` | binary | +| `TDengine\TSDB_DATA_TYPE_VARBINARY` | varbinary | | `TDengine\TSDB_DATA_TYPE_TIMESTAMP` | timestamp | | `TDengine\TSDB_DATA_TYPE_NCHAR` | nchar | | `TDengine\TSDB_DATA_TYPE_UTINYINT` | utinyint | diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md old mode 100644 new mode 100755 index 9560c3c4df..222e166019 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -7,9 +7,9 @@ description: 查询数据的详细语法 ## 查询语法 ```sql -SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE()} +SELECT {DATABASE() | CLIENT_VERSION() | SERVER_VERSION() | SERVER_STATUS() | NOW() | TODAY() | TIMEZONE() | CURRENT_USER() | USER() } -SELECT [DISTINCT] select_list +SELECT [hints] [DISTINCT] [TAGS] select_list from_clause [WHERE condition] [partition_by_clause] @@ -21,6 +21,11 @@ SELECT [DISTINCT] select_list [LIMIT limit_val [OFFSET offset_val]] [>> export_file] +hints: /*+ [hint([hint_param_list])] [hint([hint_param_list])] */ + +hint: + BATCH_SCAN | NO_BATCH_SCAN + select_list: select_expr [, select_expr] ... @@ -70,6 +75,29 @@ order_expr: {expr | position | c_alias} [DESC | ASC] [NULLS FIRST | NULLS LAST] ``` +## Hints + +Hints 是用户控制单个语句查询优化的一种手段,当 Hint 不适用于当前的查询语句时会被自动忽略,具体说明如下: + +- Hints 语法以`/*+`开始,终于`*/`,前后可有空格。 +- Hints 语法只能跟随在 SELECT 关键字后。 +- 每个 Hints 可以包含多个 Hint,Hint 间以空格分开,当多个 Hint 冲突或相同时以先出现的为准。 +- 当 Hints 中某个 Hint 出现错误时,错误出现之前的有效 Hint 仍然有效,当前及之后的 Hint 被忽略。 +- hint_param_list 是每个 Hint 的参数,根据每个 Hint 的不同而不同。 + +目前支持的 Hints 列表如下: + +| **Hint** | **参数** | **说明** | **适用范围** | +| :-----------: | -------------- | -------------------------- | -------------------------- | +| BATCH_SCAN | 无 | 采用批量读表的方式 | 超级表 JOIN 语句 | +| NO_BATCH_SCAN | 无 | 采用顺序读表的方式 | 超级表 JOIN 语句 | + +举例: + +```sql +SELECT /*+ BATCH_SCAN() */ a.ts FROM stable1 a, stable2 b where a.tag0 = b.tag0 and a.ts = b.ts; +``` + ## 列表 查询语句可以指定部分或全部列作为返回结果。数据列和标签列都可以出现在列表中。 @@ -132,6 +160,16 @@ SELECT DISTINCT col_name [, col_name ...] FROM tb_name; ::: +### 标签查询 + +当查询的列只有标签列时,`TAGS` 关键字可以指定返回所有子表的标签列。每个子表只返回一行标签列。 + +返回所有子表的标签列: + +```sql +SELECT TAGS tag_name [, tag_name ...] FROM stb_name +``` + ### 结果集列名 `SELECT`子句中,如果不指定返回结果集合的列名,结果集列名称默认使用`SELECT`子句中的表达式名称作为列名称。此外,用户可使用`AS`来重命名返回结果集合中列的名称。例如: @@ -167,7 +205,7 @@ SELECT table_name, tag_name, tag_type, tag_value FROM information_schema.ins_tag SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters); ``` -以上两个查询均只支持在 WHERE 条件子句中添加针对标签(TAGS)的过滤条件。例如: +以上两个查询均只支持在 WHERE 条件子句中添加针对标签(TAGS)的过滤条件。 **\_QSTART/\_QEND** @@ -209,8 +247,7 @@ TDengine 支持基于时间戳主键的 INNER JOIN,规则如下: 3. 对于超级表,ON 条件在时间戳主键的等值条件之外,还要求有可以一一对应的标签列等值条件,不支持 OR 条件。 4. 参与 JOIN 计算的表只能是同一种类型,即只能都是超级表,或都是子表,或都是普通表。 5. JOIN 两侧均支持子查询。 -6. 参与 JOIN 的表个数上限为 10 个。 -7. 不支持与 FILL 子句混合使用。 +6. 不支持与 FILL 子句混合使用。 ## GROUP BY @@ -301,6 +338,12 @@ SELECT TODAY(); SELECT TIMEZONE(); ``` +### 获取当前用户 + +```sql +SELECT CURRENT_USER(); +``` + ## 正则表达式过滤 ### 语法 @@ -354,7 +397,7 @@ SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) F ## JOIN 子句 -TDengine 支持基于时间戳主键的内连接,即 JOIN 条件必须包含时间戳主键。只要满足基于时间戳主键这个要求,普通表、子表、超级表和子查询之间可以随意的进行内连接,且对表个数没有限制。 +TDengine 支持基于时间戳主键的内连接,即 JOIN 条件必须包含时间戳主键。只要满足基于时间戳主键这个要求,普通表、子表、超级表和子查询之间可以随意的进行内连接,且对表个数没有限制,其它连接条件与主键间必须是 AND 操作。 普通表与普通表之间的 JOIN 操作: diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 3c0ee06caf..f7e2a64ea7 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -1266,6 +1266,14 @@ SELECT SERVER_STATUS(); **说明**:检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误。 +### CURRENT_USER + +```sql +SELECT CURRENT_USER(); +``` + +**说明**:获取当前用户。 + ## Geometry 函数 diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md old mode 100644 new mode 100755 index f750124049..62888cc5f7 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -31,7 +31,7 @@ select max(current) from meters partition by location interval(10m) ## 窗口切分查询 -TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)、条件窗口(event window)四种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。 +TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)、事件窗口(event window)四种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。 窗口子句语法如下: diff --git a/docs/zh/12-taos-sql/20-keywords.md b/docs/zh/12-taos-sql/20-keywords.md index f52af2f282..e7e926d0b7 100644 --- a/docs/zh/12-taos-sql/20-keywords.md +++ b/docs/zh/12-taos-sql/20-keywords.md @@ -178,7 +178,7 @@ description: TDengine 保留关键字的详细列表 - MATCH - MAX_DELAY -- MAX_SPEED +- BWLIMIT - MAXROWS - MERGE - META diff --git a/docs/zh/12-taos-sql/24-show.md b/docs/zh/12-taos-sql/24-show.md index 6e102e2356..b7ca9493d4 100644 --- a/docs/zh/12-taos-sql/24-show.md +++ b/docs/zh/12-taos-sql/24-show.md @@ -22,6 +22,14 @@ SHOW CLUSTER; 显示当前集群的信息 +## SHOW CLUSTER ALIVE + +```sql +SHOW CLUSTER ALIVE; +``` + +查询当前集群的状态是否可用,返回值: 0:不可用 1:完全可用 2:部分可用(集群中部分节点下线,但其它节点仍可以正常使用) + ## SHOW CONNECTIONS ```sql diff --git a/docs/zh/12-taos-sql/25-grant.md b/docs/zh/12-taos-sql/25-grant.md index d53f951e67..42d740539f 100644 --- a/docs/zh/12-taos-sql/25-grant.md +++ b/docs/zh/12-taos-sql/25-grant.md @@ -4,87 +4,85 @@ title: 权限管理 description: 企业版中才具有的权限管理功能 --- -本节讲述如何在 TDengine 中进行权限管理的相关操作。权限管理是 TDengine 企业版的特有功能,本节只列举了一些基本的权限管理功能作为示例,更丰富的权限管理请联系 TDengine 销售或市场团队。 +本节讲述如何在 TDengine 中进行权限管理的相关操作。权限管理是 TDengine 企业版的特有功能,欲试用 TDengine 企业版请联系 TDengine 销售或市场团队。 -## 创建用户 +TDengine 中的权限管理分为用户管理、数据库授权管理以及消息订阅授权管理。 + +当 TDengine 安装并部署成功后,系统中内置有 "root" 用户。持有默认 "root" 用户密码的系统管理员应该第一时间修改 root 用户的密码,并根据业务需要创建普通用户并为这些用户授予适当的权限。在未授权的情况下,普通用户可以创建 DATABASE,并拥有自己创建的 DATABASE 的所有权限,包括删除数据库、修改数据库、查询时序数据和写入时序数据。超级用户可以给普通用户授予其他(即非该用户所创建的) DATABASE 的读写权限,使其可以在这些 DATABASE 上读写数据,但不能对其进行删除和修改数据库的操作。超级用户或者 topic 的创建者也可以给其它用户授予对某个 topic 的订阅权限。 + +## 用户管理 + +用户管理涉及用户的整个生命周期,从创建用户、对用户进行授权、撤销对用户的授权、查看用户信息、直到删除用户。 + +### 创建用户 + +创建用户的操作只能由 root 用户进行,语法如下 + +```sql +CREATE USER user_name PASS 'password' [SYSINFO {1\|0}]; +``` + +说明: + +- user_name 最长为 23 字节。 +- password 最长为 128 字节,合法字符包括"a-zA-Z0-9!?\$%\^&\*()_–+={[}]:;@\~\#\|\<,\>.?/",不可以出现单双引号、撇号、反斜杠和空格,且不可以为空。 +- SYSINFO 表示用户是否可以查看系统信息。1 表示可以查看,0 表示不可以查看。系统信息包括服务端配置信息、服务端各种节点信息(如 DNODE、QNODE等)、存储相关的信息等。默认为可以查看系统信息。 + +示例:创建密码为123456且可以查看系统信息的用户 test + +``` +SQL taos\> create user test pass '123456' sysinfo 1; Query OK, 0 of 0 rows affected (0.001254s) +``` + +### 查看用户 + +查看系统中的用户信息请使用 show users 命令,示例如下 + +```sql +show users; +``` + +也可以通过查询系统表 `INFORMATION_SCHEMA.INS_USERS` 获取系统中的用户信息,示例如下 + +```sql +select * from information_schema.ins_users; +``` + +### 删除用户 + +删除用户请使用 + +```sql +DROP USER user_name; +``` + +### 修改用户信息 + +修改用户信息的命令如下 + +```sql +ALTER USER user_name alter_user_clause alter_user_clause: { PASS 'literal' \| ENABLE value \| SYSINFO value } +``` + +说明: + +- PASS:修改用户密码。 +- ENABLE:修改用户是否启用。1 表示启用此用户,0 表示禁用此用户。 +- SYSINFO:修改用户是否可查看系统信息。1 表示可以查看系统信息,0 表示不可以查看系统信息。 + +示例:禁用 test 用户 + +```sql +alter user test enable 0; Query OK, 0 of 0 rows affected (0.001160s) +``` ```sql CREATE USER use_name PASS 'password' [SYSINFO {1|0}]; ``` -创建用户。 +## 访问控制 -use_name 最长为 23 字节。 - -password 最长为 31 字节,合法字符包括"a-zA-Z0-9!?$%^&*()_–+={[}]:;@~#|<,>.?/",不可以出现单双引号、撇号、反斜杠和空格,且不可以为空。 - -SYSINFO 表示用户是否可以查看系统信息。1 表示可以查看,0 表示不可以查看。系统信息包括服务端配置信息、服务端各种节点信息(如 DNODE、QNODE等)、存储相关的信息等。默认为可以查看系统信息。 - -例如,创建密码为123456且可以查看系统信息的用户test如下: - -```sql -taos> create user test pass '123456' sysinfo 1; -Query OK, 0 of 0 rows affected (0.001254s) -``` - -## 查看用户 - -```sql -SHOW USERS; -``` - -查看用户信息。 - -```sql -taos> show users; - name | super | enable | sysinfo | create_time | -================================================================================ - test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 | - root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 | -Query OK, 2 rows in database (0.001657s) -``` - -也可以通过查询INFORMATION_SCHEMA.INS_USERS系统表来查看用户信息,例如: - -```sql -taos> select * from information_schema.ins_users; - name | super | enable | sysinfo | create_time | -================================================================================ - test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 | - root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 | -Query OK, 2 rows in database (0.001953s) -``` - -## 删除用户 - -```sql -DROP USER user_name; -``` - -## 修改用户信息 - -```sql -ALTER USER user_name alter_user_clause - -alter_user_clause: { - PASS 'literal' - | ENABLE value - | SYSINFO value -} -``` - -- PASS:修改用户密码。 -- ENABLE:修改用户是否启用。1 表示启用此用户,0 表示禁用此用户。 -- SYSINFO:修改用户是否可查看系统信息。1 表示可以查看系统信息,0 表示不可以查看系统信息。 - -例如,禁用 test 用户: - -```sql -taos> alter user test enable 0; -Query OK, 0 of 0 rows affected (0.001160s) -``` - -## 授权 +在 TDengine 企业版中,系统管理员可以根据业务和数据安全的需要控制任意一个用户对每一个数据库、订阅甚至表级别的访问。 ```sql GRANT privileges ON priv_level TO user_name @@ -105,14 +103,106 @@ priv_level : { } ``` -对用户授权。授权功能只包含在企业版中。 +### 数据库权限 -授权级别支持到DATABASE,权限有READ和WRITE两种。 -TDengine 有超级用户和普通用户两类用户。超级用户缺省创建为root,拥有所有权限。使用超级用户创建出来的用户为普通用户。在未授权的情况下,普通用户可以创建DATABASE,并拥有自己创建的DATABASE的所有权限,包括删除数据库、修改数据库、查询时序数据和写入时序数据。超级用户可以给普通用户授予其他DATABASE的读写权限,使其可以在此DATABASE上读写数据,但不能对其进行删除和修改数据库的操作。 +TDengine 有超级用户和普通用户两类用户。超级用户缺省创建为root,拥有所有权限。使用超级用户创建出来的用户为普通用户。在未授权的情况下,普通用户可以创建 DATABASE,并拥有自己创建的 DATABASE 的所有权限,包括删除数据库、修改数据库、查询时序数据和写入时序数据。超级用户可以给普通用户授予其他 DATABASE 的读写权限,使其可以在此 DATABASE 上读写数据,但不能对其进行删除和修改数据库的操作。 对于非DATABASE的对象,如USER、DNODE、UDF、QNODE等,普通用户只有读权限(一般为SHOW命令),不能创建和修改。 +对数据库的访问权限包含读和写两种权限,它们可以被分别授予,也可以被同时授予。 + +补充说明 + +- priv_level 格式中 "." 之前为数据库名称, "." 之后为表名称 +- "dbname.\*" 意思是名为 "dbname" 的数据库中的所有表 +- "\*.\*" 意思是所有数据库名中的所有表 + +**下表中总结了数据库权限的各种组合** + +对 root 用户和普通用户的权限的说明如下表 + +| 用户 | 描述 | 权限说明 | +|----------|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 超级用户 | 只有 root 是超级用户 | DB 外部 所有操作权限,例如user、dnode、udf、qnode等的CRUD DB 权限,包括 创建 删除 更新,例如修改 Option,移动 Vgruop等 读 写 Enable/Disable 用户 | +| 普通用户 | 除 root 以外的其它用户均为普通用户 | 在可读的 DB 中,普通用户可以进行读操作 select describe show subscribe 在可写 DB 的内部,用户可以进行写操作: 创建、删除、修改 超级表 创建、删除、修改 子表 创建、删除、修改 topic 写入数据 被限制系统信息时,不可进行如下操作 show dnode、mnode、vgroups、qnode、snode 修改用户包括自身密码 show db时只能看到自己的db,并且不能看到vgroups、副本、cache等信息 无论是否被限制系统信息,都可以 管理 udf 可以创建 DB 自己创建的 DB 具备所有权限 非自己创建的 DB ,参照读、写列表中的权限 | + +### 消息订阅授权 + +任意用户都可以在自己拥有读权限的数据库上创建 topic。超级用户 root 可以在任意数据库上创建 topic。每个 topic 的订阅权限都可以被独立授权给任何用户,不管该用户是否拥有该数据库的访问权限。删除 topic 只能由 root 用户或者该 topic 的创建者进行。topic 只能由超级用户、topic的创建者或者被显式授予 subscribe 权限的用户订阅。 + +授予订阅权限的语法如下: + +```sql +GRANT privileges ON priv_level TO user_name privileges : { ALL | priv_type [, priv_type] ... } priv_type : { SUBSCRIBE } priv_level : { topic_name } +``` + +### 基于标签的授权(表级授权) + +从 TDengine 3.0.5.0 开始,我们支持按标签授权某个超级表中部分特定的子表。具体的 SQL 语法如下。 + +```sql +GRANT privileges ON priv_level [WITH tag_condition] TO user_name + +privileges : { + ALL + | SUBSCRIBE + | priv_type [, priv_type] ... +} + +priv_type : { + READ + | WRITE +} + +priv_level : { + dbname.tbname + | dbname.* + | *.* + | topic_name +} + +REVOKE privileges ON priv_level [WITH tag_condition] FROM user_name + +privileges : { + ALL + | priv_type [, priv_type] ... +} + +priv_type : { + READ + | WRITE +} + +priv_level : { + dbname.tbname + | dbname.* + | *.* +} +``` + +上面 SQL 的语义为: + +- 用户可以通过 dbname.tbname 来为指定的表(包括超级表和普通表)授予或回收其读写权限,不支持直接对子表授予或回收权限。 +- 用户可以通过 dbname.tbname 和 WITH 子句来为符合条件的所有子表授予或回收其读写权限。使用 WITH 子句时,权限级别必须为超级表。 + +**表级权限和数据库权限的关系** + +下表列出了在不同的数据库授权和表级授权的组合下产生的实际权限。 + +| |**表无授权** | **表读授权** | **表读授权有标签条件** | **表写授权** | **表写授权有标签条件** | +| -------------- | ---------------- | -------- | ---------- | ------ | ----------- | +| **数据库无授权** | 无授权 | 对此表有读权限,对数据库下的其他表无权限 | 对此表符合标签权限的子表有读权限,对数据库下的其他表无权限 | 对此表有写权限,对数据库下的其他表无权限 | 对此表符合标签权限的子表有写权限,对数据库下的其他表无权限 | +| **数据库读授权** | 对所有表有读权限 | 对所有表有读权限 | 对此表符合标签权限的子表有读权限,对数据库下的其他表有读权限 | 对此表有写权限,对所有表有读权限 | 对此表符合标签权限的子表有写权限,所有表有读权限 | +| **数据库写授权** | 对所有表有写权限 | 对此表有读权限,对所有表有写权限 | 对此表符合标签权限的子表有读权限,对所有表有写权限 | 对所有表有写权限 | 对此表符合标签权限的子表有写权限,数据库下的其他表有写权限 | + +### 查看用户授权 + +使用下面的命令可以显示一个用户所拥有的授权: + +```sql +show user privileges +``` ## 撤销授权 ```sql @@ -135,4 +225,15 @@ priv_level : { ``` -收回对用户的授权。授权功能只包含在企业版中。 +### 撤销授权 + +1. 撤销数据库访问的授权 + +```sql +REVOKE privileges ON priv_level FROM user_name privileges : { ALL \| priv_type [, priv_type] ... } priv_type : { READ \| WRITE } priv_level : { dbname.\* \| \*.\* } +``` + +2. 撤销数据订阅的授权 + +```sql +REVOKE privileges ON priv_level FROM user_name privileges : { ALL \| priv_type [, priv_type] ... } priv_type : { SUBSCRIBE } priv_level : { topi_name } diff --git a/docs/zh/12-taos-sql/28-recovery.md b/docs/zh/12-taos-sql/28-recovery.md index b5088e7982..8e327afe0b 100644 --- a/docs/zh/12-taos-sql/28-recovery.md +++ b/docs/zh/12-taos-sql/28-recovery.md @@ -17,7 +17,7 @@ conn_id 可以通过 `SHOW CONNECTIONS` 获取。 ## 终止查询 ```sql -KILL QUERY kill_id; +KILL QUERY 'kill_id'; ``` kill_id 可以通过 `SHOW QUERIES` 获取。 diff --git a/docs/zh/14-reference/06-taosdump.md b/docs/zh/14-reference/06-taosdump.md index 12122edd32..9fe3c5af7a 100644 --- a/docs/zh/14-reference/06-taosdump.md +++ b/docs/zh/14-reference/06-taosdump.md @@ -105,6 +105,8 @@ Usage: taosdump [OPTION...] dbname [tbname ...] -L, --loose-mode Using loose mode if the table name and column name use letter and number only. Default is NOT. -n, --no-escape No escape char '`'. Default is using it. + -Q, --dot-replace Repalce dot character with underline character in + the table name. -T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is 8. -C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service diff --git a/docs/zh/17-operation/07-import.md b/docs/zh/17-operation/04-import.md similarity index 100% rename from docs/zh/17-operation/07-import.md rename to docs/zh/17-operation/04-import.md diff --git a/docs/zh/17-operation/08-export.md b/docs/zh/17-operation/05-export.md similarity index 100% rename from docs/zh/17-operation/08-export.md rename to docs/zh/17-operation/05-export.md diff --git a/docs/zh/17-operation/10-monitor.md b/docs/zh/17-operation/06-monitor.md similarity index 100% rename from docs/zh/17-operation/10-monitor.md rename to docs/zh/17-operation/06-monitor.md diff --git a/docs/zh/17-operation/07-cluster.md b/docs/zh/17-operation/07-cluster.md new file mode 100644 index 0000000000..cf4bfafd53 --- /dev/null +++ b/docs/zh/17-operation/07-cluster.md @@ -0,0 +1,80 @@ +--- +title: 集群运维 +description: TDengine 提供了多种集群运维手段以使集群运行更健康更高效 +--- + +为了使集群运行更健康更高效,TDengine 企业版提供了一些运维手段来帮助系统管理员更好地运维集群。 + +## 数据重整 + +TDengine 面向多种写入场景,在有些写入场景下,TDengine 的存储会导致数据存储的放大或数据文件的空洞等。这一方面影响数据的存储效率,另一方面也会影响查询效率。为了解决上述问题,TDengine 企业版提供了对数据的重整功能,即 DATA COMPACT 功能,将存储的数据文件重新整理,删除文件空洞和无效数据,提高数据的组织度,从而提高存储和查询的效率。 + +**语法** + +```sql +COMPACT DATABASE db_name [start with 'XXXX'] [end with 'YYYY']; +``` + +**效果** + +- 扫描并压缩指定的 DB 中所有 VGROUP 中 VNODE 的所有数据文件 +- COMPCAT 会删除被删除数据以及被删除的表的数据 +- COMPACT 会合并多个 STT 文件 +- 可通过 start with 关键字指定 COMPACT 数据的起始时间 +- 可通过 end with 关键字指定 COMPACT 数据的终止时间 + +**补充说明** + +- COMPACT 为异步,执行 COMPACT 命令后不会等 COMPACT 结束就会返回。如果上一个 COMPACT 没有完成则再发起一个 COMPACT 任务,则会等上一个任务完成后再返回。 +- COMPACT 可能阻塞写入,但不阻塞查询 +- COMPACT 的进度不可观测 + +## 集群负载再平衡 + +当多副本集群中的一个或多个节点因为升级或其它原因而重启后,有可能出现集群中各个 dnode 负载不均衡的现象,极端情况下会出现所有 vgroup 的 leader 都位于同一个 dnode 的情况。为了解决这个问题,可以使用下面的命令 + +```sql +balance vgroup leader; +``` + +**功能** + +让所有的 vgroup 的 leade r在各自的replica节点上均匀分布。这个命令会让 vgroup 强制重新选举,通过重新选举,在选举的过程中,变换 vgroup 的leader,通过这个方式,最终让leader均匀分布。 + +**注意** + +Raft选举本身带有随机性,所以通过选举的重新分布产生的均匀分布也是带有一定的概率,不会完全的均匀。**该命令的副作用是影响查询和写入**,在vgroup重新选举时,从开始选举到选举出新的 leader 这段时间,这 个vgroup 无法写入和查询。选举过程一般在秒级完成。所有的vgroup会依次逐个重新选举。 + +## 恢复数据节点 + +在多节点三副本的集群环境中,如果某个 dnode 的磁盘损坏,该 dnode 会自动退出,但集群中其它的 dnode 仍然能够继续提供写入和查询服务。 + +在更换了损坏的磁盘后,如果想要让曾经主动退出的 dnode 重新加入集群提供服务,可以通过 `restore dnode` 命令来恢复该数据节点上的部分或全部逻辑节点,该功能依赖多副本中的其它副本进行数据复制,所以只在集群中 dnode 数量大于等于 3 且副本数为 3 的情况下能够工作。 + + +```sql +restore dnode ;# 恢复dnode上的mnode,所有vnode和qnode +restore mnode on dnode ;# 恢复dnode上的mnode +restore vnode on dnode ;# 恢复dnode上的所有vnode +restore qnode on dnode ;# 恢复dnode上的qnode +``` + +**限制** +- 该功能是基于已有的复制功能的恢复,不是灾难恢复或者备份恢复,所以对于要恢复的 mnode 和 vnode来说,使用该命令的前提是还存在该 mnode 或 vnode 的其它两个副本仍然能够正常工作。 +- 该命令不能修复数据目录中的个别文件的损坏或者丢失。例如,如果某个 mnode 或者 vnode 中的个别文件或数据损坏,无法单独恢复损坏的某个文件或者某块数据。此时,可以选择将该 mnode/vnode 的数据全部清空再进行恢复。 + + +## 虚拟组分裂 (Scale Out) + +当一个 vgroup 因为子表数过多而导致 CPU 或 Disk 资源使用量负载过高时,增加 dnode 节点后,可通过 `split vgroup` 命令把该 vgroup 分裂为两个虚拟组。分裂完成后,新产生的两个 vgroup 承担原来由一个 vgroup 提供的读写服务。这也是 TDengine 为企业版用户提供的 scale out 集群的能力。 + +```sql +split vgroup +``` + +**注意** +- 单副本库虚拟组,在分裂完成后,历史时序数据总磁盘空间使用量,可能会翻倍。所以,在执行该操作之前,通过增加 dnode 节点方式,确保集群中有足够的 CPU 和磁盘资源,避免资源不足现象发生。 +- 该命令为 DB 级事务;执行过程,当前DB的其它管理事务将会被拒绝。集群中,其它DB不受影响。 +- 分裂任务执行过程中,可持续提供读写服务;期间,可能存在可感知的短暂的读写业务中断。 +- 在分裂过程中,不支持流和订阅。分裂结束后,历史 WAL 会清空。 +- 分裂过程中,可支持节点宕机重启容错;但不支持节点磁盘故障容错。 \ No newline at end of file diff --git a/docs/zh/17-operation/08-web.md b/docs/zh/17-operation/08-web.md new file mode 100644 index 0000000000..6560bb979f --- /dev/null +++ b/docs/zh/17-operation/08-web.md @@ -0,0 +1,178 @@ +--- +title: Web 管理工具 +description: 基于 Web 的系统管理工具 +--- + +## 简介 + +为了易于企业版用户更容易使用和管理数据库,TDengine 3.0 企业版提供了一个全新的可视化组件 taosExplorer。用户能够在其中方便地管理数据库管理系统中中各元素(数据库、超级表、子表)的生命周期,执行查询,监控系统状态,管理用户和授权,完成数据备份和恢复,与其它集群之间进行数据同步,导出数据,管理主题和流计算。 + +**欲体验基于 Web 的 TDengine 系统管理能力,请联系 TDengine 市场或销售团队** + +## 部署服务 + +### 准备工作 + +1. taosExplorer 没有独立的安装包,请使用 taosX 安装包进行安装。 +2. 在启动 taosExplorer 之前,请先确认 TDengine 集群已经正确设置并运行(即 taosd 服务),taosAdapter 也已经正确设置和运行并与 TDengine 集群保持连接状态。如果想要使用数据备份和恢复或者数据同步功能,请确保 taosX 服务和 Agent 服务也已经正确设置和运行。 + +### 配置 + +在启动 taosExplorer 之前,请确保配置文件中的内容正确。 + +```TOML +listen = "0.0.0.0:6060" +log_level = "info" +cluster = "http://localhost:6041" +x_api = "http://localhost:6050" +``` + +说明: + +- listen - taosExplorer 对外提供服务的地址 +- log_level - 日志级别,可选值为 "debug", "info", "warn", "error", "fatal" +- cluster - TDengine集群的 taosadapter 地址 +- x_api - taosX 的服务地址 + +### 启动 + +然后启动 taosExplorer,可以直接在命令行执行 taos-explorer 或者使用下面的 systemctl 脚本用 systemctl 来启动 taosExplorer 服务 + +```shell +[Unit] +Description=Explorer for TDengine +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/bin/taos-explorer +Restart=always + +[Install] +WantedBy=multi-user.target +``` + +### 问题排查 + +1. 当通过浏览器打开taosExplorer站点遇到“无法访问此网站”的错误信息时,请通过命令行登录taosExplorer所在机器,并使用命令systemctl status taos-explorer.service检查服务的状态,如果返回的状态是inactive,请使用命令systemctl start taos-explorer.service启动服务。 +2. 如果需要获取taosExplorer的详细日志,可通过命令journalctl -u taos-explorer + +## 登录 + +在 TDengine 管理系统的登录页面,输入正确的用户名和密码后,点击登录按钮,即可登录。 + +说明: +- 这里的用户,需要在所连接的 TDengine 中创建,TDengine 默认的用户名和密码为`root/taosdata`; +- 在 TDengine 中创建用户时,默认会设置用户的 SYSINFO 属性值为1, 表示该用户可以查看系统信息,只有 SYSINFO 属性为 1 的用户才能正常登录 TDengine 管理系统。 + +## 面板 + +taosExplorer 内置了一个简单的仪表盘展示以下集群信息,点击左侧功能列表中的 "面板" 可以启用此功能。 + +- 默认的仪表盘会返回对应 Grafana 的安装配置向导 +- 配置过 Grafana 的仪表盘在点击' 面板' 时会跳转到对应的配置地址(该地址来源于 /profile 接口的返回值) + + +## 数据浏览器 + +点击功能列表的“数据浏览器”入口,在“数据浏览器”中可以创建和删除数据库、创建和删除超级表和子表,执行SQL语句,查看SQL语句的执行结果。此外,超级管理员还有对数据库的管理权限,其他用户不提供该功能。 + +具体权限有: + +1.查看(提供数据库/超级表/普通表的基本信息) + +2.编辑 (编辑数据库/超级表/普通表的信息) + +3.数据库管理权限 (仅限超级管理员,该操作可以给指定用户配置数据库管理权限) + +4.删除 (删除数据库/超级表/普通表) + +5.追加 (选择对应的数据库/超级表/普通表名称直接追加到右侧sql输入区域,避免了手工输入) + + +## 系统管理 + +点击功能列表中的“系统管理”入口,可以创建用户、对用户进行访问授权、以及删除用户。还能够对当前所管理的集群中的数据进行备份和恢复。也可以配置一个远程 TDengine 的地址进行数据同步。同时也提供了集群信息和许可证的信息以及代理信息以供查看。系统管理 菜单只有 root 用户才有权限看到 + +### 用户管理 + +点击“系统管理”后,默认会进入“用户”标签页。 +在用户列表,可以查看系统中已存在的用户及其创建时间,并可以对用户进行启用、禁用,编辑(包括修改密码,数据库的读写权限等),删除等操作。 +点击用户列表右上方的“+新增”按钮,即可打开“新增用户”对话框: +1. 输入新增用户的用户名称,必填 +2. 输入新增用户的登录密码,必填,密码长度要求为8-16个字符,且至少要满足以下4个条件中的3个:大写字母,小写字母,数字,特殊字符 +3. 选择新增用户对系统中已存在的数据库的读写权限,非必填,默认情况下,新增用户对所有已存在的数据库无读写权限 +4. 提写完成后,点击确定按钮,即可新增用户。 + +### 系统信息 + +点击“集群”标签后,可以查看DNodes, MNodes和QNodes的状态、创建时间等信息,并可以对以上节点进行新增和删除操作。 + +### 许可证管理 + +点击“许可证”标签后,可以查看系统和系统和各连接器的许可证信息。 +点击位于“许可证”标签页右上角的“激活许可证”按钮,输入“激活码”和“连接器激活码”后,点击“确定”按钮,即可激活,激活码请联系 TDengine 客户成功团队获取。 + +## 数据订阅 + +本章节,将介绍如何在 TDengine 集群中,创建主题,并将其分享给其他用户,以及如何查看一个主题的消费者信息。 + +通过 Explorer, 您可以轻松地完成对数据订阅的管理,从而更好地利用 TDengine 提供的数据订阅能力。 +点击左侧导航栏中的“数据订阅”,即可跳转至数据订阅配置管理页面。 +您可以通过以下两种方式创建主题:使用向导和自定义 SQL 语句。通过自定义 SQL 创建主题时,您需要了解 TDengine 提供的数据订阅 SQL 语句的语法,并保证其正确性。 + +注: 对于数据订阅的详细说明,可参考官方文档中关于“数据订阅”章节,创建数据订阅之前需要先准备源数据库(或源数据库包含相应的超级表或者表),其中源数据库需配置wal_retention_period > 0 。 + +包括主题,消费者,共享主题和示例代码 + +### 创建主题 + +1. 在“主题”标签页,点击“新增新主题”按钮以后,选择向导窗格,然后输入“主题名称”; +2. 在“数据库”下拉列表中,选择相应的数据库; +3. 在“类型”标签下,选择“数据库” 或 “超级表” 或 “子查询”,这里以默认值“数据库”为例; +4. 然后点击“创建” 按钮,即可创建对应的主题。 + +### 分享主题 + +1. 在“共享主题”标签页,在“主题“下拉列表中,选择将要分享的主题; +2. 点击“添加可消费该主题的用户”按钮,然后在“用户名”下拉列表中选择相应的用户,然后点击“新增”,即可将该主题分享给此用户。 + + +### 查看消费者信息 + +1. 通过执行下一节“示例代码”所述的“完整实例”,即可消费共享主题 +2. 在“消费者”标签页,可查看到消费者的有关信息 + +### 示例代码 + +1. 在“示例代码”标签页,在“主题“下拉列表中,选择相应的主题; +2. 选择您熟悉的语言,然后您可以阅读以及使用这部分示例代码用来”创建消费“,”订阅主题“,通过执行 “完整实例”中的程序即可消费共享主题 + +## 流计算 + +通过 Explorer, 您可以轻松地完成对流的管理,从而更好地利用 TDengine 提供的流计算能力。 +点击左侧导航栏中的“流计算”,即可跳转至流计算配置管理页面。 +您可以通过以下两种方式创建流:流计算向导和自定义 SQL 语句。当前,通过流计算向导创建流时,暂不支持分组功能。通过自定义 SQL 创建流时,您需要了解 TDengine 提供的流计算 SQL 语句的语法,并保证其正确性。 + +注: 对于流计算的详细说明,可参考官方文档中关于“流式计算”章节,创建流计算之前需要先准备源数据库以及相应的超级表或表、输出的数据库。 + +### 流计算向导 + +1. 点击“创建流计算”按钮以后,选择流计算向导窗格,然后输入“流名称”; +2. 在“输出”部分,输入相应的“数据库”,“超级表”以及“子表前缀”; +3. 在“源”部分,选择相应的“数据库”,然后根据具体情况,选择使用“超级表”或“表”: + 1. 如果使用“超级表“,请从“超级表”下拉列表中选择相应的超级表, 并在“字段设置”区域,选择相应的字段 + 2. 如果使用“表“,请从“表”下拉列表中选择相应的表, 并在“字段设置”区域,选择相应的字段 +4. 对于窗口设置,根据需要选择”SESSION“, "STATE"或"INTERVAL", 并配置相应的值; +5. 对于”执行“部分,选择相应的”触发器“类型,并设置“Watermark”, "Ignore Expired", "DELETE_MARK", "FILL_HISTORY", "IGNORE UPDATE"; +6. 然后点击“创建” 按钮,即可创建对应的流计算。 + +### 使用 SQL 语句建流 + +1. 点击“创建流计算”按钮以后,选择流计算SQL窗格,然后输入类似如下的SQL语句(反引号内为源数据库以及相应的超级表或表、输出的数据库,请按您的环境更新反引号内的内容) + +```shell +CREATE STREAM `test_stream` TRIGGER WINDOW_CLOSE IGNORE EXPIRED 1 INTO `db_name`.`stable1` SUBTABLE(CONCAT('table1',tbname)) AS SELECT count(*) FROM `test_db`.`stable_name` PARTITION BY tbname INTERVAL(1m) +``` +2. 点击“创建”按钮,即可创建对应的流计算。 \ No newline at end of file diff --git a/docs/zh/17-operation/09-storage.md b/docs/zh/17-operation/09-storage.md new file mode 100644 index 0000000000..185b2c40ec --- /dev/null +++ b/docs/zh/17-operation/09-storage.md @@ -0,0 +1,56 @@ +--- +title: 多级存储 +--- + +## 多级存储 + +说明:多级存储功能仅企业版支持。 + +在默认配置下,TDengine 会将所有数据保存在 /var/lib/taos 目录下,而且每个 vnode 的数据文件保存在该目录下的不同目录。为扩大存储空间,尽量减少文件读取的瓶颈,提高数据吞吐率 TDengine 可通过配置系统参数 dataDir 让多个挂载的硬盘被系统同时使用。 + +除此之外,TDengine 也提供了数据分级存储的功能,将不同时间段的数据存储在挂载的不同介质上的目录里,从而实现不同“热度”的数据存储在不同的存储介质上,充分利用存储,节约成本。比如,最新采集的数据需要经常访问,对硬盘的读取性能要求高,那么用户可以配置将这些数据存储在 SSD 盘上。超过一定期限的数据,查询需求量没有那么高,那么可以存储在相对便宜的 HDD 盘上。 + +多级存储支持 3 级,每级最多可配置 16 个挂载点。 + +TDengine 多级存储配置方式如下(在配置文件/etc/taos/taos.cfg 中): + +``` +dataDir [path] +``` + +- path: 挂载点的文件夹路径 +- level: 介质存储等级,取值为 0,1,2。 + 0 级存储最新的数据,1 级存储次新的数据,2 级存储最老的数据,省略默认为 0。 + 各级存储之间的数据流向:0 级存储 -> 1 级存储 -> 2 级存储。 + 同一存储等级可挂载多个硬盘,同一存储等级上的数据文件分布在该存储等级的所有硬盘上。 + 需要说明的是,数据在不同级别的存储介质上的移动,是由系统自动完成的,用户无需干预。 +- primary: 是否为主挂载点,0(否)或 1(是),省略默认为 1。 + +在配置中,只允许一个主挂载点的存在(level=0,primary=1),例如采用如下的配置方式: + +``` +dataDir /mnt/data1 0 1 +dataDir /mnt/data2 0 0 +dataDir /mnt/data3 1 0 +dataDir /mnt/data4 1 0 +dataDir /mnt/data5 2 0 +dataDir /mnt/data6 2 0 +``` + +:::note + +1. 多级存储不允许跨级配置,合法的配置方案有:仅 0 级,仅 0 级+ 1 级,以及 0 级+ 1 级+ 2 级。而不允许只配置 level=0 和 level=2,而不配置 level=1。 +2. 禁止手动移除使用中的挂载盘,挂载盘目前不支持非本地的网络盘。 +3. 多级存储目前不支持删除已经挂载的硬盘的功能。 + +::: + +## 0 级负载均衡 + +在多级存储中,有且只有一个主挂载点,主挂载点承担了系统中最重要的元数据在座,同时各个 vnode 的主目录均存在于当前 dnode 主挂载点上,从而导致该 dnode 的写入性能受限于单个磁盘的 IO 吞吐能力。 + +从 TDengine 3.1.0.0 开始,如果一个 dnode 配置了多个 0 级挂载点,我们将该 dnode 上所有 vnode 的主目录均衡分布在所有的 0 级挂载点上,由这些 0 级挂载点共同承担写入负荷。在网络 I/O 及其它处理资源不成为瓶颈的情况下,通过优化集群配置,测试结果证明整个系统的写入能力和 0 级挂载点的数量呈现线性关系,即随着 0 级挂载点数量的增加,整个系统的写入能力也成倍增加。 + +## 同级挂载点选择策略 + +一般情况下,当 TDengine 要从同级挂载点中选择一个用于生成新的数据文件时,采用 round robin 策略进行选择。但现实中有可能每个磁盘的容量不相同,或者容量相同但写入的数据量不相同,这就导致会出现每个磁盘上的可用空间不均衡,在实际进行选择时有可能会选择到一个剩余空间已经很小的磁盘。为了解决这个问题,从 3.1.1.0 开始引入了一个新的配置 `minDiskFreeSize`,当某块磁盘上的可用空间小于等于这个阈值时,该磁盘将不再被选择用于生成新的数据文件。该配置项的单位为字节,其值应该大于 2GB,即会跳过可用空间小于 2GB 的挂载点。 diff --git a/docs/zh/18-data-transfer/01-taosX.md b/docs/zh/18-data-transfer/01-taosX.md new file mode 100644 index 0000000000..72d2cb2211 --- /dev/null +++ b/docs/zh/18-data-transfer/01-taosX.md @@ -0,0 +1,972 @@ +--- +title: 数据接入、同步和备份 +--- + +## 简介 + +为了能够方便地将各种数据源中的数据导入 TDengine 3.0,TDengine 3.0 企业版提供了一个全新的工具 taosX 用于帮助用户快速将其它数据源中的数据传输到 TDengine 中。 taosX 定义了自己的集成框架,方便扩展新的数据源。目前支持的数据源有 TDengine 自身(即从一个 TDengine 集群到另一个 TDengine 集群),Pi, OPC UA。除了数据接入外,taosX 还支持数据备份、数据同步、数据迁移以及数据导出功能。 + +**欲体验 taosX 的各种数据接入能力,请联系 TDengine 市场或销售团队。** + +## 使用前提 + +使用 taosX 需要已经部署好 TDengine 中的 taosd 和 taosAdapter,具体细节请参考 [系统部署](../../deployment/deploy) + +**使用限制**:taosX 只能用于企业版数据库服务端。 + +## 安装与配置 + +安装 taosX 需要使用独立的 taosX 安装包,其中除了 taosX 之外,还包含 Pi 连接器(限 Windows), OPC 连接器, InfluxDB 连接器, MQTT 连接器,以及必要的 Agent 组件,taosX + Agent + 某个连接器可以用于将相应数据源的数据同步到 TDengine。taosX 安装包中还包含了 taos-explorer 这个可视化管理组件 + +### Linux 安装 + +下载需要的 taosX 安装包,下文以安装包 `taosx-1.0.0-linux-x64.tar.gz` 为例展示如何安装: + +``` bash +# 在任意目录下解压文件 +tar -zxf taosx-1.0.0-linux-x64.tar.gz +cd taosx-1.0.0-linux-x64 + +# 安装 +sudo ./install.sh + +# 验证 +taosx -V +# taosx 1.0.0-494d280c (built linux-x86_64 2023-06-21 11:06:00 +08:00) +taosx-agent -V +# taosx-agent 1.0.0-494d280c (built linux-x86_64 2023-06-21 11:06:01 +08:00) + +# 卸载 +cd /usr/local/taosx +sudo ./uninstall.sh +``` + +**常见问题:** + +1. 安装后系统中增加了哪些文件? + * /usr/bin: taosx, taosx-agent, taos-explorer + * /usr/local/taosx/plugins: influxdb, mqtt, opc + * /etc/systemd/system:taosx.service, taosx-agent.service, taos-explorer.service + * /usr/local/taosx: uninstall.sh + * /etc/taox: agent.toml, explorer.toml + +2. taosx -V 提示 "Command not found" 应该如何解决? + * 检验问题1,保证所有的文件都被复制到对应的目录 + ``` bash + ls /usr/bin | grep taosx + ``` + +### Windows 安装 + +- 下载需要的 taosX 安装包,例如 taosx-1.0.0-Windows-x64-installer.exe,执行安装 +- 可使用 uninstall_taosx.exe 进行卸载 +- 命令行执行 ```sc start/stop taosx``` 启动/停止 taosx 服务 +- 命令行执行 ```sc start/stop taosx-agent``` 启动/停止 taosx-agent 服务 +- 命令行执行 ```sc start/stop taos-explorer``` 启动/停止 taosx-agent 服务 +- windows 默认安装在```C:\Program Files\taosX```,目录结构如下: +~~~ +├── bin +│   ├── taosx.exe +│   ├── taosx-srv.exe +│   ├── taosx-srv.xml +│   ├── taosx-agent.exe +│   ├── taosx-agent-srv.exe +│   ├── taosx-agent-srv.xml +│   ├── taos-explorer.exe +│   ├── taos-explorer-srv.exe +│   └── taos-explorer-srv.xml +├── plugins +│   ├── influxdb +│   │   └── taosx-inflxdb.jar +│   ├── mqtt +│   │   └── taosx-mqtt.exe +│   ├── opc +│   | └── taosx-opc.exe +│   ├── pi +│   | └── taosx-pi.exe +│   | └── taosx-pi-backfill.exe +│   | └── ... +└── config +│   ├── agent.toml +│   ├── explorer.toml +├── uninstall_taosx.exe +├── uninstall_taosx.dat +~~~ + +**运行模式** + +taosX 是进行数据同步与复制的核心组件,以下运行模式指 taosX 的运行模式,其它组件的运行模式在 taosX 的不同运行模式下与之适配。 + +## 命令行模式 + +可以直接在命令行上添加必要的参数直接启动 taosX 即为命令行模式运行。当命令行参数所指定的任务完成后 taosX 会自动停止。taosX 在运行中如果出现错误也会自动停止。也可以在任意时刻使用 ctrl+c 停止 taosX 的运行。本节介绍如何使用 taosX 的各种使用场景下的命令行。 + +### 命令行参数说明 + +**注意:部分参数暂无法通过 explorer设置【见:其他参数说明】,之后会逐步开放) ** + +命令行执行示例: + +```shell +taosx -f -t <其他参数> +``` + +以下参数说明及示例中若无特殊说明 `` 的格式均为占位符,使用时需要使用实际参数进行替换。 + +### DSN (Data Source Name) + +taosX 命令行模式使用 DSN 来表示一个数据源(来源或目的源),典型的 DSN 如下: + +```bash +# url-like +[+]://[[:@]:][/][?=[&=]] +|------|------------|---|-----------|-----------|------|------|----------|-----------------------| +|driver| protocol | | username | password | host | port | object | params | + +// url 示例 +tmq+ws://root:taosdata@localhost:6030/db1?timeout=never +``` +[] 中的数据都为可选参数。 + +1. 不同的驱动 (driver) 拥有不同的参数。driver 包含如下选项: + +- taos:使用查询接口从 TDengine 获取数据 +- tmq:启用数据订阅从 TDengine 获取数据 +- local:数据备份或恢复 +- pi: 启用 pi-connector从 pi 数据库中获取数据 +- opc:启用 opc-connector 从 opc-server 中获取数据 +- mqtt: 启用 mqtt-connector 获取 mqtt-broker 中的数据 +- kafka: 启用 Kafka 连接器从 Kafka Topics 中订阅消息写入 +- influxdb: 启用 influxdb 连接器从 InfluxDB 获取数据 +- csv:从 CSV 文件解析数据 + +2. +protocol 包含如下选项: +- +ws: 当 driver 取值为 taos 或 tmq 时使用,表示使用 rest 获取数据。不使用 +ws 则表示使用原生连接获取数据,此时需要 taosx 所在的服务器安装 taosc。 +- +ua: 当 driver 取值为 opc 时使用,表示采集的数据的 opc-server 为 opc-ua +- +da: 当 driver 取值为 opc 时使用,表示采集的数据的 opc-server 为 opc-da + +3. host:port 表示数据源的地址和端口。 +4. object 表示具体的数据源,可以是TDengine的数据库、超级表、表,也可以是本地备份文件的路径,也可以是对应数据源服务器中的数据库。 +5. username 和 password 表示该数据源的用户名和密码。 +6. params 代表了 dsn 的参数。 + +### 其它参数说明 + +1. parser 通过 --parser 或 -p 设置,设置 transform 的 parser 生效。可以通过 Explorer 在如 CSV,MQTT,KAFKA 数据源的任务配置进行设置。 + + 配置示例: + + ```shell + --parser "{\"parse\":{\"ts\":{\"as\":\"timestamp(ms)\"},\"topic\":{\"as\":\"varchar\",\"alias\":\"t\"},\"partition\":{\"as\":\"int\",\"alias\":\"p\"},\"offset\":{\"as\":\"bigint\",\"alias\":\"o\"},\"key\":{\"as\":\"binary\",\"alias\":\"k\"},\"value\":{\"as\":\"binary\",\"alias\":\"v\"}},\"model\":[{\"name\":\"t_{t}\",\"using\":\"kafka_data\",\"tags\":[\"t\",\"p\"],\"columns\":[\"ts\",\"o\",\"k\",\"v\"]}]}" + + ``` + +2. transform 通过 --transform 或 -T 设置,配置数据同步(仅支持 2.6 到 3.0 以及 3.0 之间同步)过程中对于表名及表字段的一些操作。暂无法通过 Explorer 进行设置。配置说明如下: + + ```shell + 1.AddTag,为表添加 TAG。设置示例:-T add-tag:=。 + 2.表重命名: + 2.1 重命名表限定 + 2.1.1 RenameTable:对所有符合条件的表进行重命名。 + 2.1.2 RenameChildTable:对所有符合条件的子表进行重命名。 + 2.1.3 RenameSuperTable:对所有符合条件的超级表进行重命名。 + 2.2 重命名方式 + 2.2.1 Prefix:添加前缀。 + 2.2.2 Suffix:添加后缀。 + 2.2.3 Template:模板方式。 + 2.2.4 ReplaceWithRegex:正则替换。taosx 1.1.0 新增。 + 重命名配置方式: + <表限定>:<重命名方式>:<重命名值> + 使用示例: + 1.为所有表添加前缀 + --transform rename-table:prefix: + 2.为符合条件的表替换前缀:prefix1 替换为 prefix2,以下示例中的 <> 为正则表达式的不再是占位符。 + -T rename-child-table:replace_with_regex:^prefix1(?)::prefix2_$old + + 示例说明:^prefix1(?) 为正则表达式,该表达式会匹配表名中包含以 prefix1 开始的表名并将后缀部分记录为 old,prefix2$old 则会使用 prefix2 与 old 进行替换。注意:两部分使用关键字符 :: 进行分隔,所以需要保证正则表达式中不能包含该字符。 + 若有更复杂的替换需求请参考:https://docs.rs/regex/latest/regex/#example-replacement-with-named-capture-groups 或咨询 taosx 开发人员。 + ``` + +3. jobs 指定任务并发数,仅支持 tmq 任务。暂无法通过 Explorer 进行设置。通过 --jobs `` 或 -j `` 进行设置。 +4. -v 用于指定 taosx 的日志级别,-v 表示启用 info 级别日志,-vv 对应 debug,-vvv 对应 trace。 + + +### 从 TDengine 到 TDengine 的数据同步 + +#### TDengine 3.0 -> TDengine 3.0 + +在两个相同版本 (都是 3.0.x.y)的 TDengine 集群之间将源集群中的存量及增量数据同步到目标集群中。 + +命令行模式下支持的参数如下: + +| 参数名称 | 说明 | 默认值 | +|-----------|------------------------------------------------------------------|----------------------------| +| group.id | 订阅使用的分组ID | 若为空则使用 hash 生成一个 | +| client.id | 订阅使用的客户端ID | taosx | +| timeout | 监听数据的超时时间,当设置为 never 表示 taosx 不会停止持续监听。 | 500ms | +| offset | 从指定的 offset 开始订阅,格式为 `:`,若有多个 vgroup 则用半角逗号隔开 | 若为空则从 0 开始订阅 | +| token | 目标源参数。 认证使用参数。 | 无 | + +示例: +```shell +taosx run \ + -f 'tmq://root:taosdata@localhost:6030/db1?group.id=taosx1&client.id=taosx&timeout=never&offset=2:10' \ + -t 'taos://root:taosdata@another.com:6030/db2' +``` + + + +#### TDengine 2.6 -> TDengine 3.0 + +将 2.6 版本 TDengine 集群中的数据迁移到 3.0 版本 TDengine 集群。 + +#### 命令行参数 + +| 参数名称 | 说明 | 默认值 | +|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------| +| libraryPath | 在 option 模式下指定 taos 库路径 | 无 | +| configDir | 指定 taos.cfg 配置文件路径 | 无 | +| mode | 数据源参数。 history 表示历史数据。 realtime 表示实时同步。 all 表示以上两种。 | history | +| restro | 数据源参数。 在同步实时数据前回溯指定时间长度的数据进行同步。 restro=10m 表示回溯最近 10 分钟的数据以后,启动实时同步。 | 无 | +| interval | 数据源参数。 轮询间隔 ,mode=realtime&interval=5s 指定轮询间隔为 5s | 无 | +| excursion | 数据源参数。 允许一段时间的乱序数据 | 500ms | +| stables | 数据源参数。 仅同步指定超级表的数据,多个超级表名用英文逗号 ,分隔 | 无 | +| tables | 数据源参数。 仅同步指定子表的数据,表名格式为 {stable}.{table} 或 {table},多个表名用英文逗号 , 分隔,支持 @filepath 的方式输入一个文件,每行视为一个表名,如 tables=@./tables.txt 表示从 ./tables.txt 中按行读取每个表名,空行将被忽略。 | 无 | +| select-from-stable | 数据源参数。 从超级表获取 select {columns} from stable where tbname in ({tbnames}) ,这种情况 tables 使用 {stable}.{table} 数据格式,如 meters.d0 表示 meters 超级表下面的 d0 子表。 | 默认使用 select \* from table 获取数据 | +| assert | 目标源参数。 taos:///db1?assert 将检测数据库是否存在,如不存在,将自动创建目标数据库。 | 默认不自动创建库。 | +| force-stmt | 目标源参数。 当 TDengine 版本大于 3.0 时,仍然使用 STMT 方式写入。 | 默认为 raw block 写入方式 | +| batch-size | 目标源参数。 设置 STMT 写入模式下的最大批次插入条数。 | | +| interval | 目标源参数。 每批次写入后的休眠时间。 | 无 | +| max-sql-length | 目标源参数。 用于建表的 SQL 最大长度,单位为 bytes。 | 默认 800_000 字节。 | +| failes-to | 目标源参数。 添加此参数,值为文件路径,将写入错误的表及其错误原因写入该文件,正常执行其他表的同步任务。 | 默认写入错误立即退出。 | +| timeout-per-table | 目标源参数。 为子表或普通表同步任务添加超时。 | 无 | +| update-tags | 目标源参数。 检查子表存在与否,不存在时正常建表,存在时检查标签值是否一致,不一致则更新。 | 无 | + +#### 示例 + +1.使用原生连接同步数据 + +```shell +taosx run \ + -f 'taos://td1:6030/db1?libraryPath=./libtaos.so.2.6.0.30&mode=all' \ + -t 'taos://td2:6030/db2?libraryPath=./libtaos.so.3.0.1.8&assert \ + -v +``` + +2.使用 WebSocket 同步数据超级表 stable1 和 stable2 的数据 + +```shell +taosx run \ + -f 'taos+ws://:@td1:6041/db1?stables=stable1,stable2' \ + -t 'taos+wss://td2:6041/db2?assert&token= \ + -v +``` + +### 从 TDengine 备份数据文件到本地 + +示例: +```shell +taosx run -f 'tmq://root:taosdata@td1:6030/db1' -t 'local:/path_directory/' + +``` +以上示例执行的结果及参数说明: + +将集群 td1 中的数据库 db1 的所有数据,备份到 taosx 所在设备的 /path_directory 路径下。 + +数据源(-f 参数的 DSN)的 object 支持配置为 数据库级(dbname)、超级表级(dbname.stablename)、子表/普通表级(dbname.tablename),对应备份数据的级别数据库级、超级表级、子表/普通表级 + + +### 从本地数据文件恢复到 TDengine + +#### 示例 +```shell +taosx run -f 'local:/path_directory/' -t 'taos://root:taosdata@td2:6030/db1?assert' +``` + +以上示例执行的结果: + +将 taosx 所在设备 /path_directory 路径下已备份的数据文件,恢复到集群 td2 的数据库 db1 中,如果 db1 不存在,则自动建库。 + +目标源(-t 参数的 DSN)中的 object 支持配置为数据库(dbname)、超级表(dbname.stablename)、子表/普通表(dbname.tablename),对应备份数据的级别数据库级、超级表级、子表/普通表级,前提是备份的数据文件也是对应的数据库级、超级表级、子表/普通表级数据。 + + +#### 常见错误排查 + +(1) 如果使用原生连接,任务启动失败并报以下错误: + +```text +Error: tmq to td task exec error + +Caused by: + [0x000B] Unable to establish connection +``` +产生原因是与数据源的端口链接异常,需检查数据源 FQDN 是否联通及端口 6030 是否可正常访问。 + +(2) 如果使用 WebSocket 连接,任务启动失败并报以下错误: + +```text +Error: tmq to td task exec error + +Caused by: + 0: WebSocket internal error: IO error: failed to lookup address information: Temporary failure in name resolution + 1: IO error: failed to lookup address information: Temporary failure in name resolution + 2: failed to lookup address information: Temporary failure in name resolution +``` + +使用 WebSocket 连接时可能遇到多种错误类型,错误信息可以在 ”Caused by“ 后查看,以下是几种可能的错误: + +- "Temporary failure in name resolution": DNS 解析错误,检查 IP 或 FQDN 是否能够正常访问。 +- "IO error: Connection refused (os error 111)": 端口访问失败,检查端口是否配置正确或是否已开启和可访问。 +- "IO error: received corrupt message": 消息解析失败,可能是使用了 wss 方式启用了 SSL,但源端口不支持。 +- "HTTP error: *": 可能连接到错误的 taosAdapter 端口或 LSB/Nginx/Proxy 配置错误。 +- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为配置的端口不正确。 + +(3) 如果任务启动失败并报以下错误: + +```text +Error: tmq to td task exec error + +Caused by: + [0x038C] WAL retention period is zero +``` + +是由于源端数据库 WAL 配置错误,无法订阅。 + +解决方式: +修改数据 WAL 配置: + +```sql +alter database test wal_retention_period 3600; +``` + +### 从 OPC-UA 同步数据到 TDengine + +#### 配置参数 + +| 参数名称 | 类型 | 描述 | +|-----------------|--------|-----------------------------------------------------------------------------| +| interval | int | 采集间隔(单位:秒),默认为1秒 | +| concurrent | int | 采集器并发数,默认为1 | +| batch_size | int | 采集器上报的批次点位数,默认为100 | +| batch_timeout | int | 采集器上报的超时时间(单位:秒),默认为20秒 | +| connect_timeout | int | 连接的超时时间(单位:秒),默认为10秒 | +| request_timeout | int | 请求的超时时间(单位:秒),默认为10秒 | +| security_policy | string | OPC-UA连接安全策略(可配置为None/Basic128Rsa15/Basic256/Basic256Sha256) | +| security_mode | string | OPC-UA连接模式(可配置为None/Sign/SignAndEncrypt) | +| certificate | string | cert.pem的路径。当安全模式或策略不是”无”时生效 | +| private_key | string | key.pem的路径。 当安全模式或策略不是”无”时生效 | +| csv_config_file | string | 包含 OPC UA 的点位配置和表配置。与配置 csv_config_file 配置互斥,csv_config_file 优先生效| +| ua.nodes | string | OPC-UA 测点的 NodeID。和 opc_table_config 配置结合使用,两者需要同时配置。与配置 csv_config_file 配置互斥,csv_config_file 优先生效。配置格式为 ::,code 用于建子表。| +| opc_table_config | string | OPCUA 单列模式表配置。需要与 ua.nodes 配合使用。| +| debug | bool | 启用 OPC 连接器的 debug 日志。默认为 false。| +| enable | bool | 原始数据存储。默认为 false| +| path | string | 原始数据存储路径。enable 为 true 时必须配置。| +| keep | int | 原始数据保存天数。enable 为 true 时必须配置。| + +补充: +1. opc_table_config 说明: + +```json +{ + "stable_prefix": "meters", // 超级表前缀 + "column_configs": + [ + { + "column_name": "received_time", // 存储接收时间 + "column_type": "timestamp", + "column_alias": "ts", // 接收时间建表列用列名为 ts + "is_primary_key": true // 接收时间时间戳作为主键 + }, + { + "column_name": "original_time", + "column_type": "timestamp", + "column_alias": "ts_2", + "is_primary_key": false + }, + { + "column_name": "value", // 数据列 + "column_alias": "valueaa", // 数据列别名 + "is_primary_key": false + }, + { + "column_name": "quality", // 质量位列 + "column_type": "int", + "column_alias": "quality11", // 质量位列别名 + "is_primary_key": false + } + ] +} +``` + +#### 示例 + +1. 使用 ua.nodes 和 opc_table_config 的配置示例: +采集 nodeid 为 ns=2;i=2 和 ns=2;i=3 的点位,将其写入到集群 tdengine 的 opc 库中超级表前缀为 meters,如果 ns=2;i=2 的点位类型为 float 则会创建 meters_float 的超级表,超级表使用 opc 接收的数据作为时间戳索引列,并且保留原始时间戳列,原始时间戳列名为 ts_2,数据列存储为 valueaa,同时存储质量数据到 quality11 列。 + +```shell +taosx run \ + -f "opcua://uauser:uapass@localhost:4840?ua.nodes=ns=2;i=2::DSF1312,ns=2;i=3::DSF1313&opc_table_config={\"stable_prefix\": \"meters\", \"column_configs\": [{\"column_name\": \"received_time\", \"column_type\": \"timestamp\", \"column_alias\": \"ts\", \"is_primary_key\": true }, {\"column_name\": \"original_time\", \"column_type\": \"timestamp\", \"column_alias\": \"ts_2\", \"is_primary_key\": false }, {\"column_name\": \"value\", \"column_alias\": \"valueaa\", \"is_primary_key\": false }, {\"column_name\": \"quality\", \"column_type\": \"int\", \"column_alias\": \"quality11\", \"is_primary_key\": false } ] }" \ + -t "taos://tdengine:6030/opc" + + + +``` + +2. 使用 CSV 配置文件 + +```shell +taosx run -f "opcua://?csv_config_file=@" -t "taos+ws://tdengine:6041/opc" +``` + +#### CSV 配置文件模板 + + +### 从 OPC-DA 同步数据到 TDengine (Windows) + +#### 配置参数 + +| 参数名称 | 类型 | 描述 | +|-----------------|--------|-----------------------------------------------------------------------------| +| interval | int | 采集间隔(单位:秒),默认为1秒 | +| concurrent | int | 采集器并发数,默认为1 | +| batch_size | int | 采集器上报的批次点位数,默认为100 | +| batch_timeout | int | 采集器上报的超时时间(单位:秒),默认为20秒 | +| connect_timeout | int | 连接的超时时间(单位:秒),默认为10秒 | +| request_timeout | int | 请求的超时时间(单位:秒),默认为10秒 | +| csv_config_file | string | 包含 OPC UA 的点位配置和表配置。与 ua.nodes 两者之间需要配置一个。CSV 的配置模版参考:OPC 需求汇总及完成现状 | +| da.tags | string | OPC-UA 测点的 NodeID。和 opc_table_config 配置结合使用,两者需要同时配置。与配置 csv_config_file 配置互斥,csv_config_file 优先生效。| +| opc_table_config | string | OPCUA 单列模式表配置。需要与 da.tags 配合使用| +| debug | bool | 启用 OPC 连接器的 debug 日志。默认为 false。| +| enable | bool | 原始数据存储。默认为 false| +| path | string | 原始数据存储路径。enable 为 true 时必须配置。| +| keep | int | 原始数据保存天数。enable 为 true 时必须配置。| + +#### 应用示例 + +```shell +taosx run \ + -f "opc+da://Matrikon.OPC.Simulation.1?nodes=localhost&da.tags=Random.Real8::tb3::c1::int" + -t "taos://tdengine:6030/opc" +``` + +以上示例的执行结果: + +采集 Matrikon.OPC.Simulation.1 服务器上 OPC DA 中 da.tags 为 Random.Real8的数据,数据类型为int,对应在 TDengine 中以表名为 tb3 ,列名为c1,列类型为 int 型 schema 来创建表(如果对应表已存在,则直接采集数据并写入)。 + +#### 常见错误排查 + +(1) 如果使用原生连接,任务启动失败并打印如下错误: +```text +Error: tmq to td task exec error + +Caused by: + 0: Error occurred while creating a new object: [0x000B] Unable to establish connection +``` +解决方式: + +检查目标端 TDengine 的 FQDN 是否联通及端口 6030 是否可正常访问。 + +(2) 如果使用 WebSocket 连接任务启动失败并打印如下错误:: + +```text +Error: tmq to td task exec error + +Caused by: + 0: WebSocket internal error: IO error: failed to lookup address information: Temporary failure in name resolution + 1: IO error: failed to lookup address information: Temporary failure in name resolution + 2: failed to lookup address information: Temporary failure in name resolution +``` + +使用 WebSocket 连接时可能遇到多种错误类型,错误信息可以在 ”Caused by“ 后查看,以下是几种可能的错误: + +- "Temporary failure in name resolution": DNS 解析错误,检查目标端 TDengine的 IP 或 FQDN 是否能够正常访问。 +- "IO error: Connection refused (os error 111)": 端口访问失败,检查目标端口是否配置正确或是否已开启和可访问(通常为6041端口)。 +- "HTTP error: *": 可能连接到错误的 taosAdapter 端口或 LSB/Nginx/Proxy 配置错误。 +- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为配置的端口不正确。 + +### 从 PI 同步数据到 TDengine (Windows) + +#### PI DSN 配置 + +PI DSN 的完整配置如下: + +```shell +pi://[:@]PIServerName/AFDatabaseName?[TemplateForPIPoint][&TemplateForAFElement][&PointList][&][&][&UpdateInterval] +``` + +在 taosX CLI 运行时支持的参数如下,其中 TemplateForPIPoint、TemplateForAFElement、PointList 三个参数至少配置一项: +- PISystemName:选填,连接配置 PI 系统服务名,默认值与 PIServerName 一致 +- MaxWaitLen:选填,数据最大缓冲条数,默认值为 1000 ,有效取值范围为 [1,10000] +- UpdateInterval:选填,PI System 取数据频率,默认值为 10000(毫秒:ms),有效取值范围为 [10,600000] +- TemplateForPIPoint:选填,使用 PI Point 模式将模板按照 element 的每个 Arrtribution 作为子表导入到 TDengine +- TemplateForAFElement:选填,使用 AF Point 模式将模板按照 element 的 Attribution 集合作为一个子表导入到 TDengine +- PointList:选填,使用 PointList 模式将指定csv文件中描述的点位信息在 PI 数据库中的数据导入到 TDengine + + +#### 应用示例 + +将位于服务器 WIN-2OA23UM12TN 中的 PI 数据库 Met1,模板 template1、template2配置为 TemplateForPIPoint模式,模板 template3、template4 配置为 TemplateForAFElement 模式,服务器 /home/ 路径下的点位文件 points.csv 配置为 PointList 模式,连接配置 PI 系统服务名为 PI,数据最大缓冲条数为1000,PI System 取数据频率为10000ms,将该库中的数据同步到 服务器 tdengine 的 pi 库中。完整的示例如下: + +```shell +taosx run \ + -f "pi://WIN-2OA23UM12TN/Met1?TemplateForPIPoint=template1,template2&TemplateForAFElement=template3,template4" \ + -t "taos://tdengine:6030/pi" +``` + + +#### 常见错误排查 + +(1) 如果使用原生连接,任务启动失败并打印如下错误: +```text +Error: tmq to td task exec error + +Caused by: + 0: Error occurred while creating a new object: [0x000B] Unable to establish connection +``` +解决方式: + +检查目标端 TDengine 的 FQDN 是否联通及端口 6030 是否可正常访问。 + +(2) 如果使用 WebSocket 连接任务启动失败并打印如下错误:: + +```text +Error: tmq to td task exec error + +Caused by: + 0: WebSocket internal error: IO error: failed to lookup address information: Temporary failure in name resolution + 1: IO error: failed to lookup address information: Temporary failure in name resolution + 2: failed to lookup address information: Temporary failure in name resolution +``` + +使用 WebSocket 连接时可能遇到多种错误类型,错误信息可以在 ”Caused by“ 后查看,以下是几种可能的错误: + +- "Temporary failure in name resolution": DNS 解析错误,检查目标端 TDengine的 IP 或 FQDN 是否能够正常访问。 +- "IO error: Connection refused (os error 111)": 端口访问失败,检查目标端口是否配置正确或是否已开启和可访问(通常为6041端口)。 +- "HTTP error: *": 可能连接到错误的 taosAdapter 端口或 LSB/Nginx/Proxy 配置错误。 +- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为配置的端口不正确。 + + +### 从 InfluxDB 同步数据到 TDengine + +#### 命令行参数 + +将数据从 InfluxDB 同步至 TDengine 的命令,如下所示: + +```bash +taosx run --from "" --to "" +``` + +其中,InfluxDB DSN 符合 DSN 的通用规则,这里仅对其特有的参数进行说明: +- version: 必填,InfluxDB 的版本,主要用于区分 1.x 与 2.x 两个版本,二者使用不同的认证参数; +- version = 1.x + - username: 必填,InfluxDB 用户,该用户至少在该组织中拥有读取权限; + - password: 必填,InfluxDB 用户的登陆密码; +- version = 2.x + - orgId: 必填,InfluxDB 中的 Orgnization ID; + - token: 必填,InfluxDB 中生成的 API token, 这个 token 至少要拥有以上 Bucket 的 Read 权限; +- bucket: 必填,InfluxDB 中的 Bucket 名称,一次只能同步一个 Bucket; +- measurements: 非必填,可以指定需要同步的多个 Measurements(英文逗号分割),未指定则同步全部; +- beginTime: 必填,格式为:YYYY-MM-DD'T'HH:MM:SS'Z', 时区采用 UTC 时区,例如:2023-06-01T00:00:00+0800, 即北京时间2023-06-01 00:00:00(东八区时间); +- endTime: 非必填,可以不指定该字段或值为空,格式与beginTime相同;如果未指定,提交任务后,将持续进行数据同步; +- readWindow: 非必填,可以不指定该字段或值为空,可选项为D、H、M(天、时、分);如果未指定,则默认按 M 拆分读取窗口。 + +#### 示例 + +将位于 192.168.1.10 的 InfluxDB 中, Bucket 名称为 test_bucket, 从UTC时间2023年06月01日00时00分00秒开始的数据,通过运行在 192.168.1.20 上的 taoskeeper, 同步至 TDengine 的 test_db 数据库中,完整的命令如下所示: +```bash +# version = 1.x +taosx run \ + --from "influxdb+http://192.168.1.10:8086/?version=1.7&username=test&password=123456&bucket=test_bucket&measurements=&beginTime=2023-06-01T00:00:00+0800&readWindow=M" \ + --to "taos+http://192.168.1.20:6041/test_db" \ + -vv + +# version = 2.x +taosx run \ + --from "influxdb+http://192.168.1.10:8086/?version=2.7&orgId=3233855dc7e37d8d&token=OZ2sB6Ie6qcKcYAmcHnL-i3STfLVg_IRPQjPIzjsAQ4aUxCWzYhDesNape1tp8IsX9AH0ld41C-clTgo08CGYA==&bucket=test_bucket&measurements=&beginTime=2023-06-01T00:00:00+0800&readWindow=M" \ + --to "taos+http://192.168.1.20:6041/test_db" \ + -vv +``` + +在这个命令中,未指定endTime, 所以任务会长期运行,持续同步最新的数据。 + + +### 从 OpenTSDB 同步数据到 TDengine + +#### 命令行参数 + +将数据从 OpenTSDB 同步至 TDengine 的命令,如下所示: + +```bash +taosx run --from "" --to "" +``` + +其中,OpenTSDB DSN 符合 DSN 的通用规则,这里仅对其特有的参数进行说明: +- metrics: 非必填,可以指定需要同步的多个 Metrics(英文逗号分割),未指定则同步全部; +- beginTime: 必填,格式为:YYYY-MM-DD'T'HH:MM:SS'Z', 时区采用 UTC 时区,例如:2023-06-01T00:00:00+0800, 即北京时间2023-06-01 00:00:00(东八区时间); +- endTime: 非必填,可以不指定该字段或值为空,格式与beginTime相同;如果未指定,提交任务后,将持续进行数据同步; +- readWindow: 非必填,可以不指定该字段或值为空,可选项为D、H、M(天、时、分);如果未指定,则默认按分钟拆分读取窗口。 + +#### 示例 + +将位于 192.168.1.10 的 OpenTSDB 中, Metric 名称为 test_metric1 与 test_metric2 的两个数据源, 从UTC时间2023年06月01日00时00分00秒开始的数据,通过运行在 192.168.1.20 上的 taoskeeper, 同步至 TDengine 的 test_db 数据库中,完整的命令如下所示: + +```bash +taosx run \ + --from "opentsdb+http://192.168.1.10:4242/?metrics=test_metric1,test_metric2&beginTime=2023-06-01T00:00:00+0800&readWindow=M" \ + --to "taos+http://192.168.1.20:6041/test_db" \ + -vv +``` + +在这个命令中,未指定endTime, 所以任务会长期运行,持续同步最新的数据。 + + +### 从 MQTT 同步数据到 TDengine + +目前,MQTT 连接器仅支持从 MQTT 服务端消费 JSON 格式的消息,并将其同步至 TDengine. 命令如下所示: + +```bash +taosx run --from "" --to "" --parser "@" +``` + +其中: +- `--from` 用于指定 MQTT 数据源的 DSN +- `--to` 用于指定 TDengine 的 DSN +- `--parser` 用于指定一个 JSON 格式的配置文件,该文件决定了如何解析 JSON 格式的 MQTT 消息,以及写入 TDengine 时的超级表名、子表名、字段名称和类型,以及标签名称和类型等。 + +#### MQTT DSN 配置 + +MQTT DSN 符合 DSN 的通用规则,这里仅对其特有的参数进行说明: +- topics: 必填,用于配置监听的 MQTT 主题名称和连接器支持的最大 QoS, 采用 `::` 的形式;支持配置多个主题,使用逗号分隔;配置主题时,还可以使用 MQTT 协议的支持的通配符#和+; +- version: 非必填,用于配置 MQTT 协议的版本,支持的版本包括:3.1/3.1.1/5.0, 默认值为3.1; +- clean_session: 非必填,用于配置连接器作为 MQTT 客户端连接至 MQTT 服务端时,服务端是否保存该会话信息,其默认值为 true, 即不保存会话信息; +- client_id: 必填,用于配置连接器作为 MQTT 客户端连接至 MQTT 服务端时的客户端 id; +- keep_alive: 非必填,用于配置连接器作为 MQTT 客户端,向 MQTT 服务端发出 PINGREG 消息后的等待时间,如果连接器在该时间内,未收到来自 MQTT 服务端的 PINGREQ, 连接器则主动断开连接;该配置的单位为秒,默认值为 60; +- ca: 非必填,用于指定连接器与 MQTT 服务端建立 SSL/TLS 连接时,使用的 CA 证书,其值为在证书文件的绝对路径前添加@, 例如:@/home/admin/certs/ca.crt; +- cert: 非必填,用于指定连接器与 MQTT 服务端建立 SSL/TLS 连接时,使用的客户端证书,其值为在证书文件的绝对路径前添加@, 例如:@/home/admin/certs/client.crt; +- cert_key: 非必填,用于指定连接器与 MQTT 服务端建立 SSL/TLS 连接时,使用的客户端私钥,其值为在私钥文件的绝对路径前添加@, 例如:@/home/admin/certs/client.key; +- log_level: 非必填,用于配置连接器的日志级别,连接器支持 error/warn/info/debug/trace 5种日志级别,默认值为 info. + +一个完整的 MQTT DSN 示例如下: +```bash +mqtt://:@:8883?topics=testtopic/1::2&version=3.1&clean_session=true&log_level=info&client_id=taosdata_1234&keep_alive=60&ca=@/home/admin/certs/ca.crt&cert=@/home/admin/certs/client.crt&cert_key=@/home/admin/certs/client.key +``` + +#### MQTT 连接器的解释器配置 + +连接器的解释器配置文件,即`--parser`配置项的参数,它的值为一个 JSON 文件,其配置可分为`parse`和`model`两部分,模板如下所示: + +```json +{ + "parse": { + "payload": { + "json": [ + { + "name": "ts", + "alias": "ts", + "cast": "TIMESTAMP" + }, + ... + ] + } + }, + "model": { + "using": "", + "name": "{alias}", + "columns": [ ... ], + "tags": [ ... ] + } +} +``` + +各字段的说明如下: +- parse 部分目前仅支持 json 一种 payload, json 字段的值是一个由 JSON Object 构成的 JSON Array: + - 每个 JSON Ojbect 包括 name, alias, cast 三个字段; + - name 字段用于指定如何从 MQTT 消息中提取字段,如果 MQTT 消息是一个简单的 JSON Object, 这里可以直接设置其字段名;如果 MQTT 消息是一个复杂的 JSON Object, 这里可以使用 JSON Path 提取字段,例如:`$.data.city`; + - alias 字段用于命名 MQTT 消息中的字段同步至 TDengine 后使用的名称; + - cast 字段用于指定 MQTT 消息中的字段同步至 TDengine 后使用的类型。 +- model 部分用于设置 TDengine 超级表、子表、列和标签等信息: + - using 字段用于指定超级表名称; + - name 字段用于指定子表名称,它的值可以分为前缀和变量两部分,变量为 parse 部分设置的 alias 的值,需要使用{}, 例如:d{id}; + - columns 字段用于设置 MQTT 消息中的哪些字段作为 TDengine 超级表中的列,取值为 parse 部分设置的 alias 的值;需要注意的是,这里的顺序会决定 TDengine 超级表中列的顺序,因此第一列必须为 TIMESTAMP 类型; + - tags 字段用于设置 MQTT 消息中的哪些字段作为 TDengine 超级表中的标签,取值为 parse 部分设置的 alias 的值。 + +#### 举例说明 + +在 192.168.1.10 的 1883 端口运行着一个 MQTT broker, 用户名、口令分别为admin, 123456; 现欲将其中的消息,通过运行在 192.168.1.20 的 taosadapter 同步至 TDengine 的 test 数据库中。MQTT 消息格式为: + +```json +{ + "id": 1, + "current": 10.77, + "voltage": 222, + "phase": 0.77, + "groupid": 7, + "location": "California.SanDiego" +} +``` + +MQTT 消息同步至 TDengine 时, 如果采用 meters 作为超级表名,前缀“d”拼接id字段的值作为子表名,ts, id, current, voltage, phase作为超级表的列,groupid, location作为超级表的标签,其解释器的配置如下: +```json +{ + "parse": { + "payload": { + "json": [ + { + "name": "ts", + "alias": "ts", + "cast": "TIMESTAMP" + }, + { + "name": "id", + "alias": "id", + "cast": "INT" + }, + { + "name": "voltage", + "alias": "voltage", + "cast": "INT" + }, + { + "name": "phase", + "alias": "phase", + "cast": "FLOAT" + }, + { + "name": "current", + "alias": "current", + "cast": "FLOAT" + }, + { + "name": "groupid", + "alias": "groupid", + "cast": "INT" + }, + { + "name": "location", + "alias": "location", + "cast": "VARCHAR(20)" + } + ] + } + }, + "model": { + "name": "d{id}", + "using": "meters", + "columns": [ + "ts", + "id", + "current", + "voltage", + "phase" + ], + "tags": [ + "groupid", + "location" + ] + } +} +``` + +如果以上parser配置位于`/home/admin/parser.json`中,那么完整的命令如下所示: + +```bash +taosx run \ + -f "mqtt://admin:123456@192.168.1.10:1883?topics=testtopic/1::2&version=3.1&clean_session=true&log_level=info&client_id=1234&keep_alive=60" \ + -t "taos+ws://192.168.1.20:6041/test" + --parser "@/home/admin/parser.json" + --verbose +``` + +### 从 Kafka 同步数据到 TDengine + +#### 命令行参数 + +taosx 支持从 Kafka 消费数据,写入 TDengine。命令如下所示: +```sehll +taosx run -f "" -t "" +``` +或 +```shell +taosx run -f "" -t "" --parser "@" +``` +其中: +- -f或--from: Kafka 的 DSN +- -t或--to :TDengine 的 DSN +- --parser :一个 JSON 格式的配置文件,或JSON格式的字符串。 + +#### Kafka DSN 配置的配置 + +| 参数 | 说明 | 必填? | 缺省值 | 适用于 | 示例 | +|-----|---------------|----------|---------|---------|----------| +| group| 消费者的group。允许组为空字符串,在这种情况下,生成的消费者将是无组的 | 否 | "" | 源端 | | +| topics | 指定要使用的主题。指定主题的所有可用分区都将被使用,除非在指定 topic_partitions 时被覆盖。| 该参数或topic_partitions必须至少指定一个,以便将主题分配给消费者。| None | 源端 | topics=tp1,tp2 | +| topic_partitions | 显式指定要使用的主题分区。只使用已标识主题的指定分区。 | 该参数或topics必须至少指定一个,以便将主题分配给消费者。 | None | 源端 | topic_partitions=tp1:0..2,tp2:1 | +| fallback_offset | topic偏移量时可能的值:- Earliest:接收最早的可用偏移量; - Latest:接收最近的偏移量; - ByTime(i64):用于请求在某一特定时间(ms)之前的所有消息;Unix时间戳(毫秒) | 否 | Earliest | 源端 | fallback_offset=Earliest | +| offset_storage | 定义在获取或提交组偏移量时,要使用的可用存储:- Zookeeper:基于Zookeeper的存储(从kafka 0.8.1开始可用);- Kafka:基于Kafka的存储(从Kafka 0.8.2开始可用)。这是组存储其偏移量的首选方法。 | 否 | Kafka | 源端 | offset_storage=Kafka | +| timeout | 从kafka订阅数据时,如果超时后没有获取到有效数据,退出 | 否 | 500 | 源端 | timeout=never | +| use_ssl | 是否使用SSL认证 | 否 | | 源端 | | +| cert | SSL证书的文件路径 | 否 | | | 源端 | | +| cert_key | SSL证书key的文件路径 | 否 | | 源端 || + + +#### 示例一 + +从192.168.1.92服务器的Kafka实例中消费数据,同步到192.168.1.92上的TDengine,不使用parser。 + +1. kafka + +```shell +#!/bin/bash +KAFKA_HOME=/root/zyyang/kafka_2.13-3.1.0 +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 --delete +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 --delete +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 --partitions 5 --replication-factor 1 --create +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 --partitions 1 --replication-factor 1 --create +$KAFKA_HOME/bin/kafka-console-producer.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 << EOF +{"id": 1, "message": "hello"} +{"id": 2, "message": "hello"} +{"id": 3, "message": "hello"} +{"id": 4, "message": "hello"} +{"id": 5, "message": "hello"} +EOF +$KAFKA_HOME/bin/kafka-console-producer.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 << EOF +{"id": 1, "message": "aaa"} +{"id": 2, "message": "aaa"} +{"id": 3, "message": "aaa"} +{"id": 4, "message": "aaa"} +{"id": 5, "message": "aaa"} +EOF +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp1 --describe +$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --topic tp2 --describe +``` + +2. TDengine + +```shell +drop database if exists kafka_to_taos; +create database if not exists kafka_to_taos precision 'ms'; +use kafka_to_taos; +``` + +3. taosx + +```shell +taosx run -f "kafka://192.168.1.92:9092/?topics=tp1,tp2&timeout=5000" -t "taos://192.168.1.92:6030/kafka_to_taos" --parser "{\"parse\":{\"ts\":{\"as\":\"timestamp(ms)\"},\"topic\":{\"as\":\"varchar\",\"alias\":\"t\"},\"partition\":{\"as\":\"int\",\"alias\":\"p\"},\"offset\":{\"as\":\"bigint\",\"alias\":\"o\"},\"key\":{\"as\":\"binary\",\"alias\":\"k\"},\"value\":{\"as\":\"binary\",\"alias\":\"v\"}},\"model\":[{\"name\":\"t_{t}\",\"using\":\"kafka_data\",\"tags\":[\"t\",\"p\"],\"columns\":[\"ts\",\"o\",\"k\",\"v\"]}]}" +``` + +#### 示例2 + +从192.168.1.92服务器的Kafka实例中消费数据,同步到192.168.1.92上的TDengine,使用parser解析value中的JSON数据。 + +1. kafka,同“示例1” +2. TDengine,同“示例1” +3. Taosx + +```shell +taosx run -f "kafka://192.168.1.92:9092/?topics=tp1,tp2&timeout=5000" -t "taos://192.168.0.201:6030/kafka_to_taos" --parser "{\"parse\":{\"ts\":{\"as\":\"timestamp(ms)\"},\"topic\":{\"as\":\"varchar\",\"alias\":\"t\"},\"partition\":{\"as\":\"int\",\"alias\":\"p\"},\"offset\":{\"as\":\"bigint\",\"alias\":\"o\"},\"value\":{\"json\":[\"id::int\",\"message::binary\"]}},\"model\":[{\"name\":\"t_{t}\",\"using\":\"kafka_data\",\"tags\":[\"t\",\"p\"],\"columns\":[\"ts\",\"o\",\"id\",\"message\"]}]}" +``` + +## 服务模式 + +在服务模式下, 一共需要三个组件协同完成数据迁移。 taosX,Agent 以及 taosExplorer 均已服务态运行,各种操作通过 taosExplorer 的图形界面进行。taos-Explorer 组件除了数据迁移之外,还提供了使用 TDengine 的图形化界面。 + +### 部署 taosX + +#### 配置 + +taosX 仅支持通过命令行参数进行配置。服务模式下,taosX 支持的命令行参数可以通过以下方式查看: + +``` +taosx serve --help +``` + +建议通过 Systemd 的方式,启动 taosX 的服务模式,其 Systemd 的配置文件位于:`/etc/systemd/system/taosx.service`. 如需修改 taosX 的启动参数,可以编辑该文件中的以下行: + +``` +ExecStart=/usr/bin/taosx serve -v +``` + +修改后,需执行以下命令重启 taosX 服务,使配置生效: + +``` +systemctl daemon-reload +systemctl restart taosx +``` + +#### 启动 + +Linux 系统上以 Systemd 的方式启动 taosX 的命令如下: + +```shell +systemctl start taosx +``` + +Windows 系统上,请在 "Services" 系统管理工具中找到 "taosX" 服务,然后点击 "启动这个服务"。 + +#### 问题排查 + +1. 如何修改 taosX 的日志级别? + +taosX 的日志级别是通过命令行参数指定的,默认的日志级别为 Info, 具体参数如下: +- INFO: `taosx serve -v` +- DEBUG: `taosx serve -vv` +- TRACE: `taosx serve -vvv` + +Systemd 方式启动时,如何修改命令行参数,请参考“配置”章节。 + +2. 如何查看 taosX 的日志? + +以 Systemd 方式启动时,可通过 journalctl 命令查看日志。以滚动方式,实时查看最新日志的命令如下: + +``` +journalctl -u taosx -f +``` + +### 部署 Agent + +#### 配置 + +Agent 默认的配置文件位于`/etc/taos/agent.toml`, 包含以下配置项: +- endpoint: 必填,taosX 的 GRPC endpoint +- token: 必填,在 taosExplorer 上创建 agent 时,产生的token +- debug_level: 非必填,默认为 info, 还支持 debug, trace 等级别 + +如下所示: + +```TOML +endpoint = "grpc://:6055" +token = "" +log_level = "debug" +``` + +日志保存时间设置 +日志保存的天数可以通过环境变量进行设置 TAOSX_LOGS_KEEP_DAYS, 默认为 30 天。 + +```shell +export TAOSX_LOGS_KEEP_DAYS=7 +``` + +#### 启动 + +Linux 系统上 Agent 可以通过 Systemd 命令启动: + +``` +systemctl start taosx-agent +``` + +Windows 系统上通过系统管理工具 "Services" 找到 taosx-agent 服务,然后启动它。 + +#### 问题排查 + +可以通过 journalctl 查看 Agent 的日志 + +``` +journalctl -u taosx-agent -f +``` + +### 部署 taosExplorer + + +### 数据同步功能 + +请参考 taosExplorer \ No newline at end of file diff --git a/docs/zh/18-data-transfer/02-explorer.md b/docs/zh/18-data-transfer/02-explorer.md new file mode 100644 index 0000000000..fd374cc734 --- /dev/null +++ b/docs/zh/18-data-transfer/02-explorer.md @@ -0,0 +1,128 @@ +--- +title: 基于可视化界面的数据接入和数据迁移 +--- + +本节讲述使用 taos Explorer 的可视化界面进行数据迁移,使用此功能需要依赖 taosd, taosAdapter, taosX, taos-explorer 等几个服务组件。关于 taosd 和 taosAdapter 的部署请参考 [系统部署](../../deployment/deploy),[taosX](../taosX),以及 [部署 taos-explorer](../../operation/web) + +## 功能入口 + +点击 explorer 左侧功能列表中的 "数据写入",可以配置不同类型的数据源,包括 TDengine Subscription, PI, OPC-UA, OPC-DA, InfluxDB, MQTT,Kafka, CSV 等,将它们的数据写入到当前正在被管理的 TDengine 集群中。 + +## TDengine 订阅 + +进入TDengine订阅任务配置页面: +1. 在连接协议栏中,配置连接协议,默认为原生连接,可配置为WS、WSS; +2. 在服务器栏中配置服务器的 IP 或域名; +3. 在端口栏中配置连接的端口号,默认值为6030; +4. 在主题栏中,配置可以配置订阅一个或多个数据库,或超级表或普通表,也可以是一个已创建的 Topic; +5. 在认证栏,可以配置访问 TDengine 的用户名密码,用户名默认值为 root,密码默认值为 taosdata;如果数据源为云服务实例,则可以选择令牌认证方式并配置实例 token; +6. 在订阅初始位置栏,可配置从最早数据(earliest)或最晚(latest)数据开始订阅,默认为 earliest; +7. 在超时栏配置超时时间,可配置为 never: 表示无超时时间,持续进行订阅,也可指定超时时间:5s, 1m 等,支持单位 ms(毫秒),s(秒),m(分钟),h(小时),d(天),M(月),y(年)。 +8. 在目标数据库栏中,选择本地 TDengine 的库作为目标库,点击 submit,即可启动一个 TDengine 订阅任务。 + +## Pi + +1. 在 PI 数据接入页面,设置 PI 服务器的名称、AF 数据库名称。 +2. 在监测点集栏,可以配置选择 Point 模式监测点集合、Point 模式监测的 AF 模板、AF 模式监测的 AF 模板。 +3. 在 PI 系统设置栏,可以配置 PI 系统名,默认为 PI 服务器名。 +4. 在 Data Queue 栏,可以配置 PI 连接器运行参数:MaxWaitLen(数据最大缓冲条数),默认值为 1000 ,有效取值范围为 [1,10000];UpdateInterval(PI System 取数据频率),默认值为 10000(毫秒:ms),有效取值范围为 [10,600000];重启补偿时间(Max Backfill Range,单位:天),每次重启服务时向前补偿该天数的数据,默认为1天。 +5. 在目标数据库栏,选择需要写入的 TDengine 数据库,点击 submit ,即可启动一个 PI 数据接入任务。 + +## OPC-UA + +1. 在 OPC-UA页面,配置 OPC-server 的地址,输入格式为 127.0.0.1:6666/OPCUA/ServerPath。 +2. 在认证栏,选择访问方式。可以选择匿名访问、用户名密码访问、证书访问。使用证书访问时,需配置证书文件信息、私钥文件信息、OPC-UA 安全协议和 OPC-UA 安全策略 +3. 在 Data Sets 栏,配置点位信息。(可通过“选择”按钮选择正则表达式过滤点位,每次最多能过滤出10条点位);点位配置有两种方式:1.手动输入点位信息 2.上传csv文件配置点位信息 +4. 在连接配置栏,配置连接超时间隔和采集超时间隔(单位:秒),默认值为10秒。 +5. 在采集配置栏,配置采集间隔(单位:秒)、点位数量、采集模式。采集模式可选择observe(轮询模式)和subscribe(订阅模式),默认值为observe。 +6. 在库表配置栏,配置目标 TDengine 中存储数据的超级表、子表结构信息。 +7. 在其他配置栏,配置并行度、单次采集上报批次(默认值100)、上报超时时间(单位:秒,默认值10)、是否开启debug级别日志。 +8. 在目标数据库栏,选择需要写入的 TDengine 数据库,点击 submit,即可启动一个 OPC-UA 数据接入任务。 + +## OPC-DA + +1. 在 OPC-DA页面,配置 OPC-server 的地址,输入格式为 127.0.0.1<,localhost>/Matrikon.OPC.Simulation.1。 +2. 在数据点栏,配置 OPC-DA 采集点信息。(可通过“选择”按钮选择正则表达式过滤点位,每次最多能过滤出10条点位)。点位配置有两种方式:1.手动输入点位信息 2.上传csv文件配置点位信息 +3. 在连接栏,配置连接超时时间(单位:秒,默认值为10秒)、采集超时时间(单位:秒,默认值为10秒)。 +4. 在库表配置栏,配置目标 TDengine 中存储数据的超级表、子表结构信息。 +5. 在其他配置栏,配置并行度、单次采集上报批次(默认值100)、上报超时时间(单位:秒,默认值10)、是否开启debug级别日志。 +6. 在目标数据库栏,选择需要写入的 TDengine 数据库,点击 submit,即可启动一个 OPC-DA 数据接入任务。 + +## InfluxDB + +进入 InfluxDB 数据源同步任务的编辑页面后: +1. 在服务器地址输入框, 输入 InfluxDB 服务器的地址,可以输入 IP 地址或域名,此项为必填字段; +2. 在端口输入框, 输入 InfluxDB 服务器端口,默认情况下,InfluxDB 监听8086端口的 HTTP 请求和8088端口的 HTTPS 请求,此项为必填字段; +3. 在组织 ID 输入框,输入将要同步的组织 ID,此项为必填字段; +4. 在令牌 Token 输入框,输入一个至少拥有读取这个组织 ID 下的指定 Bucket 权限的 Token, 此项为必填字段; +5. 在同步设置的起始时间项下,通过点选选择一个同步数据的起始时间,起始时间使用 UTC 时间, 此项为必填字段; +6. 在同步设置的结束时间项下,当不指定结束时间时,将持续进行最新数据的同步;当指定结束时间时,将只同步到这个结束时间为止; 结束时间使用 UTC 时间,此项为可选字段; +7. 在桶 Bucket 输入框,输入一个需要同步的 Bucket,目前只支持同步一个 Bucket 至 TDengine 数据库,此项为必填字段; +8. 在目标数据库下拉列表,选择一个将要写入的 TDengine 目标数据库 (注意:目前只支持同步到精度为纳秒的 TDengine 目标数据库),此项为必填字段; +9. 填写完成以上信息后,点击提交按钮,即可直接启动从 InfluxDB 到 TDengine 的数据同步。 + +## MQTT + +进入 MQTT 数据源同步任务的编辑页面后: +1. 在 MQTT 地址卡片,输入 MQTT 地址,必填字段,包括 IP 和 端口号,例如:192.168.1.10:1883; +2. 在认证卡片,输入 MQTT 连接器访问 MQTT 服务器时的用户名和密码,这两个字段为选填字段,如果未输入,即采用匿名认证的方式; +3. 在 SSL 证书卡片,可以选择是否打开 SSL/TLS 开关,如果打开此开关,MQTT 连接器和 MQTT 服务器之间的通信将采用 SSL/TLS 的方式进行加密;打开这个开关后,会出现 CA, 客户端证书和客户端私钥三个必填配置项,可以在这里输入证书和私钥文件的内容; +4. 在连接卡片,可以配置以下信息: + - MQTT 协议:支持3.1/3.1.1/5.0三个版本; + - Client ID: MQTT 连接器连接 MQTT 服务器时所使用的客户端 ID, 用于标识客户端的身份; + - Keep Alive: 用于配置 MQTT 连接器与 MQTT 服务器之间的Keep Alive时间,默认值为60秒; + - Clean Session: 用于配置 MQTT 连接器是否以Clean Session的方式连接至 MQTT 服务器,默认值为True; + - 订阅主题及 QoS 配置:这里用来配置监听的 MQTT 主题,以及该主题支持的最大QoS, 主题和 QoS 的配置之间用::分隔,多个主题之间用,分隔,主题的配置可以支持 MQTT 协议的通配符#和+; +5. 在其他卡片,可以配置 MQTT 连接器的日志级别,支持 error, warn, info, debug, trace 5个级别,默认值为 info; +6. MQTT Payload 解析卡片,用于配置如何解析 MQTT 消息: + - 配置表的第一行为 ts 字段,该字段为 TIMESTAMP 类型,它的值为 MQTT 连接器收到 MQTT 消息的时间; + - 配置表的第二行为 topic 字段,为该消息的主题名称,可以选择将该字段作为列或者标签同步至 TDengine; + - 配置表的第三行为 qos 字段,为该消息的 QoS 属性,可以选择将该字段作为列或者标签同步至 TDengine; + - 剩余的配置项皆为自定义字段,每个字段都需要配置:字段(来源),列(目标),列类型(目标)。字段(来源)是指该 MQTT 消息中的字段名称,当前仅支持 JSON 类型的 MQTT 消息同步,可以使用 JSON Path 语法从 MQTT 消息中提取字段,例如:$.data.id; 列(目标)是指同步至 TDengine 后的字段名称;列类型(目标)是指同步至 TDengine 后的字段类型,可以从下拉列表中选择;当且仅当以上3个配置都填写后,才能新增下一个字段; + - 如果 MQTT 消息中包含时间戳,可以选择新增一个自定义字段,将其作为同步至 TDengine 时的主键;需要注意的是,MQTT 消息中时间戳的仅支持 Unix Timestamp格式,且该字段的列类型(目标)的选择,需要与创建 TDengine 数据库时的配置一致; + - 子表命名规则:用于配置子表名称,采用“前缀+{列类型(目标)}”的格式,例如:d{id}; + - 超级表名:用于配置同步至 TDengine 时,采用的超级表名; +7. 在目标数据库卡片,可以选择同步至 TDengine 的数据库名称,支持直接从下拉列表中选择。 +8. 填写完成以上信息后,点击提交按钮,即可直接启动从 MQTT 到 TDengine 的数据同步。 + +## Kafka + +1. 在Kafka页面,配置Kafka选项,必填字段,包括:bootstrap_server,例如192.168.1.92:9092; +2. 如果使用SSL认证,在SSL认证卡中,选择cert和cert_key的文件路径; +3. 配置其他参数,topics、topic_partitions这2个参数至少填写一个,其他参数有默认值; +4. 如果消费的Kafka数据是JSON格式,可以配置parser卡片,对数据进行解析转换; +5. 在目标数据库卡片中,选择同步到TDengine的数据库名称,支持从下拉列表中选择; +6. 填写完以上信息后,点击提交按钮,即可启动从Kafka到TDengine的数据同步。 + +## CSV + +1. 在CSV页面,配置CSV选项,可设置忽略前N行,可输入具体的数字 +2. CSV的写入配置,设置批次写入量,默认是1000 +3. CSV文件解析,用于获取CSV对应的列信息: + - 上传CSV文件或者输入CSV文件的地址 + - 选择是否包包含Header + - 包含Header情况下直接执行下一步,查询出对应CSV的列信息,获取CSV的配置信息 + - 不包含Header情况,需要输入自定列信息,并以逗号分隔,然后下一步,获取CSV的配置信息 + - CSV的配置项,每个字段都需要配置:CSV列,DB列,列类型(目标),主键(整个配置只能有一个主键,且主键必须是TIMESTAMP类型),作为列,作为Tag。CSV列是指该 CSV文件中的列或者自定义的列;DB列是对应的数据表的列 + - 子表命名规则:用于配置子表名称,采用“前缀+{列类型(目标)}”的格式,例如:d{id}; + - 超级表名:用于配置同步至 TDengine 时,采用的超级表名; +4. 在目标数据库卡片,可以选择同步至 TDengine 的数据库名称,支持直接从下拉列表中选择。 +5. 填写完成以上信息后,点击提交按钮,即可直接启动从 CSV到 TDengine 的数据同步。 + + +## 备份和恢复 + +您可以将当前连接的 TDengine 集群中的数据备份至一个或多个本地文件中,稍后可以通过这些文件进行数据恢复。本章节将介绍数据备份和恢复的具体步骤。 + +### 备份数据到本地文件 + +1. 进入系统管理页面,点击【备份】进入数据备份页面,点击右上角【新增备份】。 +2. 在数据备份配置页面中可以配置三个参数: + - 备份周期:必填项,配置每次执行数据备份的时间间隔,可通过下拉框选择每天、每 7 天、每 30 天执行一次数据备份,配置后,会在对应的备份周期的0:00时启动一次数据备份任务; + - 数据库:必填项,配置需要备份的数据库名(数据库的 wal_retention_period 参数需大于0); + - 目录:必填项,配置将数据备份到 taosX 所在运行环境中指定的路径下,如 /root/data_backup; +3. 点击【确定】,可创建数据备份任务。 + +### 从本地文件恢复 + +1. 完成数据备份任务创建后,在页面中对应的数据备份任务右侧点击【数据恢复】,可将已经备份到指定路径下的数据恢复到当前 TDengine 中。 \ No newline at end of file diff --git a/docs/zh/18-data-transfer/index.md b/docs/zh/18-data-transfer/index.md new file mode 100644 index 0000000000..749ad16308 --- /dev/null +++ b/docs/zh/18-data-transfer/index.md @@ -0,0 +1,3 @@ +--- +title: 数据集成 +--- \ No newline at end of file diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index d316b3ab68..d4e4b116b7 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.1.0.3 + + + ## 3.1.0.2 diff --git a/examples/JDBC/taosdemo/pom.xml b/examples/JDBC/taosdemo/pom.xml index 0d47663bba..ff64d3e1df 100644 --- a/examples/JDBC/taosdemo/pom.xml +++ b/examples/JDBC/taosdemo/pom.xml @@ -133,6 +133,7 @@ 8 8 + UTF-8 diff --git a/examples/JDBC/taosdemo/readme.md b/examples/JDBC/taosdemo/readme.md index edac970399..986eef8a05 100644 --- a/examples/JDBC/taosdemo/readme.md +++ b/examples/JDBC/taosdemo/readme.md @@ -8,4 +8,4 @@ java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -data ``` 如果发生错误 Exception in thread "main" java.lang.UnsatisfiedLinkError: no taos in java.library.path -请检查是否安装 TDengine 客户端安装包或编译 TDengine 安装。如果确定已经安装过还出现这个错误,可以在命令行 java 后加 -Djava.library.path=/usr/local/lib 来指定寻找共享库的路径。 +请检查是否安装 TDengine 客户端安装包或编译 TDengine 安装。如果确定已经安装过还出现这个错误,可以在命令行 java 后加 -Djava.library.path=/usr/lib 来指定寻找共享库的路径。 diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 5fd174e873..aff5945f9f 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -102,6 +102,11 @@ extern uint16_t tsMonitorPort; extern int32_t tsMonitorMaxLogs; extern bool tsMonitorComp; +// audit +extern bool tsEnableAudit; +extern char tsAuditFqdn[]; +extern uint16_t tsAuditPort; + // telem extern bool tsEnableTelem; extern int32_t tsTelemInterval; @@ -130,6 +135,7 @@ extern bool tsKeepColumnName; extern bool tsEnableQueryHb; extern bool tsEnableScience; extern bool tsTtlChangeOnWrite; +extern int32_t tsTtlFlushThreshold; extern int32_t tsRedirectPeriod; extern int32_t tsRedirectFactor; extern int32_t tsRedirectMaxPeriod; @@ -161,6 +167,7 @@ extern char tsCompressor[]; // tfs extern int32_t tsDiskCfgNum; extern SDiskCfg tsDiskCfg[]; +extern int64_t tsMinDiskFreeSize; // udf extern bool tsStartUdfd; @@ -185,7 +192,9 @@ extern int32_t tsTransPullupInterval; extern int32_t tsMqRebalanceInterval; extern int32_t tsStreamCheckpointTickInterval; extern int32_t tsTtlUnit; -extern int32_t tsTtlPushInterval; +extern int32_t tsTtlPushIntervalSec; +extern int32_t tsTtlBatchDropNum; +extern int32_t tsTrimVDbIntervalSec; extern int32_t tsGrantHBInterval; extern int32_t tsUptimeInterval; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 47c030cde5..8ba2cf1cc5 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -443,7 +443,6 @@ typedef struct SField { uint8_t type; int8_t flags; int32_t bytes; - char comment[TSDB_COL_COMMENT_LEN]; } SField; typedef struct SRetention { @@ -522,7 +521,6 @@ struct SSchema { col_id_t colId; int32_t bytes; char name[TSDB_COL_NAME_LEN]; - char comment[TSDB_COL_COMMENT_LEN]; }; struct SSchema2 { @@ -771,6 +769,8 @@ typedef struct { char* pAst2; int64_t deleteMark1; int64_t deleteMark2; + int32_t sqlLen; + char* sql; } SMCreateStbReq; int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq); @@ -791,6 +791,8 @@ typedef struct { int8_t source; // 1-taosX or 0-taosClient int8_t reserved[6]; tb_uid_t suid; + int32_t sqlLen; + char* sql; } SMDropStbReq; int32_t tSerializeSMDropStbReq(void* buf, int32_t bufLen, SMDropStbReq* pReq); @@ -804,6 +806,8 @@ typedef struct { int32_t ttl; int32_t commentLen; char* comment; + int32_t sqlLen; + char* sql; } SMAlterStbReq; int32_t tSerializeSMAlterStbReq(void* buf, int32_t bufLen, SMAlterStbReq* pReq); @@ -873,6 +877,8 @@ int32_t tDeserializeSCreateAcctReq(void* buf, int32_t bufLen, SCreateAcctReq* pR typedef struct { char user[TSDB_USER_LEN]; + int32_t sqlLen; + char *sql; } SDropUserReq, SDropAcctReq; int32_t tSerializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq); @@ -885,6 +891,8 @@ typedef struct { int8_t enable; char user[TSDB_USER_LEN]; char pass[TSDB_USET_PASSWORD_LEN]; + int32_t sqlLen; + char* sql; } SCreateUserReq; int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq); @@ -901,6 +909,8 @@ typedef struct { char tabName[TSDB_TABLE_NAME_LEN]; char* tagCond; int32_t tagCondLen; + int32_t sqlLen; + char* sql; } SAlterUserReq; int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq); @@ -1063,6 +1073,8 @@ typedef struct { int16_t hashPrefix; int16_t hashSuffix; int32_t tsdbPageSize; + int32_t sqlLen; + char* sql; } SCreateDbReq; int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq); @@ -1088,6 +1100,8 @@ typedef struct { int32_t minRows; int32_t walRetentionPeriod; int32_t walRetentionSize; + int32_t sqlLen; + char* sql; } SAlterDbReq; int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); @@ -1096,6 +1110,8 @@ int32_t tDeserializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); typedef struct { char db[TSDB_DB_FNAME_LEN]; int8_t ignoreNotExists; + int32_t sqlLen; + char* sql; } SDropDbReq; int32_t tSerializeSDropDbReq(void* buf, int32_t bufLen, SDropDbReq* pReq); @@ -1163,6 +1179,9 @@ int32_t tDeserializeSVTrimDbReq(void* buf, int32_t bufLen, SVTrimDbReq* pReq); typedef struct { int32_t timestampSec; + int32_t ttlDropMaxCount; + int32_t nUids; + SArray* pTbUids; } SVDropTtlTableReq; int32_t tSerializeSVDropTtlTableReq(void* buf, int32_t bufLen, SVDropTtlTableReq* pReq); @@ -1290,6 +1309,8 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp); typedef struct { char db[TSDB_DB_FNAME_LEN]; STimeWindow timeRange; + int32_t sqlLen; + char* sql; } SCompactDbReq; int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq); @@ -1419,6 +1440,7 @@ typedef struct { int64_t numOfProcessedCQuery; int64_t numOfProcessedFetch; int64_t numOfProcessedDrop; + int64_t numOfProcessedNotify; int64_t numOfProcessedHb; int64_t numOfProcessedDelete; int64_t cacheDataSize; @@ -1852,6 +1874,8 @@ void tFreeSExplainRsp(SExplainRsp* pRsp); typedef struct { char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port int32_t port; + int32_t sqlLen; + char* sql; } SCreateDnodeReq; int32_t tSerializeSCreateDnodeReq(void* buf, int32_t bufLen, SCreateDnodeReq* pReq); @@ -1863,6 +1887,8 @@ typedef struct { int32_t port; int8_t force; int8_t unsafe; + int32_t sqlLen; + char* sql; } SDropDnodeReq; int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq); @@ -1878,6 +1904,8 @@ enum { typedef struct { int32_t dnodeId; int8_t restoreType; + int32_t sqlLen; + char* sql; } SRestoreDnodeReq; int32_t tSerializeSRestoreDnodeReq(void* buf, int32_t bufLen, SRestoreDnodeReq* pReq); @@ -1887,6 +1915,8 @@ typedef struct { int32_t dnodeId; char config[TSDB_DNODE_CONFIG_LEN]; char value[TSDB_DNODE_VALUE_LEN]; + int32_t sqlLen; + char* sql; } SMCfgDnodeReq; int32_t tSerializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq); @@ -1902,6 +1932,8 @@ int32_t tDeserializeSDCfgDnodeReq(void* buf, int32_t bufLen, SDCfgDnodeReq* pReq typedef struct { int32_t dnodeId; + int32_t sqlLen; + char *sql; } SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq, SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, SMCreateSnodeReq, SMDropSnodeReq, SDCreateSnodeReq, SDDropSnodeReq; @@ -1942,6 +1974,8 @@ int32_t tDeserializeSKillTransReq(void* buf, int32_t bufLen, SKillTransReq* pReq typedef struct { int32_t useless; // useless + int32_t sqlLen; + char* sql; } SBalanceVgroupReq; int32_t tSerializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq* pReq); @@ -1960,6 +1994,8 @@ typedef struct { int32_t dnodeId1; int32_t dnodeId2; int32_t dnodeId3; + int32_t sqlLen; + char* sql; } SRedistributeVgroupReq; int32_t tSerializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistributeVgroupReq* pReq); @@ -1967,6 +2003,8 @@ int32_t tDeserializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistrib typedef struct { int32_t useless; + int32_t sqlLen; + char* sql; } SBalanceVgroupLeaderReq; int32_t tSerializeSBalanceVgroupLeaderReq(void* buf, int32_t bufLen, SBalanceVgroupLeaderReq* pReq); @@ -2160,8 +2198,24 @@ typedef struct { int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); -int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); -int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); + + +typedef enum { + TASK_NOTIFY_FINISHED = 1, +} ETaskNotifyType; + +typedef struct { + SMsgHead header; + uint64_t sId; + uint64_t queryId; + uint64_t taskId; + int64_t refId; + int32_t execId; + ETaskNotifyType type; +} STaskNotifyReq; + +int32_t tSerializeSTaskNotifyReq(void* buf, int32_t bufLen, STaskNotifyReq* pReq); +int32_t tDeserializeSTaskNotifyReq(void* buf, int32_t bufLen, STaskNotifyReq* pReq); int32_t tSerializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp); int32_t tDeserializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp); @@ -2210,6 +2264,7 @@ typedef struct { int64_t deleteMark; int8_t igUpdate; int64_t lastTs; + int32_t sqlLen; } SCMCreateStreamReq; typedef struct { @@ -2246,6 +2301,7 @@ typedef struct { char subDbName[TSDB_DB_FNAME_LEN]; char* ast; char subStbName[TSDB_TABLE_FNAME_LEN]; + int32_t sqlLen; } SCMCreateTopicReq; int32_t tSerializeSCMCreateTopicReq(void* buf, int32_t bufLen, const SCMCreateTopicReq* pReq); @@ -2430,6 +2486,8 @@ typedef struct { typedef struct { char name[TSDB_TOPIC_FNAME_LEN]; int8_t igNotExists; + int32_t sqlLen; + char* sql; } SMDropTopicReq; int32_t tSerializeSMDropTopicReq(void* buf, int32_t bufLen, SMDropTopicReq* pReq); @@ -2529,6 +2587,8 @@ typedef struct SVCreateTbReq { SSchemaWrapper schemaRow; } ntb; }; + int32_t sqlLen; + char* sql; } SVCreateTbReq; int tEncodeSVCreateTbReq(SEncoder* pCoder, const SVCreateTbReq* pReq); @@ -2632,9 +2692,6 @@ typedef struct { int8_t type; int8_t flags; int32_t bytes; - bool hasColComment; - char* colComment; - int32_t colCommentLen; // TSDB_ALTER_TABLE_DROP_COLUMN // TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES int8_t colModType; @@ -3006,6 +3063,8 @@ typedef struct { typedef struct { char name[TSDB_STREAM_FNAME_LEN]; int8_t igNotExists; + int32_t sqlLen; + char* sql; } SMDropStreamReq; typedef struct { diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 483122b070..29f0667dac 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -65,7 +65,7 @@ enum { #define TD_NEW_MSG_SEG(TYPE) TYPE = ((TYPE##_SEG_CODE) << 8), #define TD_DEF_MSG_TYPE(TYPE, MSG, REQ, RSP) TYPE, TYPE##_RSP, -enum { +enum { // WARN: new msg should be appended to segment tail #endif TD_NEW_MSG_SEG(TDMT_DND_MSG) TD_DEF_MSG_TYPE(TDMT_DND_CREATE_MNODE, "dnode-create-mnode", NULL, NULL) @@ -89,15 +89,15 @@ enum { TD_NEW_MSG_SEG(TDMT_MND_MSG) TD_DEF_MSG_TYPE(TDMT_MND_CONNECT, "connect", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_CREATE_ACCT, "create-acct", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CREATE_ACCT, "create-acct", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_ACCT, "alter-acct", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_DROP_ACCT, "drop-acct", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_CREATE_USER, "create-user", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CREATE_USER, "create-user", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_USER, "alter-user", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_DROP_USER, "drop-user", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_GET_USER_AUTH, "get-user-auth", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_DROP_USER, "drop-user", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_GET_USER_AUTH, "get-user-auth", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_CREATE_DNODE, "create-dnode", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_DNODE, "config-dnode", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_DNODE, "config-dnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_DROP_DNODE, "drop-dnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_CREATE_MNODE, "create-mnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_MNODE, "alter-mnode", NULL, NULL) @@ -182,6 +182,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_RESTORE_DNODE, "restore-dnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_PAUSE_STREAM, "pause-stream", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_RESUME_STREAM, "resume-stream", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_TRIM_DB_TIMER, "trim-db-tmr", NULL, NULL) TD_NEW_MSG_SEG(TDMT_VND_MSG) TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp) @@ -243,6 +244,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "drop-task", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_TASK_NOTIFY, "task-notify", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_MAX_MSG, "sch-max", NULL, NULL) @@ -296,7 +298,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_SYNC_PRE_SNAPSHOT_REPLY, "sync-pre-snapshot-reply", NULL, NULL) // no longer used TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_FORCE_FOLLOWER, "sync-force-become-follower", NULL, NULL) - + TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_SCAN_HISTORY, "vnode-stream-scan-history", NULL, NULL) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index d0fb1cdafa..9b2ea843ce 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,7 +16,6 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ - #define TK_OR 1 #define TK_AND 2 #define TK_UNION 3 @@ -116,7 +115,7 @@ #define TK_TABLE_PREFIX 97 #define TK_TABLE_SUFFIX 98 #define TK_NK_COLON 99 -#define TK_MAX_SPEED 100 +#define TK_BWLIMIT 100 #define TK_START 101 #define TK_TIMESTAMP 102 #define TK_END 103 @@ -132,25 +131,25 @@ #define TK_NK_EQ 113 #define TK_USING 114 #define TK_TAGS 115 -#define TK_COMMENT 116 -#define TK_BOOL 117 -#define TK_TINYINT 118 -#define TK_SMALLINT 119 -#define TK_INT 120 -#define TK_INTEGER 121 -#define TK_BIGINT 122 -#define TK_FLOAT 123 -#define TK_DOUBLE 124 -#define TK_BINARY 125 -#define TK_NCHAR 126 -#define TK_UNSIGNED 127 -#define TK_JSON 128 -#define TK_VARCHAR 129 -#define TK_MEDIUMBLOB 130 -#define TK_BLOB 131 -#define TK_VARBINARY 132 -#define TK_GEOMETRY 133 -#define TK_DECIMAL 134 +#define TK_BOOL 116 +#define TK_TINYINT 117 +#define TK_SMALLINT 118 +#define TK_INT 119 +#define TK_INTEGER 120 +#define TK_BIGINT 121 +#define TK_FLOAT 122 +#define TK_DOUBLE 123 +#define TK_BINARY 124 +#define TK_NCHAR 125 +#define TK_UNSIGNED 126 +#define TK_JSON 127 +#define TK_VARCHAR 128 +#define TK_MEDIUMBLOB 129 +#define TK_BLOB 130 +#define TK_VARBINARY 131 +#define TK_GEOMETRY 132 +#define TK_DECIMAL 133 +#define TK_COMMENT 134 #define TK_MAX_DELAY 135 #define TK_WATERMARK 136 #define TK_ROLLUP 137 @@ -357,7 +356,6 @@ #define TK_VIEW 338 #define TK_WAL 339 - #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 #define TK_NK_ILLEGAL 602 diff --git a/include/common/ttypes.h b/include/common/ttypes.h index dd8033eb43..279799b172 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -269,8 +269,8 @@ typedef struct { (IS_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP)) #define IS_VAR_DATA_TYPE(t) \ - (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) -#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) + (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) +#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR)) #define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX) #define IS_VALID_SMALLINT(_t) ((_t) >= INT16_MIN && (_t) <= INT16_MAX) diff --git a/include/libs/audit/audit.h b/include/libs/audit/audit.h new file mode 100644 index 0000000000..1381b6e4a2 --- /dev/null +++ b/include/libs/audit/audit.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_AUDIT_H_ +#define _TD_AUDIT_H_ + +#include "tarray.h" +#include "tdef.h" +#include "tlog.h" +#include "tmsg.h" +#include "tjson.h" +#include "tmsgcb.h" +#include "trpc.h" +#include "mnode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + const char *server; + uint16_t port; + bool comp; +} SAuditCfg; + +int32_t auditInit(const SAuditCfg *pCfg); +void auditSend(SJson *pJson); +void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_MONITOR_H_*/ diff --git a/include/libs/executor/dataSinkMgt.h b/include/libs/executor/dataSinkMgt.h index 617ca7c23a..2e2882e35e 100644 --- a/include/libs/executor/dataSinkMgt.h +++ b/include/libs/executor/dataSinkMgt.h @@ -59,7 +59,7 @@ typedef struct SDataSinkMgtCfg { uint32_t maxDataBlockNumPerQuery; } SDataSinkMgtCfg; -int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI); +int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI, void** ppSinkManager); typedef struct SInputData { const struct SSDataBlock* pData; @@ -83,7 +83,7 @@ typedef struct SOutputData { * @param pHandle output * @return error code */ -int32_t dsCreateDataSinker(const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id); +int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id); int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat); diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h index 995198bc9e..935f9f9b03 100644 --- a/include/libs/function/taosudf.h +++ b/include/libs/function/taosudf.h @@ -109,8 +109,8 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 65535 #define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE)) #define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len)) #define IS_VAR_DATA_TYPE(t) \ - (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) -#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) + (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) +#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_VARBINARY) || ((t) == TSDB_DATA_TYPE_NCHAR)) static FORCE_INLINE char *udfColDataGetData(const SUdfColumn *pColumn, int32_t row) { if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index ff02070882..f0a715e651 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -23,11 +23,10 @@ extern "C" { #include "query.h" #include "querynodes.h" -#define DESCRIBE_RESULT_COLS 5 -#define DESCRIBE_RESULT_FIELD_LEN (TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE) -#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE) -#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE) -#define DESCRIBE_RESULT_COL_COMMENT_LEN (TSDB_COL_COMMENT_LEN) +#define DESCRIBE_RESULT_COLS 4 +#define DESCRIBE_RESULT_FIELD_LEN (TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE) +#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE) +#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE) #define SHOW_CREATE_DB_RESULT_COLS 2 #define SHOW_CREATE_DB_RESULT_FIELD1_LEN (TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE) @@ -156,7 +155,7 @@ typedef struct SColumnDefNode { ENodeType type; char colName[TSDB_COL_NAME_LEN]; SDataType dataType; - char comments[TSDB_COL_COMMENT_LEN]; + char comments[TSDB_TB_COMMENT_LEN]; bool sma; } SColumnDefNode; @@ -215,7 +214,6 @@ typedef struct SAlterTableStmt { char newColName[TSDB_COL_NAME_LEN]; STableOptions* pOptions; SDataType dataType; - char colComment[TSDB_COL_COMMENT_LEN]; SValueNode* pVal; } SAlterTableStmt; diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 58bdb77df3..2dc5c8f112 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -114,6 +114,7 @@ int32_t smlBuildRow(STableDataCxt* pTableCxt); int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* kv, int32_t index); STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta); +void clearColValArraySml(SArray* pCols); int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsSchema, SArray* cols, STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl, char* msgBuf, int32_t msgBufLen); diff --git a/include/libs/qworker/qworker.h b/include/libs/qworker/qworker.h index 60ed94d4de..bbd2d76b59 100644 --- a/include/libs/qworker/qworker.h +++ b/include/libs/qworker/qworker.h @@ -45,6 +45,7 @@ typedef struct { uint64_t cqueryProcessed; uint64_t fetchProcessed; uint64_t dropProcessed; + uint64_t notifyProcessed; uint64_t hbProcessed; uint64_t deleteProcessed; @@ -90,6 +91,8 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts); +int32_t qWorkerProcessNotifyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts); + int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts); int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SDeleteRes *pRes); diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 02bb65b762..b47288bf45 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -189,7 +189,7 @@ int32_t streamInit(); void streamCleanUp(); SStreamQueue* streamQueueOpen(int64_t cap); -void streamQueueClose(SStreamQueue* queue); +void streamQueueClose(SStreamQueue* pQueue, int32_t taskId); static FORCE_INLINE void streamQueueProcessSuccess(SStreamQueue* queue) { ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); diff --git a/include/os/osString.h b/include/os/osString.h index b609c9d351..4982ac8bfd 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -90,6 +90,11 @@ int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix); uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix); double taosStr2Double(const char *str, char **pEnd); float taosStr2Float(const char *str, char **pEnd); +int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size); +int32_t taosAscii2Hex(const char *z, uint32_t n, void** data, uint32_t* size); +//int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size); +bool isHex(const char* z, uint32_t n); +bool isValidateHex(const char* z, uint32_t n); #ifdef __cplusplus } diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 629b597d0c..4a3f0d3a70 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -709,6 +709,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INVALID_OPTR_USAGE TAOS_DEF_ERROR_CODE(0, 0x2667) #define TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2668) #define TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED TAOS_DEF_ERROR_CODE(0, 0x2669) +#define TSDB_CODE_PAR_INVALID_VARBINARY TAOS_DEF_ERROR_CODE(0, 0x266A) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/include/util/tcompare.h b/include/util/tcompare.h index 2fa736f4df..65457b287a 100644 --- a/include/util/tcompare.h +++ b/include/util/tcompare.h @@ -102,6 +102,7 @@ int32_t compareUint64ValDesc(const void *pLeft, const void *pRight); int32_t compareLenPrefixedStrDesc(const void *pLeft, const void *pRight); int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight); +int32_t compareLenBinaryValDesc(const void *pLeft, const void *pRight); int32_t comparestrPatternMatch(const void *pLeft, const void *pRight); int32_t comparestrPatternNMatch(const void *pLeft, const void *pRight); @@ -202,7 +203,6 @@ int32_t compareUint64Uint32(const void *pLeft, const void *pRight); __compar_fn_t getComparFunc(int32_t type, int32_t optr); __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order); -int32_t doCompare(const char *a, const char *b, int32_t type, size_t size); #ifdef __cplusplus } diff --git a/include/util/tdef.h b/include/util/tdef.h index 1e12f12087..6a37ecef5d 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -200,7 +200,7 @@ typedef enum ELogicConditionType { #define TSDB_STREAM_NAME_LEN 193 // it is a null-terminated string #define TSDB_DB_NAME_LEN 65 #define TSDB_DB_FNAME_LEN (TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN + TSDB_NAME_DELIMITER_LEN) -#define TSDB_PRIVILEDGE_CONDITION_LEN 48*1024 +#define TSDB_PRIVILEDGE_CONDITION_LEN 48 * 1024 #define TSDB_FUNC_NAME_LEN 65 #define TSDB_FUNC_COMMENT_LEN 1024 * 1024 @@ -230,7 +230,6 @@ typedef enum ELogicConditionType { #define TSDB_APP_NAME_LEN TSDB_UNI_LEN #define TSDB_TB_COMMENT_LEN 1025 -#define TSDB_COL_COMMENT_LEN 1025 #define TSDB_QUERY_ID_LEN 26 #define TSDB_TRANS_OPER_LEN 16 @@ -377,12 +376,12 @@ typedef enum ELogicConditionType { #define TSDB_MAX_STT_TRIGGER 1 #define TSDB_DEFAULT_SST_TRIGGER 1 #endif -#define TSDB_MIN_HASH_PREFIX (2 - TSDB_TABLE_NAME_LEN) -#define TSDB_MAX_HASH_PREFIX (TSDB_TABLE_NAME_LEN - 2) -#define TSDB_DEFAULT_HASH_PREFIX 0 -#define TSDB_MIN_HASH_SUFFIX (2 - TSDB_TABLE_NAME_LEN) -#define TSDB_MAX_HASH_SUFFIX (TSDB_TABLE_NAME_LEN - 2) -#define TSDB_DEFAULT_HASH_SUFFIX 0 +#define TSDB_MIN_HASH_PREFIX (2 - TSDB_TABLE_NAME_LEN) +#define TSDB_MAX_HASH_PREFIX (TSDB_TABLE_NAME_LEN - 2) +#define TSDB_DEFAULT_HASH_PREFIX 0 +#define TSDB_MIN_HASH_SUFFIX (2 - TSDB_TABLE_NAME_LEN) +#define TSDB_MAX_HASH_SUFFIX (TSDB_TABLE_NAME_LEN - 2) +#define TSDB_DEFAULT_HASH_SUFFIX 0 #define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1 #define TSDB_REP_DEF_DB_WAL_RET_PERIOD 3600 @@ -417,9 +416,10 @@ typedef enum ELogicConditionType { #define TSDB_EXPLAIN_RESULT_COLUMN_NAME "QUERY_PLAN" #define TSDB_MAX_FIELD_LEN 65519 // 16384:65519 -#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 -#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 -#define TSDB_MAX_GEOMETRY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_GEOMETRY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_VARBINARY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 #define PRIMARYKEY_TIMESTAMP_COL_ID 1 #define COL_REACH_END(colId, maxColId) ((colId) > (maxColId)) diff --git a/packaging/MPtestJenkinsfile b/packaging/MPtestJenkinsfile index 0570bae191..1b2e555b88 100644 --- a/packaging/MPtestJenkinsfile +++ b/packaging/MPtestJenkinsfile @@ -114,7 +114,7 @@ pipeline { sync_source("${BRANCH_NAME}") sh ''' if [ "${verMode}" = "all" ];then - verMode="community enterprise" + verMode="enterprise" fi verModeList=${verMode} for verModeSin in ${verModeList} @@ -123,18 +123,6 @@ pipeline { bash testpackage.sh -m ${verModeSin} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar python3 checkPackageRuning.py done - ''' - - sh ''' - cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh -m community -f server -l true -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar - python3 checkPackageRuning.py - ''' - - sh ''' - cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh -m community -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t deb - python3 checkPackageRuning.py ''' } } diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm index 0d63115a04..a474dc4c80 100644 --- a/packaging/deb/DEBIAN/prerm +++ b/packaging/deb/DEBIAN/prerm @@ -37,6 +37,7 @@ else ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index 07819159c4..eca75ce71a 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -98,6 +98,7 @@ cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_pat cp ${compile_dir}/../include/client/taos.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/common/taosdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/util/taoserror.h ${pkg_dir}${install_home_path}/include +cp ${compile_dir}/../include/util/tdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/libs/function/taosudf.h ${pkg_dir}${install_home_path}/include [ -f ${compile_dir}/build/include/taosws.h ] && cp ${compile_dir}/build/include/taosws.h ${pkg_dir}${install_home_path}/include ||: cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index 846d17e7f6..e93af2470a 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -95,6 +95,7 @@ cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driv cp %{_compiledir}/../include/client/taos.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/common/taosdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/util/taoserror.h %{buildroot}%{homepath}/include +cp %{_compiledir}/../include/util/tdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/libs/function/taosudf.h %{buildroot}%{homepath}/include [ -f %{_compiledir}/build/include/taosws.h ] && cp %{_compiledir}/build/include/taosws.h %{buildroot}%{homepath}/include ||: #cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector @@ -217,6 +218,7 @@ if [ $1 -eq 0 ];then ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index f9a11f5540..408a5664a8 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -345,7 +345,7 @@ function install_jemalloc() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : @@ -353,6 +353,7 @@ function install_header() { ${csudo}ln -sf ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -sf ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -sf ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -sf ${install_main_dir}/include/tdef.h ${inc_link_dir}/tdef.h ${csudo}ln -sf ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h [ -f ${install_main_dir}/include/taosws.h ] && ${csudo}ln -sf ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h || : @@ -935,7 +936,7 @@ function updateProduct() { fi echo echo -e "\033[44;32;1m${productName2} is updated successfully!${NC}" - echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation and explorer features, you need to install ${clientName2}Explorer ${NC}" + echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation or explorer features, please install ${clientName2}Explorer ${NC}" else install_bin install_config @@ -1028,7 +1029,7 @@ function installProduct() { fi echo -e "\033[44;32;1m${productName2} is installed successfully!${NC}" - echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation and explorer features, you need to install ${clientName2}Explorer ${NC}" + echo -e "\033[44;32;1mTo manage ${productName2} instance, view documentation or explorer features, please install ${clientName2}Explorer ${NC}" echo else # Only install client install_bin diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index 18ebf9dc8f..c8baab8269 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -180,10 +180,11 @@ function install_lib() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h + ${csudo}ln -s ${install_main_dir}/include/tdef.h ${inc_link_dir}/tdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 0a5f9d2668..ea19125bf5 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -158,7 +158,6 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/udfd || : ${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taosdump || : - ${csudo}rm -f ${bin_link_dir}/taosx || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : if [ "$osType" != "Darwin" ]; then @@ -348,9 +347,9 @@ function install_lib() { function install_header() { ${csudo}mkdir -p ${inc_link_dir} - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h ||: - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/util/tdef.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* if [ -f ${binary_dir}/build/include/taosws.h ]; then @@ -361,6 +360,7 @@ function install_header() { ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h > /dev/null 2>&1 ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h > /dev/null 2>&1 ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h > /dev/null 2>&1 + ${csudo}ln -s ${install_main_dir}/include/tdef.h ${inc_link_dir}/tdef.h > /dev/null 2>&1 ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h > /dev/null 2>&1 ${csudo}chmod 644 ${install_main_dir}/include/* diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index cd59294fe7..243efd693e 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -83,7 +83,7 @@ else wslib_files="${build_dir}/lib/libtaosws.dylib" fi -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/util/tdef.h ${code_dir}/include/libs/function/taosudf.h" wsheader_files="${build_dir}/include/taosws.h" if [ "$dbName" != "taos" ]; then diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index ad64ca431e..655629b92c 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -115,7 +115,7 @@ else lib_files="${build_dir}/lib/libtaos.so.${version}" wslib_files="${build_dir}/lib/libtaosws.so" fi -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/util/tdef.h ${code_dir}/include/libs/function/taosudf.h" wsheader_files="${build_dir}/include/taosws.h" diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index e79a10c9e9..ceaebfdc7c 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -133,12 +133,13 @@ function kill_taosd() { function install_include() { log_print "start install include from ${inc_dir} to ${inc_link_dir}" ${csudo}mkdir -p ${inc_link_dir} - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/tdef.h ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h ||: ${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${inc_dir}/tdef.h ${inc_link_dir}/tdef.h ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h [ -f ${inc_dir}/taosws.h ] && ${csudo}ln -sf ${inc_dir}/taosws.h ${inc_link_dir}/taosws.h ||: diff --git a/packaging/tools/preun.sh b/packaging/tools/preun.sh index 68f6b53c45..25f3d8ce4a 100755 --- a/packaging/tools/preun.sh +++ b/packaging/tools/preun.sh @@ -143,6 +143,7 @@ ${csudo}rm -f ${cfg_link_dir}/*.new || : ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : +${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index eca0c5e973..0e8b036f28 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -155,6 +155,7 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index 2bdb56fac2..695307254d 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -73,6 +73,7 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : ${csudo}rm -f ${inc_link_dir}/taosudf.h || : } diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 1839c14894..30d4792279 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -251,7 +251,6 @@ int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32 int32_t smlClearForRerun(SSmlHandle *info); int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg); uint8_t smlGetTimestampLen(int64_t num); -void clearColValArray(SArray* pCols); void smlDestroyTableInfo(void *para); void freeSSmlKv(void* data); diff --git a/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h b/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h index 422bcd57ac..ebc4eacdf9 100644 --- a/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h +++ b/source/client/jni/com_taosdata_jdbc_tmq_TMQConnector.h @@ -92,6 +92,10 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscriptionIm */ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNIEnv *, jobject, jlong, jlong); +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAllSync(JNIEnv *, jobject, jlong); + +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitOffsetSyncImp(JNIEnv *, jobject, jlong, jstring, + jint, jlong); /* * Class: com_taosdata_jdbc_tmq_TMQConnector * Method: tmqCommitAsync @@ -102,6 +106,12 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JN JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAsync(JNIEnv *, jobject, jlong, jlong, jobject); +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAllAsync(JNIEnv *, jobject, jlong, + jobject); + +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitOffsetAsync(JNIEnv *, jobject, jlong, + jstring, jint, jlong, jobject); + /* * Class: com_taosdata_jdbc_tmq_TMQConnector * Method: tmqUnsubscribeImp @@ -179,6 +189,11 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSeekImp(JNIEnv JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssignmentImp(JNIEnv *, jobject, jlong, jstring, jobject); +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp(JNIEnv *, jobject, jlong, jstring, + jint); + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqPositionImp(JNIEnv *, jobject, jlong, jstring, jint); + #ifdef __cplusplus } #endif diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 40c27bf164..b555f4e683 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -133,7 +133,8 @@ void closeTransporter(SAppInstInfo *pAppInfo) { static bool clientRpcRfp(int32_t code, tmsg_t msgType) { if (NEED_REDIRECT_ERROR(code)) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || - msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_QUERY_HEARTBEAT || msgType == TDMT_SCH_DROP_TASK) { + msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_QUERY_HEARTBEAT || msgType == TDMT_SCH_DROP_TASK || + msgType == TDMT_SCH_TASK_NOTIFY) { return false; } return true; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d448dd1edf..c78ba4c4a0 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -503,7 +503,7 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t pResInfo->userFields[i].bytes = pSchema[i].bytes; pResInfo->userFields[i].type = pSchema[i].type; - if (pSchema[i].type == TSDB_DATA_TYPE_VARCHAR || pSchema[i].type == TSDB_DATA_TYPE_GEOMETRY) { + if (pSchema[i].type == TSDB_DATA_TYPE_VARCHAR || pSchema[i].type == TSDB_DATA_TYPE_VARBINARY || pSchema[i].type == TSDB_DATA_TYPE_GEOMETRY) { pResInfo->userFields[i].bytes -= VARSTR_HEADER_SIZE; } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR || pSchema[i].type == TSDB_DATA_TYPE_JSON) { pResInfo->userFields[i].bytes = (pResInfo->userFields[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; diff --git a/source/client/src/clientJniConnector.c b/source/client/src/clientJniConnector.c index 4ad2d4d51f..edbc06b12b 100644 --- a/source/client/src/clientJniConnector.c +++ b/source/client/src/clientJniConnector.c @@ -580,6 +580,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn (*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble)dv); } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { memcpy(tmp, row[i], length[i]); // handle the case that terminated does not exist (*env)->CallVoidMethod(env, rowobj, g_rowdataSetStringFp, i, (*env)->NewStringUTF(env, tmp)); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e262ee04b9..64bcd6d898 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -388,10 +388,11 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); - if (fields[i].type == TSDB_DATA_TYPE_BINARY || fields[i].type == TSDB_DATA_TYPE_GEOMETRY) { + if (fields[i].type == TSDB_DATA_TYPE_BINARY || fields[i].type == TSDB_DATA_TYPE_VARBINARY || fields[i].type == TSDB_DATA_TYPE_GEOMETRY) { if (ASSERT(charLen <= fields[i].bytes && charLen >= 0)) { tscError("taos_print_row error binary. charLen:%d, fields[i].bytes:%d", charLen, fields[i].bytes); } diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index dd311db126..7ff007cd20 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -56,7 +56,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch cJSON_AddItemToObject(column, "name", cname); cJSON* ctype = cJSON_CreateNumber(s->type); cJSON_AddItemToObject(column, "type", ctype); - if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY|| s->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = s->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(column, "length", cbytes); @@ -77,7 +77,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch cJSON_AddItemToObject(tag, "name", tname); cJSON* ttype = cJSON_CreateNumber(s->type); cJSON_AddItemToObject(tag, "type", ttype); - if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = s->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(tag, "length", cbytes); @@ -130,7 +130,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { cJSON* colType = cJSON_CreateNumber(field->type); cJSON_AddItemToObject(json, "colType", colType); - if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) { + if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = field->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); @@ -155,7 +155,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { cJSON_AddItemToObject(json, "colName", colName); cJSON* colType = cJSON_CreateNumber(field->type); cJSON_AddItemToObject(json, "colType", colType); - if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) { + if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = field->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); @@ -292,7 +292,13 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { cJSON* tvalue = NULL; if (IS_VAR_DATA_TYPE(pTagVal->type)) { - char* buf = taosMemoryCalloc(pTagVal->nData + 3, 1); + char* buf = NULL; + if(pTagVal->type == TSDB_DATA_TYPE_VARBINARY){ + buf = taosMemoryCalloc(pTagVal->nData*2 + 2 + 3, 1); + }else{ + buf = taosMemoryCalloc(pTagVal->nData + 3, 1); + } + if (!buf) goto end; dataConverToStr(buf, pTagVal->type, pTagVal->pData, pTagVal->nData, NULL); tvalue = cJSON_CreateString(buf); @@ -457,7 +463,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type); cJSON_AddItemToObject(json, "colType", colType); - if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) { + if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_VARBINARY || vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = vAlterTbReq.bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); @@ -478,7 +484,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { cJSON_AddItemToObject(json, "colName", colName); cJSON* colType = cJSON_CreateNumber(vAlterTbReq.colModType); cJSON_AddItemToObject(json, "colType", colType); - if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_GEOMETRY) { + if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_VARBINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = vAlterTbReq.colModBytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); @@ -515,7 +521,11 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { } buf = parseTagDatatoJson(vAlterTbReq.pTagVal); } else { - buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); + if(vAlterTbReq.tagType == TSDB_DATA_TYPE_VARBINARY){ + buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); + }else{ + buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); + } dataConverToStr(buf, vAlterTbReq.tagType, vAlterTbReq.pTagVal, vAlterTbReq.nTagVal, NULL); } @@ -687,14 +697,14 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { pReq.pColumns = taosArrayInit(req.schemaRow.nCols, sizeof(SField)); for (int32_t i = 0; i < req.schemaRow.nCols; i++) { SSchema* pSchema = req.schemaRow.pSchema + i; - SField field = {.type = pSchema->type, .bytes = pSchema->bytes}; + SField field = {.type = pSchema->type, .flags = pSchema->flags, .bytes = pSchema->bytes}; strcpy(field.name, pSchema->name); taosArrayPush(pReq.pColumns, &field); } pReq.pTags = taosArrayInit(req.schemaTag.nCols, sizeof(SField)); for (int32_t i = 0; i < req.schemaTag.nCols; i++) { SSchema* pSchema = req.schemaTag.pSchema + i; - SField field = {.type = pSchema->type, .bytes = pSchema->bytes}; + SField field = {.type = pSchema->type, .flags = pSchema->flags, .bytes = pSchema->bytes}; strcpy(field.name, pSchema->name); taosArrayPush(pReq.pTags, &field); } diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index cad32842a0..10f8b89f4d 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -218,7 +218,16 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable) { if (strlen(oneTable->childTableName) == 0) { SArray *dst = taosArrayDup(oneTable->tags, NULL); - RandTableName rName = {dst, oneTable->sTableName, (uint8_t)oneTable->sTableNameLen, oneTable->childTableName}; + ASSERT(oneTable->sTableNameLen < TSDB_TABLE_NAME_LEN); + char superName[TSDB_TABLE_NAME_LEN] = {0}; + RandTableName rName = {dst, NULL, (uint8_t)oneTable->sTableNameLen, oneTable->childTableName}; + if(tsSmlDot2Underline){ + memcpy(superName, oneTable->sTableName, oneTable->sTableNameLen); + smlStrReplace(superName, oneTable->sTableNameLen); + rName.stbFullName = superName; + }else{ + rName.stbFullName = oneTable->sTableName; + } buildChildTableName(&rName); taosArrayDestroy(dst); @@ -230,6 +239,9 @@ void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tin char key[TSDB_TABLE_NAME_LEN * 2 + 1] = {0}; size_t nLen = strlen(tinfo->childTableName); memcpy(key, currElement->measure, currElement->measureLen); + if(tsSmlDot2Underline){ + smlStrReplace(key, currElement->measureLen); + } memcpy(key + currElement->measureLen + 1, tinfo->childTableName, nLen); void *uid = taosHashGet(info->tableUids, key, @@ -596,7 +608,7 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm return TSDB_CODE_SML_INVALID_DATA; } - if (((colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_GEOMETRY) && + if (((colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_VARBINARY || colField[*index].type == TSDB_DATA_TYPE_GEOMETRY) && (colField[*index].bytes - VARSTR_HEADER_SIZE) < kv->length) || (colField[*index].type == TSDB_DATA_TYPE_NCHAR && ((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) { @@ -627,7 +639,7 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { } } - if ((type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) && result > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { + if ((type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_GEOMETRY) && result > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { result = TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE; } else if (type == TSDB_DATA_TYPE_NCHAR && result > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { result = (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; @@ -635,7 +647,7 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { if (type == TSDB_DATA_TYPE_NCHAR) { result = result * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; - } else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_GEOMETRY) { result = result + VARSTR_HEADER_SIZE; } return result; @@ -679,7 +691,7 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool } static int32_t getBytes(uint8_t type, int32_t length) { - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { return smlFindNearestPowerOf2(length, type); } else { return tDataTypes[type].bytes; @@ -1178,21 +1190,12 @@ void smlDestroyTableInfo(void *para) { taosMemoryFree(tag); } -void clearColValArray(SArray *pCols) { - int32_t num = taosArrayGetSize(pCols); - for (int32_t i = 0; i < num; ++i) { - SColVal *pCol = taosArrayGet(pCols, i); - if (TSDB_DATA_TYPE_NCHAR == pCol->type) { - taosMemoryFreeClear(pCol->value.pData); - } - } -} - void freeSSmlKv(void *data) { SSmlKv *kv = (SSmlKv *)data; - if (kv->keyEscaped) taosMemoryFree((void *)(kv->key)); - if (kv->valueEscaped) taosMemoryFree((void *)(kv->value)); + if (kv->keyEscaped) taosMemoryFreeClear(kv->key); + if (kv->valueEscaped) taosMemoryFreeClear(kv->value); if (kv->type == TSDB_DATA_TYPE_GEOMETRY) geosFreeBuffer((void *)(kv->value)); + if (kv->type == TSDB_DATA_TYPE_VARBINARY) taosMemoryFreeClear(kv->value); } void smlDestroyInfo(SSmlHandle *info) { diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 76794fd187..f9076112c4 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -569,6 +569,8 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { static int32_t smlConvertJSONString(SSmlKv *pVal, char *typeStr, cJSON *value) { if (strcasecmp(typeStr, "binary") == 0) { pVal->type = TSDB_DATA_TYPE_BINARY; + } else if (strcasecmp(typeStr, "varbinary") == 0) { + pVal->type = TSDB_DATA_TYPE_VARBINARY; } else if (strcasecmp(typeStr, "nchar") == 0) { pVal->type = TSDB_DATA_TYPE_NCHAR; } else { @@ -577,7 +579,7 @@ static int32_t smlConvertJSONString(SSmlKv *pVal, char *typeStr, cJSON *value) { } pVal->length = strlen(value->valuestring); - if (pVal->type == TSDB_DATA_TYPE_BINARY && pVal->length > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { + if ((pVal->type == TSDB_DATA_TYPE_BINARY || pVal->type == TSDB_DATA_TYPE_VARBINARY) && pVal->length > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; } if (pVal->type == TSDB_DATA_TYPE_NCHAR && @@ -1010,7 +1012,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo if (ret == TSDB_CODE_SUCCESS) { ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; @@ -1214,7 +1216,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * if (ret == TSDB_CODE_SUCCESS) { ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index 558c5f4ddb..a565fb1a21 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -109,7 +109,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { return code; } char* tmp = taosMemoryCalloc(pVal->length, 1); - memcpy(tmp, pVal->value + 2, pVal->length - 3); + memcpy(tmp, pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN); code = doGeomFromText(tmp, (unsigned char **)&pVal->value, &pVal->length); taosMemoryFree(tmp); if (code != TSDB_CODE_SUCCESS) { @@ -126,6 +126,44 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { return TSDB_CODE_TSC_INVALID_VALUE; } + if (pVal->value[0] == 'b' || pVal->value[0] == 'B') { // varbinary + if (pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"' && pVal->length >= 3) { + pVal->type = TSDB_DATA_TYPE_VARBINARY; + if(isHex(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN)){ + if(!isValidateHex(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN)){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + + void* data = NULL; + uint32_t size = 0; + if(taosHex2Ascii(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (size + VARSTR_HEADER_SIZE > TSDB_MAX_VARBINARY_LEN) { + taosMemoryFree(data); + return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; + } + pVal->value = data; + pVal->length = size; + }else{ + pVal->length -= NCHAR_ADD_LEN; + if (pVal->length > TSDB_MAX_VARBINARY_LEN - VARSTR_HEADER_SIZE) { + return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; + } + void *data = taosMemoryMalloc(pVal->length); + if(data == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(data, pVal->value + (NCHAR_ADD_LEN - 1), pVal->length); + pVal->value = data; + } + + return TSDB_CODE_SUCCESS; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } + if (pVal->value[0] == 't' || pVal->value[0] == 'T') { if (pVal->length == 1 || (pVal->length == 4 && (pVal->value[1] == 'r' || pVal->value[1] == 'R') && @@ -414,7 +452,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin 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 || tag->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (tag->type == TSDB_DATA_TYPE_BINARY || tag->type == TSDB_DATA_TYPE_GEOMETRY || tag->type == TSDB_DATA_TYPE_VARBINARY) { kv.length = tag->bytes - VARSTR_HEADER_SIZE; } taosArrayPush((*tmp)->cols, &kv); @@ -515,6 +553,10 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin char *tmp = (char *)taosMemoryMalloc(kv.length); memcpy(tmp, kv.value, kv.length); PROCESS_SLASH_IN_FIELD_VALUE(tmp, kv.length); + ASSERT(kv.type != TSDB_DATA_TYPE_GEOMETRY); + if(kv.type == TSDB_DATA_TYPE_VARBINARY){ + taosMemoryFree((void*)kv.value); + } kv.value = tmp; kv.valueEscaped = valueEscaped; } @@ -691,7 +733,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index c378f9b1c3..f9f8602c5a 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -307,7 +307,7 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine if (ret == TSDB_CODE_SUCCESS) { ret = smlBuildRow(info->currTableDataCtx); } - clearColValArray(info->currTableDataCtx->pValues); + clearColValArraySml(info->currTableDataCtx->pValues); if (unlikely(ret != TSDB_CODE_SUCCESS)) { smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); return ret; diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index b4168046f4..e861bd4b92 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -985,6 +985,10 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) { int32_t tmq_unsubscribe(tmq_t* tmq) { if(tmq == NULL) return TSDB_CODE_INVALID_PARA; + if (tmq->status != TMQ_CONSUMER_STATUS__READY) { + tscInfo("consumer:0x%" PRIx64 " not in ready state, unsubscribe it directly", tmq->consumerId); + return 0; + } if (tmq->autoCommit) { int32_t rsp = tmq_commit_sync(tmq, NULL); if (rsp != 0) { diff --git a/source/client/src/clientTmqConnector.c b/source/client/src/clientTmqConnector.c index 6ec82aa6ef..2bea738c23 100644 --- a/source/client/src/clientTmqConnector.c +++ b/source/client/src/clientTmqConnector.c @@ -291,6 +291,39 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNI TAOS_RES *res = (TAOS_RES *)jres; return tmq_commit_sync(tmq, res); } +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAllSync(JNIEnv *env, jobject jobj, jlong jtmq) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniError("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + return tmq_commit_sync(tmq, NULL); +} + +JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitOffsetSyncImp(JNIEnv *env, jobject jobj, + jlong jtmq, jstring jtopic, + jint vgId, jlong offset) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int code = tmq_commit_offset_sync(tmq, topicName, vgId, offset); + if (code != TSDB_CODE_SUCCESS) { + jniError("jobj:%p, tmq commit offset error, code:%d, msg:%s", jobj, code, tmq_err2str(code)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return code; +} // deprecated JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JNIEnv *env, jobject jobj, jlong jtmq, @@ -319,6 +352,27 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAsy tmq_commit_async(tmq, res, consumer_callback, offset); } +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitAllAsync(JNIEnv *env, jobject jobj, + jlong jtmq, jobject offset) { + tmqGlobalMethod(env); + tmq_t *tmq = (tmq_t *)jtmq; + + offset = (*env)->NewGlobalRef(env, offset); + tmq_commit_async(tmq, NULL, consumer_callback, offset); +} + +JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_consumerCommitOffsetAsync(JNIEnv *env, jobject jobj, + jlong jtmq, jstring jtopic, + jint vgId, jlong offset, + jobject callback) { + tmqGlobalMethod(env); + tmq_t *tmq = (tmq_t *)jtmq; + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + callback = (*env)->NewGlobalRef(env, callback); + tmq_commit_offset_async(tmq, topicName, vgId, offset, consumer_callback, callback); +} + JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqUnsubscribeImp(JNIEnv *env, jobject jobj, jlong jtmq) { tmq_t *tmq = (tmq_t *)jtmq; @@ -497,9 +551,9 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssign int32_t res = tmq_get_topic_assignment(tmq, topicName, &pAssign, &numOfAssignment); if (res != TSDB_CODE_SUCCESS) { - (*env)->ReleaseStringUTFChars(env, jtopic, topicName); jniError("jobj:%p, tmq get topic assignment error, topic:%s, code:%d, msg:%s", jobj, topicName, res, tmq_err2str(res)); + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); tmq_free_assignment(pAssign); return (jint)res; } @@ -518,3 +572,55 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicAssign tmq_free_assignment(pAssign); return JNI_SUCCESS; } + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommittedImp(JNIEnv *env, jobject jobj, jlong jtmq, + jstring jtopic, jint vgId) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int64_t offset = tmq_committed(tmq, topicName, vgId); + + if (offset < JNI_SUCCESS && offset != -2147467247) { + jniError("jobj:%p, tmq get committed offset error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, + vgId, offset, tmq_err2str(offset)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return (jlong)offset; +} + +JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqPositionImp(JNIEnv *env, jobject jobj, jlong jtmq, + jstring jtopic, jint vgId) { + tmq_t *tmq = (tmq_t *)jtmq; + if (tmq == NULL) { + jniDebug("jobj:%p, tmq is closed", jobj); + return TMQ_CONSUMER_NULL; + } + + if (jtopic == NULL) { + jniDebug("jobj:%p, topic is null", jobj); + return TMQ_TOPIC_NULL; + } + + const char *topicName = (*env)->GetStringUTFChars(env, jtopic, NULL); + + int64_t offset = tmq_position(tmq, topicName, vgId); + + if (offset < JNI_SUCCESS) { + jniError("jobj:%p, tmq get position error, topic:%s, vgId:%d, code:0x%" PRIx64 ", msg:%s", jobj, topicName, vgId, + offset, tmq_err2str(offset)); + } + + (*env)->ReleaseStringUTFChars(env, jtopic, topicName); + return (jlong)offset; +} \ No newline at end of file diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index e21e3a06b2..8a500b0178 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1407,8 +1407,9 @@ SSDataBlock* blockCopyOneRow(const SSDataBlock* pDataBlock, int32_t rowIdx) { for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); SColumnInfoData* pSrc = taosArrayGet(pDataBlock->pDataBlock, i); - void* pData = colDataGetData(pSrc, rowIdx); bool isNull = colDataIsNull(pSrc, pDataBlock->info.rows, rowIdx, NULL); + void* pData = NULL; + if (!isNull) pData = colDataGetData(pSrc, rowIdx); colDataSetVal(pDst, 0, pData, isNull); } @@ -1919,6 +1920,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf, if (len >= size - 1) return dumpBuf; break; case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { memset(pBuf, 0, sizeof(pBuf)); char* pData = colDataGetVarData(pColInfoData, j); @@ -2018,6 +2020,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat } break; case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY ASSERT(pColInfoData->info.type == pCol->type); if (colDataIsNull_s(pColInfoData, j)) { @@ -2031,7 +2034,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq2** ppReq, const SSDataBlock* pDat } break; } - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_DECIMAL: case TSDB_DATA_TYPE_BLOB: case TSDB_DATA_TYPE_JSON: diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 7c6939635a..7b8f0e67fb 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1146,6 +1146,7 @@ static int tTagValJsonCmprFn(const void *p1, const void *p2) { static void debugPrintTagVal(int8_t type, const void *val, int32_t vlen, const char *tag, int32_t ln) { switch (type) { + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_NCHAR: diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index e080c2d2ec..3c1f43ef40 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -95,6 +95,11 @@ uint16_t tsMonitorPort = 6043; int32_t tsMonitorMaxLogs = 100; bool tsMonitorComp = false; +// audit +bool tsEnableAudit = false; +char tsAuditFqdn[TSDB_FQDN_LEN] = {0}; +uint16_t tsAuditPort = 6043; + // telem bool tsEnableTelem = true; int32_t tsTelemInterval = 43200; @@ -124,7 +129,6 @@ int32_t tsQueryRspPolicy = 0; int64_t tsQueryMaxConcurrentTables = 200; // unit is TSDB_TABLE_NUM_UNIT bool tsEnableQueryHb = true; bool tsEnableScience = false; // on taos-cli show float and doulbe with scientific notation if true -bool tsTtlChangeOnWrite = false; // ttl delete time changes on last write if true int32_t tsQuerySmaOptimize = 0; int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data. bool tsQueryPlannerTrace = false; @@ -186,6 +190,7 @@ int32_t tsCacheLazyLoadThreshold = 500; int32_t tsDiskCfgNum = 0; SDiskCfg tsDiskCfg[TFS_MAX_DISKS] = {0}; +int64_t tsMinDiskFreeSize = TFS_MIN_DISK_FREE_SIZE; // stream scheduler bool tsDeployOnSnode = true; @@ -225,12 +230,20 @@ bool tsStartUdfd = true; // wal int64_t tsWalFsyncDataSizeLimit = (100 * 1024 * 1024L); +// ttl +bool tsTtlChangeOnWrite = false; // if true, ttl delete time changes on last write +int32_t tsTtlFlushThreshold = 100; /* maximum number of dirty items in memory. + * if -1, flush will not be triggered by write-ops + */ +int32_t tsTtlBatchDropNum = 10000; // number of tables dropped per batch + // internal int32_t tsTransPullupInterval = 2; int32_t tsMqRebalanceInterval = 2; int32_t tsStreamCheckpointTickInterval = 1; int32_t tsTtlUnit = 86400; -int32_t tsTtlPushInterval = 3600; +int32_t tsTtlPushIntervalSec = 10; +int32_t tsTrimVDbIntervalSec = 60 * 60; // interval of trimming db in all vgroups int32_t tsGrantHBInterval = 60; int32_t tsUptimeInterval = 300; // seconds char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits @@ -239,8 +252,8 @@ bool tsDisableStream = false; int64_t tsStreamBufferSize = 128 * 1024 * 1024; int64_t tsCheckpointInterval = 3 * 60 * 60 * 1000; bool tsFilterScalarMode = false; -int32_t tsKeepTimeOffset = 0; // latency of data migration -int tsResolveFQDNRetryTime = 100; //seconds +int32_t tsKeepTimeOffset = 0; // latency of data migration +int tsResolveFQDNRetryTime = 100; // seconds char tsS3Endpoint[TSDB_FQDN_LEN] = ""; char tsS3AccessKey[TSDB_FQDN_LEN] = ""; @@ -305,9 +318,7 @@ int32_t taosSetS3Cfg(SConfig *pCfg) { return 0; } -struct SConfig *taosGetCfg() { - return tsCfg; -} +struct SConfig *taosGetCfg() { return tsCfg; } static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile, char *apolloUrl) { @@ -594,6 +605,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "monitorMaxLogs", tsMonitorMaxLogs, 1, 1000000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddBool(pCfg, "monitorComp", tsMonitorComp, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddBool(pCfg, "audit", tsEnableAudit, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddString(pCfg, "auditFqdn", tsAuditFqdn, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "auditPort", tsAuditPort, 1, 65056, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_BOTH) != 0) return -1; if (cfgAddBool(pCfg, "telemetryReporting", tsEnableTelem, CFG_SCOPE_BOTH) != 0) return -1; if (cfgAddInt32(pCfg, "telemetryInterval", tsTelemInterval, 1, 200000, CFG_SCOPE_BOTH) != 0) return -1; @@ -605,8 +620,11 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "transPullupInterval", tsTransPullupInterval, 1, 10000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "mqRebalanceInterval", tsMqRebalanceInterval, 1, 10000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400 * 365, CFG_SCOPE_SERVER) != 0) return -1; - if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushInterval, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushIntervalSec, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "ttlBatchDropNum", tsTtlBatchDropNum, 0, INT32_MAX, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddBool(pCfg, "ttlChangeOnWrite", tsTtlChangeOnWrite, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "ttlFlushThreshold", tsTtlFlushThreshold, -1, 1000000, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "trimVDbIntervalSec", tsTrimVDbIntervalSec, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, CFG_SCOPE_SERVER) != 0) return -1; @@ -635,6 +653,11 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddString(pCfg, "s3Endpoint", tsS3Endpoint, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddString(pCfg, "s3BucketName", tsS3BucketName, CFG_SCOPE_SERVER) != 0) return -1; + // min free disk space used to check if the disk is full [50MB, 1GB] + if (cfgAddInt64(pCfg, "minDiskFreeSize", tsMinDiskFreeSize, TFS_MIN_DISK_FREE_SIZE, 1024 * 1024 * 1024, + CFG_SCOPE_SERVER) != 0) + return -1; + GRANT_CFG_ADD; return 0; } @@ -987,9 +1010,14 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsMonitorComp = cfgGetItem(pCfg, "monitorComp")->bval; tsQueryRspPolicy = cfgGetItem(pCfg, "queryRspPolicy")->i32; + tsEnableAudit = cfgGetItem(pCfg, "audit")->bval; + tstrncpy(tsAuditFqdn, cfgGetItem(pCfg, "auditFqdn")->str, TSDB_FQDN_LEN); + tsAuditPort = (uint16_t)cfgGetItem(pCfg, "auditPort")->i32; + tsEnableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval; tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval; tsTtlChangeOnWrite = cfgGetItem(pCfg, "ttlChangeOnWrite")->bval; + tsTtlFlushThreshold = cfgGetItem(pCfg, "ttlFlushThreshold")->i32; tsTelemInterval = cfgGetItem(pCfg, "telemetryInterval")->i32; tstrncpy(tsTelemServer, cfgGetItem(pCfg, "telemetryServer")->str, TSDB_FQDN_LEN); tsTelemPort = (uint16_t)cfgGetItem(pCfg, "telemetryPort")->i32; @@ -999,7 +1027,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsTransPullupInterval = cfgGetItem(pCfg, "transPullupInterval")->i32; tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32; tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; - tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32; + tsTtlPushIntervalSec = cfgGetItem(pCfg, "ttlPushInterval")->i32; + tsTtlBatchDropNum = cfgGetItem(pCfg, "ttlBatchDropNum")->i32; + tsTrimVDbIntervalSec = cfgGetItem(pCfg, "trimVDbIntervalSec")->i32; tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32; tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32; @@ -1034,6 +1064,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsMaxStreamBackendCache = cfgGetItem(pCfg, "maxStreamBackendCache")->i32; tsPQSortMemThreshold = cfgGetItem(pCfg, "pqSortMemThreshold")->i32; tsResolveFQDNRetryTime = cfgGetItem(pCfg, "resolveFQDNRetryTime")->i32; + tsMinDiskFreeSize = cfgGetItem(pCfg, "minDiskFreeSize")->i64; GRANT_CFG_GET; return 0; @@ -1400,13 +1431,19 @@ int32_t taosApplyLocalCfg(SConfig *pCfg, char *name) { } else if (strcasecmp("ttlUnit", name) == 0) { tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; } else if (strcasecmp("ttlPushInterval", name) == 0) { - tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32; + tsTtlPushIntervalSec = cfgGetItem(pCfg, "ttlPushInterval")->i32; + } else if (strcasecmp("ttlBatchDropNum", name) == 0) { + tsTtlBatchDropNum = cfgGetItem(pCfg, "ttlBatchDropNum")->i32; + } else if (strcasecmp("trimVDbIntervalSec", name) == 0) { + tsTrimVDbIntervalSec = cfgGetItem(pCfg, "trimVDbIntervalSec")->i32; } else if (strcasecmp("tmrDebugFlag", name) == 0) { tmrDebugFlag = cfgGetItem(pCfg, "tmrDebugFlag")->i32; } else if (strcasecmp("tsdbDebugFlag", name) == 0) { tsdbDebugFlag = cfgGetItem(pCfg, "tsdbDebugFlag")->i32; } else if (strcasecmp("tqDebugFlag", name) == 0) { tqDebugFlag = cfgGetItem(pCfg, "tqDebugFlag")->i32; + } else if (strcasecmp("ttlFlushThreshold", name) == 0) { + tsTtlFlushThreshold = cfgGetItem(pCfg, "ttlFlushThreshold")->i32; } break; } @@ -1608,6 +1645,27 @@ void taosCfgDynamicOptions(const char *option, const char *value) { return; } + if (strcasecmp(option, "ttlPushInterval") == 0) { + int32_t newTtlPushInterval = atoi(value); + uInfo("ttlPushInterval set from %d to %d", tsTtlPushIntervalSec, newTtlPushInterval); + tsTtlPushIntervalSec = newTtlPushInterval; + return; + } + + if (strcasecmp(option, "ttlBatchDropNum") == 0) { + int32_t newTtlBatchDropNum = atoi(value); + uInfo("ttlBatchDropNum set from %d to %d", tsTtlBatchDropNum, newTtlBatchDropNum); + tsTtlBatchDropNum = newTtlBatchDropNum; + return; + } + + if (strcasecmp(option, "supportVnodes") == 0) { + int32_t newSupportVnodes = atoi(value); + uInfo("supportVnodes set from %d to %d", tsNumOfSupportVnodes, newSupportVnodes); + tsNumOfSupportVnodes = newSupportVnodes; + return; + } + const char *options[] = { "dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag", "tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag", "tmrDebugFlag", "uDebugFlag", diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index de76881467..9a21563abe 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -534,7 +534,6 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq if (tEncodeI8(&encoder, pField->flags) < 0) return -1; if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeCStr(&encoder, pField->comment) < 0) return -1; } for (int32_t i = 0; i < pReq->numOfTags; ++i) { @@ -543,7 +542,6 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq if (tEncodeI8(&encoder, pField->flags) < 0) return -1; if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; - if (tEncodeCStr(&encoder, pField->comment) < 0) return -1; } for (int32_t i = 0; i < pReq->numOfFuncs; ++i) { @@ -610,7 +608,6 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.comment) < 0) return -1; if (taosArrayPush(pReq->pColumns, &field) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; @@ -623,7 +620,6 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR if (tDecodeI8(&decoder, &field.flags) < 0) return -1; if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; - if (tDecodeCStrTo(&decoder, field.comment) < 0) return -1; if (taosArrayPush(pReq->pTags, &field) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; @@ -1096,6 +1092,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tEncodeI64(&encoder, pReq->qload.numOfProcessedCQuery) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedFetch) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedDrop) < 0) return -1; + if (tEncodeI64(&encoder, pReq->qload.numOfProcessedNotify) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedHb) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.numOfProcessedDelete) < 0) return -1; if (tEncodeI64(&encoder, pReq->qload.cacheDataSize) < 0) return -1; @@ -1193,6 +1190,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedCQuery) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedFetch) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedDrop) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedNotify) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedHb) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.numOfProcessedDelete) < 0) return -1; if (tDecodeI64(&decoder, &pReq->qload.cacheDataSize) < 0) return -1; @@ -2327,7 +2325,7 @@ int32_t tDeserializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) } int32_t totalCols = pRsp->numOfTags + pRsp->numOfColumns; - pRsp->pSchemas = taosMemoryCalloc(totalCols, sizeof(SSchema)); + pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols); if (pRsp->pSchemas == NULL) return -1; for (int32_t i = 0; i < totalCols; ++i) { @@ -3179,6 +3177,12 @@ int32_t tSerializeSVDropTtlTableReq(void *buf, int32_t bufLen, SVDropTtlTableReq if (tStartEncode(&encoder) < 0) return -1; if (tEncodeI32(&encoder, pReq->timestampSec) < 0) return -1; + if (tEncodeI32(&encoder, pReq->ttlDropMaxCount) < 0) return -1; + if (tEncodeI32(&encoder, pReq->nUids) < 0) return -1; + for (int32_t i = 0; i < pReq->nUids; ++i) { + tb_uid_t *pTbUid = taosArrayGet(pReq->pTbUids, i); + if (tEncodeI64(&encoder, *pTbUid) < 0) return -1; + } tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -3192,6 +3196,30 @@ int32_t tDeserializeSVDropTtlTableReq(void *buf, int32_t bufLen, SVDropTtlTableR if (tStartDecode(&decoder) < 0) return -1; if (tDecodeI32(&decoder, &pReq->timestampSec) < 0) return -1; + pReq->ttlDropMaxCount = INT32_MAX; + pReq->nUids = 0; + pReq->pTbUids = NULL; + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI32(&decoder, &pReq->ttlDropMaxCount) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->nUids) < 0) return -1; + + if (pReq->nUids > 0) { + pReq->pTbUids = taosArrayInit(pReq->nUids, sizeof(tb_uid_t)); + if (pReq->pTbUids == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + + tb_uid_t tbUid = 0; + for (int32_t i = 0; i < pReq->nUids; ++i) { + if (tDecodeI64(&decoder, &tbUid) < 0) return -1; + if (taosArrayPush(pReq->pTbUids, &tbUid) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + } tEndDecode(&decoder); tDecoderClear(&decoder); @@ -3710,7 +3738,7 @@ static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) { int32_t totalCols = pRsp->numOfTags + pRsp->numOfColumns; if (totalCols > 0) { - pRsp->pSchemas = taosMemoryCalloc(totalCols, sizeof(SSchema)); + pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols); if (pRsp->pSchemas == NULL) return -1; for (int32_t i = 0; i < totalCols; ++i) { @@ -5848,6 +5876,64 @@ int32_t tDeserializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq) return 0; } +int32_t tSerializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq) { + int32_t headLen = sizeof(SMsgHead); + if (buf != NULL) { + buf = (char *)buf + headLen; + bufLen -= headLen; + } + + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeU64(&encoder, pReq->sId) < 0) return -1; + if (tEncodeU64(&encoder, pReq->queryId) < 0) return -1; + if (tEncodeU64(&encoder, pReq->taskId) < 0) return -1; + if (tEncodeI64(&encoder, pReq->refId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->execId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->type) < 0) return -1; + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + + if (buf != NULL) { + SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen); + pHead->vgId = htonl(pReq->header.vgId); + pHead->contLen = htonl(tlen + headLen); + } + + return tlen + headLen; +} + +int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq) { + int32_t headLen = sizeof(SMsgHead); + + SMsgHead *pHead = buf; + pHead->vgId = pReq->header.vgId; + pHead->contLen = pReq->header.contLen; + + SDecoder decoder = {0}; + tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeU64(&decoder, &pReq->sId) < 0) return -1; + if (tDecodeU64(&decoder, &pReq->queryId) < 0) return -1; + if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->execId) < 0) return -1; + if (tDecodeI32(&decoder, (int32_t*)&pReq->type) < 0) return -1; + + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + + int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 039f436505..e2da4d166e 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -356,7 +356,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { } } else { varDataLen += sizeof(VarDataLenT); - if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR || pTColumn->type == TSDB_DATA_TYPE_GEOMETRY) { + if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR || pTColumn->type == TSDB_DATA_TYPE_VARBINARY || pTColumn->type == TSDB_DATA_TYPE_GEOMETRY) { varDataLen += CHAR_BYTES; if (maxVarDataLen < CHAR_BYTES + sizeof(VarDataLenT)) { maxVarDataLen = CHAR_BYTES + sizeof(VarDataLenT); diff --git a/source/common/src/ttszip.c b/source/common/src/ttszip.c index aabbff6f04..38659eea44 100644 --- a/source/common/src/ttszip.c +++ b/source/common/src/ttszip.c @@ -296,7 +296,8 @@ static void writeDataToDisk(STSBuf* pTSBuf) { metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &pBlock->tag.nType, sizeof(pBlock->tag.nType)); int32_t trueLen = pBlock->tag.nLen; - if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { + if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_VARBINARY || + pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &pBlock->tag.nLen, sizeof(pBlock->tag.nLen)); metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, pBlock->tag.pz, (size_t)pBlock->tag.nLen); } else if (pBlock->tag.nType == TSDB_DATA_TYPE_FLOAT) { @@ -378,7 +379,8 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) { // NOTE: mix types tags are not supported size_t sz = 0; - if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { + if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_VARBINARY || + pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { char* tp = taosMemoryRealloc(pBlock->tag.pz, pBlock->tag.nLen + 1); ASSERT(tp != NULL); diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index 39255cff3a..8827ddc811 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -61,7 +61,7 @@ tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX] = { {TSDB_DATA_TYPE_UINT, 12, INT_BYTES, "INT UNSIGNED", 0, UINT32_MAX, tsCompressInt, tsDecompressInt}, {TSDB_DATA_TYPE_UBIGINT, 15, LONG_BYTES, "BIGINT UNSIGNED", 0, UINT64_MAX, tsCompressBigint, tsDecompressBigint}, {TSDB_DATA_TYPE_JSON, 4, TSDB_MAX_JSON_TAG_LEN, "JSON", 0, 0, tsCompressString, tsDecompressString}, - {TSDB_DATA_TYPE_VARBINARY, 9, 1, "VARBINARY", 0, 0, NULL, NULL}, // placeholder, not implemented + {TSDB_DATA_TYPE_VARBINARY, 9, 1, "VARBINARY", 0, 0, tsCompressString, tsDecompressString}, // placeholder, not implemented {TSDB_DATA_TYPE_DECIMAL, 7, 1, "DECIMAL", 0, 0, NULL, NULL}, // placeholder, not implemented {TSDB_DATA_TYPE_BLOB, 4, 1, "BLOB", 0, 0, NULL, NULL}, // placeholder, not implemented {TSDB_DATA_TYPE_MEDIUMBLOB, 10, 1, "MEDIUMBLOB", 0, 0, NULL, NULL}, // placeholder, not implemented @@ -135,6 +135,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { *((int64_t *)val) = GET_INT64_VAL(src); break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: varDataCopy(val, src); break; diff --git a/source/common/src/tvariant.c b/source/common/src/tvariant.c index cb4a42eb10..5f2796260c 100644 --- a/source/common/src/tvariant.c +++ b/source/common/src/tvariant.c @@ -122,6 +122,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin break; } case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { // todo refactor, extract a method pVar->pz = taosMemoryCalloc(len + 1, sizeof(char)); memcpy(pVar->pz, pz, len); @@ -141,7 +142,8 @@ void taosVariantDestroy(SVariant *pVar) { if (pVar == NULL) return; if (pVar->nType == TSDB_DATA_TYPE_BINARY || pVar->nType == TSDB_DATA_TYPE_NCHAR || - pVar->nType == TSDB_DATA_TYPE_JSON || pVar->nType == TSDB_DATA_TYPE_GEOMETRY) { + pVar->nType == TSDB_DATA_TYPE_JSON || pVar->nType == TSDB_DATA_TYPE_GEOMETRY || + pVar->nType == TSDB_DATA_TYPE_VARBINARY) { taosMemoryFreeClear(pVar->pz); pVar->nLen = 0; } @@ -152,8 +154,9 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) { if (pSrc == NULL || pDst == NULL) return; pDst->nType = pSrc->nType; - if (pSrc->nType == TSDB_DATA_TYPE_BINARY || pSrc->nType == TSDB_DATA_TYPE_NCHAR || - pSrc->nType == TSDB_DATA_TYPE_JSON || pSrc->nType == TSDB_DATA_TYPE_GEOMETRY) { + if (pSrc->nType == TSDB_DATA_TYPE_BINARY ||pSrc->nType == TSDB_DATA_TYPE_VARBINARY || + pSrc->nType == TSDB_DATA_TYPE_NCHAR || pSrc->nType == TSDB_DATA_TYPE_JSON || + pSrc->nType == TSDB_DATA_TYPE_GEOMETRY) { int32_t len = pSrc->nLen + TSDB_NCHAR_SIZE; char *p = taosMemoryRealloc(pDst->pz, len); ASSERT(p); @@ -185,7 +188,8 @@ int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2) { return 1; } - if (p1->nType == TSDB_DATA_TYPE_BINARY || p1->nType == TSDB_DATA_TYPE_NCHAR || p1->nType == TSDB_DATA_TYPE_GEOMETRY) { + if (p1->nType == TSDB_DATA_TYPE_BINARY || p1->nType == TSDB_DATA_TYPE_VARBINARY || + p1->nType == TSDB_DATA_TYPE_NCHAR || p1->nType == TSDB_DATA_TYPE_GEOMETRY) { if (p1->nLen == p2->nLen) { return memcmp(p1->pz, p2->pz, p1->nLen); } else { @@ -237,6 +241,7 @@ char *taosVariantGet(SVariant *pVar, int32_t type) { case TSDB_DATA_TYPE_FLOAT: return (char *)&pVar->f; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_GEOMETRY: return (char *)pVar->pz; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 302d4dafd1..eaa80ba775 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -33,10 +33,10 @@ int32_t mmProcessCreateReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) { return -1; } - SMnodeOpt option = {.deploy = true, .numOfReplicas = createReq.replica, - .numOfTotalReplicas = createReq.replica + createReq.learnerReplica, + SMnodeOpt option = {.deploy = true, .numOfReplicas = createReq.replica, + .numOfTotalReplicas = createReq.replica + createReq.learnerReplica, .selfIndex = -1, .lastIndex = createReq.lastIndex}; - + memcpy(option.replicas, createReq.replicas, sizeof(createReq.replicas)); for (int32_t i = 0; i < createReq.replica; ++i) { if (createReq.replicas[i].id == pInput->pData->dnodeId) { @@ -187,10 +187,12 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_TASK_NOTIFY, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_VND_TRIM_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_SUBSCRIBE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c index 5017ad7b74..86bc11c616 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c @@ -89,6 +89,7 @@ SArray *qmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_TASK_NOTIFY, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; code = 0; _OVER: diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index e50a75d33a..f43e1f5537 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -755,6 +755,7 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_TABLES_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_TASK_NOTIFY, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index a34002161d..320c9db37d 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "dmMgmt.h" +#include "audit.h" #define STR_CASE_CMP(s, d) (0 == strcasecmp((s), (d))) #define STR_STR_CMP(s, d) (strstr((s), (d))) @@ -34,6 +35,16 @@ } \ } while (0) +#define DM_INIT_AUDIT() \ + do { \ + auditCfg.port = tsMonitorPort; \ + auditCfg.server = tsMonitorFqdn; \ + auditCfg.comp = tsMonitorComp; \ + if (auditInit(&auditCfg) != 0) { \ + return -1; \ + } \ + } while (0) + #define DM_ERR_RTN(c) \ do { \ code = (c); \ @@ -96,6 +107,14 @@ _exit: return code; } +static int32_t dmInitAudit() { + SAuditCfg auditCfg = {0}; + + DM_INIT_AUDIT(); + + return 0; +} + static bool dmDataSpaceAvailable() { SDnode *pDnode = dmInstance(); if (pDnode->pTfs) { @@ -176,6 +195,7 @@ int32_t dmInit() { if (dmCheckRepeatInit(dmInstance()) != 0) return -1; if (dmInitSystem() != 0) return -1; if (dmInitMonitor() != 0) return -1; + if (dmInitAudit() != 0) return -1; if (dmInitDnode(dmInstance()) != 0) return -1; dInfo("dnode env is initialized"); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index e0f7da3ac4..665f86034d 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -272,7 +272,7 @@ static bool rpcRfp(int32_t code, tmsg_t msgType) { code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || - msgType == TDMT_SCH_MERGE_FETCH) { + msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_TASK_NOTIFY) { return false; } return true; diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 010067e99f..48dc71a12b 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -16,7 +16,7 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser + mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser audit ) IF (TD_GRANT) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index b0e3dc4331..c58df5c88c 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -29,6 +29,9 @@ #include "mndUser.h" #include "mndVgroup.h" #include "systable.h" +#include "tjson.h" +#include "thttp.h" +#include "audit.h" #define DB_VER_NUMBER 1 #define DB_RESERVE_SIZE 46 @@ -733,6 +736,8 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { code = mndCreateDb(pMnode, pReq, &createReq, pUser); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createDB", createReq.db, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("db:%s, failed to create since %s", createReq.db, terrstr()); @@ -975,6 +980,8 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; } + auditRecord(pReq, pMnode->clusterId, "alterDB", alterReq.db, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { if (terrno != 0) code = terrno; @@ -1264,6 +1271,8 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) { code = TSDB_CODE_ACTION_IN_PROGRESS; } + auditRecord(pReq, pMnode->clusterId, "dropDB", dropReq.db, "", ""); + _OVER: if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("db:%s, failed to drop since %s", dropReq.db, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 39285ced5d..1bcbc4982b 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -26,6 +26,7 @@ #include "mndVgroup.h" #include "tmisce.h" #include "mndCluster.h" +#include "audit.h" #define TSDB_DNODE_VER_NUMBER 2 #define TSDB_DNODE_RESERVE_SIZE 64 @@ -517,7 +518,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { bool online = mndIsDnodeOnline(pDnode, curMs); bool dnodeChanged = (statusReq.dnodeVer == 0) || (statusReq.dnodeVer != dnodeVer); bool reboot = (pDnode->rebootTime != statusReq.rebootTime); - bool needCheck = !online || dnodeChanged || reboot; + bool supportVnodesChanged = pDnode->numOfSupportVnodes != statusReq.numOfSupportVnodes; + bool needCheck = !online || dnodeChanged || reboot || supportVnodesChanged; const STraceId *trace = &pReq->info.traceId; mGTrace("dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d", pDnode->id, @@ -907,6 +909,13 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) { code = mndCreateDnode(pMnode, pReq, &createReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; tsGrantHBInterval = 5; + + char detail[1000] = {0}; + sprintf(detail, "%s:%d", + createReq.fqdn, createReq.port); + + auditRecord(pReq, pMnode->clusterId, "createDnode", detail, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("dnode:%s:%d, failed to create since %s", createReq.fqdn, createReq.port, terrstr()); @@ -1054,6 +1063,14 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes, force, dropReq.unsafe); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj1[150] = {0}; + sprintf(obj1, "%s:%d", dropReq.fqdn, dropReq.port); + + char obj2[10] = {0}; + sprintf(obj2, "%d", dropReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "dropDnode", obj1, obj2, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("dnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); @@ -1123,7 +1140,55 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { strcpy(dcfgReq.config, "keeptimeoffset"); snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); + } else if (strncasecmp(cfgReq.config, "ttlpushinterval", 14) == 0) { + int32_t optLen = strlen("ttlpushinterval"); + int32_t flag = -1; + int32_t code = mndMCfgGetValInt32(&cfgReq, optLen, &flag); + if (code < 0) return code; + + if (flag < 0 || flag > 100000) { + mError("dnode:%d, failed to config ttlPushInterval since value:%d. Valid range: [0, 100000]", cfgReq.dnodeId, + flag); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + + strcpy(dcfgReq.config, "ttlpushinterval"); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); + } else if (strncasecmp(cfgReq.config, "ttlbatchdropnum", 15) == 0) { + int32_t optLen = strlen("ttlbatchdropnum"); + int32_t flag = -1; + int32_t code = mndMCfgGetValInt32(&cfgReq, optLen, &flag); + if (code < 0) return code; + + if (flag < 0) { + mError("dnode:%d, failed to config ttlBatchDropNum since value:%d. Valid range: [0, %d]", cfgReq.dnodeId, + flag, INT32_MAX); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + + strcpy(dcfgReq.config, "ttlbatchdropnum"); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); #ifdef TD_ENTERPRISE + } else if (strncasecmp(cfgReq.config, "supportvnodes", 13) == 0) { + int32_t optLen = strlen("supportvnodes"); + int32_t flag = -1; + int32_t code = mndMCfgGetValInt32(&cfgReq, optLen, &flag); + if (code < 0) return code; + + if (flag < 0 || flag > 4096) { + mError("dnode:%d, failed to config supportVnodes since value:%d. Valid range: [0, 4096]", cfgReq.dnodeId, flag); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + if (flag == 0) { + flag = tsNumOfCores * 2; + } + flag = TMAX(flag, 2); + + strcpy(dcfgReq.config, "supportvnodes"); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); } else if (strncasecmp(cfgReq.config, "activeCode", 10) == 0 || strncasecmp(cfgReq.config, "cActiveCode", 11) == 0) { int8_t opt = strncasecmp(cfgReq.config, "a", 1) == 0 ? DND_ACTIVE_CODE : DND_CONN_ACTIVE_CODE; int8_t index = opt == DND_ACTIVE_CODE ? 10 : 11; @@ -1187,6 +1252,11 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { } } + char detail[50] = {0}; + sprintf(detail, "%d", cfgReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "alterDnode", detail, "", ""); + int32_t code = -1; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; @@ -1376,7 +1446,7 @@ static int32_t mndMCfgGetValInt32(SMCfgDnodeReq *pMCfgReq, int32_t opLen, int32_ return 0; _err: - mError("dnode:%d, failed to config keeptimeoffset since invalid conf:%s", pMCfgReq->dnodeId, pMCfgReq->config); + mError("dnode:%d, failed to config since invalid conf:%s", pMCfgReq->dnodeId, pMCfgReq->config); terrno = TSDB_CODE_INVALID_CFG; return -1; } diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index 5eb7abf026..333fdf83bb 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -565,7 +565,8 @@ static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int32_t le return msg; } - if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { + if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_VARBINARY || + type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { int32_t bytes = len > 0 ? (int32_t)(len - VARSTR_HEADER_SIZE) : len; snprintf(buf, buflen - 1, "%s(%d)", tDataTypes[type].name, type == TSDB_DATA_TYPE_NCHAR ? bytes / 4 : bytes); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index b28ad207ea..12e28969c9 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -119,6 +119,14 @@ static void mndPullupTtl(SMnode *pMnode) { tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); } +static void mndPullupTrimDb(SMnode *pMnode) { + mTrace("pullup trim"); + int32_t contLen = 0; + void *pReq = mndBuildTimerMsg(&contLen); + SRpcMsg rpcMsg = {.msgType = TDMT_MND_TRIM_DB_TIMER, .pCont = pReq, .contLen = contLen}; + tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); +} + static void mndCalMqRebalance(SMnode *pMnode) { mTrace("calc mq rebalance"); int32_t contLen = 0; @@ -255,10 +263,14 @@ static void *mndThreadFp(void *param) { if (lastTime % 10 != 0) continue; int64_t sec = lastTime / 10; - if (sec % tsTtlPushInterval == 0) { + if (sec % tsTtlPushIntervalSec == 0) { mndPullupTtl(pMnode); } + if (sec % tsTrimVDbIntervalSec == 0) { + mndPullupTrimDb(pMnode); + } + if (sec % tsTransPullupInterval == 0) { mndPullupTrans(pMnode); } @@ -617,7 +629,8 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { if (!IsReq(pMsg)) return 0; if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_MERGE_QUERY || pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || - pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_MERGE_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK) { + pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_MERGE_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK || + pMsg->msgType == TDMT_SCH_TASK_NOTIFY) { return 0; } @@ -661,7 +674,7 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { _OVER: if (pMsg->msgType == TDMT_MND_TMQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER || pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER || - pMsg->msgType == TDMT_MND_UPTIME_TIMER) { + pMsg->msgType == TDMT_MND_TRIM_DB_TIMER || pMsg->msgType == TDMT_MND_UPTIME_TIMER) { mTrace("timer not process since mnode restored:%d stopped:%d, sync restored:%d role:%s ", pMnode->restored, pMnode->stopped, state.restored, syncStr(state.state)); return -1; diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 2757578d35..8b9deb3988 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -22,6 +22,7 @@ #include "mndSync.h" #include "mndTrans.h" #include "tmisce.h" +#include "audit.h" #define MNODE_VER_NUMBER 2 #define MNODE_RESERVE_SIZE 64 @@ -652,6 +653,15 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) { code = mndCreateMnode(pMnode, pReq, pDnode, &createReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char detail[1000] = {0}; + + char obj[20] = {0}; + sprintf(obj, "%d", createReq.dnodeId); + + sprintf(detail, "dnodeId:%d", createReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "createMnode", obj, detail, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("mnode:%d, failed to create since %s", createReq.dnodeId, terrstr()); @@ -788,6 +798,11 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) { code = mndDropMnode(pMnode, pReq, pObj); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[20] = {0}; + sprintf(obj, "%d", dropReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "dropMnode", obj, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("mnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 524ea1a06b..db1546e33f 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -25,6 +25,7 @@ #include "mndUser.h" #include "tglobal.h" #include "tversion.h" +#include "audit.h" typedef struct { uint32_t id; @@ -308,6 +309,16 @@ _CONNECT: code = 0; + char detail[1000] = {0}; + + char obj[30] = {0}; + sprintf(obj, "%s:%d", ip, pConn->port); + + sprintf(detail, "user:%s, from:%s, connType%d", + connReq.user, obj, connReq.connType); + + auditRecord(pReq, pMnode->clusterId, "login", connReq.app, obj, detail); + _OVER: mndReleaseUser(pMnode, pUser); diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index 5ec81440bb..45efabe97d 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -20,6 +20,7 @@ #include "mndShow.h" #include "mndTrans.h" #include "mndUser.h" +#include "audit.h" #define QNODE_VER_NUMBER 1 #define QNODE_RESERVE_SIZE 64 @@ -306,6 +307,10 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) { code = mndCreateQnode(pMnode, pReq, pDnode, &createReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[33] = {0}; + sprintf(obj, "%d", createReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "createQnode", obj, "", ""); _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr()); @@ -415,6 +420,11 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) { code = mndDropQnode(pMnode, pReq, pObj); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[33] = {0}; + sprintf(obj, "%d", dropReq.dnodeId); + + auditRecord(pReq, pMnode->clusterId, "createQnode", obj, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c index 8e95fa3d6d..c03b02c17f 100644 --- a/source/dnode/mnode/impl/src/mndQuery.c +++ b/source/dnode/mnode/impl/src/mndQuery.c @@ -55,6 +55,9 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) { case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pMnode, pMnode->pQuery, pMsg, 0); break; + case TDMT_SCH_TASK_NOTIFY: + code = qWorkerProcessNotifyMsg(pMnode, pMnode->pQuery, pMsg, 0); + break; default: terrno = TSDB_CODE_APP_ERROR; mError("unknown msg type:%d in query queue", pMsg->msgType); @@ -175,6 +178,7 @@ int32_t mndInitQuery(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_CONTINUE, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_FETCH, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_MERGE_FETCH, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_TASK_NOTIFY, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_DROP_TASK, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_HEARTBEAT, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_MND_BATCH_META, mndProcessBatchMetaMsg); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index c3899ec433..aa3ee89fd3 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -31,6 +31,7 @@ #include "mndUser.h" #include "mndVgroup.h" #include "tname.h" +#include "audit.h" #define STB_VER_NUMBER 1 #define STB_RESERVE_SIZE 64 @@ -40,10 +41,12 @@ static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb); static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb); static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew); static int32_t mndProcessTtlTimer(SRpcMsg *pReq); +static int32_t mndProcessTrimDbTimer(SRpcMsg *pReq); static int32_t mndProcessCreateStbReq(SRpcMsg *pReq); static int32_t mndProcessAlterStbReq(SRpcMsg *pReq); static int32_t mndProcessDropStbReq(SRpcMsg *pReq); -static int32_t mndProcessDropTtltbReq(SRpcMsg *pReq); +static int32_t mndProcessDropTtltbRsp(SRpcMsg *pReq); +static int32_t mndProcessTrimDbRsp(SRpcMsg *pReq); static int32_t mndProcessTableMetaReq(SRpcMsg *pReq); static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); @@ -72,11 +75,13 @@ int32_t mndInitStb(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_ALTER_STB, mndProcessAlterStbReq); mndSetMsgHandle(pMnode, TDMT_MND_DROP_STB, mndProcessDropStbReq); mndSetMsgHandle(pMnode, TDMT_VND_CREATE_STB_RSP, mndTransProcessRsp); - mndSetMsgHandle(pMnode, TDMT_VND_DROP_TTL_TABLE_RSP, mndProcessDropTtltbReq); + mndSetMsgHandle(pMnode, TDMT_VND_DROP_TTL_TABLE_RSP, mndProcessDropTtltbRsp); + mndSetMsgHandle(pMnode, TDMT_VND_TRIM_RSP, mndProcessTrimDbRsp); mndSetMsgHandle(pMnode, TDMT_VND_ALTER_STB_RSP, mndTransProcessRsp); mndSetMsgHandle(pMnode, TDMT_VND_DROP_STB_RSP, mndTransProcessRsp); mndSetMsgHandle(pMnode, TDMT_MND_TABLE_META, mndProcessTableMetaReq); mndSetMsgHandle(pMnode, TDMT_MND_TTL_TIMER, mndProcessTtlTimer); + mndSetMsgHandle(pMnode, TDMT_MND_TRIM_DB_TIMER, mndProcessTrimDbTimer); mndSetMsgHandle(pMnode, TDMT_MND_TABLE_CFG, mndProcessTableCfgReq); // mndSetMsgHandle(pMnode, TDMT_MND_SYSTABLE_RETRIEVE, mndProcessRetrieveStbReq); @@ -835,7 +840,6 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat pSchema->bytes = pField->bytes; pSchema->flags = pField->flags; memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - memcpy(pSchema->comment, pField->comment, TSDB_COL_COMMENT_LEN); pSchema->colId = pDst->nextColId; pDst->nextColId++; } @@ -849,7 +853,6 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat SSCHMEA_SET_IDX_ON(pSchema); } memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); - memcpy(pSchema->comment, pField->comment, TSDB_COL_COMMENT_LEN); pSchema->colId = pDst->nextColId; pDst->nextColId++; } @@ -919,11 +922,12 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; void *pIter = NULL; - SVDropTtlTableReq ttlReq = {.timestampSec = taosGetTimestampSec()}; - int32_t reqLen = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); - int32_t contLen = reqLen + sizeof(SMsgHead); + SVDropTtlTableReq ttlReq = { + .timestampSec = taosGetTimestampSec(), .ttlDropMaxCount = tsTtlBatchDropNum, .nUids = 0, .pTbUids = NULL}; + int32_t reqLen = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); + int32_t contLen = reqLen + sizeof(SMsgHead); - mInfo("start to process ttl timer"); + mDebug("start to process ttl timer"); while (1) { pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); @@ -936,7 +940,7 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { } pHead->contLen = htonl(contLen); pHead->vgId = htonl(pVgroup->vgId); - tSerializeSVDropTtlTableReq((char *)pHead + sizeof(SMsgHead), contLen, &ttlReq); + tSerializeSVDropTtlTableReq((char *)pHead + sizeof(SMsgHead), reqLen, &ttlReq); SRpcMsg rpcMsg = {.msgType = TDMT_VND_DROP_TTL_TABLE, .pCont = pHead, .contLen = contLen, .info = pReq->info}; SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup); @@ -944,7 +948,44 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { if (code != 0) { mError("vgId:%d, failed to send drop ttl table request to vnode since 0x%x", pVgroup->vgId, code); } else { - mInfo("vgId:%d, send drop ttl table request to vnode, time:%" PRId32, pVgroup->vgId, ttlReq.timestampSec); + mDebug("vgId:%d, send drop ttl table request to vnode, time:%" PRId32, pVgroup->vgId, ttlReq.timestampSec); + } + sdbRelease(pSdb, pVgroup); + } + + return 0; +} + +static int32_t mndProcessTrimDbTimer(SRpcMsg *pReq) { + SMnode *pMnode = pReq->info.node; + SSdb *pSdb = pMnode->pSdb; + SVgObj *pVgroup = NULL; + void *pIter = NULL; + SVTrimDbReq trimReq = {.timestamp = taosGetTimestampSec()}; + int32_t reqLen = tSerializeSVTrimDbReq(NULL, 0, &trimReq); + int32_t contLen = reqLen + sizeof(SMsgHead); + + while (1) { + pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); + if (pIter == NULL) break; + + SMsgHead *pHead = rpcMallocCont(contLen); + if (pHead == NULL) { + sdbCancelFetch(pSdb, pVgroup); + sdbRelease(pSdb, pVgroup); + continue; + } + pHead->contLen = htonl(contLen); + pHead->vgId = htonl(pVgroup->vgId); + tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), reqLen, &trimReq); + + SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen}; + SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup); + int32_t code = tmsgSendReq(&epSet, &rpcMsg); + if (code != 0) { + mError("vgId:%d, timer failed to send vnode-trim request to vnode since 0x%x", pVgroup->vgId, code); + } else { + mInfo("vgId:%d, timer send vnode-trim request to vnode, time:%d", pVgroup->vgId, trimReq.timestamp); } sdbRelease(pSdb, pVgroup); } @@ -1133,6 +1174,8 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { } if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createStb", pDb->name, createReq.name, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stb:%s, failed to create since %s", createReq.name, terrstr()); @@ -1509,8 +1552,8 @@ static int32_t mndAlterStbTagBytes(SMnode *pMnode, const SStbObj *pOld, SStbObj SSchema *pTag = pNew->pTags + tag; - if (!(pTag->type == TSDB_DATA_TYPE_BINARY || pTag->type == TSDB_DATA_TYPE_NCHAR || - pTag->type == TSDB_DATA_TYPE_GEOMETRY)) { + if (!(pTag->type == TSDB_DATA_TYPE_BINARY || pTag->type == TSDB_DATA_TYPE_VARBINARY || + pTag->type == TSDB_DATA_TYPE_NCHAR || pTag->type == TSDB_DATA_TYPE_GEOMETRY)) { terrno = TSDB_CODE_MND_INVALID_STB_OPTION; return -1; } @@ -1631,8 +1674,8 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO } SSchema *pCol = pNew->pColumns + col; - if (!(pCol->type == TSDB_DATA_TYPE_BINARY || pCol->type == TSDB_DATA_TYPE_NCHAR || - pCol->type == TSDB_DATA_TYPE_GEOMETRY)) { + if (!(pCol->type == TSDB_DATA_TYPE_BINARY || pCol->type == TSDB_DATA_TYPE_VARBINARY || + pCol->type == TSDB_DATA_TYPE_NCHAR || pCol->type == TSDB_DATA_TYPE_GEOMETRY)) { terrno = TSDB_CODE_MND_INVALID_STB_OPTION; return -1; } @@ -2201,6 +2244,8 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) { code = mndAlterStb(pMnode, pReq, &alterReq, pDb, pStb); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "alterStb", pDb->name, alterReq.name, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stb:%s, failed to alter since %s", alterReq.name, terrstr()); @@ -2405,7 +2450,8 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName, return 0; } -static int32_t mndProcessDropTtltbReq(SRpcMsg *pRsp) { return 0; } +static int32_t mndProcessDropTtltbRsp(SRpcMsg *pRsp) { return 0; } +static int32_t mndProcessTrimDbRsp(SRpcMsg *pRsp) { return 0; } static int32_t mndProcessDropStbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; @@ -2461,6 +2507,8 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) { code = mndDropStb(pMnode, pReq, pDb, pStb); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "dropStb", pDb->name, dropReq.name, ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stb:%s, failed to drop since %s", dropReq.name, terrstr()); @@ -3192,136 +3240,161 @@ static int32_t buildDbColsInfoBlock(const SSDataBlock *p, const SSysTableMeta *p return numOfRows; } +#define BUILD_COL_FOR_INFO_DB 1 +#define BUILD_COL_FOR_PERF_DB 1 << 1 +#define BUILD_COL_FOR_USER_DB 1 << 2 +#define BUILD_COL_FOR_ALL_DB (BUILD_COL_FOR_INFO_DB | BUILD_COL_FOR_PERF_DB | BUILD_COL_FOR_USER_DB) -static int32_t buildSysDbColsInfo(SSDataBlock *p, char *db, char *tb) { +static int32_t buildSysDbColsInfo(SSDataBlock *p, int8_t buildWhichDBs, char *tb) { size_t size = 0; const SSysTableMeta *pSysDbTableMeta = NULL; - if (db[0] && strncmp(db, TSDB_INFORMATION_SCHEMA_DB, TSDB_DB_FNAME_LEN) != 0 && - strncmp(db, TSDB_PERFORMANCE_SCHEMA_DB, TSDB_DB_FNAME_LEN) != 0) { - return p->info.rows; + if (buildWhichDBs & BUILD_COL_FOR_INFO_DB) { + getInfosDbMeta(&pSysDbTableMeta, &size); + p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_INFORMATION_SCHEMA_DB, tb); } - getInfosDbMeta(&pSysDbTableMeta, &size); - p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_INFORMATION_SCHEMA_DB, tb); - - getPerfDbMeta(&pSysDbTableMeta, &size); - p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_PERFORMANCE_SCHEMA_DB, tb); + if (buildWhichDBs & BUILD_COL_FOR_PERF_DB) { + getPerfDbMeta(&pSysDbTableMeta, &size); + p->info.rows = buildDbColsInfoBlock(p, pSysDbTableMeta, size, TSDB_PERFORMANCE_SCHEMA_DB, tb); + } return p->info.rows; } +static int8_t determineBuildColForWhichDBs(const char* db) { + int8_t buildWhichDBs; + if (!db[0]) + buildWhichDBs = BUILD_COL_FOR_ALL_DB; + else { + char *p = strchr(db, '.'); + if (p && strcmp(p + 1, TSDB_INFORMATION_SCHEMA_DB) == 0) { + buildWhichDBs = BUILD_COL_FOR_INFO_DB; + } else if (p && strcmp(p + 1, TSDB_PERFORMANCE_SCHEMA_DB) == 0) { + buildWhichDBs = BUILD_COL_FOR_PERF_DB; + } else { + buildWhichDBs = BUILD_COL_FOR_USER_DB; + } + } + return buildWhichDBs; +} + static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { + uint8_t buildWhichDBs; SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; SStbObj *pStb = NULL; - int32_t numOfRows = 0; + + buildWhichDBs = determineBuildColForWhichDBs(pShow->db); + if (!pShow->sysDbRsp) { - numOfRows = buildSysDbColsInfo(pBlock, pShow->db, pShow->filterTb); + numOfRows = buildSysDbColsInfo(pBlock, buildWhichDBs, pShow->filterTb); mDebug("mndRetrieveStbCol get system table cols, rows:%d, db:%s", numOfRows, pShow->db); pShow->sysDbRsp = true; } - SDbObj *pDb = NULL; - if (strlen(pShow->db) > 0) { - pDb = mndAcquireDb(pMnode, pShow->db); - if (pDb == NULL) return terrno; - } - - char typeName[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; - STR_TO_VARSTR(typeName, "SUPER_TABLE"); - bool fetch = pShow->restore ? false : true; - pShow->restore = false; - while (numOfRows < rows) { - if (fetch) { - pShow->pIter = sdbFetch(pSdb, SDB_STB, pShow->pIter, (void **)&pStb); - if (pShow->pIter == NULL) break; - } else { - fetch = true; - void *pKey = taosHashGetKey(pShow->pIter, NULL); - pStb = sdbAcquire(pSdb, SDB_STB, pKey); - if (!pStb) continue; + if (buildWhichDBs & BUILD_COL_FOR_USER_DB) { + SDbObj *pDb = NULL; + if (strlen(pShow->db) > 0) { + pDb = mndAcquireDb(pMnode, pShow->db); + if (pDb == NULL && TSDB_CODE_MND_DB_NOT_EXIST != terrno && pBlock->info.rows == 0) return terrno; } - if (pDb != NULL && pStb->dbUid != pDb->uid) { - sdbRelease(pSdb, pStb); - continue; - } - - SName name = {0}; - char stbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - mndExtractTbNameFromStbFullName(pStb->name, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); - if (pShow->filterTb[0] && strncmp(pShow->filterTb, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN) != 0) { - sdbRelease(pSdb, pStb); - continue; - } - - if ((numOfRows + pStb->numOfColumns) > rows) { - pShow->restore = true; - if (numOfRows == 0) { - mError("mndRetrieveStbCol failed to get stable cols since buf:%d less than result:%d, stable name:%s, db:%s", - rows, pStb->numOfColumns, pStb->name, pStb->db); + char typeName[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_TO_VARSTR(typeName, "SUPER_TABLE"); + bool fetch = pShow->restore ? false : true; + pShow->restore = false; + while (numOfRows < rows) { + if (fetch) { + pShow->pIter = sdbFetch(pSdb, SDB_STB, pShow->pIter, (void **)&pStb); + if (pShow->pIter == NULL) break; + } else { + fetch = true; + void *pKey = taosHashGetKey(pShow->pIter, NULL); + pStb = sdbAcquire(pSdb, SDB_STB, pKey); + if (!pStb) continue; } - sdbRelease(pSdb, pStb); - break; - } - varDataSetLen(stbName, strlen(&stbName[VARSTR_HEADER_SIZE])); - - mDebug("mndRetrieveStbCol get stable cols, stable name:%s, db:%s", pStb->name, pStb->db); - - char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB); - tNameGetDbName(&name, varDataVal(db)); - varDataSetLen(db, strlen(varDataVal(db))); - - for (int i = 0; i < pStb->numOfColumns; i++) { - int32_t cols = 0; - SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)db, false); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, typeName, false); - - // col name - char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - STR_TO_VARSTR(colName, pStb->pColumns[i].name); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, colName, false); - - // col type - int8_t colType = pStb->pColumns[i].type; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - char colTypeStr[VARSTR_HEADER_SIZE + 32]; - int colTypeLen = sprintf(varDataVal(colTypeStr), "%s", tDataTypes[colType].name); - if (colType == TSDB_DATA_TYPE_VARCHAR) { - colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", - (int32_t)(pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE)); - } else if (colType == TSDB_DATA_TYPE_NCHAR) { - colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", - (int32_t)((pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); + if (pDb != NULL && pStb->dbUid != pDb->uid) { + sdbRelease(pSdb, pStb); + continue; } - varDataSetLen(colTypeStr, colTypeLen); - colDataSetVal(pColInfo, numOfRows, (char *)colTypeStr, false); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->pColumns[i].bytes, false); - while (cols < pShow->numOfColumns) { + SName name = {0}; + char stbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + mndExtractTbNameFromStbFullName(pStb->name, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); + if (pShow->filterTb[0] && strncmp(pShow->filterTb, &stbName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN) != 0) { + sdbRelease(pSdb, pStb); + continue; + } + + if ((numOfRows + pStb->numOfColumns) > rows) { + pShow->restore = true; + if (numOfRows == 0) { + mError("mndRetrieveStbCol failed to get stable cols since buf:%d less than result:%d, stable name:%s, db:%s", + rows, pStb->numOfColumns, pStb->name, pStb->db); + } + sdbRelease(pSdb, pStb); + break; + } + + varDataSetLen(stbName, strlen(&stbName[VARSTR_HEADER_SIZE])); + + mDebug("mndRetrieveStbCol get stable cols, stable name:%s, db:%s", pStb->name, pStb->db); + + char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + tNameFromString(&name, pStb->db, T_NAME_ACCT | T_NAME_DB); + tNameGetDbName(&name, varDataVal(db)); + varDataSetLen(db, strlen(varDataVal(db))); + + for (int i = 0; i < pStb->numOfColumns; i++) { + int32_t cols = 0; + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)stbName, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetNULL(pColInfo, numOfRows); + colDataSetVal(pColInfo, numOfRows, (const char *)db, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, typeName, false); + + // col name + char colName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_TO_VARSTR(colName, pStb->pColumns[i].name); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, colName, false); + + // col type + int8_t colType = pStb->pColumns[i].type; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + char colTypeStr[VARSTR_HEADER_SIZE + 32]; + int colTypeLen = sprintf(varDataVal(colTypeStr), "%s", tDataTypes[colType].name); + if (colType == TSDB_DATA_TYPE_VARCHAR) { + colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", + (int32_t)(pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE)); + } else if (colType == TSDB_DATA_TYPE_NCHAR) { + colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", + (int32_t)((pStb->pColumns[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); + } + varDataSetLen(colTypeStr, colTypeLen); + colDataSetVal(pColInfo, numOfRows, (char *)colTypeStr, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pStb->pColumns[i].bytes, false); + while (cols < pShow->numOfColumns) { + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetNULL(pColInfo, numOfRows); + } + numOfRows++; } - numOfRows++; + + sdbRelease(pSdb, pStb); } - sdbRelease(pSdb, pStb); - } - - if (pDb != NULL) { - mndReleaseDb(pMnode, pDb); + if (pDb != NULL) { + mndReleaseDb(pMnode, pDb); + } } pShow->numOfRows += numOfRows; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 427a52af3b..c553257094 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -27,6 +27,7 @@ #include "mndVgroup.h" #include "parser.h" #include "tname.h" +#include "audit.h" #define MND_STREAM_VER_NUMBER 3 #define MND_STREAM_RESERVE_SIZE 64 @@ -828,6 +829,8 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createStream", createStreamReq.name, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); @@ -1073,6 +1076,8 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { return -1; } + auditRecord(pReq, pMnode->clusterId, "dropStream", dropReq.name, "", ""); + sdbRelease(pMnode->pSdb, pStream); mndTransDrop(pTrans); @@ -1567,6 +1572,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) { } if (pStream->status != STREAM_STATUS__PAUSE) { + sdbRelease(pMnode->pSdb, pStream); return 0; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 621a80338d..831e67bea3 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -4,7 +4,7 @@ * 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. - * + *f * 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. @@ -27,6 +27,7 @@ #include "mndVgroup.h" #include "parser.h" #include "tname.h" +#include "audit.h" #define MND_TOPIC_VER_NUMBER 3 #define MND_TOPIC_RESERVE_SIZE 64 @@ -621,6 +622,8 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) { code = TSDB_CODE_ACTION_IN_PROGRESS; } + auditRecord(pReq, pMnode->clusterId, "crateTopic", createTopicReq.name, createTopicReq.subDbName, createTopicReq.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("failed to create topic:%s since %s", createTopicReq.name, terrstr()); @@ -812,6 +815,8 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) { return -1; } + auditRecord(pReq, pMnode->clusterId, "dropTopic", dropReq.name, "", dropReq.sql); + return TSDB_CODE_ACTION_IN_PROGRESS; } @@ -860,7 +865,8 @@ static void schemaToJson(SSchema *schema, int32_t nCols, char *schemaJson){ cJSON* ctype = cJSON_CreateString(tDataTypes[s->type].name); cJSON_AddItemToObject(column, "type", ctype); int32_t length = 0; - if (s->type == TSDB_DATA_TYPE_BINARY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY || + s->type == TSDB_DATA_TYPE_GEOMETRY) { length = s->bytes - VARSTR_HEADER_SIZE; } else if (s->type == TSDB_DATA_TYPE_NCHAR || s->type == TSDB_DATA_TYPE_JSON) { length = (s->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index c59d23d252..8afc73bef6 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -22,6 +22,7 @@ #include "mndTopic.h" #include "mndTrans.h" #include "tbase64.h" +#include "audit.h" #define USER_VER_NUMBER 4 #define USER_RESERVE_SIZE 64 @@ -655,6 +656,8 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) { code = mndCreateUser(pMnode, pOperUser->acct, &createReq, pReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "createUser", createReq.user, "", ""); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("user:%s, failed to create since %s", createReq.user, terrstr()); @@ -970,6 +973,27 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { code = mndAlterUser(pMnode, pUser, &newUser, pReq); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + if(alterReq.alterType == TSDB_ALTER_USER_PASSWD){ + auditRecord(pReq, pMnode->clusterId, "changePassword", alterReq.user, alterReq.objname, ""); + } + else if(alterReq.alterType == TSDB_ALTER_USER_SUPERUSER || + alterReq.alterType == TSDB_ALTER_USER_ENABLE || + alterReq.alterType == TSDB_ALTER_USER_SYSINFO){ + auditRecord(pReq, pMnode->clusterId, "alterUser", alterReq.user, alterReq.objname, ""); + } + else if(alterReq.alterType == TSDB_ALTER_USER_ADD_READ_DB|| + alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_DB|| + alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_DB|| + alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC|| + alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE|| + alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE|| + alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE){ + auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.user, alterReq.objname, ""); + } + else{ + auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.user, alterReq.objname, ""); + } + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("user:%s, failed to alter since %s", alterReq.user, terrstr()); @@ -1039,6 +1063,8 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) { code = mndDropUser(pMnode, pReq, pUser); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + auditRecord(pReq, pMnode->clusterId, "dropUser", dropReq.user, "", dropReq.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("user:%s, failed to drop since %s", dropReq.user, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 26dc2a3f87..ff621198ff 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -26,6 +26,7 @@ #include "mndTrans.h" #include "mndUser.h" #include "tmisce.h" +#include "audit.h" #define VGROUP_VER_NUMBER 1 #define VGROUP_RESERVE_SIZE 64 @@ -2171,6 +2172,11 @@ static int32_t mndProcessRedistributeVgroupMsg(SRpcMsg *pReq) { if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + char obj[33] = {0}; + sprintf(obj, "%d", req.vgId); + + auditRecord(pReq, pMnode->clusterId, "RedistributeVgroup", obj, "", req.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("vgId:%d, failed to redistribute to dnode %d:%d:%d since %s", req.vgId, req.dnodeId1, req.dnodeId2, @@ -2981,6 +2987,8 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) { code = mndBalanceVgroup(pMnode, pReq, pArray); } + auditRecord(pReq, pMnode->clusterId, "balanceVgroup", "", "", req.sql); + _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("failed to balance vgroup since %s", terrstr()); diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index 3482355512..9937debb13 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -57,6 +57,7 @@ int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) { pLoad->numOfProcessedCQuery = stat.cqueryProcessed; pLoad->numOfProcessedFetch = stat.fetchProcessed; pLoad->numOfProcessedDrop = stat.dropProcessed; + pLoad->numOfProcessedNotify = stat.notifyProcessed; pLoad->numOfProcessedHb = stat.hbProcessed; pLoad->numOfProcessedDelete = stat.deleteProcessed; @@ -100,6 +101,9 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) { case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pQnode, pQnode->pQuery, pMsg, ts); break; + case TDMT_SCH_TASK_NOTIFY: + code = qWorkerProcessNotifyMsg(pQnode, pQnode->pQuery, pMsg, ts); + break; default: qError("unknown msg type:%d in qnode queue", pMsg->msgType); terrno = TSDB_CODE_APP_ERROR; diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index c70df86e20..c2b41392e8 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -147,6 +147,7 @@ target_link_libraries( PUBLIC executor PUBLIC scheduler PUBLIC tdb + PUBLIC audit # PUBLIC bdb # PUBLIC scalar diff --git a/source/dnode/vnode/src/inc/metaTtl.h b/source/dnode/vnode/src/inc/metaTtl.h index 45faceb1ea..c2cd389dab 100644 --- a/source/dnode/vnode/src/inc/metaTtl.h +++ b/source/dnode/vnode/src/inc/metaTtl.h @@ -31,15 +31,14 @@ typedef enum DirtyEntryType { } DirtyEntryType; typedef struct STtlManger { - TdThreadRwlock lock; + TTB* pOldTtlIdx; // btree<{deleteTime, tuid}, NULL> - TTB* pOldTtlIdx; // btree<{deleteTime, tuid}, NULL> - - SHashObj* pTtlCache; // key: tuid, value: {ttl, ctime} - SHashObj* pDirtyUids; // dirty tuid + SHashObj* pTtlCache; // hash + SHashObj* pDirtyUids; // hash TTB* pTtlIdx; // btree<{deleteTime, tuid}, ttl> - char* logPrefix; + char* logPrefix; + int32_t flushThreshold; // max dirty entry number in memory. if -1, flush will not be triggered by write-ops } STtlManger; typedef struct { @@ -68,23 +67,24 @@ typedef struct { typedef struct { tb_uid_t uid; int64_t changeTimeMs; + TXN* pTxn; } STtlUpdCtimeCtx; typedef struct { tb_uid_t uid; int64_t changeTimeMs; int64_t ttlDays; + TXN* pTxn; } STtlUpdTtlCtx; typedef struct { tb_uid_t uid; - TXN* pTxn; int64_t ttlDays; + TXN* pTxn; } STtlDelTtlCtx; -int ttlMgrOpen(STtlManger** ppTtlMgr, TDB* pEnv, int8_t rollback, const char* logPrefix); +int ttlMgrOpen(STtlManger** ppTtlMgr, TDB* pEnv, int8_t rollback, const char* logPrefix, int32_t flushThreshold); void ttlMgrClose(STtlManger* pTtlMgr); -int ttlMgrPostOpen(STtlManger* pTtlMgr, void* pMeta); bool ttlMgrNeedUpgrade(TDB* pEnv); int ttlMgrUpgrade(STtlManger* pTtlMgr, void* pMeta); @@ -94,7 +94,7 @@ int ttlMgrDeleteTtl(STtlManger* pTtlMgr, const STtlDelTtlCtx* pDelCtx); int ttlMgrUpdateChangeTime(STtlManger* pTtlMgr, const STtlUpdCtimeCtx* pUpdCtimeCtx); int ttlMgrFlush(STtlManger* pTtlMgr, TXN* pTxn); -int ttlMgrFindExpired(STtlManger* pTtlMgr, int64_t timePointMs, SArray* pTbUids); +int ttlMgrFindExpired(STtlManger* pTtlMgr, int64_t timePointMs, SArray* pTbUids, int32_t ttlDropMaxCount); #ifdef __cplusplus } diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 50b8e625f9..be663c2be9 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -151,9 +151,10 @@ int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq, STableMetaRsp** pMetaRsp); int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids, int64_t* tbUid); int32_t metaTrimTables(SMeta* pMeta); -int metaTtlDropTable(SMeta* pMeta, int64_t timePointMs, SArray* tbUids); +void metaDropTables(SMeta* pMeta, SArray* tbUids); +int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tbUids, int32_t ttlDropMaxCount); int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp); -int metaUpdateChangeTime(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs); +int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs); SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock); STSchema* metaGetTbTSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock); int32_t metaGetTbTSchemaEx(SMeta* pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sver, STSchema** ppTSchema); diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 517d9692c7..3d445acd67 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -130,7 +130,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) { // open pTtlMgr ("ttlv1.idx") char logPrefix[128] = {0}; sprintf(logPrefix, "vgId:%d", TD_VID(pVnode)); - ret = ttlMgrOpen(&pMeta->pTtlMgr, pMeta->pEnv, 0, logPrefix); + ret = ttlMgrOpen(&pMeta->pTtlMgr, pMeta->pEnv, 0, logPrefix, tsTtlFlushThreshold); if (ret < 0) { metaError("vgId:%d, failed to open meta ttl index since %s", TD_VID(pVnode), tstrerror(terrno)); goto _err; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index f56837f759..9a298a4bb7 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -21,6 +21,7 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateUidIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateTtl(SMeta *pMeta, const SMetaEntry *pME); +static int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs); static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateSuidIdx(SMeta *pMeta, const SMetaEntry *pME); @@ -842,9 +843,11 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi return 0; } -static void metaDropTables(SMeta *pMeta, SArray *tbUids) { +void metaDropTables(SMeta *pMeta, SArray *tbUids) { + if (taosArrayGetSize(tbUids) == 0) return; + metaWLock(pMeta); - for (int i = 0; i < TARRAY_SIZE(tbUids); ++i) { + for (int i = 0; i < taosArrayGetSize(tbUids); ++i) { tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUids, i); metaDropTableByUid(pMeta, uid, NULL); metaDebug("batch drop table:%" PRId64, uid); @@ -927,26 +930,23 @@ end: return code; } -int metaTtlDropTable(SMeta *pMeta, int64_t timePointMs, SArray *tbUids) { +int metaTtlFindExpired(SMeta *pMeta, int64_t timePointMs, SArray *tbUids, int32_t ttlDropMaxCount) { + metaWLock(pMeta); int ret = ttlMgrFlush(pMeta->pTtlMgr, pMeta->txn); if (ret != 0) { metaError("ttl failed to flush, ret:%d", ret); - return ret; + goto _err; } - ret = ttlMgrFindExpired(pMeta->pTtlMgr, timePointMs, tbUids); + ret = ttlMgrFindExpired(pMeta->pTtlMgr, timePointMs, tbUids, ttlDropMaxCount); if (ret != 0) { metaError("ttl failed to find expired table, ret:%d", ret); - return ret; - } - if (TARRAY_SIZE(tbUids) == 0) { - return 0; + goto _err; } - metaInfo("ttl find expired table count: %zu", TARRAY_SIZE(tbUids)); - - metaDropTables(pMeta, tbUids); - return 0; +_err: + metaULock(pMeta); + return ret; } static int metaBuildBtimeIdxKey(SBtimeIdxKey *btimeKey, const SMetaEntry *pME) { @@ -1326,10 +1326,10 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl metaSaveToSkmDb(pMeta, &entry); - metaULock(pMeta); - metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs); + metaULock(pMeta); + metaUpdateMetaRsp(uid, pAlterTbReq->tbName, pSchema, pMetaRsp); if (entry.pBuf) taosMemoryFree(entry.pBuf); @@ -1515,10 +1515,10 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid); metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid); - metaULock(pMeta); - metaUpdateChangeTime(pMeta, ctbEntry.uid, pAlterTbReq->ctimeMs); + metaULock(pMeta); + tDecoderClear(&dc1); tDecoderClear(&dc2); taosMemoryFree((void *)ctbEntry.ctbEntry.pTags); @@ -1630,10 +1630,10 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p // save to table db metaSaveToTbDb(pMeta, &entry); metaUpdateUidIdx(pMeta, &entry); - metaULock(pMeta); - metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs); + metaULock(pMeta); + tdbTbcClose(pTbDbc); tdbTbcClose(pUidIdxc); tDecoderClear(&dc); @@ -1981,7 +1981,7 @@ static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) { static int metaUpdateTtl(SMeta *pMeta, const SMetaEntry *pME) { if (pME->type != TSDB_CHILD_TABLE && pME->type != TSDB_NORMAL_TABLE) return 0; - STtlUpdTtlCtx ctx = {.uid = pME->uid}; + STtlUpdTtlCtx ctx = {.uid = pME->uid, .pTxn = pMeta->txn}; if (pME->type == TSDB_CHILD_TABLE) { ctx.ttlDays = pME->ctbEntry.ttlDays; ctx.changeTimeMs = pME->ctbEntry.btime; @@ -1993,7 +1993,7 @@ static int metaUpdateTtl(SMeta *pMeta, const SMetaEntry *pME) { return ttlMgrInsertTtl(pMeta->pTtlMgr, &ctx); } -int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { +static int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { if (!tsTtlChangeOnWrite) return 0; if (changeTimeMs <= 0) { @@ -2001,11 +2001,20 @@ int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { return TSDB_CODE_VERSION_NOT_COMPATIBLE; } - STtlUpdCtimeCtx ctx = {.uid = uid, .changeTimeMs = changeTimeMs}; + STtlUpdCtimeCtx ctx = {.uid = uid, .changeTimeMs = changeTimeMs, .pTxn = pMeta->txn}; return ttlMgrUpdateChangeTime(pMeta->pTtlMgr, &ctx); } +int metaUpdateChangeTimeWithLock(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) { + if (!tsTtlChangeOnWrite) return 0; + + metaWLock(pMeta); + int ret = metaUpdateChangeTime(pMeta, uid, changeTimeMs); + metaULock(pMeta); + return ret; +} + static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) { SCtbIdxKey ctbIdxKey = {.suid = pME->ctbEntry.suid, .uid = pME->uid}; diff --git a/source/dnode/vnode/src/meta/metaTtl.c b/source/dnode/vnode/src/meta/metaTtl.c index 45f697258c..3c45982311 100644 --- a/source/dnode/vnode/src/meta/metaTtl.c +++ b/source/dnode/vnode/src/meta/metaTtl.c @@ -21,6 +21,13 @@ typedef struct { SMeta *pMeta; } SConvertData; +typedef struct { + int32_t ttlDropMaxCount; + int32_t count; + STtlIdxKeyV1 expiredKey; + SArray *pTbUids; +} STtlExpiredCtx; + static void ttlMgrCleanup(STtlManger *pTtlMgr); static int ttlMgrConvert(TTB *pOldTtlIdx, TTB *pNewTtlIdx, void *pMeta); @@ -31,15 +38,15 @@ static int ttlIdxKeyV1Cmpr(const void *pKey1, int kLen1, const void *pKey2, static int ttlMgrFillCache(STtlManger *pTtlMgr); static int32_t ttlMgrFillCacheOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, void *pTtlCache); static int32_t ttlMgrConvertOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, void *pConvertData); +static int32_t ttlMgrFindExpiredOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, + void *pExpiredInfo); -static int32_t ttlMgrWLock(STtlManger *pTtlMgr); -static int32_t ttlMgrRLock(STtlManger *pTtlMgr); -static int32_t ttlMgrULock(STtlManger *pTtlMgr); +static bool ttlMgrNeedFlush(STtlManger *pTtlMgr); const char *ttlTbname = "ttl.idx"; const char *ttlV1Tbname = "ttlv1.idx"; -int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *logPrefix) { +int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *logPrefix, int32_t flushThreshold) { int ret = TSDB_CODE_SUCCESS; int64_t startNs = taosGetTimestampNs(); @@ -55,6 +62,7 @@ int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *lo } strcpy(logBuffer, logPrefix); pTtlMgr->logPrefix = logBuffer; + pTtlMgr->flushThreshold = flushThreshold; ret = tdbTbOpen(ttlV1Tbname, TDB_VARIANT_LEN, TDB_VARIANT_LEN, ttlIdxKeyV1Cmpr, pEnv, &pTtlMgr->pTtlIdx, rollback); if (ret < 0) { @@ -66,8 +74,6 @@ int ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char *lo pTtlMgr->pTtlCache = taosHashInit(8192, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); pTtlMgr->pDirtyUids = taosHashInit(8192, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); - taosThreadRwlockInit(&pTtlMgr->lock, NULL); - ret = ttlMgrFillCache(pTtlMgr); if (ret < 0) { metaError("%s, failed to fill hash since %s", pTtlMgr->logPrefix, tstrerror(terrno)); @@ -130,6 +136,7 @@ int ttlMgrUpgrade(STtlManger *pTtlMgr, void *pMeta) { int64_t endNs = taosGetTimestampNs(); metaInfo("%s, ttl mgr upgrade end, hash size: %d, time consumed: %" PRId64 " ns", pTtlMgr->logPrefix, taosHashGetSize(pTtlMgr->pTtlCache), endNs - startNs); + _out: tdbTbClose(pTtlMgr->pOldTtlIdx); pTtlMgr->pOldTtlIdx = NULL; @@ -142,7 +149,6 @@ static void ttlMgrCleanup(STtlManger *pTtlMgr) { taosHashCleanup(pTtlMgr->pTtlCache); taosHashCleanup(pTtlMgr->pDirtyUids); tdbTbClose(pTtlMgr->pTtlIdx); - taosThreadRwlockDestroy(&pTtlMgr->lock); taosMemoryFree(pTtlMgr); } @@ -229,10 +235,25 @@ static int ttlMgrConvertOneEntry(const void *pKey, int keyLen, const void *pVal, } ret = 0; + _out: return ret; } +static int32_t ttlMgrFindExpiredOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, + void *pExpiredCtx) { + STtlExpiredCtx *pCtx = (STtlExpiredCtx *)pExpiredCtx; + if (pCtx->count >= pCtx->ttlDropMaxCount) return -1; + + int c = ttlIdxKeyV1Cmpr(&pCtx->expiredKey, sizeof(pCtx->expiredKey), pKey, keyLen); + if (c > 0) { + taosArrayPush(pCtx->pTbUids, &((STtlIdxKeyV1 *)pKey)->uid); + pCtx->count++; + } + + return c; +} + static int ttlMgrConvert(TTB *pOldTtlIdx, TTB *pNewTtlIdx, void *pMeta) { SMeta *meta = pMeta; @@ -255,8 +276,6 @@ int ttlMgrInsertTtl(STtlManger *pTtlMgr, const STtlUpdTtlCtx *updCtx) { STtlCacheEntry cacheEntry = {.ttlDays = updCtx->ttlDays, .changeTimeMs = updCtx->changeTimeMs}; STtlDirtyEntry dirtryEntry = {.type = ENTRY_TYPE_UPSERT}; - ttlMgrWLock(pTtlMgr); - int ret = taosHashPut(pTtlMgr->pTtlCache, &updCtx->uid, sizeof(updCtx->uid), &cacheEntry, sizeof(cacheEntry)); if (ret < 0) { metaError("%s, ttlMgr insert failed to update ttl cache since %s", pTtlMgr->logPrefix, tstrerror(terrno)); @@ -269,10 +288,13 @@ int ttlMgrInsertTtl(STtlManger *pTtlMgr, const STtlUpdTtlCtx *updCtx) { goto _out; } - ret = 0; -_out: - ttlMgrULock(pTtlMgr); + if (ttlMgrNeedFlush(pTtlMgr)) { + ttlMgrFlush(pTtlMgr, updCtx->pTxn); + } + ret = 0; + +_out: metaDebug("%s, ttl mgr insert ttl, uid: %" PRId64 ", ctime: %" PRId64 ", ttlDays: %" PRId64, pTtlMgr->logPrefix, updCtx->uid, updCtx->changeTimeMs, updCtx->ttlDays); @@ -281,7 +303,6 @@ _out: int ttlMgrDeleteTtl(STtlManger *pTtlMgr, const STtlDelTtlCtx *delCtx) { if (delCtx->ttlDays == 0) return 0; - ttlMgrWLock(pTtlMgr); STtlDirtyEntry dirtryEntry = {.type = ENTRY_TYPE_DEL}; @@ -291,18 +312,19 @@ int ttlMgrDeleteTtl(STtlManger *pTtlMgr, const STtlDelTtlCtx *delCtx) { goto _out; } - ret = 0; -_out: - ttlMgrULock(pTtlMgr); + if (ttlMgrNeedFlush(pTtlMgr)) { + ttlMgrFlush(pTtlMgr, delCtx->pTxn); + } + ret = 0; + +_out: metaDebug("%s, ttl mgr delete ttl, uid: %" PRId64, pTtlMgr->logPrefix, delCtx->uid); return ret; } int ttlMgrUpdateChangeTime(STtlManger *pTtlMgr, const STtlUpdCtimeCtx *pUpdCtimeCtx) { - ttlMgrWLock(pTtlMgr); - int ret = 0; STtlCacheEntry *oldData = taosHashGet(pTtlMgr->pTtlCache, &pUpdCtimeCtx->uid, sizeof(pUpdCtimeCtx->uid)); @@ -327,59 +349,35 @@ int ttlMgrUpdateChangeTime(STtlManger *pTtlMgr, const STtlUpdCtimeCtx *pUpdCtime goto _out; } - ret = 0; -_out: - ttlMgrULock(pTtlMgr); + if (ttlMgrNeedFlush(pTtlMgr)) { + ttlMgrFlush(pTtlMgr, pUpdCtimeCtx->pTxn); + } + ret = 0; + +_out: metaDebug("%s, ttl mgr update ctime, uid: %" PRId64 ", ctime: %" PRId64, pTtlMgr->logPrefix, pUpdCtimeCtx->uid, pUpdCtimeCtx->changeTimeMs); return ret; } -int ttlMgrFindExpired(STtlManger *pTtlMgr, int64_t timePointMs, SArray *pTbUids) { - ttlMgrRLock(pTtlMgr); +int ttlMgrFindExpired(STtlManger *pTtlMgr, int64_t timePointMs, SArray *pTbUids, int32_t ttlDropMaxCount) { + STtlIdxKeyV1 ttlKey = {.deleteTimeMs = timePointMs, .uid = INT64_MAX}; + STtlExpiredCtx expiredCtx = { + .ttlDropMaxCount = ttlDropMaxCount, .count = 0, .expiredKey = ttlKey, .pTbUids = pTbUids}; + return tdbTbTraversal(pTtlMgr->pTtlIdx, &expiredCtx, ttlMgrFindExpiredOneEntry); +} - TBC *pCur; - int ret = tdbTbcOpen(pTtlMgr->pTtlIdx, &pCur, NULL); - if (ret < 0) { - goto _out; - } - - STtlIdxKeyV1 ttlKey = {0}; - ttlKey.deleteTimeMs = timePointMs; - ttlKey.uid = INT64_MAX; - int c = 0; - tdbTbcMoveTo(pCur, &ttlKey, sizeof(ttlKey), &c); - if (c < 0) { - tdbTbcMoveToPrev(pCur); - } - - void *pKey = NULL; - int kLen = 0; - while (1) { - ret = tdbTbcPrev(pCur, &pKey, &kLen, NULL, NULL); - if (ret < 0) { - ret = 0; - break; - } - ttlKey = *(STtlIdxKeyV1 *)pKey; - taosArrayPush(pTbUids, &ttlKey.uid); - } - - tdbFree(pKey); - tdbTbcClose(pCur); - - ret = 0; -_out: - ttlMgrULock(pTtlMgr); - return ret; +static bool ttlMgrNeedFlush(STtlManger *pTtlMgr) { + return pTtlMgr->flushThreshold > 0 && taosHashGetSize(pTtlMgr->pDirtyUids) > pTtlMgr->flushThreshold; } int ttlMgrFlush(STtlManger *pTtlMgr, TXN *pTxn) { - ttlMgrWLock(pTtlMgr); + int64_t startNs = taosGetTimestampNs(); + int64_t endNs = startNs; - metaDebug("%s, ttl mgr flush start. dirty uids:%d", pTtlMgr->logPrefix, taosHashGetSize(pTtlMgr->pDirtyUids)); + metaTrace("%s, ttl mgr flush start. dirty uids:%d", pTtlMgr->logPrefix, taosHashGetSize(pTtlMgr->pDirtyUids)); int ret = -1; @@ -430,40 +428,10 @@ int ttlMgrFlush(STtlManger *pTtlMgr, TXN *pTxn) { taosHashClear(pTtlMgr->pDirtyUids); ret = 0; + _out: - ttlMgrULock(pTtlMgr); - - metaDebug("%s, ttl mgr flush end.", pTtlMgr->logPrefix); - - return ret; -} - -static int32_t ttlMgrRLock(STtlManger *pTtlMgr) { - int32_t ret = 0; - - metaTrace("%s, ttlMgr rlock %p", pTtlMgr->logPrefix, &pTtlMgr->lock); - - ret = taosThreadRwlockRdlock(&pTtlMgr->lock); - - return ret; -} - -static int32_t ttlMgrWLock(STtlManger *pTtlMgr) { - int32_t ret = 0; - - metaTrace("%s, ttlMgr wlock %p", pTtlMgr->logPrefix, &pTtlMgr->lock); - - ret = taosThreadRwlockWrlock(&pTtlMgr->lock); - - return ret; -} - -static int32_t ttlMgrULock(STtlManger *pTtlMgr) { - int32_t ret = 0; - - metaTrace("%s, ttlMgr ulock %p", pTtlMgr->logPrefix, &pTtlMgr->lock); - - ret = taosThreadRwlockUnlock(&pTtlMgr->lock); + endNs = taosGetTimestampNs(); + metaTrace("%s, ttl mgr flush end, time consumed: %" PRId64 " ns", pTtlMgr->logPrefix, endNs - startNs); return ret; } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index a5f7e0eb68..cef8a99e25 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -883,20 +883,8 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg } else { tqInfo("vgId:%d switch consumer from Id:0x%" PRIx64 " to Id:0x%" PRIx64, req.vgId, pHandle->consumerId, req.newConsumerId); atomic_store_64(&pHandle->consumerId, req.newConsumerId); - // atomic_add_fetch_32(&pHandle->epoch, 1); + atomic_store_32(&pHandle->epoch, 0); - // kill executing task - // if(tqIsHandleExec(pHandle)) { - // qTaskInfo_t pTaskInfo = pHandle->execHandle.task; - // if (pTaskInfo != NULL) { - // qKillTask(pTaskInfo, TSDB_CODE_SUCCESS); - // } - - // if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { - // qStreamCloseTsdbReader(pTaskInfo); - // } - // } - // remove if it has been register in the push manager, and return one empty block to consumer tqUnregisterPushHandle(pTq, pHandle); ret = tqMetaSaveHandle(pTq, req.subKey, pHandle); } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 7c58431b57..ec8f2ae35d 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -296,53 +296,70 @@ int32_t tqReaderSeek(STqReader* pReader, int64_t ver, const char* id) { } int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, const char* id) { - int32_t code = walNextValidMsg(pReader); - if (code != TSDB_CODE_SUCCESS) { + int32_t code = 0; + + while(1) { + code = walNextValidMsg(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + SWalCont* pCont = &pReader->pHead->head; + int64_t ver = pCont->version; + if (ver > maxVer) { + tqDebug("maxVer in WAL:%" PRId64 " reached current:%" PRId64 ", do not scan wal anymore, %s", maxVer, ver, id); + return TSDB_CODE_SUCCESS; + } + + if (pCont->msgType == TDMT_VND_SUBMIT) { + void* pBody = POINTER_SHIFT(pCont->body, sizeof(SSubmitReq2Msg)); + int32_t len = pCont->bodyLen - sizeof(SSubmitReq2Msg); + + void* data = taosMemoryMalloc(len); + if (data == NULL) { + // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry + code = TSDB_CODE_OUT_OF_MEMORY; + terrno = code; + + tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", 0); + return code; + } + + memcpy(data, pBody, len); + SPackedData data1 = (SPackedData){.ver = ver, .msgLen = len, .msgStr = data}; + + *pItem = (SStreamQueueItem*)streamDataSubmitNew(&data1, STREAM_INPUT__DATA_SUBMIT); + if (*pItem == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + terrno = code; + tqError("%s failed to create data submit for stream since out of memory", id); + return code; + } + } else if (pCont->msgType == TDMT_VND_DELETE) { + void* pBody = POINTER_SHIFT(pCont->body, sizeof(SMsgHead)); + int32_t len = pCont->bodyLen - sizeof(SMsgHead); + + code = extractDelDataBlock(pBody, len, ver, (SStreamRefDataBlock**)pItem); + if (code == TSDB_CODE_SUCCESS) { + if (*pItem == NULL) { + tqDebug("s-task:%s empty delete msg, discard it, len:%d, ver:%" PRId64, id, len, ver); + // we need to continue check next data in the wal files. + continue; + } else { + tqDebug("s-task:%s delete msg extract from WAL, len:%d, ver:%" PRId64, id, len, ver); + } + } else { + terrno = code; + tqError("s-task:%s extract delete msg from WAL failed, code:%s", id, tstrerror(code)); + return code; + } + + } else { + ASSERT(0); + } + return code; } - - int64_t ver = pReader->pHead->head.version; - if (ver > maxVer) { - tqDebug("maxVer in WAL:%"PRId64" reached current:%"PRId64", do not scan wal anymore, %s", maxVer, ver, id); - return TSDB_CODE_SUCCESS; - } - - if (pReader->pHead->head.msgType == TDMT_VND_SUBMIT) { - void* pBody = POINTER_SHIFT(pReader->pHead->head.body, sizeof(SSubmitReq2Msg)); - int32_t len = pReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg); - - void* data = taosMemoryMalloc(len); - if (data == NULL) { - // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry - terrno = TSDB_CODE_OUT_OF_MEMORY; - tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", 0); - return -1; - } - - memcpy(data, pBody, len); - SPackedData data1 = (SPackedData){.ver = ver, .msgLen = len, .msgStr = data}; - - *pItem = (SStreamQueueItem*)streamDataSubmitNew(&data1, STREAM_INPUT__DATA_SUBMIT); - if (*pItem == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - tqError("%s failed to create data submit for stream since out of memory", id); - return terrno; - } - } else if (pReader->pHead->head.msgType == TDMT_VND_DELETE) { - void* pBody = POINTER_SHIFT(pReader->pHead->head.body, sizeof(SMsgHead)); - int32_t len = pReader->pHead->head.bodyLen - sizeof(SMsgHead); - - code = extractDelDataBlock(pBody, len, ver, (SStreamRefDataBlock**)pItem); - if (code != TSDB_CODE_SUCCESS) { - tqError("s-task:%s extract delete msg from WAL failed, code:%s", id, tstrerror(code)); - } else { - tqDebug("s-task:%s delete msg extract from WAL, len:%d, ver:%"PRId64, id, len, ver); - } - } else { - ASSERT(0); - } - - return 0; } // todo ignore the error in wal? diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index afbe895721..d4cb63fb7b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -235,36 +235,33 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { return 0; } - ASSERT(TARRAY2_SIZE(committer->ctx->fset->lvlArr) == 1); + SSttLvl *lvl; + TARRAY2_FOREACH(committer->ctx->fset->lvlArr, lvl) { + STFileObj *fobj = NULL; + TARRAY2_FOREACH(lvl->fobjArr, fobj) { + SSttFileReader *sttReader; - SSttLvl *lvl = TARRAY2_FIRST(committer->ctx->fset->lvlArr); + SSttFileReaderConfig config = { + .tsdb = committer->tsdb, + .szPage = committer->szPage, + .file = fobj->f[0], + }; - ASSERT(lvl->level == 0); + code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader); + TSDB_CHECK_CODE(code, lino, _exit); - STFileObj *fobj = NULL; - TARRAY2_FOREACH(lvl->fobjArr, fobj) { - SSttFileReader *sttReader; + code = TARRAY2_APPEND(committer->sttReaderArray, sttReader); + TSDB_CHECK_CODE(code, lino, _exit); - SSttFileReaderConfig config = { - .tsdb = committer->tsdb, - .szPage = committer->szPage, - .file = fobj->f[0], - }; + STFileOp op = { + .optype = TSDB_FOP_REMOVE, + .fid = fobj->f->fid, + .of = fobj->f[0], + }; - code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader); - TSDB_CHECK_CODE(code, lino, _exit); - - code = TARRAY2_APPEND(committer->sttReaderArray, sttReader); - TSDB_CHECK_CODE(code, lino, _exit); - - STFileOp op = { - .optype = TSDB_FOP_REMOVE, - .fid = fobj->f->fid, - .of = fobj->f[0], - }; - - code = TARRAY2_APPEND(committer->fopArray, op); - TSDB_CHECK_CODE(code, lino, _exit); + code = TARRAY2_APPEND(committer->fopArray, op); + TSDB_CHECK_CODE(code, lino, _exit); + } } _exit: diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 7f843070d6..a997c3eea5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -16,6 +16,7 @@ #include "tsdbFS2.h" #include "tsdbUpgrade.h" #include "vnd.h" +#include "vndCos.h" extern int vnodeScheduleTask(int (*execute)(void *), void *arg); extern int vnodeScheduleTaskEx(int tpid, int (*execute)(void *), void *arg); @@ -365,6 +366,14 @@ static int32_t tsdbFSDoScanAndFixFile(STFileSystem *fs, const STFileObj *fobj) { // check file existence if (!taosCheckExistFile(fobj->fname)) { + if (tsS3Enabled) { + const char *object_name = taosDirEntryBaseName((char *)fobj->fname); + long s3_size = s3Size(object_name); + if (s3_size > 0) { + return 0; + } + } + code = TSDB_CODE_FILE_CORRUPTED; tsdbError("vgId:%d %s failed since file:%s does not exist", TD_VID(fs->tsdb->pVnode), __func__, fobj->fname); return code; @@ -628,7 +637,7 @@ _exit: } else { tsdbInfo("vgId:%d %s success", TD_VID(pTsdb->pVnode), __func__); } - return 0; + return code; } static int32_t close_file_system(STFileSystem *fs) { @@ -721,7 +730,7 @@ _exit: } else { tsdbInfo("vgId:%d %s success", TD_VID(pTsdb->pVnode), __func__); } - return 0; + return code; } static void tsdbDoWaitBgTask(STFileSystem *fs, STFSBgTask *task) { diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 651dbebdfd..974b7f1b76 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -16,6 +16,61 @@ #include "tsdb.h" #include "vndCos.h" +static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { + int32_t code = 0; + const char *path = pFD->path; + int32_t szPage = pFD->szPage; + int32_t flag = pFD->flag; + + pFD->pFD = taosOpenFile(path, flag); + if (pFD->pFD == NULL) { + int errsv = errno; + const char *object_name = taosDirEntryBaseName((char *)path); + long s3_size = tsS3Enabled ? s3Size(object_name) : 0; + if (tsS3Enabled && !strncmp(path + strlen(path) - 5, ".data", 5) && s3_size > 0) { + s3EvictCache(path, s3_size); + s3Get(object_name, path); + + pFD->pFD = taosOpenFile(path, flag); + + if (pFD->pFD == NULL) { + code = TAOS_SYSTEM_ERROR(ENOENT); + // taosMemoryFree(pFD); + goto _exit; + } + } else { + code = TAOS_SYSTEM_ERROR(errsv); + // taosMemoryFree(pFD); + goto _exit; + } + } + + pFD->pBuf = taosMemoryCalloc(1, szPage); + if (pFD->pBuf == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + // taosCloseFile(&pFD->pFD); + // taosMemoryFree(pFD); + goto _exit; + } + + // not check file size when reading data files. + if (flag != TD_FILE_READ) { + if (taosStatFile(path, &pFD->szFile, NULL, NULL) < 0) { + code = TAOS_SYSTEM_ERROR(errno); + // taosMemoryFree(pFD->pBuf); + // taosCloseFile(&pFD->pFD); + // taosMemoryFree(pFD); + goto _exit; + } + + ASSERT(pFD->szFile % szPage == 0); + pFD->szFile = pFD->szFile / szPage; + } + +_exit: + return code; +} + // =============== PAGE-WISE FILE =============== int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD) { int32_t code = 0; @@ -33,51 +88,8 @@ int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **p strcpy(pFD->path, path); pFD->szPage = szPage; pFD->flag = flag; - pFD->pFD = taosOpenFile(path, flag); - if (pFD->pFD == NULL) { - int errsv = errno; - const char *object_name = taosDirEntryBaseName((char *)path); - long s3_size = s3Size(object_name); - if (!strncmp(path + strlen(path) - 5, ".data", 5) && s3_size > 0) { - s3EvictCache(path, s3_size); - s3Get(object_name, path); - - pFD->pFD = taosOpenFile(path, flag); - - if (pFD->pFD == NULL) { - code = TAOS_SYSTEM_ERROR(ENOENT); - taosMemoryFree(pFD); - goto _exit; - } - } else { - code = TAOS_SYSTEM_ERROR(errsv); - taosMemoryFree(pFD); - goto _exit; - } - } pFD->szPage = szPage; pFD->pgno = 0; - pFD->pBuf = taosMemoryCalloc(1, szPage); - if (pFD->pBuf == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - taosCloseFile(&pFD->pFD); - taosMemoryFree(pFD); - goto _exit; - } - - // not check file size when reading data files. - if (flag != TD_FILE_READ) { - if (taosStatFile(path, &pFD->szFile, NULL, NULL) < 0) { - code = TAOS_SYSTEM_ERROR(errno); - taosMemoryFree(pFD->pBuf); - taosCloseFile(&pFD->pFD); - taosMemoryFree(pFD); - goto _exit; - } - - ASSERT(pFD->szFile % szPage == 0); - pFD->szFile = pFD->szFile / szPage; - } *ppFD = pFD; @@ -98,6 +110,13 @@ void tsdbCloseFile(STsdbFD **ppFD) { static int32_t tsdbWriteFilePage(STsdbFD *pFD) { int32_t code = 0; + if (!pFD->pFD) { + code = tsdbOpenFileImpl(pFD); + if (code) { + goto _exit; + } + } + if (pFD->pgno > 0) { int64_t n = taosLSeekFile(pFD->pFD, PAGE_OFFSET(pFD->pgno, pFD->szPage), SEEK_SET); if (n < 0) { @@ -127,6 +146,12 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) { int32_t code = 0; // ASSERT(pgno <= pFD->szFile); + if (!pFD->pFD) { + code = tsdbOpenFileImpl(pFD); + if (code) { + goto _exit; + } + } // seek int64_t offset = PAGE_OFFSET(pgno, pFD->szPage); diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index 267e8b4117..61be14f9bc 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -338,6 +338,17 @@ static int32_t tsdbDoRetention2(void *arg) { code = tsdbMigrateDataFileS3(rtner, fobj, &did); TSDB_CHECK_CODE(code, lino, _exit); } else { + if (tsS3Enabled) { + int64_t fsize = 0; + if (taosStatFile(fobj->fname, &fsize, NULL, NULL) < 0) { + code = TAOS_SYSTEM_ERROR(terrno); + tsdbError("vgId:%d %s failed since file:%s stat failed, reason:%s", TD_VID(rtner->tsdb->pVnode), __func__, + fobj->fname, tstrerror(code)); + TSDB_CHECK_CODE(code, lino, _exit); + } + s3EvictCache(fobj->fname, fsize * 2); + } + code = tsdbDoMigrateFileObj(rtner, fobj, &did); TSDB_CHECK_CODE(code, lino, _exit); } diff --git a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c index 59ba51c371..3f1fcb7248 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c +++ b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c @@ -120,7 +120,15 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader * }; if (dataBlk->hasDup) { - code = tsdbReadDataBlockEx(reader, dataBlk, ctx->blockData); + tBlockDataReset(ctx->blockData); + + int16_t aCid = 0; + STSchema tSchema = {0}; + TABLEID tbid = {.suid = pBlockIdx->suid, .uid = pBlockIdx->uid}; + code = tBlockDataInit(ctx->blockData, &tbid, &tSchema, &aCid, 0); + TSDB_CHECK_CODE(code, lino, _exit); + + code = tsdbReadDataBlock(reader, dataBlk, ctx->blockData); TSDB_CHECK_CODE(code, lino, _exit); record.count = 1; @@ -334,6 +342,8 @@ static int32_t tsdbUpgradeFileSet(STsdb *tsdb, SDFileSet *pDFileSet, TFileSetArr int32_t code = 0; int32_t lino = 0; + tsdbInfo("vgId:%d upgrade file set start, fid:%d", TD_VID(tsdb->pVnode), pDFileSet->fid); + SDataFReader *reader; STFileSet *fset; @@ -366,6 +376,8 @@ static int32_t tsdbUpgradeFileSet(STsdb *tsdb, SDFileSet *pDFileSet, TFileSetArr code = TARRAY2_APPEND(fileSetArray, fset); TSDB_CHECK_CODE(code, lino, _exit); + tsdbInfo("vgId:%d upgrade file set end, fid:%d", TD_VID(tsdb->pVnode), pDFileSet->fid); + _exit: if (code) { TSDB_ERROR_LOG(TD_VID(tsdb->pVnode), lino, code); diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 95404ee9f2..1554d58d56 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -216,7 +216,7 @@ int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { cfgRsp.numOfTags = schemaTag.nCols; cfgRsp.numOfColumns = schema.nCols; - cfgRsp.pSchemas = (SSchema *)taosMemoryCalloc(cfgRsp.numOfColumns + cfgRsp.numOfTags, sizeof(SSchema)); + cfgRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (cfgRsp.numOfColumns + cfgRsp.numOfTags)); memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols); if (schemaTag.nCols) { diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 52c36fcb1b..3687756ffc 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -19,6 +19,7 @@ #include "vndCos.h" #include "vnode.h" #include "vnodeInt.h" +#include "audit.h" static int32_t vnodeProcessCreateStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessAlterStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); @@ -142,6 +143,74 @@ _exit: return code; } +static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) { + int32_t code = TSDB_CODE_INVALID_MSG; + int32_t lino = 0; + + SMsgHead *pContOld = pMsg->pCont; + int32_t reqLenOld = pMsg->contLen - sizeof(SMsgHead); + + SArray *tbUids = NULL; + int64_t timestampMs = 0; + + SVDropTtlTableReq ttlReq = {0}; + if (tDeserializeSVDropTtlTableReq((char *)pContOld + sizeof(SMsgHead), reqLenOld, &ttlReq) != 0) { + code = TSDB_CODE_INVALID_MSG; + TSDB_CHECK_CODE(code, lino, _exit); + } + + { // find expired uids + tbUids = taosArrayInit(8, sizeof(int64_t)); + if (tbUids == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + timestampMs = (int64_t)ttlReq.timestampSec * 1000; + code = metaTtlFindExpired(pVnode->pMeta, timestampMs, tbUids, ttlReq.ttlDropMaxCount); + if (code != 0) { + code = TSDB_CODE_INVALID_MSG; + TSDB_CHECK_CODE(code, lino, _exit); + } + + ttlReq.nUids = taosArrayGetSize(tbUids); + ttlReq.pTbUids = tbUids; + } + + { // prepare new content + int32_t reqLenNew = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); + int32_t contLenNew = reqLenNew + sizeof(SMsgHead); + + SMsgHead *pContNew = rpcMallocCont(contLenNew); + if (pContNew == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _exit); + } + + tSerializeSVDropTtlTableReq((char *)pContNew + sizeof(SMsgHead), reqLenNew, &ttlReq); + pContNew->contLen = htonl(reqLenNew); + pContNew->vgId = pContOld->vgId; + + rpcFreeCont(pContOld); + pMsg->pCont = pContNew; + pMsg->contLen = contLenNew; + } + + code = 0; + +_exit: + taosArrayDestroy(tbUids); + + if (code) { + vError("vgId:%d, %s:%d failed to preprocess drop ttl request since %s, msg type:%s", TD_VID(pVnode), __func__, lino, + tstrerror(code), TMSG_INFO(pMsg->msgType)); + } else { + vTrace("vgId:%d, %s done, timestampSec:%d, nUids:%d", TD_VID(pVnode), __func__, ttlReq.timestampSec, ttlReq.nUids); + } + + return code; +} + extern int64_t tsMaxKeyByPrecision[]; static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int64_t btimeMs, int64_t ctimeMs) { int32_t code = 0; @@ -371,6 +440,9 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) { case TDMT_VND_ALTER_TABLE: { code = vnodePreProcessAlterTableMsg(pVnode, pMsg); } break; + case TDMT_VND_DROP_TTL_TABLE: { + code = vnodePreProcessDropTtlMsg(pVnode, pMsg); + } break; case TDMT_VND_SUBMIT: { code = vnodePreProcessSubmitMsg(pVnode, pMsg); } break; @@ -405,10 +477,10 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg return -1; } - vDebug("vgId:%d, start to process write request %s, index:%" PRId64 ", applied:%" PRId64 - ", state.applyTerm:%" PRId64 ", conn.applyTerm:%" PRId64, - TD_VID(pVnode), TMSG_INFO(pMsg->msgType), ver, pVnode->state.applied, - pVnode->state.applyTerm, pMsg->info.conn.applyTerm); + vDebug("vgId:%d, start to process write request %s, index:%" PRId64 ", applied:%" PRId64 ", state.applyTerm:%" PRId64 + ", conn.applyTerm:%" PRId64, + TD_VID(pVnode), TMSG_INFO(pMsg->msgType), ver, pVnode->state.applied, pVnode->state.applyTerm, + pMsg->info.conn.applyTerm); ASSERT(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm); ASSERTS(pVnode->state.applied + 1 == ver, "applied:%" PRId64 ", ver:%" PRId64, pVnode->state.applied, ver); @@ -631,6 +703,8 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { // return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_SCH_DROP_TASK: return qWorkerProcessDropMsg(pVnode, pVnode->pQuery, pMsg, 0); + case TDMT_SCH_TASK_NOTIFY: + return qWorkerProcessNotifyMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_SCH_QUERY_HEARTBEAT: return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_VND_TABLE_META: @@ -727,28 +801,27 @@ _exit: } static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp) { - SArray *tbUids = taosArrayInit(8, sizeof(int64_t)); - if (tbUids == NULL) return TSDB_CODE_OUT_OF_MEMORY; - SVDropTtlTableReq ttlReq = {0}; if (tDeserializeSVDropTtlTableReq(pReq, len, &ttlReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto end; } - vDebug("vgId:%d, drop ttl table req will be processed, time:%" PRId32, pVnode->config.vgId, ttlReq.timestampSec); - int32_t ret = metaTtlDropTable(pVnode->pMeta, (int64_t)ttlReq.timestampSec * 1000, tbUids); - if (ret != 0) { - goto end; - } - if (taosArrayGetSize(tbUids) > 0) { - tqUpdateTbUidList(pVnode->pTq, tbUids, false); + ASSERT(ttlReq.nUids == taosArrayGetSize(ttlReq.pTbUids)); + + if (ttlReq.nUids != 0) { + vInfo("vgId:%d, drop ttl table req will be processed, time:%d, ntbUids:%d", pVnode->config.vgId, + ttlReq.timestampSec, ttlReq.nUids); } - vnodeDoRetention(pVnode, ttlReq.timestampSec); + int ret = 0; + if (ttlReq.nUids > 0) { + metaDropTables(pVnode->pMeta, ttlReq.pTbUids); + tqUpdateTbUidList(pVnode->pTq, ttlReq.pTbUids, false); + } end: - taosArrayDestroy(tbUids); + taosArrayDestroy(ttlReq.pTbUids); return ret; } @@ -858,6 +931,10 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, } taosArrayPush(rsp.pArray, &cRsp); + + int32_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId; + + auditRecord(pReq, clusterId, "createTable", pVnode->config.dbname, pCreateReq->name, ""); } vDebug("vgId:%d, add %d new created tables into query table list", TD_VID(pVnode), (int32_t)taosArrayGetSize(tbUids)); @@ -1482,7 +1559,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in code = tsdbInsertTableData(pVnode->pTsdb, ver, pSubmitTbData, &affectedRows); if (code) goto _exit; - code = metaUpdateChangeTime(pVnode->pMeta, pSubmitTbData->uid, pSubmitTbData->ctimeMs); + code = metaUpdateChangeTimeWithLock(pVnode->pMeta, pSubmitTbData->uid, pSubmitTbData->ctimeMs); if (code) goto _exit; pSubmitRsp->affectedRows += affectedRows; @@ -1739,7 +1816,7 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t ver, void *pRe TD_VID(pVnode), terrstr(), deleteReq.suid, uid, pOneReq->startTs, pOneReq->endTs); } - code = metaUpdateChangeTime(pVnode->pMeta, uid, deleteReq.ctimeMs); + code = metaUpdateChangeTimeWithLock(pVnode->pMeta, uid, deleteReq.ctimeMs); if (code < 0) { terrno = code; vError("vgId:%d, update change time error since %s, suid:%" PRId64 ", uid:%" PRId64 ", start ts:%" PRId64 @@ -1778,7 +1855,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in uint64_t uid = *(uint64_t *)taosArrayGet(pRes->uidList, iUid); code = tsdbDeleteTableData(pVnode->pTsdb, ver, pRes->suid, uid, pRes->skey, pRes->ekey); if (code) goto _err; - code = metaUpdateChangeTime(pVnode->pMeta, uid, pRes->ctimeMs); + code = metaUpdateChangeTimeWithLock(pVnode->pMeta, uid, pRes->ctimeMs); if (code) goto _err; } diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index 4a95629d59..9f812517c1 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(sync) add_subdirectory(qcom) add_subdirectory(nodes) add_subdirectory(catalog) +add_subdirectory(audit) add_subdirectory(scalar) add_subdirectory(function) diff --git a/source/libs/audit/CMakeLists.txt b/source/libs/audit/CMakeLists.txt new file mode 100644 index 0000000000..2a04f084f1 --- /dev/null +++ b/source/libs/audit/CMakeLists.txt @@ -0,0 +1,13 @@ +aux_source_directory(src AUDIT_SRC) +IF (TD_ENTERPRISE) + LIST(APPEND AUDIT_SRC ${TD_ENTERPRISE_DIR}/src/plugins/audit/src/audit.c) +ENDIF () + +add_library(audit STATIC ${AUDIT_SRC}) +target_include_directories( + audit + PUBLIC "${TD_SOURCE_DIR}/include/libs/audit" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + +target_link_libraries(audit os util common transport mnode) diff --git a/source/libs/audit/inc/auditInt.h b/source/libs/audit/inc/auditInt.h new file mode 100644 index 0000000000..b6c6ec87e8 --- /dev/null +++ b/source/libs/audit/inc/auditInt.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_AUDIT_INT_H_ +#define _TD_AUDIT_INT_H_ + +#include "audit.h" + +typedef struct { + SAuditCfg cfg; +} SAudit; + +#endif /*_TD_AUDIT_INT_H_*/ diff --git a/source/libs/audit/src/auditMain.c b/source/libs/audit/src/auditMain.c new file mode 100644 index 0000000000..d4b6465ac7 --- /dev/null +++ b/source/libs/audit/src/auditMain.c @@ -0,0 +1,43 @@ +/* + * 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 . + */ + +#define _DEFAULT_SOURCE +#include "auditInt.h" +#include "taoserror.h" +#include "thttp.h" +#include "ttime.h" +#include "tjson.h" +#include "tglobal.h" +#include "mnode.h" + +SAudit tsAudit = {0}; +char* tsAuditUri = "/audit"; + +int32_t auditInit(const SAuditCfg *pCfg) { + tsAudit.cfg = *pCfg; + return 0; +} + +extern void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail); + +void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail) { + auditRecordImp(pReq, clusterId, operation, target1, target2, detail); +} + +#ifndef TD_ENTERPRISE +void auditRecordImp(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail) { +} +#endif + diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 1fa97904e4..991e2013f5 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -48,6 +48,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe static int32_t getSchemaBytes(const SSchema* pSchema) { switch (pSchema->type) { case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: return (pSchema->bytes - VARSTR_HEADER_SIZE); case TSDB_DATA_TYPE_NCHAR: @@ -78,10 +79,6 @@ static int32_t buildDescResultDataBlock(SSDataBlock** pOutput) { infoData = createColumnInfoData(TSDB_DATA_TYPE_VARCHAR, DESCRIBE_RESULT_NOTE_LEN, 4); code = blockDataAppendColInfo(pBlock, &infoData); } - if (TSDB_CODE_SUCCESS == code) { - infoData = createColumnInfoData(TSDB_DATA_TYPE_VARCHAR, DESCRIBE_RESULT_COL_COMMENT_LEN, 5); - code = blockDataAppendColInfo(pBlock, &infoData); - } if (TSDB_CODE_SUCCESS == code) { *pOutput = pBlock; @@ -103,9 +100,7 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, SColumnInfoData* pCol3 = taosArrayGet(pBlock->pDataBlock, 2); // Note SColumnInfoData* pCol4 = taosArrayGet(pBlock->pDataBlock, 3); - // Comment - SColumnInfoData* pCol5 = taosArrayGet(pBlock->pDataBlock, 4); - char buf[DESCRIBE_RESULT_COL_COMMENT_LEN + VARSTR_HEADER_SIZE] = {0}; + char buf[DESCRIBE_RESULT_FIELD_LEN] = {0}; for (int32_t i = 0; i < numOfRows; ++i) { if (invisibleColumn(sysInfoUser, pMeta->tableType, pMeta->schema[i].flags)) { continue; @@ -118,8 +113,6 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, colDataSetVal(pCol3, pBlock->info.rows, (const char*)&bytes, false); STR_TO_VARSTR(buf, i >= pMeta->tableInfo.numOfColumns ? "TAG" : ""); colDataSetVal(pCol4, pBlock->info.rows, buf, false); - STR_TO_VARSTR(buf, pMeta->schema[i].comment); - colDataSetVal(pCol5, pBlock->info.rows, buf, false); ++(pBlock->info.rows); } if (pBlock->info.rows <= 0) { @@ -464,19 +457,14 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) { for (int32_t i = 0; i < pCfg->numOfColumns; ++i) { SSchema* pSchema = pCfg->pSchemas + i; char type[32]; - char comments[TSDB_COL_COMMENT_LEN + 16] = {0}; sprintf(type, "%s", tDataTypes[pSchema->type].name); - if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { + if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } - if (pSchema->comment[0]) { - sprintf(comments, " COMMENT '%s'", pSchema->comment); - } - *len += - sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s%s", ((i > 0) ? ", " : ""), pSchema->name, type, comments); + *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type); } } @@ -484,18 +472,14 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) { for (int32_t i = 0; i < pCfg->numOfTags; ++i) { SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i; char type[32]; - char comments[TSDB_COL_COMMENT_LEN + 16] = {0}; sprintf(type, "%s", tDataTypes[pSchema->type].name); - if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { + if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } - if (pSchema->comment[0]) { - sprintf(comments, " COMMENT '%s'", pSchema->comment); - } - *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s%s", ((i > 0) ? ", " : ""), pSchema->name, type, comments); + *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type); } } diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index 11074b0e94..960ae14fcf 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -224,6 +224,8 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) { } taosCloseQueue(pDeleter->pDataBlocks); taosThreadMutexDestroy(&pDeleter->mutex); + + taosMemoryFree(pDeleter->pManager); return TSDB_CODE_SUCCESS; } @@ -279,6 +281,8 @@ _end: if (deleter != NULL) { destroyDataSinker((SDataSinkHandle*)deleter); taosMemoryFree(deleter); + } else { + taosMemoryFree(pManager); } return code; } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 38f6541a39..53c7c073ed 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -234,6 +234,7 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) { } taosCloseQueue(pDispatcher->pDataBlocks); taosThreadMutexDestroy(&pDispatcher->mutex); + taosMemoryFree(pDispatcher->pManager); return TSDB_CODE_SUCCESS; } @@ -248,7 +249,7 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD SDataDispatchHandle* dispatcher = taosMemoryCalloc(1, sizeof(SDataDispatchHandle)); if (NULL == dispatcher) { terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_OUT_OF_MEMORY; + goto _return; } dispatcher->sink.fPut = putDataBlock; dispatcher->sink.fEndPut = endPut; @@ -266,8 +267,13 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD if (NULL == dispatcher->pDataBlocks) { taosMemoryFree(dispatcher); terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_OUT_OF_MEMORY; + goto _return; } *pHandle = dispatcher; return TSDB_CODE_SUCCESS; + +_return: + + taosMemoryFree(pManager); + return terrno; } diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index 646964ebf4..38d82f05fb 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -213,6 +213,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY ASSERT(pColInfoData->info.type == pCol->type); if (colDataIsNull_s(pColInfoData, j)) { @@ -226,7 +227,6 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp } break; } - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_DECIMAL: case TSDB_DATA_TYPE_BLOB: case TSDB_DATA_TYPE_JSON: @@ -395,6 +395,8 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) { taosMemoryFree(pInserter->pParam); taosHashCleanup(pInserter->pCols); taosThreadMutexDestroy(&pInserter->mutex); + + taosMemoryFree(pInserter->pManager); return TSDB_CODE_SUCCESS; } @@ -411,7 +413,7 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat if (NULL == inserter) { taosMemoryFree(pParam); terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_OUT_OF_MEMORY; + goto _return; } SQueryInserterNode* pInserterNode = (SQueryInserterNode*)pDataSink; @@ -431,23 +433,18 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat int64_t suid = 0; int32_t code = pManager->pAPI->metaFn.getTableSchema(inserter->pParam->readHandle->vnode, pInserterNode->tableId, &inserter->pSchema, &suid); if (code) { - destroyDataSinker((SDataSinkHandle*)inserter); - taosMemoryFree(inserter); - return code; + terrno = code; + goto _return; } if (pInserterNode->stableId != suid) { - destroyDataSinker((SDataSinkHandle*)inserter); - taosMemoryFree(inserter); terrno = TSDB_CODE_TDB_INVALID_TABLE_ID; - return terrno; + goto _return; } inserter->pDataBlocks = taosArrayInit(1, POINTER_BYTES); taosThreadMutexInit(&inserter->mutex, NULL); if (NULL == inserter->pDataBlocks) { - destroyDataSinker((SDataSinkHandle*)inserter); - taosMemoryFree(inserter); terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY; } @@ -471,4 +468,15 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat *pHandle = inserter; return TSDB_CODE_SUCCESS; + +_return: + + if (inserter) { + destroyDataSinker((SDataSinkHandle*)inserter); + taosMemoryFree(inserter); + } else { + taosMemoryFree(pManager); + } + + return terrno; } diff --git a/source/libs/executor/src/dataSinkMgt.c b/source/libs/executor/src/dataSinkMgt.c index 38ec3ad393..2a59bbf1dc 100644 --- a/source/libs/executor/src/dataSinkMgt.c +++ b/source/libs/executor/src/dataSinkMgt.c @@ -18,12 +18,17 @@ #include "planner.h" #include "tarray.h" -static SDataSinkManager gDataSinkManager = {0}; SDataSinkStat gDataSinkStat = {0}; -int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI) { - gDataSinkManager.cfg = *cfg; - gDataSinkManager.pAPI = pAPI; +int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg, SStorageAPI* pAPI, void** ppSinkManager) { + SDataSinkManager* pSinkManager = taosMemoryMalloc(sizeof(SDataSinkManager)); + if (NULL == pSinkManager) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pSinkManager->cfg = *cfg; + pSinkManager->pAPI = pAPI; + + *ppSinkManager = pSinkManager; return 0; // to avoid compiler eror } @@ -33,18 +38,22 @@ int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat) { return 0; } -int32_t dsCreateDataSinker(const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id) { +int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam, const char* id) { + SDataSinkManager* pManager = pSinkManager; switch ((int)nodeType(pDataSink)) { case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: - return createDataDispatcher(&gDataSinkManager, pDataSink, pHandle); + return createDataDispatcher(pManager, pDataSink, pHandle); case QUERY_NODE_PHYSICAL_PLAN_DELETE: { - return createDataDeleter(&gDataSinkManager, pDataSink, pHandle, pParam); + return createDataDeleter(pManager, pDataSink, pHandle, pParam); } case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: { - return createDataInserter(&gDataSinkManager, pDataSink, pHandle, pParam); + return createDataInserter(pManager, pDataSink, pHandle, pParam); } + default: + break; } + taosMemoryFree(pSinkManager); qError("invalid input node type:%d, %s", nodeType(pDataSink), id); return TSDB_CODE_QRY_INVALID_INPUT; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index af205daa15..8d4b1c0ea0 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -531,23 +531,25 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, goto _error; } - SDataSinkMgtCfg cfg = {.maxDataBlockNum = 500, .maxDataBlockNumPerQuery = 50}; - code = dsDataSinkMgtInit(&cfg, &(*pTask)->storageAPI); - if (code != TSDB_CODE_SUCCESS) { - qError("failed to dsDataSinkMgtInit, code:%s, %s", tstrerror(code), (*pTask)->id.str); - goto _error; - } - if (handle) { + SDataSinkMgtCfg cfg = {.maxDataBlockNum = 500, .maxDataBlockNumPerQuery = 50}; + void* pSinkManager = NULL; + code = dsDataSinkMgtInit(&cfg, &(*pTask)->storageAPI, &pSinkManager); + if (code != TSDB_CODE_SUCCESS) { + qError("failed to dsDataSinkMgtInit, code:%s, %s", tstrerror(code), (*pTask)->id.str); + goto _error; + } + void* pSinkParam = NULL; code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, (*pTask), readHandle); if (code != TSDB_CODE_SUCCESS) { qError("failed to createDataSinkParam, vgId:%d, code:%s, %s", vgId, tstrerror(code), (*pTask)->id.str); + taosMemoryFree(pSinkManager); goto _error; } // pSinkParam has been freed during create sinker. - code = dsCreateDataSinker(pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str); + code = dsCreateDataSinker(pSinkManager, pSubplan->pDataSink, handle, pSinkParam, (*pTask)->id.str); } qDebug("subplan task create completed, TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, pSubplan->id.queryId); diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index e7c9e404a0..c14692b7f0 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -64,6 +64,7 @@ typedef struct SFillOperatorInfo { static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, int32_t order); static void destroyFillOperatorInfo(void* param); static void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_t order, int32_t scanFlag); +static void fillResetPrevForNewGroup(SFillInfo* pFillInfo); static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOperatorInfo* pInfo, SResultInfo* pResultInfo, int32_t order) { @@ -84,6 +85,9 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp taosFillSetStartInfo(pInfo->pFillInfo, pInfo->pRes->info.rows, ts); taosFillSetInputDataBlock(pInfo->pFillInfo, pInfo->pRes); + if (pInfo->pFillInfo->type == TSDB_FILL_PREV || pInfo->pFillInfo->type == TSDB_FILL_LINEAR) { + fillResetPrevForNewGroup(pInfo->pFillInfo); + } int32_t numOfResultRows = pResultInfo->capacity - pResBlock->info.rows; taosFillResultDataBlock(pInfo->pFillInfo, pResBlock, numOfResultRows); @@ -122,6 +126,15 @@ void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlock, int pInfo->pRes->info.id.groupId = pBlock->info.id.groupId; } +static void fillResetPrevForNewGroup(SFillInfo* pFillInfo) { + for (int32_t colIdx = 0; colIdx < pFillInfo->numOfCols; ++colIdx) { + if (!pFillInfo->pFillCol[colIdx].notFillCol) { + SGroupKeys* key = taosArrayGet(pFillInfo->prev.pRowVal, colIdx); + key->isNull = true; + } + } +} + // todo refactor: decide the start key according to the query time range. static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, int32_t order) { if (order == TSDB_ORDER_ASC) { @@ -164,6 +177,7 @@ static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, i } // todo time window chosen problem: t or prev value? + if (t > pInfo->pFillInfo->start) t -= pInterval->sliding; taosFillUpdateStartTimestampInfo(pInfo->pFillInfo, t); } } @@ -825,6 +839,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS (pFillSup->next.key == pFillInfo->nextRowKey && !hasPrevWindow(pFillSup)))) { setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; + resetFillWindow(&pFillSup->prev); pFillSup->prev.key = pFillSup->cur.key; pFillSup->prev.pRowVal = pFillSup->cur.pRowVal; } else if (hasPrevWindow(pFillSup)) { @@ -838,6 +853,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS if (hasPrevWindow(pFillSup)) { setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; + resetFillWindow(&pFillSup->next); pFillSup->next.key = pFillSup->cur.key; pFillSup->next.pRowVal = pFillSup->cur.pRowVal; pFillInfo->preRowKey = INT64_MIN; @@ -1216,8 +1232,6 @@ static void doDeleteFillResult(SOperatorInfo* pOperator) { SWinKey nextKey = {.groupId = groupId, .ts = ts}; while (pInfo->srcDelRowIndex < pBlock->info.rows) { - void* nextVal = NULL; - int32_t nextLen = 0; TSKEY delTs = tsStarts[pInfo->srcDelRowIndex]; uint64_t delGroupId = groupIds[pInfo->srcDelRowIndex]; int32_t code = TSDB_CODE_SUCCESS; @@ -1232,7 +1246,7 @@ static void doDeleteFillResult(SOperatorInfo* pOperator) { if (delTs == nextKey.ts) { code = pAPI->stateStore.streamStateCurNext(pOperator->pTaskInfo->streamInfo.pState, pCur); if (code == TSDB_CODE_SUCCESS) { - code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextLen); + code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, NULL, NULL); } // ts will be deleted later if (delTs != ts) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index bd46b2494f..9ec95faa38 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -973,7 +973,8 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { SColumnInfoData* pSrcCol = taosArrayGet(pSrc->pDataBlock, slotId); SColumnInfoData* pDestCol = taosArrayGet(pDest->pDataBlock, j); bool isNull = colDataIsNull(pSrcCol, pSrc->info.rows, rowIndex, NULL); - char* pSrcData = colDataGetData(pSrcCol, rowIndex); + char* pSrcData = NULL; + if (!isNull) pSrcData = colDataGetData(pSrcCol, rowIndex); colDataSetVal(pDestCol, pDest->info.rows, pSrcData, isNull); } pDest->info.rows++; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 2dfd9538c5..8d35a02c57 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1353,7 +1353,8 @@ static SSDataBlock* doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32 SColumnInfoData* pSrcCol = taosArrayGet(tmpBlock->pDataBlock, j); SColumnInfoData* pDestCol = taosArrayGet(pResult->pDataBlock, j); bool isNull = colDataIsNull(pSrcCol, tmpBlock->info.rows, i, NULL); - char* pSrcData = colDataGetData(pSrcCol, i); + char* pSrcData = NULL; + if (!isNull) pSrcData = colDataGetData(pSrcCol, i); colDataSetVal(pDestCol, pResult->info.rows, pSrcData, isNull); } pResult->info.rows++; diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 333bb4768f..6bdbefc5c0 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -400,8 +400,7 @@ static bool sysTableIsOperatorCondOnOneTable(SNode* pCond, char* condTable) { strcasecmp(nodesGetNameFromColumnNode(node->pLeft), "table_name") == 0 && nodeType(node->pRight) == QUERY_NODE_VALUE) { SValueNode* pValue = (SValueNode*)node->pRight; - if (pValue->node.resType.type == TSDB_DATA_TYPE_NCHAR || pValue->node.resType.type == TSDB_DATA_TYPE_VARCHAR || - pValue->node.resType.type == TSDB_DATA_TYPE_BINARY) { + if (pValue->node.resType.type == TSDB_DATA_TYPE_NCHAR || pValue->node.resType.type == TSDB_DATA_TYPE_VARCHAR) { char* value = nodesGetValueFromNode(pValue); strncpy(condTable, varDataVal(value), TSDB_TABLE_NAME_LEN); return true; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index bd6352d719..2405d3edef 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -281,7 +281,7 @@ void doTimeWindowInterpolation(SArray* pPrevValues, SArray* pDataBlock, TSKEY pr pCtx[k].end.key = curTs; pCtx[k].end.val = v2; - if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR || + if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_VARBINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR || pColInfo->info.type == TSDB_DATA_TYPE_GEOMETRY) { if (prevRowIndex == -1) { // pCtx[k].start.ptr = (char*)pRuntimeEnv->prevRow[index]; diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 575bce09bb..bd459af9f5 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -971,7 +971,7 @@ static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || - msgType == TDMT_SCH_MERGE_FETCH) { + msgType == TDMT_SCH_MERGE_FETCH || msgType == TDMT_SCH_TASK_NOTIFY) { return false; } return true; diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c index a0310a9f0e..1313221952 100644 --- a/source/libs/index/src/indexComm.c +++ b/source/libs/index/src/indexComm.c @@ -76,7 +76,8 @@ char* idxInt2str(int64_t val, char* dst, int radix) { return dst - 1; } __compar_fn_t idxGetCompar(int8_t type) { - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || + type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { return (__compar_fn_t)strcmp; } return getComparFunc(type, 0); @@ -356,17 +357,13 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) { break; } case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { tlen = taosEncodeBinary(NULL, src, strlen(src)); *dst = taosMemoryCalloc(1, tlen + 1); tlen = taosEncodeBinary(dst, src, strlen(src)); break; } - case TSDB_DATA_TYPE_VARBINARY: - tlen = taosEncodeBinary(NULL, src, strlen(src)); - *dst = taosMemoryCalloc(1, tlen + 1); - tlen = taosEncodeBinary(dst, src, strlen(src)); - break; default: ASSERTS(0, "index invalid input type"); break; @@ -447,6 +444,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) { break; } case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src)); *dst = taosMemoryCalloc(1, tlen + 1); @@ -454,12 +452,6 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) { *dst = (char*)*dst - tlen; break; } - case TSDB_DATA_TYPE_VARBINARY: - tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src)); - *dst = taosMemoryCalloc(1, tlen + 1); - tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src)); - *dst = (char*)*dst - tlen; - break; default: ASSERTS(0, "index invalid input type"); break; diff --git a/source/libs/index/src/indexJson.c b/source/libs/index/src/indexJson.c index 1b4f847919..09c1320667 100644 --- a/source/libs/index/src/indexJson.c +++ b/source/libs/index/src/indexJson.c @@ -24,7 +24,7 @@ int indexJsonPut(SIndexJson *index, SIndexJsonMultiTerm *terms, uint64_t uid) { SIndexJsonTerm *p = taosArrayGetP(terms, i); if (p->colType == TSDB_DATA_TYPE_BOOL) { p->colType = TSDB_DATA_TYPE_INT; - } else if (p->colType == TSDB_DATA_TYPE_VARCHAR || p->colType == TSDB_DATA_TYPE_NCHAR || + } else if (p->colType == TSDB_DATA_TYPE_VARBINARY || p->colType == TSDB_DATA_TYPE_NCHAR || p->colType == TSDB_DATA_TYPE_BINARY || p->colType == TSDB_DATA_TYPE_GEOMETRY) { // p->colType = TSDB_DATA_TYPE_NCHAR; } else { @@ -42,7 +42,7 @@ int indexJsonSearch(SIndexJson *index, SIndexJsonMultiTermQuery *tq, SArray *res SIndexJsonTerm *p = taosArrayGetP(terms, i); if (p->colType == TSDB_DATA_TYPE_BOOL) { p->colType = TSDB_DATA_TYPE_INT; - } else if (p->colType == TSDB_DATA_TYPE_VARCHAR || p->colType == TSDB_DATA_TYPE_NCHAR || + } else if (p->colType == TSDB_DATA_TYPE_VARBINARY || p->colType == TSDB_DATA_TYPE_NCHAR || p->colType == TSDB_DATA_TYPE_BINARY || p->colType == TSDB_DATA_TYPE_GEOMETRY) { // p->colType = TSDB_DATA_TYPE_NCHAR; } else { diff --git a/source/libs/index/src/indexTfile.c b/source/libs/index/src/indexTfile.c index 9b6ba40318..8f8b5c7768 100644 --- a/source/libs/index/src/indexTfile.c +++ b/source/libs/index/src/indexTfile.c @@ -545,8 +545,8 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) { int8_t colType = tw->header.colType; colType = IDX_TYPE_GET_TYPE(colType); - if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_NCHAR || - colType == TSDB_DATA_TYPE_GEOMETRY) { + if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_VARBINARY || + colType == TSDB_DATA_TYPE_NCHAR || colType == TSDB_DATA_TYPE_GEOMETRY) { fn = tfileStrCompare; } else { fn = getComparFunc(colType, 0); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 724c4044f7..719e7ba08c 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -173,7 +173,8 @@ SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNod SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables); SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable); SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions); -SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SNode* pColDefNode); +SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, + SDataType dataType); SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName); SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pOldColName, SToken* pNewColName); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 841223510f..2a7f6c6eef 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -306,7 +306,7 @@ retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). %type speed_opt { int32_t } %destructor speed_opt { } speed_opt(A) ::= . { A = 0; } -speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } +speed_opt(A) ::= BWLIMIT 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); } @@ -332,17 +332,17 @@ cmd ::= ALTER STABLE alter_table_clause(A). alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); } alter_table_clause(A) ::= - full_table_name(B) ADD COLUMN column_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, C); } + full_table_name(B) ADD COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D); } alter_table_clause(A) ::= full_table_name(B) DROP COLUMN column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_COLUMN, &C); } alter_table_clause(A) ::= - full_table_name(B) MODIFY COLUMN column_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, C); } + full_table_name(B) MODIFY COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &C, D); } alter_table_clause(A) ::= full_table_name(B) RENAME COLUMN column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &C, &D); } alter_table_clause(A) ::= - full_table_name(B) ADD TAG column_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_TAG, C); } + full_table_name(B) ADD TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_TAG, &C, D); } alter_table_clause(A) ::= full_table_name(B) DROP TAG column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_TAG, &C); } alter_table_clause(A) ::= - full_table_name(B) MODIFY TAG column_def(C). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, C); } + full_table_name(B) MODIFY TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &C, D); } alter_table_clause(A) ::= full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); } alter_table_clause(A) ::= @@ -378,7 +378,7 @@ column_def_list(A) ::= column_def(B). column_def_list(A) ::= column_def_list(B) NK_COMMA column_def(C). { A = addNodeToList(pCxt, B, C); } column_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, &B, C, NULL); } -column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); } +//column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); } %type type_name { SDataType } %destructor type_name { } @@ -1029,7 +1029,7 @@ join_type(A) ::= INNER. /************************************************ query_specification *************************************************/ query_specification(A) ::= - SELECT hint_list(M) tag_mode_opt(N) set_quantifier_opt(B) select_list(C) from_clause_opt(D) + SELECT hint_list(M) set_quantifier_opt(B) tag_mode_opt(N) select_list(C) from_clause_opt(D) where_clause_opt(E) partition_by_clause_opt(F) range_opt(J) every_opt(K) fill_opt(L) twindow_clause_opt(G) group_by_clause_opt(H) having_clause_opt(I). { A = createSelectStmt(pCxt, B, C, D, M); diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index d36b551f94..cc2e11fea2 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1457,15 +1457,17 @@ SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, return createAlterTableStmtFinalize(pRealTable, pStmt); } -SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SNode* pColDefNode) { +SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, SToken* pColName, + SDataType dataType) { CHECK_PARSER_STATUS(pCxt); - SColumnDefNode* pCol = (SColumnDefNode*)pColDefNode; + if (!checkColumnName(pCxt, pColName)) { + return NULL; + } SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; - strcpy(pStmt->colName, pCol->colName); - strcpy(pStmt->colComment, pCol->comments); - pStmt->dataType = pCol->dataType; + COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); + pStmt->dataType = dataType; return createAlterTableStmtFinalize(pRealTable, pStmt); } diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index 577b8961a7..517bc630c3 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -18,18 +18,6 @@ #include "parToken.h" #include "ttime.h" -static void clearColValArray(SArray* pCols) { - int32_t num = taosArrayGetSize(pCols); - for (int32_t i = 0; i < num; ++i) { - SColVal* pCol = taosArrayGet(pCols, i); - if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type) { - taosMemoryFreeClear(pCol->value.pData); - } - pCol->flag = CV_FLAG_NONE; - pCol->value.val = 0; - } -} - int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf, int32_t msgBufLen) { SMsgBuf msg = {.buf = msgBuf, .len = msgBufLen}; @@ -134,7 +122,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem taosArrayPush(*tagName, pTagSchema->name); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || pTagSchema->type == TSDB_DATA_TYPE_VARBINARY || pTagSchema->type == TSDB_DATA_TYPE_GEOMETRY) { val.pData = (uint8_t*)kv->value; val.nData = kv->length; @@ -193,6 +181,18 @@ STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta) { return pTableCxt; } +void clearColValArraySml(SArray* pCols) { + int32_t num = taosArrayGetSize(pCols); + for (int32_t i = 0; i < num; ++i) { + SColVal* pCol = taosArrayGet(pCols, i); + if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type || TSDB_DATA_TYPE_VARBINARY == pCol->type) { + taosMemoryFreeClear(pCol->value.pData); + } + pCol->flag = CV_FLAG_NONE; + pCol->value.val = 0; + } +} + int32_t smlBuildRow(STableDataCxt* pTableCxt) { SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1); int ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow); @@ -240,7 +240,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32 } else if (kv->type == TSDB_DATA_TYPE_BINARY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; - } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) { pVal->value.nData = kv->length; pVal->value.pData = taosMemoryMalloc(kv->length); memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); @@ -371,7 +371,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc } else if (kv->type == TSDB_DATA_TYPE_BINARY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; - } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY) { + } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) { pVal->value.nData = kv->length; pVal->value.pData = taosMemoryMalloc(kv->length); memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); @@ -388,7 +388,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc goto end; } insCheckTableDataOrder(pTableCxt, TD_ROW_KEY(*pRow)); - clearColValArray(pTableCxt->pValues); + clearColValArraySml(pTableCxt->pValues); } end: diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 8d35674949..0e007e127e 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -326,6 +326,38 @@ static int parseGeometry(SToken *pToken, unsigned char **output, size_t *size) { return code; } +static int32_t parseVarbinary(SToken* pToken, uint8_t **pData, uint32_t *nData, int32_t bytes){ + if(pToken->type != TK_NK_STRING){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + + if(isHex(pToken->z, pToken->n)){ + if(!isValidateHex(pToken->z, pToken->n)){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + + void* data = NULL; + uint32_t size = 0; + if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (size + VARSTR_HEADER_SIZE > bytes) { + taosMemoryFree(data); + return TSDB_CODE_PAR_VALUE_TOO_LONG; + } + *pData = data; + *nData = size; + }else{ + if (pToken->n + VARSTR_HEADER_SIZE > bytes) { + return TSDB_CODE_PAR_VALUE_TOO_LONG; + } + *pData = taosStrdup(pToken->z); + *nData = pToken->n; + } + return TSDB_CODE_SUCCESS; +} + static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, int16_t timePrec, STagVal* val, SMsgBuf* pMsgBuf) { int64_t iv; @@ -477,7 +509,13 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, val->nData = pToken->n; break; } - + case TSDB_DATA_TYPE_VARBINARY: { + code = parseVarbinary(pToken, &val->pData, &val->nData, pSchema->bytes); + if(code != TSDB_CODE_SUCCESS){ + return generateSyntaxErrMsg(pMsgBuf, code, pSchema->name); + } + break; + } case TSDB_DATA_TYPE_GEOMETRY: { unsigned char* output = NULL; size_t size = 0; @@ -659,6 +697,7 @@ static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { *(double*)&pValue->typeData = pValue->datum.d; break; case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: pValue->datum.p = taosMemoryCalloc(1, pVal->nData + VARSTR_HEADER_SIZE); if (NULL == pValue->datum.p) { @@ -688,7 +727,6 @@ static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { *(uint64_t*)&pValue->typeData = pValue->datum.i; break; case TSDB_DATA_TYPE_JSON: - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_DECIMAL: case TSDB_DATA_TYPE_BLOB: case TSDB_DATA_TYPE_MEDIUMBLOB: @@ -1364,6 +1402,13 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, pVal->value.nData = pToken->n; break; } + case TSDB_DATA_TYPE_VARBINARY: { + int32_t code = parseVarbinary(pToken, &pVal->value.pData, &pVal->value.nData, pSchema->bytes); + if(code != TSDB_CODE_SUCCESS){ + return generateSyntaxErrMsg(&pCxt->msg, code, pSchema->name); + } + break; + } case TSDB_DATA_TYPE_NCHAR: { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' int32_t len = 0; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index bcbea6cd2e..5137deca2e 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -128,7 +128,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } else { STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || pTagSchema->type == TSDB_DATA_TYPE_VARBINARY || pTagSchema->type == TSDB_DATA_TYPE_GEOMETRY) { val.pData = (uint8_t*)bind[c].buffer; val.nData = colLen; diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 33699ed857..5ae2cf12c9 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -333,8 +333,8 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta* static void destroyColVal(void* p) { SColVal* pVal = p; - if (TSDB_DATA_TYPE_NCHAR == pVal->type || TSDB_DATA_TYPE_GEOMETRY == pVal->type) { - taosMemoryFree(pVal->value.pData); + if (TSDB_DATA_TYPE_NCHAR == pVal->type || TSDB_DATA_TYPE_GEOMETRY == pVal->type || TSDB_DATA_TYPE_VARBINARY == pVal->type) { + taosMemoryFreeClear(pVal->value.pData); } } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 4e777cf213..5e230a9116 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -139,7 +139,7 @@ static SKeyword keywordTable[] = { {"MATCH", TK_MATCH}, {"MAXROWS", TK_MAXROWS}, {"MAX_DELAY", TK_MAX_DELAY}, - {"MAX_SPEED", TK_MAX_SPEED}, + {"BWLIMIT", TK_BWLIMIT}, {"MERGE", TK_MERGE}, {"META", TK_META}, {"ONLY", TK_ONLY}, @@ -288,6 +288,7 @@ static SKeyword keywordTable[] = { {"_WEND", TK_WEND}, {"_WSTART", TK_WSTART}, {"ALIVE", TK_ALIVE}, + {"VARBINARY", TK_VARBINARY}, }; // clang-format on @@ -551,7 +552,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { return i; } else if (next == 'x') { // hex number *tokenId = TK_NK_HEX; - for (i = 2; isdigit(z[i]) || (z[i] >= 'a' && z[i] <= 'f') || (z[i] >= 'A' && z[i] <= 'F'); ++i) { + for (i = 2; isxdigit(z[i]) != 0; ++i) { } if (i == 2) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 473d177066..e973694a04 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1229,8 +1229,41 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, *(double*)&pVal->typeData = pVal->datum.d; break; } + case TSDB_DATA_TYPE_VARBINARY: { + if (pVal->node.resType.type != TSDB_DATA_TYPE_BINARY){ + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); + } + + void* data = NULL; + uint32_t size = 0; + bool isHexChar = isHex(pVal->literal, strlen(pVal->literal)); + if(isHexChar){ + if(!isValidateHex(pVal->literal, strlen(pVal->literal))){ + return TSDB_CODE_PAR_INVALID_VARBINARY; + } + if(taosHex2Ascii(pVal->literal, strlen(pVal->literal), &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + }else{ + size = pVal->node.resType.bytes; + data = pVal->literal; + } + + if (size + VARSTR_HEADER_SIZE > targetDt.bytes) { + if(isHexChar) taosMemoryFree(data); + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_VALUE_TOO_LONG, pVal->literal); + } + pVal->datum.p = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE); + if (NULL == pVal->datum.p) { + if(isHexChar) taosMemoryFree(data); + return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + } + varDataSetLen(pVal->datum.p, size + VARSTR_HEADER_SIZE); + memcpy(varDataVal(pVal->datum.p), data, size); + if(isHexChar) taosMemoryFree(data); + break; + } case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { if (strict && (pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); @@ -1304,7 +1337,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } static int32_t calcTypeBytes(SDataType dt) { - if (TSDB_DATA_TYPE_BINARY == dt.type || TSDB_DATA_TYPE_GEOMETRY == dt.type) { + if (TSDB_DATA_TYPE_BINARY == dt.type || TSDB_DATA_TYPE_VARBINARY == dt.type || TSDB_DATA_TYPE_GEOMETRY == dt.type) { return dt.bytes + VARSTR_HEADER_SIZE; } else if (TSDB_DATA_TYPE_NCHAR == dt.type) { return dt.bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; @@ -4702,7 +4735,6 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)}; strcpy(field.name, pCol->colName); - strcpy(field.comment, pCol->comments); if (pCol->sma) { field.flags |= COL_SMA_ON; } @@ -4799,6 +4831,7 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN } if (TSDB_CODE_SUCCESS == code) { if ((TSDB_DATA_TYPE_VARCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || (TSDB_DATA_TYPE_NCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || (TSDB_DATA_TYPE_GEOMETRY == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN)) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); @@ -4851,6 +4884,7 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in } if (TSDB_CODE_SUCCESS == code) { if ((TSDB_DATA_TYPE_VARCHAR == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_NCHAR_LEN) || (TSDB_DATA_TYPE_GEOMETRY == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_GEOMETRY_LEN)) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); @@ -5050,7 +5084,6 @@ static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSchem pSchema->bytes = calcTypeBytes(pCol->dataType); pSchema->flags = flags; strcpy(pSchema->name, pCol->colName); - strcpy(pSchema->comment, pCol->comments); } typedef struct SSampleAstInfo { @@ -5548,6 +5581,7 @@ static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTable if (TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES == pStmt->alterType) { if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } @@ -5574,6 +5608,7 @@ static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTable } if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } @@ -7699,10 +7734,6 @@ static int32_t extractDescribeResultSchema(int32_t* numOfCols, SSchema** pSchema (*pSchema)[3].bytes = DESCRIBE_RESULT_NOTE_LEN; strcpy((*pSchema)[3].name, "note"); - (*pSchema)[4].type = TSDB_DATA_TYPE_BINARY; - (*pSchema)[4].bytes = DESCRIBE_RESULT_COL_COMMENT_LEN; - strcpy((*pSchema)[4].name, "comment"); - return TSDB_CODE_SUCCESS; } @@ -8863,6 +8894,7 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S } if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } @@ -8883,15 +8915,6 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S pReq->type = pStmt->dataType.type; pReq->flags = COL_SMA_ON; pReq->bytes = calcTypeBytes(pStmt->dataType); - if (pStmt->colComment[0]) { - pReq->colComment = taosStrdup(pStmt->colComment); - if (pReq->colComment == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pReq->colCommentLen = strlen(pReq->colComment); - } else { - pReq->colCommentLen = -1; - } return TSDB_CODE_SUCCESS; } @@ -8929,6 +8952,7 @@ static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt } if ((TSDB_DATA_TYPE_VARCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || + (TSDB_DATA_TYPE_VARBINARY == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_BINARY_LEN) || (TSDB_DATA_TYPE_NCHAR == pStmt->dataType.type && calcTypeBytes(pStmt->dataType) > TSDB_MAX_NCHAR_LEN)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } @@ -8942,15 +8966,6 @@ static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt return TSDB_CODE_OUT_OF_MEMORY; } pReq->colId = pSchema->colId; - if (pStmt->colComment[0]) { - pReq->colComment = taosStrdup(pStmt->colComment); - if (pReq->colComment == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pReq->colCommentLen = strlen(pReq->colComment); - } else { - pReq->colCommentLen = -1; - } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index c30efcb18c..67cc9226e7 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -308,7 +308,7 @@ int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen) { dst[j] = '\''; } else if (src[k + 1] == '"') { dst[j] = '"'; - } else if (src[k + 1] == '%' || src[k + 1] == '_') { + } else if (src[k + 1] == '%' || src[k + 1] == '_' || src[k + 1] == 'x') { dst[j++] = src[k]; dst[j] = src[k + 1]; } else { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index e8bbf7213c..e9e712296d 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -146,7 +146,7 @@ #define TK_TABLE_PREFIX 97 #define TK_TABLE_SUFFIX 98 #define TK_NK_COLON 99 -#define TK_MAX_SPEED 100 +#define TK_BWLIMIT 100 #define TK_START 101 #define TK_TIMESTAMP 102 #define TK_END 103 @@ -162,25 +162,25 @@ #define TK_NK_EQ 113 #define TK_USING 114 #define TK_TAGS 115 -#define TK_COMMENT 116 -#define TK_BOOL 117 -#define TK_TINYINT 118 -#define TK_SMALLINT 119 -#define TK_INT 120 -#define TK_INTEGER 121 -#define TK_BIGINT 122 -#define TK_FLOAT 123 -#define TK_DOUBLE 124 -#define TK_BINARY 125 -#define TK_NCHAR 126 -#define TK_UNSIGNED 127 -#define TK_JSON 128 -#define TK_VARCHAR 129 -#define TK_MEDIUMBLOB 130 -#define TK_BLOB 131 -#define TK_VARBINARY 132 -#define TK_GEOMETRY 133 -#define TK_DECIMAL 134 +#define TK_BOOL 116 +#define TK_TINYINT 117 +#define TK_SMALLINT 118 +#define TK_INT 119 +#define TK_INTEGER 120 +#define TK_BIGINT 121 +#define TK_FLOAT 122 +#define TK_DOUBLE 123 +#define TK_BINARY 124 +#define TK_NCHAR 125 +#define TK_UNSIGNED 126 +#define TK_JSON 127 +#define TK_VARCHAR 128 +#define TK_MEDIUMBLOB 129 +#define TK_BLOB 130 +#define TK_VARBINARY 131 +#define TK_GEOMETRY 132 +#define TK_DECIMAL 133 +#define TK_COMMENT 134 #define TK_MAX_DELAY 135 #define TK_WATERMARK 136 #define TK_ROLLUP 137 @@ -481,17 +481,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 809 -#define YYNRULE 612 -#define YYNRULE_WITH_ACTION 612 +#define YYNSTATE 811 +#define YYNRULE 611 +#define YYNRULE_WITH_ACTION 611 #define YYNTOKEN 340 -#define YY_MAX_SHIFT 808 -#define YY_MIN_SHIFTREDUCE 1194 -#define YY_MAX_SHIFTREDUCE 1805 -#define YY_ERROR_ACTION 1806 -#define YY_ACCEPT_ACTION 1807 -#define YY_NO_ACTION 1808 -#define YY_MIN_REDUCE 1809 +#define YY_MAX_SHIFT 810 +#define YY_MIN_SHIFTREDUCE 1196 +#define YY_MAX_SHIFTREDUCE 1806 +#define YY_ERROR_ACTION 1807 +#define YY_ACCEPT_ACTION 1808 +#define YY_NO_ACTION 1809 +#define YY_MIN_REDUCE 1810 #define YY_MAX_REDUCE 2420 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -559,586 +559,578 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2878) +#define YY_ACTTAB_COUNT (2798) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 537, 1832, 2227, 538, 1852, 545, 695, 1993, 538, 1852, - /* 10 */ 406, 742, 48, 46, 1732, 712, 258, 34, 1995, 164, - /* 20 */ 403, 1810, 1577, 41, 40, 385, 194, 47, 45, 44, - /* 30 */ 43, 42, 170, 2045, 1821, 1658, 1892, 1575, 1603, 1971, - /* 40 */ 681, 611, 125, 1602, 2245, 124, 123, 122, 121, 120, - /* 50 */ 119, 118, 117, 116, 2195, 2195, 609, 711, 607, 248, - /* 60 */ 247, 41, 40, 2116, 1653, 47, 45, 44, 43, 42, - /* 70 */ 19, 1895, 149, 1605, 36, 396, 694, 1583, 2113, 682, - /* 80 */ 41, 40, 672, 144, 47, 45, 44, 43, 42, 460, - /* 90 */ 2095, 2226, 552, 2262, 2109, 455, 171, 2228, 715, 2230, - /* 100 */ 2231, 710, 805, 705, 680, 15, 654, 2188, 780, 779, - /* 110 */ 778, 777, 415, 62, 776, 775, 148, 770, 769, 768, - /* 120 */ 767, 766, 765, 764, 162, 760, 759, 758, 414, 413, - /* 130 */ 755, 754, 753, 177, 176, 2245, 203, 554, 636, 2356, - /* 140 */ 351, 1660, 1661, 595, 594, 593, 695, 1993, 655, 222, - /* 150 */ 585, 141, 589, 540, 635, 1859, 588, 2391, 2330, 1503, - /* 160 */ 1504, 587, 592, 379, 378, 752, 135, 586, 1259, 620, - /* 170 */ 1258, 1633, 1643, 577, 2397, 189, 694, 1659, 1662, 2392, - /* 180 */ 661, 52, 1602, 2396, 2327, 140, 285, 2323, 671, 653, - /* 190 */ 136, 670, 1578, 2391, 1576, 1502, 1505, 2330, 750, 1604, - /* 200 */ 1604, 41, 40, 1260, 74, 47, 45, 44, 43, 42, - /* 210 */ 659, 189, 672, 144, 1234, 2392, 661, 160, 159, 747, - /* 220 */ 746, 745, 157, 2326, 1581, 1582, 265, 1632, 1635, 1636, - /* 230 */ 1637, 1638, 1639, 1640, 1641, 1642, 707, 703, 1651, 1652, - /* 240 */ 1654, 1655, 1656, 1657, 2, 48, 46, 694, 146, 2116, - /* 250 */ 355, 2286, 1600, 403, 84, 1577, 1236, 1239, 1240, 491, - /* 260 */ 2227, 51, 507, 363, 2114, 682, 169, 506, 1658, 289, - /* 270 */ 1575, 41, 40, 712, 1934, 47, 45, 44, 43, 42, - /* 280 */ 595, 594, 593, 474, 1583, 508, 1795, 585, 141, 589, - /* 290 */ 476, 1760, 2216, 588, 695, 1993, 30, 1653, 587, 592, - /* 300 */ 379, 378, 2245, 19, 586, 408, 1687, 12, 2040, 2042, - /* 310 */ 1583, 672, 144, 2195, 56, 711, 188, 2323, 2324, 125, - /* 320 */ 142, 2328, 124, 123, 122, 121, 120, 119, 118, 117, - /* 330 */ 116, 650, 51, 1486, 1487, 805, 372, 289, 15, 647, - /* 340 */ 646, 1758, 1759, 1761, 1762, 1763, 2205, 462, 2218, 2226, - /* 350 */ 1831, 2262, 287, 287, 112, 2228, 715, 2230, 2231, 710, - /* 360 */ 2213, 705, 1603, 1688, 147, 2078, 155, 2286, 2315, 1772, - /* 370 */ 2209, 743, 399, 2311, 1660, 1661, 2396, 504, 762, 2391, - /* 380 */ 498, 497, 496, 495, 490, 489, 488, 487, 486, 482, - /* 390 */ 481, 480, 479, 354, 471, 470, 469, 2395, 464, 463, - /* 400 */ 370, 2392, 2394, 2195, 1633, 1643, 1809, 2047, 2211, 400, - /* 410 */ 1659, 1662, 466, 2095, 674, 187, 2323, 2324, 705, 142, - /* 420 */ 2328, 2046, 656, 651, 644, 1578, 706, 1576, 1830, 66, - /* 430 */ 134, 133, 132, 131, 130, 129, 128, 127, 126, 313, - /* 440 */ 500, 37, 401, 1682, 1683, 1684, 1685, 1686, 1690, 1691, - /* 450 */ 1692, 1693, 1807, 261, 672, 144, 208, 1581, 1582, 206, - /* 460 */ 1632, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 707, - /* 470 */ 703, 1651, 1652, 1654, 1655, 1656, 1657, 2, 12, 48, - /* 480 */ 46, 2195, 1602, 1428, 1429, 2227, 1336, 403, 289, 1577, - /* 490 */ 1393, 47, 45, 44, 43, 42, 86, 1736, 675, 85, - /* 500 */ 213, 212, 1658, 1602, 1575, 1384, 740, 739, 738, 1388, - /* 510 */ 737, 1390, 1391, 736, 733, 1822, 1399, 730, 1401, 1402, - /* 520 */ 727, 724, 721, 499, 534, 478, 1338, 2245, 418, 185, - /* 530 */ 62, 1653, 532, 417, 477, 528, 524, 19, 2195, 2047, - /* 540 */ 711, 2034, 41, 40, 1583, 384, 47, 45, 44, 43, - /* 550 */ 42, 542, 2227, 2045, 38, 307, 449, 539, 190, 2323, - /* 560 */ 2324, 448, 142, 2328, 1259, 675, 1258, 62, 182, 805, - /* 570 */ 2041, 2042, 15, 681, 2226, 635, 2262, 2227, 2391, 112, - /* 580 */ 2228, 715, 2230, 2231, 710, 1935, 705, 371, 2099, 1829, - /* 590 */ 712, 186, 1861, 2315, 2245, 2397, 189, 399, 2311, 1260, - /* 600 */ 2392, 661, 12, 635, 10, 2195, 2391, 711, 1660, 1661, - /* 610 */ 41, 40, 191, 397, 47, 45, 44, 43, 42, 2245, - /* 620 */ 2345, 1995, 167, 2397, 189, 679, 2181, 2109, 2392, 661, - /* 630 */ 2195, 2396, 711, 282, 2391, 695, 1993, 744, 1633, 1643, - /* 640 */ 2038, 2226, 2195, 2262, 1659, 1662, 112, 2228, 715, 2230, - /* 650 */ 2231, 710, 2395, 705, 1634, 135, 2392, 2393, 186, 1578, - /* 660 */ 2315, 1576, 582, 224, 399, 2311, 2226, 540, 2262, 1859, - /* 670 */ 2359, 112, 2228, 715, 2230, 2231, 710, 425, 705, 493, - /* 680 */ 2095, 1262, 1263, 2411, 681, 2315, 289, 2346, 276, 399, - /* 690 */ 2311, 1581, 1582, 2189, 1632, 1635, 1636, 1637, 1638, 1639, - /* 700 */ 1640, 1641, 1642, 707, 703, 1651, 1652, 1654, 1655, 1656, - /* 710 */ 1657, 2, 48, 46, 1663, 2047, 1969, 2227, 1802, 1577, - /* 720 */ 403, 393, 1577, 289, 600, 158, 211, 90, 1828, 2045, - /* 730 */ 712, 182, 2353, 648, 1575, 1658, 690, 1575, 2109, 612, - /* 740 */ 635, 41, 40, 2391, 373, 47, 45, 44, 43, 42, - /* 750 */ 62, 2100, 437, 1988, 2227, 249, 695, 1993, 634, 2245, - /* 760 */ 2397, 189, 695, 1993, 1653, 2392, 661, 712, 695, 1993, - /* 770 */ 2195, 603, 711, 2160, 1583, 166, 453, 1583, 597, 439, - /* 780 */ 435, 2195, 454, 2047, 246, 752, 41, 40, 468, 398, - /* 790 */ 47, 45, 44, 43, 42, 1347, 2245, 2045, 55, 805, - /* 800 */ 695, 1993, 805, 103, 2227, 49, 2226, 2195, 2262, 711, - /* 810 */ 1346, 112, 2228, 715, 2230, 2231, 710, 712, 705, 139, - /* 820 */ 483, 1801, 253, 2411, 70, 2315, 406, 69, 1986, 399, - /* 830 */ 2311, 412, 411, 2246, 1995, 167, 447, 1827, 446, 1771, - /* 840 */ 1933, 1660, 1661, 2226, 1970, 2262, 2245, 1932, 113, 2228, - /* 850 */ 715, 2230, 2231, 710, 2178, 705, 1584, 2195, 1826, 711, - /* 860 */ 168, 409, 2315, 573, 572, 329, 2314, 2311, 445, 1995, - /* 870 */ 167, 1633, 1643, 2047, 697, 509, 2287, 1659, 1662, 369, - /* 880 */ 1968, 60, 326, 73, 1748, 3, 72, 2045, 632, 1578, - /* 890 */ 2195, 1576, 1578, 2226, 1576, 2262, 352, 54, 113, 2228, - /* 900 */ 715, 2230, 2231, 710, 581, 705, 289, 220, 519, 517, - /* 910 */ 514, 2195, 2315, 699, 1668, 2287, 700, 2311, 298, 299, - /* 920 */ 1602, 1581, 1582, 297, 1581, 1582, 580, 1632, 1635, 1636, - /* 930 */ 1637, 1638, 1639, 1640, 1641, 1642, 707, 703, 1651, 1652, - /* 940 */ 1654, 1655, 1656, 1657, 2, 48, 46, 62, 386, 695, - /* 950 */ 1993, 660, 2227, 403, 2391, 1577, 44, 43, 42, 1825, - /* 960 */ 750, 2395, 14, 13, 2330, 712, 695, 1993, 1658, 484, - /* 970 */ 1575, 659, 189, 695, 1993, 748, 2392, 661, 2038, 160, - /* 980 */ 159, 747, 746, 745, 157, 111, 553, 2227, 695, 1993, - /* 990 */ 2325, 695, 1993, 1990, 2245, 2047, 750, 1653, 252, 90, - /* 1000 */ 712, 407, 2366, 695, 1993, 2195, 583, 711, 254, 2045, - /* 1010 */ 1583, 262, 2195, 1587, 1729, 160, 159, 747, 746, 745, - /* 1020 */ 157, 377, 376, 678, 1824, 1989, 81, 80, 452, 2245, - /* 1030 */ 1334, 201, 695, 1993, 416, 805, 1689, 1823, 49, 1853, - /* 1040 */ 2195, 2226, 711, 2262, 444, 442, 171, 2228, 715, 2230, - /* 1050 */ 2231, 710, 302, 705, 749, 353, 2205, 2038, 433, 695, - /* 1060 */ 1993, 431, 427, 423, 420, 445, 618, 1701, 1548, 1549, - /* 1070 */ 1984, 1634, 432, 2205, 1660, 1661, 2226, 2195, 2262, 692, - /* 1080 */ 2209, 112, 2228, 715, 2230, 2231, 710, 2214, 705, 2357, - /* 1090 */ 2195, 375, 374, 2411, 579, 2315, 2104, 2209, 581, 399, - /* 1100 */ 2311, 695, 1993, 289, 1633, 1643, 695, 1993, 575, 574, - /* 1110 */ 1659, 1662, 109, 635, 35, 615, 2391, 614, 2211, 251, - /* 1120 */ 580, 693, 9, 250, 1694, 1578, 308, 1576, 705, 145, - /* 1130 */ 1820, 695, 1993, 2397, 189, 2211, 664, 1985, 2392, 661, - /* 1140 */ 2227, 1351, 41, 40, 1819, 705, 47, 45, 44, 43, - /* 1150 */ 42, 410, 1858, 712, 1586, 1818, 1350, 1581, 1582, 1817, - /* 1160 */ 1632, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 707, - /* 1170 */ 703, 1651, 1652, 1654, 1655, 1656, 1657, 2, 48, 46, - /* 1180 */ 591, 590, 2245, 2195, 93, 1242, 403, 358, 1577, 238, - /* 1190 */ 383, 1601, 613, 2195, 1816, 711, 1815, 2195, 1605, 412, - /* 1200 */ 411, 1658, 1814, 1575, 2227, 174, 1605, 660, 2195, 1591, - /* 1210 */ 2391, 1602, 2195, 571, 567, 563, 559, 712, 237, 642, - /* 1220 */ 322, 511, 1658, 2024, 1584, 1813, 1812, 659, 189, 713, - /* 1230 */ 1653, 2262, 2392, 661, 113, 2228, 715, 2230, 2231, 710, - /* 1240 */ 663, 705, 2088, 1583, 774, 772, 2245, 2195, 2315, 2195, - /* 1250 */ 667, 1653, 362, 2311, 2349, 2195, 1585, 2195, 91, 711, - /* 1260 */ 1879, 235, 1982, 167, 1583, 1978, 167, 702, 805, 1980, - /* 1270 */ 167, 15, 2227, 1728, 676, 1976, 167, 158, 2195, 2195, - /* 1280 */ 1996, 167, 596, 763, 458, 712, 1955, 2384, 2035, 701, - /* 1290 */ 1837, 800, 137, 2226, 673, 2262, 2335, 1721, 112, 2228, - /* 1300 */ 715, 2230, 2231, 710, 83, 705, 243, 1660, 1661, 241, - /* 1310 */ 2411, 1589, 2315, 158, 2245, 584, 399, 2311, 1239, 1240, - /* 1320 */ 151, 635, 263, 150, 2391, 2195, 284, 711, 234, 228, - /* 1330 */ 245, 1870, 5, 244, 1868, 233, 550, 1633, 1643, 1332, - /* 1340 */ 1721, 2397, 189, 1659, 1662, 153, 2392, 661, 152, 50, - /* 1350 */ 1543, 204, 281, 598, 226, 108, 601, 1, 1578, 264, - /* 1360 */ 1576, 2226, 1634, 2262, 105, 94, 112, 2228, 715, 2230, - /* 1370 */ 2231, 710, 50, 705, 269, 1804, 1805, 158, 2411, 1592, - /* 1380 */ 2315, 1587, 50, 1293, 399, 2311, 1546, 665, 295, 1862, - /* 1390 */ 1581, 1582, 71, 1632, 1635, 1636, 1637, 1638, 1639, 1640, - /* 1400 */ 1641, 1642, 707, 703, 1651, 1652, 1654, 1655, 1656, 1657, - /* 1410 */ 2, 1595, 1597, 1588, 156, 158, 14, 13, 2227, 64, - /* 1420 */ 50, 1679, 1757, 1294, 703, 1651, 1652, 1654, 1655, 1656, - /* 1430 */ 1657, 712, 419, 2334, 424, 756, 367, 50, 719, 757, - /* 1440 */ 1608, 798, 441, 2227, 196, 1756, 440, 271, 197, 156, - /* 1450 */ 677, 443, 158, 199, 138, 1500, 712, 1524, 316, 1312, - /* 1460 */ 2245, 300, 156, 1310, 1601, 687, 459, 461, 210, 1605, - /* 1470 */ 465, 2195, 2105, 711, 467, 502, 1600, 472, 485, 501, - /* 1480 */ 492, 2097, 494, 503, 513, 2245, 510, 304, 1377, 214, - /* 1490 */ 215, 512, 1695, 1644, 515, 516, 2195, 217, 711, 518, - /* 1500 */ 520, 1606, 4, 668, 535, 2227, 543, 2226, 1603, 2262, - /* 1510 */ 321, 1406, 112, 2228, 715, 2230, 2231, 710, 712, 705, - /* 1520 */ 536, 544, 1410, 546, 2411, 1417, 2315, 1415, 225, 547, - /* 1530 */ 399, 2311, 2226, 1607, 2262, 161, 227, 112, 2228, 715, - /* 1540 */ 2230, 2231, 710, 1609, 705, 548, 549, 2245, 230, 2290, - /* 1550 */ 551, 2315, 576, 232, 88, 399, 2311, 555, 2195, 89, - /* 1560 */ 711, 578, 1983, 236, 240, 1979, 2227, 242, 1981, 114, - /* 1570 */ 1977, 604, 605, 617, 92, 348, 619, 2169, 154, 712, - /* 1580 */ 255, 317, 623, 259, 624, 257, 628, 622, 2166, 1531, - /* 1590 */ 2165, 629, 2227, 630, 2226, 649, 2262, 685, 627, 112, - /* 1600 */ 2228, 715, 2230, 2231, 710, 709, 705, 2350, 2245, 2360, - /* 1610 */ 2365, 2288, 639, 2315, 2364, 8, 2227, 399, 2311, 2195, - /* 1620 */ 267, 711, 270, 658, 645, 389, 652, 175, 2337, 712, - /* 1630 */ 637, 640, 638, 275, 2245, 390, 2414, 280, 277, 278, - /* 1640 */ 143, 279, 669, 2227, 666, 2195, 283, 711, 1604, 2331, - /* 1650 */ 1726, 1721, 179, 290, 1724, 2226, 712, 2262, 2245, 98, - /* 1660 */ 112, 2228, 715, 2230, 2231, 710, 1610, 705, 318, 2195, - /* 1670 */ 2110, 711, 698, 192, 2315, 288, 319, 683, 399, 2311, - /* 1680 */ 688, 2226, 684, 2262, 2124, 2245, 344, 2228, 715, 2230, - /* 1690 */ 2231, 710, 708, 705, 696, 2280, 2195, 2390, 711, 2123, - /* 1700 */ 2122, 689, 395, 320, 100, 2226, 61, 2262, 2296, 1994, - /* 1710 */ 172, 2228, 715, 2230, 2231, 710, 102, 705, 104, 1956, - /* 1720 */ 717, 2039, 323, 2227, 1218, 311, 799, 163, 53, 359, - /* 1730 */ 360, 325, 2226, 2187, 2262, 2186, 712, 113, 2228, 715, - /* 1740 */ 2230, 2231, 710, 802, 705, 2227, 347, 804, 332, 346, - /* 1750 */ 336, 2315, 327, 2185, 78, 2182, 2312, 421, 712, 422, - /* 1760 */ 1568, 1569, 195, 662, 2412, 2245, 426, 2180, 428, 387, - /* 1770 */ 430, 429, 2179, 2227, 368, 2177, 2195, 434, 711, 2176, - /* 1780 */ 436, 2175, 438, 1559, 2156, 198, 712, 2245, 2155, 200, - /* 1790 */ 1527, 388, 79, 2137, 1526, 2136, 2135, 450, 2195, 451, - /* 1800 */ 711, 2134, 2133, 1477, 2087, 456, 2084, 457, 202, 2083, - /* 1810 */ 82, 2082, 2226, 2081, 2262, 2245, 2086, 345, 2228, 715, - /* 1820 */ 2230, 2231, 710, 205, 705, 2085, 2195, 2080, 711, 207, - /* 1830 */ 2074, 473, 475, 2090, 2226, 2079, 2262, 2077, 2076, 345, - /* 1840 */ 2228, 715, 2230, 2231, 710, 2075, 705, 209, 2058, 2057, - /* 1850 */ 87, 2056, 2055, 2227, 2073, 2072, 2071, 2070, 2069, 2068, - /* 1860 */ 2067, 2066, 2226, 2065, 2262, 2064, 712, 338, 2228, 715, - /* 1870 */ 2230, 2231, 710, 2063, 705, 2227, 2062, 2061, 2060, 2059, - /* 1880 */ 2089, 2054, 2053, 2052, 1479, 2051, 2050, 505, 712, 2049, - /* 1890 */ 2048, 1348, 356, 1352, 357, 2245, 1898, 1897, 216, 1896, - /* 1900 */ 218, 1344, 1894, 219, 1891, 521, 2195, 1890, 711, 1883, - /* 1910 */ 1872, 525, 657, 1848, 523, 221, 1847, 2245, 522, 1241, - /* 1920 */ 2154, 394, 231, 2131, 2108, 529, 526, 2144, 2195, 527, - /* 1930 */ 711, 533, 2132, 531, 76, 530, 183, 1972, 223, 1893, - /* 1940 */ 2227, 1889, 2226, 77, 2262, 1887, 1885, 172, 2228, 715, - /* 1950 */ 2230, 2231, 710, 709, 705, 2215, 229, 184, 556, 1882, - /* 1960 */ 541, 558, 2227, 560, 2226, 1867, 2262, 562, 557, 345, - /* 1970 */ 2228, 715, 2230, 2231, 710, 712, 705, 564, 566, 561, - /* 1980 */ 565, 568, 2245, 1286, 569, 570, 1865, 1866, 1864, 1844, - /* 1990 */ 1974, 1422, 1421, 2195, 1973, 711, 115, 1335, 1333, 1331, - /* 2000 */ 1330, 2413, 771, 1329, 2245, 1328, 63, 773, 402, 239, - /* 2010 */ 1327, 1880, 1324, 2227, 1323, 2195, 1321, 711, 1322, 1871, - /* 2020 */ 380, 381, 1869, 382, 599, 1843, 712, 2227, 602, 2226, - /* 2030 */ 1842, 2262, 1841, 1840, 344, 2228, 715, 2230, 2231, 710, - /* 2040 */ 712, 705, 606, 2281, 608, 1839, 610, 1553, 1557, 1555, - /* 2050 */ 1552, 2226, 29, 2262, 2153, 2245, 345, 2228, 715, 2230, - /* 2060 */ 2231, 710, 67, 705, 1533, 1537, 2195, 2143, 711, 2245, - /* 2070 */ 1535, 625, 2130, 404, 2129, 20, 2396, 21, 17, 6, - /* 2080 */ 2195, 7, 711, 31, 641, 643, 1774, 266, 57, 268, - /* 2090 */ 22, 626, 274, 273, 33, 165, 2216, 23, 1755, 1747, - /* 2100 */ 2227, 1794, 616, 1795, 2262, 260, 65, 340, 2228, 715, - /* 2110 */ 2230, 2231, 710, 712, 705, 24, 2226, 631, 2262, 173, - /* 2120 */ 621, 345, 2228, 715, 2230, 2231, 710, 633, 705, 1512, - /* 2130 */ 1789, 1511, 1788, 272, 391, 1793, 1792, 392, 808, 32, - /* 2140 */ 95, 286, 2245, 1718, 1717, 59, 2128, 2107, 97, 2106, - /* 2150 */ 178, 96, 99, 2195, 315, 711, 293, 25, 2227, 294, - /* 2160 */ 306, 1753, 26, 296, 105, 13, 1593, 301, 68, 101, - /* 2170 */ 181, 712, 2227, 1670, 1669, 1680, 686, 303, 796, 792, - /* 2180 */ 788, 784, 2265, 312, 1648, 712, 704, 180, 39, 2226, - /* 2190 */ 2227, 2262, 1646, 58, 330, 2228, 715, 2230, 2231, 710, - /* 2200 */ 2245, 705, 1645, 712, 193, 1625, 716, 16, 718, 27, - /* 2210 */ 11, 2195, 405, 711, 2245, 722, 18, 725, 728, 1617, - /* 2220 */ 28, 731, 1407, 110, 1404, 2195, 305, 711, 714, 720, - /* 2230 */ 723, 726, 2245, 1403, 1400, 729, 734, 1394, 732, 1383, - /* 2240 */ 1392, 735, 309, 2195, 1398, 711, 106, 2226, 1397, 2262, - /* 2250 */ 107, 1416, 328, 2228, 715, 2230, 2231, 710, 691, 705, - /* 2260 */ 1412, 2226, 1396, 2262, 1395, 2227, 331, 2228, 715, 2230, - /* 2270 */ 2231, 710, 741, 705, 75, 1284, 751, 1316, 712, 2226, - /* 2280 */ 1315, 2262, 1314, 1313, 337, 2228, 715, 2230, 2231, 710, - /* 2290 */ 1342, 705, 2227, 292, 1311, 1309, 1308, 1307, 310, 761, - /* 2300 */ 291, 1305, 1302, 1304, 1303, 712, 1301, 2245, 1300, 1299, - /* 2310 */ 1339, 1337, 1296, 1295, 1292, 2227, 1291, 1290, 2195, 256, - /* 2320 */ 711, 1289, 1888, 781, 782, 783, 1886, 785, 712, 786, - /* 2330 */ 787, 1884, 790, 789, 2245, 791, 1881, 793, 794, 795, - /* 2340 */ 1863, 797, 1231, 1838, 801, 2195, 1219, 711, 807, 314, - /* 2350 */ 803, 806, 2227, 1808, 2226, 1579, 2262, 2245, 1808, 341, - /* 2360 */ 2228, 715, 2230, 2231, 710, 712, 705, 324, 2195, 1808, - /* 2370 */ 711, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 2227, - /* 2380 */ 1808, 2226, 1808, 2262, 1808, 1808, 333, 2228, 715, 2230, - /* 2390 */ 2231, 710, 712, 705, 2245, 1808, 1808, 1808, 1808, 1808, - /* 2400 */ 1808, 1808, 2227, 1808, 2226, 2195, 2262, 711, 1808, 342, - /* 2410 */ 2228, 715, 2230, 2231, 710, 712, 705, 1808, 1808, 1808, - /* 2420 */ 1808, 2245, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, - /* 2430 */ 1808, 1808, 2195, 1808, 711, 1808, 1808, 1808, 1808, 1808, - /* 2440 */ 1808, 2226, 1808, 2262, 2245, 1808, 334, 2228, 715, 2230, - /* 2450 */ 2231, 710, 2227, 705, 1808, 2195, 1808, 711, 1808, 1808, - /* 2460 */ 1808, 1808, 1808, 1808, 1808, 712, 2227, 1808, 2226, 1808, - /* 2470 */ 2262, 1808, 1808, 343, 2228, 715, 2230, 2231, 710, 712, - /* 2480 */ 705, 1808, 2227, 1808, 1808, 1808, 1808, 1808, 1808, 1808, - /* 2490 */ 1808, 2226, 1808, 2262, 2245, 712, 335, 2228, 715, 2230, - /* 2500 */ 2231, 710, 1808, 705, 1808, 2195, 1808, 711, 2245, 1808, - /* 2510 */ 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 2195, - /* 2520 */ 1808, 711, 1808, 1808, 2245, 1808, 1808, 1808, 1808, 1808, - /* 2530 */ 1808, 1808, 1808, 1808, 1808, 2195, 1808, 711, 1808, 1808, - /* 2540 */ 1808, 2226, 1808, 2262, 1808, 2227, 349, 2228, 715, 2230, - /* 2550 */ 2231, 710, 1808, 705, 1808, 2226, 1808, 2262, 712, 1808, - /* 2560 */ 350, 2228, 715, 2230, 2231, 710, 1808, 705, 1808, 2227, - /* 2570 */ 1808, 2226, 1808, 2262, 1808, 1808, 2239, 2228, 715, 2230, - /* 2580 */ 2231, 710, 712, 705, 1808, 1808, 1808, 2245, 1808, 1808, - /* 2590 */ 1808, 1808, 1808, 1808, 1808, 1808, 2227, 1808, 2195, 1808, - /* 2600 */ 711, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 712, - /* 2610 */ 1808, 2245, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, - /* 2620 */ 1808, 1808, 2195, 1808, 711, 1808, 1808, 1808, 1808, 1808, - /* 2630 */ 1808, 1808, 1808, 1808, 2226, 1808, 2262, 1808, 2245, 2238, - /* 2640 */ 2228, 715, 2230, 2231, 710, 1808, 705, 1808, 1808, 2195, - /* 2650 */ 1808, 711, 1808, 1808, 1808, 1808, 1808, 1808, 2226, 2227, - /* 2660 */ 2262, 1808, 1808, 2237, 2228, 715, 2230, 2231, 710, 1808, - /* 2670 */ 705, 1808, 712, 1808, 1808, 1808, 1808, 1808, 1808, 1808, - /* 2680 */ 1808, 1808, 1808, 1808, 1808, 2226, 1808, 2262, 1808, 2227, - /* 2690 */ 364, 2228, 715, 2230, 2231, 710, 1808, 705, 1808, 1808, - /* 2700 */ 1808, 2245, 712, 1808, 1808, 1808, 1808, 1808, 1808, 2227, - /* 2710 */ 1808, 1808, 2195, 1808, 711, 1808, 1808, 1808, 1808, 1808, - /* 2720 */ 1808, 1808, 712, 1808, 1808, 1808, 1808, 1808, 1808, 1808, - /* 2730 */ 1808, 2245, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, - /* 2740 */ 1808, 1808, 2195, 1808, 711, 1808, 1808, 1808, 2226, 1808, - /* 2750 */ 2262, 2245, 1808, 365, 2228, 715, 2230, 2231, 710, 2227, - /* 2760 */ 705, 1808, 2195, 1808, 711, 1808, 1808, 1808, 1808, 1808, - /* 2770 */ 1808, 1808, 712, 1808, 1808, 1808, 2227, 1808, 2226, 1808, - /* 2780 */ 2262, 1808, 1808, 361, 2228, 715, 2230, 2231, 710, 712, - /* 2790 */ 705, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 2226, 1808, - /* 2800 */ 2262, 2245, 1808, 366, 2228, 715, 2230, 2231, 710, 1808, - /* 2810 */ 705, 1808, 2195, 1808, 711, 1808, 1808, 1808, 2245, 1808, - /* 2820 */ 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 2195, - /* 2830 */ 1808, 711, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, - /* 2840 */ 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 713, 1808, - /* 2850 */ 2262, 1808, 1808, 340, 2228, 715, 2230, 2231, 710, 1808, - /* 2860 */ 705, 1808, 1808, 1808, 1808, 2226, 1808, 2262, 1808, 1808, - /* 2870 */ 339, 2228, 715, 2230, 2231, 710, 1808, 705, + /* 0 */ 38, 311, 2227, 410, 541, 699, 1994, 542, 1853, 2041, + /* 10 */ 2042, 164, 48, 46, 1733, 716, 416, 415, 389, 1996, + /* 20 */ 407, 1811, 1578, 41, 40, 135, 2045, 47, 45, 44, + /* 30 */ 43, 42, 581, 577, 576, 1659, 1893, 1576, 1603, 676, + /* 40 */ 144, 1585, 125, 2245, 2078, 124, 123, 122, 121, 120, + /* 50 */ 119, 118, 117, 116, 109, 2195, 317, 715, 699, 1994, + /* 60 */ 664, 41, 40, 2391, 1654, 47, 45, 44, 43, 42, + /* 70 */ 19, 145, 2116, 1606, 2116, 676, 144, 1584, 194, 1986, + /* 80 */ 663, 189, 676, 144, 400, 2392, 665, 2113, 686, 2114, + /* 90 */ 686, 2226, 170, 2262, 1822, 185, 172, 2228, 719, 2230, + /* 100 */ 2231, 714, 807, 709, 706, 15, 459, 2034, 782, 781, + /* 110 */ 780, 779, 419, 504, 778, 777, 148, 772, 771, 770, + /* 120 */ 769, 768, 767, 766, 158, 762, 761, 760, 418, 417, + /* 130 */ 757, 756, 755, 177, 176, 1604, 1833, 1603, 1808, 1394, + /* 140 */ 546, 1661, 1662, 188, 2323, 2324, 543, 142, 2328, 666, + /* 150 */ 2412, 355, 2181, 1385, 744, 743, 742, 1389, 741, 1391, + /* 160 */ 1392, 740, 737, 698, 1400, 734, 1402, 1403, 731, 728, + /* 170 */ 725, 1634, 1644, 213, 212, 699, 1994, 1660, 1663, 190, + /* 180 */ 2323, 2324, 558, 142, 2328, 1970, 289, 2323, 675, 2195, + /* 190 */ 136, 674, 1579, 2391, 1577, 56, 503, 2396, 1588, 1803, + /* 200 */ 2391, 41, 40, 429, 482, 47, 45, 44, 43, 42, + /* 210 */ 663, 189, 1604, 481, 422, 2392, 665, 549, 2395, 421, + /* 220 */ 542, 1853, 2392, 2394, 1582, 1583, 269, 1633, 1636, 1637, + /* 230 */ 1638, 1639, 1640, 1641, 1642, 1643, 711, 707, 1652, 1653, + /* 240 */ 1655, 1656, 1657, 1658, 2, 48, 46, 698, 638, 1261, + /* 250 */ 359, 1260, 1601, 407, 754, 1578, 1504, 1505, 1680, 495, + /* 260 */ 2227, 639, 511, 367, 2391, 1236, 140, 510, 1659, 684, + /* 270 */ 1576, 41, 40, 716, 1690, 47, 45, 44, 43, 42, + /* 280 */ 1603, 2397, 189, 478, 1262, 512, 2392, 665, 1487, 1488, + /* 290 */ 480, 1761, 1503, 1506, 698, 2396, 30, 1654, 2391, 1737, + /* 300 */ 1832, 2245, 1802, 19, 659, 1603, 1688, 1238, 1241, 1242, + /* 310 */ 1584, 676, 144, 2195, 412, 715, 2395, 2040, 2042, 125, + /* 320 */ 2392, 2393, 124, 123, 122, 121, 120, 119, 118, 117, + /* 330 */ 116, 654, 51, 1429, 1430, 807, 376, 754, 15, 651, + /* 340 */ 650, 1759, 1760, 1762, 1763, 1764, 2205, 466, 2160, 2226, + /* 350 */ 1831, 2262, 35, 2195, 112, 2228, 719, 2230, 2231, 714, + /* 360 */ 2213, 709, 1695, 1689, 147, 62, 151, 2286, 2315, 1773, + /* 370 */ 2209, 60, 403, 2311, 1661, 1662, 62, 508, 636, 51, + /* 380 */ 502, 501, 500, 499, 494, 493, 492, 491, 490, 486, + /* 390 */ 485, 484, 483, 358, 475, 474, 473, 257, 468, 467, + /* 400 */ 374, 699, 1994, 2195, 1634, 1644, 1810, 624, 2211, 404, + /* 410 */ 1660, 1663, 208, 66, 678, 187, 2323, 2324, 709, 142, + /* 420 */ 2328, 135, 660, 655, 648, 1579, 658, 1577, 586, 685, + /* 430 */ 134, 133, 132, 131, 130, 129, 128, 127, 126, 699, + /* 440 */ 1994, 37, 405, 1683, 1684, 1685, 1686, 1687, 1691, 1692, + /* 450 */ 1693, 1694, 86, 12, 2245, 85, 1635, 1582, 1583, 457, + /* 460 */ 1633, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 711, + /* 470 */ 707, 1652, 1653, 1655, 1656, 1657, 1658, 2, 12, 48, + /* 480 */ 46, 556, 103, 2109, 1261, 2227, 1260, 407, 293, 1578, + /* 490 */ 752, 156, 155, 749, 748, 747, 153, 222, 679, 62, + /* 500 */ 538, 544, 1659, 1860, 1576, 2227, 2205, 1987, 536, 657, + /* 510 */ 604, 532, 528, 1584, 62, 599, 598, 597, 716, 1262, + /* 520 */ 1985, 293, 589, 141, 593, 616, 2245, 745, 592, 182, + /* 530 */ 2209, 1654, 293, 591, 596, 383, 382, 19, 2195, 590, + /* 540 */ 715, 253, 464, 2095, 1584, 401, 2245, 2047, 615, 375, + /* 550 */ 2099, 255, 764, 167, 373, 254, 146, 607, 2195, 2286, + /* 560 */ 715, 1996, 2045, 613, 601, 611, 252, 251, 2211, 807, + /* 570 */ 250, 74, 15, 685, 2226, 1338, 2262, 2227, 709, 112, + /* 580 */ 2228, 719, 2230, 2231, 714, 451, 709, 450, 90, 203, + /* 590 */ 716, 186, 1862, 2315, 2226, 1830, 2262, 403, 2311, 171, + /* 600 */ 2228, 719, 2230, 2231, 714, 377, 709, 52, 1661, 1662, + /* 610 */ 70, 1983, 191, 69, 1989, 1340, 93, 449, 2245, 362, + /* 620 */ 2345, 84, 387, 2396, 617, 683, 664, 2109, 2047, 2391, + /* 630 */ 2195, 1829, 715, 47, 45, 44, 43, 42, 1634, 1644, + /* 640 */ 1605, 640, 2356, 2046, 1660, 1663, 663, 189, 2195, 410, + /* 650 */ 224, 2392, 665, 1936, 544, 293, 1860, 167, 9, 1579, + /* 660 */ 1896, 1577, 699, 1994, 1578, 1996, 2226, 2330, 2262, 169, + /* 670 */ 293, 112, 2228, 719, 2230, 2231, 714, 1935, 709, 1576, + /* 680 */ 470, 2095, 458, 2411, 2195, 2315, 44, 43, 42, 403, + /* 690 */ 2311, 1582, 1583, 2327, 1633, 1636, 1637, 1638, 1639, 1640, + /* 700 */ 1641, 1642, 1643, 711, 707, 1652, 1653, 1655, 1656, 1657, + /* 710 */ 1658, 2, 48, 46, 1664, 685, 267, 2227, 453, 1584, + /* 720 */ 407, 441, 1578, 452, 302, 303, 1796, 206, 2188, 301, + /* 730 */ 679, 2047, 599, 598, 597, 1659, 182, 1576, 388, 589, + /* 740 */ 141, 593, 699, 1994, 807, 592, 2045, 2205, 443, 439, + /* 750 */ 591, 596, 383, 382, 699, 1994, 590, 2100, 2245, 94, + /* 760 */ 2189, 2214, 472, 293, 1654, 639, 2047, 694, 2391, 2109, + /* 770 */ 2195, 2209, 715, 397, 487, 639, 1244, 1584, 2391, 699, + /* 780 */ 1994, 2045, 1602, 699, 1994, 2397, 189, 1979, 497, 2095, + /* 790 */ 2392, 665, 256, 291, 265, 2397, 189, 1264, 1265, 488, + /* 800 */ 2392, 665, 807, 557, 2227, 49, 2226, 639, 2262, 2211, + /* 810 */ 2391, 112, 2228, 719, 2230, 2231, 714, 716, 709, 709, + /* 820 */ 699, 1994, 585, 186, 2047, 2315, 584, 2397, 189, 403, + /* 830 */ 2311, 402, 2392, 665, 1579, 211, 1577, 1971, 1981, 2045, + /* 840 */ 1991, 1661, 1662, 41, 40, 2245, 1349, 47, 45, 44, + /* 850 */ 43, 42, 2346, 699, 1994, 699, 1994, 2195, 1828, 715, + /* 860 */ 168, 1348, 1549, 1550, 1669, 333, 1582, 1583, 699, 1994, + /* 870 */ 1603, 1634, 1644, 258, 2047, 266, 1722, 1660, 1663, 1969, + /* 880 */ 2330, 411, 330, 73, 699, 1994, 72, 1823, 682, 2045, + /* 890 */ 14, 13, 1579, 2226, 1577, 2262, 356, 90, 113, 2228, + /* 900 */ 719, 2230, 2231, 714, 306, 709, 2326, 220, 523, 521, + /* 910 */ 518, 2195, 2315, 1827, 41, 40, 2314, 2311, 47, 45, + /* 920 */ 44, 43, 42, 1990, 1582, 1583, 513, 1633, 1636, 1637, + /* 930 */ 1638, 1639, 1640, 1641, 1642, 1643, 711, 707, 1652, 1653, + /* 940 */ 1655, 1656, 1657, 1658, 2, 48, 46, 62, 668, 699, + /* 950 */ 1994, 1826, 1825, 407, 1824, 1578, 41, 40, 699, 1994, + /* 960 */ 47, 45, 44, 43, 42, 1605, 2195, 238, 1659, 696, + /* 970 */ 1576, 752, 156, 155, 749, 748, 747, 153, 697, 1821, + /* 980 */ 699, 1994, 413, 174, 2395, 111, 699, 1994, 2227, 1820, + /* 990 */ 167, 575, 571, 567, 563, 1702, 237, 1654, 1996, 622, + /* 1000 */ 312, 716, 2178, 2353, 2195, 2195, 414, 2195, 166, 12, + /* 1010 */ 1584, 10, 1772, 752, 156, 155, 749, 748, 747, 153, + /* 1020 */ 1819, 1635, 1353, 1818, 2330, 1817, 81, 80, 456, 2245, + /* 1030 */ 1730, 201, 2195, 579, 578, 807, 91, 1352, 49, 235, + /* 1040 */ 2227, 2195, 2195, 715, 448, 446, 639, 595, 594, 2391, + /* 1050 */ 2325, 1603, 167, 716, 1749, 357, 776, 774, 437, 1816, + /* 1060 */ 1997, 435, 431, 427, 424, 449, 2397, 189, 1838, 802, + /* 1070 */ 1606, 2392, 665, 2195, 1661, 1662, 2195, 2226, 2195, 2262, + /* 1080 */ 1977, 2245, 112, 2228, 719, 2230, 2231, 714, 671, 709, + /* 1090 */ 1815, 1814, 1813, 2195, 2411, 715, 2315, 701, 1998, 2287, + /* 1100 */ 403, 2311, 515, 293, 1634, 1644, 234, 228, 1606, 34, + /* 1110 */ 1660, 1663, 2195, 233, 554, 41, 40, 1587, 291, 47, + /* 1120 */ 45, 44, 43, 42, 703, 1579, 2287, 1577, 1586, 2226, + /* 1130 */ 746, 2262, 226, 2038, 112, 2228, 719, 2230, 2231, 714, + /* 1140 */ 680, 709, 154, 2195, 2195, 2195, 2290, 750, 2315, 1972, + /* 1150 */ 2038, 262, 403, 2311, 381, 380, 751, 1582, 1583, 2038, + /* 1160 */ 1633, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 711, + /* 1170 */ 707, 1652, 1653, 1655, 1656, 1657, 1658, 2, 48, 46, + /* 1180 */ 326, 765, 149, 2024, 1956, 710, 407, 639, 1578, 2088, + /* 1190 */ 2391, 1241, 1242, 2335, 1722, 1805, 1806, 3, 137, 669, + /* 1200 */ 154, 1659, 1635, 1576, 2227, 14, 13, 2397, 189, 54, + /* 1210 */ 83, 243, 2392, 665, 241, 55, 652, 716, 245, 2366, + /* 1220 */ 436, 244, 587, 204, 379, 378, 588, 583, 2359, 247, + /* 1230 */ 1654, 462, 246, 41, 40, 286, 154, 47, 45, 44, + /* 1240 */ 43, 42, 1863, 1584, 249, 2245, 1336, 248, 1880, 585, + /* 1250 */ 1334, 2227, 619, 584, 618, 50, 50, 2195, 139, 715, + /* 1260 */ 280, 268, 1871, 667, 716, 1869, 646, 2216, 807, 36, + /* 1270 */ 600, 15, 1934, 1544, 1590, 41, 40, 108, 2227, 47, + /* 1280 */ 45, 44, 43, 42, 602, 1589, 105, 605, 1933, 1729, + /* 1290 */ 1295, 713, 2245, 2226, 800, 2262, 758, 759, 112, 2228, + /* 1300 */ 719, 2230, 2231, 714, 2195, 709, 715, 1661, 1662, 1547, + /* 1310 */ 2411, 2246, 2315, 390, 273, 154, 403, 2311, 420, 2245, + /* 1320 */ 1314, 1312, 1854, 2218, 2104, 1859, 2035, 2349, 1758, 1757, + /* 1330 */ 1296, 2195, 677, 715, 288, 285, 292, 1634, 1644, 50, + /* 1340 */ 2226, 672, 2262, 1660, 1663, 112, 2228, 719, 2230, 2231, + /* 1350 */ 714, 299, 709, 5, 423, 428, 371, 2411, 1579, 2315, + /* 1360 */ 1577, 416, 415, 403, 2311, 71, 1609, 2226, 445, 2262, + /* 1370 */ 2227, 1592, 348, 2228, 719, 2230, 2231, 714, 712, 709, + /* 1380 */ 700, 2280, 444, 716, 1659, 2384, 1585, 275, 681, 196, + /* 1390 */ 1582, 1583, 197, 1633, 1636, 1637, 1638, 1639, 1640, 1641, + /* 1400 */ 1642, 1643, 711, 707, 1652, 1653, 1655, 1656, 1657, 1658, + /* 1410 */ 2, 2245, 1501, 1654, 152, 154, 447, 64, 50, 2227, + /* 1420 */ 50, 199, 723, 2195, 304, 715, 1584, 152, 154, 138, + /* 1430 */ 152, 1525, 716, 320, 2334, 1602, 210, 463, 691, 2227, + /* 1440 */ 465, 1606, 2105, 469, 471, 506, 476, 489, 1601, 496, + /* 1450 */ 2097, 705, 716, 505, 498, 516, 514, 507, 517, 2226, + /* 1460 */ 2245, 2262, 1607, 215, 112, 2228, 719, 2230, 2231, 714, + /* 1470 */ 519, 709, 2195, 214, 715, 217, 2411, 520, 2315, 522, + /* 1480 */ 2245, 524, 403, 2311, 4, 539, 540, 308, 1379, 547, + /* 1490 */ 1696, 1645, 2195, 325, 715, 1407, 550, 548, 1604, 225, + /* 1500 */ 1411, 1418, 1416, 157, 227, 1608, 1610, 552, 2226, 555, + /* 1510 */ 2262, 551, 553, 112, 2228, 719, 2230, 2231, 714, 230, + /* 1520 */ 709, 232, 88, 89, 559, 2411, 236, 2315, 2226, 580, + /* 1530 */ 2262, 403, 2311, 112, 2228, 719, 2230, 2231, 714, 114, + /* 1540 */ 709, 1593, 608, 1588, 582, 2288, 609, 2315, 621, 352, + /* 1550 */ 2169, 403, 2311, 623, 1984, 240, 92, 1980, 242, 2166, + /* 1560 */ 160, 161, 1982, 2227, 1978, 321, 162, 163, 259, 627, + /* 1570 */ 150, 628, 626, 1596, 1598, 2165, 716, 261, 263, 1532, + /* 1580 */ 653, 634, 643, 631, 632, 633, 707, 1652, 1653, 1655, + /* 1590 */ 1656, 1657, 1658, 2350, 2360, 2227, 2365, 689, 649, 2364, + /* 1600 */ 8, 271, 274, 393, 2245, 2337, 656, 662, 716, 279, + /* 1610 */ 644, 642, 175, 641, 283, 2227, 2195, 2390, 715, 673, + /* 1620 */ 281, 394, 284, 282, 2414, 670, 1722, 143, 716, 1605, + /* 1630 */ 2331, 1727, 294, 179, 287, 1725, 2245, 1611, 2110, 98, + /* 1640 */ 687, 322, 2227, 688, 323, 2124, 2123, 2122, 2195, 692, + /* 1650 */ 715, 399, 2226, 693, 2262, 716, 2245, 112, 2228, 719, + /* 1660 */ 2230, 2231, 714, 100, 709, 192, 1, 324, 2195, 702, + /* 1670 */ 715, 2315, 102, 1995, 61, 403, 2311, 104, 2296, 721, + /* 1680 */ 327, 2039, 1957, 2245, 2226, 315, 2262, 1220, 804, 113, + /* 1690 */ 2228, 719, 2230, 2231, 714, 2195, 709, 715, 801, 159, + /* 1700 */ 53, 806, 363, 2315, 717, 2227, 2262, 704, 2311, 113, + /* 1710 */ 2228, 719, 2230, 2231, 714, 351, 709, 364, 716, 336, + /* 1720 */ 329, 2227, 350, 2315, 2187, 340, 2186, 366, 2311, 331, + /* 1730 */ 2185, 2226, 78, 2262, 716, 2182, 113, 2228, 719, 2230, + /* 1740 */ 2231, 714, 425, 709, 426, 1569, 2245, 1570, 195, 430, + /* 1750 */ 2315, 2180, 2227, 432, 433, 2312, 434, 2179, 2195, 372, + /* 1760 */ 715, 2177, 2245, 2176, 438, 716, 440, 391, 2175, 442, + /* 1770 */ 2227, 1560, 2156, 198, 2195, 2155, 715, 200, 1528, 79, + /* 1780 */ 1527, 2137, 2136, 716, 2135, 454, 455, 2134, 2133, 2087, + /* 1790 */ 1478, 460, 2084, 2245, 2226, 2083, 2262, 461, 392, 171, + /* 1800 */ 2228, 719, 2230, 2231, 714, 2195, 709, 715, 202, 82, + /* 1810 */ 2226, 2245, 2262, 2082, 2081, 349, 2228, 719, 2230, 2231, + /* 1820 */ 714, 2086, 709, 2195, 2085, 715, 205, 2080, 2079, 2077, + /* 1830 */ 2076, 2075, 207, 477, 2074, 479, 2090, 2073, 2072, 2071, + /* 1840 */ 2070, 2226, 2357, 2262, 2069, 2068, 349, 2228, 719, 2230, + /* 1850 */ 2231, 714, 2067, 709, 2066, 2065, 2064, 2227, 209, 2226, + /* 1860 */ 2063, 2262, 2062, 2061, 342, 2228, 719, 2230, 2231, 714, + /* 1870 */ 716, 709, 2227, 2060, 2059, 2058, 2057, 87, 2056, 2055, + /* 1880 */ 2089, 2054, 2053, 1480, 2052, 716, 2051, 2227, 2050, 509, + /* 1890 */ 2049, 2048, 1350, 360, 1354, 1899, 361, 216, 2245, 1898, + /* 1900 */ 713, 1346, 1897, 1895, 1892, 218, 525, 527, 526, 661, + /* 1910 */ 2195, 219, 715, 2245, 1891, 1884, 1873, 530, 398, 531, + /* 1920 */ 529, 1849, 533, 1243, 1848, 2195, 2154, 715, 2245, 537, + /* 1930 */ 183, 535, 2144, 2132, 2227, 76, 231, 2131, 534, 221, + /* 1940 */ 2195, 223, 715, 2108, 1973, 2215, 2226, 716, 2262, 184, + /* 1950 */ 545, 172, 2228, 719, 2230, 2231, 714, 1894, 709, 2227, + /* 1960 */ 77, 2226, 229, 2262, 1890, 560, 349, 2228, 719, 2230, + /* 1970 */ 2231, 714, 716, 709, 561, 2245, 2226, 1288, 2262, 1888, + /* 1980 */ 406, 348, 2228, 719, 2230, 2231, 714, 2195, 709, 715, + /* 1990 */ 2281, 562, 564, 565, 566, 1886, 2227, 568, 569, 1883, + /* 2000 */ 2245, 570, 572, 574, 573, 2413, 1868, 1866, 1867, 716, + /* 2010 */ 1865, 1845, 2195, 1975, 715, 1423, 1422, 1974, 63, 239, + /* 2020 */ 1337, 1335, 1333, 2226, 1332, 2262, 1331, 1330, 349, 2228, + /* 2030 */ 719, 2230, 2231, 714, 1881, 709, 773, 2245, 1329, 1326, + /* 2040 */ 1324, 1325, 408, 384, 1872, 775, 1323, 385, 620, 2195, + /* 2050 */ 2262, 715, 1870, 344, 2228, 719, 2230, 2231, 714, 386, + /* 2060 */ 709, 606, 2227, 1844, 1843, 1842, 610, 603, 1841, 1840, + /* 2070 */ 612, 115, 614, 1554, 1558, 716, 1556, 1553, 29, 2153, + /* 2080 */ 57, 67, 1534, 2227, 1536, 2226, 2143, 2262, 629, 625, + /* 2090 */ 349, 2228, 719, 2230, 2231, 714, 716, 709, 630, 2130, + /* 2100 */ 2129, 635, 264, 2245, 1513, 2396, 20, 810, 165, 1512, + /* 2110 */ 1538, 1775, 65, 637, 2227, 2195, 17, 715, 21, 278, + /* 2120 */ 31, 270, 6, 319, 2245, 645, 7, 716, 647, 272, + /* 2130 */ 22, 277, 1756, 173, 33, 276, 2195, 1748, 715, 181, + /* 2140 */ 32, 2216, 1790, 95, 24, 1789, 59, 798, 794, 790, + /* 2150 */ 786, 2226, 316, 2262, 1795, 2245, 334, 2228, 719, 2230, + /* 2160 */ 2231, 714, 1796, 709, 395, 1794, 1793, 2195, 396, 715, + /* 2170 */ 290, 58, 2226, 1719, 2262, 178, 2128, 332, 2228, 719, + /* 2180 */ 2230, 2231, 714, 23, 709, 2227, 1718, 2107, 96, 97, + /* 2190 */ 297, 2106, 110, 298, 25, 309, 18, 1754, 716, 300, + /* 2200 */ 305, 2227, 99, 2226, 105, 2262, 310, 26, 335, 2228, + /* 2210 */ 719, 2230, 2231, 714, 716, 709, 307, 690, 11, 68, + /* 2220 */ 101, 1671, 1670, 13, 1594, 2265, 2245, 695, 1649, 708, + /* 2230 */ 180, 1647, 193, 722, 1626, 39, 409, 16, 2195, 1646, + /* 2240 */ 715, 27, 2245, 1681, 1618, 28, 718, 726, 1408, 720, + /* 2250 */ 724, 729, 1405, 2227, 2195, 727, 715, 1404, 730, 732, + /* 2260 */ 1401, 733, 296, 735, 1395, 1393, 716, 736, 738, 295, + /* 2270 */ 739, 106, 2227, 313, 2226, 107, 2262, 75, 1399, 341, + /* 2280 */ 2228, 719, 2230, 2231, 714, 716, 709, 1398, 260, 1397, + /* 2290 */ 2226, 1417, 2262, 1396, 2245, 345, 2228, 719, 2230, 2231, + /* 2300 */ 714, 1413, 709, 1286, 753, 2227, 2195, 1318, 715, 1317, + /* 2310 */ 1344, 1316, 1315, 2245, 1313, 1311, 763, 1310, 716, 1309, + /* 2320 */ 314, 1307, 1306, 1305, 2227, 2195, 1304, 715, 1341, 1303, + /* 2330 */ 1302, 1301, 1339, 1298, 1297, 1294, 1293, 716, 1292, 1291, + /* 2340 */ 2227, 1889, 2226, 783, 2262, 785, 2245, 337, 2228, 719, + /* 2350 */ 2230, 2231, 714, 716, 709, 1887, 784, 787, 2195, 788, + /* 2360 */ 715, 2226, 1885, 2262, 789, 2245, 346, 2228, 719, 2230, + /* 2370 */ 2231, 714, 791, 709, 792, 2227, 793, 2195, 1882, 715, + /* 2380 */ 795, 2245, 796, 1864, 797, 799, 1233, 1839, 716, 1221, + /* 2390 */ 803, 318, 2227, 2195, 2226, 715, 2262, 805, 808, 338, + /* 2400 */ 2228, 719, 2230, 2231, 714, 716, 709, 1580, 328, 809, + /* 2410 */ 1809, 1809, 1809, 2226, 1809, 2262, 2245, 1809, 347, 2228, + /* 2420 */ 719, 2230, 2231, 714, 1809, 709, 1809, 2227, 2195, 2226, + /* 2430 */ 715, 2262, 1809, 2245, 339, 2228, 719, 2230, 2231, 714, + /* 2440 */ 716, 709, 1809, 1809, 1809, 2195, 1809, 715, 1809, 1809, + /* 2450 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, + /* 2460 */ 1809, 1809, 1809, 1809, 2226, 1809, 2262, 1809, 2245, 353, + /* 2470 */ 2228, 719, 2230, 2231, 714, 1809, 709, 1809, 1809, 1809, + /* 2480 */ 2195, 2226, 715, 2262, 1809, 1809, 354, 2228, 719, 2230, + /* 2490 */ 2231, 714, 2227, 709, 1809, 1809, 1809, 1809, 1809, 1809, + /* 2500 */ 1809, 1809, 1809, 1809, 1809, 716, 1809, 2227, 1809, 1809, + /* 2510 */ 1809, 1809, 1809, 1809, 1809, 1809, 2226, 1809, 2262, 1809, + /* 2520 */ 716, 2239, 2228, 719, 2230, 2231, 714, 1809, 709, 2227, + /* 2530 */ 1809, 1809, 1809, 2245, 1809, 1809, 1809, 1809, 1809, 1809, + /* 2540 */ 1809, 1809, 716, 1809, 1809, 2195, 1809, 715, 2245, 1809, + /* 2550 */ 1809, 1809, 1809, 1809, 2227, 1809, 1809, 1809, 1809, 1809, + /* 2560 */ 2195, 1809, 715, 1809, 1809, 1809, 1809, 716, 1809, 1809, + /* 2570 */ 2245, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, + /* 2580 */ 1809, 2226, 2195, 2262, 715, 1809, 2238, 2228, 719, 2230, + /* 2590 */ 2231, 714, 1809, 709, 1809, 2245, 2226, 1809, 2262, 1809, + /* 2600 */ 1809, 2237, 2228, 719, 2230, 2231, 714, 2195, 709, 715, + /* 2610 */ 1809, 1809, 1809, 1809, 1809, 1809, 2227, 1809, 2226, 1809, + /* 2620 */ 2262, 1809, 1809, 368, 2228, 719, 2230, 2231, 714, 716, + /* 2630 */ 709, 1809, 1809, 1809, 2227, 1809, 1809, 1809, 1809, 1809, + /* 2640 */ 1809, 1809, 1809, 2226, 1809, 2262, 1809, 716, 369, 2228, + /* 2650 */ 719, 2230, 2231, 714, 1809, 709, 1809, 2245, 1809, 1809, + /* 2660 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 2195, + /* 2670 */ 1809, 715, 1809, 1809, 1809, 2245, 1809, 1809, 1809, 1809, + /* 2680 */ 1809, 2227, 1809, 1809, 1809, 1809, 1809, 2195, 1809, 715, + /* 2690 */ 1809, 1809, 1809, 1809, 716, 1809, 2227, 1809, 1809, 1809, + /* 2700 */ 1809, 1809, 1809, 1809, 1809, 2226, 1809, 2262, 1809, 716, + /* 2710 */ 365, 2228, 719, 2230, 2231, 714, 1809, 709, 1809, 1809, + /* 2720 */ 1809, 1809, 2245, 2226, 1809, 2262, 1809, 1809, 370, 2228, + /* 2730 */ 719, 2230, 2231, 714, 2195, 709, 715, 2245, 1809, 1809, + /* 2740 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 2195, + /* 2750 */ 1809, 715, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, + /* 2760 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, + /* 2770 */ 717, 1809, 2262, 1809, 1809, 344, 2228, 719, 2230, 2231, + /* 2780 */ 714, 1809, 709, 1809, 1809, 2226, 1809, 2262, 1809, 1809, + /* 2790 */ 343, 2228, 719, 2230, 2231, 714, 1809, 709, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 350, 343, 343, 353, 354, 350, 355, 356, 353, 354, - /* 10 */ 376, 392, 12, 13, 14, 356, 392, 2, 384, 385, - /* 20 */ 20, 0, 22, 8, 9, 391, 375, 12, 13, 14, - /* 30 */ 15, 16, 342, 399, 344, 35, 0, 37, 20, 0, - /* 40 */ 355, 21, 21, 20, 385, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 396, 396, 36, 398, 38, 39, - /* 60 */ 40, 8, 9, 398, 64, 12, 13, 14, 15, 16, - /* 70 */ 70, 0, 33, 20, 2, 410, 20, 77, 413, 414, - /* 80 */ 8, 9, 355, 356, 12, 13, 14, 15, 16, 355, - /* 90 */ 356, 432, 407, 434, 409, 355, 437, 438, 439, 440, - /* 100 */ 441, 442, 102, 444, 20, 105, 356, 416, 72, 73, - /* 110 */ 74, 75, 76, 105, 78, 79, 80, 81, 82, 83, + /* 0 */ 452, 453, 343, 376, 350, 355, 356, 353, 354, 397, + /* 10 */ 398, 384, 12, 13, 14, 356, 12, 13, 391, 392, + /* 20 */ 20, 0, 22, 8, 9, 375, 399, 12, 13, 14, + /* 30 */ 15, 16, 382, 360, 361, 35, 0, 37, 20, 355, + /* 40 */ 356, 37, 21, 384, 0, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 362, 396, 34, 398, 355, 356, + /* 60 */ 463, 8, 9, 466, 64, 12, 13, 14, 15, 16, + /* 70 */ 70, 379, 398, 20, 398, 355, 356, 77, 375, 387, + /* 80 */ 483, 484, 355, 356, 410, 488, 489, 413, 414, 413, + /* 90 */ 414, 432, 342, 434, 344, 383, 437, 438, 439, 440, + /* 100 */ 441, 442, 102, 444, 70, 105, 355, 395, 72, 73, + /* 110 */ 74, 75, 76, 86, 78, 79, 80, 81, 82, 83, /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - /* 130 */ 94, 95, 96, 97, 98, 385, 402, 69, 479, 480, - /* 140 */ 400, 141, 142, 72, 73, 74, 355, 356, 20, 351, - /* 150 */ 79, 80, 81, 355, 463, 357, 85, 466, 436, 141, - /* 160 */ 142, 90, 91, 92, 93, 69, 375, 96, 20, 115, - /* 170 */ 22, 171, 172, 382, 483, 484, 20, 177, 178, 488, - /* 180 */ 489, 105, 20, 3, 462, 37, 459, 460, 461, 439, - /* 190 */ 463, 464, 192, 466, 194, 177, 178, 436, 116, 20, - /* 200 */ 20, 8, 9, 55, 115, 12, 13, 14, 15, 16, - /* 210 */ 483, 484, 355, 356, 4, 488, 489, 135, 136, 137, - /* 220 */ 138, 139, 140, 462, 224, 225, 173, 227, 228, 229, + /* 130 */ 94, 95, 96, 97, 98, 20, 343, 20, 340, 102, + /* 140 */ 14, 141, 142, 459, 460, 461, 20, 463, 464, 490, + /* 150 */ 491, 400, 0, 116, 117, 118, 119, 120, 121, 122, + /* 160 */ 123, 124, 125, 20, 127, 128, 129, 130, 131, 132, + /* 170 */ 133, 171, 172, 146, 147, 355, 356, 177, 178, 459, + /* 180 */ 460, 461, 69, 463, 464, 0, 459, 460, 461, 396, + /* 190 */ 463, 464, 192, 466, 194, 375, 169, 463, 194, 184, + /* 200 */ 466, 8, 9, 51, 160, 12, 13, 14, 15, 16, + /* 210 */ 483, 484, 20, 169, 416, 488, 489, 350, 484, 421, + /* 220 */ 353, 354, 488, 489, 224, 225, 173, 227, 228, 229, /* 230 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 240 */ 240, 241, 242, 243, 244, 12, 13, 20, 447, 398, - /* 250 */ 18, 450, 20, 20, 165, 22, 46, 47, 48, 27, - /* 260 */ 343, 105, 30, 70, 413, 414, 365, 35, 35, 261, - /* 270 */ 37, 8, 9, 356, 373, 12, 13, 14, 15, 16, - /* 280 */ 72, 73, 74, 51, 77, 53, 106, 79, 80, 81, - /* 290 */ 58, 224, 49, 85, 355, 356, 33, 64, 90, 91, - /* 300 */ 92, 93, 385, 70, 96, 394, 113, 245, 397, 398, - /* 310 */ 77, 355, 356, 396, 375, 398, 459, 460, 461, 21, - /* 320 */ 463, 464, 24, 25, 26, 27, 28, 29, 30, 31, - /* 330 */ 32, 176, 105, 171, 172, 102, 104, 261, 105, 272, - /* 340 */ 273, 274, 275, 276, 277, 278, 372, 115, 105, 432, - /* 350 */ 343, 434, 173, 173, 437, 438, 439, 440, 441, 442, - /* 360 */ 386, 444, 20, 170, 447, 0, 449, 450, 451, 106, - /* 370 */ 396, 115, 455, 456, 141, 142, 463, 145, 77, 466, + /* 240 */ 240, 241, 242, 243, 244, 12, 13, 20, 50, 20, + /* 250 */ 18, 22, 20, 20, 69, 22, 141, 142, 224, 27, + /* 260 */ 343, 463, 30, 70, 466, 4, 37, 35, 35, 20, + /* 270 */ 37, 8, 9, 356, 170, 12, 13, 14, 15, 16, + /* 280 */ 20, 483, 484, 51, 55, 53, 488, 489, 171, 172, + /* 290 */ 58, 224, 177, 178, 20, 463, 33, 64, 466, 14, + /* 300 */ 343, 384, 287, 70, 20, 20, 113, 46, 47, 48, + /* 310 */ 77, 355, 356, 396, 394, 398, 484, 397, 398, 21, + /* 320 */ 488, 489, 24, 25, 26, 27, 28, 29, 30, 31, + /* 330 */ 32, 176, 105, 141, 142, 102, 104, 69, 105, 272, + /* 340 */ 273, 274, 275, 276, 277, 278, 372, 115, 380, 432, + /* 350 */ 343, 434, 248, 396, 437, 438, 439, 440, 441, 442, + /* 360 */ 386, 444, 258, 170, 447, 105, 449, 450, 451, 106, + /* 370 */ 396, 173, 455, 456, 141, 142, 105, 145, 180, 105, /* 380 */ 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - /* 390 */ 158, 159, 160, 161, 162, 163, 164, 484, 166, 167, - /* 400 */ 168, 488, 489, 396, 171, 172, 0, 385, 434, 435, - /* 410 */ 177, 178, 355, 356, 458, 459, 460, 461, 444, 463, - /* 420 */ 464, 399, 267, 268, 269, 192, 392, 194, 343, 4, - /* 430 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, - /* 440 */ 86, 248, 249, 250, 251, 252, 253, 254, 255, 256, - /* 450 */ 257, 258, 340, 422, 355, 356, 64, 224, 225, 402, + /* 390 */ 158, 159, 160, 161, 162, 163, 164, 429, 166, 167, + /* 400 */ 168, 355, 356, 396, 171, 172, 0, 115, 434, 435, + /* 410 */ 177, 178, 64, 4, 458, 459, 460, 461, 444, 463, + /* 420 */ 464, 375, 267, 268, 269, 192, 356, 194, 382, 355, + /* 430 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 355, + /* 440 */ 356, 248, 249, 250, 251, 252, 253, 254, 255, 256, + /* 450 */ 257, 258, 104, 245, 384, 107, 171, 224, 225, 375, /* 460 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, /* 470 */ 237, 238, 239, 240, 241, 242, 243, 244, 245, 12, - /* 480 */ 13, 396, 20, 141, 142, 343, 37, 20, 261, 22, - /* 490 */ 102, 12, 13, 14, 15, 16, 104, 14, 356, 107, - /* 500 */ 146, 147, 35, 20, 37, 117, 118, 119, 120, 121, - /* 510 */ 122, 123, 124, 125, 126, 344, 128, 129, 130, 131, - /* 520 */ 132, 133, 134, 169, 51, 160, 77, 385, 416, 383, - /* 530 */ 105, 64, 59, 421, 169, 62, 63, 70, 396, 385, - /* 540 */ 398, 395, 8, 9, 77, 391, 12, 13, 14, 15, - /* 550 */ 16, 14, 343, 399, 452, 453, 416, 20, 459, 460, - /* 560 */ 461, 421, 463, 464, 20, 356, 22, 105, 385, 102, - /* 570 */ 397, 398, 105, 355, 432, 463, 434, 343, 466, 437, - /* 580 */ 438, 439, 440, 441, 442, 373, 444, 404, 405, 343, - /* 590 */ 356, 449, 358, 451, 385, 483, 484, 455, 456, 55, - /* 600 */ 488, 489, 245, 463, 247, 396, 466, 398, 141, 142, - /* 610 */ 8, 9, 470, 376, 12, 13, 14, 15, 16, 385, - /* 620 */ 478, 384, 385, 483, 484, 407, 0, 409, 488, 489, - /* 630 */ 396, 463, 398, 492, 466, 355, 356, 393, 171, 172, - /* 640 */ 396, 432, 396, 434, 177, 178, 437, 438, 439, 440, - /* 650 */ 441, 442, 484, 444, 171, 375, 488, 489, 449, 192, - /* 660 */ 451, 194, 382, 351, 455, 456, 432, 355, 434, 357, - /* 670 */ 406, 437, 438, 439, 440, 441, 442, 51, 444, 355, - /* 680 */ 356, 56, 57, 449, 355, 451, 261, 478, 475, 455, - /* 690 */ 456, 224, 225, 416, 227, 228, 229, 230, 231, 232, + /* 480 */ 13, 407, 362, 409, 20, 343, 22, 20, 261, 22, + /* 490 */ 134, 135, 136, 137, 138, 139, 140, 351, 356, 105, + /* 500 */ 51, 355, 35, 357, 37, 343, 372, 387, 59, 439, + /* 510 */ 4, 62, 63, 77, 105, 72, 73, 74, 356, 55, + /* 520 */ 386, 261, 79, 80, 81, 19, 384, 115, 85, 384, + /* 530 */ 396, 64, 261, 90, 91, 92, 93, 70, 396, 96, + /* 540 */ 398, 35, 355, 356, 77, 376, 384, 384, 21, 404, + /* 550 */ 405, 136, 77, 384, 391, 140, 447, 51, 396, 450, + /* 560 */ 398, 392, 399, 36, 58, 38, 39, 40, 434, 102, + /* 570 */ 64, 115, 105, 355, 432, 37, 434, 343, 444, 437, + /* 580 */ 438, 439, 440, 441, 442, 191, 444, 193, 364, 402, + /* 590 */ 356, 449, 358, 451, 432, 343, 434, 455, 456, 437, + /* 600 */ 438, 439, 440, 441, 442, 381, 444, 105, 141, 142, + /* 610 */ 104, 385, 470, 107, 390, 77, 201, 223, 384, 204, + /* 620 */ 478, 165, 207, 3, 209, 407, 463, 409, 384, 466, + /* 630 */ 396, 343, 398, 12, 13, 14, 15, 16, 171, 172, + /* 640 */ 20, 479, 480, 399, 177, 178, 483, 484, 396, 376, + /* 650 */ 351, 488, 489, 373, 355, 261, 357, 384, 42, 192, + /* 660 */ 0, 194, 355, 356, 22, 392, 432, 436, 434, 365, + /* 670 */ 261, 437, 438, 439, 440, 441, 442, 373, 444, 37, + /* 680 */ 355, 356, 375, 449, 396, 451, 14, 15, 16, 455, + /* 690 */ 456, 224, 225, 462, 227, 228, 229, 230, 231, 232, /* 700 */ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - /* 710 */ 243, 244, 12, 13, 14, 385, 0, 343, 184, 22, - /* 720 */ 20, 391, 22, 261, 4, 33, 402, 364, 343, 399, - /* 730 */ 356, 385, 358, 481, 37, 35, 407, 37, 409, 19, - /* 740 */ 463, 8, 9, 466, 381, 12, 13, 14, 15, 16, - /* 750 */ 105, 405, 187, 390, 343, 35, 355, 356, 50, 385, - /* 760 */ 483, 484, 355, 356, 64, 488, 489, 356, 355, 356, - /* 770 */ 396, 51, 398, 380, 77, 173, 375, 77, 58, 214, - /* 780 */ 215, 396, 375, 385, 64, 69, 8, 9, 375, 391, - /* 790 */ 12, 13, 14, 15, 16, 22, 385, 399, 106, 102, - /* 800 */ 355, 356, 102, 362, 343, 105, 432, 396, 434, 398, - /* 810 */ 37, 437, 438, 439, 440, 441, 442, 356, 444, 359, - /* 820 */ 375, 287, 429, 449, 104, 451, 376, 107, 387, 455, - /* 830 */ 456, 12, 13, 385, 384, 385, 191, 343, 193, 106, - /* 840 */ 372, 141, 142, 432, 0, 434, 385, 372, 437, 438, - /* 850 */ 439, 440, 441, 442, 0, 444, 37, 396, 343, 398, - /* 860 */ 18, 376, 451, 360, 361, 23, 455, 456, 223, 384, - /* 870 */ 385, 171, 172, 385, 448, 102, 450, 177, 178, 391, - /* 880 */ 0, 173, 40, 41, 106, 33, 44, 399, 180, 192, - /* 890 */ 396, 194, 192, 432, 194, 434, 54, 45, 437, 438, - /* 900 */ 439, 440, 441, 442, 116, 444, 261, 65, 66, 67, - /* 910 */ 68, 396, 451, 448, 14, 450, 455, 456, 135, 136, - /* 920 */ 20, 224, 225, 140, 224, 225, 138, 227, 228, 229, + /* 710 */ 243, 244, 12, 13, 14, 355, 64, 343, 416, 77, + /* 720 */ 20, 187, 22, 421, 135, 136, 106, 402, 416, 140, + /* 730 */ 356, 384, 72, 73, 74, 35, 384, 37, 391, 79, + /* 740 */ 80, 81, 355, 356, 102, 85, 399, 372, 214, 215, + /* 750 */ 90, 91, 92, 93, 355, 356, 96, 405, 384, 107, + /* 760 */ 416, 386, 375, 261, 64, 463, 384, 407, 466, 409, + /* 770 */ 396, 396, 398, 391, 375, 463, 14, 77, 466, 355, + /* 780 */ 356, 399, 20, 355, 356, 483, 484, 385, 355, 356, + /* 790 */ 488, 489, 135, 173, 422, 483, 484, 56, 57, 375, + /* 800 */ 488, 489, 102, 375, 343, 105, 432, 463, 434, 434, + /* 810 */ 466, 437, 438, 439, 440, 441, 442, 356, 444, 444, + /* 820 */ 355, 356, 134, 449, 384, 451, 138, 483, 484, 455, + /* 830 */ 456, 391, 488, 489, 192, 402, 194, 0, 385, 399, + /* 840 */ 375, 141, 142, 8, 9, 384, 22, 12, 13, 14, + /* 850 */ 15, 16, 478, 355, 356, 355, 356, 396, 343, 398, + /* 860 */ 18, 37, 205, 206, 14, 23, 224, 225, 355, 356, + /* 870 */ 20, 171, 172, 375, 384, 375, 260, 177, 178, 0, + /* 880 */ 436, 391, 40, 41, 355, 356, 44, 344, 375, 399, + /* 890 */ 1, 2, 192, 432, 194, 434, 54, 364, 437, 438, + /* 900 */ 439, 440, 441, 442, 375, 444, 462, 65, 66, 67, + /* 910 */ 68, 396, 451, 343, 8, 9, 455, 456, 12, 13, + /* 920 */ 14, 15, 16, 390, 224, 225, 102, 227, 228, 229, /* 930 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 940 */ 240, 241, 242, 243, 244, 12, 13, 105, 415, 355, - /* 950 */ 356, 463, 343, 20, 466, 22, 14, 15, 16, 343, - /* 960 */ 116, 3, 1, 2, 436, 356, 355, 356, 35, 375, - /* 970 */ 37, 483, 484, 355, 356, 393, 488, 489, 396, 135, - /* 980 */ 136, 137, 138, 139, 140, 143, 375, 343, 355, 356, - /* 990 */ 462, 355, 356, 375, 385, 385, 116, 64, 135, 364, - /* 1000 */ 356, 391, 358, 355, 356, 396, 13, 398, 375, 399, - /* 1010 */ 77, 375, 396, 194, 4, 135, 136, 137, 138, 139, - /* 1020 */ 140, 39, 40, 375, 343, 390, 184, 185, 186, 385, - /* 1030 */ 37, 189, 355, 356, 359, 102, 170, 343, 105, 354, - /* 1040 */ 396, 432, 398, 434, 202, 203, 437, 438, 439, 440, - /* 1050 */ 441, 442, 375, 444, 393, 213, 372, 396, 216, 355, - /* 1060 */ 356, 219, 220, 221, 222, 223, 416, 106, 205, 206, - /* 1070 */ 386, 171, 218, 372, 141, 142, 432, 396, 434, 375, - /* 1080 */ 396, 437, 438, 439, 440, 441, 442, 386, 444, 480, - /* 1090 */ 396, 109, 110, 449, 112, 451, 406, 396, 116, 455, - /* 1100 */ 456, 355, 356, 261, 171, 172, 355, 356, 360, 361, - /* 1110 */ 177, 178, 362, 463, 248, 208, 466, 210, 434, 136, - /* 1120 */ 138, 375, 42, 140, 258, 192, 375, 194, 444, 379, - /* 1130 */ 343, 355, 356, 483, 484, 434, 33, 387, 488, 489, - /* 1140 */ 343, 22, 8, 9, 343, 444, 12, 13, 14, 15, - /* 1150 */ 16, 375, 356, 356, 37, 343, 37, 224, 225, 343, + /* 940 */ 240, 241, 242, 243, 244, 12, 13, 105, 33, 355, + /* 950 */ 356, 343, 343, 20, 343, 22, 8, 9, 355, 356, + /* 960 */ 12, 13, 14, 15, 16, 20, 396, 35, 35, 375, + /* 970 */ 37, 134, 135, 136, 137, 138, 139, 140, 375, 343, + /* 980 */ 355, 356, 376, 51, 3, 143, 355, 356, 343, 343, + /* 990 */ 384, 59, 60, 61, 62, 106, 64, 64, 392, 416, + /* 1000 */ 375, 356, 0, 358, 396, 396, 375, 396, 173, 245, + /* 1010 */ 77, 247, 106, 134, 135, 136, 137, 138, 139, 140, + /* 1020 */ 343, 171, 22, 343, 436, 343, 184, 185, 186, 384, + /* 1030 */ 4, 189, 396, 360, 361, 102, 104, 37, 105, 107, + /* 1040 */ 343, 396, 396, 398, 202, 203, 463, 369, 370, 466, + /* 1050 */ 462, 20, 384, 356, 106, 213, 369, 370, 216, 343, + /* 1060 */ 392, 219, 220, 221, 222, 223, 483, 484, 346, 347, + /* 1070 */ 20, 488, 489, 396, 141, 142, 396, 432, 396, 434, + /* 1080 */ 385, 384, 437, 438, 439, 440, 441, 442, 33, 444, + /* 1090 */ 343, 343, 343, 396, 449, 398, 451, 448, 385, 450, + /* 1100 */ 455, 456, 102, 261, 171, 172, 174, 175, 20, 2, + /* 1110 */ 177, 178, 396, 181, 182, 8, 9, 37, 173, 12, + /* 1120 */ 13, 14, 15, 16, 448, 192, 450, 194, 37, 432, + /* 1130 */ 393, 434, 200, 396, 437, 438, 439, 440, 441, 442, + /* 1140 */ 416, 444, 33, 396, 396, 396, 449, 393, 451, 0, + /* 1150 */ 396, 385, 455, 456, 39, 40, 393, 224, 225, 396, /* 1160 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, /* 1170 */ 237, 238, 239, 240, 241, 242, 243, 244, 12, 13, - /* 1180 */ 369, 370, 385, 396, 201, 14, 20, 204, 22, 35, - /* 1190 */ 207, 20, 209, 396, 343, 398, 343, 396, 20, 12, - /* 1200 */ 13, 35, 343, 37, 343, 51, 20, 463, 396, 22, - /* 1210 */ 466, 20, 396, 59, 60, 61, 62, 356, 64, 358, - /* 1220 */ 377, 102, 35, 380, 37, 343, 343, 483, 484, 432, - /* 1230 */ 64, 434, 488, 489, 437, 438, 439, 440, 441, 442, - /* 1240 */ 282, 444, 0, 77, 369, 370, 385, 396, 451, 396, - /* 1250 */ 33, 64, 455, 456, 406, 396, 37, 396, 104, 398, - /* 1260 */ 0, 107, 384, 385, 77, 384, 385, 70, 102, 384, - /* 1270 */ 385, 105, 343, 263, 416, 384, 385, 33, 396, 396, - /* 1280 */ 384, 385, 22, 371, 42, 356, 374, 358, 395, 102, - /* 1290 */ 346, 347, 33, 432, 465, 434, 259, 260, 437, 438, - /* 1300 */ 439, 440, 441, 442, 45, 444, 108, 141, 142, 111, - /* 1310 */ 449, 194, 451, 33, 385, 13, 455, 456, 47, 48, - /* 1320 */ 108, 463, 64, 111, 466, 396, 485, 398, 174, 175, - /* 1330 */ 108, 0, 264, 111, 0, 181, 182, 171, 172, 37, - /* 1340 */ 260, 483, 484, 177, 178, 108, 488, 489, 111, 33, - /* 1350 */ 106, 173, 457, 22, 200, 105, 22, 469, 192, 173, - /* 1360 */ 194, 432, 171, 434, 114, 107, 437, 438, 439, 440, - /* 1370 */ 441, 442, 33, 444, 33, 141, 142, 33, 449, 192, - /* 1380 */ 451, 194, 33, 37, 455, 456, 106, 284, 33, 0, - /* 1390 */ 224, 225, 33, 227, 228, 229, 230, 231, 232, 233, + /* 1180 */ 377, 371, 33, 380, 374, 385, 20, 463, 22, 0, + /* 1190 */ 466, 47, 48, 259, 260, 141, 142, 33, 33, 284, + /* 1200 */ 33, 35, 171, 37, 343, 1, 2, 483, 484, 45, + /* 1210 */ 45, 108, 488, 489, 111, 106, 481, 356, 108, 358, + /* 1220 */ 218, 111, 13, 173, 109, 110, 13, 112, 406, 108, + /* 1230 */ 64, 42, 111, 8, 9, 492, 33, 12, 13, 14, + /* 1240 */ 15, 16, 0, 77, 108, 384, 37, 111, 0, 134, + /* 1250 */ 37, 343, 208, 138, 210, 33, 33, 396, 359, 398, + /* 1260 */ 475, 173, 0, 282, 356, 0, 358, 49, 102, 2, + /* 1270 */ 22, 105, 372, 106, 194, 8, 9, 105, 343, 12, + /* 1280 */ 13, 14, 15, 16, 22, 194, 114, 22, 372, 263, + /* 1290 */ 37, 356, 384, 432, 52, 434, 13, 13, 437, 438, + /* 1300 */ 439, 440, 441, 442, 396, 444, 398, 141, 142, 106, + /* 1310 */ 449, 384, 451, 415, 33, 33, 455, 456, 359, 384, + /* 1320 */ 37, 37, 354, 105, 406, 356, 395, 406, 106, 106, + /* 1330 */ 77, 396, 465, 398, 485, 457, 468, 171, 172, 33, + /* 1340 */ 432, 286, 434, 177, 178, 437, 438, 439, 440, 441, + /* 1350 */ 442, 33, 444, 264, 417, 51, 433, 449, 192, 451, + /* 1360 */ 194, 12, 13, 455, 456, 33, 20, 432, 426, 434, + /* 1370 */ 343, 22, 437, 438, 439, 440, 441, 442, 443, 444, + /* 1380 */ 445, 446, 207, 356, 35, 358, 37, 106, 106, 431, + /* 1390 */ 224, 225, 364, 227, 228, 229, 230, 231, 232, 233, /* 1400 */ 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - /* 1410 */ 244, 224, 225, 194, 33, 33, 1, 2, 343, 33, - /* 1420 */ 33, 224, 106, 77, 237, 238, 239, 240, 241, 242, - /* 1430 */ 243, 356, 417, 358, 51, 13, 433, 33, 33, 13, - /* 1440 */ 20, 52, 426, 343, 431, 106, 207, 106, 364, 33, - /* 1450 */ 106, 426, 33, 364, 33, 106, 356, 190, 419, 37, - /* 1460 */ 385, 106, 33, 37, 20, 106, 356, 403, 45, 20, - /* 1470 */ 356, 396, 406, 398, 403, 170, 20, 401, 355, 401, - /* 1480 */ 356, 355, 403, 401, 368, 385, 101, 106, 106, 367, - /* 1490 */ 355, 103, 106, 106, 100, 366, 396, 355, 398, 355, - /* 1500 */ 355, 20, 50, 286, 348, 343, 348, 432, 20, 434, - /* 1510 */ 106, 106, 437, 438, 439, 440, 441, 442, 356, 444, - /* 1520 */ 352, 352, 106, 426, 449, 106, 451, 106, 364, 398, - /* 1530 */ 455, 456, 432, 20, 434, 106, 364, 437, 438, 439, - /* 1540 */ 440, 441, 442, 20, 444, 357, 418, 385, 364, 449, - /* 1550 */ 357, 451, 348, 364, 364, 455, 456, 355, 396, 364, - /* 1560 */ 398, 385, 385, 364, 385, 385, 343, 385, 385, 355, - /* 1570 */ 385, 346, 346, 211, 105, 348, 430, 396, 428, 356, - /* 1580 */ 362, 426, 198, 362, 425, 424, 423, 197, 396, 196, - /* 1590 */ 396, 417, 343, 355, 432, 271, 434, 270, 398, 437, - /* 1600 */ 438, 439, 440, 441, 442, 356, 444, 406, 385, 406, - /* 1610 */ 474, 449, 396, 451, 474, 279, 343, 455, 456, 396, - /* 1620 */ 411, 398, 411, 183, 396, 396, 396, 474, 477, 356, - /* 1630 */ 265, 281, 280, 476, 385, 288, 493, 417, 473, 472, - /* 1640 */ 356, 471, 285, 343, 283, 396, 486, 398, 20, 436, - /* 1650 */ 115, 260, 357, 362, 262, 432, 356, 434, 385, 362, - /* 1660 */ 437, 438, 439, 440, 441, 442, 20, 444, 411, 396, - /* 1670 */ 409, 398, 449, 468, 451, 467, 411, 396, 455, 456, - /* 1680 */ 175, 432, 396, 434, 396, 385, 437, 438, 439, 440, - /* 1690 */ 441, 442, 443, 444, 445, 446, 396, 487, 398, 396, - /* 1700 */ 396, 408, 396, 380, 362, 432, 105, 434, 454, 356, - /* 1710 */ 437, 438, 439, 440, 441, 442, 362, 444, 105, 374, - /* 1720 */ 388, 396, 355, 343, 22, 362, 38, 349, 420, 412, - /* 1730 */ 412, 363, 432, 0, 434, 0, 356, 437, 438, 439, - /* 1740 */ 440, 441, 442, 345, 444, 343, 427, 348, 378, 378, - /* 1750 */ 378, 451, 341, 0, 45, 0, 456, 37, 356, 217, - /* 1760 */ 37, 37, 37, 490, 491, 385, 217, 0, 37, 389, - /* 1770 */ 217, 37, 0, 343, 217, 0, 396, 37, 398, 0, - /* 1780 */ 22, 0, 37, 212, 0, 200, 356, 385, 0, 200, - /* 1790 */ 194, 389, 201, 0, 192, 0, 0, 188, 396, 187, - /* 1800 */ 398, 0, 0, 49, 0, 37, 0, 51, 49, 0, - /* 1810 */ 45, 0, 432, 0, 434, 385, 0, 437, 438, 439, - /* 1820 */ 440, 441, 442, 49, 444, 0, 396, 0, 398, 160, - /* 1830 */ 0, 37, 160, 0, 432, 0, 434, 0, 0, 437, - /* 1840 */ 438, 439, 440, 441, 442, 0, 444, 49, 0, 0, - /* 1850 */ 45, 0, 0, 343, 0, 0, 0, 0, 0, 0, - /* 1860 */ 0, 0, 432, 0, 434, 0, 356, 437, 438, 439, - /* 1870 */ 440, 441, 442, 0, 444, 343, 0, 0, 0, 0, - /* 1880 */ 0, 0, 0, 0, 22, 0, 0, 144, 356, 0, - /* 1890 */ 0, 22, 50, 22, 50, 385, 0, 0, 64, 0, - /* 1900 */ 64, 37, 0, 64, 0, 37, 396, 0, 398, 0, - /* 1910 */ 0, 37, 482, 0, 42, 45, 0, 385, 51, 14, - /* 1920 */ 0, 389, 183, 0, 0, 37, 51, 0, 396, 42, - /* 1930 */ 398, 37, 0, 42, 42, 51, 33, 0, 43, 0, - /* 1940 */ 343, 0, 432, 42, 434, 0, 0, 437, 438, 439, - /* 1950 */ 440, 441, 442, 356, 444, 49, 42, 49, 37, 0, - /* 1960 */ 49, 42, 343, 37, 432, 0, 434, 42, 51, 437, - /* 1970 */ 438, 439, 440, 441, 442, 356, 444, 37, 42, 51, - /* 1980 */ 51, 37, 385, 71, 51, 42, 0, 0, 0, 0, - /* 1990 */ 0, 37, 22, 396, 0, 398, 20, 37, 37, 37, - /* 2000 */ 37, 491, 33, 37, 385, 37, 113, 33, 389, 111, - /* 2010 */ 37, 0, 37, 343, 37, 396, 37, 398, 22, 0, - /* 2020 */ 22, 22, 0, 22, 53, 0, 356, 343, 37, 432, - /* 2030 */ 0, 434, 0, 0, 437, 438, 439, 440, 441, 442, - /* 2040 */ 356, 444, 37, 446, 37, 0, 22, 37, 106, 37, - /* 2050 */ 37, 432, 105, 434, 0, 385, 437, 438, 439, 440, - /* 2060 */ 441, 442, 105, 444, 37, 199, 396, 0, 398, 385, - /* 2070 */ 22, 22, 0, 389, 0, 33, 3, 33, 266, 50, - /* 2080 */ 396, 50, 398, 105, 103, 101, 106, 105, 173, 106, - /* 2090 */ 33, 173, 49, 33, 33, 195, 49, 266, 106, 106, - /* 2100 */ 343, 106, 432, 106, 434, 175, 3, 437, 438, 439, - /* 2110 */ 440, 441, 442, 356, 444, 33, 432, 179, 434, 105, - /* 2120 */ 1, 437, 438, 439, 440, 441, 442, 179, 444, 173, - /* 2130 */ 37, 173, 37, 105, 37, 37, 37, 37, 19, 105, - /* 2140 */ 105, 49, 385, 106, 106, 33, 0, 0, 42, 0, - /* 2150 */ 49, 105, 42, 396, 35, 398, 49, 105, 343, 106, - /* 2160 */ 49, 106, 33, 105, 114, 2, 22, 105, 105, 105, - /* 2170 */ 51, 356, 343, 103, 103, 224, 176, 174, 59, 60, - /* 2180 */ 61, 62, 105, 64, 106, 356, 105, 49, 105, 432, - /* 2190 */ 343, 434, 106, 259, 437, 438, 439, 440, 441, 442, - /* 2200 */ 385, 444, 106, 356, 49, 22, 115, 105, 37, 105, - /* 2210 */ 246, 396, 37, 398, 385, 37, 266, 37, 37, 106, - /* 2220 */ 105, 37, 106, 104, 106, 396, 107, 398, 226, 105, - /* 2230 */ 105, 105, 385, 106, 106, 105, 37, 106, 105, 22, - /* 2240 */ 106, 105, 33, 396, 127, 398, 105, 432, 127, 434, - /* 2250 */ 105, 37, 437, 438, 439, 440, 441, 442, 139, 444, - /* 2260 */ 22, 432, 127, 434, 127, 343, 437, 438, 439, 440, - /* 2270 */ 441, 442, 116, 444, 105, 71, 70, 37, 356, 432, - /* 2280 */ 37, 434, 37, 37, 437, 438, 439, 440, 441, 442, - /* 2290 */ 77, 444, 343, 174, 37, 37, 37, 37, 33, 99, - /* 2300 */ 181, 37, 22, 37, 37, 356, 37, 385, 37, 37, - /* 2310 */ 77, 37, 37, 37, 37, 343, 37, 22, 396, 200, - /* 2320 */ 398, 37, 0, 37, 51, 42, 0, 37, 356, 51, - /* 2330 */ 42, 0, 51, 37, 385, 42, 0, 37, 51, 42, - /* 2340 */ 0, 37, 37, 0, 33, 396, 22, 398, 20, 22, - /* 2350 */ 21, 21, 343, 494, 432, 22, 434, 385, 494, 437, - /* 2360 */ 438, 439, 440, 441, 442, 356, 444, 22, 396, 494, - /* 2370 */ 398, 494, 494, 494, 494, 494, 494, 494, 494, 343, - /* 2380 */ 494, 432, 494, 434, 494, 494, 437, 438, 439, 440, - /* 2390 */ 441, 442, 356, 444, 385, 494, 494, 494, 494, 494, - /* 2400 */ 494, 494, 343, 494, 432, 396, 434, 398, 494, 437, - /* 2410 */ 438, 439, 440, 441, 442, 356, 444, 494, 494, 494, - /* 2420 */ 494, 385, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2430 */ 494, 494, 396, 494, 398, 494, 494, 494, 494, 494, - /* 2440 */ 494, 432, 494, 434, 385, 494, 437, 438, 439, 440, - /* 2450 */ 441, 442, 343, 444, 494, 396, 494, 398, 494, 494, - /* 2460 */ 494, 494, 494, 494, 494, 356, 343, 494, 432, 494, - /* 2470 */ 434, 494, 494, 437, 438, 439, 440, 441, 442, 356, - /* 2480 */ 444, 494, 343, 494, 494, 494, 494, 494, 494, 494, - /* 2490 */ 494, 432, 494, 434, 385, 356, 437, 438, 439, 440, - /* 2500 */ 441, 442, 494, 444, 494, 396, 494, 398, 385, 494, - /* 2510 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 396, - /* 2520 */ 494, 398, 494, 494, 385, 494, 494, 494, 494, 494, - /* 2530 */ 494, 494, 494, 494, 494, 396, 494, 398, 494, 494, - /* 2540 */ 494, 432, 494, 434, 494, 343, 437, 438, 439, 440, - /* 2550 */ 441, 442, 494, 444, 494, 432, 494, 434, 356, 494, - /* 2560 */ 437, 438, 439, 440, 441, 442, 494, 444, 494, 343, - /* 2570 */ 494, 432, 494, 434, 494, 494, 437, 438, 439, 440, - /* 2580 */ 441, 442, 356, 444, 494, 494, 494, 385, 494, 494, - /* 2590 */ 494, 494, 494, 494, 494, 494, 343, 494, 396, 494, - /* 2600 */ 398, 494, 494, 494, 494, 494, 494, 494, 494, 356, - /* 2610 */ 494, 385, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2620 */ 494, 494, 396, 494, 398, 494, 494, 494, 494, 494, - /* 2630 */ 494, 494, 494, 494, 432, 494, 434, 494, 385, 437, - /* 2640 */ 438, 439, 440, 441, 442, 494, 444, 494, 494, 396, - /* 2650 */ 494, 398, 494, 494, 494, 494, 494, 494, 432, 343, - /* 2660 */ 434, 494, 494, 437, 438, 439, 440, 441, 442, 494, - /* 2670 */ 444, 494, 356, 494, 494, 494, 494, 494, 494, 494, - /* 2680 */ 494, 494, 494, 494, 494, 432, 494, 434, 494, 343, - /* 2690 */ 437, 438, 439, 440, 441, 442, 494, 444, 494, 494, - /* 2700 */ 494, 385, 356, 494, 494, 494, 494, 494, 494, 343, - /* 2710 */ 494, 494, 396, 494, 398, 494, 494, 494, 494, 494, - /* 2720 */ 494, 494, 356, 494, 494, 494, 494, 494, 494, 494, - /* 2730 */ 494, 385, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2740 */ 494, 494, 396, 494, 398, 494, 494, 494, 432, 494, - /* 2750 */ 434, 385, 494, 437, 438, 439, 440, 441, 442, 343, - /* 2760 */ 444, 494, 396, 494, 398, 494, 494, 494, 494, 494, - /* 2770 */ 494, 494, 356, 494, 494, 494, 343, 494, 432, 494, - /* 2780 */ 434, 494, 494, 437, 438, 439, 440, 441, 442, 356, - /* 2790 */ 444, 494, 494, 494, 494, 494, 494, 494, 432, 494, - /* 2800 */ 434, 385, 494, 437, 438, 439, 440, 441, 442, 494, - /* 2810 */ 444, 494, 396, 494, 398, 494, 494, 494, 385, 494, - /* 2820 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 396, - /* 2830 */ 494, 398, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2840 */ 494, 494, 494, 494, 494, 494, 494, 494, 432, 494, - /* 2850 */ 434, 494, 494, 437, 438, 439, 440, 441, 442, 494, - /* 2860 */ 444, 494, 494, 494, 494, 432, 494, 434, 494, 494, - /* 2870 */ 437, 438, 439, 440, 441, 442, 494, 444, 340, 340, + /* 1410 */ 244, 384, 106, 64, 33, 33, 426, 33, 33, 343, + /* 1420 */ 33, 364, 33, 396, 106, 398, 77, 33, 33, 33, + /* 1430 */ 33, 190, 356, 419, 358, 20, 45, 356, 106, 343, + /* 1440 */ 403, 20, 406, 356, 403, 170, 401, 355, 20, 356, + /* 1450 */ 355, 102, 356, 401, 403, 103, 101, 401, 368, 432, + /* 1460 */ 384, 434, 20, 355, 437, 438, 439, 440, 441, 442, + /* 1470 */ 100, 444, 396, 367, 398, 355, 449, 366, 451, 355, + /* 1480 */ 384, 355, 455, 456, 50, 348, 352, 106, 106, 348, + /* 1490 */ 106, 106, 396, 106, 398, 106, 426, 352, 20, 364, + /* 1500 */ 106, 106, 106, 106, 364, 20, 20, 357, 432, 357, + /* 1510 */ 434, 398, 418, 437, 438, 439, 440, 441, 442, 364, + /* 1520 */ 444, 364, 364, 364, 355, 449, 364, 451, 432, 348, + /* 1530 */ 434, 455, 456, 437, 438, 439, 440, 441, 442, 355, + /* 1540 */ 444, 192, 346, 194, 384, 449, 346, 451, 211, 348, + /* 1550 */ 396, 455, 456, 430, 384, 384, 105, 384, 384, 396, + /* 1560 */ 384, 384, 384, 343, 384, 426, 384, 384, 362, 198, + /* 1570 */ 428, 425, 197, 224, 225, 396, 356, 424, 362, 196, + /* 1580 */ 271, 355, 396, 398, 423, 417, 237, 238, 239, 240, + /* 1590 */ 241, 242, 243, 406, 406, 343, 474, 270, 396, 474, + /* 1600 */ 279, 411, 411, 396, 384, 477, 396, 183, 356, 476, + /* 1610 */ 281, 280, 474, 265, 471, 343, 396, 487, 398, 285, + /* 1620 */ 473, 288, 417, 472, 493, 283, 260, 356, 356, 20, + /* 1630 */ 436, 115, 362, 357, 486, 262, 384, 20, 409, 362, + /* 1640 */ 396, 411, 343, 396, 411, 396, 396, 396, 396, 175, + /* 1650 */ 398, 396, 432, 408, 434, 356, 384, 437, 438, 439, + /* 1660 */ 440, 441, 442, 362, 444, 467, 469, 380, 396, 449, + /* 1670 */ 398, 451, 362, 356, 105, 455, 456, 105, 454, 388, + /* 1680 */ 355, 396, 374, 384, 432, 362, 434, 22, 345, 437, + /* 1690 */ 438, 439, 440, 441, 442, 396, 444, 398, 38, 349, + /* 1700 */ 420, 348, 412, 451, 432, 343, 434, 455, 456, 437, + /* 1710 */ 438, 439, 440, 441, 442, 427, 444, 412, 356, 378, + /* 1720 */ 363, 343, 378, 451, 0, 378, 0, 455, 456, 341, + /* 1730 */ 0, 432, 45, 434, 356, 0, 437, 438, 439, 440, + /* 1740 */ 441, 442, 37, 444, 217, 37, 384, 37, 37, 217, + /* 1750 */ 451, 0, 343, 37, 37, 456, 217, 0, 396, 217, + /* 1760 */ 398, 0, 384, 0, 37, 356, 22, 389, 0, 37, + /* 1770 */ 343, 212, 0, 200, 396, 0, 398, 200, 194, 201, + /* 1780 */ 192, 0, 0, 356, 0, 188, 187, 0, 0, 0, + /* 1790 */ 49, 37, 0, 384, 432, 0, 434, 51, 389, 437, + /* 1800 */ 438, 439, 440, 441, 442, 396, 444, 398, 49, 45, + /* 1810 */ 432, 384, 434, 0, 0, 437, 438, 439, 440, 441, + /* 1820 */ 442, 0, 444, 396, 0, 398, 49, 0, 0, 0, + /* 1830 */ 0, 0, 160, 37, 0, 160, 0, 0, 0, 0, + /* 1840 */ 0, 432, 480, 434, 0, 0, 437, 438, 439, 440, + /* 1850 */ 441, 442, 0, 444, 0, 0, 0, 343, 49, 432, + /* 1860 */ 0, 434, 0, 0, 437, 438, 439, 440, 441, 442, + /* 1870 */ 356, 444, 343, 0, 0, 0, 0, 45, 0, 0, + /* 1880 */ 0, 0, 0, 22, 0, 356, 0, 343, 0, 144, + /* 1890 */ 0, 0, 22, 50, 22, 0, 50, 64, 384, 0, + /* 1900 */ 356, 37, 0, 0, 0, 64, 37, 42, 51, 482, + /* 1910 */ 396, 64, 398, 384, 0, 0, 0, 51, 389, 42, + /* 1920 */ 37, 0, 37, 14, 0, 396, 0, 398, 384, 37, + /* 1930 */ 33, 42, 0, 0, 343, 42, 183, 0, 51, 45, + /* 1940 */ 396, 43, 398, 0, 0, 49, 432, 356, 434, 49, + /* 1950 */ 49, 437, 438, 439, 440, 441, 442, 0, 444, 343, + /* 1960 */ 42, 432, 42, 434, 0, 37, 437, 438, 439, 440, + /* 1970 */ 441, 442, 356, 444, 51, 384, 432, 71, 434, 0, + /* 1980 */ 389, 437, 438, 439, 440, 441, 442, 396, 444, 398, + /* 1990 */ 446, 42, 37, 51, 42, 0, 343, 37, 51, 0, + /* 2000 */ 384, 42, 37, 42, 51, 491, 0, 0, 0, 356, + /* 2010 */ 0, 0, 396, 0, 398, 37, 22, 0, 113, 111, + /* 2020 */ 37, 37, 37, 432, 37, 434, 37, 37, 437, 438, + /* 2030 */ 439, 440, 441, 442, 0, 444, 33, 384, 37, 37, + /* 2040 */ 22, 37, 389, 22, 0, 33, 37, 22, 432, 396, + /* 2050 */ 434, 398, 0, 437, 438, 439, 440, 441, 442, 22, + /* 2060 */ 444, 37, 343, 0, 0, 0, 37, 53, 0, 0, + /* 2070 */ 37, 20, 22, 37, 106, 356, 37, 37, 105, 0, + /* 2080 */ 173, 105, 37, 343, 22, 432, 0, 434, 22, 1, + /* 2090 */ 437, 438, 439, 440, 441, 442, 356, 444, 173, 0, + /* 2100 */ 0, 179, 175, 384, 173, 3, 33, 19, 195, 173, + /* 2110 */ 199, 106, 3, 179, 343, 396, 266, 398, 33, 49, + /* 2120 */ 105, 105, 50, 35, 384, 103, 50, 356, 101, 106, + /* 2130 */ 33, 33, 106, 105, 33, 105, 396, 106, 398, 51, + /* 2140 */ 105, 49, 37, 105, 33, 37, 33, 59, 60, 61, + /* 2150 */ 62, 432, 64, 434, 106, 384, 437, 438, 439, 440, + /* 2160 */ 441, 442, 106, 444, 37, 37, 37, 396, 37, 398, + /* 2170 */ 49, 259, 432, 106, 434, 49, 0, 437, 438, 439, + /* 2180 */ 440, 441, 442, 266, 444, 343, 106, 0, 105, 42, + /* 2190 */ 49, 0, 104, 106, 105, 107, 266, 106, 356, 105, + /* 2200 */ 105, 343, 42, 432, 114, 434, 49, 33, 437, 438, + /* 2210 */ 439, 440, 441, 442, 356, 444, 174, 176, 246, 105, + /* 2220 */ 105, 103, 103, 2, 22, 105, 384, 139, 106, 105, + /* 2230 */ 49, 106, 49, 37, 22, 105, 37, 105, 396, 106, + /* 2240 */ 398, 105, 384, 224, 106, 105, 226, 37, 106, 115, + /* 2250 */ 105, 37, 106, 343, 396, 105, 398, 106, 105, 37, + /* 2260 */ 106, 105, 174, 37, 106, 106, 356, 105, 37, 181, + /* 2270 */ 105, 105, 343, 33, 432, 105, 434, 105, 126, 437, + /* 2280 */ 438, 439, 440, 441, 442, 356, 444, 126, 200, 126, + /* 2290 */ 432, 37, 434, 126, 384, 437, 438, 439, 440, 441, + /* 2300 */ 442, 22, 444, 71, 70, 343, 396, 37, 398, 37, + /* 2310 */ 77, 37, 37, 384, 37, 37, 99, 37, 356, 37, + /* 2320 */ 33, 37, 37, 37, 343, 396, 22, 398, 77, 37, + /* 2330 */ 37, 37, 37, 37, 37, 37, 37, 356, 22, 37, + /* 2340 */ 343, 0, 432, 37, 434, 42, 384, 437, 438, 439, + /* 2350 */ 440, 441, 442, 356, 444, 0, 51, 37, 396, 51, + /* 2360 */ 398, 432, 0, 434, 42, 384, 437, 438, 439, 440, + /* 2370 */ 441, 442, 37, 444, 51, 343, 42, 396, 0, 398, + /* 2380 */ 37, 384, 51, 0, 42, 37, 37, 0, 356, 22, + /* 2390 */ 33, 22, 343, 396, 432, 398, 434, 21, 21, 437, + /* 2400 */ 438, 439, 440, 441, 442, 356, 444, 22, 22, 20, + /* 2410 */ 494, 494, 494, 432, 494, 434, 384, 494, 437, 438, + /* 2420 */ 439, 440, 441, 442, 494, 444, 494, 343, 396, 432, + /* 2430 */ 398, 434, 494, 384, 437, 438, 439, 440, 441, 442, + /* 2440 */ 356, 444, 494, 494, 494, 396, 494, 398, 494, 494, + /* 2450 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, + /* 2460 */ 494, 494, 494, 494, 432, 494, 434, 494, 384, 437, + /* 2470 */ 438, 439, 440, 441, 442, 494, 444, 494, 494, 494, + /* 2480 */ 396, 432, 398, 434, 494, 494, 437, 438, 439, 440, + /* 2490 */ 441, 442, 343, 444, 494, 494, 494, 494, 494, 494, + /* 2500 */ 494, 494, 494, 494, 494, 356, 494, 343, 494, 494, + /* 2510 */ 494, 494, 494, 494, 494, 494, 432, 494, 434, 494, + /* 2520 */ 356, 437, 438, 439, 440, 441, 442, 494, 444, 343, + /* 2530 */ 494, 494, 494, 384, 494, 494, 494, 494, 494, 494, + /* 2540 */ 494, 494, 356, 494, 494, 396, 494, 398, 384, 494, + /* 2550 */ 494, 494, 494, 494, 343, 494, 494, 494, 494, 494, + /* 2560 */ 396, 494, 398, 494, 494, 494, 494, 356, 494, 494, + /* 2570 */ 384, 494, 494, 494, 494, 494, 494, 494, 494, 494, + /* 2580 */ 494, 432, 396, 434, 398, 494, 437, 438, 439, 440, + /* 2590 */ 441, 442, 494, 444, 494, 384, 432, 494, 434, 494, + /* 2600 */ 494, 437, 438, 439, 440, 441, 442, 396, 444, 398, + /* 2610 */ 494, 494, 494, 494, 494, 494, 343, 494, 432, 494, + /* 2620 */ 434, 494, 494, 437, 438, 439, 440, 441, 442, 356, + /* 2630 */ 444, 494, 494, 494, 343, 494, 494, 494, 494, 494, + /* 2640 */ 494, 494, 494, 432, 494, 434, 494, 356, 437, 438, + /* 2650 */ 439, 440, 441, 442, 494, 444, 494, 384, 494, 494, + /* 2660 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 396, + /* 2670 */ 494, 398, 494, 494, 494, 384, 494, 494, 494, 494, + /* 2680 */ 494, 343, 494, 494, 494, 494, 494, 396, 494, 398, + /* 2690 */ 494, 494, 494, 494, 356, 494, 343, 494, 494, 494, + /* 2700 */ 494, 494, 494, 494, 494, 432, 494, 434, 494, 356, + /* 2710 */ 437, 438, 439, 440, 441, 442, 494, 444, 494, 494, + /* 2720 */ 494, 494, 384, 432, 494, 434, 494, 494, 437, 438, + /* 2730 */ 439, 440, 441, 442, 396, 444, 398, 384, 494, 494, + /* 2740 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 396, + /* 2750 */ 494, 398, 494, 494, 494, 494, 494, 494, 494, 494, + /* 2760 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, + /* 2770 */ 432, 494, 434, 494, 494, 437, 438, 439, 440, 441, + /* 2780 */ 442, 494, 444, 494, 494, 432, 494, 434, 494, 494, + /* 2790 */ 437, 438, 439, 440, 441, 442, 494, 444, 340, 340, + /* 2800 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, + /* 2810 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, + /* 2820 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, + /* 2830 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, + /* 2840 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, + /* 2850 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, + /* 2860 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, + /* 2870 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, /* 2880 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, /* 2890 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, /* 2900 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, @@ -1164,222 +1156,216 @@ static const YYCODETYPE yy_lookahead[] = { /* 3100 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, /* 3110 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, /* 3120 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3130 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3140 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3150 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3160 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3170 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3180 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3190 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3200 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3210 */ 340, 340, 340, 340, 340, 340, 340, 340, + /* 3130 */ 340, 340, 340, 340, 340, 340, 340, 340, }; -#define YY_SHIFT_COUNT (808) +#define YY_SHIFT_COUNT (810) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2345) +#define YY_SHIFT_MAX (2389) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 842, 0, 233, 0, 467, 467, 467, 467, 467, 467, /* 10 */ 467, 467, 467, 467, 467, 467, 700, 933, 933, 1166, /* 20 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933, /* 30 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933, /* 40 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933, - /* 50 */ 933, 227, 462, 645, 156, 8, 76, 8, 156, 156, - /* 60 */ 8, 1187, 8, 1187, 1187, 425, 8, 23, 18, 56, - /* 70 */ 56, 18, 210, 210, 162, 342, 537, 537, 56, 56, - /* 80 */ 56, 56, 56, 56, 56, 56, 56, 56, 84, 56, - /* 90 */ 56, 68, 23, 56, 56, 128, 23, 56, 84, 56, - /* 100 */ 84, 23, 56, 56, 23, 56, 23, 23, 23, 56, - /* 110 */ 96, 232, 193, 193, 208, 298, 697, 697, 697, 697, - /* 120 */ 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, - /* 130 */ 697, 697, 697, 697, 697, 982, 180, 162, 342, 625, - /* 140 */ 625, 449, 179, 179, 179, 716, 357, 357, 449, 68, - /* 150 */ 23, 23, 23, 23, 54, 62, 23, 207, 23, 207, - /* 160 */ 207, 256, 301, 405, 388, 388, 388, 388, 2119, 71, - /* 170 */ 21, 53, 534, 67, 148, 155, 819, 819, 483, 708, - /* 180 */ 900, 544, 1178, 1271, 1171, 788, 1186, 1037, 1080, 958, - /* 190 */ 1037, 852, 1010, 1191, 1068, 1383, 1420, 1239, 68, 1420, - /* 200 */ 68, 1267, 1444, 1423, 1449, 1444, 1423, 1305, 1456, 1444, - /* 210 */ 1456, 1423, 1305, 1305, 1388, 1385, 1456, 1394, 1456, 1456, - /* 220 */ 1456, 1481, 1452, 1481, 1452, 1420, 68, 1488, 68, 1513, - /* 230 */ 1523, 68, 1513, 68, 68, 68, 1456, 68, 1481, 23, - /* 240 */ 23, 23, 23, 23, 23, 23, 1456, 405, 405, 1481, - /* 250 */ 207, 207, 207, 1362, 1469, 1420, 96, 1384, 1390, 1488, - /* 260 */ 96, 1393, 1068, 1456, 1449, 1449, 207, 1324, 1327, 207, - /* 270 */ 1324, 1327, 207, 207, 23, 1336, 1440, 1324, 1350, 1352, - /* 280 */ 1365, 1068, 1347, 1357, 1361, 1391, 1444, 1628, 1535, 1392, - /* 290 */ 1513, 96, 96, 1646, 1327, 207, 207, 207, 207, 207, - /* 300 */ 1327, 207, 1505, 96, 256, 96, 1444, 1601, 1613, 207, - /* 310 */ 301, 1456, 96, 1702, 1688, 1481, 2878, 2878, 2878, 2878, - /* 320 */ 2878, 2878, 2878, 2878, 2878, 36, 1154, 406, 263, 720, - /* 330 */ 733, 778, 844, 15, 72, 602, 880, 1134, 1134, 1134, - /* 340 */ 1134, 1134, 1134, 1134, 1134, 1134, 82, 983, 20, 479, - /* 350 */ 479, 354, 473, 565, 365, 392, 773, 1119, 863, 783, - /* 360 */ 783, 942, 961, 866, 942, 942, 942, 626, 854, 692, - /* 370 */ 1242, 1259, 89, 39, 1198, 1212, 1222, 1237, 993, 1302, - /* 380 */ 1260, 1331, 1334, 907, 1244, 1280, 1258, 1316, 1339, 1341, - /* 390 */ 1234, 1103, 1217, 1344, 1349, 1355, 1359, 1381, 1382, 1415, - /* 400 */ 1386, 1197, 1387, 243, 1404, 1405, 1416, 1419, 1421, 1429, - /* 410 */ 1250, 1117, 1219, 1422, 1426, 1346, 1389, 1733, 1735, 1753, - /* 420 */ 1709, 1755, 1720, 1542, 1723, 1724, 1725, 1549, 1767, 1731, - /* 430 */ 1734, 1553, 1772, 1557, 1775, 1740, 1779, 1758, 1781, 1745, - /* 440 */ 1571, 1784, 1585, 1788, 1589, 1591, 1596, 1602, 1793, 1795, - /* 450 */ 1796, 1609, 1612, 1801, 1802, 1754, 1804, 1768, 1756, 1806, - /* 460 */ 1759, 1809, 1765, 1811, 1813, 1816, 1774, 1825, 1827, 1835, - /* 470 */ 1837, 1838, 1845, 1669, 1794, 1830, 1672, 1833, 1854, 1855, - /* 480 */ 1856, 1857, 1858, 1859, 1860, 1861, 1863, 1865, 1873, 1876, - /* 490 */ 1877, 1878, 1879, 1798, 1848, 1805, 1849, 1851, 1852, 1880, - /* 500 */ 1881, 1882, 1862, 1883, 1885, 1886, 1743, 1889, 1890, 1869, - /* 510 */ 1842, 1871, 1844, 1896, 1834, 1864, 1897, 1836, 1899, 1839, - /* 520 */ 1902, 1904, 1868, 1867, 1872, 1907, 1874, 1875, 1887, 1909, - /* 530 */ 1888, 1884, 1891, 1910, 1894, 1913, 1870, 1892, 1903, 1906, - /* 540 */ 1908, 1905, 1911, 1916, 1895, 1901, 1920, 1927, 1932, 1914, - /* 550 */ 1739, 1923, 1924, 1937, 1912, 1939, 1941, 1921, 1917, 1919, - /* 560 */ 1945, 1926, 1928, 1925, 1946, 1940, 1929, 1936, 1959, 1944, - /* 570 */ 1933, 1943, 1965, 1986, 1987, 1988, 1989, 1990, 1893, 1898, - /* 580 */ 1954, 1970, 1994, 1960, 1961, 1962, 1963, 1966, 1968, 1973, - /* 590 */ 1969, 1974, 1975, 1977, 1996, 1979, 2011, 1998, 2019, 1999, - /* 600 */ 1971, 2022, 2001, 1991, 2025, 2030, 2032, 2005, 2033, 2007, - /* 610 */ 2045, 2024, 1976, 2010, 2012, 2013, 1942, 1947, 2054, 1915, - /* 620 */ 1957, 1866, 2027, 2048, 2067, 1900, 2049, 1918, 1930, 2072, - /* 630 */ 2074, 1956, 1938, 1958, 1948, 2073, 2042, 1812, 1978, 1980, - /* 640 */ 1982, 2029, 1981, 2031, 1984, 1983, 2044, 2057, 1992, 2014, - /* 650 */ 2028, 2034, 1993, 2060, 2043, 2047, 2035, 2061, 1831, 1995, - /* 660 */ 1997, 2103, 2082, 1950, 2093, 2095, 2097, 2098, 2099, 2100, - /* 670 */ 2037, 2038, 2092, 1934, 2112, 2101, 2146, 2147, 2046, 2106, - /* 680 */ 1906, 2107, 2052, 2053, 2055, 2058, 2062, 2000, 2063, 2149, - /* 690 */ 2110, 2003, 2064, 2050, 1906, 2111, 2129, 2070, 1964, 2071, - /* 700 */ 2163, 2144, 1951, 2077, 2078, 2081, 2086, 2083, 2096, 2138, - /* 710 */ 2102, 2104, 2155, 2113, 2183, 2002, 2115, 2091, 2116, 2171, - /* 720 */ 2175, 2124, 2118, 2178, 2125, 2127, 2180, 2126, 2128, 2181, - /* 730 */ 2130, 2131, 2184, 2133, 2134, 2199, 2136, 2117, 2121, 2135, - /* 740 */ 2137, 2217, 2156, 2141, 2209, 2145, 2214, 2169, 2209, 2209, - /* 750 */ 2238, 2204, 2206, 2240, 2243, 2245, 2246, 2257, 2258, 2259, - /* 760 */ 2260, 2213, 2200, 2265, 2264, 2266, 2267, 2280, 2269, 2271, - /* 770 */ 2272, 2233, 1969, 2274, 1974, 2275, 2276, 2277, 2279, 2295, - /* 780 */ 2284, 2322, 2286, 2273, 2283, 2326, 2290, 2278, 2288, 2331, - /* 790 */ 2296, 2281, 2293, 2336, 2300, 2287, 2297, 2340, 2304, 2305, - /* 800 */ 2343, 2324, 2311, 2327, 2329, 2333, 2345, 2330, 2328, + /* 50 */ 933, 227, 260, 394, 274, 271, 502, 271, 274, 274, + /* 60 */ 271, 1349, 271, 1349, 1349, 409, 271, 18, 115, 143, + /* 70 */ 143, 115, 261, 261, 117, 192, 126, 126, 143, 143, + /* 80 */ 143, 143, 143, 143, 143, 143, 143, 143, 249, 143, + /* 90 */ 143, 113, 18, 143, 143, 284, 18, 143, 249, 143, + /* 100 */ 249, 18, 143, 143, 18, 143, 18, 18, 18, 143, + /* 110 */ 268, 232, 193, 193, 443, 298, 642, 642, 642, 642, + /* 120 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, + /* 130 */ 642, 642, 642, 642, 642, 1115, 620, 117, 192, 741, + /* 140 */ 741, 538, 945, 945, 945, 185, 764, 764, 538, 113, + /* 150 */ 292, 208, 18, 436, 18, 436, 436, 412, 475, 22, + /* 160 */ 37, 37, 37, 37, 37, 37, 37, 37, 2088, 660, + /* 170 */ 21, 53, 15, 67, 229, 155, 4, 4, 285, 198, + /* 180 */ 850, 464, 1050, 1144, 762, 688, 1088, 934, 616, 981, + /* 190 */ 934, 1164, 1026, 1031, 1089, 1304, 1346, 1175, 113, 1346, + /* 200 */ 113, 1241, 1415, 1391, 1421, 1415, 1391, 1275, 1428, 1415, + /* 210 */ 1428, 1391, 1275, 1275, 1352, 1355, 1428, 1370, 1428, 1428, + /* 220 */ 1428, 1442, 1434, 1442, 1434, 1346, 113, 1478, 113, 1485, + /* 230 */ 1486, 113, 1485, 113, 113, 113, 1428, 113, 1442, 18, + /* 240 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + /* 250 */ 1428, 22, 22, 1442, 436, 436, 436, 1337, 1451, 1346, + /* 260 */ 268, 1371, 1375, 1478, 268, 1383, 1089, 1428, 1421, 1421, + /* 270 */ 436, 1309, 1327, 436, 1309, 1327, 436, 436, 18, 1321, + /* 280 */ 1424, 1309, 1329, 1331, 1348, 1089, 1333, 1334, 1342, 1366, + /* 290 */ 1415, 1609, 1516, 1373, 1485, 268, 268, 1617, 1327, 436, + /* 300 */ 436, 436, 436, 436, 1327, 436, 1474, 268, 412, 268, + /* 310 */ 1415, 1569, 1572, 436, 475, 1428, 268, 1665, 1660, 1442, + /* 320 */ 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 36, + /* 330 */ 932, 406, 263, 506, 906, 948, 837, 1107, 1267, 835, + /* 340 */ 879, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, + /* 350 */ 356, 415, 527, 621, 621, 27, 449, 534, 44, 348, + /* 360 */ 824, 1000, 657, 589, 589, 672, 889, 104, 672, 672, + /* 370 */ 672, 152, 1002, 1109, 1189, 1165, 456, 1149, 1103, 1110, + /* 380 */ 1121, 1136, 1209, 1213, 1248, 1262, 1265, 1044, 1167, 1203, + /* 390 */ 652, 1222, 1223, 1281, 1054, 915, 1055, 1282, 1306, 1318, + /* 400 */ 1332, 1381, 1382, 1204, 1384, 34, 1385, 1218, 1387, 1389, + /* 410 */ 1394, 1395, 1396, 1397, 1172, 1080, 1091, 1283, 1284, 1253, + /* 420 */ 1242, 1724, 1726, 1730, 1687, 1735, 1705, 1527, 1708, 1710, + /* 430 */ 1711, 1532, 1751, 1716, 1717, 1539, 1757, 1542, 1761, 1727, + /* 440 */ 1763, 1744, 1768, 1732, 1559, 1772, 1573, 1775, 1577, 1578, + /* 450 */ 1584, 1588, 1781, 1782, 1784, 1597, 1599, 1787, 1788, 1741, + /* 460 */ 1789, 1754, 1746, 1792, 1759, 1795, 1764, 1813, 1814, 1821, + /* 470 */ 1777, 1824, 1827, 1828, 1829, 1830, 1831, 1672, 1796, 1834, + /* 480 */ 1675, 1836, 1837, 1838, 1839, 1840, 1844, 1845, 1852, 1854, + /* 490 */ 1855, 1856, 1860, 1862, 1863, 1873, 1874, 1809, 1875, 1832, + /* 500 */ 1876, 1878, 1879, 1880, 1881, 1882, 1861, 1884, 1886, 1888, + /* 510 */ 1745, 1890, 1891, 1870, 1843, 1872, 1846, 1895, 1833, 1864, + /* 520 */ 1899, 1841, 1902, 1847, 1903, 1904, 1869, 1857, 1865, 1914, + /* 530 */ 1883, 1866, 1877, 1915, 1885, 1887, 1889, 1916, 1892, 1921, + /* 540 */ 1894, 1893, 1897, 1896, 1900, 1909, 1901, 1924, 1898, 1918, + /* 550 */ 1926, 1932, 1933, 1920, 1753, 1937, 1943, 1944, 1906, 1957, + /* 560 */ 1964, 1928, 1923, 1949, 1979, 1955, 1942, 1952, 1995, 1960, + /* 570 */ 1947, 1959, 1999, 1965, 1953, 1961, 2006, 2007, 2008, 2010, + /* 580 */ 2011, 2013, 1905, 1908, 1978, 1994, 2017, 1983, 1984, 1985, + /* 590 */ 1987, 1989, 1990, 2001, 2003, 2012, 2002, 2004, 2018, 2009, + /* 600 */ 2034, 2021, 2044, 2025, 2014, 2052, 2037, 2024, 2063, 2064, + /* 610 */ 2065, 2029, 2068, 2033, 2069, 2050, 2051, 2036, 2039, 2040, + /* 620 */ 1968, 1973, 2079, 1907, 1976, 1911, 2045, 2062, 2086, 1913, + /* 630 */ 2066, 1925, 1927, 2099, 2100, 1931, 1922, 1936, 1934, 2102, + /* 640 */ 2073, 1850, 2015, 2005, 2016, 2072, 2022, 2076, 2027, 2023, + /* 650 */ 2085, 2097, 2026, 2028, 2030, 2035, 2031, 2098, 2070, 2092, + /* 660 */ 2038, 2101, 1917, 2048, 2056, 2109, 2111, 1930, 2105, 2108, + /* 670 */ 2127, 2128, 2129, 2131, 2067, 2080, 2121, 1912, 2113, 2126, + /* 680 */ 2176, 2187, 2083, 2147, 1896, 2141, 2089, 2087, 2091, 2094, + /* 690 */ 2095, 2041, 2114, 2191, 2160, 2042, 2115, 2090, 1896, 2157, + /* 700 */ 2174, 2118, 1972, 2119, 2221, 2202, 2019, 2120, 2122, 2124, + /* 710 */ 2125, 2130, 2133, 2181, 2132, 2136, 2183, 2138, 2212, 2020, + /* 720 */ 2140, 2134, 2142, 2196, 2199, 2145, 2146, 2210, 2150, 2151, + /* 730 */ 2214, 2153, 2154, 2222, 2156, 2158, 2226, 2162, 2159, 2231, + /* 740 */ 2165, 2152, 2161, 2163, 2167, 2166, 2240, 2170, 2254, 2172, + /* 750 */ 2240, 2240, 2279, 2232, 2234, 2270, 2272, 2274, 2275, 2277, + /* 760 */ 2278, 2280, 2282, 2233, 2217, 2287, 2284, 2285, 2286, 2304, + /* 770 */ 2292, 2293, 2294, 2251, 2003, 2295, 2012, 2296, 2297, 2298, + /* 780 */ 2299, 2316, 2302, 2341, 2306, 2305, 2303, 2355, 2320, 2308, + /* 790 */ 2322, 2362, 2335, 2323, 2334, 2378, 2343, 2331, 2342, 2383, + /* 800 */ 2348, 2349, 2387, 2367, 2357, 2369, 2376, 2385, 2386, 2377, + /* 810 */ 2389, }; -#define YY_REDUCE_COUNT (324) -#define YY_REDUCE_MIN (-381) -#define YY_REDUCE_MAX (2433) +#define YY_REDUCE_COUNT (328) +#define YY_REDUCE_MIN (-452) +#define YY_REDUCE_MAX (2353) static const short yy_reduce_ofst[] = { - /* 0 */ 112, 142, -83, 209, 234, 374, 644, 861, 929, 1075, - /* 10 */ 1100, 1162, 1223, 411, 461, 797, 1249, -341, 1273, 1300, - /* 20 */ 609, 1380, 1402, 1430, 1510, 1532, 1597, 1619, 1684, 1670, - /* 30 */ 1757, 1815, 1829, 1847, 1922, 1949, 1972, 2009, 2036, 2059, - /* 40 */ 2109, 2123, 2139, 2202, 2226, 2253, 2316, 2346, 2366, 2416, - /* 50 */ 2433, -273, 488, 140, -44, -309, 277, 650, -143, 99, - /* 60 */ 858, -26, 744, 684, 701, -87, 168, -366, -335, -209, - /* 70 */ 280, -149, -350, -345, 183, -89, -202, 312, -349, -61, - /* 80 */ 401, 407, -266, 57, 413, 445, 594, 324, -315, 611, - /* 90 */ 618, 363, 154, 633, 636, -250, 330, 648, 218, 677, - /* 100 */ 329, 237, 704, 746, 398, 751, 450, 610, 485, 776, - /* 110 */ 750, -260, 102, 102, -99, -310, -342, 7, 85, 246, - /* 120 */ 385, 494, 515, 616, 681, 694, 787, 801, 812, 816, - /* 130 */ 851, 853, 859, 882, 883, 146, -278, 346, 173, 503, - /* 140 */ 748, 811, -278, -239, 528, 441, 426, 465, 875, 635, - /* 150 */ 878, 881, 885, 891, 393, -199, 896, 244, 22, 582, - /* 160 */ 661, 843, 912, 944, -381, -376, 34, -381, 31, 212, - /* 170 */ 171, 264, 141, 252, 460, 213, 468, 475, 448, 533, - /* 180 */ 448, 675, 690, 685, 796, 893, 848, 829, 829, 841, - /* 190 */ 829, 895, 888, 448, 1015, 1003, 1016, 1013, 1084, 1025, - /* 200 */ 1089, 1039, 1110, 1064, 1066, 1114, 1071, 1076, 1123, 1124, - /* 210 */ 1126, 1079, 1078, 1082, 1116, 1122, 1135, 1129, 1142, 1144, - /* 220 */ 1145, 1156, 1168, 1158, 1169, 1097, 1164, 1131, 1172, 1188, - /* 230 */ 1128, 1184, 1193, 1189, 1190, 1195, 1202, 1199, 1204, 1176, - /* 240 */ 1177, 1179, 1180, 1182, 1183, 1185, 1214, 1225, 1226, 1227, - /* 250 */ 1181, 1192, 1194, 1146, 1150, 1155, 1218, 1159, 1161, 1200, - /* 260 */ 1221, 1163, 1174, 1238, 1201, 1203, 1216, 1136, 1209, 1228, - /* 270 */ 1140, 1211, 1229, 1230, 448, 1151, 1157, 1153, 1165, 1167, - /* 280 */ 1170, 1220, 1143, 1210, 1160, 829, 1284, 1213, 1205, 1208, - /* 290 */ 1295, 1291, 1297, 1261, 1257, 1281, 1286, 1288, 1303, 1304, - /* 300 */ 1265, 1306, 1293, 1342, 1323, 1354, 1353, 1254, 1332, 1325, - /* 310 */ 1345, 1367, 1363, 1398, 1378, 1399, 1308, 1319, 1317, 1318, - /* 320 */ 1370, 1371, 1372, 1368, 1411, + /* 0 */ -202, 142, -83, 374, 234, 645, 861, 908, 1027, 1076, + /* 10 */ 697, 1096, 1220, 461, 1252, 1272, 935, 162, -341, 1299, + /* 20 */ 1362, 1378, 1409, 1427, 1514, 1529, 1544, 1591, 1653, 1616, + /* 30 */ 1719, 1740, 1771, 1842, 1858, 1910, 1929, 1962, 1981, 1997, + /* 40 */ 2032, 2049, 2084, 2149, 2164, 2186, 2211, 2273, 2291, 2338, + /* 50 */ 2353, -273, 163, 302, -44, 312, 344, 583, -316, -280, + /* 60 */ 724, -26, -403, 134, 375, -266, -168, -373, -326, -350, + /* 70 */ 46, -324, -346, -133, 145, -80, 146, 299, -297, -180, + /* 80 */ 84, 307, 187, 325, 387, 399, 424, 433, 74, 428, + /* 90 */ 465, 224, 347, 498, 500, 70, 382, 513, 218, 529, + /* 100 */ 360, 169, 594, 603, 440, 625, 273, 490, 606, 631, + /* 110 */ -308, -249, -452, -452, 304, -250, -207, -43, 7, 252, + /* 120 */ 288, 515, 570, 608, 609, 611, 636, 646, 677, 680, + /* 130 */ 682, 716, 747, 748, 749, -288, 231, 352, -388, -327, + /* 140 */ 673, 678, 231, 444, 588, 120, 649, 676, 687, 533, + /* 150 */ -32, 109, 668, 737, 244, 754, 763, 803, 810, 722, + /* 160 */ 226, 402, 453, 695, 713, 766, 800, 713, 372, 280, + /* 170 */ 543, 822, 743, 735, 899, 785, 900, 916, 927, 898, + /* 180 */ 927, 959, 918, 968, 969, 931, 921, 867, 867, 849, + /* 190 */ 867, 878, 868, 927, 937, 923, 942, 958, 1028, 990, + /* 200 */ 1057, 1014, 1081, 1037, 1036, 1087, 1041, 1045, 1092, 1093, + /* 210 */ 1095, 1051, 1052, 1056, 1090, 1106, 1108, 1111, 1120, 1124, + /* 220 */ 1126, 1137, 1134, 1141, 1145, 1070, 1135, 1113, 1140, 1150, + /* 230 */ 1094, 1155, 1152, 1157, 1158, 1159, 1169, 1162, 1181, 1160, + /* 240 */ 1170, 1171, 1173, 1174, 1176, 1177, 1178, 1180, 1182, 1183, + /* 250 */ 1184, 1196, 1200, 1201, 1154, 1163, 1179, 1123, 1142, 1139, + /* 260 */ 1206, 1146, 1153, 1185, 1216, 1161, 1168, 1226, 1187, 1188, + /* 270 */ 1186, 1122, 1190, 1202, 1125, 1191, 1207, 1210, 927, 1128, + /* 280 */ 1133, 1138, 1147, 1151, 1143, 1205, 1131, 1130, 1148, 867, + /* 290 */ 1271, 1194, 1197, 1198, 1276, 1270, 1277, 1229, 1230, 1244, + /* 300 */ 1247, 1249, 1250, 1251, 1233, 1255, 1245, 1301, 1287, 1310, + /* 310 */ 1317, 1224, 1291, 1285, 1308, 1325, 1323, 1343, 1350, 1353, + /* 320 */ 1280, 1288, 1290, 1305, 1341, 1344, 1347, 1357, 1388, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 10 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 20 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 30 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 40 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 50 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 60 */ 2125, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 70 */ 1806, 1806, 1806, 1806, 2098, 1806, 1806, 1806, 1806, 1806, - /* 80 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 90 */ 1806, 1902, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 100 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 110 */ 1900, 2091, 2317, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 120 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 130 */ 1806, 1806, 1806, 1806, 1806, 1806, 2329, 1806, 1806, 1876, - /* 140 */ 1876, 1806, 2329, 2329, 2329, 1900, 2289, 2289, 1806, 1902, - /* 150 */ 1806, 1806, 1806, 1806, 2159, 1806, 1806, 1806, 1806, 1806, - /* 160 */ 1806, 2023, 1806, 1836, 2047, 1806, 1806, 1806, 2151, 1806, - /* 170 */ 1806, 2358, 2415, 1806, 1806, 2361, 1806, 1806, 1806, 1806, - /* 180 */ 1806, 1806, 2103, 1806, 1806, 1975, 2348, 2321, 2335, 2399, - /* 190 */ 2322, 2319, 2342, 1806, 2352, 1806, 1806, 2173, 1902, 1806, - /* 200 */ 1902, 2138, 1806, 2096, 1806, 1806, 2096, 2093, 1806, 1806, - /* 210 */ 1806, 2096, 2093, 2093, 1964, 1960, 1806, 1958, 1806, 1806, - /* 220 */ 1806, 1806, 1860, 1806, 1860, 1806, 1902, 1806, 1902, 1806, - /* 230 */ 1806, 1902, 1806, 1902, 1902, 1902, 1806, 1902, 1806, 1806, - /* 240 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 250 */ 1806, 1806, 1806, 2171, 2157, 1806, 1900, 2149, 2147, 1806, - /* 260 */ 1900, 2145, 2352, 1806, 1806, 1806, 1806, 2369, 2367, 1806, - /* 270 */ 2369, 2367, 1806, 1806, 1806, 2383, 2379, 2369, 2388, 2385, - /* 280 */ 2354, 2352, 2418, 2405, 2401, 2335, 1806, 1806, 2340, 2338, - /* 290 */ 1806, 1900, 1900, 1806, 2367, 1806, 1806, 1806, 1806, 1806, - /* 300 */ 2367, 1806, 1806, 1900, 1806, 1900, 1806, 1806, 1991, 1806, - /* 310 */ 1806, 1806, 1900, 1806, 1845, 1806, 2140, 2162, 2121, 2121, - /* 320 */ 2026, 2026, 2026, 1903, 1811, 1806, 1806, 1806, 1806, 1806, - /* 330 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 2382, 2381, 2244, - /* 340 */ 1806, 2293, 2292, 2291, 2282, 2243, 1987, 1806, 1806, 2242, - /* 350 */ 2241, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 2112, - /* 360 */ 2111, 2235, 1806, 1806, 2236, 2234, 2233, 1806, 1806, 1806, - /* 370 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 380 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 390 */ 1806, 2402, 2406, 1806, 1806, 1806, 1806, 1806, 1806, 2318, - /* 400 */ 1806, 1806, 1806, 2217, 1806, 1806, 1806, 1806, 1806, 1806, - /* 410 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 420 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 430 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 440 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 450 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 460 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 470 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 480 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 490 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 500 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 510 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 520 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 530 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1850, 2222, - /* 540 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 550 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 560 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 570 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 580 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 590 */ 1941, 1940, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 600 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 610 */ 1806, 1806, 1806, 1806, 1806, 1806, 2226, 1806, 1806, 1806, - /* 620 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 630 */ 1806, 1806, 1806, 1806, 1806, 2398, 2355, 1806, 1806, 1806, - /* 640 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 650 */ 1806, 1806, 1806, 1806, 1806, 2217, 1806, 2380, 1806, 1806, - /* 660 */ 2396, 1806, 2400, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 670 */ 2328, 2324, 1806, 1806, 2320, 1806, 1806, 1806, 1806, 1806, - /* 680 */ 2225, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 690 */ 1806, 1806, 1806, 1806, 2216, 1806, 2279, 1806, 1806, 1806, - /* 700 */ 2313, 1806, 1806, 2264, 1806, 1806, 1806, 1806, 1806, 1806, - /* 710 */ 1806, 1806, 1806, 2226, 1806, 2229, 1806, 1806, 1806, 1806, - /* 720 */ 1806, 2020, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 730 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 2004, 2002, 2001, - /* 740 */ 2000, 1806, 1997, 1806, 2033, 1806, 1806, 1806, 2029, 2028, - /* 750 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 760 */ 1806, 1806, 1806, 1921, 1806, 1806, 1806, 1806, 1806, 1806, - /* 770 */ 1806, 1806, 1913, 1806, 1912, 1806, 1806, 1806, 1806, 1806, - /* 780 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 790 */ 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, 1806, - /* 800 */ 1806, 1806, 1835, 1806, 1806, 1806, 1806, 1806, 1806, + /* 0 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 10 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 20 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 30 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 40 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 50 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 60 */ 2125, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 70 */ 1807, 1807, 1807, 1807, 2098, 1807, 1807, 1807, 1807, 1807, + /* 80 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 90 */ 1807, 1903, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 100 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 110 */ 1901, 2091, 2317, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 120 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 130 */ 1807, 1807, 1807, 1807, 1807, 1807, 2329, 1807, 1807, 1877, + /* 140 */ 1877, 1807, 2329, 2329, 2329, 1901, 2289, 2289, 1807, 1903, + /* 150 */ 2159, 1807, 1807, 1807, 1807, 1807, 1807, 2023, 1807, 1837, + /* 160 */ 1807, 1807, 1807, 1807, 2047, 1807, 1807, 1807, 2151, 1807, + /* 170 */ 1807, 2358, 2415, 1807, 1807, 2361, 1807, 1807, 1807, 1807, + /* 180 */ 1807, 1807, 2103, 1807, 1807, 1976, 2348, 2321, 2335, 2399, + /* 190 */ 2322, 2319, 2342, 1807, 2352, 1807, 1807, 2173, 1903, 1807, + /* 200 */ 1903, 2138, 1807, 2096, 1807, 1807, 2096, 2093, 1807, 1807, + /* 210 */ 1807, 2096, 2093, 2093, 1965, 1961, 1807, 1959, 1807, 1807, + /* 220 */ 1807, 1807, 1861, 1807, 1861, 1807, 1903, 1807, 1903, 1807, + /* 230 */ 1807, 1903, 1807, 1903, 1903, 1903, 1807, 1903, 1807, 1807, + /* 240 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 250 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2171, 2157, 1807, + /* 260 */ 1901, 2149, 2147, 1807, 1901, 2145, 2352, 1807, 1807, 1807, + /* 270 */ 1807, 2369, 2367, 1807, 2369, 2367, 1807, 1807, 1807, 2383, + /* 280 */ 2379, 2369, 2388, 2385, 2354, 2352, 2418, 2405, 2401, 2335, + /* 290 */ 1807, 1807, 2340, 2338, 1807, 1901, 1901, 1807, 2367, 1807, + /* 300 */ 1807, 1807, 1807, 1807, 2367, 1807, 1807, 1901, 1807, 1901, + /* 310 */ 1807, 1807, 1992, 1807, 1807, 1807, 1901, 1807, 1846, 1807, + /* 320 */ 2140, 2162, 2121, 2121, 2026, 2026, 2026, 1904, 1812, 1807, + /* 330 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 340 */ 1807, 2382, 2381, 2244, 1807, 2293, 2292, 2291, 2282, 2243, + /* 350 */ 1988, 1807, 1807, 2242, 2241, 1807, 1807, 1807, 1807, 1807, + /* 360 */ 1807, 1807, 1807, 2112, 2111, 2235, 1807, 1807, 2236, 2234, + /* 370 */ 2233, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 380 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 390 */ 1807, 1807, 1807, 1807, 1807, 2402, 2406, 1807, 1807, 1807, + /* 400 */ 1807, 1807, 1807, 2318, 1807, 1807, 1807, 2217, 1807, 1807, + /* 410 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 420 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 430 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 440 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 450 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 460 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 470 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 480 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 490 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 500 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 510 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 520 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 530 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 540 */ 1807, 1807, 1851, 2222, 1807, 1807, 1807, 1807, 1807, 1807, + /* 550 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 560 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 570 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 580 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 590 */ 1807, 1807, 1807, 1807, 1942, 1941, 1807, 1807, 1807, 1807, + /* 600 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 610 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 620 */ 2226, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 630 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2398, + /* 640 */ 2355, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 650 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2217, + /* 660 */ 1807, 2380, 1807, 1807, 2396, 1807, 2400, 1807, 1807, 1807, + /* 670 */ 1807, 1807, 1807, 1807, 2328, 2324, 1807, 1807, 2320, 1807, + /* 680 */ 1807, 1807, 1807, 1807, 2225, 1807, 1807, 1807, 1807, 1807, + /* 690 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2216, 1807, + /* 700 */ 2279, 1807, 1807, 1807, 2313, 1807, 1807, 2264, 1807, 1807, + /* 710 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2226, 1807, 2229, + /* 720 */ 1807, 1807, 1807, 1807, 1807, 2020, 1807, 1807, 1807, 1807, + /* 730 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 740 */ 1807, 2004, 2002, 2001, 2000, 1807, 2033, 1807, 1807, 1807, + /* 750 */ 2029, 2028, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 760 */ 1807, 1807, 1807, 1807, 1807, 1922, 1807, 1807, 1807, 1807, + /* 770 */ 1807, 1807, 1807, 1807, 1914, 1807, 1913, 1807, 1807, 1807, + /* 780 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 790 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, + /* 800 */ 1807, 1807, 1807, 1807, 1836, 1807, 1807, 1807, 1807, 1807, + /* 810 */ 1807, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1499,7 +1485,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLE_PREFIX => nothing */ 0, /* TABLE_SUFFIX => nothing */ 0, /* NK_COLON => nothing */ - 0, /* MAX_SPEED => nothing */ + 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ 289, /* END => ABORT */ @@ -1515,7 +1501,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_EQ => nothing */ 0, /* USING => nothing */ 0, /* TAGS => nothing */ - 0, /* COMMENT => nothing */ 0, /* BOOL => nothing */ 0, /* TINYINT => nothing */ 0, /* SMALLINT => nothing */ @@ -1534,6 +1519,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* VARBINARY => nothing */ 0, /* GEOMETRY => nothing */ 0, /* DECIMAL => nothing */ + 0, /* COMMENT => nothing */ 0, /* MAX_DELAY => nothing */ 0, /* WATERMARK => nothing */ 0, /* ROLLUP => nothing */ @@ -1927,7 +1913,7 @@ static const char *const yyTokenName[] = { /* 97 */ "TABLE_PREFIX", /* 98 */ "TABLE_SUFFIX", /* 99 */ "NK_COLON", - /* 100 */ "MAX_SPEED", + /* 100 */ "BWLIMIT", /* 101 */ "START", /* 102 */ "TIMESTAMP", /* 103 */ "END", @@ -1943,25 +1929,25 @@ static const char *const yyTokenName[] = { /* 113 */ "NK_EQ", /* 114 */ "USING", /* 115 */ "TAGS", - /* 116 */ "COMMENT", - /* 117 */ "BOOL", - /* 118 */ "TINYINT", - /* 119 */ "SMALLINT", - /* 120 */ "INT", - /* 121 */ "INTEGER", - /* 122 */ "BIGINT", - /* 123 */ "FLOAT", - /* 124 */ "DOUBLE", - /* 125 */ "BINARY", - /* 126 */ "NCHAR", - /* 127 */ "UNSIGNED", - /* 128 */ "JSON", - /* 129 */ "VARCHAR", - /* 130 */ "MEDIUMBLOB", - /* 131 */ "BLOB", - /* 132 */ "VARBINARY", - /* 133 */ "GEOMETRY", - /* 134 */ "DECIMAL", + /* 116 */ "BOOL", + /* 117 */ "TINYINT", + /* 118 */ "SMALLINT", + /* 119 */ "INT", + /* 120 */ "INTEGER", + /* 121 */ "BIGINT", + /* 122 */ "FLOAT", + /* 123 */ "DOUBLE", + /* 124 */ "BINARY", + /* 125 */ "NCHAR", + /* 126 */ "UNSIGNED", + /* 127 */ "JSON", + /* 128 */ "VARCHAR", + /* 129 */ "MEDIUMBLOB", + /* 130 */ "BLOB", + /* 131 */ "VARBINARY", + /* 132 */ "GEOMETRY", + /* 133 */ "DECIMAL", + /* 134 */ "COMMENT", /* 135 */ "MAX_DELAY", /* 136 */ "WATERMARK", /* 137 */ "ROLLUP", @@ -2211,15 +2197,15 @@ static const char *const yyTokenName[] = { /* 381 */ "multi_drop_clause", /* 382 */ "alter_table_clause", /* 383 */ "alter_table_options", - /* 384 */ "column_def", - /* 385 */ "column_name", + /* 384 */ "column_name", + /* 385 */ "type_name", /* 386 */ "signed_literal", /* 387 */ "create_subtable_clause", /* 388 */ "specific_cols_opt", /* 389 */ "expression_list", /* 390 */ "drop_table_clause", /* 391 */ "col_name_list", - /* 392 */ "type_name", + /* 392 */ "column_def", /* 393 */ "duration_list", /* 394 */ "rollup_func_list", /* 395 */ "alter_table_option", @@ -2295,8 +2281,8 @@ static const char *const yyTokenName[] = { /* 465 */ "join_type", /* 466 */ "query_specification", /* 467 */ "hint_list", - /* 468 */ "tag_mode_opt", - /* 469 */ "set_quantifier_opt", + /* 468 */ "set_quantifier_opt", + /* 469 */ "tag_mode_opt", /* 470 */ "select_list", /* 471 */ "partition_by_clause_opt", /* 472 */ "range_opt", @@ -2478,7 +2464,7 @@ static const char *const yyRuleName[] = { /* 147 */ "retention_list ::= retention_list NK_COMMA retention", /* 148 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", /* 149 */ "speed_opt ::=", - /* 150 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 150 */ "speed_opt ::= BWLIMIT NK_INTEGER", /* 151 */ "start_opt ::=", /* 152 */ "start_opt ::= START WITH NK_INTEGER", /* 153 */ "start_opt ::= START WITH NK_STRING", @@ -2495,13 +2481,13 @@ static const char *const yyRuleName[] = { /* 164 */ "cmd ::= ALTER TABLE alter_table_clause", /* 165 */ "cmd ::= ALTER STABLE alter_table_clause", /* 166 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 167 */ "alter_table_clause ::= full_table_name ADD COLUMN column_def", + /* 167 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", /* 168 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 169 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_def", + /* 169 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", /* 170 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 171 */ "alter_table_clause ::= full_table_name ADD TAG column_def", + /* 171 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", /* 172 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 173 */ "alter_table_clause ::= full_table_name MODIFY TAG column_def", + /* 173 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", /* 174 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", /* 175 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", /* 176 */ "multi_create_clause ::= create_subtable_clause", @@ -2517,429 +2503,428 @@ static const char *const yyRuleName[] = { /* 186 */ "column_def_list ::= column_def", /* 187 */ "column_def_list ::= column_def_list NK_COMMA column_def", /* 188 */ "column_def ::= column_name type_name", - /* 189 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 190 */ "type_name ::= BOOL", - /* 191 */ "type_name ::= TINYINT", - /* 192 */ "type_name ::= SMALLINT", - /* 193 */ "type_name ::= INT", - /* 194 */ "type_name ::= INTEGER", - /* 195 */ "type_name ::= BIGINT", - /* 196 */ "type_name ::= FLOAT", - /* 197 */ "type_name ::= DOUBLE", - /* 198 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 199 */ "type_name ::= TIMESTAMP", - /* 200 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 201 */ "type_name ::= TINYINT UNSIGNED", - /* 202 */ "type_name ::= SMALLINT UNSIGNED", - /* 203 */ "type_name ::= INT UNSIGNED", - /* 204 */ "type_name ::= BIGINT UNSIGNED", - /* 205 */ "type_name ::= JSON", - /* 206 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 207 */ "type_name ::= MEDIUMBLOB", - /* 208 */ "type_name ::= BLOB", - /* 209 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 210 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 211 */ "type_name ::= DECIMAL", - /* 212 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 213 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 214 */ "tags_def_opt ::=", - /* 215 */ "tags_def_opt ::= tags_def", - /* 216 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 217 */ "table_options ::=", - /* 218 */ "table_options ::= table_options COMMENT NK_STRING", - /* 219 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 220 */ "table_options ::= table_options WATERMARK duration_list", - /* 221 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 222 */ "table_options ::= table_options TTL NK_INTEGER", - /* 223 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 224 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 225 */ "alter_table_options ::= alter_table_option", - /* 226 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 227 */ "alter_table_option ::= COMMENT NK_STRING", - /* 228 */ "alter_table_option ::= TTL NK_INTEGER", - /* 229 */ "duration_list ::= duration_literal", - /* 230 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 231 */ "rollup_func_list ::= rollup_func_name", - /* 232 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 233 */ "rollup_func_name ::= function_name", - /* 234 */ "rollup_func_name ::= FIRST", - /* 235 */ "rollup_func_name ::= LAST", - /* 236 */ "col_name_list ::= col_name", - /* 237 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 238 */ "col_name ::= column_name", - /* 239 */ "cmd ::= SHOW DNODES", - /* 240 */ "cmd ::= SHOW USERS", - /* 241 */ "cmd ::= SHOW USER PRIVILEGES", - /* 242 */ "cmd ::= SHOW DATABASES", - /* 243 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 244 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 245 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 246 */ "cmd ::= SHOW MNODES", - /* 247 */ "cmd ::= SHOW QNODES", - /* 248 */ "cmd ::= SHOW FUNCTIONS", - /* 249 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 250 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 251 */ "cmd ::= SHOW STREAMS", - /* 252 */ "cmd ::= SHOW ACCOUNTS", - /* 253 */ "cmd ::= SHOW APPS", - /* 254 */ "cmd ::= SHOW CONNECTIONS", - /* 255 */ "cmd ::= SHOW LICENCES", - /* 256 */ "cmd ::= SHOW GRANTS", - /* 257 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 258 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 259 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 260 */ "cmd ::= SHOW QUERIES", - /* 261 */ "cmd ::= SHOW SCORES", - /* 262 */ "cmd ::= SHOW TOPICS", - /* 263 */ "cmd ::= SHOW VARIABLES", - /* 264 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 265 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 266 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 267 */ "cmd ::= SHOW BNODES", - /* 268 */ "cmd ::= SHOW SNODES", - /* 269 */ "cmd ::= SHOW CLUSTER", - /* 270 */ "cmd ::= SHOW TRANSACTIONS", - /* 271 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 272 */ "cmd ::= SHOW CONSUMERS", - /* 273 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 274 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 275 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 276 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 277 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 278 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 279 */ "cmd ::= SHOW VNODES", - /* 280 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 281 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 282 */ "db_name_cond_opt ::=", - /* 283 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 284 */ "like_pattern_opt ::=", - /* 285 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 286 */ "table_name_cond ::= table_name", - /* 287 */ "from_db_opt ::=", - /* 288 */ "from_db_opt ::= FROM db_name", - /* 289 */ "tag_list_opt ::=", - /* 290 */ "tag_list_opt ::= tag_item", - /* 291 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 292 */ "tag_item ::= TBNAME", - /* 293 */ "tag_item ::= QTAGS", - /* 294 */ "tag_item ::= column_name", - /* 295 */ "tag_item ::= column_name column_alias", - /* 296 */ "tag_item ::= column_name AS column_alias", - /* 297 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 298 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 299 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 300 */ "full_index_name ::= index_name", - /* 301 */ "full_index_name ::= db_name NK_DOT index_name", - /* 302 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 303 */ "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", - /* 304 */ "func_list ::= func", - /* 305 */ "func_list ::= func_list NK_COMMA func", - /* 306 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 307 */ "sma_func_name ::= function_name", - /* 308 */ "sma_func_name ::= COUNT", - /* 309 */ "sma_func_name ::= FIRST", - /* 310 */ "sma_func_name ::= LAST", - /* 311 */ "sma_func_name ::= LAST_ROW", - /* 312 */ "sma_stream_opt ::=", - /* 313 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 314 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 315 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 316 */ "with_meta ::= AS", - /* 317 */ "with_meta ::= WITH META AS", - /* 318 */ "with_meta ::= ONLY META AS", - /* 319 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 320 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 321 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 322 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 323 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 324 */ "cmd ::= DESC full_table_name", - /* 325 */ "cmd ::= DESCRIBE full_table_name", - /* 326 */ "cmd ::= RESET QUERY CACHE", - /* 327 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 328 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 329 */ "analyze_opt ::=", - /* 330 */ "analyze_opt ::= ANALYZE", - /* 331 */ "explain_options ::=", - /* 332 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 333 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 334 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 335 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 336 */ "agg_func_opt ::=", - /* 337 */ "agg_func_opt ::= AGGREGATE", - /* 338 */ "bufsize_opt ::=", - /* 339 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 340 */ "language_opt ::=", - /* 341 */ "language_opt ::= LANGUAGE NK_STRING", - /* 342 */ "or_replace_opt ::=", - /* 343 */ "or_replace_opt ::= OR REPLACE", - /* 344 */ "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", - /* 345 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 346 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 347 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 348 */ "col_list_opt ::=", - /* 349 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 350 */ "tag_def_or_ref_opt ::=", - /* 351 */ "tag_def_or_ref_opt ::= tags_def", - /* 352 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 353 */ "stream_options ::=", - /* 354 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 355 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 356 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 357 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 358 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 359 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 360 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 361 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 362 */ "subtable_opt ::=", - /* 363 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 364 */ "ignore_opt ::=", - /* 365 */ "ignore_opt ::= IGNORE UNTREATED", - /* 366 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 367 */ "cmd ::= KILL QUERY NK_STRING", - /* 368 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 369 */ "cmd ::= BALANCE VGROUP", - /* 370 */ "cmd ::= BALANCE VGROUP LEADER", - /* 371 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 372 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 373 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 374 */ "dnode_list ::= DNODE NK_INTEGER", - /* 375 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 376 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 377 */ "cmd ::= query_or_subquery", - /* 378 */ "cmd ::= insert_query", - /* 379 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 380 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 381 */ "literal ::= NK_INTEGER", - /* 382 */ "literal ::= NK_FLOAT", - /* 383 */ "literal ::= NK_STRING", - /* 384 */ "literal ::= NK_BOOL", - /* 385 */ "literal ::= TIMESTAMP NK_STRING", - /* 386 */ "literal ::= duration_literal", - /* 387 */ "literal ::= NULL", - /* 388 */ "literal ::= NK_QUESTION", - /* 389 */ "duration_literal ::= NK_VARIABLE", - /* 390 */ "signed ::= NK_INTEGER", - /* 391 */ "signed ::= NK_PLUS NK_INTEGER", - /* 392 */ "signed ::= NK_MINUS NK_INTEGER", - /* 393 */ "signed ::= NK_FLOAT", - /* 394 */ "signed ::= NK_PLUS NK_FLOAT", - /* 395 */ "signed ::= NK_MINUS NK_FLOAT", - /* 396 */ "signed_literal ::= signed", - /* 397 */ "signed_literal ::= NK_STRING", - /* 398 */ "signed_literal ::= NK_BOOL", - /* 399 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 400 */ "signed_literal ::= duration_literal", - /* 401 */ "signed_literal ::= NULL", - /* 402 */ "signed_literal ::= literal_func", - /* 403 */ "signed_literal ::= NK_QUESTION", - /* 404 */ "literal_list ::= signed_literal", - /* 405 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 406 */ "db_name ::= NK_ID", - /* 407 */ "table_name ::= NK_ID", - /* 408 */ "column_name ::= NK_ID", - /* 409 */ "function_name ::= NK_ID", - /* 410 */ "table_alias ::= NK_ID", - /* 411 */ "column_alias ::= NK_ID", - /* 412 */ "user_name ::= NK_ID", - /* 413 */ "topic_name ::= NK_ID", - /* 414 */ "stream_name ::= NK_ID", - /* 415 */ "cgroup_name ::= NK_ID", - /* 416 */ "index_name ::= NK_ID", - /* 417 */ "expr_or_subquery ::= expression", - /* 418 */ "expression ::= literal", - /* 419 */ "expression ::= pseudo_column", - /* 420 */ "expression ::= column_reference", - /* 421 */ "expression ::= function_expression", - /* 422 */ "expression ::= case_when_expression", - /* 423 */ "expression ::= NK_LP expression NK_RP", - /* 424 */ "expression ::= NK_PLUS expr_or_subquery", - /* 425 */ "expression ::= NK_MINUS expr_or_subquery", - /* 426 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 427 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 428 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 429 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 430 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 431 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 432 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 433 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 434 */ "expression_list ::= expr_or_subquery", - /* 435 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 436 */ "column_reference ::= column_name", - /* 437 */ "column_reference ::= table_name NK_DOT column_name", - /* 438 */ "pseudo_column ::= ROWTS", - /* 439 */ "pseudo_column ::= TBNAME", - /* 440 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 441 */ "pseudo_column ::= QSTART", - /* 442 */ "pseudo_column ::= QEND", - /* 443 */ "pseudo_column ::= QDURATION", - /* 444 */ "pseudo_column ::= WSTART", - /* 445 */ "pseudo_column ::= WEND", - /* 446 */ "pseudo_column ::= WDURATION", - /* 447 */ "pseudo_column ::= IROWTS", - /* 448 */ "pseudo_column ::= ISFILLED", - /* 449 */ "pseudo_column ::= QTAGS", - /* 450 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 451 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 452 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 453 */ "function_expression ::= literal_func", - /* 454 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 455 */ "literal_func ::= NOW", - /* 456 */ "noarg_func ::= NOW", - /* 457 */ "noarg_func ::= TODAY", - /* 458 */ "noarg_func ::= TIMEZONE", - /* 459 */ "noarg_func ::= DATABASE", - /* 460 */ "noarg_func ::= CLIENT_VERSION", - /* 461 */ "noarg_func ::= SERVER_VERSION", - /* 462 */ "noarg_func ::= SERVER_STATUS", - /* 463 */ "noarg_func ::= CURRENT_USER", - /* 464 */ "noarg_func ::= USER", - /* 465 */ "star_func ::= COUNT", - /* 466 */ "star_func ::= FIRST", - /* 467 */ "star_func ::= LAST", - /* 468 */ "star_func ::= LAST_ROW", - /* 469 */ "star_func_para_list ::= NK_STAR", - /* 470 */ "star_func_para_list ::= other_para_list", - /* 471 */ "other_para_list ::= star_func_para", - /* 472 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 473 */ "star_func_para ::= expr_or_subquery", - /* 474 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 475 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 476 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 477 */ "when_then_list ::= when_then_expr", - /* 478 */ "when_then_list ::= when_then_list when_then_expr", - /* 479 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 480 */ "case_when_else_opt ::=", - /* 481 */ "case_when_else_opt ::= ELSE common_expression", - /* 482 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 483 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 484 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 485 */ "predicate ::= expr_or_subquery IS NULL", - /* 486 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 487 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 488 */ "compare_op ::= NK_LT", - /* 489 */ "compare_op ::= NK_GT", - /* 490 */ "compare_op ::= NK_LE", - /* 491 */ "compare_op ::= NK_GE", - /* 492 */ "compare_op ::= NK_NE", - /* 493 */ "compare_op ::= NK_EQ", - /* 494 */ "compare_op ::= LIKE", - /* 495 */ "compare_op ::= NOT LIKE", - /* 496 */ "compare_op ::= MATCH", - /* 497 */ "compare_op ::= NMATCH", - /* 498 */ "compare_op ::= CONTAINS", - /* 499 */ "in_op ::= IN", - /* 500 */ "in_op ::= NOT IN", - /* 501 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 502 */ "boolean_value_expression ::= boolean_primary", - /* 503 */ "boolean_value_expression ::= NOT boolean_primary", - /* 504 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 505 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 506 */ "boolean_primary ::= predicate", - /* 507 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 508 */ "common_expression ::= expr_or_subquery", - /* 509 */ "common_expression ::= boolean_value_expression", - /* 510 */ "from_clause_opt ::=", - /* 511 */ "from_clause_opt ::= FROM table_reference_list", - /* 512 */ "table_reference_list ::= table_reference", - /* 513 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 514 */ "table_reference ::= table_primary", - /* 515 */ "table_reference ::= joined_table", - /* 516 */ "table_primary ::= table_name alias_opt", - /* 517 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 518 */ "table_primary ::= subquery alias_opt", - /* 519 */ "table_primary ::= parenthesized_joined_table", - /* 520 */ "alias_opt ::=", - /* 521 */ "alias_opt ::= table_alias", - /* 522 */ "alias_opt ::= AS table_alias", - /* 523 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 524 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 525 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 526 */ "join_type ::=", - /* 527 */ "join_type ::= INNER", - /* 528 */ "query_specification ::= SELECT hint_list tag_mode_opt 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", - /* 529 */ "hint_list ::=", - /* 530 */ "hint_list ::= NK_HINT", - /* 531 */ "tag_mode_opt ::=", - /* 532 */ "tag_mode_opt ::= TAGS", - /* 533 */ "set_quantifier_opt ::=", - /* 534 */ "set_quantifier_opt ::= DISTINCT", - /* 535 */ "set_quantifier_opt ::= ALL", - /* 536 */ "select_list ::= select_item", - /* 537 */ "select_list ::= select_list NK_COMMA select_item", - /* 538 */ "select_item ::= NK_STAR", - /* 539 */ "select_item ::= common_expression", - /* 540 */ "select_item ::= common_expression column_alias", - /* 541 */ "select_item ::= common_expression AS column_alias", - /* 542 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 543 */ "where_clause_opt ::=", - /* 544 */ "where_clause_opt ::= WHERE search_condition", - /* 545 */ "partition_by_clause_opt ::=", - /* 546 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 547 */ "partition_list ::= partition_item", - /* 548 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 549 */ "partition_item ::= expr_or_subquery", - /* 550 */ "partition_item ::= expr_or_subquery column_alias", - /* 551 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 552 */ "twindow_clause_opt ::=", - /* 553 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 554 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 555 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 556 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 557 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 558 */ "sliding_opt ::=", - /* 559 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 560 */ "fill_opt ::=", - /* 561 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 562 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 563 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 564 */ "fill_mode ::= NONE", - /* 565 */ "fill_mode ::= PREV", - /* 566 */ "fill_mode ::= NULL", - /* 567 */ "fill_mode ::= NULL_F", - /* 568 */ "fill_mode ::= LINEAR", - /* 569 */ "fill_mode ::= NEXT", - /* 570 */ "group_by_clause_opt ::=", - /* 571 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 572 */ "group_by_list ::= expr_or_subquery", - /* 573 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 574 */ "having_clause_opt ::=", - /* 575 */ "having_clause_opt ::= HAVING search_condition", - /* 576 */ "range_opt ::=", - /* 577 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 578 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 579 */ "every_opt ::=", - /* 580 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 581 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 582 */ "query_simple ::= query_specification", - /* 583 */ "query_simple ::= union_query_expression", - /* 584 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 585 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 586 */ "query_simple_or_subquery ::= query_simple", - /* 587 */ "query_simple_or_subquery ::= subquery", - /* 588 */ "query_or_subquery ::= query_expression", - /* 589 */ "query_or_subquery ::= subquery", - /* 590 */ "order_by_clause_opt ::=", - /* 591 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 592 */ "slimit_clause_opt ::=", - /* 593 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 594 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 595 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 596 */ "limit_clause_opt ::=", - /* 597 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 598 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 599 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 600 */ "subquery ::= NK_LP query_expression NK_RP", - /* 601 */ "subquery ::= NK_LP subquery NK_RP", - /* 602 */ "search_condition ::= common_expression", - /* 603 */ "sort_specification_list ::= sort_specification", - /* 604 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 605 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 606 */ "ordering_specification_opt ::=", - /* 607 */ "ordering_specification_opt ::= ASC", - /* 608 */ "ordering_specification_opt ::= DESC", - /* 609 */ "null_ordering_opt ::=", - /* 610 */ "null_ordering_opt ::= NULLS FIRST", - /* 611 */ "null_ordering_opt ::= NULLS LAST", + /* 189 */ "type_name ::= BOOL", + /* 190 */ "type_name ::= TINYINT", + /* 191 */ "type_name ::= SMALLINT", + /* 192 */ "type_name ::= INT", + /* 193 */ "type_name ::= INTEGER", + /* 194 */ "type_name ::= BIGINT", + /* 195 */ "type_name ::= FLOAT", + /* 196 */ "type_name ::= DOUBLE", + /* 197 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 198 */ "type_name ::= TIMESTAMP", + /* 199 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 200 */ "type_name ::= TINYINT UNSIGNED", + /* 201 */ "type_name ::= SMALLINT UNSIGNED", + /* 202 */ "type_name ::= INT UNSIGNED", + /* 203 */ "type_name ::= BIGINT UNSIGNED", + /* 204 */ "type_name ::= JSON", + /* 205 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 206 */ "type_name ::= MEDIUMBLOB", + /* 207 */ "type_name ::= BLOB", + /* 208 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 209 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 210 */ "type_name ::= DECIMAL", + /* 211 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 212 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 213 */ "tags_def_opt ::=", + /* 214 */ "tags_def_opt ::= tags_def", + /* 215 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 216 */ "table_options ::=", + /* 217 */ "table_options ::= table_options COMMENT NK_STRING", + /* 218 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 219 */ "table_options ::= table_options WATERMARK duration_list", + /* 220 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 221 */ "table_options ::= table_options TTL NK_INTEGER", + /* 222 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 223 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 224 */ "alter_table_options ::= alter_table_option", + /* 225 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 226 */ "alter_table_option ::= COMMENT NK_STRING", + /* 227 */ "alter_table_option ::= TTL NK_INTEGER", + /* 228 */ "duration_list ::= duration_literal", + /* 229 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 230 */ "rollup_func_list ::= rollup_func_name", + /* 231 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 232 */ "rollup_func_name ::= function_name", + /* 233 */ "rollup_func_name ::= FIRST", + /* 234 */ "rollup_func_name ::= LAST", + /* 235 */ "col_name_list ::= col_name", + /* 236 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 237 */ "col_name ::= column_name", + /* 238 */ "cmd ::= SHOW DNODES", + /* 239 */ "cmd ::= SHOW USERS", + /* 240 */ "cmd ::= SHOW USER PRIVILEGES", + /* 241 */ "cmd ::= SHOW DATABASES", + /* 242 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 243 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 244 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 245 */ "cmd ::= SHOW MNODES", + /* 246 */ "cmd ::= SHOW QNODES", + /* 247 */ "cmd ::= SHOW FUNCTIONS", + /* 248 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 249 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 250 */ "cmd ::= SHOW STREAMS", + /* 251 */ "cmd ::= SHOW ACCOUNTS", + /* 252 */ "cmd ::= SHOW APPS", + /* 253 */ "cmd ::= SHOW CONNECTIONS", + /* 254 */ "cmd ::= SHOW LICENCES", + /* 255 */ "cmd ::= SHOW GRANTS", + /* 256 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 257 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 258 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 259 */ "cmd ::= SHOW QUERIES", + /* 260 */ "cmd ::= SHOW SCORES", + /* 261 */ "cmd ::= SHOW TOPICS", + /* 262 */ "cmd ::= SHOW VARIABLES", + /* 263 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 264 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 265 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 266 */ "cmd ::= SHOW BNODES", + /* 267 */ "cmd ::= SHOW SNODES", + /* 268 */ "cmd ::= SHOW CLUSTER", + /* 269 */ "cmd ::= SHOW TRANSACTIONS", + /* 270 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 271 */ "cmd ::= SHOW CONSUMERS", + /* 272 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 273 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 274 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 275 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 276 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 277 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 278 */ "cmd ::= SHOW VNODES", + /* 279 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 280 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 281 */ "db_name_cond_opt ::=", + /* 282 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 283 */ "like_pattern_opt ::=", + /* 284 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 285 */ "table_name_cond ::= table_name", + /* 286 */ "from_db_opt ::=", + /* 287 */ "from_db_opt ::= FROM db_name", + /* 288 */ "tag_list_opt ::=", + /* 289 */ "tag_list_opt ::= tag_item", + /* 290 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 291 */ "tag_item ::= TBNAME", + /* 292 */ "tag_item ::= QTAGS", + /* 293 */ "tag_item ::= column_name", + /* 294 */ "tag_item ::= column_name column_alias", + /* 295 */ "tag_item ::= column_name AS column_alias", + /* 296 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 297 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 298 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 299 */ "full_index_name ::= index_name", + /* 300 */ "full_index_name ::= db_name NK_DOT index_name", + /* 301 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 302 */ "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", + /* 303 */ "func_list ::= func", + /* 304 */ "func_list ::= func_list NK_COMMA func", + /* 305 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 306 */ "sma_func_name ::= function_name", + /* 307 */ "sma_func_name ::= COUNT", + /* 308 */ "sma_func_name ::= FIRST", + /* 309 */ "sma_func_name ::= LAST", + /* 310 */ "sma_func_name ::= LAST_ROW", + /* 311 */ "sma_stream_opt ::=", + /* 312 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 313 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 314 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 315 */ "with_meta ::= AS", + /* 316 */ "with_meta ::= WITH META AS", + /* 317 */ "with_meta ::= ONLY META AS", + /* 318 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 319 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 320 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 321 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 322 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 323 */ "cmd ::= DESC full_table_name", + /* 324 */ "cmd ::= DESCRIBE full_table_name", + /* 325 */ "cmd ::= RESET QUERY CACHE", + /* 326 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 327 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 328 */ "analyze_opt ::=", + /* 329 */ "analyze_opt ::= ANALYZE", + /* 330 */ "explain_options ::=", + /* 331 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 332 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 333 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 334 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 335 */ "agg_func_opt ::=", + /* 336 */ "agg_func_opt ::= AGGREGATE", + /* 337 */ "bufsize_opt ::=", + /* 338 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 339 */ "language_opt ::=", + /* 340 */ "language_opt ::= LANGUAGE NK_STRING", + /* 341 */ "or_replace_opt ::=", + /* 342 */ "or_replace_opt ::= OR REPLACE", + /* 343 */ "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", + /* 344 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 345 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 346 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 347 */ "col_list_opt ::=", + /* 348 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 349 */ "tag_def_or_ref_opt ::=", + /* 350 */ "tag_def_or_ref_opt ::= tags_def", + /* 351 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 352 */ "stream_options ::=", + /* 353 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 354 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 355 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 356 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 357 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 358 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 359 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 360 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 361 */ "subtable_opt ::=", + /* 362 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 363 */ "ignore_opt ::=", + /* 364 */ "ignore_opt ::= IGNORE UNTREATED", + /* 365 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 366 */ "cmd ::= KILL QUERY NK_STRING", + /* 367 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 368 */ "cmd ::= BALANCE VGROUP", + /* 369 */ "cmd ::= BALANCE VGROUP LEADER", + /* 370 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 371 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 372 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 373 */ "dnode_list ::= DNODE NK_INTEGER", + /* 374 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 375 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 376 */ "cmd ::= query_or_subquery", + /* 377 */ "cmd ::= insert_query", + /* 378 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 379 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 380 */ "literal ::= NK_INTEGER", + /* 381 */ "literal ::= NK_FLOAT", + /* 382 */ "literal ::= NK_STRING", + /* 383 */ "literal ::= NK_BOOL", + /* 384 */ "literal ::= TIMESTAMP NK_STRING", + /* 385 */ "literal ::= duration_literal", + /* 386 */ "literal ::= NULL", + /* 387 */ "literal ::= NK_QUESTION", + /* 388 */ "duration_literal ::= NK_VARIABLE", + /* 389 */ "signed ::= NK_INTEGER", + /* 390 */ "signed ::= NK_PLUS NK_INTEGER", + /* 391 */ "signed ::= NK_MINUS NK_INTEGER", + /* 392 */ "signed ::= NK_FLOAT", + /* 393 */ "signed ::= NK_PLUS NK_FLOAT", + /* 394 */ "signed ::= NK_MINUS NK_FLOAT", + /* 395 */ "signed_literal ::= signed", + /* 396 */ "signed_literal ::= NK_STRING", + /* 397 */ "signed_literal ::= NK_BOOL", + /* 398 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 399 */ "signed_literal ::= duration_literal", + /* 400 */ "signed_literal ::= NULL", + /* 401 */ "signed_literal ::= literal_func", + /* 402 */ "signed_literal ::= NK_QUESTION", + /* 403 */ "literal_list ::= signed_literal", + /* 404 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 405 */ "db_name ::= NK_ID", + /* 406 */ "table_name ::= NK_ID", + /* 407 */ "column_name ::= NK_ID", + /* 408 */ "function_name ::= NK_ID", + /* 409 */ "table_alias ::= NK_ID", + /* 410 */ "column_alias ::= NK_ID", + /* 411 */ "user_name ::= NK_ID", + /* 412 */ "topic_name ::= NK_ID", + /* 413 */ "stream_name ::= NK_ID", + /* 414 */ "cgroup_name ::= NK_ID", + /* 415 */ "index_name ::= NK_ID", + /* 416 */ "expr_or_subquery ::= expression", + /* 417 */ "expression ::= literal", + /* 418 */ "expression ::= pseudo_column", + /* 419 */ "expression ::= column_reference", + /* 420 */ "expression ::= function_expression", + /* 421 */ "expression ::= case_when_expression", + /* 422 */ "expression ::= NK_LP expression NK_RP", + /* 423 */ "expression ::= NK_PLUS expr_or_subquery", + /* 424 */ "expression ::= NK_MINUS expr_or_subquery", + /* 425 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 426 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 427 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 428 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 429 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 430 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 431 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 432 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 433 */ "expression_list ::= expr_or_subquery", + /* 434 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 435 */ "column_reference ::= column_name", + /* 436 */ "column_reference ::= table_name NK_DOT column_name", + /* 437 */ "pseudo_column ::= ROWTS", + /* 438 */ "pseudo_column ::= TBNAME", + /* 439 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 440 */ "pseudo_column ::= QSTART", + /* 441 */ "pseudo_column ::= QEND", + /* 442 */ "pseudo_column ::= QDURATION", + /* 443 */ "pseudo_column ::= WSTART", + /* 444 */ "pseudo_column ::= WEND", + /* 445 */ "pseudo_column ::= WDURATION", + /* 446 */ "pseudo_column ::= IROWTS", + /* 447 */ "pseudo_column ::= ISFILLED", + /* 448 */ "pseudo_column ::= QTAGS", + /* 449 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 450 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 451 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 452 */ "function_expression ::= literal_func", + /* 453 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 454 */ "literal_func ::= NOW", + /* 455 */ "noarg_func ::= NOW", + /* 456 */ "noarg_func ::= TODAY", + /* 457 */ "noarg_func ::= TIMEZONE", + /* 458 */ "noarg_func ::= DATABASE", + /* 459 */ "noarg_func ::= CLIENT_VERSION", + /* 460 */ "noarg_func ::= SERVER_VERSION", + /* 461 */ "noarg_func ::= SERVER_STATUS", + /* 462 */ "noarg_func ::= CURRENT_USER", + /* 463 */ "noarg_func ::= USER", + /* 464 */ "star_func ::= COUNT", + /* 465 */ "star_func ::= FIRST", + /* 466 */ "star_func ::= LAST", + /* 467 */ "star_func ::= LAST_ROW", + /* 468 */ "star_func_para_list ::= NK_STAR", + /* 469 */ "star_func_para_list ::= other_para_list", + /* 470 */ "other_para_list ::= star_func_para", + /* 471 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 472 */ "star_func_para ::= expr_or_subquery", + /* 473 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 474 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 475 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 476 */ "when_then_list ::= when_then_expr", + /* 477 */ "when_then_list ::= when_then_list when_then_expr", + /* 478 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 479 */ "case_when_else_opt ::=", + /* 480 */ "case_when_else_opt ::= ELSE common_expression", + /* 481 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 482 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 483 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 484 */ "predicate ::= expr_or_subquery IS NULL", + /* 485 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 486 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 487 */ "compare_op ::= NK_LT", + /* 488 */ "compare_op ::= NK_GT", + /* 489 */ "compare_op ::= NK_LE", + /* 490 */ "compare_op ::= NK_GE", + /* 491 */ "compare_op ::= NK_NE", + /* 492 */ "compare_op ::= NK_EQ", + /* 493 */ "compare_op ::= LIKE", + /* 494 */ "compare_op ::= NOT LIKE", + /* 495 */ "compare_op ::= MATCH", + /* 496 */ "compare_op ::= NMATCH", + /* 497 */ "compare_op ::= CONTAINS", + /* 498 */ "in_op ::= IN", + /* 499 */ "in_op ::= NOT IN", + /* 500 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 501 */ "boolean_value_expression ::= boolean_primary", + /* 502 */ "boolean_value_expression ::= NOT boolean_primary", + /* 503 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 504 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 505 */ "boolean_primary ::= predicate", + /* 506 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 507 */ "common_expression ::= expr_or_subquery", + /* 508 */ "common_expression ::= boolean_value_expression", + /* 509 */ "from_clause_opt ::=", + /* 510 */ "from_clause_opt ::= FROM table_reference_list", + /* 511 */ "table_reference_list ::= table_reference", + /* 512 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 513 */ "table_reference ::= table_primary", + /* 514 */ "table_reference ::= joined_table", + /* 515 */ "table_primary ::= table_name alias_opt", + /* 516 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 517 */ "table_primary ::= subquery alias_opt", + /* 518 */ "table_primary ::= parenthesized_joined_table", + /* 519 */ "alias_opt ::=", + /* 520 */ "alias_opt ::= table_alias", + /* 521 */ "alias_opt ::= AS table_alias", + /* 522 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 523 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 524 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 525 */ "join_type ::=", + /* 526 */ "join_type ::= INNER", + /* 527 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 528 */ "hint_list ::=", + /* 529 */ "hint_list ::= NK_HINT", + /* 530 */ "tag_mode_opt ::=", + /* 531 */ "tag_mode_opt ::= TAGS", + /* 532 */ "set_quantifier_opt ::=", + /* 533 */ "set_quantifier_opt ::= DISTINCT", + /* 534 */ "set_quantifier_opt ::= ALL", + /* 535 */ "select_list ::= select_item", + /* 536 */ "select_list ::= select_list NK_COMMA select_item", + /* 537 */ "select_item ::= NK_STAR", + /* 538 */ "select_item ::= common_expression", + /* 539 */ "select_item ::= common_expression column_alias", + /* 540 */ "select_item ::= common_expression AS column_alias", + /* 541 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 542 */ "where_clause_opt ::=", + /* 543 */ "where_clause_opt ::= WHERE search_condition", + /* 544 */ "partition_by_clause_opt ::=", + /* 545 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 546 */ "partition_list ::= partition_item", + /* 547 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 548 */ "partition_item ::= expr_or_subquery", + /* 549 */ "partition_item ::= expr_or_subquery column_alias", + /* 550 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 551 */ "twindow_clause_opt ::=", + /* 552 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 553 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 554 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 555 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 556 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 557 */ "sliding_opt ::=", + /* 558 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 559 */ "fill_opt ::=", + /* 560 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 561 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 562 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 563 */ "fill_mode ::= NONE", + /* 564 */ "fill_mode ::= PREV", + /* 565 */ "fill_mode ::= NULL", + /* 566 */ "fill_mode ::= NULL_F", + /* 567 */ "fill_mode ::= LINEAR", + /* 568 */ "fill_mode ::= NEXT", + /* 569 */ "group_by_clause_opt ::=", + /* 570 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 571 */ "group_by_list ::= expr_or_subquery", + /* 572 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 573 */ "having_clause_opt ::=", + /* 574 */ "having_clause_opt ::= HAVING search_condition", + /* 575 */ "range_opt ::=", + /* 576 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 577 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 578 */ "every_opt ::=", + /* 579 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 580 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 581 */ "query_simple ::= query_specification", + /* 582 */ "query_simple ::= union_query_expression", + /* 583 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 584 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 585 */ "query_simple_or_subquery ::= query_simple", + /* 586 */ "query_simple_or_subquery ::= subquery", + /* 587 */ "query_or_subquery ::= query_expression", + /* 588 */ "query_or_subquery ::= subquery", + /* 589 */ "order_by_clause_opt ::=", + /* 590 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 591 */ "slimit_clause_opt ::=", + /* 592 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 593 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 594 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 595 */ "limit_clause_opt ::=", + /* 596 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 597 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 598 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 599 */ "subquery ::= NK_LP query_expression NK_RP", + /* 600 */ "subquery ::= NK_LP subquery NK_RP", + /* 601 */ "search_condition ::= common_expression", + /* 602 */ "sort_specification_list ::= sort_specification", + /* 603 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 604 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 605 */ "ordering_specification_opt ::=", + /* 606 */ "ordering_specification_opt ::= ASC", + /* 607 */ "ordering_specification_opt ::= DESC", + /* 608 */ "null_ordering_opt ::=", + /* 609 */ "null_ordering_opt ::= NULLS FIRST", + /* 610 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3080,10 +3065,10 @@ static void yy_destructor( case 378: /* table_options */ case 382: /* alter_table_clause */ case 383: /* alter_table_options */ - case 384: /* column_def */ case 386: /* signed_literal */ case 387: /* create_subtable_clause */ case 390: /* drop_table_clause */ + case 392: /* column_def */ case 396: /* duration_literal */ case 397: /* rollup_func_name */ case 399: /* col_name */ @@ -3143,7 +3128,7 @@ static void yy_destructor( { #line 7 "sql.y" nodesDestroyNode((yypminor->yy28)); -#line 3146 "sql.c" +#line 3131 "sql.c" } break; case 341: /* account_options */ @@ -3155,7 +3140,7 @@ static void yy_destructor( { #line 54 "sql.y" -#line 3158 "sql.c" +#line 3143 "sql.c" } break; case 345: /* ip_range_list */ @@ -3194,7 +3179,7 @@ static void yy_destructor( { #line 85 "sql.y" nodesDestroyList((yypminor->yy236)); -#line 3197 "sql.c" +#line 3182 "sql.c" } break; case 348: /* user_name */ @@ -3202,7 +3187,7 @@ static void yy_destructor( case 356: /* table_name */ case 357: /* topic_name */ case 359: /* dnode_endpoint */ - case 385: /* column_name */ + case 384: /* column_name */ case 398: /* function_name */ case 406: /* column_alias */ case 409: /* index_name */ @@ -3217,14 +3202,14 @@ static void yy_destructor( { #line 762 "sql.y" -#line 3220 "sql.c" +#line 3205 "sql.c" } break; case 349: /* sysinfo_opt */ { #line 112 "sql.y" -#line 3227 "sql.c" +#line 3212 "sql.c" } break; case 350: /* privileges */ @@ -3233,14 +3218,14 @@ static void yy_destructor( { #line 121 "sql.y" -#line 3236 "sql.c" +#line 3221 "sql.c" } break; case 351: /* priv_level */ { #line 137 "sql.y" -#line 3243 "sql.c" +#line 3228 "sql.c" } break; case 360: /* force_opt */ @@ -3251,12 +3236,12 @@ static void yy_destructor( case 422: /* or_replace_opt */ case 423: /* agg_func_opt */ case 431: /* ignore_opt */ - case 468: /* tag_mode_opt */ - case 469: /* set_quantifier_opt */ + case 468: /* set_quantifier_opt */ + case 469: /* tag_mode_opt */ { #line 166 "sql.y" -#line 3259 "sql.c" +#line 3244 "sql.c" } break; case 373: /* alter_db_option */ @@ -3264,14 +3249,14 @@ static void yy_destructor( { #line 263 "sql.y" -#line 3267 "sql.c" +#line 3252 "sql.c" } break; - case 392: /* type_name */ + case 385: /* type_name */ { #line 384 "sql.y" -#line 3274 "sql.c" +#line 3259 "sql.c" } break; case 452: /* compare_op */ @@ -3279,35 +3264,35 @@ static void yy_destructor( { #line 950 "sql.y" -#line 3282 "sql.c" +#line 3267 "sql.c" } break; case 465: /* join_type */ { #line 1026 "sql.y" -#line 3289 "sql.c" +#line 3274 "sql.c" } break; case 481: /* fill_mode */ { #line 1112 "sql.y" -#line 3296 "sql.c" +#line 3281 "sql.c" } break; case 492: /* ordering_specification_opt */ { #line 1197 "sql.y" -#line 3303 "sql.c" +#line 3288 "sql.c" } break; case 493: /* null_ordering_opt */ { #line 1203 "sql.y" -#line 3310 "sql.c" +#line 3295 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3746,7 +3731,7 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 371, /* (147) retention_list ::= retention_list NK_COMMA retention */ 374, /* (148) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ 366, /* (149) speed_opt ::= */ - 366, /* (150) speed_opt ::= MAX_SPEED NK_INTEGER */ + 366, /* (150) speed_opt ::= BWLIMIT NK_INTEGER */ 367, /* (151) start_opt ::= */ 367, /* (152) start_opt ::= START WITH NK_INTEGER */ 367, /* (153) start_opt ::= START WITH NK_STRING */ @@ -3763,13 +3748,13 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 340, /* (164) cmd ::= ALTER TABLE alter_table_clause */ 340, /* (165) cmd ::= ALTER STABLE alter_table_clause */ 382, /* (166) alter_table_clause ::= full_table_name alter_table_options */ - 382, /* (167) alter_table_clause ::= full_table_name ADD COLUMN column_def */ + 382, /* (167) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ 382, /* (168) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 382, /* (169) alter_table_clause ::= full_table_name MODIFY COLUMN column_def */ + 382, /* (169) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ 382, /* (170) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 382, /* (171) alter_table_clause ::= full_table_name ADD TAG column_def */ + 382, /* (171) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ 382, /* (172) alter_table_clause ::= full_table_name DROP TAG column_name */ - 382, /* (173) alter_table_clause ::= full_table_name MODIFY TAG column_def */ + 382, /* (173) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ 382, /* (174) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ 382, /* (175) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ 379, /* (176) multi_create_clause ::= create_subtable_clause */ @@ -3784,430 +3769,429 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 375, /* (185) full_table_name ::= db_name NK_DOT table_name */ 376, /* (186) column_def_list ::= column_def */ 376, /* (187) column_def_list ::= column_def_list NK_COMMA column_def */ - 384, /* (188) column_def ::= column_name type_name */ - 384, /* (189) column_def ::= column_name type_name COMMENT NK_STRING */ - 392, /* (190) type_name ::= BOOL */ - 392, /* (191) type_name ::= TINYINT */ - 392, /* (192) type_name ::= SMALLINT */ - 392, /* (193) type_name ::= INT */ - 392, /* (194) type_name ::= INTEGER */ - 392, /* (195) type_name ::= BIGINT */ - 392, /* (196) type_name ::= FLOAT */ - 392, /* (197) type_name ::= DOUBLE */ - 392, /* (198) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 392, /* (199) type_name ::= TIMESTAMP */ - 392, /* (200) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 392, /* (201) type_name ::= TINYINT UNSIGNED */ - 392, /* (202) type_name ::= SMALLINT UNSIGNED */ - 392, /* (203) type_name ::= INT UNSIGNED */ - 392, /* (204) type_name ::= BIGINT UNSIGNED */ - 392, /* (205) type_name ::= JSON */ - 392, /* (206) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 392, /* (207) type_name ::= MEDIUMBLOB */ - 392, /* (208) type_name ::= BLOB */ - 392, /* (209) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 392, /* (210) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 392, /* (211) type_name ::= DECIMAL */ - 392, /* (212) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 392, /* (213) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 377, /* (214) tags_def_opt ::= */ - 377, /* (215) tags_def_opt ::= tags_def */ - 380, /* (216) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 378, /* (217) table_options ::= */ - 378, /* (218) table_options ::= table_options COMMENT NK_STRING */ - 378, /* (219) table_options ::= table_options MAX_DELAY duration_list */ - 378, /* (220) table_options ::= table_options WATERMARK duration_list */ - 378, /* (221) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 378, /* (222) table_options ::= table_options TTL NK_INTEGER */ - 378, /* (223) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 378, /* (224) table_options ::= table_options DELETE_MARK duration_list */ - 383, /* (225) alter_table_options ::= alter_table_option */ - 383, /* (226) alter_table_options ::= alter_table_options alter_table_option */ - 395, /* (227) alter_table_option ::= COMMENT NK_STRING */ - 395, /* (228) alter_table_option ::= TTL NK_INTEGER */ - 393, /* (229) duration_list ::= duration_literal */ - 393, /* (230) duration_list ::= duration_list NK_COMMA duration_literal */ - 394, /* (231) rollup_func_list ::= rollup_func_name */ - 394, /* (232) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 397, /* (233) rollup_func_name ::= function_name */ - 397, /* (234) rollup_func_name ::= FIRST */ - 397, /* (235) rollup_func_name ::= LAST */ - 391, /* (236) col_name_list ::= col_name */ - 391, /* (237) col_name_list ::= col_name_list NK_COMMA col_name */ - 399, /* (238) col_name ::= column_name */ - 340, /* (239) cmd ::= SHOW DNODES */ - 340, /* (240) cmd ::= SHOW USERS */ - 340, /* (241) cmd ::= SHOW USER PRIVILEGES */ - 340, /* (242) cmd ::= SHOW DATABASES */ - 340, /* (243) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - 340, /* (244) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 340, /* (245) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 340, /* (246) cmd ::= SHOW MNODES */ - 340, /* (247) cmd ::= SHOW QNODES */ - 340, /* (248) cmd ::= SHOW FUNCTIONS */ - 340, /* (249) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 340, /* (250) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 340, /* (251) cmd ::= SHOW STREAMS */ - 340, /* (252) cmd ::= SHOW ACCOUNTS */ - 340, /* (253) cmd ::= SHOW APPS */ - 340, /* (254) cmd ::= SHOW CONNECTIONS */ - 340, /* (255) cmd ::= SHOW LICENCES */ - 340, /* (256) cmd ::= SHOW GRANTS */ - 340, /* (257) cmd ::= SHOW CREATE DATABASE db_name */ - 340, /* (258) cmd ::= SHOW CREATE TABLE full_table_name */ - 340, /* (259) cmd ::= SHOW CREATE STABLE full_table_name */ - 340, /* (260) cmd ::= SHOW QUERIES */ - 340, /* (261) cmd ::= SHOW SCORES */ - 340, /* (262) cmd ::= SHOW TOPICS */ - 340, /* (263) cmd ::= SHOW VARIABLES */ - 340, /* (264) cmd ::= SHOW CLUSTER VARIABLES */ - 340, /* (265) cmd ::= SHOW LOCAL VARIABLES */ - 340, /* (266) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 340, /* (267) cmd ::= SHOW BNODES */ - 340, /* (268) cmd ::= SHOW SNODES */ - 340, /* (269) cmd ::= SHOW CLUSTER */ - 340, /* (270) cmd ::= SHOW TRANSACTIONS */ - 340, /* (271) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 340, /* (272) cmd ::= SHOW CONSUMERS */ - 340, /* (273) cmd ::= SHOW SUBSCRIPTIONS */ - 340, /* (274) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 340, /* (275) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 340, /* (276) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 340, /* (277) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 340, /* (278) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 340, /* (279) cmd ::= SHOW VNODES */ - 340, /* (280) cmd ::= SHOW db_name_cond_opt ALIVE */ - 340, /* (281) cmd ::= SHOW CLUSTER ALIVE */ - 400, /* (282) db_name_cond_opt ::= */ - 400, /* (283) db_name_cond_opt ::= db_name NK_DOT */ - 401, /* (284) like_pattern_opt ::= */ - 401, /* (285) like_pattern_opt ::= LIKE NK_STRING */ - 402, /* (286) table_name_cond ::= table_name */ - 403, /* (287) from_db_opt ::= */ - 403, /* (288) from_db_opt ::= FROM db_name */ - 404, /* (289) tag_list_opt ::= */ - 404, /* (290) tag_list_opt ::= tag_item */ - 404, /* (291) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 405, /* (292) tag_item ::= TBNAME */ - 405, /* (293) tag_item ::= QTAGS */ - 405, /* (294) tag_item ::= column_name */ - 405, /* (295) tag_item ::= column_name column_alias */ - 405, /* (296) tag_item ::= column_name AS column_alias */ - 340, /* (297) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - 340, /* (298) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - 340, /* (299) cmd ::= DROP INDEX exists_opt full_index_name */ - 407, /* (300) full_index_name ::= index_name */ - 407, /* (301) full_index_name ::= db_name NK_DOT index_name */ - 408, /* (302) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 408, /* (303) 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 */ - 410, /* (304) func_list ::= func */ - 410, /* (305) func_list ::= func_list NK_COMMA func */ - 413, /* (306) func ::= sma_func_name NK_LP expression_list NK_RP */ - 414, /* (307) sma_func_name ::= function_name */ - 414, /* (308) sma_func_name ::= COUNT */ - 414, /* (309) sma_func_name ::= FIRST */ - 414, /* (310) sma_func_name ::= LAST */ - 414, /* (311) sma_func_name ::= LAST_ROW */ - 412, /* (312) sma_stream_opt ::= */ - 412, /* (313) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 412, /* (314) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 412, /* (315) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 415, /* (316) with_meta ::= AS */ - 415, /* (317) with_meta ::= WITH META AS */ - 415, /* (318) with_meta ::= ONLY META AS */ - 340, /* (319) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 340, /* (320) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 340, /* (321) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 340, /* (322) cmd ::= DROP TOPIC exists_opt topic_name */ - 340, /* (323) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 340, /* (324) cmd ::= DESC full_table_name */ - 340, /* (325) cmd ::= DESCRIBE full_table_name */ - 340, /* (326) cmd ::= RESET QUERY CACHE */ - 340, /* (327) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 340, /* (328) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 419, /* (329) analyze_opt ::= */ - 419, /* (330) analyze_opt ::= ANALYZE */ - 420, /* (331) explain_options ::= */ - 420, /* (332) explain_options ::= explain_options VERBOSE NK_BOOL */ - 420, /* (333) explain_options ::= explain_options RATIO NK_FLOAT */ - 340, /* (334) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 340, /* (335) cmd ::= DROP FUNCTION exists_opt function_name */ - 423, /* (336) agg_func_opt ::= */ - 423, /* (337) agg_func_opt ::= AGGREGATE */ - 424, /* (338) bufsize_opt ::= */ - 424, /* (339) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 425, /* (340) language_opt ::= */ - 425, /* (341) language_opt ::= LANGUAGE NK_STRING */ - 422, /* (342) or_replace_opt ::= */ - 422, /* (343) or_replace_opt ::= OR REPLACE */ - 340, /* (344) 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 */ - 340, /* (345) cmd ::= DROP STREAM exists_opt stream_name */ - 340, /* (346) cmd ::= PAUSE STREAM exists_opt stream_name */ - 340, /* (347) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 428, /* (348) col_list_opt ::= */ - 428, /* (349) col_list_opt ::= NK_LP col_name_list NK_RP */ - 429, /* (350) tag_def_or_ref_opt ::= */ - 429, /* (351) tag_def_or_ref_opt ::= tags_def */ - 429, /* (352) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 427, /* (353) stream_options ::= */ - 427, /* (354) stream_options ::= stream_options TRIGGER AT_ONCE */ - 427, /* (355) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 427, /* (356) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 427, /* (357) stream_options ::= stream_options WATERMARK duration_literal */ - 427, /* (358) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 427, /* (359) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 427, /* (360) stream_options ::= stream_options DELETE_MARK duration_literal */ - 427, /* (361) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 430, /* (362) subtable_opt ::= */ - 430, /* (363) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 431, /* (364) ignore_opt ::= */ - 431, /* (365) ignore_opt ::= IGNORE UNTREATED */ - 340, /* (366) cmd ::= KILL CONNECTION NK_INTEGER */ - 340, /* (367) cmd ::= KILL QUERY NK_STRING */ - 340, /* (368) cmd ::= KILL TRANSACTION NK_INTEGER */ - 340, /* (369) cmd ::= BALANCE VGROUP */ - 340, /* (370) cmd ::= BALANCE VGROUP LEADER */ - 340, /* (371) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 340, /* (372) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 340, /* (373) cmd ::= SPLIT VGROUP NK_INTEGER */ - 433, /* (374) dnode_list ::= DNODE NK_INTEGER */ - 433, /* (375) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 340, /* (376) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 340, /* (377) cmd ::= query_or_subquery */ - 340, /* (378) cmd ::= insert_query */ - 421, /* (379) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 421, /* (380) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 343, /* (381) literal ::= NK_INTEGER */ - 343, /* (382) literal ::= NK_FLOAT */ - 343, /* (383) literal ::= NK_STRING */ - 343, /* (384) literal ::= NK_BOOL */ - 343, /* (385) literal ::= TIMESTAMP NK_STRING */ - 343, /* (386) literal ::= duration_literal */ - 343, /* (387) literal ::= NULL */ - 343, /* (388) literal ::= NK_QUESTION */ - 396, /* (389) duration_literal ::= NK_VARIABLE */ - 372, /* (390) signed ::= NK_INTEGER */ - 372, /* (391) signed ::= NK_PLUS NK_INTEGER */ - 372, /* (392) signed ::= NK_MINUS NK_INTEGER */ - 372, /* (393) signed ::= NK_FLOAT */ - 372, /* (394) signed ::= NK_PLUS NK_FLOAT */ - 372, /* (395) signed ::= NK_MINUS NK_FLOAT */ - 386, /* (396) signed_literal ::= signed */ - 386, /* (397) signed_literal ::= NK_STRING */ - 386, /* (398) signed_literal ::= NK_BOOL */ - 386, /* (399) signed_literal ::= TIMESTAMP NK_STRING */ - 386, /* (400) signed_literal ::= duration_literal */ - 386, /* (401) signed_literal ::= NULL */ - 386, /* (402) signed_literal ::= literal_func */ - 386, /* (403) signed_literal ::= NK_QUESTION */ - 435, /* (404) literal_list ::= signed_literal */ - 435, /* (405) literal_list ::= literal_list NK_COMMA signed_literal */ - 355, /* (406) db_name ::= NK_ID */ - 356, /* (407) table_name ::= NK_ID */ - 385, /* (408) column_name ::= NK_ID */ - 398, /* (409) function_name ::= NK_ID */ - 436, /* (410) table_alias ::= NK_ID */ - 406, /* (411) column_alias ::= NK_ID */ - 348, /* (412) user_name ::= NK_ID */ - 357, /* (413) topic_name ::= NK_ID */ - 426, /* (414) stream_name ::= NK_ID */ - 418, /* (415) cgroup_name ::= NK_ID */ - 409, /* (416) index_name ::= NK_ID */ - 437, /* (417) expr_or_subquery ::= expression */ - 432, /* (418) expression ::= literal */ - 432, /* (419) expression ::= pseudo_column */ - 432, /* (420) expression ::= column_reference */ - 432, /* (421) expression ::= function_expression */ - 432, /* (422) expression ::= case_when_expression */ - 432, /* (423) expression ::= NK_LP expression NK_RP */ - 432, /* (424) expression ::= NK_PLUS expr_or_subquery */ - 432, /* (425) expression ::= NK_MINUS expr_or_subquery */ - 432, /* (426) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 432, /* (427) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 432, /* (428) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 432, /* (429) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 432, /* (430) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 432, /* (431) expression ::= column_reference NK_ARROW NK_STRING */ - 432, /* (432) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 432, /* (433) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 389, /* (434) expression_list ::= expr_or_subquery */ - 389, /* (435) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 439, /* (436) column_reference ::= column_name */ - 439, /* (437) column_reference ::= table_name NK_DOT column_name */ - 438, /* (438) pseudo_column ::= ROWTS */ - 438, /* (439) pseudo_column ::= TBNAME */ - 438, /* (440) pseudo_column ::= table_name NK_DOT TBNAME */ - 438, /* (441) pseudo_column ::= QSTART */ - 438, /* (442) pseudo_column ::= QEND */ - 438, /* (443) pseudo_column ::= QDURATION */ - 438, /* (444) pseudo_column ::= WSTART */ - 438, /* (445) pseudo_column ::= WEND */ - 438, /* (446) pseudo_column ::= WDURATION */ - 438, /* (447) pseudo_column ::= IROWTS */ - 438, /* (448) pseudo_column ::= ISFILLED */ - 438, /* (449) pseudo_column ::= QTAGS */ - 440, /* (450) function_expression ::= function_name NK_LP expression_list NK_RP */ - 440, /* (451) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 440, /* (452) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 440, /* (453) function_expression ::= literal_func */ - 434, /* (454) literal_func ::= noarg_func NK_LP NK_RP */ - 434, /* (455) literal_func ::= NOW */ - 444, /* (456) noarg_func ::= NOW */ - 444, /* (457) noarg_func ::= TODAY */ - 444, /* (458) noarg_func ::= TIMEZONE */ - 444, /* (459) noarg_func ::= DATABASE */ - 444, /* (460) noarg_func ::= CLIENT_VERSION */ - 444, /* (461) noarg_func ::= SERVER_VERSION */ - 444, /* (462) noarg_func ::= SERVER_STATUS */ - 444, /* (463) noarg_func ::= CURRENT_USER */ - 444, /* (464) noarg_func ::= USER */ - 442, /* (465) star_func ::= COUNT */ - 442, /* (466) star_func ::= FIRST */ - 442, /* (467) star_func ::= LAST */ - 442, /* (468) star_func ::= LAST_ROW */ - 443, /* (469) star_func_para_list ::= NK_STAR */ - 443, /* (470) star_func_para_list ::= other_para_list */ - 445, /* (471) other_para_list ::= star_func_para */ - 445, /* (472) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 446, /* (473) star_func_para ::= expr_or_subquery */ - 446, /* (474) star_func_para ::= table_name NK_DOT NK_STAR */ - 441, /* (475) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 441, /* (476) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 447, /* (477) when_then_list ::= when_then_expr */ - 447, /* (478) when_then_list ::= when_then_list when_then_expr */ - 450, /* (479) when_then_expr ::= WHEN common_expression THEN common_expression */ - 448, /* (480) case_when_else_opt ::= */ - 448, /* (481) case_when_else_opt ::= ELSE common_expression */ - 451, /* (482) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 451, /* (483) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 451, /* (484) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 451, /* (485) predicate ::= expr_or_subquery IS NULL */ - 451, /* (486) predicate ::= expr_or_subquery IS NOT NULL */ - 451, /* (487) predicate ::= expr_or_subquery in_op in_predicate_value */ - 452, /* (488) compare_op ::= NK_LT */ - 452, /* (489) compare_op ::= NK_GT */ - 452, /* (490) compare_op ::= NK_LE */ - 452, /* (491) compare_op ::= NK_GE */ - 452, /* (492) compare_op ::= NK_NE */ - 452, /* (493) compare_op ::= NK_EQ */ - 452, /* (494) compare_op ::= LIKE */ - 452, /* (495) compare_op ::= NOT LIKE */ - 452, /* (496) compare_op ::= MATCH */ - 452, /* (497) compare_op ::= NMATCH */ - 452, /* (498) compare_op ::= CONTAINS */ - 453, /* (499) in_op ::= IN */ - 453, /* (500) in_op ::= NOT IN */ - 454, /* (501) in_predicate_value ::= NK_LP literal_list NK_RP */ - 455, /* (502) boolean_value_expression ::= boolean_primary */ - 455, /* (503) boolean_value_expression ::= NOT boolean_primary */ - 455, /* (504) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 455, /* (505) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 456, /* (506) boolean_primary ::= predicate */ - 456, /* (507) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 449, /* (508) common_expression ::= expr_or_subquery */ - 449, /* (509) common_expression ::= boolean_value_expression */ - 457, /* (510) from_clause_opt ::= */ - 457, /* (511) from_clause_opt ::= FROM table_reference_list */ - 458, /* (512) table_reference_list ::= table_reference */ - 458, /* (513) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 459, /* (514) table_reference ::= table_primary */ - 459, /* (515) table_reference ::= joined_table */ - 460, /* (516) table_primary ::= table_name alias_opt */ - 460, /* (517) table_primary ::= db_name NK_DOT table_name alias_opt */ - 460, /* (518) table_primary ::= subquery alias_opt */ - 460, /* (519) table_primary ::= parenthesized_joined_table */ - 462, /* (520) alias_opt ::= */ - 462, /* (521) alias_opt ::= table_alias */ - 462, /* (522) alias_opt ::= AS table_alias */ - 464, /* (523) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 464, /* (524) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 461, /* (525) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 465, /* (526) join_type ::= */ - 465, /* (527) join_type ::= INNER */ - 466, /* (528) query_specification ::= SELECT hint_list tag_mode_opt 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 */ - 467, /* (529) hint_list ::= */ - 467, /* (530) hint_list ::= NK_HINT */ - 468, /* (531) tag_mode_opt ::= */ - 468, /* (532) tag_mode_opt ::= TAGS */ - 469, /* (533) set_quantifier_opt ::= */ - 469, /* (534) set_quantifier_opt ::= DISTINCT */ - 469, /* (535) set_quantifier_opt ::= ALL */ - 470, /* (536) select_list ::= select_item */ - 470, /* (537) select_list ::= select_list NK_COMMA select_item */ - 478, /* (538) select_item ::= NK_STAR */ - 478, /* (539) select_item ::= common_expression */ - 478, /* (540) select_item ::= common_expression column_alias */ - 478, /* (541) select_item ::= common_expression AS column_alias */ - 478, /* (542) select_item ::= table_name NK_DOT NK_STAR */ - 417, /* (543) where_clause_opt ::= */ - 417, /* (544) where_clause_opt ::= WHERE search_condition */ - 471, /* (545) partition_by_clause_opt ::= */ - 471, /* (546) partition_by_clause_opt ::= PARTITION BY partition_list */ - 479, /* (547) partition_list ::= partition_item */ - 479, /* (548) partition_list ::= partition_list NK_COMMA partition_item */ - 480, /* (549) partition_item ::= expr_or_subquery */ - 480, /* (550) partition_item ::= expr_or_subquery column_alias */ - 480, /* (551) partition_item ::= expr_or_subquery AS column_alias */ - 475, /* (552) twindow_clause_opt ::= */ - 475, /* (553) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - 475, /* (554) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 475, /* (555) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - 475, /* (556) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - 475, /* (557) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 411, /* (558) sliding_opt ::= */ - 411, /* (559) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 474, /* (560) fill_opt ::= */ - 474, /* (561) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 474, /* (562) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 474, /* (563) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 481, /* (564) fill_mode ::= NONE */ - 481, /* (565) fill_mode ::= PREV */ - 481, /* (566) fill_mode ::= NULL */ - 481, /* (567) fill_mode ::= NULL_F */ - 481, /* (568) fill_mode ::= LINEAR */ - 481, /* (569) fill_mode ::= NEXT */ - 476, /* (570) group_by_clause_opt ::= */ - 476, /* (571) group_by_clause_opt ::= GROUP BY group_by_list */ - 482, /* (572) group_by_list ::= expr_or_subquery */ - 482, /* (573) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 477, /* (574) having_clause_opt ::= */ - 477, /* (575) having_clause_opt ::= HAVING search_condition */ - 472, /* (576) range_opt ::= */ - 472, /* (577) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 472, /* (578) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 473, /* (579) every_opt ::= */ - 473, /* (580) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 483, /* (581) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 484, /* (582) query_simple ::= query_specification */ - 484, /* (583) query_simple ::= union_query_expression */ - 488, /* (584) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 488, /* (585) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 489, /* (586) query_simple_or_subquery ::= query_simple */ - 489, /* (587) query_simple_or_subquery ::= subquery */ - 416, /* (588) query_or_subquery ::= query_expression */ - 416, /* (589) query_or_subquery ::= subquery */ - 485, /* (590) order_by_clause_opt ::= */ - 485, /* (591) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 486, /* (592) slimit_clause_opt ::= */ - 486, /* (593) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 486, /* (594) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 486, /* (595) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 487, /* (596) limit_clause_opt ::= */ - 487, /* (597) limit_clause_opt ::= LIMIT NK_INTEGER */ - 487, /* (598) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 487, /* (599) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 463, /* (600) subquery ::= NK_LP query_expression NK_RP */ - 463, /* (601) subquery ::= NK_LP subquery NK_RP */ - 358, /* (602) search_condition ::= common_expression */ - 490, /* (603) sort_specification_list ::= sort_specification */ - 490, /* (604) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 491, /* (605) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 492, /* (606) ordering_specification_opt ::= */ - 492, /* (607) ordering_specification_opt ::= ASC */ - 492, /* (608) ordering_specification_opt ::= DESC */ - 493, /* (609) null_ordering_opt ::= */ - 493, /* (610) null_ordering_opt ::= NULLS FIRST */ - 493, /* (611) null_ordering_opt ::= NULLS LAST */ + 392, /* (188) column_def ::= column_name type_name */ + 385, /* (189) type_name ::= BOOL */ + 385, /* (190) type_name ::= TINYINT */ + 385, /* (191) type_name ::= SMALLINT */ + 385, /* (192) type_name ::= INT */ + 385, /* (193) type_name ::= INTEGER */ + 385, /* (194) type_name ::= BIGINT */ + 385, /* (195) type_name ::= FLOAT */ + 385, /* (196) type_name ::= DOUBLE */ + 385, /* (197) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 385, /* (198) type_name ::= TIMESTAMP */ + 385, /* (199) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 385, /* (200) type_name ::= TINYINT UNSIGNED */ + 385, /* (201) type_name ::= SMALLINT UNSIGNED */ + 385, /* (202) type_name ::= INT UNSIGNED */ + 385, /* (203) type_name ::= BIGINT UNSIGNED */ + 385, /* (204) type_name ::= JSON */ + 385, /* (205) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 385, /* (206) type_name ::= MEDIUMBLOB */ + 385, /* (207) type_name ::= BLOB */ + 385, /* (208) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 385, /* (209) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 385, /* (210) type_name ::= DECIMAL */ + 385, /* (211) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 385, /* (212) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 377, /* (213) tags_def_opt ::= */ + 377, /* (214) tags_def_opt ::= tags_def */ + 380, /* (215) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 378, /* (216) table_options ::= */ + 378, /* (217) table_options ::= table_options COMMENT NK_STRING */ + 378, /* (218) table_options ::= table_options MAX_DELAY duration_list */ + 378, /* (219) table_options ::= table_options WATERMARK duration_list */ + 378, /* (220) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 378, /* (221) table_options ::= table_options TTL NK_INTEGER */ + 378, /* (222) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 378, /* (223) table_options ::= table_options DELETE_MARK duration_list */ + 383, /* (224) alter_table_options ::= alter_table_option */ + 383, /* (225) alter_table_options ::= alter_table_options alter_table_option */ + 395, /* (226) alter_table_option ::= COMMENT NK_STRING */ + 395, /* (227) alter_table_option ::= TTL NK_INTEGER */ + 393, /* (228) duration_list ::= duration_literal */ + 393, /* (229) duration_list ::= duration_list NK_COMMA duration_literal */ + 394, /* (230) rollup_func_list ::= rollup_func_name */ + 394, /* (231) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 397, /* (232) rollup_func_name ::= function_name */ + 397, /* (233) rollup_func_name ::= FIRST */ + 397, /* (234) rollup_func_name ::= LAST */ + 391, /* (235) col_name_list ::= col_name */ + 391, /* (236) col_name_list ::= col_name_list NK_COMMA col_name */ + 399, /* (237) col_name ::= column_name */ + 340, /* (238) cmd ::= SHOW DNODES */ + 340, /* (239) cmd ::= SHOW USERS */ + 340, /* (240) cmd ::= SHOW USER PRIVILEGES */ + 340, /* (241) cmd ::= SHOW DATABASES */ + 340, /* (242) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + 340, /* (243) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 340, /* (244) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 340, /* (245) cmd ::= SHOW MNODES */ + 340, /* (246) cmd ::= SHOW QNODES */ + 340, /* (247) cmd ::= SHOW FUNCTIONS */ + 340, /* (248) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 340, /* (249) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 340, /* (250) cmd ::= SHOW STREAMS */ + 340, /* (251) cmd ::= SHOW ACCOUNTS */ + 340, /* (252) cmd ::= SHOW APPS */ + 340, /* (253) cmd ::= SHOW CONNECTIONS */ + 340, /* (254) cmd ::= SHOW LICENCES */ + 340, /* (255) cmd ::= SHOW GRANTS */ + 340, /* (256) cmd ::= SHOW CREATE DATABASE db_name */ + 340, /* (257) cmd ::= SHOW CREATE TABLE full_table_name */ + 340, /* (258) cmd ::= SHOW CREATE STABLE full_table_name */ + 340, /* (259) cmd ::= SHOW QUERIES */ + 340, /* (260) cmd ::= SHOW SCORES */ + 340, /* (261) cmd ::= SHOW TOPICS */ + 340, /* (262) cmd ::= SHOW VARIABLES */ + 340, /* (263) cmd ::= SHOW CLUSTER VARIABLES */ + 340, /* (264) cmd ::= SHOW LOCAL VARIABLES */ + 340, /* (265) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 340, /* (266) cmd ::= SHOW BNODES */ + 340, /* (267) cmd ::= SHOW SNODES */ + 340, /* (268) cmd ::= SHOW CLUSTER */ + 340, /* (269) cmd ::= SHOW TRANSACTIONS */ + 340, /* (270) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 340, /* (271) cmd ::= SHOW CONSUMERS */ + 340, /* (272) cmd ::= SHOW SUBSCRIPTIONS */ + 340, /* (273) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 340, /* (274) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 340, /* (275) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 340, /* (276) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 340, /* (277) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 340, /* (278) cmd ::= SHOW VNODES */ + 340, /* (279) cmd ::= SHOW db_name_cond_opt ALIVE */ + 340, /* (280) cmd ::= SHOW CLUSTER ALIVE */ + 400, /* (281) db_name_cond_opt ::= */ + 400, /* (282) db_name_cond_opt ::= db_name NK_DOT */ + 401, /* (283) like_pattern_opt ::= */ + 401, /* (284) like_pattern_opt ::= LIKE NK_STRING */ + 402, /* (285) table_name_cond ::= table_name */ + 403, /* (286) from_db_opt ::= */ + 403, /* (287) from_db_opt ::= FROM db_name */ + 404, /* (288) tag_list_opt ::= */ + 404, /* (289) tag_list_opt ::= tag_item */ + 404, /* (290) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 405, /* (291) tag_item ::= TBNAME */ + 405, /* (292) tag_item ::= QTAGS */ + 405, /* (293) tag_item ::= column_name */ + 405, /* (294) tag_item ::= column_name column_alias */ + 405, /* (295) tag_item ::= column_name AS column_alias */ + 340, /* (296) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + 340, /* (297) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + 340, /* (298) cmd ::= DROP INDEX exists_opt full_index_name */ + 407, /* (299) full_index_name ::= index_name */ + 407, /* (300) full_index_name ::= db_name NK_DOT index_name */ + 408, /* (301) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 408, /* (302) 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 */ + 410, /* (303) func_list ::= func */ + 410, /* (304) func_list ::= func_list NK_COMMA func */ + 413, /* (305) func ::= sma_func_name NK_LP expression_list NK_RP */ + 414, /* (306) sma_func_name ::= function_name */ + 414, /* (307) sma_func_name ::= COUNT */ + 414, /* (308) sma_func_name ::= FIRST */ + 414, /* (309) sma_func_name ::= LAST */ + 414, /* (310) sma_func_name ::= LAST_ROW */ + 412, /* (311) sma_stream_opt ::= */ + 412, /* (312) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 412, /* (313) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 412, /* (314) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 415, /* (315) with_meta ::= AS */ + 415, /* (316) with_meta ::= WITH META AS */ + 415, /* (317) with_meta ::= ONLY META AS */ + 340, /* (318) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 340, /* (319) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 340, /* (320) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 340, /* (321) cmd ::= DROP TOPIC exists_opt topic_name */ + 340, /* (322) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 340, /* (323) cmd ::= DESC full_table_name */ + 340, /* (324) cmd ::= DESCRIBE full_table_name */ + 340, /* (325) cmd ::= RESET QUERY CACHE */ + 340, /* (326) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 340, /* (327) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 419, /* (328) analyze_opt ::= */ + 419, /* (329) analyze_opt ::= ANALYZE */ + 420, /* (330) explain_options ::= */ + 420, /* (331) explain_options ::= explain_options VERBOSE NK_BOOL */ + 420, /* (332) explain_options ::= explain_options RATIO NK_FLOAT */ + 340, /* (333) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 340, /* (334) cmd ::= DROP FUNCTION exists_opt function_name */ + 423, /* (335) agg_func_opt ::= */ + 423, /* (336) agg_func_opt ::= AGGREGATE */ + 424, /* (337) bufsize_opt ::= */ + 424, /* (338) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 425, /* (339) language_opt ::= */ + 425, /* (340) language_opt ::= LANGUAGE NK_STRING */ + 422, /* (341) or_replace_opt ::= */ + 422, /* (342) or_replace_opt ::= OR REPLACE */ + 340, /* (343) 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 */ + 340, /* (344) cmd ::= DROP STREAM exists_opt stream_name */ + 340, /* (345) cmd ::= PAUSE STREAM exists_opt stream_name */ + 340, /* (346) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 428, /* (347) col_list_opt ::= */ + 428, /* (348) col_list_opt ::= NK_LP col_name_list NK_RP */ + 429, /* (349) tag_def_or_ref_opt ::= */ + 429, /* (350) tag_def_or_ref_opt ::= tags_def */ + 429, /* (351) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 427, /* (352) stream_options ::= */ + 427, /* (353) stream_options ::= stream_options TRIGGER AT_ONCE */ + 427, /* (354) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 427, /* (355) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 427, /* (356) stream_options ::= stream_options WATERMARK duration_literal */ + 427, /* (357) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 427, /* (358) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 427, /* (359) stream_options ::= stream_options DELETE_MARK duration_literal */ + 427, /* (360) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 430, /* (361) subtable_opt ::= */ + 430, /* (362) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 431, /* (363) ignore_opt ::= */ + 431, /* (364) ignore_opt ::= IGNORE UNTREATED */ + 340, /* (365) cmd ::= KILL CONNECTION NK_INTEGER */ + 340, /* (366) cmd ::= KILL QUERY NK_STRING */ + 340, /* (367) cmd ::= KILL TRANSACTION NK_INTEGER */ + 340, /* (368) cmd ::= BALANCE VGROUP */ + 340, /* (369) cmd ::= BALANCE VGROUP LEADER */ + 340, /* (370) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 340, /* (371) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 340, /* (372) cmd ::= SPLIT VGROUP NK_INTEGER */ + 433, /* (373) dnode_list ::= DNODE NK_INTEGER */ + 433, /* (374) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 340, /* (375) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 340, /* (376) cmd ::= query_or_subquery */ + 340, /* (377) cmd ::= insert_query */ + 421, /* (378) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 421, /* (379) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 343, /* (380) literal ::= NK_INTEGER */ + 343, /* (381) literal ::= NK_FLOAT */ + 343, /* (382) literal ::= NK_STRING */ + 343, /* (383) literal ::= NK_BOOL */ + 343, /* (384) literal ::= TIMESTAMP NK_STRING */ + 343, /* (385) literal ::= duration_literal */ + 343, /* (386) literal ::= NULL */ + 343, /* (387) literal ::= NK_QUESTION */ + 396, /* (388) duration_literal ::= NK_VARIABLE */ + 372, /* (389) signed ::= NK_INTEGER */ + 372, /* (390) signed ::= NK_PLUS NK_INTEGER */ + 372, /* (391) signed ::= NK_MINUS NK_INTEGER */ + 372, /* (392) signed ::= NK_FLOAT */ + 372, /* (393) signed ::= NK_PLUS NK_FLOAT */ + 372, /* (394) signed ::= NK_MINUS NK_FLOAT */ + 386, /* (395) signed_literal ::= signed */ + 386, /* (396) signed_literal ::= NK_STRING */ + 386, /* (397) signed_literal ::= NK_BOOL */ + 386, /* (398) signed_literal ::= TIMESTAMP NK_STRING */ + 386, /* (399) signed_literal ::= duration_literal */ + 386, /* (400) signed_literal ::= NULL */ + 386, /* (401) signed_literal ::= literal_func */ + 386, /* (402) signed_literal ::= NK_QUESTION */ + 435, /* (403) literal_list ::= signed_literal */ + 435, /* (404) literal_list ::= literal_list NK_COMMA signed_literal */ + 355, /* (405) db_name ::= NK_ID */ + 356, /* (406) table_name ::= NK_ID */ + 384, /* (407) column_name ::= NK_ID */ + 398, /* (408) function_name ::= NK_ID */ + 436, /* (409) table_alias ::= NK_ID */ + 406, /* (410) column_alias ::= NK_ID */ + 348, /* (411) user_name ::= NK_ID */ + 357, /* (412) topic_name ::= NK_ID */ + 426, /* (413) stream_name ::= NK_ID */ + 418, /* (414) cgroup_name ::= NK_ID */ + 409, /* (415) index_name ::= NK_ID */ + 437, /* (416) expr_or_subquery ::= expression */ + 432, /* (417) expression ::= literal */ + 432, /* (418) expression ::= pseudo_column */ + 432, /* (419) expression ::= column_reference */ + 432, /* (420) expression ::= function_expression */ + 432, /* (421) expression ::= case_when_expression */ + 432, /* (422) expression ::= NK_LP expression NK_RP */ + 432, /* (423) expression ::= NK_PLUS expr_or_subquery */ + 432, /* (424) expression ::= NK_MINUS expr_or_subquery */ + 432, /* (425) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 432, /* (426) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 432, /* (427) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 432, /* (428) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 432, /* (429) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 432, /* (430) expression ::= column_reference NK_ARROW NK_STRING */ + 432, /* (431) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 432, /* (432) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 389, /* (433) expression_list ::= expr_or_subquery */ + 389, /* (434) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 439, /* (435) column_reference ::= column_name */ + 439, /* (436) column_reference ::= table_name NK_DOT column_name */ + 438, /* (437) pseudo_column ::= ROWTS */ + 438, /* (438) pseudo_column ::= TBNAME */ + 438, /* (439) pseudo_column ::= table_name NK_DOT TBNAME */ + 438, /* (440) pseudo_column ::= QSTART */ + 438, /* (441) pseudo_column ::= QEND */ + 438, /* (442) pseudo_column ::= QDURATION */ + 438, /* (443) pseudo_column ::= WSTART */ + 438, /* (444) pseudo_column ::= WEND */ + 438, /* (445) pseudo_column ::= WDURATION */ + 438, /* (446) pseudo_column ::= IROWTS */ + 438, /* (447) pseudo_column ::= ISFILLED */ + 438, /* (448) pseudo_column ::= QTAGS */ + 440, /* (449) function_expression ::= function_name NK_LP expression_list NK_RP */ + 440, /* (450) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 440, /* (451) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 440, /* (452) function_expression ::= literal_func */ + 434, /* (453) literal_func ::= noarg_func NK_LP NK_RP */ + 434, /* (454) literal_func ::= NOW */ + 444, /* (455) noarg_func ::= NOW */ + 444, /* (456) noarg_func ::= TODAY */ + 444, /* (457) noarg_func ::= TIMEZONE */ + 444, /* (458) noarg_func ::= DATABASE */ + 444, /* (459) noarg_func ::= CLIENT_VERSION */ + 444, /* (460) noarg_func ::= SERVER_VERSION */ + 444, /* (461) noarg_func ::= SERVER_STATUS */ + 444, /* (462) noarg_func ::= CURRENT_USER */ + 444, /* (463) noarg_func ::= USER */ + 442, /* (464) star_func ::= COUNT */ + 442, /* (465) star_func ::= FIRST */ + 442, /* (466) star_func ::= LAST */ + 442, /* (467) star_func ::= LAST_ROW */ + 443, /* (468) star_func_para_list ::= NK_STAR */ + 443, /* (469) star_func_para_list ::= other_para_list */ + 445, /* (470) other_para_list ::= star_func_para */ + 445, /* (471) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 446, /* (472) star_func_para ::= expr_or_subquery */ + 446, /* (473) star_func_para ::= table_name NK_DOT NK_STAR */ + 441, /* (474) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 441, /* (475) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 447, /* (476) when_then_list ::= when_then_expr */ + 447, /* (477) when_then_list ::= when_then_list when_then_expr */ + 450, /* (478) when_then_expr ::= WHEN common_expression THEN common_expression */ + 448, /* (479) case_when_else_opt ::= */ + 448, /* (480) case_when_else_opt ::= ELSE common_expression */ + 451, /* (481) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 451, /* (482) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 451, /* (483) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 451, /* (484) predicate ::= expr_or_subquery IS NULL */ + 451, /* (485) predicate ::= expr_or_subquery IS NOT NULL */ + 451, /* (486) predicate ::= expr_or_subquery in_op in_predicate_value */ + 452, /* (487) compare_op ::= NK_LT */ + 452, /* (488) compare_op ::= NK_GT */ + 452, /* (489) compare_op ::= NK_LE */ + 452, /* (490) compare_op ::= NK_GE */ + 452, /* (491) compare_op ::= NK_NE */ + 452, /* (492) compare_op ::= NK_EQ */ + 452, /* (493) compare_op ::= LIKE */ + 452, /* (494) compare_op ::= NOT LIKE */ + 452, /* (495) compare_op ::= MATCH */ + 452, /* (496) compare_op ::= NMATCH */ + 452, /* (497) compare_op ::= CONTAINS */ + 453, /* (498) in_op ::= IN */ + 453, /* (499) in_op ::= NOT IN */ + 454, /* (500) in_predicate_value ::= NK_LP literal_list NK_RP */ + 455, /* (501) boolean_value_expression ::= boolean_primary */ + 455, /* (502) boolean_value_expression ::= NOT boolean_primary */ + 455, /* (503) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 455, /* (504) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 456, /* (505) boolean_primary ::= predicate */ + 456, /* (506) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 449, /* (507) common_expression ::= expr_or_subquery */ + 449, /* (508) common_expression ::= boolean_value_expression */ + 457, /* (509) from_clause_opt ::= */ + 457, /* (510) from_clause_opt ::= FROM table_reference_list */ + 458, /* (511) table_reference_list ::= table_reference */ + 458, /* (512) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 459, /* (513) table_reference ::= table_primary */ + 459, /* (514) table_reference ::= joined_table */ + 460, /* (515) table_primary ::= table_name alias_opt */ + 460, /* (516) table_primary ::= db_name NK_DOT table_name alias_opt */ + 460, /* (517) table_primary ::= subquery alias_opt */ + 460, /* (518) table_primary ::= parenthesized_joined_table */ + 462, /* (519) alias_opt ::= */ + 462, /* (520) alias_opt ::= table_alias */ + 462, /* (521) alias_opt ::= AS table_alias */ + 464, /* (522) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 464, /* (523) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 461, /* (524) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 465, /* (525) join_type ::= */ + 465, /* (526) join_type ::= INNER */ + 466, /* (527) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 467, /* (528) hint_list ::= */ + 467, /* (529) hint_list ::= NK_HINT */ + 469, /* (530) tag_mode_opt ::= */ + 469, /* (531) tag_mode_opt ::= TAGS */ + 468, /* (532) set_quantifier_opt ::= */ + 468, /* (533) set_quantifier_opt ::= DISTINCT */ + 468, /* (534) set_quantifier_opt ::= ALL */ + 470, /* (535) select_list ::= select_item */ + 470, /* (536) select_list ::= select_list NK_COMMA select_item */ + 478, /* (537) select_item ::= NK_STAR */ + 478, /* (538) select_item ::= common_expression */ + 478, /* (539) select_item ::= common_expression column_alias */ + 478, /* (540) select_item ::= common_expression AS column_alias */ + 478, /* (541) select_item ::= table_name NK_DOT NK_STAR */ + 417, /* (542) where_clause_opt ::= */ + 417, /* (543) where_clause_opt ::= WHERE search_condition */ + 471, /* (544) partition_by_clause_opt ::= */ + 471, /* (545) partition_by_clause_opt ::= PARTITION BY partition_list */ + 479, /* (546) partition_list ::= partition_item */ + 479, /* (547) partition_list ::= partition_list NK_COMMA partition_item */ + 480, /* (548) partition_item ::= expr_or_subquery */ + 480, /* (549) partition_item ::= expr_or_subquery column_alias */ + 480, /* (550) partition_item ::= expr_or_subquery AS column_alias */ + 475, /* (551) twindow_clause_opt ::= */ + 475, /* (552) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + 475, /* (553) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 475, /* (554) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + 475, /* (555) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + 475, /* (556) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 411, /* (557) sliding_opt ::= */ + 411, /* (558) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 474, /* (559) fill_opt ::= */ + 474, /* (560) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 474, /* (561) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 474, /* (562) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 481, /* (563) fill_mode ::= NONE */ + 481, /* (564) fill_mode ::= PREV */ + 481, /* (565) fill_mode ::= NULL */ + 481, /* (566) fill_mode ::= NULL_F */ + 481, /* (567) fill_mode ::= LINEAR */ + 481, /* (568) fill_mode ::= NEXT */ + 476, /* (569) group_by_clause_opt ::= */ + 476, /* (570) group_by_clause_opt ::= GROUP BY group_by_list */ + 482, /* (571) group_by_list ::= expr_or_subquery */ + 482, /* (572) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 477, /* (573) having_clause_opt ::= */ + 477, /* (574) having_clause_opt ::= HAVING search_condition */ + 472, /* (575) range_opt ::= */ + 472, /* (576) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 472, /* (577) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 473, /* (578) every_opt ::= */ + 473, /* (579) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 483, /* (580) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 484, /* (581) query_simple ::= query_specification */ + 484, /* (582) query_simple ::= union_query_expression */ + 488, /* (583) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 488, /* (584) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 489, /* (585) query_simple_or_subquery ::= query_simple */ + 489, /* (586) query_simple_or_subquery ::= subquery */ + 416, /* (587) query_or_subquery ::= query_expression */ + 416, /* (588) query_or_subquery ::= subquery */ + 485, /* (589) order_by_clause_opt ::= */ + 485, /* (590) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 486, /* (591) slimit_clause_opt ::= */ + 486, /* (592) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 486, /* (593) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 486, /* (594) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 487, /* (595) limit_clause_opt ::= */ + 487, /* (596) limit_clause_opt ::= LIMIT NK_INTEGER */ + 487, /* (597) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 487, /* (598) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 463, /* (599) subquery ::= NK_LP query_expression NK_RP */ + 463, /* (600) subquery ::= NK_LP subquery NK_RP */ + 358, /* (601) search_condition ::= common_expression */ + 490, /* (602) sort_specification_list ::= sort_specification */ + 490, /* (603) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 491, /* (604) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 492, /* (605) ordering_specification_opt ::= */ + 492, /* (606) ordering_specification_opt ::= ASC */ + 492, /* (607) ordering_specification_opt ::= DESC */ + 493, /* (608) null_ordering_opt ::= */ + 493, /* (609) null_ordering_opt ::= NULLS FIRST */ + 493, /* (610) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4363,7 +4347,7 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (147) retention_list ::= retention_list NK_COMMA retention */ -3, /* (148) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ 0, /* (149) speed_opt ::= */ - -2, /* (150) speed_opt ::= MAX_SPEED NK_INTEGER */ + -2, /* (150) speed_opt ::= BWLIMIT NK_INTEGER */ 0, /* (151) start_opt ::= */ -3, /* (152) start_opt ::= START WITH NK_INTEGER */ -3, /* (153) start_opt ::= START WITH NK_STRING */ @@ -4380,13 +4364,13 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (164) cmd ::= ALTER TABLE alter_table_clause */ -3, /* (165) cmd ::= ALTER STABLE alter_table_clause */ -2, /* (166) alter_table_clause ::= full_table_name alter_table_options */ - -4, /* (167) alter_table_clause ::= full_table_name ADD COLUMN column_def */ + -5, /* (167) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -4, /* (168) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -4, /* (169) alter_table_clause ::= full_table_name MODIFY COLUMN column_def */ + -5, /* (169) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -5, /* (170) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -4, /* (171) alter_table_clause ::= full_table_name ADD TAG column_def */ + -5, /* (171) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -4, /* (172) alter_table_clause ::= full_table_name DROP TAG column_name */ - -4, /* (173) alter_table_clause ::= full_table_name MODIFY TAG column_def */ + -5, /* (173) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -5, /* (174) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -6, /* (175) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -1, /* (176) multi_create_clause ::= create_subtable_clause */ @@ -4402,429 +4386,428 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (186) column_def_list ::= column_def */ -3, /* (187) column_def_list ::= column_def_list NK_COMMA column_def */ -2, /* (188) column_def ::= column_name type_name */ - -4, /* (189) column_def ::= column_name type_name COMMENT NK_STRING */ - -1, /* (190) type_name ::= BOOL */ - -1, /* (191) type_name ::= TINYINT */ - -1, /* (192) type_name ::= SMALLINT */ - -1, /* (193) type_name ::= INT */ - -1, /* (194) type_name ::= INTEGER */ - -1, /* (195) type_name ::= BIGINT */ - -1, /* (196) type_name ::= FLOAT */ - -1, /* (197) type_name ::= DOUBLE */ - -4, /* (198) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (199) type_name ::= TIMESTAMP */ - -4, /* (200) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (201) type_name ::= TINYINT UNSIGNED */ - -2, /* (202) type_name ::= SMALLINT UNSIGNED */ - -2, /* (203) type_name ::= INT UNSIGNED */ - -2, /* (204) type_name ::= BIGINT UNSIGNED */ - -1, /* (205) type_name ::= JSON */ - -4, /* (206) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (207) type_name ::= MEDIUMBLOB */ - -1, /* (208) type_name ::= BLOB */ - -4, /* (209) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (210) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (211) type_name ::= DECIMAL */ - -4, /* (212) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (213) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (214) tags_def_opt ::= */ - -1, /* (215) tags_def_opt ::= tags_def */ - -4, /* (216) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 0, /* (217) table_options ::= */ - -3, /* (218) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (219) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (220) table_options ::= table_options WATERMARK duration_list */ - -5, /* (221) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (222) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (223) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (224) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (225) alter_table_options ::= alter_table_option */ - -2, /* (226) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (227) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (228) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (229) duration_list ::= duration_literal */ - -3, /* (230) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (231) rollup_func_list ::= rollup_func_name */ - -3, /* (232) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (233) rollup_func_name ::= function_name */ - -1, /* (234) rollup_func_name ::= FIRST */ - -1, /* (235) rollup_func_name ::= LAST */ - -1, /* (236) col_name_list ::= col_name */ - -3, /* (237) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (238) col_name ::= column_name */ - -2, /* (239) cmd ::= SHOW DNODES */ - -2, /* (240) cmd ::= SHOW USERS */ - -3, /* (241) cmd ::= SHOW USER PRIVILEGES */ - -2, /* (242) cmd ::= SHOW DATABASES */ - -4, /* (243) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (244) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (245) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (246) cmd ::= SHOW MNODES */ - -2, /* (247) cmd ::= SHOW QNODES */ - -2, /* (248) cmd ::= SHOW FUNCTIONS */ - -5, /* (249) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (250) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (251) cmd ::= SHOW STREAMS */ - -2, /* (252) cmd ::= SHOW ACCOUNTS */ - -2, /* (253) cmd ::= SHOW APPS */ - -2, /* (254) cmd ::= SHOW CONNECTIONS */ - -2, /* (255) cmd ::= SHOW LICENCES */ - -2, /* (256) cmd ::= SHOW GRANTS */ - -4, /* (257) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (258) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (259) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (260) cmd ::= SHOW QUERIES */ - -2, /* (261) cmd ::= SHOW SCORES */ - -2, /* (262) cmd ::= SHOW TOPICS */ - -2, /* (263) cmd ::= SHOW VARIABLES */ - -3, /* (264) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (265) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (266) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (267) cmd ::= SHOW BNODES */ - -2, /* (268) cmd ::= SHOW SNODES */ - -2, /* (269) cmd ::= SHOW CLUSTER */ - -2, /* (270) cmd ::= SHOW TRANSACTIONS */ - -4, /* (271) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (272) cmd ::= SHOW CONSUMERS */ - -2, /* (273) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (274) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (275) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (276) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (277) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (278) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (279) cmd ::= SHOW VNODES */ - -3, /* (280) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (281) cmd ::= SHOW CLUSTER ALIVE */ - 0, /* (282) db_name_cond_opt ::= */ - -2, /* (283) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (284) like_pattern_opt ::= */ - -2, /* (285) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (286) table_name_cond ::= table_name */ - 0, /* (287) from_db_opt ::= */ - -2, /* (288) from_db_opt ::= FROM db_name */ - 0, /* (289) tag_list_opt ::= */ - -1, /* (290) tag_list_opt ::= tag_item */ - -3, /* (291) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (292) tag_item ::= TBNAME */ - -1, /* (293) tag_item ::= QTAGS */ - -1, /* (294) tag_item ::= column_name */ - -2, /* (295) tag_item ::= column_name column_alias */ - -3, /* (296) tag_item ::= column_name AS column_alias */ - -8, /* (297) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - -9, /* (298) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (299) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (300) full_index_name ::= index_name */ - -3, /* (301) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (302) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (303) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - -1, /* (304) func_list ::= func */ - -3, /* (305) func_list ::= func_list NK_COMMA func */ - -4, /* (306) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (307) sma_func_name ::= function_name */ - -1, /* (308) sma_func_name ::= COUNT */ - -1, /* (309) sma_func_name ::= FIRST */ - -1, /* (310) sma_func_name ::= LAST */ - -1, /* (311) sma_func_name ::= LAST_ROW */ - 0, /* (312) sma_stream_opt ::= */ - -3, /* (313) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (314) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (315) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (316) with_meta ::= AS */ - -3, /* (317) with_meta ::= WITH META AS */ - -3, /* (318) with_meta ::= ONLY META AS */ - -6, /* (319) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (320) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (321) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (322) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (323) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (324) cmd ::= DESC full_table_name */ - -2, /* (325) cmd ::= DESCRIBE full_table_name */ - -3, /* (326) cmd ::= RESET QUERY CACHE */ - -4, /* (327) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (328) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (329) analyze_opt ::= */ - -1, /* (330) analyze_opt ::= ANALYZE */ - 0, /* (331) explain_options ::= */ - -3, /* (332) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (333) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (334) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (335) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (336) agg_func_opt ::= */ - -1, /* (337) agg_func_opt ::= AGGREGATE */ - 0, /* (338) bufsize_opt ::= */ - -2, /* (339) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (340) language_opt ::= */ - -2, /* (341) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (342) or_replace_opt ::= */ - -2, /* (343) or_replace_opt ::= OR REPLACE */ - -12, /* (344) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (345) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (346) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (347) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (348) col_list_opt ::= */ - -3, /* (349) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (350) tag_def_or_ref_opt ::= */ - -1, /* (351) tag_def_or_ref_opt ::= tags_def */ - -4, /* (352) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (353) stream_options ::= */ - -3, /* (354) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (355) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (356) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (357) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (358) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (359) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (360) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (361) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (362) subtable_opt ::= */ - -4, /* (363) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (364) ignore_opt ::= */ - -2, /* (365) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (366) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (367) cmd ::= KILL QUERY NK_STRING */ - -3, /* (368) cmd ::= KILL TRANSACTION NK_INTEGER */ - -2, /* (369) cmd ::= BALANCE VGROUP */ - -3, /* (370) cmd ::= BALANCE VGROUP LEADER */ - -4, /* (371) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (372) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (373) cmd ::= SPLIT VGROUP NK_INTEGER */ - -2, /* (374) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (375) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (376) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (377) cmd ::= query_or_subquery */ - -1, /* (378) cmd ::= insert_query */ - -7, /* (379) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (380) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (381) literal ::= NK_INTEGER */ - -1, /* (382) literal ::= NK_FLOAT */ - -1, /* (383) literal ::= NK_STRING */ - -1, /* (384) literal ::= NK_BOOL */ - -2, /* (385) literal ::= TIMESTAMP NK_STRING */ - -1, /* (386) literal ::= duration_literal */ - -1, /* (387) literal ::= NULL */ - -1, /* (388) literal ::= NK_QUESTION */ - -1, /* (389) duration_literal ::= NK_VARIABLE */ - -1, /* (390) signed ::= NK_INTEGER */ - -2, /* (391) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (392) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (393) signed ::= NK_FLOAT */ - -2, /* (394) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (395) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (396) signed_literal ::= signed */ - -1, /* (397) signed_literal ::= NK_STRING */ - -1, /* (398) signed_literal ::= NK_BOOL */ - -2, /* (399) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (400) signed_literal ::= duration_literal */ - -1, /* (401) signed_literal ::= NULL */ - -1, /* (402) signed_literal ::= literal_func */ - -1, /* (403) signed_literal ::= NK_QUESTION */ - -1, /* (404) literal_list ::= signed_literal */ - -3, /* (405) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (406) db_name ::= NK_ID */ - -1, /* (407) table_name ::= NK_ID */ - -1, /* (408) column_name ::= NK_ID */ - -1, /* (409) function_name ::= NK_ID */ - -1, /* (410) table_alias ::= NK_ID */ - -1, /* (411) column_alias ::= NK_ID */ - -1, /* (412) user_name ::= NK_ID */ - -1, /* (413) topic_name ::= NK_ID */ - -1, /* (414) stream_name ::= NK_ID */ - -1, /* (415) cgroup_name ::= NK_ID */ - -1, /* (416) index_name ::= NK_ID */ - -1, /* (417) expr_or_subquery ::= expression */ - -1, /* (418) expression ::= literal */ - -1, /* (419) expression ::= pseudo_column */ - -1, /* (420) expression ::= column_reference */ - -1, /* (421) expression ::= function_expression */ - -1, /* (422) expression ::= case_when_expression */ - -3, /* (423) expression ::= NK_LP expression NK_RP */ - -2, /* (424) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (425) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (426) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (427) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (428) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (429) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (430) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (431) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (432) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (433) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (434) expression_list ::= expr_or_subquery */ - -3, /* (435) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (436) column_reference ::= column_name */ - -3, /* (437) column_reference ::= table_name NK_DOT column_name */ - -1, /* (438) pseudo_column ::= ROWTS */ - -1, /* (439) pseudo_column ::= TBNAME */ - -3, /* (440) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (441) pseudo_column ::= QSTART */ - -1, /* (442) pseudo_column ::= QEND */ - -1, /* (443) pseudo_column ::= QDURATION */ - -1, /* (444) pseudo_column ::= WSTART */ - -1, /* (445) pseudo_column ::= WEND */ - -1, /* (446) pseudo_column ::= WDURATION */ - -1, /* (447) pseudo_column ::= IROWTS */ - -1, /* (448) pseudo_column ::= ISFILLED */ - -1, /* (449) pseudo_column ::= QTAGS */ - -4, /* (450) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (451) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (452) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (453) function_expression ::= literal_func */ - -3, /* (454) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (455) literal_func ::= NOW */ - -1, /* (456) noarg_func ::= NOW */ - -1, /* (457) noarg_func ::= TODAY */ - -1, /* (458) noarg_func ::= TIMEZONE */ - -1, /* (459) noarg_func ::= DATABASE */ - -1, /* (460) noarg_func ::= CLIENT_VERSION */ - -1, /* (461) noarg_func ::= SERVER_VERSION */ - -1, /* (462) noarg_func ::= SERVER_STATUS */ - -1, /* (463) noarg_func ::= CURRENT_USER */ - -1, /* (464) noarg_func ::= USER */ - -1, /* (465) star_func ::= COUNT */ - -1, /* (466) star_func ::= FIRST */ - -1, /* (467) star_func ::= LAST */ - -1, /* (468) star_func ::= LAST_ROW */ - -1, /* (469) star_func_para_list ::= NK_STAR */ - -1, /* (470) star_func_para_list ::= other_para_list */ - -1, /* (471) other_para_list ::= star_func_para */ - -3, /* (472) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (473) star_func_para ::= expr_or_subquery */ - -3, /* (474) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (475) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (476) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (477) when_then_list ::= when_then_expr */ - -2, /* (478) when_then_list ::= when_then_list when_then_expr */ - -4, /* (479) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (480) case_when_else_opt ::= */ - -2, /* (481) case_when_else_opt ::= ELSE common_expression */ - -3, /* (482) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (483) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (484) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (485) predicate ::= expr_or_subquery IS NULL */ - -4, /* (486) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (487) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (488) compare_op ::= NK_LT */ - -1, /* (489) compare_op ::= NK_GT */ - -1, /* (490) compare_op ::= NK_LE */ - -1, /* (491) compare_op ::= NK_GE */ - -1, /* (492) compare_op ::= NK_NE */ - -1, /* (493) compare_op ::= NK_EQ */ - -1, /* (494) compare_op ::= LIKE */ - -2, /* (495) compare_op ::= NOT LIKE */ - -1, /* (496) compare_op ::= MATCH */ - -1, /* (497) compare_op ::= NMATCH */ - -1, /* (498) compare_op ::= CONTAINS */ - -1, /* (499) in_op ::= IN */ - -2, /* (500) in_op ::= NOT IN */ - -3, /* (501) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (502) boolean_value_expression ::= boolean_primary */ - -2, /* (503) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (504) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (505) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (506) boolean_primary ::= predicate */ - -3, /* (507) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (508) common_expression ::= expr_or_subquery */ - -1, /* (509) common_expression ::= boolean_value_expression */ - 0, /* (510) from_clause_opt ::= */ - -2, /* (511) from_clause_opt ::= FROM table_reference_list */ - -1, /* (512) table_reference_list ::= table_reference */ - -3, /* (513) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (514) table_reference ::= table_primary */ - -1, /* (515) table_reference ::= joined_table */ - -2, /* (516) table_primary ::= table_name alias_opt */ - -4, /* (517) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (518) table_primary ::= subquery alias_opt */ - -1, /* (519) table_primary ::= parenthesized_joined_table */ - 0, /* (520) alias_opt ::= */ - -1, /* (521) alias_opt ::= table_alias */ - -2, /* (522) alias_opt ::= AS table_alias */ - -3, /* (523) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (524) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (525) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (526) join_type ::= */ - -1, /* (527) join_type ::= INNER */ - -14, /* (528) query_specification ::= SELECT hint_list tag_mode_opt 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 */ - 0, /* (529) hint_list ::= */ - -1, /* (530) hint_list ::= NK_HINT */ - 0, /* (531) tag_mode_opt ::= */ - -1, /* (532) tag_mode_opt ::= TAGS */ - 0, /* (533) set_quantifier_opt ::= */ - -1, /* (534) set_quantifier_opt ::= DISTINCT */ - -1, /* (535) set_quantifier_opt ::= ALL */ - -1, /* (536) select_list ::= select_item */ - -3, /* (537) select_list ::= select_list NK_COMMA select_item */ - -1, /* (538) select_item ::= NK_STAR */ - -1, /* (539) select_item ::= common_expression */ - -2, /* (540) select_item ::= common_expression column_alias */ - -3, /* (541) select_item ::= common_expression AS column_alias */ - -3, /* (542) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (543) where_clause_opt ::= */ - -2, /* (544) where_clause_opt ::= WHERE search_condition */ - 0, /* (545) partition_by_clause_opt ::= */ - -3, /* (546) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (547) partition_list ::= partition_item */ - -3, /* (548) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (549) partition_item ::= expr_or_subquery */ - -2, /* (550) partition_item ::= expr_or_subquery column_alias */ - -3, /* (551) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (552) twindow_clause_opt ::= */ - -6, /* (553) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - -4, /* (554) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (555) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (556) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (557) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (558) sliding_opt ::= */ - -4, /* (559) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 0, /* (560) fill_opt ::= */ - -4, /* (561) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (562) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (563) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (564) fill_mode ::= NONE */ - -1, /* (565) fill_mode ::= PREV */ - -1, /* (566) fill_mode ::= NULL */ - -1, /* (567) fill_mode ::= NULL_F */ - -1, /* (568) fill_mode ::= LINEAR */ - -1, /* (569) fill_mode ::= NEXT */ - 0, /* (570) group_by_clause_opt ::= */ - -3, /* (571) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (572) group_by_list ::= expr_or_subquery */ - -3, /* (573) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (574) having_clause_opt ::= */ - -2, /* (575) having_clause_opt ::= HAVING search_condition */ - 0, /* (576) range_opt ::= */ - -6, /* (577) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (578) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (579) every_opt ::= */ - -4, /* (580) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (581) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (582) query_simple ::= query_specification */ - -1, /* (583) query_simple ::= union_query_expression */ - -4, /* (584) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (585) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (586) query_simple_or_subquery ::= query_simple */ - -1, /* (587) query_simple_or_subquery ::= subquery */ - -1, /* (588) query_or_subquery ::= query_expression */ - -1, /* (589) query_or_subquery ::= subquery */ - 0, /* (590) order_by_clause_opt ::= */ - -3, /* (591) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (592) slimit_clause_opt ::= */ - -2, /* (593) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (594) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (595) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (596) limit_clause_opt ::= */ - -2, /* (597) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (598) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (599) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (600) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (601) subquery ::= NK_LP subquery NK_RP */ - -1, /* (602) search_condition ::= common_expression */ - -1, /* (603) sort_specification_list ::= sort_specification */ - -3, /* (604) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (605) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (606) ordering_specification_opt ::= */ - -1, /* (607) ordering_specification_opt ::= ASC */ - -1, /* (608) ordering_specification_opt ::= DESC */ - 0, /* (609) null_ordering_opt ::= */ - -2, /* (610) null_ordering_opt ::= NULLS FIRST */ - -2, /* (611) null_ordering_opt ::= NULLS LAST */ + -1, /* (189) type_name ::= BOOL */ + -1, /* (190) type_name ::= TINYINT */ + -1, /* (191) type_name ::= SMALLINT */ + -1, /* (192) type_name ::= INT */ + -1, /* (193) type_name ::= INTEGER */ + -1, /* (194) type_name ::= BIGINT */ + -1, /* (195) type_name ::= FLOAT */ + -1, /* (196) type_name ::= DOUBLE */ + -4, /* (197) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (198) type_name ::= TIMESTAMP */ + -4, /* (199) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (200) type_name ::= TINYINT UNSIGNED */ + -2, /* (201) type_name ::= SMALLINT UNSIGNED */ + -2, /* (202) type_name ::= INT UNSIGNED */ + -2, /* (203) type_name ::= BIGINT UNSIGNED */ + -1, /* (204) type_name ::= JSON */ + -4, /* (205) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (206) type_name ::= MEDIUMBLOB */ + -1, /* (207) type_name ::= BLOB */ + -4, /* (208) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (209) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (210) type_name ::= DECIMAL */ + -4, /* (211) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (212) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (213) tags_def_opt ::= */ + -1, /* (214) tags_def_opt ::= tags_def */ + -4, /* (215) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 0, /* (216) table_options ::= */ + -3, /* (217) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (218) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (219) table_options ::= table_options WATERMARK duration_list */ + -5, /* (220) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (221) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (222) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (223) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (224) alter_table_options ::= alter_table_option */ + -2, /* (225) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (226) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (227) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (228) duration_list ::= duration_literal */ + -3, /* (229) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (230) rollup_func_list ::= rollup_func_name */ + -3, /* (231) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (232) rollup_func_name ::= function_name */ + -1, /* (233) rollup_func_name ::= FIRST */ + -1, /* (234) rollup_func_name ::= LAST */ + -1, /* (235) col_name_list ::= col_name */ + -3, /* (236) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (237) col_name ::= column_name */ + -2, /* (238) cmd ::= SHOW DNODES */ + -2, /* (239) cmd ::= SHOW USERS */ + -3, /* (240) cmd ::= SHOW USER PRIVILEGES */ + -2, /* (241) cmd ::= SHOW DATABASES */ + -4, /* (242) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (243) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (244) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (245) cmd ::= SHOW MNODES */ + -2, /* (246) cmd ::= SHOW QNODES */ + -2, /* (247) cmd ::= SHOW FUNCTIONS */ + -5, /* (248) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (249) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (250) cmd ::= SHOW STREAMS */ + -2, /* (251) cmd ::= SHOW ACCOUNTS */ + -2, /* (252) cmd ::= SHOW APPS */ + -2, /* (253) cmd ::= SHOW CONNECTIONS */ + -2, /* (254) cmd ::= SHOW LICENCES */ + -2, /* (255) cmd ::= SHOW GRANTS */ + -4, /* (256) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (257) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (258) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (259) cmd ::= SHOW QUERIES */ + -2, /* (260) cmd ::= SHOW SCORES */ + -2, /* (261) cmd ::= SHOW TOPICS */ + -2, /* (262) cmd ::= SHOW VARIABLES */ + -3, /* (263) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (264) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (265) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (266) cmd ::= SHOW BNODES */ + -2, /* (267) cmd ::= SHOW SNODES */ + -2, /* (268) cmd ::= SHOW CLUSTER */ + -2, /* (269) cmd ::= SHOW TRANSACTIONS */ + -4, /* (270) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (271) cmd ::= SHOW CONSUMERS */ + -2, /* (272) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (273) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (274) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (275) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (276) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (277) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (278) cmd ::= SHOW VNODES */ + -3, /* (279) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (280) cmd ::= SHOW CLUSTER ALIVE */ + 0, /* (281) db_name_cond_opt ::= */ + -2, /* (282) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (283) like_pattern_opt ::= */ + -2, /* (284) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (285) table_name_cond ::= table_name */ + 0, /* (286) from_db_opt ::= */ + -2, /* (287) from_db_opt ::= FROM db_name */ + 0, /* (288) tag_list_opt ::= */ + -1, /* (289) tag_list_opt ::= tag_item */ + -3, /* (290) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (291) tag_item ::= TBNAME */ + -1, /* (292) tag_item ::= QTAGS */ + -1, /* (293) tag_item ::= column_name */ + -2, /* (294) tag_item ::= column_name column_alias */ + -3, /* (295) tag_item ::= column_name AS column_alias */ + -8, /* (296) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + -9, /* (297) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (298) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (299) full_index_name ::= index_name */ + -3, /* (300) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (301) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (302) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + -1, /* (303) func_list ::= func */ + -3, /* (304) func_list ::= func_list NK_COMMA func */ + -4, /* (305) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (306) sma_func_name ::= function_name */ + -1, /* (307) sma_func_name ::= COUNT */ + -1, /* (308) sma_func_name ::= FIRST */ + -1, /* (309) sma_func_name ::= LAST */ + -1, /* (310) sma_func_name ::= LAST_ROW */ + 0, /* (311) sma_stream_opt ::= */ + -3, /* (312) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (313) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (314) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (315) with_meta ::= AS */ + -3, /* (316) with_meta ::= WITH META AS */ + -3, /* (317) with_meta ::= ONLY META AS */ + -6, /* (318) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (319) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (320) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (321) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (322) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (323) cmd ::= DESC full_table_name */ + -2, /* (324) cmd ::= DESCRIBE full_table_name */ + -3, /* (325) cmd ::= RESET QUERY CACHE */ + -4, /* (326) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (327) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (328) analyze_opt ::= */ + -1, /* (329) analyze_opt ::= ANALYZE */ + 0, /* (330) explain_options ::= */ + -3, /* (331) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (332) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (333) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + -4, /* (334) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (335) agg_func_opt ::= */ + -1, /* (336) agg_func_opt ::= AGGREGATE */ + 0, /* (337) bufsize_opt ::= */ + -2, /* (338) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (339) language_opt ::= */ + -2, /* (340) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (341) or_replace_opt ::= */ + -2, /* (342) or_replace_opt ::= OR REPLACE */ + -12, /* (343) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + -4, /* (344) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (345) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (346) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (347) col_list_opt ::= */ + -3, /* (348) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (349) tag_def_or_ref_opt ::= */ + -1, /* (350) tag_def_or_ref_opt ::= tags_def */ + -4, /* (351) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 0, /* (352) stream_options ::= */ + -3, /* (353) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (354) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (355) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (356) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (357) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (358) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (359) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (360) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (361) subtable_opt ::= */ + -4, /* (362) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (363) ignore_opt ::= */ + -2, /* (364) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (365) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (366) cmd ::= KILL QUERY NK_STRING */ + -3, /* (367) cmd ::= KILL TRANSACTION NK_INTEGER */ + -2, /* (368) cmd ::= BALANCE VGROUP */ + -3, /* (369) cmd ::= BALANCE VGROUP LEADER */ + -4, /* (370) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (371) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (372) cmd ::= SPLIT VGROUP NK_INTEGER */ + -2, /* (373) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (374) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (375) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (376) cmd ::= query_or_subquery */ + -1, /* (377) cmd ::= insert_query */ + -7, /* (378) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (379) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (380) literal ::= NK_INTEGER */ + -1, /* (381) literal ::= NK_FLOAT */ + -1, /* (382) literal ::= NK_STRING */ + -1, /* (383) literal ::= NK_BOOL */ + -2, /* (384) literal ::= TIMESTAMP NK_STRING */ + -1, /* (385) literal ::= duration_literal */ + -1, /* (386) literal ::= NULL */ + -1, /* (387) literal ::= NK_QUESTION */ + -1, /* (388) duration_literal ::= NK_VARIABLE */ + -1, /* (389) signed ::= NK_INTEGER */ + -2, /* (390) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (391) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (392) signed ::= NK_FLOAT */ + -2, /* (393) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (394) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (395) signed_literal ::= signed */ + -1, /* (396) signed_literal ::= NK_STRING */ + -1, /* (397) signed_literal ::= NK_BOOL */ + -2, /* (398) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (399) signed_literal ::= duration_literal */ + -1, /* (400) signed_literal ::= NULL */ + -1, /* (401) signed_literal ::= literal_func */ + -1, /* (402) signed_literal ::= NK_QUESTION */ + -1, /* (403) literal_list ::= signed_literal */ + -3, /* (404) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (405) db_name ::= NK_ID */ + -1, /* (406) table_name ::= NK_ID */ + -1, /* (407) column_name ::= NK_ID */ + -1, /* (408) function_name ::= NK_ID */ + -1, /* (409) table_alias ::= NK_ID */ + -1, /* (410) column_alias ::= NK_ID */ + -1, /* (411) user_name ::= NK_ID */ + -1, /* (412) topic_name ::= NK_ID */ + -1, /* (413) stream_name ::= NK_ID */ + -1, /* (414) cgroup_name ::= NK_ID */ + -1, /* (415) index_name ::= NK_ID */ + -1, /* (416) expr_or_subquery ::= expression */ + -1, /* (417) expression ::= literal */ + -1, /* (418) expression ::= pseudo_column */ + -1, /* (419) expression ::= column_reference */ + -1, /* (420) expression ::= function_expression */ + -1, /* (421) expression ::= case_when_expression */ + -3, /* (422) expression ::= NK_LP expression NK_RP */ + -2, /* (423) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (424) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (425) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (426) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (427) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (428) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (429) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (430) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (431) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (432) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (433) expression_list ::= expr_or_subquery */ + -3, /* (434) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (435) column_reference ::= column_name */ + -3, /* (436) column_reference ::= table_name NK_DOT column_name */ + -1, /* (437) pseudo_column ::= ROWTS */ + -1, /* (438) pseudo_column ::= TBNAME */ + -3, /* (439) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (440) pseudo_column ::= QSTART */ + -1, /* (441) pseudo_column ::= QEND */ + -1, /* (442) pseudo_column ::= QDURATION */ + -1, /* (443) pseudo_column ::= WSTART */ + -1, /* (444) pseudo_column ::= WEND */ + -1, /* (445) pseudo_column ::= WDURATION */ + -1, /* (446) pseudo_column ::= IROWTS */ + -1, /* (447) pseudo_column ::= ISFILLED */ + -1, /* (448) pseudo_column ::= QTAGS */ + -4, /* (449) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (450) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (451) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (452) function_expression ::= literal_func */ + -3, /* (453) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (454) literal_func ::= NOW */ + -1, /* (455) noarg_func ::= NOW */ + -1, /* (456) noarg_func ::= TODAY */ + -1, /* (457) noarg_func ::= TIMEZONE */ + -1, /* (458) noarg_func ::= DATABASE */ + -1, /* (459) noarg_func ::= CLIENT_VERSION */ + -1, /* (460) noarg_func ::= SERVER_VERSION */ + -1, /* (461) noarg_func ::= SERVER_STATUS */ + -1, /* (462) noarg_func ::= CURRENT_USER */ + -1, /* (463) noarg_func ::= USER */ + -1, /* (464) star_func ::= COUNT */ + -1, /* (465) star_func ::= FIRST */ + -1, /* (466) star_func ::= LAST */ + -1, /* (467) star_func ::= LAST_ROW */ + -1, /* (468) star_func_para_list ::= NK_STAR */ + -1, /* (469) star_func_para_list ::= other_para_list */ + -1, /* (470) other_para_list ::= star_func_para */ + -3, /* (471) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (472) star_func_para ::= expr_or_subquery */ + -3, /* (473) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (474) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (475) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (476) when_then_list ::= when_then_expr */ + -2, /* (477) when_then_list ::= when_then_list when_then_expr */ + -4, /* (478) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (479) case_when_else_opt ::= */ + -2, /* (480) case_when_else_opt ::= ELSE common_expression */ + -3, /* (481) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (482) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (483) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (484) predicate ::= expr_or_subquery IS NULL */ + -4, /* (485) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (486) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (487) compare_op ::= NK_LT */ + -1, /* (488) compare_op ::= NK_GT */ + -1, /* (489) compare_op ::= NK_LE */ + -1, /* (490) compare_op ::= NK_GE */ + -1, /* (491) compare_op ::= NK_NE */ + -1, /* (492) compare_op ::= NK_EQ */ + -1, /* (493) compare_op ::= LIKE */ + -2, /* (494) compare_op ::= NOT LIKE */ + -1, /* (495) compare_op ::= MATCH */ + -1, /* (496) compare_op ::= NMATCH */ + -1, /* (497) compare_op ::= CONTAINS */ + -1, /* (498) in_op ::= IN */ + -2, /* (499) in_op ::= NOT IN */ + -3, /* (500) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (501) boolean_value_expression ::= boolean_primary */ + -2, /* (502) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (503) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (504) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (505) boolean_primary ::= predicate */ + -3, /* (506) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (507) common_expression ::= expr_or_subquery */ + -1, /* (508) common_expression ::= boolean_value_expression */ + 0, /* (509) from_clause_opt ::= */ + -2, /* (510) from_clause_opt ::= FROM table_reference_list */ + -1, /* (511) table_reference_list ::= table_reference */ + -3, /* (512) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (513) table_reference ::= table_primary */ + -1, /* (514) table_reference ::= joined_table */ + -2, /* (515) table_primary ::= table_name alias_opt */ + -4, /* (516) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (517) table_primary ::= subquery alias_opt */ + -1, /* (518) table_primary ::= parenthesized_joined_table */ + 0, /* (519) alias_opt ::= */ + -1, /* (520) alias_opt ::= table_alias */ + -2, /* (521) alias_opt ::= AS table_alias */ + -3, /* (522) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (523) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (524) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (525) join_type ::= */ + -1, /* (526) join_type ::= INNER */ + -14, /* (527) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (528) hint_list ::= */ + -1, /* (529) hint_list ::= NK_HINT */ + 0, /* (530) tag_mode_opt ::= */ + -1, /* (531) tag_mode_opt ::= TAGS */ + 0, /* (532) set_quantifier_opt ::= */ + -1, /* (533) set_quantifier_opt ::= DISTINCT */ + -1, /* (534) set_quantifier_opt ::= ALL */ + -1, /* (535) select_list ::= select_item */ + -3, /* (536) select_list ::= select_list NK_COMMA select_item */ + -1, /* (537) select_item ::= NK_STAR */ + -1, /* (538) select_item ::= common_expression */ + -2, /* (539) select_item ::= common_expression column_alias */ + -3, /* (540) select_item ::= common_expression AS column_alias */ + -3, /* (541) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (542) where_clause_opt ::= */ + -2, /* (543) where_clause_opt ::= WHERE search_condition */ + 0, /* (544) partition_by_clause_opt ::= */ + -3, /* (545) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (546) partition_list ::= partition_item */ + -3, /* (547) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (548) partition_item ::= expr_or_subquery */ + -2, /* (549) partition_item ::= expr_or_subquery column_alias */ + -3, /* (550) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (551) twindow_clause_opt ::= */ + -6, /* (552) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + -4, /* (553) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (554) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (555) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (556) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (557) sliding_opt ::= */ + -4, /* (558) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 0, /* (559) fill_opt ::= */ + -4, /* (560) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (561) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (562) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (563) fill_mode ::= NONE */ + -1, /* (564) fill_mode ::= PREV */ + -1, /* (565) fill_mode ::= NULL */ + -1, /* (566) fill_mode ::= NULL_F */ + -1, /* (567) fill_mode ::= LINEAR */ + -1, /* (568) fill_mode ::= NEXT */ + 0, /* (569) group_by_clause_opt ::= */ + -3, /* (570) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (571) group_by_list ::= expr_or_subquery */ + -3, /* (572) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (573) having_clause_opt ::= */ + -2, /* (574) having_clause_opt ::= HAVING search_condition */ + 0, /* (575) range_opt ::= */ + -6, /* (576) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (577) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (578) every_opt ::= */ + -4, /* (579) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (580) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (581) query_simple ::= query_specification */ + -1, /* (582) query_simple ::= union_query_expression */ + -4, /* (583) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (584) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (585) query_simple_or_subquery ::= query_simple */ + -1, /* (586) query_simple_or_subquery ::= subquery */ + -1, /* (587) query_or_subquery ::= query_expression */ + -1, /* (588) query_or_subquery ::= subquery */ + 0, /* (589) order_by_clause_opt ::= */ + -3, /* (590) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (591) slimit_clause_opt ::= */ + -2, /* (592) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (593) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (594) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (595) limit_clause_opt ::= */ + -2, /* (596) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (597) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (598) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (599) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (600) subquery ::= NK_LP subquery NK_RP */ + -1, /* (601) search_condition ::= common_expression */ + -1, /* (602) sort_specification_list ::= sort_specification */ + -3, /* (603) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (604) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (605) ordering_specification_opt ::= */ + -1, /* (606) ordering_specification_opt ::= ASC */ + -1, /* (607) ordering_specification_opt ::= DESC */ + 0, /* (608) null_ordering_opt ::= */ + -2, /* (609) null_ordering_opt ::= NULLS FIRST */ + -2, /* (610) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4869,19 +4852,19 @@ static YYACTIONTYPE yy_reduce( case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ #line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 4872 "sql.c" +#line 4855 "sql.c" yy_destructor(yypParser,341,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ #line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 4878 "sql.c" +#line 4861 "sql.c" yy_destructor(yypParser,342,&yymsp[0].minor); break; case 2: /* account_options ::= */ #line 55 "sql.y" { } -#line 4884 "sql.c" +#line 4867 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -4895,7 +4878,7 @@ static YYACTIONTYPE yy_reduce( { yy_destructor(yypParser,341,&yymsp[-2].minor); #line 56 "sql.y" { } -#line 4898 "sql.c" +#line 4881 "sql.c" yy_destructor(yypParser,343,&yymsp[0].minor); } break; @@ -4903,14 +4886,14 @@ static YYACTIONTYPE yy_reduce( { yy_destructor(yypParser,344,&yymsp[0].minor); #line 68 "sql.y" { } -#line 4906 "sql.c" +#line 4889 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,342,&yymsp[-1].minor); #line 69 "sql.y" { } -#line 4913 "sql.c" +#line 4896 "sql.c" yy_destructor(yypParser,344,&yymsp[0].minor); } break; @@ -4926,46 +4909,46 @@ static YYACTIONTYPE yy_reduce( case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); #line 73 "sql.y" { } -#line 4929 "sql.c" +#line 4912 "sql.c" yy_destructor(yypParser,343,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ #line 86 "sql.y" { yylhsminor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 4935 "sql.c" +#line 4918 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ #line 87 "sql.y" { yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 4941 "sql.c" +#line 4924 "sql.c" yymsp[-2].minor.yy236 = yylhsminor.yy236; break; case 26: /* white_list ::= HOST ip_range_list */ #line 91 "sql.y" { yymsp[-1].minor.yy236 = yymsp[0].minor.yy236; } -#line 4947 "sql.c" +#line 4930 "sql.c" break; case 27: /* white_list_opt ::= */ case 182: /* specific_cols_opt ::= */ yytestcase(yyruleno==182); - case 214: /* tags_def_opt ::= */ yytestcase(yyruleno==214); - case 289: /* tag_list_opt ::= */ yytestcase(yyruleno==289); - case 348: /* col_list_opt ::= */ yytestcase(yyruleno==348); - case 350: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==350); - case 545: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==545); - case 570: /* group_by_clause_opt ::= */ yytestcase(yyruleno==570); - case 590: /* order_by_clause_opt ::= */ yytestcase(yyruleno==590); + case 213: /* tags_def_opt ::= */ yytestcase(yyruleno==213); + case 288: /* tag_list_opt ::= */ yytestcase(yyruleno==288); + case 347: /* col_list_opt ::= */ yytestcase(yyruleno==347); + case 349: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==349); + case 544: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==544); + case 569: /* group_by_clause_opt ::= */ yytestcase(yyruleno==569); + case 589: /* order_by_clause_opt ::= */ yytestcase(yyruleno==589); #line 95 "sql.y" { yymsp[1].minor.yy236 = NULL; } -#line 4960 "sql.c" +#line 4943 "sql.c" break; case 28: /* white_list_opt ::= white_list */ - case 215: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==215); - case 351: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==351); - case 470: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==470); + case 214: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==214); + case 350: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==350); + case 469: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==469); #line 96 "sql.y" { yylhsminor.yy236 = yymsp[0].minor.yy236; } -#line 4968 "sql.c" +#line 4951 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ @@ -4974,494 +4957,494 @@ static YYACTIONTYPE yy_reduce( pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy889, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy847); addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy236); } -#line 4977 "sql.c" +#line 4960 "sql.c" break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ #line 104 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 4982 "sql.c" +#line 4965 "sql.c" break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ #line 105 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 4987 "sql.c" +#line 4970 "sql.c" break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ #line 106 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 4992 "sql.c" +#line 4975 "sql.c" break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ #line 107 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy236); } -#line 4997 "sql.c" +#line 4980 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ #line 108 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy236); } -#line 5002 "sql.c" +#line 4985 "sql.c" break; case 35: /* cmd ::= DROP USER user_name */ #line 109 "sql.y" { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy889); } -#line 5007 "sql.c" +#line 4990 "sql.c" break; case 36: /* sysinfo_opt ::= */ #line 113 "sql.y" { yymsp[1].minor.yy847 = 1; } -#line 5012 "sql.c" +#line 4995 "sql.c" break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ #line 114 "sql.y" { yymsp[-1].minor.yy847 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5017 "sql.c" +#line 5000 "sql.c" break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ #line 117 "sql.y" { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy701, &yymsp[-3].minor.yy833, &yymsp[0].minor.yy889, yymsp[-2].minor.yy28); } -#line 5022 "sql.c" +#line 5005 "sql.c" break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ #line 118 "sql.y" { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy701, &yymsp[-3].minor.yy833, &yymsp[0].minor.yy889, yymsp[-2].minor.yy28); } -#line 5027 "sql.c" +#line 5010 "sql.c" break; case 40: /* privileges ::= ALL */ #line 122 "sql.y" { yymsp[0].minor.yy701 = PRIVILEGE_TYPE_ALL; } -#line 5032 "sql.c" +#line 5015 "sql.c" break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); #line 123 "sql.y" { yylhsminor.yy701 = yymsp[0].minor.yy701; } -#line 5038 "sql.c" +#line 5021 "sql.c" yymsp[0].minor.yy701 = yylhsminor.yy701; break; case 42: /* privileges ::= SUBSCRIBE */ #line 124 "sql.y" { yymsp[0].minor.yy701 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5044 "sql.c" +#line 5027 "sql.c" break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ #line 129 "sql.y" { yylhsminor.yy701 = yymsp[-2].minor.yy701 | yymsp[0].minor.yy701; } -#line 5049 "sql.c" +#line 5032 "sql.c" yymsp[-2].minor.yy701 = yylhsminor.yy701; break; case 45: /* priv_type ::= READ */ #line 133 "sql.y" { yymsp[0].minor.yy701 = PRIVILEGE_TYPE_READ; } -#line 5055 "sql.c" +#line 5038 "sql.c" break; case 46: /* priv_type ::= WRITE */ #line 134 "sql.y" { yymsp[0].minor.yy701 = PRIVILEGE_TYPE_WRITE; } -#line 5060 "sql.c" +#line 5043 "sql.c" break; case 47: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ #line 138 "sql.y" { yylhsminor.yy833.first = yymsp[-2].minor.yy0; yylhsminor.yy833.second = yymsp[0].minor.yy0; } -#line 5065 "sql.c" +#line 5048 "sql.c" yymsp[-2].minor.yy833 = yylhsminor.yy833; break; case 48: /* priv_level ::= db_name NK_DOT NK_STAR */ #line 139 "sql.y" { yylhsminor.yy833.first = yymsp[-2].minor.yy889; yylhsminor.yy833.second = yymsp[0].minor.yy0; } -#line 5071 "sql.c" +#line 5054 "sql.c" yymsp[-2].minor.yy833 = yylhsminor.yy833; break; case 49: /* priv_level ::= db_name NK_DOT table_name */ #line 140 "sql.y" { yylhsminor.yy833.first = yymsp[-2].minor.yy889; yylhsminor.yy833.second = yymsp[0].minor.yy889; } -#line 5077 "sql.c" +#line 5060 "sql.c" yymsp[-2].minor.yy833 = yylhsminor.yy833; break; case 50: /* priv_level ::= topic_name */ #line 141 "sql.y" { yylhsminor.yy833.first = yymsp[0].minor.yy889; yylhsminor.yy833.second = nil_token; } -#line 5083 "sql.c" +#line 5066 "sql.c" yymsp[0].minor.yy833 = yylhsminor.yy833; break; case 51: /* with_opt ::= */ case 151: /* start_opt ::= */ yytestcase(yyruleno==151); case 155: /* end_opt ::= */ yytestcase(yyruleno==155); - case 284: /* like_pattern_opt ::= */ yytestcase(yyruleno==284); - case 362: /* subtable_opt ::= */ yytestcase(yyruleno==362); - case 480: /* case_when_else_opt ::= */ yytestcase(yyruleno==480); - case 510: /* from_clause_opt ::= */ yytestcase(yyruleno==510); - case 543: /* where_clause_opt ::= */ yytestcase(yyruleno==543); - case 552: /* twindow_clause_opt ::= */ yytestcase(yyruleno==552); - case 558: /* sliding_opt ::= */ yytestcase(yyruleno==558); - case 560: /* fill_opt ::= */ yytestcase(yyruleno==560); - case 574: /* having_clause_opt ::= */ yytestcase(yyruleno==574); - case 576: /* range_opt ::= */ yytestcase(yyruleno==576); - case 579: /* every_opt ::= */ yytestcase(yyruleno==579); - case 592: /* slimit_clause_opt ::= */ yytestcase(yyruleno==592); - case 596: /* limit_clause_opt ::= */ yytestcase(yyruleno==596); + case 283: /* like_pattern_opt ::= */ yytestcase(yyruleno==283); + case 361: /* subtable_opt ::= */ yytestcase(yyruleno==361); + case 479: /* case_when_else_opt ::= */ yytestcase(yyruleno==479); + case 509: /* from_clause_opt ::= */ yytestcase(yyruleno==509); + case 542: /* where_clause_opt ::= */ yytestcase(yyruleno==542); + case 551: /* twindow_clause_opt ::= */ yytestcase(yyruleno==551); + case 557: /* sliding_opt ::= */ yytestcase(yyruleno==557); + case 559: /* fill_opt ::= */ yytestcase(yyruleno==559); + case 573: /* having_clause_opt ::= */ yytestcase(yyruleno==573); + case 575: /* range_opt ::= */ yytestcase(yyruleno==575); + case 578: /* every_opt ::= */ yytestcase(yyruleno==578); + case 591: /* slimit_clause_opt ::= */ yytestcase(yyruleno==591); + case 595: /* limit_clause_opt ::= */ yytestcase(yyruleno==595); #line 143 "sql.y" { yymsp[1].minor.yy28 = NULL; } -#line 5104 "sql.c" +#line 5087 "sql.c" break; case 52: /* with_opt ::= WITH search_condition */ - case 511: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==511); - case 544: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==544); - case 575: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==575); + case 510: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==510); + case 543: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==543); + case 574: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==574); #line 144 "sql.y" { yymsp[-1].minor.yy28 = yymsp[0].minor.yy28; } -#line 5112 "sql.c" +#line 5095 "sql.c" break; case 53: /* cmd ::= CREATE DNODE dnode_endpoint */ #line 147 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy889, NULL); } -#line 5117 "sql.c" +#line 5100 "sql.c" break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ #line 148 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0); } -#line 5122 "sql.c" +#line 5105 "sql.c" break; case 55: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ #line 149 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy793, false); } -#line 5127 "sql.c" +#line 5110 "sql.c" break; case 56: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ #line 150 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy793, false); } -#line 5132 "sql.c" +#line 5115 "sql.c" break; case 57: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ #line 151 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy793); } -#line 5137 "sql.c" +#line 5120 "sql.c" break; case 58: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ #line 152 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy889, false, yymsp[0].minor.yy793); } -#line 5142 "sql.c" +#line 5125 "sql.c" break; case 59: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ #line 153 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 5147 "sql.c" +#line 5130 "sql.c" break; case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ #line 154 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5152 "sql.c" +#line 5135 "sql.c" break; case 61: /* cmd ::= ALTER ALL DNODES NK_STRING */ #line 155 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 5157 "sql.c" +#line 5140 "sql.c" break; case 62: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ #line 156 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5162 "sql.c" +#line 5145 "sql.c" break; case 63: /* cmd ::= RESTORE DNODE NK_INTEGER */ #line 157 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 5167 "sql.c" +#line 5150 "sql.c" break; case 64: /* dnode_endpoint ::= NK_STRING */ case 65: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==65); case 66: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==66); - case 308: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==308); - case 309: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==309); - case 310: /* sma_func_name ::= LAST */ yytestcase(yyruleno==310); - case 311: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==311); - case 406: /* db_name ::= NK_ID */ yytestcase(yyruleno==406); - case 407: /* table_name ::= NK_ID */ yytestcase(yyruleno==407); - case 408: /* column_name ::= NK_ID */ yytestcase(yyruleno==408); - case 409: /* function_name ::= NK_ID */ yytestcase(yyruleno==409); - case 410: /* table_alias ::= NK_ID */ yytestcase(yyruleno==410); - case 411: /* column_alias ::= NK_ID */ yytestcase(yyruleno==411); - case 412: /* user_name ::= NK_ID */ yytestcase(yyruleno==412); - case 413: /* topic_name ::= NK_ID */ yytestcase(yyruleno==413); - case 414: /* stream_name ::= NK_ID */ yytestcase(yyruleno==414); - case 415: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==415); - case 416: /* index_name ::= NK_ID */ yytestcase(yyruleno==416); - case 456: /* noarg_func ::= NOW */ yytestcase(yyruleno==456); - case 457: /* noarg_func ::= TODAY */ yytestcase(yyruleno==457); - case 458: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==458); - case 459: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==459); - case 460: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==460); - case 461: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==461); - case 462: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==462); - case 463: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==463); - case 464: /* noarg_func ::= USER */ yytestcase(yyruleno==464); - case 465: /* star_func ::= COUNT */ yytestcase(yyruleno==465); - case 466: /* star_func ::= FIRST */ yytestcase(yyruleno==466); - case 467: /* star_func ::= LAST */ yytestcase(yyruleno==467); - case 468: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==468); + case 307: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==307); + case 308: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==308); + case 309: /* sma_func_name ::= LAST */ yytestcase(yyruleno==309); + case 310: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==310); + case 405: /* db_name ::= NK_ID */ yytestcase(yyruleno==405); + case 406: /* table_name ::= NK_ID */ yytestcase(yyruleno==406); + case 407: /* column_name ::= NK_ID */ yytestcase(yyruleno==407); + case 408: /* function_name ::= NK_ID */ yytestcase(yyruleno==408); + case 409: /* table_alias ::= NK_ID */ yytestcase(yyruleno==409); + case 410: /* column_alias ::= NK_ID */ yytestcase(yyruleno==410); + case 411: /* user_name ::= NK_ID */ yytestcase(yyruleno==411); + case 412: /* topic_name ::= NK_ID */ yytestcase(yyruleno==412); + case 413: /* stream_name ::= NK_ID */ yytestcase(yyruleno==413); + case 414: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==414); + case 415: /* index_name ::= NK_ID */ yytestcase(yyruleno==415); + case 455: /* noarg_func ::= NOW */ yytestcase(yyruleno==455); + case 456: /* noarg_func ::= TODAY */ yytestcase(yyruleno==456); + case 457: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==457); + case 458: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==458); + case 459: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==459); + case 460: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==460); + case 461: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==461); + case 462: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==462); + case 463: /* noarg_func ::= USER */ yytestcase(yyruleno==463); + case 464: /* star_func ::= COUNT */ yytestcase(yyruleno==464); + case 465: /* star_func ::= FIRST */ yytestcase(yyruleno==465); + case 466: /* star_func ::= LAST */ yytestcase(yyruleno==466); + case 467: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==467); #line 161 "sql.y" { yylhsminor.yy889 = yymsp[0].minor.yy0; } -#line 5202 "sql.c" +#line 5185 "sql.c" yymsp[0].minor.yy889 = yylhsminor.yy889; break; case 67: /* force_opt ::= */ case 91: /* not_exists_opt ::= */ yytestcase(yyruleno==91); case 93: /* exists_opt ::= */ yytestcase(yyruleno==93); - case 329: /* analyze_opt ::= */ yytestcase(yyruleno==329); - case 336: /* agg_func_opt ::= */ yytestcase(yyruleno==336); - case 342: /* or_replace_opt ::= */ yytestcase(yyruleno==342); - case 364: /* ignore_opt ::= */ yytestcase(yyruleno==364); - case 531: /* tag_mode_opt ::= */ yytestcase(yyruleno==531); - case 533: /* set_quantifier_opt ::= */ yytestcase(yyruleno==533); + case 328: /* analyze_opt ::= */ yytestcase(yyruleno==328); + case 335: /* agg_func_opt ::= */ yytestcase(yyruleno==335); + case 341: /* or_replace_opt ::= */ yytestcase(yyruleno==341); + case 363: /* ignore_opt ::= */ yytestcase(yyruleno==363); + case 530: /* tag_mode_opt ::= */ yytestcase(yyruleno==530); + case 532: /* set_quantifier_opt ::= */ yytestcase(yyruleno==532); #line 167 "sql.y" { yymsp[1].minor.yy793 = false; } -#line 5216 "sql.c" +#line 5199 "sql.c" break; case 68: /* force_opt ::= FORCE */ case 69: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==69); - case 330: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==330); - case 337: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==337); - case 532: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==532); - case 534: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==534); + case 329: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==329); + case 336: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==336); + case 531: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==531); + case 533: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==533); #line 168 "sql.y" { yymsp[0].minor.yy793 = true; } -#line 5226 "sql.c" +#line 5209 "sql.c" break; case 70: /* cmd ::= ALTER LOCAL NK_STRING */ #line 175 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5231 "sql.c" +#line 5214 "sql.c" break; case 71: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ #line 176 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5236 "sql.c" +#line 5219 "sql.c" break; case 72: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ #line 179 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5241 "sql.c" +#line 5224 "sql.c" break; case 73: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ #line 180 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5246 "sql.c" +#line 5229 "sql.c" break; case 74: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ #line 181 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5251 "sql.c" +#line 5234 "sql.c" break; case 75: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ #line 184 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5256 "sql.c" +#line 5239 "sql.c" break; case 76: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ #line 185 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5261 "sql.c" +#line 5244 "sql.c" break; case 77: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ #line 188 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5266 "sql.c" +#line 5249 "sql.c" break; case 78: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ #line 189 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5271 "sql.c" +#line 5254 "sql.c" break; case 79: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ #line 192 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5276 "sql.c" +#line 5259 "sql.c" break; case 80: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ #line 193 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5281 "sql.c" +#line 5264 "sql.c" break; case 81: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ #line 194 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5286 "sql.c" +#line 5269 "sql.c" break; case 82: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ #line 197 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 5291 "sql.c" +#line 5274 "sql.c" break; case 83: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ #line 200 "sql.y" { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy793, &yymsp[-1].minor.yy889, yymsp[0].minor.yy28); } -#line 5296 "sql.c" +#line 5279 "sql.c" break; case 84: /* cmd ::= DROP DATABASE exists_opt db_name */ #line 201 "sql.y" { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 5301 "sql.c" +#line 5284 "sql.c" break; case 85: /* cmd ::= USE db_name */ #line 202 "sql.y" { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy889); } -#line 5306 "sql.c" +#line 5289 "sql.c" break; case 86: /* cmd ::= ALTER DATABASE db_name alter_db_options */ #line 203 "sql.y" { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy28); } -#line 5311 "sql.c" +#line 5294 "sql.c" break; case 87: /* cmd ::= FLUSH DATABASE db_name */ #line 204 "sql.y" { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy889); } -#line 5316 "sql.c" +#line 5299 "sql.c" break; case 88: /* cmd ::= TRIM DATABASE db_name speed_opt */ #line 205 "sql.y" { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy956); } -#line 5321 "sql.c" +#line 5304 "sql.c" break; case 89: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ #line 206 "sql.y" { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy889, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 5326 "sql.c" +#line 5309 "sql.c" break; case 90: /* not_exists_opt ::= IF NOT EXISTS */ #line 210 "sql.y" { yymsp[-2].minor.yy793 = true; } -#line 5331 "sql.c" +#line 5314 "sql.c" break; case 92: /* exists_opt ::= IF EXISTS */ - case 343: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==343); - case 365: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==365); + case 342: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==342); + case 364: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==364); #line 215 "sql.y" { yymsp[-1].minor.yy793 = true; } -#line 5338 "sql.c" +#line 5321 "sql.c" break; case 94: /* db_options ::= */ #line 218 "sql.y" { yymsp[1].minor.yy28 = createDefaultDatabaseOptions(pCxt); } -#line 5343 "sql.c" +#line 5326 "sql.c" break; case 95: /* db_options ::= db_options BUFFER NK_INTEGER */ #line 219 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 5348 "sql.c" +#line 5331 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 96: /* db_options ::= db_options CACHEMODEL NK_STRING */ #line 220 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 5354 "sql.c" +#line 5337 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 97: /* db_options ::= db_options CACHESIZE NK_INTEGER */ #line 221 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 5360 "sql.c" +#line 5343 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 98: /* db_options ::= db_options COMP NK_INTEGER */ #line 222 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 5366 "sql.c" +#line 5349 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 99: /* db_options ::= db_options DURATION NK_INTEGER */ case 100: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==100); #line 223 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 5373 "sql.c" +#line 5356 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 101: /* db_options ::= db_options MAXROWS NK_INTEGER */ #line 225 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 5379 "sql.c" +#line 5362 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 102: /* db_options ::= db_options MINROWS NK_INTEGER */ #line 226 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 5385 "sql.c" +#line 5368 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 103: /* db_options ::= db_options KEEP integer_list */ case 104: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==104); #line 227 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_KEEP, yymsp[0].minor.yy236); } -#line 5392 "sql.c" +#line 5375 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 105: /* db_options ::= db_options PAGES NK_INTEGER */ #line 229 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 5398 "sql.c" +#line 5381 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 106: /* db_options ::= db_options PAGESIZE NK_INTEGER */ #line 230 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5404 "sql.c" +#line 5387 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 107: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ #line 231 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5410 "sql.c" +#line 5393 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 108: /* db_options ::= db_options PRECISION NK_STRING */ #line 232 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 5416 "sql.c" +#line 5399 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 109: /* db_options ::= db_options REPLICA NK_INTEGER */ #line 233 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 5422 "sql.c" +#line 5405 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 110: /* db_options ::= db_options VGROUPS NK_INTEGER */ #line 235 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 5428 "sql.c" +#line 5411 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 111: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ #line 236 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 5434 "sql.c" +#line 5417 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 112: /* db_options ::= db_options RETENTIONS retention_list */ #line 237 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_RETENTIONS, yymsp[0].minor.yy236); } -#line 5440 "sql.c" +#line 5423 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 113: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ #line 238 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 5446 "sql.c" +#line 5429 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 114: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ #line 239 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 5452 "sql.c" +#line 5435 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 115: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ #line 240 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 5458 "sql.c" +#line 5441 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 116: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ #line 241 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 5464 "sql.c" +#line 5447 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 117: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ @@ -5471,13 +5454,13 @@ static YYACTIONTYPE yy_reduce( t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-3].minor.yy28, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 5474 "sql.c" +#line 5457 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; case 118: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ #line 247 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 5480 "sql.c" +#line 5463 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 119: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ @@ -5487,106 +5470,106 @@ static YYACTIONTYPE yy_reduce( t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-3].minor.yy28, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 5490 "sql.c" +#line 5473 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; case 120: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ #line 253 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 5496 "sql.c" +#line 5479 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 121: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ #line 254 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 5502 "sql.c" +#line 5485 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 122: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ #line 255 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 5508 "sql.c" +#line 5491 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 123: /* db_options ::= db_options TABLE_PREFIX signed */ #line 256 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy28); } -#line 5514 "sql.c" +#line 5497 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 124: /* db_options ::= db_options TABLE_SUFFIX signed */ #line 257 "sql.y" { yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy28); } -#line 5520 "sql.c" +#line 5503 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 125: /* alter_db_options ::= alter_db_option */ #line 259 "sql.y" { yylhsminor.yy28 = createAlterDatabaseOptions(pCxt); yylhsminor.yy28 = setAlterDatabaseOption(pCxt, yylhsminor.yy28, &yymsp[0].minor.yy481); } -#line 5526 "sql.c" +#line 5509 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; case 126: /* alter_db_options ::= alter_db_options alter_db_option */ #line 260 "sql.y" { yylhsminor.yy28 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy28, &yymsp[0].minor.yy481); } -#line 5532 "sql.c" +#line 5515 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; case 127: /* alter_db_option ::= BUFFER NK_INTEGER */ #line 264 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5538 "sql.c" +#line 5521 "sql.c" break; case 128: /* alter_db_option ::= CACHEMODEL NK_STRING */ #line 265 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5543 "sql.c" +#line 5526 "sql.c" break; case 129: /* alter_db_option ::= CACHESIZE NK_INTEGER */ #line 266 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5548 "sql.c" +#line 5531 "sql.c" break; case 130: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ #line 267 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5553 "sql.c" +#line 5536 "sql.c" break; case 131: /* alter_db_option ::= KEEP integer_list */ case 132: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==132); #line 268 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_KEEP; yymsp[-1].minor.yy481.pList = yymsp[0].minor.yy236; } -#line 5559 "sql.c" +#line 5542 "sql.c" break; case 133: /* alter_db_option ::= PAGES NK_INTEGER */ #line 270 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_PAGES; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5564 "sql.c" +#line 5547 "sql.c" break; case 134: /* alter_db_option ::= REPLICA NK_INTEGER */ #line 271 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5569 "sql.c" +#line 5552 "sql.c" break; case 135: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ #line 273 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_WAL; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5574 "sql.c" +#line 5557 "sql.c" break; case 136: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ #line 274 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5579 "sql.c" +#line 5562 "sql.c" break; case 137: /* alter_db_option ::= MINROWS NK_INTEGER */ #line 275 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5584 "sql.c" +#line 5567 "sql.c" break; case 138: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ #line 276 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5589 "sql.c" +#line 5572 "sql.c" break; case 139: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ #line 277 "sql.y" @@ -5595,12 +5578,12 @@ static YYACTIONTYPE yy_reduce( t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yymsp[-2].minor.yy481.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy481.val = t; } -#line 5598 "sql.c" +#line 5581 "sql.c" break; case 140: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ #line 282 "sql.y" { yymsp[-1].minor.yy481.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5603 "sql.c" +#line 5586 "sql.c" break; case 141: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ #line 283 "sql.y" @@ -5609,1586 +5592,1580 @@ static YYACTIONTYPE yy_reduce( t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yymsp[-2].minor.yy481.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy481.val = t; } -#line 5612 "sql.c" +#line 5595 "sql.c" break; case 142: /* integer_list ::= NK_INTEGER */ #line 291 "sql.y" { yylhsminor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5617 "sql.c" +#line 5600 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; case 143: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 375: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==375); + case 374: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==374); #line 292 "sql.y" { yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5624 "sql.c" +#line 5607 "sql.c" yymsp[-2].minor.yy236 = yylhsminor.yy236; break; case 144: /* variable_list ::= NK_VARIABLE */ #line 296 "sql.y" { yylhsminor.yy236 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5630 "sql.c" +#line 5613 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; case 145: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ #line 297 "sql.y" { yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5636 "sql.c" +#line 5619 "sql.c" yymsp[-2].minor.yy236 = yylhsminor.yy236; break; case 146: /* retention_list ::= retention */ case 176: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==176); case 179: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==179); case 186: /* column_def_list ::= column_def */ yytestcase(yyruleno==186); - case 231: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==231); - case 236: /* col_name_list ::= col_name */ yytestcase(yyruleno==236); - case 290: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==290); - case 304: /* func_list ::= func */ yytestcase(yyruleno==304); - case 404: /* literal_list ::= signed_literal */ yytestcase(yyruleno==404); - case 471: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==471); - case 477: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==477); - case 536: /* select_list ::= select_item */ yytestcase(yyruleno==536); - case 547: /* partition_list ::= partition_item */ yytestcase(yyruleno==547); - case 603: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==603); + case 230: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==230); + case 235: /* col_name_list ::= col_name */ yytestcase(yyruleno==235); + case 289: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==289); + case 303: /* func_list ::= func */ yytestcase(yyruleno==303); + case 403: /* literal_list ::= signed_literal */ yytestcase(yyruleno==403); + case 470: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==470); + case 476: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==476); + case 535: /* select_list ::= select_item */ yytestcase(yyruleno==535); + case 546: /* partition_list ::= partition_item */ yytestcase(yyruleno==546); + case 602: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==602); #line 301 "sql.y" { yylhsminor.yy236 = createNodeList(pCxt, yymsp[0].minor.yy28); } -#line 5655 "sql.c" +#line 5638 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; case 147: /* retention_list ::= retention_list NK_COMMA retention */ case 180: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==180); case 187: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==187); - case 232: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==232); - case 237: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==237); - case 291: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==291); - case 305: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==305); - case 405: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==405); - case 472: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==472); - case 537: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==537); - case 548: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==548); - case 604: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==604); + case 231: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==231); + case 236: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==236); + case 290: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==290); + case 304: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==304); + case 404: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==404); + case 471: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==471); + case 536: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==536); + case 547: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==547); + case 603: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==603); #line 302 "sql.y" { yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, yymsp[0].minor.yy28); } -#line 5672 "sql.c" +#line 5655 "sql.c" yymsp[-2].minor.yy236 = yylhsminor.yy236; break; case 148: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ #line 304 "sql.y" { yylhsminor.yy28 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5678 "sql.c" +#line 5661 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 149: /* speed_opt ::= */ - case 338: /* bufsize_opt ::= */ yytestcase(yyruleno==338); + case 337: /* bufsize_opt ::= */ yytestcase(yyruleno==337); #line 308 "sql.y" { yymsp[1].minor.yy956 = 0; } -#line 5685 "sql.c" +#line 5668 "sql.c" break; - case 150: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 339: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==339); + case 150: /* speed_opt ::= BWLIMIT NK_INTEGER */ + case 338: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==338); #line 309 "sql.y" { yymsp[-1].minor.yy956 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5691 "sql.c" +#line 5674 "sql.c" break; case 152: /* start_opt ::= START WITH NK_INTEGER */ case 156: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==156); #line 312 "sql.y" { yymsp[-2].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 5697 "sql.c" +#line 5680 "sql.c" break; case 153: /* start_opt ::= START WITH NK_STRING */ case 157: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==157); #line 313 "sql.y" { yymsp[-2].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5703 "sql.c" +#line 5686 "sql.c" break; case 154: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 158: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==158); #line 314 "sql.y" { yymsp[-3].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5709 "sql.c" +#line 5692 "sql.c" break; case 159: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 161: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==161); #line 323 "sql.y" { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy793, yymsp[-5].minor.yy28, yymsp[-3].minor.yy236, yymsp[-1].minor.yy236, yymsp[0].minor.yy28); } -#line 5715 "sql.c" +#line 5698 "sql.c" break; case 160: /* cmd ::= CREATE TABLE multi_create_clause */ #line 324 "sql.y" { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy236); } -#line 5720 "sql.c" +#line 5703 "sql.c" break; case 162: /* cmd ::= DROP TABLE multi_drop_clause */ #line 327 "sql.y" { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy236); } -#line 5725 "sql.c" +#line 5708 "sql.c" break; case 163: /* cmd ::= DROP STABLE exists_opt full_table_name */ #line 328 "sql.y" { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy793, yymsp[0].minor.yy28); } -#line 5730 "sql.c" +#line 5713 "sql.c" break; case 164: /* cmd ::= ALTER TABLE alter_table_clause */ - case 377: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==377); - case 378: /* cmd ::= insert_query */ yytestcase(yyruleno==378); + case 376: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==376); + case 377: /* cmd ::= insert_query */ yytestcase(yyruleno==377); #line 330 "sql.y" { pCxt->pRootNode = yymsp[0].minor.yy28; } -#line 5737 "sql.c" +#line 5720 "sql.c" break; case 165: /* cmd ::= ALTER STABLE alter_table_clause */ #line 331 "sql.y" { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy28); } -#line 5742 "sql.c" +#line 5725 "sql.c" break; case 166: /* alter_table_clause ::= full_table_name alter_table_options */ #line 333 "sql.y" { yylhsminor.yy28 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 5747 "sql.c" +#line 5730 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 167: /* alter_table_clause ::= full_table_name ADD COLUMN column_def */ + case 167: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ #line 335 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_ADD_COLUMN, yymsp[0].minor.yy28); } -#line 5753 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } +#line 5736 "sql.c" + yymsp[-4].minor.yy28 = yylhsminor.yy28; break; case 168: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ #line 336 "sql.y" { yylhsminor.yy28 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy889); } -#line 5759 "sql.c" +#line 5742 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 169: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_def */ + case 169: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ #line 338 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, yymsp[0].minor.yy28); } -#line 5765 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } +#line 5748 "sql.c" + yymsp[-4].minor.yy28 = yylhsminor.yy28; break; case 170: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ #line 340 "sql.y" { yylhsminor.yy28 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 5771 "sql.c" +#line 5754 "sql.c" yymsp[-4].minor.yy28 = yylhsminor.yy28; break; - case 171: /* alter_table_clause ::= full_table_name ADD TAG column_def */ + case 171: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ #line 342 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_ADD_TAG, yymsp[0].minor.yy28); } -#line 5777 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } +#line 5760 "sql.c" + yymsp[-4].minor.yy28 = yylhsminor.yy28; break; case 172: /* alter_table_clause ::= full_table_name DROP TAG column_name */ #line 343 "sql.y" { yylhsminor.yy28 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy889); } -#line 5783 "sql.c" +#line 5766 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 173: /* alter_table_clause ::= full_table_name MODIFY TAG column_def */ + case 173: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ #line 345 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, yymsp[0].minor.yy28); } -#line 5789 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } +#line 5772 "sql.c" + yymsp[-4].minor.yy28 = yylhsminor.yy28; break; case 174: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ #line 347 "sql.y" { yylhsminor.yy28 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 5795 "sql.c" +#line 5778 "sql.c" yymsp[-4].minor.yy28 = yylhsminor.yy28; break; case 175: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ #line 349 "sql.y" { yylhsminor.yy28 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy28, &yymsp[-2].minor.yy889, yymsp[0].minor.yy28); } -#line 5801 "sql.c" +#line 5784 "sql.c" yymsp[-5].minor.yy28 = yylhsminor.yy28; break; case 177: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 478: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==478); + case 477: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==477); #line 354 "sql.y" { yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-1].minor.yy236, yymsp[0].minor.yy28); } -#line 5808 "sql.c" +#line 5791 "sql.c" yymsp[-1].minor.yy236 = yylhsminor.yy236; break; case 178: /* 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 */ #line 358 "sql.y" { yylhsminor.yy28 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy793, yymsp[-8].minor.yy28, yymsp[-6].minor.yy28, yymsp[-5].minor.yy236, yymsp[-2].minor.yy236, yymsp[0].minor.yy28); } -#line 5814 "sql.c" +#line 5797 "sql.c" yymsp[-9].minor.yy28 = yylhsminor.yy28; break; case 181: /* drop_table_clause ::= exists_opt full_table_name */ #line 365 "sql.y" { yylhsminor.yy28 = createDropTableClause(pCxt, yymsp[-1].minor.yy793, yymsp[0].minor.yy28); } -#line 5820 "sql.c" +#line 5803 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; case 183: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 349: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==349); + case 348: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==348); #line 370 "sql.y" { yymsp[-2].minor.yy236 = yymsp[-1].minor.yy236; } -#line 5827 "sql.c" +#line 5810 "sql.c" break; case 184: /* full_table_name ::= table_name */ #line 372 "sql.y" { yylhsminor.yy28 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy889, NULL); } -#line 5832 "sql.c" +#line 5815 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; case 185: /* full_table_name ::= db_name NK_DOT table_name */ #line 373 "sql.y" { yylhsminor.yy28 = createRealTableNode(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889, NULL); } -#line 5838 "sql.c" +#line 5821 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; case 188: /* column_def ::= column_name type_name */ #line 380 "sql.y" { yylhsminor.yy28 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32, NULL); } -#line 5844 "sql.c" +#line 5827 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 189: /* column_def ::= column_name type_name COMMENT NK_STRING */ -#line 381 "sql.y" -{ yylhsminor.yy28 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy889, yymsp[-2].minor.yy32, &yymsp[0].minor.yy0); } -#line 5850 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 190: /* type_name ::= BOOL */ + case 189: /* type_name ::= BOOL */ #line 385 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 5856 "sql.c" +#line 5833 "sql.c" break; - case 191: /* type_name ::= TINYINT */ + case 190: /* type_name ::= TINYINT */ #line 386 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 5861 "sql.c" +#line 5838 "sql.c" break; - case 192: /* type_name ::= SMALLINT */ + case 191: /* type_name ::= SMALLINT */ #line 387 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 5866 "sql.c" +#line 5843 "sql.c" break; - case 193: /* type_name ::= INT */ - case 194: /* type_name ::= INTEGER */ yytestcase(yyruleno==194); + case 192: /* type_name ::= INT */ + case 193: /* type_name ::= INTEGER */ yytestcase(yyruleno==193); #line 388 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_INT); } -#line 5872 "sql.c" +#line 5849 "sql.c" break; - case 195: /* type_name ::= BIGINT */ + case 194: /* type_name ::= BIGINT */ #line 390 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 5877 "sql.c" +#line 5854 "sql.c" break; - case 196: /* type_name ::= FLOAT */ + case 195: /* type_name ::= FLOAT */ #line 391 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 5882 "sql.c" +#line 5859 "sql.c" break; - case 197: /* type_name ::= DOUBLE */ + case 196: /* type_name ::= DOUBLE */ #line 392 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 5887 "sql.c" +#line 5864 "sql.c" break; - case 198: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + case 197: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ #line 393 "sql.y" { yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 5892 "sql.c" +#line 5869 "sql.c" break; - case 199: /* type_name ::= TIMESTAMP */ + case 198: /* type_name ::= TIMESTAMP */ #line 394 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 5897 "sql.c" +#line 5874 "sql.c" break; - case 200: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + case 199: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ #line 395 "sql.y" { yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 5902 "sql.c" +#line 5879 "sql.c" break; - case 201: /* type_name ::= TINYINT UNSIGNED */ + case 200: /* type_name ::= TINYINT UNSIGNED */ #line 396 "sql.y" { yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 5907 "sql.c" +#line 5884 "sql.c" break; - case 202: /* type_name ::= SMALLINT UNSIGNED */ + case 201: /* type_name ::= SMALLINT UNSIGNED */ #line 397 "sql.y" { yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 5912 "sql.c" +#line 5889 "sql.c" break; - case 203: /* type_name ::= INT UNSIGNED */ + case 202: /* type_name ::= INT UNSIGNED */ #line 398 "sql.y" { yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 5917 "sql.c" +#line 5894 "sql.c" break; - case 204: /* type_name ::= BIGINT UNSIGNED */ + case 203: /* type_name ::= BIGINT UNSIGNED */ #line 399 "sql.y" { yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 5922 "sql.c" +#line 5899 "sql.c" break; - case 205: /* type_name ::= JSON */ + case 204: /* type_name ::= JSON */ #line 400 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 5927 "sql.c" +#line 5904 "sql.c" break; - case 206: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + case 205: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ #line 401 "sql.y" { yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 5932 "sql.c" +#line 5909 "sql.c" break; - case 207: /* type_name ::= MEDIUMBLOB */ + case 206: /* type_name ::= MEDIUMBLOB */ #line 402 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 5937 "sql.c" +#line 5914 "sql.c" break; - case 208: /* type_name ::= BLOB */ + case 207: /* type_name ::= BLOB */ #line 403 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 5942 "sql.c" +#line 5919 "sql.c" break; - case 209: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + case 208: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ #line 404 "sql.y" { yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 5947 "sql.c" +#line 5924 "sql.c" break; - case 210: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + case 209: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ #line 405 "sql.y" { yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 5952 "sql.c" +#line 5929 "sql.c" break; - case 211: /* type_name ::= DECIMAL */ + case 210: /* type_name ::= DECIMAL */ #line 406 "sql.y" { yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5957 "sql.c" +#line 5934 "sql.c" break; - case 212: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + case 211: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ #line 407 "sql.y" { yymsp[-3].minor.yy32 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5962 "sql.c" +#line 5939 "sql.c" break; - case 213: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + case 212: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ #line 408 "sql.y" { yymsp[-5].minor.yy32 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5967 "sql.c" +#line 5944 "sql.c" break; - case 216: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 352: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==352); + case 215: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 351: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==351); #line 417 "sql.y" { yymsp[-3].minor.yy236 = yymsp[-1].minor.yy236; } -#line 5973 "sql.c" +#line 5950 "sql.c" break; - case 217: /* table_options ::= */ + case 216: /* table_options ::= */ #line 419 "sql.y" { yymsp[1].minor.yy28 = createDefaultTableOptions(pCxt); } -#line 5978 "sql.c" +#line 5955 "sql.c" break; - case 218: /* table_options ::= table_options COMMENT NK_STRING */ + case 217: /* table_options ::= table_options COMMENT NK_STRING */ #line 420 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 5983 "sql.c" +#line 5960 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 219: /* table_options ::= table_options MAX_DELAY duration_list */ + case 218: /* table_options ::= table_options MAX_DELAY duration_list */ #line 421 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy236); } -#line 5989 "sql.c" +#line 5966 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 220: /* table_options ::= table_options WATERMARK duration_list */ + case 219: /* table_options ::= table_options WATERMARK duration_list */ #line 422 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy236); } -#line 5995 "sql.c" +#line 5972 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 221: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + case 220: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ #line 423 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-4].minor.yy28, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy236); } -#line 6001 "sql.c" +#line 5978 "sql.c" yymsp[-4].minor.yy28 = yylhsminor.yy28; break; - case 222: /* table_options ::= table_options TTL NK_INTEGER */ + case 221: /* table_options ::= table_options TTL NK_INTEGER */ #line 424 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 6007 "sql.c" +#line 5984 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 223: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + case 222: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ #line 425 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-4].minor.yy28, TABLE_OPTION_SMA, yymsp[-1].minor.yy236); } -#line 6013 "sql.c" +#line 5990 "sql.c" yymsp[-4].minor.yy28 = yylhsminor.yy28; break; - case 224: /* table_options ::= table_options DELETE_MARK duration_list */ + case 223: /* table_options ::= table_options DELETE_MARK duration_list */ #line 426 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy236); } -#line 6019 "sql.c" +#line 5996 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 225: /* alter_table_options ::= alter_table_option */ + case 224: /* alter_table_options ::= alter_table_option */ #line 428 "sql.y" { yylhsminor.yy28 = createAlterTableOptions(pCxt); yylhsminor.yy28 = setTableOption(pCxt, yylhsminor.yy28, yymsp[0].minor.yy481.type, &yymsp[0].minor.yy481.val); } -#line 6025 "sql.c" +#line 6002 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 226: /* alter_table_options ::= alter_table_options alter_table_option */ + case 225: /* alter_table_options ::= alter_table_options alter_table_option */ #line 429 "sql.y" { yylhsminor.yy28 = setTableOption(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy481.type, &yymsp[0].minor.yy481.val); } -#line 6031 "sql.c" +#line 6008 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 227: /* alter_table_option ::= COMMENT NK_STRING */ + case 226: /* alter_table_option ::= COMMENT NK_STRING */ #line 433 "sql.y" { yymsp[-1].minor.yy481.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 6037 "sql.c" +#line 6014 "sql.c" break; - case 228: /* alter_table_option ::= TTL NK_INTEGER */ + case 227: /* alter_table_option ::= TTL NK_INTEGER */ #line 434 "sql.y" { yymsp[-1].minor.yy481.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 6042 "sql.c" +#line 6019 "sql.c" break; - case 229: /* duration_list ::= duration_literal */ - case 434: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==434); + case 228: /* duration_list ::= duration_literal */ + case 433: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==433); #line 438 "sql.y" { yylhsminor.yy236 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6048 "sql.c" +#line 6025 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; - case 230: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 435: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==435); + case 229: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 434: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==434); #line 439 "sql.y" { yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6055 "sql.c" +#line 6032 "sql.c" yymsp[-2].minor.yy236 = yylhsminor.yy236; break; - case 233: /* rollup_func_name ::= function_name */ + case 232: /* rollup_func_name ::= function_name */ #line 446 "sql.y" { yylhsminor.yy28 = createFunctionNode(pCxt, &yymsp[0].minor.yy889, NULL); } -#line 6061 "sql.c" +#line 6038 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 234: /* rollup_func_name ::= FIRST */ - case 235: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==235); - case 293: /* tag_item ::= QTAGS */ yytestcase(yyruleno==293); + case 233: /* rollup_func_name ::= FIRST */ + case 234: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==234); + case 292: /* tag_item ::= QTAGS */ yytestcase(yyruleno==292); #line 447 "sql.y" { yylhsminor.yy28 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6069 "sql.c" +#line 6046 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 238: /* col_name ::= column_name */ - case 294: /* tag_item ::= column_name */ yytestcase(yyruleno==294); + case 237: /* col_name ::= column_name */ + case 293: /* tag_item ::= column_name */ yytestcase(yyruleno==293); #line 455 "sql.y" { yylhsminor.yy28 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy889); } -#line 6076 "sql.c" +#line 6053 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 239: /* cmd ::= SHOW DNODES */ + case 238: /* cmd ::= SHOW DNODES */ #line 458 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6082 "sql.c" +#line 6059 "sql.c" break; - case 240: /* cmd ::= SHOW USERS */ + case 239: /* cmd ::= SHOW USERS */ #line 459 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6087 "sql.c" +#line 6064 "sql.c" break; - case 241: /* cmd ::= SHOW USER PRIVILEGES */ + case 240: /* cmd ::= SHOW USER PRIVILEGES */ #line 460 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6092 "sql.c" +#line 6069 "sql.c" break; - case 242: /* cmd ::= SHOW DATABASES */ + case 241: /* cmd ::= SHOW DATABASES */ #line 461 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } -#line 6097 "sql.c" +#line 6074 "sql.c" break; - case 243: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + case 242: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ #line 462 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, OP_TYPE_LIKE); } -#line 6102 "sql.c" +#line 6079 "sql.c" break; - case 244: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + case 243: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ #line 463 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, OP_TYPE_LIKE); } -#line 6107 "sql.c" +#line 6084 "sql.c" break; - case 245: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ + case 244: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ #line 464 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy28, NULL, OP_TYPE_LIKE); } -#line 6112 "sql.c" +#line 6089 "sql.c" break; - case 246: /* cmd ::= SHOW MNODES */ + case 245: /* cmd ::= SHOW MNODES */ #line 465 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 6117 "sql.c" +#line 6094 "sql.c" break; - case 247: /* cmd ::= SHOW QNODES */ + case 246: /* cmd ::= SHOW QNODES */ #line 467 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 6122 "sql.c" +#line 6099 "sql.c" break; - case 248: /* cmd ::= SHOW FUNCTIONS */ + case 247: /* cmd ::= SHOW FUNCTIONS */ #line 468 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 6127 "sql.c" +#line 6104 "sql.c" break; - case 249: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + case 248: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ #line 469 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy28, yymsp[-1].minor.yy28, OP_TYPE_EQUAL); } -#line 6132 "sql.c" +#line 6109 "sql.c" break; - case 250: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + case 249: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ #line 470 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy889), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889), OP_TYPE_EQUAL); } -#line 6137 "sql.c" +#line 6114 "sql.c" break; - case 251: /* cmd ::= SHOW STREAMS */ + case 250: /* cmd ::= SHOW STREAMS */ #line 471 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 6142 "sql.c" +#line 6119 "sql.c" break; - case 252: /* cmd ::= SHOW ACCOUNTS */ + case 251: /* cmd ::= SHOW ACCOUNTS */ #line 472 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6147 "sql.c" +#line 6124 "sql.c" break; - case 253: /* cmd ::= SHOW APPS */ + case 252: /* cmd ::= SHOW APPS */ #line 473 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 6152 "sql.c" +#line 6129 "sql.c" break; - case 254: /* cmd ::= SHOW CONNECTIONS */ + case 253: /* cmd ::= SHOW CONNECTIONS */ #line 474 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 6157 "sql.c" +#line 6134 "sql.c" break; - case 255: /* cmd ::= SHOW LICENCES */ - case 256: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==256); + case 254: /* cmd ::= SHOW LICENCES */ + case 255: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==255); #line 475 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 6163 "sql.c" +#line 6140 "sql.c" break; - case 257: /* cmd ::= SHOW CREATE DATABASE db_name */ + case 256: /* cmd ::= SHOW CREATE DATABASE db_name */ #line 477 "sql.y" { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy889); } -#line 6168 "sql.c" +#line 6145 "sql.c" break; - case 258: /* cmd ::= SHOW CREATE TABLE full_table_name */ + case 257: /* cmd ::= SHOW CREATE TABLE full_table_name */ #line 478 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy28); } -#line 6173 "sql.c" +#line 6150 "sql.c" break; - case 259: /* cmd ::= SHOW CREATE STABLE full_table_name */ + case 258: /* cmd ::= SHOW CREATE STABLE full_table_name */ #line 479 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy28); } -#line 6178 "sql.c" +#line 6155 "sql.c" break; - case 260: /* cmd ::= SHOW QUERIES */ + case 259: /* cmd ::= SHOW QUERIES */ #line 480 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 6183 "sql.c" +#line 6160 "sql.c" break; - case 261: /* cmd ::= SHOW SCORES */ + case 260: /* cmd ::= SHOW SCORES */ #line 481 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 6188 "sql.c" +#line 6165 "sql.c" break; - case 262: /* cmd ::= SHOW TOPICS */ + case 261: /* cmd ::= SHOW TOPICS */ #line 482 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 6193 "sql.c" +#line 6170 "sql.c" break; - case 263: /* cmd ::= SHOW VARIABLES */ - case 264: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==264); + case 262: /* cmd ::= SHOW VARIABLES */ + case 263: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==263); #line 483 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 6199 "sql.c" +#line 6176 "sql.c" break; - case 265: /* cmd ::= SHOW LOCAL VARIABLES */ + case 264: /* cmd ::= SHOW LOCAL VARIABLES */ #line 485 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 6204 "sql.c" +#line 6181 "sql.c" break; - case 266: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + case 265: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ #line 486 "sql.y" { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy28); } -#line 6209 "sql.c" +#line 6186 "sql.c" break; - case 267: /* cmd ::= SHOW BNODES */ + case 266: /* cmd ::= SHOW BNODES */ #line 487 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 6214 "sql.c" +#line 6191 "sql.c" break; - case 268: /* cmd ::= SHOW SNODES */ + case 267: /* cmd ::= SHOW SNODES */ #line 488 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 6219 "sql.c" +#line 6196 "sql.c" break; - case 269: /* cmd ::= SHOW CLUSTER */ + case 268: /* cmd ::= SHOW CLUSTER */ #line 489 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 6224 "sql.c" +#line 6201 "sql.c" break; - case 270: /* cmd ::= SHOW TRANSACTIONS */ + case 269: /* cmd ::= SHOW TRANSACTIONS */ #line 490 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 6229 "sql.c" +#line 6206 "sql.c" break; - case 271: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + case 270: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ #line 491 "sql.y" { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy28); } -#line 6234 "sql.c" +#line 6211 "sql.c" break; - case 272: /* cmd ::= SHOW CONSUMERS */ + case 271: /* cmd ::= SHOW CONSUMERS */ #line 492 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 6239 "sql.c" +#line 6216 "sql.c" break; - case 273: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 272: /* cmd ::= SHOW SUBSCRIPTIONS */ #line 493 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 6244 "sql.c" +#line 6221 "sql.c" break; - case 274: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + case 273: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ #line 494 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy28, yymsp[-1].minor.yy28, OP_TYPE_EQUAL); } -#line 6249 "sql.c" +#line 6226 "sql.c" break; - case 275: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + case 274: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ #line 495 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy889), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889), OP_TYPE_EQUAL); } -#line 6254 "sql.c" +#line 6231 "sql.c" break; - case 276: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + case 275: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ #line 496 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy28, yymsp[-3].minor.yy236); } -#line 6259 "sql.c" +#line 6236 "sql.c" break; - case 277: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + case 276: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ #line 497 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy889), yymsp[-4].minor.yy236); } -#line 6264 "sql.c" +#line 6241 "sql.c" break; - case 278: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + case 277: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ #line 498 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 6269 "sql.c" +#line 6246 "sql.c" break; - case 279: /* cmd ::= SHOW VNODES */ + case 278: /* cmd ::= SHOW VNODES */ #line 499 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 6274 "sql.c" +#line 6251 "sql.c" break; - case 280: /* cmd ::= SHOW db_name_cond_opt ALIVE */ + case 279: /* cmd ::= SHOW db_name_cond_opt ALIVE */ #line 501 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy28, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 6279 "sql.c" +#line 6256 "sql.c" break; - case 281: /* cmd ::= SHOW CLUSTER ALIVE */ + case 280: /* cmd ::= SHOW CLUSTER ALIVE */ #line 502 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 6284 "sql.c" +#line 6261 "sql.c" break; - case 282: /* db_name_cond_opt ::= */ - case 287: /* from_db_opt ::= */ yytestcase(yyruleno==287); + case 281: /* db_name_cond_opt ::= */ + case 286: /* from_db_opt ::= */ yytestcase(yyruleno==286); #line 504 "sql.y" { yymsp[1].minor.yy28 = createDefaultDatabaseCondValue(pCxt); } -#line 6290 "sql.c" +#line 6267 "sql.c" break; - case 283: /* db_name_cond_opt ::= db_name NK_DOT */ + case 282: /* db_name_cond_opt ::= db_name NK_DOT */ #line 505 "sql.y" { yylhsminor.yy28 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy889); } -#line 6295 "sql.c" +#line 6272 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 285: /* like_pattern_opt ::= LIKE NK_STRING */ + case 284: /* like_pattern_opt ::= LIKE NK_STRING */ #line 508 "sql.y" { yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 6301 "sql.c" +#line 6278 "sql.c" break; - case 286: /* table_name_cond ::= table_name */ + case 285: /* table_name_cond ::= table_name */ #line 510 "sql.y" { yylhsminor.yy28 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889); } -#line 6306 "sql.c" +#line 6283 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 288: /* from_db_opt ::= FROM db_name */ + case 287: /* from_db_opt ::= FROM db_name */ #line 513 "sql.y" { yymsp[-1].minor.yy28 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889); } -#line 6312 "sql.c" +#line 6289 "sql.c" break; - case 292: /* tag_item ::= TBNAME */ + case 291: /* tag_item ::= TBNAME */ #line 521 "sql.y" { yylhsminor.yy28 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 6317 "sql.c" +#line 6294 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 295: /* tag_item ::= column_name column_alias */ + case 294: /* tag_item ::= column_name column_alias */ #line 524 "sql.y" { yylhsminor.yy28 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy889), &yymsp[0].minor.yy889); } -#line 6323 "sql.c" +#line 6300 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 296: /* tag_item ::= column_name AS column_alias */ + case 295: /* tag_item ::= column_name AS column_alias */ #line 525 "sql.y" { yylhsminor.yy28 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy889), &yymsp[0].minor.yy889); } -#line 6329 "sql.c" +#line 6306 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 297: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + case 296: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ #line 529 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy793, yymsp[-3].minor.yy28, yymsp[-1].minor.yy28, NULL, yymsp[0].minor.yy28); } -#line 6335 "sql.c" +#line 6312 "sql.c" break; - case 298: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + case 297: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ #line 531 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy793, yymsp[-5].minor.yy28, yymsp[-3].minor.yy28, yymsp[-1].minor.yy236, NULL); } -#line 6340 "sql.c" +#line 6317 "sql.c" break; - case 299: /* cmd ::= DROP INDEX exists_opt full_index_name */ + case 298: /* cmd ::= DROP INDEX exists_opt full_index_name */ #line 532 "sql.y" { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy793, yymsp[0].minor.yy28); } -#line 6345 "sql.c" +#line 6322 "sql.c" break; - case 300: /* full_index_name ::= index_name */ + case 299: /* full_index_name ::= index_name */ #line 534 "sql.y" { yylhsminor.yy28 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy889); } -#line 6350 "sql.c" +#line 6327 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 301: /* full_index_name ::= db_name NK_DOT index_name */ + case 300: /* full_index_name ::= db_name NK_DOT index_name */ #line 535 "sql.y" { yylhsminor.yy28 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889); } -#line 6356 "sql.c" +#line 6333 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 302: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + case 301: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ #line 538 "sql.y" { yymsp[-9].minor.yy28 = createIndexOption(pCxt, yymsp[-7].minor.yy236, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), NULL, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6362 "sql.c" +#line 6339 "sql.c" break; - case 303: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + case 302: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ #line 541 "sql.y" { yymsp[-11].minor.yy28 = createIndexOption(pCxt, yymsp[-9].minor.yy236, releaseRawExprNode(pCxt, yymsp[-5].minor.yy28), releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6367 "sql.c" +#line 6344 "sql.c" break; - case 306: /* func ::= sma_func_name NK_LP expression_list NK_RP */ + case 305: /* func ::= sma_func_name NK_LP expression_list NK_RP */ #line 548 "sql.y" { yylhsminor.yy28 = createFunctionNode(pCxt, &yymsp[-3].minor.yy889, yymsp[-1].minor.yy236); } -#line 6372 "sql.c" +#line 6349 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 307: /* sma_func_name ::= function_name */ - case 521: /* alias_opt ::= table_alias */ yytestcase(yyruleno==521); + case 306: /* sma_func_name ::= function_name */ + case 520: /* alias_opt ::= table_alias */ yytestcase(yyruleno==520); #line 552 "sql.y" { yylhsminor.yy889 = yymsp[0].minor.yy889; } -#line 6379 "sql.c" +#line 6356 "sql.c" yymsp[0].minor.yy889 = yylhsminor.yy889; break; - case 312: /* sma_stream_opt ::= */ - case 353: /* stream_options ::= */ yytestcase(yyruleno==353); + case 311: /* sma_stream_opt ::= */ + case 352: /* stream_options ::= */ yytestcase(yyruleno==352); #line 558 "sql.y" { yymsp[1].minor.yy28 = createStreamOptions(pCxt); } -#line 6386 "sql.c" +#line 6363 "sql.c" break; - case 313: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 312: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ #line 559 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy28)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = yymsp[-2].minor.yy28; } -#line 6391 "sql.c" +#line 6368 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 314: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + case 313: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ #line 560 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy28)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = yymsp[-2].minor.yy28; } -#line 6397 "sql.c" +#line 6374 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 315: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + case 314: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ #line 561 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy28)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = yymsp[-2].minor.yy28; } -#line 6403 "sql.c" +#line 6380 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 316: /* with_meta ::= AS */ + case 315: /* with_meta ::= AS */ #line 566 "sql.y" { yymsp[0].minor.yy956 = 0; } -#line 6409 "sql.c" +#line 6386 "sql.c" break; - case 317: /* with_meta ::= WITH META AS */ + case 316: /* with_meta ::= WITH META AS */ #line 567 "sql.y" { yymsp[-2].minor.yy956 = 1; } -#line 6414 "sql.c" +#line 6391 "sql.c" break; - case 318: /* with_meta ::= ONLY META AS */ + case 317: /* with_meta ::= ONLY META AS */ #line 568 "sql.y" { yymsp[-2].minor.yy956 = 2; } -#line 6419 "sql.c" +#line 6396 "sql.c" break; - case 319: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + case 318: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ #line 570 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy793, &yymsp[-2].minor.yy889, yymsp[0].minor.yy28); } -#line 6424 "sql.c" +#line 6401 "sql.c" break; - case 320: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + case 319: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ #line 572 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy793, &yymsp[-3].minor.yy889, &yymsp[0].minor.yy889, yymsp[-2].minor.yy956); } -#line 6429 "sql.c" +#line 6406 "sql.c" break; - case 321: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + case 320: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ #line 574 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy793, &yymsp[-4].minor.yy889, yymsp[-1].minor.yy28, yymsp[-3].minor.yy956, yymsp[0].minor.yy28); } -#line 6434 "sql.c" +#line 6411 "sql.c" break; - case 322: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 321: /* cmd ::= DROP TOPIC exists_opt topic_name */ #line 576 "sql.y" { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6439 "sql.c" +#line 6416 "sql.c" break; - case 323: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + case 322: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ #line 577 "sql.y" { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy793, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889); } -#line 6444 "sql.c" +#line 6421 "sql.c" break; - case 324: /* cmd ::= DESC full_table_name */ - case 325: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==325); + case 323: /* cmd ::= DESC full_table_name */ + case 324: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==324); #line 580 "sql.y" { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy28); } -#line 6450 "sql.c" +#line 6427 "sql.c" break; - case 326: /* cmd ::= RESET QUERY CACHE */ + case 325: /* cmd ::= RESET QUERY CACHE */ #line 584 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 6455 "sql.c" +#line 6432 "sql.c" break; - case 327: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 328: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==328); + case 326: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 327: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==327); #line 587 "sql.y" { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy793, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6461 "sql.c" +#line 6438 "sql.c" break; - case 331: /* explain_options ::= */ + case 330: /* explain_options ::= */ #line 595 "sql.y" { yymsp[1].minor.yy28 = createDefaultExplainOptions(pCxt); } -#line 6466 "sql.c" +#line 6443 "sql.c" break; - case 332: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 331: /* explain_options ::= explain_options VERBOSE NK_BOOL */ #line 596 "sql.y" { yylhsminor.yy28 = setExplainVerbose(pCxt, yymsp[-2].minor.yy28, &yymsp[0].minor.yy0); } -#line 6471 "sql.c" +#line 6448 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 333: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 332: /* explain_options ::= explain_options RATIO NK_FLOAT */ #line 597 "sql.y" { yylhsminor.yy28 = setExplainRatio(pCxt, yymsp[-2].minor.yy28, &yymsp[0].minor.yy0); } -#line 6477 "sql.c" +#line 6454 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 334: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + case 333: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ #line 602 "sql.y" { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy793, yymsp[-9].minor.yy793, &yymsp[-6].minor.yy889, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy32, yymsp[-1].minor.yy956, &yymsp[0].minor.yy889, yymsp[-10].minor.yy793); } -#line 6483 "sql.c" +#line 6460 "sql.c" break; - case 335: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 334: /* cmd ::= DROP FUNCTION exists_opt function_name */ #line 603 "sql.y" { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6488 "sql.c" +#line 6465 "sql.c" break; - case 340: /* language_opt ::= */ + case 339: /* language_opt ::= */ #line 617 "sql.y" { yymsp[1].minor.yy889 = nil_token; } -#line 6493 "sql.c" +#line 6470 "sql.c" break; - case 341: /* language_opt ::= LANGUAGE NK_STRING */ + case 340: /* language_opt ::= LANGUAGE NK_STRING */ #line 618 "sql.y" { yymsp[-1].minor.yy889 = yymsp[0].minor.yy0; } -#line 6498 "sql.c" +#line 6475 "sql.c" break; - case 344: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + case 343: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ #line 628 "sql.y" { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy793, &yymsp[-8].minor.yy889, yymsp[-5].minor.yy28, yymsp[-7].minor.yy28, yymsp[-3].minor.yy236, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, yymsp[-4].minor.yy236); } -#line 6503 "sql.c" +#line 6480 "sql.c" break; - case 345: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 344: /* cmd ::= DROP STREAM exists_opt stream_name */ #line 629 "sql.y" { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6508 "sql.c" +#line 6485 "sql.c" break; - case 346: /* cmd ::= PAUSE STREAM exists_opt stream_name */ + case 345: /* cmd ::= PAUSE STREAM exists_opt stream_name */ #line 630 "sql.y" { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6513 "sql.c" +#line 6490 "sql.c" break; - case 347: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + case 346: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ #line 631 "sql.y" { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy793, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6518 "sql.c" +#line 6495 "sql.c" break; - case 354: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 355: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==355); + case 353: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 354: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==354); #line 645 "sql.y" { yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6524 "sql.c" +#line 6501 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 356: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 355: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ #line 647 "sql.y" { yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-3].minor.yy28, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6530 "sql.c" +#line 6507 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 357: /* stream_options ::= stream_options WATERMARK duration_literal */ + case 356: /* stream_options ::= stream_options WATERMARK duration_literal */ #line 648 "sql.y" { yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6536 "sql.c" +#line 6513 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 358: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + case 357: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ #line 649 "sql.y" { yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-3].minor.yy28, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 6542 "sql.c" +#line 6519 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 359: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + case 358: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ #line 650 "sql.y" { yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 6548 "sql.c" +#line 6525 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 360: /* stream_options ::= stream_options DELETE_MARK duration_literal */ + case 359: /* stream_options ::= stream_options DELETE_MARK duration_literal */ #line 651 "sql.y" { yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6554 "sql.c" +#line 6531 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 361: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + case 360: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ #line 652 "sql.y" { yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-3].minor.yy28, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6560 "sql.c" +#line 6537 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 363: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 559: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==559); - case 580: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==580); + case 362: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 558: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==558); + case 579: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==579); #line 655 "sql.y" { yymsp[-3].minor.yy28 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy28); } -#line 6568 "sql.c" +#line 6545 "sql.c" break; - case 366: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 365: /* cmd ::= KILL CONNECTION NK_INTEGER */ #line 663 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 6573 "sql.c" +#line 6550 "sql.c" break; - case 367: /* cmd ::= KILL QUERY NK_STRING */ + case 366: /* cmd ::= KILL QUERY NK_STRING */ #line 664 "sql.y" { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6578 "sql.c" +#line 6555 "sql.c" break; - case 368: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 367: /* cmd ::= KILL TRANSACTION NK_INTEGER */ #line 665 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 6583 "sql.c" +#line 6560 "sql.c" break; - case 369: /* cmd ::= BALANCE VGROUP */ + case 368: /* cmd ::= BALANCE VGROUP */ #line 668 "sql.y" { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 6588 "sql.c" +#line 6565 "sql.c" break; - case 370: /* cmd ::= BALANCE VGROUP LEADER */ + case 369: /* cmd ::= BALANCE VGROUP LEADER */ #line 669 "sql.y" { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); } -#line 6593 "sql.c" +#line 6570 "sql.c" break; - case 371: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 370: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ #line 670 "sql.y" { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6598 "sql.c" +#line 6575 "sql.c" break; - case 372: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + case 371: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ #line 671 "sql.y" { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy236); } -#line 6603 "sql.c" +#line 6580 "sql.c" break; - case 373: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 372: /* cmd ::= SPLIT VGROUP NK_INTEGER */ #line 672 "sql.y" { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6608 "sql.c" +#line 6585 "sql.c" break; - case 374: /* dnode_list ::= DNODE NK_INTEGER */ + case 373: /* dnode_list ::= DNODE NK_INTEGER */ #line 676 "sql.y" { yymsp[-1].minor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6613 "sql.c" +#line 6590 "sql.c" break; - case 376: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ + case 375: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ #line 683 "sql.y" { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6618 "sql.c" +#line 6595 "sql.c" break; - case 379: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + case 378: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ #line 692 "sql.y" { yymsp[-6].minor.yy28 = createInsertStmt(pCxt, yymsp[-4].minor.yy28, yymsp[-2].minor.yy236, yymsp[0].minor.yy28); } -#line 6623 "sql.c" +#line 6600 "sql.c" break; - case 380: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ + case 379: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ #line 693 "sql.y" { yymsp[-3].minor.yy28 = createInsertStmt(pCxt, yymsp[-1].minor.yy28, NULL, yymsp[0].minor.yy28); } -#line 6628 "sql.c" +#line 6605 "sql.c" break; - case 381: /* literal ::= NK_INTEGER */ + case 380: /* literal ::= NK_INTEGER */ #line 696 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 6633 "sql.c" +#line 6610 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 382: /* literal ::= NK_FLOAT */ + case 381: /* literal ::= NK_FLOAT */ #line 697 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 6639 "sql.c" +#line 6616 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 383: /* literal ::= NK_STRING */ + case 382: /* literal ::= NK_STRING */ #line 698 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 6645 "sql.c" +#line 6622 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 384: /* literal ::= NK_BOOL */ + case 383: /* literal ::= NK_BOOL */ #line 699 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 6651 "sql.c" +#line 6628 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 385: /* literal ::= TIMESTAMP NK_STRING */ + case 384: /* literal ::= TIMESTAMP NK_STRING */ #line 700 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 6657 "sql.c" +#line 6634 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 386: /* literal ::= duration_literal */ - case 396: /* signed_literal ::= signed */ yytestcase(yyruleno==396); - case 417: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==417); - case 418: /* expression ::= literal */ yytestcase(yyruleno==418); - case 419: /* expression ::= pseudo_column */ yytestcase(yyruleno==419); - case 420: /* expression ::= column_reference */ yytestcase(yyruleno==420); - case 421: /* expression ::= function_expression */ yytestcase(yyruleno==421); - case 422: /* expression ::= case_when_expression */ yytestcase(yyruleno==422); - case 453: /* function_expression ::= literal_func */ yytestcase(yyruleno==453); - case 502: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==502); - case 506: /* boolean_primary ::= predicate */ yytestcase(yyruleno==506); - case 508: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==508); - case 509: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==509); - case 512: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==512); - case 514: /* table_reference ::= table_primary */ yytestcase(yyruleno==514); - case 515: /* table_reference ::= joined_table */ yytestcase(yyruleno==515); - case 519: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==519); - case 582: /* query_simple ::= query_specification */ yytestcase(yyruleno==582); - case 583: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==583); - case 586: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==586); - case 588: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==588); + case 385: /* literal ::= duration_literal */ + case 395: /* signed_literal ::= signed */ yytestcase(yyruleno==395); + case 416: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==416); + case 417: /* expression ::= literal */ yytestcase(yyruleno==417); + case 418: /* expression ::= pseudo_column */ yytestcase(yyruleno==418); + case 419: /* expression ::= column_reference */ yytestcase(yyruleno==419); + case 420: /* expression ::= function_expression */ yytestcase(yyruleno==420); + case 421: /* expression ::= case_when_expression */ yytestcase(yyruleno==421); + case 452: /* function_expression ::= literal_func */ yytestcase(yyruleno==452); + case 501: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==501); + case 505: /* boolean_primary ::= predicate */ yytestcase(yyruleno==505); + case 507: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==507); + case 508: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==508); + case 511: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==511); + case 513: /* table_reference ::= table_primary */ yytestcase(yyruleno==513); + case 514: /* table_reference ::= joined_table */ yytestcase(yyruleno==514); + case 518: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==518); + case 581: /* query_simple ::= query_specification */ yytestcase(yyruleno==581); + case 582: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==582); + case 585: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==585); + case 587: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==587); #line 701 "sql.y" { yylhsminor.yy28 = yymsp[0].minor.yy28; } -#line 6683 "sql.c" +#line 6660 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 387: /* literal ::= NULL */ + case 386: /* literal ::= NULL */ #line 702 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 6689 "sql.c" +#line 6666 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 388: /* literal ::= NK_QUESTION */ + case 387: /* literal ::= NK_QUESTION */ #line 703 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6695 "sql.c" +#line 6672 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 389: /* duration_literal ::= NK_VARIABLE */ + case 388: /* duration_literal ::= NK_VARIABLE */ #line 705 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6701 "sql.c" +#line 6678 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 390: /* signed ::= NK_INTEGER */ + case 389: /* signed ::= NK_INTEGER */ #line 707 "sql.y" { yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 6707 "sql.c" +#line 6684 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 391: /* signed ::= NK_PLUS NK_INTEGER */ + case 390: /* signed ::= NK_PLUS NK_INTEGER */ #line 708 "sql.y" { yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 6713 "sql.c" +#line 6690 "sql.c" break; - case 392: /* signed ::= NK_MINUS NK_INTEGER */ + case 391: /* signed ::= NK_MINUS NK_INTEGER */ #line 709 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 6722 "sql.c" +#line 6699 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 393: /* signed ::= NK_FLOAT */ + case 392: /* signed ::= NK_FLOAT */ #line 714 "sql.y" { yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 6728 "sql.c" +#line 6705 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 394: /* signed ::= NK_PLUS NK_FLOAT */ + case 393: /* signed ::= NK_PLUS NK_FLOAT */ #line 715 "sql.y" { yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 6734 "sql.c" +#line 6711 "sql.c" break; - case 395: /* signed ::= NK_MINUS NK_FLOAT */ + case 394: /* signed ::= NK_MINUS NK_FLOAT */ #line 716 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 6743 "sql.c" +#line 6720 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 397: /* signed_literal ::= NK_STRING */ + case 396: /* signed_literal ::= NK_STRING */ #line 723 "sql.y" { yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 6749 "sql.c" +#line 6726 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 398: /* signed_literal ::= NK_BOOL */ + case 397: /* signed_literal ::= NK_BOOL */ #line 724 "sql.y" { yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 6755 "sql.c" +#line 6732 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 399: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 398: /* signed_literal ::= TIMESTAMP NK_STRING */ #line 725 "sql.y" { yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6761 "sql.c" +#line 6738 "sql.c" break; - case 400: /* signed_literal ::= duration_literal */ - case 402: /* signed_literal ::= literal_func */ yytestcase(yyruleno==402); - case 473: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==473); - case 539: /* select_item ::= common_expression */ yytestcase(yyruleno==539); - case 549: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==549); - case 587: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==587); - case 589: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==589); - case 602: /* search_condition ::= common_expression */ yytestcase(yyruleno==602); + case 399: /* signed_literal ::= duration_literal */ + case 401: /* signed_literal ::= literal_func */ yytestcase(yyruleno==401); + case 472: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==472); + case 538: /* select_item ::= common_expression */ yytestcase(yyruleno==538); + case 548: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==548); + case 586: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==586); + case 588: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==588); + case 601: /* search_condition ::= common_expression */ yytestcase(yyruleno==601); #line 726 "sql.y" { yylhsminor.yy28 = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); } -#line 6773 "sql.c" +#line 6750 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 401: /* signed_literal ::= NULL */ + case 400: /* signed_literal ::= NULL */ #line 727 "sql.y" { yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 6779 "sql.c" +#line 6756 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 403: /* signed_literal ::= NK_QUESTION */ + case 402: /* signed_literal ::= NK_QUESTION */ #line 729 "sql.y" { yylhsminor.yy28 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 6785 "sql.c" +#line 6762 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 423: /* expression ::= NK_LP expression NK_RP */ - case 507: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==507); - case 601: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==601); + case 422: /* expression ::= NK_LP expression NK_RP */ + case 506: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==506); + case 600: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==600); #line 790 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 6793 "sql.c" +#line 6770 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 424: /* expression ::= NK_PLUS expr_or_subquery */ + case 423: /* expression ::= NK_PLUS expr_or_subquery */ #line 791 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6802 "sql.c" +#line 6779 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 425: /* expression ::= NK_MINUS expr_or_subquery */ + case 424: /* expression ::= NK_MINUS expr_or_subquery */ #line 795 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy28), NULL)); } -#line 6811 "sql.c" +#line 6788 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 426: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 425: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ #line 799 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6821 "sql.c" +#line 6798 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 427: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 426: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ #line 804 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6831 "sql.c" +#line 6808 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 428: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 427: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ #line 809 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6841 "sql.c" +#line 6818 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 429: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 428: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ #line 814 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6851 "sql.c" +#line 6828 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 430: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 429: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ #line 819 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6861 "sql.c" +#line 6838 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 431: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 430: /* expression ::= column_reference NK_ARROW NK_STRING */ #line 824 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 6870 "sql.c" +#line 6847 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 432: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 431: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ #line 828 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6880 "sql.c" +#line 6857 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 433: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 432: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ #line 833 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6890 "sql.c" +#line 6867 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 436: /* column_reference ::= column_name */ + case 435: /* column_reference ::= column_name */ #line 844 "sql.y" { yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy889, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy889)); } +#line 6873 "sql.c" + yymsp[0].minor.yy28 = yylhsminor.yy28; + break; + case 436: /* column_reference ::= table_name NK_DOT column_name */ +#line 845 "sql.y" +{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889, createColumnNode(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889)); } +#line 6879 "sql.c" + yymsp[-2].minor.yy28 = yylhsminor.yy28; + break; + case 437: /* pseudo_column ::= ROWTS */ + case 438: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==438); + case 440: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==440); + case 441: /* pseudo_column ::= QEND */ yytestcase(yyruleno==441); + case 442: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==442); + case 443: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==443); + case 444: /* pseudo_column ::= WEND */ yytestcase(yyruleno==444); + case 445: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==445); + case 446: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==446); + case 447: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==447); + case 448: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==448); + case 454: /* literal_func ::= NOW */ yytestcase(yyruleno==454); +#line 847 "sql.y" +{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } #line 6896 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 437: /* column_reference ::= table_name NK_DOT column_name */ -#line 845 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889, createColumnNode(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889)); } + case 439: /* pseudo_column ::= table_name NK_DOT TBNAME */ +#line 849 "sql.y" +{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy889)))); } #line 6902 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 438: /* pseudo_column ::= ROWTS */ - case 439: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==439); - case 441: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==441); - case 442: /* pseudo_column ::= QEND */ yytestcase(yyruleno==442); - case 443: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==443); - case 444: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==444); - case 445: /* pseudo_column ::= WEND */ yytestcase(yyruleno==445); - case 446: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==446); - case 447: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==447); - case 448: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==448); - case 449: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==449); - case 455: /* literal_func ::= NOW */ yytestcase(yyruleno==455); -#line 847 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 6919 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; - break; - case 440: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 849 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy889)))); } -#line 6925 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 450: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 451: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==451); + case 449: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 450: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==450); #line 860 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy889, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy889, yymsp[-1].minor.yy236)); } -#line 6932 "sql.c" +#line 6909 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 452: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 451: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ #line 863 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-1].minor.yy32)); } -#line 6938 "sql.c" +#line 6915 "sql.c" yymsp[-5].minor.yy28 = yylhsminor.yy28; break; - case 454: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 453: /* literal_func ::= noarg_func NK_LP NK_RP */ #line 866 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy889, NULL)); } -#line 6944 "sql.c" +#line 6921 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 469: /* star_func_para_list ::= NK_STAR */ + case 468: /* star_func_para_list ::= NK_STAR */ #line 890 "sql.y" { yylhsminor.yy236 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 6950 "sql.c" +#line 6927 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; - case 474: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 542: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==542); + case 473: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 541: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==541); #line 899 "sql.y" { yylhsminor.yy28 = createColumnNode(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0); } -#line 6957 "sql.c" +#line 6934 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 475: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ + case 474: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ #line 902 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy236, yymsp[-1].minor.yy28)); } -#line 6963 "sql.c" +#line 6940 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 476: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + case 475: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ #line 904 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-2].minor.yy236, yymsp[-1].minor.yy28)); } -#line 6969 "sql.c" +#line 6946 "sql.c" yymsp[-4].minor.yy28 = yylhsminor.yy28; break; - case 479: /* when_then_expr ::= WHEN common_expression THEN common_expression */ + case 478: /* when_then_expr ::= WHEN common_expression THEN common_expression */ #line 911 "sql.y" { yymsp[-3].minor.yy28 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6975 "sql.c" +#line 6952 "sql.c" break; - case 481: /* case_when_else_opt ::= ELSE common_expression */ + case 480: /* case_when_else_opt ::= ELSE common_expression */ #line 914 "sql.y" { yymsp[-1].minor.yy28 = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); } -#line 6980 "sql.c" +#line 6957 "sql.c" break; - case 482: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 487: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==487); + case 481: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 486: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==486); #line 917 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy896, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 6990 "sql.c" +#line 6967 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 483: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 482: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ #line 924 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy28), releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 7000 "sql.c" +#line 6977 "sql.c" yymsp[-4].minor.yy28 = yylhsminor.yy28; break; - case 484: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 483: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ #line 930 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy28), releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 7010 "sql.c" +#line 6987 "sql.c" yymsp[-5].minor.yy28 = yylhsminor.yy28; break; - case 485: /* predicate ::= expr_or_subquery IS NULL */ + case 484: /* predicate ::= expr_or_subquery IS NULL */ #line 935 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), NULL)); } -#line 7019 "sql.c" +#line 6996 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 486: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 485: /* predicate ::= expr_or_subquery IS NOT NULL */ #line 939 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), NULL)); } -#line 7028 "sql.c" +#line 7005 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 488: /* compare_op ::= NK_LT */ + case 487: /* compare_op ::= NK_LT */ #line 951 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_LOWER_THAN; } -#line 7034 "sql.c" +#line 7011 "sql.c" break; - case 489: /* compare_op ::= NK_GT */ + case 488: /* compare_op ::= NK_GT */ #line 952 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_GREATER_THAN; } -#line 7039 "sql.c" +#line 7016 "sql.c" break; - case 490: /* compare_op ::= NK_LE */ + case 489: /* compare_op ::= NK_LE */ #line 953 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_LOWER_EQUAL; } -#line 7044 "sql.c" +#line 7021 "sql.c" break; - case 491: /* compare_op ::= NK_GE */ + case 490: /* compare_op ::= NK_GE */ #line 954 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_GREATER_EQUAL; } -#line 7049 "sql.c" +#line 7026 "sql.c" break; - case 492: /* compare_op ::= NK_NE */ + case 491: /* compare_op ::= NK_NE */ #line 955 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_NOT_EQUAL; } -#line 7054 "sql.c" +#line 7031 "sql.c" break; - case 493: /* compare_op ::= NK_EQ */ + case 492: /* compare_op ::= NK_EQ */ #line 956 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_EQUAL; } -#line 7059 "sql.c" +#line 7036 "sql.c" break; - case 494: /* compare_op ::= LIKE */ + case 493: /* compare_op ::= LIKE */ #line 957 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_LIKE; } -#line 7064 "sql.c" +#line 7041 "sql.c" break; - case 495: /* compare_op ::= NOT LIKE */ + case 494: /* compare_op ::= NOT LIKE */ #line 958 "sql.y" { yymsp[-1].minor.yy896 = OP_TYPE_NOT_LIKE; } -#line 7069 "sql.c" +#line 7046 "sql.c" break; - case 496: /* compare_op ::= MATCH */ + case 495: /* compare_op ::= MATCH */ #line 959 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_MATCH; } -#line 7074 "sql.c" +#line 7051 "sql.c" break; - case 497: /* compare_op ::= NMATCH */ + case 496: /* compare_op ::= NMATCH */ #line 960 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_NMATCH; } -#line 7079 "sql.c" +#line 7056 "sql.c" break; - case 498: /* compare_op ::= CONTAINS */ + case 497: /* compare_op ::= CONTAINS */ #line 961 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_JSON_CONTAINS; } -#line 7084 "sql.c" +#line 7061 "sql.c" break; - case 499: /* in_op ::= IN */ + case 498: /* in_op ::= IN */ #line 965 "sql.y" { yymsp[0].minor.yy896 = OP_TYPE_IN; } -#line 7089 "sql.c" +#line 7066 "sql.c" break; - case 500: /* in_op ::= NOT IN */ + case 499: /* in_op ::= NOT IN */ #line 966 "sql.y" { yymsp[-1].minor.yy896 = OP_TYPE_NOT_IN; } -#line 7094 "sql.c" +#line 7071 "sql.c" break; - case 501: /* in_predicate_value ::= NK_LP literal_list NK_RP */ + case 500: /* in_predicate_value ::= NK_LP literal_list NK_RP */ #line 968 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); } -#line 7099 "sql.c" +#line 7076 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 503: /* boolean_value_expression ::= NOT boolean_primary */ + case 502: /* boolean_value_expression ::= NOT boolean_primary */ #line 972 "sql.y" { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy28), NULL)); } -#line 7108 "sql.c" +#line 7085 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 504: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 503: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ #line 977 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 7118 "sql.c" +#line 7095 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 505: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 504: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ #line 983 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 7128 "sql.c" +#line 7105 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 513: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 512: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ #line 1001 "sql.y" { yylhsminor.yy28 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, NULL); } -#line 7134 "sql.c" +#line 7111 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 516: /* table_primary ::= table_name alias_opt */ + case 515: /* table_primary ::= table_name alias_opt */ #line 1007 "sql.y" { yylhsminor.yy28 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 7140 "sql.c" +#line 7117 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 517: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 516: /* table_primary ::= db_name NK_DOT table_name alias_opt */ #line 1008 "sql.y" { yylhsminor.yy28 = createRealTableNode(pCxt, &yymsp[-3].minor.yy889, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 7146 "sql.c" +#line 7123 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 518: /* table_primary ::= subquery alias_opt */ + case 517: /* table_primary ::= subquery alias_opt */ #line 1009 "sql.y" { yylhsminor.yy28 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28), &yymsp[0].minor.yy889); } -#line 7152 "sql.c" +#line 7129 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 520: /* alias_opt ::= */ + case 519: /* alias_opt ::= */ #line 1014 "sql.y" { yymsp[1].minor.yy889 = nil_token; } -#line 7158 "sql.c" +#line 7135 "sql.c" break; - case 522: /* alias_opt ::= AS table_alias */ + case 521: /* alias_opt ::= AS table_alias */ #line 1016 "sql.y" { yymsp[-1].minor.yy889 = yymsp[0].minor.yy889; } -#line 7163 "sql.c" +#line 7140 "sql.c" break; - case 523: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 524: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==524); + case 522: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 523: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==523); #line 1018 "sql.y" { yymsp[-2].minor.yy28 = yymsp[-1].minor.yy28; } -#line 7169 "sql.c" +#line 7146 "sql.c" break; - case 525: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 524: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ #line 1023 "sql.y" { yylhsminor.yy28 = createJoinTableNode(pCxt, yymsp[-4].minor.yy152, yymsp[-5].minor.yy28, yymsp[-2].minor.yy28, yymsp[0].minor.yy28); } -#line 7174 "sql.c" +#line 7151 "sql.c" yymsp[-5].minor.yy28 = yylhsminor.yy28; break; - case 526: /* join_type ::= */ + case 525: /* join_type ::= */ #line 1027 "sql.y" { yymsp[1].minor.yy152 = JOIN_TYPE_INNER; } -#line 7180 "sql.c" +#line 7157 "sql.c" break; - case 527: /* join_type ::= INNER */ + case 526: /* join_type ::= INNER */ #line 1028 "sql.y" { yymsp[0].minor.yy152 = JOIN_TYPE_INNER; } -#line 7185 "sql.c" +#line 7162 "sql.c" break; - case 528: /* query_specification ::= SELECT hint_list tag_mode_opt 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 527: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ #line 1034 "sql.y" { - yymsp[-13].minor.yy28 = createSelectStmt(pCxt, yymsp[-10].minor.yy793, yymsp[-9].minor.yy236, yymsp[-8].minor.yy28, yymsp[-12].minor.yy236); - yymsp[-13].minor.yy28 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy28, yymsp[-11].minor.yy793); + yymsp[-13].minor.yy28 = createSelectStmt(pCxt, yymsp[-11].minor.yy793, yymsp[-9].minor.yy236, yymsp[-8].minor.yy28, yymsp[-12].minor.yy236); + yymsp[-13].minor.yy28 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy28, yymsp[-10].minor.yy793); yymsp[-13].minor.yy28 = addWhereClause(pCxt, yymsp[-13].minor.yy28, yymsp[-7].minor.yy28); yymsp[-13].minor.yy28 = addPartitionByClause(pCxt, yymsp[-13].minor.yy28, yymsp[-6].minor.yy236); yymsp[-13].minor.yy28 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy28, yymsp[-2].minor.yy28); @@ -7198,224 +7175,224 @@ static YYACTIONTYPE yy_reduce( yymsp[-13].minor.yy28 = addEveryClause(pCxt, yymsp[-13].minor.yy28, yymsp[-4].minor.yy28); yymsp[-13].minor.yy28 = addFillClause(pCxt, yymsp[-13].minor.yy28, yymsp[-3].minor.yy28); } -#line 7201 "sql.c" +#line 7178 "sql.c" break; - case 529: /* hint_list ::= */ + case 528: /* hint_list ::= */ #line 1049 "sql.y" { yymsp[1].minor.yy236 = createHintNodeList(pCxt, NULL); } -#line 7206 "sql.c" +#line 7183 "sql.c" break; - case 530: /* hint_list ::= NK_HINT */ + case 529: /* hint_list ::= NK_HINT */ #line 1050 "sql.y" { yylhsminor.yy236 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 7211 "sql.c" +#line 7188 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; - case 535: /* set_quantifier_opt ::= ALL */ + case 534: /* set_quantifier_opt ::= ALL */ #line 1061 "sql.y" { yymsp[0].minor.yy793 = false; } -#line 7217 "sql.c" +#line 7194 "sql.c" break; - case 538: /* select_item ::= NK_STAR */ + case 537: /* select_item ::= NK_STAR */ #line 1068 "sql.y" { yylhsminor.yy28 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 7222 "sql.c" +#line 7199 "sql.c" yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 540: /* select_item ::= common_expression column_alias */ - case 550: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==550); + case 539: /* select_item ::= common_expression column_alias */ + case 549: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==549); #line 1070 "sql.y" { yylhsminor.yy28 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28), &yymsp[0].minor.yy889); } -#line 7229 "sql.c" +#line 7206 "sql.c" yymsp[-1].minor.yy28 = yylhsminor.yy28; break; - case 541: /* select_item ::= common_expression AS column_alias */ - case 551: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==551); + case 540: /* select_item ::= common_expression AS column_alias */ + case 550: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==550); #line 1071 "sql.y" { yylhsminor.yy28 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), &yymsp[0].minor.yy889); } -#line 7236 "sql.c" +#line 7213 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 546: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 571: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==571); - case 591: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==591); + case 545: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 570: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==570); + case 590: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==590); #line 1080 "sql.y" { yymsp[-2].minor.yy236 = yymsp[0].minor.yy236; } -#line 7244 "sql.c" +#line 7221 "sql.c" break; - case 553: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 552: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ #line 1093 "sql.y" { yymsp[-5].minor.yy28 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 7249 "sql.c" +#line 7226 "sql.c" break; - case 554: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + case 553: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ #line 1094 "sql.y" { yymsp[-3].minor.yy28 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 7254 "sql.c" +#line 7231 "sql.c" break; - case 555: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 554: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ #line 1096 "sql.y" { yymsp[-5].minor.yy28 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), NULL, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 7259 "sql.c" +#line 7236 "sql.c" break; - case 556: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 555: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ #line 1099 "sql.y" { yymsp[-7].minor.yy28 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy28), releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 7264 "sql.c" +#line 7241 "sql.c" break; - case 557: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + case 556: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ #line 1101 "sql.y" { yymsp[-6].minor.yy28 = createEventWindowNode(pCxt, yymsp[-3].minor.yy28, yymsp[0].minor.yy28); } -#line 7269 "sql.c" +#line 7246 "sql.c" break; - case 561: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 560: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ #line 1107 "sql.y" { yymsp[-3].minor.yy28 = createFillNode(pCxt, yymsp[-1].minor.yy322, NULL); } -#line 7274 "sql.c" +#line 7251 "sql.c" break; - case 562: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + case 561: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ #line 1108 "sql.y" { yymsp[-5].minor.yy28 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); } -#line 7279 "sql.c" +#line 7256 "sql.c" break; - case 563: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + case 562: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ #line 1109 "sql.y" { yymsp[-5].minor.yy28 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); } -#line 7284 "sql.c" +#line 7261 "sql.c" break; - case 564: /* fill_mode ::= NONE */ + case 563: /* fill_mode ::= NONE */ #line 1113 "sql.y" { yymsp[0].minor.yy322 = FILL_MODE_NONE; } -#line 7289 "sql.c" +#line 7266 "sql.c" break; - case 565: /* fill_mode ::= PREV */ + case 564: /* fill_mode ::= PREV */ #line 1114 "sql.y" { yymsp[0].minor.yy322 = FILL_MODE_PREV; } -#line 7294 "sql.c" +#line 7271 "sql.c" break; - case 566: /* fill_mode ::= NULL */ + case 565: /* fill_mode ::= NULL */ #line 1115 "sql.y" { yymsp[0].minor.yy322 = FILL_MODE_NULL; } -#line 7299 "sql.c" +#line 7276 "sql.c" break; - case 567: /* fill_mode ::= NULL_F */ + case 566: /* fill_mode ::= NULL_F */ #line 1116 "sql.y" { yymsp[0].minor.yy322 = FILL_MODE_NULL_F; } -#line 7304 "sql.c" +#line 7281 "sql.c" break; - case 568: /* fill_mode ::= LINEAR */ + case 567: /* fill_mode ::= LINEAR */ #line 1117 "sql.y" { yymsp[0].minor.yy322 = FILL_MODE_LINEAR; } -#line 7309 "sql.c" +#line 7286 "sql.c" break; - case 569: /* fill_mode ::= NEXT */ + case 568: /* fill_mode ::= NEXT */ #line 1118 "sql.y" { yymsp[0].minor.yy322 = FILL_MODE_NEXT; } -#line 7314 "sql.c" +#line 7291 "sql.c" break; - case 572: /* group_by_list ::= expr_or_subquery */ + case 571: /* group_by_list ::= expr_or_subquery */ #line 1127 "sql.y" { yylhsminor.yy236 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 7319 "sql.c" +#line 7296 "sql.c" yymsp[0].minor.yy236 = yylhsminor.yy236; break; - case 573: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + case 572: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ #line 1128 "sql.y" { yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } -#line 7325 "sql.c" +#line 7302 "sql.c" yymsp[-2].minor.yy236 = yylhsminor.yy236; break; - case 577: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + case 576: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ #line 1135 "sql.y" { yymsp[-5].minor.yy28 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 7331 "sql.c" +#line 7308 "sql.c" break; - case 578: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + case 577: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ #line 1137 "sql.y" { yymsp[-3].minor.yy28 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 7336 "sql.c" +#line 7313 "sql.c" break; - case 581: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 580: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ #line 1144 "sql.y" { yylhsminor.yy28 = addOrderByClause(pCxt, yymsp[-3].minor.yy28, yymsp[-2].minor.yy236); yylhsminor.yy28 = addSlimitClause(pCxt, yylhsminor.yy28, yymsp[-1].minor.yy28); yylhsminor.yy28 = addLimitClause(pCxt, yylhsminor.yy28, yymsp[0].minor.yy28); } -#line 7345 "sql.c" +#line 7322 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 584: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + case 583: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ #line 1154 "sql.y" { yylhsminor.yy28 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy28, yymsp[0].minor.yy28); } -#line 7351 "sql.c" +#line 7328 "sql.c" yymsp[-3].minor.yy28 = yylhsminor.yy28; break; - case 585: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + case 584: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ #line 1156 "sql.y" { yylhsminor.yy28 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy28, yymsp[0].minor.yy28); } -#line 7357 "sql.c" +#line 7334 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 593: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 597: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==597); + case 592: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 596: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==596); #line 1170 "sql.y" { yymsp[-1].minor.yy28 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 7364 "sql.c" +#line 7341 "sql.c" break; - case 594: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 598: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==598); + case 593: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 597: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==597); #line 1171 "sql.y" { yymsp[-3].minor.yy28 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 7370 "sql.c" +#line 7347 "sql.c" break; - case 595: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 599: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==599); + case 594: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 598: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==598); #line 1172 "sql.y" { yymsp[-3].minor.yy28 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 7376 "sql.c" +#line 7353 "sql.c" break; - case 600: /* subquery ::= NK_LP query_expression NK_RP */ + case 599: /* subquery ::= NK_LP query_expression NK_RP */ #line 1180 "sql.y" { yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy28); } -#line 7381 "sql.c" +#line 7358 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 605: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + case 604: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ #line 1194 "sql.y" { yylhsminor.yy28 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), yymsp[-1].minor.yy734, yymsp[0].minor.yy945); } -#line 7387 "sql.c" +#line 7364 "sql.c" yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 606: /* ordering_specification_opt ::= */ + case 605: /* ordering_specification_opt ::= */ #line 1198 "sql.y" { yymsp[1].minor.yy734 = ORDER_ASC; } -#line 7393 "sql.c" +#line 7370 "sql.c" break; - case 607: /* ordering_specification_opt ::= ASC */ + case 606: /* ordering_specification_opt ::= ASC */ #line 1199 "sql.y" { yymsp[0].minor.yy734 = ORDER_ASC; } -#line 7398 "sql.c" +#line 7375 "sql.c" break; - case 608: /* ordering_specification_opt ::= DESC */ + case 607: /* ordering_specification_opt ::= DESC */ #line 1200 "sql.y" { yymsp[0].minor.yy734 = ORDER_DESC; } -#line 7403 "sql.c" +#line 7380 "sql.c" break; - case 609: /* null_ordering_opt ::= */ + case 608: /* null_ordering_opt ::= */ #line 1204 "sql.y" { yymsp[1].minor.yy945 = NULL_ORDER_DEFAULT; } -#line 7408 "sql.c" +#line 7385 "sql.c" break; - case 610: /* null_ordering_opt ::= NULLS FIRST */ + case 609: /* null_ordering_opt ::= NULLS FIRST */ #line 1205 "sql.y" { yymsp[-1].minor.yy945 = NULL_ORDER_FIRST; } -#line 7413 "sql.c" +#line 7390 "sql.c" break; - case 611: /* null_ordering_opt ::= NULLS LAST */ + case 610: /* null_ordering_opt ::= NULLS LAST */ #line 1206 "sql.y" { yymsp[-1].minor.yy945 = NULL_ORDER_LAST; } -#line 7418 "sql.c" +#line 7395 "sql.c" break; default: break; @@ -7488,7 +7465,7 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } -#line 7491 "sql.c" +#line 7468 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/source/libs/parser/test/parShowToUse.cpp b/source/libs/parser/test/parShowToUse.cpp index 3e1482d420..ee71950621 100644 --- a/source/libs/parser/test/parShowToUse.cpp +++ b/source/libs/parser/test/parShowToUse.cpp @@ -286,7 +286,7 @@ TEST_F(ParserShowToUseTest, trimDatabase) { run("TRIM DATABASE wxy_db"); setTrimDbReq("wxy_db", 100); - run("TRIM DATABASE wxy_db MAX_SPEED 100"); + run("TRIM DATABASE wxy_db BWLIMIT 100"); } TEST_F(ParserShowToUseTest, useDatabase) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 7ce6994ce6..51d5c96c86 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -969,6 +969,9 @@ static int32_t pushDownCondOptDealJoin(SOptimizeContext* pCxt, SJoinLogicNode* p if (NULL == pJoin->node.pConditions) { int32_t code = pushDownCondOptJoinExtractCond(pCxt, pJoin); + if (TSDB_CODE_SUCCESS == code) { + code = pushDownCondOptJoinExtractEqualOnCond(pCxt, pJoin); + } if (TSDB_CODE_SUCCESS == code) { OPTIMIZE_FLAG_SET_MASK(pJoin->node.optimizedFlag, OPTIMIZE_FLAG_PUSH_DOWN_CONDE); pCxt->optimized = true; diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 38d7c9da3b..5c9c3da5f4 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -44,7 +44,7 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen } // 2. valid length for each type - if (pSchema[i].type == TSDB_DATA_TYPE_BINARY) { + if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_VARBINARY) { if (pSchema[i].bytes > TSDB_MAX_BINARY_LEN) { return false; } @@ -300,6 +300,23 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t n = sprintf(str, "%e", GET_DOUBLE_VAL(buf)); break; + case TSDB_DATA_TYPE_VARBINARY:{ + if (bufSize < 0) { + // tscError("invalid buf size"); + return TSDB_CODE_TSC_INVALID_VALUE; + } + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(buf, bufSize, &data, &size) < 0){ + return TSDB_CODE_OUT_OF_MEMORY; + } + *str = '"'; + memcpy(str + 1, data, size); + *(str + size + 1) = '"'; + n = size + 2; + taosMemoryFree(data); + break; + } case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 8797a8cf6b..b4bd1943c5 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -133,6 +133,7 @@ typedef struct SQWTaskCtx { bool queryContinue; bool queryExecDone; bool queryInQueue; + bool explainRsped; int32_t rspCode; int64_t affectedRows; // for insert ...select stmt @@ -169,6 +170,7 @@ typedef struct SQWMsgStat { uint64_t rspProcessed; uint64_t cancelProcessed; uint64_t dropProcessed; + uint64_t notifyProcessed; uint64_t hbProcessed; uint64_t deleteProcessed; } SQWMsgStat; @@ -406,6 +408,7 @@ int32_t qwAddTaskCtx(QW_FPARAMS_DEF); void qwDbgSimulateRedirect(SQWMsg *qwMsg, SQWTaskCtx *ctx, bool *rsped); void qwDbgSimulateSleep(void); void qwDbgSimulateDead(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *rsped); +int32_t qwSendExplainResponse(QW_FPARAMS_DEF, SQWTaskCtx *ctx); #ifdef __cplusplus } diff --git a/source/libs/qworker/inc/qwMsg.h b/source/libs/qworker/inc/qwMsg.h index f226b223f7..ae68f69802 100644 --- a/source/libs/qworker/inc/qwMsg.h +++ b/source/libs/qworker/inc/qwMsg.h @@ -30,6 +30,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessReady(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg); +int32_t qwProcessNotify(QW_FPARAMS_DEF, SQWMsg *qwMsg); int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req); int32_t qwProcessDelete(QW_FPARAMS_DEF, SQWMsg *qwMsg, SDeleteRes *pRes); diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 0cbcf44ed4..9a1c309ab0 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -610,6 +610,41 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6 return TSDB_CODE_SUCCESS; } +int32_t qWorkerProcessNotifyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts) { + if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) { + return TSDB_CODE_QRY_INVALID_INPUT; + } + + int32_t code = 0; + SQWorker *mgmt = (SQWorker *)qWorkerMgmt; + + qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_STAT_INC(mgmt->stat.msgStat.notifyProcessed, 1); + + STaskNotifyReq msg = {0}; + if (tDeserializeSTaskNotifyReq(pMsg->pCont, pMsg->contLen, &msg) < 0) { + QW_ELOG("tDeserializeSTaskNotifyReq failed, contLen:%d", pMsg->contLen); + QW_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + uint64_t sId = msg.sId; + uint64_t qId = msg.queryId; + uint64_t tId = msg.taskId; + int64_t rId = msg.refId; + int32_t eId = msg.execId; + + SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code, .connInfo = pMsg->info, .msgType = msg.type}; + + QW_SCH_TASK_DLOG("processNotify start, node:%p, handle:%p", node, pMsg->info.handle); + + QW_ERR_RET(qwProcessNotify(QW_FPARAMS(), &qwMsg)); + + QW_SCH_TASK_DLOG("processNotify end, node:%p", node); + + return TSDB_CODE_SUCCESS; +} + + int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts) { if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) { return TSDB_CODE_QRY_INVALID_INPUT; diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index 3b127ee780..f00c4aef30 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -316,6 +316,45 @@ void qwFreeTaskCtx(SQWTaskCtx *ctx) { taosArrayDestroy(ctx->tbInfo); } +static void freeExplainExecItem(void *param) { + SExplainExecInfo *pInfo = param; + taosMemoryFree(pInfo->verboseInfo); +} + + +int32_t qwSendExplainResponse(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { + qTaskInfo_t taskHandle = ctx->taskHandle; + + ctx->explainRsped = true; + + SArray *execInfoList = taosArrayInit(4, sizeof(SExplainExecInfo)); + QW_ERR_RET(qGetExplainExecInfo(taskHandle, execInfoList)); + + if (ctx->localExec) { + SExplainLocalRsp localRsp = {0}; + localRsp.rsp.numOfPlans = taosArrayGetSize(execInfoList); + SExplainExecInfo *pExec = taosMemoryCalloc(localRsp.rsp.numOfPlans, sizeof(SExplainExecInfo)); + memcpy(pExec, taosArrayGet(execInfoList, 0), localRsp.rsp.numOfPlans * sizeof(SExplainExecInfo)); + localRsp.rsp.subplanInfo = pExec; + localRsp.qId = qId; + localRsp.tId = tId; + localRsp.rId = rId; + localRsp.eId = eId; + taosArrayPush(ctx->explainRes, &localRsp); + taosArrayDestroy(execInfoList); + } else { + SRpcHandleInfo connInfo = ctx->ctrlConnInfo; + connInfo.ahandle = NULL; + int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList); + taosArrayDestroyEx(execInfoList, freeExplainExecItem); + QW_ERR_RET(code); + } + + return TSDB_CODE_SUCCESS; +} + + + int32_t qwDropTaskCtx(QW_FPARAMS_DEF) { char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; QW_SET_QTID(id, qId, tId, eId); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 1759cc89f5..afce4a496a 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -90,11 +90,6 @@ int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *re QW_RET(TSDB_CODE_SUCCESS); } -static void freeItem(void *param) { - SExplainExecInfo *pInfo = param; - taosMemoryFree(pInfo->verboseInfo); -} - int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { qTaskInfo_t taskHandle = ctx->taskHandle; @@ -102,29 +97,8 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { ctx->queryExecDone = true; if (TASK_TYPE_TEMP == ctx->taskType && taskHandle) { - if (ctx->explain) { - SArray *execInfoList = taosArrayInit(4, sizeof(SExplainExecInfo)); - QW_ERR_RET(qGetExplainExecInfo(taskHandle, execInfoList)); - - if (ctx->localExec) { - SExplainLocalRsp localRsp = {0}; - localRsp.rsp.numOfPlans = taosArrayGetSize(execInfoList); - SExplainExecInfo *pExec = taosMemoryCalloc(localRsp.rsp.numOfPlans, sizeof(SExplainExecInfo)); - memcpy(pExec, taosArrayGet(execInfoList, 0), localRsp.rsp.numOfPlans * sizeof(SExplainExecInfo)); - localRsp.rsp.subplanInfo = pExec; - localRsp.qId = qId; - localRsp.tId = tId; - localRsp.rId = rId; - localRsp.eId = eId; - taosArrayPush(ctx->explainRes, &localRsp); - taosArrayDestroy(execInfoList); - } else { - SRpcHandleInfo connInfo = ctx->ctrlConnInfo; - connInfo.ahandle = NULL; - int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList); - taosArrayDestroyEx(execInfoList, freeItem); - QW_ERR_RET(code); - } + if (ctx->explain && !ctx->explainRsped) { + QW_ERR_RET(qwSendExplainResponse(QW_FPARAMS(), ctx)); } if (!ctx->needFetch) { @@ -1030,6 +1004,55 @@ _return: QW_RET(TSDB_CODE_SUCCESS); } +int32_t qwProcessNotify(QW_FPARAMS_DEF, SQWMsg *qwMsg) { + int32_t code = 0; + SQWTaskCtx *ctx = NULL; + bool locked = false; + + QW_ERR_JRET(qwAcquireTaskCtx(QW_FPARAMS(), &ctx)); + + QW_LOCK(QW_WRITE, &ctx->lock); + + locked = true; + + if (QW_QUERY_RUNNING(ctx)) { + QW_ERR_JRET(qwKillTaskHandle(ctx, TSDB_CODE_TSC_QUERY_CANCELLED)); + qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask); + } + + switch (qwMsg->msgType) { + case TASK_NOTIFY_FINISHED: + if (ctx->explain && !ctx->explainRsped) { + QW_ERR_RET(qwSendExplainResponse(QW_FPARAMS(), ctx)); + } + break; + default: + QW_ELOG("Invalid task notify type %d", qwMsg->msgType); + QW_ERR_JRET(TSDB_CODE_INVALID_MSG); + break; + } + +_return: + + if (code) { + if (ctx) { + QW_UPDATE_RSP_CODE(ctx, code); + qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); + } + } + + if (locked) { + QW_UNLOCK(QW_WRITE, &ctx->lock); + } + + if (ctx) { + qwReleaseTaskCtx(mgmt, ctx); + } + + QW_RET(TSDB_CODE_SUCCESS); +} + + int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { int32_t code = 0; SSchedulerHbRsp rsp = {0}; @@ -1354,6 +1377,7 @@ int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pSt pStat->cqueryProcessed = QW_STAT_GET(mgmt->stat.msgStat.cqueryProcessed); pStat->fetchProcessed = QW_STAT_GET(mgmt->stat.msgStat.fetchProcessed); pStat->dropProcessed = QW_STAT_GET(mgmt->stat.msgStat.dropProcessed); + pStat->notifyProcessed = QW_STAT_GET(mgmt->stat.msgStat.notifyProcessed); pStat->hbProcessed = QW_STAT_GET(mgmt->stat.msgStat.hbProcessed); pStat->deleteProcessed = QW_STAT_GET(mgmt->stat.msgStat.deleteProcessed); diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp index 02b341e28c..4a0d74a6e3 100644 --- a/source/libs/qworker/test/qworkerTests.cpp +++ b/source/libs/qworker/test/qworkerTests.cpp @@ -818,6 +818,9 @@ void *fetchQueueThread(void *param) { case TDMT_SCH_DROP_TASK: qWorkerProcessDropMsg(mockPointer, mgmt, fetchRpc, 0); break; + case TDMT_SCH_TASK_NOTIFY: + qWorkerProcessNotifyMsg(mockPointer, mgmt, fetchRpc, 0); + break; default: printf("unknown msg type:%d in fetch queue", fetchRpc->msgType); assert(0); diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h index 5fb7b0e90c..4296abb588 100644 --- a/source/libs/scalar/inc/filterInt.h +++ b/source/libs/scalar/inc/filterInt.h @@ -272,7 +272,7 @@ struct SFilterInfo { }; #define FILTER_NO_MERGE_DATA_TYPE(t) \ - ((t) == TSDB_DATA_TYPE_BINARY || (t) == TSDB_DATA_TYPE_NCHAR || (t) == TSDB_DATA_TYPE_JSON || \ + ((t) == TSDB_DATA_TYPE_BINARY || (t) == TSDB_DATA_TYPE_VARBINARY || (t) == TSDB_DATA_TYPE_NCHAR || (t) == TSDB_DATA_TYPE_JSON || \ (t) == TSDB_DATA_TYPE_GEOMETRY) #define FILTER_NO_MERGE_OPTR(o) ((o) == OP_TYPE_IS_NULL || (o) == OP_TYPE_IS_NOT_NULL || (o) == FILTER_DUMMY_EMPTY_OPTR) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 892fd588b6..6cc235bd06 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -180,7 +180,8 @@ __compar_fn_t gUint64UsignCompare[] = {compareUint64Uint8, compareUint64Uint16, int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { int8_t comparFn = 0; - if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && + type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -206,7 +207,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { } } - if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -257,6 +258,16 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = 5; break; + case TSDB_DATA_TYPE_VARBINARY:{ + if (optr == OP_TYPE_IN) { + comparFn = 8; + } else if (optr == OP_TYPE_NOT_IN) { + comparFn = 25; + } else { /* normal relational comparFn */ + comparFn = 30; + } + break; + } case TSDB_DATA_TYPE_BINARY: { if (optr == OP_TYPE_MATCH) { comparFn = 19; @@ -466,7 +477,7 @@ static FORCE_INLINE SFilterRangeNode *filterNewRange(SFilterRangeCtx *ctx, SFilt void *filterInitRangeCtx(int32_t type, int32_t options) { if (type > TSDB_DATA_TYPE_UBIGINT || type < TSDB_DATA_TYPE_BOOL || - type == TSDB_DATA_TYPE_BINARY || + type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { qError("not supported range type:%d", type); return NULL; @@ -1585,6 +1596,7 @@ int32_t fltConverToStr(char *str, int type, void *buf, int32_t bufSize, int32_t break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 4eb0f0e1bc..b3f67f2c9d 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -1594,6 +1594,8 @@ static int32_t sclGetMathOperatorResType(SOperatorNode *pOp) { SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_TIMESTAMP == rdt.type) || + TSDB_DATA_TYPE_VARBINARY == ldt.type || + TSDB_DATA_TYPE_VARBINARY == rdt.type || (TSDB_DATA_TYPE_TIMESTAMP == ldt.type && (IS_VAR_DATA_TYPE(rdt.type) || IS_FLOAT_TYPE(rdt.type))) || (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && (IS_VAR_DATA_TYPE(ldt.type) || IS_FLOAT_TYPE(ldt.type)))) { return TSDB_CODE_TSC_INVALID_OPERATION; @@ -1629,7 +1631,7 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) { return TSDB_CODE_TSC_INVALID_OPERATION; } SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; - if (!IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) || + if (ldt.type == TSDB_DATA_TYPE_VARBINARY || !IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) || (!IS_STR_DATA_TYPE(rdt.type) && (rdt.type != TSDB_DATA_TYPE_NULL))) { return TSDB_CODE_TSC_INVALID_OPERATION; } @@ -1660,6 +1662,11 @@ static int32_t sclGetJsonOperatorResType(SOperatorNode *pOp) { } static int32_t sclGetBitwiseOperatorResType(SOperatorNode *pOp) { + SDataType ldt = ((SExprNode *)(pOp->pLeft))->resType; + SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; + if(TSDB_DATA_TYPE_VARBINARY == ldt.type || TSDB_DATA_TYPE_VARBINARY == rdt.type){ + return TSDB_CODE_TSC_INVALID_OPERATION; + } pOp->node.resType.type = TSDB_DATA_TYPE_BIGINT; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; return TSDB_CODE_SUCCESS; diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 0246724c5b..e12c62ad87 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -190,55 +190,6 @@ _getBigintValue_fn_t getVectorBigintValueFn(int32_t srcType) { return p; } -typedef void *(*_getValueAddr_fn_t)(void *src, int32_t index); - -void *getVectorValueAddr_TINYINT(void *src, int32_t index) { return (void *)((int8_t *)src + index); } -void *getVectorValueAddr_UTINYINT(void *src, int32_t index) { return (void *)((uint8_t *)src + index); } -void *getVectorValueAddr_SMALLINT(void *src, int32_t index) { return (void *)((int16_t *)src + index); } -void *getVectorValueAddr_USMALLINT(void *src, int32_t index) { return (void *)((uint16_t *)src + index); } -void *getVectorValueAddr_INT(void *src, int32_t index) { return (void *)((int32_t *)src + index); } -void *getVectorValueAddr_UINT(void *src, int32_t index) { return (void *)((uint32_t *)src + index); } -void *getVectorValueAddr_BIGINT(void *src, int32_t index) { return (void *)((int64_t *)src + index); } -void *getVectorValueAddr_UBIGINT(void *src, int32_t index) { return (void *)((uint64_t *)src + index); } -void *getVectorValueAddr_FLOAT(void *src, int32_t index) { return (void *)((float *)src + index); } -void *getVectorValueAddr_DOUBLE(void *src, int32_t index) { return (void *)((double *)src + index); } -void *getVectorValueAddr_default(void *src, int32_t index) { return src; } -void *getVectorValueAddr_VAR(void *src, int32_t index) { return colDataGetData((SColumnInfoData *)src, index); } - -_getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) { - _getValueAddr_fn_t p = NULL; - if (srcType == TSDB_DATA_TYPE_TINYINT) { - p = getVectorValueAddr_TINYINT; - } else if (srcType == TSDB_DATA_TYPE_UTINYINT) { - p = getVectorValueAddr_UTINYINT; - } else if (srcType == TSDB_DATA_TYPE_SMALLINT) { - p = getVectorValueAddr_SMALLINT; - } else if (srcType == TSDB_DATA_TYPE_USMALLINT) { - p = getVectorValueAddr_USMALLINT; - } else if (srcType == TSDB_DATA_TYPE_INT) { - p = getVectorValueAddr_INT; - } else if (srcType == TSDB_DATA_TYPE_UINT) { - p = getVectorValueAddr_UINT; - } else if (srcType == TSDB_DATA_TYPE_BIGINT) { - p = getVectorValueAddr_BIGINT; - } else if (srcType == TSDB_DATA_TYPE_UBIGINT) { - p = getVectorValueAddr_UBIGINT; - } else if (srcType == TSDB_DATA_TYPE_FLOAT) { - p = getVectorValueAddr_FLOAT; - } else if (srcType == TSDB_DATA_TYPE_DOUBLE) { - p = getVectorValueAddr_DOUBLE; - } else if (srcType == TSDB_DATA_TYPE_BINARY) { - p = getVectorValueAddr_VAR; - } else if (srcType == TSDB_DATA_TYPE_NCHAR) { - p = getVectorValueAddr_VAR; - }else if(srcType == TSDB_DATA_TYPE_GEOMETRY) { - p = getVectorValueAddr_VAR; - } else { - p = getVectorValueAddr_default; - } - return p; -} - static FORCE_INLINE void varToTimestamp(char *buf, SScalarParam *pOut, int32_t rowIndex, int32_t *overflow) { terrno = TSDB_CODE_SUCCESS; @@ -358,6 +309,47 @@ static FORCE_INLINE void varToBool(char *buf, SScalarParam *pOut, int32_t rowInd } // todo remove this malloc +static FORCE_INLINE void varToVarbinary(char *buf, SScalarParam *pOut, int32_t rowIndex, int32_t *overflow) { + terrno = TSDB_CODE_SUCCESS; + + if(isHex(varDataVal(buf), varDataLen(buf))){ + if(!isValidateHex(varDataVal(buf), varDataLen(buf))){ + terrno = TSDB_CODE_PAR_INVALID_VARBINARY; + return; + } + + void* data = NULL; + uint32_t size = 0; + if(taosHex2Ascii(varDataVal(buf), varDataLen(buf), &data, &size) < 0){ + terrno = TSDB_CODE_OUT_OF_MEMORY; + return; + } + int32_t inputLen = size + VARSTR_HEADER_SIZE; + char *t = taosMemoryCalloc(1, inputLen); + if (t == NULL) { + sclError("Out of memory"); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return; + } + varDataSetLen(t, size); + memcpy(varDataVal(t), data, size); + colDataSetVal(pOut->columnData, rowIndex, t, false); + taosMemoryFree(t); + taosMemoryFree(data); + }else{ + int32_t inputLen = varDataTLen(buf); + char *t = taosMemoryCalloc(1, inputLen); + if (t == NULL) { + sclError("Out of memory"); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return; + } + memcpy(t, buf, inputLen); + colDataSetVal(pOut->columnData, rowIndex, t, false); + taosMemoryFree(t); + } +} + static FORCE_INLINE void varToNchar(char *buf, SScalarParam *pOut, int32_t rowIndex, int32_t *overflow) { terrno = TSDB_CODE_SUCCESS; @@ -447,18 +439,21 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { func = varToUnsigned; } else if (IS_FLOAT_TYPE(pCtx->outType)) { func = varToFloat; - } else if (pCtx->outType == TSDB_DATA_TYPE_VARCHAR && + } else if ((pCtx->outType == TSDB_DATA_TYPE_VARCHAR || pCtx->outType == TSDB_DATA_TYPE_VARBINARY) && pCtx->inType == TSDB_DATA_TYPE_NCHAR) { // nchar -> binary func = ncharToVar; vton = true; } else if (pCtx->outType == TSDB_DATA_TYPE_NCHAR && - pCtx->inType == TSDB_DATA_TYPE_VARCHAR) { // binary -> nchar + (pCtx->inType == TSDB_DATA_TYPE_VARCHAR || pCtx->inType == TSDB_DATA_TYPE_VARBINARY)) { // binary -> nchar func = varToNchar; vton = true; } else if (TSDB_DATA_TYPE_TIMESTAMP == pCtx->outType) { func = varToTimestamp; } else if (TSDB_DATA_TYPE_GEOMETRY == pCtx->outType) { func = varToGeometry; + } else if (TSDB_DATA_TYPE_VARBINARY == pCtx->outType) { + func = varToVarbinary; + vton = true; } else { sclError("invalid convert outType:%d, inType:%d", pCtx->outType, pCtx->inType); terrno = TSDB_CODE_APP_ERROR; @@ -597,7 +592,8 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t } if (optr == OP_TYPE_LIKE || optr == OP_TYPE_NOT_LIKE || optr == OP_TYPE_MATCH || optr == OP_TYPE_NMATCH) { - if (typeLeft != TSDB_DATA_TYPE_NCHAR && typeLeft != TSDB_DATA_TYPE_BINARY && typeLeft != TSDB_DATA_TYPE_GEOMETRY) { + if (typeLeft != TSDB_DATA_TYPE_NCHAR && typeLeft != TSDB_DATA_TYPE_BINARY && + typeLeft != TSDB_DATA_TYPE_GEOMETRY && typeLeft != TSDB_DATA_TYPE_VARBINARY) { return false; } } @@ -642,7 +638,8 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t convertNumberToNumber(*pRightData, pRightOut, typeRight, type); *pRightData = pRightOut; } - } else if (type == TSDB_DATA_TYPE_BINARY || typeLeft == TSDB_DATA_TYPE_GEOMETRY) { + } else if (type == TSDB_DATA_TYPE_BINARY || + type == TSDB_DATA_TYPE_GEOMETRY) { if (typeLeft == TSDB_DATA_TYPE_NCHAR) { *pLeftData = ncharTobinary(*pLeftData); *freeLeft = true; @@ -932,6 +929,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, break; } case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { return vectorConvertToVarData(&cCtx); @@ -947,26 +945,26 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/ /*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 5, 9, 7, 11, 12, 13, 14, 0, 7, 0, 0, 0, -1, - /*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, 0, -1, - /*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, 0, -1, - /*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 5, 9, 7, 4, 4, 5, 7, 0, 7, 0, 0, 0, -1, - /*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 5, 9, 7, 5, 5, 5, 7, 0, 7, 0, 0, 0, -1, - /*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, 7, 0, 0, 0, -1, - /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0, 0, -1, - /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 0, 0, 0, 0, 20, - /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 7, 0, 7, 0, 0, 0, -1, - /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, -1, - /*UTIN*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 0, 7, 0, 0, 0, -1, - /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 0, 7, 0, 0, 0, -1, - /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 7, 0, 0, 0, -1, - /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, -1, - /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - /*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + /*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 5, 9, 7, 11, 12, 13, 14, 0, -1, 0, 0, 0, -1, + /*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, -1, 0, 0, 0, -1, + /*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, -1, 0, 0, 0, -1, + /*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 5, 9, 7, 4, 4, 5, 7, 0, -1, 0, 0, 0, -1, + /*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 5, 9, 7, 5, 5, 5, 7, 0, -1, 0, 0, 0, -1, + /*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, -1, 0, 0, 0, -1, + /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, -1, 0, 0, 0, -1, + /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 16, 0, 0, 0, 20, + /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 7, 0, -1, 0, 0, 0, -1, + /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 16, 0, 0, 0, -1, + /*UTIN*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 0, -1, 0, 0, 0, -1, + /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 0, -1, 0, 0, 0, -1, + /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, -1, 0, 0, 0, -1, + /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,-1, -1, + /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, + /*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0}; int32_t vectorGetConvertType(int32_t type1, int32_t type2) { if (type1 == type2) { @@ -1122,7 +1120,7 @@ static SColumnInfoData *vectorConvertVarToDouble(SScalarParam *pInput, int32_t * SScalarParam output = {0}; SColumnInfoData *pCol = pInput->columnData; - if (IS_VAR_DATA_TYPE(pCol->info.type) && pCol->info.type != TSDB_DATA_TYPE_JSON) { + if (IS_VAR_DATA_TYPE(pCol->info.type) && pCol->info.type != TSDB_DATA_TYPE_JSON && pCol->info.type != TSDB_DATA_TYPE_VARBINARY) { int32_t code = vectorConvertSingleCol(pInput, &output, TSDB_DATA_TYPE_DOUBLE, -1, -1); if (code != TSDB_CODE_SUCCESS) { terrno = code; diff --git a/source/libs/scalar/test/filter/filterTests.cpp b/source/libs/scalar/test/filter/filterTests.cpp index 51ee9b6570..cd3d681f58 100644 --- a/source/libs/scalar/test/filter/filterTests.cpp +++ b/source/libs/scalar/test/filter/filterTests.cpp @@ -1415,52 +1415,6 @@ void doCompareWithValueRange_OnlyLeftType(__compar_fn_t fp, int32_t rType) { } } -void doCompare(const std::vector &lTypes, const std::vector &rTypes, int32_t oper) { - for (int i = 0; i < lTypes.size(); ++i) { - for (int j = 0; j < rTypes.size(); ++j) { - auto fp = filterGetCompFuncEx(lTypes[i], rTypes[j], oper); - switch (lTypes[i]) { - case TSDB_DATA_TYPE_TINYINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_SMALLINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_INT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_BIGINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_UTINYINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_USMALLINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_UINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - case TSDB_DATA_TYPE_UBIGINT: - doCompareWithValueRange_OnlyLeftType(fp, rTypes[j]); - break; - default: - FAIL(); - } - } - } -} - -TEST(dataCompareTest, signed_and_unsigned_int) { - std::vector lType = {TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, - TSDB_DATA_TYPE_BIGINT}; - std::vector rType = {TSDB_DATA_TYPE_UTINYINT, TSDB_DATA_TYPE_USMALLINT, TSDB_DATA_TYPE_UINT, - TSDB_DATA_TYPE_UBIGINT}; - - doCompare(lType, rType, OP_TYPE_GREATER_THAN); - doCompare(rType, lType, OP_TYPE_GREATER_THAN); -} - int main(int argc, char **argv) { taosSeedRand(taosGetTimestampSec()); testing::InitGoogleTest(&argc, argv); diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index aecf3d5d91..3b7a76bfc7 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -531,7 +531,7 @@ void schDeregisterTaskHb(SSchJob *pJob, SSchTask *pTask); void schCleanClusterHb(void *pTrans); int32_t schLaunchTask(SSchJob *job, SSchTask *task); int32_t schDelayLaunchTask(SSchJob *pJob, SSchTask *pTask); -int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, SQueryNodeAddr *addr, int32_t msgType); +int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, SQueryNodeAddr *addr, int32_t msgType, void* param); SSchJob *schAcquireJob(int64_t refId); int32_t schReleaseJob(int64_t refId); void schFreeFlowCtrl(SSchJob *pJob); @@ -598,6 +598,7 @@ int32_t schProcessOnJobFailure(SSchJob *pJob, int32_t errCode); int32_t schProcessOnJobPartialSuccess(SSchJob *pJob); void schFreeTask(SSchJob *pJob, SSchTask *pTask); void schDropTaskInHashList(SSchJob *pJob, SHashObj *list); +int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type, SSchTask *pTask); int32_t schLaunchLevelTasks(SSchJob *pJob, SSchLevel *level); int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask); int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel); @@ -612,6 +613,7 @@ int32_t schHandleJobRetry(SSchJob *pJob, SSchTask *pTask, SDataBuf *pMsg, int32 int32_t schChkResetJobRetry(SSchJob *pJob, int32_t rspCode); void schResetTaskForRetry(SSchJob *pJob, SSchTask *pTask); int32_t schChkUpdateRedirectCtx(SSchJob *pJob, SSchTask *pTask, SEpSet *pEpSet, int32_t rspCode); +int32_t schNotifyJobAllTasks(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType type); extern SSchDebug gSCHDebug; diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index d2ed26d405..b565619e75 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -638,6 +638,10 @@ void schDropJobAllTasks(SSchJob *pJob) { // schDropTaskInHashList(pJob, pJob->failTasks); } +int32_t schNotifyJobAllTasks(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType type) { + SCH_RET(schNotifyTaskInHashList(pJob, pJob->execTasks, type, pTask)); +} + void schFreeJobImpl(void *job) { if (NULL == job) { return; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 01b4e7e9e6..7b8decc007 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -88,6 +88,8 @@ int32_t schProcessFetchRsp(SSchJob *pJob, SSchTask *pTask, char *msg, int32_t rs SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp)); if (pRsp) { SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp)); + } else { + SCH_ERR_JRET(schNotifyJobAllTasks(pJob, pTask, TASK_NOTIFY_FINISHED)); } taosMemoryFreeClear(msg); @@ -481,6 +483,18 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { return TSDB_CODE_SUCCESS; } +int32_t schHandleNotifyCallback(void *param, SDataBuf *pMsg, int32_t code) { + SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; + qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " task notify rsp received, code:0x%x", pParam->queryId, pParam->taskId, + code); + if (pMsg) { + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); + } + return TSDB_CODE_SUCCESS; +} + + int32_t schHandleLinkBrokenCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchCallbackParamHeader *head = (SSchCallbackParamHeader *)param; rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); @@ -646,6 +660,9 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { case TDMT_SCH_DROP_TASK: *fp = schHandleDropCallback; break; + case TDMT_SCH_TASK_NOTIFY: + *fp = schHandleNotifyCallback; + break; case TDMT_SCH_QUERY_HEARTBEAT: *fp = schHandleHbCallback; break; @@ -1027,7 +1044,7 @@ _return: SCH_RET(code); } -int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t msgType) { +int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t msgType, void* param) { int32_t msgSize = 0; void *msg = NULL; int32_t code = 0; @@ -1205,6 +1222,37 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, persistHandle = true; break; } + case TDMT_SCH_TASK_NOTIFY: { + ETaskNotifyType* pType = param; + STaskNotifyReq qMsg; + qMsg.header.vgId = addr->nodeId; + qMsg.header.contLen = 0; + qMsg.sId = schMgmt.sId; + qMsg.queryId = pJob->queryId; + qMsg.taskId = pTask->taskId; + qMsg.refId = pJob->refId; + qMsg.execId = pTask->execId; + qMsg.type = *pType; + + msgSize = tSerializeSTaskNotifyReq(NULL, 0, &qMsg); + if (msgSize < 0) { + SCH_TASK_ELOG("tSerializeSTaskNotifyReq get size, msgSize:%d", msgSize); + SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + msg = taosMemoryCalloc(1, msgSize); + if (NULL == msg) { + SCH_TASK_ELOG("calloc %d failed", msgSize); + SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + if (tSerializeSTaskNotifyReq(msg, msgSize, &qMsg) < 0) { + SCH_TASK_ELOG("tSerializeSTaskNotifyReq failed, msgSize:%d", msgSize); + taosMemoryFree(msg); + SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + break; + } default: SCH_TASK_ELOG("unknown msg type to send, msgType:%d", msgType); SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index 9985e7d6a1..d96c01fc76 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -862,7 +862,7 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { while (nodeInfo) { if (nodeInfo->handle) { SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); - schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK); + schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK, NULL); SCH_TASK_DLOG("start to drop task's %dth execNode", i); } else { SCH_TASK_DLOG("no need to drop task %dth execNode", i); @@ -875,6 +875,33 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { SCH_TASK_DLOG("task has been dropped on %d exec nodes", size); } +int32_t schNotifyTaskOnExecNode(SSchJob *pJob, SSchTask *pTask, ETaskNotifyType type) { + int32_t size = (int32_t)taosHashGetSize(pTask->execNodes); + if (size <= 0) { + SCH_TASK_DLOG("task no exec address to notify, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); + return TSDB_CODE_SUCCESS; + } + + int32_t i = 0; + SSchNodeInfo *nodeInfo = taosHashIterate(pTask->execNodes, NULL); + while (nodeInfo) { + if (nodeInfo->handle) { + SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); + SCH_ERR_RET(schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_TASK_NOTIFY, &type)); + SCH_TASK_DLOG("start to notify %d to task's %dth execNode", type, i); + } else { + SCH_TASK_DLOG("no need to notify %d to task %dth execNode", type, i); + } + + ++i; + nodeInfo = taosHashIterate(pTask->execNodes, nodeInfo); + } + + SCH_TASK_DLOG("task has been notified %d on %d exec nodes", type, size); + return TSDB_CODE_SUCCESS; +} + + int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) { int32_t taskNum = (int32_t)taosArrayGetSize(pStatusList); SSchTask *pTask = NULL; @@ -1001,7 +1028,7 @@ int32_t schLaunchRemoteTask(SSchJob *pJob, SSchTask *pTask) { SCH_ERR_RET(schEnsureHbConnection(pJob, pTask)); } - SCH_RET(schBuildAndSendMsg(pJob, pTask, NULL, plan->msgType)); + SCH_RET(schBuildAndSendMsg(pJob, pTask, NULL, plan->msgType, NULL)); } int32_t schLaunchLocalTask(SSchJob *pJob, SSchTask *pTask) { @@ -1238,8 +1265,33 @@ void schDropTaskInHashList(SSchJob *pJob, SHashObj *list) { } } +int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type, SSchTask *pCurrTask) { + int32_t code = TSDB_CODE_SUCCESS; + + SCH_ERR_RET(schNotifyTaskOnExecNode(pJob, pCurrTask, type)); + + void *pIter = taosHashIterate(list, NULL); + while (pIter) { + SSchTask *pTask = *(SSchTask **)pIter; + if (pTask != pCurrTask) { + SCH_LOCK_TASK(pTask); + code = schNotifyTaskOnExecNode(pJob, pTask, type); + SCH_UNLOCK_TASK(pTask); + + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + pIter = taosHashIterate(list, pIter); + } + + SCH_RET(code); +} + + int32_t schExecRemoteFetch(SSchJob *pJob, SSchTask *pTask) { - SCH_RET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask))); + SCH_RET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask), NULL)); } int32_t schExecLocalFetch(SSchJob *pJob, SSchTask *pTask) { diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 694b0808f2..0864eb3c28 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -780,6 +780,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i } streamFreeQitem(pTask->msgInfo.pData); + pTask->msgInfo.pData = NULL; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index 65135ec9a1..e28c93b8b1 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -35,18 +35,17 @@ FAIL: return NULL; } -void streamQueueClose(SStreamQueue* queue) { - while (1) { - void* qItem = streamQueueNextItem(queue); - if (qItem) { - streamFreeQitem(qItem); - } else { - break; - } +void streamQueueClose(SStreamQueue* pQueue, int32_t taskId) { + qDebug("s-task:0x%x free the queue:%p, items in queue:%d", taskId, pQueue->queue, taosQueueItemSize(pQueue->queue)); + + void* qItem = NULL; + while ((qItem = streamQueueNextItem(pQueue)) != NULL) { + streamFreeQitem(qItem); } - taosFreeQall(queue->qall); - taosCloseQueue(queue->queue); - taosMemoryFree(queue); + + taosFreeQall(pQueue->qall); + taosCloseQueue(pQueue->queue); + taosMemoryFree(pQueue); } #if 0 diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 122d18e9f0..232ca132ab 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -236,11 +236,11 @@ void tFreeStreamTask(SStreamTask* pTask) { int32_t status = atomic_load_8((int8_t*)&(pTask->status.taskStatus)); if (pTask->inputQueue) { - streamQueueClose(pTask->inputQueue); + streamQueueClose(pTask->inputQueue, pTask->id.taskId); } if (pTask->outputInfo.queue) { - streamQueueClose(pTask->outputInfo.queue); + streamQueueClose(pTask->outputInfo.queue, pTask->id.taskId); } if (pTask->exec.qmsg) { @@ -271,6 +271,11 @@ void tFreeStreamTask(SStreamTask* pTask) { streamStateClose(pTask->pState, status == TASK_STATUS__DROPPING); } + if (pTask->msgInfo.pData != NULL) { + destroyStreamDataBlock(pTask->msgInfo.pData); + pTask->msgInfo.pData = NULL; + } + if (pTask->id.idStr != NULL) { taosMemoryFree((void*)pTask->id.idStr); } diff --git a/source/libs/tfs/src/tfsTier.c b/source/libs/tfs/src/tfsTier.c index 2ad021cbb5..a24e3cf021 100644 --- a/source/libs/tfs/src/tfsTier.c +++ b/source/libs/tfs/src/tfsTier.c @@ -16,6 +16,8 @@ #define _DEFAULT_SOURCE #include "tfsInt.h" +extern int64_t tsMinDiskFreeSize; + int32_t tfsInitTier(STfsTier *pTier, int32_t level) { memset(pTier, 0, sizeof(STfsTier)); @@ -114,7 +116,7 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) { if (pDisk == NULL) continue; - if (pDisk->size.avail < TFS_MIN_DISK_FREE_SIZE) continue; + if (pDisk->size.avail < tsMinDiskFreeSize) continue; retId = diskId; terrno = 0; @@ -132,7 +134,7 @@ void tfsPosNextId(STfsTier *pTier) { for (int32_t id = 1; id < pTier->ndisk; id++) { STfsDisk *pLDisk = pTier->disks[nextid]; STfsDisk *pDisk = pTier->disks[id]; - if (pDisk->size.avail > TFS_MIN_DISK_FREE_SIZE && pDisk->size.avail > pLDisk->size.avail) { + if (pDisk->size.avail > tsMinDiskFreeSize && pDisk->size.avail > pLDisk->size.avail) { nextid = id; } } diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index c4309b2c55..1177ff562e 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -212,7 +212,7 @@ int32_t taosStatFile(const char *path, int64_t *size, int32_t *mtime, int32_t *a } if (atime != NULL) { - *atime = fileStat.st_mtime; + *atime = fileStat.st_atime; } return 0; @@ -889,13 +889,16 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) { char *data = taosMemoryMalloc(compressSize); gzFile dstFp = NULL; - TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ | TD_FILE_STREAM); + TdFilePtr pFile = NULL; + TdFilePtr pSrcFile = NULL; + + pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ | TD_FILE_STREAM); if (pSrcFile == NULL) { ret = -1; goto cmp_end; } - TdFilePtr pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { ret = -2; goto cmp_end; @@ -914,6 +917,9 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) { } cmp_end: + if (pFile) { + taosCloseFile(&pFile); + } if (pSrcFile) { taosCloseFile(&pSrcFile); } diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 0f459b58cd..8aac606473 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -468,3 +468,117 @@ float taosStr2Float(const char *str, char **pEnd) { #endif return tmp; } + +#define HEX_PREFIX_LEN 2 // \x +bool isHex(const char* z, uint32_t n){ + if(n < HEX_PREFIX_LEN) return false; + if(z[0] == '\\' && z[1] == 'x') return true; + return false; +} + +bool isValidateHex(const char* z, uint32_t n){ + if(n % 2 != 0) return false; + for(size_t i = HEX_PREFIX_LEN; i < n; i++){ + if(isxdigit(z[i]) == 0){ + return false; + } + } + return true; +} + +int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ + n -= HEX_PREFIX_LEN; // remove 0x + z += HEX_PREFIX_LEN; + *size = n / HEX_PREFIX_LEN; + if(*size == 0) return 0; + uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); + if(tmp == NULL) return -1; + int8_t num = 0; + uint8_t *byte = tmp + *size - 1; + + for (int i = n - 1; i >= 0; i--) { + if (z[i] >= 'a') { + *byte |= ((uint8_t)(10 + (z[i] - 'a')) << (num * 4)); + } else if (z[i] >= 'A') { + *byte |= ((uint8_t)(10 + (z[i] - 'A')) << (num * 4)); + } else { + *byte |= ((uint8_t)(z[i] - '0') << (num * 4)); + } + if (num == 1) { + byte--; + num = 0; + } else { + num++; + } + } + *data = tmp; + return 0; +} + +//int32_t taosBin2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ +// +// for (i = 2; isdigit(z[i]) || (z[i] >= 'a' && z[i] <= 'f') || (z[i] >= 'A' && z[i] <= 'F'); ++i) { +// } +// +// n -= 2; // remove 0b +// z += 2; +// *size = n%8 == 0 ? n/8 : n/8 + 1; +// uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); +// if(tmp == NULL) return -1; +// int8_t num = 0; +// uint8_t *byte = tmp + *size - 1; +// +// for (int i = n - 1; i >= 0; i--) { +// *byte |= ((uint8_t)(z[i] - '0') << num); +// if (num == 7) { +// byte--; +// num = 0; +// } else { +// num++; +// } +// } +// *data = tmp; +// return 0; +//} + +static char valueOf(uint8_t symbol) +{ + switch(symbol) + { + case 0: return '0'; + case 1: return '1'; + case 2: return '2'; + case 3: return '3'; + case 4: return '4'; + case 5: return '5'; + case 6: return '6'; + case 7: return '7'; + case 8: return '8'; + case 9: return '9'; + case 10: return 'A'; + case 11: return 'B'; + case 12: return 'C'; + case 13: return 'D'; + case 14: return 'E'; + case 15: return 'F'; + default: + { + return -1; + } + } +} + +int32_t taosAscii2Hex(const char *z, uint32_t n, void** data, uint32_t* size){ + *size = n * 2 + HEX_PREFIX_LEN; + uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size + 1, 1); + if(tmp == NULL) return -1; + *data = tmp; + *(tmp++) = '\\'; + *(tmp++) = 'x'; + for(int i = 0; i < n; i ++){ + uint8_t val = z[i]; + tmp[i*2] = valueOf(val >> 4); + tmp[i*2 + 1] = valueOf(val & 0x0F); + } + return 0; +} diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 843f9c56dc..4bacda48d2 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -242,6 +242,10 @@ int32_t compareLenBinaryVal(const void *pLeft, const void *pRight) { } } +int32_t compareLenBinaryValDesc(const void *pLeft, const void *pRight) { + return compareLenBinaryVal(pRight, pLeft); +} + // string > number > bool > null // ref: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-comparison int32_t compareJsonVal(const void *pLeft, const void *pRight) { @@ -1301,7 +1305,8 @@ int32_t comparewcsPatternNMatch(const void *pLeft, const void *pRight) { __compar_fn_t getComparFunc(int32_t type, int32_t optr) { __compar_fn_t comparFn = NULL; - if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && + type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -1324,7 +1329,8 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { } } - if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { + if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_VARBINARY && + type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -1368,6 +1374,15 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = compareDoubleVal; break; + case TSDB_DATA_TYPE_VARBINARY: + if (optr == OP_TYPE_IN) { + comparFn = compareChkInString; + } else if (optr == OP_TYPE_NOT_IN) { + comparFn = compareChkNotInString; + } else { /* normal relational comparFn */ + comparFn = compareLenBinaryVal; + } + break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_GEOMETRY: { if (optr == OP_TYPE_MATCH) { @@ -1453,6 +1468,8 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { return (order == TSDB_ORDER_ASC) ? compareUint32Val : compareUint32ValDesc; case TSDB_DATA_TYPE_UBIGINT: return (order == TSDB_ORDER_ASC) ? compareUint64Val : compareUint64ValDesc; + case TSDB_DATA_TYPE_VARBINARY: + return (order == TSDB_ORDER_ASC) ? compareLenBinaryVal : compareLenBinaryValDesc; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_GEOMETRY: return (order == TSDB_ORDER_ASC) ? compareLenPrefixedStr : compareLenPrefixedStrDesc; @@ -1464,57 +1481,3 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { return (order == TSDB_ORDER_ASC) ? compareInt32Val : compareInt32ValDesc; } } - -int32_t doCompare(const char *f1, const char *f2, int32_t type, size_t size) { - switch (type) { - case TSDB_DATA_TYPE_INT: - DEFAULT_COMP(GET_INT32_VAL(f1), GET_INT32_VAL(f2)); - case TSDB_DATA_TYPE_DOUBLE: - DEFAULT_DOUBLE_COMP(GET_DOUBLE_VAL(f1), GET_DOUBLE_VAL(f2)); - case TSDB_DATA_TYPE_FLOAT: - DEFAULT_FLOAT_COMP(GET_FLOAT_VAL(f1), GET_FLOAT_VAL(f2)); - case TSDB_DATA_TYPE_BIGINT: - DEFAULT_COMP(GET_INT64_VAL(f1), GET_INT64_VAL(f2)); - case TSDB_DATA_TYPE_SMALLINT: - DEFAULT_COMP(GET_INT16_VAL(f1), GET_INT16_VAL(f2)); - case TSDB_DATA_TYPE_TINYINT: - case TSDB_DATA_TYPE_BOOL: - DEFAULT_COMP(GET_INT8_VAL(f1), GET_INT8_VAL(f2)); - case TSDB_DATA_TYPE_UTINYINT: - DEFAULT_COMP(GET_UINT8_VAL(f1), GET_UINT8_VAL(f2)); - case TSDB_DATA_TYPE_USMALLINT: - DEFAULT_COMP(GET_UINT16_VAL(f1), GET_UINT16_VAL(f2)); - case TSDB_DATA_TYPE_UINT: - DEFAULT_COMP(GET_UINT32_VAL(f1), GET_UINT32_VAL(f2)); - case TSDB_DATA_TYPE_UBIGINT: - DEFAULT_COMP(GET_UINT64_VAL(f1), GET_UINT64_VAL(f2)); - case TSDB_DATA_TYPE_NCHAR: { - tstr *t1 = (tstr *)f1; - tstr *t2 = (tstr *)f2; - - if (t1->len != t2->len) { - return t1->len > t2->len ? 1 : -1; - } - int32_t ret = memcmp((TdUcs4 *)t1, (TdUcs4 *)t2, t2->len); - if (ret == 0) { - return ret; - } - return (ret < 0) ? -1 : 1; - } - default: { // todo refactor - tstr *t1 = (tstr *)f1; - tstr *t2 = (tstr *)f2; - - if (t1->len != t2->len) { - return t1->len > t2->len ? 1 : -1; - } else { - int32_t ret = strncmp(t1->data, t2->data, t1->len); - if (ret == 0) { - return 0; - } else { - return ret < 0 ? -1 : 1; - } - } - } - } -} diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 3681c7a423..848e977687 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -1019,7 +1019,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { code = cfgSetItem(pConfig, name, value, CFG_STYPE_APOLLO_URL); if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break; - + if (strcasecmp(name, "dataDir") == 0) { code = cfgSetTfsItem(pConfig, name, value, value2, value3, CFG_STYPE_APOLLO_URL); if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 0dc6f1d777..e1dfdc8cf7 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -556,6 +556,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY, "Window query not su TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DROP_COL, "No columns can be dropped") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be json type") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VARBINARY, "Invalidate varbinary type") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must have a definite time window range") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG, "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC, "Fill not allowed") diff --git a/source/util/src/thashutil.c b/source/util/src/thashutil.c index 891c09cfb5..9d65977ff1 100644 --- a/source/util/src/thashutil.c +++ b/source/util/src/thashutil.c @@ -193,6 +193,7 @@ _hash_fn_t taosGetDefaultHashFunction(int32_t type) { fn = taosIntHash_64; break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: fn = MurmurHash3_32; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 4a15b5b976..a431b091ec 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -384,7 +384,7 @@ static void taosGetLogFileName(char *fn) { } static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { -#ifdef WINDOWS +#ifdef WINDOWS_STASH /* * always set maxFileNum to 1 * means client log filename is unique in windows diff --git a/source/util/src/tskiplist.c b/source/util/src/tskiplist.c index 6344af523f..eadd9a2413 100644 --- a/source/util/src/tskiplist.c +++ b/source/util/src/tskiplist.c @@ -376,6 +376,7 @@ void tSkipListPrint(SSkipList *pSkipList, int16_t nlevel) { fprintf(stdout, "%d: %" PRId64 " \n", id++, *(int64_t *)key); break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: fprintf(stdout, "%d: %s \n", id++, key); break; diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 326a754654..2428fdb9a2 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -360,6 +360,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/smaTest.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/sma_index.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml_TS-3724.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/varbinary.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/spread.py @@ -772,6 +773,7 @@ ,,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 2-query/fill_with_group.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 ,,n,system-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/insertMix.py -N 3 diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index e91d9d3f6b..cd873ca0f2 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -806,21 +806,33 @@ class TDDnodes: psCmd = "for /f %a in ('wmic process where \"name='taosd.exe'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): - print(processID) + print(f"pid of taosd.exe:{processID}") killCmd = "kill -9 %s > nul 2>&1" % processID os.system(killCmd) time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8").strip() + psCmd = "for /f %a in ('wmic process where \"name='tmq_sim.exe'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): - print(processID) + print(f"pid of tmq_sim.exe:{processID}") killCmd = "kill -9 %s > nul 2>&1" % processID os.system(killCmd) time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8").strip() + + psCmd = "for /f %a in ('wmic process where \"name='taosBenchmark.exe'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + while(processID): + print(f"pid of taosBenchmark.exe:{processID}") + killCmd = "kill -9 %s > nul 2>&1" % processID + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8").strip() + else: psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() diff --git a/tests/script/api/batchprepare.c b/tests/script/api/batchprepare.c index 604d6ade89..0e3b50974a 100644 --- a/tests/script/api/batchprepare.c +++ b/tests/script/api/batchprepare.c @@ -1222,6 +1222,7 @@ int32_t bpAppendValueString(char *buf, int type, void *value, int32_t valueLen, break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: buf[*len] = '\''; @@ -1369,7 +1370,7 @@ void bpCheckColTagFields(TAOS_STMT *stmt, int32_t fieldNum, TAOS_FIELD_E* pField exit(1); } - if (pFields[i].type == TSDB_DATA_TYPE_BINARY || pFields[i].type == TSDB_DATA_TYPE_GEOMETRY) { + if (pFields[i].type == TSDB_DATA_TYPE_BINARY || pFields[i].type == TSDB_DATA_TYPE_VARBINARY || pFields[i].type == TSDB_DATA_TYPE_GEOMETRY) { if (pFields[i].bytes != (pBind[i].buffer_length + 2)) { printf("!!!%s %dth field len %d mis-match expect len %d\n", BP_BIND_TYPE_STR(type), i, pFields[i].bytes, (pBind[i].buffer_length + 2)); exit(1); @@ -2256,7 +2257,7 @@ int insertNonExistsTb(TAOS_STMT *stmt, TAOS *taos) { void bpAddWrongVarBuffLen(TAOS_MULTI_BIND* pBind) { for (int32_t i = 0; i < gCurCase->bindColNum; ++i) { - if (pBind[i].buffer_type == TSDB_DATA_TYPE_BINARY || pBind[i].buffer_type == TSDB_DATA_TYPE_NCHAR) { + if (pBind[i].buffer_type == TSDB_DATA_TYPE_BINARY || pBind[i].buffer_type == TSDB_DATA_TYPE_VARBINARY || pBind[i].buffer_type == TSDB_DATA_TYPE_NCHAR) { *pBind[i].length += 100; } } diff --git a/tests/script/api/passwdTest.c b/tests/script/api/passwdTest.c index d9cb2128ef..06d2d3455f 100644 --- a/tests/script/api/passwdTest.c +++ b/tests/script/api/passwdTest.c @@ -145,6 +145,7 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { len += sprintf(str + len, "%lf", dv); } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); diff --git a/tests/script/api/stmt_function.c b/tests/script/api/stmt_function.c index 55ab3f5631..d7d6f7d6f0 100644 --- a/tests/script/api/stmt_function.c +++ b/tests/script/api/stmt_function.c @@ -400,6 +400,7 @@ void taos_stmt_use_result_query(void *taos, char *col, int type) { params->length = ¶ms->buffer_length; break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: params->buffer_length = sizeof(v.c6); params->buffer = &v.c6; diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index f7788d1d50..baf0682fbb 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -215,7 +215,13 @@ class TDTestCase: for t in range (2): tdSql.query(f'select * from information_schema.ins_columns where db_name="db2" and table_type=="NORMAL_TABLE"') tdSql.checkEqual(20470,len(tdSql.queryResult)) - + + tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") + tdSql.checkEqual(193, len(tdSql.queryResult)) + + tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") + tdSql.checkEqual(54, len(tdSql.queryResult)) + def ins_dnodes_check(self): tdSql.execute('drop database if exists db2') tdSql.execute('create database if not exists db2 vgroups 1 replica 1') diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index d9cc4895b1..4ef323db22 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -210,66 +210,6 @@ class TDTestCase: licences_info = tdSql.queryResult tdSql.checkEqual(grants_info,licences_info) - def show_create_table_with_col_comment(self): - tdSql.execute("create database comment_test_db") - tdSql.execute("use comment_test_db") - tdSql.execute("create table normal_table(ts timestamp, c2 int comment 'c2 comment')") - tdSql.execute("create stable super_table(ts timestamp comment 'ts', c2 int comment 'c2 comment') tags(tg int comment 'tg comment')") - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int)" - tdSql.query('show create table normal_table') - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - tdSql.query('show create table super_table') - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int) tags (`tg` int)" - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - tdSql.query("desc normal_table") - tdSql.checkCols(5) - tdSql.checkData(0, 4, "") - - tdSql.query("desc super_table") - tdSql.checkCols(5) - tdSql.checkData(0, 4, "") - - tdSql.execute("drop database comment_test_db") - - def alter_table_with_col_comment(self): - tdSql.execute("create database comment_test_db") - tdSql.execute("use comment_test_db") - tdSql.execute("create table normal_table(ts timestamp, c2 int comment 'c2 comment')") - tdSql.execute("create stable super_table(ts timestamp comment 'ts', c2 int comment 'c2 comment') tags(tg int comment 'tg comment')") - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int, `c3` int)" - tdSql.execute("alter table normal_table add column c3 int comment 'c3 comment'", queryTimes=1) - tdSql.query("show create table normal_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(255))" - tdSql.execute("alter table normal_table add column c4 varchar(255) comment 'c4 comment'", queryTimes=1) - tdSql.query("show create table normal_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create table `normal_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(255), `c5` varchar(255))" - tdSql.execute("alter table normal_table add column c5 varchar(255)", queryTimes=1) - tdSql.query("show create table normal_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int, `c3` int) tags (`tg` int) sma(`ts`,`c2`)" - tdSql.execute("alter table super_table add column c3 int comment 'c3 comment'", queryTimes=1) - tdSql.query("show create table super_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(255)) tags (`tg` int) sma(`ts`,`c2`)" - tdSql.execute("alter table super_table add column c4 varchar(255) comment 'c4 comment'", queryTimes=1) - tdSql.query("show create table super_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - - create_sql = "create stable `super_table` (`ts` timestamp, `c2` int, `c3` int, `c4` varchar(256)) tags (`tg` int) sma(`ts`,`c2`)" - tdSql.execute("alter table super_table modify column c4 varchar(256) comment 'c4 256 comment'", queryTimes=1) - tdSql.query("show create table super_table") - tdSql.checkEqual(tdSql.queryResult[0][1].lower(), create_sql) - tdSql.execute("drop database comment_test_db") - def run(self): self.check_gitinfo() self.show_base() @@ -278,8 +218,6 @@ class TDTestCase: self.show_create_sql() self.show_create_sysdb_sql() self.show_create_systb_sql() - self.show_create_table_with_col_comment() - self.alter_table_with_col_comment() def stop(self): tdSql.close() diff --git a/tests/system-test/0-others/walRetention.py b/tests/system-test/0-others/walRetention.py index 5257b7644a..0fdeb84a5b 100644 --- a/tests/system-test/0-others/walRetention.py +++ b/tests/system-test/0-others/walRetention.py @@ -147,13 +147,13 @@ class VNode : if self.lastVer != -1 and ret: # first wal file ignore if walFile.startVer == self.firstVer: - tdLog.info(f" {walFile.pathFile} can del, but is first. snapVer={self.snapVer} firstVer={self.firstVer}") + tdLog.info(f" can del {walFile.pathFile}, but is first. snapVer={self.snapVer} firstVer={self.firstVer}") return False # ver in stay range smallVer = self.snapVer - self.walStayRange -1 if walFile.startVer >= smallVer: - tdLog.info(f" {walFile.pathFile} can del, but range not arrived. snapVer={self.snapVer} smallVer={smallVer}") + tdLog.info(f" can del {walFile.pathFile}, but range not arrived. snapVer={self.snapVer} smallVer={smallVer}") return False return ret @@ -161,9 +161,20 @@ class VNode : # get log size def getWalsSize(self): size = 0 + lastSize = 0 + max = -1 for walFile in self.walFiles: - size += walFile.fsize + if self.canDelete(walFile) == False: + tdLog.info(f" calc vnode size {walFile.pathFile} size={walFile.fsize} startVer={walFile.startVer}") + size += walFile.fsize + if max < walFile.startVer: + max = walFile.startVer + lastSize = walFile.fsize + + if lastSize > 0: + tdLog.info(f" last file size need reduct . lastSize={lastSize}") + size -= lastSize return size # vnode @@ -183,7 +194,7 @@ class VNode : delTs = delTsLine.timestamp() for walFile in self.walFiles: mt = datetime.fromtimestamp(walFile.mtime) - info = f" {walFile.pathFile} mt={mt} line={delTsLine} start={walFile.startVer} snap={self.snapVer} end= {walFile.endVer}" + info = f" {walFile.pathFile} size={walFile.fsize} mt={mt} line={delTsLine} start={walFile.startVer} snap={self.snapVer} end= {walFile.endVer}" tdLog.info(info) if walFile.mtime < delTs and self.canDelete(walFile): # wait a moment then check file exist @@ -199,25 +210,16 @@ class VNode : if self.walSize == 0: return True + time.sleep(2) vnodeSize = self.getWalsSize() - if vnodeSize < self.walSize: - tdLog.info(f" wal size valid. {self.path} real = {vnodeSize} set = {self.walSize} ") + # need over 20% + if vnodeSize < self.walSize * 1.2: + tdLog.info(f" wal size valid. {self.path} real = {vnodeSize} set = {self.walSize}. allow over 20%.") return True - # check valid - tdLog.info(f" wal size over set. {self.path} real = {vnodeSize} set = {self.walSize} ") - for walFile in self.walFiles: - if self.canDelete(walFile): - # wait a moment then check file exist - time.sleep(1) - if os.path.exists(walFile.pathFile): - tdLog.exit(f" wal file size over .\ - \n wal file = {walFile.pathFile}\ - \n snapVer = {self.snapVer}\ - \n real = {vnodeSize} bytes\ - \n set = {self.walSize} bytes") - return False - return True + # check over + tdLog.exit(f" wal size over set. {self.path} real = {vnodeSize} set = {self.walSize} ") + return False # insert by async diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py new file mode 100644 index 0000000000..393102c8ed --- /dev/null +++ b/tests/system-test/2-query/fill_with_group.py @@ -0,0 +1,153 @@ +import taos +import sys +import time +import socket +import os +import threading +import math + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +# from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.vgroups = 4 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + self.duraion = '1h' + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def create_database(self,tsql, dbName,dropFlag=1,vgroups=2,replica=1, duration:str='1d'): + if dropFlag == 1: + tsql.execute("drop database if exists %s"%(dbName)) + + tsql.execute("create database if not exists %s vgroups %d replica %d duration %s"%(dbName, vgroups, replica, duration)) + tdLog.debug("complete to create database %s"%(dbName)) + return + + def create_stable(self,tsql, paraDict): + colString = tdCom.gen_column_type_str(colname_prefix=paraDict["colPrefix"], column_elm_list=paraDict["colSchema"]) + tagString = tdCom.gen_tag_type_str(tagname_prefix=paraDict["tagPrefix"], tag_elm_list=paraDict["tagSchema"]) + sqlString = f"create table if not exists %s.%s (%s) tags (%s)"%(paraDict["dbName"], paraDict["stbName"], colString, tagString) + tdLog.debug("%s"%(sqlString)) + tsql.execute(sqlString) + return + + def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1,ctbStartIdx=0): + for i in range(ctbNum): + sqlString = "create table %s.%s%d using %s.%s tags(%d, 'tb%d', 'tb%d', %d, %d, %d)" % \ + (dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,(i+ctbStartIdx) % 5,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx) + tsql.execute(sqlString) + + tdLog.debug("complete to create %d child tables by %s.%s" %(ctbNum, dbName, stbName)) + return + + def insert_data(self,tsql,dbName,ctbPrefix,ctbNum,rowsPerTbl,batchNum,startTs,tsStep): + tdLog.debug("start to insert data ............") + tsql.execute("use %s" %dbName) + pre_insert = "insert into " + sql = pre_insert + + for i in range(ctbNum): + rowsBatched = 0 + sql += " %s%d values "%(ctbPrefix,i) + for j in range(rowsPerTbl): + if (i < ctbNum/2): + sql += "(%d, %d, %d, %d,%d,%d,%d,true,'binary%d', 'nchar%d') "%(startTs + j*tsStep, j%10, j%10, j%10, j%10, j%10, j%10, j%10, j%10) + else: + sql += "(%d, %d, NULL, %d,NULL,%d,%d,true,'binary%d', 'nchar%d') "%(startTs + j*tsStep, j%10, j%10, j%10, j%10, j%10, j%10) + rowsBatched += 1 + if ((rowsBatched == batchNum) or (j == rowsPerTbl - 1)): + tsql.execute(sql) + rowsBatched = 0 + if j < rowsPerTbl - 1: + sql = "insert into %s%d values " %(ctbPrefix,i) + else: + sql = "insert into " + if sql != pre_insert: + tsql.execute(sql) + tdLog.debug("insert data ............ [OK]") + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'test', + 'dropFlag': 1, + 'vgroups': 2, + 'stbName': 'meters', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'FLOAT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'smallint', 'count':1},{'type': 'tinyint', 'count':1},{'type': 'bool', 'count':1},{'type': 'binary', 'len':10, 'count':1},{'type': 'nchar', 'len':10, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'nchar', 'len':20, 'count':1},{'type': 'binary', 'len':20, 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'smallint', 'count':1},{'type': 'DOUBLE', 'count':1}], + 'ctbPrefix': 't', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 10000, + 'batchNum': 3000, + 'startTs': 1537146000000, + 'tsStep': 600000} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create database") + self.create_database(tsql=tdSql, dbName=paraDict["dbName"], dropFlag=paraDict["dropFlag"], vgroups=paraDict["vgroups"], replica=self.replicaVar, duration=self.duraion) + + tdLog.info("create stb") + self.create_stable(tsql=tdSql, paraDict=paraDict) + + tdLog.info("create child tables") + self.create_ctable(tsql=tdSql, dbName=paraDict["dbName"], \ + stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"],\ + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict["ctbStartIdx"]) + self.insert_data(tsql=tdSql, dbName=paraDict["dbName"],\ + ctbPrefix=paraDict["ctbPrefix"],ctbNum=paraDict["ctbNum"],\ + rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],\ + startTs=paraDict["startTs"],tsStep=paraDict["tsStep"]) + return + + def test_partition_by_with_interval_fill_prev_new_group_fill_error(self): + ## every table has 1500 rows after fill, 10 tables, total 15000 rows. + ## there is no data from 9-17 08:00:00 ~ 9-17 09:00:00, so first 60 rows of every group will be NULL, cause no prev value. + sql = "select _wstart, count(*),tbname from meters where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-18 09:00:00.000' partition by tbname interval(1m) fill(PREV) order by tbname, _wstart" + tdSql.query(sql) + for i in range(0,10): + for j in range(0,60): + tdSql.checkData(i*1500+j, 1, None) + + sql = "select _wstart, count(*),tbname from meters where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-18 09:00:00.000' partition by tbname interval(1m) fill(LINEAR) order by tbname, _wstart" + tdSql.query(sql) + for i in range(0,10): + for j in range(0,60): + tdSql.checkData(i*1500+j, 1, None) + + def test_fill_with_order_by(self): + sql = "select _wstart, _wend, count(ts), sum(c1) from meters where ts > '2018-11-25 00:00:00.000' and ts < '2018-11-26 00:00:00.00' interval(1d) fill(NULL) order by _wstart" + tdSql.query(sql) + tdSql.checkRows(1) + sql = "select _wstart, _wend, count(ts), sum(c1) from meters where ts > '2018-11-25 00:00:00.000' and ts < '2018-11-26 00:00:00.00' interval(1d) fill(NULL) order by _wstart desc" + tdSql.query(sql) + tdSql.checkRows(1) + + def run(self): + self.prepareTestEnv() + self.test_partition_by_with_interval_fill_prev_new_group_fill_error() + self.test_fill_with_order_by() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/sml.py b/tests/system-test/2-query/sml.py index cae012ece1..53ac85bd8e 100644 --- a/tests/system-test/2-query/sml.py +++ b/tests/system-test/2-query/sml.py @@ -1,18 +1,12 @@ -import taos import sys -import time -import socket import os -import threading from util.log import * from util.sql import * from util.cases import * from util.dnodes import * from util.common import * -sys.path.append("./7-tmq") -from tmqCommon import * class TDTestCase: updatecfgDict = {'clientCfg': {'smlChildTableName': 'dataModelName', 'fqdn': 'localhost', 'smlDot2Underline': 0}, 'fqdn': 'localhost'} @@ -32,7 +26,7 @@ class TDTestCase: tdLog.info(cmdStr) ret = os.system(cmdStr) if ret != 0: - tdLog.info("sml_test ret != 0") + tdLog.exit("sml_test ret != 0") tdSql.query(f"select * from ts3303.stb2") tdSql.query(f"select * from ts3303.meters") diff --git a/tests/system-test/2-query/sml_TS-3724.py b/tests/system-test/2-query/sml_TS-3724.py index a8b16c4662..410e266f10 100644 --- a/tests/system-test/2-query/sml_TS-3724.py +++ b/tests/system-test/2-query/sml_TS-3724.py @@ -67,7 +67,7 @@ class TDTestCase: tdSql.query(f"select distinct tbname from {dbname}.`sys_if_bytes_out`") tdSql.checkRows(2) - tdSql.query(f"select * from {dbname}.t_fc70dec6677d4277c5d9799c4da806da order by times") + tdSql.query(f"select * from {dbname}.t_f67972b49aa8adf8bca5d0d54f0d850d order by times") tdSql.checkRows(2) tdSql.checkData(0, 1, 1.300000000) tdSql.checkData(1, 1, 13.000000000) diff --git a/tests/system-test/2-query/stbJoin.py b/tests/system-test/2-query/stbJoin.py index b4d6301424..e21a875cf2 100644 --- a/tests/system-test/2-query/stbJoin.py +++ b/tests/system-test/2-query/stbJoin.py @@ -106,6 +106,9 @@ class TDTestCase: tdSql.query(f"select a.ts, b.ts from sta a, stb b where a.ts=b.ts and (a.tg1=b.tg1 and a.tg1 > b.tg1);") tdSql.checkRows(0) + tdSql.query(f"select a.* from sta a join stb b on a.tg1=b.tg1 and a.ts=b.ts and a.tg2=b.tg2;") + tdSql.checkRows(12) + # tdSql.checkData(0,1,10) tdSql.error(f"select a.* from sta a join stb b on a.tg1=b.tg1 where a.ts=b.ts or a.tg2=b.tg2;") diff --git a/tests/system-test/2-query/union.py b/tests/system-test/2-query/union.py index 82dcfe12e6..9086d7754d 100644 --- a/tests/system-test/2-query/union.py +++ b/tests/system-test/2-query/union.py @@ -191,7 +191,7 @@ class TDTestCase: if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): return "BIGINT UNSIGNED" - def union_check(self): + def union_check(self, dbname = "db"): sqls = self.sql_list() for i in range(len(sqls)): tdSql.query(sqls[i]) @@ -232,6 +232,32 @@ class TDTestCase: else: tdSql.error(f"{sqls[i]} union {sqls[j+i]}") + # check union with timeline function + tdSql.query(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9) + tdSql.query(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts desc)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 2147450880) + tdSql.query(f"select irate(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.102222222222222) + tdSql.query(f"select elapsed(ts) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 46800000.000000000000000) + tdSql.query(f"select diff(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") + tdSql.checkRows(14) + tdSql.query(f"select derivative(c1, 1s, 0) from (select * from {dbname}.t1 union select * from {dbname}.t1 order by ts)") + tdSql.checkRows(11) + + tdSql.error(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select irate(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select elapsed(ts) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select diff(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + tdSql.error(f"select derivative(c1, 1s, 0) from (select * from {dbname}.t1 union select * from {dbname}.t1)") + + def __test_error(self, dbname="db"): tdSql.error( f"show {dbname}.tables union show {dbname}.tables" ) diff --git a/tests/system-test/2-query/varbinary.py b/tests/system-test/2-query/varbinary.py new file mode 100644 index 0000000000..8f7032cdc3 --- /dev/null +++ b/tests/system-test/2-query/varbinary.py @@ -0,0 +1,80 @@ +import sys +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.common import * + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def test(self): + tdLog.info(" test") + + buildPath = tdCom.getBuildPath() + cmdStr = '%s/build/bin/varbinary_test'%(buildPath) + print("cmdStr:", cmdStr) + tdLog.info(cmdStr) + ret = os.system(cmdStr) + if ret != 0: + tdLog.exit("varbinary_test ret != 0") + + tdSql.execute(f" create database test") + tdSql.execute(f" use test ") + tdSql.execute(f" create stable stb (ts timestamp, c1 nchar(32), c2 varbinary(16), c3 float) tags (t1 int, t2 binary(8), t3 varbinary(8))") + + tdSql.query(f"desc stb") + tdSql.checkRows(7) + tdSql.checkData(2, 1, 'VARBINARY') + tdSql.checkData(2, 2, 16) + tdSql.checkData(6, 1, 'VARBINARY') + tdSql.checkData(6, 2, 8) + + # tdSql.execute(f" insert into tb1 using stb tags (1, 'tb1_bin1', 'vart1') values (now, 'nchar1', 'varc1', 0.3)") + # tdSql.execute(f" insert into tb1 values (now + 1s, 'nchar2', null, 0.4)") + # + # tdSql.execute(f" insert into tb2 using stb tags (2, 'tb2_bin1', 093) values (now + 2s, 'nchar1', 892, 0.3)") + # tdSql.execute(f" insert into tb3 using stb tags (3, 'tb3_bin1', 0x7f829) values (now + 3s, 'nchar1', 0x7f829, 0.3)") + # tdSql.execute(f" insert into tb4 using stb tags (4, 'tb4_bin1', 0b100000010) values (now + 4s, 'nchar1', 0b110000001, 0.3)") + # tdSql.execute(f" insert into tb4 values (now + 5s, 'nchar1', 0b11000000100000000, 0.3)") + # tdSql.execute(f" insert into tb5 using stb tags (4, 'tb5_bin1', NULL) values (now + 6s, 'nchar1', 0b10100000011000000110000001, 0.3)") + + # basic query + # tdSql.query(f"select c2,t3 from stb order by ts") + # tdSql.checkRows(6) + # tdSql.checkData(0, 0, '0x7661726331') + # tdSql.checkData(0, 1, '0x7661727431') + # tdSql.checkData(1, 0, None) + # tdSql.checkData(1, 1, '0x7661727431') + # tdSql.checkData(2, 0, '0x383932') + # tdSql.checkData(2, 1, '0x303933') + # tdSql.checkData(3, 0, '0x07f829') + # tdSql.checkData(3, 1, '0x07f829') + # tdSql.checkData(4, 0, '0x0181') + # tdSql.checkData(4, 1, '0x0102') + # tdSql.checkData(5, 0, '0x02818181') + # tdSql.checkData(5, 1, None) + + # tdSql.query(f"select ts,c2 from stb order by c2") + # + # tdSql.query(f"select c2,t3 from stb where c2 >= 0 order by ts") + # + # tdSql.query(f"select c2,t3 from stb where c2 >= 0x0181 order by ts") + + + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring + tdSql.prepare() + self.test() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/subscribeDb0.py b/tests/system-test/7-tmq/subscribeDb0.py index ed13fcbe06..d4dfe425dc 100644 --- a/tests/system-test/7-tmq/subscribeDb0.py +++ b/tests/system-test/7-tmq/subscribeDb0.py @@ -237,7 +237,7 @@ class TDTestCase: for i in range(expectRows): totalConsumeRows += resultList[i] - if totalConsumeRows != expectrowcnt: + if totalConsumeRows < expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index e084f97fb5..35ab86269d 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -323,13 +323,12 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i return; } - char quotationStr[2]; - quotationStr[0] = '\"'; - quotationStr[1] = 0; + char quotationStr[2] ={'"', 0}; int32_t width; - int n; - char buf[TSDB_MAX_BYTES_PER_ROW]; + int n = 0; +#define LENGTH 64 + char buf[LENGTH] = {0}; switch (field->type) { case TSDB_DATA_TYPE_BOOL: taosFprintfFile(pFile, "%d", ((((int32_t)(*((char *)val))) == 1) ? 1 : 0)); @@ -363,7 +362,7 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i if (tsEnableScience) { taosFprintfFile(pFile, "%*.7e", width, GET_FLOAT_VAL(val)); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.7f", width, GET_FLOAT_VAL(val)); + n = snprintf(buf, LENGTH, "%*.7f", width, GET_FLOAT_VAL(val)); if (n > SHELL_FLOAT_WIDTH) { taosFprintfFile(pFile, "%*.7e", width, GET_FLOAT_VAL(val)); } else { @@ -374,10 +373,10 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i case TSDB_DATA_TYPE_DOUBLE: width = SHELL_DOUBLE_WIDTH; if (tsEnableScience) { - snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15e", width, GET_DOUBLE_VAL(val)); + snprintf(buf, LENGTH, "%*.15e", width, GET_DOUBLE_VAL(val)); taosFprintfFile(pFile, "%s", buf); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15f", width, GET_DOUBLE_VAL(val)); + n = snprintf(buf, LENGTH, "%*.15f", width, GET_DOUBLE_VAL(val)); if (n > SHELL_DOUBLE_WIDTH) { taosFprintfFile(pFile, "%*.15e", width, GET_DOUBLE_VAL(val)); } else { @@ -389,22 +388,39 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: { int32_t bufIndex = 0; + char* tmp = (char*)taosMemoryCalloc(length * 2 + 1, 1); + if(tmp == NULL) break; for (int32_t i = 0; i < length; i++) { - buf[bufIndex] = val[i]; + tmp[bufIndex] = val[i]; bufIndex++; if (val[i] == '\"') { - buf[bufIndex] = val[i]; + tmp[bufIndex] = val[i]; bufIndex++; } } - buf[bufIndex] = 0; + tmp[bufIndex] = 0; - taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr); + taosFprintfFile(pFile, "%s%s%s", quotationStr, tmp, quotationStr); + taosMemoryFree(tmp); } break; - case TSDB_DATA_TYPE_GEOMETRY: - shellDumpHexValue(buf, val, length); - taosFprintfFile(pFile, "%s", buf); + case TSDB_DATA_TYPE_VARBINARY:{ + void* tmp = NULL; + uint32_t size = 0; + if(taosAscii2Hex(val, length, &tmp, &size) < 0){ + break; + } + taosFprintfFile(pFile, "%s", tmp); + taosMemoryFree(tmp); break; + } + case TSDB_DATA_TYPE_GEOMETRY:{ + char* tmp = (char*)taosMemoryCalloc(length * 2 + 1, 1); + if(tmp == NULL) break; + shellDumpHexValue(tmp, val, length); + taosFprintfFile(pFile, "%s", buf); + taosMemoryFree(tmp); + break; + } case TSDB_DATA_TYPE_TIMESTAMP: shellFormatTimestamp(buf, *(int64_t *)val, precision); taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr); @@ -576,8 +592,9 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t return; } - int n; - char buf[TSDB_MAX_BYTES_PER_ROW]; + int n = 0; +#define LENGTH 64 + char buf[LENGTH] = {0}; switch (field->type) { case TSDB_DATA_TYPE_BOOL: shellPrintString(((((int32_t)(*((char *)val))) == 1) ? "true" : "false"), width); @@ -610,7 +627,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t if (tsEnableScience) { printf("%*.7e", width, GET_FLOAT_VAL(val)); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.7f", width, GET_FLOAT_VAL(val)); + n = snprintf(buf, LENGTH, "%*.7f", width, GET_FLOAT_VAL(val)); if (n > SHELL_FLOAT_WIDTH) { printf("%*.7e", width, GET_FLOAT_VAL(val)); } else { @@ -620,10 +637,10 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t break; case TSDB_DATA_TYPE_DOUBLE: if (tsEnableScience) { - snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15e", width, GET_DOUBLE_VAL(val)); + snprintf(buf, LENGTH, "%*.15e", width,GET_DOUBLE_VAL(val)); printf("%s", buf); } else { - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15f", width, GET_DOUBLE_VAL(val)); + n = snprintf(buf, LENGTH, "%*.15f", width, GET_DOUBLE_VAL(val)); if (n > SHELL_DOUBLE_WIDTH) { printf("%*.15e", width, GET_DOUBLE_VAL(val)); } else { @@ -631,6 +648,16 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t } } break; + case TSDB_DATA_TYPE_VARBINARY:{ + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(val, length, &data, &size) < 0){ + break; + } + shellPrintNChar(data, size, width); + taosMemoryFree(data); + break; + } case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: @@ -773,7 +800,14 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) { } else { return TMAX(field->bytes + 2, width); } - + case TSDB_DATA_TYPE_VARBINARY:{ + int32_t bytes = field->bytes * 2 + 2; + if (bytes > shell.args.displayWidth) { + return TMAX(shell.args.displayWidth, width); + } else { + return TMAX(bytes + 2, width); + } + } case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: { uint16_t bytes = field->bytes * TSDB_NCHAR_SIZE; diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index af7f13c69c..ff2e5efdd4 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -278,7 +278,7 @@ void shellRunSingleCommandWebsocketImp(char *command) { } if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { - fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); + fprintf(stderr, "Hint: use -T to increase the timeout in seconds\n"); } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) { shell.ws_conn = NULL; @@ -373,8 +373,6 @@ void shellRunSingleCommandWebsocketImp(char *command) { } else { printf("Query interrupted, %d row(s) in set (%.6fs)\n", numOfRows, (et - st)/1E6); - printf("Execute: %.2f ms Network: %.2f ms Total: %.2f ms\n", - execute_time, net_time, total_time); } } printf("\n"); diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt index b96814c13b..43e97a3467 100644 --- a/utils/test/c/CMakeLists.txt +++ b/utils/test/c/CMakeLists.txt @@ -8,6 +8,7 @@ add_executable(sml_test sml_test.c) add_executable(get_db_name_test get_db_name_test.c) add_executable(tmq_offset tmqOffset.c) add_executable(tmq_offset_test tmq_offset_test.c) +add_executable(varbinary_test varbinary_test.c) target_link_libraries( tmq_offset PUBLIC taos @@ -65,6 +66,8 @@ target_link_libraries( PUBLIC util PUBLIC common PUBLIC os + PUBLIC geometry + ) target_link_libraries( @@ -74,3 +77,11 @@ target_link_libraries( PUBLIC common PUBLIC os ) + +target_link_libraries( + varbinary_test + PUBLIC taos + PUBLIC util + PUBLIC common + PUBLIC os +) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 237bfc5092..9153706d23 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -21,6 +21,7 @@ #include "taos.h" #include "tlog.h" #include "types.h" +#include "geosWrapper.h" int smlProcess_influx_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1533,6 +1534,7 @@ int sml_ts3724_Test() { const char *sql[] = { "stb.2,t1=1 f1=283i32 1632299372000", + "stb_2,t1=1 f1=283i32 1632299372000", ".stb2,t1=1 f1=106i32 1632299378000", "stb2.,t1=1 f1=106i32 1632299378000", }; @@ -1547,6 +1549,12 @@ int sml_ts3724_Test() { printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); taos_free_result(pRes); + pRes = taos_query(taos, "select * from stb_2"); + TAOS_ROW row = taos_fetch_row(pRes); + int numRows = taos_affected_rows(pRes); + ASSERT(numRows == 1); + taos_free_result(pRes); + taos_close(taos); return code; @@ -1578,6 +1586,83 @@ int sml_td24559_Test() { printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); taos_free_result(pRes); + TAOS_ROW row = NULL; + pRes = taos_query(taos, "select * from stb order by _ts;"); + int rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { + + int32_t* length = taos_fetch_lengths(pRes); + + code = initCtxAsText(); + ASSERT (code == TSDB_CODE_SUCCESS); + char *outputWKT = NULL; + code = doAsText(row[2], length[2], &outputWKT); + ASSERT (code == TSDB_CODE_SUCCESS); + + if (rowIndex == 0) { + ASSERT(strcmp("POINT (4.343000 89.342000)", outputWKT) == 0); + } + if (rowIndex == 3) { + ASSERT(strcmp( "GEOMETRYCOLLECTION (MULTIPOINT ((0.000000 0.000000), (1.000000 1.000000)), POINT (3.000000 4.000000), LINESTRING (2.000000 3.000000, 3.000000 4.000000))", outputWKT) == 0); + } + geosFreeBuffer(outputWKT); + + rowIndex++; + } + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + +int sml_td18789_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists td18789"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists td18789"); + taos_free_result(pRes); + + const char *sql[] = { + "vbin,t1=1 f1=283i32,f2=b\"hello\" 1632299372000", + "vbin,t1=1 f2=B\"\\x98f46e\",f1=106i32 1632299373000", + }; + + pRes = taos_query(taos, "use td18789"); + 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); + + int code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + taos_free_result(pRes); + + TAOS_ROW row = NULL; + pRes = taos_query(taos, "select *,tbname from vbin order by _ts"); + int rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { + int32_t* length = taos_fetch_lengths(pRes); + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(row[2], length[2], &data, &size) < 0){ + ASSERT(0); + } + + if (rowIndex == 0) { + ASSERT(memcmp(data, "\\x68656C6C6F", size) == 0); + } + if (rowIndex == 1) { + ASSERT(memcmp(data, "\\x98F46E", size) == 0); + } + taosMemoryFree(data); + + rowIndex++; + } + taos_free_result(pRes); + taos_close(taos); return code; @@ -1591,6 +1676,8 @@ int main(int argc, char *argv[]) { int ret = 0; ret = sml_td24559_Test(); ASSERT(!ret); + ret = sml_td18789_Test(); + ASSERT(!ret); ret = sml_td24070_Test(); ASSERT(!ret); ret = sml_td23881_Test(); diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c index dd6875185f..fbfacd9eda 100644 --- a/utils/test/c/tmqSim.c +++ b/utils/test/c/tmqSim.c @@ -541,6 +541,7 @@ static void shellDumpFieldToFile(TdFilePtr pFile, const char* val, TAOS_FIELD* f } break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_GEOMETRY: { diff --git a/utils/test/c/varbinary_test.c b/utils/test/c/varbinary_test.c new file mode 100644 index 0000000000..b2fccee63b --- /dev/null +++ b/utils/test/c/varbinary_test.c @@ -0,0 +1,253 @@ +/* + * 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 +#include +#include +#include +#include "taos.h" +#include "types.h" +#include "tlog.h" + +#define GET_ROW_NUM \ + numRows = 0;\ + while(1){\ + row = taos_fetch_row(pRes);\ + if (row != NULL){\ + numRows++;\ + }else{\ + break;\ + }\ + } +int varbinary_test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists varbinary_db"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists varbinary_db"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use varbinary_db"); + int code = taos_errno(pRes); + taos_free_result(pRes); + ASSERT(code == 0); + + pRes = taos_query(taos, "create stable stb (ts timestamp, c1 nchar(32), c2 varbinary(16), c3 float) tags (t1 int, t2 binary(8), t3 varbinary(8))"); + taos_free_result(pRes); + + pRes = taos_query(taos, "desc stb"); + + TAOS_ROW row = NULL; + int32_t rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { + char* type = row[1]; + int32_t length = *(int32_t *)row[2]; + + if (rowIndex == 2) { + ASSERT(strncmp(type, "VARBINARY", sizeof("VARBINARY") - 1) == 0); + ASSERT(length == 16); + } + + if (rowIndex == 6) { + ASSERT(strncmp(type, "VARBINARY", sizeof("VARBINARY") - 1) == 0); + ASSERT(length == 8); + } + rowIndex++; + } + + pRes = taos_query(taos, "insert into tb1 using stb tags (1, 'tb1_bin1', 'vart1') values (now, 'nchar1', 'varc1', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb1 values (now + 1s, 'nchar2', null, 0.4);"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', '\\x7f8290') values (now + 2s, 'nchar1', '\\x7f8290', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb3 values (now + 3s, 'nchar1', '\\x7f829000', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb2 using stb tags (2, 'tb2_bin1', '\\x') values (now + 4s, 'nchar1', '\\x', 0.3)"); + taos_free_result(pRes); + pRes = taos_query(taos, "insert into tb2 values (now + 5s, 'nchar1', '\\x00000000', 0.3)"); + taos_free_result(pRes); + + // test insert + pRes = taos_query(taos, "insert into tb2 using stb tags (2, 'tb2_bin1', 093) values (now + 2s, 'nchar1', 892, 0.3)"); + ASSERT(taos_errno(pRes) != 0); + + pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', 0x7f829) values (now + 3s, 'nchar1', 0x7f829, 0.3)"); + ASSERT(taos_errno(pRes) != 0); + + pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', '\\x7f829') values (now + 3s, 'nchar1', '\\x7f829', 0.3)"); + ASSERT(taos_errno(pRes) != 0); + + pRes = taos_query(taos, "insert into tb4 using stb tags (4, 'tb4_bin1', 0b100000010) values (now + 4s, 'nchar1', 0b110000001, 0.3)"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + + // test error + pRes = taos_query(taos, "select * from tb1 where c2 >= 0x8de6"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from tb1 where c2 >= 0"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 > '\\x7F82900'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select c2+2 from stb"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select c2|2 from stb"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 not like 's%'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 like 's%'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 match 'ssd'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 nmatch 'ssd'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2->'ssd' = 1"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 contains 'ssd'"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where sum(c2) = 2"); + ASSERT(taos_errno(pRes) != 0); + taos_free_result(pRes); + +// pRes = taos_query(taos, "select * from stb where c2 contains 'ssd'"); +// ASSERT(taos_errno(pRes) != 0); +// taos_free_result(pRes); +// +// pRes = taos_query(taos, "select * from stb where c2 contains 'ssd'"); +// ASSERT(taos_errno(pRes) != 0); +// taos_free_result(pRes); + + int numRows = 0; + + pRes = taos_query(taos, "select * from stb where c2 > 'varc1'"); + GET_ROW_NUM + ASSERT(numRows == 2); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 > '\\x7F8290'"); + GET_ROW_NUM + ASSERT(numRows == 1); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 in ('\\x7F829000','\\x00000000')"); + GET_ROW_NUM + ASSERT(numRows == 2); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 not in ('\\x00000000')"); + GET_ROW_NUM + ASSERT(numRows == 4); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 is null"); + GET_ROW_NUM + ASSERT(numRows == 1); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 is not null"); + GET_ROW_NUM + ASSERT(numRows == 5); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from stb where c2 between '\\x3e' and '\\x7F8290'"); + GET_ROW_NUM + ASSERT(numRows == 2); + taos_free_result(pRes); + + + pRes = taos_query(taos, "select * from stb where c2 not between '\\x3e' and '\\x7F8290'"); + GET_ROW_NUM + ASSERT(numRows == 3); + taos_free_result(pRes); + + pRes = taos_query(taos, "select ts,c2 from stb order by c2"); + rowIndex = 0; + while ((row = taos_fetch_row(pRes)) != NULL) { +// int64_t ts = *(int64_t *)row[0]; + if (rowIndex == 0) { + ASSERT(row[1] == NULL); + rowIndex++; + continue; + } + int32_t* length = taos_fetch_lengths(pRes); + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(row[1], length[1], &data, &size) < 0){ + ASSERT(0); + } + + if (rowIndex == 1) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x", size) == 0); + } + if (rowIndex == 2) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x00000000", size) == 0); + } + if (rowIndex == 3) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x7661726331", size) == 0); + } + if (rowIndex == 4) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x7F8290", size) == 0); + } + if (rowIndex == 5) { +// ASSERT(ts == 1661943960000); + ASSERT(memcmp(data, "\\x7F829000", size) == 0); + } + taosMemoryFree(data); + + rowIndex++; + } + printf("%s result1:%s\n", __FUNCTION__, taos_errstr(pRes)); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + +int main(int argc, char *argv[]) { + int ret = 0; + ret = varbinary_test(); + ASSERT(!ret); + return ret; +}