diff --git a/docs/en/08-develop/01-connect/index.md b/docs/en/08-develop/01-connect/index.md
index 916d5e1e09..ab35f6ad63 100644
--- a/docs/en/08-develop/01-connect/index.md
+++ b/docs/en/08-develop/01-connect/index.md
@@ -90,7 +90,7 @@ If `maven` is used to manage the projects, what needs to be done is only adding
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
```
diff --git a/docs/en/14-reference/03-taos-sql/10-function.md b/docs/en/14-reference/03-taos-sql/10-function.md
index 72ca878ce8..2ba3c416fd 100644
--- a/docs/en/14-reference/03-taos-sql/10-function.md
+++ b/docs/en/14-reference/03-taos-sql/10-function.md
@@ -1384,7 +1384,7 @@ SELECT SERVER_VERSION();
SELECT SERVER_STATUS();
```
-**Description**: The server status.
+**Description**: The server status. When checking the status of a cluster, the recommended way is to use `SHOW CLUSTER ALIVE;`. Unlike `SELECT SERVER_STATUS();`, it does not return an error when some nodes in the cluster are unavailable; instead, it returns different status codes. Plese check [SHOW CLUSTER ALIVE](https://docs.tdengine.com/reference/taos-sql/show/#show-cluster-alive) for details.
### CURRENT_USER
diff --git a/docs/en/14-reference/05-connectors/14-java.mdx b/docs/en/14-reference/05-connectors/14-java.mdx
index aa7e91b7fa..1f4cf9895f 100644
--- a/docs/en/14-reference/05-connectors/14-java.mdx
+++ b/docs/en/14-reference/05-connectors/14-java.mdx
@@ -42,6 +42,7 @@ REST connection supports all platforms that can run Java.
| taos-jdbcdriver version | major changes | TDengine version |
| :---------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------: |
+| 3.3.2 | 1. Optimized websocket prepareStatement performance; 2. Improved mybatis support| - |
| 3.3.0 | 1. Optimized data transmission performance under Websocket connection; 2. SSL validation skipping is supported but disabled by default| 3.3.2.0 or later |
| 3.2.11 | Fixed the result set closing bug when using a native connection.| - |
| 3.2.10 | 1. Automatic compression/decompression for data transmission, disabled by default; 2.Automatic reconnection for websocket with configurable parameter, disabled by default; 3. A new method for schemaless writing is added in the connection class; 4. Optimized performance for data fetching on native connection; 5. Fixing for some known issues; 6. The list of supported functions can be returned by the API for retrieving metadata| - |
@@ -179,7 +180,7 @@ Add following dependency in the `pom.xml` file of your Maven project:
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
```
diff --git a/docs/examples/JDBC/JDBCDemo/pom.xml b/docs/examples/JDBC/JDBCDemo/pom.xml
index 763be51aff..a9b981a026 100644
--- a/docs/examples/JDBC/JDBCDemo/pom.xml
+++ b/docs/examples/JDBC/JDBCDemo/pom.xml
@@ -19,7 +19,7 @@
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
org.locationtech.jts
diff --git a/docs/examples/JDBC/connectionPools/pom.xml b/docs/examples/JDBC/connectionPools/pom.xml
index 855d531f4c..a3705e6834 100644
--- a/docs/examples/JDBC/connectionPools/pom.xml
+++ b/docs/examples/JDBC/connectionPools/pom.xml
@@ -18,7 +18,7 @@
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
diff --git a/docs/examples/JDBC/consumer-demo/pom.xml b/docs/examples/JDBC/consumer-demo/pom.xml
index ad0f6cd6a1..0db41bc33f 100644
--- a/docs/examples/JDBC/consumer-demo/pom.xml
+++ b/docs/examples/JDBC/consumer-demo/pom.xml
@@ -17,7 +17,7 @@
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
com.google.guava
@@ -67,4 +67,4 @@
-
\ No newline at end of file
+
diff --git a/docs/examples/JDBC/taosdemo/pom.xml b/docs/examples/JDBC/taosdemo/pom.xml
index c73614948b..8e61cbecdf 100644
--- a/docs/examples/JDBC/taosdemo/pom.xml
+++ b/docs/examples/JDBC/taosdemo/pom.xml
@@ -67,7 +67,7 @@
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
diff --git a/docs/examples/java/pom.xml b/docs/examples/java/pom.xml
index 35fe5f280c..c44be4704d 100644
--- a/docs/examples/java/pom.xml
+++ b/docs/examples/java/pom.xml
@@ -22,7 +22,7 @@
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
diff --git a/docs/zh/08-develop/01-connect/index.md b/docs/zh/08-develop/01-connect/index.md
index d1aeb0ed8b..5cecd245e5 100644
--- a/docs/zh/08-develop/01-connect/index.md
+++ b/docs/zh/08-develop/01-connect/index.md
@@ -89,7 +89,7 @@ TDengine 提供了丰富的应用程序开发接口,为了便于用户快速
com.taosdata.jdbc
taos-jdbcdriver
- 3.3.0
+ 3.3.2
```
diff --git a/docs/zh/14-reference/03-taos-sql/03-table.md b/docs/zh/14-reference/03-taos-sql/03-table.md
index 80aad0718a..2f0ae7100a 100644
--- a/docs/zh/14-reference/03-taos-sql/03-table.md
+++ b/docs/zh/14-reference/03-taos-sql/03-table.md
@@ -41,15 +41,13 @@ table_option: {
**使用说明**
+1. 表(列)名命名规则参见[名称命名规则](./19-limit.md#名称命名规则)。
+1. 表名最大长度为 192。
1. 表的第一个字段必须是 TIMESTAMP,并且系统自动将其设为主键。
-2. 除时间戳主键列之外,还可以通过 PRIMARY KEY 关键字指定第二列为额外的主键列。被指定为主键列的第二列必须为整型或字符串类型(varchar)。
-3. 表名最大长度为 192。
-4. 表的每行长度不能超过 48KB(从 3.0.5.0 版本开始为 64KB);(注意:每个 BINARY/NCHAR/GEOMETRY 类型的列还会额外占用 2 个字节的存储位置)。
-5. 子表名只能由字母、数字和下划线组成,且不能以数字开头,不区分大小写。
-6. 使用数据类型 BINARY/NCHAR/GEOMETRY,需指定其最长的字节数,如 BINARY(20),表示 20 字节。
-7. 为了兼容支持更多形式的表名,TDengine 引入新的转义符 "\`",可以让表名与关键词不冲突,同时不受限于上述表名称合法性约束检查。但是同样具有长度限制要求。使用转义字符以后,不再对转义字符中的内容进行大小写统一,
- 例如:\`aBc\` 和 \`abc\` 是不同的表名,但是 abc 和 aBc 是相同的表名。
-8. 关于 `ENCODE` 和 `COMPRESS` 的使用,请参考[按列压缩](../compress)
+1. 除时间戳主键列之外,还可以通过 PRIMARY KEY 关键字指定第二列为额外的主键列。被指定为主键列的第二列必须为整型或字符串类型(varchar)。
+1. 表的每行长度不能超过 48KB(从 3.0.5.0 版本开始为 64KB);(注意:每个 BINARY/NCHAR/GEOMETRY 类型的列还会额外占用 2 个字节的存储位置)。
+1. 使用数据类型 BINARY/NCHAR/GEOMETRY,需指定其最长的字节数,如 BINARY(20),表示 20 字节。
+1. 关于 `ENCODE` 和 `COMPRESS` 的使用,请参考[按列压缩](../compress)
**参数说明**
diff --git a/docs/zh/14-reference/03-taos-sql/10-function.md b/docs/zh/14-reference/03-taos-sql/10-function.md
index ac9311184e..ee71abbdec 100644
--- a/docs/zh/14-reference/03-taos-sql/10-function.md
+++ b/docs/zh/14-reference/03-taos-sql/10-function.md
@@ -1374,7 +1374,7 @@ SELECT SERVER_VERSION();
SELECT SERVER_STATUS();
```
-**说明**:检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误。
+**说明**:检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误。如果想要查询集群的状态,推荐使用 `SHOW CLUSTER ALIVE;`, 与 `SELECT SERVER_STATUS();` 不同,当集群中的部分节点不可用时,它不会返回错误,而是返回不同的状态码,详见:[SHOW CLUSTER ALIVE](https://docs.taosdata.com/reference/taos-sql/show/#show-cluster-alive)
### CURRENT_USER
diff --git a/docs/zh/14-reference/03-taos-sql/19-limit.md b/docs/zh/14-reference/03-taos-sql/19-limit.md
index 73107bf3ba..4e2fa69a14 100644
--- a/docs/zh/14-reference/03-taos-sql/19-limit.md
+++ b/docs/zh/14-reference/03-taos-sql/19-limit.md
@@ -6,13 +6,16 @@ description: 合法字符集和命名中的限制规则
## 名称命名规则
-1. 合法字符:英文字符、数字和下划线
-2. 允许英文字符或下划线开头,不允许以数字开头
-3. 不区分大小写
-4. 转义后表(列)名规则:
- 为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`"。使用转义字符以后,不再对转义字符中的内容进行大小写统一,即可以保留用户指定表名中的大小写属性。
-
- 例如:\`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。
+1. 合法字符:英文字符、数字和下划线。
+1. 允许英文字符或下划线开头,不允许以数字开头。
+1. 不区分大小写。
+1. 不能是[保留关键字](./20-keywords.md)。
+1. 转义后表(列)名规则:
+ 为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`"。使用转义字符以后:
+ - 不再对转义字符中的内容进行大小写统一,即可以保留用户指定表名中的大小写属性,例如:\`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。
+ - 可以创建包含字母、数字和下划线以外字符的表(列)名,例如:\`abc@TD\`,但是转义后名称中仍然不能包含`.`,否则会提示`The table name cannot contain '.'`。
+ - 可以创建以数字开头的表(列)名,例如\`1970\`。
+ - 可以创建以[保留关键字](./20-keywords.md)命名的表(列)名,例如\`select\`。
## 密码合法字符集
@@ -37,22 +40,3 @@ description: 合法字符集和命名中的限制规则
- 用户密码的最大长度是 31 字节
- 总数据行数取决于可用资源
- 单个数据库的虚拟结点数上限为 1024
-
-## 表(列)名合法性说明
-
-### TDengine 中的表(列)名命名规则如下:
-
-只能由字母、数字、下划线构成,数字不能在首位,长度不能超过 192 字节,不区分大小写。这里表名称不包括数据库名的前缀和分隔符。
-
-### 转义后表(列)名规则:
-
-为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`",可以避免表名与关键词的冲突,转义符不计入表名的长度。
-转义后的表(列)名同样受到长度限制要求,且长度计算的时候不计算转义符。使用转义字符以后,不再对转义字符中的内容进行大小写统一。
-
-例如:
-\`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。
-
-:::note
-转义字符中的内容必须符合命名规则中的字符约束。
-
-:::
diff --git a/docs/zh/14-reference/05-connector/14-java.mdx b/docs/zh/14-reference/05-connector/14-java.mdx
index 5f95233163..ec24f1329d 100644
--- a/docs/zh/14-reference/05-connector/14-java.mdx
+++ b/docs/zh/14-reference/05-connector/14-java.mdx
@@ -33,6 +33,7 @@ REST 连接支持所有能运行 Java 的平台。
| taos-jdbcdriver 版本 | 主要变化 | TDengine 版本 |
| :------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------: |
+| 3.3.2 | 1. 优化 Websocket 连接下的参数绑定性能;2. 优化了对 mybatis 的支持 | - |
| 3.3.0 | 1. 优化 Websocket 连接下的数据传输性能;2. 支持跳过 SSL 验证,默认关闭 | 3.3.2.0 及更高版本 |
| 3.2.11 | 解决了 Native 连接关闭结果集 bug | - |
| 3.2.10 | 1. REST/WebSocket 连接支持传输中的数据压缩;2. Websocket 自动重连机制,默认关闭;3. Connection 类提供无模式写入的方法;4. 优化了原生连接的数据拉取性能;5. 修复了一些已知问题;6.元数据获取函数可以返回支持的函数列表。 | - |
diff --git a/include/client/taos.h b/include/client/taos.h
index 55b24c8721..8b0111ae97 100644
--- a/include/client/taos.h
+++ b/include/client/taos.h
@@ -51,7 +51,7 @@ typedef void TAOS_SUB;
#define TSDB_DATA_TYPE_BLOB 18 // binary
#define TSDB_DATA_TYPE_MEDIUMBLOB 19
#define TSDB_DATA_TYPE_BINARY TSDB_DATA_TYPE_VARCHAR // string
-#define TSDB_DATA_TYPE_GEOMETRY 20 // geometry
+#define TSDB_DATA_TYPE_GEOMETRY 20 // geometry
#define TSDB_DATA_TYPE_MAX 21
typedef enum {
@@ -168,7 +168,7 @@ DLL_EXPORT const char *taos_data_type(int type);
DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos);
DLL_EXPORT TAOS_STMT *taos_stmt_init_with_reqid(TAOS *taos, int64_t reqid);
-DLL_EXPORT TAOS_STMT *taos_stmt_init_with_options(TAOS *taos, TAOS_STMT_OPTIONS* options);
+DLL_EXPORT TAOS_STMT *taos_stmt_init_with_options(TAOS *taos, TAOS_STMT_OPTIONS *options);
DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length);
DLL_EXPORT int taos_stmt_set_tbname_tags(TAOS_STMT *stmt, const char *name, TAOS_MULTI_BIND *tags);
DLL_EXPORT int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name);
@@ -193,6 +193,49 @@ DLL_EXPORT char *taos_stmt_errstr(TAOS_STMT *stmt);
DLL_EXPORT int taos_stmt_affected_rows(TAOS_STMT *stmt);
DLL_EXPORT int taos_stmt_affected_rows_once(TAOS_STMT *stmt);
+typedef void TAOS_STMT2;
+
+typedef enum TAOS_FIELD_T {
+ TAOS_FIELD_COL = 1,
+ TAOS_FIELD_TAG,
+ TAOS_FIELD_QUERY,
+ TAOS_FIELD_TBNAME,
+} TAOS_FIELD_T;
+
+typedef struct TAOS_STMT2_OPTION {
+ int64_t reqid;
+ bool singleStbInsert;
+ bool singleTableBindOnce;
+ __taos_async_fn_t asyncExecFn;
+ void *userdata;
+} TAOS_STMT2_OPTION;
+
+typedef struct TAOS_STMT2_BIND {
+ int buffer_type;
+ void *buffer;
+ int32_t *length;
+ char *is_null;
+ int num;
+} TAOS_STMT2_BIND;
+
+typedef struct TAOS_STMT2_BINDV {
+ int count;
+ char **tbnames;
+ TAOS_STMT2_BIND **tags;
+ TAOS_STMT2_BIND **bind_cols;
+} TAOS_STMT2_BINDV;
+
+DLL_EXPORT TAOS_STMT2 *taos_stmt2_init(TAOS *taos, TAOS_STMT2_OPTION *option);
+DLL_EXPORT int taos_stmt2_prepare(TAOS_STMT2 *stmt, const char *sql, unsigned long length);
+DLL_EXPORT int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx);
+DLL_EXPORT int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows);
+DLL_EXPORT int taos_stmt2_close(TAOS_STMT2 *stmt);
+DLL_EXPORT int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert);
+DLL_EXPORT int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields);
+DLL_EXPORT void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields);
+DLL_EXPORT TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt);
+DLL_EXPORT char *taos_stmt2_error(TAOS_STMT2 *stmt);
+
DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql);
DLL_EXPORT TAOS_RES *taos_query_with_reqid(TAOS *taos, const char *sql, int64_t reqId);
@@ -246,14 +289,15 @@ DLL_EXPORT void taos_set_hb_quit(int8_t quitByKill);
DLL_EXPORT int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type);
-typedef void (*__taos_async_whitelist_fn_t)(void *param, int code, TAOS *taos, int numOfWhiteLists, uint64_t* pWhiteLists);
+typedef void (*__taos_async_whitelist_fn_t)(void *param, int code, TAOS *taos, int numOfWhiteLists,
+ uint64_t *pWhiteLists);
DLL_EXPORT void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *param);
typedef enum {
TAOS_CONN_MODE_BI = 0,
} TAOS_CONN_MODE;
-DLL_EXPORT int taos_set_conn_mode(TAOS* taos, int mode, int value);
+DLL_EXPORT int taos_set_conn_mode(TAOS *taos, int mode, int value);
/* --------------------------schemaless INTERFACE------------------------------- */
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
@@ -271,10 +315,13 @@ DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int
int precision, int32_t ttl);
DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows,
int protocol, int precision, int32_t ttl, int64_t reqid);
-DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid_tbname_key(TAOS *taos, char *lines, int len, int32_t *totalRows,
- int protocol, int precision, int32_t ttl, int64_t reqid, char *tbnameKey);
-DLL_EXPORT TAOS_RES *taos_schemaless_insert_ttl_with_reqid_tbname_key(TAOS *taos, char *lines[], int numLines, int protocol,
- int precision, int32_t ttl, int64_t reqid, char *tbnameKey);
+DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid_tbname_key(TAOS *taos, char *lines, int len,
+ int32_t *totalRows, int protocol,
+ int precision, int32_t ttl, int64_t reqid,
+ char *tbnameKey);
+DLL_EXPORT TAOS_RES *taos_schemaless_insert_ttl_with_reqid_tbname_key(TAOS *taos, char *lines[], int numLines,
+ int protocol, int precision, int32_t ttl,
+ int64_t reqid, char *tbnameKey);
/* --------------------------TMQ INTERFACE------------------------------- */
typedef struct tmq_t tmq_t;
@@ -320,14 +367,17 @@ DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
DLL_EXPORT int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics);
DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq);
-DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg); //Commit the msg’s offset + 1
+DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg); // Commit the msg’s offset + 1
DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
DLL_EXPORT int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
-DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param);
-DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,int32_t *numOfAssignment);
-DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment);
+DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset,
+ tmq_commit_cb *cb, void *param);
+DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,
+ int32_t *numOfAssignment);
+DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment *pAssignment);
DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
-DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId); // The current offset is the offset of the last consumed message + 1
+DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName,
+ int32_t vgId); // The current offset is the offset of the last consumed message + 1
DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId);
DLL_EXPORT TAOS *tmq_get_connect(tmq_t *tmq);
@@ -336,7 +386,7 @@ DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res);
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res);
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
-DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res);
+DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES *res);
DLL_EXPORT const char *tmq_err2str(int32_t code);
/* ------------------------------ TAOSX -----------------------------------*/
@@ -346,15 +396,16 @@ typedef struct tmq_raw_data {
uint16_t raw_type;
} tmq_raw_data;
-DLL_EXPORT int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw);
-DLL_EXPORT int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw);
-DLL_EXPORT int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char *tbname);
-DLL_EXPORT int taos_write_raw_block_with_reqid(TAOS *taos, int numOfRows, char *pData, const char *tbname, int64_t reqid);
-DLL_EXPORT int taos_write_raw_block_with_fields(TAOS *taos, int rows, char *pData, const char *tbname,
- TAOS_FIELD *fields, int numFields);
-DLL_EXPORT int taos_write_raw_block_with_fields_with_reqid(TAOS *taos, int rows, char *pData, const char *tbname,
- TAOS_FIELD *fields, int numFields, int64_t reqid);
-DLL_EXPORT void tmq_free_raw(tmq_raw_data raw);
+DLL_EXPORT int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw);
+DLL_EXPORT int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw);
+DLL_EXPORT int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char *tbname);
+DLL_EXPORT int taos_write_raw_block_with_reqid(TAOS *taos, int numOfRows, char *pData, const char *tbname,
+ int64_t reqid);
+DLL_EXPORT int taos_write_raw_block_with_fields(TAOS *taos, int rows, char *pData, const char *tbname,
+ TAOS_FIELD *fields, int numFields);
+DLL_EXPORT int taos_write_raw_block_with_fields_with_reqid(TAOS *taos, int rows, char *pData, const char *tbname,
+ TAOS_FIELD *fields, int numFields, int64_t reqid);
+DLL_EXPORT void tmq_free_raw(tmq_raw_data raw);
// Returning null means error. Returned result need to be freed by tmq_free_json_meta
DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res);
@@ -370,7 +421,7 @@ typedef enum {
} TSDB_SERVER_STATUS;
DLL_EXPORT TSDB_SERVER_STATUS taos_check_server_status(const char *fqdn, int port, char *details, int maxlen);
-DLL_EXPORT char* getBuildInfo();
+DLL_EXPORT char *getBuildInfo();
#ifdef __cplusplus
}
#endif
diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h
index b4dd6d61e4..22a43012c5 100644
--- a/include/common/tdatablock.h
+++ b/include/common/tdatablock.h
@@ -41,7 +41,7 @@ typedef struct SBlockOrderInfo {
#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT])
#define colDataIsNull_f(bm_, r_) ((BMCharPos(bm_, r_) & (1u << (7u - BitPos(r_)))) == (1u << (7u - BitPos(r_))))
-#define QRY_OPTR_CHECK(_o) \
+#define QRY_PARAM_CHECK(_o) \
do { \
if ((_o) == NULL) { \
return TSDB_CODE_INVALID_PARA; \
diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h
index 4d6d69b178..1179e710cd 100644
--- a/include/common/tdataformat.h
+++ b/include/common/tdataformat.h
@@ -378,6 +378,19 @@ typedef struct {
int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted, const STSchema *pTSchema,
SArray *rowArray);
+// stmt2 binding
+int32_t tColDataAddValueByBind2(SColData *pColData, TAOS_STMT2_BIND *pBind, int32_t buffMaxLen);
+
+typedef struct {
+ int32_t columnId;
+ int32_t type;
+ int32_t bytes;
+ TAOS_STMT2_BIND *bind;
+} SBindInfo2;
+
+int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorted, const STSchema *pTSchema,
+ SArray *rowArray);
+
#endif
#ifdef __cplusplus
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 09408a9826..005a5c49b1 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -286,117 +286,118 @@
#define TK_FOR 268
#define TK_NOW 269
#define TK_TODAY 270
-#define TK_SUBSTR 271
-#define TK_SUBSTRING 272
-#define TK_BOTH 273
-#define TK_TRAILING 274
-#define TK_LEADING 275
-#define TK_TIMEZONE 276
-#define TK_CLIENT_VERSION 277
-#define TK_SERVER_VERSION 278
-#define TK_SERVER_STATUS 279
-#define TK_CURRENT_USER 280
-#define TK_PI 281
-#define TK_CASE 282
-#define TK_WHEN 283
-#define TK_THEN 284
-#define TK_ELSE 285
-#define TK_BETWEEN 286
-#define TK_IS 287
-#define TK_NK_LT 288
-#define TK_NK_GT 289
-#define TK_NK_LE 290
-#define TK_NK_GE 291
-#define TK_NK_NE 292
-#define TK_MATCH 293
-#define TK_NMATCH 294
-#define TK_CONTAINS 295
-#define TK_JOIN 296
-#define TK_INNER 297
-#define TK_LEFT 298
-#define TK_RIGHT 299
-#define TK_OUTER 300
-#define TK_SEMI 301
-#define TK_ANTI 302
-#define TK_ASOF 303
-#define TK_WINDOW 304
-#define TK_WINDOW_OFFSET 305
-#define TK_JLIMIT 306
-#define TK_SELECT 307
-#define TK_NK_HINT 308
-#define TK_DISTINCT 309
-#define TK_WHERE 310
-#define TK_PARTITION 311
-#define TK_BY 312
-#define TK_SESSION 313
-#define TK_STATE_WINDOW 314
-#define TK_EVENT_WINDOW 315
-#define TK_COUNT_WINDOW 316
-#define TK_SLIDING 317
-#define TK_FILL 318
-#define TK_VALUE 319
-#define TK_VALUE_F 320
-#define TK_NONE 321
-#define TK_PREV 322
-#define TK_NULL_F 323
-#define TK_LINEAR 324
-#define TK_NEXT 325
-#define TK_HAVING 326
-#define TK_RANGE 327
-#define TK_EVERY 328
-#define TK_ORDER 329
-#define TK_SLIMIT 330
-#define TK_SOFFSET 331
-#define TK_LIMIT 332
-#define TK_OFFSET 333
-#define TK_ASC 334
-#define TK_NULLS 335
-#define TK_ABORT 336
-#define TK_AFTER 337
-#define TK_ATTACH 338
-#define TK_BEFORE 339
-#define TK_BEGIN 340
-#define TK_BITAND 341
-#define TK_BITNOT 342
-#define TK_BITOR 343
-#define TK_BLOCKS 344
-#define TK_CHANGE 345
-#define TK_COMMA 346
-#define TK_CONCAT 347
-#define TK_CONFLICT 348
-#define TK_COPY 349
-#define TK_DEFERRED 350
-#define TK_DELIMITERS 351
-#define TK_DETACH 352
-#define TK_DIVIDE 353
-#define TK_DOT 354
-#define TK_EACH 355
-#define TK_FAIL 356
-#define TK_GLOB 357
-#define TK_ID 358
-#define TK_IMMEDIATE 359
-#define TK_IMPORT 360
-#define TK_INITIALLY 361
-#define TK_INSTEAD 362
-#define TK_ISNULL 363
-#define TK_MODULES 364
-#define TK_NK_BITNOT 365
-#define TK_NK_SEMI 366
-#define TK_NOTNULL 367
-#define TK_OF 368
-#define TK_PLUS 369
-#define TK_PRIVILEGE 370
-#define TK_RAISE 371
-#define TK_RESTRICT 372
-#define TK_ROW 373
-#define TK_STAR 374
-#define TK_STATEMENT 375
-#define TK_STRICT 376
-#define TK_STRING 377
-#define TK_TIMES 378
-#define TK_VALUES 379
-#define TK_VARIABLE 380
-#define TK_WAL 381
+#define TK_RAND 271
+#define TK_SUBSTR 272
+#define TK_SUBSTRING 273
+#define TK_BOTH 274
+#define TK_TRAILING 275
+#define TK_LEADING 276
+#define TK_TIMEZONE 277
+#define TK_CLIENT_VERSION 278
+#define TK_SERVER_VERSION 279
+#define TK_SERVER_STATUS 280
+#define TK_CURRENT_USER 281
+#define TK_PI 282
+#define TK_CASE 283
+#define TK_WHEN 284
+#define TK_THEN 285
+#define TK_ELSE 286
+#define TK_BETWEEN 287
+#define TK_IS 288
+#define TK_NK_LT 289
+#define TK_NK_GT 290
+#define TK_NK_LE 291
+#define TK_NK_GE 292
+#define TK_NK_NE 293
+#define TK_MATCH 294
+#define TK_NMATCH 295
+#define TK_CONTAINS 296
+#define TK_JOIN 297
+#define TK_INNER 298
+#define TK_LEFT 299
+#define TK_RIGHT 300
+#define TK_OUTER 301
+#define TK_SEMI 302
+#define TK_ANTI 303
+#define TK_ASOF 304
+#define TK_WINDOW 305
+#define TK_WINDOW_OFFSET 306
+#define TK_JLIMIT 307
+#define TK_SELECT 308
+#define TK_NK_HINT 309
+#define TK_DISTINCT 310
+#define TK_WHERE 311
+#define TK_PARTITION 312
+#define TK_BY 313
+#define TK_SESSION 314
+#define TK_STATE_WINDOW 315
+#define TK_EVENT_WINDOW 316
+#define TK_COUNT_WINDOW 317
+#define TK_SLIDING 318
+#define TK_FILL 319
+#define TK_VALUE 320
+#define TK_VALUE_F 321
+#define TK_NONE 322
+#define TK_PREV 323
+#define TK_NULL_F 324
+#define TK_LINEAR 325
+#define TK_NEXT 326
+#define TK_HAVING 327
+#define TK_RANGE 328
+#define TK_EVERY 329
+#define TK_ORDER 330
+#define TK_SLIMIT 331
+#define TK_SOFFSET 332
+#define TK_LIMIT 333
+#define TK_OFFSET 334
+#define TK_ASC 335
+#define TK_NULLS 336
+#define TK_ABORT 337
+#define TK_AFTER 338
+#define TK_ATTACH 339
+#define TK_BEFORE 340
+#define TK_BEGIN 341
+#define TK_BITAND 342
+#define TK_BITNOT 343
+#define TK_BITOR 344
+#define TK_BLOCKS 345
+#define TK_CHANGE 346
+#define TK_COMMA 347
+#define TK_CONCAT 348
+#define TK_CONFLICT 349
+#define TK_COPY 350
+#define TK_DEFERRED 351
+#define TK_DELIMITERS 352
+#define TK_DETACH 353
+#define TK_DIVIDE 354
+#define TK_DOT 355
+#define TK_EACH 356
+#define TK_FAIL 357
+#define TK_GLOB 358
+#define TK_ID 359
+#define TK_IMMEDIATE 360
+#define TK_IMPORT 361
+#define TK_INITIALLY 362
+#define TK_INSTEAD 363
+#define TK_ISNULL 364
+#define TK_MODULES 365
+#define TK_NK_BITNOT 366
+#define TK_NK_SEMI 367
+#define TK_NOTNULL 368
+#define TK_OF 369
+#define TK_PLUS 370
+#define TK_PRIVILEGE 371
+#define TK_RAISE 372
+#define TK_RESTRICT 373
+#define TK_ROW 374
+#define TK_STAR 375
+#define TK_STATEMENT 376
+#define TK_STRICT 377
+#define TK_STRING 378
+#define TK_TIMES 379
+#define TK_VALUES 380
+#define TK_VARIABLE 381
+#define TK_WAL 382
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index 09143dde29..ed56b7e6b2 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -166,6 +166,8 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
+void qResetTaskCode(qTaskInfo_t tinfo);
+
void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo);
/**
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index b1d8be2f0e..1b02203c07 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -191,6 +191,8 @@ typedef struct SFunctionNode {
bool hasOriginalFunc;
int32_t originalFuncId;
ETrimType trimType;
+ bool hasSMA;
+ bool dual; // whether select stmt without from stmt, true for without.
} SFunctionNode;
typedef struct STableNode {
diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h
index a808fccc4a..7271da8ff6 100644
--- a/include/libs/parser/parser.h
+++ b/include/libs/parser/parser.h
@@ -20,9 +20,9 @@
extern "C" {
#endif
+#include "catalog.h"
#include "query.h"
#include "querynodes.h"
-#include "catalog.h"
typedef struct SStmtCallback {
TAOS_STMT* pStmt;
@@ -37,15 +37,15 @@ typedef enum {
} SParseResType;
typedef struct SParseSchemaRes {
- int8_t precision;
- int32_t numOfCols;
- SSchema* pSchema;
+ int8_t precision;
+ int32_t numOfCols;
+ SSchema* pSchema;
} SParseSchemaRes;
typedef struct SParseQueryRes {
- SNode* pQuery;
- SCatalogReq* pCatalogReq;
- SMetaData meta;
+ SNode* pQuery;
+ SCatalogReq* pCatalogReq;
+ SMetaData meta;
} SParseQueryRes;
typedef struct SParseSqlRes {
@@ -124,11 +124,13 @@ int32_t qSetSTableIdForRsma(SNode* pStmt, int64_t uid);
int32_t qInitKeywordsTable();
void qCleanupKeywordsTable();
-int32_t qAppendStmtTableOutput(SQuery* pQuery, SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx, SStbInterlaceInfo* pBuildInfo);
-int32_t qBuildStmtFinOutput(SQuery* pQuery, SHashObj* pAllVgHash, SArray* pVgDataBlocks);
-//int32_t qBuildStmtOutputFromTbList(SQuery* pQuery, SHashObj* pVgHash, SArray* pBlockList, STableDataCxt* pTbCtx, int32_t tbNum);
+int32_t qAppendStmtTableOutput(SQuery* pQuery, SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx,
+ SStbInterlaceInfo* pBuildInfo);
+int32_t qBuildStmtFinOutput(SQuery* pQuery, SHashObj* pAllVgHash, SArray* pVgDataBlocks);
+// int32_t qBuildStmtOutputFromTbList(SQuery* pQuery, SHashObj* pVgHash, SArray* pBlockList, STableDataCxt* pTbCtx,
+// int32_t tbNum);
int32_t qBuildStmtOutput(SQuery* pQuery, SHashObj* pVgHash, SHashObj* pBlockHash);
-int32_t qResetStmtColumns(SArray* pCols, bool deepClear);
+int32_t qResetStmtColumns(SArray* pCols, bool deepClear);
int32_t qResetStmtDataBlock(STableDataCxt* block, bool keepBuf);
int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool reset);
int32_t qRebuildStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_t uid, uint64_t suid, int32_t vgId,
@@ -139,39 +141,51 @@ int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData** pData
int32_t qStmtBindParams(SQuery* pQuery, TAOS_MULTI_BIND* pParams, int32_t colIdx);
int32_t qStmtParseQuerySql(SParseContext* pCxt, SQuery* pQuery);
-int32_t qBindStmtStbColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, STSchema** pTSchema, SBindInfo* pBindInfos);
+int32_t qBindStmtStbColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen,
+ STSchema** pTSchema, SBindInfo* pBindInfos);
int32_t qBindStmtColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen);
-int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, int32_t colIdx,
- int32_t rowNum);
+int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen,
+ int32_t colIdx, int32_t rowNum);
int32_t qBuildStmtColFields(void* pDataBlock, int32_t* fieldNum, TAOS_FIELD_E** fields);
int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TAOS_FIELD_E** fields);
int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName,
TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen);
+
+int32_t qStmtBindParams2(SQuery* pQuery, TAOS_STMT2_BIND* pParams, int32_t colIdx);
+int32_t qBindStmtStbColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
+ STSchema** pTSchema, SBindInfo2* pBindInfos);
+int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen);
+int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
+ int32_t colIdx, int32_t rowNum);
+int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName,
+ TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen);
+
void destroyBoundColumnInfo(void* pBoundInfo);
int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf,
int32_t msgBufLen);
void qDestroyBoundColInfo(void* pInfo);
-int32_t smlInitHandle(SQuery** query);
-int32_t smlBuildRow(STableDataCxt* pTableCxt);
-int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* kv, int32_t index);
-int32_t smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta, STableDataCxt** cxt);
+int32_t smlInitHandle(SQuery** query);
+int32_t smlBuildRow(STableDataCxt* pTableCxt);
+int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* kv, int32_t index);
+int32_t smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta, STableDataCxt** cxt);
void clearColValArraySml(SArray* pCols);
int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsSchema, SArray* cols,
STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl,
char* msgBuf, int32_t msgBufLen);
int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash);
-int rawBlockBindData(SQuery *query, STableMeta* pTableMeta, void* data, SVCreateTbReq** pCreateTb, TAOS_FIELD *fields,
- int numFields, bool needChangeLength, char* errstr, int32_t errstrLen);
+int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq** pCreateTb, TAOS_FIELD* fields,
+ int numFields, bool needChangeLength, char* errstr, int32_t errstrLen);
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut);
int32_t serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap, SArray** pOut);
-void destoryCatalogReq(SCatalogReq *pCatalogReq);
+void destoryCatalogReq(SCatalogReq* pCatalogReq);
bool isPrimaryKeyImpl(SNode* pExpr);
-int32_t insAppendStmtTableDataCxt(SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx, SStbInterlaceInfo* pBuildInfo);
+int32_t insAppendStmtTableDataCxt(SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx,
+ SStbInterlaceInfo* pBuildInfo);
#ifdef __cplusplus
}
diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h
index 6e2b83dce7..c8c4fcad44 100644
--- a/include/libs/qcom/query.h
+++ b/include/libs/qcom/query.h
@@ -348,6 +348,8 @@ extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char** msg, int32_t msgSi
void* (*mallocFp)(int64_t));
extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t msgSize);
+void* getTaskPoolWorkerCb();
+
#define SET_META_TYPE_NULL(t) (t) = META_TYPE_NULL_TABLE
#define SET_META_TYPE_CTABLE(t) (t) = META_TYPE_CTABLE
#define SET_META_TYPE_TABLE(t) (t) = META_TYPE_TABLE
diff --git a/include/libs/qworker/qworker.h b/include/libs/qworker/qworker.h
index ac27534ab0..83daf0376c 100644
--- a/include/libs/qworker/qworker.h
+++ b/include/libs/qworker/qworker.h
@@ -72,6 +72,7 @@ typedef struct SQWMsg {
int32_t msgLen;
SQWMsgInfo msgInfo;
SRpcHandleInfo connInfo;
+ void *pWorkerCb;
} SQWMsg;
int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb);
diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h
index 70b44a4b52..b06b7c74c7 100644
--- a/include/libs/scalar/scalar.h
+++ b/include/libs/scalar/scalar.h
@@ -70,6 +70,7 @@ int32_t modFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu
int32_t signFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t degreesFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t radiansFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
+int32_t randFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
/* String functions */
int32_t lengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h
index 8ab3b898ca..b98170f168 100644
--- a/include/libs/scheduler/scheduler.h
+++ b/include/libs/scheduler/scheduler.h
@@ -67,6 +67,7 @@ typedef struct SSchedulerReq {
SExecResult* pExecRes;
void** pFetchRes;
int8_t source;
+ void* pWorkerCb;
} SSchedulerReq;
int32_t schedulerInit(void);
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 20f91106a5..e71a6c4dce 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -636,7 +636,7 @@ typedef struct SCheckpointConsensusInfo {
int64_t streamId;
} SCheckpointConsensusInfo;
-int32_t streamSetupScheduleTrigger(SStreamTask* pTask);
+void streamSetupScheduleTrigger(SStreamTask* pTask);
// dispatch related
int32_t streamProcessDispatchMsg(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg);
@@ -705,7 +705,7 @@ int32_t streamTaskSetActiveCheckpointInfo(SStreamTask* pTask, int64_t activeChec
void streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t checkpointId);
bool streamTaskAlreadySendTrigger(SStreamTask* pTask, int32_t downstreamNodeId);
void streamTaskGetTriggerRecvStatus(SStreamTask* pTask, int32_t* pRecved, int32_t* pTotal);
-void streamTaskInitTriggerDispatchInfo(SStreamTask* pTask);
+int32_t streamTaskInitTriggerDispatchInfo(SStreamTask* pTask);
void streamTaskSetTriggerDispatchConfirmed(SStreamTask* pTask, int32_t vgId);
int32_t streamTaskSendCheckpointTriggerMsg(SStreamTask* pTask, int32_t dstTaskId, int32_t downstreamNodeId,
SRpcHandleInfo* pInfo, int32_t code);
@@ -793,6 +793,7 @@ void streamTaskSetReqConsenChkptId(SStreamTask* pTask, int64_t ts);
int32_t streamTimerGetInstance(tmr_h* pTmr);
void streamTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void* param, void* handle, tmr_h* pTmrId, int32_t vgId,
const char* pMsg);
+void streamTmrStop(tmr_h tmrId);
// checkpoint
int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSourceReq* pReq);
@@ -810,6 +811,7 @@ int32_t streamTaskBuildCheckpointSourceRsp(SStreamCheckpointSourceReq* pReq, SRp
int32_t streamSendChkptReportMsg(SStreamTask* pTask, SCheckpointInfo* pCheckpointInfo, int8_t dropRelHTask);
int32_t streamTaskUpdateTaskCheckpointInfo(SStreamTask* pTask, bool restored, SVUpdateCheckpointInfoReq* pReq);
int32_t streamTaskCreateActiveChkptInfo(SActiveCheckpointInfo** pRes);
+void streamTaskSetCheckpointFailed(SStreamTask* pTask);
// stream task state machine, and event handling
int32_t streamCreateStateMachine(SStreamTask* pTask);
diff --git a/source/client/inc/clientStmt2.h b/source/client/inc/clientStmt2.h
new file mode 100644
index 0000000000..74eb198930
--- /dev/null
+++ b/source/client/inc/clientStmt2.h
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef TDENGINE_CLIENTSTMT2_H
+#define TDENGINE_CLIENTSTMT2_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "catalog.h"
+/*
+typedef enum {
+STMT_TYPE_INSERT = 1,
+STMT_TYPE_MULTI_INSERT,
+STMT_TYPE_QUERY,
+} STMT_TYPE;
+
+typedef enum {
+STMT_INIT = 1,
+STMT_PREPARE,
+STMT_SETTBNAME,
+STMT_SETTAGS,
+STMT_FETCH_FIELDS,
+STMT_BIND,
+STMT_BIND_COL,
+STMT_ADD_BATCH,
+STMT_EXECUTE,
+STMT_MAX,
+} STMT_STATUS;
+
+#define STMT_TABLE_COLS_NUM 1000
+
+typedef struct SStmtTableCache {
+STableDataCxt *pDataCtx;
+void *boundTags;
+} SStmtTableCache;
+
+typedef struct SStmtQueryResInfo {
+TAOS_FIELD *fields;
+TAOS_FIELD *userFields;
+uint32_t numOfCols;
+int32_t precision;
+} SStmtQueryResInfo;
+
+typedef struct SStmtBindInfo {
+bool needParse;
+bool inExecCache;
+uint64_t tbUid;
+uint64_t tbSuid;
+int32_t tbVgId;
+int32_t sBindRowNum;
+int32_t sBindLastIdx;
+int8_t tbType;
+bool tagsCached;
+void *boundTags;
+char tbName[TSDB_TABLE_FNAME_LEN];
+char tbFName[TSDB_TABLE_FNAME_LEN];
+char stbFName[TSDB_TABLE_FNAME_LEN];
+SName sname;
+
+char statbName[TSDB_TABLE_FNAME_LEN];
+} SStmtBindInfo;
+
+typedef struct SStmtAsyncParam {
+STableColsData *pTbData;
+void* pStmt;
+} SStmtAsyncParam;
+
+typedef struct SStmtExecInfo {
+int32_t affectedRows;
+SRequestObj *pRequest;
+SHashObj *pBlockHash;
+STableDataCxt *pCurrBlock;
+SSubmitTbData *pCurrTbData;
+} SStmtExecInfo;
+*/
+typedef struct {
+ bool stbInterlaceMode;
+ STMT_TYPE type;
+ STMT_STATUS status;
+ uint64_t suid;
+ uint64_t runTimes;
+ SHashObj *pTableCache; // SHash
+ SQuery *pQuery;
+ char *sqlStr;
+ int32_t sqlLen;
+ SArray *nodeList;
+ SStmtQueryResInfo queryRes;
+ bool autoCreateTbl;
+ SHashObj *pVgHash;
+ SBindInfo2 *pBindInfo;
+
+ SStbInterlaceInfo siInfo;
+} SStmtSQLInfo2;
+/*
+typedef struct SStmtStatInfo {
+int64_t ctgGetTbMetaNum;
+int64_t getCacheTbInfo;
+int64_t parseSqlNum;
+int64_t bindDataNum;
+int64_t setTbNameUs;
+int64_t bindDataUs1;
+int64_t bindDataUs2;
+int64_t bindDataUs3;
+int64_t bindDataUs4;
+int64_t addBatchUs;
+int64_t execWaitUs;
+int64_t execUseUs;
+} SStmtStatInfo;
+
+typedef struct SStmtQNode {
+bool restoreTbCols;
+STableColsData tblData;
+struct SStmtQNode* next;
+} SStmtQNode;
+
+typedef struct SStmtQueue {
+bool stopQueue;
+SStmtQNode* head;
+SStmtQNode* tail;
+uint64_t qRemainNum;
+} SStmtQueue;
+*/
+
+typedef struct {
+ STscObj *taos;
+ SCatalog *pCatalog;
+ int32_t affectedRows;
+ uint32_t seqId;
+ uint32_t seqIds[STMT_MAX];
+ bool bindThreadInUse;
+ TdThread bindThread;
+ TAOS_STMT2_OPTION options;
+ bool stbInterlaceMode;
+ SStmtQueue queue;
+
+ SStmtSQLInfo2 sql;
+ SStmtExecInfo exec;
+ SStmtBindInfo bInfo;
+
+ int64_t reqid;
+ int32_t errCode;
+ tsem_t asyncQuerySem;
+
+ SStmtStatInfo stat;
+} STscStmt2;
+/*
+extern char *gStmtStatusStr[];
+
+#define STMT_LOG_SEQ(n) \
+do { \
+ (pStmt)->seqId++; \
+ (pStmt)->seqIds[n]++; \
+ STMT_DLOG("the %dth:%d %s", (pStmt)->seqIds[n], (pStmt)->seqId, gStmtStatusStr[n]); \
+} while (0)
+
+#define STMT_STATUS_NE(S) (pStmt->sql.status != STMT_##S)
+#define STMT_STATUS_EQ(S) (pStmt->sql.status == STMT_##S)
+
+#define STMT_ERR_RET(c) \
+do { \
+ int32_t _code = c; \
+ if (_code != TSDB_CODE_SUCCESS) { \
+ terrno = _code; \
+ pStmt->errCode = _code; \
+ return _code; \
+ } \
+} while (0)
+#define STMT_RET(c) \
+do { \
+ int32_t _code = c; \
+ if (_code != TSDB_CODE_SUCCESS) { \
+ terrno = _code; \
+ pStmt->errCode = _code; \
+ } \
+ return _code; \
+} while (0)
+#define STMT_ERR_JRET(c) \
+do { \
+ code = c; \
+ if (code != TSDB_CODE_SUCCESS) { \
+ terrno = code; \
+ pStmt->errCode = code; \
+ goto _return; \
+ } \
+} while (0)
+#define STMT_ERRI_JRET(c) \
+do { \
+ code = c; \
+ if (code != TSDB_CODE_SUCCESS) { \
+ terrno = code; \
+ goto _return; \
+ } \
+} while (0)
+
+
+#define STMT_FLOG(param, ...) qFatal("stmt:%p " param, pStmt, __VA_ARGS__)
+#define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__)
+#define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__)
+
+#define STMT_ELOG_E(param) qError("stmt:%p " param, pStmt)
+#define STMT_DLOG_E(param) qDebug("stmt:%p " param, pStmt)
+*/
+TAOS_STMT2 *stmtInit2(STscObj *taos, TAOS_STMT2_OPTION *pOptions);
+int stmtClose2(TAOS_STMT2 *stmt);
+int stmtExec2(TAOS_STMT2 *stmt, int *affected_rows);
+int stmtPrepare2(TAOS_STMT2 *stmt, const char *sql, unsigned long length);
+int stmtSetTbName2(TAOS_STMT2 *stmt, const char *tbName);
+int stmtSetTbTags2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *tags);
+int stmtBindBatch2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind, int32_t colIdx);
+int stmtGetTagFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields);
+int stmtGetColFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields);
+int stmtGetParamNum2(TAOS_STMT2 *stmt, int *nums);
+int stmtGetParamTbName(TAOS_STMT2 *stmt, int *nums);
+int stmtIsInsert2(TAOS_STMT2 *stmt, int *insert);
+TAOS_RES *stmtUseResult2(TAOS_STMT2 *stmt);
+const char *stmtErrstr2(TAOS_STMT2 *stmt);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TDENGINE_CLIENTSTMT2_H
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 3c2729c029..fec1060042 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -687,7 +687,9 @@ void doDestroyRequest(void *p) {
taosMemoryFreeClear(pRequest->msgBuf);
doFreeReqResultInfo(&pRequest->body.resInfo);
- (void)tsem_destroy(&pRequest->body.rspSem);
+ if (TSDB_CODE_SUCCESS != tsem_destroy(&pRequest->body.rspSem)) {
+ tscError("failed to destroy semaphore");
+ }
taosArrayDestroy(pRequest->tableList);
taosArrayDestroy(pRequest->targetTableList);
@@ -700,7 +702,9 @@ void doDestroyRequest(void *p) {
taosMemoryFreeClear(pRequest->pDb);
taosArrayDestroy(pRequest->dbList);
if (pRequest->body.interParam) {
- (void)tsem_destroy(&((SSyncQueryParam *)pRequest->body.interParam)->sem);
+ if (TSDB_CODE_SUCCESS != tsem_destroy(&((SSyncQueryParam *)pRequest->body.interParam)->sem)) {
+ tscError("failed to destroy semaphore in pRequest");
+ }
}
taosMemoryFree(pRequest->body.interParam);
diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c
index 5d3892d5e0..47b80c03d1 100644
--- a/source/client/src/clientHb.c
+++ b/source/client/src/clientHb.c
@@ -1636,7 +1636,9 @@ void hbDeregisterConn(STscObj *pTscObj, SClientHbKey connKey) {
SClientHbReq *pReq = taosHashAcquire(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
if (pReq) {
tFreeClientHbReq(pReq);
- (void)taosHashRemove(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey));
+ if (TSDB_CODE_SUCCESS != taosHashRemove(pAppHbMgr->activeInfo, &connKey, sizeof(SClientHbKey))) {
+ tscError("failed to remove connKey from activeInfo");
+ }
taosHashRelease(pAppHbMgr->activeInfo, pReq);
(void)atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
}
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index a208cedd65..d77b8dcbb7 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -209,7 +209,9 @@ _return:
void freeQueryParam(SSyncQueryParam* param) {
if (param == NULL) return;
- (void)tsem_destroy(¶m->sem);
+ if (TSDB_CODE_SUCCESS != tsem_destroy(¶m->sem)) {
+ tscError("failed to destroy semaphore in freeQueryParam");
+ }
taosMemoryFree(param);
}
@@ -351,7 +353,7 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
// int64_t transporterId = 0;
TSC_ERR_RET(asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pMsgInfo->epSet, NULL, pSendMsg));
- (void)tsem_wait(&pRequest->body.rspSem);
+ TSC_ERR_RET(tsem_wait(&pRequest->body.rspSem));
return TSDB_CODE_SUCCESS;
}
@@ -839,6 +841,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
.chkKillParam = (void*)pRequest->self,
.pExecRes = &res,
.source = pRequest->source,
+ .pWorkerCb = getTaskPoolWorkerCb(),
};
int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob);
@@ -1065,6 +1068,7 @@ static int32_t createResultBlock(TAOS_RES* pRes, int32_t numOfRows, SSDataBlock*
TAOS_ROW pRow = taos_fetch_row(pRes);
if (NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) {
tscError("invalid data from vnode");
+ blockDataDestroy(*pBlock);
return TSDB_CODE_TSC_INTERNAL_ERROR;
}
int64_t ts = *(int64_t*)pRow[0];
@@ -1099,8 +1103,11 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) {
}
SSDataBlock* pBlock = NULL;
- if (TSDB_CODE_SUCCESS != createResultBlock(res, rowNum, &pBlock)) {
- tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
+ pRequest->code = createResultBlock(res, rowNum, &pBlock);
+ if (TSDB_CODE_SUCCESS != pRequest->code) {
+ tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId,
+ tstrerror(pRequest->code));
+ returnToUser(pRequest);
return;
}
@@ -1165,14 +1172,18 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) {
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%s, tryCount:%d,QID:0x%" PRIx64, pRequest->self,
tstrerror(code), pRequest->retry, pRequest->requestId);
- (void)removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type));
+ if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) {
+ tscError("0x%" PRIx64 " remove meta failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
+ }
restartAsyncQuery(pRequest, code);
return;
}
tscDebug("schedulerExecCb request type %s", TMSG_INFO(pRequest->type));
if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) {
- (void)removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type));
+ if (TSDB_CODE_SUCCESS != removeMeta(pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type))) {
+ tscError("0x%" PRIx64 " remove meta failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
+ }
}
pRequest->metric.execCostUs = taosGetTimestampUs() - pRequest->metric.execStart;
@@ -1266,7 +1277,10 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue
}
if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) {
- (void)removeMeta(pRequest->pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type));
+ code = removeMeta(pRequest->pTscObj, pRequest->targetTableList, IS_VIEW_REQUEST(pRequest->type));
+ if (TSDB_CODE_SUCCESS != code) {
+ tscError("0x%" PRIx64 " remove meta failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
+ }
}
if (TSDB_CODE_SUCCESS == code) {
@@ -1349,6 +1363,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
.chkKillParam = (void*)pRequest->self,
.pExecRes = NULL,
.source = pRequest->source,
+ .pWorkerCb = getTaskPoolWorkerCb(),
};
if (TSDB_CODE_SUCCESS == code) {
code = schedulerExecJob(&req, &pRequest->body.queryJob);
@@ -1479,12 +1494,12 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList, bool isView) {
continue;
}
(void)tNameGetFullDbName(pViewName, dbFName);
- (void)catalogRemoveViewMeta(pCatalog, dbFName, 0, pViewName->tname, 0);
+ TSC_ERR_RET(catalogRemoveViewMeta(pCatalog, dbFName, 0, pViewName->tname, 0));
}
} else {
for (int32_t i = 0; i < tbNum; ++i) {
SName* pTbName = taosArrayGet(tbList, i);
- (void)catalogRemoveTableMeta(pCatalog, pTbName);
+ TSC_ERR_RET(catalogRemoveTableMeta(pCatalog, pTbName));
}
}
@@ -1584,7 +1599,11 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta
tscError("failed to send connect msg to server, code:%s", tstrerror(code));
return code;
}
- (void)tsem_wait(&pRequest->body.rspSem);
+ if (TSDB_CODE_SUCCESS != tsem_wait(&pRequest->body.rspSem)) {
+ destroyTscObj(*pTscObj);
+ tscError("failed to wait sem, code:%s", terrstr());
+ return terrno;
+ }
if (pRequest->code != TSDB_CODE_SUCCESS) {
const char* errorMsg = (code == TSDB_CODE_RPC_FQDN_ERROR) ? taos_errstr(pRequest) : tstrerror(pRequest->code);
tscError("failed to connect to server, reason: %s", errorMsg);
@@ -1736,7 +1755,9 @@ int32_t doProcessMsgFromServer(void* param) {
tscError("doProcessMsgFromServer pRequest->self:%" PRId64 " != pSendInfo->requestObjRefId:%" PRId64,
pRequest->self, pSendInfo->requestObjRefId);
- (void)taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId);
+ if (TSDB_CODE_SUCCESS != taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId)) {
+ tscError("doProcessMsgFromServer taosReleaseRef failed");
+ }
taosMemoryFree(arg->pEpset);
rpcFreeCont(pMsg->pCont);
destroySendMsgInfo(pSendInfo);
@@ -1769,7 +1790,12 @@ int32_t doProcessMsgFromServer(void* param) {
(void)pSendInfo->fp(pSendInfo->param, &buf, pMsg->code);
if (pTscObj) {
- (void)taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId);
+ int32_t code = taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId);
+ if (TSDB_CODE_SUCCESS != code) {
+ tscError("doProcessMsgFromServer taosReleaseRef failed");
+ terrno = code;
+ pMsg->code = code;
+ }
}
rpcFreeCont(pMsg->pCont);
@@ -1946,7 +1972,9 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
static void syncFetchFn(void* param, TAOS_RES* res, int32_t numOfRows) {
tsem_t* sem = param;
- (void)tsem_post(sem);
+ if (TSDB_CODE_SUCCESS != tsem_post(sem)) {
+ tscError("failed to post sem, code:%s", terrstr());
+ }
}
void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) {
@@ -1965,10 +1993,16 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU
// convert ucs4 to native multi-bytes string
pResultInfo->convertUcs4 = convertUcs4;
tsem_t sem;
- (void)tsem_init(&sem, 0, 0);
+ if (TSDB_CODE_SUCCESS != tsem_init(&sem, 0, 0)) {
+ tscError("failed to init sem, code:%s", terrstr());
+ }
taos_fetch_rows_a(pRequest, syncFetchFn, &sem);
- (void)tsem_wait(&sem);
- (void)tsem_destroy(&sem);
+ if (TSDB_CODE_SUCCESS != tsem_wait(&sem)) {
+ tscError("failed to wait sem, code:%s", terrstr());
+ }
+ if (TSDB_CODE_SUCCESS != tsem_destroy(&sem)) {
+ tscError("failed to destroy sem, code:%s", terrstr());
+ }
pRequest->inCallback = false;
}
@@ -2742,7 +2776,9 @@ void syncCatalogFn(SMetaData* pResult, void* param, int32_t code) {
SSyncQueryParam* pParam = param;
pParam->pRequest->code = code;
- (void)tsem_post(&pParam->sem);
+ if (TSDB_CODE_SUCCESS != tsem_post(&pParam->sem)) {
+ tscError("failed to post semaphore since %s", tstrerror(terrno));
+ }
}
void syncQueryFn(void* param, void* res, int32_t code) {
@@ -2753,7 +2789,9 @@ void syncQueryFn(void* param, void* res, int32_t code) {
pParam->pRequest->code = code;
}
- (void)tsem_post(&pParam->sem);
+ if (TSDB_CODE_SUCCESS != tsem_post(&pParam->sem)) {
+ tscError("failed to post semaphore since %s", tstrerror(terrno));
+ }
}
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly,
@@ -2831,10 +2869,20 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
- (void)tsem_init(¶m->sem, 0, 0);
+ int32_t code = tsem_init(¶m->sem, 0, 0);
+ if (TSDB_CODE_SUCCESS != code) {
+ terrno = code;
+ taosMemoryFree(param);
+ return NULL;
+ }
taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, source);
- (void)tsem_wait(¶m->sem);
+ code = tsem_wait(¶m->sem);
+ if (TSDB_CODE_SUCCESS != code) {
+ terrno = code;
+ taosMemoryFree(param);
+ return NULL;
+ }
SRequestObj* pRequest = NULL;
if (param->pRequest != NULL) {
@@ -2860,10 +2908,20 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly,
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
- (void)tsem_init(¶m->sem, 0, 0);
+ int32_t code = tsem_init(¶m->sem, 0, 0);
+ if (TSDB_CODE_SUCCESS != code) {
+ terrno = code;
+ taosMemoryFree(param);
+ return NULL;
+ }
taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid);
- (void)tsem_wait(¶m->sem);
+ code = tsem_wait(¶m->sem);
+ if (TSDB_CODE_SUCCESS != code) {
+ terrno = code;
+ taosMemoryFree(param);
+ return NULL;
+ }
SRequestObj* pRequest = NULL;
if (param->pRequest != NULL) {
param->pRequest->syncQuery = true;
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index 27c1878dc8..1c1fff9b7b 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -18,6 +18,7 @@
#include "clientLog.h"
#include "clientMonitor.h"
#include "clientStmt.h"
+#include "clientStmt2.h"
#include "functionMgt.h"
#include "os.h"
#include "query.h"
@@ -312,7 +313,9 @@ void taos_close_internal(void *taos) {
STscObj *pTscObj = (STscObj *)taos;
tscDebug("0x%" PRIx64 " try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs);
- (void)taosRemoveRef(clientConnRefPool, pTscObj->id);
+ if (TSDB_CODE_SUCCESS != taosRemoveRef(clientConnRefPool, pTscObj->id)) {
+ tscError("0x%" PRIx64 " failed to remove ref from conn pool", pTscObj->id);
+ }
}
void taos_close(TAOS *taos) {
@@ -1313,7 +1316,10 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
if (NEED_CLIENT_HANDLE_ERROR(code)) {
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d,QID:0x%" PRIx64,
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
- (void)refreshMeta(pRequest->pTscObj, pRequest); // ignore return code,try again
+ if (TSDB_CODE_SUCCESS != refreshMeta(pRequest->pTscObj, pRequest)) {
+ tscWarn("0x%" PRIx64 " refresh meta failed, code:%d - %s,QID:0x%" PRIx64, pRequest->self, code,
+ tstrerror(code), pRequest->requestId);
+ }
pRequest->prevCode = code;
doAsyncQuery(pRequest, true);
return;
@@ -1357,6 +1363,19 @@ void restartAsyncQuery(SRequestObj *pRequest, int32_t code) {
doAsyncQuery(pUserReq, true);
}
+typedef struct SAsyncFetchParam {
+ SRequestObj *pReq;
+ __taos_async_fn_t fp;
+ void *param;
+} SAsyncFetchParam;
+
+static int32_t doAsyncFetch(void* pParam) {
+ SAsyncFetchParam *param = pParam;
+ taosAsyncFetchImpl(param->pReq, param->fp, param->param);
+ taosMemoryFree(param);
+ return TSDB_CODE_SUCCESS;
+}
+
void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
if (res == NULL || fp == NULL) {
tscError("taos_fetch_rows_a invalid paras");
@@ -1364,6 +1383,7 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
}
if (!TD_RES_QUERY(res)) {
tscError("taos_fetch_rows_a res is NULL");
+ fp(param, res, TSDB_CODE_APP_ERROR);
return;
}
@@ -1373,7 +1393,20 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
return;
}
- taosAsyncFetchImpl(pRequest, fp, param);
+ SAsyncFetchParam* pParam = taosMemoryCalloc(1, sizeof(SAsyncFetchParam));
+ if (!pParam) {
+ fp(param, res, terrno);
+ return;
+ }
+ pParam->pReq = pRequest;
+ pParam->fp = fp;
+ pParam->param = param;
+ int32_t code = taosAsyncExec(doAsyncFetch, pParam, NULL);
+ if (TSDB_CODE_SUCCESS != code) {
+ taosMemoryFree(pParam);
+ fp(param, res, code);
+ return;
+ }
}
void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
@@ -1614,8 +1647,11 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
}
SSyncQueryParam *pParam = pRequest->body.interParam;
- (void)tsem_wait(&pParam->sem);
-
+ code = tsem_wait(&pParam->sem);
+ if (code) {
+ tscError("tsem wait failed, code:%d - %s", code, tstrerror(code));
+ goto _return;
+ }
_return:
destoryCatalogReq(&catalogReq);
destroyRequest(pRequest);
@@ -1915,6 +1951,160 @@ int taos_stmt_close(TAOS_STMT *stmt) {
return stmtClose(stmt);
}
+TAOS_STMT2 *taos_stmt2_init(TAOS *taos, TAOS_STMT2_OPTION *option) {
+ STscObj *pObj = acquireTscObj(*(int64_t *)taos);
+ if (NULL == pObj) {
+ tscError("invalid parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_TSC_DISCONNECTED;
+ return NULL;
+ }
+
+ TAOS_STMT2 *pStmt = stmtInit2(pObj, option);
+
+ releaseTscObj(*(int64_t *)taos);
+
+ return pStmt;
+}
+
+int taos_stmt2_prepare(TAOS_STMT2 *stmt, const char *sql, unsigned long length) {
+ if (stmt == NULL || sql == NULL) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ return stmtPrepare2(stmt, sql, length);
+}
+
+int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx) {
+ if (stmt == NULL) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ int32_t code = 0;
+ for (int i = 0; i < bindv->count; ++i) {
+ if (bindv->tbnames && bindv->tbnames[i]) {
+ code = stmtSetTbName2(stmt, bindv->tbnames[i]);
+ if (code) {
+ return code;
+ }
+ }
+
+ if (bindv->tags && bindv->tags[i]) {
+ code = stmtSetTbTags2(stmt, bindv->tags[i]);
+ if (code) {
+ return code;
+ }
+ }
+
+ if (bindv->bind_cols && bindv->bind_cols[i]) {
+ TAOS_STMT2_BIND *bind = bindv->bind_cols[i];
+
+ if (bind->num <= 0 || bind->num > INT16_MAX) {
+ tscError("invalid bind num %d", bind->num);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ int32_t insert = 0;
+ (void)stmtIsInsert2(stmt, &insert);
+ if (0 == insert && bind->num > 1) {
+ tscError("only one row data allowed for query");
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ code = stmtBindBatch2(stmt, bind, col_idx);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows) {
+ if (stmt == NULL) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ return stmtExec2(stmt, affected_rows);
+}
+
+int taos_stmt2_close(TAOS_STMT2 *stmt) {
+ if (stmt == NULL) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ return stmtClose2(stmt);
+}
+/*
+int taos_stmt2_param_count(TAOS_STMT2 *stmt, int *nums) {
+ if (stmt == NULL || nums == NULL) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+ return stmtGetParamNum2(stmt, nums);
+}
+*/
+int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert) {
+ if (stmt == NULL || insert == NULL) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ return stmtIsInsert2(stmt, insert);
+}
+
+int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields) {
+ if (stmt == NULL || NULL == count) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+
+ if (field_type == TAOS_FIELD_COL) {
+ return stmtGetColFields2(stmt, count, fields);
+ } else if (field_type == TAOS_FIELD_TAG) {
+ return stmtGetTagFields2(stmt, count, fields);
+ } else if (field_type == TAOS_FIELD_QUERY) {
+ return stmtGetParamNum2(stmt, count);
+ } else if (field_type == TAOS_FIELD_TBNAME) {
+ return stmtGetParamTbName(stmt, count);
+ } else {
+ tscError("invalid parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return terrno;
+ }
+}
+
+void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields) {
+ (void)stmt;
+ if (!fields) return;
+ taosMemoryFree(fields);
+}
+
+TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt) {
+ if (stmt == NULL) {
+ tscError("NULL parameter for %s", __FUNCTION__);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return NULL;
+ }
+
+ return stmtUseResult2(stmt);
+}
+
+char *taos_stmt2_error(TAOS_STMT2 *stmt) { return (char *)stmtErrstr2(stmt); }
+
int taos_set_conn_mode(TAOS *taos, int mode, int value) {
if (taos == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c
new file mode 100644
index 0000000000..e7e08c0982
--- /dev/null
+++ b/source/client/src/clientStmt2.c
@@ -0,0 +1,1956 @@
+#include "clientInt.h"
+#include "clientLog.h"
+#include "tdef.h"
+
+#include "clientStmt.h"
+#include "clientStmt2.h"
+/*
+char* gStmtStatusStr[] = {"unknown", "init", "prepare", "settbname", "settags",
+ "fetchFields", "bind", "bindCol", "addBatch", "exec"};
+*/
+static FORCE_INLINE int32_t stmtAllocQNodeFromBuf(STableBufInfo* pTblBuf, void** pBuf) {
+ if (pTblBuf->buffOffset < pTblBuf->buffSize) {
+ *pBuf = (char*)pTblBuf->pCurBuff + pTblBuf->buffOffset;
+ pTblBuf->buffOffset += pTblBuf->buffUnit;
+ } else if (pTblBuf->buffIdx < taosArrayGetSize(pTblBuf->pBufList)) {
+ pTblBuf->pCurBuff = taosArrayGetP(pTblBuf->pBufList, pTblBuf->buffIdx++);
+ if (NULL == pTblBuf->pCurBuff) {
+ return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
+ }
+ *pBuf = pTblBuf->pCurBuff;
+ pTblBuf->buffOffset = pTblBuf->buffUnit;
+ } else {
+ void* buff = taosMemoryMalloc(pTblBuf->buffSize);
+ if (NULL == buff) {
+ return terrno;
+ }
+
+ if (taosArrayPush(pTblBuf->pBufList, &buff) == NULL) {
+ return terrno;
+ }
+
+ pTblBuf->buffIdx++;
+ pTblBuf->pCurBuff = buff;
+ *pBuf = buff;
+ pTblBuf->buffOffset = pTblBuf->buffUnit;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static bool stmtDequeue(STscStmt2* pStmt, SStmtQNode** param) {
+ while (0 == atomic_load_64(&pStmt->queue.qRemainNum)) {
+ taosUsleep(1);
+ return false;
+ }
+
+ SStmtQNode* orig = pStmt->queue.head;
+
+ SStmtQNode* node = pStmt->queue.head->next;
+ pStmt->queue.head = pStmt->queue.head->next;
+
+ // taosMemoryFreeClear(orig);
+
+ *param = node;
+
+ (void)atomic_sub_fetch_64(&pStmt->queue.qRemainNum, 1);
+
+ return true;
+}
+
+static void stmtEnqueue(STscStmt2* pStmt, SStmtQNode* param) {
+ pStmt->queue.tail->next = param;
+ pStmt->queue.tail = param;
+
+ pStmt->stat.bindDataNum++;
+ (void)atomic_add_fetch_64(&pStmt->queue.qRemainNum, 1);
+}
+
+static int32_t stmtCreateRequest(STscStmt2* pStmt) {
+ int32_t code = 0;
+
+ if (pStmt->exec.pRequest == NULL) {
+ code = buildRequest(pStmt->taos->id, pStmt->sql.sqlStr, pStmt->sql.sqlLen, NULL, false, &pStmt->exec.pRequest,
+ pStmt->reqid);
+ if (pStmt->reqid != 0) {
+ pStmt->reqid++;
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ pStmt->exec.pRequest->syncQuery = true;
+ pStmt->exec.pRequest->isStmtBind = true;
+ }
+ }
+
+ return code;
+}
+
+static int32_t stmtSwitchStatus(STscStmt2* pStmt, STMT_STATUS newStatus) {
+ int32_t code = 0;
+
+ if (newStatus >= STMT_INIT && newStatus < STMT_MAX) {
+ STMT_LOG_SEQ(newStatus);
+ }
+
+ if (pStmt->errCode && newStatus != STMT_PREPARE) {
+ STMT_DLOG("stmt already failed with err: %s", tstrerror(pStmt->errCode));
+ return pStmt->errCode;
+ }
+
+ switch (newStatus) {
+ case STMT_PREPARE:
+ pStmt->errCode = 0;
+ break;
+ case STMT_SETTBNAME:
+ if (STMT_STATUS_EQ(INIT)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ if (!pStmt->sql.stbInterlaceMode && (STMT_STATUS_EQ(BIND) || STMT_STATUS_EQ(BIND_COL))) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ break;
+ case STMT_SETTAGS:
+ if (STMT_STATUS_NE(SETTBNAME) && STMT_STATUS_NE(FETCH_FIELDS)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ break;
+ case STMT_FETCH_FIELDS:
+ if (STMT_STATUS_EQ(INIT)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ break;
+ case STMT_BIND:
+ if (STMT_STATUS_EQ(INIT) || STMT_STATUS_EQ(BIND_COL)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ /*
+ if ((pStmt->sql.type == STMT_TYPE_MULTI_INSERT) && ()) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ */
+ break;
+ case STMT_BIND_COL:
+ if (STMT_STATUS_EQ(INIT) || STMT_STATUS_EQ(BIND)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ break;
+ case STMT_ADD_BATCH:
+ if (STMT_STATUS_NE(BIND) && STMT_STATUS_NE(BIND_COL) && STMT_STATUS_NE(FETCH_FIELDS)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ break;
+ case STMT_EXECUTE:
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ if (STMT_STATUS_NE(ADD_BATCH) && STMT_STATUS_NE(FETCH_FIELDS) && STMT_STATUS_NE(BIND) &&
+ STMT_STATUS_NE(BIND_COL)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ } else {
+ if (STMT_STATUS_NE(ADD_BATCH) && STMT_STATUS_NE(FETCH_FIELDS)) {
+ code = TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+ }
+ break;
+ default:
+ code = TSDB_CODE_APP_ERROR;
+ break;
+ }
+
+ STMT_ERR_RET(code);
+
+ pStmt->sql.status = newStatus;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtGetTbName(TAOS_STMT2* stmt, char** tbName) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ pStmt->sql.type = STMT_TYPE_MULTI_INSERT;
+
+ if ('\0' == pStmt->bInfo.tbName[0]) {
+ tscError("no table name set");
+ STMT_ERR_RET(TSDB_CODE_TSC_STMT_TBNAME_ERROR);
+ }
+
+ *tbName = pStmt->bInfo.tbName;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtUpdateBindInfo(TAOS_STMT2* stmt, STableMeta* pTableMeta, void* tags, SName* tbName,
+ const char* sTableName, bool autoCreateTbl) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+ char tbFName[TSDB_TABLE_FNAME_LEN];
+ int32_t code = tNameExtractFullName(tbName, tbFName);
+ if (code != 0) {
+ return code;
+ }
+
+ (void)memcpy(&pStmt->bInfo.sname, tbName, sizeof(*tbName));
+ (void)strncpy(pStmt->bInfo.tbFName, tbFName, sizeof(pStmt->bInfo.tbFName) - 1);
+ pStmt->bInfo.tbFName[sizeof(pStmt->bInfo.tbFName) - 1] = 0;
+
+ pStmt->bInfo.tbUid = autoCreateTbl ? 0 : pTableMeta->uid;
+ pStmt->bInfo.tbSuid = pTableMeta->suid;
+ pStmt->bInfo.tbVgId = pTableMeta->vgId;
+ pStmt->bInfo.tbType = pTableMeta->tableType;
+ pStmt->bInfo.boundTags = tags;
+ pStmt->bInfo.tagsCached = false;
+ tstrncpy(pStmt->bInfo.stbFName, sTableName, sizeof(pStmt->bInfo.stbFName));
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtUpdateExecInfo(TAOS_STMT2* stmt, SHashObj* pVgHash, SHashObj* pBlockHash) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ pStmt->sql.pVgHash = pVgHash;
+ pStmt->exec.pBlockHash = pBlockHash;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtUpdateInfo(TAOS_STMT2* stmt, STableMeta* pTableMeta, void* tags, SName* tbName, bool autoCreateTbl,
+ SHashObj* pVgHash, SHashObj* pBlockHash, const char* sTableName) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_ERR_RET(stmtUpdateBindInfo(stmt, pTableMeta, tags, tbName, sTableName, autoCreateTbl));
+ STMT_ERR_RET(stmtUpdateExecInfo(stmt, pVgHash, pBlockHash));
+
+ pStmt->sql.autoCreateTbl = autoCreateTbl;
+ if (pStmt->sql.autoCreateTbl) {
+ pStmt->sql.stbInterlaceMode = false;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtGetExecInfo(TAOS_STMT2* stmt, SHashObj** pVgHash, SHashObj** pBlockHash) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ *pVgHash = pStmt->sql.pVgHash;
+ pStmt->sql.pVgHash = NULL;
+
+ *pBlockHash = pStmt->exec.pBlockHash;
+ pStmt->exec.pBlockHash = NULL;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtParseSql(STscStmt2* pStmt) {
+ pStmt->exec.pCurrBlock = NULL;
+
+ SStmtCallback stmtCb = {
+ .pStmt = pStmt,
+ .getTbNameFn = stmtGetTbName,
+ .setInfoFn = stmtUpdateInfo,
+ .getExecInfoFn = stmtGetExecInfo,
+ };
+
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+
+ pStmt->stat.parseSqlNum++;
+ STMT_ERR_RET(parseSql(pStmt->exec.pRequest, false, &pStmt->sql.pQuery, &stmtCb));
+ pStmt->sql.siInfo.pQuery = pStmt->sql.pQuery;
+
+ pStmt->bInfo.needParse = false;
+
+ if (pStmt->sql.pQuery->pRoot && 0 == pStmt->sql.type) {
+ pStmt->sql.type = STMT_TYPE_INSERT;
+ pStmt->sql.stbInterlaceMode = false;
+ } else if (pStmt->sql.pQuery->pPrepareRoot) {
+ pStmt->sql.type = STMT_TYPE_QUERY;
+ pStmt->sql.stbInterlaceMode = false;
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ STableDataCxt** pSrc =
+ (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (NULL == pSrc || NULL == *pSrc) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ STableDataCxt* pTableCtx = *pSrc;
+ if (pStmt->sql.stbInterlaceMode) {
+ int16_t lastIdx = -1;
+
+ for (int32_t i = 0; i < pTableCtx->boundColsInfo.numOfBound; ++i) {
+ if (pTableCtx->boundColsInfo.pColIndex[i] < lastIdx) {
+ pStmt->sql.stbInterlaceMode = false;
+ break;
+ }
+
+ lastIdx = pTableCtx->boundColsInfo.pColIndex[i];
+ }
+ }
+
+ if (NULL == pStmt->sql.pBindInfo) {
+ pStmt->sql.pBindInfo = taosMemoryMalloc(pTableCtx->boundColsInfo.numOfBound * sizeof(*pStmt->sql.pBindInfo));
+ if (NULL == pStmt->sql.pBindInfo) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtCleanBindInfo(STscStmt2* pStmt) {
+ pStmt->bInfo.tbUid = 0;
+ pStmt->bInfo.tbSuid = 0;
+ pStmt->bInfo.tbVgId = -1;
+ pStmt->bInfo.tbType = 0;
+ pStmt->bInfo.needParse = true;
+ pStmt->bInfo.inExecCache = false;
+
+ pStmt->bInfo.tbName[0] = 0;
+ pStmt->bInfo.tbFName[0] = 0;
+ if (!pStmt->bInfo.tagsCached) {
+ qDestroyBoundColInfo(pStmt->bInfo.boundTags);
+ taosMemoryFreeClear(pStmt->bInfo.boundTags);
+ }
+ pStmt->bInfo.stbFName[0] = 0;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static void stmtFreeTableBlkList(STableColsData* pTb) {
+ (void)qResetStmtColumns(pTb->aCol, true);
+ taosArrayDestroy(pTb->aCol);
+}
+
+static void stmtResetQueueTableBuf(STableBufInfo* pTblBuf, SStmtQueue* pQueue) {
+ pTblBuf->pCurBuff = taosArrayGetP(pTblBuf->pBufList, 0);
+ if (NULL == pTblBuf->pCurBuff) {
+ tscError("QInfo:%p, failed to get buffer from list", pTblBuf);
+ return;
+ }
+ pTblBuf->buffIdx = 1;
+ pTblBuf->buffOffset = sizeof(*pQueue->head);
+
+ pQueue->head = pQueue->tail = pTblBuf->pCurBuff;
+ pQueue->qRemainNum = 0;
+ pQueue->head->next = NULL;
+}
+
+static int32_t stmtCleanExecInfo(STscStmt2* pStmt, bool keepTable, bool deepClean) {
+ if (pStmt->sql.stbInterlaceMode) {
+ if (deepClean) {
+ taosHashCleanup(pStmt->exec.pBlockHash);
+ pStmt->exec.pBlockHash = NULL;
+
+ if (NULL != pStmt->exec.pCurrBlock) {
+ taosMemoryFreeClear(pStmt->exec.pCurrBlock->pData);
+ qDestroyStmtDataBlock(pStmt->exec.pCurrBlock);
+ }
+ } else {
+ pStmt->sql.siInfo.pTableColsIdx = 0;
+ stmtResetQueueTableBuf(&pStmt->sql.siInfo.tbBuf, &pStmt->queue);
+ }
+ } else {
+ if (STMT_TYPE_QUERY != pStmt->sql.type || deepClean) {
+ // if (!pStmt->options.asyncExecFn) {
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+ //}
+ }
+
+ size_t keyLen = 0;
+ void* pIter = taosHashIterate(pStmt->exec.pBlockHash, NULL);
+ while (pIter) {
+ STableDataCxt* pBlocks = *(STableDataCxt**)pIter;
+ char* key = taosHashGetKey(pIter, &keyLen);
+ STableMeta* pMeta = qGetTableMetaInDataBlock(pBlocks);
+
+ if (keepTable && pBlocks == pStmt->exec.pCurrBlock) {
+ TSWAP(pBlocks->pData, pStmt->exec.pCurrTbData);
+ STMT_ERR_RET(qResetStmtDataBlock(pBlocks, false));
+
+ pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
+ continue;
+ }
+
+ qDestroyStmtDataBlock(pBlocks);
+ STMT_ERR_RET(taosHashRemove(pStmt->exec.pBlockHash, key, keyLen));
+
+ pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
+ }
+
+ if (keepTable) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ taosHashCleanup(pStmt->exec.pBlockHash);
+ pStmt->exec.pBlockHash = NULL;
+
+ tDestroySubmitTbData(pStmt->exec.pCurrTbData, TSDB_MSG_FLG_ENCODE);
+ taosMemoryFreeClear(pStmt->exec.pCurrTbData);
+ }
+
+ STMT_ERR_RET(stmtCleanBindInfo(pStmt));
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static void stmtFreeTbBuf(void* buf) {
+ void* pBuf = *(void**)buf;
+ taosMemoryFree(pBuf);
+}
+
+static void stmtFreeTbCols(void* buf) {
+ SArray* pCols = *(SArray**)buf;
+ taosArrayDestroy(pCols);
+}
+
+static int32_t stmtCleanSQLInfo(STscStmt2* pStmt) {
+ STMT_DLOG_E("start to free SQL info");
+
+ taosMemoryFree(pStmt->sql.pBindInfo);
+ taosMemoryFree(pStmt->sql.queryRes.fields);
+ taosMemoryFree(pStmt->sql.queryRes.userFields);
+ taosMemoryFree(pStmt->sql.sqlStr);
+ qDestroyQuery(pStmt->sql.pQuery);
+ taosArrayDestroy(pStmt->sql.nodeList);
+ taosHashCleanup(pStmt->sql.pVgHash);
+ pStmt->sql.pVgHash = NULL;
+
+ void* pIter = taosHashIterate(pStmt->sql.pTableCache, NULL);
+ while (pIter) {
+ SStmtTableCache* pCache = (SStmtTableCache*)pIter;
+
+ qDestroyStmtDataBlock(pCache->pDataCtx);
+ qDestroyBoundColInfo(pCache->boundTags);
+ taosMemoryFreeClear(pCache->boundTags);
+
+ pIter = taosHashIterate(pStmt->sql.pTableCache, pIter);
+ }
+ taosHashCleanup(pStmt->sql.pTableCache);
+ pStmt->sql.pTableCache = NULL;
+
+ STMT_ERR_RET(stmtCleanExecInfo(pStmt, false, true));
+ STMT_ERR_RET(stmtCleanBindInfo(pStmt));
+
+ taos_free_result(pStmt->sql.siInfo.pRequest);
+ taosHashCleanup(pStmt->sql.siInfo.pVgroupHash);
+ tSimpleHashCleanup(pStmt->sql.siInfo.pTableHash);
+ taosArrayDestroyEx(pStmt->sql.siInfo.tbBuf.pBufList, stmtFreeTbBuf);
+ taosMemoryFree(pStmt->sql.siInfo.pTSchema);
+ qDestroyStmtDataBlock(pStmt->sql.siInfo.pDataCtx);
+ taosArrayDestroyEx(pStmt->sql.siInfo.pTableCols, stmtFreeTbCols);
+
+ (void)memset(&pStmt->sql, 0, sizeof(pStmt->sql));
+ pStmt->sql.siInfo.tableColsReady = true;
+
+ STMT_DLOG_E("end to free SQL info");
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtTryAddTableVgroupInfo(STscStmt2* pStmt, int32_t* vgId) {
+ if (*vgId >= 0 && taosHashGet(pStmt->sql.pVgHash, (const char*)vgId, sizeof(*vgId))) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ SVgroupInfo vgInfo = {0};
+ SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter,
+ .requestId = pStmt->exec.pRequest->requestId,
+ .requestObjRefId = pStmt->exec.pRequest->self,
+ .mgmtEps = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp)};
+
+ int32_t code = catalogGetTableHashVgroup(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &vgInfo);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+
+ code =
+ taosHashPut(pStmt->sql.pVgHash, (const char*)&vgInfo.vgId, sizeof(vgInfo.vgId), (char*)&vgInfo, sizeof(vgInfo));
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+
+ *vgId = vgInfo.vgId;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtRebuildDataBlock(STscStmt2* pStmt, STableDataCxt* pDataBlock, STableDataCxt** newBlock, uint64_t uid,
+ uint64_t suid, int32_t vgId) {
+ STMT_ERR_RET(stmtTryAddTableVgroupInfo(pStmt, &vgId));
+ STMT_ERR_RET(qRebuildStmtDataBlock(newBlock, pDataBlock, uid, suid, vgId, pStmt->sql.autoCreateTbl));
+
+ STMT_DLOG("tableDataCxt rebuilt, uid:%" PRId64 ", vgId:%d", uid, vgId);
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtGetFromCache(STscStmt2* pStmt) {
+ if (pStmt->sql.stbInterlaceMode && pStmt->sql.siInfo.pDataCtx) {
+ pStmt->bInfo.needParse = false;
+ pStmt->bInfo.inExecCache = false;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ pStmt->bInfo.needParse = true;
+ pStmt->bInfo.inExecCache = false;
+
+ STableDataCxt** pCxtInExec = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (pCxtInExec) {
+ pStmt->bInfo.needParse = false;
+ pStmt->bInfo.inExecCache = true;
+
+ pStmt->exec.pCurrBlock = *pCxtInExec;
+
+ if (pStmt->sql.autoCreateTbl) {
+ tscDebug("reuse stmt block for tb %s in execBlock", pStmt->bInfo.tbFName);
+ return TSDB_CODE_SUCCESS;
+ }
+ }
+
+ if (NULL == pStmt->pCatalog) {
+ STMT_ERR_RET(catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &pStmt->pCatalog));
+ pStmt->sql.siInfo.pCatalog = pStmt->pCatalog;
+ }
+
+ if (NULL == pStmt->sql.pTableCache || taosHashGetSize(pStmt->sql.pTableCache) <= 0) {
+ if (pStmt->bInfo.inExecCache) {
+ pStmt->bInfo.needParse = false;
+ tscDebug("reuse stmt block for tb %s in execBlock", pStmt->bInfo.tbFName);
+ return TSDB_CODE_SUCCESS;
+ }
+
+ tscDebug("no stmt block cache for tb %s", pStmt->bInfo.tbFName);
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pStmt->sql.autoCreateTbl) {
+ SStmtTableCache* pCache = taosHashGet(pStmt->sql.pTableCache, &pStmt->bInfo.tbSuid, sizeof(pStmt->bInfo.tbSuid));
+ if (pCache) {
+ pStmt->bInfo.needParse = false;
+ pStmt->bInfo.tbUid = 0;
+
+ STableDataCxt* pNewBlock = NULL;
+ STMT_ERR_RET(stmtRebuildDataBlock(pStmt, pCache->pDataCtx, &pNewBlock, 0, pStmt->bInfo.tbSuid, -1));
+
+ if (taosHashPut(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName), &pNewBlock,
+ POINTER_BYTES)) {
+ STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
+
+ pStmt->exec.pCurrBlock = pNewBlock;
+
+ tscDebug("reuse stmt block for tb %s in sqlBlock, suid:0x%" PRIx64, pStmt->bInfo.tbFName, pStmt->bInfo.tbSuid);
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ STMT_RET(stmtCleanBindInfo(pStmt));
+ }
+
+ uint64_t uid, suid;
+ int32_t vgId;
+ int8_t tableType;
+
+ STableMeta* pTableMeta = NULL;
+ SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter,
+ .requestId = pStmt->exec.pRequest->requestId,
+ .requestObjRefId = pStmt->exec.pRequest->self,
+ .mgmtEps = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp)};
+ int32_t code = catalogGetTableMeta(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &pTableMeta);
+
+ pStmt->stat.ctgGetTbMetaNum++;
+
+ if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) {
+ tscDebug("tb %s not exist", pStmt->bInfo.tbFName);
+ STMT_ERR_RET(stmtCleanBindInfo(pStmt));
+
+ STMT_ERR_RET(code);
+ }
+
+ STMT_ERR_RET(code);
+
+ uid = pTableMeta->uid;
+ suid = pTableMeta->suid;
+ tableType = pTableMeta->tableType;
+ pStmt->bInfo.tbVgId = pTableMeta->vgId;
+ vgId = pTableMeta->vgId;
+
+ taosMemoryFree(pTableMeta);
+
+ uint64_t cacheUid = (TSDB_CHILD_TABLE == tableType) ? suid : uid;
+
+ if (uid == pStmt->bInfo.tbUid) {
+ pStmt->bInfo.needParse = false;
+
+ tscDebug("tb %s is current table", pStmt->bInfo.tbFName);
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pStmt->bInfo.inExecCache) {
+ SStmtTableCache* pCache = taosHashGet(pStmt->sql.pTableCache, &cacheUid, sizeof(cacheUid));
+ if (NULL == pCache) {
+ tscError("table [%s, %" PRIx64 ", %" PRIx64 "] found in exec blockHash, but not in sql blockHash",
+ pStmt->bInfo.tbFName, uid, cacheUid);
+
+ STMT_ERR_RET(TSDB_CODE_APP_ERROR);
+ }
+
+ pStmt->bInfo.needParse = false;
+
+ pStmt->bInfo.tbUid = uid;
+ pStmt->bInfo.tbSuid = suid;
+ pStmt->bInfo.tbType = tableType;
+ pStmt->bInfo.boundTags = pCache->boundTags;
+ pStmt->bInfo.tagsCached = true;
+
+ tscDebug("tb %s in execBlock list, set to current", pStmt->bInfo.tbFName);
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ SStmtTableCache* pCache = taosHashGet(pStmt->sql.pTableCache, &cacheUid, sizeof(cacheUid));
+ if (pCache) {
+ pStmt->bInfo.needParse = false;
+
+ pStmt->bInfo.tbUid = uid;
+ pStmt->bInfo.tbSuid = suid;
+ pStmt->bInfo.tbType = tableType;
+ pStmt->bInfo.boundTags = pCache->boundTags;
+ pStmt->bInfo.tagsCached = true;
+
+ STableDataCxt* pNewBlock = NULL;
+ STMT_ERR_RET(stmtRebuildDataBlock(pStmt, pCache->pDataCtx, &pNewBlock, uid, suid, vgId));
+
+ if (taosHashPut(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName), &pNewBlock,
+ POINTER_BYTES)) {
+ STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
+
+ pStmt->exec.pCurrBlock = pNewBlock;
+
+ tscDebug("tb %s in sqlBlock list, set to current", pStmt->bInfo.tbFName);
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ STMT_ERR_RET(stmtCleanBindInfo(pStmt));
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtResetStmt(STscStmt2* pStmt) {
+ STMT_ERR_RET(stmtCleanSQLInfo(pStmt));
+
+ pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
+ if (NULL == pStmt->sql.pTableCache) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ STMT_ERR_RET(terrno);
+ }
+
+ pStmt->sql.status = STMT_INIT;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtAsyncOutput(STscStmt2* pStmt, void* param) {
+ SStmtQNode* pParam = (SStmtQNode*)param;
+
+ if (pParam->restoreTbCols) {
+ for (int32_t i = 0; i < pStmt->sql.siInfo.pTableColsIdx; ++i) {
+ SArray** p = (SArray**)TARRAY_GET_ELEM(pStmt->sql.siInfo.pTableCols, i);
+ *p = taosArrayInit(20, POINTER_BYTES);
+ if (*p == NULL) {
+ STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
+ }
+
+ atomic_store_8((int8_t*)&pStmt->sql.siInfo.tableColsReady, true);
+ } else {
+ STMT_ERR_RET(qAppendStmtTableOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, &pParam->tblData, pStmt->exec.pCurrBlock,
+ &pStmt->sql.siInfo));
+
+ // taosMemoryFree(pParam->pTbData);
+
+ (void)atomic_sub_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static void* stmtBindThreadFunc(void* param) {
+ setThreadName("stmtBind");
+
+ qInfo("stmt bind thread started");
+
+ STscStmt2* pStmt = (STscStmt2*)param;
+
+ while (true) {
+ if (atomic_load_8((int8_t*)&pStmt->queue.stopQueue)) {
+ break;
+ }
+
+ SStmtQNode* asyncParam = NULL;
+ if (!stmtDequeue(pStmt, &asyncParam)) {
+ continue;
+ }
+
+ (void)stmtAsyncOutput(pStmt, asyncParam);
+ }
+
+ qInfo("stmt bind thread stopped");
+
+ return NULL;
+}
+
+static int32_t stmtStartBindThread(STscStmt2* pStmt) {
+ TdThreadAttr thAttr;
+ if (taosThreadAttrInit(&thAttr) != 0) {
+ return TSDB_CODE_TSC_INTERNAL_ERROR;
+ }
+ if (taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE) != 0) {
+ return TSDB_CODE_TSC_INTERNAL_ERROR;
+ }
+
+ if (taosThreadCreate(&pStmt->bindThread, &thAttr, stmtBindThreadFunc, pStmt) != 0) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ STMT_ERR_RET(terrno);
+ }
+
+ pStmt->bindThreadInUse = true;
+
+ (void)taosThreadAttrDestroy(&thAttr);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtInitQueue(STscStmt2* pStmt) {
+ STMT_ERR_RET(stmtAllocQNodeFromBuf(&pStmt->sql.siInfo.tbBuf, (void**)&pStmt->queue.head));
+ pStmt->queue.tail = pStmt->queue.head;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtInitTableBuf(STableBufInfo* pTblBuf) {
+ pTblBuf->buffUnit = sizeof(SStmtQNode);
+ pTblBuf->buffSize = pTblBuf->buffUnit * 1000;
+ pTblBuf->pBufList = taosArrayInit(100, POINTER_BYTES);
+ if (NULL == pTblBuf->pBufList) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ void* buff = taosMemoryMalloc(pTblBuf->buffSize);
+ if (NULL == buff) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ if (taosArrayPush(pTblBuf->pBufList, &buff) == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pTblBuf->pCurBuff = buff;
+ pTblBuf->buffIdx = 1;
+ pTblBuf->buffOffset = 0;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+TAOS_STMT2* stmtInit2(STscObj* taos, TAOS_STMT2_OPTION* pOptions) {
+ STscObj* pObj = (STscObj*)taos;
+ STscStmt2* pStmt = NULL;
+ int32_t code = 0;
+
+ pStmt = taosMemoryCalloc(1, sizeof(STscStmt2));
+ if (NULL == pStmt) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ pStmt->sql.pTableCache = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
+ if (NULL == pStmt->sql.pTableCache) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ taosMemoryFree(pStmt);
+ return NULL;
+ }
+
+ pStmt->taos = pObj;
+ pStmt->bInfo.needParse = true;
+ pStmt->sql.status = STMT_INIT;
+ pStmt->errCode = TSDB_CODE_SUCCESS;
+
+ if (NULL != pOptions) {
+ (void)memcpy(&pStmt->options, pOptions, sizeof(pStmt->options));
+ if (pOptions->singleStbInsert && pOptions->singleTableBindOnce) {
+ pStmt->stbInterlaceMode = true;
+ }
+
+ pStmt->reqid = pOptions->reqid;
+ }
+
+ if (pStmt->stbInterlaceMode) {
+ pStmt->sql.siInfo.transport = taos->pAppInfo->pTransporter;
+ pStmt->sql.siInfo.acctId = taos->acctId;
+ pStmt->sql.siInfo.dbname = taos->db;
+ pStmt->sql.siInfo.mgmtEpSet = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp);
+ pStmt->sql.siInfo.pTableHash = tSimpleHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY));
+ if (NULL == pStmt->sql.siInfo.pTableHash) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ (void)stmtClose(pStmt);
+ return NULL;
+ }
+ pStmt->sql.siInfo.pTableCols = taosArrayInit(STMT_TABLE_COLS_NUM, POINTER_BYTES);
+ if (NULL == pStmt->sql.siInfo.pTableCols) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ (void)stmtClose(pStmt);
+ return NULL;
+ }
+
+ code = stmtInitTableBuf(&pStmt->sql.siInfo.tbBuf);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = stmtInitQueue(pStmt);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = stmtStartBindThread(pStmt);
+ }
+ if (TSDB_CODE_SUCCESS != code) {
+ terrno = code;
+ (void)stmtClose(pStmt);
+ return NULL;
+ }
+ }
+
+ pStmt->sql.siInfo.tableColsReady = true;
+ if (pStmt->options.asyncExecFn) {
+ (void)tsem_init(&pStmt->asyncQuerySem, 0, 1);
+ }
+
+ STMT_LOG_SEQ(STMT_INIT);
+
+ tscDebug("stmt:%p initialized", pStmt);
+
+ return pStmt;
+}
+
+static int stmtSetDbName2(TAOS_STMT2* stmt, const char* dbName) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG("start to set dbName: %s", dbName);
+
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+
+ // The SQL statement specifies a database name, overriding the previously specified database
+ taosMemoryFreeClear(pStmt->exec.pRequest->pDb);
+ pStmt->exec.pRequest->pDb = taosStrdup(dbName);
+ if (pStmt->exec.pRequest->pDb == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+int stmtPrepare2(TAOS_STMT2* stmt, const char* sql, unsigned long length) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start to prepare");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ if (pStmt->sql.status >= STMT_PREPARE) {
+ STMT_ERR_RET(stmtResetStmt(pStmt));
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_PREPARE));
+
+ if (length <= 0) {
+ length = strlen(sql);
+ }
+
+ pStmt->sql.sqlStr = strndup(sql, length);
+ pStmt->sql.sqlLen = length;
+ pStmt->sql.stbInterlaceMode = pStmt->stbInterlaceMode;
+
+ char* dbName = NULL;
+ if (qParseDbName(sql, length, &dbName)) {
+ STMT_ERR_RET(stmtSetDbName2(stmt, dbName));
+ taosMemoryFreeClear(dbName);
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtInitStbInterlaceTableInfo(STscStmt2* pStmt) {
+ STableDataCxt** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (!pSrc) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ STableDataCxt* pDst = NULL;
+
+ STMT_ERR_RET(qCloneStmtDataBlock(&pDst, *pSrc, true));
+ pStmt->sql.siInfo.pDataCtx = pDst;
+
+ SArray* pTblCols = NULL;
+ for (int32_t i = 0; i < STMT_TABLE_COLS_NUM; i++) {
+ pTblCols = taosArrayInit(20, POINTER_BYTES);
+ if (NULL == pTblCols) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ pStmt->sql.siInfo.boundTags = pStmt->bInfo.boundTags;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int stmtIsInsert2(TAOS_STMT2* stmt, int* insert) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start is insert");
+
+ if (pStmt->sql.type) {
+ *insert = (STMT_TYPE_INSERT == pStmt->sql.type || STMT_TYPE_MULTI_INSERT == pStmt->sql.type);
+ } else {
+ *insert = qIsInsertValuesSql(pStmt->sql.sqlStr, pStmt->sql.sqlLen);
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int stmtSetTbName2(TAOS_STMT2* stmt, const char* tbName) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ int64_t startUs = taosGetTimestampUs();
+
+ STMT_DLOG("start to set tbName: %s", tbName);
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTBNAME));
+
+ int32_t insert = 0;
+ STMT_ERR_RET(stmtIsInsert2(stmt, &insert));
+ if (0 == insert) {
+ tscError("set tb name not available for none insert statement");
+ STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR);
+ }
+
+ if (!pStmt->sql.stbInterlaceMode || NULL == pStmt->sql.siInfo.pDataCtx) {
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+
+ STMT_ERR_RET(qCreateSName(&pStmt->bInfo.sname, tbName, pStmt->taos->acctId, pStmt->exec.pRequest->pDb,
+ pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen));
+ STMT_ERR_RET(tNameExtractFullName(&pStmt->bInfo.sname, pStmt->bInfo.tbFName));
+
+ STMT_ERR_RET(stmtGetFromCache(pStmt));
+
+ if (pStmt->bInfo.needParse) {
+ (void)strncpy(pStmt->bInfo.tbName, tbName, sizeof(pStmt->bInfo.tbName) - 1);
+ pStmt->bInfo.tbName[sizeof(pStmt->bInfo.tbName) - 1] = 0;
+
+ STMT_ERR_RET(stmtParseSql(pStmt));
+ }
+ } else {
+ (void)strncpy(pStmt->bInfo.tbName, tbName, sizeof(pStmt->bInfo.tbName) - 1);
+ pStmt->bInfo.tbName[sizeof(pStmt->bInfo.tbName) - 1] = 0;
+ pStmt->exec.pRequest->requestId++;
+ pStmt->bInfo.needParse = false;
+ }
+
+ if (pStmt->sql.stbInterlaceMode && NULL == pStmt->sql.siInfo.pDataCtx) {
+ STMT_ERR_RET(stmtInitStbInterlaceTableInfo(pStmt));
+ }
+
+ int64_t startUs2 = taosGetTimestampUs();
+ pStmt->stat.setTbNameUs += startUs2 - startUs;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int stmtSetTbTags2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* tags) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start to set tbTags");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTAGS));
+
+ SBoundColInfo* tags_info = (SBoundColInfo*)pStmt->bInfo.boundTags;
+ if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) {
+ tscWarn("no tags or cols bound in sql, will not bound tags");
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pStmt->bInfo.inExecCache) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ STableDataCxt** pDataBlock =
+ (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (NULL == pDataBlock) {
+ tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
+ STMT_ERR_RET(TSDB_CODE_APP_ERROR);
+ }
+
+ tscDebug("start to bind stmt tag values");
+ STMT_ERR_RET(qBindStmtTagsValue2(*pDataBlock, pStmt->bInfo.boundTags, pStmt->bInfo.tbSuid, pStmt->bInfo.stbFName,
+ pStmt->bInfo.sname.tname, tags, pStmt->exec.pRequest->msgBuf,
+ pStmt->exec.pRequest->msgBufLen));
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int stmtFetchTagFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields) {
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ tscError("invalid operation to get query tag fileds");
+ STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR);
+ }
+
+ STableDataCxt** pDataBlock =
+ (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (NULL == pDataBlock) {
+ tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
+ STMT_ERR_RET(TSDB_CODE_APP_ERROR);
+ }
+
+ STMT_ERR_RET(qBuildStmtTagFields(*pDataBlock, pStmt->bInfo.boundTags, fieldNum, fields));
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int stmtFetchColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields) {
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ tscError("invalid operation to get query column fileds");
+ STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR);
+ }
+
+ STableDataCxt** pDataBlock = NULL;
+
+ if (pStmt->sql.stbInterlaceMode) {
+ pDataBlock = &pStmt->sql.siInfo.pDataCtx;
+ } else {
+ pDataBlock =
+ (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (NULL == pDataBlock) {
+ tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
+ STMT_ERR_RET(TSDB_CODE_APP_ERROR);
+ }
+ }
+
+ STMT_ERR_RET(qBuildStmtColFields(*pDataBlock, fieldNum, fields));
+
+ return TSDB_CODE_SUCCESS;
+}
+/*
+SArray* stmtGetFreeCol(STscStmt2* pStmt, int32_t* idx) {
+ while (true) {
+ if (pStmt->exec.smInfo.pColIdx >= STMT_COL_BUF_SIZE) {
+ pStmt->exec.smInfo.pColIdx = 0;
+ }
+
+ if ((pStmt->exec.smInfo.pColIdx + 1) == atomic_load_32(&pStmt->exec.smInfo.pColFreeIdx)) {
+ taosUsleep(1);
+ continue;
+ }
+
+ *idx = pStmt->exec.smInfo.pColIdx;
+ return pStmt->exec.smInfo.pCols[pStmt->exec.smInfo.pColIdx++];
+ }
+}
+*/
+static int32_t stmtAppendTablePostHandle(STscStmt2* pStmt, SStmtQNode* param) {
+ if (NULL == pStmt->sql.siInfo.pVgroupHash) {
+ pStmt->sql.siInfo.pVgroupHash =
+ taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
+ }
+ if (NULL == pStmt->sql.siInfo.pVgroupList) {
+ pStmt->sql.siInfo.pVgroupList = taosArrayInit(64, POINTER_BYTES);
+ }
+
+ if (NULL == pStmt->sql.siInfo.pRequest) {
+ STMT_ERR_RET(buildRequest(pStmt->taos->id, pStmt->sql.sqlStr, pStmt->sql.sqlLen, NULL, false,
+ (SRequestObj**)&pStmt->sql.siInfo.pRequest, pStmt->reqid));
+
+ if (pStmt->reqid != 0) {
+ pStmt->reqid++;
+ }
+ pStmt->exec.pRequest->syncQuery = true;
+
+ pStmt->sql.siInfo.requestId = ((SRequestObj*)pStmt->sql.siInfo.pRequest)->requestId;
+ pStmt->sql.siInfo.requestSelf = ((SRequestObj*)pStmt->sql.siInfo.pRequest)->self;
+ }
+
+ if (!pStmt->sql.siInfo.tbFromHash && pStmt->sql.siInfo.firstName[0] &&
+ 0 == strcmp(pStmt->sql.siInfo.firstName, pStmt->bInfo.tbName)) {
+ pStmt->sql.siInfo.tbFromHash = true;
+ }
+
+ if (0 == pStmt->sql.siInfo.firstName[0]) {
+ (void)strcpy(pStmt->sql.siInfo.firstName, pStmt->bInfo.tbName);
+ }
+
+ param->tblData.getFromHash = pStmt->sql.siInfo.tbFromHash;
+ param->next = NULL;
+
+ (void)atomic_add_fetch_64(&pStmt->sql.siInfo.tbRemainNum, 1);
+
+ stmtEnqueue(pStmt, param);
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static FORCE_INLINE int32_t stmtGetTableColsFromCache(STscStmt2* pStmt, SArray** pTableCols) {
+ while (true) {
+ if (pStmt->sql.siInfo.pTableColsIdx < taosArrayGetSize(pStmt->sql.siInfo.pTableCols)) {
+ *pTableCols = (SArray*)taosArrayGetP(pStmt->sql.siInfo.pTableCols, pStmt->sql.siInfo.pTableColsIdx++);
+ break;
+ } else {
+ SArray* pTblCols = NULL;
+ for (int32_t i = 0; i < 100; i++) {
+ pTblCols = taosArrayInit(20, POINTER_BYTES);
+ if (NULL == pTblCols) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ if (taosArrayPush(pStmt->sql.siInfo.pTableCols, &pTblCols) == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtCacheBlock(STscStmt2* pStmt) {
+ if (pStmt->sql.type != STMT_TYPE_MULTI_INSERT) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ uint64_t uid = pStmt->bInfo.tbUid;
+ uint64_t cacheUid = (TSDB_CHILD_TABLE == pStmt->bInfo.tbType) ? pStmt->bInfo.tbSuid : uid;
+
+ if (taosHashGet(pStmt->sql.pTableCache, &cacheUid, sizeof(cacheUid))) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ STableDataCxt** pSrc = taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (!pSrc) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ STableDataCxt* pDst = NULL;
+
+ STMT_ERR_RET(qCloneStmtDataBlock(&pDst, *pSrc, true));
+
+ SStmtTableCache cache = {
+ .pDataCtx = pDst,
+ .boundTags = pStmt->bInfo.boundTags,
+ };
+
+ if (taosHashPut(pStmt->sql.pTableCache, &cacheUid, sizeof(cacheUid), &cache, sizeof(cache))) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ if (pStmt->sql.autoCreateTbl) {
+ pStmt->bInfo.tagsCached = true;
+ } else {
+ pStmt->bInfo.boundTags = NULL;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int stmtAddBatch2(TAOS_STMT2* stmt) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ int64_t startUs = taosGetTimestampUs();
+
+ STMT_DLOG_E("start to add batch");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_ADD_BATCH));
+
+ if (pStmt->sql.stbInterlaceMode) {
+ int64_t startUs2 = taosGetTimestampUs();
+ pStmt->stat.addBatchUs += startUs2 - startUs;
+
+ pStmt->sql.siInfo.tableColsReady = false;
+
+ SStmtQNode* param = NULL;
+ STMT_ERR_RET(stmtAllocQNodeFromBuf(&pStmt->sql.siInfo.tbBuf, (void**)¶m));
+ param->restoreTbCols = true;
+ param->next = NULL;
+
+ stmtEnqueue(pStmt, param);
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ STMT_ERR_RET(stmtCacheBlock(pStmt));
+
+ return TSDB_CODE_SUCCESS;
+}
+/*
+static int32_t stmtBackupQueryFields(STscStmt2* pStmt) {
+ SStmtQueryResInfo* pRes = &pStmt->sql.queryRes;
+ pRes->numOfCols = pStmt->exec.pRequest->body.resInfo.numOfCols;
+ pRes->precision = pStmt->exec.pRequest->body.resInfo.precision;
+
+ int32_t size = pRes->numOfCols * sizeof(TAOS_FIELD);
+ pRes->fields = taosMemoryMalloc(size);
+ pRes->userFields = taosMemoryMalloc(size);
+ if (NULL == pRes->fields || NULL == pRes->userFields) {
+ STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
+ (void)memcpy(pRes->fields, pStmt->exec.pRequest->body.resInfo.fields, size);
+ (void)memcpy(pRes->userFields, pStmt->exec.pRequest->body.resInfo.userFields, size);
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t stmtRestoreQueryFields(STscStmt2* pStmt) {
+ SStmtQueryResInfo* pRes = &pStmt->sql.queryRes;
+ int32_t size = pRes->numOfCols * sizeof(TAOS_FIELD);
+
+ pStmt->exec.pRequest->body.resInfo.numOfCols = pRes->numOfCols;
+ pStmt->exec.pRequest->body.resInfo.precision = pRes->precision;
+
+ if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
+ pStmt->exec.pRequest->body.resInfo.fields = taosMemoryMalloc(size);
+ if (NULL == pStmt->exec.pRequest->body.resInfo.fields) {
+ STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
+ (void)memcpy(pStmt->exec.pRequest->body.resInfo.fields, pRes->fields, size);
+ }
+
+ if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
+ pStmt->exec.pRequest->body.resInfo.userFields = taosMemoryMalloc(size);
+ if (NULL == pStmt->exec.pRequest->body.resInfo.userFields) {
+ STMT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
+ (void)memcpy(pStmt->exec.pRequest->body.resInfo.userFields, pRes->userFields, size);
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+*/
+int stmtBindBatch2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* bind, int32_t colIdx) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+ int32_t code = 0;
+
+ int64_t startUs = taosGetTimestampUs();
+
+ STMT_DLOG("start to bind stmt data, colIdx: %d", colIdx);
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_BIND));
+
+ if (pStmt->options.asyncExecFn) {
+ (void)tsem_wait(&pStmt->asyncQuerySem);
+ }
+
+ if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
+ STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
+ pStmt->bInfo.needParse = false;
+ }
+
+ if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) {
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+ }
+
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+
+ if (pStmt->bInfo.needParse) {
+ STMT_ERR_RET(stmtParseSql(pStmt));
+ }
+
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ STMT_ERR_RET(qStmtBindParams2(pStmt->sql.pQuery, bind, colIdx));
+
+ SParseContext ctx = {.requestId = pStmt->exec.pRequest->requestId,
+ .acctId = pStmt->taos->acctId,
+ .db = pStmt->exec.pRequest->pDb,
+ .topicQuery = false,
+ .pSql = pStmt->sql.sqlStr,
+ .sqlLen = pStmt->sql.sqlLen,
+ .pMsg = pStmt->exec.pRequest->msgBuf,
+ .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE,
+ .pTransporter = pStmt->taos->pAppInfo->pTransporter,
+ .pStmtCb = NULL,
+ .pUser = pStmt->taos->user};
+ ctx.mgmtEpSet = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp);
+ STMT_ERR_RET(catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &ctx.pCatalog));
+
+ STMT_ERR_RET(qStmtParseQuerySql(&ctx, pStmt->sql.pQuery));
+
+ if (pStmt->sql.pQuery->haveResultSet) {
+ STMT_ERR_RET(setResSchemaInfo(&pStmt->exec.pRequest->body.resInfo, pStmt->sql.pQuery->pResSchema,
+ pStmt->sql.pQuery->numOfResCols));
+ taosMemoryFreeClear(pStmt->sql.pQuery->pResSchema);
+ setResPrecision(&pStmt->exec.pRequest->body.resInfo, pStmt->sql.pQuery->precision);
+ }
+
+ TSWAP(pStmt->exec.pRequest->dbList, pStmt->sql.pQuery->pDbList);
+ TSWAP(pStmt->exec.pRequest->tableList, pStmt->sql.pQuery->pTableList);
+ TSWAP(pStmt->exec.pRequest->targetTableList, pStmt->sql.pQuery->pTargetTableList);
+
+ // if (STMT_TYPE_QUERY == pStmt->sql.queryRes) {
+ // STMT_ERR_RET(stmtRestoreQueryFields(pStmt));
+ // }
+
+ // STMT_ERR_RET(stmtBackupQueryFields(pStmt));
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pStmt->sql.stbInterlaceMode && NULL == pStmt->sql.siInfo.pDataCtx) {
+ STMT_ERR_RET(stmtInitStbInterlaceTableInfo(pStmt));
+ }
+
+ STableDataCxt** pDataBlock = NULL;
+
+ if (pStmt->exec.pCurrBlock) {
+ pDataBlock = &pStmt->exec.pCurrBlock;
+ } else {
+ pDataBlock =
+ (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
+ if (NULL == pDataBlock) {
+ tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName);
+ STMT_ERR_RET(TSDB_CODE_TSC_STMT_CACHE_ERROR);
+ }
+ pStmt->exec.pCurrBlock = *pDataBlock;
+ if (pStmt->sql.stbInterlaceMode) {
+ taosArrayDestroy(pStmt->exec.pCurrBlock->pData->aCol);
+ pStmt->exec.pCurrBlock->pData->aCol = NULL;
+ }
+ }
+
+ int64_t startUs2 = taosGetTimestampUs();
+ pStmt->stat.bindDataUs1 += startUs2 - startUs;
+
+ SStmtQNode* param = NULL;
+ if (pStmt->sql.stbInterlaceMode) {
+ STMT_ERR_RET(stmtAllocQNodeFromBuf(&pStmt->sql.siInfo.tbBuf, (void**)¶m));
+ STMT_ERR_RET(stmtGetTableColsFromCache(pStmt, ¶m->tblData.aCol));
+ taosArrayClear(param->tblData.aCol);
+
+ // param->tblData.aCol = taosArrayInit(20, POINTER_BYTES);
+
+ param->restoreTbCols = false;
+ (void)strcpy(param->tblData.tbName, pStmt->bInfo.tbName);
+ }
+
+ int64_t startUs3 = taosGetTimestampUs();
+ pStmt->stat.bindDataUs2 += startUs3 - startUs2;
+
+ SArray* pCols = pStmt->sql.stbInterlaceMode ? param->tblData.aCol : (*pDataBlock)->pData->aCol;
+
+ if (colIdx < 0) {
+ if (pStmt->sql.stbInterlaceMode) {
+ (*pDataBlock)->pData->flags = 0;
+ code = qBindStmtStbColsValue2(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf,
+ pStmt->exec.pRequest->msgBufLen, &pStmt->sql.siInfo.pTSchema, pStmt->sql.pBindInfo);
+ } else {
+ code =
+ qBindStmtColsValue2(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen);
+ }
+
+ if (code) {
+ tscError("qBindStmtColsValue failed, error:%s", tstrerror(code));
+ STMT_ERR_RET(code);
+ }
+ } else {
+ if (pStmt->sql.stbInterlaceMode) {
+ tscError("bind single column not allowed in stb insert mode");
+ STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR);
+ }
+
+ if (colIdx != (pStmt->bInfo.sBindLastIdx + 1) && colIdx != 0) {
+ tscError("bind column index not in sequence");
+ STMT_ERR_RET(TSDB_CODE_APP_ERROR);
+ }
+
+ pStmt->bInfo.sBindLastIdx = colIdx;
+
+ if (0 == colIdx) {
+ pStmt->bInfo.sBindRowNum = bind->num;
+ }
+
+ code = qBindStmtSingleColValue2(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf,
+ pStmt->exec.pRequest->msgBufLen, colIdx, pStmt->bInfo.sBindRowNum);
+ if (code) {
+ tscError("qBindStmtSingleColValue failed, error:%s", tstrerror(code));
+ STMT_ERR_RET(code);
+ }
+ }
+
+ int64_t startUs4 = taosGetTimestampUs();
+ pStmt->stat.bindDataUs3 += startUs4 - startUs3;
+
+ if (pStmt->sql.stbInterlaceMode) {
+ STMT_ERR_RET(stmtAppendTablePostHandle(pStmt, param));
+ }
+
+ STMT_ERR_RET(stmtAddBatch2(pStmt));
+
+ pStmt->stat.bindDataUs4 += taosGetTimestampUs() - startUs4;
+
+ return TSDB_CODE_SUCCESS;
+}
+/*
+int stmtUpdateTableUid(STscStmt2* pStmt, SSubmitRsp* pRsp) {
+ tscDebug("stmt start to update tbUid, blockNum: %d", pRsp->nBlocks);
+
+ int32_t code = 0;
+ int32_t finalCode = 0;
+ size_t keyLen = 0;
+ void* pIter = taosHashIterate(pStmt->exec.pBlockHash, NULL);
+ while (pIter) {
+ STableDataCxt* pBlock = *(STableDataCxt**)pIter;
+ char* key = taosHashGetKey(pIter, &keyLen);
+
+ STableMeta* pMeta = qGetTableMetaInDataBlock(pBlock);
+ if (pMeta->uid) {
+ pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
+ continue;
+ }
+
+ SSubmitBlkRsp* blkRsp = NULL;
+ int32_t i = 0;
+ for (; i < pRsp->nBlocks; ++i) {
+ blkRsp = pRsp->pBlocks + i;
+ if (strlen(blkRsp->tblFName) != keyLen) {
+ continue;
+ }
+
+ if (strncmp(blkRsp->tblFName, key, keyLen)) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (i < pRsp->nBlocks) {
+ tscDebug("auto created table %s uid updated from %" PRIx64 " to %" PRIx64, blkRsp->tblFName, pMeta->uid,
+ blkRsp->uid);
+
+ pMeta->uid = blkRsp->uid;
+ pStmt->bInfo.tbUid = blkRsp->uid;
+ } else {
+ tscDebug("table %s not found in submit rsp, will update from catalog", pStmt->bInfo.tbFName);
+ if (NULL == pStmt->pCatalog) {
+ code = catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &pStmt->pCatalog);
+ if (code) {
+ pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
+ finalCode = code;
+ continue;
+ }
+ }
+
+ code = stmtCreateRequest(pStmt);
+ if (code) {
+ pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
+ finalCode = code;
+ continue;
+ }
+
+ STableMeta* pTableMeta = NULL;
+ SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter,
+ .requestId = pStmt->exec.pRequest->requestId,
+ .requestObjRefId = pStmt->exec.pRequest->self,
+ .mgmtEps = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp)};
+ code = catalogGetTableMeta(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &pTableMeta);
+
+ pStmt->stat.ctgGetTbMetaNum++;
+
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+
+ if (code || NULL == pTableMeta) {
+ pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
+ finalCode = code;
+ taosMemoryFree(pTableMeta);
+ continue;
+ }
+
+ pMeta->uid = pTableMeta->uid;
+ pStmt->bInfo.tbUid = pTableMeta->uid;
+ taosMemoryFree(pTableMeta);
+ }
+
+ pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
+ }
+
+ return finalCode;
+}
+*/
+/*
+int stmtStaticModeExec(TAOS_STMT* stmt) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+ int32_t code = 0;
+ SSubmitRsp* pRsp = NULL;
+ if (pStmt->sql.staticMode) {
+ return TSDB_CODE_TSC_STMT_API_ERROR;
+ }
+
+ STMT_DLOG_E("start to exec");
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_EXECUTE));
+
+ STMT_ERR_RET(qBuildStmtOutputFromTbList(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->exec.pTbBlkList,
+pStmt->exec.pCurrBlock, pStmt->exec.tbBlkNum));
+
+ launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL);
+
+ if (pStmt->exec.pRequest->code && NEED_CLIENT_HANDLE_ERROR(pStmt->exec.pRequest->code)) {
+ code = refreshMeta(pStmt->exec.pRequest->pTscObj, pStmt->exec.pRequest);
+ if (code) {
+ pStmt->exec.pRequest->code = code;
+ } else {
+ tFreeSSubmitRsp(pRsp);
+ STMT_ERR_RET(stmtResetStmt(pStmt));
+ STMT_ERR_RET(TSDB_CODE_NEED_RETRY);
+ }
+ }
+
+ STMT_ERR_JRET(pStmt->exec.pRequest->code);
+
+ pStmt->exec.affectedRows = taos_affected_rows(pStmt->exec.pRequest);
+ pStmt->affectedRows += pStmt->exec.affectedRows;
+
+_return:
+
+ stmtCleanExecInfo(pStmt, (code ? false : true), false);
+
+ tFreeSSubmitRsp(pRsp);
+
+ ++pStmt->sql.runTimes;
+
+ STMT_RET(code);
+}
+*/
+
+static int32_t createParseContext(const SRequestObj* pRequest, SParseContext** pCxt, SSqlCallbackWrapper* pWrapper) {
+ const STscObj* pTscObj = pRequest->pTscObj;
+
+ *pCxt = taosMemoryCalloc(1, sizeof(SParseContext));
+ if (*pCxt == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ **pCxt = (SParseContext){.requestId = pRequest->requestId,
+ .requestRid = pRequest->self,
+ .acctId = pTscObj->acctId,
+ .db = pRequest->pDb,
+ .topicQuery = false,
+ .pSql = pRequest->sqlstr,
+ .sqlLen = pRequest->sqlLen,
+ .pMsg = pRequest->msgBuf,
+ .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE,
+ .pTransporter = pTscObj->pAppInfo->pTransporter,
+ .pStmtCb = NULL,
+ .pUser = pTscObj->user,
+ .pEffectiveUser = pRequest->effectiveUser,
+ .isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)),
+ .enableSysInfo = pTscObj->sysInfo,
+ .async = true,
+ .svrVer = pTscObj->sVer,
+ .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes),
+ .allocatorId = pRequest->allocatorRefId,
+ .parseSqlFp = clientParseSql,
+ .parseSqlParam = pWrapper};
+ int8_t biMode = atomic_load_8(&((STscObj*)pTscObj)->biMode);
+ (*pCxt)->biMode = biMode;
+ return TSDB_CODE_SUCCESS;
+}
+
+static void asyncQueryCb(void* userdata, TAOS_RES* res, int code) {
+ STscStmt2* pStmt = userdata;
+ __taos_async_fn_t fp = pStmt->options.asyncExecFn;
+
+ pStmt->exec.affectedRows = taos_affected_rows(pStmt->exec.pRequest);
+ pStmt->affectedRows += pStmt->exec.affectedRows;
+
+ fp(pStmt->options.userdata, res, code);
+
+ while (0 == atomic_load_8((int8_t*)&pStmt->sql.siInfo.tableColsReady)) {
+ taosUsleep(1);
+ }
+ (void)stmtCleanExecInfo(pStmt, (code ? false : true), false);
+ ++pStmt->sql.runTimes;
+
+ (void)tsem_post(&pStmt->asyncQuerySem);
+}
+
+int stmtExec2(TAOS_STMT2* stmt, int* affected_rows) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+ int32_t code = 0;
+ int64_t startUs = taosGetTimestampUs();
+
+ STMT_DLOG_E("start to exec");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_EXECUTE));
+
+ if (STMT_TYPE_QUERY != pStmt->sql.type) {
+ if (pStmt->sql.stbInterlaceMode) {
+ int64_t startTs = taosGetTimestampUs();
+ while (atomic_load_64(&pStmt->sql.siInfo.tbRemainNum)) {
+ taosUsleep(1);
+ }
+ pStmt->stat.execWaitUs += taosGetTimestampUs() - startTs;
+
+ STMT_ERR_RET(qBuildStmtFinOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->sql.siInfo.pVgroupList));
+ taosHashCleanup(pStmt->sql.siInfo.pVgroupHash);
+ pStmt->sql.siInfo.pVgroupHash = NULL;
+ pStmt->sql.siInfo.pVgroupList = NULL;
+ } else {
+ tDestroySubmitTbData(pStmt->exec.pCurrTbData, TSDB_MSG_FLG_ENCODE);
+ taosMemoryFreeClear(pStmt->exec.pCurrTbData);
+
+ STMT_ERR_RET(qCloneCurrentTbData(pStmt->exec.pCurrBlock, &pStmt->exec.pCurrTbData));
+
+ STMT_ERR_RET(qBuildStmtOutput(pStmt->sql.pQuery, pStmt->sql.pVgHash, pStmt->exec.pBlockHash));
+ }
+ }
+
+ SRequestObj* pRequest = pStmt->exec.pRequest;
+ __taos_async_fn_t fp = pStmt->options.asyncExecFn;
+
+ if (!fp) {
+ (void)launchQueryImpl(pStmt->exec.pRequest, pStmt->sql.pQuery, true, NULL);
+
+ if (pStmt->exec.pRequest->code && NEED_CLIENT_HANDLE_ERROR(pStmt->exec.pRequest->code)) {
+ code = refreshMeta(pStmt->exec.pRequest->pTscObj, pStmt->exec.pRequest);
+ if (code) {
+ pStmt->exec.pRequest->code = code;
+ } else {
+ STMT_ERR_RET(stmtResetStmt(pStmt));
+ STMT_ERR_RET(TSDB_CODE_NEED_RETRY);
+ }
+ }
+
+ STMT_ERR_JRET(pStmt->exec.pRequest->code);
+
+ pStmt->exec.affectedRows = taos_affected_rows(pStmt->exec.pRequest);
+ if (affected_rows) {
+ *affected_rows = pStmt->exec.affectedRows;
+ }
+ pStmt->affectedRows += pStmt->exec.affectedRows;
+
+ while (0 == atomic_load_8((int8_t*)&pStmt->sql.siInfo.tableColsReady)) {
+ taosUsleep(1);
+ }
+
+ STMT_ERR_RET(stmtCleanExecInfo(pStmt, (code ? false : true), false));
+
+ ++pStmt->sql.runTimes;
+
+ } else {
+ SSqlCallbackWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
+ if (pWrapper == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ } else {
+ pWrapper->pRequest = pRequest;
+ pRequest->pWrapper = pWrapper;
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = createParseContext(pRequest, &pWrapper->pParseCtx, pWrapper);
+ }
+ pRequest->syncQuery = false;
+ pRequest->body.queryFp = asyncQueryCb;
+ ((SSyncQueryParam*)(pRequest)->body.interParam)->userParam = pStmt;
+
+ launchAsyncQuery(pRequest, pStmt->sql.pQuery, NULL, pWrapper);
+ }
+
+_return:
+ pStmt->stat.execUseUs += taosGetTimestampUs() - startUs;
+
+ STMT_RET(code);
+}
+
+int stmtClose2(TAOS_STMT2* stmt) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start to free stmt");
+
+ pStmt->queue.stopQueue = true;
+
+ if (pStmt->bindThreadInUse) {
+ (void)taosThreadJoin(pStmt->bindThread, NULL);
+ pStmt->bindThreadInUse = false;
+ }
+
+ STMT_DLOG("stmt %p closed, stbInterlaceMode: %d, statInfo: ctgGetTbMetaNum=>%" PRId64 ", getCacheTbInfo=>%" PRId64
+ ", parseSqlNum=>%" PRId64 ", pStmt->stat.bindDataNum=>%" PRId64
+ ", settbnameAPI:%u, bindAPI:%u, addbatchAPI:%u, execAPI:%u"
+ ", setTbNameUs:%" PRId64 ", bindDataUs:%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 " addBatchUs:%" PRId64
+ ", execWaitUs:%" PRId64 ", execUseUs:%" PRId64,
+ pStmt, pStmt->sql.stbInterlaceMode, pStmt->stat.ctgGetTbMetaNum, pStmt->stat.getCacheTbInfo,
+ pStmt->stat.parseSqlNum, pStmt->stat.bindDataNum, pStmt->seqIds[STMT_SETTBNAME], pStmt->seqIds[STMT_BIND],
+ pStmt->seqIds[STMT_ADD_BATCH], pStmt->seqIds[STMT_EXECUTE], pStmt->stat.setTbNameUs,
+ pStmt->stat.bindDataUs1, pStmt->stat.bindDataUs2, pStmt->stat.bindDataUs3, pStmt->stat.bindDataUs4,
+ pStmt->stat.addBatchUs, pStmt->stat.execWaitUs, pStmt->stat.execUseUs);
+
+ STMT_ERR_RET(stmtCleanSQLInfo(pStmt));
+
+ if (pStmt->options.asyncExecFn) {
+ (void)tsem_destroy(&pStmt->asyncQuerySem);
+ }
+ taosMemoryFree(stmt);
+
+ return TSDB_CODE_SUCCESS;
+}
+
+const char* stmtErrstr2(TAOS_STMT2* stmt) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ if (stmt == NULL || NULL == pStmt->exec.pRequest) {
+ return (char*)tstrerror(terrno);
+ }
+
+ pStmt->exec.pRequest->code = terrno;
+
+ return taos_errstr(pStmt->exec.pRequest);
+}
+/*
+int stmtAffectedRows(TAOS_STMT* stmt) { return ((STscStmt2*)stmt)->affectedRows; }
+
+int stmtAffectedRowsOnce(TAOS_STMT* stmt) { return ((STscStmt2*)stmt)->exec.affectedRows; }
+*/
+int stmtGetTagFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) {
+ int32_t code = 0;
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+ int32_t preCode = pStmt->errCode;
+
+ STMT_DLOG_E("start to get tag fields");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR);
+ }
+
+ STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
+
+ if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
+ STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
+ pStmt->bInfo.needParse = false;
+ }
+
+ if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) {
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+ }
+
+ STMT_ERRI_JRET(stmtCreateRequest(pStmt));
+
+ if (pStmt->bInfo.needParse) {
+ STMT_ERRI_JRET(stmtParseSql(pStmt));
+ }
+
+ STMT_ERRI_JRET(stmtFetchTagFields2(stmt, nums, fields));
+
+_return:
+
+ pStmt->errCode = preCode;
+
+ return code;
+}
+
+int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) {
+ int32_t code = 0;
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+ int32_t preCode = pStmt->errCode;
+
+ STMT_DLOG_E("start to get col fields");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR);
+ }
+
+ STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
+
+ if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
+ STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
+ pStmt->bInfo.needParse = false;
+ }
+
+ if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) {
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+ }
+
+ STMT_ERRI_JRET(stmtCreateRequest(pStmt));
+
+ if (pStmt->bInfo.needParse) {
+ STMT_ERRI_JRET(stmtParseSql(pStmt));
+ }
+
+ STMT_ERRI_JRET(stmtFetchColFields2(stmt, nums, fields));
+
+_return:
+
+ pStmt->errCode = preCode;
+
+ return code;
+}
+
+int stmtGetParamNum2(TAOS_STMT2* stmt, int* nums) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start to get param num");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
+
+ if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
+ STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
+ pStmt->bInfo.needParse = false;
+ }
+
+ if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) {
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+ }
+
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+
+ if (pStmt->bInfo.needParse) {
+ STMT_ERR_RET(stmtParseSql(pStmt));
+ }
+
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ *nums = taosArrayGetSize(pStmt->sql.pQuery->pPlaceholderValues);
+ } else {
+ STMT_ERR_RET(stmtFetchColFields2(stmt, nums, NULL));
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int stmtGetParamTbName(TAOS_STMT2* stmt, int* nums) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start to get param num");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
+
+ if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
+ STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
+ pStmt->bInfo.needParse = false;
+ }
+
+ if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) {
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+ }
+
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+
+ if (pStmt->bInfo.needParse) {
+ STMT_ERR_RET(stmtParseSql(pStmt));
+ }
+
+ *nums = STMT_TYPE_MULTI_INSERT == pStmt->sql.type ? 1 : 0;
+
+ return TSDB_CODE_SUCCESS;
+}
+/*
+int stmtGetParam(TAOS_STMT* stmt, int idx, int* type, int* bytes) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start to get param");
+
+ if (pStmt->errCode != TSDB_CODE_SUCCESS) {
+ return pStmt->errCode;
+ }
+
+ if (STMT_TYPE_QUERY == pStmt->sql.type) {
+ STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
+ }
+
+ STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
+
+ if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
+ STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
+ pStmt->bInfo.needParse = false;
+ }
+
+ if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) {
+ taos_free_result(pStmt->exec.pRequest);
+ pStmt->exec.pRequest = NULL;
+ }
+
+ STMT_ERR_RET(stmtCreateRequest(pStmt));
+
+ if (pStmt->bInfo.needParse) {
+ STMT_ERR_RET(stmtParseSql(pStmt));
+ }
+
+ int32_t nums = 0;
+ TAOS_FIELD_E* pField = NULL;
+ STMT_ERR_RET(stmtFetchColFields(stmt, &nums, &pField));
+ if (idx >= nums) {
+ tscError("idx %d is too big", idx);
+ taosMemoryFree(pField);
+ STMT_ERR_RET(TSDB_CODE_INVALID_PARA);
+ }
+
+ *type = pField[idx].type;
+ *bytes = pField[idx].bytes;
+
+ taosMemoryFree(pField);
+
+ return TSDB_CODE_SUCCESS;
+}
+*/
+TAOS_RES* stmtUseResult2(TAOS_STMT2* stmt) {
+ STscStmt2* pStmt = (STscStmt2*)stmt;
+
+ STMT_DLOG_E("start to use result");
+
+ if (STMT_TYPE_QUERY != pStmt->sql.type) {
+ tscError("useResult only for query statement");
+ return NULL;
+ }
+
+ return pStmt->exec.pRequest;
+}
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index 8e50c943b9..ea3e88919b 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -849,7 +849,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
int32_t blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int32_t rowCount, SSDataBlock** pResBlock) {
int32_t code = 0;
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
if (pBlock == NULL || startIndex < 0 || rowCount > pBlock->info.rows || rowCount + startIndex > pBlock->info.rows) {
return TSDB_CODE_INVALID_PARA;
@@ -1263,18 +1263,19 @@ static void blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataBloc
}
static int32_t createHelpColInfoData(const SSDataBlock* pDataBlock, SColumnInfoData** ppCols) {
- *ppCols = NULL;
-
int32_t code = 0;
int32_t rows = pDataBlock->info.capacity;
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
+ int32_t i = 0;
+
+ *ppCols = NULL;
SColumnInfoData* pCols = taosMemoryCalloc(numOfCols, sizeof(SColumnInfoData));
if (pCols == NULL) {
return terrno;
}
- for (int32_t i = 0; i < numOfCols; ++i) {
+ for (i = 0; i < numOfCols; ++i) {
SColumnInfoData* pColInfoData = taosArrayGet(pDataBlock->pDataBlock, i);
if (pColInfoData == NULL) {
continue;
@@ -1309,6 +1310,10 @@ static int32_t createHelpColInfoData(const SSDataBlock* pDataBlock, SColumnInfoD
return code;
_error:
+ for(int32_t j = 0; j < i; ++j) {
+ colDataDestroy(&pCols[j]);
+ }
+
taosMemoryFree(pCols);
return code;
}
@@ -1753,7 +1758,7 @@ int32_t copyDataBlock(SSDataBlock* pDst, const SSDataBlock* pSrc) {
}
int32_t createSpecialDataBlock(EStreamType type, SSDataBlock** pBlock) {
- QRY_OPTR_CHECK(pBlock);
+ QRY_PARAM_CHECK(pBlock);
int32_t code = 0;
SSDataBlock* p = taosMemoryCalloc(1, sizeof(SSDataBlock));
@@ -1846,7 +1851,7 @@ _err:
}
int32_t blockCopyOneRow(const SSDataBlock* pDataBlock, int32_t rowIdx, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
if (pDataBlock == NULL) {
return TSDB_CODE_INVALID_PARA;
@@ -1946,7 +1951,7 @@ _end:
}
int32_t createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
if (pDataBlock == NULL) {
return TSDB_CODE_INVALID_PARA;
}
@@ -2029,7 +2034,7 @@ int32_t createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData, SSDataB
}
int32_t createDataBlock(SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
if (pBlock == NULL) {
return terrno;
@@ -2080,7 +2085,7 @@ SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId)
int32_t bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index, SColumnInfoData** pColInfoData) {
int32_t code = 0;
- QRY_OPTR_CHECK(pColInfoData);
+ QRY_PARAM_CHECK(pColInfoData);
if (index >= taosArrayGetSize(pBlock->pDataBlock)) {
return TSDB_CODE_INVALID_PARA;
@@ -2402,10 +2407,18 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock) {
} else {
buf = taosDecodeBinary(buf, (void**)&data.nullbitmap, BitmapLen(pBlock->info.rows));
}
+ if(buf == NULL) {
+ uError("failed to decode null bitmap/offset, type:%d", data.info.type);
+ goto _error;
+ }
int32_t len = 0;
buf = taosDecodeFixedI32(buf, &len);
buf = taosDecodeBinary(buf, (void**)&data.pData, len);
+ if (buf == NULL) {
+ uError("failed to decode data, type:%d", data.info.type);
+ goto _error;
+ }
if (IS_VAR_DATA_TYPE(data.info.type)) {
data.varmeta.length = len;
data.varmeta.allocLen = len;
@@ -2418,6 +2431,15 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock) {
}
return (void*)buf;
+_error:
+ for (int32_t i = 0; i < sz; ++i) {
+ SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i);
+ if (pColInfoData == NULL) {
+ break;
+ }
+ colDataDestroy(pColInfoData);
+ }
+ return NULL;
}
static char* formatTimestamp(char* buf, int64_t val, int precision) {
@@ -2854,7 +2876,7 @@ bool alreadyAddGroupId(char* ctbName, int64_t groupId) {
}
int32_t buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId, char** pName) {
- QRY_OPTR_CHECK(pName);
+ QRY_PARAM_CHECK(pName);
char* pBuf = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1);
if (!pBuf) {
@@ -3009,6 +3031,12 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
data += colSizes[col];
}
+ if (colSizes[col] <= 0 && !colDataIsNull_s(pColRes, 0) && pColRes->info.type != TSDB_DATA_TYPE_NULL) {
+ uError("Invalid colSize:%d colIdx:%d colType:%d while encoding block", colSizes[col], col, pColRes->info.type);
+ terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
+ return -1;
+ }
+
colSizes[col] = htonl(colSizes[col]);
// uError("blockEncode col bytes:%d, type:%d, size:%d, htonl size:%d", pColRes->info.bytes, pColRes->info.type,
// htonl(colSizes[col]), colSizes[col]);
@@ -3036,6 +3064,11 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos
// total rows sizeof(int32_t)
int32_t numOfRows = *(int32_t*)pStart;
pStart += sizeof(int32_t);
+ if (numOfRows <= 0) {
+ uError("block decode numOfRows:%d error", numOfRows);
+ terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
+ return terrno;
+ }
// total columns sizeof(int32_t)
int32_t numOfCols = *(int32_t*)pStart;
@@ -3115,14 +3148,19 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos
pStart += BitmapLen(numOfRows);
}
- if (colLen[i] > 0) {
- memcpy(pColInfoData->pData, pStart, colLen[i]);
- }
-
// TODO
// setting this flag to true temporarily so aggregate function on stable will
// examine NULL value for non-primary key column
pColInfoData->hasNull = true;
+
+ if (colLen[i] > 0) {
+ memcpy(pColInfoData->pData, pStart, colLen[i]);
+ } else if (!colDataIsNull_s(pColInfoData, 0) && pColInfoData->info.type != TSDB_DATA_TYPE_NULL) {
+ uError("block decode colLen:%d error, colIdx:%d, type:%d", colLen[i], i, pColInfoData->info.type);
+ terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
+ return terrno;
+ }
+
pStart += colLen[i];
}
diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c
index b831860512..24e669577a 100644
--- a/source/common/src/tdataformat.c
+++ b/source/common/src/tdataformat.c
@@ -3124,6 +3124,198 @@ _exit:
return code;
}
+int32_t tColDataAddValueByBind2(SColData *pColData, TAOS_STMT2_BIND *pBind, int32_t buffMaxLen) {
+ int32_t code = 0;
+
+ if (!(pBind->num == 1 && pBind->is_null && *pBind->is_null)) {
+ if (!(pColData->type == pBind->buffer_type)) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+ }
+
+ if (IS_VAR_DATA_TYPE(pColData->type)) { // var-length data type
+ uint8_t *buf = pBind->buffer;
+ for (int32_t i = 0; i < pBind->num; ++i) {
+ if (pBind->is_null && pBind->is_null[i]) {
+ if (pColData->cflag & COL_IS_KEY) {
+ code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL;
+ goto _exit;
+ }
+ if (pBind->is_null[i] == 1) {
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
+ if (code) goto _exit;
+ } else {
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0);
+ if (code) goto _exit;
+ }
+ } else if (pBind->length[i] > buffMaxLen) {
+ uError("var data length too big, len:%d, max:%d", pBind->length[i], buffMaxLen);
+ return TSDB_CODE_INVALID_PARA;
+ } else {
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, buf, pBind->length[i]);
+ buf += pBind->length[i];
+ }
+ }
+ } else { // fixed-length data type
+ bool allValue;
+ bool allNull;
+ bool allNone;
+ if (pBind->is_null) {
+ bool same = (memcmp(pBind->is_null, pBind->is_null + 1, pBind->num - 1) == 0);
+ allNull = (same && pBind->is_null[0] == 1);
+ allNone = (same && pBind->is_null[0] > 1);
+ allValue = (same && pBind->is_null[0] == 0);
+ } else {
+ allNull = false;
+ allNone = false;
+ allValue = true;
+ }
+
+ if ((pColData->cflag & COL_IS_KEY) && !allValue) {
+ code = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL;
+ goto _exit;
+ }
+
+ if (allValue) {
+ // optimize (todo)
+ for (int32_t i = 0; i < pBind->num; ++i) {
+ uint8_t *val = (uint8_t *)pBind->buffer + TYPE_BYTES[pColData->type] * i;
+ if (TSDB_DATA_TYPE_BOOL == pColData->type && *val > 1) {
+ *val = 1;
+ }
+
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, val, TYPE_BYTES[pColData->type]);
+ }
+ } else if (allNull) {
+ // optimize (todo)
+ for (int32_t i = 0; i < pBind->num; ++i) {
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
+ if (code) goto _exit;
+ }
+ } else if (allNone) {
+ // optimize (todo)
+ for (int32_t i = 0; i < pBind->num; ++i) {
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0);
+ if (code) goto _exit;
+ }
+ } else {
+ for (int32_t i = 0; i < pBind->num; ++i) {
+ if (pBind->is_null[i]) {
+ if (pBind->is_null[i] == 1) {
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
+ if (code) goto _exit;
+ } else {
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NONE](pColData, NULL, 0);
+ if (code) goto _exit;
+ }
+ } else {
+ uint8_t *val = (uint8_t *)pBind->buffer + TYPE_BYTES[pColData->type] * i;
+ if (TSDB_DATA_TYPE_BOOL == pColData->type && *val > 1) {
+ *val = 1;
+ }
+
+ code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, val, TYPE_BYTES[pColData->type]);
+ }
+ }
+ }
+ }
+
+_exit:
+ return code;
+}
+
+/* build rows to `rowArray` from bind
+ * `infos` is the bind information array
+ * `numOfInfos` is the number of bind information
+ * `infoSorted` is whether the bind information is sorted by column id
+ * `pTSchema` is the schema of the table
+ * `rowArray` is the array to store the rows
+ */
+int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorted, const STSchema *pTSchema,
+ SArray *rowArray) {
+ if (infos == NULL || numOfInfos <= 0 || numOfInfos > pTSchema->numOfCols || pTSchema == NULL || rowArray == NULL) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+
+ if (!infoSorted) {
+ taosqsort_r(infos, numOfInfos, sizeof(SBindInfo), NULL, tBindInfoCompare);
+ }
+
+ int32_t code = 0;
+ int32_t numOfRows = infos[0].bind->num;
+ SArray *colValArray, *bufArray;
+ SColVal colVal;
+
+ if ((colValArray = taosArrayInit(numOfInfos, sizeof(SColVal))) == NULL) {
+ return terrno;
+ }
+ if ((bufArray = taosArrayInit(numOfInfos, sizeof(uint8_t *))) == NULL) {
+ taosArrayDestroy(colValArray);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ for (int i = 0; i < numOfInfos; ++i) {
+ if (!taosArrayPush(bufArray, &infos[i].bind->buffer)) {
+ taosArrayDestroy(colValArray);
+ taosArrayDestroy(bufArray);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ for (int32_t iRow = 0; iRow < numOfRows; iRow++) {
+ taosArrayClear(colValArray);
+
+ for (int32_t iInfo = 0; iInfo < numOfInfos; iInfo++) {
+ if (infos[iInfo].bind->is_null && infos[iInfo].bind->is_null[iRow]) {
+ if (infos[iInfo].bind->is_null[iRow] == 1) {
+ colVal = COL_VAL_NULL(infos[iInfo].columnId, infos[iInfo].type);
+ } else {
+ colVal = COL_VAL_NONE(infos[iInfo].columnId, infos[iInfo].type);
+ }
+ } else {
+ SValue value = {
+ .type = infos[iInfo].type,
+ };
+ if (IS_VAR_DATA_TYPE(infos[iInfo].type)) {
+ int32_t length = infos[iInfo].bind->length[iRow];
+ uint8_t **data = &((uint8_t **)TARRAY_DATA(bufArray))[iInfo];
+ value.nData = length;
+ value.pData = *data;
+ *data += length;
+ // value.pData = (uint8_t *)infos[iInfo].bind->buffer + infos[iInfo].bind->buffer_length * iRow;
+ } else {
+ uint8_t *val = (uint8_t *)infos[iInfo].bind->buffer + infos[iInfo].bytes * iRow;
+ if (TSDB_DATA_TYPE_BOOL == value.type && *val > 1) {
+ *val = 1;
+ }
+ (void)memcpy(&value.val, val,
+ /*(uint8_t *)infos[iInfo].bind->buffer + infos[iInfo].bind->buffer_length * iRow,*/
+ infos[iInfo].bytes /*bind->buffer_length*/);
+ }
+ colVal = COL_VAL_VALUE(infos[iInfo].columnId, value);
+ }
+ if (taosArrayPush(colValArray, &colVal) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _exit;
+ }
+ }
+
+ SRow *row;
+ if ((code = tRowBuild(colValArray, pTSchema, &row))) {
+ goto _exit;
+ }
+
+ if ((taosArrayPush(rowArray, &row)) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _exit;
+ }
+ }
+
+_exit:
+ taosArrayDestroy(colValArray);
+ taosArrayDestroy(bufArray);
+ return code;
+}
+
static int32_t tColDataCopyRowCell(SColData *pFromColData, int32_t iFromRow, SColData *pToColData, int32_t iToRow) {
int32_t code = TSDB_CODE_SUCCESS;
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 367eb68865..5b67e1267b 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -615,7 +615,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
tsKeepAliveIdle = TRANGE(tsKeepAliveIdle, 1, 72000);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "keepAliveIdle", tsKeepAliveIdle, 1, 7200000, CFG_SCOPE_BOTH, CFG_DYN_ENT_BOTH));
- tsNumOfTaskQueueThreads = tsNumOfCores;
+ tsNumOfTaskQueueThreads = tsNumOfCores * 2;
tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 16);
TAOS_CHECK_RETURN(
diff --git a/source/common/src/tmisce.c b/source/common/src/tmisce.c
index dd371c6a2a..f3f4b29617 100644
--- a/source/common/src/tmisce.c
+++ b/source/common/src/tmisce.c
@@ -171,8 +171,9 @@ int32_t epsetToStr(const SEpSet* pEpSet, char* pBuf, int32_t cap) {
ret = snprintf(pBuf + nwrite, cap, "}, inUse:%d", pEpSet->inUse);
if (ret <= 0 || ret >= cap) {
return TSDB_CODE_OUT_OF_BUFFER;
+ } else {
+ return TSDB_CODE_SUCCESS;
}
- return TSDB_CODE_SUCCESS;
}
int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t startTime) {
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 5f8a0e99aa..758a4aeec3 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -43,22 +43,22 @@
#include "tcol.h"
#include "tlog.h"
-#define DECODESQL() \
- do { \
- if (!tDecodeIsEnd(&decoder)) { \
- if (tDecodeI32(&decoder, &pReq->sqlLen) < 0) return -1; \
- if (pReq->sqlLen > 0) { \
- if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->sql, NULL) < 0) return -1; \
- } \
- } \
+#define DECODESQL() \
+ do { \
+ if (!tDecodeIsEnd(&decoder)) { \
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sqlLen)); \
+ if (pReq->sqlLen > 0) { \
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->sql, NULL)); \
+ } \
+ } \
} while (0)
-#define ENCODESQL() \
- do { \
- if (tEncodeI32(&encoder, pReq->sqlLen) < 0) return -1; \
- if (pReq->sqlLen > 0) { \
- if (tEncodeBinary(&encoder, pReq->sql, pReq->sqlLen) < 0) return -1; \
- } \
+#define ENCODESQL() \
+ do { \
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sqlLen)); \
+ if (pReq->sqlLen > 0) { \
+ TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)pReq->sql, pReq->sqlLen)); \
+ } \
} while (0)
#define FREESQL() \
@@ -1243,19 +1243,7 @@ _exit:
tDecoderClear(&decoder);
return code;
}
-// int32_t tSerializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
-// SEncoder encoder = {0};
-// tEncoderInit(&encoder, buf, bufLen);
-// if (tStartEncode(&encoder) < 0) return -1;
-// tEndEncode(&encoder);
-// if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
-// if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
-
-// int32_t tlen = encoder.pos;
-// tEncoderClear(&encoder);
-// return tlen;
-// }
int32_t tDeserializeSDropTagIdxReq(void *buf, int32_t bufLen, SDropTagIndexReq *pReq) {
SDecoder decoder = {0};
int32_t code = 0;
@@ -1307,32 +1295,6 @@ void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) {
// impl later
return;
}
-// int32_t tSerializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
-// SEncoder encoder = {0};
-// tEncoderInit(&encoder, buf, bufLen);
-
-// if (tStartEncode(&encoder) < 0) return -1;
-
-// if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
-
-// if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
-
-// tEndEncode(&encoder);
-// int32_t tlen = encoder.pos;
-// tEncoderClear(&encoder);
-// return tlen;
-// }
-// int32_t tDeserializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq *pReq) {
-// SDecoder decoder = {0};
-// tDecoderInit(&decoder, buf, bufLen);
-// if (tStartDecode(&decoder) < 0) return -1;
-// if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
-// if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
-
-// tEndDecode(&decoder);
-// tDecoderClear(&decoder);
-// return 0;
-// }
int32_t tSerializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) {
SEncoder encoder = {0};
@@ -2108,7 +2070,7 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
if (len > 0) {
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tabName));
}
- TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen));
+ TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)pReq->tagCond, pReq->tagCondLen));
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numIpRanges));
for (int32_t i = 0; i < pReq->numIpRanges; ++i) {
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->pIpRanges[i].ip));
@@ -3386,6 +3348,8 @@ void tFreeSRetrieveFuncRsp(SRetrieveFuncRsp *pRsp) {
}
int32_t tSerializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
+ int32_t code = 0;
+ int32_t lino;
int32_t headLen = sizeof(SMsgHead);
if (buf != NULL) {
buf = (char *)buf + headLen;
@@ -3395,26 +3359,34 @@ int32_t tSerializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->dbFName) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->tbName) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tbName));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
- tEncoderClear(&encoder);
+_exit:
+ if (code) {
+ tEncoderClear(&encoder);
+ return code;
+ } else {
+ 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);
+ if (buf != NULL) {
+ SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
+ pHead->vgId = htonl(pReq->header.vgId);
+ pHead->contLen = htonl(tlen + headLen);
+ }
+
+ return tlen + headLen;
}
-
- return tlen + headLen;
}
int32_t tDeserializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq) {
int32_t headLen = sizeof(SMsgHead);
+ int32_t code = 0;
+ int32_t lino;
SMsgHead *pHead = buf;
pHead->vgId = pReq->header.vgId;
pHead->contLen = pReq->header.contLen;
@@ -3422,13 +3394,14 @@ int32_t tDeserializeSTableCfgReq(void *buf, int32_t bufLen, STableCfgReq *pReq)
SDecoder decoder = {0};
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->dbFName) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->tbName) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tbName));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
int32_t tSerializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) {
@@ -4683,14 +4656,22 @@ _exit:
int32_t tSerializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
- if (tEncodeI32(&encoder, pReq->maxSpeed) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->maxSpeed));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
@@ -5726,6 +5707,8 @@ void tFreeSSTbHbRsp(SSTbHbRsp *pRsp) {
int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq) {
int32_t headLen = sizeof(SMsgHead);
+ int32_t code = 0;
+ int32_t lino;
if (buf != NULL) {
buf = (char *)buf + headLen;
bufLen -= headLen;
@@ -5734,26 +5717,33 @@ int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq)
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->dbFName) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->tbName) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->tbName));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
- tEncoderClear(&encoder);
+_exit:
+ if (code) {
+ tEncoderClear(&encoder);
+ return code;
+ } else {
+ 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);
+ if (buf != NULL) {
+ SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
+ pHead->vgId = htonl(pReq->header.vgId);
+ pHead->contLen = htonl(tlen + headLen);
+ }
+
+ return tlen + headLen;
}
-
- return tlen + headLen;
}
int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq) {
- int32_t headLen = sizeof(SMsgHead);
-
+ int32_t headLen = sizeof(SMsgHead);
+ int32_t code = 0;
+ int32_t lino;
SMsgHead *pHead = buf;
pHead->vgId = pReq->header.vgId;
pHead->contLen = pReq->header.contLen;
@@ -5761,13 +5751,14 @@ int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq
SDecoder decoder = {0};
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->dbFName) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->tbName) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->tbName));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
int32_t tSerializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *pReq) {
@@ -6393,7 +6384,7 @@ int32_t tSerializeSQueryCompactProgressReq(void *buf, int32_t bufLen, SQueryComp
int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->compactId));
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->vgId));
@@ -7768,7 +7759,9 @@ int32_t tDeserializeSMArbUpdateGroupBatchReq(void *buf, int32_t bufLen, SMArbUpd
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz));
SArray *updateArray = taosArrayInit(sz, sizeof(SMArbUpdateGroup));
- if (!updateArray) return -1;
+ if (!updateArray) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < sz; i++) {
SMArbUpdateGroup group = {0};
@@ -7939,6 +7932,8 @@ void tFreeSExplainRsp(SExplainRsp *pRsp) {
}
int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
+ int32_t code = 0;
+ int32_t lino;
int32_t headLen = sizeof(SMsgHead);
if (buf != NULL) {
buf = (char *)buf + headLen;
@@ -7947,35 +7942,42 @@ int32_t tSerializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
int32_t num = taosArrayGetSize(pReq->pMsgs);
- if (tEncodeI32(&encoder, num) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, num));
for (int32_t i = 0; i < num; ++i) {
SBatchMsg *pMsg = taosArrayGet(pReq->pMsgs, i);
- if (tEncodeI32(&encoder, pMsg->msgIdx) < 0) return -1;
- if (tEncodeI32(&encoder, pMsg->msgType) < 0) return -1;
- if (tEncodeI32(&encoder, pMsg->msgLen) < 0) return -1;
- if (tEncodeBinary(&encoder, pMsg->msg, pMsg->msgLen) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgIdx));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgType));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pMsg->msgLen));
+ TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pMsg->msg, pMsg->msgLen));
}
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
- tEncoderClear(&encoder);
+_exit:
+ if (code) {
+ tEncoderClear(&encoder);
+ return code;
+ } else {
+ 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);
+ if (buf != NULL) {
+ SMsgHead *pHead = (SMsgHead *)((char *)buf - headLen);
+ pHead->vgId = htonl(pReq->header.vgId);
+ pHead->contLen = htonl(tlen + headLen);
+ }
+
+ return tlen + headLen;
}
-
- return tlen + headLen;
}
int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
- int32_t headLen = sizeof(SMsgHead);
-
+ int32_t headLen = sizeof(SMsgHead);
+ int32_t code = 0;
+ int32_t lino;
SMsgHead *pHead = buf;
pHead->vgId = pReq->header.vgId;
pHead->contLen = pReq->header.contLen;
@@ -7983,33 +7985,37 @@ int32_t tDeserializeSBatchReq(void *buf, int32_t bufLen, SBatchReq *pReq) {
SDecoder decoder = {0};
tDecoderInit(&decoder, (char *)buf + headLen, bufLen - headLen);
- if (tStartDecode(&decoder) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
int32_t num = 0;
- if (tDecodeI32(&decoder, &num) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num));
if (num <= 0) {
pReq->pMsgs = NULL;
tEndDecode(&decoder);
-
tDecoderClear(&decoder);
return 0;
}
pReq->pMsgs = taosArrayInit(num, sizeof(SBatchMsg));
- if (NULL == pReq->pMsgs) return -1;
+ if (NULL == pReq->pMsgs) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < num; ++i) {
SBatchMsg msg = {0};
- if (tDecodeI32(&decoder, &msg.msgIdx) < 0) return -1;
- if (tDecodeI32(&decoder, &msg.msgType) < 0) return -1;
- if (tDecodeI32(&decoder, &msg.msgLen) < 0) return -1;
- if (tDecodeBinaryAlloc(&decoder, &msg.msg, NULL) < 0) return -1;
- if (NULL == taosArrayPush(pReq->pMsgs, &msg)) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgIdx));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgType));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &msg.msgLen));
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, &msg.msg, NULL));
+ if (NULL == taosArrayPush(pReq->pMsgs, &msg)) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
int32_t tSerializeSBatchRsp(void *buf, int32_t bufLen, SBatchRsp *pRsp) {
@@ -8169,7 +8175,9 @@ int32_t tDeserializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) {
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &sz));
if (sz > 0) {
pRsp->topicPrivileges = taosArrayInit(sz, sizeof(STopicPrivilege));
- if (NULL == pRsp->topicPrivileges) return -1;
+ if (NULL == pRsp->topicPrivileges) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < sz; ++i) {
STopicPrivilege *data = taosArrayReserve(pRsp->topicPrivileges, 1);
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, data->topic));
@@ -8529,7 +8537,7 @@ int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) {
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId));
if (pReq->pOpParam) {
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 1));
- if (tSerializeSOperatorParam(&encoder, pReq->pOpParam) < 0) return -1;
+ TAOS_CHECK_EXIT(tSerializeSOperatorParam(&encoder, pReq->pOpParam));
} else {
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0));
}
@@ -9021,7 +9029,9 @@ int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &num));
if (num > 0) {
pRsp->taskStatus = taosArrayInit(num, sizeof(STaskStatus));
- if (NULL == pRsp->taskStatus) return -1;
+ if (NULL == pRsp->taskStatus) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < num; ++i) {
STaskStatus status = {0};
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &status.queryId));
@@ -9289,8 +9299,12 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->maxDelay));
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->watermark));
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igExpired));
- if (sqlLen > 0 && tEncodeCStr(&encoder, pReq->sql) < 0) return -1;
- if (astLen > 0 && tEncodeCStr(&encoder, pReq->ast) < 0) return -1;
+ if (sqlLen > 0) {
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sql));
+ }
+ if (astLen > 0) {
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->ast));
+ }
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfTags));
for (int32_t i = 0; i < pReq->numOfTags; ++i) {
SField *pField = taosArrayGet(pReq->pTags, i);
@@ -9735,7 +9749,9 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->commentLen));
if (pReq->commentLen > 0) {
pReq->comment = taosMemoryMalloc(pReq->commentLen + 1);
- if (pReq->comment == NULL) return -1;
+ if (pReq->comment == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pReq->comment));
}
@@ -10012,100 +10028,30 @@ int32_t tDecodeSVDropStbReq(SDecoder *pCoder, SVDropStbReq *pReq) {
}
static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBlock) {
- if (tStartEncode(pEncoder) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
- if (tEncodeI32(pEncoder, pBlock->code) < 0) return -1;
- if (tEncodeI64(pEncoder, pBlock->uid) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pBlock->code));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pBlock->uid));
if (pBlock->tblFName) {
- if (tEncodeCStr(pEncoder, pBlock->tblFName) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pBlock->tblFName));
} else {
- if (tEncodeCStr(pEncoder, "") < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, ""));
}
- if (tEncodeI32v(pEncoder, pBlock->numOfRows) < 0) return -1;
- if (tEncodeI32v(pEncoder, pBlock->affectedRows) < 0) return -1;
- if (tEncodeI64v(pEncoder, pBlock->sver) < 0) return -1;
- if (tEncodeI32(pEncoder, pBlock->pMeta ? 1 : 0) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pBlock->numOfRows));
+ TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pBlock->affectedRows));
+ TAOS_CHECK_EXIT(tEncodeI64v(pEncoder, pBlock->sver));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pBlock->pMeta ? 1 : 0));
if (pBlock->pMeta) {
- if (tEncodeSTableMetaRsp(pEncoder, pBlock->pMeta) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSTableMetaRsp(pEncoder, pBlock->pMeta));
}
tEndEncode(pEncoder);
- return 0;
+_exit:
+ return code;
}
-// static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
-// if (tStartDecode(pDecoder) < 0) return -1;
-
-// if (tDecodeI32(pDecoder, &pBlock->code) < 0) return -1;
-// if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
-// pBlock->tblFName = taosMemoryCalloc(TSDB_TABLE_FNAME_LEN, 1);
-// if (NULL == pBlock->tblFName) return -1;
-// if (tDecodeCStrTo(pDecoder, pBlock->tblFName) < 0) return -1;
-// if (tDecodeI32v(pDecoder, &pBlock->numOfRows) < 0) return -1;
-// if (tDecodeI32v(pDecoder, &pBlock->affectedRows) < 0) return -1;
-// if (tDecodeI64v(pDecoder, &pBlock->sver) < 0) return -1;
-
-// int32_t meta = 0;
-// if (tDecodeI32(pDecoder, &meta) < 0) return -1;
-// if (meta) {
-// pBlock->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
-// if (NULL == pBlock->pMeta) return -1;
-// if (tDecodeSTableMetaRsp(pDecoder, pBlock->pMeta) < 0) return -1;
-// } else {
-// pBlock->pMeta = NULL;
-// }
-
-// tEndDecode(pDecoder);
-// return 0;
-// }
-
-// int32_t tEncodeSSubmitRsp(SEncoder *pEncoder, const SSubmitRsp *pRsp) {
-// int32_t nBlocks = taosArrayGetSize(pRsp->pArray);
-
-// if (tStartEncode(pEncoder) < 0) return -1;
-
-// if (tEncodeI32v(pEncoder, pRsp->numOfRows) < 0) return -1;
-// if (tEncodeI32v(pEncoder, pRsp->affectedRows) < 0) return -1;
-// if (tEncodeI32v(pEncoder, nBlocks) < 0) return -1;
-// for (int32_t iBlock = 0; iBlock < nBlocks; iBlock++) {
-// if (tEncodeSSubmitBlkRsp(pEncoder, (SSubmitBlkRsp *)taosArrayGet(pRsp->pArray, iBlock)) < 0) return -1;
-// }
-
-// tEndEncode(pEncoder);
-// return 0;
-// }
-
-// int32_t tDecodeSSubmitRsp(SDecoder *pDecoder, SSubmitRsp *pRsp) {
-// if (tStartDecode(pDecoder) < 0) return -1;
-
-// if (tDecodeI32v(pDecoder, &pRsp->numOfRows) < 0) return -1;
-// if (tDecodeI32v(pDecoder, &pRsp->affectedRows) < 0) return -1;
-// if (tDecodeI32v(pDecoder, &pRsp->nBlocks) < 0) return -1;
-// pRsp->pBlocks = taosMemoryCalloc(pRsp->nBlocks, sizeof(*pRsp->pBlocks));
-// if (pRsp->pBlocks == NULL) return -1;
-// for (int32_t iBlock = 0; iBlock < pRsp->nBlocks; iBlock++) {
-// if (tDecodeSSubmitBlkRsp(pDecoder, pRsp->pBlocks + iBlock) < 0) return -1;
-// }
-
-// tEndDecode(pDecoder);
-// tDecoderClear(pDecoder);
-// return 0;
-// }
-
-// void tFreeSSubmitBlkRsp(void *param) {
-// if (NULL == param) {
-// return;
-// }
-
-// SSubmitBlkRsp *pRsp = (SSubmitBlkRsp *)param;
-
-// taosMemoryFree(pRsp->tblFName);
-// if (pRsp->pMeta) {
-// taosMemoryFree(pRsp->pMeta->pSchemas);
-// taosMemoryFree(pRsp->pMeta);
-// }
-// }
-
void tFreeSSubmitRsp(SSubmitRsp *pRsp) {
if (NULL == pRsp) return;
@@ -10124,239 +10070,239 @@ void tFreeSSubmitRsp(SSubmitRsp *pRsp) {
}
int32_t tEncodeSVAlterTbReq(SEncoder *pEncoder, const SVAlterTbReq *pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
- if (tEncodeCStr(pEncoder, pReq->tbName) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->action) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->colId) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->tbName));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->action));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->colId));
switch (pReq->action) {
case TSDB_ALTER_TABLE_ADD_COLUMN:
- if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->type) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->flags) < 0) return -1;
- if (tEncodeI32v(pEncoder, pReq->bytes) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->colName));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->type));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->flags));
+ TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pReq->bytes));
break;
case TSDB_ALTER_TABLE_DROP_COLUMN:
- if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->colName));
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
- if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->colModType) < 0) return -1;
- if (tEncodeI32v(pEncoder, pReq->colModBytes) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->colName));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->colModType));
+ TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pReq->colModBytes));
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME:
- if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
- if (tEncodeCStr(pEncoder, pReq->colNewName) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->colName));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->colNewName));
break;
case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:
- if (tEncodeCStr(pEncoder, pReq->tagName) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->isNull) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->tagType) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->tagName));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->isNull));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->tagType));
if (!pReq->isNull) {
- if (tEncodeBinary(pEncoder, pReq->pTagVal, pReq->nTagVal) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, pReq->pTagVal, pReq->nTagVal));
}
break;
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
- if (tEncodeI8(pEncoder, pReq->updateTTL) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->updateTTL));
if (pReq->updateTTL) {
- if (tEncodeI32v(pEncoder, pReq->newTTL) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pReq->newTTL));
}
- if (tEncodeI32v(pEncoder, pReq->newCommentLen) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pReq->newCommentLen));
if (pReq->newCommentLen > 0) {
- if (tEncodeCStr(pEncoder, pReq->newComment) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->newComment));
}
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS:
- if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
- if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->colName));
+ TAOS_CHECK_EXIT(tEncodeU32(pEncoder, pReq->compress));
break;
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
- if (tEncodeCStr(pEncoder, pReq->colName) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->type) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->flags) < 0) return -1;
- if (tEncodeI32v(pEncoder, pReq->bytes) < 0) return -1;
- if (tEncodeU32(pEncoder, pReq->compress) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pReq->colName));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->type));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->flags));
+ TAOS_CHECK_EXIT(tEncodeI32v(pEncoder, pReq->bytes));
+ TAOS_CHECK_EXIT(tEncodeU32(pEncoder, pReq->compress));
break;
default:
break;
}
- if (tEncodeI64(pEncoder, pReq->ctimeMs) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->source) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->ctimeMs));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->source));
tEndEncode(pEncoder);
- return 0;
+_exit:
+ return code;
}
static int32_t tDecodeSVAlterTbReqCommon(SDecoder *pDecoder, SVAlterTbReq *pReq) {
- if (tDecodeCStr(pDecoder, &pReq->tbName) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->action) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->colId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->tbName));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->action));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->colId));
switch (pReq->action) {
case TSDB_ALTER_TABLE_ADD_COLUMN:
- if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->type) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->flags) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pReq->bytes) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->colName));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->type));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->flags));
+ TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &pReq->bytes));
break;
case TSDB_ALTER_TABLE_DROP_COLUMN:
- if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->colName));
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
- if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->colModType) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pReq->colModBytes) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->colName));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->colModType));
+ TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &pReq->colModBytes));
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME:
- if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
- if (tDecodeCStr(pDecoder, &pReq->colNewName) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->colName));
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->colNewName));
break;
case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:
- if (tDecodeCStr(pDecoder, &pReq->tagName) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->isNull) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->tagType) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->tagName));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->isNull));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->tagType));
if (!pReq->isNull) {
- if (tDecodeBinary(pDecoder, &pReq->pTagVal, &pReq->nTagVal) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeBinary(pDecoder, &pReq->pTagVal, &pReq->nTagVal));
}
break;
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
- if (tDecodeI8(pDecoder, &pReq->updateTTL) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->updateTTL));
if (pReq->updateTTL) {
- if (tDecodeI32v(pDecoder, &pReq->newTTL) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &pReq->newTTL));
}
- if (tDecodeI32v(pDecoder, &pReq->newCommentLen) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &pReq->newCommentLen));
if (pReq->newCommentLen > 0) {
- if (tDecodeCStr(pDecoder, &pReq->newComment) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->newComment));
}
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS:
- if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
- if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->colName));
+ TAOS_CHECK_EXIT(tDecodeU32(pDecoder, &pReq->compress));
break;
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
- if (tDecodeCStr(pDecoder, &pReq->colName) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->type) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->flags) < 0) return -1;
- if (tDecodeI32v(pDecoder, &pReq->bytes) < 0) return -1;
- if (tDecodeU32(pDecoder, &pReq->compress) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pDecoder, &pReq->colName));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->type));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->flags));
+ TAOS_CHECK_EXIT(tDecodeI32v(pDecoder, &pReq->bytes));
+ TAOS_CHECK_EXIT(tDecodeU32(pDecoder, &pReq->compress));
default:
break;
}
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSVAlterTbReq(SDecoder *pDecoder, SVAlterTbReq *pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeSVAlterTbReqCommon(pDecoder, pReq) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeSVAlterTbReqCommon(pDecoder, pReq));
pReq->ctimeMs = 0;
if (!tDecodeIsEnd(pDecoder)) {
- if (tDecodeI64(pDecoder, &pReq->ctimeMs) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->ctimeMs));
}
if (!tDecodeIsEnd(pDecoder)) {
- if (tDecodeI8(pDecoder, &pReq->source) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->source));
}
tEndDecode(pDecoder);
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSVAlterTbReqSetCtime(SDecoder *pDecoder, SVAlterTbReq *pReq, int64_t ctimeMs) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeSVAlterTbReqCommon(pDecoder, pReq) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeSVAlterTbReqCommon(pDecoder, pReq));
pReq->ctimeMs = 0;
if (!tDecodeIsEnd(pDecoder)) {
*(int64_t *)(pDecoder->data + pDecoder->pos) = ctimeMs;
- if (tDecodeI64(pDecoder, &pReq->ctimeMs) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->ctimeMs));
}
tEndDecode(pDecoder);
- return 0;
+_exit:
+ return code;
}
int32_t tEncodeSVAlterTbRsp(SEncoder *pEncoder, const SVAlterTbRsp *pRsp) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->code) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->pMeta ? 1 : 0) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->code));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->pMeta ? 1 : 0));
if (pRsp->pMeta) {
- if (tEncodeSTableMetaRsp(pEncoder, pRsp->pMeta) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSTableMetaRsp(pEncoder, pRsp->pMeta));
}
tEndEncode(pEncoder);
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSVAlterTbRsp(SDecoder *pDecoder, SVAlterTbRsp *pRsp) {
int32_t meta = 0;
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->code) < 0) return -1;
- if (tDecodeI32(pDecoder, &meta) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->code));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &meta));
if (meta) {
pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
- if (NULL == pRsp->pMeta) return -1;
- if (tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta) < 0) return -1;
+ if (NULL == pRsp->pMeta) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta));
}
tEndDecode(pDecoder);
- return 0;
+_exit:
+ return code;
}
-// int32_t tDeserializeSVAlterTbRsp(void *buf, int32_t bufLen, SVAlterTbRsp *pRsp) {
-// int32_t meta = 0;
-// SDecoder decoder = {0};
-// tDecoderInit(&decoder, buf, bufLen);
-
-// if (tStartDecode(&decoder) < 0) return -1;
-// if (tDecodeI32(&decoder, &pRsp->code) < 0) return -1;
-// if (tDecodeI32(&decoder, &meta) < 0) return -1;
-// if (meta) {
-// pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
-// if (NULL == pRsp->pMeta) return -1;
-// if (tDecodeSTableMetaRsp(&decoder, pRsp->pMeta) < 0) return -1;
-// }
-// tEndDecode(&decoder);
-// tDecoderClear(&decoder);
-// return 0;
-// }
-
int32_t tEncodeSMAlterStbRsp(SEncoder *pEncoder, const SMAlterStbRsp *pRsp) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->pMeta->pSchemas ? 1 : 0) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->pMeta->pSchemas ? 1 : 0));
if (pRsp->pMeta->pSchemas) {
- if (tEncodeSTableMetaRsp(pEncoder, pRsp->pMeta) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSTableMetaRsp(pEncoder, pRsp->pMeta));
}
tEndEncode(pEncoder);
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSMAlterStbRsp(SDecoder *pDecoder, SMAlterStbRsp *pRsp) {
int32_t meta = 0;
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI32(pDecoder, &meta) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &meta));
if (meta) {
pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
- if (NULL == pRsp->pMeta) return -1;
- if (tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta) < 0) return -1;
+ if (NULL == pRsp->pMeta) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta));
}
tEndDecode(pDecoder);
- return 0;
+_exit:
+ return code;
}
-// int32_t tDeserializeSMAlterStbRsp(void *buf, int32_t bufLen, SMAlterStbRsp *pRsp) {
-// int32_t meta = 0;
-// SDecoder decoder = {0};
-// tDecoderInit(&decoder, buf, bufLen);
-
-// if (tStartDecode(&decoder) < 0) return -1;
-// if (tDecodeI32(&decoder, &meta) < 0) return -1;
-// if (meta) {
-// pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
-// if (NULL == pRsp->pMeta) return -1;
-// if (tDecodeSTableMetaRsp(&decoder, pRsp->pMeta) < 0) return -1;
-// }
-// tEndDecode(&decoder);
-// tDecoderClear(&decoder);
-// return 0;
-// }
-
void tFreeSMAlterStbRsp(SMAlterStbRsp *pRsp) {
if (NULL == pRsp) {
return;
@@ -10370,45 +10316,40 @@ void tFreeSMAlterStbRsp(SMAlterStbRsp *pRsp) {
}
int32_t tEncodeSMCreateStbRsp(SEncoder *pEncoder, const SMCreateStbRsp *pRsp) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->pMeta->pSchemas ? 1 : 0) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->pMeta->pSchemas ? 1 : 0));
if (pRsp->pMeta->pSchemas) {
- if (tEncodeSTableMetaRsp(pEncoder, pRsp->pMeta) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSTableMetaRsp(pEncoder, pRsp->pMeta));
}
tEndEncode(pEncoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tDecodeSMCreateStbRsp(SDecoder *pDecoder, SMCreateStbRsp *pRsp) {
int32_t meta = 0;
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI32(pDecoder, &meta) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &meta));
if (meta) {
pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
- if (NULL == pRsp->pMeta) return -1;
- if (tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta) < 0) return -1;
+ if (NULL == pRsp->pMeta) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ TAOS_CHECK_EXIT(tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta));
}
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
-// int32_t tDeserializeSMCreateStbRsp(void *buf, int32_t bufLen, SMCreateStbRsp *pRsp) {
-// int32_t meta = 0;
-// SDecoder decoder = {0};
-// tDecoderInit(&decoder, buf, bufLen);
-
-// if (tStartDecode(&decoder) < 0) return -1;
-// if (tDecodeI32(&decoder, &meta) < 0) return -1;
-// if (meta) {
-// pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
-// if (NULL == pRsp->pMeta) return -1;
-// if (tDecodeSTableMetaRsp(&decoder, pRsp->pMeta) < 0) return -1;
-// }
-// tEndDecode(&decoder);
-// tDecoderClear(&decoder);
-// return 0;
-// }
-
void tFreeSMCreateStbRsp(SMCreateStbRsp *pRsp) {
if (NULL == pRsp) {
return;
@@ -10422,51 +10363,59 @@ void tFreeSMCreateStbRsp(SMCreateStbRsp *pRsp) {
}
int32_t tEncodeSTqOffsetVal(SEncoder *pEncoder, const STqOffsetVal *pOffsetVal) {
+ int32_t code = 0;
+ int32_t lino;
+
int8_t type = pOffsetVal->type < 0 ? pOffsetVal->type : (TQ_OFFSET_VERSION << 4) | pOffsetVal->type;
- if (tEncodeI8(pEncoder, type) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, type));
if (pOffsetVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pOffsetVal->type == TMQ_OFFSET__SNAPSHOT_META) {
- if (tEncodeI64(pEncoder, pOffsetVal->uid) < 0) return -1;
- if (tEncodeI64(pEncoder, pOffsetVal->ts) < 0) return -1;
- if (tEncodeI8(pEncoder, pOffsetVal->primaryKey.type) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pOffsetVal->uid));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pOffsetVal->ts));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pOffsetVal->primaryKey.type));
if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) {
- if (tEncodeBinary(pEncoder, pOffsetVal->primaryKey.pData, pOffsetVal->primaryKey.nData) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, pOffsetVal->primaryKey.pData, pOffsetVal->primaryKey.nData));
} else {
- if (tEncodeI64(pEncoder, pOffsetVal->primaryKey.val) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pOffsetVal->primaryKey.val));
}
} else if (pOffsetVal->type == TMQ_OFFSET__LOG) {
- if (tEncodeI64(pEncoder, pOffsetVal->version) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pOffsetVal->version));
} else {
// do nothing
}
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSTqOffsetVal(SDecoder *pDecoder, STqOffsetVal *pOffsetVal) {
- if (tDecodeI8(pDecoder, &pOffsetVal->type) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pOffsetVal->type));
int8_t offsetVersion = 0;
if (pOffsetVal->type > 0) {
offsetVersion = (pOffsetVal->type >> 4);
pOffsetVal->type = pOffsetVal->type & 0x0F;
}
if (pOffsetVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pOffsetVal->type == TMQ_OFFSET__SNAPSHOT_META) {
- if (tDecodeI64(pDecoder, &pOffsetVal->uid) < 0) return -1;
- if (tDecodeI64(pDecoder, &pOffsetVal->ts) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pOffsetVal->uid));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pOffsetVal->ts));
if (offsetVersion >= TQ_OFFSET_VERSION) {
- if (tDecodeI8(pDecoder, &pOffsetVal->primaryKey.type) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pOffsetVal->primaryKey.type));
if (IS_VAR_DATA_TYPE(pOffsetVal->primaryKey.type)) {
- if (tDecodeBinaryAlloc32(pDecoder, (void **)&pOffsetVal->primaryKey.pData, &pOffsetVal->primaryKey.nData) < 0)
- return -1;
+ TAOS_CHECK_EXIT(
+ tDecodeBinaryAlloc32(pDecoder, (void **)&pOffsetVal->primaryKey.pData, &pOffsetVal->primaryKey.nData));
} else {
- if (tDecodeI64(pDecoder, &pOffsetVal->primaryKey.val) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pOffsetVal->primaryKey.val));
}
}
} else if (pOffsetVal->type == TMQ_OFFSET__LOG) {
- if (tDecodeI64(pDecoder, &pOffsetVal->version) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pOffsetVal->version));
} else {
// do nothing
}
- return 0;
+_exit:
+ return code;
}
void tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) {
@@ -10538,250 +10487,294 @@ void tDeleteSTqOffset(void *param) {
}
int32_t tEncodeSTqOffset(SEncoder *pEncoder, const STqOffset *pOffset) {
- if (tEncodeSTqOffsetVal(pEncoder, &pOffset->val) < 0) return -1;
- if (tEncodeCStr(pEncoder, pOffset->subKey) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeSTqOffsetVal(pEncoder, &pOffset->val));
+ TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pOffset->subKey));
return 0;
}
int32_t tDecodeSTqOffset(SDecoder *pDecoder, STqOffset *pOffset) {
- if (tDecodeSTqOffsetVal(pDecoder, &pOffset->val) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pOffset->subKey) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeSTqOffsetVal(pDecoder, &pOffset->val));
+ TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pOffset->subKey));
return 0;
}
int32_t tEncodeMqVgOffset(SEncoder *pEncoder, const SMqVgOffset *pOffset) {
- if (tEncodeSTqOffset(pEncoder, &pOffset->offset) < 0) return -1;
- if (tEncodeI64(pEncoder, pOffset->consumerId) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeSTqOffset(pEncoder, &pOffset->offset));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pOffset->consumerId));
return 0;
}
int32_t tDecodeMqVgOffset(SDecoder *pDecoder, SMqVgOffset *pOffset) {
- if (tDecodeSTqOffset(pDecoder, &pOffset->offset) < 0) return -1;
- if (tDecodeI64(pDecoder, &pOffset->consumerId) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeSTqOffset(pDecoder, &pOffset->offset));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pOffset->consumerId));
return 0;
}
int32_t tEncodeSTqCheckInfo(SEncoder *pEncoder, const STqCheckInfo *pInfo) {
- if (tEncodeCStr(pEncoder, pInfo->topic) < 0) return -1;
- if (tEncodeI64(pEncoder, pInfo->ntbUid) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->topic));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pInfo->ntbUid));
int32_t sz = taosArrayGetSize(pInfo->colIdList);
- if (tEncodeI32(pEncoder, sz) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, sz));
for (int32_t i = 0; i < sz; i++) {
int16_t colId = *(int16_t *)taosArrayGet(pInfo->colIdList, i);
- if (tEncodeI16(pEncoder, colId) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeI16(pEncoder, colId));
}
return pEncoder->pos;
}
int32_t tDecodeSTqCheckInfo(SDecoder *pDecoder, STqCheckInfo *pInfo) {
- if (tDecodeCStrTo(pDecoder, pInfo->topic) < 0) return -1;
- if (tDecodeI64(pDecoder, &pInfo->ntbUid) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->topic));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pInfo->ntbUid));
int32_t sz = 0;
- if (tDecodeI32(pDecoder, &sz) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &sz));
pInfo->colIdList = taosArrayInit(sz, sizeof(int16_t));
- if (pInfo->colIdList == NULL) return -1;
+ if (pInfo->colIdList == NULL) {
+ TAOS_CHECK_RETURN(terrno);
+ }
for (int32_t i = 0; i < sz; i++) {
int16_t colId = 0;
- if (tDecodeI16(pDecoder, &colId) < 0) return -1;
- if (taosArrayPush(pInfo->colIdList, &colId) == NULL) return -1;
+ TAOS_CHECK_RETURN(tDecodeI16(pDecoder, &colId));
+ if (taosArrayPush(pInfo->colIdList, &colId) == NULL) {
+ TAOS_CHECK_RETURN(terrno);
+ }
}
return 0;
}
void tDeleteSTqCheckInfo(STqCheckInfo *pInfo) { taosArrayDestroy(pInfo->colIdList); }
int32_t tEncodeSMqRebVgReq(SEncoder *pCoder, const SMqRebVgReq *pReq) {
- if (tStartEncode(pCoder) < 0) return -1;
- if (tEncodeI64(pCoder, pReq->leftForVer) < 0) return -1;
- if (tEncodeI32(pCoder, pReq->vgId) < 0) return -1;
- if (tEncodeI64(pCoder, pReq->oldConsumerId) < 0) return -1;
- if (tEncodeI64(pCoder, pReq->newConsumerId) < 0) return -1;
- if (tEncodeCStr(pCoder, pReq->subKey) < 0) return -1;
- if (tEncodeI8(pCoder, pReq->subType) < 0) return -1;
- if (tEncodeI8(pCoder, pReq->withMeta) < 0) return -1;
+ TAOS_CHECK_RETURN(tStartEncode(pCoder));
+ TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->leftForVer));
+ TAOS_CHECK_RETURN(tEncodeI32(pCoder, pReq->vgId));
+ TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->oldConsumerId));
+ TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->newConsumerId));
+ TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pReq->subKey));
+ TAOS_CHECK_RETURN(tEncodeI8(pCoder, pReq->subType));
+ TAOS_CHECK_RETURN(tEncodeI8(pCoder, pReq->withMeta));
if (pReq->subType == TOPIC_SUB_TYPE__COLUMN) {
- if (tEncodeCStr(pCoder, pReq->qmsg) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pReq->qmsg));
} else if (pReq->subType == TOPIC_SUB_TYPE__TABLE) {
- if (tEncodeI64(pCoder, pReq->suid) < 0) return -1;
- if (tEncodeCStr(pCoder, pReq->qmsg) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->suid));
+ TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pReq->qmsg));
}
tEndEncode(pCoder);
return 0;
}
int32_t tDecodeSMqRebVgReq(SDecoder *pCoder, SMqRebVgReq *pReq) {
- if (tStartDecode(pCoder) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
- if (tDecodeI64(pCoder, &pReq->leftForVer) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(pCoder));
- if (tDecodeI32(pCoder, &pReq->vgId) < 0) return -1;
- if (tDecodeI64(pCoder, &pReq->oldConsumerId) < 0) return -1;
- if (tDecodeI64(pCoder, &pReq->newConsumerId) < 0) return -1;
- if (tDecodeCStrTo(pCoder, pReq->subKey) < 0) return -1;
- if (tDecodeI8(pCoder, &pReq->subType) < 0) return -1;
- if (tDecodeI8(pCoder, &pReq->withMeta) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->leftForVer));
+
+ TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pReq->vgId));
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->oldConsumerId));
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->newConsumerId));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pReq->subKey));
+ TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pReq->subType));
+ TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pReq->withMeta));
if (pReq->subType == TOPIC_SUB_TYPE__COLUMN) {
- if (tDecodeCStr(pCoder, &pReq->qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pReq->qmsg));
} else if (pReq->subType == TOPIC_SUB_TYPE__TABLE) {
- if (tDecodeI64(pCoder, &pReq->suid) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pReq->suid));
if (!tDecodeIsEnd(pCoder)) {
- if (tDecodeCStr(pCoder, &pReq->qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStr(pCoder, &pReq->qmsg));
}
}
tEndDecode(pCoder);
- return 0;
+_exit:
+ return code;
}
int32_t tEncodeDeleteRes(SEncoder *pCoder, const SDeleteRes *pRes) {
int32_t nUid = taosArrayGetSize(pRes->uidList);
+ int32_t code = 0;
+ int32_t lino;
- if (tEncodeU64(pCoder, pRes->suid) < 0) return -1;
- if (tEncodeI32v(pCoder, nUid) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeU64(pCoder, pRes->suid));
+ TAOS_CHECK_EXIT(tEncodeI32v(pCoder, nUid));
for (int32_t iUid = 0; iUid < nUid; iUid++) {
- if (tEncodeU64(pCoder, *(uint64_t *)taosArrayGet(pRes->uidList, iUid)) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeU64(pCoder, *(uint64_t *)taosArrayGet(pRes->uidList, iUid)));
}
- if (tEncodeI64(pCoder, pRes->skey) < 0) return -1;
- if (tEncodeI64(pCoder, pRes->ekey) < 0) return -1;
- if (tEncodeI64v(pCoder, pRes->affectedRows) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pCoder, pRes->skey));
+ TAOS_CHECK_EXIT(tEncodeI64(pCoder, pRes->ekey));
+ TAOS_CHECK_EXIT(tEncodeI64v(pCoder, pRes->affectedRows));
- if (tEncodeCStr(pCoder, pRes->tableFName) < 0) return -1;
- if (tEncodeCStr(pCoder, pRes->tsColName) < 0) return -1;
- if (tEncodeI64(pCoder, pRes->ctimeMs) < 0) return -1;
- if (tEncodeI8(pCoder, pRes->source) < 0) return -1;
- return 0;
+ TAOS_CHECK_EXIT(tEncodeCStr(pCoder, pRes->tableFName));
+ TAOS_CHECK_EXIT(tEncodeCStr(pCoder, pRes->tsColName));
+ TAOS_CHECK_EXIT(tEncodeI64(pCoder, pRes->ctimeMs));
+ TAOS_CHECK_EXIT(tEncodeI8(pCoder, pRes->source));
+
+_exit:
+ return code;
}
int32_t tDecodeDeleteRes(SDecoder *pCoder, SDeleteRes *pRes) {
int32_t nUid;
uint64_t uid;
+ int32_t code = 0;
+ int32_t lino;
- if (tDecodeU64(pCoder, &pRes->suid) < 0) return -1;
- if (tDecodeI32v(pCoder, &nUid) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeU64(pCoder, &pRes->suid));
+ TAOS_CHECK_EXIT(tDecodeI32v(pCoder, &nUid));
for (int32_t iUid = 0; iUid < nUid; iUid++) {
- if (tDecodeU64(pCoder, &uid) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeU64(pCoder, &uid));
if (pRes->uidList) {
- if (taosArrayPush(pRes->uidList, &uid) == NULL) return -1;
+ if (taosArrayPush(pRes->uidList, &uid) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
- if (tDecodeI64(pCoder, &pRes->skey) < 0) return -1;
- if (tDecodeI64(pCoder, &pRes->ekey) < 0) return -1;
- if (tDecodeI64v(pCoder, &pRes->affectedRows) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pRes->skey));
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pRes->ekey));
+ TAOS_CHECK_EXIT(tDecodeI64v(pCoder, &pRes->affectedRows));
- if (tDecodeCStrTo(pCoder, pRes->tableFName) < 0) return -1;
- if (tDecodeCStrTo(pCoder, pRes->tsColName) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pRes->tableFName));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pCoder, pRes->tsColName));
pRes->ctimeMs = 0;
if (!tDecodeIsEnd(pCoder)) {
- if (tDecodeI64(pCoder, &pRes->ctimeMs) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pRes->ctimeMs));
}
if (!tDecodeIsEnd(pCoder)) {
- if (tDecodeI8(pCoder, &pRes->source) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pCoder, &pRes->source));
}
- return 0;
+
+_exit:
+ return code;
}
int32_t tEncodeMqMetaRsp(SEncoder *pEncoder, const SMqMetaRsp *pRsp) {
- if (tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset) < 0) return -1;
- if (tEncodeI16(pEncoder, pRsp->resMsgType)) return -1;
- if (tEncodeBinary(pEncoder, pRsp->metaRsp, pRsp->metaRspLen)) return -1;
+ TAOS_CHECK_RETURN(tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset));
+ TAOS_CHECK_RETURN(tEncodeI16(pEncoder, pRsp->resMsgType));
+ TAOS_CHECK_RETURN(tEncodeBinary(pEncoder, pRsp->metaRsp, pRsp->metaRspLen));
return 0;
}
int32_t tDecodeMqMetaRsp(SDecoder *pDecoder, SMqMetaRsp *pRsp) {
- if (tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset) < 0) return -1;
- if (tDecodeI16(pDecoder, &pRsp->resMsgType) < 0) return -1;
- if (tDecodeBinaryAlloc(pDecoder, &pRsp->metaRsp, (uint64_t *)&pRsp->metaRspLen) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset));
+ TAOS_CHECK_RETURN(tDecodeI16(pDecoder, &pRsp->resMsgType));
+ TAOS_CHECK_RETURN(tDecodeBinaryAlloc(pDecoder, &pRsp->metaRsp, (uint64_t *)&pRsp->metaRspLen));
return 0;
}
void tDeleteMqMetaRsp(SMqMetaRsp *pRsp) { taosMemoryFree(pRsp->metaRsp); }
int32_t tEncodeMqDataRspCommon(SEncoder *pEncoder, const SMqDataRspCommon *pRsp) {
- if (tEncodeSTqOffsetVal(pEncoder, &pRsp->reqOffset) < 0) return -1;
- if (tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->blockNum) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeSTqOffsetVal(pEncoder, &pRsp->reqOffset));
+ TAOS_CHECK_EXIT(tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->blockNum));
if (pRsp->blockNum != 0) {
- if (tEncodeI8(pEncoder, pRsp->withTbName) < 0) return -1;
- if (tEncodeI8(pEncoder, pRsp->withSchema) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pRsp->withTbName));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pRsp->withSchema));
for (int32_t i = 0; i < pRsp->blockNum; i++) {
int32_t bLen = *(int32_t *)taosArrayGet(pRsp->blockDataLen, i);
void *data = taosArrayGetP(pRsp->blockData, i);
- if (tEncodeBinary(pEncoder, (const uint8_t *)data, bLen) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, (const uint8_t *)data, bLen));
if (pRsp->withSchema) {
SSchemaWrapper *pSW = (SSchemaWrapper *)taosArrayGetP(pRsp->blockSchema, i);
- if (tEncodeSSchemaWrapper(pEncoder, pSW) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSSchemaWrapper(pEncoder, pSW));
}
if (pRsp->withTbName) {
char *tbName = (char *)taosArrayGetP(pRsp->blockTbName, i);
- if (tEncodeCStr(pEncoder, tbName) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, tbName));
}
}
}
- return 0;
+
+_exit:
+ return code;
}
int32_t tEncodeMqDataRsp(SEncoder *pEncoder, const void *pRsp) {
- if (tEncodeMqDataRspCommon(pEncoder, pRsp) < 0) return -1;
- if (tEncodeI64(pEncoder, ((SMqDataRsp *)pRsp)->sleepTime) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeMqDataRspCommon(pEncoder, pRsp));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, ((SMqDataRsp *)pRsp)->sleepTime));
return 0;
}
int32_t tDecodeMqDataRspCommon(SDecoder *pDecoder, SMqDataRspCommon *pRsp) {
- if (tDecodeSTqOffsetVal(pDecoder, &pRsp->reqOffset) < 0) return -1;
- if (tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->blockNum) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeSTqOffsetVal(pDecoder, &pRsp->reqOffset));
+ TAOS_CHECK_EXIT(tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->blockNum));
if (pRsp->blockNum != 0) {
- if ((pRsp->blockData = taosArrayInit(pRsp->blockNum, sizeof(void *))) == NULL) return -1;
- if ((pRsp->blockDataLen = taosArrayInit(pRsp->blockNum, sizeof(int32_t))) == NULL) return -1;
- if (tDecodeI8(pDecoder, &pRsp->withTbName) < 0) return -1;
- if (tDecodeI8(pDecoder, &pRsp->withSchema) < 0) return -1;
+ if ((pRsp->blockData = taosArrayInit(pRsp->blockNum, sizeof(void *))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ if ((pRsp->blockDataLen = taosArrayInit(pRsp->blockNum, sizeof(int32_t))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pRsp->withTbName));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pRsp->withSchema));
if (pRsp->withTbName) {
- if ((pRsp->blockTbName = taosArrayInit(pRsp->blockNum, sizeof(void *))) == NULL) return -1;
+ if ((pRsp->blockTbName = taosArrayInit(pRsp->blockNum, sizeof(void *))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
if (pRsp->withSchema) {
- if ((pRsp->blockSchema = taosArrayInit(pRsp->blockNum, sizeof(void *))) == NULL) return -1;
+ if ((pRsp->blockSchema = taosArrayInit(pRsp->blockNum, sizeof(void *))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
for (int32_t i = 0; i < pRsp->blockNum; i++) {
void *data;
uint64_t bLen;
- if (tDecodeBinaryAlloc(pDecoder, &data, &bLen) < 0) return -1;
- if (taosArrayPush(pRsp->blockData, &data) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(pDecoder, &data, &bLen));
+ if (taosArrayPush(pRsp->blockData, &data) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
int32_t len = bLen;
- if (taosArrayPush(pRsp->blockDataLen, &len) == NULL) return -1;
+ if (taosArrayPush(pRsp->blockDataLen, &len) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
if (pRsp->withSchema) {
SSchemaWrapper *pSW = (SSchemaWrapper *)taosMemoryCalloc(1, sizeof(SSchemaWrapper));
- if (pSW == NULL) return -1;
- if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) {
+ if (pSW == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+
+ if ((code = tDecodeSSchemaWrapper(pDecoder, pSW))) {
taosMemoryFree(pSW);
- return -1;
+ goto _exit;
}
if (taosArrayPush(pRsp->blockSchema, &pSW) == NULL) {
taosMemoryFree(pSW);
- return -1;
+ TAOS_CHECK_EXIT(terrno);
}
}
if (pRsp->withTbName) {
char *tbName;
- if (tDecodeCStrAlloc(pDecoder, &tbName) < 0) return -1;
- if (taosArrayPush(pRsp->blockTbName, &tbName) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &tbName));
+ if (taosArrayPush(pRsp->blockTbName, &tbName) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
}
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeMqDataRsp(SDecoder *pDecoder, void *pRsp) {
- if (tDecodeMqDataRspCommon(pDecoder, pRsp) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeMqDataRspCommon(pDecoder, pRsp));
if (!tDecodeIsEnd(pDecoder)) {
- if (tDecodeI64(pDecoder, &((SMqDataRsp *)pRsp)->sleepTime) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &((SMqDataRsp *)pRsp)->sleepTime));
}
return 0;
@@ -10804,39 +10797,55 @@ static void tDeleteMqDataRspCommon(void *rsp) {
void tDeleteMqDataRsp(void *rsp) { tDeleteMqDataRspCommon(rsp); }
int32_t tEncodeSTaosxRsp(SEncoder *pEncoder, const void *rsp) {
- if (tEncodeMqDataRspCommon(pEncoder, rsp) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeMqDataRspCommon(pEncoder, rsp));
const STaosxRsp *pRsp = (const STaosxRsp *)rsp;
- if (tEncodeI32(pEncoder, pRsp->createTableNum) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->createTableNum));
if (pRsp->createTableNum) {
for (int32_t i = 0; i < pRsp->createTableNum; i++) {
void *createTableReq = taosArrayGetP(pRsp->createTableReq, i);
int32_t createTableLen = *(int32_t *)taosArrayGet(pRsp->createTableLen, i);
- if (tEncodeBinary(pEncoder, createTableReq, createTableLen) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, createTableReq, createTableLen));
}
}
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, void *rsp) {
- if (tDecodeMqDataRspCommon(pDecoder, rsp) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeMqDataRspCommon(pDecoder, rsp));
STaosxRsp *pRsp = (STaosxRsp *)rsp;
- if (tDecodeI32(pDecoder, &pRsp->createTableNum) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->createTableNum));
if (pRsp->createTableNum) {
- if ((pRsp->createTableLen = taosArrayInit(pRsp->createTableNum, sizeof(int32_t))) == NULL) return -1;
- if ((pRsp->createTableReq = taosArrayInit(pRsp->createTableNum, sizeof(void *))) == NULL) return -1;
+ if ((pRsp->createTableLen = taosArrayInit(pRsp->createTableNum, sizeof(int32_t))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ if ((pRsp->createTableReq = taosArrayInit(pRsp->createTableNum, sizeof(void *))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < pRsp->createTableNum; i++) {
void *pCreate = NULL;
uint64_t len = 0;
- if (tDecodeBinaryAlloc(pDecoder, &pCreate, &len) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(pDecoder, &pCreate, &len));
int32_t l = (int32_t)len;
- if (taosArrayPush(pRsp->createTableLen, &l) == NULL) return -1;
- if (taosArrayPush(pRsp->createTableReq, &pCreate) == NULL) return -1;
+ if (taosArrayPush(pRsp->createTableLen, &l) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ if (taosArrayPush(pRsp->createTableReq, &pCreate) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
- return 0;
+_exit:
+ return code;
}
void tDeleteSTaosxRsp(void *rsp) {
@@ -10850,101 +10859,126 @@ void tDeleteSTaosxRsp(void *rsp) {
}
int32_t tEncodeSSingleDeleteReq(SEncoder *pEncoder, const SSingleDeleteReq *pReq) {
- if (tEncodeCStr(pEncoder, pReq->tbname) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->startTs) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->endTs) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pReq->tbname));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pReq->startTs));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pReq->endTs));
return 0;
}
int32_t tDecodeSSingleDeleteReq(SDecoder *pDecoder, SSingleDeleteReq *pReq) {
- if (tDecodeCStrTo(pDecoder, pReq->tbname) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->startTs) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->endTs) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pReq->tbname));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pReq->startTs));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pReq->endTs));
return 0;
}
int32_t tEncodeSBatchDeleteReq(SEncoder *pEncoder, const SBatchDeleteReq *pReq) {
- if (tEncodeI64(pEncoder, pReq->suid) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->suid));
int32_t sz = taosArrayGetSize(pReq->deleteReqs);
- if (tEncodeI32(pEncoder, sz) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, sz));
for (int32_t i = 0; i < sz; i++) {
SSingleDeleteReq *pOneReq = taosArrayGet(pReq->deleteReqs, i);
- if (tEncodeSSingleDeleteReq(pEncoder, pOneReq) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSSingleDeleteReq(pEncoder, pOneReq));
}
- if (tEncodeI64(pEncoder, pReq->ctimeMs) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->level) < 0) return -1;
- return 0;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->ctimeMs));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->level));
+_exit:
+ return code;
}
static int32_t tDecodeSBatchDeleteReqCommon(SDecoder *pDecoder, SBatchDeleteReq *pReq) {
- if (tDecodeI64(pDecoder, &pReq->suid) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->suid));
int32_t sz;
- if (tDecodeI32(pDecoder, &sz) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &sz));
pReq->deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
- if (pReq->deleteReqs == NULL) return -1;
+ if (pReq->deleteReqs == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < sz; i++) {
SSingleDeleteReq deleteReq;
- if (tDecodeSSingleDeleteReq(pDecoder, &deleteReq) < 0) return -1;
- if (taosArrayPush(pReq->deleteReqs, &deleteReq) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeSSingleDeleteReq(pDecoder, &deleteReq));
+ if (taosArrayPush(pReq->deleteReqs, &deleteReq) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSBatchDeleteReq(SDecoder *pDecoder, SBatchDeleteReq *pReq) {
- if (tDecodeSBatchDeleteReqCommon(pDecoder, pReq)) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeSBatchDeleteReqCommon(pDecoder, pReq));
pReq->ctimeMs = 0;
if (!tDecodeIsEnd(pDecoder)) {
- if (tDecodeI64(pDecoder, &pReq->ctimeMs) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->ctimeMs));
}
if (!tDecodeIsEnd(pDecoder)) {
- if (tDecodeI8(pDecoder, &pReq->level) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->level));
}
- return 0;
+
+_exit:
+ return code;
}
int32_t tDecodeSBatchDeleteReqSetCtime(SDecoder *pDecoder, SBatchDeleteReq *pReq, int64_t ctimeMs) {
- if (tDecodeSBatchDeleteReqCommon(pDecoder, pReq)) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeSBatchDeleteReqCommon(pDecoder, pReq));
pReq->ctimeMs = 0;
if (!tDecodeIsEnd(pDecoder)) {
*(int64_t *)(pDecoder->data + pDecoder->pos) = ctimeMs;
- if (tDecodeI64(pDecoder, &pReq->ctimeMs) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->ctimeMs));
}
- return 0;
+
+_exit:
+ return code;
}
static int32_t tEncodeSSubmitTbData(SEncoder *pCoder, const SSubmitTbData *pSubmitTbData) {
- if (tStartEncode(pCoder) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pCoder));
int32_t flags = pSubmitTbData->flags | ((SUBMIT_REQUEST_VERSION) << 8);
- if (tEncodeI32v(pCoder, flags) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32v(pCoder, flags));
// auto create table
if (pSubmitTbData->flags & SUBMIT_REQ_AUTO_CREATE_TABLE) {
if (!(pSubmitTbData->pCreateTbReq)) {
return TSDB_CODE_INVALID_MSG;
}
- if (tEncodeSVCreateTbReq(pCoder, pSubmitTbData->pCreateTbReq) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSVCreateTbReq(pCoder, pSubmitTbData->pCreateTbReq));
}
// submit data
- if (tEncodeI64(pCoder, pSubmitTbData->suid) < 0) return -1;
- if (tEncodeI64(pCoder, pSubmitTbData->uid) < 0) return -1;
- if (tEncodeI32v(pCoder, pSubmitTbData->sver) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pCoder, pSubmitTbData->suid));
+ TAOS_CHECK_EXIT(tEncodeI64(pCoder, pSubmitTbData->uid));
+ TAOS_CHECK_EXIT(tEncodeI32v(pCoder, pSubmitTbData->sver));
if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
uint64_t nColData = TARRAY_SIZE(pSubmitTbData->aCol);
SColData *aColData = (SColData *)TARRAY_DATA(pSubmitTbData->aCol);
- if (tEncodeU64v(pCoder, nColData) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeU64v(pCoder, nColData));
for (uint64_t i = 0; i < nColData; i++) {
pCoder->pos +=
tPutColData(SUBMIT_REQUEST_VERSION, pCoder->data ? pCoder->data + pCoder->pos : NULL, &aColData[i]);
}
} else {
- if (tEncodeU64v(pCoder, TARRAY_SIZE(pSubmitTbData->aRowP)) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeU64v(pCoder, TARRAY_SIZE(pSubmitTbData->aRowP)));
SRow **rows = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP);
for (int32_t iRow = 0; iRow < TARRAY_SIZE(pSubmitTbData->aRowP); ++iRow) {
@@ -10952,23 +10986,21 @@ static int32_t tEncodeSSubmitTbData(SEncoder *pCoder, const SSubmitTbData *pSubm
pCoder->pos += rows[iRow]->len;
}
}
- if (tEncodeI64(pCoder, pSubmitTbData->ctimeMs) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pCoder, pSubmitTbData->ctimeMs));
tEndEncode(pCoder);
- return 0;
+_exit:
+ return code;
}
static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbData) {
int32_t code = 0;
+ int32_t lino;
int32_t flags;
uint8_t version;
- if (tStartDecode(pCoder) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
-
- if (tDecodeI32v(pCoder, &flags) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(pCoder));
+ TAOS_CHECK_EXIT(tDecodeI32v(pCoder, &flags));
pSubmitTbData->flags = flags & 0xff;
version = (flags >> 8) & 0xff;
@@ -10976,41 +11008,25 @@ static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbDa
if (pSubmitTbData->flags & SUBMIT_REQ_AUTO_CREATE_TABLE) {
pSubmitTbData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
if (pSubmitTbData->pCreateTbReq == NULL) {
- goto _exit;
+ TAOS_CHECK_EXIT(terrno);
}
- if (tDecodeSVCreateTbReq(pCoder, pSubmitTbData->pCreateTbReq) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
+ TAOS_CHECK_EXIT(tDecodeSVCreateTbReq(pCoder, pSubmitTbData->pCreateTbReq));
}
// submit data
- if (tDecodeI64(pCoder, &pSubmitTbData->suid) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
- if (tDecodeI64(pCoder, &pSubmitTbData->uid) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
- if (tDecodeI32v(pCoder, &pSubmitTbData->sver) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSubmitTbData->suid));
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSubmitTbData->uid));
+ TAOS_CHECK_EXIT(tDecodeI32v(pCoder, &pSubmitTbData->sver));
if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
uint64_t nColData;
- if (tDecodeU64v(pCoder, &nColData) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
+ TAOS_CHECK_EXIT(tDecodeU64v(pCoder, &nColData));
pSubmitTbData->aCol = taosArrayInit(nColData, sizeof(SColData));
if (pSubmitTbData->aCol == NULL) {
- code = terrno;
- goto _exit;
+ TAOS_CHECK_EXIT(terrno);
}
for (int32_t i = 0; i < nColData; ++i) {
@@ -11018,19 +11034,18 @@ static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbDa
}
} else {
uint64_t nRow;
- if (tDecodeU64v(pCoder, &nRow) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
+ TAOS_CHECK_EXIT(tDecodeU64v(pCoder, &nRow));
pSubmitTbData->aRowP = taosArrayInit(nRow, sizeof(SRow *));
if (pSubmitTbData->aRowP == NULL) {
- code = terrno;
- goto _exit;
+ TAOS_CHECK_EXIT(terrno);
}
for (int32_t iRow = 0; iRow < nRow; ++iRow) {
SRow **ppRow = taosArrayReserve(pSubmitTbData->aRowP, 1);
+ if (ppRow == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
*ppRow = (SRow *)(pCoder->data + pCoder->pos);
pCoder->pos += (*ppRow)->len;
@@ -11039,31 +11054,27 @@ static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbDa
pSubmitTbData->ctimeMs = 0;
if (!tDecodeIsEnd(pCoder)) {
- if (tDecodeI64(pCoder, &pSubmitTbData->ctimeMs) < 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _exit;
- }
+ TAOS_CHECK_EXIT(tDecodeI64(pCoder, &pSubmitTbData->ctimeMs));
}
tEndDecode(pCoder);
_exit:
- if (code) {
- // TODO: clear
- }
- return 0;
+ return code;
}
int32_t tEncodeSubmitReq(SEncoder *pCoder, const SSubmitReq2 *pReq) {
- if (tStartEncode(pCoder) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
- if (tEncodeU64v(pCoder, taosArrayGetSize(pReq->aSubmitTbData)) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(pCoder));
+ TAOS_CHECK_EXIT(tEncodeU64v(pCoder, taosArrayGetSize(pReq->aSubmitTbData)));
for (uint64_t i = 0; i < taosArrayGetSize(pReq->aSubmitTbData); i++) {
- if (tEncodeSSubmitTbData(pCoder, taosArrayGet(pReq->aSubmitTbData, i)) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSSubmitTbData(pCoder, taosArrayGet(pReq->aSubmitTbData, i)));
}
-
tEndEncode(pCoder);
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSubmitReq(SDecoder *pCoder, SSubmitReq2 *pReq) {
@@ -11172,17 +11183,21 @@ void tDestroySubmitReq(SSubmitReq2 *pReq, int32_t flag) {
}
int32_t tEncodeSSubmitRsp2(SEncoder *pCoder, const SSubmitRsp2 *pRsp) {
- if (tStartEncode(pCoder) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
- if (tEncodeI32v(pCoder, pRsp->affectedRows) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(pCoder));
- if (tEncodeU64v(pCoder, taosArrayGetSize(pRsp->aCreateTbRsp)) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32v(pCoder, pRsp->affectedRows));
+
+ TAOS_CHECK_EXIT(tEncodeU64v(pCoder, taosArrayGetSize(pRsp->aCreateTbRsp)));
for (int32_t i = 0; i < taosArrayGetSize(pRsp->aCreateTbRsp); ++i) {
- if (tEncodeSVCreateTbRsp(pCoder, taosArrayGet(pRsp->aCreateTbRsp, i)) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSVCreateTbRsp(pCoder, taosArrayGet(pRsp->aCreateTbRsp, i)));
}
tEndEncode(pCoder);
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSSubmitRsp2(SDecoder *pCoder, SSubmitRsp2 *pRsp) {
@@ -11265,55 +11280,79 @@ void tDestroySSubmitRsp2(SSubmitRsp2 *pRsp, int32_t flag) {
}
int32_t tSerializeSMPauseStreamReq(void *buf, int32_t bufLen, const SMPauseStreamReq *pReq) {
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name));
+ TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSMPauseStreamReq(void *buf, int32_t bufLen, SMPauseStreamReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
- if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name));
+ TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igNotExists));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
int32_t tSerializeSMResumeStreamReq(void *buf, int32_t bufLen, const SMResumeStreamReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->igUntreated) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name));
+ TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists));
+ TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igUntreated));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSMResumeStreamReq(void *buf, int32_t bufLen, SMResumeStreamReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
- if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
- if (tDecodeI8(&decoder, &pReq->igUntreated) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name));
+ TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igNotExists));
+ TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igUntreated));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
int32_t tEncodeMqSubTopicEp(void **buf, const SMqSubTopicEp *pTopicEp) {
@@ -11360,59 +11399,71 @@ void tDeleteMqSubTopicEp(SMqSubTopicEp *pSubTopicEp) {
int32_t tSerializeSCMCreateViewReq(void *buf, int32_t bufLen, const SCMCreateViewReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->fullname) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->dbFName) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->querySql) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->sql) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->orReplace) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->precision) < 0) return -1;
- if (tEncodeI32(&encoder, pReq->numOfCols) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->fullname));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->querySql));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sql));
+ TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->orReplace));
+ TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->precision));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->numOfCols));
for (int32_t i = 0; i < pReq->numOfCols; ++i) {
SSchema *pSchema = &pReq->pSchema[i];
- if (tEncodeSSchema(&encoder, pSchema) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSSchema(&encoder, pSchema));
}
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSCMCreateViewReq(void *buf, int32_t bufLen, SCMCreateViewReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->fullname) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->dbFName) < 0) return -1;
- if (tDecodeCStrAlloc(&decoder, &pReq->querySql) < 0) return -1;
- if (tDecodeCStrAlloc(&decoder, &pReq->sql) < 0) return -1;
- if (tDecodeI8(&decoder, &pReq->orReplace) < 0) return -1;
- if (tDecodeI8(&decoder, &pReq->precision) < 0) return -1;
- if (tDecodeI32(&decoder, &pReq->numOfCols) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->fullname));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(&decoder, &pReq->querySql));
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(&decoder, &pReq->sql));
+ TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->orReplace));
+ TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->precision));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->numOfCols));
if (pReq->numOfCols > 0) {
pReq->pSchema = taosMemoryCalloc(pReq->numOfCols, sizeof(SSchema));
if (pReq->pSchema == NULL) {
- return -1;
+ TAOS_CHECK_EXIT(terrno);
}
for (int32_t i = 0; i < pReq->numOfCols; ++i) {
SSchema *pSchema = pReq->pSchema + i;
- if (tDecodeSSchema(&decoder, pSchema) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeSSchema(&decoder, pSchema));
}
}
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
void tFreeSCMCreateViewReq(SCMCreateViewReq *pReq) {
@@ -11427,37 +11478,49 @@ void tFreeSCMCreateViewReq(SCMCreateViewReq *pReq) {
int32_t tSerializeSCMDropViewReq(void *buf, int32_t bufLen, const SCMDropViewReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->fullname) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->dbFName) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->sql) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->fullname));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sql));
+ TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->igNotExists));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSCMDropViewReq(void *buf, int32_t bufLen, SCMDropViewReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->fullname) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->dbFName) < 0) return -1;
- if (tDecodeCStrAlloc(&decoder, &pReq->sql) < 0) return -1;
- if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->fullname));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dbFName));
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(&decoder, &pReq->sql));
+ TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->igNotExists));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
void tFreeSCMDropViewReq(SCMDropViewReq *pReq) {
if (NULL == pReq) {
@@ -11469,101 +11532,133 @@ void tFreeSCMDropViewReq(SCMDropViewReq *pReq) {
int32_t tSerializeSViewMetaReq(void *buf, int32_t bufLen, const SViewMetaReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->fullname) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->fullname));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSViewMetaReq(void *buf, int32_t bufLen, SViewMetaReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->fullname) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->fullname));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
static int32_t tEncodeSViewMetaRsp(SEncoder *pEncoder, const SViewMetaRsp *pRsp) {
- if (tEncodeCStr(pEncoder, pRsp->name) < 0) return -1;
- if (tEncodeCStr(pEncoder, pRsp->dbFName) < 0) return -1;
- if (tEncodeCStr(pEncoder, pRsp->user) < 0) return -1;
- if (tEncodeU64(pEncoder, pRsp->dbId) < 0) return -1;
- if (tEncodeU64(pEncoder, pRsp->viewId) < 0) return -1;
- if (tEncodeCStr(pEncoder, pRsp->querySql) < 0) return -1;
- if (tEncodeI8(pEncoder, pRsp->precision) < 0) return -1;
- if (tEncodeI8(pEncoder, pRsp->type) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->version) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->numOfCols) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pRsp->name));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pRsp->dbFName));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pRsp->user));
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pRsp->dbId));
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pRsp->viewId));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pRsp->querySql));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pRsp->precision));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pRsp->type));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->version));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->numOfCols));
for (int32_t i = 0; i < pRsp->numOfCols; ++i) {
SSchema *pSchema = &pRsp->pSchema[i];
- if (tEncodeSSchema(pEncoder, pSchema) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSSchema(pEncoder, pSchema));
}
- return 0;
+_exit:
+ return code;
}
int32_t tSerializeSViewMetaRsp(void *buf, int32_t bufLen, const SViewMetaRsp *pRsp) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeSViewMetaRsp(&encoder, pRsp) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeSViewMetaRsp(&encoder, pRsp));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
static int32_t tDecodeSViewMetaRsp(SDecoder *pDecoder, SViewMetaRsp *pRsp) {
- if (tDecodeCStrTo(pDecoder, pRsp->name) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pRsp->dbFName) < 0) return -1;
- if (tDecodeCStrAlloc(pDecoder, &pRsp->user) < 0) return -1;
- if (tDecodeU64(pDecoder, &pRsp->dbId) < 0) return -1;
- if (tDecodeU64(pDecoder, &pRsp->viewId) < 0) return -1;
- if (tDecodeCStrAlloc(pDecoder, &pRsp->querySql) < 0) return -1;
- if (tDecodeI8(pDecoder, &pRsp->precision) < 0) return -1;
- if (tDecodeI8(pDecoder, &pRsp->type) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->version) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->numOfCols) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pRsp->name));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pRsp->dbFName));
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pRsp->user));
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, &pRsp->dbId));
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, &pRsp->viewId));
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pRsp->querySql));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pRsp->precision));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pRsp->type));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->version));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->numOfCols));
if (pRsp->numOfCols > 0) {
pRsp->pSchema = taosMemoryCalloc(pRsp->numOfCols, sizeof(SSchema));
if (pRsp->pSchema == NULL) {
- return -1;
+ TAOS_CHECK_EXIT(terrno);
}
for (int32_t i = 0; i < pRsp->numOfCols; ++i) {
SSchema *pSchema = pRsp->pSchema + i;
- if (tDecodeSSchema(pDecoder, pSchema) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeSSchema(pDecoder, pSchema));
}
}
- return 0;
+_exit:
+ return code;
}
int32_t tDeserializeSViewMetaRsp(void *buf, int32_t bufLen, SViewMetaRsp *pRsp) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeSViewMetaRsp(&decoder, pRsp) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeSViewMetaRsp(&decoder, pRsp));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
void tFreeSViewMetaRsp(SViewMetaRsp *pRsp) {
@@ -11578,48 +11673,64 @@ void tFreeSViewMetaRsp(SViewMetaRsp *pRsp) {
int32_t tSerializeSViewHbRsp(void *buf, int32_t bufLen, SViewHbRsp *pRsp) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
int32_t numOfMeta = taosArrayGetSize(pRsp->pViewRsp);
- if (tEncodeI32(&encoder, numOfMeta) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, numOfMeta));
for (int32_t i = 0; i < numOfMeta; ++i) {
SViewMetaRsp *pMetaRsp = taosArrayGetP(pRsp->pViewRsp, i);
- if (tEncodeSViewMetaRsp(&encoder, pMetaRsp) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSViewMetaRsp(&encoder, pMetaRsp));
}
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSViewHbRsp(void *buf, int32_t bufLen, SViewHbRsp *pRsp) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
int32_t numOfMeta = 0;
- if (tDecodeI32(&decoder, &numOfMeta) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfMeta));
pRsp->pViewRsp = taosArrayInit(numOfMeta, POINTER_BYTES);
if (pRsp->pViewRsp == NULL) {
- return -1;
+ TAOS_CHECK_EXIT(terrno);
}
for (int32_t i = 0; i < numOfMeta; ++i) {
SViewMetaRsp *metaRsp = taosMemoryCalloc(1, sizeof(SViewMetaRsp));
- if (NULL == metaRsp) return -1;
- if (tDecodeSViewMetaRsp(&decoder, metaRsp) < 0) return -1;
- if (taosArrayPush(pRsp->pViewRsp, &metaRsp) == NULL) return -1;
+ if (NULL == metaRsp) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ TAOS_CHECK_EXIT(tDecodeSViewMetaRsp(&decoder, metaRsp));
+ if (taosArrayPush(pRsp->pViewRsp, &metaRsp) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
void tFreeSViewHbRsp(SViewHbRsp *pRsp) {
@@ -11647,183 +11758,243 @@ void setFieldWithOptions(SFieldWithOptions *fieldWithOptions, SField *field) {
}
int32_t tSerializeTableTSMAInfoReq(void *buf, int32_t bufLen, const STableTSMAInfoReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
- if (tEncodeI8(&encoder, pReq->fetchingWithTsmaName) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->name));
+ TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->fetchingWithTsmaName));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeTableTSMAInfoReq(void *buf, int32_t bufLen, STableTSMAInfoReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
- if (tDecodeI8(&decoder, (uint8_t *)&pReq->fetchingWithTsmaName) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->name));
+ TAOS_CHECK_EXIT(tDecodeI8(&decoder, (uint8_t *)&pReq->fetchingWithTsmaName));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
static int32_t tEncodeTableTSMAInfo(SEncoder *pEncoder, const STableTSMAInfo *pTsmaInfo) {
- if (tEncodeCStr(pEncoder, pTsmaInfo->name) < 0) return -1;
- if (tEncodeU64(pEncoder, pTsmaInfo->tsmaId) < 0) return -1;
- if (tEncodeCStr(pEncoder, pTsmaInfo->tb) < 0) return -1;
- if (tEncodeCStr(pEncoder, pTsmaInfo->dbFName) < 0) return -1;
- if (tEncodeU64(pEncoder, pTsmaInfo->suid) < 0) return -1;
- if (tEncodeU64(pEncoder, pTsmaInfo->destTbUid) < 0) return -1;
- if (tEncodeU64(pEncoder, pTsmaInfo->dbId) < 0) return -1;
- if (tEncodeI32(pEncoder, pTsmaInfo->version) < 0) return -1;
- if (tEncodeCStr(pEncoder, pTsmaInfo->targetTb) < 0) return -1;
- if (tEncodeCStr(pEncoder, pTsmaInfo->targetDbFName) < 0) return -1;
- if (tEncodeI64(pEncoder, pTsmaInfo->interval) < 0) return -1;
- if (tEncodeI8(pEncoder, pTsmaInfo->unit) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTsmaInfo->name));
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTsmaInfo->tsmaId));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTsmaInfo->tb));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTsmaInfo->dbFName));
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTsmaInfo->suid));
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTsmaInfo->destTbUid));
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTsmaInfo->dbId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTsmaInfo->version));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTsmaInfo->targetTb));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTsmaInfo->targetDbFName));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTsmaInfo->interval));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTsmaInfo->unit));
int32_t size = pTsmaInfo->pFuncs ? pTsmaInfo->pFuncs->size : 0;
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
for (int32_t i = 0; i < size; ++i) {
STableTSMAFuncInfo *pFuncInfo = taosArrayGet(pTsmaInfo->pFuncs, i);
- if (tEncodeI32(pEncoder, pFuncInfo->funcId) < 0) return -1;
- if (tEncodeI16(pEncoder, pFuncInfo->colId) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pFuncInfo->funcId));
+ TAOS_CHECK_EXIT(tEncodeI16(pEncoder, pFuncInfo->colId));
}
size = pTsmaInfo->pTags ? pTsmaInfo->pTags->size : 0;
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
for (int32_t i = 0; i < size; ++i) {
const SSchema *pSchema = taosArrayGet(pTsmaInfo->pTags, i);
- if (tEncodeSSchema(pEncoder, pSchema) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSSchema(pEncoder, pSchema));
}
size = pTsmaInfo->pUsedCols ? pTsmaInfo->pUsedCols->size : 0;
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
for (int32_t i = 0; i < size; ++i) {
const SSchema *pSchema = taosArrayGet(pTsmaInfo->pUsedCols, i);
- if (tEncodeSSchema(pEncoder, pSchema) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSSchema(pEncoder, pSchema));
}
- if (tEncodeCStr(pEncoder, pTsmaInfo->ast) < 0) return -1;
- if (tEncodeI64(pEncoder, pTsmaInfo->streamUid) < 0) return -1;
- if (tEncodeI64(pEncoder, pTsmaInfo->reqTs) < 0) return -1;
- if (tEncodeI64(pEncoder, pTsmaInfo->rspTs) < 0) return -1;
- if (tEncodeI64(pEncoder, pTsmaInfo->delayDuration) < 0) return -1;
- if (tEncodeI8(pEncoder, pTsmaInfo->fillHistoryFinished) < 0) return -1;
- return 0;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTsmaInfo->ast));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTsmaInfo->streamUid));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTsmaInfo->reqTs));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTsmaInfo->rspTs));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTsmaInfo->delayDuration));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTsmaInfo->fillHistoryFinished));
+
+_exit:
+ return code;
}
static int32_t tDecodeTableTSMAInfo(SDecoder *pDecoder, STableTSMAInfo *pTsmaInfo) {
- if (tDecodeCStrTo(pDecoder, pTsmaInfo->name) < 0) return -1;
- if (tDecodeU64(pDecoder, &pTsmaInfo->tsmaId) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pTsmaInfo->tb) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pTsmaInfo->dbFName) < 0) return -1;
- if (tDecodeU64(pDecoder, &pTsmaInfo->suid) < 0) return -1;
- if (tDecodeU64(pDecoder, &pTsmaInfo->destTbUid) < 0) return -1;
- if (tDecodeU64(pDecoder, &pTsmaInfo->dbId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pTsmaInfo->version) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pTsmaInfo->targetTb) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pTsmaInfo->targetDbFName) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTsmaInfo->interval) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTsmaInfo->unit) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTsmaInfo->name));
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, &pTsmaInfo->tsmaId));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTsmaInfo->tb));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTsmaInfo->dbFName));
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, &pTsmaInfo->suid));
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, &pTsmaInfo->destTbUid));
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, &pTsmaInfo->dbId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTsmaInfo->version));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTsmaInfo->targetTb));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTsmaInfo->targetDbFName));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTsmaInfo->interval));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTsmaInfo->unit));
int32_t size = 0;
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
if (size > 0) {
pTsmaInfo->pFuncs = taosArrayInit(size, sizeof(STableTSMAFuncInfo));
- if (!pTsmaInfo->pFuncs) return -1;
+ if (!pTsmaInfo->pFuncs) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < size; ++i) {
STableTSMAFuncInfo funcInfo = {0};
- if (tDecodeI32(pDecoder, &funcInfo.funcId) < 0) return -1;
- if (tDecodeI16(pDecoder, &funcInfo.colId) < 0) return -1;
- if (!taosArrayPush(pTsmaInfo->pFuncs, &funcInfo)) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &funcInfo.funcId));
+ TAOS_CHECK_EXIT(tDecodeI16(pDecoder, &funcInfo.colId));
+ if (!taosArrayPush(pTsmaInfo->pFuncs, &funcInfo)) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
if (size > 0) {
pTsmaInfo->pTags = taosArrayInit(size, sizeof(SSchema));
- if (!pTsmaInfo->pTags) return -1;
+ if (!pTsmaInfo->pTags) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < size; ++i) {
SSchema schema = {0};
- if (tDecodeSSchema(pDecoder, &schema) < 0) return -1;
- if (taosArrayPush(pTsmaInfo->pTags, &schema) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeSSchema(pDecoder, &schema));
+ if (taosArrayPush(pTsmaInfo->pTags, &schema) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
if (size > 0) {
pTsmaInfo->pUsedCols = taosArrayInit(size, sizeof(SSchema));
- if (!pTsmaInfo->pUsedCols) return -1;
+ if (!pTsmaInfo->pUsedCols) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < size; ++i) {
SSchema schema = {0};
- if (tDecodeSSchema(pDecoder, &schema) < 0) return -1;
- if (taosArrayPush(pTsmaInfo->pUsedCols, &schema) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeSSchema(pDecoder, &schema));
+ if (taosArrayPush(pTsmaInfo->pUsedCols, &schema) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
- if (tDecodeCStrAlloc(pDecoder, &pTsmaInfo->ast) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTsmaInfo->streamUid) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTsmaInfo->reqTs) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTsmaInfo->rspTs) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTsmaInfo->delayDuration) < 0) return -1;
- if (tDecodeI8(pDecoder, (int8_t *)&pTsmaInfo->fillHistoryFinished) < 0) return -1;
- return 0;
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pTsmaInfo->ast));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTsmaInfo->streamUid));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTsmaInfo->reqTs));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTsmaInfo->rspTs));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTsmaInfo->delayDuration));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, (int8_t *)&pTsmaInfo->fillHistoryFinished));
+
+_exit:
+ return code;
}
static int32_t tEncodeTableTSMAInfoRsp(SEncoder *pEncoder, const STableTSMAInfoRsp *pRsp) {
+ int32_t code = 0;
+ int32_t lino;
+
int32_t size = pRsp->pTsmas ? pRsp->pTsmas->size : 0;
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
for (int32_t i = 0; i < size; ++i) {
STableTSMAInfo *pInfo = taosArrayGetP(pRsp->pTsmas, i);
- if (tEncodeTableTSMAInfo(pEncoder, pInfo) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeTableTSMAInfo(pEncoder, pInfo));
}
- return 0;
+_exit:
+ return code;
}
static int32_t tDecodeTableTSMAInfoRsp(SDecoder *pDecoder, STableTSMAInfoRsp *pRsp) {
int32_t size = 0;
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
if (size <= 0) return 0;
pRsp->pTsmas = taosArrayInit(size, POINTER_BYTES);
- if (!pRsp->pTsmas) return -1;
+ if (!pRsp->pTsmas) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < size; ++i) {
STableTSMAInfo *pTsma = taosMemoryCalloc(1, sizeof(STableTSMAInfo));
- if (!pTsma) return -1;
- if (taosArrayPush(pRsp->pTsmas, &pTsma) == NULL) return -1;
- if (tDecodeTableTSMAInfo(pDecoder, pTsma) < 0) return -1;
+ if (!pTsma) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ if (taosArrayPush(pRsp->pTsmas, &pTsma) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ TAOS_CHECK_EXIT(tDecodeTableTSMAInfo(pDecoder, pTsma));
}
- return 0;
+_exit:
+ return code;
}
int32_t tSerializeTableTSMAInfoRsp(void *buf, int32_t bufLen, const STableTSMAInfoRsp *pRsp) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeTableTSMAInfoRsp(&encoder, pRsp) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeTableTSMAInfoRsp(&encoder, pRsp));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeTableTSMAInfoRsp(void *buf, int32_t bufLen, STableTSMAInfoRsp *pRsp) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeTableTSMAInfoRsp(&decoder, pRsp) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeTableTSMAInfoRsp(&decoder, pRsp));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
void tFreeTableTSMAInfo(void *p) {
@@ -11884,129 +12055,184 @@ void tFreeTableTSMAInfoRsp(STableTSMAInfoRsp *pRsp) {
}
static int32_t tEncodeStreamProgressReq(SEncoder *pEncoder, const SStreamProgressReq *pReq) {
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->vgId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->fetchIdx) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->subFetchIdx) < 0) return -1;
- return 0;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->vgId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->fetchIdx));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->subFetchIdx));
+
+_exit:
+ return code;
}
int32_t tSerializeStreamProgressReq(void *buf, int32_t bufLen, const SStreamProgressReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeStreamProgressReq(&encoder, pReq) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeStreamProgressReq(&encoder, pReq));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
static int32_t tDecodeStreamProgressReq(SDecoder *pDecoder, SStreamProgressReq *pReq) {
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->vgId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->fetchIdx) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->subFetchIdx) < 0) return -1;
- return 0;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->vgId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->fetchIdx));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->subFetchIdx));
+
+_exit:
+ return code;
}
int32_t tDeserializeStreamProgressReq(void *buf, int32_t bufLen, SStreamProgressReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, (char *)buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeStreamProgressReq(&decoder, pReq) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeStreamProgressReq(&decoder, pReq));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
static int32_t tEncodeStreamProgressRsp(SEncoder *pEncoder, const SStreamProgressRsp *pRsp) {
- if (tEncodeI64(pEncoder, pRsp->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->vgId) < 0) return -1;
- if (tEncodeI8(pEncoder, pRsp->fillHisFinished) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->progressDelay) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->fetchIdx) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->subFetchIdx) < 0) return -1;
- return 0;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pRsp->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->vgId));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pRsp->fillHisFinished));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pRsp->progressDelay));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->fetchIdx));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->subFetchIdx));
+
+_exit:
+ return code;
}
int32_t tSerializeStreamProgressRsp(void *buf, int32_t bufLen, const SStreamProgressRsp *pRsp) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeStreamProgressRsp(&encoder, pRsp) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeStreamProgressRsp(&encoder, pRsp));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
static int32_t tDecodeStreamProgressRsp(SDecoder *pDecoder, SStreamProgressRsp *pRsp) {
- if (tDecodeI64(pDecoder, &pRsp->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->vgId) < 0) return -1;
- if (tDecodeI8(pDecoder, (int8_t *)&pRsp->fillHisFinished) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->progressDelay) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->fetchIdx) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->subFetchIdx) < 0) return -1;
- return 0;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->vgId));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, (int8_t *)&pRsp->fillHisFinished));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->progressDelay));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->fetchIdx));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->subFetchIdx));
+
+_exit:
+ return code;
}
int32_t tDeserializeSStreamProgressRsp(void *buf, int32_t bufLen, SStreamProgressRsp *pRsp) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeStreamProgressRsp(&decoder, pRsp) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeStreamProgressRsp(&decoder, pRsp));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
int32_t tEncodeSMDropTbReqOnSingleVg(SEncoder *pEncoder, const SMDropTbReqsOnSingleVg *pReq) {
const SVgroupInfo *pVgInfo = &pReq->vgInfo;
- if (tEncodeI32(pEncoder, pVgInfo->vgId) < 0) return -1;
- if (tEncodeU32(pEncoder, pVgInfo->hashBegin) < 0) return -1;
- if (tEncodeU32(pEncoder, pVgInfo->hashEnd) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pVgInfo->epSet) < 0) return -1;
- if (tEncodeI32(pEncoder, pVgInfo->numOfTable) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pVgInfo->vgId));
+ TAOS_CHECK_EXIT(tEncodeU32(pEncoder, pVgInfo->hashBegin));
+ TAOS_CHECK_EXIT(tEncodeU32(pEncoder, pVgInfo->hashEnd));
+ TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pVgInfo->epSet));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pVgInfo->numOfTable));
int32_t size = pReq->pTbs ? pReq->pTbs->size : 0;
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
for (int32_t i = 0; i < size; ++i) {
const SVDropTbReq *pInfo = taosArrayGet(pReq->pTbs, i);
- if (tEncodeSVDropTbReq(pEncoder, pInfo) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSVDropTbReq(pEncoder, pInfo));
}
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeSMDropTbReqOnSingleVg(SDecoder *pDecoder, SMDropTbReqsOnSingleVg *pReq) {
- if (tDecodeI32(pDecoder, &pReq->vgInfo.vgId) < 0) return -1;
- if (tDecodeU32(pDecoder, &pReq->vgInfo.hashBegin) < 0) return -1;
- if (tDecodeU32(pDecoder, &pReq->vgInfo.hashEnd) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &pReq->vgInfo.epSet) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->vgInfo.numOfTable) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->vgInfo.vgId));
+ TAOS_CHECK_EXIT(tDecodeU32(pDecoder, &pReq->vgInfo.hashBegin));
+ TAOS_CHECK_EXIT(tDecodeU32(pDecoder, &pReq->vgInfo.hashEnd));
+ TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &pReq->vgInfo.epSet));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->vgInfo.numOfTable));
int32_t size = 0;
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
pReq->pTbs = taosArrayInit(size, sizeof(SVDropTbReq));
if (!pReq->pTbs) {
- return -1;
+ TAOS_CHECK_EXIT(terrno);
}
SVDropTbReq pTbReq = {0};
for (int32_t i = 0; i < size; ++i) {
- if (tDecodeSVDropTbReq(pDecoder, &pTbReq) < 0) return -1;
- if (taosArrayPush(pReq->pTbs, &pTbReq) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeSVDropTbReq(pDecoder, &pTbReq));
+ if (taosArrayPush(pReq->pTbs, &pTbReq) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
- return 0;
+
+_exit:
+ return code;
}
void tFreeSMDropTbReqOnSingleVg(void *p) {
@@ -12016,38 +12242,54 @@ void tFreeSMDropTbReqOnSingleVg(void *p) {
int32_t tSerializeSMDropTbsReq(void *buf, int32_t bufLen, const SMDropTbsReq *pReq) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
+
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
int32_t size = pReq->pVgReqs ? pReq->pVgReqs->size : 0;
- if (tEncodeI32(&encoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, size));
for (int32_t i = 0; i < size; ++i) {
SMDropTbReqsOnSingleVg *pVgReq = taosArrayGet(pReq->pVgReqs, i);
- if (tEncodeSMDropTbReqOnSingleVg(&encoder, pVgReq) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSMDropTbReqOnSingleVg(&encoder, pVgReq));
}
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSMDropTbsReq(void *buf, int32_t bufLen, SMDropTbsReq *pReq) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
int32_t size = 0;
- if (tDecodeI32(&decoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &size));
pReq->pVgReqs = taosArrayInit(size, sizeof(SMDropTbReqsOnSingleVg));
if (!pReq->pVgReqs) {
- return -1;
+ TAOS_CHECK_EXIT(terrno);
}
for (int32_t i = 0; i < size; ++i) {
SMDropTbReqsOnSingleVg vgReq = {0};
- if (tDecodeSMDropTbReqOnSingleVg(&decoder, &vgReq) < 0) return -1;
- if (taosArrayPush(pReq->pVgReqs, &vgReq) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeSMDropTbReqOnSingleVg(&decoder, &vgReq));
+ if (taosArrayPush(pReq->pVgReqs, &vgReq) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
void tFreeSMDropTbsReq(void *p) {
@@ -12056,29 +12298,42 @@ void tFreeSMDropTbsReq(void *p) {
}
int32_t tEncodeVFetchTtlExpiredTbsRsp(SEncoder *pCoder, const SVFetchTtlExpiredTbsRsp *pRsp) {
- if (tEncodeI32(pCoder, pRsp->vgId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeI32(pCoder, pRsp->vgId));
int32_t size = pRsp->pExpiredTbs ? pRsp->pExpiredTbs->size : 0;
- if (tEncodeI32(pCoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pCoder, size));
for (int32_t i = 0; i < size; ++i) {
- if (tEncodeSVDropTbReq(pCoder, taosArrayGet(pRsp->pExpiredTbs, i)) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeSVDropTbReq(pCoder, taosArrayGet(pRsp->pExpiredTbs, i)));
}
- return 0;
+
+_exit:
+ return code;
}
int32_t tDecodeVFetchTtlExpiredTbsRsp(SDecoder *pCoder, SVFetchTtlExpiredTbsRsp *pRsp) {
- if (tDecodeI32(pCoder, &pRsp->vgId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI32(pCoder, &pRsp->vgId));
int32_t size = 0;
- if (tDecodeI32(pCoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pCoder, &size));
if (size > 0) {
pRsp->pExpiredTbs = taosArrayInit(size, sizeof(SVDropTbReq));
- if (!pRsp->pExpiredTbs) return terrno;
+ if (!pRsp->pExpiredTbs) {
+ TAOS_CHECK_EXIT(terrno);
+ }
SVDropTbReq tb = {0};
for (int32_t i = 0; i < size; ++i) {
- if (tDecodeSVDropTbReq(pCoder, &tb) < 0) return -1;
- if (taosArrayPush(pRsp->pExpiredTbs, &tb) == NULL) return -1;
+ TAOS_CHECK_EXIT(tDecodeSVDropTbReq(pCoder, &tb));
+ if (taosArrayPush(pRsp->pExpiredTbs, &tb) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
- return 0;
+_exit:
+ return code;
}
void tFreeFetchTtlExpiredTbsRsp(void *p) {
@@ -12087,52 +12342,73 @@ void tFreeFetchTtlExpiredTbsRsp(void *p) {
}
int32_t tEncodeMqBatchMetaRsp(SEncoder *pEncoder, const SMqBatchMetaRsp *pRsp) {
- if (tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tEncodeSTqOffsetVal(pEncoder, &pRsp->rspOffset));
int32_t size = taosArrayGetSize(pRsp->batchMetaReq);
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
if (size > 0) {
for (int32_t i = 0; i < size; i++) {
void *pMetaReq = taosArrayGetP(pRsp->batchMetaReq, i);
int32_t metaLen = *(int32_t *)taosArrayGet(pRsp->batchMetaLen, i);
- if (tEncodeBinary(pEncoder, pMetaReq, metaLen) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, pMetaReq, metaLen));
}
}
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeMqBatchMetaRsp(SDecoder *pDecoder, SMqBatchMetaRsp *pRsp) {
int32_t size = 0;
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
if (size > 0) {
pRsp->batchMetaReq = taosArrayInit(size, POINTER_BYTES);
- if (!pRsp->batchMetaReq) return -1;
+ if (!pRsp->batchMetaReq) {
+ TAOS_CHECK_EXIT(terrno);
+ }
pRsp->batchMetaLen = taosArrayInit(size, sizeof(int32_t));
- if (!pRsp->batchMetaLen) return -1;
+ if (!pRsp->batchMetaLen) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < size; i++) {
void *pCreate = NULL;
uint64_t len = 0;
- if (tDecodeBinaryAlloc(pDecoder, &pCreate, &len) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(pDecoder, &pCreate, &len));
int32_t l = (int32_t)len;
- if (taosArrayPush(pRsp->batchMetaReq, &pCreate) == NULL) return -1;
- if (taosArrayPush(pRsp->batchMetaLen, &l) == NULL) return -1;
+ if (taosArrayPush(pRsp->batchMetaReq, &pCreate) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ if (taosArrayPush(pRsp->batchMetaLen, &l) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
}
}
- return 0;
+_exit:
+ return code;
}
int32_t tSemiDecodeMqBatchMetaRsp(SDecoder *pDecoder, SMqBatchMetaRsp *pRsp) {
- if (tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tDecodeSTqOffsetVal(pDecoder, &pRsp->rspOffset));
if (pDecoder->size < pDecoder->pos) {
- return -1;
+ return TSDB_CODE_INVALID_PARA;
}
pRsp->metaBuffLen = TD_CODER_REMAIN_CAPACITY(pDecoder);
pRsp->pMetaBuff = taosMemoryCalloc(1, pRsp->metaBuffLen);
if (pRsp->pMetaBuff == NULL) {
- return -1;
+ TAOS_CHECK_EXIT(terrno);
}
memcpy(pRsp->pMetaBuff, TD_CODER_CURRENT(pDecoder), pRsp->metaBuffLen);
- return 0;
+
+_exit:
+ return code;
}
void tDeleteMqBatchMetaRsp(SMqBatchMetaRsp *pRsp) {
diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c
index 9b0cd7d5a5..9f5db9b0eb 100644
--- a/source/dnode/mgmt/exe/dmMain.c
+++ b/source/dnode/mgmt/exe/dmMain.c
@@ -147,12 +147,14 @@ static void dmSetSignalHandle() {
(void)taosSetSignal(SIGQUIT, dmStopDnode);
#endif
+#if 0
#ifndef WINDOWS
(void)taosSetSignal(SIGBUS, dmLogCrash);
#endif
(void)taosSetSignal(SIGABRT, dmLogCrash);
(void)taosSetSignal(SIGFPE, dmLogCrash);
(void)taosSetSignal(SIGSEGV, dmLogCrash);
+#endif
}
static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h
index 75ba51e498..dceb86c963 100644
--- a/source/dnode/mnode/impl/inc/mndStream.h
+++ b/source/dnode/mnode/impl/inc/mndStream.h
@@ -114,7 +114,7 @@ int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb);
int32_t mndPersistStream(STrans *pTrans, SStreamObj *pStream);
int32_t mndStreamRegisterTrans(STrans *pTrans, const char *pTransName, int64_t streamId);
int32_t mndStreamClearFinishedTrans(SMnode *pMnode, int32_t *pNumOfActiveChkpt);
-bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *pTransName, bool lock);
+int32_t mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *pTransName, bool lock);
int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamId);
int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams);
diff --git a/source/dnode/mnode/impl/src/mndCompact.c b/source/dnode/mnode/impl/src/mndCompact.c
index b8073885fd..bce8c5901d 100644
--- a/source/dnode/mnode/impl/src/mndCompact.c
+++ b/source/dnode/mnode/impl/src/mndCompact.c
@@ -55,36 +55,44 @@ void tFreeCompactObj(SCompactObj *pCompact) {}
int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
-
- if (tEncodeI32(&encoder, pObj->compactId) < 0) return -1;
- if (tEncodeCStr(&encoder, pObj->dbname) < 0) return -1;
- if (tEncodeI64(&encoder, pObj->startTime) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->compactId));
+ TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pObj->dbname));
+ TAOS_CHECK_EXIT(tEncodeI64(&encoder, pObj->startTime));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) {
- int8_t ex = 0;
+ int32_t code = 0;
+ int32_t lino;
SDecoder decoder = {0};
tDecoderInit(&decoder, buf, bufLen);
- TAOS_CHECK_RETURN(tStartDecode(&decoder));
-
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->compactId));
- TAOS_CHECK_RETURN(tDecodeCStrTo(&decoder, pObj->dbname));
- TAOS_CHECK_RETURN(tDecodeI64(&decoder, &pObj->startTime));
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->compactId));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pObj->dbname));
+ TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pObj->startTime));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
@@ -633,8 +641,8 @@ void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact) {
static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) {
int32_t code = 0;
- bool needSave = false;
- void *pIter = NULL;
+ bool needSave = false;
+ void *pIter = NULL;
while (1) {
SCompactDetailObj *pDetail = NULL;
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail);
diff --git a/source/dnode/mnode/impl/src/mndCompactDetail.c b/source/dnode/mnode/impl/src/mndCompactDetail.c
index 86d398e7bd..d1bdb4734d 100644
--- a/source/dnode/mnode/impl/src/mndCompactDetail.c
+++ b/source/dnode/mnode/impl/src/mndCompactDetail.c
@@ -13,9 +13,9 @@
* along with this program. If not, see .
*/
#include "mndCompactDetail.h"
-#include "mndTrans.h"
-#include "mndShow.h"
#include "mndDb.h"
+#include "mndShow.h"
+#include "mndTrans.h"
#define MND_COMPACT_VER_NUMBER 1
@@ -35,21 +35,20 @@ int32_t mndInitCompactDetail(SMnode *pMnode) {
return sdbSetTable(pMnode->pSdb, table);
}
-void mndCleanupCompactDetail(SMnode *pMnode) {
- mDebug("mnd compact detail cleanup");
-}
+void mndCleanupCompactDetail(SMnode *pMnode) { mDebug("mnd compact detail cleanup"); }
+
+int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
+ SMnode *pMnode = pReq->info.node;
+ SSdb *pSdb = pMnode->pSdb;
+ int32_t numOfRows = 0;
+ SCompactDetailObj *pCompactDetail = NULL;
+ char *sep = NULL;
+ SDbObj *pDb = NULL;
-int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows){
- SMnode *pMnode = pReq->info.node;
- SSdb *pSdb = pMnode->pSdb;
- int32_t numOfRows = 0;
- SCompactDetailObj *pCompactDetail = NULL;
- char *sep = NULL;
- SDbObj *pDb = NULL;
-
if (strlen(pShow->db) > 0) {
sep = strchr(pShow->db, '.');
- if (sep && ((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) {
+ if (sep &&
+ ((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) {
sep++;
} else {
pDb = mndAcquireDb(pMnode, pShow->db);
@@ -57,7 +56,7 @@ int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
}
}
- while(numOfRows < rows){
+ while (numOfRows < rows) {
pShow->pIter = sdbFetch(pSdb, SDB_COMPACT_DETAIL, pShow->pIter, (void **)&pCompactDetail);
if (pShow->pIter == NULL) break;
@@ -94,53 +93,60 @@ int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
return numOfRows;
}
-void tFreeCompactDetailObj(SCompactDetailObj *pCompact) {
-}
+void tFreeCompactDetailObj(SCompactDetailObj *pCompact) {}
int32_t tSerializeSCompactDetailObj(void *buf, int32_t bufLen, const SCompactDetailObj *pObj) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
-
- if (tEncodeI32(&encoder, pObj->compactDetailId) < 0) return -1;
- if (tEncodeI32(&encoder, pObj->compactId) < 0) return -1;
- if (tEncodeI32(&encoder, pObj->vgId) < 0) return -1;
- if (tEncodeI32(&encoder, pObj->dnodeId) < 0) return -1;
- if (tEncodeI32(&encoder, pObj->numberFileset) < 0) return -1;
- if (tEncodeI32(&encoder, pObj->finished) < 0) return -1;
- if (tEncodeI64(&encoder, pObj->startTime) < 0) return -1;
- if (tEncodeI32(&encoder, pObj->newNumberFileset) < 0) return -1;
- if (tEncodeI32(&encoder, pObj->newFinished) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->compactDetailId));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->compactId));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->vgId));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->dnodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->numberFileset));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->finished));
+ TAOS_CHECK_EXIT(tEncodeI64(&encoder, pObj->startTime));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->newNumberFileset));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pObj->newFinished));
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSCompactDetailObj(void *buf, int32_t bufLen, SCompactDetailObj *pObj) {
- int8_t ex = 0;
+ int32_t code = 0;
+ int32_t lino;
SDecoder decoder = {0};
tDecoderInit(&decoder, buf, bufLen);
- TAOS_CHECK_RETURN(tStartDecode(&decoder));
-
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->compactDetailId));
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->compactId));
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->vgId));
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->dnodeId));
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->numberFileset));
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->finished));
- TAOS_CHECK_RETURN(tDecodeI64(&decoder, &pObj->startTime));
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->newNumberFileset));
- TAOS_CHECK_RETURN(tDecodeI32(&decoder, &pObj->newFinished));
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->compactDetailId));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->compactId));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->vgId));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->dnodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->numberFileset));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->finished));
+ TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pObj->startTime));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->newNumberFileset));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pObj->newFinished));
tEndDecode(&decoder);
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
@@ -148,7 +154,7 @@ SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
int32_t lino = 0;
terrno = TSDB_CODE_SUCCESS;
- void *buf = NULL;
+ void *buf = NULL;
SSdbRaw *pRaw = NULL;
int32_t tlen = tSerializeSCompactDetailObj(NULL, 0, pCompact);
@@ -156,8 +162,8 @@ SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
goto OVER;
}
-
- int32_t size = sizeof(int32_t) + tlen;
+
+ int32_t size = sizeof(int32_t) + tlen;
pRaw = sdbAllocRaw(SDB_COMPACT_DETAIL, MND_COMPACT_VER_NUMBER, size);
if (pRaw == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -181,7 +187,6 @@ SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OVER);
SDB_SET_DATALEN(pRaw, dataPos, OVER);
-
OVER:
taosMemoryFreeClear(buf);
if (terrno != TSDB_CODE_SUCCESS) {
@@ -263,9 +268,8 @@ int32_t mndCompactDetailActionDelete(SSdb *pSdb, SCompactDetailObj *pCompact) {
}
int32_t mndCompactDetailActionUpdate(SSdb *pSdb, SCompactDetailObj *pOldCompact, SCompactDetailObj *pNewCompact) {
- mTrace("compact detail:%" PRId32 ", perform update action, old row:%p new row:%p",
- pOldCompact->compactId, pOldCompact, pNewCompact);
-
+ mTrace("compact detail:%" PRId32 ", perform update action, old row:%p new row:%p", pOldCompact->compactId,
+ pOldCompact, pNewCompact);
pOldCompact->numberFileset = pNewCompact->numberFileset;
pOldCompact->finished = pNewCompact->finished;
@@ -273,8 +277,8 @@ int32_t mndCompactDetailActionUpdate(SSdb *pSdb, SCompactDetailObj *pOldCompact,
return 0;
}
-int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompact, SVgObj *pVgroup,
- SVnodeGid *pVgid, int32_t index){
+int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj *pCompact, SVgObj *pVgroup,
+ SVnodeGid *pVgid, int32_t index) {
int32_t code = 0;
SCompactDetailObj compactDetail = {0};
compactDetail.compactDetailId = index;
@@ -287,8 +291,8 @@ int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* p
compactDetail.newNumberFileset = -1;
compactDetail.newFinished = -1;
- mInfo("compact:%d, add compact detail to trans, index:%d, vgId:%d, dnodeId:%d",
- compactDetail.compactId, compactDetail.compactDetailId, compactDetail.vgId, compactDetail.dnodeId);
+ mInfo("compact:%d, add compact detail to trans, index:%d, vgId:%d, dnodeId:%d", compactDetail.compactId,
+ compactDetail.compactDetailId, compactDetail.vgId, compactDetail.dnodeId);
SSdbRaw *pVgRaw = mndCompactDetailActionEncode(&compactDetail);
if (pVgRaw == NULL) return -1;
diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c
index 86802914b8..b8d44da8c4 100644
--- a/source/dnode/mnode/impl/src/mndShow.c
+++ b/source/dnode/mnode/impl/src/mndShow.c
@@ -19,8 +19,8 @@
#include "systable.h"
#include "mndUser.h"
-#define SHOW_STEP_SIZE 100
-#define SHOW_COLS_STEP_SIZE 4096
+#define SHOW_STEP_SIZE 100
+#define SHOW_COLS_STEP_SIZE 4096
#define SHOW_PRIVILEGES_STEP_SIZE 2048
static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq);
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index f7b97a2c3c..ade8d541de 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -63,8 +63,8 @@ static int32_t mndProcessCheckpointReport(SRpcMsg *pReq);
static int32_t mndProcessConsensusInTmr(SRpcMsg *pMsg);
static void doSendQuickRsp(SRpcHandleInfo *pInfo, int32_t msgSize, int32_t vgId, int32_t code);
static int32_t mndProcessDropOrphanTaskReq(SRpcMsg* pReq);
-
-static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList);
+static int32_t mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList, SVgroupChangeInfo* pInfo);
+static void mndDestroyVgroupChangeInfo(SVgroupChangeInfo *pInfo);
static void addAllStreamTasksIntoBuf(SMnode *pMnode, SStreamExecInfo *pExecInfo);
static void removeExpiredNodeInfo(const SArray *pNodeSnapshot);
@@ -220,7 +220,7 @@ STREAM_DECODE_OVER:
taosMemoryFreeClear(buf);
if (terrno != TSDB_CODE_SUCCESS) {
char *p = (pStream == NULL) ? "null" : pStream->name;
- mError("stream:%s, failed to decode from raw:%p since %s", p, pRaw, terrstr());
+ mError("stream:%s, failed to decode from raw:%p since %s", p, pRaw, tstrerror(terrno));
taosMemoryFreeClear(pRow);
return NULL;
}
@@ -282,9 +282,9 @@ int32_t mndStreamSeqActionUpdate(SSdb *pSdb, SStreamSeq *pOldStream, SStreamSeq
static int32_t mndCheckCreateStreamReq(SCMCreateStreamReq *pCreate) {
if (pCreate->name[0] == 0 || pCreate->sql == NULL || pCreate->sql[0] == 0 || pCreate->sourceDB[0] == 0 ||
pCreate->targetStbFullName[0] == 0) {
- return terrno = TSDB_CODE_MND_INVALID_STREAM_OPTION;
+ return TSDB_CODE_MND_INVALID_STREAM_OPTION;
}
- return 0;
+ return TSDB_CODE_SUCCESS;
}
static int32_t createSchemaByFields(const SArray *pFields, SSchemaWrapper *pWrapper) {
@@ -366,8 +366,8 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
memcpy(pObj->sourceDb, pCreate->sourceDB, TSDB_DB_FNAME_LEN);
SDbObj *pSourceDb = mndAcquireDb(pMnode, pCreate->sourceDB);
if (pSourceDb == NULL) {
- mInfo("stream:%s failed to create, source db %s not exist since %s", pCreate->name, pObj->sourceDb, terrstr());
code = terrno;
+ mInfo("stream:%s failed to create, source db %s not exist since %s", pCreate->name, pObj->sourceDb, tstrerror(code));
goto FAIL;
}
@@ -378,8 +378,8 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SDbObj *pTargetDb = mndAcquireDbByStb(pMnode, pObj->targetSTbName);
if (pTargetDb == NULL) {
- mError("stream:%s failed to create, target db %s not exist since %s", pCreate->name, pObj->targetDb, terrstr());
code = terrno;
+ mError("stream:%s failed to create, target db %s not exist since %s", pCreate->name, pObj->targetDb, tstrerror(code));
goto FAIL;
}
@@ -543,8 +543,7 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) {
code = tEncodeStreamTask(&encoder, pTask);
tEncoderClear(&encoder);
- if (code == -1) {
- code = TSDB_CODE_INVALID_PARA;
+ if (code != 0) {
mError("failed to encode stream task, code:%s", tstrerror(code));
taosMemoryFree(buf);
return code;
@@ -616,8 +615,8 @@ int32_t mndPersistStream(STrans *pTrans, SStreamObj *pStream) {
static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStreamObj *pStream, const char *user) {
SStbObj *pStb = NULL;
SDbObj *pDb = NULL;
- int32_t code = 0;
- int32_t lino = 0;
+ int32_t code = 0;
+ int32_t lino = 0;
SMCreateStbReq createReq = {0};
tstrncpy(createReq.name, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
@@ -669,19 +668,19 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
}
}
- if (mndCheckCreateStbReq(&createReq) != 0) {
+ if ((code = mndCheckCreateStbReq(&createReq)) != 0) {
goto _OVER;
}
pStb = mndAcquireStb(pMnode, createReq.name);
if (pStb != NULL) {
- terrno = TSDB_CODE_MND_STB_ALREADY_EXIST;
+ code = TSDB_CODE_MND_STB_ALREADY_EXIST;
goto _OVER;
}
pDb = mndAcquireDbByStb(pMnode, createReq.name);
if (pDb == NULL) {
- terrno = TSDB_CODE_MND_DB_NOT_SELECTED;
+ code = TSDB_CODE_MND_DB_NOT_SELECTED;
goto _OVER;
}
@@ -691,7 +690,7 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
}
if (pDb->cfg.numOfStables == 1 && numOfStbs != 0) {
- terrno = TSDB_CODE_MND_SINGLE_STB_MODE_DB;
+ code = TSDB_CODE_MND_SINGLE_STB_MODE_DB;
goto _OVER;
}
@@ -720,7 +719,8 @@ _OVER:
mndReleaseStb(pMnode, pStb);
mndReleaseDb(pMnode, pDb);
- mDebug("stream:%s failed to create dst stable:%s, code:%s", pStream->name, pStream->targetSTbName, tstrerror(terrno));
+ mDebug("stream:%s failed to create dst stable:%s, line:%d code:%s", pStream->name, pStream->targetSTbName, lino,
+ tstrerror(code));
return code;
}
@@ -742,16 +742,14 @@ static int32_t doStreamCheck(SMnode *pMnode, SStreamObj *pStreamObj) {
mError("too many streams, no more than %d for each database, failed to create stream:%s", MND_STREAM_MAX_NUM,
pStreamObj->name);
sdbCancelFetch(pMnode->pSdb, pIter);
- terrno = TSDB_CODE_MND_TOO_MANY_STREAMS;
- return terrno;
+ return TSDB_CODE_MND_TOO_MANY_STREAMS;
}
if (pStream->targetStbUid == pStreamObj->targetStbUid) {
mError("Cannot write the same stable as other stream:%s, failed to create stream:%s", pStream->name,
pStreamObj->name);
sdbCancelFetch(pMnode->pSdb, pIter);
- terrno = TSDB_CODE_MND_INVALID_TARGET_TABLE;
- return terrno;
+ return TSDB_CODE_MND_INVALID_TARGET_TABLE;
}
}
@@ -767,13 +765,11 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
const char *pMsg = "create stream tasks on dnodes";
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
+ STrans *pTrans = NULL;
- terrno = TSDB_CODE_SUCCESS;
SCMCreateStreamReq createReq = {0};
- if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
- code = TSDB_CODE_INVALID_MSG;
- goto _OVER;
- }
+ code = tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createReq);
+ TSDB_CHECK_CODE(code, lino, _OVER);
#ifdef WINDOWS
code = TSDB_CODE_MND_INVALID_PLATFORM;
@@ -782,7 +778,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
mInfo("stream:%s, start to create stream, sql:%s", createReq.name, createReq.sql);
if ((code = mndCheckCreateStreamReq(&createReq)) != 0) {
- mError("stream:%s, failed to create since %s", createReq.name, terrstr());
+ mError("stream:%s, failed to create since %s", createReq.name, tstrerror(code));
goto _OVER;
}
@@ -790,7 +786,9 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
if (pStream != NULL && code == 0) {
if (createReq.igExists) {
mInfo("stream:%s, already exist, ignore exist is set", createReq.name);
- goto _OVER;
+ mndReleaseStream(pMnode, pStream);
+ tFreeSCMCreateStreamReq(&createReq);
+ return code;
} else {
code = TSDB_CODE_MND_STREAM_ALREADY_EXIST;
goto _OVER;
@@ -807,21 +805,20 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
sqlLen = strlen(createReq.sql);
sql = taosMemoryMalloc(sqlLen + 1);
TSDB_CHECK_NULL(sql, code, lino, _OVER, terrno);
+
memset(sql, 0, sqlLen + 1);
memcpy(sql, createReq.sql, sqlLen);
}
// build stream obj from request
if ((code = mndBuildStreamObjFromCreateReq(pMnode, &streamObj, &createReq)) < 0) {
- mError("stream:%s, failed to create since %s", createReq.name, terrstr());
+ mError("stream:%s, failed to create since %s", createReq.name, tstrerror(code));
goto _OVER;
}
- if ((code = doStreamCheck(pMnode, &streamObj)) < 0) {
- goto _OVER;
- }
+ code = doStreamCheck(pMnode, &streamObj);
+ TSDB_CHECK_CODE(code, lino, _OVER);
- STrans *pTrans = NULL;
code = doCreateTrans(pMnode, &streamObj, pReq, TRN_CONFLICT_DB, MND_STREAM_CREATE_NAME, pMsg, &pTrans);
if (pTrans == NULL || code) {
goto _OVER;
@@ -830,7 +827,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
// create stb for stream
if (createReq.createStb == STREAM_CREATE_STABLE_TRUE) {
if ((code = mndCreateStbForStream(pMnode, pTrans, &streamObj, pReq->info.conn.user)) < 0) {
- mError("trans:%d, failed to create stb for stream %s since %s", pTrans->id, createReq.name, terrstr());
+ mError("trans:%d, failed to create stb for stream %s since %s", pTrans->id, createReq.name, tstrerror(code));
mndTransDrop(pTrans);
goto _OVER;
}
@@ -841,7 +838,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
// schedule stream task for stream obj
code = mndScheduleStream(pMnode, &streamObj, createReq.lastTs, createReq.pVgroupVerList);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("stream:%s, failed to schedule since %s", createReq.name, terrstr());
+ mError("stream:%s, failed to schedule since %s", createReq.name, tstrerror(code));
mndTransDrop(pTrans);
goto _OVER;
}
@@ -849,7 +846,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
// add stream to trans
code = mndPersistStream(pTrans, &streamObj);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("stream:%s, failed to persist since %s", createReq.name, terrstr());
+ mError("stream:%s, failed to persist since %s", createReq.name, tstrerror(code));
mndTransDrop(pTrans);
goto _OVER;
}
@@ -874,17 +871,13 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
// execute creation
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare since %s", pTrans->id, tstrerror(code));
mndTransDrop(pTrans);
goto _OVER;
}
mndTransDrop(pTrans);
- if (code == 0) {
- code = TSDB_CODE_ACTION_IN_PROGRESS;
- }
-
SName dbname = {0};
code = tNameFromString(&dbname, createReq.sourceDB, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
if (code) {
@@ -910,9 +903,10 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
_OVER:
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("stream:%s, failed to create since %s", createReq.name, terrstr());
+ mError("stream:%s, failed to create at line:%d since %s", createReq.name, lino, terrstr(code));
} else {
mDebug("stream:%s create stream completed", createReq.name);
+ code = TSDB_CODE_ACTION_IN_PROGRESS;
}
mndReleaseStream(pMnode, pStream);
@@ -1058,23 +1052,24 @@ static int32_t doSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask
static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStream, int64_t checkpointId,
int8_t mndTrigger, bool lock) {
int32_t code = TSDB_CODE_SUCCESS;
+ bool conflict = false;
int64_t ts = taosGetTimestampMs();
+ STrans *pTrans = NULL;
+
if (mndTrigger == 1 && (ts - pStream->checkpointFreq < tsStreamCheckpointInterval * 1000)) {
return code;
}
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHECKPOINT_NAME, lock);
- if (conflict) {
- mWarn("checkpoint conflict with other trans in %s, ignore the checkpoint for stream:%s %" PRIx64, pStream->sourceDb,
- pStream->name, pStream->uid);
- return TSDB_CODE_MND_TRANS_CONFLICT;
+ code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHECKPOINT_NAME, lock);
+ if (code) {
+ mWarn("checkpoint conflict with other trans in %s, code:%s ignore the checkpoint for stream:%s %" PRIx64,
+ pStream->sourceDb, tstrerror(code), pStream->name, pStream->uid);
+ goto _ERR;
}
- STrans *pTrans = NULL;
code = doCreateTrans(pMnode, pStream, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_CHECKPOINT_NAME,
- "gen checkpoint for stream", &pTrans);
- if (pTrans == NULL || code) {
- code = TSDB_CODE_MND_TRANS_CONFLICT;
+ "gen checkpoint for stream", &pTrans);
+ if (code) {
mError("failed to checkpoint of stream name%s, checkpointId: %" PRId64 ", reason:%s", pStream->name, checkpointId,
tstrerror(code));
goto _ERR;
@@ -1126,7 +1121,9 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("failed to prepare checkpoint trans since %s", terrstr());
+ mError("failed to prepare checkpoint trans since %s", terrstr(code));
+ } else {
+ code = TSDB_CODE_ACTION_IN_PROGRESS;
}
_ERR:
@@ -1147,6 +1144,9 @@ int32_t extractStreamNodeList(SMnode *pMnode) {
}
static bool taskNodeIsUpdated(SMnode *pMnode) {
+ bool allReady = true;
+ SArray *pNodeSnapshot = NULL;
+
// check if the node update happens or not
streamMutexLock(&execInfo.lock);
@@ -1171,13 +1171,11 @@ static bool taskNodeIsUpdated(SMnode *pMnode) {
}
}
- bool allReady = true;
- SArray *pNodeSnapshot = NULL;
-
int32_t code = mndTakeVgroupSnapshot(pMnode, &allReady, &pNodeSnapshot);
if (code) {
mError("failed to get the vgroup snapshot, ignore it and continue");
}
+
if (!allReady) {
mWarn("not all vnodes ready, quit from vnodes status check");
taosArrayDestroy(pNodeSnapshot);
@@ -1185,12 +1183,16 @@ static bool taskNodeIsUpdated(SMnode *pMnode) {
return true;
}
- SVgroupChangeInfo changeInfo = mndFindChangedNodeInfo(pMnode, execInfo.pNodeList, pNodeSnapshot);
+ SVgroupChangeInfo changeInfo = {0};
+ code = mndFindChangedNodeInfo(pMnode, execInfo.pNodeList, pNodeSnapshot, &changeInfo);
+ if (code) {
+ streamMutexUnlock(&execInfo.lock);
+ return false;
+ }
bool nodeUpdated = (taosArrayGetSize(changeInfo.pUpdateNodeList) > 0);
- taosArrayDestroy(changeInfo.pUpdateNodeList);
- taosHashCleanup(changeInfo.pDBMap);
+ mndDestroyVgroupChangeInfo(&changeInfo);
taosArrayDestroy(pNodeSnapshot);
if (nodeUpdated) {
@@ -1400,7 +1402,7 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) {
code = mndProcessStreamCheckpointTrans(pMnode, p, checkpointId, 1, true);
sdbRelease(pSdb, p);
- if (code != -1) {
+ if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
started += 1;
if (started >= capacity) {
@@ -1438,10 +1440,9 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
tFreeMDropStreamReq(&dropReq);
return 0;
} else {
- code = TSDB_CODE_MND_STREAM_NOT_EXIST;
mError("stream:%s not exist failed to drop it", dropReq.name);
tFreeMDropStreamReq(&dropReq);
- TAOS_RETURN(code);
+ TAOS_RETURN(TSDB_CODE_MND_STREAM_NOT_EXIST);
}
}
@@ -1480,17 +1481,17 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
}
// check if it is conflict with other trans in both sourceDb and targetDb.
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_DROP_NAME, true);
- if (conflict) {
+ code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_DROP_NAME, true);
+ if (code) {
sdbRelease(pMnode->pSdb, pStream);
tFreeMDropStreamReq(&dropReq);
- return terrno;
+ return code;
}
STrans *pTrans = NULL;
code = doCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_DROP_NAME, "drop stream", &pTrans);
if (pTrans == NULL || code) {
- mError("stream:%s uid:0x%" PRIx64 " failed to drop since %s", dropReq.name, pStream->uid, terrstr());
+ mError("stream:%s uid:0x%" PRIx64 " failed to drop since %s", dropReq.name, pStream->uid, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
tFreeMDropStreamReq(&dropReq);
TAOS_RETURN(code);
@@ -1526,7 +1527,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare drop stream trans since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare drop stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
tFreeMDropStreamReq(&dropReq);
@@ -1756,16 +1757,16 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
return 0;
}
- if (mndCheckDbPrivilegeByName(pMnode, pReq->info.conn.user, MND_OPER_WRITE_DB, pStream->targetDb) != 0) {
+ if ((code = mndCheckDbPrivilegeByName(pMnode, pReq->info.conn.user, MND_OPER_WRITE_DB, pStream->targetDb)) != 0) {
sdbRelease(pMnode->pSdb, pStream);
- return -1;
+ return code;
}
// check if it is conflict with other trans in both sourceDb and targetDb.
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_PAUSE_NAME, true);
- if (conflict) {
+ code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_PAUSE_NAME, true);
+ if (code) {
sdbRelease(pMnode->pSdb, pStream);
- TAOS_RETURN(TSDB_CODE_MND_TRANS_CONFLICT);
+ TAOS_RETURN(code);
}
bool updated = taskNodeIsUpdated(pMnode);
@@ -1821,7 +1822,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
STrans *pTrans = NULL;
code = doCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_PAUSE_NAME, "pause the stream", &pTrans);
if (pTrans == NULL || code) {
- mError("stream:%s failed to pause stream since %s", pauseReq.name, terrstr());
+ mError("stream:%s failed to pause stream since %s", pauseReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
return code;
}
@@ -1836,7 +1837,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
// if nodeUpdate happened, not send pause trans
code = mndStreamSetPauseAction(pMnode, pTrans, pStream);
if (code) {
- mError("stream:%s, failed to pause task since %s", pauseReq.name, terrstr());
+ mError("stream:%s, failed to pause task since %s", pauseReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
@@ -1857,7 +1858,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare pause stream trans since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare pause stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
@@ -1874,8 +1875,8 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
SStreamObj *pStream = NULL;
int32_t code = 0;
- if ((terrno = grantCheckExpire(TSDB_GRANT_STREAMS)) < 0) {
- return terrno;
+ if ((code = grantCheckExpire(TSDB_GRANT_STREAMS)) < 0) {
+ return code;
}
SMResumeStreamReq resumeReq = {0};
@@ -1906,17 +1907,17 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
}
// check if it is conflict with other trans in both sourceDb and targetDb.
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_RESUME_NAME, true);
- if (conflict) {
+ code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_RESUME_NAME, true);
+ if (code) {
sdbRelease(pMnode->pSdb, pStream);
- return terrno;
+ return code;
}
STrans *pTrans = NULL;
code =
doCreateTrans(pMnode, pStream, pReq, TRN_CONFLICT_NOTHING, MND_STREAM_RESUME_NAME, "resume the stream", &pTrans);
if (pTrans == NULL || code) {
- mError("stream:%s, failed to resume stream since %s", resumeReq.name, terrstr());
+ mError("stream:%s, failed to resume stream since %s", resumeReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
return code;
}
@@ -1929,8 +1930,9 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
}
// set the resume action
- if (mndStreamSetResumeAction(pTrans, pMnode, pStream, resumeReq.igUntreated) < 0) {
- mError("stream:%s, failed to drop task since %s", resumeReq.name, terrstr());
+ code = mndStreamSetResumeAction(pTrans, pMnode, pStream, resumeReq.igUntreated);
+ if (code) {
+ mError("stream:%s, failed to drop task since %s", resumeReq.name, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
@@ -1950,7 +1952,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
taosWUnLockLatch(&pStream->lock);
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare pause stream trans since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare pause stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
@@ -1977,11 +1979,22 @@ static bool isNodeEpsetChanged(const SEpSet *pPrevEpset, const SEpSet *pCurrent)
// tasks on the will be removed replica.
// 3. vgroup redistribution is an combination operation of first increase replica and then decrease replica. So we
// will handle it as mentioned in 1 & 2 items.
-static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList) {
- SVgroupChangeInfo info = {
- .pUpdateNodeList = taosArrayInit(4, sizeof(SNodeUpdateInfo)),
- .pDBMap = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK),
- };
+static int32_t mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pPrevNodeList, const SArray *pNodeList,
+ SVgroupChangeInfo *pInfo) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (pInfo == NULL) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+
+ pInfo->pUpdateNodeList = taosArrayInit(4, sizeof(SNodeUpdateInfo)),
+ pInfo->pDBMap = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK);
+
+ if (pInfo->pUpdateNodeList == NULL || pInfo->pDBMap == NULL) {
+ mndDestroyVgroupChangeInfo(pInfo);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
int32_t numOfNodes = taosArrayGetSize(pPrevNodeList);
for (int32_t i = 0; i < numOfNodes; ++i) {
@@ -2002,7 +2015,11 @@ static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pP
const SEp *pPrevEp = GET_ACTIVE_EP(&pPrevEntry->epset);
char buf[256] = {0};
- (void) epsetToStr(&pCurrent->epset, buf, tListLen(buf)); // ignore this error
+ code = epsetToStr(&pCurrent->epset, buf, tListLen(buf)); // ignore this error
+ if (code) {
+ mError("failed to convert epset string, code:%s", tstrerror(code));
+ TSDB_CHECK_CODE(code, lino, _err);
+ }
mDebug("nodeId:%d restart/epset changed detected, old:%s:%d -> new:%s, stageUpdate:%d", pCurrent->nodeId,
pPrevEp->fqdn, pPrevEp->port, buf, pPrevEntry->stageUpdated);
@@ -2011,20 +2028,16 @@ static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pP
epsetAssign(&updateInfo.prevEp, &pPrevEntry->epset);
epsetAssign(&updateInfo.newEp, &pCurrent->epset);
- void* p = taosArrayPush(info.pUpdateNodeList, &updateInfo);
- if (p == NULL) {
- mError("failed to put update entry into node list, code:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- }
+ void* p = taosArrayPush(pInfo->pUpdateNodeList, &updateInfo);
+ TSDB_CHECK_NULL(p, code, lino, _err, terrno);
}
// todo handle the snode info
if (pCurrent->nodeId != SNODE_HANDLE) {
SVgObj *pVgroup = mndAcquireVgroup(pMnode, pCurrent->nodeId);
- int32_t code = taosHashPut(info.pDBMap, pVgroup->dbName, strlen(pVgroup->dbName), NULL, 0);
+ code = taosHashPut(pInfo->pDBMap, pVgroup->dbName, strlen(pVgroup->dbName), NULL, 0);
mndReleaseVgroup(pMnode, pVgroup);
- if (code) {
- mError("failed to put into dbmap, code:out of memory");
- }
+ TSDB_CHECK_CODE(code, lino, _err);
}
break;
@@ -2032,7 +2045,18 @@ static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pP
}
}
- return info;
+ return code;
+
+ _err:
+ mndDestroyVgroupChangeInfo(pInfo);
+ return code;
+}
+
+static void mndDestroyVgroupChangeInfo(SVgroupChangeInfo* pInfo) {
+ if (pInfo != NULL) {
+ taosArrayDestroy(pInfo->pUpdateNodeList);
+ taosHashCleanup(pInfo->pDBMap);
+ }
}
static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo, bool includeAllNodes) {
@@ -2049,13 +2073,13 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange
break;
}
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_TASK_UPDATE_NAME, false);
+ code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_TASK_UPDATE_NAME, false);
sdbRelease(pSdb, pStream);
- if (conflict) {
- mError("nodeUpdate conflict with other trans, current nodeUpdate ignored");
+ if (code) {
+ mError("nodeUpdate conflict with other trans, current nodeUpdate ignored, code:%s", tstrerror(code));
sdbCancelFetch(pSdb, pIter);
- return terrno;
+ return code;
}
}
@@ -2119,7 +2143,7 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare update stream trans since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare update stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
@@ -2276,7 +2300,11 @@ static int32_t mndProcessNodeCheckReq(SRpcMsg *pMsg) {
goto _end;
}
- SVgroupChangeInfo changeInfo = mndFindChangedNodeInfo(pMnode, execInfo.pNodeList, pNodeSnapshot);
+ SVgroupChangeInfo changeInfo = {0};
+ code = mndFindChangedNodeInfo(pMnode, execInfo.pNodeList, pNodeSnapshot, &changeInfo);
+ if (code) {
+ goto _end;
+ }
{
if (execInfo.role == NODE_ROLE_LEADER && execInfo.switchFromFollower) {
@@ -2310,8 +2338,7 @@ static int32_t mndProcessNodeCheckReq(SRpcMsg *pMsg) {
mDebug("no update found in nodeList");
}
- taosArrayDestroy(changeInfo.pUpdateNodeList);
- taosHashCleanup(changeInfo.pDBMap);
+ mndDestroyVgroupChangeInfo(&changeInfo);
_end:
streamMutexUnlock(&execInfo.lock);
@@ -2640,9 +2667,8 @@ int32_t mndProcessCheckpointReport(SRpcMsg *pReq) {
void *p = taosHashGet(execInfo.pTaskMap, &id, sizeof(id));
if (p == NULL) {
mError("failed to find the stream:0x%" PRIx64 " in buf, not handle the checkpoint-report", req.streamId);
- terrno = TSDB_CODE_MND_STREAM_NOT_EXIST;
streamMutexUnlock(&execInfo.lock);
- return terrno;
+ return TSDB_CODE_MND_STREAM_NOT_EXIST;
} else {
mDebug("s-task:0x%" PRIx64 "-0x%x in buf not in mnode/meta, create stream trans may not complete yet",
req.streamId, req.taskId);
@@ -2993,7 +3019,7 @@ int32_t mndCreateStreamChkptInfoUpdateTrans(SMnode *pMnode, SStreamObj *pStream,
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare update checkpoint-info meta trans since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare update checkpoint-info meta trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
@@ -3038,9 +3064,8 @@ static int32_t mndProcessDropOrphanTaskReq(SRpcMsg *pReq) {
}
// check if it is conflict with other trans in both sourceDb and targetDb.
- bool conflict = mndStreamTransConflictCheck(pMnode, pTask->streamId, MND_STREAM_DROP_NAME, false);
- if (conflict) {
- code = TSDB_CODE_MND_TRANS_CONFLICT;
+ code = mndStreamTransConflictCheck(pMnode, pTask->streamId, MND_STREAM_DROP_NAME, false);
+ if (code) {
goto _err;
}
@@ -3048,7 +3073,7 @@ static int32_t mndProcessDropOrphanTaskReq(SRpcMsg *pReq) {
code = doCreateTrans(pMnode, &dummyObj, NULL, TRN_CONFLICT_NOTHING, MND_STREAM_DROP_NAME, "drop stream", &pTrans);
if (pTrans == NULL || code != 0) {
- mError("failed to create trans to drop orphan tasks since %s", terrstr());
+ mError("failed to create trans to drop orphan tasks since %s", tstrerror(code));
goto _err;
}
@@ -3059,7 +3084,7 @@ static int32_t mndProcessDropOrphanTaskReq(SRpcMsg *pReq) {
// drop all tasks
if ((code = mndStreamSetDropActionFromList(pMnode, pTrans, msg.pList)) < 0) {
- mError("failed to create trans to drop orphan tasks since %s", terrstr());
+ mError("failed to create trans to drop orphan tasks since %s", tstrerror(code));
goto _err;
}
@@ -3070,7 +3095,7 @@ static int32_t mndProcessDropOrphanTaskReq(SRpcMsg *pReq) {
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare drop stream trans since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare drop stream trans since %s", pTrans->id, tstrerror(code));
goto _err;
}
diff --git a/source/dnode/mnode/impl/src/mndStreamHb.c b/source/dnode/mnode/impl/src/mndStreamHb.c
index f515e9565d..d31d0dad65 100644
--- a/source/dnode/mnode/impl/src/mndStreamHb.c
+++ b/source/dnode/mnode/impl/src/mndStreamHb.c
@@ -100,7 +100,7 @@ int32_t mndCreateStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream) {
code = mndTransPrepare(pMnode, pTrans);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
- mError("trans:%d, failed to prepare update stream trans since %s", pTrans->id, terrstr());
+ mError("trans:%d, failed to prepare update stream trans since %s", pTrans->id, tstrerror(code));
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
return code;
@@ -109,6 +109,9 @@ int32_t mndCreateStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream) {
sdbRelease(pMnode->pSdb, pStream);
mndTransDrop(pTrans);
+ if (code == 0) {
+ code = TSDB_CODE_ACTION_IN_PROGRESS;
+ }
return code;
}
@@ -221,8 +224,8 @@ int32_t mndProcessResetStatusReq(SRpcMsg *pReq) {
code = TSDB_CODE_STREAM_TASK_NOT_EXIST;
mError("failed to acquire the streamObj:0x%" PRIx64 " to reset checkpoint, may have been dropped", pStream->uid);
} else {
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_TASK_RESET_NAME, false);
- if (conflict) {
+ code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_TASK_RESET_NAME, false);
+ if (code) {
mError("stream:%s other trans exists in DB:%s, dstTable:%s failed to start reset-status trans", pStream->name,
pStream->sourceDb, pStream->targetSTbName);
} else {
diff --git a/source/dnode/mnode/impl/src/mndStreamTrans.c b/source/dnode/mnode/impl/src/mndStreamTrans.c
index 494771e65e..25a735e152 100644
--- a/source/dnode/mnode/impl/src/mndStreamTrans.c
+++ b/source/dnode/mnode/impl/src/mndStreamTrans.c
@@ -50,7 +50,7 @@ int32_t mndStreamClearFinishedTrans(SMnode *pMnode, int32_t *pNumOfActiveChkpt)
pEntry->startTime);
void* p = taosArrayPush(pList, &info);
if (p == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
+ return terrno;
}
} else {
if (strcmp(pEntry->name, MND_STREAM_CHECKPOINT_NAME) == 0) {
@@ -77,7 +77,6 @@ int32_t mndStreamClearFinishedTrans(SMnode *pMnode, int32_t *pNumOfActiveChkpt)
mDebug("clear %d finished stream-trans, remained:%d, active checkpoint trans:%d", size,
taosHashGetSize(execInfo.transMgmt.pDBTrans), num);
- terrno = TSDB_CODE_SUCCESS;
taosArrayDestroy(pList);
if (pNumOfActiveChkpt != NULL) {
@@ -91,7 +90,7 @@ int32_t mndStreamClearFinishedTrans(SMnode *pMnode, int32_t *pNumOfActiveChkpt)
// For a given stream:
// 1. checkpoint trans is conflict with any other trans except for the drop and reset trans.
// 2. create/drop/reset/update trans are conflict with any other trans.
-bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *pTransName, bool lock) {
+int32_t mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *pTransName, bool lock) {
if (lock) {
streamMutexLock(&execInfo.lock);
}
@@ -101,7 +100,7 @@ bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *p
if (lock) {
streamMutexUnlock(&execInfo.lock);
}
- return false;
+ return 0;
}
int32_t code = mndStreamClearFinishedTrans(pMnode, NULL);
@@ -121,8 +120,7 @@ bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *p
if ((strcmp(pTransName, MND_STREAM_DROP_NAME) != 0) && (strcmp(pTransName, MND_STREAM_TASK_RESET_NAME) != 0)) {
mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId,
tInfo.name);
- terrno = TSDB_CODE_MND_TRANS_CONFLICT;
- return true;
+ return TSDB_CODE_MND_TRANS_CONFLICT;
} else {
mDebug("not conflict with checkpoint trans, name:%s, continue creating trans", pTransName);
}
@@ -131,8 +129,7 @@ bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *p
strcmp(tInfo.name, MND_STREAM_TASK_UPDATE_NAME) == 0) {
mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId,
tInfo.name);
- terrno = TSDB_CODE_MND_TRANS_CONFLICT;
- return true;
+ return TSDB_CODE_MND_TRANS_CONFLICT;
}
} else {
mDebug("stream:0x%" PRIx64 " no conflict trans existed, continue create trans", streamId);
@@ -142,7 +139,7 @@ bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *p
streamMutexUnlock(&execInfo.lock);
}
- return false;
+ return 0;
}
int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamId) {
@@ -202,47 +199,48 @@ int32_t doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, ETrnCo
SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
int32_t code = 0;
int32_t lino = 0;
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- void *buf = NULL;
+ void *buf = NULL;
SEncoder encoder;
tEncoderInit(&encoder, NULL, 0);
- if (tEncodeSStreamObj(&encoder, pStream) < 0) {
+ if ((code = tEncodeSStreamObj(&encoder, pStream)) < 0) {
tEncoderClear(&encoder);
- goto STREAM_ENCODE_OVER;
+ TSDB_CHECK_CODE(code, lino, _over);
}
+
int32_t tlen = encoder.pos;
tEncoderClear(&encoder);
int32_t size = sizeof(int32_t) + tlen + MND_STREAM_RESERVE_SIZE;
SSdbRaw *pRaw = sdbAllocRaw(SDB_STREAM, MND_STREAM_VER_NUMBER, size);
- if (pRaw == NULL) goto STREAM_ENCODE_OVER;
+ TSDB_CHECK_NULL(pRaw, code, lino, _over, terrno);
buf = taosMemoryMalloc(tlen);
- if (buf == NULL) goto STREAM_ENCODE_OVER;
+ TSDB_CHECK_NULL(buf, code, lino, _over, terrno);
tEncoderInit(&encoder, buf, tlen);
- if (tEncodeSStreamObj(&encoder, pStream) < 0) {
+ if ((code = tEncodeSStreamObj(&encoder, pStream)) < 0) {
tEncoderClear(&encoder);
- goto STREAM_ENCODE_OVER;
+ TSDB_CHECK_CODE(code, lino, _over);
}
+
tEncoderClear(&encoder);
int32_t dataPos = 0;
- SDB_SET_INT32(pRaw, dataPos, tlen, STREAM_ENCODE_OVER);
- SDB_SET_BINARY(pRaw, dataPos, buf, tlen, STREAM_ENCODE_OVER);
- SDB_SET_DATALEN(pRaw, dataPos, STREAM_ENCODE_OVER);
+ SDB_SET_INT32(pRaw, dataPos, tlen, _over);
+ SDB_SET_BINARY(pRaw, dataPos, buf, tlen, _over);
+ SDB_SET_DATALEN(pRaw, dataPos, _over);
- terrno = TSDB_CODE_SUCCESS;
-
-STREAM_ENCODE_OVER:
+_over:
taosMemoryFreeClear(buf);
- if (terrno != TSDB_CODE_SUCCESS) {
- mError("stream:%s, failed to encode to raw:%p since %s", pStream->name, pRaw, terrstr());
+ if (code != TSDB_CODE_SUCCESS) {
+ mError("stream:%s, failed to encode to raw:%p at line:%d since %s", pStream->name, pRaw, lino, tstrerror(code));
sdbFreeRaw(pRaw);
+ terrno = code;
return NULL;
}
+ terrno = 0;
mTrace("stream:%s, encode to raw:%p, row:%p, checkpoint:%" PRId64 "", pStream->name, pRaw, pStream,
pStream->checkpointId);
return pRaw;
diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c
index ef91ccef34..a405cdde0a 100644
--- a/source/dnode/mnode/impl/src/mndStreamUtil.c
+++ b/source/dnode/mnode/impl/src/mndStreamUtil.c
@@ -251,7 +251,7 @@ void mndKillTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName) {
int32_t code = mndKillTrans(pMnode, pTrans);
mndReleaseTrans(pMnode, pTrans);
if (code) {
- mError("failed to kill trans:%d", pTrans->id);
+ mError("failed to kill transId:%d, code:%s", pTrans->id, tstrerror(code));
}
} else {
mError("failed to acquire trans in Db:%s, transId:%d", pDbName, transId);
@@ -1105,8 +1105,8 @@ int32_t mndScanCheckpointReportInfo(SRpcMsg *pReq) {
mDebug("stream:0x%" PRIx64 " %s all %d tasks send checkpoint-report, start to update checkpoint-info",
pStream->uid, pStream->name, total);
- bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHKPT_UPDATE_NAME, false);
- if (!conflict) {
+ code = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHKPT_UPDATE_NAME, false);
+ if (code == 0) {
code = mndCreateStreamChkptInfoUpdateTrans(pMnode, pStream, px->pTaskList);
if (code == TSDB_CODE_SUCCESS || code == TSDB_CODE_ACTION_IN_PROGRESS) { // remove this entry
taosArrayClear(px->pTaskList);
@@ -1858,4 +1858,74 @@ int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SSDataBlo
mError("error happens during build task attr result blocks, lino:%d, code:%s", lino, tstrerror(code));
}
return code;
+}
+
+uint32_t seed = 0;
+static SRpcMsg createRpcMsg(STransAction* pAction, int64_t traceId, int64_t signature) {
+ SRpcMsg rpcMsg = {.msgType = pAction->msgType, .contLen = pAction->contLen, .info.ahandle = (void *)signature};
+ rpcMsg.pCont = rpcMallocCont(pAction->contLen);
+ if (rpcMsg.pCont == NULL) {
+ return rpcMsg;
+ }
+
+ rpcMsg.info.traceId.rootId = traceId;
+ rpcMsg.info.notFreeAhandle = 1;
+
+ memcpy(rpcMsg.pCont, pAction->pCont, pAction->contLen);
+ return rpcMsg;
+}
+
+void streamTransRandomErrorGen(STransAction *pAction, STrans *pTrans, int64_t signature) {
+ if ((pAction->msgType == TDMT_STREAM_TASK_UPDATE_CHKPT && pAction->id > 2) ||
+ (pAction->msgType == TDMT_STREAM_CONSEN_CHKPT) ||
+ (pAction->msgType == TDMT_VND_STREAM_CHECK_POINT_SOURCE && pAction->id > 2)) {
+ if (seed == 0) {
+ seed = taosGetTimestampSec();
+ }
+
+ uint32_t v = taosRandR(&seed);
+ int32_t choseItem = v % 5;
+
+ if (choseItem == 0) {
+ // 1. one of update-checkpoint not send, restart and send it again
+ taosMsleep(5000);
+ if (pAction->msgType == TDMT_STREAM_TASK_UPDATE_CHKPT) {
+ mError(
+ "***sleep 5s and core dump, following tasks will not recv update-checkpoint info, so the checkpoint will "
+ "rollback***");
+ exit(-1);
+ } else if (pAction->msgType == TDMT_STREAM_CONSEN_CHKPT) { // pAction->msgType == TDMT_STREAM_CONSEN_CHKPT
+ mError(
+ "***sleep 5s and core dump, following tasks will not recv consen-checkpoint info, so the tasks will "
+ "not started***");
+ } else { // pAction->msgType == TDMT_VND_STREAM_CHECK_POINT_SOURCE
+ mError(
+ "***sleep 5s and core dump, following tasks will not recv checkpoint-source info, so the tasks will "
+ "started after restart***");
+ exit(-1);
+ }
+ } else if (choseItem == 1) {
+ // 2. repeat send update chkpt msg
+ mError("***repeat send update-checkpoint/consensus/checkpoint trans msg 3times to vnode***");
+
+ mError("***repeat 1***");
+ SRpcMsg rpcMsg1 = createRpcMsg(pAction, pTrans->mTraceId, signature);
+ int32_t code = tmsgSendReq(&pAction->epSet, &rpcMsg1);
+
+ mError("***repeat 2***");
+ SRpcMsg rpcMsg2 = createRpcMsg(pAction, pTrans->mTraceId, signature);
+ code = tmsgSendReq(&pAction->epSet, &rpcMsg2);
+
+ mError("***repeat 3***");
+ SRpcMsg rpcMsg3 = createRpcMsg(pAction, pTrans->mTraceId, signature);
+ code = tmsgSendReq(&pAction->epSet, &rpcMsg3);
+ } else if (choseItem == 2) {
+ // 3. sleep 40s and then send msg
+ mError("***idle for 30s, and then send msg***");
+ taosMsleep(30000);
+ } else {
+ // do nothing
+ // mInfo("no error triggered");
+ }
+ }
}
\ No newline at end of file
diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c
index 7244f2d7c9..576ba736b5 100644
--- a/source/dnode/mnode/sdb/src/sdb.c
+++ b/source/dnode/mnode/sdb/src/sdb.c
@@ -68,7 +68,11 @@ SSdb *sdbInit(SSdbOpt *pOption) {
void sdbCleanup(SSdb *pSdb) {
mInfo("start to cleanup sdb");
- (void)sdbWriteFile(pSdb, 0);
+ int32_t code = 0;
+
+ if ((code = sdbWriteFile(pSdb, 0)) != 0) {
+ mError("failed to write sdb file since %s", tstrerror(code));
+ }
if (pSdb->currDir != NULL) {
taosMemoryFreeClear(pSdb->currDir);
diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c
index dec37bfbf1..94826405dc 100644
--- a/source/dnode/mnode/sdb/src/sdbFile.c
+++ b/source/dnode/mnode/sdb/src/sdbFile.c
@@ -258,8 +258,11 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
if (code != 0) {
mError("failed to read sdb file:%s head since %s", file, tstrerror(code));
taosMemoryFree(pRaw);
- (void)taosCloseFile(&pFile);
- return -1;
+ int32_t ret = 0;
+ if ((ret = taosCloseFile(&pFile)) != 0) {
+ mError("failed to close sdb file:%s since %s", file, tstrerror(ret));
+ }
+ return code;
}
int64_t tableVer[SDB_MAX] = {0};
@@ -361,7 +364,9 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
pSdb->commitTerm, pSdb->commitConfig);
_OVER:
- (void)taosCloseFile(&pFile);
+ if ((ret = taosCloseFile(&pFile)) != 0) {
+ mError("failed to close sdb file:%s since %s", file, tstrerror(ret));
+ }
sdbFreeRaw(pRaw);
TAOS_RETURN(code);
@@ -404,8 +409,11 @@ static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) {
code = sdbWriteFileHead(pSdb, pFile);
if (code != 0) {
mError("failed to write sdb file:%s head since %s", tmpfile, tstrerror(code));
- (void)taosCloseFile(&pFile);
- return -1;
+ int32_t ret = 0;
+ if ((ret = taosCloseFile(&pFile)) != 0) {
+ mError("failed to close sdb file:%s since %s", tmpfile, tstrerror(ret));
+ }
+ return code;
}
for (int32_t i = SDB_MAX - 1; i >= 0; --i) {
@@ -613,12 +621,18 @@ static void sdbCloseIter(SSdbIter *pIter) {
if (pIter == NULL) return;
if (pIter->file != NULL) {
- (void)taosCloseFile(&pIter->file);
+ int32_t ret = 0;
+ if ((ret = taosCloseFile(&pIter->file)) != 0) {
+ mError("failed to close sdb file since %s", tstrerror(ret));
+ }
pIter->file = NULL;
}
if (pIter->name != NULL) {
- (void)taosRemoveFile(pIter->name);
+ int32_t ret = 0;
+ if ((ret = taosRemoveFile(pIter->name)) != 0) {
+ mError("failed to remove sdb file:%s since %s", pIter->name, tstrerror(ret));
+ }
taosMemoryFree(pIter->name);
pIter->name = NULL;
}
diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c
index 0e41e0732f..5a2d1c981c 100644
--- a/source/dnode/mnode/sdb/src/sdbHash.c
+++ b/source/dnode/mnode/sdb/src/sdbHash.c
@@ -174,12 +174,12 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
if (insertFp != NULL) {
code = (*insertFp)(pSdb, pRow->pObj);
if (code != 0) {
- if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
- code = terrno;
- (void)taosHashRemove(hash, pRow->pObj, keySize);
+ if (taosHashRemove(hash, pRow->pObj, keySize) != 0) {
+ mError("failed to remove row from hash");
+ }
sdbFreeRow(pSdb, pRow, false);
- terrno = code;
sdbUnLock(pSdb, type);
+ terrno = code;
return terrno;
}
}
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index 85084a0b81..59d70889e5 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -243,7 +243,7 @@ int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable);
void tsdbMemTableDestroy(SMemTable *pMemTable, bool proactive);
STbData *tsdbGetTbDataFromMemTable(SMemTable *pMemTable, tb_uid_t suid, tb_uid_t uid);
int32_t tsdbRefMemTable(SMemTable *pMemTable, SQueryNode *pQNode);
-int32_t tsdbUnrefMemTable(SMemTable *pMemTable, SQueryNode *pNode, bool proactive);
+void tsdbUnrefMemTable(SMemTable *pMemTable, SQueryNode *pNode, bool proactive);
// STbDataIter
int32_t tsdbTbDataIterCreate(STbData *pTbData, STsdbRowKey *pFrom, int8_t backward, STbDataIter **ppIter);
void *tsdbTbDataIterDestroy(STbDataIter *pIter);
@@ -377,7 +377,7 @@ struct STsdb {
struct {
SVHashTable *ht;
SArray *arr;
- } * commitInfo;
+ } *commitInfo;
};
struct TSDBKEY {
@@ -679,7 +679,7 @@ typedef struct STFileSetRange STFileSetRange;
typedef TARRAY2(STFileSetRange *) TFileSetRangeArray; // disjoint ranges
int32_t tsdbTFileSetRangeClear(STFileSetRange **fsr);
-int32_t tsdbTFileSetRangeArrayDestroy(TFileSetRangeArray **ppArr);
+void tsdbTFileSetRangeArrayDestroy(TFileSetRangeArray **ppArr);
// fset partition
enum {
@@ -898,7 +898,7 @@ typedef struct SSttDataInfoForTable {
int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoForTable *pTableInfo);
void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter);
-int32_t tMergeTreeNext(SMergeTree *pMTree, bool* pHasNext);
+int32_t tMergeTreeNext(SMergeTree *pMTree, bool *pHasNext);
void tMergeTreePinSttBlock(SMergeTree *pMTree);
void tMergeTreeUnpinSttBlock(SMergeTree *pMTree);
bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree);
@@ -914,13 +914,13 @@ typedef enum {
READER_EXEC_ROWS = 0x2,
} EExecMode;
-#define LAST_COL_VERSION_1 (0x1) // add primary key, version
-#define LAST_COL_VERSION_2 (0x2) // add cache status
+#define LAST_COL_VERSION_1 (0x1) // add primary key, version
+#define LAST_COL_VERSION_2 (0x2) // add cache status
#define LAST_COL_VERSION LAST_COL_VERSION_2
typedef enum {
- TSDB_LAST_CACHE_VALID = 0, // last_cache has valid data
- TSDB_LAST_CACHE_NO_CACHE, // last_cache has no data, but tsdb may have data
+ TSDB_LAST_CACHE_VALID = 0, // last_cache has valid data
+ TSDB_LAST_CACHE_NO_CACHE, // last_cache has no data, but tsdb may have data
} ELastCacheStatus;
typedef struct {
@@ -1069,6 +1069,8 @@ typedef enum {
ETsdbFsState tsdbSnapGetFsState(SVnode *pVnode);
int32_t tsdbSnapPrepDescription(SVnode *pVnode, SSnapshot *pSnap);
+void tsdbRemoveFile(const char *path);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h
index eb1b4c6a9b..1bc1eadca7 100644
--- a/source/dnode/vnode/src/inc/vnd.h
+++ b/source/dnode/vnode/src/inc/vnd.h
@@ -101,7 +101,7 @@ void vnodeBufPoolAddToFreeList(SVBufPool* pPool);
int32_t vnodeBufPoolRecycle(SVBufPool* pPool);
// vnodeOpen.c
-int32_t vnodeGetPrimaryDir(const char* relPath, int32_t diskPrimary, STfs* pTfs, char* buf, size_t bufLen);
+void vnodeGetPrimaryDir(const char* relPath, int32_t diskPrimary, STfs* pTfs, char* buf, size_t bufLen);
// vnodeQuery.c
int32_t vnodeQueryOpen(SVnode* pVnode);
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 07490989f5..4bcd5335f7 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -130,8 +130,8 @@ void vnodeBufPoolRef(SVBufPool* pPool);
void vnodeBufPoolUnRef(SVBufPool* pPool, bool proactive);
int vnodeDecodeInfo(uint8_t* pData, SVnodeInfo* pInfo);
-int32_t vnodeBufPoolRegisterQuery(SVBufPool* pPool, SQueryNode* pQNode);
-void vnodeBufPoolDeregisterQuery(SVBufPool* pPool, SQueryNode* pQNode, bool proactive);
+void vnodeBufPoolRegisterQuery(SVBufPool* pPool, SQueryNode* pQNode);
+void vnodeBufPoolDeregisterQuery(SVBufPool* pPool, SQueryNode* pQNode, bool proactive);
// meta
typedef struct SMStbCursor SMStbCursor;
@@ -161,6 +161,8 @@ int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tb
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs);
SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
+int32_t metaGetTbTSchemaNotNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema);
+int32_t metaGetTbTSchemaMaybeNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema);
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);
int metaGetTableEntryByName(SMetaReader* pReader, const char* name);
@@ -221,7 +223,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq2* pMsg);
int tsdbInsertData(STsdb* pTsdb, int64_t version, SSubmitReq2* pMsg, SSubmitRsp2* pRsp);
int32_t tsdbInsertTableData(STsdb* pTsdb, int64_t version, SSubmitTbData* pSubmitTbData, int32_t* affectedRows);
int32_t tsdbDeleteTableData(STsdb* pTsdb, int64_t version, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey);
-int32_t tsdbSetKeepCfg(STsdb* pTsdb, STsdbCfg* pCfg);
+void tsdbSetKeepCfg(STsdb* pTsdb, STsdbCfg* pCfg);
int64_t tsdbGetEarliestTs(STsdb* pTsdb);
// tq
diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c
index d7626be4a9..1917c09526 100644
--- a/source/dnode/vnode/src/meta/metaOpen.c
+++ b/source/dnode/vnode/src/meta/metaOpen.c
@@ -48,7 +48,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
char indexFullPath[128] = {0};
// create handle
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
offset = strlen(path);
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VNODE_META_DIR);
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index 2625a77ef0..acee24e494 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -45,6 +45,7 @@ void metaReaderClear(SMetaReader *pReader) {
}
tDecoderClear(&pReader->coder);
tdbFree(pReader->pBuf);
+ pReader->pBuf = NULL;
}
int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t uid) {
@@ -53,8 +54,8 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u
STbDbKey tbDbKey = {.version = version, .uid = uid};
// query table.db
- if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf) < 0) {
- return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
+ if ((code = tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf)) < 0) {
+ return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code);
}
// decode the entry
@@ -97,8 +98,9 @@ int metaReaderGetTableEntryByUidCache(SMetaReader *pReader, tb_uid_t uid) {
SMeta *pMeta = pReader->pMeta;
SMetaInfo info;
- if (metaGetInfo(pMeta, uid, &info, pReader) == TSDB_CODE_NOT_FOUND) {
- return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
+ int32_t code = metaGetInfo(pMeta, uid, &info, pReader);
+ if (TSDB_CODE_SUCCESS != code) {
+ return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code);
}
return metaGetTableEntryByVersion(pReader, info.version, uid);
@@ -614,6 +616,22 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock) {
return pTSchema;
}
+int32_t metaGetTbTSchemaNotNull(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema) {
+ *ppTSchema = metaGetTbTSchema(pMeta, uid, sver, lock);
+ if(*ppTSchema == NULL) {
+ return terrno;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t metaGetTbTSchemaMaybeNull(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema) {
+ *ppTSchema = metaGetTbTSchema(pMeta, uid, sver, lock);
+ if(*ppTSchema == NULL && terrno == TSDB_CODE_OUT_OF_MEMORY) {
+ return terrno;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sver, STSchema **ppTSchema) {
int32_t code = 0;
int32_t lino;
@@ -1567,10 +1585,9 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR
}
// search TDB
- if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) {
+ if ((code = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData)) < 0) {
// not found
if (!lock) metaULock(pMeta);
- code = TSDB_CODE_NOT_FOUND;
goto _exit;
}
diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c
index 7576a85cdc..19c5b5d481 100644
--- a/source/dnode/vnode/src/sma/smaRollup.c
+++ b/source/dnode/vnode/src/sma/smaRollup.c
@@ -392,10 +392,9 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
return terrno;
}
- STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, -1, 1);
- if (!pTSchema) {
- TAOS_CHECK_EXIT(TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION);
- }
+ STSchema *pTSchema;
+ code = metaGetTbTSchemaNotNull(SMA_META(pSma), suid, -1, 1, &pTSchema);
+ TAOS_CHECK_EXIT(code);
pRSmaInfo->pSma = pSma;
pRSmaInfo->pTSchema = pTSchema;
pRSmaInfo->suid = suid;
diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c
index 8fd50716f6..f66282ac25 100644
--- a/source/dnode/vnode/src/sma/smaTimeRange.c
+++ b/source/dnode/vnode/src/sma/smaTimeRange.c
@@ -343,11 +343,8 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
TSDB_CHECK_CODE(code, lino, _exit);
}
pTsmaStat->pTSma = pTSma;
- pTsmaStat->pTSchema = metaGetTbTSchema(SMA_META(pSma), pTSma->dstTbUid, -1, 1);
- if (!pTsmaStat->pTSchema) {
- code = TSDB_CODE_TSMA_INVALID_PTR;
- TSDB_CHECK_CODE(code, lino, _exit);
- }
+ code = metaGetTbTSchemaNotNull(SMA_META(pSma), pTSma->dstTbUid, -1, 1, &pTsmaStat->pTSchema);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
if (pTsmaStat->pTSma->indexUid != indexUid) {
diff --git a/source/dnode/vnode/src/sma/smaUtil.c b/source/dnode/vnode/src/sma/smaUtil.c
index 8b908ed5bb..7271c79533 100644
--- a/source/dnode/vnode/src/sma/smaUtil.c
+++ b/source/dnode/vnode/src/sma/smaUtil.c
@@ -26,7 +26,7 @@ void tdRSmaGetDirName(SVnode *pVnode, STfs *pTfs, bool endWithSep, char *outputN
int32_t offset = 0;
// vnode
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pTfs, outputName, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pTfs, outputName, TSDB_FILENAME_LEN);
offset = strlen(outputName);
// rsma
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 07daab4459..c865e3ec6e 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -752,7 +752,7 @@ int32_t tqBuildStreamTask(void* pTqObj, SStreamTask* pTask, int64_t nextProcessV
}
streamTaskResetUpstreamStageInfo(pTask);
- (void)streamSetupScheduleTrigger(pTask);
+ streamSetupScheduleTrigger(pTask);
SCheckpointInfo* pChkInfo = &pTask->chkInfo;
tqSetRestoreVersionInfo(pTask);
@@ -802,6 +802,7 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
const char* id = pTask->id.idStr;
int64_t nextProcessedVer = pStreamTask->hTaskInfo.haltVer;
SVersionRange* pStep2Range = &pTask->step2Range;
+ int32_t vgId = pTask->pMeta->vgId;
// if it's an source task, extract the last version in wal.
bool done = streamHistoryTaskSetVerRangeStep2(pTask, nextProcessedVer);
@@ -837,12 +838,15 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
tqDebug("s-task:%s wal reader start scan WAL verRange:%" PRId64 "-%" PRId64 ", set sched-status:%d", id, dstVer,
pStep2Range->maxVer, TASK_SCHED_STATUS__INACTIVE);
- (void)streamTaskSetSchedStatusInactive(pTask);
+ int8_t status = streamTaskSetSchedStatusInactive(pTask);
// now the fill-history task starts to scan data from wal files.
code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE);
if (code == TSDB_CODE_SUCCESS) {
- (void)tqScanWalAsync(pTq, false);
+ code = tqScanWalAsync(pTq, false);
+ if (code) {
+ tqError("vgId:%d failed to start scan wal file, code:%s", vgId, tstrerror(code));
+ }
}
}
}
@@ -1001,7 +1005,10 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
// let's continue scan data in the wal files
if (code == 0 && (pReq->reqType >= 0 || pReq->reqType == STREAM_EXEC_T_RESUME_TASK)) {
- (void)tqScanWalAsync(pTq, false); // it's ok to failed
+ code = tqScanWalAsync(pTq, false); // it's ok to failed
+ if (code) {
+ tqError("vgId:%d failed to start scan wal file, code:%s", pTq->pStreamMeta->vgId, tstrerror(code));
+ }
}
return code;
@@ -1103,7 +1110,11 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
tqError("vgId:%d failed to decode checkpoint-source msg, code:%s", vgId, tstrerror(code));
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:0x%x failed to build checkpoint-source rsp, code:%s", req.taskId, tstrerror(code));
+ }
+
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; // always return success to mnode, todo: handle failure of build and send msg to mnode
}
@@ -1112,7 +1123,11 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
if (!vnodeIsRoleLeader(pTq->pVnode)) {
tqDebug("vgId:%d not leader, ignore checkpoint-source msg, s-task:0x%x", vgId, req.taskId);
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:0x%x failed to build checkpoint-source rsp, code:%s", req.taskId, tstrerror(code));
+ }
+
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; // always return success to mnode, todo: handle failure of build and send msg to mnode
}
@@ -1122,19 +1137,26 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
", transId:%d s-task:0x%x ignore it",
vgId, req.checkpointId, req.transId, req.taskId);
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:0x%x failed to build checkpoint-source rsp, code:%s", req.taskId, tstrerror(code));
+ }
+
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; // always return success to mnode, , todo: handle failure of build and send msg to mnode
}
SStreamTask* pTask = NULL;
code = streamMetaAcquireTask(pMeta, req.streamId, req.taskId, &pTask);
- if (pTask == NULL) {
+ if (pTask == NULL || code != 0) {
tqError("vgId:%d failed to find s-task:0x%x, ignore checkpoint msg. checkpointId:%" PRId64
" transId:%d it may have been destroyed",
vgId, req.taskId, req.checkpointId, req.transId);
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:%s failed to build checkpoint-source rsp, code:%s", pTask->id.idStr, tstrerror(code));
+ }
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS;
}
@@ -1147,7 +1169,11 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
streamMetaReleaseTask(pMeta, pTask);
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:%s failed to build checkpoint-source rsp, code:%s", pTask->id.idStr, tstrerror(code));
+ }
+
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; // todo retry handle error
}
@@ -1165,7 +1191,11 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
streamMetaReleaseTask(pMeta, pTask);
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:%s failed to build checkpoint-source rsp, code:%s", pTask->id.idStr, tstrerror(code));
+ }
+
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS;
}
@@ -1199,7 +1229,11 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
streamMetaReleaseTask(pMeta, pTask);
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:%s failed to build checkpoint-source rsp, code:%s", pTask->id.idStr, tstrerror(code));
+ }
+
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS;
@@ -1228,7 +1262,10 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
code = streamAddCheckpointSourceRspMsg(&req, &pMsg->info, pTask);
if (code != TSDB_CODE_SUCCESS) {
SRpcMsg rsp = {0};
- (void)streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ int32_t ret = streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
+ if (ret) { // suppress the error in build checkpointsource rsp
+ tqError("s-task:%s failed to build checkpoint-source rsp, code:%s", pTask->id.idStr, tstrerror(code));
+ }
tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS;
}
diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c
index db7766a7bb..cccc96d3f0 100644
--- a/source/dnode/vnode/src/tq/tqMeta.c
+++ b/source/dnode/vnode/src/tq/tqMeta.c
@@ -16,64 +16,79 @@
#include "tq.h"
int32_t tEncodeSTqHandle(SEncoder* pEncoder, const STqHandle* pHandle) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeCStr(pEncoder, pHandle->subKey) < 0) return -1;
- if (tEncodeI8(pEncoder, pHandle->fetchMeta) < 0) return -1;
- if (tEncodeI64(pEncoder, pHandle->consumerId) < 0) return -1;
- if (tEncodeI64(pEncoder, pHandle->snapshotVer) < 0) return -1;
- if (tEncodeI32(pEncoder, pHandle->epoch) < 0) return -1;
- if (tEncodeI8(pEncoder, pHandle->execHandle.subType) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pHandle->subKey));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pHandle->fetchMeta));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pHandle->consumerId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pHandle->snapshotVer));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pHandle->epoch));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pHandle->execHandle.subType));
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
- if (tEncodeCStr(pEncoder, pHandle->execHandle.execCol.qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pHandle->execHandle.execCol.qmsg));
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
int32_t size = taosHashGetSize(pHandle->execHandle.execDb.pFilterOutTbUid);
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
void* pIter = NULL;
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
while (pIter) {
int64_t* tbUid = (int64_t*)taosHashGetKey(pIter, NULL);
- if (tEncodeI64(pEncoder, *tbUid) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, *tbUid));
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
}
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
- if (tEncodeI64(pEncoder, pHandle->execHandle.execTb.suid) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pHandle->execHandle.execTb.suid));
if (pHandle->execHandle.execTb.qmsg != NULL) {
- if (tEncodeCStr(pEncoder, pHandle->execHandle.execTb.qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pHandle->execHandle.execTb.qmsg));
}
}
tEndEncode(pEncoder);
- return pEncoder->pos;
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pHandle->subKey) < 0) return -1;
- if (tDecodeI8(pDecoder, &pHandle->fetchMeta) < 0) return -1;
- if (tDecodeI64(pDecoder, &pHandle->consumerId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pHandle->snapshotVer) < 0) return -1;
- if (tDecodeI32(pDecoder, &pHandle->epoch) < 0) return -1;
- if (tDecodeI8(pDecoder, &pHandle->execHandle.subType) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pHandle->subKey));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pHandle->fetchMeta));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pHandle->consumerId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pHandle->snapshotVer));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pHandle->epoch));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pHandle->execHandle.subType));
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
- if (tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execCol.qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execCol.qmsg));
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
pHandle->execHandle.execDb.pFilterOutTbUid =
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
- if (pHandle->execHandle.execDb.pFilterOutTbUid == NULL) return -1;
+ if (pHandle->execHandle.execDb.pFilterOutTbUid == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
int32_t size = 0;
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
for (int32_t i = 0; i < size; i++) {
int64_t tbUid = 0;
- if (tDecodeI64(pDecoder, &tbUid) < 0) return -1;
- if (taosHashPut(pHandle->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0) != 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &tbUid));
+ TAOS_CHECK_EXIT(taosHashPut(pHandle->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0));
}
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
- if (tDecodeI64(pDecoder, &pHandle->execHandle.execTb.suid) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pHandle->execHandle.execTb.suid));
if (!tDecodeIsEnd(pDecoder)) {
- if (tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execTb.qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execTb.qmsg));
}
}
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tqMetaDecodeCheckInfo(STqCheckInfo* info, void* pVal, int32_t vLen) {
@@ -374,7 +389,10 @@ static int32_t tqMetaTransformInfo(TDB* pMetaDB, TTB* pOld, TTB* pNew) {
END:
tdbFree(pKey);
tdbFree(pVal);
- (void)tdbTbcClose(pCur);
+ int32_t ret = tdbTbcClose(pCur);
+ if (code == 0 && ret != 0) {
+ code = ret;
+ }
return code;
}
@@ -446,7 +464,12 @@ static int32_t tqMetaRestoreCheckInfo(STQ* pTq) {
END:
tdbFree(pKey);
tdbFree(pVal);
- (void)tdbTbcClose(pCur);
+
+ int32_t ret = tdbTbcClose(pCur);
+ if (code == 0) {
+ code = ret;
+ }
+
tDeleteSTqCheckInfo(&info);
return code;
}
@@ -461,13 +484,13 @@ int32_t tqMetaOpen(STQ* pTq) {
TQ_ERR_GO_TO_END(tqMetaOpenTdb(pTq));
} else {
TQ_ERR_GO_TO_END(tqMetaTransform(pTq));
- (void)taosRemoveFile(maindb);
+ TQ_ERR_GO_TO_END(taosRemoveFile(maindb));
}
TQ_ERR_GO_TO_END(tqBuildFName(&offsetNew, pTq->path, TQ_OFFSET_NAME));
if(taosCheckExistFile(offsetNew)){
TQ_ERR_GO_TO_END(tqOffsetRestoreFromFile(pTq, offsetNew));
- (void)taosRemoveFile(offsetNew);
+ TQ_ERR_GO_TO_END(taosRemoveFile(offsetNew));
}
TQ_ERR_GO_TO_END(tqMetaRestoreCheckInfo(pTq));
@@ -503,7 +526,7 @@ int32_t tqMetaTransform(STQ* pTq) {
if (taosCopyFile(offset, offsetNew) < 0) {
tqError("copy offset file error");
} else {
- (void)taosRemoveFile(offset);
+ TQ_ERR_GO_TO_END(taosRemoveFile(offset));
}
}
@@ -512,22 +535,47 @@ END:
taosMemoryFree(offsetNew);
// return 0 always, so ignore
- (void)tdbTbClose(pExecStore);
- (void)tdbTbClose(pCheckStore);
- (void)tdbClose(pMetaDB);
+ int32_t ret = tdbTbClose(pExecStore);
+ if (ret != 0) {
+ tqError("vgId:%d failed to close stream exec store, code:%s", pTq->pStreamMeta->vgId, tstrerror(ret));
+ }
+
+ ret = tdbTbClose(pCheckStore);
+ if (ret != 0) {
+ tqError("vgId:%d failed to close stream check store, code:%s", pTq->pStreamMeta->vgId, tstrerror(ret));
+ }
+
+ ret = tdbClose(pMetaDB);
+ if (ret != 0) {
+ tqError("vgId:%d failed to close stream meta db store, code:%s", pTq->pStreamMeta->vgId, tstrerror(ret));
+ }
return code;
}
void tqMetaClose(STQ* pTq) {
+ int32_t code = 0;
if (pTq->pExecStore) {
- (void)tdbTbClose(pTq->pExecStore);
+ code = tdbTbClose(pTq->pExecStore);
+ if (code) {
+ tqError("vgId:%d failed to close tq exec store, code:%s", pTq->pStreamMeta->vgId, tstrerror(code));
+ }
}
if (pTq->pCheckStore) {
- (void)tdbTbClose(pTq->pCheckStore);
+ code = tdbTbClose(pTq->pCheckStore);
+ if (code) {
+ tqError("vgId:%d failed to close tq check store, code:%s", pTq->pStreamMeta->vgId, tstrerror(code));
+ }
}
if (pTq->pOffsetStore) {
- (void)tdbTbClose(pTq->pOffsetStore);
+ code = tdbTbClose(pTq->pOffsetStore);
+ if (code) {
+ tqError("vgId:%d failed to close tq offset store, code:%s", pTq->pStreamMeta->vgId, tstrerror(code));
+ }
+ }
+
+ code = tdbClose(pTq->pMetaDB);
+ if (code) {
+ tqError("vgId:%d failed to close tq meta db store, code:%s", pTq->pStreamMeta->vgId, tstrerror(code));
}
- (void)tdbClose(pTq->pMetaDB);
}
diff --git a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
index a279b58d32..420fbf9c56 100644
--- a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
+++ b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
@@ -83,18 +83,27 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
_err:
tqError("vgId:%d, vnode stream-task snapshot reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
- (void)streamTaskSnapReaderClose(pReader);
+ int32_t ret = streamTaskSnapReaderClose(pReader);
*ppReader = NULL;
return code;
}
int32_t streamTaskSnapReaderClose(SStreamTaskReader* pReader) {
- if (pReader == NULL) return 0;
+ if (pReader == NULL) {
+ return 0;
+ }
int32_t code = 0;
- tqInfo("vgId:%d, vnode stream-task snapshot reader closed", TD_VID(pReader->pTq->pVnode));
+ int32_t vgId = TD_VID(pReader->pTq->pVnode);
+
taosArrayDestroy(pReader->tdbTbList);
- (void)tdbTbcClose(pReader->pCur);
+ code = tdbTbcClose(pReader->pCur);
+ if (code) {
+ tqError("vgId:%d failed to close stream meta reader, code:%s", vgId, tstrerror(code));
+ } else {
+ tqInfo("vgId:%d, vnode stream-task snapshot reader closed", vgId);
+ }
+
taosMemoryFree(pReader);
return code;
}
@@ -113,6 +122,7 @@ int32_t streamTaskSnapRead(SStreamTaskReader* pReader, uint8_t** ppData) {
tqDebug("vgId:%d, vnode stream-task snapshot start read data", TD_VID(pReader->pTq->pVnode));
STablePair* pPair = taosArrayGet(pReader->tdbTbList, pReader->pos);
+
NextTbl:
except = 0;
for (;;) {
@@ -127,6 +137,7 @@ NextTbl:
code = terrno;
goto _err;
}
+
memcpy(pVal, tVal, tLen);
vLen = tLen;
}
@@ -163,8 +174,8 @@ NextTbl:
taosMemoryFree(pVal);
tqDebug("vgId:%d, vnode stream-task snapshot read data vLen:%d", TD_VID(pReader->pTq->pVnode), vLen);
-
return code;
+
_err:
tqError("vgId:%d, vnode stream-task snapshot read data failed since %s", TD_VID(pReader->pTq->pVnode),
tstrerror(code));
diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c
index 44b3f75289..c00d9a93bb 100644
--- a/source/dnode/vnode/src/tqCommon/tqCommon.c
+++ b/source/dnode/vnode/src/tqCommon/tqCommon.c
@@ -207,7 +207,10 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM
updated = streamTaskUpdateEpsetInfo(pTask, req.pNodeList);
// send the checkpoint-source-rsp for source task to end the checkpoint trans in mnode
- (void)streamTaskSendCheckpointsourceRsp(pTask);
+ code = streamTaskSendCheckpointsourceRsp(pTask);
+ if (code) {
+ tqError("%s failed to send checkpoint-source rsp, code:%s", pTask->id.idStr, tstrerror(code));
+ }
streamTaskResetStatus(pTask);
streamTaskStopMonitorCheckRsp(&pTask->taskCheckInfo, pTask->id.idStr);
@@ -410,7 +413,7 @@ int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
tDecoderClear(&decoder);
if (code) {
- tqError("vgId:%d failed to decode retrieve msg, quit handling it", pMeta->vgId);
+ tqError("vgId:%d failed to decode retrieve msg, discard it", pMeta->vgId);
return code;
}
@@ -420,9 +423,16 @@ int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
tqError("vgId:%d process retrieve req, failed to acquire task:0x%x, it may have been dropped already", pMeta->vgId,
req.dstTaskId);
tCleanupStreamRetrieveReq(&req);
- return -1;
+ return code;
}
+ // enqueue
+ tqDebug("s-task:%s (vgId:%d level:%d) recv retrieve req from task:0x%x(vgId:%d),QID:0x%" PRIx64, pTask->id.idStr,
+ pTask->pMeta->vgId, pTask->info.taskLevel, req.srcTaskId, req.srcNodeId, req.reqId);
+
+ // if task is in ck status, set current ck failed
+ streamTaskSetCheckpointFailed(pTask);
+
if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
code = streamProcessRetrieveReq(pTask, &req);
} else {
@@ -431,14 +441,19 @@ int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
code = streamTaskBroadcastRetrieveReq(pTask, &req);
}
- SRpcMsg rsp = {.info = pMsg->info, .code = 0};
- streamTaskSendRetrieveRsp(&req, &rsp);
+ if (code != TSDB_CODE_SUCCESS) { // return error not send rsp manually
+ tqError("s-task:0x%x vgId:%d failed to process retrieve request from 0x%x, code:%s", req.dstTaskId, req.dstNodeId,
+ req.srcTaskId, tstrerror(code));
+ } else { // send rsp manually only on success.
+ SRpcMsg rsp = {.info = pMsg->info, .code = 0};
+ streamTaskSendRetrieveRsp(&req, &rsp);
+ }
streamMetaReleaseTask(pMeta, pTask);
tCleanupStreamRetrieveReq(&req);
// always return success, to disable the auto rsp
- return TSDB_CODE_SUCCESS;
+ return code;
}
int32_t tqStreamTaskProcessCheckReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
@@ -794,25 +809,26 @@ int32_t tqStreamTaskProcessRunReq(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLead
int32_t type = pReq->reqType;
int32_t vgId = pMeta->vgId;
+ int32_t code = 0;
if (type == STREAM_EXEC_T_START_ONE_TASK) {
- (void)streamMetaStartOneTask(pMeta, pReq->streamId, pReq->taskId);
+ code = streamMetaStartOneTask(pMeta, pReq->streamId, pReq->taskId);
return 0;
} else if (type == STREAM_EXEC_T_START_ALL_TASKS) {
- (void)streamMetaStartAllTasks(pMeta);
+ code = streamMetaStartAllTasks(pMeta);
return 0;
} else if (type == STREAM_EXEC_T_RESTART_ALL_TASKS) {
- (void)restartStreamTasks(pMeta, isLeader);
+ code = restartStreamTasks(pMeta, isLeader);
return 0;
} else if (type == STREAM_EXEC_T_STOP_ALL_TASKS) {
- (void)streamMetaStopAllTasks(pMeta);
+ code = streamMetaStopAllTasks(pMeta);
return 0;
} else if (type == STREAM_EXEC_T_ADD_FAILED_TASK) {
- int32_t code = streamMetaAddFailedTask(pMeta, pReq->streamId, pReq->taskId);
+ code = streamMetaAddFailedTask(pMeta, pReq->streamId, pReq->taskId);
return code;
} else if (type == STREAM_EXEC_T_RESUME_TASK) { // task resume to run after idle for a while
SStreamTask* pTask = NULL;
- int32_t code = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId, &pTask);
+ code = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId, &pTask);
if (pTask != NULL && (code == 0)) {
char* pStatus = NULL;
@@ -834,7 +850,7 @@ int32_t tqStreamTaskProcessRunReq(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLead
}
SStreamTask* pTask = NULL;
- int32_t code = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId, &pTask);
+ code = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId, &pTask);
if ((pTask != NULL) && (code == 0)) { // even in halt status, the data in inputQ must be processed
char* p = NULL;
if (streamTaskReadyToRun(pTask, &p)) {
@@ -852,7 +868,7 @@ int32_t tqStreamTaskProcessRunReq(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLead
} else { // NOTE: pTask->status.schedStatus is not updated since it is not be handled by the run exec.
// todo add one function to handle this
tqError("vgId:%d failed to found s-task, taskId:0x%x may have been dropped", vgId, pReq->taskId);
- return -1;
+ return code;
}
}
@@ -1217,7 +1233,8 @@ int32_t tqStreamTaskProcessConsenChkptIdReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
tqError(
"vgId:%d process set consensus checkpointId req, failed to acquire task:0x%x, it may have been dropped already",
pMeta->vgId, req.taskId);
- (void)streamMetaAddFailedTask(pMeta, req.streamId, req.taskId);
+ // ignore this code to avoid error code over write
+ int32_t ret = streamMetaAddFailedTask(pMeta, req.streamId, req.taskId);
return code;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index 2a321289d1..f11788bb47 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -117,7 +117,7 @@ typedef struct {
static void tsdbGetRocksPath(STsdb *pTsdb, char *path) {
SVnode *pVnode = pTsdb->pVnode;
- (void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
int32_t offset = strlen(path);
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%scache.rdb", TD_DIRSEP);
@@ -582,6 +582,8 @@ _exit:
taosMemoryFree(pCol->rowKey.pks[j].pData);
}
}
+
+ (void)memset(pCol, 0, sizeof(SLastCol));
}
TAOS_RETURN(code);
@@ -643,7 +645,9 @@ static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, i
LRUStatus status = taosLRUCacheInsert(pCache, pLastKey, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL,
TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
if (status != TAOS_LRU_STATUS_OK) {
- // code = -1;
+ tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
+ tsdbCacheFreeSLastColItem(pLastCol);
+ code = TSDB_CODE_FAILED;
}
_exit:
@@ -1015,29 +1019,6 @@ static int32_t tsdbCacheUpdateValue(SValue *pOld, SValue *pNew) {
TAOS_RETURN(TSDB_CODE_SUCCESS);
}
-#ifdef BUILD_NO_CALL
-static void tsdbCacheUpdateLastCol(SLastCol *pLastCol, SRowKey *pRowKey, SColVal *pColVal) {
- // update rowkey
- pLastCol->rowKey.ts = pRowKey->ts;
- pLastCol->rowKey.numOfPKs = pRowKey->numOfPKs;
- for (int8_t i = 0; i < pRowKey->numOfPKs; i++) {
- SValue *pPKValue = &pLastCol->rowKey.pks[i];
- SValue *pNewPKValue = &pRowKey->pks[i];
-
- (void)tsdbCacheUpdateValue(pPKValue, pNewPKValue);
- }
-
- // update colval
- pLastCol->colVal.cid = pColVal->cid;
- pLastCol->colVal.flag = pColVal->flag;
- (void)tsdbCacheUpdateValue(&pLastCol->colVal.value, &pColVal->value);
-
- if (!pLastCol->dirty) {
- pLastCol->dirty = 1;
- }
-}
-#endif
-
static void tsdbCacheUpdateLastColToNone(SLastCol *pLastCol, ELastCacheStatus cacheStatus) {
// update rowkey
pLastCol->rowKey.ts = TSKEY_MIN;
@@ -1104,8 +1085,9 @@ static int32_t tsdbCachePutToLRU(STsdb *pTsdb, SLastKey *pLastKey, SLastCol *pLa
LRUStatus status = taosLRUCacheInsert(pTsdb->lruCache, pLastKey, ROCKS_KEY_LEN, pLRULastCol, charge, tsdbCacheDeleter,
NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) {
- tsdbError("tsdb/cache/putlru: vgId:%d, failed to insert status %d.", TD_VID(pTsdb->pVnode), status);
- code = TSDB_CODE_INVALID_DATA_FMT;
+ tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
+ tsdbCacheFreeSLastColItem(pLRULastCol);
+ code = TSDB_CODE_FAILED;
}
_exit:
@@ -1217,23 +1199,23 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
tsdbError("tsdb/cache: vgId:%d, deserialize failed since %s.", TD_VID(pTsdb->pVnode), tstrerror(code));
}
*/
- SLastCol *PToFree = pLastCol;
+ SLastCol *pToFree = pLastCol;
if (pLastCol && pLastCol->cacheStatus == TSDB_LAST_CACHE_NO_CACHE) {
if ((code = tsdbCachePutToLRU(pTsdb, &idxKey->key, pLastCol)) != TSDB_CODE_SUCCESS) {
tsdbError("tsdb/cache: vgId:%d, put lru failed at line %d since %s.", TD_VID(pTsdb->pVnode), lino,
tstrerror(code));
- taosMemoryFreeClear(PToFree);
+ taosMemoryFreeClear(pToFree);
break;
}
// cache invalid => skip update
- taosMemoryFreeClear(PToFree);
+ taosMemoryFreeClear(pToFree);
continue;
}
if (IS_LAST_KEY(idxKey->key) && !COL_VAL_IS_VALUE(pColVal)) {
- taosMemoryFreeClear(PToFree);
+ taosMemoryFreeClear(pToFree);
continue;
}
@@ -1247,18 +1229,18 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
if ((code = tsdbCachePutToRocksdb(pTsdb, &idxKey->key, &lastColTmp)) != TSDB_CODE_SUCCESS) {
tsdbError("tsdb/cache: vgId:%d, put rocks failed at line %d since %s.", TD_VID(pTsdb->pVnode), lino,
tstrerror(code));
- taosMemoryFreeClear(PToFree);
+ taosMemoryFreeClear(pToFree);
break;
}
if ((code = tsdbCachePutToLRU(pTsdb, &idxKey->key, &lastColTmp)) != TSDB_CODE_SUCCESS) {
tsdbError("tsdb/cache: vgId:%d, put lru failed at line %d since %s.", TD_VID(pTsdb->pVnode), lino,
tstrerror(code));
- taosMemoryFreeClear(PToFree);
+ taosMemoryFreeClear(pToFree);
break;
}
}
- taosMemoryFreeClear(PToFree);
+ taosMemoryFreeClear(pToFree);
}
rocksMayWrite(pTsdb, true, false);
@@ -1586,14 +1568,17 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
pLastCol = pTmpLastCol;
code = tsdbCacheReallocSLastCol(pLastCol, &charge);
if (TSDB_CODE_SUCCESS != code) {
- taosMemoryFree(pTmpLastCol);
+ taosMemoryFree(pLastCol);
TAOS_CHECK_EXIT(code);
}
LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL,
TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
- if (status != TAOS_LRU_STATUS_OK) {
- // code = -1;
+ if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) {
+ tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
+ tsdbCacheFreeSLastColItem(pLastCol);
+ taosMemoryFree(pLastCol);
+ TAOS_CHECK_EXIT(TSDB_CODE_FAILED);
}
// store result back to rocks cache
@@ -1672,14 +1657,13 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
}
(void)tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol);
- SLastCol *PToFree = pLastCol;
+ SLastCol *pToFree = pLastCol;
SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[j];
if (pLastCol && pLastCol->cacheStatus != TSDB_LAST_CACHE_NO_CACHE) {
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
if (!pTmpLastCol) {
- taosMemoryFreeClear(PToFree);
- code = terrno;
- goto _exit;
+ taosMemoryFreeClear(pToFree);
+ TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
}
size_t charge = 0;
@@ -1687,18 +1671,28 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
pLastCol = pTmpLastCol;
code = tsdbCacheReallocSLastCol(pLastCol, &charge);
if (TSDB_CODE_SUCCESS != code) {
- taosMemoryFree(pTmpLastCol);
- taosMemoryFreeClear(PToFree);
- goto _exit;
+ taosMemoryFreeClear(pLastCol);
+ taosMemoryFreeClear(pToFree);
+ TAOS_CHECK_EXIT(code);
}
SLastCol lastCol = *pLastCol;
- TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(&lastCol, NULL));
+ code = tsdbCacheReallocSLastCol(&lastCol, NULL);
+ if (TSDB_CODE_SUCCESS != code) {
+ tsdbCacheFreeSLastColItem(pLastCol);
+ taosMemoryFreeClear(pLastCol);
+ taosMemoryFreeClear(pToFree);
+ TAOS_CHECK_EXIT(code);
+ }
LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter,
NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
- if (status != TAOS_LRU_STATUS_OK) {
- code = -1;
+ if (TAOS_LRU_STATUS_OK != status && TAOS_LRU_STATUS_OK_OVERWRITTEN != status) {
+ tsdbError("vgId:%d, %s failed at line %d status %d.", TD_VID(pTsdb->pVnode), __func__, __LINE__, status);
+ tsdbCacheFreeSLastColItem(pLastCol);
+ taosMemoryFreeClear(pLastCol);
+ taosMemoryFreeClear(pToFree);
+ TAOS_CHECK_EXIT(TSDB_CODE_FAILED);
}
taosArraySet(pLastArray, idxKey->idx, &lastCol);
@@ -1708,7 +1702,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
++j;
}
- taosMemoryFreeClear(PToFree);
+ taosMemoryFreeClear(pToFree);
}
if (TARRAY_SIZE(remainCols) > 0) {
@@ -2158,6 +2152,11 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
uint64_t uid = uidList[j];
STableLoadInfo *pInfo = getTableLoadInfo(pReader, uid);
+ if (!pInfo) {
+ (void)tTombBlockDestroy(&block);
+ TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
+ }
+
if (pInfo->pTombData == NULL) {
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
}
@@ -2200,8 +2199,18 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
if (newTable) {
pInfo = getTableLoadInfo(pReader, uid);
+ if (!pInfo) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ finished = true;
+ break;
+ }
if (pInfo->pTombData == NULL) {
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
+ if (!pInfo->pTombData) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ finished = true;
+ break;
+ }
}
}
@@ -2523,7 +2532,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if (!state->pBrinBlock) {
state->pBrinBlock = &state->brinBlock;
} else {
- (void)tBrinBlockClear(&state->brinBlock);
+ tBrinBlockClear(&state->brinBlock);
}
TAOS_CHECK_GOTO(tsdbDataFileReadBrinBlock(state->pr->pFileReader, pBrinBlk, &state->brinBlock), &lino, _err);
@@ -2535,7 +2544,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if (SFSNEXTROW_BRINBLOCK == state->state) {
_next_brinrecord:
if (state->iBrinRecord < 0) { // empty brin block, goto _next_brinindex
- (void)tBrinBlockClear(&state->brinBlock);
+ tBrinBlockClear(&state->brinBlock);
goto _next_brinindex;
}
@@ -2794,7 +2803,7 @@ int32_t clearNextRowFromFS(void *iter) {
}
if (state->pBrinBlock) {
- (void)tBrinBlockDestroy(state->pBrinBlock);
+ tBrinBlockDestroy(state->pBrinBlock);
state->pBrinBlock = NULL;
}
@@ -2827,7 +2836,7 @@ static void clearLastFileSet(SFSNextRowIter *state) {
}
if (state->pr->pFileReader) {
- (void)tsdbDataFileReaderClose(&state->pr->pFileReader);
+ tsdbDataFileReaderClose(&state->pr->pFileReader);
state->pr->pFileReader = NULL;
state->pr->pCurFileSet = NULL;
@@ -2912,9 +2921,7 @@ _err:
TAOS_RETURN(code);
}
-static int32_t nextRowIterClose(CacheNextRowIter *pIter) {
- int32_t code = 0;
-
+static void nextRowIterClose(CacheNextRowIter *pIter) {
for (int i = 0; i < 3; ++i) {
if (pIter->input[i].nextRowClearFn) {
(void)pIter->input[i].nextRowClearFn(pIter->input[i].iter);
@@ -2928,9 +2935,6 @@ static int32_t nextRowIterClose(CacheNextRowIter *pIter) {
if (pIter->pMemDelData) {
taosArrayDestroy(pIter->pMemDelData);
}
-
-_err:
- TAOS_RETURN(code);
}
// iterate next row non deleted backward ts, version (from high to low)
@@ -2998,6 +3002,8 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
uint64_t uid = pIter->idx.uid;
STableLoadInfo *pInfo = getTableLoadInfo(pIter->pr, uid);
+ TSDB_CHECK_NULL(pInfo, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
+
if (pInfo->pTombData == NULL) {
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
TSDB_CHECK_NULL(pInfo->pTombData, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
@@ -3204,6 +3210,10 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
break;
}
// high version's column value
+ if (slotIds[iCol] > pTSchema->numOfCols - 1) {
+ continue;
+ }
+
SLastCol *lastColVal = (SLastCol *)taosArrayGet(pColArray, iCol);
if (lastColVal->colVal.cid != pTSchema->columns[slotIds[iCol]].colId) {
continue;
@@ -3239,7 +3249,7 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
}
*ppLastArray = pColArray;
- (void)nextRowIterClose(&iter);
+ nextRowIterClose(&iter);
taosArrayDestroy(aColArray);
TAOS_RETURN(code);
@@ -3360,7 +3370,7 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
}
*ppLastArray = pColArray;
- (void)nextRowIterClose(&iter);
+ nextRowIterClose(&iter);
taosArrayDestroy(aColArray);
TAOS_RETURN(code);
diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
index 14e4b5a53c..c3364231e0 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
@@ -237,17 +237,25 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
static int32_t setTableSchema(SCacheRowsReader* p, uint64_t suid, const char* idstr) {
int32_t numOfTables = p->numOfTables;
+ int32_t code = TSDB_CODE_SUCCESS;
if (suid != 0) {
- p->pSchema = metaGetTbTSchema(p->pVnode->pMeta, suid, -1, 1);
- if (p->pSchema == NULL) {
+ code = metaGetTbTSchemaNotNull(p->pVnode->pMeta, suid, -1, 1, &p->pSchema);
+ if (TSDB_CODE_SUCCESS != code) {
tsdbWarn("stable:%" PRIu64 " has been dropped, failed to retrieve cached rows, %s", suid, idstr);
- return TSDB_CODE_PAR_TABLE_NOT_EXIST;
+ if(code != TSDB_CODE_OUT_OF_MEMORY) {
+ return TSDB_CODE_PAR_TABLE_NOT_EXIST;
+ } else {
+ return code;
+ }
}
} else {
for (int32_t i = 0; i < numOfTables; ++i) {
uint64_t uid = p->pTableList[i].uid;
- p->pSchema = metaGetTbTSchema(p->pVnode->pMeta, uid, -1, 1);
+ code = metaGetTbTSchemaMaybeNull(p->pVnode->pMeta, uid, -1, 1, &p->pSchema);
+ if(code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
if (p->pSchema != NULL) {
break;
}
@@ -379,7 +387,7 @@ void tsdbCacherowsReaderClose(void* pReader) {
}
if (p->pFileReader) {
- (void) tsdbDataFileReaderClose(&p->pFileReader);
+ tsdbDataFileReaderClose(&p->pFileReader);
p->pFileReader = NULL;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c
index 8ccb8b0a50..586a86bdb6 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c
@@ -251,8 +251,8 @@ _exit:
}
static int32_t tsdbCommitCloseIter(SCommitter2 *committer) {
- TAOS_UNUSED(tsdbIterMergerClose(&committer->tombIterMerger));
- TAOS_UNUSED(tsdbIterMergerClose(&committer->dataIterMerger));
+ tsdbIterMergerClose(&committer->tombIterMerger);
+ tsdbIterMergerClose(&committer->dataIterMerger);
TARRAY2_CLEAR(committer->tombIterArray, tsdbIterClose);
TARRAY2_CLEAR(committer->dataIterArray, tsdbIterClose);
return 0;
@@ -669,7 +669,7 @@ int32_t tsdbCommitBegin(STsdb *tsdb, SCommitInfo *info) {
(void)taosThreadMutexLock(&tsdb->mutex);
tsdb->imem = NULL;
(void)taosThreadMutexUnlock(&tsdb->mutex);
- TAOS_UNUSED(tsdbUnrefMemTable(imem, NULL, true));
+ tsdbUnrefMemTable(imem, NULL, true);
} else {
SCommitter2 committer = {0};
@@ -717,7 +717,7 @@ int32_t tsdbCommitCommit(STsdb *tsdb) {
(void)taosThreadMutexUnlock(&tsdb->mutex);
TAOS_UNUSED(tsdbCommitInfoDestroy(tsdb));
- TAOS_UNUSED(tsdbUnrefMemTable(pMemTable, NULL, true));
+ tsdbUnrefMemTable(pMemTable, NULL, true);
}
_exit:
diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c
index 3b5386a426..842730cb71 100644
--- a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c
+++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c
@@ -35,7 +35,7 @@ int32_t tsdbDataFileRAWReaderOpen(const char *fname, const SDataFileRAWReaderCon
}
} else {
char fname1[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(config->tsdb, &config->file, fname1);
+ tsdbTFileName(config->tsdb, &config->file, fname1);
TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd, lcn), &lino, _exit);
}
@@ -157,7 +157,7 @@ static int32_t tsdbDataFileRAWWriterOpenDataFD(SDataFileRAWWriter *writer) {
flag |= (TD_FILE_CREATE | TD_FILE_TRUNC);
}
- (void)tsdbTFileName(writer->config->tsdb, &writer->file, fname);
+ tsdbTFileName(writer->config->tsdb, &writer->file, fname);
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd, writer->file.lcn), &lino, _exit);
_exit:
diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
index 1f2e338c0a..2d54d33105 100644
--- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
+++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c
@@ -135,7 +135,7 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig
for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) {
if (config->files[i].exist) {
char fname1[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(config->tsdb, &config->files[i].file, fname1);
+ tsdbTFileName(config->tsdb, &config->files[i].file, fname1);
int32_t lcn = config->files[i].file.lcn;
TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd[i], lcn), &lino, _exit);
}
@@ -150,9 +150,9 @@ _exit:
return code;
}
-int32_t tsdbDataFileReaderClose(SDataFileReader **reader) {
+void tsdbDataFileReaderClose(SDataFileReader **reader) {
if (reader[0] == NULL) {
- return 0;
+ return;
}
TARRAY2_DESTROY(reader[0]->tombBlkArray, NULL);
@@ -170,7 +170,6 @@ int32_t tsdbDataFileReaderClose(SDataFileReader **reader) {
taosMemoryFree(reader[0]);
reader[0] = NULL;
- return 0;
}
int32_t tsdbDataFileReadBrinBlk(SDataFileReader *reader, const TBrinBlkArray **brinBlkArray) {
@@ -230,7 +229,7 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
// decode brin block
SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
- (void)tBrinBlockClear(brinBlock);
+ tBrinBlockClear(brinBlock);
brinBlock->numOfPKs = brinBlk->numOfPKs;
brinBlock->numOfRecords = brinBlk->numRec;
for (int32_t i = 0; i < 10; i++) { // int64_t
@@ -677,20 +676,20 @@ static int32_t tsdbDataFileWriterCloseAbort(SDataFileWriter *writer) {
return 0;
}
-static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
+static void tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
if (writer->ctx->reader) {
- (void)tsdbDataFileReaderClose(&writer->ctx->reader);
+ tsdbDataFileReaderClose(&writer->ctx->reader);
}
tTombBlockDestroy(writer->tombBlock);
TARRAY2_DESTROY(writer->tombBlkArray, NULL);
tBlockDataDestroy(writer->blockData);
- (void)tBrinBlockDestroy(writer->brinBlock);
+ tBrinBlockDestroy(writer->brinBlock);
TARRAY2_DESTROY(writer->brinBlkArray, NULL);
tTombBlockDestroy(writer->ctx->tombBlock);
tBlockDataDestroy(writer->ctx->blockData);
- (void)tBrinBlockDestroy(writer->ctx->brinBlock);
+ tBrinBlockDestroy(writer->ctx->brinBlock);
for (int32_t i = 0; i < ARRAY_SIZE(writer->local); ++i) {
tBufferDestroy(writer->local + i);
@@ -698,7 +697,6 @@ static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
tDestroyTSchema(writer->skmRow->pTSchema);
tDestroyTSchema(writer->skmTb->pTSchema);
- return 0;
}
static int32_t tsdbDataFileWriterDoOpenReader(SDataFileWriter *writer) {
@@ -819,10 +817,9 @@ _exit:
return code;
}
-int32_t tsdbWriterUpdVerRange(SVersionRange *range, int64_t minVer, int64_t maxVer) {
+void tsdbWriterUpdVerRange(SVersionRange *range, int64_t minVer, int64_t maxVer) {
range->minVer = TMIN(range->minVer, minVer);
range->maxVer = TMAX(range->maxVer, maxVer);
- return 0;
}
int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmprAlg, int64_t *fileSize,
@@ -869,7 +866,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr
}
}
- (void)tsdbWriterUpdVerRange(range, brinBlk.minVer, brinBlk.maxVer);
+ tsdbWriterUpdVerRange(range, brinBlk.minVer, brinBlk.maxVer);
// write to file
for (int32_t i = 0; i < 10; ++i) {
@@ -930,7 +927,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr
// append to brinBlkArray
TAOS_CHECK_RETURN(TARRAY2_APPEND_PTR(brinBlkArray, &brinBlk));
- (void)tBrinBlockClear(brinBlock);
+ tBrinBlockClear(brinBlock);
return 0;
}
@@ -1032,7 +1029,7 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData
}
}
- (void)tsdbWriterUpdVerRange(&writer->ctx->range, record->minVer, record->maxVer);
+ tsdbWriterUpdVerRange(&writer->ctx->range, record->minVer, record->maxVer);
code = metaGetColCmpr(writer->config->tsdb->pVnode->pMeta, bData->suid != 0 ? bData->suid : bData->uid,
&cmprInfo.pColCmpr);
@@ -1383,7 +1380,7 @@ int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAl
}
}
- (void)tsdbWriterUpdVerRange(range, tombBlk.minVer, tombBlk.maxVer);
+ tsdbWriterUpdVerRange(range, tombBlk.minVer, tombBlk.maxVer);
for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->buffers); i++) {
tBufferClear(buffer0);
@@ -1615,10 +1612,9 @@ _exit:
return code;
}
-int32_t tsdbTFileUpdVerRange(STFile *f, SVersionRange range) {
+void tsdbTFileUpdVerRange(STFile *f, SVersionRange range) {
f->minVer = TMIN(f->minVer, range.minVer);
f->maxVer = TMAX(f->maxVer, range.maxVer);
- return 0;
}
static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArray *opArr) {
@@ -1658,8 +1654,8 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid,
.nf = writer->files[ftype],
};
- (void)tsdbTFileUpdVerRange(&op.nf, ofRange);
- (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
+ tsdbTFileUpdVerRange(&op.nf, ofRange);
+ tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
// .data
@@ -1670,7 +1666,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid,
.nf = writer->files[ftype],
};
- (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
+ tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
} else if (writer->config->files[ftype].file.size != writer->files[ftype].size) {
op = (STFileOp){
@@ -1679,7 +1675,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.of = writer->config->files[ftype].file,
.nf = writer->files[ftype],
};
- (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
+ tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
}
@@ -1691,7 +1687,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid,
.nf = writer->files[ftype],
};
- (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
+ tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
} else if (writer->config->files[ftype].file.size != writer->files[ftype].size) {
op = (STFileOp){
@@ -1700,7 +1696,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.of = writer->config->files[ftype].file,
.nf = writer->files[ftype],
};
- (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
+ tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
}
}
@@ -1734,8 +1730,8 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid,
.nf = writer->files[ftype],
};
- (void)tsdbTFileUpdVerRange(&op.nf, ofRange);
- (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->tombRange);
+ tsdbTFileUpdVerRange(&op.nf, ofRange);
+ tsdbTFileUpdVerRange(&op.nf, writer->ctx->tombRange);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
}
int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
@@ -1772,7 +1768,7 @@ static int32_t tsdbDataFileWriterOpenDataFD(SDataFileWriter *writer) {
}
int32_t lcn = writer->files[ftype].lcn;
- (void)tsdbTFileName(writer->config->tsdb, &writer->files[ftype], fname);
+ tsdbTFileName(writer->config->tsdb, &writer->files[ftype], fname);
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit);
if (writer->files[ftype].size == 0) {
@@ -1822,7 +1818,7 @@ int32_t tsdbDataFileWriterClose(SDataFileWriter **writer, bool abort, TFileOpArr
} else {
TAOS_CHECK_GOTO(tsdbDataFileWriterCloseCommit(writer[0], opArr), &lino, _exit);
}
- (void)tsdbDataFileWriterDoClose(writer[0]);
+ tsdbDataFileWriterDoClose(writer[0]);
}
taosMemoryFree(writer[0]);
writer[0] = NULL;
@@ -1935,7 +1931,7 @@ static int32_t tsdbDataFileWriterOpenTombFD(SDataFileWriter *writer) {
int32_t flag = (TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
int32_t lcn = writer->files[ftype].lcn;
- (void)tsdbTFileName(writer->config->tsdb, writer->files + ftype, fname);
+ tsdbTFileName(writer->config->tsdb, writer->files + ftype, fname);
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit);
diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h
index 2b87818273..a87205f865 100644
--- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h
+++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h
@@ -51,7 +51,7 @@ typedef struct SDataFileReaderConfig {
int32_t tsdbDataFileReaderOpen(const char *fname[/* TSDB_FTYPE_MAX */], const SDataFileReaderConfig *config,
SDataFileReader **reader);
-int32_t tsdbDataFileReaderClose(SDataFileReader **reader);
+void tsdbDataFileReaderClose(SDataFileReader **reader);
// .head
int32_t tsdbDataFileReadBrinBlk(SDataFileReader *reader, const TBrinBlkArray **brinBlkArray);
int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinBlk, SBrinBlock *brinBlock);
@@ -115,8 +115,8 @@ int32_t tsdbFileWriteTombFooter(STsdbFD *fd, const STombFooter *footer, int64_t
char *encryptKey);
// utils
-int32_t tsdbWriterUpdVerRange(SVersionRange *range, int64_t minVer, int64_t maxVer);
-int32_t tsdbTFileUpdVerRange(STFile *f, SVersionRange range);
+void tsdbWriterUpdVerRange(SVersionRange *range, int64_t minVer, int64_t maxVer);
+void tsdbTFileUpdVerRange(STFile *f, SVersionRange range);
#ifdef __cplusplus
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c
index ed80b5d412..dbd79a1f93 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFS.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFS.c
@@ -270,14 +270,14 @@ void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t) {
// CURRENT
if (current) {
- (void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current, TSDB_FILENAME_LEN);
offset = strlen(current);
snprintf(current + offset, TSDB_FILENAME_LEN - offset - 1, "%sCURRENT", TD_DIRSEP);
}
// CURRENT.t
if (current_t) {
- (void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current_t, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, current_t, TSDB_FILENAME_LEN);
offset = strlen(current_t);
snprintf(current_t + offset, TSDB_FILENAME_LEN - offset - 1, "%sCURRENT.t", TD_DIRSEP);
}
@@ -340,21 +340,21 @@ static int32_t tsdbRemoveFileSet(STsdb *pTsdb, SDFileSet *pSet) {
int32_t nRef = atomic_sub_fetch_32(&pSet->pHeadF->nRef, 1);
if (nRef == 0) {
tsdbHeadFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pHeadF, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSet->pHeadF);
}
nRef = atomic_sub_fetch_32(&pSet->pDataF->nRef, 1);
if (nRef == 0) {
tsdbDataFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pDataF, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSet->pDataF);
}
nRef = atomic_sub_fetch_32(&pSet->pSmaF->nRef, 1);
if (nRef == 0) {
tsdbSmaFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pSmaF, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSet->pSmaF);
}
@@ -362,7 +362,7 @@ static int32_t tsdbRemoveFileSet(STsdb *pTsdb, SDFileSet *pSet) {
nRef = atomic_sub_fetch_32(&pSet->aSttF[iStt]->nRef, 1);
if (nRef == 0) {
tsdbSttFileName(pTsdb, pSet->diskId, pSet->fid, pSet->aSttF[iStt], fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSet->aSttF[iStt]);
}
}
@@ -449,7 +449,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
nRef = atomic_sub_fetch_32(&pHeadF->nRef, 1);
if (nRef == 0) {
tsdbHeadFileName(pTsdb, pSetOld->diskId, pSetOld->fid, pHeadF, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pHeadF);
}
} else {
@@ -472,7 +472,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
nRef = atomic_sub_fetch_32(&pDataF->nRef, 1);
if (nRef == 0) {
tsdbDataFileName(pTsdb, pSetOld->diskId, pSetOld->fid, pDataF, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pDataF);
}
} else {
@@ -493,7 +493,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
nRef = atomic_sub_fetch_32(&pSmaF->nRef, 1);
if (nRef == 0) {
tsdbSmaFileName(pTsdb, pSetOld->diskId, pSetOld->fid, pSmaF, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSmaF);
}
} else {
@@ -517,7 +517,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
nRef = atomic_sub_fetch_32(&pSttFile->nRef, 1);
if (nRef == 0) {
tsdbSttFileName(pTsdb, pSetOld->diskId, pSetOld->fid, pSttFile, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSttFile);
}
pSetOld->aSttF[iStt] = NULL;
@@ -538,7 +538,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
nRef = atomic_sub_fetch_32(&pSttFile->nRef, 1);
if (nRef == 0) {
tsdbSttFileName(pTsdb, pSetOld->diskId, pSetOld->fid, pSttFile, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSttFile);
}
@@ -563,7 +563,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
nRef = atomic_sub_fetch_32(&pSttFile->nRef, 1);
if (nRef == 0) {
tsdbSttFileName(pTsdb, pSetOld->diskId, pSetOld->fid, pSttFile, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pSttFile);
}
}
@@ -619,7 +619,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
nRef = atomic_sub_fetch_32(&pDelFile->nRef, 1);
if (nRef == 0) {
tsdbDelFileName(pTsdb, pDelFile, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pDelFile);
}
}
@@ -629,7 +629,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
nRef = atomic_sub_fetch_32(&pTsdb->fs.pDelFile->nRef, 1);
if (nRef == 0) {
tsdbDelFileName(pTsdb, pTsdb->fs.pDelFile, fname);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
taosMemoryFree(pTsdb->fs.pDelFile);
}
pTsdb->fs.pDelFile = NULL;
@@ -741,7 +741,7 @@ static int32_t tsdbFSRollback(STsdb *pTsdb) {
char current_t[TSDB_FILENAME_LEN] = {0};
tsdbGetCurrentFName(pTsdb, NULL, current_t);
- (void)taosRemoveFile(current_t);
+ tsdbRemoveFile(current_t);
_exit:
if (code) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c
index 24916bf47c..ea9cb5f768 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFS2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c
@@ -20,8 +20,6 @@
#define BLOCK_COMMIT_FACTOR 3
-extern void remove_file(const char *fname);
-
typedef struct STFileHashEntry {
struct STFileHashEntry *next;
char fname[TSDB_FILENAME_LEN];
@@ -55,25 +53,22 @@ static int32_t create_fs(STsdb *pTsdb, STFileSystem **fs) {
return 0;
}
-static int32_t destroy_fs(STFileSystem **fs) {
- if (fs[0] == NULL) return 0;
+static void destroy_fs(STFileSystem **fs) {
+ if (fs[0] == NULL) return;
TARRAY2_DESTROY(fs[0]->fSetArr, NULL);
TARRAY2_DESTROY(fs[0]->fSetArrTmp, NULL);
(void)tsem_destroy(&fs[0]->canEdit);
taosMemoryFree(fs[0]);
fs[0] = NULL;
- return 0;
}
-int32_t current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype) {
+void current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype) {
int32_t offset = 0;
- (void)vnodeGetPrimaryDir(pTsdb->path, pTsdb->pVnode->diskPrimary, pTsdb->pVnode->pTfs, fname, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pTsdb->path, pTsdb->pVnode->diskPrimary, pTsdb->pVnode->pTfs, fname, TSDB_FILENAME_LEN);
offset = strlen(fname);
snprintf(fname + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, gCurrentFname[ftype]);
-
- return 0;
}
static int32_t save_json(const cJSON *json, const char *fname) {
@@ -300,11 +295,11 @@ static int32_t commit_edit(STFileSystem *fs) {
char current[TSDB_FILENAME_LEN];
char current_t[TSDB_FILENAME_LEN];
- (void)current_fname(fs->tsdb, current, TSDB_FCURRENT);
+ current_fname(fs->tsdb, current, TSDB_FCURRENT);
if (fs->etype == TSDB_FEDIT_COMMIT) {
- (void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
+ current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
} else {
- (void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
+ current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
}
int32_t code;
@@ -335,9 +330,9 @@ static int32_t abort_edit(STFileSystem *fs) {
char fname[TSDB_FILENAME_LEN];
if (fs->etype == TSDB_FEDIT_COMMIT) {
- (void)current_fname(fs->tsdb, fname, TSDB_FCURRENT_C);
+ current_fname(fs->tsdb, fname, TSDB_FCURRENT_C);
} else {
- (void)current_fname(fs->tsdb, fname, TSDB_FCURRENT_M);
+ current_fname(fs->tsdb, fname, TSDB_FCURRENT_M);
}
int32_t code;
@@ -421,7 +416,7 @@ static int32_t tsdbFSCreateFileObjHash(STFileSystem *fs, STFileHash *hash) {
}
// vnode.json
- (void)current_fname(fs->tsdb, fname, TSDB_FCURRENT);
+ current_fname(fs->tsdb, fname, TSDB_FCURRENT);
code = tsdbFSAddEntryToFileObjHash(hash, fname);
TSDB_CHECK_CODE(code, lino, _exit);
@@ -538,7 +533,7 @@ static int32_t tsdbFSDoSanAndFix(STFileSystem *fs) {
if (tsdbFSGetFileObjHashEntry(&fobjHash, file->aname) == NULL &&
strncmp(file->aname + strlen(file->aname) - 3, ".cp", 3) &&
strncmp(file->aname + strlen(file->aname) - 5, ".data", 5)) {
- remove_file(file->aname);
+ tsdbRemoveFile(file->aname);
}
}
@@ -605,9 +600,9 @@ static int32_t open_fs(STFileSystem *fs, int8_t rollback) {
char cCurrent[TSDB_FILENAME_LEN];
char mCurrent[TSDB_FILENAME_LEN];
- (void)current_fname(pTsdb, fCurrent, TSDB_FCURRENT);
- (void)current_fname(pTsdb, cCurrent, TSDB_FCURRENT_C);
- (void)current_fname(pTsdb, mCurrent, TSDB_FCURRENT_M);
+ current_fname(pTsdb, fCurrent, TSDB_FCURRENT);
+ current_fname(pTsdb, cCurrent, TSDB_FCURRENT_C);
+ current_fname(pTsdb, mCurrent, TSDB_FCURRENT_M);
if (taosCheckExistFile(fCurrent)) { // current.json exists
code = load_fs(pTsdb, fCurrent, fs->fSetArr);
@@ -746,14 +741,14 @@ int32_t tsdbOpenFS(STsdb *pTsdb, STFileSystem **fs, int8_t rollback) {
_exit:
if (code) {
tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code));
- (void)destroy_fs(fs);
+ destroy_fs(fs);
} else {
tsdbInfo("vgId:%d %s success", TD_VID(pTsdb->pVnode), __func__);
}
return code;
}
-static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block);
+static void tsdbFSSetBlockCommit(STFileSet *fset, bool block);
extern int32_t tsdbStopAllCompTask(STsdb *tsdb);
int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
@@ -779,7 +774,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
}
fset->channel = (SVAChannelID){0};
fset->mergeScheduled = false;
- (void)tsdbFSSetBlockCommit(fset, false);
+ tsdbFSSetBlockCommit(fset, false);
fset->channelOpened = false;
}
}
@@ -811,7 +806,7 @@ int32_t tsdbCloseFS(STFileSystem **fs) {
(void)tsdbDisableAndCancelAllBgTask((*fs)->tsdb);
(void)close_file_system(fs[0]);
- (void)destroy_fs(fs);
+ destroy_fs(fs);
return 0;
}
@@ -834,9 +829,9 @@ int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT e
char current_t[TSDB_FILENAME_LEN];
if (etype == TSDB_FEDIT_COMMIT) {
- (void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
+ current_fname(fs->tsdb, current_t, TSDB_FCURRENT_C);
} else {
- (void)current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
+ current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M);
}
(void)tsem_wait(&fs->canEdit);
@@ -860,7 +855,7 @@ _exit:
return code;
}
-static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block) {
+static void tsdbFSSetBlockCommit(STFileSet *fset, bool block) {
if (block) {
fset->blockCommit = true;
} else {
@@ -869,13 +864,12 @@ static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block) {
(void)taosThreadCondSignal(&fset->canCommit);
}
}
- return 0;
}
int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid) {
(void)taosThreadMutexLock(&tsdb->mutex);
STFileSet *fset;
- (void)tsdbFSGetFSet(tsdb->pFS, fid, &fset);
+ tsdbFSGetFSet(tsdb->pFS, fid, &fset);
if (fset) {
while (fset->blockCommit) {
fset->numWaitCommit++;
@@ -902,13 +896,13 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
STFileSet *fset;
TARRAY2_FOREACH_REVERSE(fs->fSetArr, fset) {
if (TARRAY2_SIZE(fset->lvlArr) == 0) {
- (void)tsdbFSSetBlockCommit(fset, false);
+ tsdbFSSetBlockCommit(fset, false);
continue;
}
SSttLvl *lvl = TARRAY2_FIRST(fset->lvlArr);
if (lvl->level != 0) {
- (void)tsdbFSSetBlockCommit(fset, false);
+ tsdbFSSetBlockCommit(fset, false);
continue;
}
@@ -933,9 +927,9 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
}
if (numFile >= sttTrigger * BLOCK_COMMIT_FACTOR) {
- (void)tsdbFSSetBlockCommit(fset, true);
+ tsdbFSSetBlockCommit(fset, true);
} else {
- (void)tsdbFSSetBlockCommit(fset, false);
+ tsdbFSSetBlockCommit(fset, false);
}
}
}
@@ -956,12 +950,11 @@ int32_t tsdbFSEditAbort(STFileSystem *fs) {
return code;
}
-int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset) {
+void tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset) {
STFileSet tfset = {.fid = fid};
STFileSet *pset = &tfset;
STFileSet **fsetPtr = TARRAY2_SEARCH(fs->fSetArr, &pset, tsdbTFileSetCmprFn, TD_EQ);
fset[0] = (fsetPtr == NULL) ? NULL : fsetPtr[0];
- return 0;
}
int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
@@ -1180,12 +1173,12 @@ _out:
return code;
}
-int32_t tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr) { return tsdbTFileSetRangeArrayDestroy(fsrArr); }
+void tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr) { tsdbTFileSetRangeArrayDestroy(fsrArr); }
int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
- (void)tsdbFSGetFSet(tsdb->pFS, fid, fset);
+ tsdbFSGetFSet(tsdb->pFS, fid, fset);
if (sttTrigger == 1 && (*fset)) {
for (;;) {
if ((*fset)->taskRunning) {
@@ -1193,7 +1186,7 @@ int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
(void)taosThreadCondWait(&(*fset)->beginTask, &tsdb->mutex);
- (void)tsdbFSGetFSet(tsdb->pFS, fid, fset);
+ tsdbFSGetFSet(tsdb->pFS, fid, fset);
(*fset)->numWaitTask--;
} else {
@@ -1211,7 +1204,7 @@ int32_t tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid) {
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
if (sttTrigger == 1) {
STFileSet *fset = NULL;
- (void)tsdbFSGetFSet(tsdb->pFS, fid, &fset);
+ tsdbFSGetFSet(tsdb->pFS, fid, &fset);
if (fset != NULL && fset->taskRunning) {
fset->taskRunning = false;
if (fset->numWaitTask > 0) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.h b/source/dnode/vnode/src/tsdb/tsdbFS2.h
index 6938efde3c..6de2b8ace0 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFS2.h
+++ b/source/dnode/vnode/src/tsdb/tsdbFS2.h
@@ -51,7 +51,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TFileSetRangeArray *pEx
int32_t tsdbFSDestroyCopyRangedSnapshot(TFileSetArray **fsetArr);
int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ever, TFileSetRangeArray *pRanges,
TFileSetRangeArray **fsrArr);
-int32_t tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr);
+void tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr);
// txn
int64_t tsdbFSAllocEid(STFileSystem *fs);
void tsdbFSUpdateEid(STFileSystem *fs, int64_t cid);
@@ -59,13 +59,13 @@ int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT e
int32_t tsdbFSEditCommit(STFileSystem *fs);
int32_t tsdbFSEditAbort(STFileSystem *fs);
// other
-int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset);
+void tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset);
int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid);
int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset);
int32_t tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid);
// utils
int32_t save_fs(const TFileSetArray *arr, const char *fname);
-int32_t current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype);
+void current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype);
/* Exposed Structs */
struct STFileSystem {
diff --git a/source/dnode/vnode/src/tsdb/tsdbFSet2.c b/source/dnode/vnode/src/tsdb/tsdbFSet2.c
index de62ce63a0..8864968f63 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFSet2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFSet2.c
@@ -27,13 +27,12 @@ int32_t tsdbSttLvlInit(int32_t level, SSttLvl **lvl) {
static void tsdbSttLvlClearFObj(void *data) { TAOS_UNUSED(tsdbTFileObjUnref(*(STFileObj **)data)); }
-int32_t tsdbSttLvlClear(SSttLvl **lvl) {
+void tsdbSttLvlClear(SSttLvl **lvl) {
if (lvl[0] != NULL) {
TARRAY2_DESTROY(lvl[0]->fobjArr, tsdbSttLvlClearFObj);
taosMemoryFree(lvl[0]);
lvl[0] = NULL;
}
- return 0;
}
static int32_t tsdbSttLvlInitEx(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lvl) {
@@ -45,12 +44,16 @@ static int32_t tsdbSttLvlInitEx(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lvl
STFileObj *fobj;
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj);
if (code) {
- (void)tsdbSttLvlClear(lvl);
+ tsdbSttLvlClear(lvl);
return code;
}
code = TARRAY2_APPEND(lvl[0]->fobjArr, fobj);
- if (code) return code;
+ if (code) {
+ tsdbSttLvlClear(lvl);
+ taosMemoryFree(fobj);
+ return code;
+ }
}
return 0;
}
@@ -79,7 +82,7 @@ static int32_t tsdbSttLvlFilteredInitEx(STsdb *pTsdb, const SSttLvl *lvl1, int64
STFileObj *fobj;
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj);
if (code) {
- (void)tsdbSttLvlClear(lvl);
+ tsdbSttLvlClear(lvl);
return code;
}
@@ -200,7 +203,7 @@ static int32_t tsdbJsonToSttLvl(STsdb *pTsdb, const cJSON *json, SSttLvl **lvl)
item1 = cJSON_GetObjectItem(json, "files");
if (!cJSON_IsArray(item1)) {
- (void)tsdbSttLvlClear(lvl);
+ tsdbSttLvlClear(lvl);
return TSDB_CODE_FILE_CORRUPTED;
}
@@ -208,14 +211,14 @@ static int32_t tsdbJsonToSttLvl(STsdb *pTsdb, const cJSON *json, SSttLvl **lvl)
STFile tf;
code = tsdbJsonToTFile(item2, TSDB_FTYPE_STT, &tf);
if (code) {
- (void)tsdbSttLvlClear(lvl);
+ tsdbSttLvlClear(lvl);
return code;
}
STFileObj *fobj;
code = tsdbTFileObjInit(pTsdb, &tf, &fobj);
if (code) {
- (void)tsdbSttLvlClear(lvl);
+ tsdbSttLvlClear(lvl);
return code;
}
@@ -601,13 +604,12 @@ int32_t tsdbTFileSetRangeClear(STFileSetRange **fsr) {
return 0;
}
-int32_t tsdbTFileSetRangeArrayDestroy(TFileSetRangeArray **ppArr) {
+void tsdbTFileSetRangeArrayDestroy(TFileSetRangeArray **ppArr) {
if (ppArr && ppArr[0]) {
TARRAY2_DESTROY(ppArr[0], tsdbTFileSetRangeClear);
taosMemoryFree(ppArr[0]);
ppArr[0] = NULL;
}
- return 0;
}
void tsdbTFileSetClear(STFileSet **fset) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbFSet2.h b/source/dnode/vnode/src/tsdb/tsdbFSet2.h
index 4b99a46dc7..25c998e945 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFSet2.h
+++ b/source/dnode/vnode/src/tsdb/tsdbFSet2.h
@@ -57,7 +57,6 @@ int32_t tsdbJsonToTFileSet(STsdb *pTsdb, const cJSON *json, STFileSet **fset);
// cmpr
int32_t tsdbTFileSetCmprFn(const STFileSet **fset1, const STFileSet **fset2);
// edit
-int32_t tsdbSttLvlClear(SSttLvl **lvl);
int32_t tsdbTFileSetEdit(STsdb *pTsdb, STFileSet *fset, const STFileOp *op);
int32_t tsdbTFileSetApplyEdit(STsdb *pTsdb, const STFileSet *fset1, STFileSet *fset);
// max commit id
@@ -68,7 +67,7 @@ SSttLvl *tsdbTFileSetGetSttLvl(STFileSet *fset, int32_t level);
bool tsdbTFileSetIsEmpty(const STFileSet *fset);
// stt
int32_t tsdbSttLvlInit(int32_t level, SSttLvl **lvl);
-int32_t tsdbSttLvlClear(SSttLvl **lvl);
+void tsdbSttLvlClear(SSttLvl **lvl);
// open channel
int32_t tsdbTFileSetOpenChannel(STFileSet *fset);
diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c
index 39de97a05d..30e1b67e44 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFile.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFile.c
@@ -221,7 +221,7 @@ void tsdbDelFileName(STsdb *pTsdb, SDelFile *pFile, char fname[]) {
int32_t offset = 0;
SVnode *pVnode = pTsdb->pVnode;
- (void)vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, fname, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pTsdb->path, pVnode->diskPrimary, pVnode->pTfs, fname, TSDB_FILENAME_LEN);
offset = strlen(fname);
snprintf((char *)fname + offset, TSDB_FILENAME_LEN - offset - 1, "%sv%dver%" PRId64 ".del", TD_DIRSEP,
TD_VID(pTsdb->pVnode), pFile->commitID);
diff --git a/source/dnode/vnode/src/tsdb/tsdbFile2.c b/source/dnode/vnode/src/tsdb/tsdbFile2.c
index 50272a689c..d5d222eb56 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFile2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFile2.c
@@ -43,9 +43,13 @@ static const struct {
[TSDB_FTYPE_STT] = {"stt", stt_to_json, stt_from_json},
};
-void remove_file(const char *fname) {
- (void)taosRemoveFile(fname);
- tsdbInfo("file:%s is removed", fname);
+void tsdbRemoveFile(const char *fname) {
+ int32_t code = taosRemoveFile(fname);
+ if (code) {
+ tsdbError("failed to remove file:%s, code:%d, error:%s", fname, code, tstrerror(code));
+ } else {
+ tsdbInfo("file:%s is removed", fname);
+ }
}
static int32_t tfile_to_json(const STFile *file, cJSON *json) {
@@ -234,7 +238,7 @@ int32_t tsdbTFileObjInit(STsdb *pTsdb, const STFile *f, STFileObj **fobj) {
fobj[0]->f[0] = f[0];
fobj[0]->state = TSDB_FSTATE_LIVE;
fobj[0]->ref = 1;
- (void)tsdbTFileName(pTsdb, f, fobj[0]->fname);
+ tsdbTFileName(pTsdb, f, fobj[0]->fname);
// fobj[0]->nlevel = tfsGetLevel(pTsdb->pVnode->pTfs);
fobj[0]->nlevel = vnodeNodeId(pTsdb->pVnode);
return 0;
@@ -269,7 +273,7 @@ int32_t tsdbTFileObjUnref(STFileObj *fobj) {
tsdbTrace("unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef);
if (nRef == 0) {
if (fobj->state == TSDB_FSTATE_DEAD) {
- remove_file(fobj->fname);
+ tsdbRemoveFile(fobj->fname);
}
taosMemoryFree(fobj);
}
@@ -279,7 +283,7 @@ int32_t tsdbTFileObjUnref(STFileObj *fobj) {
static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) {
if (fobj->f->type != TSDB_FTYPE_DATA || fobj->f->lcn < 1) {
- remove_file(fobj->fname);
+ tsdbRemoveFile(fobj->fname);
return;
}
@@ -295,7 +299,7 @@ static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) {
}
snprintf(dot + 1, TSDB_FQDN_LEN - (dot + 1 - lc_path), "%d.data", fobj->f->lcn);
- remove_file(lc_path);
+ tsdbRemoveFile(lc_path);
} else {
// delete by data file prefix
@@ -324,7 +328,7 @@ static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) {
}
snprintf(dot + 1, TSDB_FQDN_LEN - (dot + 1 - lc_path), "%d.data", fobj->f->lcn);
- remove_file(lc_path);
+ tsdbRemoveFile(lc_path);
}
}
@@ -366,7 +370,7 @@ int32_t tsdbTFileObjRemoveUpdateLC(STFileObj *fobj) {
return 0;
}
-int32_t tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]) {
+void tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]) {
SVnode *pVnode = pTsdb->pVnode;
STfs *pTfs = pVnode->pTfs;
@@ -393,7 +397,6 @@ int32_t tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]) {
f->cid, //
g_tfile_info[f->type].suffix);
}
- return 0;
}
int32_t tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbFile2.h b/source/dnode/vnode/src/tsdb/tsdbFile2.h
index 70e167c1eb..8f80d88ba4 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFile2.h
+++ b/source/dnode/vnode/src/tsdb/tsdbFile2.h
@@ -44,7 +44,7 @@ enum {
// STFile
int32_t tsdbTFileToJson(const STFile *f, cJSON *json);
int32_t tsdbJsonToTFile(const cJSON *json, tsdb_ftype_t ftype, STFile *f);
-int32_t tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]);
+void tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]);
int32_t tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]);
bool tsdbIsSameTFile(const STFile *f1, const STFile *f2);
bool tsdbIsTFileChanged(const STFile *f1, const STFile *f2);
diff --git a/source/dnode/vnode/src/tsdb/tsdbIter.c b/source/dnode/vnode/src/tsdb/tsdbIter.c
index 5f9e838ccc..1902a51baf 100644
--- a/source/dnode/vnode/src/tsdb/tsdbIter.c
+++ b/source/dnode/vnode/src/tsdb/tsdbIter.c
@@ -430,7 +430,7 @@ static int32_t tsdbMemTombIterOpen(STsdbIter *iter) {
}
static int32_t tsdbDataIterClose(STsdbIter *iter) {
- (void)tBrinBlockDestroy(iter->dataData->brinBlock);
+ tBrinBlockDestroy(iter->dataData->brinBlock);
tBlockDataDestroy(iter->dataData->blockData);
return 0;
}
@@ -699,12 +699,11 @@ int32_t tsdbIterMergerOpen(const TTsdbIterArray *iterArray, SIterMerger **merger
return tsdbIterMergerNext(merger[0]);
}
-int32_t tsdbIterMergerClose(SIterMerger **merger) {
+void tsdbIterMergerClose(SIterMerger **merger) {
if (merger[0]) {
taosMemoryFree(merger[0]);
merger[0] = NULL;
}
- return 0;
}
int32_t tsdbIterMergerNext(SIterMerger *merger) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbIter.h b/source/dnode/vnode/src/tsdb/tsdbIter.h
index 05449d2042..05cc15f142 100644
--- a/source/dnode/vnode/src/tsdb/tsdbIter.h
+++ b/source/dnode/vnode/src/tsdb/tsdbIter.h
@@ -59,7 +59,7 @@ int32_t tsdbIterNext(STsdbIter *iter);
// SIterMerger ===============
int32_t tsdbIterMergerOpen(const TTsdbIterArray *iterArray, SIterMerger **merger, bool isTomb);
-int32_t tsdbIterMergerClose(SIterMerger **merger);
+void tsdbIterMergerClose(SIterMerger **merger);
int32_t tsdbIterMergerNext(SIterMerger *merger);
int32_t tsdbIterMergerSkipTableData(SIterMerger *merger, const TABLEID *tbid);
diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c
index 79565f887b..11fcb08d89 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c
@@ -731,15 +731,13 @@ int32_t tsdbRefMemTable(SMemTable *pMemTable, SQueryNode *pQNode) {
tsdbError("vgId:%d, memtable ref count is invalid, ref:%d", TD_VID(pMemTable->pTsdb->pVnode), nRef);
}
- (void)vnodeBufPoolRegisterQuery(pMemTable->pPool, pQNode);
+ vnodeBufPoolRegisterQuery(pMemTable->pPool, pQNode);
_exit:
return code;
}
-int32_t tsdbUnrefMemTable(SMemTable *pMemTable, SQueryNode *pNode, bool proactive) {
- int32_t code = 0;
-
+void tsdbUnrefMemTable(SMemTable *pMemTable, SQueryNode *pNode, bool proactive) {
if (pNode) {
vnodeBufPoolDeregisterQuery(pMemTable->pPool, pNode, proactive);
}
@@ -747,8 +745,6 @@ int32_t tsdbUnrefMemTable(SMemTable *pMemTable, SQueryNode *pNode, bool proactiv
if (atomic_sub_fetch_32(&pMemTable->nRef, 1) == 0) {
tsdbMemTableDestroy(pMemTable, proactive);
}
-
- return code;
}
static FORCE_INLINE int32_t tbDataPCmprFn(const void *p1, const void *p2) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbMerge.c b/source/dnode/vnode/src/tsdb/tsdbMerge.c
index 5587f29440..f14dc98658 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMerge.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMerge.c
@@ -339,9 +339,9 @@ static int32_t tsdbMergeFileSetEndCloseWriter(SMerger *merger) {
}
static int32_t tsdbMergeFileSetEndCloseIter(SMerger *merger) {
- (void)tsdbIterMergerClose(&merger->tombIterMerger);
+ tsdbIterMergerClose(&merger->tombIterMerger);
TARRAY2_CLEAR(merger->tombIterArr, tsdbIterClose);
- (void)tsdbIterMergerClose(&merger->dataIterMerger);
+ tsdbIterMergerClose(&merger->dataIterMerger);
TARRAY2_CLEAR(merger->dataIterArr, tsdbIterClose);
return 0;
}
@@ -463,7 +463,7 @@ static int32_t tsdbMergeGetFSet(SMerger *merger) {
STFileSet *fset;
(void)taosThreadMutexLock(&merger->tsdb->mutex);
- (void)tsdbFSGetFSet(merger->tsdb->pFS, merger->fid, &fset);
+ tsdbFSGetFSet(merger->tsdb->pFS, merger->fid, &fset);
if (fset == NULL) {
(void)taosThreadMutexUnlock(&merger->tsdb->mutex);
return 0;
diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
index fc2b873054..1099218b73 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
@@ -379,6 +379,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
int32_t lino = 0;
void *px = NULL;
int32_t startIndex = 0;
+ int32_t ret = 0;
int32_t numOfBlocks = TARRAY2_SIZE(pStatisBlkArray);
if (numOfBlocks <= 0) {
@@ -408,9 +409,7 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
for (int32_t k = startIndex; k < endIndex; ++k) {
code = tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[k], &block);
- if (code) {
- return code;
- }
+ QUERY_CHECK_CODE(code, lino, _end);
int32_t i = 0;
int32_t rows = block.numOfRecords;
@@ -489,7 +488,9 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
} else {
STbStatisRecord record = {0};
while (i < rows) {
- (void)tStatisBlockGet(&block, i, &record);
+ code = tStatisBlockGet(&block, i, &record);
+ TSDB_CHECK_CODE(code, lino, _end);
+
if (record.suid != suid) {
break;
}
@@ -536,12 +537,15 @@ static int32_t loadSttStatisticsBlockData(SSttFileReader *pSttFileReader, SSttBl
}
_end:
- (void)tStatisBlockDestroy(&block);
+ tStatisBlockDestroy(&block);
+ if (code != 0) {
+ tsdbError("%s error happens at:%s line number: %d, code:%s", id, __func__, lino, tstrerror(code));
+ } else {
+ double el = (taosGetTimestampUs() - st) / 1000.0;
+ pBlockLoadInfo->cost.statisElapsedTime += el;
- double el = (taosGetTimestampUs() - st) / 1000.0;
- pBlockLoadInfo->cost.statisElapsedTime += el;
-
- tsdbDebug("%s load %d statis blocks into buf, elapsed time:%.2fms", id, num, el);
+ tsdbDebug("%s load %d statis blocks into buf, elapsed time:%.2fms", id, num, el);
+ }
return code;
}
@@ -677,7 +681,11 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32
}
void tLDataIterClose2(SLDataIter *pIter) {
- (void)tsdbSttFileReaderClose(&pIter->pReader); // always return 0
+ int32_t code = tsdbSttFileReaderClose(&pIter->pReader); // always return 0
+ if (code != 0) {
+ tsdbError("%" PRId64 " failed to close tsdb file reader, code:%s", pIter->cid, tstrerror(code));
+ }
+
pIter->pReader = NULL;
}
@@ -953,6 +961,7 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF
pMTree->pIter = NULL;
pMTree->backward = pConf->backward;
pMTree->idStr = pConf->idstr;
+ int32_t lino = 0;
if (!pMTree->backward) { // asc
tRBTreeCreate(&pMTree->rbt, tLDataIterCmprFn);
@@ -1027,9 +1036,8 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF
// let's record the time window for current table of uid in the stt files
if (pSttDataInfo != NULL && numOfRows > 0) {
void *px = taosArrayPush(pSttDataInfo->pKeyRangeList, &range);
- if (px == NULL) {
- return terrno;
- }
+ QUERY_CHECK_NULL(px, code, lino, _end, terrno);
+
pSttDataInfo->numOfRows += numOfRows;
}
} else {
diff --git a/source/dnode/vnode/src/tsdb/tsdbOpen.c b/source/dnode/vnode/src/tsdb/tsdbOpen.c
index 2e2ea39a7f..df507251ed 100644
--- a/source/dnode/vnode/src/tsdb/tsdbOpen.c
+++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c
@@ -19,7 +19,7 @@
extern int32_t tsdbOpenCompMonitor(STsdb *tsdb);
extern int32_t tsdbCloseCompMonitor(STsdb *tsdb);
-int32_t tsdbSetKeepCfg(STsdb *pTsdb, STsdbCfg *pCfg) {
+void tsdbSetKeepCfg(STsdb *pTsdb, STsdbCfg *pCfg) {
STsdbKeepCfg *pKeepCfg = &pTsdb->keepCfg;
pKeepCfg->precision = pCfg->precision;
pKeepCfg->days = pCfg->days;
@@ -27,7 +27,6 @@ int32_t tsdbSetKeepCfg(STsdb *pTsdb, STsdbCfg *pCfg) {
pKeepCfg->keep1 = pCfg->keep1;
pKeepCfg->keep2 = pCfg->keep2;
pKeepCfg->keepTimeOffset = pCfg->keepTimeOffset;
- return 0;
}
int64_t tsdbGetEarliestTs(STsdb *pTsdb) {
@@ -59,7 +58,7 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
pTsdb->pVnode = pVnode;
(void)taosThreadMutexInit(&pTsdb->mutex, NULL);
if (!pKeepCfg) {
- (void)tsdbSetKeepCfg(pTsdb, &pVnode->config.tsdbCfg);
+ tsdbSetKeepCfg(pTsdb, &pVnode->config.tsdbCfg);
} else {
memcpy(&pTsdb->keepCfg, pKeepCfg, sizeof(STsdbKeepCfg));
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c
index 34280326a0..7813716e9f 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c
@@ -308,7 +308,7 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
while (1) {
if (pReader->pFileReader != NULL) {
- (void) tsdbDataFileReaderClose(&pReader->pFileReader);
+ tsdbDataFileReaderClose(&pReader->pFileReader);
}
pReader->status.pCurrentFileset = pIter->pFilesetList->data[pIter->index];
@@ -403,7 +403,7 @@ static void initReaderStatus(SReaderStatus* pStatus) {
}
static int32_t createResBlock(SQueryTableDataCond* pCond, int32_t capacity, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
SSDataBlock* pBlock = NULL;
int32_t code = createDataBlock(&pBlock);
@@ -449,10 +449,14 @@ static int32_t tsdbUninitReaderLock(STsdbReader* pReader) {
static int32_t tsdbAcquireReader(STsdbReader* pReader) {
int32_t code = -1;
- tsdbTrace("tsdb/read: %p, pre-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+ tsdbTrace("tsdb/read: %s, pre-take read mutex: %p, code: %d", pReader->idStr, &pReader->readerMutex, code);
code = taosThreadMutexLock(&pReader->readerMutex);
- tsdbTrace("tsdb/read: %p, post-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code);
+ if (code != 0) {
+ tsdbError("tsdb/read:%p, failed to lock reader mutex, code:%s", pReader->idStr, tstrerror(code));
+ } else {
+ tsdbTrace("tsdb/read: %s, post-take read mutex: %p, code: %d", pReader->idStr, &pReader->readerMutex, code);
+ }
return code;
}
@@ -1743,8 +1747,6 @@ static int32_t initRowMergeIfNeeded(STsdbReader* pReader, int64_t uid) {
if (ps == NULL) {
return terrno;
}
-
- code = tsdbRowMergerInit(pMerger, ps);
}
return code;
@@ -4576,12 +4578,17 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t
STableBlockScanInfo** p = NULL;
int32_t iter = 0;
- (void)tsdbAcquireReader(pReader);
+ code = tsdbAcquireReader(pReader);
+ if (code) {
+ return code;
+ }
while ((p = tSimpleHashIterate(pReader->status.pTableMap, p, &iter)) != NULL) {
clearBlockScanInfo(*p);
}
+ tSimpleHashClear(pReader->status.pTableMap);
+
if (size < num) {
code = ensureBlockScanInfoBuf(&pReader->blockInfoBuf, num);
if (code) {
@@ -4598,7 +4605,6 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t
pReader->status.uidList.tableUidList = (uint64_t*)p1;
}
- tSimpleHashClear(pReader->status.pTableMap);
STableUidList* pUidList = &pReader->status.uidList;
pUidList->currentIndex = 0;
@@ -4747,13 +4753,15 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi
// no valid error code set in metaGetTbTSchema, so let's set the error code here.
// we should proceed in case of tmq processing.
if (pCond->suid != 0) {
- pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1);
+ code = metaGetTbTSchemaMaybeNull(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1, &pReader->info.pSchema);
+ TSDB_CHECK_CODE(code, lino, _err);
if (pReader->info.pSchema == NULL) {
tsdbWarn("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
}
} else if (numOfTables > 0) {
STableKeyInfo* pKey = pTableList;
- pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1);
+ code = metaGetTbTSchemaMaybeNull(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1, &pReader->info.pSchema);
+ TSDB_CHECK_CODE(code, lino, _err);
if (pReader->info.pSchema == NULL) {
tsdbWarn("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
}
@@ -4807,7 +4815,10 @@ void tsdbReaderClose2(STsdbReader* pReader) {
return;
}
- (void)tsdbAcquireReader(pReader);
+ int32_t code = tsdbAcquireReader(pReader);
+ if (code) {
+ return;
+ }
{
if (pReader->innerReader[0] != NULL || pReader->innerReader[1] != NULL) {
@@ -4850,7 +4861,7 @@ void tsdbReaderClose2(STsdbReader* pReader) {
clearBlockScanInfoBuf(&pReader->blockInfoBuf);
if (pReader->pFileReader != NULL) {
- (void) tsdbDataFileReaderClose(&pReader->pFileReader);
+ tsdbDataFileReaderClose(&pReader->pFileReader);
}
SReadCostSummary* pCost = &pReader->cost;
@@ -4904,7 +4915,7 @@ static int32_t doSuspendCurrentReader(STsdbReader* pCurrentReader) {
SReaderStatus* pStatus = &pCurrentReader->status;
if (pStatus->loadFromFile) {
- (void) tsdbDataFileReaderClose(&pCurrentReader->pFileReader);
+ tsdbDataFileReaderClose(&pCurrentReader->pFileReader);
SReadCostSummary* pCost = &pCurrentReader->cost;
destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost);
@@ -5552,7 +5563,7 @@ int32_t tsdbReaderReset2(STsdbReader* pReader, SQueryTableDataCond* pCond) {
memset(&pReader->suppInfo.tsColAgg, 0, sizeof(SColumnDataAgg));
pReader->suppInfo.tsColAgg.colId = PRIMARYKEY_TIMESTAMP_COL_ID;
- (void) tsdbDataFileReaderClose(&pReader->pFileReader);
+ tsdbDataFileReaderClose(&pReader->pFileReader);
int32_t numOfTables = tSimpleHashGetSize(pStatus->pTableMap);
@@ -5855,6 +5866,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs
int32_t code = 0;
STsdb* pTsdb = pReader->pTsdb;
SVersionRange* pRange = &pReader->info.verRange;
+ int32_t lino = 0;
*ppSnap = NULL;
// lock
@@ -5868,8 +5880,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs
STsdbReadSnap* pSnap = (STsdbReadSnap*)taosMemoryCalloc(1, sizeof(STsdbReadSnap));
if (pSnap == NULL) {
(void) taosThreadMutexUnlock(&pTsdb->mutex);
- code = terrno;
- goto _exit;
+ TSDB_CHECK_NULL(pSnap, code, lino, _exit, terrno);
}
// take snapshot
@@ -5878,14 +5889,14 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs
pSnap->pNode = taosMemoryMalloc(sizeof(*pSnap->pNode));
if (pSnap->pNode == NULL) {
(void) taosThreadMutexUnlock(&pTsdb->mutex);
- code = terrno;
- goto _exit;
+ TSDB_CHECK_NULL(pSnap->pNode, code, lino, _exit, terrno);
}
pSnap->pNode->pQHandle = pReader;
pSnap->pNode->reseek = reseek;
- (void)tsdbRefMemTable(pTsdb->mem, pSnap->pNode);
+ code = tsdbRefMemTable(pTsdb->mem, pSnap->pNode);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
if (pTsdb->imem && (pRange->minVer <= pTsdb->imem->maxVer && pRange->maxVer >= pTsdb->imem->minVer)) {
@@ -5895,7 +5906,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs
code = terrno;
if (pTsdb->mem && pSnap->pNode) {
- (void) tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true); // unref the previous refed mem
+ tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true); // unref the previous refed mem
}
(void) taosThreadMutexUnlock(&pTsdb->mutex);
@@ -5905,23 +5916,23 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs
pSnap->pINode->pQHandle = pReader;
pSnap->pINode->reseek = reseek;
- (void)tsdbRefMemTable(pTsdb->imem, pSnap->pINode);
+ code = tsdbRefMemTable(pTsdb->imem, pSnap->pINode);
+ TSDB_CHECK_CODE(code, lino, _exit);
}
// fs
code = tsdbFSCreateRefSnapshotWithoutLock(pTsdb->pFS, &pSnap->pfSetArray);
if (code) {
if (pSnap->pNode) {
- (void) tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true); // unref the previous refed mem
+ tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true); // unref the previous refed mem
}
if (pSnap->pINode) {
- (void) tsdbUnrefMemTable(pTsdb->imem, pSnap->pINode, true);
+ tsdbUnrefMemTable(pTsdb->imem, pSnap->pINode, true);
}
(void) taosThreadMutexUnlock(&pTsdb->mutex);
- goto _exit;
- }
+ TSDB_CHECK_CODE(code, lino, _exit);}
// unlock
(void) taosThreadMutexUnlock(&pTsdb->mutex);
@@ -5931,7 +5942,8 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs
return code;
_exit:
- tsdbError("vgId:%d take read snapshot failed, code:%s", TD_VID(pTsdb->pVnode), tstrerror(code));
+ tsdbError("%s vgId:%d take read snapshot failed, line:%d code:%s", pReader->idStr, TD_VID(pTsdb->pVnode), lino,
+ tstrerror(code));
if (pSnap) {
if (pSnap->pNode) taosMemoryFree(pSnap->pNode);
if (pSnap->pINode) taosMemoryFree(pSnap->pINode);
@@ -5945,11 +5957,11 @@ void tsdbUntakeReadSnap2(STsdbReader* pReader, STsdbReadSnap* pSnap, bool proact
if (pSnap) {
if (pSnap->pMem) {
- (void) tsdbUnrefMemTable(pSnap->pMem, pSnap->pNode, proactive);
+ tsdbUnrefMemTable(pSnap->pMem, pSnap->pNode, proactive);
}
if (pSnap->pIMem) {
- (void) tsdbUnrefMemTable(pSnap->pIMem, pSnap->pINode, proactive);
+ tsdbUnrefMemTable(pSnap->pIMem, pSnap->pINode, proactive);
}
if (pSnap->pNode) taosMemoryFree(pSnap->pNode);
diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c
index 9d58e2c7bd..db987d07d6 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c
+++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c
@@ -490,7 +490,7 @@ int32_t getNextBrinRecord(SBrinRecordIter* pIter, SBrinRecord** pRecord) {
return TSDB_CODE_INVALID_PARA;
}
- (void)tBrinBlockClear(&pIter->block);
+ tBrinBlockClear(&pIter->block);
int32_t code = tsdbDataFileReadBrinBlock(pIter->pReader, pIter->pCurrentBlk, &pIter->block);
if (code != TSDB_CODE_SUCCESS) {
tsdbError("failed to read brinBlock from file, code:%s", tstrerror(code));
@@ -507,7 +507,7 @@ int32_t getNextBrinRecord(SBrinRecordIter* pIter, SBrinRecord** pRecord) {
return code;
}
-void clearBrinBlockIter(SBrinRecordIter* pIter) { (void)tBrinBlockDestroy(&pIter->block); }
+void clearBrinBlockIter(SBrinRecordIter* pIter) { tBrinBlockDestroy(&pIter->block); }
// initialize the file block access order
// sort the file blocks according to the offset of each data block in the files
@@ -779,8 +779,9 @@ typedef enum {
BLK_CHECK_QUIT = 0x2,
} ETombBlkCheckEnum;
-static void loadNextStatisticsBlock(SSttFileReader* pSttFileReader, STbStatisBlock* pStatisBlock,
- const TStatisBlkArray* pStatisBlkArray, int32_t numOfRows, int32_t* i, int32_t* j);
+static int32_t loadNextStatisticsBlock(SSttFileReader* pSttFileReader, STbStatisBlock* pStatisBlock,
+ const TStatisBlkArray* pStatisBlkArray, int32_t numOfRows, int32_t* i,
+ int32_t* j);
static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_t numOfTables, int32_t* j,
ETombBlkCheckEnum* pRet) {
int32_t code = 0;
@@ -912,7 +913,7 @@ static int32_t doLoadTombDataFromTombBlk(const TTombBlkArray* pTombBlkArray, STs
ETombBlkCheckEnum ret = 0;
code = doCheckTombBlock(&block, pReader, numOfTables, &j, &ret);
- (void)tTombBlockDestroy(&block);
+ tTombBlockDestroy(&block);
if (code != TSDB_CODE_SUCCESS || ret == BLK_CHECK_QUIT) {
return code;
}
@@ -994,11 +995,17 @@ int32_t loadMemTombData(SArray** ppMemDelData, STbData* pMemTbData, STbData* piM
int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pBlockLoadInfo,
TStatisBlkArray* pStatisBlkArray, uint64_t suid, const uint64_t* pUidList,
- int32_t numOfTables) {
+ int32_t numOfTables, int32_t* pNumOfRows) {
int32_t num = 0;
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ if (pNumOfRows != 0) {
+ *pNumOfRows = 0;
+ }
if (TARRAY2_SIZE(pStatisBlkArray) <= 0) {
- return 0;
+ return code;
}
int32_t i = 0;
@@ -1007,18 +1014,19 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
}
if (i >= TARRAY2_SIZE(pStatisBlkArray)) {
- return 0;
+ return code;
}
SStatisBlk* p = &pStatisBlkArray->data[i];
STbStatisBlock* pStatisBlock = taosMemoryCalloc(1, sizeof(STbStatisBlock));
- (void)tStatisBlockInit(pStatisBlock);
+ TSDB_CHECK_NULL(pStatisBlock, code, lino, _err, terrno);
+
+ code = tStatisBlockInit(pStatisBlock);
+ TSDB_CHECK_CODE(code, lino, _err);
int64_t st = taosGetTimestampMs();
- int32_t code = tsdbSttFileReadStatisBlock(pSttFileReader, p, pStatisBlock);
- if (code != TSDB_CODE_SUCCESS) {
- return 0;
- }
+ code = tsdbSttFileReadStatisBlock(pSttFileReader, p, pStatisBlock);
+ TSDB_CHECK_CODE(code, lino, _err);
double el = (taosGetTimestampMs() - st) / 1000.0;
pBlockLoadInfo->cost.loadStatisBlocks += 1;
@@ -1030,9 +1038,10 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
}
if (index >= pStatisBlock->numOfRecords) {
- (void)tStatisBlockDestroy(pStatisBlock);
+ tStatisBlockDestroy(pStatisBlock);
taosMemoryFreeClear(pStatisBlock);
- return num;
+ *pNumOfRows = num;
+ return code;
}
int32_t j = index;
@@ -1040,9 +1049,10 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
while (i < TARRAY2_SIZE(pStatisBlkArray) && uidIndex < numOfTables) {
p = &pStatisBlkArray->data[i];
if (p->minTbid.suid > suid) {
- (void)tStatisBlockDestroy(pStatisBlock);
+ tStatisBlockDestroy(pStatisBlock);
taosMemoryFreeClear(pStatisBlock);
- return num;
+ *pNumOfRows = num;
+ return code;
}
uint64_t uid = pUidList[uidIndex];
@@ -1051,30 +1061,45 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
num += ((int64_t*)pStatisBlock->counts.data)[j];
uidIndex += 1;
j += 1;
- loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->numOfRecords, &i, &j);
+ code = loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->numOfRecords, &i, &j);
+ TSDB_CHECK_CODE(code, lino, _err);
} else if (((int64_t*)pStatisBlock->uids.data)[j] < uid) {
j += 1;
- loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->numOfRecords, &i, &j);
+ code = loadNextStatisticsBlock(pSttFileReader, pStatisBlock, pStatisBlkArray, pStatisBlock->numOfRecords, &i, &j);
+ TSDB_CHECK_CODE(code, lino, _err);
} else {
uidIndex += 1;
}
}
- (void)tStatisBlockDestroy(pStatisBlock);
+ tStatisBlockDestroy(pStatisBlock);
taosMemoryFreeClear(pStatisBlock);
- return num;
+ *pNumOfRows = num;
+ return code;
+
+_err:
+ tsdbError("%p failed to get number of rows in stt block, %s at line:%d code:%s", pSttFileReader, __func__, lino,
+ tstrerror(code));
+ return code;
}
// load next stt statistics block
-static void loadNextStatisticsBlock(SSttFileReader* pSttFileReader, STbStatisBlock* pStatisBlock,
- const TStatisBlkArray* pStatisBlkArray, int32_t numOfRows, int32_t* i, int32_t* j) {
+static int32_t loadNextStatisticsBlock(SSttFileReader* pSttFileReader, STbStatisBlock* pStatisBlock,
+ const TStatisBlkArray* pStatisBlkArray, int32_t numOfRows, int32_t* i,
+ int32_t* j) {
if ((*j) >= numOfRows) {
(*i) += 1;
(*j) = 0;
if ((*i) < TARRAY2_SIZE(pStatisBlkArray)) {
- (void)tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[(*i)], pStatisBlock);
+ int32_t code = tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[(*i)], pStatisBlock);
+ if (code != 0) {
+ tsdbError("%p failed to read statisBlock, code:%s", pSttFileReader, tstrerror(code));
+ return code;
+ }
}
}
+
+ return 0;
}
int32_t doAdjustValidDataIters(SArray* pLDIterList, int32_t numOfFileObj) {
@@ -1191,8 +1216,13 @@ int32_t tsdbGetRowsInSttFiles(STFileSet* pFileSet, SArray* pSttFileBlockIterArra
STsdbReader* pReader = pConf->pReader;
int32_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap);
uint64_t* pUidList = pReader->status.uidList.tableUidList;
- numOfRows += getNumOfRowsInSttBlock(pIter->pReader, pIter->pBlockLoadInfo, pStatisBlkArray, pConf->suid, pUidList,
- numOfTables);
+ int32_t n = 0;
+ code = getNumOfRowsInSttBlock(pIter->pReader, pIter->pBlockLoadInfo, pStatisBlkArray, pConf->suid, pUidList,
+ numOfTables, &n);
+ numOfRows += n;
+ if (code) {
+ tsdbError("%s failed to get rows in stt blocks, code:%s", pstr, tstrerror(code));
+ }
}
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h
index ed895b7d27..cc37f20cf6 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h
+++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h
@@ -343,7 +343,7 @@ int32_t loadDataFileTombDataForAll(STsdbReader* pReader);
int32_t loadSttTombDataForAll(STsdbReader* pReader, SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pLoadInfo);
int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pBlockLoadInfo,
TStatisBlkArray* pStatisBlkArray, uint64_t suid, const uint64_t* pUidList,
- int32_t numOfTables);
+ int32_t numOfTables, int32_t* pNumOfRows);
void recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record);
void destroyLDataIter(SLDataIter* pIter);
diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
index e044743bea..2fd123d8d2 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
@@ -125,9 +125,12 @@ void tsdbCloseFile(STsdbFD **ppFD) {
STsdbFD *pFD = *ppFD;
if (pFD) {
taosMemoryFree(pFD->pBuf);
- // if (!pFD->s3File) {
- (void)taosCloseFile(&pFD->pFD);
- //}
+ int32_t code = taosCloseFile(&pFD->pFD);
+ if (code) {
+ tsdbError("failed to close file: %s, code:%d reason:%s", pFD->path, code, tstrerror(code));
+ } else {
+ tsdbTrace("close file: %s", pFD->path);
+ }
taosMemoryFree(pFD);
*ppFD = NULL;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c
index 96b752104d..070735f079 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRetention.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c
@@ -112,7 +112,7 @@ static int32_t tsdbDoCopyFile(SRTNer *rtner, const STFileObj *from, const STFile
TdFilePtr fdFrom = NULL;
TdFilePtr fdTo = NULL;
- (void)tsdbTFileName(rtner->tsdb, to, fname);
+ tsdbTFileName(rtner->tsdb, to, fname);
fdFrom = taosOpenFile(from->fname, TD_FILE_READ);
if (fdFrom == NULL) {
@@ -425,7 +425,7 @@ static int32_t tsdbCopyFileS3(SRTNer *rtner, const STFileObj *from, const STFile
TdFilePtr fdFrom = NULL;
// TdFilePtr fdTo = NULL;
- (void)tsdbTFileName(rtner->tsdb, to, fname);
+ tsdbTFileName(rtner->tsdb, to, fname);
fdFrom = taosOpenFile(from->fname, TD_FILE_READ);
if (fdFrom == NULL) {
@@ -484,7 +484,7 @@ static int32_t tsdbMigrateDataFileLCS3(SRTNer *rtner, const STFileObj *fobj, int
TAOS_CHECK_GOTO(TARRAY2_APPEND(&rtner->fopArr, op), &lino, _exit);
char fname[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(rtner->tsdb, &op.nf, fname);
+ tsdbTFileName(rtner->tsdb, &op.nf, fname);
char *object_name = taosDirEntryBaseName(fname);
char object_name_prefix[TSDB_FILENAME_LEN];
int32_t node_id = vnodeNodeId(rtner->tsdb->pVnode);
@@ -585,7 +585,7 @@ static int32_t tsdbMigrateDataFileS3(SRTNer *rtner, const STFileObj *fobj, int64
TAOS_CHECK_GOTO(TARRAY2_APPEND(&rtner->fopArr, op), &lino, _exit);
char fname[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(rtner->tsdb, &op.nf, fname);
+ tsdbTFileName(rtner->tsdb, &op.nf, fname);
char *object_name = taosDirEntryBaseName(fname);
char object_name_prefix[TSDB_FILENAME_LEN];
int32_t node_id = vnodeNodeId(rtner->tsdb->pVnode);
diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c b/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c
index 4a73f53c77..5e84c5ae25 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSnapInfo.c
@@ -191,7 +191,7 @@ int32_t tsdbFSetPartListToRangeDiff(STsdbFSetPartList* pList, TFileSetRangeArray
_err:
if (pDiff) {
- (void)tsdbTFileSetRangeArrayDestroy(&pDiff);
+ tsdbTFileSetRangeArrayDestroy(&pDiff);
}
return code;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
index 19efeb0256..9dd3b371c6 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
@@ -59,7 +59,7 @@ struct STsdbSnapReader {
static int32_t tsdbSnapReadFileSetCloseReader(STsdbSnapReader* reader) {
TARRAY2_CLEAR(reader->sttReaderArr, tsdbSttFileReaderClose);
- TAOS_UNUSED(tsdbDataFileReaderClose(&reader->dataReader));
+ tsdbDataFileReaderClose(&reader->dataReader);
return 0;
}
@@ -191,8 +191,8 @@ _exit:
}
static int32_t tsdbSnapReadFileSetCloseIter(STsdbSnapReader* reader) {
- TAOS_UNUSED(tsdbIterMergerClose(&reader->dataIterMerger));
- TAOS_UNUSED(tsdbIterMergerClose(&reader->tombIterMerger));
+ tsdbIterMergerClose(&reader->dataIterMerger);
+ tsdbIterMergerClose(&reader->tombIterMerger);
TARRAY2_CLEAR(reader->dataIterArr, tsdbIterClose);
TARRAY2_CLEAR(reader->tombIterArr, tsdbIterClose);
return 0;
@@ -430,7 +430,7 @@ _exit:
if (code) {
tsdbError("vgId:%d %s failed at %s:%d since %s, sver:%" PRId64 " ever:%" PRId64 " type:%d", TD_VID(tsdb->pVnode),
__func__, __FILE__, lino, tstrerror(code), sver, ever, type);
- TAOS_UNUSED(tsdbTFileSetRangeArrayDestroy(&reader[0]->fsrArr));
+ tsdbTFileSetRangeArrayDestroy(&reader[0]->fsrArr);
taosMemoryFree(reader[0]);
reader[0] = NULL;
} else {
@@ -452,14 +452,14 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** reader) {
TAOS_UNUSED(tTombBlockDestroy(reader[0]->tombBlock));
tBlockDataDestroy(reader[0]->blockData);
- TAOS_UNUSED(tsdbIterMergerClose(&reader[0]->dataIterMerger));
- TAOS_UNUSED(tsdbIterMergerClose(&reader[0]->tombIterMerger));
+ tsdbIterMergerClose(&reader[0]->dataIterMerger);
+ tsdbIterMergerClose(&reader[0]->tombIterMerger);
TARRAY2_DESTROY(reader[0]->dataIterArr, tsdbIterClose);
TARRAY2_DESTROY(reader[0]->tombIterArr, tsdbIterClose);
TARRAY2_DESTROY(reader[0]->sttReaderArr, tsdbSttFileReaderClose);
- TAOS_UNUSED(tsdbDataFileReaderClose(&reader[0]->dataReader));
+ tsdbDataFileReaderClose(&reader[0]->dataReader);
- TAOS_UNUSED(tsdbFSDestroyRefRangedSnapshot(&reader[0]->fsrArr));
+ tsdbFSDestroyRefRangedSnapshot(&reader[0]->fsrArr);
tDestroyTSchema(reader[0]->skmTb->pTSchema);
for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->buffers); ++i) {
@@ -691,7 +691,7 @@ _exit:
static int32_t tsdbSnapWriteFileSetCloseReader(STsdbSnapWriter* writer) {
TARRAY2_CLEAR(writer->ctx->sttReaderArr, tsdbSttFileReaderClose);
- TAOS_UNUSED(tsdbDataFileReaderClose(&writer->ctx->dataReader));
+ tsdbDataFileReaderClose(&writer->ctx->dataReader);
return 0;
}
@@ -767,8 +767,8 @@ _exit:
}
static int32_t tsdbSnapWriteFileSetCloseIter(STsdbSnapWriter* writer) {
- TAOS_UNUSED(tsdbIterMergerClose(&writer->ctx->dataIterMerger));
- TAOS_UNUSED(tsdbIterMergerClose(&writer->ctx->tombIterMerger));
+ tsdbIterMergerClose(&writer->ctx->dataIterMerger);
+ tsdbIterMergerClose(&writer->ctx->tombIterMerger);
TARRAY2_CLEAR(writer->ctx->dataIterArr, tsdbIterClose);
TARRAY2_CLEAR(writer->ctx->tombIterArr, tsdbIterClose);
return 0;
@@ -1119,12 +1119,12 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** writer, int8_t rollback) {
(void)taosThreadMutexUnlock(&writer[0]->tsdb->mutex);
}
- TAOS_UNUSED(tsdbIterMergerClose(&writer[0]->ctx->tombIterMerger));
- TAOS_UNUSED(tsdbIterMergerClose(&writer[0]->ctx->dataIterMerger));
+ tsdbIterMergerClose(&writer[0]->ctx->tombIterMerger);
+ tsdbIterMergerClose(&writer[0]->ctx->dataIterMerger);
TARRAY2_DESTROY(writer[0]->ctx->tombIterArr, tsdbIterClose);
TARRAY2_DESTROY(writer[0]->ctx->dataIterArr, tsdbIterClose);
TARRAY2_DESTROY(writer[0]->ctx->sttReaderArr, tsdbSttFileReaderClose);
- TAOS_UNUSED(tsdbDataFileReaderClose(&writer[0]->ctx->dataReader));
+ tsdbDataFileReaderClose(&writer[0]->ctx->dataReader);
TARRAY2_DESTROY(writer[0]->fopArr, NULL);
TAOS_UNUSED(tsdbFSDestroyCopyRangedSnapshot(&writer[0]->fsetArr));
diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c
index 5c5df65ab1..2349d3adaf 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c
@@ -55,7 +55,7 @@ int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *con
TAOS_CHECK_GOTO(tsdbOpenFile(fname, config->tsdb, TD_FILE_READ, &reader[0]->fd, 0), &lino, _exit);
} else {
char fname1[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(config->tsdb, config->file, fname1);
+ tsdbTFileName(config->tsdb, config->file, fname1);
TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd, 0), &lino, _exit);
}
@@ -524,7 +524,7 @@ static int32_t tsdbFileDoWriteSttBlockData(STsdbFD *fd, SBlockData *blockData, S
if (sttBlk->maxVer < blockData->aVersion[iRow]) sttBlk->maxVer = blockData->aVersion[iRow];
}
- (void)tsdbWriterUpdVerRange(range, sttBlk->minVer, sttBlk->maxVer);
+ tsdbWriterUpdVerRange(range, sttBlk->minVer, sttBlk->maxVer);
TAOS_CHECK_RETURN(tBlockDataCompress(blockData, info, buffers, buffers + 4));
sttBlk->bInfo.offset = *fileSize;
@@ -807,7 +807,7 @@ static int32_t tsdbSttFWriterDoOpen(SSttFileWriter *writer) {
int32_t flag = TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC;
char fname[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(writer->config->tsdb, writer->file, fname);
+ tsdbTFileName(writer->config->tsdb, writer->file, fname);
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd, 0), &lino, _exit);
uint8_t hdr[TSDB_FHDR_SIZE] = {0};
@@ -837,7 +837,7 @@ static void tsdbSttFWriterDoClose(SSttFileWriter *writer) {
tDestroyTSchema(writer->skmRow->pTSchema);
tDestroyTSchema(writer->skmTb->pTSchema);
tTombBlockDestroy(writer->tombBlock);
- (void)tStatisBlockDestroy(writer->staticBlock);
+ tStatisBlockDestroy(writer->staticBlock);
tBlockDataDestroy(writer->blockData);
TARRAY2_DESTROY(writer->tombBlkArray, NULL);
TARRAY2_DESTROY(writer->statisBlkArray, NULL);
@@ -874,7 +874,7 @@ static int32_t tsdbSttFWriterCloseCommit(SSttFileWriter *writer, TFileOpArray *o
.fid = writer->config->fid,
.nf = writer->file[0],
};
- (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
+ tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArray, op), &lino, _exit);
@@ -888,9 +888,9 @@ _exit:
static int32_t tsdbSttFWriterCloseAbort(SSttFileWriter *writer) {
char fname[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(writer->config->tsdb, writer->file, fname);
+ tsdbTFileName(writer->config->tsdb, writer->file, fname);
tsdbCloseFile(&writer->fd);
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
return 0;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c
index 9336231420..e492ea0f63 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c
@@ -23,8 +23,6 @@
#include "tsdbDataFileRW.h"
#include "tsdbFS2.h"
#include "tsdbSttFileRW.h"
-// extern int32_t save_fs(const TFileSetArray *arr, const char *fname);
-// extern int32_t current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype);
static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *reader, STFileSet *fset) {
int32_t code = 0;
@@ -79,7 +77,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
// open fd
char fname[TSDB_FILENAME_LEN];
- (void)tsdbTFileName(tsdb, &file, fname);
+ tsdbTFileName(tsdb, &file, fname);
TAOS_CHECK_GOTO(tsdbOpenFile(fname, tsdb, TD_FILE_READ | TD_FILE_WRITE, &ctx->fd, 0), &lino, _exit);
@@ -167,7 +165,7 @@ _exit:
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(tsdb->pVnode), __func__, __FILE__, lino, tstrerror(code));
}
TARRAY2_DESTROY(ctx->brinBlkArray, NULL);
- (void)tBrinBlockDestroy(ctx->brinBlock);
+ tBrinBlockDestroy(ctx->brinBlock);
tBlockDataDestroy(ctx->blockData);
tMapDataClear(ctx->mDataBlk);
taosArrayDestroy(ctx->aBlockIdx);
@@ -321,7 +319,7 @@ static int32_t tsdbUpgradeStt(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *r
if (TARRAY2_SIZE(lvl->fobjArr) > 0) {
TAOS_CHECK_GOTO(TARRAY2_APPEND(fset->lvlArr, lvl), &lino, _exit);
} else {
- (void)tsdbSttLvlClear(&lvl);
+ tsdbSttLvlClear(&lvl);
}
_exit:
@@ -612,7 +610,7 @@ static int32_t tsdbUpgradeFileSystem(STsdb *tsdb, int8_t rollback) {
// save new file system
char fname[TSDB_FILENAME_LEN];
- (void)current_fname(tsdb, fname, TSDB_FCURRENT);
+ current_fname(tsdb, fname, TSDB_FCURRENT);
TAOS_CHECK_GOTO(save_fs(fileSetArray, fname), &lino, _exit);
_exit:
@@ -632,6 +630,6 @@ int32_t tsdbCheckAndUpgradeFileSystem(STsdb *tsdb, int8_t rollback) {
TAOS_CHECK_RETURN(tsdbUpgradeFileSystem(tsdb, rollback));
- (void)taosRemoveFile(fname);
+ tsdbRemoveFile(fname);
return 0;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil2.c b/source/dnode/vnode/src/tsdb/tsdbUtil2.c
index d87a05bcf4..4bccf7df13 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil2.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil2.c
@@ -84,12 +84,12 @@ int32_t tStatisBlockInit(STbStatisBlock *statisBlock) {
_exit:
if (code) {
- TAOS_UNUSED(tStatisBlockDestroy(statisBlock));
+ tStatisBlockDestroy(statisBlock);
}
return code;
}
-int32_t tStatisBlockDestroy(STbStatisBlock *statisBlock) {
+void tStatisBlockDestroy(STbStatisBlock *statisBlock) {
statisBlock->numOfPKs = 0;
statisBlock->numOfRecords = 0;
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
@@ -99,7 +99,6 @@ int32_t tStatisBlockDestroy(STbStatisBlock *statisBlock) {
TAOS_UNUSED(tValueColumnDestroy(&statisBlock->firstKeyPKs[i]));
TAOS_UNUSED(tValueColumnDestroy(&statisBlock->lastKeyPKs[i]));
}
- return 0;
}
int32_t tStatisBlockClear(STbStatisBlock *statisBlock) {
@@ -244,12 +243,12 @@ int32_t tBrinBlockInit(SBrinBlock *brinBlock) {
_exit:
if (code) {
- (void)tBrinBlockDestroy(brinBlock);
+ tBrinBlockDestroy(brinBlock);
}
return code;
}
-int32_t tBrinBlockDestroy(SBrinBlock *brinBlock) {
+void tBrinBlockDestroy(SBrinBlock *brinBlock) {
brinBlock->numOfPKs = 0;
brinBlock->numOfRecords = 0;
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
@@ -259,10 +258,9 @@ int32_t tBrinBlockDestroy(SBrinBlock *brinBlock) {
TAOS_UNUSED(tValueColumnDestroy(&brinBlock->firstKeyPKs[i]));
TAOS_UNUSED(tValueColumnDestroy(&brinBlock->lastKeyPKs[i]));
}
- return 0;
}
-int32_t tBrinBlockClear(SBrinBlock *brinBlock) {
+void tBrinBlockClear(SBrinBlock *brinBlock) {
brinBlock->numOfPKs = 0;
brinBlock->numOfRecords = 0;
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
@@ -272,7 +270,6 @@ int32_t tBrinBlockClear(SBrinBlock *brinBlock) {
TAOS_UNUSED(tValueColumnClear(&brinBlock->firstKeyPKs[i]));
TAOS_UNUSED(tValueColumnClear(&brinBlock->lastKeyPKs[i]));
}
- return 0;
}
int32_t tBrinBlockPut(SBrinBlock *brinBlock, const SBrinRecord *record) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil2.h b/source/dnode/vnode/src/tsdb/tsdbUtil2.h
index d9d2892165..ccc9009fd3 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil2.h
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil2.h
@@ -112,7 +112,7 @@ typedef struct {
#define STATIS_BLOCK_SIZE(db) ((db)->numOfRecords)
int32_t tStatisBlockInit(STbStatisBlock *statisBlock);
-int32_t tStatisBlockDestroy(STbStatisBlock *statisBlock);
+void tStatisBlockDestroy(STbStatisBlock *statisBlock);
int32_t tStatisBlockClear(STbStatisBlock *statisBlock);
int32_t tStatisBlockPut(STbStatisBlock *statisBlock, SRowInfo *row, int32_t maxRecords);
int32_t tStatisBlockGet(STbStatisBlock *statisBlock, int32_t idx, STbStatisRecord *record);
@@ -179,8 +179,8 @@ typedef TARRAY2(SBrinBlk) TBrinBlkArray;
#define BRIN_BLOCK_SIZE(db) ((db)->numOfRecords)
int32_t tBrinBlockInit(SBrinBlock *brinBlock);
-int32_t tBrinBlockDestroy(SBrinBlock *brinBlock);
-int32_t tBrinBlockClear(SBrinBlock *brinBlock);
+void tBrinBlockDestroy(SBrinBlock *brinBlock);
+void tBrinBlockClear(SBrinBlock *brinBlock);
int32_t tBrinBlockPut(SBrinBlock *brinBlock, const SBrinRecord *record);
int32_t tBrinBlockGet(SBrinBlock *brinBlock, int32_t idx, SBrinRecord *record);
diff --git a/source/dnode/vnode/src/vnd/vnodeBufPool.c b/source/dnode/vnode/src/vnd/vnodeBufPool.c
index 2071125175..35b3a87e00 100644
--- a/source/dnode/vnode/src/vnd/vnodeBufPool.c
+++ b/source/dnode/vnode/src/vnd/vnodeBufPool.c
@@ -286,7 +286,7 @@ _exit:
return;
}
-int32_t vnodeBufPoolRegisterQuery(SVBufPool *pPool, SQueryNode *pQNode) {
+void vnodeBufPoolRegisterQuery(SVBufPool *pPool, SQueryNode *pQNode) {
(void)taosThreadMutexLock(&pPool->mutex);
pQNode->pNext = pPool->qList.pNext;
@@ -296,7 +296,6 @@ int32_t vnodeBufPoolRegisterQuery(SVBufPool *pPool, SQueryNode *pQNode) {
pPool->nQuery++;
(void)taosThreadMutexUnlock(&pPool->mutex);
- return 0;
}
void vnodeBufPoolDeregisterQuery(SVBufPool *pPool, SQueryNode *pQNode, bool proactive) {
diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c
index ddd1ac9d4a..d433498590 100644
--- a/source/dnode/vnode/src/vnd/vnodeCommit.c
+++ b/source/dnode/vnode/src/vnd/vnodeCommit.c
@@ -287,7 +287,7 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
pInfo->txn = metaGetTxn(pVnode->pMeta);
// save info
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
vDebug("vgId:%d, save config while prepare commit", TD_VID(pVnode));
code = vnodeSaveInfo(dir, &pInfo->info);
@@ -417,7 +417,7 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
return code;
}
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
(void)syncBeginSnapshot(pVnode->sync, pInfo->info.state.committed);
@@ -471,7 +471,7 @@ bool vnodeShouldRollback(SVnode *pVnode) {
char tFName[TSDB_FILENAME_LEN] = {0};
int32_t offset = 0;
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
offset = strlen(tFName);
snprintf(tFName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VND_INFO_FNAME_TMP);
@@ -482,7 +482,7 @@ void vnodeRollback(SVnode *pVnode) {
char tFName[TSDB_FILENAME_LEN] = {0};
int32_t offset = 0;
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, tFName, TSDB_FILENAME_LEN);
offset = strlen(tFName);
snprintf(tFName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VND_INFO_FNAME_TMP);
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index 2964306092..bdc866500c 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -18,7 +18,7 @@
#include "tsdb.h"
#include "vnd.h"
-int32_t vnodeGetPrimaryDir(const char *relPath, int32_t diskPrimary, STfs *pTfs, char *buf, size_t bufLen) {
+void vnodeGetPrimaryDir(const char *relPath, int32_t diskPrimary, STfs *pTfs, char *buf, size_t bufLen) {
if (pTfs) {
SDiskID diskId = {0};
diskId.id = diskPrimary;
@@ -27,7 +27,6 @@ int32_t vnodeGetPrimaryDir(const char *relPath, int32_t diskPrimary, STfs *pTfs,
snprintf(buf, bufLen - 1, "%s", relPath);
}
buf[bufLen - 1] = '\0';
- return 0;
}
static int32_t vnodeMkDir(STfs *pTfs, const char *path) {
@@ -54,7 +53,7 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, int32_t diskPrimary, STfs
vError("vgId:%d, failed to prepare vnode dir since %s, path: %s", pCfg->vgId, strerror(errno), path);
return TAOS_SYSTEM_ERROR(errno);
}
- (void)vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
if (pCfg) {
info.config = *pCfg;
@@ -89,7 +88,7 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, int32_t
char dir[TSDB_FILENAME_LEN] = {0};
int32_t ret = 0;
- (void)vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
ret = vnodeLoadInfo(dir, &info);
if (ret < 0) {
@@ -222,7 +221,7 @@ int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnod
char dir[TSDB_FILENAME_LEN] = {0};
int32_t ret = 0;
- (void)vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
ret = vnodeLoadInfo(dir, &info);
if (ret < 0) {
@@ -284,7 +283,7 @@ int32_t vnodeRestoreVgroupId(const char *srcPath, const char *dstPath, int32_t s
char dir[TSDB_FILENAME_LEN] = {0};
int32_t code = 0;
- (void)vnodeGetPrimaryDir(dstPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(dstPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
if (vnodeLoadInfo(dir, &info) == 0) {
if (info.config.vgId != dstVgId) {
vError("vgId:%d, unexpected vnode config.vgId:%d", dstVgId, info.config.vgId);
@@ -293,7 +292,7 @@ int32_t vnodeRestoreVgroupId(const char *srcPath, const char *dstPath, int32_t s
return dstVgId;
}
- (void)vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(srcPath, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
if ((code = vnodeLoadInfo(dir, &info)) < 0) {
vError("vgId:%d, failed to read vnode config from %s since %s", srcVgId, srcPath, tstrerror(terrno));
return code;
@@ -352,7 +351,7 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
vError("failed to open vnode from %s since %s. diskPrimary:%d", path, terrstr(), diskPrimary);
return NULL;
}
- (void)vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(path, diskPrimary, pTfs, dir, TSDB_FILENAME_LEN);
info.config = vnodeCfgDefault;
diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c
index 23bc6b607c..dedb473df6 100644
--- a/source/dnode/vnode/src/vnd/vnodeQuery.c
+++ b/source/dnode/vnode/src/vnd/vnodeQuery.c
@@ -396,15 +396,21 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
switch (req->msgType) {
case TDMT_VND_TABLE_META:
// error code has been set into reqMsg, no need to handle it here.
- (void)vnodeGetTableMeta(pVnode, &reqMsg, false);
+ if (TSDB_CODE_SUCCESS != vnodeGetTableMeta(pVnode, &reqMsg, false)) {
+ qWarn("vnodeGetBatchMeta failed, msgType:%d", req->msgType);
+ }
break;
case TDMT_VND_TABLE_CFG:
// error code has been set into reqMsg, no need to handle it here.
- (void)vnodeGetTableCfg(pVnode, &reqMsg, false);
+ if (TSDB_CODE_SUCCESS != vnodeGetTableCfg(pVnode, &reqMsg, false)) {
+ qWarn("vnodeGetBatchMeta failed, msgType:%d", req->msgType);
+ }
break;
case TDMT_VND_GET_STREAM_PROGRESS:
// error code has been set into reqMsg, no need to handle it here.
- (void)vnodeGetStreamProgress(pVnode, &reqMsg, false);
+ if (TSDB_CODE_SUCCESS != vnodeGetStreamProgress(pVnode, &reqMsg, false)) {
+ qWarn("vnodeGetBatchMeta failed, msgType:%d", req->msgType);
+ }
break;
default:
qError("invalid req msgType %d", req->msgType);
diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
index 86c25009bc..fb0d0d5277 100644
--- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c
+++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
@@ -210,7 +210,7 @@ static void vnodeSnapReaderDestroyTsdbRanges(SVSnapReader *pReader) {
for (int32_t j = 0; j < TSDB_RETENTION_MAX; ++j) {
TFileSetRangeArray **ppRanges = vnodeSnapReaderGetTsdbRanges(pReader, tsdbTyps[j]);
if (ppRanges == NULL) continue;
- (void)tsdbTFileSetRangeArrayDestroy(ppRanges);
+ tsdbTFileSetRangeArrayDestroy(ppRanges);
}
}
@@ -261,7 +261,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
char fName[TSDB_FILENAME_LEN];
int32_t offset = 0;
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, fName, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, fName, TSDB_FILENAME_LEN);
offset = strlen(fName);
snprintf(fName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VND_INFO_FNAME);
@@ -648,7 +648,7 @@ static void vnodeSnapWriterDestroyTsdbRanges(SVSnapWriter *pWriter) {
for (int32_t j = 0; j < TSDB_RETENTION_MAX; ++j) {
TFileSetRangeArray **ppRanges = vnodeSnapWriterGetTsdbRanges(pWriter, tsdbTyps[j]);
if (ppRanges == NULL) continue;
- (void)tsdbTFileSetRangeArrayDestroy(ppRanges);
+ tsdbTFileSetRangeArrayDestroy(ppRanges);
}
}
@@ -682,7 +682,7 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot *
.applyTerm = pWriter->info.state.commitTerm};
pVnode->statis = pWriter->info.statis;
char dir[TSDB_FILENAME_LEN] = {0};
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
code = vnodeCommitInfo(dir);
if (code) goto _exit;
@@ -773,7 +773,7 @@ static int32_t vnodeSnapWriteInfo(SVSnapWriter *pWriter, uint8_t *pData, uint32_
// modify info as needed
char dir[TSDB_FILENAME_LEN] = {0};
- (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
+ vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
SVnodeStats vndStats = pWriter->info.config.vndStats;
pWriter->info.config = pVnode->config;
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 8052be46f9..1d8b48bf01 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -754,8 +754,7 @@ int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
vTrace("message in vnode query queue is processing");
- if ((pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_VND_TMQ_CONSUME) &&
- !syncIsReadyForRead(pVnode->sync)) {
+ if ((pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_VND_TMQ_CONSUME) && !syncIsReadyForRead(pVnode->sync)) {
vnodeRedirectRpcMsg(pVnode, pMsg, terrno);
return 0;
}
@@ -1477,15 +1476,16 @@ static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock,
tInitSubmitBlkIter(msgIter, pBlock, &blkIter);
if (blkIter.row == NULL) return 0;
- pSchema = metaGetTbTSchema(pMeta, msgIter->suid, TD_ROW_SVER(blkIter.row), 1); // TODO: use the real schema
- if (pSchema) {
- suid = msgIter->suid;
- rv = TD_ROW_SVER(blkIter.row);
- }
- if (!pSchema) {
+ int32_t code = metaGetTbTSchemaNotNull(pMeta, msgIter->suid, TD_ROW_SVER(blkIter.row), 1,
+ &pSchema); // TODO: use the real schema
+ if (TSDB_CODE_SUCCESS != code) {
printf("%s:%d no valid schema\n", tags, __LINE__);
- return -1;
+ return code;
}
+
+ suid = msgIter->suid;
+ rv = TD_ROW_SVER(blkIter.row);
+
char __tags[128] = {0};
snprintf(__tags, 128, "%s: uid %" PRIi64 " ", tags, msgIter->uid);
while ((row = tGetSubmitBlkNext(&blkIter))) {
@@ -1510,10 +1510,10 @@ typedef struct SSubmitReqConvertCxt {
static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
taosMemoryFreeClear(pCxt->pTbSchema);
- pCxt->pTbSchema = metaGetTbTSchema(pMeta, pCxt->msgIter.suid > 0 ? pCxt->msgIter.suid : pCxt->msgIter.uid,
- pCxt->msgIter.sversion, 1);
- if (NULL == pCxt->pTbSchema) {
- return TSDB_CODE_INVALID_MSG;
+ int32_t code = metaGetTbTSchemaNotNull(pMeta, pCxt->msgIter.suid > 0 ? pCxt->msgIter.suid : pCxt->msgIter.uid,
+ pCxt->msgIter.sversion, 1, &pCxt->pTbSchema);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
}
tdSTSRowIterInit(&pCxt->rowIter, pCxt->pTbSchema);
@@ -2166,7 +2166,7 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t ver, void *pRe
}
if (tsdbChanged) {
- (void)tsdbSetKeepCfg(pVnode->pTsdb, &pVnode->config.tsdbCfg);
+ tsdbSetKeepCfg(pVnode->pTsdb, &pVnode->config.tsdbCfg);
}
return 0;
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index d8a29c8e73..f725fb3809 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -587,7 +587,10 @@ static void vnodeRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx)
streamMetaWUnLock(pMeta);
tqInfo("vgId:%d stream task already loaded, start them", vgId);
- (void)streamTaskSchedTask(&pVnode->msgCb, TD_VID(pVnode), 0, 0, STREAM_EXEC_T_START_ALL_TASKS);
+ int32_t code = streamTaskSchedTask(&pVnode->msgCb, TD_VID(pVnode), 0, 0, STREAM_EXEC_T_START_ALL_TASKS);
+ if (code != 0) {
+ tqError("vgId:%d failed to sched stream task, code:%s", vgId, tstrerror(code));
+ }
return;
}
}
diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c
index 138782495f..80766855cf 100644
--- a/source/libs/command/src/command.c
+++ b/source/libs/command/src/command.c
@@ -78,7 +78,7 @@ static int32_t getSchemaBytes(const SSchema* pSchema) {
}
static int32_t buildDescResultDataBlock(SSDataBlock** pOutput) {
- QRY_OPTR_CHECK(pOutput);
+ QRY_PARAM_CHECK(pOutput);
SSDataBlock* pBlock = NULL;
int32_t code = createDataBlock(&pBlock);
@@ -236,7 +236,7 @@ static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp**
static int32_t execResetQueryCache() { return catalogClearCache(); }
static int32_t buildCreateDBResultDataBlock(SSDataBlock** pOutput) {
- QRY_OPTR_CHECK(pOutput);
+ QRY_PARAM_CHECK(pOutput);
SSDataBlock* pBlock = NULL;
int32_t code = createDataBlock(&pBlock);
@@ -475,7 +475,7 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT
}
static int32_t buildCreateTbResultDataBlock(SSDataBlock** pOutput) {
- QRY_OPTR_CHECK(pOutput);
+ QRY_PARAM_CHECK(pOutput);
SSDataBlock* pBlock = NULL;
int32_t code = createDataBlock(&pBlock);
@@ -499,7 +499,7 @@ static int32_t buildCreateTbResultDataBlock(SSDataBlock** pOutput) {
}
static int32_t buildCreateViewResultDataBlock(SSDataBlock** pOutput) {
- QRY_OPTR_CHECK(pOutput);
+ QRY_PARAM_CHECK(pOutput);
SSDataBlock* pBlock = NULL;
int32_t code = createDataBlock(&pBlock);
@@ -929,7 +929,7 @@ static int32_t execShowLocalVariables(SRetrieveTableRsp** pRsp) {
}
static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** pOutput) {
- QRY_OPTR_CHECK(pOutput);
+ QRY_PARAM_CHECK(pOutput);
SSDataBlock* pBlock = NULL;
int32_t code = createDataBlock(&pBlock);
diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c
index 61f1339c82..4605d19464 100644
--- a/source/libs/executor/src/aggregateoperator.c
+++ b/source/libs/executor/src/aggregateoperator.c
@@ -51,7 +51,7 @@ typedef struct SAggOperatorInfo {
} SAggOperatorInfo;
static void destroyAggOperatorInfo(void* param);
-static void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
+static int32_t setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBlock** ppBlock);
static void destroyDataBlockForEmptyInput(bool blockAllocated, SSDataBlock** ppBlock);
@@ -63,14 +63,14 @@ static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, in
static int32_t addNewResultRowBuf(SResultRow* pWindowRes, SDiskbasedBuf* pResultBuf, uint32_t size);
-static void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
+static int32_t doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
static void functionCtxSave(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus);
static void functionCtxRestore(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus);
int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNode, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t lino = 0;
int32_t code = 0;
@@ -184,7 +184,8 @@ static bool nextGroupedResult(SOperatorInfo* pOperator) {
if (pBlock) {
pAggInfo->pNewGroupBlock = NULL;
tSimpleHashClear(pAggInfo->aggSup.pResultRowHashTable);
- setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
+ code = setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
+ QUERY_CHECK_CODE(code, lino, _end);
code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true);
QUERY_CHECK_CODE(code, lino, _end);
@@ -225,12 +226,19 @@ static bool nextGroupedResult(SOperatorInfo* pOperator) {
break;
}
// the pDataBlock are always the same one, no need to call this again
- setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
+ code = setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
+ if (code != TSDB_CODE_SUCCESS) {
+ destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
+ T_LONG_JMP(pTaskInfo->env, code);
+ }
code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true);
- QUERY_CHECK_CODE(code, lino, _end);
+ if (code != TSDB_CODE_SUCCESS) {
+ destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
+ T_LONG_JMP(pTaskInfo->env, code);
+ }
code = doAggregateImpl(pOperator, pSup->pCtx);
- if (code != 0) {
+ if (code != TSDB_CODE_SUCCESS) {
destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
T_LONG_JMP(pTaskInfo->env, code);
}
@@ -427,20 +435,24 @@ void destroyDataBlockForEmptyInput(bool blockAllocated, SSDataBlock** ppBlock) {
*ppBlock = NULL;
}
-void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
+int32_t setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
+ int32_t code = TSDB_CODE_SUCCESS;
SAggOperatorInfo* pAggInfo = pOperator->info;
if (pAggInfo->groupId != UINT64_MAX && pAggInfo->groupId == groupId) {
- return;
+ return code;
}
- doSetTableGroupOutputBuf(pOperator, numOfOutput, groupId);
+ code = doSetTableGroupOutputBuf(pOperator, numOfOutput, groupId);
// record the current active group id
pAggInfo->groupId = groupId;
+ return code;
}
-void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
+int32_t doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
// for simple group by query without interval, all the tables belong to one group result.
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SAggOperatorInfo* pAggInfo = pOperator->info;
@@ -452,23 +464,27 @@ void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uin
doSetResultOutBufByKey(pAggInfo->aggSup.pResultBuf, pResultRowInfo, (char*)&groupId, sizeof(groupId), true,
groupId, pTaskInfo, false, &pAggInfo->aggSup, true);
if (pResultRow == NULL || pTaskInfo->code != 0) {
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ code = pTaskInfo->code;
+ lino = __LINE__;
+ goto _end;
}
/*
* not assign result buffer yet, add new result buffer
* all group belong to one result set, and each group result has different group id so set the id to be one
*/
if (pResultRow->pageId == -1) {
- int32_t ret = addNewResultRowBuf(pResultRow, pAggInfo->aggSup.pResultBuf, pAggInfo->binfo.pRes->info.rowSize);
- if (ret != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pTaskInfo->env, terrno);
- }
+ code = addNewResultRowBuf(pResultRow, pAggInfo->aggSup.pResultBuf, pAggInfo->binfo.pRes->info.rowSize);
+ QUERY_CHECK_CODE(code, lino, _end);
}
- int32_t ret = setResultRowInitCtx(pResultRow, pCtx, numOfOutput, rowEntryInfoOffset);
- if (ret != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pTaskInfo->env, ret);
+ code = setResultRowInitCtx(pResultRow, pCtx, numOfOutput, rowEntryInfoOffset);
+ QUERY_CHECK_CODE(code, lino, _end);
+
+_end:
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
}
+ return code;
}
// a new buffer page for each table. Needs to opt this design
diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c
index fdf20b4613..b575613efe 100644
--- a/source/libs/executor/src/cachescanoperator.c
+++ b/source/libs/executor/src/cachescanoperator.c
@@ -97,7 +97,7 @@ _end:
int32_t createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandle* readHandle,
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
diff --git a/source/libs/executor/src/countwindowoperator.c b/source/libs/executor/src/countwindowoperator.c
index 713116d605..2233d58ef8 100644
--- a/source/libs/executor/src/countwindowoperator.c
+++ b/source/libs/executor/src/countwindowoperator.c
@@ -295,7 +295,7 @@ _end:
int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c
index fb3ed06224..9bbc5a94eb 100644
--- a/source/libs/executor/src/dataDispatcher.c
+++ b/source/libs/executor/src/dataDispatcher.c
@@ -204,6 +204,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
_return:
+ taosMemoryFreeClear(pBuf->pData);
taosFreeQitem(pBuf);
return code;
}
diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c
index 8058fa9afe..44e8a3cb8a 100644
--- a/source/libs/executor/src/dynqueryctrloperator.c
+++ b/source/libs/executor/src/dynqueryctrloperator.c
@@ -889,7 +889,7 @@ int32_t seqStableJoin(SOperatorInfo* pOperator, SSDataBlock** pRes) {
SDynQueryCtrlOperatorInfo* pInfo = pOperator->info;
SStbJoinDynCtrlInfo* pStbJoin = (SStbJoinDynCtrlInfo*)&pInfo->stbJoin;
- QRY_OPTR_CHECK(pRes);
+ QRY_PARAM_CHECK(pRes);
if (pOperator->status == OP_EXEC_DONE) {
return code;
}
@@ -958,7 +958,7 @@ int32_t initSeqStbJoinTableHash(SStbJoinPrevJoinCtx* pPrev, bool batchFetch) {
int32_t createDynQueryCtrlOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream,
SDynQueryCtrlPhysiNode* pPhyciNode, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
__optr_fn_t nextFp = NULL;
diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c
index a4be2ddf7d..0f3a08c14b 100644
--- a/source/libs/executor/src/eventwindowoperator.c
+++ b/source/libs/executor/src/eventwindowoperator.c
@@ -61,7 +61,7 @@ static void doKeepTuple(SWindowRowsSup* pRowSup, int64_t ts, uint64_t groupId) {
int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c
index f6f3570804..457aa8ff2b 100644
--- a/source/libs/executor/src/exchangeoperator.c
+++ b/source/libs/executor/src/exchangeoperator.c
@@ -401,7 +401,7 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo*
int32_t createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNode, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
@@ -464,7 +464,10 @@ _error:
void destroyExchangeOperatorInfo(void* param) {
SExchangeInfo* pExInfo = (SExchangeInfo*)param;
- (void)taosRemoveRef(exchangeObjRefPool, pExInfo->self);
+ int32_t code = taosRemoveRef(exchangeObjRefPool, pExInfo->self);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ }
}
void freeBlock(void* pParam) {
@@ -505,7 +508,10 @@ void doDestroyExchangeOperatorInfo(void* param) {
blockDataDestroy(pExInfo->pDummyBlock);
tSimpleHashCleanup(pExInfo->pHashSources);
- (void)tsem_destroy(&pExInfo->ready);
+ int32_t code = tsem_destroy(&pExInfo->ready);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ }
taosMemoryFreeClear(pExInfo->pTaskId);
taosMemoryFreeClear(param);
@@ -561,9 +567,13 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) {
if (code != TSDB_CODE_SUCCESS) {
code = TAOS_SYSTEM_ERROR(code);
qError("failed to invoke post when fetch rsp is ready, code:%s, %p", tstrerror(code), pExchangeInfo);
+ return code;
}
- (void)taosReleaseRef(exchangeObjRefPool, pWrapper->exchangeId);
+ code = taosReleaseRef(exchangeObjRefPool, pWrapper->exchangeId);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ }
return code;
}
@@ -1190,7 +1200,14 @@ static int32_t exchangeWait(SOperatorInfo* pOperator, SExchangeInfo* pExchangeIn
return pTask->code;
}
}
- (void)tsem_wait(&pExchangeInfo->ready);
+
+ code = tsem_wait(&pExchangeInfo->ready);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ pTask->code = code;
+ return pTask->code;
+ }
+
if (pTask->pWorkerCb) {
code = pTask->pWorkerCb->afterRecoverFromBlocking(pTask->pWorkerCb->pPool);
if (code != TSDB_CODE_SUCCESS) {
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index db3017468d..05ed5a9d1e 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -1924,7 +1924,7 @@ SExprInfo* createExpr(SNodeList* pNodeList, int32_t* numOfExprs) {
}
int32_t createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, SExprInfo** pExprInfo, int32_t* numOfExprs) {
- QRY_OPTR_CHECK(pExprInfo);
+ QRY_PARAM_CHECK(pExprInfo);
int32_t code = 0;
int32_t numOfFuncs = LIST_LENGTH(pNodeList);
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index 117eb8d80a..9e33a3d890 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -601,7 +601,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
SExecTaskInfo** pTask = (SExecTaskInfo**)pTaskInfo;
(void)taosThreadOnce(&initPoolOnce, initRefPool);
- qDebug("start to create task, TID:0x%" PRIx64 "QID:0x%" PRIx64 ", vgId:%d", taskId, pSubplan->id.queryId, vgId);
+ qDebug("start to create task, TID:0x%" PRIx64 " QID:0x%" PRIx64 ", vgId:%d", taskId, pSubplan->id.queryId, vgId);
int32_t code = createExecTaskInfo(pSubplan, pTask, readHandle, taskId, vgId, sql, model);
if (code != TSDB_CODE_SUCCESS || NULL == *pTask) {
@@ -904,8 +904,14 @@ void qStopTaskOperators(SExecTaskInfo* pTaskInfo) {
}
SExchangeInfo* pExchangeInfo = taosAcquireRef(exchangeObjRefPool, pStop->refId);
if (pExchangeInfo) {
- (void)tsem_post(&pExchangeInfo->ready);
- (void)taosReleaseRef(exchangeObjRefPool, pStop->refId);
+ int32_t code = tsem_post(&pExchangeInfo->ready);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ }
+ code = taosReleaseRef(exchangeObjRefPool, pStop->refId);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ }
}
}
@@ -1627,3 +1633,11 @@ int32_t qStreamOperatorReloadState(qTaskInfo_t tInfo) {
pTaskInfo->pRoot->fpSet.reloadStreamStateFn(pTaskInfo->pRoot);
return 0;
}
+
+void qResetTaskCode(qTaskInfo_t tinfo) {
+ SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
+
+ int32_t code = pTaskInfo->code;
+ pTaskInfo->code = 0;
+ qDebug("0x%" PRIx64 " reset task code to be success, prev:%s", pTaskInfo->id.taskId, tstrerror(code));
+}
diff --git a/source/libs/executor/src/executorInt.c b/source/libs/executor/src/executorInt.c
index a1bf64a10d..00138d6871 100644
--- a/source/libs/executor/src/executorInt.c
+++ b/source/libs/executor/src/executorInt.c
@@ -1280,7 +1280,7 @@ void freeResetOperatorParams(struct SOperatorInfo* pOperator, SOperatorParamType
FORCE_INLINE int32_t getNextBlockFromDownstreamImpl(struct SOperatorInfo* pOperator, int32_t idx, bool clearParam,
SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
int32_t code = 0;
if (pOperator->pDownstreamGetParams && pOperator->pDownstreamGetParams[idx]) {
diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c
index 21b67c8ffb..76b41ca99a 100644
--- a/source/libs/executor/src/filloperator.c
+++ b/source/libs/executor/src/filloperator.c
@@ -423,7 +423,7 @@ static int32_t createPrimaryTsExprIfNeeded(SFillOperatorInfo* pInfo, SFillPhysiN
int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFillNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
diff --git a/source/libs/executor/src/groupcacheoperator.c b/source/libs/executor/src/groupcacheoperator.c
index 6a9482e31c..1796aa7b64 100644
--- a/source/libs/executor/src/groupcacheoperator.c
+++ b/source/libs/executor/src/groupcacheoperator.c
@@ -1444,7 +1444,7 @@ static int32_t groupCacheTableCacheEnd(SOperatorInfo* pOperator, SOperatorParam*
int32_t createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream,
SGroupCachePhysiNode* pPhyciNode, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
SGroupCacheOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupCacheOperatorInfo));
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index 47b35fe9f3..e4ace6b83a 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -353,38 +353,6 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
}
}
-static SSDataBlock* buildGroupResultDataBlock(SOperatorInfo* pOperator) {
- int32_t code = TSDB_CODE_SUCCESS;
- int32_t lino = 0;
- SGroupbyOperatorInfo* pInfo = pOperator->info;
- SSDataBlock* pRes = pInfo->binfo.pRes;
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
-
- while (1) {
- doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
- code = doFilter(pRes, pOperator->exprSupp.pFilterInfo, NULL);
- QUERY_CHECK_CODE(code, lino, _end);
-
- if (!hasRemainResults(&pInfo->groupResInfo)) {
- setOperatorCompleted(pOperator);
- break;
- }
-
- if (pRes->info.rows > 0) {
- break;
- }
- }
-
- pOperator->resultInfo.totalRows += pRes->info.rows;
-
-_end:
- if (code != TSDB_CODE_SUCCESS) {
- qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- T_LONG_JMP(pTaskInfo->env, code);
- }
- return (pRes->info.rows == 0) ? NULL : pRes;
-}
-
bool hasRemainResultByHash(SOperatorInfo* pOperator) {
SGroupbyOperatorInfo* pInfo = pOperator->info;
SSHashObj* pHashmap = pInfo->aggSup.pResultRowHashTable;
@@ -463,25 +431,23 @@ _end:
}
static int32_t hashGroupbyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SGroupbyOperatorInfo* pInfo = pOperator->info;
+ SGroupResInfo* pGroupResInfo = &pInfo->groupResInfo;
+ int32_t order = pInfo->binfo.inputTsOrder;
+ int64_t st = taosGetTimestampUs();
+
+ QRY_PARAM_CHECK(ppRes);
if (pOperator->status == OP_EXEC_DONE) {
- (*ppRes) = NULL;
return TSDB_CODE_SUCCESS;
}
- int32_t code = TSDB_CODE_SUCCESS;
- int32_t lino = 0;
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
-
- SGroupbyOperatorInfo* pInfo = pOperator->info;
if (pOperator->status == OP_RES_TO_RETURN) {
(*ppRes) = buildGroupResultDataBlockByHash(pOperator);
return code;
}
- SGroupResInfo* pGroupResInfo = &pInfo->groupResInfo;
-
- int32_t order = pInfo->binfo.inputTsOrder;
- int64_t st = taosGetTimestampUs();
- SOperatorInfo* downstream = pOperator->pDownstream[0];
while (1) {
SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0);
@@ -511,10 +477,12 @@ static int32_t hashGroupbyAggregateNext(SOperatorInfo* pOperator, SSDataBlock**
if (pGroupResInfo->pRows != NULL) {
taosArrayDestroy(pGroupResInfo->pRows);
}
+
if (pGroupResInfo->pBuf) {
taosMemoryFree(pGroupResInfo->pBuf);
pGroupResInfo->pBuf = NULL;
}
+
pGroupResInfo->index = 0;
pGroupResInfo->iter = 0;
pGroupResInfo->dataPos = NULL;
@@ -525,15 +493,16 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
+ } else {
+ (*ppRes) = buildGroupResultDataBlockByHash(pOperator);
}
- (*ppRes) = buildGroupResultDataBlockByHash(pOperator);
+
return code;
}
int32_t createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNode, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -1127,7 +1096,7 @@ static void destroyPartitionOperatorInfo(void* param) {
int32_t createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNode* pPartNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -1668,7 +1637,7 @@ void freePartItem(void* ptr) {
int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPartitionPhysiNode* pPartNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
diff --git a/source/libs/executor/src/hashjoinoperator.c b/source/libs/executor/src/hashjoinoperator.c
index 4e630dbd18..7f13608653 100644
--- a/source/libs/executor/src/hashjoinoperator.c
+++ b/source/libs/executor/src/hashjoinoperator.c
@@ -996,7 +996,7 @@ static int32_t hJoinMainProcess(struct SOperatorInfo* pOperator, SSDataBlock** p
SSDataBlock* pRes = pJoin->finBlk;
int64_t st = 0;
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
if (pOperator->cost.openCost == 0) {
st = taosGetTimestampUs();
}
@@ -1182,7 +1182,7 @@ int32_t hJoinInitResBlocks(SHJoinOperatorInfo* pJoin, SHashJoinPhysiNode* pJoinN
int32_t createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream,
SHashJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
SHJoinOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SHJoinOperatorInfo));
diff --git a/source/libs/executor/src/mergejoinoperator.c b/source/libs/executor/src/mergejoinoperator.c
index 30cc596a44..90c2248c12 100644
--- a/source/libs/executor/src/mergejoinoperator.c
+++ b/source/libs/executor/src/mergejoinoperator.c
@@ -1867,7 +1867,7 @@ int32_t mJoinSetImplFp(SMJoinOperatorInfo* pJoin) {
int32_t createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream,
SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t oldNum = numOfDownstream;
bool newDownstreams = false;
diff --git a/source/libs/executor/src/mergeoperator.c b/source/libs/executor/src/mergeoperator.c
index 93bddb0787..7357329ca6 100644
--- a/source/libs/executor/src/mergeoperator.c
+++ b/source/libs/executor/src/mergeoperator.c
@@ -336,7 +336,7 @@ int32_t openNonSortMergeOperator(SOperatorInfo* pOperator) {
}
int32_t doNonSortMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SMultiwayMergeOperatorInfo* pInfo = pOperator->info;
@@ -419,7 +419,7 @@ int32_t copyColumnsValue(SNodeList* pNodeList, uint64_t targetBlkId, SSDataBlock
}
int32_t doColsMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SMultiwayMergeOperatorInfo* pInfo = pOperator->info;
@@ -499,7 +499,7 @@ int32_t openMultiwayMergeOperator(SOperatorInfo* pOperator) {
}
int32_t doMultiwayMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
if (pOperator->status == OP_EXEC_DONE) {
return 0;
@@ -556,7 +556,7 @@ int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplai
int32_t createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size_t numStreams, SMergePhysiNode* pMergePhyNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
SPhysiNode* pPhyNode = (SPhysiNode*)pMergePhyNode;
int32_t lino = 0;
diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c
index 983b70c575..6fe270161f 100644
--- a/source/libs/executor/src/operator.c
+++ b/source/libs/executor/src/operator.c
@@ -180,7 +180,7 @@ ERetType extractOperatorInfo(SOperatorInfo* pOperator, STraverParam* pParam, con
// QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
int32_t extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, const char* id, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
if (pOperator == NULL) {
qError("invalid operator, failed to find tableScanOperator %s", id);
@@ -282,7 +282,7 @@ int32_t stopTableScanOperator(SOperatorInfo* pOperator, const char* pIdStr, SSto
int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SNode* pTagCond,
SNode* pTagIndexCond, const char* pUser, const char* dbname, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t type = nodeType(pPhyNode);
@@ -878,7 +878,7 @@ SSDataBlock* getNextBlockFromDownstreamRemain(struct SOperatorInfo* pOperator, i
}
int32_t optrDefaultGetNextExtFn(struct SOperatorInfo* pOperator, SOperatorParam* pParam, SSDataBlock** pRes) {
- QRY_OPTR_CHECK(pRes);
+ QRY_PARAM_CHECK(pRes);
int32_t code = setOperatorParams(pOperator, pParam, OP_GET_PARAM);
if (TSDB_CODE_SUCCESS != code) {
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index 633eda6bf9..790e97b27c 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -93,7 +93,7 @@ void streamOperatorReloadState(SOperatorInfo* pOperator) {
int32_t createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode* pProjPhyNode, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo));
@@ -262,7 +262,7 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
}
int32_t doProjectOperation(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
SProjectOperatorInfo* pProjectInfo = pOperator->info;
SOptrBasicInfo* pInfo = &pProjectInfo->binfo;
@@ -441,7 +441,7 @@ int32_t doProjectOperation(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
int32_t numOfRows = 4096;
@@ -572,7 +572,7 @@ SSDataBlock* doApplyIndefinitFunction1(SOperatorInfo* pOperator) {
}
int32_t doApplyIndefinitFunction(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
SIndefOperatorInfo* pIndefInfo = pOperator->info;
SOptrBasicInfo* pInfo = &pIndefInfo->binfo;
@@ -717,7 +717,7 @@ int32_t setFunctionResultOutput(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo,
}
int32_t setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols, SArray** pResList) {
- QRY_OPTR_CHECK(pResList);
+ QRY_PARAM_CHECK(pResList);
SArray* pList = taosArrayInit(4, sizeof(int32_t));
if (pList == NULL) {
return terrno;
diff --git a/source/libs/executor/src/querytask.c b/source/libs/executor/src/querytask.c
index 67b05af120..cb0ebcff70 100644
--- a/source/libs/executor/src/querytask.c
+++ b/source/libs/executor/src/querytask.c
@@ -288,7 +288,7 @@ void buildTaskId(uint64_t taskId, uint64_t queryId, char* dst) {
memcpy(p, "TID:0x", offset);
offset += tintToHex(taskId, &p[offset]);
- memcpy(&p[offset], "QID:0x", 7);
+ memcpy(&p[offset], " QID:0x", 7);
offset += 7;
offset += tintToHex(queryId, &p[offset]);
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index 3cc1d41924..42e7e4ac3b 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -67,7 +67,7 @@ typedef struct STableCountScanOperatorInfo {
SArray* stbUidList; // when group by db_name and/or stable_name
} STableCountScanOperatorInfo;
-static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
+static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
static int32_t doTableCountScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
bool processBlockWithProbability(const SSampleExecInfo* pInfo) {
@@ -671,7 +671,8 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h);
val = *pVal;
- (void)taosLRUCacheRelease(pCache->pTableMetaEntryCache, h, false);
+ bool bRes = taosLRUCacheRelease(pCache->pTableMetaEntryCache, h, false);
+ qTrace("release LRU cache, res %d", bRes);
}
qDebug("retrieve table meta from cache:%" PRIu64 ", hit:%" PRIu64 " miss:%" PRIu64 ", %s", pCache->metaFetch,
@@ -893,7 +894,10 @@ void markGroupProcessed(STableScanInfo* pInfo, uint64_t groupId) {
if (pInfo->base.pTableListInfo->groupOffset) {
pInfo->countState = TABLE_COUNT_STATE_PROCESSED;
} else {
- (void)taosHashRemove(pInfo->base.pTableListInfo->remainGroups, &groupId, sizeof(groupId));
+ int32_t code = taosHashRemove(pInfo->base.pTableListInfo->remainGroups, &groupId, sizeof(groupId));
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ }
}
}
@@ -933,13 +937,13 @@ static int32_t doTableScanImplNext(SOperatorInfo* pOperator, SSDataBlock** ppRes
STableScanInfo* pTableScanInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
+ SSDataBlock* pBlock = pTableScanInfo->pResBlock;
+ bool hasNext = false;
+ int64_t st = taosGetTimestampUs();
- SSDataBlock* pBlock = pTableScanInfo->pResBlock;
- bool hasNext = false;
+ QRY_PARAM_CHECK(ppRes);
pBlock->info.dataLoad = false;
- int64_t st = taosGetTimestampUs();
-
while (true) {
code = pAPI->tsdReader.tsdNextDataBlock(pTableScanInfo->base.dataReader, &hasNext);
if (code != TSDB_CODE_SUCCESS) {
@@ -953,7 +957,7 @@ static int32_t doTableScanImplNext(SOperatorInfo* pOperator, SSDataBlock** ppRes
if (isTaskKilled(pTaskInfo)) {
pAPI->tsdReader.tsdReaderReleaseDataBlock(pTableScanInfo->base.dataReader);
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ return pTaskInfo->code;
}
if (pOperator->status == OP_EXEC_DONE) {
@@ -989,6 +993,7 @@ static int32_t doTableScanImplNext(SOperatorInfo* pOperator, SSDataBlock** ppRes
pOperator->cost.totalCost = pTableScanInfo->base.readRecorder.elapsedTime;
pBlock->info.scanFlag = pTableScanInfo->base.scanFlag;
+
(*ppRes) = pBlock;
return code;
}
@@ -997,9 +1002,7 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
- (*ppRes) = NULL;
return code;
}
@@ -1010,7 +1013,7 @@ static int32_t doGroupedTableScan(SOperatorInfo* pOperator, SSDataBlock** pBlock
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
- QRY_OPTR_CHECK(pBlock);
+ QRY_PARAM_CHECK(pBlock);
// The read handle is not initialized yet, since no qualified tables exists
if (pTableScanInfo->base.dataReader == NULL || pOperator->status == OP_EXEC_DONE) {
@@ -1190,7 +1193,7 @@ static int32_t startNextGroupScan(SOperatorInfo* pOperator, SSDataBlock** pResul
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
int32_t numOfTables = 0;
- QRY_OPTR_CHECK(pResult);
+ QRY_PARAM_CHECK(pResult);
code = tableListGetSize(pInfo->base.pTableListInfo, &numOfTables);
QUERY_CHECK_CODE(code, lino, _end);
@@ -1238,7 +1241,7 @@ _end:
return code;
}
-static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
+static int32_t groupSeqTableScan(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
STableScanInfo* pInfo = pOperator->info;
@@ -1246,12 +1249,14 @@ static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
int32_t num = 0;
STableKeyInfo* pList = NULL;
- SSDataBlock* result = NULL;
+ SSDataBlock* pResult = NULL;
+
+ QRY_PARAM_CHECK(pResBlock);
if (pInfo->currentGroupId == -1) {
if ((++pInfo->currentGroupId) >= tableListGetOutputGroups(pInfo->base.pTableListInfo)) {
setOperatorCompleted(pOperator);
- return NULL;
+ return code;
}
taosRLockLatch(&pTaskInfo->lock);
@@ -1269,28 +1274,32 @@ static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) {
if (pInfo->filesetDelimited) {
pAPI->tsdReader.tsdSetFilesetDelimited(pInfo->base.dataReader);
}
+
if (pInfo->pResBlock->info.capacity > pOperator->resultInfo.capacity) {
pOperator->resultInfo.capacity = pInfo->pResBlock->info.capacity;
}
}
- result = NULL;
- code = doGroupedTableScan(pOperator, &result);
+ pResult = NULL;
+ code = doGroupedTableScan(pOperator, &pResult);
QUERY_CHECK_CODE(code, lino, _end);
- if (result != NULL) {
+ if (pResult != NULL) {
if (pOperator->dynamicTask) {
- result->info.id.groupId = result->info.id.uid;
+ pResult->info.id.groupId = pResult->info.id.uid;
}
- return result;
+
+ *pResBlock = pResult;
+ return code;
}
while (true) {
- code = startNextGroupScan(pOperator, &result);
+ code = startNextGroupScan(pOperator, &pResult);
QUERY_CHECK_CODE(code, lino, _end);
- if (result || pOperator->status == OP_EXEC_DONE) {
- return result;
+ if (pResult || pOperator->status == OP_EXEC_DONE) {
+ *pResBlock = pResult;
+ return code;
}
}
@@ -1298,9 +1307,9 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
- return result;
+
+ return code;
}
static int32_t doTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
@@ -1309,7 +1318,7 @@ static int32_t doTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
STableScanInfo* pInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
- QRY_OPTR_CHECK(ppRes);
+ QRY_PARAM_CHECK(ppRes);
if (pOperator->pOperatorGetParam) {
pOperator->dynamicTask = true;
@@ -1390,8 +1399,7 @@ static int32_t doTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
pInfo->scanTimes = 0;
}
} else { // scan table group by group sequentially
- (*ppRes) = groupSeqTableScan(pOperator);
- return code;
+ code = groupSeqTableScan(pOperator, ppRes);
}
_end:
@@ -1443,7 +1451,7 @@ static void destroyTableScanOperatorInfo(void* param) {
int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -1543,7 +1551,7 @@ _error:
}
int32_t createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
@@ -3700,7 +3708,7 @@ static int32_t doRawScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
if (pInfo->dataReader && hasNext) {
if (isTaskKilled(pTaskInfo)) {
pAPI->tsdReader.tsdReaderReleaseDataBlock(pInfo->dataReader);
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ return code;
}
SSDataBlock* pBlock = NULL;
@@ -3802,6 +3810,7 @@ static int32_t doRawScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
}
}
+
(*ppRes) = NULL;
return code;
}
@@ -3810,8 +3819,8 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
+
(*ppRes) = NULL;
return code;
}
@@ -3833,7 +3842,7 @@ int32_t createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pTaskInfo
// create meta reader
// create tq reader
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -4025,7 +4034,7 @@ _end:
int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond,
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -4258,7 +4267,7 @@ _error:
return code;
}
-static void doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pRes, int32_t count, SMetaReader* mr,
+static int32_t doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pRes, int32_t count, SMetaReader* mr,
SStorageAPI* pAPI) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -4272,7 +4281,7 @@ static void doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pRes,
GET_TASKID(pTaskInfo));
tDecoderClear(&(*mr).coder);
pAPI->metaReaderFn.clearReader(mr);
- T_LONG_JMP(pTaskInfo->env, terrno);
+ goto _end;
}
code = pAPI->metaReaderFn.getTableEntryByUid(mr, item->uid);
@@ -4281,7 +4290,7 @@ static void doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pRes,
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", item->uid, tstrerror(terrno),
GET_TASKID(pTaskInfo));
pAPI->metaReaderFn.clearReader(mr);
- T_LONG_JMP(pTaskInfo->env, terrno);
+ goto _end;
}
char str[512];
@@ -4310,12 +4319,13 @@ static void doTagScanOneTable(SOperatorInfo* pOperator, const SSDataBlock* pRes,
} else {
data = (char*)p;
}
+
code = colDataSetVal(pDst, (count), data,
(data == NULL) || (pDst->info.type == TSDB_DATA_TYPE_JSON && tTagIsJsonNull(data)));
QUERY_CHECK_CODE(code, lino, _end);
- if (pDst->info.type != TSDB_DATA_TYPE_JSON && p != NULL && IS_VAR_DATA_TYPE(((const STagVal*)p)->type) &&
- data != NULL) {
+ if ((pDst->info.type != TSDB_DATA_TYPE_JSON) && (p != NULL) && IS_VAR_DATA_TYPE(((const STagVal*)p)->type) &&
+ (data != NULL)) {
taosMemoryFree(data);
}
}
@@ -4325,8 +4335,9 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
+
+ return code;
}
static void tagScanFreeUidTag(void* p) {
@@ -4529,6 +4540,7 @@ static int32_t tagScanFillResultBlock(SOperatorInfo* pOperator, SSDataBlock* pRe
SColumnInfoData* pDst = taosArrayGet(pRes->pDataBlock, pExprInfo[j].base.resSchema.slotId);
QUERY_CHECK_NULL(pDst, code, lino, _end, terrno);
code = tagScanFillOneCellWithTag(pOperator, pUidTagInfo, &pExprInfo[j], pDst, i, pAPI, pInfo->readHandle.vnode);
+ QUERY_CHECK_CODE(code, lino, _end);
}
}
} else {
@@ -4540,6 +4552,7 @@ static int32_t tagScanFillResultBlock(SOperatorInfo* pOperator, SSDataBlock* pRe
SColumnInfoData* pDst = taosArrayGet(pRes->pDataBlock, pExprInfo[j].base.resSchema.slotId);
QUERY_CHECK_NULL(pDst, code, lino, _end, terrno);
code = tagScanFillOneCellWithTag(pOperator, pUidTagInfo, &pExprInfo[j], pDst, i, pAPI, pInfo->readHandle.vnode);
+ QUERY_CHECK_CODE(code, lino, _end);
}
}
}
@@ -4552,10 +4565,6 @@ _end:
}
static int32_t doTagScanFromCtbIdxNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
- if (pOperator->status == OP_EXEC_DONE) {
- (*ppRes) = NULL;
- return TSDB_CODE_SUCCESS;
- }
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
@@ -4563,6 +4572,12 @@ static int32_t doTagScanFromCtbIdxNext(SOperatorInfo* pOperator, SSDataBlock** p
STagScanInfo* pInfo = pOperator->info;
SSDataBlock* pRes = pInfo->pRes;
+
+ QRY_PARAM_CHECK(ppRes);
+
+ if (pOperator->status == OP_EXEC_DONE) {
+ return TSDB_CODE_SUCCESS;
+ }
blockDataCleanup(pRes);
if (pInfo->pCtbCursor == NULL) {
@@ -4629,28 +4644,23 @@ static int32_t doTagScanFromCtbIdxNext(SOperatorInfo* pOperator, SSDataBlock** p
pInfo->pCtbCursor = NULL;
setOperatorCompleted(pOperator);
}
- pRes->info.rows = count;
+ pRes->info.rows = count;
bool bLimitReached = applyLimitOffset(&pInfo->limitInfo, pRes, pTaskInfo);
if (bLimitReached) {
setOperatorCompleted(pOperator);
}
+ pOperator->resultInfo.totalRows += pRes->info.rows;
+ (*ppRes) = (pRes->info.rows == 0) ? NULL : pInfo->pRes;
+
_end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
- pOperator->resultInfo.totalRows += pRes->info.rows;
- (*ppRes) = (pRes->info.rows == 0) ? NULL : pInfo->pRes;
- return code;
-}
-static SSDataBlock* doTagScanFromCtbIdx(SOperatorInfo* pOperator) {
- SSDataBlock* pRes = NULL;
- int32_t code = doTagScanFromCtbIdxNext(pOperator, &pRes);
- return pRes;
+ return code;
}
static int32_t doTagScanFromMetaEntryNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
@@ -4681,18 +4691,18 @@ static int32_t doTagScanFromMetaEntryNext(SOperatorInfo* pOperator, SSDataBlock*
return code;
}
- char str[512] = {0};
int32_t count = 0;
SMetaReader mr = {0};
pAPI->metaReaderFn.initReader(&mr, pInfo->readHandle.vnode, META_READER_LOCK, &pAPI->metaFn);
while (pInfo->curPos < size && count < pOperator->resultInfo.capacity) {
- doTagScanOneTable(pOperator, pRes, count, &mr, &pTaskInfo->storageAPI);
+ code = doTagScanOneTable(pOperator, pRes, count, &mr, &pTaskInfo->storageAPI);
++count;
if (++pInfo->curPos >= size) {
setOperatorCompleted(pOperator);
}
}
+
pRes->info.rows = count;
pAPI->metaReaderFn.clearReader(&mr);
@@ -4700,6 +4710,7 @@ static int32_t doTagScanFromMetaEntryNext(SOperatorInfo* pOperator, SSDataBlock*
if (bLimitReached) {
setOperatorCompleted(pOperator);
}
+
// qDebug("QInfo:0x%"PRIx64" create tag values results completed, rows:%d", GET_TASKID(pRuntimeEnv), count);
if (pOperator->status == OP_EXEC_DONE) {
setTaskStatus(pTaskInfo, TASK_COMPLETED);
@@ -4739,7 +4750,7 @@ static void destroyTagScanOperatorInfo(void* param) {
int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* pTagScanNode,
STableListInfo* pTableListInfo, SNode* pTagCond, SNode* pTagIndexCond,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -4907,7 +4918,7 @@ static int32_t fetchNextSubTableBlockFromReader(SOperatorInfo* pOperator, STmsSu
code = pAPI->tsdReader.tsdReaderOpen(pHandle->vnode, &pInput->tblCond, pInput->pKeyInfo, 1, pInput->pReaderBlock,
(void**)&pInput->pReader, GET_TASKID(pTaskInfo), NULL);
if (code != 0) {
- T_LONG_JMP(pTaskInfo->env, code);
+ return code;
}
}
@@ -4915,18 +4926,20 @@ static int32_t fetchNextSubTableBlockFromReader(SOperatorInfo* pOperator, STmsSu
while (true) {
bool hasNext = false;
- int32_t code = pAPI->tsdReader.tsdNextDataBlock(pInfo->base.dataReader, &hasNext);
+ code = pAPI->tsdReader.tsdNextDataBlock(pInfo->base.dataReader, &hasNext);
if (code != 0) {
pAPI->tsdReader.tsdReaderReleaseDataBlock(pInfo->base.dataReader);
pInfo->base.dataReader = NULL;
- T_LONG_JMP(pTaskInfo->env, code);
+ return code;
}
+
if (!hasNext || isTaskKilled(pTaskInfo)) {
if (isTaskKilled(pTaskInfo)) {
pAPI->tsdReader.tsdReaderReleaseDataBlock(pInfo->base.dataReader);
pInfo->base.dataReader = NULL;
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ return code;
}
+
*pSubTableHasBlock = false;
break;
}
@@ -4941,8 +4954,9 @@ static int32_t fetchNextSubTableBlockFromReader(SOperatorInfo* pOperator, STmsSu
code = loadDataBlock(pOperator, &pInfo->base, pInput->pReaderBlock, &status);
if (code != 0) {
pInfo->base.dataReader = NULL;
- T_LONG_JMP(pTaskInfo->env, code);
+ return code;
}
+
if (status == FUNC_DATA_REQUIRED_ALL_FILTEROUT) {
*pSubTableHasBlock = false;
break;
@@ -5209,49 +5223,56 @@ _end:
return code;
}
-static SSDataBlock* getSubTablesSortedBlock(SOperatorInfo* pOperator, SSDataBlock* pResBlock, int32_t capacity) {
+static int32_t getSubTablesSortedBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_t capacity, SSDataBlock** pResBlock) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
STableMergeScanInfo* pInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
STmsSubTablesMergeInfo* pSubTblsInfo = pInfo->pSubTablesMergeInfo;
+ bool finished = false;
+
+ QRY_PARAM_CHECK(pResBlock);
+
+ blockDataCleanup(pBlock);
- blockDataCleanup(pResBlock);
- bool finished = false;
while (true) {
- while (1) {
+ while (true) {
if (pSubTblsInfo->numSubTablesCompleted >= pSubTblsInfo->numSubTables) {
finished = true;
break;
}
- code = appendChosenRowToDataBlock(pSubTblsInfo, pResBlock);
+ code = appendChosenRowToDataBlock(pSubTblsInfo, pBlock);
QUERY_CHECK_CODE(code, lino, _end);
+
code = adjustSubTableForNextRow(pOperator, pSubTblsInfo);
QUERY_CHECK_CODE(code, lino, _end);
- if (pResBlock->info.rows >= capacity) {
+ if (pBlock->info.rows >= capacity) {
break;
}
}
if (isTaskKilled(pTaskInfo)) {
- T_LONG_JMP(pOperator->pTaskInfo->env, pTaskInfo->code);
+ return pTaskInfo->code;
}
- bool limitReached = applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo);
- if (finished || limitReached || pResBlock->info.rows > 0) {
+ bool limitReached = applyLimitOffset(&pInfo->limitInfo, pBlock, pTaskInfo);
+ if (finished || limitReached || pBlock->info.rows > 0) {
break;
}
}
+ if (pBlock->info.rows > 0) {
+ *pResBlock = pBlock;
+ }
+
_end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
- return (pResBlock->info.rows > 0) ? pResBlock : NULL;
+ return code;
}
static int32_t startSubTablesTableMergeScan(SOperatorInfo* pOperator) {
@@ -5301,23 +5322,22 @@ static void stopSubTablesTableMergeScan(STableMergeScanInfo* pInfo) {
}
int32_t doTableMergeScanParaSubTablesNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
- if (pOperator->status == OP_EXEC_DONE) {
- (*ppRes) = NULL;
- return TSDB_CODE_SUCCESS;
- }
+ QRY_PARAM_CHECK(ppRes);
+
+ int32_t lino = 0;
+ int32_t tableListSize = 0;
+ int64_t st = taosGetTimestampUs();
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
STableMergeScanInfo* pInfo = pOperator->info;
- int32_t lino = 0;
- int32_t code = pOperator->fpSet._openFn(pOperator);
- if (code != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pTaskInfo->env, code);
+ if (pOperator->status == OP_EXEC_DONE) {
+ return TSDB_CODE_SUCCESS;
}
- int64_t st = taosGetTimestampUs();
+ int32_t code = pOperator->fpSet._openFn(pOperator);
+ QUERY_CHECK_CODE(code, lino, _end);
- int32_t tableListSize = 0;
code = tableListGetSize(pInfo->base.pTableListInfo, &tableListSize);
QUERY_CHECK_CODE(code, lino, _end);
@@ -5329,6 +5349,7 @@ int32_t doTableMergeScanParaSubTablesNext(SOperatorInfo* pOperator, SSDataBlock*
(*ppRes) = NULL;
return code;
}
+
pInfo->tableStartIndex = 0;
STableKeyInfo* pTmpGpId = (STableKeyInfo*)tableListGetInfo(pInfo->base.pTableListInfo, pInfo->tableStartIndex);
QUERY_CHECK_NULL(pTmpGpId, code, lino, _end, terrno);
@@ -5340,15 +5361,19 @@ int32_t doTableMergeScanParaSubTablesNext(SOperatorInfo* pOperator, SSDataBlock*
SSDataBlock* pBlock = NULL;
while (pInfo->tableStartIndex < tableListSize) {
if (isTaskKilled(pTaskInfo)) {
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ break;
}
- pBlock = getSubTablesSortedBlock(pOperator, pInfo->pResBlock, pOperator->resultInfo.capacity);
+ code = getSubTablesSortedBlock(pOperator, pInfo->pResBlock, pOperator->resultInfo.capacity, &pBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+
if (pBlock == NULL && !pInfo->bGroupProcessed && pInfo->needCountEmptyTable) {
STableKeyInfo* tbInfo = tableListGetInfo(pInfo->base.pTableListInfo, pInfo->tableStartIndex);
QUERY_CHECK_NULL(tbInfo, code, lino, _end, terrno);
+
pBlock = getOneRowResultBlock(pTaskInfo, &pInfo->base, pInfo->pResBlock, tbInfo);
}
+
if (pBlock != NULL) {
pBlock->info.id.groupId = pInfo->groupId;
pOperator->resultInfo.totalRows += pBlock->info.rows;
@@ -5379,16 +5404,11 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
+ } else {
+ (*ppRes) = pBlock;
}
- (*ppRes) = pBlock;
- return code;
-}
-static SSDataBlock* doTableMergeScanParaSubTables(SOperatorInfo* pOperator) {
- SSDataBlock* pRes = NULL;
- int32_t code = doTableMergeScanParaSubTablesNext(pOperator, &pRes);
- return pRes;
+ return code;
}
static void tableMergeScanDoSkipTable(uint64_t uid, void* pTableMergeOpInfo) {
@@ -5420,7 +5440,7 @@ _end:
}
}
-static void doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinished, bool* pSkipped) {
+static int32_t doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinished, bool* pSkipped) {
STableMergeScanInfo* pInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SStorageAPI* pAPI = &pTaskInfo->storageAPI;
@@ -5433,7 +5453,8 @@ static void doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinishe
if (code != 0) {
pAPI->tsdReader.tsdReaderReleaseDataBlock(reader);
qError("table merge scan fetch next data block error code: %d, %s", code, GET_TASKID(pTaskInfo));
- T_LONG_JMP(pTaskInfo->env, code);
+ pTaskInfo->code = code;
+ return code;
}
if (!hasNext || isTaskKilled(pTaskInfo)) {
@@ -5442,7 +5463,7 @@ static void doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinishe
pAPI->tsdReader.tsdReaderReleaseDataBlock(reader);
}
*pFinished = true;
- return;
+ return code;
}
uint32_t status = 0;
@@ -5450,21 +5471,22 @@ static void doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinishe
if (code != TSDB_CODE_SUCCESS) {
qInfo("table merge scan load datablock code %d, %s", code, GET_TASKID(pTaskInfo));
- T_LONG_JMP(pTaskInfo->env, code);
+ pTaskInfo->code = code;
+ return code;
}
if (status == FUNC_DATA_REQUIRED_ALL_FILTEROUT) {
*pFinished = true;
- return;
+ return code;
}
// current block is filter out according to filter condition, continue load the next block
if (status == FUNC_DATA_REQUIRED_FILTEROUT || pBlock->info.rows == 0) {
*pSkipped = true;
- return;
+ return code;
}
- return;
+ return code;
}
static int32_t getBlockForTableMergeScan(void* param, SSDataBlock** ppBlock) {
@@ -5475,7 +5497,7 @@ static int32_t getBlockForTableMergeScan(void* param, SSDataBlock** ppBlock) {
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SSDataBlock* pBlock = NULL;
int64_t st = taosGetTimestampUs();
- int32_t code = TSDB_CODE_SUCCESS;
+ int32_t code = TSDB_CODE_SUCCESS;
while (true) {
if (pInfo->rtnNextDurationBlocks) {
@@ -5499,7 +5521,12 @@ static int32_t getBlockForTableMergeScan(void* param, SSDataBlock** ppBlock) {
} else {
bool bFinished = false;
bool bSkipped = false;
- doGetBlockForTableMergeScan(pOperator, &bFinished, &bSkipped);
+
+ code = doGetBlockForTableMergeScan(pOperator, &bFinished, &bSkipped);
+ if (code != 0) {
+ return code;
+ }
+
pBlock = pInfo->pReaderBlock;
qDebug("%s table merge scan fetch block. finished %d skipped %d next-duration-block %d new-fileset %d",
GET_TASKID(pTaskInfo), bFinished, bSkipped, pInfo->bNextDurationBlockEvent, pInfo->bNewFilesetEvent);
@@ -5512,7 +5539,6 @@ static int32_t getBlockForTableMergeScan(void* param, SSDataBlock** ppBlock) {
if (!bSkipped) {
code = createOneDataBlock(pBlock, true, &pInfo->nextDurationBlocks[pInfo->numNextDurationBlocks]);
if (code) {
- terrno = code;
*ppBlock = NULL;
return code;
}
@@ -5651,7 +5677,11 @@ int32_t startDurationForGroupTableMergeScan(SOperatorInfo* pOperator) {
param->pOperator = pOperator;
SSortSource* ps = taosMemoryCalloc(1, sizeof(SSortSource));
- QUERY_CHECK_NULL(ps, code, lino, _end, terrno);
+ if (ps == NULL) {
+ taosMemoryFree(param);
+ QUERY_CHECK_NULL(ps, code, lino, _end, terrno);
+ }
+
ps->param = param;
ps->onlyRef = false;
code = tsortAddSource(pInfo->pSortHandle, ps);
@@ -5846,7 +5876,7 @@ int32_t doTableMergeScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
SSDataBlock* pBlock = NULL;
while (pInfo->tableStartIndex < tableListSize) {
if (isTaskKilled(pTaskInfo)) {
- T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ goto _end;
}
pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pInfo->pResBlock, pOperator->resultInfo.capacity,
@@ -5890,9 +5920,10 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
+ } else {
+ (*ppRes) = pBlock;
}
- (*ppRes) = pBlock;
+
return code;
}
@@ -5965,7 +5996,7 @@ int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExpla
int32_t createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -6100,11 +6131,11 @@ static int32_t buildVnodeGroupedStbTableCount(STableCountScanOperatorInfo*
SSDataBlock* pRes, char* dbName, tb_uid_t stbUid, SStorageAPI* pAPI);
static int32_t buildVnodeGroupedNtbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
SSDataBlock* pRes, char* dbName, SStorageAPI* pAPI);
-static void buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
+static int32_t buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName);
-static void buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
+static int32_t buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName);
-static SSDataBlock* buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
+static int32_t buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes);
static void buildSysDbGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes, size_t infodbTableNum,
@@ -6207,7 +6238,7 @@ int32_t getTableCountScanSupp(SNodeList* groupTags, SName* tableName, SNodeList*
int32_t createTableCountScanOperatorInfo(SReadHandle* readHandle, STableCountScanPhysiNode* pTblCountScanNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -6390,23 +6421,29 @@ static int32_t doTableCountScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRe
STableCountScanOperatorInfo* pInfo = pOperator->info;
STableCountScanSupp* pSupp = &pInfo->supp;
SSDataBlock* pRes = pInfo->pRes;
+
blockDataCleanup(pRes);
+ QRY_PARAM_CHECK(ppRes);
if (pOperator->status == OP_EXEC_DONE) {
- (*ppRes) = NULL;
return code;
}
+
if (pInfo->readHandle.mnd != NULL) {
(*ppRes) = buildSysDbTableCount(pOperator, pInfo);
return code;
}
- (*ppRes) = buildVnodeDbTableCount(pOperator, pInfo, pSupp, pRes);
+ code = buildVnodeDbTableCount(pOperator, pInfo, pSupp, pRes);
+ if ((pRes->info.rows > 0) && (code == 0)) {
+ *ppRes = pRes;
+ }
+
return code;
}
-static SSDataBlock* buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
- STableCountScanSupp* pSupp, SSDataBlock* pRes) {
+static int32_t buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
+ STableCountScanSupp* pSupp, SSDataBlock* pRes) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
const char* db = NULL;
@@ -6418,27 +6455,29 @@ static SSDataBlock* buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCount
// get dbname
pAPI->metaFn.getBasicInfo(pInfo->readHandle.vnode, &db, &vgId, NULL, NULL);
SName sn = {0};
+
code = tNameFromString(&sn, db, T_NAME_ACCT | T_NAME_DB);
QUERY_CHECK_CODE(code, lino, _end);
+
code = tNameGetDbName(&sn, dbName);
QUERY_CHECK_CODE(code, lino, _end);
if (pSupp->groupByDbName || pSupp->groupByStbName) {
- buildVnodeGroupedTableCount(pOperator, pInfo, pSupp, pRes, vgId, dbName);
+ code = buildVnodeGroupedTableCount(pOperator, pInfo, pSupp, pRes, vgId, dbName);
} else {
- buildVnodeFilteredTbCount(pOperator, pInfo, pSupp, pRes, dbName);
+ code = buildVnodeFilteredTbCount(pOperator, pInfo, pSupp, pRes, dbName);
}
_end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
- return pRes->info.rows > 0 ? pRes : NULL;
+
+ return code;
}
-static void buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
+static int32_t buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -6452,6 +6491,7 @@ static void buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountSca
code = pAPI->metaFn.storeGetTableList(pInfo->readHandle.vnode, TSDB_SUPER_TABLE, pInfo->stbUidList);
QUERY_CHECK_CODE(code, lino, _end);
}
+
if (pInfo->currGrpIdx < taosArrayGetSize(pInfo->stbUidList)) {
tb_uid_t stbUid = *(tb_uid_t*)taosArrayGet(pInfo->stbUidList, pInfo->currGrpIdx);
code = buildVnodeGroupedStbTableCount(pInfo, pSupp, pRes, dbName, stbUid, pAPI);
@@ -6481,11 +6521,11 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
pTaskInfo->code = code;
- T_LONG_JMP(pTaskInfo->env, code);
}
+ return code;
}
-static void buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
+static int32_t buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -6521,9 +6561,10 @@ _end:
if (code != TSDB_CODE_SUCCESS) {
pTaskInfo->code = code;
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- T_LONG_JMP(pTaskInfo->env, code);
}
+
setOperatorCompleted(pOperator);
+ return code;
}
static int32_t buildVnodeGroupedNtbTableCount(STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp,
diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c
index bb494cacfa..9b659ac761 100644
--- a/source/libs/executor/src/sortoperator.c
+++ b/source/libs/executor/src/sortoperator.c
@@ -55,7 +55,7 @@ static void destroySortOpGroupIdCalc(SSortOpGroupIdCalc* pCalc);
// todo add limit/offset impl
int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
@@ -252,7 +252,7 @@ static STupleHandle* nextTupleWithGroupId(SSortHandle* pHandle, SSortOperatorInf
static int32_t getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, int32_t capacity, SArray* pColMatchInfo,
SSortOperatorInfo* pInfo, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
blockDataCleanup(pDataBlock);
int32_t lino = 0;
int32_t code = 0;
@@ -355,25 +355,26 @@ int32_t doOpenSortOperator(SOperatorInfo* pOperator) {
pInfo->startTs = taosGetTimestampUs();
// pInfo->binfo.pRes is not equalled to the input datablock.
pInfo->pSortHandle = NULL;
- int32_t code = tsortCreateSortHandle(pInfo->pSortInfo, SORT_SINGLESOURCE_SORT, -1, -1, NULL, pTaskInfo->id.str,
- pInfo->maxRows, pInfo->maxTupleLength, tsPQSortMemThreshold * 1024 * 1024, &pInfo->pSortHandle);
+ int32_t code =
+ tsortCreateSortHandle(pInfo->pSortInfo, SORT_SINGLESOURCE_SORT, -1, -1, NULL, pTaskInfo->id.str, pInfo->maxRows,
+ pInfo->maxTupleLength, tsPQSortMemThreshold * 1024 * 1024, &pInfo->pSortHandle);
if (code) {
return code;
}
tsortSetFetchRawDataFp(pInfo->pSortHandle, loadNextDataBlock, applyScalarFunction, pOperator);
- SSortSource* ps = taosMemoryCalloc(1, sizeof(SSortSource));
- if (ps == NULL) {
+ SSortSource* pSource = taosMemoryCalloc(1, sizeof(SSortSource));
+ if (pSource == NULL) {
return terrno;
}
- ps->param = pOperator->pDownstream[0];
- ps->onlyRef = true;
+ pSource->param = pOperator->pDownstream[0];
+ pSource->onlyRef = true;
- code = tsortAddSource(pInfo->pSortHandle, ps);
+ code = tsortAddSource(pInfo->pSortHandle, pSource);
if (code) {
- taosMemoryFree(ps);
+ taosMemoryFree(pSource);
return code;
}
@@ -390,7 +391,7 @@ int32_t doOpenSortOperator(SOperatorInfo* pOperator) {
}
int32_t doSort(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
if (pOperator->status == OP_EXEC_DONE) {
return 0;
}
@@ -400,7 +401,7 @@ int32_t doSort(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
int32_t code = pOperator->fpSet._openFn(pOperator);
if (code != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pTaskInfo->env, code);
+ return code;
}
// multi-group case not handle here
@@ -408,7 +409,7 @@ int32_t doSort(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
while (1) {
if (tsortIsClosed(pInfo->pSortHandle)) {
code = TSDB_CODE_TSC_QUERY_CANCELLED;
- T_LONG_JMP(pOperator->pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
code = getSortedBlockData(pInfo->pSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity,
@@ -516,7 +517,7 @@ typedef struct SGroupSortOperatorInfo {
int32_t getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, int32_t capacity, SArray* pColMatchInfo,
SGroupSortOperatorInfo* pInfo, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
blockDataCleanup(pDataBlock);
int32_t code = blockDataEnsureCapacity(pDataBlock, capacity);
@@ -598,7 +599,7 @@ int32_t fetchNextGroupSortDataBlock(void* param, SSDataBlock** ppBlock) {
SGroupSortOperatorInfo* grpSortOpInfo = source->grpSortOpInfo;
SSDataBlock* block = NULL;
- QRY_OPTR_CHECK(ppBlock);
+ QRY_PARAM_CHECK(ppBlock);
if (grpSortOpInfo->prefetchedSortInput) {
block = grpSortOpInfo->prefetchedSortInput;
@@ -648,23 +649,22 @@ int32_t beginSortGroup(SOperatorInfo* pOperator) {
SSortSource* ps = taosMemoryCalloc(1, sizeof(SSortSource));
SGroupSortSourceParam* param = taosMemoryCalloc(1, sizeof(SGroupSortSourceParam));
if (ps == NULL || param == NULL) {
- T_LONG_JMP(pTaskInfo->env, terrno);
+ taosMemoryFree(ps);
+ taosMemoryFree(param);
+ return terrno;
}
param->childOpInfo = pOperator->pDownstream[0];
param->grpSortOpInfo = pInfo;
+
ps->param = param;
ps->onlyRef = false;
code = tsortAddSource(pInfo->pCurrSortHandle, ps);
- if (code) {
- T_LONG_JMP(pTaskInfo->env, code);
+ if (code != 0) {
+ return code;
}
code = tsortOpen(pInfo->pCurrSortHandle);
- if (code != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pTaskInfo->env, code);
- }
-
return code;
}
@@ -686,7 +686,7 @@ int32_t finishSortGroup(SOperatorInfo* pOperator) {
}
int32_t doGroupSort(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
- QRY_OPTR_CHECK(pResBlock);
+ QRY_PARAM_CHECK(pResBlock);
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SGroupSortOperatorInfo* pInfo = pOperator->info;
@@ -696,7 +696,7 @@ int32_t doGroupSort(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
int32_t code = pOperator->fpSet._openFn(pOperator);
if (code != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pTaskInfo->env, code);
+ return code;
}
if (!pInfo->hasGroupId) {
@@ -720,15 +720,14 @@ int32_t doGroupSort(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
while (pInfo->pCurrSortHandle != NULL) {
if (tsortIsClosed(pInfo->pCurrSortHandle)) {
code = TSDB_CODE_TSC_QUERY_CANCELLED;
- T_LONG_JMP(pOperator->pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
// beginSortGroup would fetch all child blocks of pInfo->currGroupId;
if (pInfo->childOpStatus == CHILD_OP_SAME_GROUP) {
- code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
- pOperator->pTaskInfo->code = code;
+ pTaskInfo->code = code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
- T_LONG_JMP(pOperator->pTaskInfo->env, code);
+ return code;
}
code = getGroupSortedBlockData(pInfo->pCurrSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity,
@@ -777,7 +776,7 @@ void destroyGroupSortOperatorInfo(void* param) {
int32_t createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNode* pSortPhyNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c
index b086b41611..524ef6ee2f 100644
--- a/source/libs/executor/src/streamcountwindowoperator.c
+++ b/source/libs/executor/src/streamcountwindowoperator.c
@@ -807,7 +807,7 @@ _end:
int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode,
SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
SCountWinodwPhysiNode* pCountNode = (SCountWinodwPhysiNode*)pPhyNode;
int32_t numOfCols = 0;
diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c
index 70f88fc37f..735b470325 100644
--- a/source/libs/executor/src/streameventwindowoperator.c
+++ b/source/libs/executor/src/streameventwindowoperator.c
@@ -858,7 +858,7 @@ _end:
int32_t createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo,
SReadHandle* pHandle, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
SStreamEventWinodwPhysiNode* pEventNode = (SStreamEventWinodwPhysiNode*)pPhyNode;
int32_t tsSlotId = ((SColumnNode*)pEventNode->window.pTspk)->slotId;
diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c
index d87e78ede3..58e57eb88b 100644
--- a/source/libs/executor/src/streamfilloperator.c
+++ b/source/libs/executor/src/streamfilloperator.c
@@ -1349,7 +1349,7 @@ _end:
int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c
index 0036618d9f..6196647eff 100644
--- a/source/libs/executor/src/streamtimewindowoperator.c
+++ b/source/libs/executor/src/streamtimewindowoperator.c
@@ -718,6 +718,11 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB
SColumnInfoData* pGroupId = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
SColumnInfoData* pCalStartTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
SColumnInfoData* pCalEndTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
+ SColumnInfoData* pTbName = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
+ SColumnInfoData* pPrimaryKey = NULL;
+ if (taosArrayGetSize(pBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) {
+ pPrimaryKey = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX);
+ }
for (; (*pIndex) < size; (*pIndex)++) {
SPullWindowInfo* pWin = taosArrayGet(array, (*pIndex));
code = colDataSetVal(pStartTs, pBlock->info.rows, (const char*)&pWin->window.skey, false);
@@ -735,6 +740,11 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB
code = colDataSetVal(pCalEndTs, pBlock->info.rows, (const char*)&pWin->calWin.ekey, false);
QUERY_CHECK_CODE(code, lino, _end);
+ colDataSetNULL(pTbName, pBlock->info.rows);
+ if (pPrimaryKey != NULL) {
+ colDataSetNULL(pPrimaryKey, pBlock->info.rows);
+ }
+
pBlock->info.rows++;
}
if ((*pIndex) == size) {
@@ -1876,7 +1886,7 @@ _end:
int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode,
SExecTaskInfo* pTaskInfo, int32_t numOfChild,
SReadHandle* pHandle, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -3744,7 +3754,7 @@ _end:
int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode,
SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
SSessionWinodwPhysiNode* pSessionNode = (SSessionWinodwPhysiNode*)pPhyNode;
int32_t numOfCols = 0;
@@ -4071,7 +4081,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
int32_t createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode,
SExecTaskInfo* pTaskInfo, int32_t numOfChild,
SReadHandle* pHandle, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -4921,7 +4931,7 @@ _end:
int32_t createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo,
SReadHandle* pHandle, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
@@ -5238,7 +5248,7 @@ _end:
int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo,
SReadHandle* pHandle, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c
index 85a8b035da..bf1153f412 100644
--- a/source/libs/executor/src/sysscanoperator.c
+++ b/source/libs/executor/src/sysscanoperator.c
@@ -2177,7 +2177,12 @@ static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableSca
T_LONG_JMP(pTaskInfo->env, code);
}
- (void)tsem_wait(&pInfo->ready);
+ code = tsem_wait(&pInfo->ready);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ pTaskInfo->code = code;
+ T_LONG_JMP(pTaskInfo->env, code);
+ }
if (pTaskInfo->code) {
qError("%s load meta data from mnode failed, totalRows:%" PRIu64 ", code:%s", GET_TASKID(pTaskInfo),
@@ -2228,7 +2233,7 @@ static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableSca
int32_t createSysTableScanOperatorInfo(void* readHandle, SSystemTableScanPhysiNode* pScanPhyNode, const char* pUser,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -2327,7 +2332,10 @@ void extractTbnameSlotId(SSysTableScanInfo* pInfo, const SScanPhysiNode* pScanNo
void destroySysScanOperator(void* param) {
SSysTableScanInfo* pInfo = (SSysTableScanInfo*)param;
- (void)tsem_destroy(&pInfo->ready);
+ int32_t code = tsem_destroy(&pInfo->ready);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ }
blockDataDestroy(pInfo->pRes);
if (pInfo->name.type == TSDB_TABLE_NAME_T) {
@@ -2383,7 +2391,10 @@ int32_t loadSysTableCallback(void* param, SDataBuf* pMsg, int32_t code) {
}
}
- (void)tsem_post(&pScanResInfo->ready);
+ int32_t res = tsem_post(&pScanResInfo->ready);
+ if (res != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(res));
+ }
return TSDB_CODE_SUCCESS;
}
@@ -2853,7 +2864,7 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC
int32_t createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDistScanPhysiNode* pBlockScanNode,
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c
index 32a769ade3..f9211e5730 100644
--- a/source/libs/executor/src/timesliceoperator.c
+++ b/source/libs/executor/src/timesliceoperator.c
@@ -1104,7 +1104,7 @@ static int32_t extractPkColumnFromFuncs(SNodeList* pFuncs, bool* pHasPk, SColumn
}
int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = 0;
int32_t lino = 0;
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index fc91877b66..59883d2b80 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -1231,7 +1231,7 @@ void destroyIntervalOperatorInfo(void* param) {
cleanupAggSup(&pInfo->aggSup);
cleanupExprSupp(&pInfo->scalarSupp);
- (void)tdListFree(pInfo->binfo.resultRowInfo.openWindow);
+ pInfo->binfo.resultRowInfo.openWindow = tdListFree(pInfo->binfo.resultRowInfo.openWindow);
taosArrayDestroy(pInfo->pInterpCols);
pInfo->pInterpCols = NULL;
@@ -1320,7 +1320,7 @@ _end:
int32_t createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo,
SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -1616,7 +1616,7 @@ _end:
// todo make this as an non-blocking operator
int32_t createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhysiNode* pStateNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -1727,7 +1727,7 @@ void destroySWindowOperatorInfo(void* param) {
int32_t createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPhysiNode* pSessionNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -2027,7 +2027,7 @@ static int32_t mergeAlignedIntervalAggNext(SOperatorInfo* pOperator, SSDataBlock
int32_t createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMergeAlignedIntervalPhysiNode* pNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
@@ -2132,7 +2132,7 @@ typedef struct SGroupTimeWindow {
void destroyMergeIntervalOperatorInfo(void* param) {
SMergeIntervalAggOperatorInfo* miaInfo = (SMergeIntervalAggOperatorInfo*)param;
- (void)tdListFree(miaInfo->groupIntervals);
+ miaInfo->groupIntervals = tdListFree(miaInfo->groupIntervals);
destroyIntervalOperatorInfo(&miaInfo->intervalAggOperatorInfo);
taosMemoryFreeClear(param);
@@ -2162,7 +2162,8 @@ static int32_t outputPrevIntervalResult(SOperatorInfo* pOperatorInfo, uint64_t t
STimeWindow* prevWin = &prevGrpWin->window;
if ((ascScan && newWin->skey > prevWin->ekey) || ((!ascScan) && newWin->skey < prevWin->ekey)) {
- (void)tdListPopNode(miaInfo->groupIntervals, listNode);
+ SListNode* tmp = tdListPopNode(miaInfo->groupIntervals, listNode);
+ taosMemoryFreeClear(tmp);
}
}
@@ -2365,7 +2366,7 @@ _end:
int32_t createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeIntervalPhysiNode* pIntervalPhyNode,
SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
- QRY_OPTR_CHECK(pOptrInfo);
+ QRY_PARAM_CHECK(pOptrInfo);
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index 2792e6a197..796ebbeb84 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -79,9 +79,8 @@ struct SSortHandle {
bool forceUsePQSort;
BoundedQueue* pBoundedQueue;
uint32_t tmpRowIdx;
-
- int64_t mergeLimit;
- int64_t currMergeLimitTs;
+ int64_t mergeLimit;
+ int64_t currMergeLimitTs;
int32_t sourceId;
SSDataBlock* pDataBlock;
@@ -288,7 +287,7 @@ int32_t tsortCreateSortHandle(SArray* pSortInfo, int32_t type, int32_t pageSize,
int32_t code = 0;
int32_t lino = 0;
- QRY_OPTR_CHECK(pHandle);
+ QRY_PARAM_CHECK(pHandle);
SSortHandle* pSortHandle = taosMemoryCalloc(1, sizeof(SSortHandle));
QUERY_CHECK_NULL(pSortHandle, code, lino, _err, terrno);
@@ -367,7 +366,7 @@ static int32_t sortComparCleanup(SMsortComparParam* cmpParam) {
return TSDB_CODE_SUCCESS;
}
-void tsortClearOrderdSource(SArray* pOrderedSource, int64_t *fetchUs, int64_t *fetchNum) {
+void tsortClearOrderedSource(SArray* pOrderedSource, int64_t *fetchUs, int64_t *fetchNum) {
for (size_t i = 0; i < taosArrayGetSize(pOrderedSource); i++) {
SSortSource** pSource = taosArrayGet(pOrderedSource, i);
if (NULL == *pSource) {
@@ -413,10 +412,11 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
destroyDiskbasedBuf(pSortHandle->pBuf);
taosMemoryFreeClear(pSortHandle->idStr);
blockDataDestroy(pSortHandle->pDataBlock);
+
if (pSortHandle->pBoundedQueue) destroyBoundedQueue(pSortHandle->pBoundedQueue);
int64_t fetchUs = 0, fetchNum = 0;
- tsortClearOrderdSource(pSortHandle->pOrderedSource, &fetchUs, &fetchNum);
+ tsortClearOrderedSource(pSortHandle->pOrderedSource, &fetchUs, &fetchNum);
qDebug("all source fetch time: %" PRId64 "us num:%" PRId64 " %s", fetchUs, fetchNum, pSortHandle->idStr);
taosArrayDestroy(pSortHandle->pOrderedSource);
@@ -465,7 +465,13 @@ static int32_t doAddNewExternalMemSource(SDiskbasedBuf* pBuf, SArray* pAllSource
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
- return blockDataEnsureCapacity(pSource->src.pBlock, numOfRows);
+ int32_t code = blockDataEnsureCapacity(pSource->src.pBlock, numOfRows);
+ if (code != 0) {
+ qError("sort failed at: %s:%d", __func__, __LINE__);
+ taosArrayDestroy(pPageIdList);
+ }
+
+ return code;
}
static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
@@ -935,9 +941,99 @@ int32_t msortComparFn(const void* pLeft, const void* pRight, void* param) {
}
}
}
+
return 0;
}
+static int32_t doSortForEachGroup(SSortHandle* pHandle, int32_t sortTimes, int32_t numOfSorted,
+ int32_t numOfInputSources, SArray* pResList, int32_t sortGroup, int32_t numOfRows) {
+ int32_t code = 0;
+ int32_t lino = 0;
+ SArray* pPageIdList = NULL;
+
+ for (int32_t i = 0; i < sortGroup; ++i) {
+ qDebug("internal merge sort pass %d group %d. num input sources %d ", sortTimes, i, numOfInputSources);
+ pHandle->sourceId += 1;
+
+ int32_t end = (i + 1) * numOfInputSources - 1;
+ if (end > numOfSorted - 1) {
+ end = numOfSorted - 1;
+ }
+
+ pHandle->cmpParam.numOfSources = end - i * numOfInputSources + 1;
+
+ code = sortComparInit(&pHandle->cmpParam, pHandle->pOrderedSource, i * numOfInputSources, end, pHandle);
+ QUERY_CHECK_CODE(code, lino, _err);
+
+ code =
+ tMergeTreeCreate(&pHandle->pMergeTree, pHandle->cmpParam.numOfSources, &pHandle->cmpParam, pHandle->comparFn);
+ QUERY_CHECK_CODE(code, lino, _err);
+
+ int32_t nMergedRows = 0;
+ pPageIdList = taosArrayInit(4, sizeof(int32_t));
+ QUERY_CHECK_NULL(pPageIdList, code, lino, _err, terrno);
+
+ while (1) {
+ if (tsortIsClosed(pHandle) || (pHandle->abortCheckFn && pHandle->abortCheckFn(pHandle->abortCheckParam))) {
+ code = TSDB_CODE_TSC_QUERY_CANCELLED;
+ goto _err;
+ }
+
+ SSDataBlock* pDataBlock = NULL;
+ code = getSortedBlockDataInner(pHandle, &pHandle->cmpParam, numOfRows, &pDataBlock);
+ if (pDataBlock == NULL || code != 0) {
+ break;
+ }
+
+ int32_t pageId = -1;
+ void* pPage = getNewBufPage(pHandle->pBuf, &pageId);
+ QUERY_CHECK_NULL(pPage, code, lino, _err, terrno);
+
+ void* px = taosArrayPush(pPageIdList, &pageId);
+ QUERY_CHECK_NULL(px, code, lino, _err, terrno);
+
+ int32_t size =
+ blockDataGetSize(pDataBlock) + sizeof(int32_t) + taosArrayGetSize(pDataBlock->pDataBlock) * sizeof(int32_t);
+ if (size > getBufPageSize(pHandle->pBuf)) {
+ code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
+ goto _err;
+ }
+
+ code = blockDataToBuf(pPage, pDataBlock);
+ QUERY_CHECK_CODE(code, lino, _err);
+
+ setBufPageDirty(pPage, true);
+ releaseBufPage(pHandle->pBuf, pPage);
+ nMergedRows += pDataBlock->info.rows;
+
+ blockDataCleanup(pDataBlock);
+ if ((pHandle->mergeLimit != -1) && (nMergedRows >= pHandle->mergeLimit)) {
+ break;
+ }
+ }
+
+ code = sortComparCleanup(&pHandle->cmpParam);
+ QUERY_CHECK_CODE(code, lino, _err);
+
+ tMergeTreeDestroy(&pHandle->pMergeTree);
+ pHandle->numOfCompletedSources = 0;
+
+ SSDataBlock* pBlock = NULL;
+ code = createOneDataBlock(pHandle->pDataBlock, false, &pBlock);
+ QUERY_CHECK_CODE(code, lino, _err);
+
+ code = doAddNewExternalMemSource(pHandle->pBuf, pResList, pBlock, &pHandle->sourceId, pPageIdList);
+ QUERY_CHECK_CODE(code, lino, _err);
+ }
+
+ return code;
+
+_err:
+ taosArrayDestroy(pPageIdList);
+ qError("%s error happens:%s line:%d, code:%s", pHandle->idStr, __func__, lino, tstrerror(code));
+ return code;
+}
+
static int32_t doInternalMergeSort(SSortHandle* pHandle) {
size_t numOfSources = taosArrayGetSize(pHandle->pOrderedSource);
if (numOfSources == 0) {
@@ -959,8 +1055,8 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
pHandle->numOfPages);
}
- int32_t numOfRows = blockDataGetCapacityInRow(pHandle->pDataBlock, pHandle->pageSize,
- blockDataGetSerialMetaSize(taosArrayGetSize(pHandle->pDataBlock->pDataBlock)));
+ int32_t size = (int32_t) blockDataGetSerialMetaSize(taosArrayGetSize(pHandle->pDataBlock->pDataBlock));
+ int32_t numOfRows = blockDataGetCapacityInRow(pHandle->pDataBlock, pHandle->pageSize, size);
if (numOfRows < 0) {
return terrno;
}
@@ -985,117 +1081,22 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
int32_t sortGroup = (numOfSorted + numOfInputSources - 1) / numOfInputSources;
// Only *numOfInputSources* can be loaded into buffer to perform the external sort.
- for (int32_t i = 0; i < sortGroup; ++i) {
- qDebug("internal merge sort pass %d group %d. num input sources %d ", t, i, numOfInputSources);
- pHandle->sourceId += 1;
-
- int32_t end = (i + 1) * numOfInputSources - 1;
- if (end > numOfSorted - 1) {
- end = numOfSorted - 1;
- }
-
- pHandle->cmpParam.numOfSources = end - i * numOfInputSources + 1;
-
- code = sortComparInit(&pHandle->cmpParam, pHandle->pOrderedSource, i * numOfInputSources, end, pHandle);
- if (code != TSDB_CODE_SUCCESS) {
- taosArrayDestroy(pResList);
- return code;
- }
-
- code =
- tMergeTreeCreate(&pHandle->pMergeTree, pHandle->cmpParam.numOfSources, &pHandle->cmpParam, pHandle->comparFn);
- if (code != TSDB_CODE_SUCCESS) {
- taosArrayDestroy(pResList);
- return code;
- }
-
- int32_t nMergedRows = 0;
- SArray* pPageIdList = taosArrayInit(4, sizeof(int32_t));
- if (pPageIdList == NULL) {
- taosArrayDestroy(pResList);
- return terrno;
- }
-
- while (1) {
- if (tsortIsClosed(pHandle) || (pHandle->abortCheckFn && pHandle->abortCheckFn(pHandle->abortCheckParam))) {
- code = terrno = TSDB_CODE_TSC_QUERY_CANCELLED;
- return code;
- }
-
- SSDataBlock* pDataBlock = NULL;
- code = getSortedBlockDataInner(pHandle, &pHandle->cmpParam, numOfRows, &pDataBlock);
- if (pDataBlock == NULL || code != 0) {
- break;
- }
-
- int32_t pageId = -1;
- void* pPage = getNewBufPage(pHandle->pBuf, &pageId);
- if (pPage == NULL) {
- taosArrayDestroy(pResList);
- taosArrayDestroy(pPageIdList);
- return terrno;
- }
-
- void* px = taosArrayPush(pPageIdList, &pageId);
- if (px == NULL) {
- taosArrayDestroy(pResList);
- taosArrayDestroy(pPageIdList);
- return terrno;
- }
-
- int32_t size =
- blockDataGetSize(pDataBlock) + sizeof(int32_t) + taosArrayGetSize(pDataBlock->pDataBlock) * sizeof(int32_t);
- if (size > getBufPageSize(pHandle->pBuf)) {
- qError("sort failed at: %s:%d", __func__, __LINE__);
- return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
- }
-
- code= blockDataToBuf(pPage, pDataBlock);
- if (code) {
- return code;
- }
-
- setBufPageDirty(pPage, true);
- releaseBufPage(pHandle->pBuf, pPage);
- nMergedRows += pDataBlock->info.rows;
-
- blockDataCleanup(pDataBlock);
- if ((pHandle->mergeLimit != -1) && (nMergedRows >= pHandle->mergeLimit)) {
- break;
- }
- }
-
- code = sortComparCleanup(&pHandle->cmpParam);
- if (code) {
- return code;
- }
-
- tMergeTreeDestroy(&pHandle->pMergeTree);
- pHandle->numOfCompletedSources = 0;
-
- SSDataBlock* pBlock = NULL;
-
- code = createOneDataBlock(pHandle->pDataBlock, false, &pBlock);
- if (code) {
- taosArrayDestroy(pResList);
- return code;
- }
-
- code = doAddNewExternalMemSource(pHandle->pBuf, pResList, pBlock, &pHandle->sourceId, pPageIdList);
- if (code != TSDB_CODE_SUCCESS) {
- taosArrayDestroy(pResList);
- return code;
- }
+ code = doSortForEachGroup(pHandle, t, numOfSorted, numOfInputSources, pResList, sortGroup, numOfRows);
+ if (code != 0) {
+ tsortClearOrderedSource(pResList, NULL, NULL);
+ taosArrayDestroy(pResList);
+ return code;
}
- tsortClearOrderdSource(pHandle->pOrderedSource, NULL, NULL);
+ tsortClearOrderedSource(pHandle->pOrderedSource, NULL, NULL);
void* px = taosArrayAddAll(pHandle->pOrderedSource, pResList);
if (px == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
+ tsortClearOrderedSource(pResList, NULL, NULL);
+ taosArrayDestroy(pResList);
+ return terrno;
}
taosArrayDestroy(pResList);
-
numOfSorted = taosArrayGetSize(pHandle->pOrderedSource);
int64_t el = taosGetTimestampUs() - st;
@@ -2346,7 +2347,7 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
}
}
- tsortClearOrderdSource(pHandle->pOrderedSource, NULL, NULL);
+ tsortClearOrderedSource(pHandle->pOrderedSource, NULL, NULL);
if (!tsortIsClosed(pHandle)) {
void* px = taosArrayAddAll(pHandle->pOrderedSource, aExtSrc);
QUERY_CHECK_NULL(px, code, lino, _err, terrno);
@@ -2378,37 +2379,44 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
return code;
}
-static void freeSSortSource(SSortSource* source) {
- if (NULL == source) {
+static void freeSortSource(SSortSource* pSource) {
+ if (NULL == pSource) {
return;
}
- if (source->param && !source->onlyRef) {
- taosMemoryFree(source->param);
+ if (!pSource->onlyRef && pSource->param) {
+ taosMemoryFree(pSource->param);
}
- if (!source->onlyRef && source->src.pBlock) {
- blockDataDestroy(source->src.pBlock);
- source->src.pBlock = NULL;
+
+ if (!pSource->onlyRef && pSource->src.pBlock) {
+ blockDataDestroy(pSource->src.pBlock);
+ pSource->src.pBlock = NULL;
}
- taosMemoryFree(source);
+
+ taosMemoryFree(pSource);
}
static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
int32_t code = 0;
size_t sortBufSize = pHandle->numOfPages * pHandle->pageSize;
- SSortSource** pSource = taosArrayGet(pHandle->pOrderedSource, 0);
- if (pSource == NULL) {
+ SSortSource** p = taosArrayGet(pHandle->pOrderedSource, 0);
+ if (p == NULL) {
return terrno;
}
- SSortSource* source = *pSource;
- *pSource = NULL;
+ SSortSource* pSource = *p;
- tsortClearOrderdSource(pHandle->pOrderedSource, NULL, NULL);
+ taosArrayRemove(pHandle->pOrderedSource, 0);
+ tsortClearOrderedSource(pHandle->pOrderedSource, NULL, NULL);
while (1) {
SSDataBlock* pBlock = NULL;
- TAOS_CHECK_RETURN(pHandle->fetchfp(source->param, &pBlock));
+ code = pHandle->fetchfp(pSource->param, &pBlock);
+ if (code != 0) {
+ freeSortSource(pSource);
+ return code;
+ }
+
if (pBlock == NULL) {
break;
}
@@ -2422,7 +2430,7 @@ static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
sortBufSize = pHandle->numOfPages * pHandle->pageSize;
code = createOneDataBlock(pBlock, false, &pHandle->pDataBlock);
if (code) {
- freeSSortSource(source);
+ freeSortSource(pSource);
return code;
}
}
@@ -2433,47 +2441,45 @@ static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
code = blockDataMerge(pHandle->pDataBlock, pBlock);
if (code != TSDB_CODE_SUCCESS) {
- freeSSortSource(source);
+ freeSortSource(pSource);
return code;
}
size_t size = blockDataGetSize(pHandle->pDataBlock);
if (size > sortBufSize) {
// Perform the in-memory sort and then flush data in the buffer into disk.
- int64_t p = taosGetTimestampUs();
+ int64_t st = taosGetTimestampUs();
code = blockDataSort(pHandle->pDataBlock, pHandle->pSortInfo);
if (code != 0) {
- freeSSortSource(source);
+ freeSortSource(pSource);
return code;
}
- int64_t el = taosGetTimestampUs() - p;
- pHandle->sortElapsed += el;
+ pHandle->sortElapsed += (taosGetTimestampUs() - st);
+
if (pHandle->pqMaxRows > 0) blockDataKeepFirstNRows(pHandle->pDataBlock, pHandle->pqMaxRows);
code = doAddToBuf(pHandle->pDataBlock, pHandle);
if (code != TSDB_CODE_SUCCESS) {
- freeSSortSource(source);
+ freeSortSource(pSource);
return code;
}
}
}
- freeSSortSource(source);
+ freeSortSource(pSource);
if (pHandle->pDataBlock != NULL && pHandle->pDataBlock->info.rows > 0) {
size_t size = blockDataGetSize(pHandle->pDataBlock);
// Perform the in-memory sort and then flush data in the buffer into disk.
- int64_t p = taosGetTimestampUs();
-
+ int64_t st = taosGetTimestampUs();
code = blockDataSort(pHandle->pDataBlock, pHandle->pSortInfo);
if (code != 0) {
return code;
}
if (pHandle->pqMaxRows > 0) blockDataKeepFirstNRows(pHandle->pDataBlock, pHandle->pqMaxRows);
- int64_t el = taosGetTimestampUs() - p;
- pHandle->sortElapsed += el;
+ pHandle->sortElapsed += (taosGetTimestampUs() - st);
// All sorted data can fit in memory, external memory sort is not needed. Return to directly
if (size <= sortBufSize && pHandle->pBuf == NULL) {
@@ -2488,6 +2494,7 @@ static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) {
code = doAddToBuf(pHandle->pDataBlock, pHandle);
}
}
+
return code;
}
@@ -2500,7 +2507,7 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
code = createBlocksMergeSortInitialSources(pHandle);
}
- qDebug("%zu sources created", taosArrayGetSize(pHandle->pOrderedSource));
+ qDebug("%s %zu sources created", pHandle->idStr, taosArrayGetSize(pHandle->pOrderedSource));
return code;
}
diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h
index 77d6bda35b..16f31321ce 100644
--- a/source/libs/function/inc/builtinsimpl.h
+++ b/source/libs/function/inc/builtinsimpl.h
@@ -38,6 +38,7 @@ typedef struct SSumRes {
typedef struct SMinmaxResInfo {
bool assign; // assign the first value or not
int64_t v;
+ char *str;
STuplePos tuplePos;
STuplePos nullTuplePos;
diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h
index 2c5c7725d5..a50562d78d 100644
--- a/source/libs/function/inc/functionMgtInt.h
+++ b/source/libs/function/inc/functionMgtInt.h
@@ -24,7 +24,7 @@ extern "C" {
#define FUNCTION_NAME_MAX_LENGTH 32
-#define FUNC_MGT_FUNC_CLASSIFICATION_MASK(n) (1 << n)
+#define FUNC_MGT_FUNC_CLASSIFICATION_MASK(n) ((uint64_t)1 << n)
#define FUNC_MGT_AGG_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(0)
#define FUNC_MGT_SCALAR_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(1)
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index 17ba430150..3ec63a6d34 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -271,6 +271,21 @@ static int32_t addUint8Param(SNodeList** pList, uint8_t param) {
return TSDB_CODE_SUCCESS;
}
+static int32_t addPseudoParam(SNodeList** pList) {
+ SNode *pseudoNode = NULL;
+ int32_t code = nodesMakeNode(QUERY_NODE_LEFT_VALUE, &pseudoNode);
+ if (pseudoNode == NULL) {
+ return code;
+ }
+
+ code = nodesListMakeAppend(pList, pseudoNode);
+ if (TSDB_CODE_SUCCESS != code) {
+ nodesDestroyNode(pseudoNode);
+ return code;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static SDataType* getSDataTypeFromNode(SNode* pNode) {
if (pNode == NULL) return NULL;
if (nodesIsExprNode(pNode)) {
@@ -299,6 +314,25 @@ static int32_t translateInOutNum(SFunctionNode* pFunc, char* pErrBuf, int32_t le
return TSDB_CODE_SUCCESS;
}
+// There is only one parameter of numeric type, and the return type is parameter type
+static int32_t translateMinMax(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
+ if (1 != LIST_LENGTH(pFunc->pParameterList)) {
+ return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
+ }
+
+ SDataType* dataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0));
+ uint8_t paraType = dataType->type;
+ if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType) && !IS_STR_DATA_TYPE(paraType)) {
+ return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
+ } else if (IS_NULL_TYPE(paraType)) {
+ paraType = TSDB_DATA_TYPE_BIGINT;
+ }
+ pFunc->hasSMA = !IS_VAR_DATA_TYPE(paraType);
+ int32_t bytes = IS_STR_DATA_TYPE(paraType) ? dataType->bytes : tDataTypes[paraType].bytes;
+ pFunc->node.resType = (SDataType){.bytes = bytes, .type = paraType};
+ return TSDB_CODE_SUCCESS;
+}
+
// There is only one parameter of numeric type, and the return type is double type
static int32_t translateInNumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
if (1 != LIST_LENGTH(pFunc->pParameterList)) {
@@ -579,6 +613,30 @@ static int32_t translatePi(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
return TSDB_CODE_SUCCESS;
}
+static int32_t translateRand(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
+ if (0 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) {
+ return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
+ }
+
+ if (1 == LIST_LENGTH(pFunc->pParameterList)) {
+ uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type;
+ if (!IS_INTEGER_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
+ return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
+ }
+ }
+
+ if (!pFunc->dual) {
+ int32_t code = addPseudoParam(&pFunc->pParameterList);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+ }
+
+ pFunc->node.resType =
+ (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE};
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t translateRound(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
if (2 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) {
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
@@ -678,7 +736,7 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
// set result type
if (numOfParams > 2) {
- pFunc->node.resType = (SDataType){.bytes = 512, .type = TSDB_DATA_TYPE_VARCHAR};
+ pFunc->node.resType = (SDataType){.bytes = 3200, .type = TSDB_DATA_TYPE_VARCHAR};
} else {
pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE};
}
@@ -2904,7 +2962,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "min",
.type = FUNCTION_TYPE_MIN,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC,
- .translateFunc = translateInOutNum,
+ .translateFunc = translateMinMax,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getMinmaxFuncEnv,
.initFunc = minmaxFunctionSetup,
@@ -2920,7 +2978,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "max",
.type = FUNCTION_TYPE_MAX,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC,
- .translateFunc = translateInOutNum,
+ .translateFunc = translateMinMax,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getMinmaxFuncEnv,
.initFunc = minmaxFunctionSetup,
@@ -4729,6 +4787,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.sprocessFunc = weekofyearFunction,
.finalizeFunc = NULL
},
+ {
+ .name = "rand",
+ .type = FUNCTION_TYPE_RAND,
+ .classification = FUNC_MGT_SCALAR_FUNC,
+ .translateFunc = translateRand,
+ .getEnvFunc = NULL,
+ .initFunc = NULL,
+ .sprocessFunc = randFunction,
+ .finalizeFunc = NULL
+ },
};
// clang-format on
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index 84ab103456..6d655528c7 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -1026,6 +1026,7 @@ int32_t minmaxFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultIn
buf->nullTupleSaved = false;
buf->nullTuplePos.pageId = -1;
+ buf->str = NULL;
return TSDB_CODE_SUCCESS;
}
@@ -1101,11 +1102,21 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
colDataSetFloat(pCol, currentRow, &v);
break;
}
+ case TSDB_DATA_TYPE_VARBINARY:
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_NCHAR: {
+ code = colDataSetVal(pCol, currentRow, pRes->str, false);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ break;
+ }
}
} else {
colDataSetNULL(pCol, currentRow);
}
+ taosMemoryFreeClear(pRes->str);
if (pCtx->subsidiaries.num > 0) {
if (pEntryInfo->numOfRes > 0) {
code = setSelectivityValue(pCtx, pBlock, &pRes->tuplePos, currentRow);
@@ -2105,7 +2116,8 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
tMemBucket* pMemBucket = ppInfo->pMemBucket;
if (pMemBucket != NULL && pMemBucket->total > 0) { // check for null
if (pCtx->numOfParams > 2) {
- char buf[512] = {0};
+ char buf[3200] = {0};
+ // max length of double num is 317, e.g. use %.6lf to print -1.0e+308, consider the comma and bracket, 3200 is enough.
size_t len = 1;
varDataVal(buf)[0] = '[';
@@ -2154,6 +2166,8 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
tMemBucketDestroy(pMemBucket);
return functionFinalize(pCtx, pBlock);
}
+ } else {
+ return functionFinalize(pCtx, pBlock);
}
_fin_error:
@@ -3162,7 +3176,7 @@ static int32_t doSaveLastrow(SqlFunctionCtx* pCtx, char* pData, int32_t rowIndex
(void)memcpy(pInfo->buf, pData, pInfo->bytes);
}
- if (pCtx->hasPrimaryKey) {
+ if (pCtx->hasPrimaryKey && !colDataIsNull_s(pkCol, rowIndex)) {
char* pkData = colDataGetData(pkCol, rowIndex);
if (IS_VAR_DATA_TYPE(pInfo->pkType)) {
pInfo->pkBytes = varDataTLen(pkData);
@@ -6008,6 +6022,7 @@ int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
pInfo->buf = taosMemoryMalloc(pInfo->colBytes);
if (NULL == pInfo->buf) {
taosHashCleanup(pInfo->pHash);
+ pInfo->pHash = NULL;
return TSDB_CODE_OUT_OF_MEMORY;
}
@@ -6016,6 +6031,7 @@ int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
static void modeFunctionCleanup(SModeInfo * pInfo) {
taosHashCleanup(pInfo->pHash);
+ pInfo->pHash = NULL;
taosMemoryFreeClear(pInfo->buf);
}
@@ -6434,63 +6450,74 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) {
int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDistInfo* pInfo) {
SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
tEncoderInit(&encoder, buf, bufLen);
- if (tStartEncode(&encoder) < 0) return -1;
- if (tEncodeU32(&encoder, pInfo->rowSize) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->rowSize));
- if (tEncodeU16(&encoder, pInfo->numOfFiles) < 0) return -1;
- if (tEncodeU32(&encoder, pInfo->numOfBlocks) < 0) return -1;
- if (tEncodeU32(&encoder, pInfo->numOfTables) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeU16(&encoder, pInfo->numOfFiles));
+ TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfBlocks));
+ TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfTables));
- if (tEncodeU64(&encoder, pInfo->totalSize) < 0) return -1;
- if (tEncodeU64(&encoder, pInfo->totalRows) < 0) return -1;
- if (tEncodeI32(&encoder, pInfo->maxRows) < 0) return -1;
- if (tEncodeI32(&encoder, pInfo->minRows) < 0) return -1;
- if (tEncodeI32(&encoder, pInfo->defMaxRows) < 0) return -1;
- if (tEncodeI32(&encoder, pInfo->defMinRows) < 0) return -1;
- if (tEncodeU32(&encoder, pInfo->numOfInmemRows) < 0) return -1;
- if (tEncodeU32(&encoder, pInfo->numOfSttRows) < 0) return -1;
- if (tEncodeU32(&encoder, pInfo->numOfVgroups) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, pInfo->totalSize));
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, pInfo->totalRows));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->maxRows));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->minRows));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->defMaxRows));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->defMinRows));
+ TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfInmemRows));
+ TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfSttRows));
+ TAOS_CHECK_EXIT(tEncodeU32(&encoder, pInfo->numOfVgroups));
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
- if (tEncodeI32(&encoder, pInfo->blockRowsHisto[i]) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pInfo->blockRowsHisto[i]));
}
tEndEncode(&encoder);
- int32_t tlen = encoder.pos;
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo* pInfo) {
SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
tDecoderInit(&decoder, buf, bufLen);
- if (tStartDecode(&decoder) < 0) return -1;
- if (tDecodeU32(&decoder, &pInfo->rowSize) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->rowSize));
- if (tDecodeU16(&decoder, &pInfo->numOfFiles) < 0) return -1;
- if (tDecodeU32(&decoder, &pInfo->numOfBlocks) < 0) return -1;
- if (tDecodeU32(&decoder, &pInfo->numOfTables) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeU16(&decoder, &pInfo->numOfFiles));
+ TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfBlocks));
+ TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfTables));
- if (tDecodeU64(&decoder, &pInfo->totalSize) < 0) return -1;
- if (tDecodeU64(&decoder, &pInfo->totalRows) < 0) return -1;
- if (tDecodeI32(&decoder, &pInfo->maxRows) < 0) return -1;
- if (tDecodeI32(&decoder, &pInfo->minRows) < 0) return -1;
- if (tDecodeI32(&decoder, &pInfo->defMaxRows) < 0) return -1;
- if (tDecodeI32(&decoder, &pInfo->defMinRows) < 0) return -1;
- if (tDecodeU32(&decoder, &pInfo->numOfInmemRows) < 0) return -1;
- if (tDecodeU32(&decoder, &pInfo->numOfSttRows) < 0) return -1;
- if (tDecodeU32(&decoder, &pInfo->numOfVgroups) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pInfo->totalSize));
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pInfo->totalRows));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->maxRows));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->minRows));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->defMaxRows));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->defMinRows));
+ TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfInmemRows));
+ TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfSttRows));
+ TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pInfo->numOfVgroups));
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
- if (tDecodeI32(&decoder, &pInfo->blockRowsHisto[i]) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pInfo->blockRowsHisto[i]));
}
+_exit:
tDecoderClear(&decoder);
- return 0;
+ return code;
}
int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c
index b316b7a512..608f3bf260 100644
--- a/source/libs/function/src/detail/tminmax.c
+++ b/source/libs/function/src/detail/tminmax.c
@@ -15,6 +15,7 @@
#include "builtinsimpl.h"
#include "function.h"
+#include "tcompare.h"
#include "tdatablock.h"
#include "tfunctionInt.h"
#include "tglobal.h"
@@ -365,10 +366,10 @@ static double doubleVectorCmpAVX(const double* pData, int32_t numOfRows, bool is
return v;
}
-static int32_t findFirstValPosition(const SColumnInfoData* pCol, int32_t start, int32_t numOfRows) {
+static int32_t findFirstValPosition(const SColumnInfoData* pCol, int32_t start, int32_t numOfRows, bool isStr) {
int32_t i = start;
- while (i < (start + numOfRows) && (colDataIsNull_f(pCol->nullbitmap, i) == true)) {
+ while (i < (start + numOfRows) && (isStr ? colDataIsNull_s(pCol, i) : colDataIsNull_f(pCol->nullbitmap, i) == true)) {
i += 1;
}
@@ -643,6 +644,52 @@ static int32_t doExtractVal(SColumnInfoData* pCol, int32_t i, int32_t end, SqlFu
__COMPARE_ACQUIRED_MIN(i, end, pCol->nullbitmap, pData, pCtx, *(double*)&(pBuf->v), &pBuf->tuplePos)
break;
}
+
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_VARBINARY: {
+ int32_t code = TSDB_CODE_SUCCESS;
+ for (; i < (end); ++i) {
+ if (colDataIsNull_var(pCol, i)) {
+ continue;
+ }
+ char *pLeft = (char *)colDataGetData(pCol, i);
+ char *pRight = (char *)pBuf->str;
+
+ int32_t ret = compareLenBinaryVal(pLeft, pRight);
+ if (ret < 0) {
+ memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
+ if (pCtx->subsidiaries.num > 0) {
+ code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ }
+ }
+ }
+ break;
+ }
+ case TSDB_DATA_TYPE_NCHAR: {
+ int32_t code = TSDB_CODE_SUCCESS;
+ for (; i < (end); ++i) {
+ if (colDataIsNull_var(pCol, i)) {
+ continue;
+ }
+ char *pLeft = (char *)colDataGetData(pCol, i);
+ char *pRight = (char *)pBuf->str;
+
+ int32_t ret = compareLenPrefixedWStr(pLeft, pRight);
+ if (ret < 0) {
+ memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
+ if (pCtx->subsidiaries.num > 0) {
+ code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ }
+ }
+ }
+ break;
+ }
}
} else {
switch (pCol->info.type) {
@@ -706,6 +753,53 @@ static int32_t doExtractVal(SColumnInfoData* pCol, int32_t i, int32_t end, SqlFu
__COMPARE_ACQUIRED_MAX(i, end, pCol->nullbitmap, pData, pCtx, *(double*)&(pBuf->v), &pBuf->tuplePos)
break;
}
+
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_VARBINARY: {
+ int32_t code = TSDB_CODE_SUCCESS;
+ for (; i < (end); ++i) {
+ if (colDataIsNull_var(pCol, i)) {
+ continue;
+ }
+ char *pLeft = (char *)colDataGetData(pCol, i);
+ char *pRight = (char *)pBuf->str;
+
+ int32_t ret = compareLenBinaryVal(pLeft, pRight);
+ if (ret > 0) {
+ memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
+ if (pCtx->subsidiaries.num > 0) {
+ code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ case TSDB_DATA_TYPE_NCHAR: {
+ int32_t code = TSDB_CODE_SUCCESS;
+ for (; i < (end); ++i) {
+ if (colDataIsNull_var(pCol, i)) {
+ continue;
+ }
+ char *pLeft = (char *)colDataGetData(pCol, i);
+ char *pRight = (char *)pBuf->str;
+
+ int32_t ret = compareLenPrefixedWStr(pLeft, pRight);
+ if (ret > 0) {
+ memcpy(pBuf->str, pLeft, varDataTLen(pLeft));
+ if (pCtx->subsidiaries.num > 0) {
+ code = updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ }
+ }
+ }
+ break;
+ }
}
}
return TSDB_CODE_SUCCESS;
@@ -743,7 +837,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
}
// data in current data block are qualified to the query
- if (pInput->colDataSMAIsSet) {
+ if (pInput->colDataSMAIsSet && !IS_STR_DATA_TYPE(type)) {
numOfElems = pInput->numOfRows - pAgg->numOfNull;
if (numOfElems == 0) {
@@ -820,7 +914,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
// clang-format on
if (pCol->hasNull || numOfRows < threshold[pCol->info.type] || pCtx->subsidiaries.num > 0) {
- int32_t i = findFirstValPosition(pCol, start, numOfRows);
+ int32_t i = findFirstValPosition(pCol, start, numOfRows, IS_STR_DATA_TYPE(type));
if ((i < end) && (!pBuf->assign)) {
char* p = pCol->pData + pCol->info.bytes * i;
@@ -848,6 +942,16 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
*(float*)&pBuf->v = *(float*)p;
break;
}
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_VARBINARY:
+ case TSDB_DATA_TYPE_NCHAR: {
+ pBuf->str = taosMemoryMalloc(pCol->info.bytes);
+ if (pBuf->str == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ (void)memcpy(pBuf->str, colDataGetData(pCol, i), varDataTLen(colDataGetData(pCol, i)));
+ break;
+ }
default:
(void)memcpy(&pBuf->v, p, pCol->info.bytes);
break;
diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c
index 2f71ab8e24..1a927a1576 100644
--- a/source/libs/function/src/functionMgt.c
+++ b/source/libs/function/src/functionMgt.c
@@ -431,7 +431,9 @@ static int32_t createPartialFunction(const SFunctionNode* pSrcFunc, SFunctionNod
(*pPartialFunc)->originalFuncId = pSrcFunc->hasOriginalFunc ? pSrcFunc->originalFuncId : pSrcFunc->funcId;
char name[TSDB_FUNC_NAME_LEN + TSDB_NAME_DELIMITER_LEN + TSDB_POINTER_PRINT_BYTES + 1] = {0};
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%p", (*pPartialFunc)->functionName, pSrcFunc);
- (void)taosHashBinary(name, len);
+ if (taosHashBinary(name, len) < 0) {
+ return TSDB_CODE_FAILED;
+ }
(void)strncpy((*pPartialFunc)->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
(*pPartialFunc)->hasPk = pSrcFunc->hasPk;
(*pPartialFunc)->pkBytes = pSrcFunc->pkBytes;
diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c
index adcce879eb..b17af44260 100644
--- a/source/libs/function/src/udfd.c
+++ b/source/libs/function/src/udfd.c
@@ -524,7 +524,12 @@ void udfdDeinitScriptPlugins() {
void udfdProcessRequest(uv_work_t *req) {
SUvUdfWork *uvUdf = (SUvUdfWork *)(req->data);
SUdfRequest request = {0};
- if(decodeUdfRequest(uvUdf->input.base, &request) == NULL) return;
+ if(decodeUdfRequest(uvUdf->input.base, &request) == NULL)
+ {
+ taosMemoryFree(uvUdf->input.base);
+ fnError("udf request decode failed");
+ return;
+ }
switch (request.type) {
case UDF_TASK_SETUP: {
diff --git a/source/libs/parser/inc/parTranslater.h b/source/libs/parser/inc/parTranslater.h
index 99e303e51c..93d6645e12 100644
--- a/source/libs/parser/inc/parTranslater.h
+++ b/source/libs/parser/inc/parTranslater.h
@@ -45,6 +45,7 @@ typedef struct STranslateContext {
bool showRewrite;
SNode* pPrevRoot;
SNode* pPostRoot;
+ bool dual; // whether select stmt without from stmt, true for without.
} STranslateContext;
int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRet);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index f2a3692f78..4e53747e5b 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -1207,11 +1207,15 @@ function_expression(A) ::=
substr_func(B) NK_LP expr_or_subquery(C) FROM expr_or_subquery(D) FOR expr_or_subquery(E) NK_RP(F). { A = createRawExprNodeExt(pCxt, &B, &F, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), releaseRawExprNode(pCxt, E))); }
function_expression(A) ::= REPLACE(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
function_expression(A) ::= literal_func(B). { A = B; }
+function_expression(A) ::= rand_func(B). { A = B; }
literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
literal_func(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
literal_func(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
+rand_func(A) ::= RAND(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
+rand_func(A) ::= RAND(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
+
%type substr_func { SToken }
%destructor substr_func { }
substr_func(A) ::= SUBSTR(B). { A = B; }
diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c
index a8db514ee3..9412735ded 100644
--- a/source/libs/parser/src/parInsertSql.c
+++ b/source/libs/parser/src/parInsertSql.c
@@ -2254,10 +2254,16 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt
static int32_t parseDataFromFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SToken* pFilePath,
SRowsDataContext rowsDataCxt) {
- char filePathStr[PATH_MAX] = {0};
+ char filePathStr[PATH_MAX + 16] = {0};
if (TK_NK_STRING == pFilePath->type) {
(void)trimString(pFilePath->z, pFilePath->n, filePathStr, sizeof(filePathStr));
+ if (strlen(filePathStr) >= PATH_MAX) {
+ return buildSyntaxErrMsg(&pCxt->msg, "file path is too long, max length is 4096", pFilePath->z);
+ }
} else {
+ if (pFilePath->n >= PATH_MAX) {
+ return buildSyntaxErrMsg(&pCxt->msg, "file path is too long, max length is 4096", pFilePath->z);
+ }
strncpy(filePathStr, pFilePath->z, pFilePath->n);
}
pStmt->fp = taosOpenFile(filePathStr, TD_FILE_READ | TD_FILE_STREAM);
diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c
index 025459a8c9..5b459243a4 100644
--- a/source/libs/parser/src/parInsertStmt.c
+++ b/source/libs/parser/src/parInsertStmt.c
@@ -448,7 +448,407 @@ int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bi
pBind = bind;
}
- code = tColDataAddValueByBind(pCol, pBind, IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1);
+ code = tColDataAddValueByBind(pCol, pBind,
+ IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1);
+
+ qDebug("stmt col %d bind %d rows data", colIdx, rowNum);
+
+_return:
+
+ taosMemoryFree(ncharBind.buffer);
+ taosMemoryFree(ncharBind.length);
+
+ return code;
+}
+
+int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName,
+ TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen) {
+ STableDataCxt* pDataBlock = (STableDataCxt*)pBlock;
+ SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen};
+ int32_t code = TSDB_CODE_SUCCESS;
+ SBoundColInfo* tags = (SBoundColInfo*)boundTags;
+ if (NULL == tags) {
+ return TSDB_CODE_APP_ERROR;
+ }
+
+ SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal));
+ if (!pTagArray) {
+ return buildInvalidOperationMsg(&pBuf, "out of memory");
+ }
+
+ SArray* tagName = taosArrayInit(8, TSDB_COL_NAME_LEN);
+ if (!tagName) {
+ code = buildInvalidOperationMsg(&pBuf, "out of memory");
+ goto end;
+ }
+
+ SSchema* pSchema = getTableTagSchema(pDataBlock->pMeta);
+
+ bool isJson = false;
+ STag* pTag = NULL;
+
+ for (int c = 0; c < tags->numOfBound; ++c) {
+ if (bind[c].is_null && bind[c].is_null[0]) {
+ continue;
+ }
+
+ SSchema* pTagSchema = &pSchema[tags->pColIndex[c]];
+ int32_t colLen = pTagSchema->bytes;
+ if (IS_VAR_DATA_TYPE(pTagSchema->type)) {
+ colLen = bind[c].length[0];
+ if ((colLen + VARSTR_HEADER_SIZE) > pTagSchema->bytes) {
+ code = buildInvalidOperationMsg(&pBuf, "tag length is too big");
+ goto end;
+ }
+ }
+ if (NULL == taosArrayPush(tagName, pTagSchema->name)) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto end;
+ }
+ if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
+ if (colLen > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
+ code = buildSyntaxErrMsg(&pBuf, "json string too long than 4095", bind[c].buffer);
+ goto end;
+ }
+
+ isJson = true;
+ char* tmp = taosMemoryCalloc(1, colLen + 1);
+ memcpy(tmp, bind[c].buffer, colLen);
+ code = parseJsontoTagData(tmp, pTagArray, &pTag, &pBuf);
+ taosMemoryFree(tmp);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto end;
+ }
+ } else {
+ STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type};
+ // strcpy(val.colName, pTagSchema->name);
+ if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || pTagSchema->type == TSDB_DATA_TYPE_VARBINARY ||
+ pTagSchema->type == TSDB_DATA_TYPE_GEOMETRY) {
+ val.pData = (uint8_t*)bind[c].buffer;
+ val.nData = colLen;
+ } else if (pTagSchema->type == TSDB_DATA_TYPE_NCHAR) {
+ int32_t output = 0;
+ void* p = taosMemoryCalloc(1, colLen * TSDB_NCHAR_SIZE);
+ if (p == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto end;
+ }
+ if (!taosMbsToUcs4(bind[c].buffer, colLen, (TdUcs4*)(p), colLen * TSDB_NCHAR_SIZE, &output)) {
+ if (errno == E2BIG) {
+ taosMemoryFree(p);
+ code = generateSyntaxErrMsg(&pBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pTagSchema->name);
+ goto end;
+ }
+ char buf[512] = {0};
+ snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno));
+ taosMemoryFree(p);
+ code = buildSyntaxErrMsg(&pBuf, buf, bind[c].buffer);
+ goto end;
+ }
+ val.pData = p;
+ val.nData = output;
+ } else {
+ memcpy(&val.i64, bind[c].buffer, colLen);
+ }
+ if (NULL == taosArrayPush(pTagArray, &val)) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto end;
+ }
+ }
+ }
+
+ if (!isJson && (code = tTagNew(pTagArray, 1, false, &pTag)) != TSDB_CODE_SUCCESS) {
+ goto end;
+ }
+
+ if (NULL == pDataBlock->pData->pCreateTbReq) {
+ pDataBlock->pData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
+ if (NULL == pDataBlock->pData->pCreateTbReq) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto end;
+ }
+ }
+
+ insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName,
+ pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL);
+ pTag = NULL;
+
+end:
+ for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) {
+ STagVal* p = (STagVal*)taosArrayGet(pTagArray, i);
+ if (p->type == TSDB_DATA_TYPE_NCHAR) {
+ taosMemoryFreeClear(p->pData);
+ }
+ }
+ taosArrayDestroy(pTagArray);
+ taosArrayDestroy(tagName);
+ taosMemoryFree(pTag);
+
+ return code;
+}
+
+static int32_t convertStmtStbNcharCol2(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_STMT2_BIND* src, TAOS_STMT2_BIND* dst) {
+ int32_t output = 0;
+ const int32_t max_buf_len = pSchema->bytes - VARSTR_HEADER_SIZE;
+
+ dst->buffer = taosMemoryCalloc(src->num, max_buf_len);
+ if (NULL == dst->buffer) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ dst->length = taosMemoryCalloc(src->num, sizeof(int32_t));
+ if (NULL == dst->length) {
+ taosMemoryFreeClear(dst->buffer);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ char* src_buf = src->buffer;
+ char* dst_buf = dst->buffer;
+ for (int32_t i = 0; i < src->num; ++i) {
+ if (src->is_null && src->is_null[i]) {
+ continue;
+ }
+
+ if (!taosMbsToUcs4(src_buf, src->length[i], (TdUcs4*)dst_buf, max_buf_len, &output)) {
+ if (errno == E2BIG) {
+ return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
+ }
+ char buf[512] = {0};
+ snprintf(buf, tListLen(buf), "%s", strerror(errno));
+ return buildSyntaxErrMsg(pMsgBuf, buf, NULL);
+ }
+
+ dst->length[i] = output;
+ src_buf += src->length[i];
+ dst_buf += output;
+ }
+
+ dst->buffer_type = src->buffer_type;
+ dst->is_null = src->is_null;
+ dst->num = src->num;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t qBindStmtStbColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
+ STSchema** pTSchema, SBindInfo2* pBindInfos) {
+ STableDataCxt* pDataBlock = (STableDataCxt*)pBlock;
+ SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta);
+ SBoundColInfo* boundInfo = &pDataBlock->boundColsInfo;
+ SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen};
+ int32_t rowNum = bind->num;
+ SArray* ncharBinds = NULL;
+ TAOS_STMT2_BIND ncharBind = {0};
+ int32_t code = 0;
+ int16_t lastColId = -1;
+ bool colInOrder = true;
+
+ if (NULL == *pTSchema) {
+ *pTSchema = tBuildTSchema(pSchema, pDataBlock->pMeta->tableInfo.numOfColumns, pDataBlock->pMeta->sversion);
+ }
+
+ for (int c = 0; c < boundInfo->numOfBound; ++c) {
+ SSchema* pColSchema = &pSchema[boundInfo->pColIndex[c]];
+ if (pColSchema->colId <= lastColId) {
+ colInOrder = false;
+ } else {
+ lastColId = pColSchema->colId;
+ }
+
+ if (bind[c].num != rowNum) {
+ code = buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same");
+ goto _return;
+ }
+
+ if ((!(rowNum == 1 && bind[c].is_null && *bind[c].is_null)) &&
+ bind[c].buffer_type != pColSchema->type) { // for rowNum ==1 , connector may not set buffer_type
+ code = buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type");
+ goto _return;
+ }
+
+ if (TSDB_DATA_TYPE_NCHAR == pColSchema->type) {
+ code = convertStmtStbNcharCol2(&pBuf, pColSchema, bind + c, &ncharBind);
+ if (code) {
+ goto _return;
+ }
+ if (!ncharBinds) {
+ ncharBinds = taosArrayInit(1, sizeof(ncharBind));
+ if (!ncharBinds) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _return;
+ }
+ }
+ if (!taosArrayPush(ncharBinds, &ncharBind)) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _return;
+ }
+ pBindInfos[c].bind = taosArrayGetLast(ncharBinds);
+ } else {
+ pBindInfos[c].bind = bind + c;
+ }
+
+ pBindInfos[c].columnId = pColSchema->colId;
+ pBindInfos[c].type = pColSchema->type;
+ pBindInfos[c].bytes = pColSchema->bytes;
+ }
+
+ code = tRowBuildFromBind2(pBindInfos, boundInfo->numOfBound, colInOrder, *pTSchema, pCols);
+
+ qDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum);
+
+_return:
+ if (ncharBinds) {
+ for (int i = 0; i < TARRAY_SIZE(ncharBinds); ++i) {
+ TAOS_STMT2_BIND* ncBind = TARRAY_DATA(ncharBinds);
+ taosMemoryFree(ncBind[i].buffer);
+ taosMemoryFree(ncBind[i].length);
+ }
+ taosArrayDestroy(ncharBinds);
+ }
+
+ return code;
+}
+
+static int32_t convertStmtNcharCol2(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_STMT2_BIND* src, TAOS_STMT2_BIND* dst) {
+ int32_t output = 0;
+ const int32_t max_buf_len = pSchema->bytes - VARSTR_HEADER_SIZE;
+
+ int32_t newBuflen = (pSchema->bytes - VARSTR_HEADER_SIZE) * src->num;
+ // if (dst->buffer_length < newBuflen) {
+ dst->buffer = taosMemoryRealloc(dst->buffer, newBuflen);
+ if (NULL == dst->buffer) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ //}
+
+ if (NULL == dst->length) {
+ dst->length = taosMemoryRealloc(dst->length, sizeof(int32_t) * src->num);
+ if (NULL == dst->length) {
+ taosMemoryFreeClear(dst->buffer);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ // dst->buffer_length = pSchema->bytes - VARSTR_HEADER_SIZE;
+ char* src_buf = src->buffer;
+ char* dst_buf = dst->buffer;
+ for (int32_t i = 0; i < src->num; ++i) {
+ if (src->is_null && src->is_null[i]) {
+ continue;
+ }
+
+ /*if (!taosMbsToUcs4(((char*)src->buffer) + src->buffer_length * i, src->length[i],
+ (TdUcs4*)(((char*)dst->buffer) + dst->buffer_length * i), dst->buffer_length, &output)) {*/
+ if (!taosMbsToUcs4(src_buf, src->length[i], (TdUcs4*)dst_buf, max_buf_len, &output)) {
+ if (errno == E2BIG) {
+ return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
+ }
+ char buf[512] = {0};
+ snprintf(buf, tListLen(buf), "%s", strerror(errno));
+ return buildSyntaxErrMsg(pMsgBuf, buf, NULL);
+ }
+
+ dst->length[i] = output;
+ src_buf += src->length[i];
+ dst_buf += output;
+ }
+
+ dst->buffer_type = src->buffer_type;
+ dst->is_null = src->is_null;
+ dst->num = src->num;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen) {
+ STableDataCxt* pDataBlock = (STableDataCxt*)pBlock;
+ SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta);
+ SBoundColInfo* boundInfo = &pDataBlock->boundColsInfo;
+ SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen};
+ int32_t rowNum = bind->num;
+ TAOS_STMT2_BIND ncharBind = {0};
+ TAOS_STMT2_BIND* pBind = NULL;
+ int32_t code = 0;
+
+ for (int c = 0; c < boundInfo->numOfBound; ++c) {
+ SSchema* pColSchema = &pSchema[boundInfo->pColIndex[c]];
+ SColData* pCol = taosArrayGet(pCols, c);
+
+ if (bind[c].num != rowNum) {
+ code = buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same");
+ goto _return;
+ }
+
+ if ((!(rowNum == 1 && bind[c].is_null && *bind[c].is_null)) &&
+ bind[c].buffer_type != pColSchema->type) { // for rowNum ==1 , connector may not set buffer_type
+ code = buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type");
+ goto _return;
+ }
+
+ if (TSDB_DATA_TYPE_NCHAR == pColSchema->type) {
+ code = convertStmtNcharCol2(&pBuf, pColSchema, bind + c, &ncharBind);
+ if (code) {
+ goto _return;
+ }
+ pBind = &ncharBind;
+ } else {
+ pBind = bind + c;
+ }
+
+ code = tColDataAddValueByBind2(pCol, pBind,
+ IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1);
+ if (code) {
+ goto _return;
+ }
+ }
+
+ qDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum);
+
+_return:
+
+ taosMemoryFree(ncharBind.buffer);
+ taosMemoryFree(ncharBind.length);
+
+ return code;
+}
+
+int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
+ int32_t colIdx, int32_t rowNum) {
+ STableDataCxt* pDataBlock = (STableDataCxt*)pBlock;
+ SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta);
+ SBoundColInfo* boundInfo = &pDataBlock->boundColsInfo;
+ SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen};
+ SSchema* pColSchema = &pSchema[boundInfo->pColIndex[colIdx]];
+ SColData* pCol = taosArrayGet(pCols, colIdx);
+ TAOS_STMT2_BIND ncharBind = {0};
+ TAOS_STMT2_BIND* pBind = NULL;
+ int32_t code = 0;
+
+ if (bind->num != rowNum) {
+ return buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same");
+ }
+
+ // Column index exceeds the number of columns
+ if (colIdx >= pCols->size && pCol == NULL) {
+ return buildInvalidOperationMsg(&pBuf, "column index exceeds the number of columns");
+ }
+
+ if (bind->buffer_type != pColSchema->type) {
+ return buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type");
+ }
+
+ if (TSDB_DATA_TYPE_NCHAR == pColSchema->type) {
+ code = convertStmtNcharCol2(&pBuf, pColSchema, bind, &ncharBind);
+ if (code) {
+ goto _return;
+ }
+ pBind = &ncharBind;
+ } else {
+ pBind = bind;
+ }
+
+ code = tColDataAddValueByBind2(pCol, pBind,
+ IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1);
qDebug("stmt col %d bind %d rows data", colIdx, rowNum);
@@ -533,7 +933,7 @@ int32_t qResetStmtColumns(SArray* pCols, bool deepClear) {
for (int32_t i = 0; i < colNum; ++i) {
SColData* pCol = (SColData*)taosArrayGet(pCols, i);
- if (pCol == NULL){
+ if (pCol == NULL) {
qError("qResetStmtColumns column is NULL");
return TSDB_CODE_OUT_OF_MEMORY;
}
@@ -553,7 +953,7 @@ int32_t qResetStmtDataBlock(STableDataCxt* block, bool deepClear) {
for (int32_t i = 0; i < colNum; ++i) {
SColData* pCol = (SColData*)taosArrayGet(pBlock->pData->aCol, i);
- if (pCol == NULL){
+ if (pCol == NULL) {
qError("qResetStmtDataBlock column is NULL");
return TSDB_CODE_OUT_OF_MEMORY;
}
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 7422e86345..5857093cec 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -206,6 +206,7 @@ static SKeyword keywordTable[] = {
{"QUERIES", TK_QUERIES},
{"QUERY", TK_QUERY},
{"PI", TK_PI},
+ {"RAND", TK_RAND},
{"RANGE", TK_RANGE},
{"RATIO", TK_RATIO},
{"PAUSE", TK_PAUSE},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 62943cb6d5..a0b8c13e58 100755
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -2307,6 +2307,7 @@ static bool hasInvalidFuncNesting(SNodeList* pParameterList) {
static int32_t getFuncInfo(STranslateContext* pCxt, SFunctionNode* pFunc) {
// the time precision of the function execution environment
+ pFunc->dual = pCxt->dual;
pFunc->node.resType.precision = getPrecisionFromCurrStmt(pCxt->pCurrStmt, TSDB_TIME_PRECISION_MILLI);
int32_t code = fmGetFuncInfo(pFunc, pCxt->msgBuf.buf, pCxt->msgBuf.len);
if (TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION == code) {
@@ -6696,11 +6697,13 @@ static int32_t replaceOrderByAliasForSelect(STranslateContext* pCxt, SSelectStmt
static int32_t translateSelectWithoutFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
pCxt->pCurrStmt = (SNode*)pSelect;
pCxt->currClause = SQL_CLAUSE_SELECT;
+ pCxt->dual = true;
return translateExprList(pCxt, pSelect->pProjectionList);
}
static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
pCxt->pCurrStmt = (SNode*)pSelect;
+ pCxt->dual = false;
int32_t code = translateFrom(pCxt, &pSelect->pFromTable);
if (TSDB_CODE_SUCCESS == code) {
pSelect->precision = ((STableNode*)pSelect->pFromTable)->precision;
diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c
index e96aaf52ed..b78cd36f0e 100644
--- a/source/libs/parser/src/parser.c
+++ b/source/libs/parser/src/parser.c
@@ -76,33 +76,33 @@ bool qIsCreateTbFromFileSql(const char* pStr, size_t length) {
}
bool qParseDbName(const char* pStr, size_t length, char** pDbName) {
- (void) length;
+ (void)length;
int32_t index = 0;
- SToken t;
+ SToken t;
if (NULL == pStr) {
*pDbName = NULL;
return false;
}
- t = tStrGetToken((char *) pStr, &index, false, NULL);
+ t = tStrGetToken((char*)pStr, &index, false, NULL);
if (TK_INSERT != t.type && TK_IMPORT != t.type) {
*pDbName = NULL;
return false;
}
- t = tStrGetToken((char *) pStr, &index, false, NULL);
+ t = tStrGetToken((char*)pStr, &index, false, NULL);
if (TK_INTO != t.type) {
*pDbName = NULL;
return false;
}
- t = tStrGetToken((char *) pStr, &index, false, NULL);
+ t = tStrGetToken((char*)pStr, &index, false, NULL);
if (t.n == 0 || t.z == NULL) {
*pDbName = NULL;
return false;
}
- char *dotPos = strnchr(t.z, '.', t.n, true);
+ char* dotPos = strnchr(t.z, '.', t.n, true);
if (dotPos != NULL) {
int dbNameLen = dotPos - t.z;
*pDbName = taosMemoryMalloc(dbNameLen + 1);
@@ -331,13 +331,12 @@ int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, SSDataBlock
return code;
}
-
-static void destoryTablesReq(void *p) {
- STablesReq *pRes = (STablesReq *)p;
+static void destoryTablesReq(void* p) {
+ STablesReq* pRes = (STablesReq*)p;
taosArrayDestroy(pRes->pTables);
}
-void destoryCatalogReq(SCatalogReq *pCatalogReq) {
+void destoryCatalogReq(SCatalogReq* pCatalogReq) {
if (NULL == pCatalogReq) {
return;
}
@@ -369,7 +368,6 @@ void destoryCatalogReq(SCatalogReq *pCatalogReq) {
taosArrayDestroy(pCatalogReq->pTableTag);
}
-
void tfreeSParseQueryRes(void* p) {
if (NULL == p) {
return;
@@ -410,9 +408,7 @@ int32_t qSetSTableIdForRsma(SNode* pStmt, int64_t uid) {
return TSDB_CODE_FAILED;
}
-int32_t qInitKeywordsTable() {
- return taosInitKeywordsTable();
-}
+int32_t qInitKeywordsTable() { return taosInitKeywordsTable(); }
void qCleanupKeywordsTable() { taosCleanupKeywordsTable(); }
@@ -445,6 +441,98 @@ int32_t qStmtBindParams(SQuery* pQuery, TAOS_MULTI_BIND* pParams, int32_t colIdx
return code;
}
+static int32_t setValueByBindParam2(SValueNode* pVal, TAOS_STMT2_BIND* pParam) {
+ if (IS_VAR_DATA_TYPE(pVal->node.resType.type)) {
+ taosMemoryFreeClear(pVal->datum.p);
+ }
+
+ if (pParam->is_null && 1 == *(pParam->is_null)) {
+ pVal->node.resType.type = TSDB_DATA_TYPE_NULL;
+ pVal->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_NULL].bytes;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ int32_t inputSize = (NULL != pParam->length ? *(pParam->length) : tDataTypes[pParam->buffer_type].bytes);
+ pVal->node.resType.type = pParam->buffer_type;
+ pVal->node.resType.bytes = inputSize;
+
+ switch (pParam->buffer_type) {
+ case TSDB_DATA_TYPE_VARBINARY:
+ pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
+ if (NULL == pVal->datum.p) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ varDataSetLen(pVal->datum.p, pVal->node.resType.bytes);
+ memcpy(varDataVal(pVal->datum.p), pParam->buffer, pVal->node.resType.bytes);
+ pVal->node.resType.bytes += VARSTR_HEADER_SIZE;
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_GEOMETRY:
+ pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
+ if (NULL == pVal->datum.p) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ varDataSetLen(pVal->datum.p, pVal->node.resType.bytes);
+ strncpy(varDataVal(pVal->datum.p), (const char*)pParam->buffer, pVal->node.resType.bytes);
+ pVal->node.resType.bytes += VARSTR_HEADER_SIZE;
+ break;
+ case TSDB_DATA_TYPE_NCHAR: {
+ pVal->node.resType.bytes *= TSDB_NCHAR_SIZE;
+ pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
+ if (NULL == pVal->datum.p) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ int32_t output = 0;
+ if (!taosMbsToUcs4(pParam->buffer, inputSize, (TdUcs4*)varDataVal(pVal->datum.p), pVal->node.resType.bytes,
+ &output)) {
+ return errno;
+ }
+ varDataSetLen(pVal->datum.p, output);
+ pVal->node.resType.bytes = output + VARSTR_HEADER_SIZE;
+ break;
+ }
+ default: {
+ int32_t code = nodesSetValueNodeValue(pVal, pParam->buffer);
+ if (code) {
+ return code;
+ }
+ break;
+ }
+ }
+ pVal->translate = true;
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t qStmtBindParams2(SQuery* pQuery, TAOS_STMT2_BIND* pParams, int32_t colIdx) {
+ int32_t code = TSDB_CODE_SUCCESS;
+
+ if (colIdx < 0) {
+ int32_t size = taosArrayGetSize(pQuery->pPlaceholderValues);
+ for (int32_t i = 0; i < size; ++i) {
+ code = setValueByBindParam2((SValueNode*)taosArrayGetP(pQuery->pPlaceholderValues, i), pParams + i);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ }
+ } else {
+ code = setValueByBindParam2((SValueNode*)taosArrayGetP(pQuery->pPlaceholderValues, colIdx), pParams);
+ }
+
+ if (TSDB_CODE_SUCCESS == code && (colIdx < 0 || colIdx + 1 == pQuery->placeholderNum)) {
+ nodesDestroyNode(pQuery->pRoot);
+ pQuery->pRoot = NULL;
+ code = nodesCloneNode(pQuery->pPrepareRoot, &pQuery->pRoot);
+ if (NULL == pQuery->pRoot) {
+ code = code;
+ }
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ rewriteExprAlias(pQuery->pRoot);
+ }
+ return code;
+}
+
int32_t qStmtParseQuerySql(SParseContext* pCxt, SQuery* pQuery) {
int32_t code = translate(pCxt, pQuery, NULL);
if (TSDB_CODE_SUCCESS == code) {
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index b694a502da..47a43f1485 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -315,117 +315,118 @@
#define TK_FOR 268
#define TK_NOW 269
#define TK_TODAY 270
-#define TK_SUBSTR 271
-#define TK_SUBSTRING 272
-#define TK_BOTH 273
-#define TK_TRAILING 274
-#define TK_LEADING 275
-#define TK_TIMEZONE 276
-#define TK_CLIENT_VERSION 277
-#define TK_SERVER_VERSION 278
-#define TK_SERVER_STATUS 279
-#define TK_CURRENT_USER 280
-#define TK_PI 281
-#define TK_CASE 282
-#define TK_WHEN 283
-#define TK_THEN 284
-#define TK_ELSE 285
-#define TK_BETWEEN 286
-#define TK_IS 287
-#define TK_NK_LT 288
-#define TK_NK_GT 289
-#define TK_NK_LE 290
-#define TK_NK_GE 291
-#define TK_NK_NE 292
-#define TK_MATCH 293
-#define TK_NMATCH 294
-#define TK_CONTAINS 295
-#define TK_JOIN 296
-#define TK_INNER 297
-#define TK_LEFT 298
-#define TK_RIGHT 299
-#define TK_OUTER 300
-#define TK_SEMI 301
-#define TK_ANTI 302
-#define TK_ASOF 303
-#define TK_WINDOW 304
-#define TK_WINDOW_OFFSET 305
-#define TK_JLIMIT 306
-#define TK_SELECT 307
-#define TK_NK_HINT 308
-#define TK_DISTINCT 309
-#define TK_WHERE 310
-#define TK_PARTITION 311
-#define TK_BY 312
-#define TK_SESSION 313
-#define TK_STATE_WINDOW 314
-#define TK_EVENT_WINDOW 315
-#define TK_COUNT_WINDOW 316
-#define TK_SLIDING 317
-#define TK_FILL 318
-#define TK_VALUE 319
-#define TK_VALUE_F 320
-#define TK_NONE 321
-#define TK_PREV 322
-#define TK_NULL_F 323
-#define TK_LINEAR 324
-#define TK_NEXT 325
-#define TK_HAVING 326
-#define TK_RANGE 327
-#define TK_EVERY 328
-#define TK_ORDER 329
-#define TK_SLIMIT 330
-#define TK_SOFFSET 331
-#define TK_LIMIT 332
-#define TK_OFFSET 333
-#define TK_ASC 334
-#define TK_NULLS 335
-#define TK_ABORT 336
-#define TK_AFTER 337
-#define TK_ATTACH 338
-#define TK_BEFORE 339
-#define TK_BEGIN 340
-#define TK_BITAND 341
-#define TK_BITNOT 342
-#define TK_BITOR 343
-#define TK_BLOCKS 344
-#define TK_CHANGE 345
-#define TK_COMMA 346
-#define TK_CONCAT 347
-#define TK_CONFLICT 348
-#define TK_COPY 349
-#define TK_DEFERRED 350
-#define TK_DELIMITERS 351
-#define TK_DETACH 352
-#define TK_DIVIDE 353
-#define TK_DOT 354
-#define TK_EACH 355
-#define TK_FAIL 356
-#define TK_GLOB 357
-#define TK_ID 358
-#define TK_IMMEDIATE 359
-#define TK_IMPORT 360
-#define TK_INITIALLY 361
-#define TK_INSTEAD 362
-#define TK_ISNULL 363
-#define TK_MODULES 364
-#define TK_NK_BITNOT 365
-#define TK_NK_SEMI 366
-#define TK_NOTNULL 367
-#define TK_OF 368
-#define TK_PLUS 369
-#define TK_PRIVILEGE 370
-#define TK_RAISE 371
-#define TK_RESTRICT 372
-#define TK_ROW 373
-#define TK_STAR 374
-#define TK_STATEMENT 375
-#define TK_STRICT 376
-#define TK_STRING 377
-#define TK_TIMES 378
-#define TK_VALUES 379
-#define TK_VARIABLE 380
-#define TK_WAL 381
+#define TK_RAND 271
+#define TK_SUBSTR 272
+#define TK_SUBSTRING 273
+#define TK_BOTH 274
+#define TK_TRAILING 275
+#define TK_LEADING 276
+#define TK_TIMEZONE 277
+#define TK_CLIENT_VERSION 278
+#define TK_SERVER_VERSION 279
+#define TK_SERVER_STATUS 280
+#define TK_CURRENT_USER 281
+#define TK_PI 282
+#define TK_CASE 283
+#define TK_WHEN 284
+#define TK_THEN 285
+#define TK_ELSE 286
+#define TK_BETWEEN 287
+#define TK_IS 288
+#define TK_NK_LT 289
+#define TK_NK_GT 290
+#define TK_NK_LE 291
+#define TK_NK_GE 292
+#define TK_NK_NE 293
+#define TK_MATCH 294
+#define TK_NMATCH 295
+#define TK_CONTAINS 296
+#define TK_JOIN 297
+#define TK_INNER 298
+#define TK_LEFT 299
+#define TK_RIGHT 300
+#define TK_OUTER 301
+#define TK_SEMI 302
+#define TK_ANTI 303
+#define TK_ASOF 304
+#define TK_WINDOW 305
+#define TK_WINDOW_OFFSET 306
+#define TK_JLIMIT 307
+#define TK_SELECT 308
+#define TK_NK_HINT 309
+#define TK_DISTINCT 310
+#define TK_WHERE 311
+#define TK_PARTITION 312
+#define TK_BY 313
+#define TK_SESSION 314
+#define TK_STATE_WINDOW 315
+#define TK_EVENT_WINDOW 316
+#define TK_COUNT_WINDOW 317
+#define TK_SLIDING 318
+#define TK_FILL 319
+#define TK_VALUE 320
+#define TK_VALUE_F 321
+#define TK_NONE 322
+#define TK_PREV 323
+#define TK_NULL_F 324
+#define TK_LINEAR 325
+#define TK_NEXT 326
+#define TK_HAVING 327
+#define TK_RANGE 328
+#define TK_EVERY 329
+#define TK_ORDER 330
+#define TK_SLIMIT 331
+#define TK_SOFFSET 332
+#define TK_LIMIT 333
+#define TK_OFFSET 334
+#define TK_ASC 335
+#define TK_NULLS 336
+#define TK_ABORT 337
+#define TK_AFTER 338
+#define TK_ATTACH 339
+#define TK_BEFORE 340
+#define TK_BEGIN 341
+#define TK_BITAND 342
+#define TK_BITNOT 343
+#define TK_BITOR 344
+#define TK_BLOCKS 345
+#define TK_CHANGE 346
+#define TK_COMMA 347
+#define TK_CONCAT 348
+#define TK_CONFLICT 349
+#define TK_COPY 350
+#define TK_DEFERRED 351
+#define TK_DELIMITERS 352
+#define TK_DETACH 353
+#define TK_DIVIDE 354
+#define TK_DOT 355
+#define TK_EACH 356
+#define TK_FAIL 357
+#define TK_GLOB 358
+#define TK_ID 359
+#define TK_IMMEDIATE 360
+#define TK_IMPORT 361
+#define TK_INITIALLY 362
+#define TK_INSTEAD 363
+#define TK_ISNULL 364
+#define TK_MODULES 365
+#define TK_NK_BITNOT 366
+#define TK_NK_SEMI 367
+#define TK_NOTNULL 368
+#define TK_OF 369
+#define TK_PLUS 370
+#define TK_PRIVILEGE 371
+#define TK_RAISE 372
+#define TK_RESTRICT 373
+#define TK_ROW 374
+#define TK_STAR 375
+#define TK_STATEMENT 376
+#define TK_STRICT 377
+#define TK_STRING 378
+#define TK_TIMES 379
+#define TK_VALUES 380
+#define TK_VARIABLE 381
+#define TK_WAL 382
#endif
/**************** End token definitions ***************************************/
@@ -490,31 +491,31 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 564
+#define YYNOCODE 566
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- ETrimType yy72;
- bool yy89;
- SNode* yy248;
- SShowTablesOption yy373;
- SToken yy401;
- EOrder yy482;
- int64_t yy525;
- EJoinSubType yy582;
- EFillMode yy583;
- int32_t yy604;
- SAlterOption yy677;
- int8_t yy695;
- EOperatorType yy716;
- ENullOrder yy721;
- EJoinType yy804;
- SNodeList* yy928;
- SDataType yy976;
- STokenPair yy1041;
- EShowKind yy1042;
+ EFillMode yy58;
+ int8_t yy107;
+ int64_t yy145;
+ EOperatorType yy164;
+ ENullOrder yy417;
+ bool yy429;
+ SToken yy461;
+ STokenPair yy517;
+ SAlterOption yy533;
+ int32_t yy696;
+ SNodeList* yy712;
+ SNode* yy724;
+ EOrder yy746;
+ ETrimType yy796;
+ EJoinSubType yy798;
+ SShowTablesOption yy801;
+ EJoinType yy916;
+ EShowKind yy973;
+ SDataType yy1016;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -533,20 +534,20 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 1004
-#define YYNRULE 768
-#define YYNRULE_WITH_ACTION 768
-#define YYNTOKEN 382
-#define YY_MAX_SHIFT 1003
-#define YY_MIN_SHIFTREDUCE 1486
-#define YY_MAX_SHIFTREDUCE 2253
-#define YY_ERROR_ACTION 2254
-#define YY_ACCEPT_ACTION 2255
-#define YY_NO_ACTION 2256
-#define YY_MIN_REDUCE 2257
-#define YY_MAX_REDUCE 3024
-#define YY_MIN_DSTRCTR 383
-#define YY_MAX_DSTRCTR 563
+#define YYNSTATE 1007
+#define YYNRULE 771
+#define YYNRULE_WITH_ACTION 771
+#define YYNTOKEN 383
+#define YY_MAX_SHIFT 1006
+#define YY_MIN_SHIFTREDUCE 1492
+#define YY_MAX_SHIFTREDUCE 2262
+#define YY_ERROR_ACTION 2263
+#define YY_ACCEPT_ACTION 2264
+#define YY_NO_ACTION 2265
+#define YY_MIN_REDUCE 2266
+#define YY_MAX_REDUCE 3036
+#define YY_MIN_DSTRCTR 384
+#define YY_MAX_DSTRCTR 565
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -629,1125 +630,1198 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (4102)
+#define YY_ACTTAB_COUNT (4470)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 821, 670, 2997, 678, 671, 2305, 671, 2305, 2992, 2469,
- /* 10 */ 2992, 954, 58, 56, 2424, 57, 55, 54, 53, 52,
- /* 20 */ 498, 2258, 1978, 2620, 399, 461, 820, 229, 2502, 2996,
- /* 30 */ 218, 2993, 822, 2993, 2995, 502, 1976, 491, 2080, 2349,
- /* 40 */ 218, 2787, 149, 2617, 882, 148, 147, 146, 145, 144,
- /* 50 */ 143, 142, 141, 140, 895, 895, 836, 2593, 51, 50,
- /* 60 */ 833, 168, 57, 55, 54, 53, 52, 2593, 2075, 149,
- /* 70 */ 767, 865, 148, 147, 146, 145, 144, 143, 142, 141,
- /* 80 */ 140, 218, 1984, 51, 50, 2805, 757, 57, 55, 54,
- /* 90 */ 53, 52, 51, 50, 2003, 2007, 57, 55, 54, 53,
- /* 100 */ 52, 2752, 751, 877, 755, 753, 299, 298, 2594, 690,
- /* 110 */ 520, 771, 1000, 2518, 2520, 59, 971, 970, 969, 968,
- /* 120 */ 528, 249, 967, 966, 173, 961, 960, 959, 958, 957,
- /* 130 */ 956, 955, 172, 949, 948, 947, 527, 526, 944, 943,
- /* 140 */ 942, 209, 208, 941, 523, 940, 939, 938, 2786, 61,
- /* 150 */ 61, 2834, 2083, 2084, 810, 132, 2788, 881, 2790, 2791,
- /* 160 */ 876, 2456, 2745, 864, 900, 515, 2216, 105, 2607, 211,
- /* 170 */ 691, 2894, 104, 51, 50, 493, 2890, 57, 55, 54,
- /* 180 */ 53, 52, 2787, 2805, 205, 2902, 832, 2620, 160, 831,
- /* 190 */ 195, 2039, 2049, 680, 2659, 230, 2992, 878, 2398, 111,
- /* 200 */ 2060, 2082, 2085, 2941, 2257, 51, 50, 2618, 882, 57,
- /* 210 */ 55, 54, 53, 52, 820, 229, 1979, 464, 1977, 2993,
- /* 220 */ 822, 895, 9, 863, 504, 504, 2805, 2460, 158, 157,
- /* 230 */ 156, 155, 154, 153, 152, 151, 150, 900, 900, 103,
- /* 240 */ 453, 73, 2752, 2255, 877, 935, 185, 184, 932, 931,
- /* 250 */ 930, 182, 1982, 1983, 2036, 809, 2038, 2041, 2042, 2043,
- /* 260 */ 2044, 2045, 2046, 2047, 2048, 873, 866, 811, 225, 898,
- /* 270 */ 897, 2067, 2068, 2069, 2070, 2071, 2074, 2076, 2077, 2078,
- /* 280 */ 2079, 2081, 2, 58, 56, 2172, 2696, 2787, 895, 2786,
- /* 290 */ 2110, 498, 2834, 1978, 582, 2589, 132, 2788, 881, 2790,
- /* 300 */ 2791, 876, 875, 770, 864, 900, 573, 1976, 170, 2080,
- /* 310 */ 179, 2865, 2894, 2188, 2620, 2746, 493, 2890, 51, 50,
- /* 320 */ 833, 168, 57, 55, 54, 53, 52, 868, 500, 2008,
- /* 330 */ 675, 2805, 531, 2147, 2617, 882, 672, 530, 867, 2075,
- /* 340 */ 538, 335, 865, 33, 2003, 686, 19, 2752, 245, 877,
- /* 350 */ 2997, 193, 44, 1984, 1531, 2111, 635, 633, 2992, 436,
- /* 360 */ 518, 2467, 243, 2004, 51, 50, 58, 56, 57, 55,
- /* 370 */ 54, 53, 52, 1538, 498, 720, 1978, 2996, 504, 719,
- /* 380 */ 2004, 2993, 2994, 1000, 2545, 125, 15, 2280, 787, 265,
- /* 390 */ 1976, 900, 2080, 673, 2786, 2313, 2992, 2834, 1533, 1536,
- /* 400 */ 1537, 431, 2788, 881, 2790, 2791, 876, 874, 2112, 864,
- /* 410 */ 900, 856, 2859, 2352, 2998, 229, 2147, 43, 351, 2993,
- /* 420 */ 822, 2562, 2075, 2083, 2084, 865, 2217, 77, 39, 19,
- /* 430 */ 689, 2003, 2116, 335, 51, 50, 1984, 2147, 57, 55,
- /* 440 */ 54, 53, 52, 835, 198, 2902, 2903, 2752, 166, 2907,
- /* 450 */ 2997, 42, 495, 2105, 2106, 2107, 2108, 2109, 2113, 2114,
- /* 460 */ 2115, 124, 2039, 2049, 267, 2176, 1000, 2006, 673, 15,
- /* 470 */ 2313, 2003, 2082, 2085, 2914, 2144, 2145, 2146, 2914, 2914,
- /* 480 */ 2914, 2914, 2914, 193, 1558, 2117, 1557, 1979, 2458, 1977,
- /* 490 */ 737, 736, 735, 2468, 863, 1750, 1751, 727, 165, 731,
- /* 500 */ 164, 2036, 2439, 730, 40, 903, 2083, 2084, 729, 734,
- /* 510 */ 473, 472, 1851, 1852, 728, 1824, 1825, 693, 471, 724,
- /* 520 */ 723, 722, 1559, 1982, 1983, 2036, 73, 2038, 2041, 2042,
- /* 530 */ 2043, 2044, 2045, 2046, 2047, 2048, 873, 866, 73, 612,
- /* 540 */ 898, 897, 2067, 2068, 2279, 2039, 2049, 2074, 2076, 2077,
- /* 550 */ 2078, 2079, 2081, 2, 611, 2082, 2085, 1661, 2144, 2145,
- /* 560 */ 2146, 1850, 1853, 2240, 2247, 444, 443, 896, 2465, 771,
- /* 570 */ 1979, 1660, 1977, 896, 2465, 505, 937, 863, 2914, 2144,
- /* 580 */ 2145, 2146, 2914, 2914, 2914, 2914, 2914, 522, 951, 514,
- /* 590 */ 2525, 2080, 610, 234, 937, 51, 50, 609, 459, 57,
- /* 600 */ 55, 54, 53, 52, 2752, 608, 1982, 1983, 2036, 2523,
- /* 610 */ 2038, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 873,
- /* 620 */ 866, 2075, 687, 898, 897, 2067, 2068, 62, 285, 2705,
- /* 630 */ 2074, 2076, 2077, 2078, 2079, 2081, 2, 12, 58, 56,
- /* 640 */ 333, 203, 2040, 328, 204, 222, 498, 640, 1978, 1665,
- /* 650 */ 1711, 773, 2659, 710, 706, 702, 698, 953, 284, 525,
- /* 660 */ 524, 2512, 1976, 1664, 2080, 1702, 927, 926, 925, 1706,
- /* 670 */ 924, 1708, 1709, 923, 920, 95, 1717, 917, 1719, 1720,
- /* 680 */ 914, 911, 908, 1985, 768, 787, 688, 2613, 821, 2091,
- /* 690 */ 2246, 2525, 171, 2992, 2075, 2003, 2992, 865, 303, 489,
- /* 700 */ 12, 19, 2457, 2056, 112, 2037, 1984, 2762, 1984, 282,
- /* 710 */ 2523, 2998, 229, 904, 820, 229, 2993, 822, 335, 2993,
- /* 720 */ 822, 58, 56, 2086, 2149, 2150, 2151, 2152, 2153, 498,
- /* 730 */ 335, 1978, 392, 1711, 510, 196, 2766, 2269, 1000, 642,
- /* 740 */ 2205, 15, 2278, 588, 2589, 1976, 2762, 2080, 1702, 927,
- /* 750 */ 926, 925, 1706, 924, 1708, 1709, 872, 871, 928, 1717,
- /* 760 */ 870, 1719, 1720, 869, 911, 908, 619, 2589, 1558, 1969,
- /* 770 */ 1557, 1945, 786, 470, 468, 2766, 270, 2075, 2083, 2084,
- /* 780 */ 865, 896, 2465, 1905, 1906, 281, 2768, 2770, 494, 272,
- /* 790 */ 279, 1984, 479, 2667, 385, 277, 684, 247, 2454, 900,
- /* 800 */ 513, 66, 2752, 507, 506, 1970, 1559, 803, 802, 2203,
- /* 810 */ 2204, 2206, 2207, 2208, 269, 896, 2465, 2039, 2049, 335,
- /* 820 */ 252, 1000, 898, 897, 59, 2768, 2771, 2082, 2085, 2074,
- /* 830 */ 2076, 2077, 2078, 2079, 2081, 159, 2449, 466, 900, 737,
- /* 840 */ 736, 735, 1979, 716, 1977, 550, 727, 165, 731, 863,
- /* 850 */ 2519, 2520, 730, 467, 465, 501, 718, 729, 734, 473,
- /* 860 */ 472, 2083, 2084, 728, 192, 1988, 2040, 471, 724, 723,
- /* 870 */ 722, 342, 343, 896, 2465, 2470, 341, 720, 1982, 1983,
- /* 880 */ 2036, 719, 2038, 2041, 2042, 2043, 2044, 2045, 2046, 2047,
- /* 890 */ 2048, 873, 866, 570, 744, 898, 897, 2067, 2068, 1649,
- /* 900 */ 2039, 2049, 2074, 2076, 2077, 2078, 2079, 2081, 2, 758,
- /* 910 */ 2082, 2085, 2909, 71, 51, 50, 1947, 2277, 57, 55,
- /* 920 */ 54, 53, 52, 169, 784, 1979, 2865, 1977, 300, 2037,
- /* 930 */ 51, 50, 863, 2452, 57, 55, 54, 53, 52, 929,
- /* 940 */ 2906, 566, 2516, 1978, 747, 1651, 565, 667, 509, 508,
- /* 950 */ 73, 741, 739, 46, 1561, 1562, 665, 1976, 297, 661,
- /* 960 */ 657, 1982, 1983, 2036, 115, 2038, 2041, 2042, 2043, 2044,
- /* 970 */ 2045, 2046, 2047, 2048, 873, 866, 2525, 2752, 898, 897,
- /* 980 */ 2067, 2068, 1946, 554, 503, 2074, 2076, 2077, 2078, 2079,
- /* 990 */ 2081, 2, 58, 56, 2197, 2523, 2787, 787, 1879, 2706,
- /* 1000 */ 498, 521, 1978, 1984, 83, 2992, 896, 2465, 2198, 82,
- /* 1010 */ 192, 878, 556, 552, 512, 511, 1976, 2525, 2080, 896,
- /* 1020 */ 2465, 2470, 2055, 2998, 229, 519, 571, 37, 2993, 822,
- /* 1030 */ 54, 53, 52, 1000, 2787, 391, 2523, 135, 2058, 590,
- /* 1040 */ 2805, 1538, 2276, 2169, 896, 2465, 518, 2467, 2075, 878,
- /* 1050 */ 564, 865, 563, 310, 2196, 787, 2752, 2275, 877, 896,
- /* 1060 */ 2465, 398, 1984, 2992, 604, 51, 50, 1536, 1537, 57,
- /* 1070 */ 55, 54, 53, 52, 815, 58, 56, 2909, 2805, 605,
- /* 1080 */ 2006, 2998, 229, 498, 562, 1978, 2993, 822, 896, 2465,
- /* 1090 */ 712, 711, 1000, 2469, 2752, 59, 877, 480, 2667, 1976,
- /* 1100 */ 392, 2080, 2752, 2786, 38, 2905, 2834, 2274, 606, 2673,
- /* 1110 */ 197, 2788, 881, 2790, 2791, 876, 41, 2752, 864, 900,
- /* 1120 */ 896, 2465, 51, 50, 733, 732, 57, 55, 54, 53,
- /* 1130 */ 52, 2075, 2083, 2084, 865, 2003, 12, 1979, 10, 1977,
- /* 1140 */ 692, 2786, 335, 2158, 2834, 1984, 896, 2465, 132, 2788,
- /* 1150 */ 881, 2790, 2791, 876, 14, 13, 864, 900, 806, 788,
- /* 1160 */ 2952, 2668, 2869, 857, 2894, 2866, 2462, 2752, 493, 2890,
- /* 1170 */ 304, 2039, 2049, 1982, 1983, 1000, 965, 963, 59, 896,
- /* 1180 */ 2465, 2082, 2085, 51, 50, 833, 168, 57, 55, 54,
- /* 1190 */ 53, 52, 896, 2465, 714, 713, 1979, 2909, 1977, 305,
- /* 1200 */ 51, 50, 2336, 863, 57, 55, 54, 53, 52, 859,
- /* 1210 */ 2007, 2866, 313, 51, 50, 2083, 2084, 57, 55, 54,
- /* 1220 */ 53, 52, 51, 50, 738, 2904, 57, 55, 54, 53,
- /* 1230 */ 52, 2441, 1982, 1983, 2036, 2003, 2038, 2041, 2042, 2043,
- /* 1240 */ 2044, 2045, 2046, 2047, 2048, 873, 866, 2285, 993, 898,
- /* 1250 */ 897, 2067, 2068, 333, 2039, 2049, 2074, 2076, 2077, 2078,
- /* 1260 */ 2079, 2081, 2, 2438, 2082, 2085, 51, 50, 2525, 2124,
- /* 1270 */ 57, 55, 54, 53, 52, 812, 807, 800, 796, 1979,
- /* 1280 */ 2525, 1977, 896, 2465, 896, 2465, 863, 840, 51, 50,
- /* 1290 */ 111, 2061, 57, 55, 54, 53, 52, 833, 168, 848,
- /* 1300 */ 2996, 2273, 839, 764, 159, 45, 2040, 2007, 2057, 138,
- /* 1310 */ 2902, 2903, 721, 166, 2907, 1982, 1983, 2036, 2461, 2038,
- /* 1320 */ 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 873, 866,
- /* 1330 */ 896, 2465, 898, 897, 2067, 2068, 2692, 896, 2465, 2074,
- /* 1340 */ 2076, 2077, 2078, 2079, 2081, 2, 58, 56, 2168, 933,
- /* 1350 */ 346, 440, 2516, 2001, 498, 2272, 1978, 853, 2271, 787,
- /* 1360 */ 617, 2752, 192, 463, 761, 825, 760, 2992, 772, 2037,
- /* 1370 */ 1976, 637, 2080, 2471, 2007, 837, 935, 185, 184, 932,
- /* 1380 */ 931, 930, 182, 896, 2465, 2998, 229, 596, 2268, 639,
- /* 1390 */ 2993, 822, 2267, 302, 441, 598, 2054, 301, 934, 828,
- /* 1400 */ 175, 2516, 2075, 353, 2527, 865, 576, 136, 935, 185,
- /* 1410 */ 184, 932, 931, 930, 182, 2752, 1984, 2266, 2752, 525,
- /* 1420 */ 524, 199, 2902, 2903, 787, 166, 2907, 3, 2265, 1992,
- /* 1430 */ 545, 787, 2992, 896, 2465, 629, 1540, 290, 89, 2992,
- /* 1440 */ 288, 64, 2002, 1985, 2008, 2080, 1000, 462, 2752, 15,
- /* 1450 */ 2998, 229, 2752, 889, 236, 2993, 822, 2998, 229, 584,
- /* 1460 */ 51, 50, 2993, 822, 57, 55, 54, 53, 52, 2037,
- /* 1470 */ 183, 114, 47, 2264, 2263, 2075, 448, 2752, 2262, 478,
- /* 1480 */ 224, 759, 175, 1895, 896, 2465, 2083, 2084, 2752, 1984,
- /* 1490 */ 2600, 2579, 102, 625, 624, 623, 622, 621, 616, 615,
- /* 1500 */ 614, 613, 445, 254, 890, 603, 602, 601, 600, 599,
- /* 1510 */ 593, 592, 591, 2261, 586, 585, 460, 2572, 2260, 861,
- /* 1520 */ 577, 1812, 1813, 896, 2465, 2039, 2049, 1831, 628, 253,
- /* 1530 */ 2525, 896, 2465, 2752, 2752, 2082, 2085, 2442, 2752, 1644,
- /* 1540 */ 161, 2008, 626, 894, 725, 292, 726, 232, 291, 2524,
- /* 1550 */ 1979, 381, 1977, 65, 101, 294, 314, 863, 293, 638,
- /* 1560 */ 296, 580, 2334, 295, 862, 1903, 945, 1642, 794, 1640,
- /* 1570 */ 174, 60, 60, 2752, 212, 2249, 2250, 223, 2752, 2325,
- /* 1580 */ 220, 14, 13, 183, 740, 1645, 1982, 1983, 2036, 1614,
- /* 1590 */ 2038, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 873,
- /* 1600 */ 866, 742, 2323, 898, 897, 2067, 2068, 116, 2008, 340,
- /* 1610 */ 2074, 2076, 2077, 2078, 2079, 2081, 2, 194, 88, 60,
- /* 1620 */ 2787, 75, 405, 1993, 745, 1988, 824, 130, 60, 127,
- /* 1630 */ 60, 2270, 2773, 60, 88, 836, 180, 161, 183, 360,
- /* 1640 */ 359, 403, 87, 362, 361, 86, 364, 363, 366, 365,
- /* 1650 */ 2787, 2192, 368, 367, 2202, 2201, 442, 319, 1987, 1996,
- /* 1660 */ 1998, 370, 369, 826, 2805, 878, 838, 2315, 263, 652,
- /* 1670 */ 650, 647, 645, 372, 371, 85, 898, 897, 374, 373,
- /* 1680 */ 2752, 2399, 877, 2074, 2076, 2077, 2078, 2079, 2081, 376,
- /* 1690 */ 375, 906, 344, 181, 2805, 1986, 2775, 378, 377, 829,
- /* 1700 */ 183, 845, 2059, 162, 2118, 380, 379, 2317, 180, 946,
- /* 1710 */ 2752, 2062, 877, 2050, 73, 1622, 1848, 1838, 2955, 356,
- /* 1720 */ 893, 1693, 203, 329, 1595, 804, 321, 2786, 834, 163,
- /* 1730 */ 2834, 2806, 1612, 2306, 132, 2788, 881, 2790, 2791, 876,
- /* 1740 */ 2391, 2102, 864, 900, 2390, 2945, 801, 485, 211, 808,
- /* 1750 */ 2894, 481, 2598, 74, 493, 2890, 2787, 2786, 397, 842,
- /* 1760 */ 2834, 1623, 989, 529, 132, 2788, 881, 2790, 2791, 876,
- /* 1770 */ 1596, 878, 864, 900, 1724, 2787, 1732, 547, 3012, 2312,
- /* 1780 */ 2894, 2513, 2942, 1739, 493, 2890, 1737, 780, 2946, 816,
- /* 1790 */ 878, 186, 2949, 817, 331, 2956, 326, 334, 2599, 2425,
- /* 1800 */ 2805, 5, 532, 2001, 537, 457, 2011, 99, 98, 569,
- /* 1810 */ 546, 557, 242, 237, 238, 574, 2752, 240, 877, 2805,
- /* 1820 */ 1872, 390, 558, 560, 2002, 561, 559, 581, 251, 583,
- /* 1830 */ 587, 589, 607, 631, 594, 2752, 618, 877, 439, 620,
- /* 1840 */ 1990, 548, 2591, 627, 544, 540, 536, 533, 562, 630,
- /* 1850 */ 632, 643, 641, 644, 257, 256, 646, 648, 649, 260,
- /* 1860 */ 651, 653, 2009, 2786, 668, 4, 2834, 669, 676, 677,
- /* 1870 */ 200, 2788, 881, 2790, 2791, 876, 679, 1989, 864, 900,
- /* 1880 */ 2004, 681, 2786, 268, 2787, 2834, 107, 271, 2010, 132,
- /* 1890 */ 2788, 881, 2790, 2791, 876, 682, 2012, 864, 900, 878,
- /* 1900 */ 274, 2962, 683, 3012, 276, 2894, 335, 685, 2013, 493,
- /* 1910 */ 2890, 2614, 108, 2014, 2608, 694, 109, 110, 283, 715,
- /* 1920 */ 137, 2787, 717, 763, 2455, 2682, 287, 2451, 2805, 289,
- /* 1930 */ 188, 823, 3013, 748, 134, 749, 878, 765, 798, 113,
- /* 1940 */ 2453, 434, 2448, 189, 2752, 2005, 877, 190, 176, 393,
- /* 1950 */ 306, 2660, 775, 774, 776, 781, 309, 311, 782, 805,
- /* 1960 */ 2679, 2961, 843, 2960, 2678, 2805, 814, 779, 791, 320,
- /* 1970 */ 8, 819, 2787, 322, 2933, 202, 792, 790, 818, 323,
- /* 1980 */ 3015, 2752, 789, 877, 2913, 324, 327, 878, 486, 2985,
- /* 1990 */ 316, 2786, 827, 318, 2834, 830, 325, 2006, 132, 2788,
- /* 2000 */ 881, 2790, 2791, 876, 2166, 1, 864, 900, 2787, 167,
- /* 2010 */ 2991, 2164, 3012, 215, 2894, 330, 2805, 231, 493, 2890,
- /* 2020 */ 2910, 336, 177, 878, 846, 2926, 394, 841, 2786, 2628,
- /* 2030 */ 395, 2834, 2752, 847, 877, 132, 2788, 881, 2790, 2791,
- /* 2040 */ 876, 2627, 72, 864, 900, 178, 883, 854, 2875, 3012,
- /* 2050 */ 887, 2894, 2805, 2626, 2787, 493, 2890, 349, 490, 851,
- /* 2060 */ 354, 123, 885, 396, 2466, 888, 2744, 126, 2752, 878,
- /* 2070 */ 877, 2743, 1510, 2739, 2738, 2730, 995, 2729, 2721, 2786,
- /* 2080 */ 2720, 400, 2834, 996, 997, 187, 132, 2788, 881, 2790,
- /* 2090 */ 2791, 876, 2736, 386, 864, 900, 2787, 2735, 2805, 992,
- /* 2100 */ 3012, 2727, 2894, 383, 435, 387, 493, 2890, 999, 767,
- /* 2110 */ 404, 878, 902, 2726, 2752, 2786, 877, 2715, 2834, 2714,
- /* 2120 */ 422, 2733, 132, 2788, 881, 2790, 2791, 876, 2732, 2724,
- /* 2130 */ 864, 900, 2723, 402, 2787, 2712, 3012, 2711, 2894, 2709,
- /* 2140 */ 2805, 469, 493, 2890, 2708, 2517, 433, 449, 516, 878,
- /* 2150 */ 423, 2704, 2703, 2702, 96, 63, 2752, 450, 877, 2697,
- /* 2160 */ 534, 2786, 535, 1929, 2834, 1930, 235, 539, 132, 2788,
- /* 2170 */ 881, 2790, 2791, 876, 2695, 541, 864, 900, 2805, 542,
- /* 2180 */ 543, 1928, 2867, 2694, 2894, 2693, 458, 2691, 493, 2890,
- /* 2190 */ 549, 2690, 551, 2689, 2752, 553, 877, 2688, 555, 1916,
- /* 2200 */ 2664, 2663, 239, 2786, 241, 1875, 2834, 97, 1874, 2641,
- /* 2210 */ 132, 2788, 881, 2790, 2791, 876, 567, 568, 864, 900,
- /* 2220 */ 2640, 2787, 2639, 2638, 858, 2637, 2894, 2581, 572, 1811,
- /* 2230 */ 493, 2890, 2578, 2577, 575, 2571, 878, 2568, 578, 244,
- /* 2240 */ 579, 2786, 2567, 100, 2834, 2566, 2565, 2570, 133, 2788,
- /* 2250 */ 881, 2790, 2791, 876, 769, 246, 864, 900, 2569, 2564,
- /* 2260 */ 2563, 2561, 2560, 2559, 2894, 2805, 248, 595, 2893, 2890,
- /* 2270 */ 2787, 2558, 1003, 597, 2556, 2555, 2554, 2553, 2552, 2576,
- /* 2280 */ 2551, 2752, 2550, 877, 2549, 878, 2574, 2557, 2548, 2547,
- /* 2290 */ 2546, 389, 2544, 2543, 2542, 2541, 2540, 2539, 2538, 250,
- /* 2300 */ 2537, 106, 2536, 2535, 2534, 2606, 991, 219, 2575, 2573,
- /* 2310 */ 2533, 2532, 2531, 1817, 2805, 255, 987, 983, 979, 975,
- /* 2320 */ 2530, 384, 634, 2529, 636, 2528, 2526, 2356, 2786, 1662,
- /* 2330 */ 2752, 2834, 877, 446, 258, 133, 2788, 881, 2790, 2791,
- /* 2340 */ 876, 1666, 2355, 864, 900, 2354, 2353, 2351, 2348, 1658,
- /* 2350 */ 2347, 2894, 654, 447, 2340, 860, 2890, 658, 2327, 2301,
- /* 2360 */ 2300, 2662, 656, 1539, 662, 2658, 666, 131, 660, 210,
- /* 2370 */ 2648, 655, 357, 2636, 259, 2787, 659, 879, 664, 264,
- /* 2380 */ 2834, 2635, 261, 262, 133, 2788, 881, 2790, 2791, 876,
- /* 2390 */ 878, 663, 864, 900, 2772, 92, 2612, 266, 2605, 275,
- /* 2400 */ 2894, 2443, 2787, 849, 452, 2890, 221, 93, 674, 1588,
- /* 2410 */ 273, 2350, 2346, 278, 695, 280, 697, 878, 2344, 2805,
- /* 2420 */ 699, 2787, 696, 700, 701, 2342, 703, 705, 704, 2339,
- /* 2430 */ 707, 708, 709, 2322, 2320, 2752, 878, 877, 2321, 2319,
- /* 2440 */ 2297, 2445, 2787, 1744, 1743, 2444, 2805, 962, 355, 1648,
- /* 2450 */ 855, 1647, 1646, 338, 964, 1643, 84, 878, 337, 1641,
- /* 2460 */ 1639, 286, 2752, 2337, 877, 2805, 1638, 1637, 1636, 1630,
- /* 2470 */ 474, 1635, 1632, 1631, 2335, 475, 2326, 307, 1629, 476,
- /* 2480 */ 2324, 2752, 2786, 877, 743, 2834, 2805, 477, 2787, 133,
- /* 2490 */ 2788, 881, 2790, 2791, 876, 746, 2296, 864, 900, 2295,
- /* 2500 */ 2294, 2293, 2752, 878, 877, 2894, 750, 752, 2292, 2786,
- /* 2510 */ 2891, 754, 2834, 2291, 756, 139, 408, 2788, 881, 2790,
- /* 2520 */ 2791, 876, 1910, 31, 864, 900, 483, 1912, 2786, 1909,
- /* 2530 */ 2661, 2834, 2805, 1914, 67, 197, 2788, 881, 2790, 2791,
- /* 2540 */ 876, 32, 2657, 864, 900, 308, 68, 1881, 2752, 2786,
- /* 2550 */ 877, 1883, 2834, 2647, 777, 2787, 432, 2788, 881, 2790,
- /* 2560 */ 2791, 876, 2634, 766, 864, 900, 78, 1885, 1900, 778,
- /* 2570 */ 878, 2633, 484, 2997, 2787, 1860, 21, 17, 312, 1859,
- /* 2580 */ 2219, 34, 315, 793, 2193, 2953, 191, 795, 783, 878,
- /* 2590 */ 785, 482, 6, 7, 797, 2786, 799, 22, 2834, 2805,
- /* 2600 */ 23, 2787, 432, 2788, 881, 2790, 2791, 876, 214, 226,
- /* 2610 */ 864, 900, 2773, 317, 2200, 2752, 875, 877, 2805, 201,
- /* 2620 */ 36, 213, 35, 76, 227, 2187, 2159, 94, 2161, 25,
- /* 2630 */ 2157, 228, 332, 2239, 2752, 2240, 877, 2234, 2233, 487,
- /* 2640 */ 2238, 2237, 488, 2141, 2140, 2805, 70, 2632, 206, 2611,
- /* 2650 */ 117, 118, 24, 339, 2195, 2610, 844, 2604, 119, 120,
- /* 2660 */ 216, 2752, 2786, 877, 345, 2834, 850, 80, 350, 425,
- /* 2670 */ 2788, 881, 2790, 2791, 876, 348, 26, 864, 900, 347,
- /* 2680 */ 13, 2786, 2093, 18, 2834, 69, 852, 11, 200, 2788,
- /* 2690 */ 881, 2790, 2791, 876, 1994, 2092, 864, 900, 2103, 27,
- /* 2700 */ 28, 20, 207, 48, 217, 2053, 2029, 880, 2786, 2052,
- /* 2710 */ 913, 2834, 2603, 916, 2787, 431, 2788, 881, 2790, 2791,
- /* 2720 */ 876, 121, 813, 864, 900, 919, 2860, 922, 127, 878,
- /* 2730 */ 886, 2440, 49, 891, 2051, 2021, 16, 29, 30, 81,
- /* 2740 */ 352, 2787, 884, 122, 90, 892, 358, 2844, 2843, 899,
- /* 2750 */ 3014, 2064, 79, 2252, 2253, 1725, 878, 901, 2805, 905,
- /* 2760 */ 517, 907, 909, 912, 1722, 910, 915, 1716, 1721, 918,
- /* 2770 */ 1718, 921, 1712, 1715, 2752, 1710, 877, 1714, 2787, 1713,
- /* 2780 */ 128, 382, 129, 1738, 91, 2805, 1734, 1626, 1625, 1586,
- /* 2790 */ 936, 1624, 1621, 878, 1618, 950, 1617, 1616, 496, 1615,
- /* 2800 */ 1656, 2752, 1613, 877, 1611, 2787, 1610, 1609, 952, 233,
- /* 2810 */ 1655, 1607, 1604, 1606, 1605, 1603, 1602, 1601, 1652, 1650,
- /* 2820 */ 878, 2786, 2805, 1598, 2834, 492, 1592, 1597, 432, 2788,
- /* 2830 */ 881, 2790, 2791, 876, 1594, 1593, 864, 900, 2752, 1591,
- /* 2840 */ 877, 2345, 972, 973, 974, 2343, 976, 977, 2786, 2805,
- /* 2850 */ 2341, 2834, 978, 980, 2338, 417, 2788, 881, 2790, 2791,
- /* 2860 */ 876, 981, 497, 864, 900, 2752, 982, 877, 984, 2787,
- /* 2870 */ 985, 986, 2318, 988, 2316, 990, 1528, 2290, 1511, 994,
- /* 2880 */ 1516, 388, 998, 1518, 878, 2786, 1980, 401, 2834, 499,
- /* 2890 */ 2787, 1001, 432, 2788, 881, 2790, 2791, 876, 1002, 2256,
- /* 2900 */ 864, 900, 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256,
- /* 2910 */ 2787, 2256, 2786, 2805, 2256, 2834, 2256, 2256, 2256, 432,
- /* 2920 */ 2788, 881, 2790, 2791, 876, 878, 2256, 864, 900, 2752,
- /* 2930 */ 2256, 877, 2256, 2256, 2805, 2256, 2787, 2256, 2256, 2256,
- /* 2940 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 2950 */ 2752, 878, 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256,
- /* 2960 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 2970 */ 2752, 2256, 877, 2256, 2256, 2787, 2786, 2256, 2256, 2834,
- /* 2980 */ 2805, 2256, 2256, 413, 2788, 881, 2790, 2791, 876, 2256,
- /* 2990 */ 878, 864, 900, 2256, 2256, 2256, 2752, 762, 877, 2256,
- /* 3000 */ 2834, 2787, 2256, 2256, 427, 2788, 881, 2790, 2791, 876,
- /* 3010 */ 2256, 2256, 864, 900, 2256, 2256, 878, 2786, 2256, 2805,
- /* 3020 */ 2834, 2256, 2256, 2256, 409, 2788, 881, 2790, 2791, 876,
- /* 3030 */ 2256, 2256, 864, 900, 2256, 2752, 2256, 877, 2256, 2256,
- /* 3040 */ 2256, 2256, 2256, 2786, 2256, 2805, 2834, 2256, 2256, 2256,
- /* 3050 */ 406, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900,
- /* 3060 */ 2256, 2752, 2256, 877, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3070 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3080 */ 2256, 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256, 410,
- /* 3090 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256,
- /* 3100 */ 2256, 2256, 2256, 2256, 2256, 2256, 2787, 2256, 2786, 2256,
- /* 3110 */ 2256, 2834, 2256, 2256, 2256, 424, 2788, 881, 2790, 2791,
- /* 3120 */ 876, 878, 2256, 864, 900, 2256, 2256, 2787, 2256, 2256,
- /* 3130 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3140 */ 2256, 2256, 878, 2256, 2787, 2256, 2256, 2256, 2256, 2256,
- /* 3150 */ 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 878,
- /* 3160 */ 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256,
- /* 3170 */ 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3180 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2805, 877,
- /* 3190 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3200 */ 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2256, 2256,
- /* 3210 */ 2256, 2787, 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256,
- /* 3220 */ 411, 2788, 881, 2790, 2791, 876, 878, 2256, 864, 900,
- /* 3230 */ 2256, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2256, 2256,
- /* 3240 */ 2256, 412, 2788, 881, 2790, 2791, 876, 2256, 2256, 864,
- /* 3250 */ 900, 2786, 2256, 2787, 2834, 2805, 2256, 2256, 428, 2788,
- /* 3260 */ 881, 2790, 2791, 876, 2256, 2256, 864, 900, 878, 2256,
- /* 3270 */ 2256, 2752, 2256, 877, 2256, 2787, 2256, 2256, 2256, 2256,
- /* 3280 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3290 */ 878, 2256, 2256, 2256, 2256, 2256, 2787, 2805, 2256, 2256,
- /* 3300 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3310 */ 2256, 878, 2256, 2752, 2256, 877, 2256, 2787, 2786, 2805,
- /* 3320 */ 2256, 2834, 2256, 2256, 2256, 414, 2788, 881, 2790, 2791,
- /* 3330 */ 876, 2256, 878, 864, 900, 2752, 2256, 877, 2256, 2256,
- /* 3340 */ 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3350 */ 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256,
- /* 3360 */ 2786, 2805, 2256, 2834, 2256, 2256, 2256, 429, 2788, 881,
- /* 3370 */ 2790, 2791, 876, 2256, 2256, 864, 900, 2752, 2256, 877,
- /* 3380 */ 2256, 2256, 2786, 2256, 2787, 2834, 2256, 2256, 2256, 415,
- /* 3390 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 878,
- /* 3400 */ 2256, 2256, 2256, 2786, 2256, 2787, 2834, 2256, 2256, 2256,
- /* 3410 */ 430, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900,
- /* 3420 */ 878, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2805, 2256,
- /* 3430 */ 2256, 416, 2788, 881, 2790, 2791, 876, 2256, 2256, 864,
- /* 3440 */ 900, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2256, 2805,
- /* 3450 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3460 */ 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2256,
- /* 3470 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3480 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3490 */ 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256, 407, 2788,
- /* 3500 */ 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256, 2256,
- /* 3510 */ 2787, 2256, 2786, 2256, 2256, 2834, 2256, 2256, 2256, 418,
- /* 3520 */ 2788, 881, 2790, 2791, 876, 878, 2256, 864, 900, 2256,
- /* 3530 */ 2787, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3540 */ 2256, 2256, 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256,
- /* 3550 */ 2256, 2256, 2787, 2256, 2805, 2256, 2256, 2256, 2256, 2256,
- /* 3560 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 878, 2256, 2256,
- /* 3570 */ 2752, 2256, 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256,
- /* 3580 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3590 */ 2752, 2256, 877, 2256, 2256, 2256, 2805, 2256, 2256, 2256,
- /* 3600 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3610 */ 2256, 2256, 2752, 2256, 877, 2256, 2256, 2786, 2256, 2256,
- /* 3620 */ 2834, 2256, 2256, 2256, 419, 2788, 881, 2790, 2791, 876,
- /* 3630 */ 2256, 2256, 864, 900, 2256, 2787, 2256, 2786, 2256, 2256,
- /* 3640 */ 2834, 2256, 2256, 2256, 420, 2788, 881, 2790, 2791, 876,
- /* 3650 */ 878, 2256, 864, 900, 2256, 2256, 2256, 2787, 2256, 2786,
- /* 3660 */ 2256, 2256, 2834, 2256, 2256, 2256, 421, 2788, 881, 2790,
- /* 3670 */ 2791, 876, 878, 2256, 864, 900, 2787, 2256, 2256, 2805,
- /* 3680 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3690 */ 2256, 878, 2256, 2256, 2256, 2752, 2256, 877, 2256, 2787,
- /* 3700 */ 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3710 */ 2256, 2256, 2256, 2256, 878, 2256, 2256, 2752, 2256, 877,
- /* 3720 */ 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3730 */ 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256,
- /* 3740 */ 2256, 2256, 2786, 2805, 2256, 2834, 2256, 2256, 2256, 437,
- /* 3750 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2752,
- /* 3760 */ 2256, 877, 2256, 2787, 2786, 2256, 2256, 2834, 2256, 2256,
- /* 3770 */ 2256, 438, 2788, 881, 2790, 2791, 876, 2256, 878, 864,
- /* 3780 */ 900, 2256, 2256, 2786, 2256, 2787, 2834, 2256, 2256, 2256,
- /* 3790 */ 2799, 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900,
- /* 3800 */ 878, 2256, 2256, 2256, 2787, 2256, 2786, 2805, 2256, 2834,
- /* 3810 */ 2256, 2256, 2256, 2798, 2788, 881, 2790, 2791, 876, 878,
- /* 3820 */ 2256, 864, 900, 2752, 2256, 877, 2256, 2256, 2256, 2805,
- /* 3830 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3840 */ 2256, 2256, 2256, 2256, 2256, 2752, 2256, 877, 2805, 2256,
- /* 3850 */ 2256, 2256, 2256, 2787, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3860 */ 2256, 2256, 2256, 2256, 2752, 2256, 877, 2256, 878, 2256,
- /* 3870 */ 2786, 2256, 2256, 2834, 2256, 2256, 2256, 2797, 2788, 881,
- /* 3880 */ 2790, 2791, 876, 2256, 2256, 864, 900, 2256, 2256, 2256,
- /* 3890 */ 2256, 2256, 2786, 2256, 2256, 2834, 2256, 2805, 2256, 454,
- /* 3900 */ 2788, 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256,
- /* 3910 */ 2256, 2786, 2256, 2752, 2834, 877, 2256, 2256, 455, 2788,
- /* 3920 */ 881, 2790, 2791, 876, 2256, 2256, 864, 900, 2256, 2256,
- /* 3930 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2787, 2256,
- /* 3940 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3950 */ 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256, 2787, 2256,
- /* 3960 */ 2786, 2256, 2256, 2834, 2256, 2256, 2256, 451, 2788, 881,
- /* 3970 */ 2790, 2791, 876, 878, 2256, 864, 900, 2256, 2787, 2256,
- /* 3980 */ 2256, 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 3990 */ 2256, 2256, 2256, 878, 2256, 2256, 2256, 2256, 2752, 2256,
- /* 4000 */ 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 4010 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256,
- /* 4020 */ 877, 2256, 2805, 2256, 2256, 2256, 2256, 2256, 2256, 2256,
- /* 4030 */ 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2256, 2752, 2256,
- /* 4040 */ 877, 2256, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2256,
- /* 4050 */ 2256, 2256, 456, 2788, 881, 2790, 2791, 876, 2256, 2256,
- /* 4060 */ 864, 900, 2256, 2256, 2256, 879, 2256, 2256, 2834, 2256,
- /* 4070 */ 2256, 2256, 427, 2788, 881, 2790, 2791, 876, 2256, 2256,
- /* 4080 */ 864, 900, 2256, 2256, 2256, 2786, 2256, 2256, 2834, 2256,
- /* 4090 */ 2256, 2256, 426, 2788, 881, 2790, 2791, 876, 2256, 2256,
- /* 4100 */ 864, 900,
+ /* 0 */ 823, 672, 2448, 3009, 673, 2314, 680, 2463, 3004, 673,
+ /* 10 */ 2314, 3004, 59, 57, 522, 44, 352, 2527, 2529, 2461,
+ /* 20 */ 500, 2267, 1984, 2629, 898, 2754, 822, 230, 517, 2010,
+ /* 30 */ 3008, 3005, 824, 575, 3005, 3007, 1982, 492, 2089, 2358,
+ /* 40 */ 2289, 2796, 150, 2626, 885, 149, 148, 147, 146, 145,
+ /* 50 */ 144, 143, 142, 141, 759, 2009, 838, 52, 51, 835,
+ /* 60 */ 169, 58, 56, 55, 54, 53, 2266, 871, 2084, 2013,
+ /* 70 */ 753, 868, 757, 755, 300, 299, 940, 2009, 870, 3009,
+ /* 80 */ 835, 169, 1990, 637, 635, 2814, 437, 3004, 506, 244,
+ /* 90 */ 159, 158, 157, 156, 155, 154, 153, 152, 151, 194,
+ /* 100 */ 2761, 2761, 903, 880, 835, 169, 3008, 898, 520, 2476,
+ /* 110 */ 3005, 3006, 1003, 584, 2598, 60, 974, 973, 972, 971,
+ /* 120 */ 530, 126, 970, 969, 174, 964, 963, 962, 961, 960,
+ /* 130 */ 959, 958, 173, 952, 951, 950, 529, 528, 947, 946,
+ /* 140 */ 945, 210, 209, 944, 525, 943, 942, 941, 2795, 1537,
+ /* 150 */ 2264, 2843, 2092, 2093, 2554, 133, 2797, 884, 2799, 2800,
+ /* 160 */ 879, 1756, 1757, 867, 2844, 903, 772, 246, 1544, 2465,
+ /* 170 */ 212, 223, 2906, 250, 52, 51, 494, 2902, 58, 56,
+ /* 180 */ 55, 54, 53, 2796, 139, 2914, 2915, 2521, 167, 2919,
+ /* 190 */ 136, 2045, 2055, 1539, 1542, 1543, 231, 2010, 838, 520,
+ /* 200 */ 2476, 2091, 2094, 2012, 2953, 206, 2914, 834, 3009, 161,
+ /* 210 */ 833, 58, 56, 55, 54, 53, 1985, 3004, 1983, 106,
+ /* 220 */ 677, 898, 9, 866, 105, 2012, 674, 2814, 837, 199,
+ /* 230 */ 2914, 2915, 506, 167, 2919, 822, 230, 2156, 813, 533,
+ /* 240 */ 3005, 824, 226, 2761, 532, 880, 903, 196, 1830, 1831,
+ /* 250 */ 481, 2676, 1988, 1989, 2042, 2407, 2044, 2047, 2048, 2049,
+ /* 260 */ 2050, 2051, 2052, 2053, 2054, 876, 869, 899, 2474, 901,
+ /* 270 */ 900, 865, 2076, 2077, 2078, 2079, 2080, 2083, 2085, 2086,
+ /* 280 */ 2087, 2088, 2090, 2, 59, 57, 2181, 160, 835, 169,
+ /* 290 */ 2795, 104, 500, 2843, 1984, 718, 789, 133, 2797, 884,
+ /* 300 */ 2799, 2800, 879, 2014, 3004, 867, 2844, 903, 1982, 614,
+ /* 310 */ 2089, 303, 212, 2571, 2906, 302, 62, 898, 494, 2902,
+ /* 320 */ 688, 2249, 3010, 230, 613, 112, 2796, 3005, 824, 1857,
+ /* 330 */ 1858, 52, 51, 2156, 2009, 58, 56, 55, 54, 53,
+ /* 340 */ 2084, 881, 2771, 868, 52, 51, 2954, 19, 58, 56,
+ /* 350 */ 55, 54, 53, 2470, 1990, 150, 34, 2755, 149, 148,
+ /* 360 */ 147, 146, 145, 144, 143, 142, 141, 59, 57, 400,
+ /* 370 */ 2814, 2775, 552, 2511, 2256, 500, 334, 1984, 1856, 1859,
+ /* 380 */ 2153, 2154, 2155, 204, 1003, 329, 2761, 15, 880, 115,
+ /* 390 */ 2185, 1982, 2534, 2089, 449, 691, 2009, 479, 334, 761,
+ /* 400 */ 460, 78, 52, 51, 527, 526, 58, 56, 55, 54,
+ /* 410 */ 53, 2532, 62, 200, 2914, 2915, 2156, 167, 2919, 2534,
+ /* 420 */ 506, 2777, 2780, 2084, 2092, 2093, 868, 490, 1991, 74,
+ /* 430 */ 19, 899, 2474, 2795, 903, 903, 2843, 1990, 2532, 2226,
+ /* 440 */ 133, 2797, 884, 2799, 2800, 879, 899, 2474, 867, 2844,
+ /* 450 */ 903, 160, 2066, 171, 266, 180, 2877, 2906, 675, 723,
+ /* 460 */ 2322, 494, 2902, 2045, 2055, 1655, 524, 1003, 116, 454,
+ /* 470 */ 15, 812, 2042, 2091, 2094, 2926, 2153, 2154, 2155, 2926,
+ /* 480 */ 2926, 2926, 2926, 2926, 612, 739, 738, 737, 1985, 611,
+ /* 490 */ 1983, 823, 729, 166, 733, 866, 547, 610, 732, 3004,
+ /* 500 */ 2814, 2255, 1885, 731, 736, 474, 473, 2092, 2093, 730,
+ /* 510 */ 556, 1657, 74, 472, 726, 725, 724, 822, 230, 2119,
+ /* 520 */ 237, 2100, 3005, 824, 1988, 1989, 2042, 2009, 2044, 2047,
+ /* 530 */ 2048, 2049, 2050, 2051, 2052, 2053, 2054, 876, 869, 558,
+ /* 540 */ 554, 901, 900, 865, 2076, 2077, 2045, 2055, 695, 2083,
+ /* 550 */ 2085, 2086, 2087, 2088, 2090, 2, 2091, 2094, 2926, 2153,
+ /* 560 */ 2154, 2155, 2926, 2926, 2926, 2926, 2926, 2046, 219, 40,
+ /* 570 */ 1717, 1985, 811, 1983, 940, 52, 51, 2771, 866, 58,
+ /* 580 */ 56, 55, 54, 53, 2120, 1708, 930, 929, 928, 1712,
+ /* 590 */ 927, 1714, 1715, 926, 923, 2603, 1723, 920, 1725, 1726,
+ /* 600 */ 917, 914, 911, 2214, 45, 336, 2775, 1988, 1989, 2042,
+ /* 610 */ 1994, 2044, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054,
+ /* 620 */ 876, 869, 336, 631, 901, 900, 865, 2076, 2077, 773,
+ /* 630 */ 2043, 2921, 2083, 2085, 2086, 2087, 2088, 2090, 2, 12,
+ /* 640 */ 59, 57, 2158, 2159, 2160, 2161, 2162, 197, 500, 2278,
+ /* 650 */ 1984, 770, 512, 2796, 471, 469, 2777, 2779, 495, 268,
+ /* 660 */ 2918, 2125, 839, 675, 1982, 2322, 2089, 12, 881, 10,
+ /* 670 */ 903, 805, 804, 2212, 2213, 2215, 2216, 2217, 590, 2598,
+ /* 680 */ 2629, 43, 496, 2114, 2115, 2116, 2117, 2118, 2122, 2123,
+ /* 690 */ 2124, 255, 2796, 315, 502, 393, 2084, 2814, 2046, 868,
+ /* 700 */ 2626, 885, 74, 19, 1564, 336, 1563, 878, 2629, 462,
+ /* 710 */ 1990, 682, 2668, 2761, 219, 880, 630, 254, 773, 789,
+ /* 720 */ 165, 12, 74, 59, 57, 2095, 63, 3004, 2627, 885,
+ /* 730 */ 628, 500, 248, 1984, 468, 466, 2814, 720, 621, 2598,
+ /* 740 */ 1003, 2602, 1565, 15, 117, 3010, 230, 1982, 568, 2089,
+ /* 750 */ 3005, 824, 2761, 567, 880, 480, 2676, 859, 722, 2878,
+ /* 760 */ 2795, 2043, 721, 2843, 2361, 899, 2474, 134, 2797, 884,
+ /* 770 */ 2799, 2800, 879, 2288, 669, 867, 2844, 903, 3008, 2084,
+ /* 780 */ 2092, 2093, 868, 667, 2906, 235, 663, 659, 2905, 2902,
+ /* 790 */ 52, 51, 253, 1990, 58, 56, 55, 54, 53, 2795,
+ /* 800 */ 775, 2668, 2843, 2458, 467, 789, 432, 2797, 884, 2799,
+ /* 810 */ 2800, 879, 877, 3004, 867, 2844, 903, 858, 2871, 2045,
+ /* 820 */ 2055, 2534, 566, 1003, 565, 194, 60, 899, 2474, 2091,
+ /* 830 */ 2094, 3010, 230, 2761, 1953, 2477, 3005, 824, 899, 2474,
+ /* 840 */ 842, 739, 738, 737, 1985, 515, 1983, 67, 729, 166,
+ /* 850 */ 733, 866, 343, 344, 732, 692, 564, 342, 572, 731,
+ /* 860 */ 736, 474, 473, 2092, 2093, 730, 511, 510, 689, 472,
+ /* 870 */ 726, 725, 724, 938, 186, 185, 935, 934, 933, 183,
+ /* 880 */ 1988, 1989, 2042, 184, 2044, 2047, 2048, 2049, 2050, 2051,
+ /* 890 */ 2052, 2053, 2054, 876, 869, 336, 808, 901, 900, 865,
+ /* 900 */ 2076, 2077, 2045, 2055, 1544, 2083, 2085, 2086, 2087, 2088,
+ /* 910 */ 2090, 2, 2091, 2094, 2616, 336, 693, 52, 51, 336,
+ /* 920 */ 1717, 58, 56, 55, 54, 53, 2450, 1985, 1990, 1983,
+ /* 930 */ 1542, 1543, 690, 2622, 866, 1708, 930, 929, 928, 1712,
+ /* 940 */ 927, 1714, 1715, 875, 874, 931, 1723, 873, 1725, 1726,
+ /* 950 */ 872, 914, 911, 52, 51, 954, 47, 58, 56, 55,
+ /* 960 */ 54, 53, 2287, 1988, 1989, 2042, 66, 2044, 2047, 2048,
+ /* 970 */ 2049, 2050, 2051, 2052, 2053, 2054, 876, 869, 899, 2474,
+ /* 980 */ 901, 900, 865, 2076, 2077, 2121, 746, 1650, 2083, 2085,
+ /* 990 */ 2086, 2087, 2088, 2090, 2, 59, 57, 1984, 573, 504,
+ /* 1000 */ 861, 760, 2878, 500, 219, 1984, 899, 2474, 2796, 899,
+ /* 1010 */ 2474, 1982, 899, 2474, 814, 809, 802, 798, 224, 1982,
+ /* 1020 */ 301, 2089, 2761, 881, 956, 2061, 592, 1952, 2714, 606,
+ /* 1030 */ 2286, 2602, 607, 1651, 52, 51, 749, 2013, 58, 56,
+ /* 1040 */ 55, 54, 53, 743, 741, 2534, 899, 2474, 2796, 48,
+ /* 1050 */ 298, 2084, 2814, 505, 868, 1667, 1564, 1990, 1563, 514,
+ /* 1060 */ 513, 2225, 2126, 881, 2532, 1990, 608, 2478, 2761, 1666,
+ /* 1070 */ 880, 938, 186, 185, 935, 934, 933, 183, 59, 57,
+ /* 1080 */ 899, 2474, 41, 899, 2474, 789, 500, 1003, 1984, 2581,
+ /* 1090 */ 2761, 112, 2814, 3004, 1565, 1003, 84, 386, 60, 2074,
+ /* 1100 */ 694, 83, 1982, 2471, 2089, 826, 14, 13, 2761, 465,
+ /* 1110 */ 880, 3010, 230, 38, 125, 2795, 3005, 824, 2843, 2469,
+ /* 1120 */ 2285, 393, 134, 2797, 884, 2799, 2800, 879, 769, 503,
+ /* 1130 */ 867, 2844, 903, 582, 2084, 2092, 2093, 868, 193, 2906,
+ /* 1140 */ 42, 2467, 2197, 862, 2902, 642, 52, 51, 1990, 2479,
+ /* 1150 */ 58, 56, 55, 54, 53, 2795, 899, 2474, 2843, 899,
+ /* 1160 */ 2474, 2701, 198, 2797, 884, 2799, 2800, 879, 899, 2474,
+ /* 1170 */ 867, 2844, 903, 2206, 2045, 2055, 306, 392, 1003, 314,
+ /* 1180 */ 2761, 60, 2677, 2013, 2091, 2094, 311, 2207, 841, 899,
+ /* 1190 */ 2474, 1985, 2534, 1983, 899, 2474, 899, 2474, 96, 1985,
+ /* 1200 */ 521, 1983, 899, 2474, 286, 2705, 866, 1567, 1568, 347,
+ /* 1210 */ 225, 2532, 790, 2964, 855, 172, 354, 1546, 2092, 2093,
+ /* 1220 */ 205, 2133, 892, 2008, 2009, 2466, 788, 1988, 1989, 712,
+ /* 1230 */ 708, 704, 700, 2205, 285, 1988, 1989, 2042, 2447, 2044,
+ /* 1240 */ 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 876, 869,
+ /* 1250 */ 2528, 2529, 901, 900, 865, 2076, 2077, 2045, 2055, 540,
+ /* 1260 */ 2083, 2085, 2086, 2087, 2088, 2090, 2, 2091, 2094, 52,
+ /* 1270 */ 51, 2014, 2013, 58, 56, 55, 54, 53, 899, 2474,
+ /* 1280 */ 113, 2682, 1985, 304, 1983, 283, 52, 51, 2534, 866,
+ /* 1290 */ 58, 56, 55, 54, 53, 52, 51, 523, 893, 58,
+ /* 1300 */ 56, 55, 54, 53, 52, 51, 193, 850, 58, 56,
+ /* 1310 */ 55, 54, 53, 899, 2474, 714, 713, 2479, 1988, 1989,
+ /* 1320 */ 2042, 2534, 2044, 2047, 2048, 2049, 2050, 2051, 2052, 2053,
+ /* 1330 */ 2054, 876, 869, 897, 39, 901, 900, 865, 2076, 2077,
+ /* 1340 */ 2533, 1671, 305, 2083, 2085, 2086, 2087, 2088, 2090, 2,
+ /* 1350 */ 59, 57, 271, 899, 2474, 1670, 233, 2178, 500, 2284,
+ /* 1360 */ 1984, 282, 2283, 2282, 2796, 273, 280, 72, 1911, 1912,
+ /* 1370 */ 2281, 278, 686, 382, 1982, 2280, 2089, 2062, 786, 881,
+ /* 1380 */ 2277, 2324, 2276, 938, 186, 185, 935, 934, 933, 183,
+ /* 1390 */ 270, 2275, 52, 51, 2064, 2046, 58, 56, 55, 54,
+ /* 1400 */ 53, 55, 54, 53, 2274, 221, 2084, 957, 2814, 868,
+ /* 1410 */ 2433, 170, 2067, 2273, 2877, 2272, 2271, 2014, 2921, 2761,
+ /* 1420 */ 1990, 2009, 2761, 2761, 2761, 2270, 880, 716, 715, 2536,
+ /* 1430 */ 2761, 644, 2921, 59, 57, 2761, 2269, 2715, 735, 734,
+ /* 1440 */ 2761, 500, 2761, 1984, 193, 968, 966, 2917, 906, 932,
+ /* 1450 */ 1003, 2761, 2525, 60, 817, 2480, 722, 1982, 2043, 2089,
+ /* 1460 */ 721, 2916, 52, 51, 2761, 90, 58, 56, 55, 54,
+ /* 1470 */ 53, 2795, 827, 2761, 2843, 2761, 2761, 830, 133, 2797,
+ /* 1480 */ 884, 2799, 2800, 879, 399, 2761, 867, 2844, 903, 2084,
+ /* 1490 */ 2092, 2093, 868, 3024, 789, 2906, 2761, 2294, 996, 494,
+ /* 1500 */ 2902, 46, 3004, 1990, 936, 937, 2014, 2525, 2525, 2478,
+ /* 1510 */ 52, 51, 2451, 3, 58, 56, 55, 54, 53, 103,
+ /* 1520 */ 3010, 230, 2408, 2167, 162, 3005, 824, 65, 291, 2045,
+ /* 1530 */ 2055, 289, 293, 1003, 295, 292, 15, 294, 102, 2091,
+ /* 1540 */ 2094, 176, 52, 51, 727, 175, 58, 56, 55, 54,
+ /* 1550 */ 53, 864, 297, 728, 1985, 296, 1983, 2345, 52, 51,
+ /* 1560 */ 2343, 866, 58, 56, 55, 54, 53, 1648, 763, 176,
+ /* 1570 */ 762, 796, 2326, 2092, 2093, 61, 1646, 61, 213, 740,
+ /* 1580 */ 2279, 766, 742, 2334, 640, 2258, 2259, 2967, 184, 341,
+ /* 1590 */ 1988, 1989, 2042, 806, 2044, 2047, 2048, 2049, 2050, 2051,
+ /* 1600 */ 2052, 2053, 2054, 876, 869, 744, 2332, 901, 900, 865,
+ /* 1610 */ 2076, 2077, 2045, 2055, 204, 2083, 2085, 2086, 2087, 2088,
+ /* 1620 */ 2090, 2, 2091, 2094, 1901, 1993, 89, 992, 747, 61,
+ /* 1630 */ 14, 13, 76, 445, 444, 61, 61, 1985, 789, 1983,
+ /* 1640 */ 61, 61, 2782, 507, 866, 1992, 3004, 89, 330, 181,
+ /* 1650 */ 2063, 774, 1909, 162, 2201, 2043, 907, 516, 2211, 2089,
+ /* 1660 */ 2210, 320, 322, 2177, 3010, 230, 2060, 836, 184, 3005,
+ /* 1670 */ 824, 840, 345, 1988, 1989, 2042, 86, 2044, 2047, 2048,
+ /* 1680 */ 2049, 2050, 2051, 2052, 2053, 2054, 876, 869, 164, 2084,
+ /* 1690 */ 901, 900, 865, 2076, 2077, 137, 361, 360, 2083, 2085,
+ /* 1700 */ 2086, 2087, 2088, 2090, 2, 441, 2784, 2007, 789, 847,
+ /* 1710 */ 363, 362, 2065, 909, 619, 2127, 3004, 464, 2075, 2068,
+ /* 1720 */ 365, 364, 195, 2056, 1854, 639, 182, 406, 2111, 184,
+ /* 1730 */ 1844, 2815, 357, 163, 3010, 230, 896, 367, 366, 3005,
+ /* 1740 */ 824, 598, 181, 641, 2400, 2399, 404, 88, 442, 600,
+ /* 1750 */ 87, 1699, 369, 368, 371, 370, 373, 372, 1628, 398,
+ /* 1760 */ 578, 443, 375, 374, 377, 376, 379, 378, 381, 380,
+ /* 1770 */ 131, 828, 128, 264, 654, 652, 649, 647, 831, 948,
+ /* 1780 */ 949, 2315, 2957, 1601, 803, 486, 810, 482, 844, 2607,
+ /* 1790 */ 531, 549, 2321, 2522, 782, 2958, 1730, 332, 2968, 818,
+ /* 1800 */ 819, 463, 1620, 1618, 1629, 327, 335, 1996, 2608, 1738,
+ /* 1810 */ 5, 2434, 1745, 586, 534, 539, 1743, 458, 2007, 74,
+ /* 1820 */ 548, 2017, 238, 559, 239, 187, 560, 1995, 562, 1602,
+ /* 1830 */ 391, 241, 1878, 2008, 576, 252, 583, 1975, 585, 1951,
+ /* 1840 */ 591, 589, 633, 609, 2609, 2588, 596, 627, 626, 625,
+ /* 1850 */ 624, 623, 618, 617, 616, 615, 446, 620, 75, 605,
+ /* 1860 */ 604, 603, 602, 601, 595, 594, 593, 2796, 588, 587,
+ /* 1870 */ 461, 509, 508, 1976, 579, 1818, 1819, 2600, 622, 629,
+ /* 1880 */ 646, 1837, 881, 632, 2961, 645, 643, 257, 634, 258,
+ /* 1890 */ 901, 900, 648, 650, 651, 261, 653, 655, 2083, 2085,
+ /* 1900 */ 2086, 2087, 2088, 2090, 2015, 4, 670, 671, 678, 681,
+ /* 1910 */ 269, 2814, 100, 99, 571, 679, 108, 243, 2010, 683,
+ /* 1920 */ 272, 2016, 684, 2018, 685, 275, 687, 2761, 277, 880,
+ /* 1930 */ 563, 561, 2019, 2623, 109, 2020, 110, 2617, 111, 696,
+ /* 1940 */ 717, 284, 750, 440, 719, 435, 550, 2464, 2796, 546,
+ /* 1950 */ 542, 538, 535, 564, 138, 751, 288, 765, 2460, 114,
+ /* 1960 */ 290, 767, 2011, 881, 776, 2974, 394, 189, 2691, 2688,
+ /* 1970 */ 177, 135, 307, 2462, 2795, 777, 2457, 2843, 2796, 190,
+ /* 1980 */ 310, 133, 2797, 884, 2799, 2800, 879, 2669, 191, 867,
+ /* 1990 */ 2844, 903, 2814, 881, 2687, 800, 3024, 784, 2906, 781,
+ /* 2000 */ 807, 312, 494, 2902, 2973, 2972, 845, 793, 2761, 8,
+ /* 2010 */ 880, 2945, 336, 816, 778, 203, 321, 324, 794, 792,
+ /* 2020 */ 821, 2925, 2814, 323, 791, 820, 487, 325, 328, 317,
+ /* 2030 */ 319, 3027, 783, 829, 832, 168, 2012, 2175, 2761, 2173,
+ /* 2040 */ 880, 326, 216, 1, 232, 337, 3003, 395, 331, 178,
+ /* 2050 */ 843, 2637, 396, 848, 179, 2795, 2636, 2635, 2843, 491,
+ /* 2060 */ 856, 2796, 133, 2797, 884, 2799, 2800, 879, 2922, 853,
+ /* 2070 */ 867, 2844, 903, 350, 73, 849, 881, 3024, 2997, 2906,
+ /* 2080 */ 886, 891, 888, 494, 2902, 2795, 890, 2887, 2843, 397,
+ /* 2090 */ 355, 2796, 133, 2797, 884, 2799, 2800, 879, 2475, 124,
+ /* 2100 */ 867, 2844, 903, 2753, 2752, 2814, 881, 3024, 2938, 2906,
+ /* 2110 */ 2748, 2747, 127, 494, 2902, 2739, 2738, 2730, 2729, 2745,
+ /* 2120 */ 2744, 2761, 2736, 880, 2735, 2724, 401, 1516, 384, 998,
+ /* 2130 */ 999, 2723, 2742, 1000, 995, 2814, 188, 64, 387, 423,
+ /* 2140 */ 2741, 2733, 905, 388, 1002, 2732, 769, 470, 405, 2721,
+ /* 2150 */ 518, 2761, 2720, 880, 434, 424, 2718, 2717, 2713, 2712,
+ /* 2160 */ 2526, 2711, 436, 403, 97, 2706, 536, 537, 2795, 1935,
+ /* 2170 */ 1936, 2843, 236, 541, 2704, 133, 2797, 884, 2799, 2800,
+ /* 2180 */ 879, 543, 544, 867, 2844, 903, 545, 1934, 2796, 2703,
+ /* 2190 */ 3024, 450, 2906, 2702, 451, 459, 494, 2902, 2795, 2700,
+ /* 2200 */ 551, 2843, 2699, 881, 553, 133, 2797, 884, 2799, 2800,
+ /* 2210 */ 879, 2698, 555, 867, 2844, 903, 2697, 557, 527, 526,
+ /* 2220 */ 3024, 1922, 2906, 2673, 240, 2672, 494, 2902, 1998, 242,
+ /* 2230 */ 1881, 2796, 2814, 98, 1880, 2650, 2649, 2648, 569, 570,
+ /* 2240 */ 2647, 2646, 1991, 2590, 2089, 574, 881, 1817, 2761, 577,
+ /* 2250 */ 880, 2587, 2586, 2580, 580, 581, 2577, 2576, 245, 101,
+ /* 2260 */ 2575, 2574, 2579, 2578, 2573, 247, 2572, 2570, 2569, 2796,
+ /* 2270 */ 2568, 2567, 2565, 249, 2084, 2814, 599, 2564, 597, 2563,
+ /* 2280 */ 2562, 2561, 2585, 2560, 881, 2559, 2558, 2583, 1990, 2566,
+ /* 2290 */ 2557, 2761, 2556, 880, 2555, 2795, 2553, 2552, 2843, 2551,
+ /* 2300 */ 2550, 2549, 133, 2797, 884, 2799, 2800, 879, 2548, 251,
+ /* 2310 */ 867, 2844, 903, 2814, 2547, 2546, 107, 2881, 863, 2906,
+ /* 2320 */ 2545, 2544, 2543, 494, 2902, 2615, 2584, 2582, 2542, 2761,
+ /* 2330 */ 2541, 880, 1823, 2540, 256, 2539, 636, 2538, 2795, 638,
+ /* 2340 */ 2537, 2843, 2535, 447, 2365, 133, 2797, 884, 2799, 2800,
+ /* 2350 */ 879, 1668, 259, 867, 2844, 903, 1672, 448, 2364, 1664,
+ /* 2360 */ 2879, 260, 2906, 2363, 2362, 2360, 494, 2902, 2357, 2356,
+ /* 2370 */ 262, 263, 656, 657, 660, 658, 2795, 2349, 661, 2843,
+ /* 2380 */ 211, 1545, 2796, 133, 2797, 884, 2799, 2800, 879, 662,
+ /* 2390 */ 664, 867, 2844, 903, 666, 665, 2336, 881, 860, 2310,
+ /* 2400 */ 2906, 93, 668, 265, 494, 2902, 2781, 2309, 2671, 2667,
+ /* 2410 */ 222, 676, 2657, 2645, 2644, 267, 94, 274, 2621, 2614,
+ /* 2420 */ 2452, 2359, 1999, 2355, 1994, 279, 2814, 276, 1594, 281,
+ /* 2430 */ 697, 699, 2353, 698, 701, 702, 703, 2351, 705, 706,
+ /* 2440 */ 2348, 707, 2761, 710, 880, 711, 709, 2331, 2329, 2796,
+ /* 2450 */ 2330, 2328, 2306, 2454, 2453, 1749, 1654, 85, 2002, 2004,
+ /* 2460 */ 1750, 1653, 1652, 1649, 881, 1647, 287, 1645, 1636, 2346,
+ /* 2470 */ 2344, 1644, 1643, 745, 1642, 901, 900, 1641, 1638, 2796,
+ /* 2480 */ 1637, 475, 965, 2083, 2085, 2086, 2087, 2088, 2090, 882,
+ /* 2490 */ 967, 1635, 2843, 2814, 881, 476, 134, 2797, 884, 2799,
+ /* 2500 */ 2800, 879, 2335, 477, 867, 2844, 903, 2333, 478, 2761,
+ /* 2510 */ 748, 880, 2305, 2906, 2304, 2303, 752, 453, 2902, 2302,
+ /* 2520 */ 754, 2301, 2300, 2814, 756, 758, 140, 1916, 1918, 1915,
+ /* 2530 */ 2670, 1920, 1891, 1906, 768, 2666, 1887, 33, 309, 2761,
+ /* 2540 */ 1889, 880, 68, 79, 69, 2656, 779, 313, 2643, 2642,
+ /* 2550 */ 3009, 17, 795, 22, 35, 780, 2795, 6, 316, 2843,
+ /* 2560 */ 7, 483, 23, 201, 2797, 884, 2799, 2800, 879, 771,
+ /* 2570 */ 24, 867, 2844, 903, 785, 1866, 1865, 2228, 787, 2202,
+ /* 2580 */ 192, 797, 801, 318, 2796, 799, 2795, 1006, 215, 2843,
+ /* 2590 */ 227, 2209, 202, 134, 2797, 884, 2799, 2800, 879, 881,
+ /* 2600 */ 37, 867, 2844, 903, 214, 2796, 390, 2782, 25, 36,
+ /* 2610 */ 2906, 2196, 95, 2168, 2166, 2903, 228, 2170, 77, 229,
+ /* 2620 */ 881, 994, 220, 2243, 26, 825, 3025, 2248, 2814, 2249,
+ /* 2630 */ 18, 990, 986, 982, 978, 2796, 385, 2242, 488, 2247,
+ /* 2640 */ 2246, 489, 2150, 2149, 2761, 333, 880, 71, 207, 2814,
+ /* 2650 */ 881, 2641, 2620, 118, 119, 2619, 340, 2204, 217, 346,
+ /* 2660 */ 846, 81, 120, 2613, 121, 2761, 852, 880, 348, 349,
+ /* 2670 */ 27, 2102, 854, 70, 351, 11, 2101, 13, 2000, 2814,
+ /* 2680 */ 21, 28, 132, 208, 29, 218, 20, 358, 49, 497,
+ /* 2690 */ 2059, 2795, 2058, 916, 2843, 2761, 2057, 880, 409, 2797,
+ /* 2700 */ 884, 2799, 2800, 879, 919, 32, 867, 2844, 903, 2027,
+ /* 2710 */ 2112, 922, 2795, 925, 50, 2843, 2035, 883, 851, 433,
+ /* 2720 */ 2797, 884, 2799, 2800, 879, 2796, 16, 867, 2844, 903,
+ /* 2730 */ 2612, 30, 31, 122, 82, 2449, 894, 887, 353, 123,
+ /* 2740 */ 881, 359, 2795, 128, 91, 2843, 895, 889, 2856, 198,
+ /* 2750 */ 2797, 884, 2799, 2800, 879, 2855, 902, 867, 2844, 903,
+ /* 2760 */ 2071, 80, 904, 356, 2262, 857, 2796, 908, 339, 2814,
+ /* 2770 */ 1731, 2261, 519, 338, 910, 912, 1728, 913, 383, 1722,
+ /* 2780 */ 1727, 881, 915, 1724, 918, 2761, 1718, 880, 921, 1716,
+ /* 2790 */ 924, 129, 308, 130, 1721, 1720, 1744, 92, 1719, 1740,
+ /* 2800 */ 2965, 1592, 939, 1632, 1631, 1630, 1627, 1624, 1623, 484,
+ /* 2810 */ 2814, 1622, 1621, 953, 1619, 1617, 1616, 955, 1615, 1662,
+ /* 2820 */ 1661, 234, 1613, 1612, 1610, 1611, 2761, 1609, 880, 1608,
+ /* 2830 */ 1607, 2796, 2795, 1658, 1656, 2843, 1604, 1603, 2354, 433,
+ /* 2840 */ 2797, 884, 2799, 2800, 879, 1600, 881, 867, 2844, 903,
+ /* 2850 */ 485, 2796, 1599, 1598, 1597, 975, 977, 976, 2352, 979,
+ /* 2860 */ 980, 981, 2350, 2347, 983, 984, 881, 988, 985, 987,
+ /* 2870 */ 989, 2796, 2327, 2795, 2325, 2814, 2843, 991, 993, 1534,
+ /* 2880 */ 433, 2797, 884, 2799, 2800, 879, 878, 2299, 867, 2844,
+ /* 2890 */ 903, 2761, 1517, 880, 997, 2814, 1522, 389, 1001, 1004,
+ /* 2900 */ 1524, 1986, 402, 1005, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 2910 */ 2265, 2761, 2265, 880, 2265, 2814, 2265, 2265, 2265, 2265,
+ /* 2920 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 2930 */ 2265, 2761, 2265, 880, 2265, 2265, 2265, 2265, 2795, 2265,
+ /* 2940 */ 2265, 2843, 2265, 2265, 2265, 426, 2797, 884, 2799, 2800,
+ /* 2950 */ 879, 2265, 2265, 867, 2844, 903, 2796, 2265, 2795, 2265,
+ /* 2960 */ 2265, 2843, 2265, 2265, 2265, 201, 2797, 884, 2799, 2800,
+ /* 2970 */ 879, 881, 2265, 867, 2844, 903, 2796, 2265, 2795, 2265,
+ /* 2980 */ 2265, 2843, 2265, 2265, 2265, 432, 2797, 884, 2799, 2800,
+ /* 2990 */ 879, 881, 2265, 867, 2844, 903, 2265, 2872, 2265, 815,
+ /* 3000 */ 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3010 */ 2265, 2265, 2265, 2265, 2265, 2265, 2761, 2265, 880, 2265,
+ /* 3020 */ 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 3026, 2265,
+ /* 3030 */ 2265, 2265, 2265, 2265, 2265, 2265, 2761, 2265, 880, 2265,
+ /* 3040 */ 498, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3050 */ 2265, 2265, 2796, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3060 */ 493, 2265, 2265, 2795, 2265, 2265, 2843, 881, 2265, 2265,
+ /* 3070 */ 433, 2797, 884, 2799, 2800, 879, 2265, 2265, 867, 2844,
+ /* 3080 */ 903, 2265, 2265, 2795, 2265, 2265, 2843, 2265, 2796, 2265,
+ /* 3090 */ 418, 2797, 884, 2799, 2800, 879, 2814, 2265, 867, 2844,
+ /* 3100 */ 903, 2265, 2265, 881, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3110 */ 2265, 2265, 2761, 2265, 880, 2265, 2265, 2265, 2265, 2265,
+ /* 3120 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2796,
+ /* 3130 */ 2265, 2265, 2814, 2265, 2265, 2265, 499, 2265, 2265, 2265,
+ /* 3140 */ 2265, 2265, 2265, 2265, 881, 2265, 2265, 2265, 2761, 2265,
+ /* 3150 */ 880, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2795,
+ /* 3160 */ 2265, 2265, 2843, 2265, 2265, 2265, 433, 2797, 884, 2799,
+ /* 3170 */ 2800, 879, 501, 2814, 867, 2844, 903, 2265, 2265, 2265,
+ /* 3180 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2761,
+ /* 3190 */ 2265, 880, 2265, 2265, 2265, 2795, 2265, 2265, 2843, 2265,
+ /* 3200 */ 2265, 2265, 433, 2797, 884, 2799, 2800, 879, 2265, 2265,
+ /* 3210 */ 867, 2844, 903, 2796, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3220 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 881, 2265,
+ /* 3230 */ 2265, 2265, 2265, 2265, 2796, 2265, 2795, 2265, 2265, 2843,
+ /* 3240 */ 2265, 2265, 2265, 414, 2797, 884, 2799, 2800, 879, 881,
+ /* 3250 */ 2265, 867, 2844, 903, 2265, 2265, 2265, 2814, 2265, 2265,
+ /* 3260 */ 2265, 2265, 2796, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3270 */ 2265, 2265, 2265, 2761, 2265, 880, 2265, 881, 2814, 2265,
+ /* 3280 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3290 */ 2265, 2265, 2265, 2265, 2761, 2265, 880, 2265, 2265, 2265,
+ /* 3300 */ 2265, 2265, 2796, 2265, 2265, 2265, 2814, 2265, 2265, 2265,
+ /* 3310 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 881, 2265, 2265,
+ /* 3320 */ 764, 2265, 2761, 2843, 880, 2265, 2265, 428, 2797, 884,
+ /* 3330 */ 2799, 2800, 879, 2265, 2265, 867, 2844, 903, 2265, 2265,
+ /* 3340 */ 2265, 2795, 2265, 2265, 2843, 2796, 2814, 2265, 410, 2797,
+ /* 3350 */ 884, 2799, 2800, 879, 2265, 2265, 867, 2844, 903, 2265,
+ /* 3360 */ 881, 2265, 2761, 2265, 880, 2265, 2265, 2265, 2265, 2795,
+ /* 3370 */ 2265, 2265, 2843, 2265, 2265, 2265, 407, 2797, 884, 2799,
+ /* 3380 */ 2800, 879, 2265, 2265, 867, 2844, 903, 2796, 2265, 2814,
+ /* 3390 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3400 */ 2265, 2265, 881, 2265, 2265, 2761, 2265, 880, 2265, 2795,
+ /* 3410 */ 2265, 2265, 2843, 2265, 2265, 2265, 411, 2797, 884, 2799,
+ /* 3420 */ 2800, 879, 2265, 2265, 867, 2844, 903, 2796, 2265, 2265,
+ /* 3430 */ 2265, 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3440 */ 2265, 2265, 881, 2265, 2265, 2265, 2265, 2761, 2265, 880,
+ /* 3450 */ 2265, 2265, 2795, 2265, 2265, 2843, 2265, 2265, 2265, 425,
+ /* 3460 */ 2797, 884, 2799, 2800, 879, 2265, 2265, 867, 2844, 903,
+ /* 3470 */ 2796, 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3480 */ 2265, 2265, 2265, 2265, 2265, 881, 2265, 2761, 2265, 880,
+ /* 3490 */ 2265, 2265, 2265, 2265, 2795, 2265, 2265, 2843, 2265, 2265,
+ /* 3500 */ 2265, 412, 2797, 884, 2799, 2800, 879, 2265, 2265, 867,
+ /* 3510 */ 2844, 903, 2265, 2265, 2814, 2265, 2796, 2265, 2265, 2265,
+ /* 3520 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3530 */ 2761, 881, 880, 2265, 2795, 2265, 2265, 2843, 2265, 2265,
+ /* 3540 */ 2265, 413, 2797, 884, 2799, 2800, 879, 2265, 2265, 867,
+ /* 3550 */ 2844, 903, 2265, 2796, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3560 */ 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 881, 2265,
+ /* 3570 */ 2265, 2265, 2265, 2265, 2265, 2265, 2761, 2795, 880, 2265,
+ /* 3580 */ 2843, 2265, 2265, 2265, 429, 2797, 884, 2799, 2800, 879,
+ /* 3590 */ 2265, 2265, 867, 2844, 903, 2265, 2265, 2814, 2265, 2796,
+ /* 3600 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3610 */ 2265, 2265, 2265, 2761, 881, 880, 2265, 2265, 2265, 2265,
+ /* 3620 */ 2265, 2796, 2265, 2795, 2265, 2265, 2843, 2265, 2265, 2265,
+ /* 3630 */ 415, 2797, 884, 2799, 2800, 879, 881, 2265, 867, 2844,
+ /* 3640 */ 903, 2265, 2265, 2814, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3650 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2761,
+ /* 3660 */ 2795, 880, 2265, 2843, 2796, 2814, 2265, 430, 2797, 884,
+ /* 3670 */ 2799, 2800, 879, 2265, 2265, 867, 2844, 903, 2265, 881,
+ /* 3680 */ 2265, 2761, 2265, 880, 2265, 2265, 2265, 2265, 2265, 2796,
+ /* 3690 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3700 */ 2265, 2265, 2265, 2265, 881, 2265, 2795, 2265, 2814, 2843,
+ /* 3710 */ 2796, 2265, 2265, 416, 2797, 884, 2799, 2800, 879, 2265,
+ /* 3720 */ 2265, 867, 2844, 903, 2761, 881, 880, 2265, 2795, 2265,
+ /* 3730 */ 2265, 2843, 2796, 2814, 2265, 431, 2797, 884, 2799, 2800,
+ /* 3740 */ 879, 2265, 2265, 867, 2844, 903, 2265, 881, 2265, 2761,
+ /* 3750 */ 2265, 880, 2265, 2265, 2814, 2265, 2265, 2265, 2265, 2265,
+ /* 3760 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3770 */ 2761, 2795, 880, 2265, 2843, 2265, 2814, 2265, 417, 2797,
+ /* 3780 */ 884, 2799, 2800, 879, 2265, 2265, 867, 2844, 903, 2265,
+ /* 3790 */ 2265, 2265, 2761, 2265, 880, 2265, 2795, 2265, 2265, 2843,
+ /* 3800 */ 2265, 2265, 2265, 408, 2797, 884, 2799, 2800, 879, 2265,
+ /* 3810 */ 2265, 867, 2844, 903, 2265, 2265, 2265, 2795, 2265, 2265,
+ /* 3820 */ 2843, 2265, 2265, 2265, 419, 2797, 884, 2799, 2800, 879,
+ /* 3830 */ 2265, 2265, 867, 2844, 903, 2265, 2265, 2265, 2265, 2795,
+ /* 3840 */ 2265, 2265, 2843, 2265, 2265, 2265, 420, 2797, 884, 2799,
+ /* 3850 */ 2800, 879, 2265, 2265, 867, 2844, 903, 2796, 2265, 2265,
+ /* 3860 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3870 */ 2265, 2265, 881, 2265, 2265, 2265, 2796, 2265, 2265, 2265,
+ /* 3880 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3890 */ 2265, 881, 2265, 2265, 2265, 2265, 2796, 2265, 2265, 2265,
+ /* 3900 */ 2265, 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3910 */ 2265, 881, 2265, 2265, 2265, 2265, 2265, 2761, 2265, 880,
+ /* 3920 */ 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3930 */ 2265, 2265, 2265, 2265, 2265, 2265, 2761, 2265, 880, 2265,
+ /* 3940 */ 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 3950 */ 2265, 2265, 2265, 2265, 2265, 2265, 2761, 2265, 880, 2265,
+ /* 3960 */ 2265, 2265, 2265, 2796, 2795, 2265, 2265, 2843, 2265, 2265,
+ /* 3970 */ 2265, 421, 2797, 884, 2799, 2800, 879, 2265, 881, 867,
+ /* 3980 */ 2844, 903, 2265, 2795, 2265, 2265, 2843, 2265, 2265, 2265,
+ /* 3990 */ 422, 2797, 884, 2799, 2800, 879, 2265, 2265, 867, 2844,
+ /* 4000 */ 903, 2796, 2265, 2795, 2265, 2265, 2843, 2814, 2265, 2265,
+ /* 4010 */ 438, 2797, 884, 2799, 2800, 879, 881, 2265, 867, 2844,
+ /* 4020 */ 903, 2265, 2265, 2761, 2265, 880, 2265, 2265, 2265, 2265,
+ /* 4030 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4040 */ 2265, 2265, 2265, 2265, 2265, 2814, 2265, 2796, 2265, 2265,
+ /* 4050 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4060 */ 2265, 2761, 881, 880, 2265, 2265, 2265, 2265, 2796, 2265,
+ /* 4070 */ 2795, 2265, 2265, 2843, 2265, 2265, 2265, 439, 2797, 884,
+ /* 4080 */ 2799, 2800, 879, 881, 2265, 867, 2844, 903, 2265, 2265,
+ /* 4090 */ 2265, 2814, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4100 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2761, 2795, 880,
+ /* 4110 */ 2265, 2843, 2814, 2265, 2265, 2808, 2797, 884, 2799, 2800,
+ /* 4120 */ 879, 2265, 2265, 867, 2844, 903, 2265, 2265, 2761, 2265,
+ /* 4130 */ 880, 2265, 2265, 2265, 2265, 2265, 2796, 2265, 2265, 2265,
+ /* 4140 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4150 */ 2265, 881, 2265, 2265, 2795, 2265, 2265, 2843, 2796, 2265,
+ /* 4160 */ 2265, 2807, 2797, 884, 2799, 2800, 879, 2265, 2265, 867,
+ /* 4170 */ 2844, 903, 2265, 881, 2265, 2795, 2265, 2265, 2843, 2796,
+ /* 4180 */ 2814, 2265, 2806, 2797, 884, 2799, 2800, 879, 2265, 2265,
+ /* 4190 */ 867, 2844, 903, 2265, 881, 2265, 2761, 2265, 880, 2265,
+ /* 4200 */ 2265, 2265, 2814, 2265, 2796, 2265, 2265, 2265, 2265, 2265,
+ /* 4210 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2761, 881,
+ /* 4220 */ 880, 2265, 2265, 2814, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4230 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2761,
+ /* 4240 */ 2265, 880, 2265, 2795, 2265, 2265, 2843, 2265, 2814, 2265,
+ /* 4250 */ 455, 2797, 884, 2799, 2800, 879, 2265, 2265, 867, 2844,
+ /* 4260 */ 903, 2265, 2265, 2265, 2761, 2795, 880, 2265, 2843, 2265,
+ /* 4270 */ 2265, 2265, 456, 2797, 884, 2799, 2800, 879, 2265, 2265,
+ /* 4280 */ 867, 2844, 903, 2265, 2265, 2265, 2795, 2265, 2265, 2843,
+ /* 4290 */ 2265, 2265, 2265, 452, 2797, 884, 2799, 2800, 879, 2265,
+ /* 4300 */ 2265, 867, 2844, 903, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4310 */ 2265, 2795, 2265, 2265, 2843, 2265, 2265, 2265, 457, 2797,
+ /* 4320 */ 884, 2799, 2800, 879, 2265, 2796, 867, 2844, 903, 2265,
+ /* 4330 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4340 */ 881, 2265, 2265, 2265, 2265, 2796, 2265, 2265, 2265, 2265,
+ /* 4350 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4360 */ 881, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2814,
+ /* 4370 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4380 */ 2265, 2265, 2265, 2265, 2265, 2761, 2265, 880, 2265, 2814,
+ /* 4390 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4400 */ 2265, 2265, 2265, 2265, 2265, 2761, 2265, 880, 2265, 2265,
+ /* 4410 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4420 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265,
+ /* 4430 */ 2265, 2265, 882, 2265, 2265, 2843, 2265, 2265, 2265, 428,
+ /* 4440 */ 2797, 884, 2799, 2800, 879, 2265, 2265, 867, 2844, 903,
+ /* 4450 */ 2265, 2265, 2795, 2265, 2265, 2843, 2265, 2265, 2265, 427,
+ /* 4460 */ 2797, 884, 2799, 2800, 879, 2265, 2265, 867, 2844, 903,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 527, 394, 527, 394, 397, 398, 397, 398, 535, 430,
- /* 10 */ 535, 415, 12, 13, 418, 12, 13, 14, 15, 16,
- /* 20 */ 20, 0, 22, 447, 421, 424, 553, 554, 425, 554,
- /* 30 */ 429, 558, 559, 558, 559, 424, 36, 461, 38, 0,
- /* 40 */ 429, 385, 21, 467, 468, 24, 25, 26, 27, 28,
- /* 50 */ 29, 30, 31, 32, 20, 20, 400, 456, 8, 9,
- /* 60 */ 399, 400, 12, 13, 14, 15, 16, 456, 68, 21,
- /* 70 */ 491, 71, 24, 25, 26, 27, 28, 29, 30, 31,
- /* 80 */ 32, 429, 82, 8, 9, 429, 21, 12, 13, 14,
- /* 90 */ 15, 16, 8, 9, 20, 20, 12, 13, 14, 15,
- /* 100 */ 16, 445, 37, 447, 39, 40, 41, 42, 456, 399,
- /* 110 */ 443, 399, 112, 446, 447, 115, 77, 78, 79, 80,
- /* 120 */ 81, 68, 83, 84, 85, 86, 87, 88, 89, 90,
+ /* 0 */ 529, 395, 0, 529, 398, 399, 395, 431, 537, 398,
+ /* 10 */ 399, 537, 12, 13, 444, 518, 519, 447, 448, 431,
+ /* 20 */ 20, 0, 22, 448, 20, 433, 555, 556, 436, 20,
+ /* 30 */ 556, 560, 561, 400, 560, 561, 36, 462, 38, 0,
+ /* 40 */ 386, 386, 21, 468, 469, 24, 25, 26, 27, 28,
+ /* 50 */ 29, 30, 31, 32, 21, 20, 401, 8, 9, 400,
+ /* 60 */ 401, 12, 13, 14, 15, 16, 0, 431, 68, 20,
+ /* 70 */ 37, 71, 39, 40, 41, 42, 74, 20, 442, 529,
+ /* 80 */ 400, 401, 82, 450, 451, 430, 453, 537, 496, 456,
+ /* 90 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 430,
+ /* 100 */ 446, 446, 510, 448, 400, 401, 556, 20, 439, 440,
+ /* 110 */ 560, 561, 112, 400, 401, 115, 77, 78, 79, 80,
+ /* 120 */ 81, 117, 83, 84, 85, 86, 87, 88, 89, 90,
/* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 492, 115,
- /* 150 */ 115, 495, 152, 153, 400, 499, 500, 501, 502, 503,
- /* 160 */ 504, 432, 432, 507, 508, 435, 116, 114, 458, 513,
- /* 170 */ 460, 515, 119, 8, 9, 519, 520, 12, 13, 14,
- /* 180 */ 15, 16, 385, 429, 523, 524, 525, 447, 527, 528,
- /* 190 */ 409, 191, 192, 481, 482, 539, 535, 400, 417, 408,
- /* 200 */ 116, 201, 202, 547, 0, 8, 9, 467, 468, 12,
- /* 210 */ 13, 14, 15, 16, 553, 554, 216, 426, 218, 558,
- /* 220 */ 559, 20, 44, 223, 495, 495, 429, 436, 24, 25,
- /* 230 */ 26, 27, 28, 29, 30, 31, 32, 508, 508, 186,
- /* 240 */ 75, 115, 445, 382, 447, 145, 146, 147, 148, 149,
- /* 250 */ 150, 151, 252, 253, 254, 501, 256, 257, 258, 259,
- /* 260 */ 260, 261, 262, 263, 264, 265, 266, 20, 193, 269,
+ /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 493, 4,
+ /* 150 */ 383, 496, 152, 153, 0, 500, 501, 502, 503, 504,
+ /* 160 */ 505, 152, 153, 508, 509, 510, 20, 454, 23, 433,
+ /* 170 */ 515, 429, 517, 68, 8, 9, 521, 522, 12, 13,
+ /* 180 */ 14, 15, 16, 386, 525, 526, 527, 445, 529, 530,
+ /* 190 */ 430, 191, 192, 48, 49, 50, 541, 20, 401, 439,
+ /* 200 */ 440, 201, 202, 20, 549, 525, 526, 527, 3, 529,
+ /* 210 */ 530, 12, 13, 14, 15, 16, 216, 537, 218, 114,
+ /* 220 */ 14, 20, 44, 223, 119, 20, 20, 430, 524, 525,
+ /* 230 */ 526, 527, 496, 529, 530, 555, 556, 155, 20, 472,
+ /* 240 */ 560, 561, 193, 446, 477, 448, 510, 410, 191, 192,
+ /* 250 */ 490, 491, 252, 253, 254, 418, 256, 257, 258, 259,
+ /* 260 */ 260, 261, 262, 263, 264, 265, 266, 400, 401, 269,
/* 270 */ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
- /* 280 */ 280, 281, 282, 12, 13, 14, 0, 385, 20, 492,
- /* 290 */ 125, 20, 495, 22, 399, 400, 499, 500, 501, 502,
- /* 300 */ 503, 504, 400, 20, 507, 508, 399, 36, 511, 38,
- /* 310 */ 513, 514, 515, 116, 447, 432, 519, 520, 8, 9,
- /* 320 */ 399, 400, 12, 13, 14, 15, 16, 430, 461, 254,
- /* 330 */ 14, 429, 471, 155, 467, 468, 20, 476, 441, 68,
- /* 340 */ 54, 307, 71, 33, 20, 20, 75, 445, 453, 447,
- /* 350 */ 527, 429, 268, 82, 4, 190, 449, 450, 535, 452,
- /* 360 */ 438, 439, 455, 20, 8, 9, 12, 13, 12, 13,
- /* 370 */ 14, 15, 16, 23, 20, 145, 22, 554, 495, 149,
- /* 380 */ 20, 558, 559, 112, 0, 117, 115, 385, 527, 395,
- /* 390 */ 36, 508, 38, 399, 492, 401, 535, 495, 48, 49,
- /* 400 */ 50, 499, 500, 501, 502, 503, 504, 505, 190, 507,
- /* 410 */ 508, 509, 510, 0, 553, 554, 155, 516, 517, 558,
- /* 420 */ 559, 0, 68, 152, 153, 71, 116, 4, 2, 75,
- /* 430 */ 20, 20, 267, 307, 8, 9, 82, 155, 12, 13,
- /* 440 */ 14, 15, 16, 522, 523, 524, 525, 445, 527, 528,
- /* 450 */ 3, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- /* 460 */ 295, 406, 191, 192, 395, 14, 112, 20, 399, 115,
- /* 470 */ 401, 20, 201, 202, 296, 297, 298, 299, 300, 301,
- /* 480 */ 302, 303, 304, 429, 20, 267, 22, 216, 433, 218,
- /* 490 */ 77, 78, 79, 439, 223, 152, 153, 84, 85, 86,
- /* 500 */ 36, 254, 0, 90, 286, 20, 152, 153, 95, 96,
- /* 510 */ 97, 98, 152, 153, 101, 191, 192, 74, 105, 106,
- /* 520 */ 107, 108, 58, 252, 253, 254, 115, 256, 257, 258,
- /* 530 */ 259, 260, 261, 262, 263, 264, 265, 266, 115, 155,
- /* 540 */ 269, 270, 271, 272, 385, 191, 192, 276, 277, 278,
- /* 550 */ 279, 280, 281, 282, 170, 201, 202, 22, 297, 298,
- /* 560 */ 299, 201, 202, 116, 208, 12, 13, 399, 400, 399,
- /* 570 */ 216, 36, 218, 399, 400, 22, 74, 223, 296, 297,
- /* 580 */ 298, 299, 300, 301, 302, 303, 304, 419, 13, 36,
- /* 590 */ 429, 38, 171, 419, 74, 8, 9, 176, 437, 12,
- /* 600 */ 13, 14, 15, 16, 445, 184, 252, 253, 254, 448,
- /* 610 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
- /* 620 */ 266, 68, 399, 269, 270, 271, 272, 115, 38, 471,
- /* 630 */ 276, 277, 278, 279, 280, 281, 282, 283, 12, 13,
- /* 640 */ 193, 529, 191, 531, 54, 428, 20, 112, 22, 22,
- /* 650 */ 112, 481, 482, 63, 64, 65, 66, 82, 68, 12,
- /* 660 */ 13, 444, 36, 36, 38, 127, 128, 129, 130, 131,
- /* 670 */ 132, 133, 134, 135, 136, 406, 138, 139, 140, 141,
- /* 680 */ 142, 143, 144, 36, 126, 527, 463, 464, 527, 14,
- /* 690 */ 334, 429, 423, 535, 68, 20, 535, 71, 146, 437,
- /* 700 */ 283, 75, 433, 116, 114, 254, 82, 416, 82, 119,
- /* 710 */ 448, 553, 554, 228, 553, 554, 558, 559, 307, 558,
- /* 720 */ 559, 12, 13, 14, 300, 301, 302, 303, 304, 20,
- /* 730 */ 307, 22, 429, 112, 36, 384, 445, 386, 112, 112,
- /* 740 */ 252, 115, 385, 399, 400, 36, 416, 38, 127, 128,
- /* 750 */ 129, 130, 131, 132, 133, 134, 135, 136, 126, 138,
- /* 760 */ 139, 140, 141, 142, 143, 144, 399, 400, 20, 216,
- /* 770 */ 22, 218, 52, 41, 42, 445, 186, 68, 152, 153,
- /* 780 */ 71, 399, 400, 231, 232, 195, 495, 496, 497, 199,
- /* 790 */ 200, 82, 489, 490, 34, 205, 206, 453, 430, 508,
- /* 800 */ 36, 419, 445, 250, 251, 252, 58, 319, 320, 321,
- /* 810 */ 322, 323, 324, 325, 224, 399, 400, 191, 192, 307,
- /* 820 */ 453, 112, 269, 270, 115, 495, 496, 201, 202, 276,
- /* 830 */ 277, 278, 279, 280, 281, 419, 430, 431, 508, 77,
- /* 840 */ 78, 79, 216, 427, 218, 73, 84, 85, 86, 223,
- /* 850 */ 446, 447, 90, 121, 122, 420, 124, 95, 96, 97,
- /* 860 */ 98, 152, 153, 101, 429, 218, 191, 105, 106, 107,
- /* 870 */ 108, 146, 147, 399, 400, 440, 151, 145, 252, 253,
- /* 880 */ 254, 149, 256, 257, 258, 259, 260, 261, 262, 263,
- /* 890 */ 264, 265, 266, 419, 4, 269, 270, 271, 272, 36,
- /* 900 */ 191, 192, 276, 277, 278, 279, 280, 281, 282, 19,
- /* 910 */ 201, 202, 498, 193, 8, 9, 218, 385, 12, 13,
- /* 920 */ 14, 15, 16, 511, 204, 216, 514, 218, 38, 254,
- /* 930 */ 8, 9, 223, 430, 12, 13, 14, 15, 16, 442,
- /* 940 */ 526, 471, 445, 22, 54, 82, 476, 54, 250, 251,
- /* 950 */ 115, 61, 62, 47, 59, 60, 63, 36, 68, 66,
- /* 960 */ 67, 252, 253, 254, 186, 256, 257, 258, 259, 260,
- /* 970 */ 261, 262, 263, 264, 265, 266, 429, 445, 269, 270,
- /* 980 */ 271, 272, 218, 211, 437, 276, 277, 278, 279, 280,
- /* 990 */ 281, 282, 12, 13, 22, 448, 385, 527, 220, 471,
- /* 1000 */ 20, 420, 22, 82, 114, 535, 399, 400, 36, 119,
- /* 1010 */ 429, 400, 240, 241, 250, 251, 36, 429, 38, 399,
- /* 1020 */ 400, 440, 116, 553, 554, 437, 419, 47, 558, 559,
- /* 1030 */ 14, 15, 16, 112, 385, 430, 448, 429, 116, 419,
- /* 1040 */ 429, 23, 385, 4, 399, 400, 438, 439, 68, 400,
- /* 1050 */ 215, 71, 217, 430, 82, 527, 445, 385, 447, 399,
- /* 1060 */ 400, 430, 82, 535, 419, 8, 9, 49, 50, 12,
- /* 1070 */ 13, 14, 15, 16, 13, 12, 13, 498, 429, 419,
- /* 1080 */ 20, 553, 554, 20, 249, 22, 558, 559, 399, 400,
- /* 1090 */ 404, 405, 112, 430, 445, 115, 447, 489, 490, 36,
- /* 1100 */ 429, 38, 445, 492, 47, 526, 495, 385, 419, 425,
- /* 1110 */ 499, 500, 501, 502, 503, 504, 2, 445, 507, 508,
- /* 1120 */ 399, 400, 8, 9, 413, 414, 12, 13, 14, 15,
- /* 1130 */ 16, 68, 152, 153, 71, 20, 283, 216, 285, 218,
- /* 1140 */ 419, 492, 307, 82, 495, 82, 399, 400, 499, 500,
- /* 1150 */ 501, 502, 503, 504, 1, 2, 507, 508, 196, 548,
- /* 1160 */ 549, 490, 513, 512, 515, 514, 419, 445, 519, 520,
- /* 1170 */ 486, 191, 192, 252, 253, 112, 413, 414, 115, 399,
- /* 1180 */ 400, 201, 202, 8, 9, 399, 400, 12, 13, 14,
- /* 1190 */ 15, 16, 399, 400, 404, 405, 216, 498, 218, 419,
- /* 1200 */ 8, 9, 0, 223, 12, 13, 14, 15, 16, 512,
- /* 1210 */ 20, 514, 419, 8, 9, 152, 153, 12, 13, 14,
- /* 1220 */ 15, 16, 8, 9, 22, 526, 12, 13, 14, 15,
- /* 1230 */ 16, 0, 252, 253, 254, 20, 256, 257, 258, 259,
- /* 1240 */ 260, 261, 262, 263, 264, 265, 266, 388, 389, 269,
- /* 1250 */ 270, 271, 272, 193, 191, 192, 276, 277, 278, 279,
- /* 1260 */ 280, 281, 282, 0, 201, 202, 8, 9, 429, 116,
- /* 1270 */ 12, 13, 14, 15, 16, 313, 314, 315, 316, 216,
- /* 1280 */ 429, 218, 399, 400, 399, 400, 223, 448, 8, 9,
- /* 1290 */ 408, 116, 12, 13, 14, 15, 16, 399, 400, 448,
- /* 1300 */ 3, 385, 419, 471, 419, 47, 191, 20, 116, 523,
- /* 1310 */ 524, 525, 427, 527, 528, 252, 253, 254, 436, 256,
- /* 1320 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
- /* 1330 */ 399, 400, 269, 270, 271, 272, 0, 399, 400, 276,
- /* 1340 */ 277, 278, 279, 280, 281, 282, 12, 13, 309, 442,
- /* 1350 */ 419, 18, 445, 20, 20, 385, 22, 419, 385, 527,
- /* 1360 */ 27, 445, 429, 30, 234, 33, 236, 535, 471, 254,
- /* 1370 */ 36, 38, 38, 440, 20, 471, 145, 146, 147, 148,
- /* 1380 */ 149, 150, 151, 399, 400, 553, 554, 54, 385, 56,
- /* 1390 */ 558, 559, 385, 147, 61, 62, 116, 151, 442, 33,
- /* 1400 */ 33, 445, 68, 419, 0, 71, 73, 193, 145, 146,
- /* 1410 */ 147, 148, 149, 150, 151, 445, 82, 385, 445, 12,
- /* 1420 */ 13, 523, 524, 525, 527, 527, 528, 33, 385, 22,
- /* 1430 */ 44, 527, 535, 399, 400, 91, 14, 120, 126, 535,
- /* 1440 */ 123, 47, 20, 36, 254, 38, 112, 114, 445, 115,
- /* 1450 */ 553, 554, 445, 419, 68, 558, 559, 553, 554, 126,
- /* 1460 */ 8, 9, 558, 559, 12, 13, 14, 15, 16, 254,
- /* 1470 */ 33, 225, 267, 385, 385, 68, 230, 445, 385, 233,
- /* 1480 */ 193, 235, 33, 116, 399, 400, 152, 153, 445, 82,
- /* 1490 */ 157, 158, 180, 160, 161, 162, 163, 164, 165, 166,
- /* 1500 */ 167, 168, 169, 159, 419, 172, 173, 174, 175, 176,
- /* 1510 */ 177, 178, 179, 385, 181, 182, 183, 0, 385, 112,
- /* 1520 */ 187, 188, 189, 399, 400, 191, 192, 194, 184, 185,
- /* 1530 */ 429, 399, 400, 445, 445, 201, 202, 0, 445, 36,
- /* 1540 */ 33, 254, 198, 419, 13, 120, 13, 193, 123, 448,
- /* 1550 */ 216, 419, 218, 116, 47, 120, 68, 223, 123, 155,
- /* 1560 */ 120, 44, 0, 123, 75, 116, 13, 36, 33, 36,
- /* 1570 */ 33, 33, 33, 445, 33, 152, 153, 477, 445, 0,
- /* 1580 */ 244, 1, 2, 33, 22, 82, 252, 253, 254, 36,
- /* 1590 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
- /* 1600 */ 266, 22, 0, 269, 270, 271, 272, 119, 254, 33,
- /* 1610 */ 276, 277, 278, 279, 280, 281, 282, 18, 33, 33,
- /* 1620 */ 385, 33, 23, 216, 22, 218, 329, 115, 33, 117,
- /* 1630 */ 33, 386, 51, 33, 33, 400, 33, 33, 33, 12,
- /* 1640 */ 13, 42, 43, 12, 13, 46, 12, 13, 12, 13,
- /* 1650 */ 385, 116, 12, 13, 116, 116, 57, 116, 36, 252,
- /* 1660 */ 253, 12, 13, 331, 429, 400, 116, 402, 69, 70,
- /* 1670 */ 71, 72, 73, 12, 13, 33, 269, 270, 12, 13,
- /* 1680 */ 445, 417, 447, 276, 277, 278, 279, 280, 281, 12,
- /* 1690 */ 13, 33, 116, 33, 429, 36, 115, 12, 13, 333,
- /* 1700 */ 33, 116, 116, 33, 116, 12, 13, 0, 33, 13,
- /* 1710 */ 445, 116, 447, 116, 115, 36, 116, 116, 457, 116,
- /* 1720 */ 116, 116, 529, 562, 36, 551, 544, 492, 530, 403,
- /* 1730 */ 495, 429, 36, 398, 499, 500, 501, 502, 503, 504,
- /* 1740 */ 416, 252, 507, 508, 416, 457, 550, 550, 513, 550,
- /* 1750 */ 515, 470, 457, 154, 519, 520, 385, 492, 116, 550,
- /* 1760 */ 495, 82, 55, 403, 499, 500, 501, 502, 503, 504,
- /* 1770 */ 82, 400, 507, 508, 116, 385, 116, 493, 513, 400,
- /* 1780 */ 515, 444, 547, 116, 519, 520, 116, 478, 457, 534,
- /* 1790 */ 400, 116, 402, 534, 555, 457, 521, 537, 457, 418,
- /* 1800 */ 429, 310, 472, 20, 54, 494, 20, 208, 209, 210,
- /* 1810 */ 399, 233, 213, 488, 408, 399, 445, 408, 447, 429,
- /* 1820 */ 214, 474, 483, 483, 20, 226, 227, 400, 47, 454,
- /* 1830 */ 400, 454, 399, 190, 451, 445, 400, 447, 239, 454,
- /* 1840 */ 218, 242, 399, 451, 245, 246, 247, 248, 249, 451,
- /* 1850 */ 451, 113, 111, 412, 399, 411, 399, 110, 410, 399,
- /* 1860 */ 399, 399, 20, 492, 392, 52, 495, 396, 392, 396,
- /* 1870 */ 499, 500, 501, 502, 503, 504, 483, 218, 507, 508,
- /* 1880 */ 20, 447, 492, 408, 385, 495, 408, 408, 20, 499,
- /* 1890 */ 500, 501, 502, 503, 504, 401, 20, 507, 508, 400,
- /* 1900 */ 408, 402, 473, 513, 408, 515, 307, 401, 20, 519,
- /* 1910 */ 520, 464, 408, 20, 458, 399, 408, 408, 408, 392,
- /* 1920 */ 399, 385, 429, 237, 429, 445, 429, 429, 429, 429,
- /* 1930 */ 429, 560, 561, 388, 429, 388, 400, 487, 402, 115,
- /* 1940 */ 429, 392, 429, 429, 445, 20, 447, 429, 485, 483,
- /* 1950 */ 406, 482, 222, 221, 480, 472, 479, 406, 399, 318,
- /* 1960 */ 445, 543, 317, 543, 445, 429, 207, 447, 445, 545,
- /* 1970 */ 326, 306, 385, 542, 546, 543, 328, 327, 305, 541,
- /* 1980 */ 563, 445, 311, 447, 533, 540, 532, 400, 335, 402,
- /* 1990 */ 465, 492, 330, 465, 495, 332, 472, 20, 499, 500,
- /* 2000 */ 501, 502, 503, 504, 126, 538, 507, 508, 385, 400,
- /* 2010 */ 557, 308, 513, 401, 515, 556, 429, 536, 519, 520,
- /* 2020 */ 498, 406, 406, 400, 199, 402, 465, 445, 492, 445,
- /* 2030 */ 465, 495, 445, 462, 447, 499, 500, 501, 502, 503,
- /* 2040 */ 504, 445, 115, 507, 508, 406, 199, 458, 518, 513,
- /* 2050 */ 459, 515, 429, 445, 385, 519, 520, 406, 445, 445,
- /* 2060 */ 406, 406, 445, 425, 400, 458, 445, 115, 445, 400,
- /* 2070 */ 447, 445, 22, 445, 445, 445, 387, 445, 445, 492,
- /* 2080 */ 445, 399, 495, 35, 37, 390, 499, 500, 501, 502,
- /* 2090 */ 503, 504, 445, 391, 507, 508, 385, 445, 429, 40,
- /* 2100 */ 513, 445, 515, 406, 484, 393, 519, 520, 392, 491,
- /* 2110 */ 383, 400, 434, 445, 445, 492, 447, 445, 495, 445,
- /* 2120 */ 422, 445, 499, 500, 501, 502, 503, 504, 445, 445,
- /* 2130 */ 507, 508, 445, 407, 385, 445, 513, 445, 515, 445,
- /* 2140 */ 429, 431, 519, 520, 445, 445, 422, 466, 431, 400,
- /* 2150 */ 422, 0, 0, 0, 47, 475, 445, 466, 447, 0,
- /* 2160 */ 36, 492, 243, 36, 495, 36, 36, 243, 499, 500,
- /* 2170 */ 501, 502, 503, 504, 0, 36, 507, 508, 429, 36,
- /* 2180 */ 243, 36, 513, 0, 515, 0, 243, 0, 519, 520,
- /* 2190 */ 36, 0, 36, 0, 445, 22, 447, 0, 36, 238,
- /* 2200 */ 0, 0, 224, 492, 224, 218, 495, 225, 216, 0,
- /* 2210 */ 499, 500, 501, 502, 503, 504, 212, 211, 507, 508,
- /* 2220 */ 0, 385, 0, 0, 513, 0, 515, 158, 51, 51,
- /* 2230 */ 519, 520, 0, 0, 36, 0, 400, 0, 36, 51,
- /* 2240 */ 54, 492, 0, 47, 495, 0, 0, 0, 499, 500,
- /* 2250 */ 501, 502, 503, 504, 1, 51, 507, 508, 0, 0,
- /* 2260 */ 0, 0, 0, 0, 515, 429, 176, 36, 519, 520,
- /* 2270 */ 385, 0, 19, 176, 0, 0, 0, 0, 0, 0,
- /* 2280 */ 0, 445, 0, 447, 0, 400, 0, 0, 0, 0,
- /* 2290 */ 0, 38, 0, 0, 0, 0, 0, 0, 0, 51,
- /* 2300 */ 0, 47, 0, 0, 0, 0, 53, 54, 0, 0,
- /* 2310 */ 0, 0, 0, 22, 429, 158, 63, 64, 65, 66,
- /* 2320 */ 0, 68, 157, 0, 156, 0, 0, 0, 492, 22,
- /* 2330 */ 445, 495, 447, 52, 68, 499, 500, 501, 502, 503,
- /* 2340 */ 504, 22, 0, 507, 508, 0, 0, 0, 0, 36,
- /* 2350 */ 0, 515, 36, 52, 0, 519, 520, 36, 0, 0,
- /* 2360 */ 0, 0, 44, 14, 36, 0, 36, 114, 44, 33,
- /* 2370 */ 0, 54, 119, 0, 68, 385, 54, 492, 44, 47,
- /* 2380 */ 495, 0, 68, 68, 499, 500, 501, 502, 503, 504,
- /* 2390 */ 400, 54, 507, 508, 51, 44, 0, 45, 0, 207,
- /* 2400 */ 515, 0, 385, 150, 519, 520, 51, 44, 51, 76,
- /* 2410 */ 44, 0, 0, 51, 36, 51, 44, 400, 0, 429,
- /* 2420 */ 36, 385, 54, 54, 44, 0, 36, 44, 54, 0,
- /* 2430 */ 36, 54, 44, 0, 0, 445, 400, 447, 0, 0,
- /* 2440 */ 0, 0, 385, 36, 22, 0, 429, 33, 195, 22,
- /* 2450 */ 197, 36, 36, 200, 33, 36, 125, 400, 205, 36,
- /* 2460 */ 36, 123, 445, 0, 447, 429, 36, 36, 36, 22,
- /* 2470 */ 22, 36, 36, 36, 0, 22, 0, 224, 36, 22,
- /* 2480 */ 0, 445, 492, 447, 56, 495, 429, 22, 385, 499,
- /* 2490 */ 500, 501, 502, 503, 504, 36, 0, 507, 508, 0,
- /* 2500 */ 0, 0, 445, 400, 447, 515, 36, 36, 0, 492,
- /* 2510 */ 520, 36, 495, 0, 22, 20, 499, 500, 501, 502,
- /* 2520 */ 503, 504, 36, 506, 507, 508, 469, 36, 492, 36,
- /* 2530 */ 0, 495, 429, 116, 193, 499, 500, 501, 502, 503,
- /* 2540 */ 504, 115, 0, 507, 508, 51, 193, 36, 445, 492,
- /* 2550 */ 447, 22, 495, 0, 22, 385, 499, 500, 501, 502,
- /* 2560 */ 503, 504, 0, 228, 507, 508, 115, 223, 229, 193,
- /* 2570 */ 400, 0, 469, 3, 385, 193, 33, 312, 199, 193,
- /* 2580 */ 116, 115, 115, 36, 116, 549, 219, 115, 203, 400,
- /* 2590 */ 203, 36, 52, 52, 113, 492, 111, 33, 495, 429,
- /* 2600 */ 33, 385, 499, 500, 501, 502, 503, 504, 33, 51,
- /* 2610 */ 507, 508, 51, 116, 116, 445, 400, 447, 429, 115,
- /* 2620 */ 33, 115, 115, 3, 33, 116, 82, 115, 36, 33,
- /* 2630 */ 116, 115, 51, 116, 445, 116, 447, 36, 36, 36,
- /* 2640 */ 36, 36, 36, 116, 116, 429, 33, 0, 51, 0,
- /* 2650 */ 115, 44, 312, 116, 116, 0, 196, 0, 44, 44,
- /* 2660 */ 115, 445, 492, 447, 115, 495, 116, 115, 195, 499,
- /* 2670 */ 500, 501, 502, 503, 504, 115, 33, 507, 508, 200,
- /* 2680 */ 2, 492, 113, 312, 495, 296, 196, 284, 499, 500,
- /* 2690 */ 501, 502, 503, 504, 22, 113, 507, 508, 252, 115,
- /* 2700 */ 115, 115, 51, 115, 51, 116, 22, 255, 492, 116,
- /* 2710 */ 115, 495, 0, 115, 385, 499, 500, 501, 502, 503,
- /* 2720 */ 504, 44, 552, 507, 508, 115, 510, 115, 117, 400,
- /* 2730 */ 196, 0, 115, 22, 116, 116, 115, 115, 115, 115,
- /* 2740 */ 115, 385, 116, 115, 115, 118, 51, 115, 115, 115,
- /* 2750 */ 561, 116, 115, 229, 22, 116, 400, 126, 429, 36,
- /* 2760 */ 36, 115, 36, 36, 116, 115, 36, 137, 116, 36,
- /* 2770 */ 116, 36, 116, 137, 445, 116, 447, 137, 385, 137,
- /* 2780 */ 115, 33, 115, 36, 115, 429, 22, 22, 36, 76,
- /* 2790 */ 75, 36, 36, 400, 36, 109, 36, 36, 469, 36,
- /* 2800 */ 82, 445, 36, 447, 36, 385, 36, 36, 109, 33,
- /* 2810 */ 82, 36, 22, 36, 36, 36, 36, 36, 82, 36,
- /* 2820 */ 400, 492, 429, 36, 495, 469, 22, 36, 499, 500,
- /* 2830 */ 501, 502, 503, 504, 36, 36, 507, 508, 445, 36,
- /* 2840 */ 447, 0, 36, 54, 44, 0, 36, 54, 492, 429,
- /* 2850 */ 0, 495, 44, 36, 0, 499, 500, 501, 502, 503,
- /* 2860 */ 504, 54, 469, 507, 508, 445, 44, 447, 36, 385,
- /* 2870 */ 54, 44, 0, 36, 0, 22, 36, 0, 22, 33,
- /* 2880 */ 36, 22, 21, 36, 400, 492, 22, 22, 495, 469,
- /* 2890 */ 385, 21, 499, 500, 501, 502, 503, 504, 20, 564,
- /* 2900 */ 507, 508, 564, 564, 564, 400, 564, 564, 564, 564,
- /* 2910 */ 385, 564, 492, 429, 564, 495, 564, 564, 564, 499,
- /* 2920 */ 500, 501, 502, 503, 504, 400, 564, 507, 508, 445,
- /* 2930 */ 564, 447, 564, 564, 429, 564, 385, 564, 564, 564,
- /* 2940 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 2950 */ 445, 400, 447, 564, 429, 564, 564, 564, 564, 564,
- /* 2960 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 2970 */ 445, 564, 447, 564, 564, 385, 492, 564, 564, 495,
- /* 2980 */ 429, 564, 564, 499, 500, 501, 502, 503, 504, 564,
- /* 2990 */ 400, 507, 508, 564, 564, 564, 445, 492, 447, 564,
- /* 3000 */ 495, 385, 564, 564, 499, 500, 501, 502, 503, 504,
- /* 3010 */ 564, 564, 507, 508, 564, 564, 400, 492, 564, 429,
- /* 3020 */ 495, 564, 564, 564, 499, 500, 501, 502, 503, 504,
- /* 3030 */ 564, 564, 507, 508, 564, 445, 564, 447, 564, 564,
- /* 3040 */ 564, 564, 564, 492, 564, 429, 495, 564, 564, 564,
- /* 3050 */ 499, 500, 501, 502, 503, 504, 564, 564, 507, 508,
- /* 3060 */ 564, 445, 564, 447, 564, 564, 564, 564, 564, 564,
- /* 3070 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3080 */ 564, 564, 492, 564, 564, 495, 564, 564, 564, 499,
- /* 3090 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 564,
- /* 3100 */ 564, 564, 564, 564, 564, 564, 385, 564, 492, 564,
- /* 3110 */ 564, 495, 564, 564, 564, 499, 500, 501, 502, 503,
- /* 3120 */ 504, 400, 564, 507, 508, 564, 564, 385, 564, 564,
- /* 3130 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3140 */ 564, 564, 400, 564, 385, 564, 564, 564, 564, 564,
- /* 3150 */ 429, 564, 564, 564, 564, 564, 564, 564, 564, 400,
- /* 3160 */ 564, 564, 564, 564, 564, 564, 445, 564, 447, 564,
- /* 3170 */ 564, 429, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3180 */ 564, 564, 564, 564, 564, 564, 564, 445, 429, 447,
- /* 3190 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3200 */ 564, 564, 564, 564, 445, 564, 447, 564, 564, 564,
- /* 3210 */ 564, 385, 564, 492, 564, 564, 495, 564, 564, 564,
- /* 3220 */ 499, 500, 501, 502, 503, 504, 400, 564, 507, 508,
- /* 3230 */ 564, 564, 564, 564, 492, 564, 564, 495, 564, 564,
- /* 3240 */ 564, 499, 500, 501, 502, 503, 504, 564, 564, 507,
- /* 3250 */ 508, 492, 564, 385, 495, 429, 564, 564, 499, 500,
- /* 3260 */ 501, 502, 503, 504, 564, 564, 507, 508, 400, 564,
- /* 3270 */ 564, 445, 564, 447, 564, 385, 564, 564, 564, 564,
- /* 3280 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3290 */ 400, 564, 564, 564, 564, 564, 385, 429, 564, 564,
- /* 3300 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3310 */ 564, 400, 564, 445, 564, 447, 564, 385, 492, 429,
- /* 3320 */ 564, 495, 564, 564, 564, 499, 500, 501, 502, 503,
- /* 3330 */ 504, 564, 400, 507, 508, 445, 564, 447, 564, 564,
- /* 3340 */ 429, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3350 */ 564, 564, 564, 564, 564, 564, 445, 564, 447, 564,
- /* 3360 */ 492, 429, 564, 495, 564, 564, 564, 499, 500, 501,
- /* 3370 */ 502, 503, 504, 564, 564, 507, 508, 445, 564, 447,
- /* 3380 */ 564, 564, 492, 564, 385, 495, 564, 564, 564, 499,
- /* 3390 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 400,
- /* 3400 */ 564, 564, 564, 492, 564, 385, 495, 564, 564, 564,
- /* 3410 */ 499, 500, 501, 502, 503, 504, 564, 564, 507, 508,
- /* 3420 */ 400, 564, 564, 564, 492, 564, 564, 495, 429, 564,
- /* 3430 */ 564, 499, 500, 501, 502, 503, 504, 564, 564, 507,
- /* 3440 */ 508, 564, 564, 564, 445, 564, 447, 564, 564, 429,
- /* 3450 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3460 */ 564, 564, 564, 564, 564, 445, 564, 447, 564, 564,
- /* 3470 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3480 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3490 */ 564, 492, 564, 564, 495, 564, 564, 564, 499, 500,
- /* 3500 */ 501, 502, 503, 504, 564, 564, 507, 508, 564, 564,
- /* 3510 */ 385, 564, 492, 564, 564, 495, 564, 564, 564, 499,
- /* 3520 */ 500, 501, 502, 503, 504, 400, 564, 507, 508, 564,
- /* 3530 */ 385, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3540 */ 564, 564, 564, 564, 564, 400, 564, 564, 564, 564,
- /* 3550 */ 564, 564, 385, 564, 429, 564, 564, 564, 564, 564,
- /* 3560 */ 564, 564, 564, 564, 564, 564, 564, 400, 564, 564,
- /* 3570 */ 445, 564, 447, 564, 429, 564, 564, 564, 564, 564,
- /* 3580 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3590 */ 445, 564, 447, 564, 564, 564, 429, 564, 564, 564,
- /* 3600 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3610 */ 564, 564, 445, 564, 447, 564, 564, 492, 564, 564,
- /* 3620 */ 495, 564, 564, 564, 499, 500, 501, 502, 503, 504,
- /* 3630 */ 564, 564, 507, 508, 564, 385, 564, 492, 564, 564,
- /* 3640 */ 495, 564, 564, 564, 499, 500, 501, 502, 503, 504,
- /* 3650 */ 400, 564, 507, 508, 564, 564, 564, 385, 564, 492,
- /* 3660 */ 564, 564, 495, 564, 564, 564, 499, 500, 501, 502,
- /* 3670 */ 503, 504, 400, 564, 507, 508, 385, 564, 564, 429,
- /* 3680 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3690 */ 564, 400, 564, 564, 564, 445, 564, 447, 564, 385,
- /* 3700 */ 564, 429, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3710 */ 564, 564, 564, 564, 400, 564, 564, 445, 564, 447,
- /* 3720 */ 429, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3730 */ 564, 564, 564, 564, 564, 564, 445, 564, 447, 564,
- /* 3740 */ 564, 564, 492, 429, 564, 495, 564, 564, 564, 499,
- /* 3750 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 445,
- /* 3760 */ 564, 447, 564, 385, 492, 564, 564, 495, 564, 564,
- /* 3770 */ 564, 499, 500, 501, 502, 503, 504, 564, 400, 507,
- /* 3780 */ 508, 564, 564, 492, 564, 385, 495, 564, 564, 564,
- /* 3790 */ 499, 500, 501, 502, 503, 504, 564, 564, 507, 508,
- /* 3800 */ 400, 564, 564, 564, 385, 564, 492, 429, 564, 495,
- /* 3810 */ 564, 564, 564, 499, 500, 501, 502, 503, 504, 400,
- /* 3820 */ 564, 507, 508, 445, 564, 447, 564, 564, 564, 429,
- /* 3830 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3840 */ 564, 564, 564, 564, 564, 445, 564, 447, 429, 564,
- /* 3850 */ 564, 564, 564, 385, 564, 564, 564, 564, 564, 564,
- /* 3860 */ 564, 564, 564, 564, 445, 564, 447, 564, 400, 564,
- /* 3870 */ 492, 564, 564, 495, 564, 564, 564, 499, 500, 501,
- /* 3880 */ 502, 503, 504, 564, 564, 507, 508, 564, 564, 564,
- /* 3890 */ 564, 564, 492, 564, 564, 495, 564, 429, 564, 499,
- /* 3900 */ 500, 501, 502, 503, 504, 564, 564, 507, 508, 564,
- /* 3910 */ 564, 492, 564, 445, 495, 447, 564, 564, 499, 500,
- /* 3920 */ 501, 502, 503, 504, 564, 564, 507, 508, 564, 564,
- /* 3930 */ 564, 564, 564, 564, 564, 564, 564, 564, 385, 564,
- /* 3940 */ 564, 564, 564, 564, 564, 564, 564, 564, 564, 564,
- /* 3950 */ 564, 564, 564, 400, 564, 564, 564, 564, 385, 564,
- /* 3960 */ 492, 564, 564, 495, 564, 564, 564, 499, 500, 501,
- /* 3970 */ 502, 503, 504, 400, 564, 507, 508, 564, 385, 564,
- /* 3980 */ 564, 564, 429, 564, 564, 564, 564, 564, 564, 564,
- /* 3990 */ 564, 564, 564, 400, 564, 564, 564, 564, 445, 564,
- /* 4000 */ 447, 564, 429, 564, 564, 564, 564, 564, 564, 564,
- /* 4010 */ 564, 564, 564, 564, 564, 564, 564, 564, 445, 564,
- /* 4020 */ 447, 564, 429, 564, 564, 564, 564, 564, 564, 564,
- /* 4030 */ 564, 564, 564, 564, 564, 564, 564, 564, 445, 564,
- /* 4040 */ 447, 564, 564, 564, 564, 492, 564, 564, 495, 564,
- /* 4050 */ 564, 564, 499, 500, 501, 502, 503, 504, 564, 564,
- /* 4060 */ 507, 508, 564, 564, 564, 492, 564, 564, 495, 564,
- /* 4070 */ 564, 564, 499, 500, 501, 502, 503, 504, 564, 564,
- /* 4080 */ 507, 508, 564, 564, 564, 492, 564, 564, 495, 564,
- /* 4090 */ 564, 564, 499, 500, 501, 502, 503, 504, 564, 564,
- /* 4100 */ 507, 508, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4110 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4120 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4130 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4140 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4150 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4160 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4170 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4180 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4190 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4200 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4210 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4220 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4230 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4240 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4250 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4260 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4270 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4280 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4290 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4300 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4310 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4320 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4330 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4340 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4350 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4360 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4370 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4380 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4390 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4400 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4410 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4420 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4430 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4440 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4450 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4460 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4470 */ 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
- /* 4480 */ 382, 382, 382, 382,
+ /* 280 */ 280, 281, 282, 283, 12, 13, 14, 420, 400, 401,
+ /* 290 */ 493, 186, 20, 496, 22, 428, 529, 500, 501, 502,
+ /* 300 */ 503, 504, 505, 254, 537, 508, 509, 510, 36, 155,
+ /* 310 */ 38, 147, 515, 0, 517, 151, 115, 20, 521, 522,
+ /* 320 */ 20, 116, 555, 556, 170, 409, 386, 560, 561, 152,
+ /* 330 */ 153, 8, 9, 155, 20, 12, 13, 14, 15, 16,
+ /* 340 */ 68, 401, 417, 71, 8, 9, 549, 75, 12, 13,
+ /* 350 */ 14, 15, 16, 437, 82, 21, 33, 433, 24, 25,
+ /* 360 */ 26, 27, 28, 29, 30, 31, 32, 12, 13, 422,
+ /* 370 */ 430, 446, 73, 426, 208, 20, 193, 22, 201, 202,
+ /* 380 */ 298, 299, 300, 531, 112, 533, 446, 115, 448, 225,
+ /* 390 */ 14, 36, 430, 38, 230, 20, 20, 233, 193, 235,
+ /* 400 */ 438, 4, 8, 9, 12, 13, 12, 13, 14, 15,
+ /* 410 */ 16, 449, 115, 525, 526, 527, 155, 529, 530, 430,
+ /* 420 */ 496, 496, 497, 68, 152, 153, 71, 438, 36, 115,
+ /* 430 */ 75, 400, 401, 493, 510, 510, 496, 82, 449, 116,
+ /* 440 */ 500, 501, 502, 503, 504, 505, 400, 401, 508, 509,
+ /* 450 */ 510, 420, 116, 513, 396, 515, 516, 517, 400, 428,
+ /* 460 */ 402, 521, 522, 191, 192, 36, 420, 112, 186, 75,
+ /* 470 */ 115, 401, 254, 201, 202, 297, 298, 299, 300, 301,
+ /* 480 */ 302, 303, 304, 305, 171, 77, 78, 79, 216, 176,
+ /* 490 */ 218, 529, 84, 85, 86, 223, 44, 184, 90, 537,
+ /* 500 */ 430, 335, 220, 95, 96, 97, 98, 152, 153, 101,
+ /* 510 */ 211, 82, 115, 105, 106, 107, 108, 555, 556, 125,
+ /* 520 */ 68, 14, 560, 561, 252, 253, 254, 20, 256, 257,
+ /* 530 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 240,
+ /* 540 */ 241, 269, 270, 271, 272, 273, 191, 192, 74, 277,
+ /* 550 */ 278, 279, 280, 281, 282, 283, 201, 202, 297, 298,
+ /* 560 */ 299, 300, 301, 302, 303, 304, 305, 191, 430, 2,
+ /* 570 */ 112, 216, 502, 218, 74, 8, 9, 417, 223, 12,
+ /* 580 */ 13, 14, 15, 16, 190, 127, 128, 129, 130, 131,
+ /* 590 */ 132, 133, 134, 135, 136, 457, 138, 139, 140, 141,
+ /* 600 */ 142, 143, 144, 252, 268, 308, 446, 252, 253, 254,
+ /* 610 */ 218, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ /* 620 */ 265, 266, 308, 91, 269, 270, 271, 272, 273, 400,
+ /* 630 */ 254, 499, 277, 278, 279, 280, 281, 282, 283, 284,
+ /* 640 */ 12, 13, 301, 302, 303, 304, 305, 385, 20, 387,
+ /* 650 */ 22, 126, 36, 386, 41, 42, 496, 497, 498, 396,
+ /* 660 */ 528, 267, 472, 400, 36, 402, 38, 284, 401, 286,
+ /* 670 */ 510, 320, 321, 322, 323, 324, 325, 326, 400, 401,
+ /* 680 */ 448, 287, 288, 289, 290, 291, 292, 293, 294, 295,
+ /* 690 */ 296, 159, 386, 68, 462, 430, 68, 430, 191, 71,
+ /* 700 */ 468, 469, 115, 75, 20, 308, 22, 401, 448, 425,
+ /* 710 */ 82, 482, 483, 446, 430, 448, 184, 185, 400, 529,
+ /* 720 */ 36, 284, 115, 12, 13, 14, 115, 537, 468, 469,
+ /* 730 */ 198, 20, 454, 22, 121, 122, 430, 124, 400, 401,
+ /* 740 */ 112, 457, 58, 115, 119, 555, 556, 36, 472, 38,
+ /* 750 */ 560, 561, 446, 477, 448, 490, 491, 514, 145, 516,
+ /* 760 */ 493, 254, 149, 496, 0, 400, 401, 500, 501, 502,
+ /* 770 */ 503, 504, 505, 386, 54, 508, 509, 510, 3, 68,
+ /* 780 */ 152, 153, 71, 63, 517, 420, 66, 67, 521, 522,
+ /* 790 */ 8, 9, 454, 82, 12, 13, 14, 15, 16, 493,
+ /* 800 */ 482, 483, 496, 431, 432, 529, 500, 501, 502, 503,
+ /* 810 */ 504, 505, 506, 537, 508, 509, 510, 511, 512, 191,
+ /* 820 */ 192, 430, 215, 112, 217, 430, 115, 400, 401, 201,
+ /* 830 */ 202, 555, 556, 446, 218, 440, 560, 561, 400, 401,
+ /* 840 */ 449, 77, 78, 79, 216, 36, 218, 420, 84, 85,
+ /* 850 */ 86, 223, 146, 147, 90, 400, 249, 151, 420, 95,
+ /* 860 */ 96, 97, 98, 152, 153, 101, 250, 251, 400, 105,
+ /* 870 */ 106, 107, 108, 145, 146, 147, 148, 149, 150, 151,
+ /* 880 */ 252, 253, 254, 33, 256, 257, 258, 259, 260, 261,
+ /* 890 */ 262, 263, 264, 265, 266, 308, 196, 269, 270, 271,
+ /* 900 */ 272, 273, 191, 192, 23, 277, 278, 279, 280, 281,
+ /* 910 */ 282, 283, 201, 202, 459, 308, 461, 8, 9, 308,
+ /* 920 */ 112, 12, 13, 14, 15, 16, 0, 216, 82, 218,
+ /* 930 */ 49, 50, 464, 465, 223, 127, 128, 129, 130, 131,
+ /* 940 */ 132, 133, 134, 135, 136, 126, 138, 139, 140, 141,
+ /* 950 */ 142, 143, 144, 8, 9, 13, 47, 12, 13, 14,
+ /* 960 */ 15, 16, 386, 252, 253, 254, 116, 256, 257, 258,
+ /* 970 */ 259, 260, 261, 262, 263, 264, 265, 266, 400, 401,
+ /* 980 */ 269, 270, 271, 272, 273, 190, 4, 36, 277, 278,
+ /* 990 */ 279, 280, 281, 282, 283, 12, 13, 22, 420, 425,
+ /* 1000 */ 514, 19, 516, 20, 430, 22, 400, 401, 386, 400,
+ /* 1010 */ 401, 36, 400, 401, 314, 315, 316, 317, 478, 36,
+ /* 1020 */ 38, 38, 446, 401, 82, 116, 420, 218, 472, 420,
+ /* 1030 */ 386, 457, 420, 82, 8, 9, 54, 20, 12, 13,
+ /* 1040 */ 14, 15, 16, 61, 62, 430, 400, 401, 386, 267,
+ /* 1050 */ 68, 68, 430, 438, 71, 22, 20, 82, 22, 250,
+ /* 1060 */ 251, 116, 267, 401, 449, 82, 420, 431, 446, 36,
+ /* 1070 */ 448, 145, 146, 147, 148, 149, 150, 151, 12, 13,
+ /* 1080 */ 400, 401, 287, 400, 401, 529, 20, 112, 22, 0,
+ /* 1090 */ 446, 409, 430, 537, 58, 112, 114, 34, 115, 116,
+ /* 1100 */ 420, 119, 36, 420, 38, 330, 1, 2, 446, 427,
+ /* 1110 */ 448, 555, 556, 47, 407, 493, 560, 561, 496, 437,
+ /* 1120 */ 386, 430, 500, 501, 502, 503, 504, 505, 492, 421,
+ /* 1130 */ 508, 509, 510, 44, 68, 152, 153, 71, 430, 517,
+ /* 1140 */ 2, 434, 116, 521, 522, 112, 8, 9, 82, 441,
+ /* 1150 */ 12, 13, 14, 15, 16, 493, 400, 401, 496, 400,
+ /* 1160 */ 401, 0, 500, 501, 502, 503, 504, 505, 400, 401,
+ /* 1170 */ 508, 509, 510, 22, 191, 192, 420, 431, 112, 420,
+ /* 1180 */ 446, 115, 491, 20, 201, 202, 431, 36, 420, 400,
+ /* 1190 */ 401, 216, 430, 218, 400, 401, 400, 401, 407, 216,
+ /* 1200 */ 438, 218, 400, 401, 38, 0, 223, 59, 60, 420,
+ /* 1210 */ 193, 449, 550, 551, 420, 424, 420, 14, 152, 153,
+ /* 1220 */ 54, 116, 420, 20, 20, 434, 52, 252, 253, 63,
+ /* 1230 */ 64, 65, 66, 82, 68, 252, 253, 254, 0, 256,
+ /* 1240 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
+ /* 1250 */ 447, 448, 269, 270, 271, 272, 273, 191, 192, 54,
+ /* 1260 */ 277, 278, 279, 280, 281, 282, 283, 201, 202, 8,
+ /* 1270 */ 9, 254, 20, 12, 13, 14, 15, 16, 400, 401,
+ /* 1280 */ 114, 426, 216, 146, 218, 119, 8, 9, 430, 223,
+ /* 1290 */ 12, 13, 14, 15, 16, 8, 9, 421, 420, 12,
+ /* 1300 */ 13, 14, 15, 16, 8, 9, 430, 449, 12, 13,
+ /* 1310 */ 14, 15, 16, 400, 401, 405, 406, 441, 252, 253,
+ /* 1320 */ 254, 430, 256, 257, 258, 259, 260, 261, 262, 263,
+ /* 1330 */ 264, 265, 266, 420, 47, 269, 270, 271, 272, 273,
+ /* 1340 */ 449, 22, 487, 277, 278, 279, 280, 281, 282, 283,
+ /* 1350 */ 12, 13, 186, 400, 401, 36, 193, 4, 20, 386,
+ /* 1360 */ 22, 195, 386, 386, 386, 199, 200, 193, 231, 232,
+ /* 1370 */ 386, 205, 206, 420, 36, 386, 38, 116, 204, 401,
+ /* 1380 */ 386, 403, 386, 145, 146, 147, 148, 149, 150, 151,
+ /* 1390 */ 224, 386, 8, 9, 116, 191, 12, 13, 14, 15,
+ /* 1400 */ 16, 14, 15, 16, 386, 244, 68, 416, 430, 71,
+ /* 1410 */ 419, 513, 116, 386, 516, 386, 386, 254, 499, 446,
+ /* 1420 */ 82, 20, 446, 446, 446, 386, 448, 405, 406, 0,
+ /* 1430 */ 446, 112, 499, 12, 13, 446, 386, 472, 414, 415,
+ /* 1440 */ 446, 20, 446, 22, 430, 414, 415, 528, 20, 443,
+ /* 1450 */ 112, 446, 446, 115, 13, 441, 145, 36, 254, 38,
+ /* 1460 */ 149, 528, 8, 9, 446, 126, 12, 13, 14, 15,
+ /* 1470 */ 16, 493, 33, 446, 496, 446, 446, 33, 500, 501,
+ /* 1480 */ 502, 503, 504, 505, 431, 446, 508, 509, 510, 68,
+ /* 1490 */ 152, 153, 71, 515, 529, 517, 446, 389, 390, 521,
+ /* 1500 */ 522, 47, 537, 82, 443, 443, 254, 446, 446, 431,
+ /* 1510 */ 8, 9, 0, 33, 12, 13, 14, 15, 16, 180,
+ /* 1520 */ 555, 556, 418, 82, 33, 560, 561, 47, 120, 191,
+ /* 1530 */ 192, 123, 120, 112, 120, 123, 115, 123, 47, 201,
+ /* 1540 */ 202, 33, 8, 9, 13, 33, 12, 13, 14, 15,
+ /* 1550 */ 16, 75, 120, 13, 216, 123, 218, 0, 8, 9,
+ /* 1560 */ 0, 223, 12, 13, 14, 15, 16, 36, 234, 33,
+ /* 1570 */ 236, 33, 0, 152, 153, 33, 36, 33, 33, 22,
+ /* 1580 */ 387, 472, 22, 0, 155, 152, 153, 458, 33, 33,
+ /* 1590 */ 252, 253, 254, 553, 256, 257, 258, 259, 260, 261,
+ /* 1600 */ 262, 263, 264, 265, 266, 22, 0, 269, 270, 271,
+ /* 1610 */ 272, 273, 191, 192, 531, 277, 278, 279, 280, 281,
+ /* 1620 */ 282, 283, 201, 202, 116, 36, 33, 55, 22, 33,
+ /* 1630 */ 1, 2, 33, 12, 13, 33, 33, 216, 529, 218,
+ /* 1640 */ 33, 33, 51, 22, 223, 36, 537, 33, 564, 33,
+ /* 1650 */ 116, 472, 116, 33, 116, 254, 228, 36, 116, 38,
+ /* 1660 */ 116, 116, 546, 310, 555, 556, 116, 532, 33, 560,
+ /* 1670 */ 561, 116, 116, 252, 253, 254, 33, 256, 257, 258,
+ /* 1680 */ 259, 260, 261, 262, 263, 264, 265, 266, 404, 68,
+ /* 1690 */ 269, 270, 271, 272, 273, 193, 12, 13, 277, 278,
+ /* 1700 */ 279, 280, 281, 282, 283, 18, 115, 20, 529, 116,
+ /* 1710 */ 12, 13, 116, 33, 27, 116, 537, 30, 116, 116,
+ /* 1720 */ 12, 13, 18, 116, 116, 38, 33, 23, 252, 33,
+ /* 1730 */ 116, 430, 116, 33, 555, 556, 116, 12, 13, 560,
+ /* 1740 */ 561, 54, 33, 56, 417, 417, 42, 43, 61, 62,
+ /* 1750 */ 46, 116, 12, 13, 12, 13, 12, 13, 36, 116,
+ /* 1760 */ 73, 57, 12, 13, 12, 13, 12, 13, 12, 13,
+ /* 1770 */ 115, 332, 117, 69, 70, 71, 72, 73, 334, 13,
+ /* 1780 */ 13, 399, 458, 36, 552, 552, 552, 471, 552, 458,
+ /* 1790 */ 404, 494, 401, 445, 479, 458, 116, 557, 458, 536,
+ /* 1800 */ 536, 114, 36, 36, 82, 523, 539, 218, 458, 116,
+ /* 1810 */ 311, 419, 116, 126, 473, 54, 116, 495, 20, 115,
+ /* 1820 */ 400, 20, 489, 233, 409, 116, 484, 218, 484, 82,
+ /* 1830 */ 475, 409, 214, 20, 400, 47, 401, 216, 455, 218,
+ /* 1840 */ 455, 401, 190, 400, 157, 158, 452, 160, 161, 162,
+ /* 1850 */ 163, 164, 165, 166, 167, 168, 169, 401, 154, 172,
+ /* 1860 */ 173, 174, 175, 176, 177, 178, 179, 386, 181, 182,
+ /* 1870 */ 183, 250, 251, 252, 187, 188, 189, 400, 455, 452,
+ /* 1880 */ 413, 194, 401, 452, 403, 113, 111, 412, 452, 400,
+ /* 1890 */ 269, 270, 400, 110, 411, 400, 400, 400, 277, 278,
+ /* 1900 */ 279, 280, 281, 282, 20, 52, 393, 397, 393, 484,
+ /* 1910 */ 409, 430, 208, 209, 210, 397, 409, 213, 20, 448,
+ /* 1920 */ 409, 20, 402, 20, 474, 409, 402, 446, 409, 448,
+ /* 1930 */ 226, 227, 20, 465, 409, 20, 409, 459, 409, 400,
+ /* 1940 */ 393, 409, 389, 239, 430, 393, 242, 430, 386, 245,
+ /* 1950 */ 246, 247, 248, 249, 400, 389, 430, 237, 430, 115,
+ /* 1960 */ 430, 488, 20, 401, 221, 403, 484, 430, 446, 446,
+ /* 1970 */ 486, 430, 407, 430, 493, 222, 430, 496, 386, 430,
+ /* 1980 */ 480, 500, 501, 502, 503, 504, 505, 483, 430, 508,
+ /* 1990 */ 509, 510, 430, 401, 446, 403, 515, 400, 517, 448,
+ /* 2000 */ 319, 407, 521, 522, 545, 545, 318, 446, 446, 327,
+ /* 2010 */ 448, 548, 308, 207, 481, 545, 547, 543, 329, 328,
+ /* 2020 */ 307, 535, 430, 544, 312, 306, 336, 542, 534, 466,
+ /* 2030 */ 466, 565, 473, 331, 333, 401, 20, 126, 446, 309,
+ /* 2040 */ 448, 473, 402, 540, 538, 407, 559, 466, 558, 407,
+ /* 2050 */ 446, 446, 466, 199, 407, 493, 446, 446, 496, 446,
+ /* 2060 */ 459, 386, 500, 501, 502, 503, 504, 505, 499, 446,
+ /* 2070 */ 508, 509, 510, 407, 115, 463, 401, 515, 403, 517,
+ /* 2080 */ 199, 459, 446, 521, 522, 493, 460, 520, 496, 426,
+ /* 2090 */ 407, 386, 500, 501, 502, 503, 504, 505, 401, 407,
+ /* 2100 */ 508, 509, 510, 446, 446, 430, 401, 515, 403, 517,
+ /* 2110 */ 446, 446, 115, 521, 522, 446, 446, 446, 446, 446,
+ /* 2120 */ 446, 446, 446, 448, 446, 446, 400, 22, 407, 388,
+ /* 2130 */ 35, 446, 446, 37, 40, 430, 391, 476, 392, 423,
+ /* 2140 */ 446, 446, 435, 394, 393, 446, 492, 432, 384, 446,
+ /* 2150 */ 432, 446, 446, 448, 423, 423, 446, 446, 0, 0,
+ /* 2160 */ 446, 0, 485, 408, 47, 0, 36, 243, 493, 36,
+ /* 2170 */ 36, 496, 36, 243, 0, 500, 501, 502, 503, 504,
+ /* 2180 */ 505, 36, 36, 508, 509, 510, 243, 36, 386, 0,
+ /* 2190 */ 515, 467, 517, 0, 467, 243, 521, 522, 493, 0,
+ /* 2200 */ 36, 496, 0, 401, 36, 500, 501, 502, 503, 504,
+ /* 2210 */ 505, 0, 22, 508, 509, 510, 0, 36, 12, 13,
+ /* 2220 */ 515, 238, 517, 0, 224, 0, 521, 522, 22, 224,
+ /* 2230 */ 218, 386, 430, 225, 216, 0, 0, 0, 212, 211,
+ /* 2240 */ 0, 0, 36, 158, 38, 51, 401, 51, 446, 36,
+ /* 2250 */ 448, 0, 0, 0, 36, 54, 0, 0, 51, 47,
+ /* 2260 */ 0, 0, 0, 0, 0, 51, 0, 0, 0, 386,
+ /* 2270 */ 0, 0, 0, 176, 68, 430, 176, 0, 36, 0,
+ /* 2280 */ 0, 0, 0, 0, 401, 0, 0, 0, 82, 0,
+ /* 2290 */ 0, 446, 0, 448, 0, 493, 0, 0, 496, 0,
+ /* 2300 */ 0, 0, 500, 501, 502, 503, 504, 505, 0, 51,
+ /* 2310 */ 508, 509, 510, 430, 0, 0, 47, 515, 112, 517,
+ /* 2320 */ 0, 0, 0, 521, 522, 0, 0, 0, 0, 446,
+ /* 2330 */ 0, 448, 22, 0, 158, 0, 157, 0, 493, 156,
+ /* 2340 */ 0, 496, 0, 52, 0, 500, 501, 502, 503, 504,
+ /* 2350 */ 505, 22, 68, 508, 509, 510, 22, 52, 0, 36,
+ /* 2360 */ 515, 68, 517, 0, 0, 0, 521, 522, 0, 0,
+ /* 2370 */ 68, 68, 36, 54, 36, 44, 493, 0, 54, 496,
+ /* 2380 */ 33, 14, 386, 500, 501, 502, 503, 504, 505, 44,
+ /* 2390 */ 36, 508, 509, 510, 44, 54, 0, 401, 515, 0,
+ /* 2400 */ 517, 44, 36, 47, 521, 522, 51, 0, 0, 0,
+ /* 2410 */ 51, 51, 0, 0, 0, 45, 44, 44, 0, 0,
+ /* 2420 */ 0, 0, 216, 0, 218, 51, 430, 207, 76, 51,
+ /* 2430 */ 36, 44, 0, 54, 36, 54, 44, 0, 36, 54,
+ /* 2440 */ 0, 44, 446, 54, 448, 44, 36, 0, 0, 386,
+ /* 2450 */ 0, 0, 0, 0, 0, 22, 22, 125, 252, 253,
+ /* 2460 */ 36, 36, 36, 36, 401, 36, 123, 36, 22, 0,
+ /* 2470 */ 0, 36, 36, 56, 36, 269, 270, 36, 36, 386,
+ /* 2480 */ 36, 22, 33, 277, 278, 279, 280, 281, 282, 493,
+ /* 2490 */ 33, 36, 496, 430, 401, 22, 500, 501, 502, 503,
+ /* 2500 */ 504, 505, 0, 22, 508, 509, 510, 0, 22, 446,
+ /* 2510 */ 36, 448, 0, 517, 0, 0, 36, 521, 522, 0,
+ /* 2520 */ 36, 0, 0, 430, 36, 22, 20, 36, 36, 36,
+ /* 2530 */ 0, 116, 223, 229, 228, 0, 36, 115, 51, 446,
+ /* 2540 */ 22, 448, 193, 115, 193, 0, 22, 199, 0, 0,
+ /* 2550 */ 3, 313, 36, 33, 115, 193, 493, 52, 115, 496,
+ /* 2560 */ 52, 36, 33, 500, 501, 502, 503, 504, 505, 1,
+ /* 2570 */ 33, 508, 509, 510, 203, 193, 193, 116, 203, 116,
+ /* 2580 */ 219, 115, 111, 116, 386, 113, 493, 19, 33, 496,
+ /* 2590 */ 51, 116, 115, 500, 501, 502, 503, 504, 505, 401,
+ /* 2600 */ 33, 508, 509, 510, 115, 386, 38, 51, 313, 115,
+ /* 2610 */ 517, 116, 115, 82, 116, 522, 33, 36, 3, 115,
+ /* 2620 */ 401, 53, 54, 36, 33, 562, 563, 116, 430, 116,
+ /* 2630 */ 313, 63, 64, 65, 66, 386, 68, 36, 36, 36,
+ /* 2640 */ 36, 36, 116, 116, 446, 51, 448, 33, 51, 430,
+ /* 2650 */ 401, 0, 0, 115, 44, 0, 116, 116, 115, 115,
+ /* 2660 */ 196, 115, 44, 0, 44, 446, 116, 448, 200, 115,
+ /* 2670 */ 33, 113, 196, 297, 195, 285, 113, 2, 22, 430,
+ /* 2680 */ 115, 115, 114, 51, 115, 51, 115, 119, 115, 470,
+ /* 2690 */ 116, 493, 116, 115, 496, 446, 116, 448, 500, 501,
+ /* 2700 */ 502, 503, 504, 505, 115, 507, 508, 509, 510, 116,
+ /* 2710 */ 252, 115, 493, 115, 115, 496, 22, 255, 150, 500,
+ /* 2720 */ 501, 502, 503, 504, 505, 386, 115, 508, 509, 510,
+ /* 2730 */ 0, 115, 115, 44, 115, 0, 22, 116, 115, 115,
+ /* 2740 */ 401, 51, 493, 117, 115, 496, 118, 196, 115, 500,
+ /* 2750 */ 501, 502, 503, 504, 505, 115, 115, 508, 509, 510,
+ /* 2760 */ 116, 115, 126, 195, 22, 197, 386, 36, 200, 430,
+ /* 2770 */ 116, 229, 36, 205, 115, 36, 116, 115, 33, 137,
+ /* 2780 */ 116, 401, 36, 116, 36, 446, 116, 448, 36, 116,
+ /* 2790 */ 36, 115, 224, 115, 137, 137, 36, 115, 137, 22,
+ /* 2800 */ 551, 76, 75, 22, 36, 36, 36, 36, 36, 470,
+ /* 2810 */ 430, 36, 36, 109, 36, 36, 36, 109, 36, 82,
+ /* 2820 */ 82, 33, 36, 36, 22, 36, 446, 36, 448, 36,
+ /* 2830 */ 36, 386, 493, 82, 36, 496, 36, 36, 0, 500,
+ /* 2840 */ 501, 502, 503, 504, 505, 36, 401, 508, 509, 510,
+ /* 2850 */ 470, 386, 36, 22, 36, 36, 44, 54, 0, 36,
+ /* 2860 */ 54, 44, 0, 0, 36, 54, 401, 54, 44, 36,
+ /* 2870 */ 44, 386, 0, 493, 0, 430, 496, 36, 22, 36,
+ /* 2880 */ 500, 501, 502, 503, 504, 505, 401, 0, 508, 509,
+ /* 2890 */ 510, 446, 22, 448, 33, 430, 36, 22, 21, 21,
+ /* 2900 */ 36, 22, 22, 20, 566, 566, 566, 566, 566, 566,
+ /* 2910 */ 566, 446, 566, 448, 566, 430, 566, 566, 566, 566,
+ /* 2920 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 2930 */ 566, 446, 566, 448, 566, 566, 566, 566, 493, 566,
+ /* 2940 */ 566, 496, 566, 566, 566, 500, 501, 502, 503, 504,
+ /* 2950 */ 505, 566, 566, 508, 509, 510, 386, 566, 493, 566,
+ /* 2960 */ 566, 496, 566, 566, 566, 500, 501, 502, 503, 504,
+ /* 2970 */ 505, 401, 566, 508, 509, 510, 386, 566, 493, 566,
+ /* 2980 */ 566, 496, 566, 566, 566, 500, 501, 502, 503, 504,
+ /* 2990 */ 505, 401, 566, 508, 509, 510, 566, 512, 566, 554,
+ /* 3000 */ 430, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3010 */ 566, 566, 566, 566, 566, 566, 446, 566, 448, 566,
+ /* 3020 */ 430, 566, 566, 566, 566, 566, 566, 566, 563, 566,
+ /* 3030 */ 566, 566, 566, 566, 566, 566, 446, 566, 448, 566,
+ /* 3040 */ 470, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3050 */ 566, 566, 386, 566, 566, 566, 566, 566, 566, 566,
+ /* 3060 */ 470, 566, 566, 493, 566, 566, 496, 401, 566, 566,
+ /* 3070 */ 500, 501, 502, 503, 504, 505, 566, 566, 508, 509,
+ /* 3080 */ 510, 566, 566, 493, 566, 566, 496, 566, 386, 566,
+ /* 3090 */ 500, 501, 502, 503, 504, 505, 430, 566, 508, 509,
+ /* 3100 */ 510, 566, 566, 401, 566, 566, 566, 566, 566, 566,
+ /* 3110 */ 566, 566, 446, 566, 448, 566, 566, 566, 566, 566,
+ /* 3120 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 386,
+ /* 3130 */ 566, 566, 430, 566, 566, 566, 470, 566, 566, 566,
+ /* 3140 */ 566, 566, 566, 566, 401, 566, 566, 566, 446, 566,
+ /* 3150 */ 448, 566, 566, 566, 566, 566, 566, 566, 566, 493,
+ /* 3160 */ 566, 566, 496, 566, 566, 566, 500, 501, 502, 503,
+ /* 3170 */ 504, 505, 470, 430, 508, 509, 510, 566, 566, 566,
+ /* 3180 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 446,
+ /* 3190 */ 566, 448, 566, 566, 566, 493, 566, 566, 496, 566,
+ /* 3200 */ 566, 566, 500, 501, 502, 503, 504, 505, 566, 566,
+ /* 3210 */ 508, 509, 510, 386, 566, 566, 566, 566, 566, 566,
+ /* 3220 */ 566, 566, 566, 566, 566, 566, 566, 566, 401, 566,
+ /* 3230 */ 566, 566, 566, 566, 386, 566, 493, 566, 566, 496,
+ /* 3240 */ 566, 566, 566, 500, 501, 502, 503, 504, 505, 401,
+ /* 3250 */ 566, 508, 509, 510, 566, 566, 566, 430, 566, 566,
+ /* 3260 */ 566, 566, 386, 566, 566, 566, 566, 566, 566, 566,
+ /* 3270 */ 566, 566, 566, 446, 566, 448, 566, 401, 430, 566,
+ /* 3280 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3290 */ 566, 566, 566, 566, 446, 566, 448, 566, 566, 566,
+ /* 3300 */ 566, 566, 386, 566, 566, 566, 430, 566, 566, 566,
+ /* 3310 */ 566, 566, 566, 566, 566, 566, 566, 401, 566, 566,
+ /* 3320 */ 493, 566, 446, 496, 448, 566, 566, 500, 501, 502,
+ /* 3330 */ 503, 504, 505, 566, 566, 508, 509, 510, 566, 566,
+ /* 3340 */ 566, 493, 566, 566, 496, 386, 430, 566, 500, 501,
+ /* 3350 */ 502, 503, 504, 505, 566, 566, 508, 509, 510, 566,
+ /* 3360 */ 401, 566, 446, 566, 448, 566, 566, 566, 566, 493,
+ /* 3370 */ 566, 566, 496, 566, 566, 566, 500, 501, 502, 503,
+ /* 3380 */ 504, 505, 566, 566, 508, 509, 510, 386, 566, 430,
+ /* 3390 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3400 */ 566, 566, 401, 566, 566, 446, 566, 448, 566, 493,
+ /* 3410 */ 566, 566, 496, 566, 566, 566, 500, 501, 502, 503,
+ /* 3420 */ 504, 505, 566, 566, 508, 509, 510, 386, 566, 566,
+ /* 3430 */ 566, 430, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3440 */ 566, 566, 401, 566, 566, 566, 566, 446, 566, 448,
+ /* 3450 */ 566, 566, 493, 566, 566, 496, 566, 566, 566, 500,
+ /* 3460 */ 501, 502, 503, 504, 505, 566, 566, 508, 509, 510,
+ /* 3470 */ 386, 430, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3480 */ 566, 566, 566, 566, 566, 401, 566, 446, 566, 448,
+ /* 3490 */ 566, 566, 566, 566, 493, 566, 566, 496, 566, 566,
+ /* 3500 */ 566, 500, 501, 502, 503, 504, 505, 566, 566, 508,
+ /* 3510 */ 509, 510, 566, 566, 430, 566, 386, 566, 566, 566,
+ /* 3520 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3530 */ 446, 401, 448, 566, 493, 566, 566, 496, 566, 566,
+ /* 3540 */ 566, 500, 501, 502, 503, 504, 505, 566, 566, 508,
+ /* 3550 */ 509, 510, 566, 386, 566, 566, 566, 566, 566, 566,
+ /* 3560 */ 430, 566, 566, 566, 566, 566, 566, 566, 401, 566,
+ /* 3570 */ 566, 566, 566, 566, 566, 566, 446, 493, 448, 566,
+ /* 3580 */ 496, 566, 566, 566, 500, 501, 502, 503, 504, 505,
+ /* 3590 */ 566, 566, 508, 509, 510, 566, 566, 430, 566, 386,
+ /* 3600 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3610 */ 566, 566, 566, 446, 401, 448, 566, 566, 566, 566,
+ /* 3620 */ 566, 386, 566, 493, 566, 566, 496, 566, 566, 566,
+ /* 3630 */ 500, 501, 502, 503, 504, 505, 401, 566, 508, 509,
+ /* 3640 */ 510, 566, 566, 430, 566, 566, 566, 566, 566, 566,
+ /* 3650 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 446,
+ /* 3660 */ 493, 448, 566, 496, 386, 430, 566, 500, 501, 502,
+ /* 3670 */ 503, 504, 505, 566, 566, 508, 509, 510, 566, 401,
+ /* 3680 */ 566, 446, 566, 448, 566, 566, 566, 566, 566, 386,
+ /* 3690 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3700 */ 566, 566, 566, 566, 401, 566, 493, 566, 430, 496,
+ /* 3710 */ 386, 566, 566, 500, 501, 502, 503, 504, 505, 566,
+ /* 3720 */ 566, 508, 509, 510, 446, 401, 448, 566, 493, 566,
+ /* 3730 */ 566, 496, 386, 430, 566, 500, 501, 502, 503, 504,
+ /* 3740 */ 505, 566, 566, 508, 509, 510, 566, 401, 566, 446,
+ /* 3750 */ 566, 448, 566, 566, 430, 566, 566, 566, 566, 566,
+ /* 3760 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3770 */ 446, 493, 448, 566, 496, 566, 430, 566, 500, 501,
+ /* 3780 */ 502, 503, 504, 505, 566, 566, 508, 509, 510, 566,
+ /* 3790 */ 566, 566, 446, 566, 448, 566, 493, 566, 566, 496,
+ /* 3800 */ 566, 566, 566, 500, 501, 502, 503, 504, 505, 566,
+ /* 3810 */ 566, 508, 509, 510, 566, 566, 566, 493, 566, 566,
+ /* 3820 */ 496, 566, 566, 566, 500, 501, 502, 503, 504, 505,
+ /* 3830 */ 566, 566, 508, 509, 510, 566, 566, 566, 566, 493,
+ /* 3840 */ 566, 566, 496, 566, 566, 566, 500, 501, 502, 503,
+ /* 3850 */ 504, 505, 566, 566, 508, 509, 510, 386, 566, 566,
+ /* 3860 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3870 */ 566, 566, 401, 566, 566, 566, 386, 566, 566, 566,
+ /* 3880 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3890 */ 566, 401, 566, 566, 566, 566, 386, 566, 566, 566,
+ /* 3900 */ 566, 430, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3910 */ 566, 401, 566, 566, 566, 566, 566, 446, 566, 448,
+ /* 3920 */ 430, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3930 */ 566, 566, 566, 566, 566, 566, 446, 566, 448, 566,
+ /* 3940 */ 430, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 3950 */ 566, 566, 566, 566, 566, 566, 446, 566, 448, 566,
+ /* 3960 */ 566, 566, 566, 386, 493, 566, 566, 496, 566, 566,
+ /* 3970 */ 566, 500, 501, 502, 503, 504, 505, 566, 401, 508,
+ /* 3980 */ 509, 510, 566, 493, 566, 566, 496, 566, 566, 566,
+ /* 3990 */ 500, 501, 502, 503, 504, 505, 566, 566, 508, 509,
+ /* 4000 */ 510, 386, 566, 493, 566, 566, 496, 430, 566, 566,
+ /* 4010 */ 500, 501, 502, 503, 504, 505, 401, 566, 508, 509,
+ /* 4020 */ 510, 566, 566, 446, 566, 448, 566, 566, 566, 566,
+ /* 4030 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4040 */ 566, 566, 566, 566, 566, 430, 566, 386, 566, 566,
+ /* 4050 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4060 */ 566, 446, 401, 448, 566, 566, 566, 566, 386, 566,
+ /* 4070 */ 493, 566, 566, 496, 566, 566, 566, 500, 501, 502,
+ /* 4080 */ 503, 504, 505, 401, 566, 508, 509, 510, 566, 566,
+ /* 4090 */ 566, 430, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4100 */ 566, 566, 566, 566, 566, 566, 566, 446, 493, 448,
+ /* 4110 */ 566, 496, 430, 566, 566, 500, 501, 502, 503, 504,
+ /* 4120 */ 505, 566, 566, 508, 509, 510, 566, 566, 446, 566,
+ /* 4130 */ 448, 566, 566, 566, 566, 566, 386, 566, 566, 566,
+ /* 4140 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4150 */ 566, 401, 566, 566, 493, 566, 566, 496, 386, 566,
+ /* 4160 */ 566, 500, 501, 502, 503, 504, 505, 566, 566, 508,
+ /* 4170 */ 509, 510, 566, 401, 566, 493, 566, 566, 496, 386,
+ /* 4180 */ 430, 566, 500, 501, 502, 503, 504, 505, 566, 566,
+ /* 4190 */ 508, 509, 510, 566, 401, 566, 446, 566, 448, 566,
+ /* 4200 */ 566, 566, 430, 566, 386, 566, 566, 566, 566, 566,
+ /* 4210 */ 566, 566, 566, 566, 566, 566, 566, 566, 446, 401,
+ /* 4220 */ 448, 566, 566, 430, 566, 566, 566, 566, 566, 566,
+ /* 4230 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 446,
+ /* 4240 */ 566, 448, 566, 493, 566, 566, 496, 566, 430, 566,
+ /* 4250 */ 500, 501, 502, 503, 504, 505, 566, 566, 508, 509,
+ /* 4260 */ 510, 566, 566, 566, 446, 493, 448, 566, 496, 566,
+ /* 4270 */ 566, 566, 500, 501, 502, 503, 504, 505, 566, 566,
+ /* 4280 */ 508, 509, 510, 566, 566, 566, 493, 566, 566, 496,
+ /* 4290 */ 566, 566, 566, 500, 501, 502, 503, 504, 505, 566,
+ /* 4300 */ 566, 508, 509, 510, 566, 566, 566, 566, 566, 566,
+ /* 4310 */ 566, 493, 566, 566, 496, 566, 566, 566, 500, 501,
+ /* 4320 */ 502, 503, 504, 505, 566, 386, 508, 509, 510, 566,
+ /* 4330 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4340 */ 401, 566, 566, 566, 566, 386, 566, 566, 566, 566,
+ /* 4350 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4360 */ 401, 566, 566, 566, 566, 566, 566, 566, 566, 430,
+ /* 4370 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4380 */ 566, 566, 566, 566, 566, 446, 566, 448, 566, 430,
+ /* 4390 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4400 */ 566, 566, 566, 566, 566, 446, 566, 448, 566, 566,
+ /* 4410 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4420 */ 566, 566, 566, 566, 566, 566, 566, 566, 566, 566,
+ /* 4430 */ 566, 566, 493, 566, 566, 496, 566, 566, 566, 500,
+ /* 4440 */ 501, 502, 503, 504, 505, 566, 566, 508, 509, 510,
+ /* 4450 */ 566, 566, 493, 566, 566, 496, 566, 566, 566, 500,
+ /* 4460 */ 501, 502, 503, 504, 505, 566, 566, 508, 509, 510,
+ /* 4470 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4480 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4490 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4500 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4510 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4520 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4530 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4540 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4550 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4560 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4570 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4580 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4590 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4600 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4610 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4620 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4630 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4640 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4650 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4660 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4670 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4680 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4690 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4700 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4710 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4720 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4730 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4740 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4750 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4760 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4770 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4780 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4790 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4800 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4810 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4820 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4830 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4840 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 4850 */ 383, 383, 383,
};
-#define YY_SHIFT_COUNT (1003)
+#define YY_SHIFT_COUNT (1006)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2878)
+#define YY_SHIFT_MAX (2887)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 1599, 271, 354, 271, 626, 626, 626, 626, 626, 626,
- /* 10 */ 626, 626, 626, 626, 626, 626, 709, 1063, 1063, 1334,
- /* 20 */ 0, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- /* 30 */ 1063, 980, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- /* 40 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- /* 50 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- /* 60 */ 1063, 34, 411, 835, 35, 126, 512, 126, 126, 35,
- /* 70 */ 35, 126, 1407, 126, 1333, 1407, 423, 126, 74, 553,
- /* 80 */ 360, 360, 201, 201, 553, 553, 350, 350, 360, 324,
- /* 90 */ 324, 343, 316, 316, 247, 268, 201, 201, 201, 201,
- /* 100 */ 201, 201, 201, 201, 201, 201, 201, 283, 325, 410,
- /* 110 */ 201, 201, 443, 74, 201, 283, 201, 74, 201, 201,
- /* 120 */ 201, 201, 74, 201, 201, 201, 74, 201, 74, 74,
- /* 130 */ 74, 520, 165, 165, 538, 538, 621, 762, 178, 48,
- /* 140 */ 921, 921, 921, 921, 921, 921, 921, 921, 921, 921,
- /* 150 */ 921, 921, 921, 921, 921, 921, 921, 921, 921, 732,
- /* 160 */ 447, 324, 343, 895, 895, 863, 1060, 1060, 1060, 853,
- /* 170 */ 853, 502, 575, 863, 443, 74, 558, 74, 74, 417,
- /* 180 */ 74, 74, 624, 74, 624, 624, 632, 760, 538, 538,
- /* 190 */ 538, 538, 538, 538, 2253, 413, 21, 75, 282, 282,
- /* 200 */ 356, 488, 962, 424, 464, 261, 451, 675, 647, 647,
- /* 210 */ 1018, 1287, 972, 972, 972, 720, 972, 1115, 1354, 748,
- /* 220 */ 1386, 1422, 230, 778, 1190, 1190, 1215, 1061, 1061, 1297,
- /* 230 */ 1394, 1039, 1190, 575, 1491, 1750, 1783, 1786, 1578, 443,
- /* 240 */ 1786, 443, 1606, 1783, 1804, 1781, 1804, 1781, 1643, 1783,
- /* 250 */ 1804, 1783, 1781, 1643, 1643, 1643, 1738, 1741, 1783, 1783,
- /* 260 */ 1747, 1783, 1783, 1783, 1842, 1813, 1842, 1813, 1786, 443,
- /* 270 */ 443, 1860, 443, 1868, 1876, 443, 1868, 443, 1888, 443,
- /* 280 */ 1893, 443, 443, 1783, 443, 1842, 74, 74, 74, 74,
- /* 290 */ 74, 74, 74, 74, 74, 74, 74, 1783, 760, 760,
- /* 300 */ 1842, 624, 624, 624, 1686, 1824, 1786, 520, 1925, 1730,
- /* 310 */ 1732, 1860, 520, 1491, 1783, 624, 1641, 1645, 1641, 1645,
- /* 320 */ 1644, 1759, 1641, 1648, 1650, 1671, 1491, 1665, 1673, 1653,
- /* 330 */ 1663, 1662, 1804, 1977, 1878, 1703, 1868, 520, 520, 1645,
- /* 340 */ 624, 624, 624, 624, 1645, 624, 1825, 520, 624, 1893,
- /* 350 */ 520, 1927, 624, 1847, 1893, 520, 632, 520, 1804, 624,
- /* 360 */ 624, 624, 624, 624, 624, 624, 624, 624, 624, 624,
- /* 370 */ 624, 624, 624, 624, 624, 624, 624, 624, 624, 624,
- /* 380 */ 624, 1952, 624, 1783, 520, 2050, 2048, 2047, 2059, 1842,
- /* 390 */ 4102, 4102, 4102, 4102, 4102, 4102, 4102, 4102, 4102, 4102,
- /* 400 */ 4102, 4102, 39, 590, 204, 890, 310, 84, 906, 50,
- /* 410 */ 197, 587, 922, 1057, 426, 1114, 1175, 1258, 1192, 1280,
- /* 420 */ 1205, 1214, 1231, 1263, 1452, 1452, 1452, 1452, 1452, 1452,
- /* 430 */ 1452, 1452, 1452, 100, 65, 1246, 1344, 3, 3, 772,
- /* 440 */ 53, 421, 893, 698, 764, 384, 535, 627, 552, 725,
- /* 450 */ 725, 1016, 1153, 218, 1016, 1016, 1016, 286, 1336, 1437,
- /* 460 */ 1517, 1507, 1312, 1404, 1537, 1317, 485, 1425, 1435, 485,
- /* 470 */ 1440, 1503, 1531, 1533, 1202, 1562, 1579, 1602, 1130, 1367,
- /* 480 */ 1449, 1488, 1535, 1538, 1539, 1541, 1423, 1332, 1366, 1550,
- /* 490 */ 1576, 1585, 1586, 1580, 1588, 1489, 1595, 1597, 1581, 1600,
- /* 500 */ 1601, 1603, 1604, 1605, 1627, 1631, 1634, 1636, 1640, 1649,
- /* 510 */ 1661, 1666, 1677, 1685, 1693, 1642, 485, 1658, 1660, 1667,
- /* 520 */ 1670, 1675, 1512, 1679, 1622, 1659, 1553, 1696, 1688, 1707,
- /* 530 */ 2151, 2152, 2153, 2107, 2159, 2124, 1919, 2127, 2129, 2130,
- /* 540 */ 1924, 2174, 2139, 2143, 1937, 2145, 2183, 2185, 1943, 2187,
- /* 550 */ 2154, 2191, 2156, 2193, 2173, 2197, 2162, 1961, 2200, 1978,
- /* 560 */ 2201, 1980, 1982, 1987, 1992, 2209, 2220, 2222, 2004, 2006,
- /* 570 */ 2223, 2225, 2069, 2177, 2178, 2232, 2198, 2233, 2235, 2202,
- /* 580 */ 2186, 2237, 2188, 2242, 2196, 2245, 2246, 2247, 2204, 2258,
- /* 590 */ 2259, 2260, 2261, 2262, 2263, 2090, 2231, 2271, 2097, 2274,
- /* 600 */ 2275, 2276, 2277, 2278, 2279, 2280, 2282, 2284, 2286, 2287,
- /* 610 */ 2288, 2289, 2290, 2292, 2293, 2294, 2295, 2296, 2297, 2248,
- /* 620 */ 2298, 2254, 2300, 2302, 2303, 2304, 2305, 2308, 2309, 2310,
- /* 630 */ 2311, 2291, 2312, 2157, 2320, 2165, 2323, 2168, 2325, 2326,
- /* 640 */ 2307, 2281, 2319, 2301, 2327, 2266, 2342, 2306, 2313, 2345,
- /* 650 */ 2314, 2346, 2315, 2347, 2348, 2316, 2317, 2318, 2350, 2321,
- /* 660 */ 2322, 2324, 2354, 2328, 2337, 2334, 2358, 2330, 2359, 2332,
- /* 670 */ 2351, 2336, 2343, 2355, 2349, 2357, 2360, 2352, 2363, 2361,
- /* 680 */ 2365, 2370, 2373, 2366, 2192, 2381, 2343, 2362, 2396, 2343,
- /* 690 */ 2364, 2398, 2401, 2333, 2411, 2412, 2378, 2368, 2372, 2418,
- /* 700 */ 2384, 2369, 2380, 2425, 2390, 2374, 2383, 2429, 2394, 2377,
- /* 710 */ 2388, 2433, 2434, 2438, 2439, 2440, 2441, 2331, 2338, 2407,
- /* 720 */ 2422, 2445, 2427, 2415, 2416, 2419, 2423, 2424, 2430, 2431,
- /* 730 */ 2432, 2435, 2414, 2421, 2436, 2437, 2447, 2442, 2463, 2448,
- /* 740 */ 2474, 2453, 2476, 2457, 2428, 2480, 2465, 2459, 2496, 2499,
- /* 750 */ 2500, 2470, 2501, 2471, 2508, 2475, 2513, 2492, 2495, 2486,
- /* 760 */ 2491, 2493, 2417, 2426, 2530, 2341, 2339, 2335, 2451, 2344,
- /* 770 */ 2343, 2494, 2542, 2353, 2511, 2529, 2553, 2367, 2532, 2376,
- /* 780 */ 2379, 2562, 2571, 2382, 2385, 2386, 2387, 2570, 2543, 2265,
- /* 790 */ 2466, 2464, 2467, 2468, 2547, 2555, 2472, 2540, 2481, 2541,
- /* 800 */ 2485, 2497, 2564, 2567, 2498, 2504, 2506, 2507, 2509, 2575,
- /* 810 */ 2558, 2561, 2512, 2587, 2340, 2544, 2514, 2591, 2516, 2592,
- /* 820 */ 2517, 2519, 2620, 2596, 2371, 2601, 2602, 2603, 2604, 2605,
- /* 830 */ 2606, 2527, 2528, 2581, 2389, 2613, 2597, 2647, 2649, 2535,
- /* 840 */ 2607, 2537, 2538, 2545, 2549, 2460, 2552, 2655, 2614, 2479,
- /* 850 */ 2657, 2550, 2560, 2490, 2615, 2473, 2643, 2569, 2403, 2582,
- /* 860 */ 2678, 2672, 2446, 2584, 2585, 2586, 2588, 2589, 2593, 2595,
- /* 870 */ 2598, 2610, 2612, 2617, 2618, 2651, 2621, 2622, 2653, 2619,
- /* 880 */ 2684, 2452, 2623, 2624, 2712, 2626, 2625, 2534, 2677, 2628,
- /* 890 */ 2611, 2731, 2711, 2627, 2629, 2343, 2695, 2632, 2633, 2635,
- /* 900 */ 2634, 2637, 2631, 2732, 2524, 2639, 2723, 2724, 2646, 2648,
- /* 910 */ 2726, 2650, 2652, 2727, 2595, 2654, 2730, 2598, 2656, 2733,
- /* 920 */ 2610, 2659, 2735, 2612, 2630, 2636, 2640, 2642, 2665, 2748,
- /* 930 */ 2667, 2747, 2669, 2748, 2748, 2764, 2713, 2715, 2765, 2752,
- /* 940 */ 2755, 2756, 2758, 2760, 2761, 2763, 2766, 2768, 2770, 2771,
- /* 950 */ 2718, 2686, 2728, 2699, 2776, 2775, 2777, 2778, 2790, 2779,
- /* 960 */ 2780, 2781, 2736, 2414, 2783, 2421, 2787, 2791, 2798, 2799,
- /* 970 */ 2804, 2803, 2841, 2806, 2789, 2800, 2845, 2810, 2793, 2808,
- /* 980 */ 2850, 2817, 2807, 2822, 2854, 2832, 2816, 2827, 2872, 2837,
- /* 990 */ 2874, 2853, 2840, 2877, 2856, 2846, 2844, 2847, 2859, 2861,
- /* 1000 */ 2864, 2865, 2870, 2878,
+ /* 0 */ 1704, 272, 355, 272, 628, 628, 628, 628, 628, 628,
+ /* 10 */ 628, 628, 628, 628, 628, 628, 711, 1338, 1338, 1421,
+ /* 20 */ 0, 983, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
+ /* 30 */ 1338, 1338, 1066, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
+ /* 40 */ 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
+ /* 50 */ 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
+ /* 60 */ 1338, 1338, 297, 314, 607, 201, 587, 611, 587, 587,
+ /* 70 */ 201, 201, 587, 2206, 587, 1687, 2206, 397, 587, 35,
+ /* 80 */ 1621, 177, 177, 87, 87, 1621, 1621, 145, 145, 177,
+ /* 90 */ 57, 57, 9, 206, 206, 218, 4, 87, 87, 87,
+ /* 100 */ 87, 87, 87, 87, 87, 87, 87, 87, 146, 300,
+ /* 110 */ 375, 87, 87, 474, 35, 87, 146, 87, 35, 87,
+ /* 120 */ 87, 87, 87, 35, 87, 87, 87, 35, 87, 35,
+ /* 130 */ 35, 35, 500, 394, 394, 458, 458, 808, 408, 178,
+ /* 140 */ 334, 975, 975, 975, 975, 975, 975, 975, 975, 975,
+ /* 150 */ 975, 975, 975, 975, 975, 975, 975, 975, 975, 975,
+ /* 160 */ 613, 205, 57, 9, 1148, 1148, 429, 183, 183, 183,
+ /* 170 */ 383, 383, 2, 942, 429, 474, 35, 525, 35, 35,
+ /* 180 */ 437, 35, 35, 846, 35, 846, 846, 819, 1063, 458,
+ /* 190 */ 458, 458, 458, 458, 458, 2568, 764, 21, 49, 261,
+ /* 200 */ 261, 166, 351, 700, 341, 684, 82, 376, 507, 392,
+ /* 210 */ 392, 881, 1017, 1151, 1151, 1151, 1174, 1151, 1204, 1163,
+ /* 220 */ 1036, 452, 1203, 1311, 282, 1252, 1252, 1401, 1441, 1441,
+ /* 230 */ 775, 1480, 1353, 1252, 942, 1499, 1761, 1798, 1801, 1590,
+ /* 240 */ 474, 1801, 474, 1618, 1798, 1813, 1788, 1813, 1788, 1652,
+ /* 250 */ 1798, 1813, 1798, 1788, 1652, 1652, 1652, 1772, 1775, 1798,
+ /* 260 */ 1798, 1783, 1798, 1798, 1798, 1884, 1853, 1884, 1853, 1801,
+ /* 270 */ 474, 474, 1898, 474, 1901, 1903, 474, 1901, 474, 1912,
+ /* 280 */ 474, 1915, 474, 474, 1798, 474, 1884, 35, 35, 35,
+ /* 290 */ 35, 35, 35, 35, 35, 35, 35, 35, 1798, 1063,
+ /* 300 */ 1063, 1884, 846, 846, 846, 1720, 1844, 1801, 500, 1942,
+ /* 310 */ 1753, 1743, 1898, 500, 1499, 1798, 846, 1681, 1688, 1681,
+ /* 320 */ 1688, 1682, 1806, 1681, 1689, 1691, 1712, 1499, 1713, 1719,
+ /* 330 */ 1690, 1701, 1702, 1813, 2016, 1911, 1730, 1901, 500, 500,
+ /* 340 */ 1688, 846, 846, 846, 846, 1688, 846, 1854, 500, 846,
+ /* 350 */ 1915, 500, 1959, 846, 1881, 1915, 500, 819, 500, 1813,
+ /* 360 */ 846, 846, 846, 846, 846, 846, 846, 846, 846, 846,
+ /* 370 */ 846, 846, 846, 846, 846, 846, 846, 846, 846, 846,
+ /* 380 */ 846, 846, 1997, 846, 1798, 500, 2105, 2095, 2096, 2094,
+ /* 390 */ 1884, 4470, 4470, 4470, 4470, 4470, 4470, 4470, 4470, 4470,
+ /* 400 */ 4470, 4470, 4470, 39, 1166, 66, 982, 323, 336, 909,
+ /* 410 */ 945, 1026, 1261, 1278, 1287, 567, 1138, 1296, 1454, 1534,
+ /* 420 */ 1550, 782, 1502, 926, 1238, 1384, 1384, 1384, 1384, 1384,
+ /* 430 */ 1384, 1384, 1384, 1384, 728, 33, 164, 532, 199, 199,
+ /* 440 */ 299, 105, 313, 720, 616, 809, 154, 1033, 1319, 1137,
+ /* 450 */ 706, 706, 1387, 1105, 795, 1387, 1387, 1387, 1205, 1161,
+ /* 460 */ 850, 1089, 1491, 1339, 1429, 1512, 1408, 1428, 1412, 1414,
+ /* 470 */ 1428, 1432, 951, 1531, 1540, 1557, 1560, 1583, 1606, 1334,
+ /* 480 */ 1508, 1536, 625, 1538, 1542, 1544, 1545, 1433, 1439, 1444,
+ /* 490 */ 1555, 1556, 1593, 1596, 1629, 1599, 1476, 1602, 1603, 1607,
+ /* 500 */ 1591, 1608, 1614, 1616, 1620, 1635, 1684, 1698, 1708, 1725,
+ /* 510 */ 1740, 1742, 1744, 1750, 1752, 1754, 1756, 1643, 1428, 1680,
+ /* 520 */ 1693, 1696, 1700, 1709, 1655, 1722, 1589, 1609, 1766, 1767,
+ /* 530 */ 1747, 1572, 2158, 2159, 2161, 2117, 2165, 2130, 1924, 2133,
+ /* 540 */ 2134, 2136, 1930, 2174, 2145, 2146, 1943, 2151, 2189, 2193,
+ /* 550 */ 1952, 2199, 2164, 2202, 2168, 2211, 2190, 2216, 2181, 1983,
+ /* 560 */ 2223, 2000, 2225, 2005, 2008, 2012, 2018, 2235, 2236, 2237,
+ /* 570 */ 2026, 2028, 2240, 2241, 2085, 2194, 2196, 2251, 2213, 2252,
+ /* 580 */ 2253, 2218, 2201, 2256, 2207, 2257, 2212, 2260, 2261, 2262,
+ /* 590 */ 2214, 2263, 2264, 2266, 2267, 2268, 2270, 2097, 2242, 2271,
+ /* 600 */ 2100, 2272, 2277, 2279, 2280, 2281, 2282, 2283, 2285, 2286,
+ /* 610 */ 2287, 2289, 2290, 2292, 2294, 2296, 2297, 2299, 2300, 2301,
+ /* 620 */ 2308, 2258, 2314, 2269, 2315, 2320, 2321, 2322, 2325, 2326,
+ /* 630 */ 2327, 2328, 2330, 2310, 2333, 2176, 2335, 2179, 2337, 2183,
+ /* 640 */ 2340, 2342, 2329, 2291, 2334, 2305, 2344, 2284, 2358, 2293,
+ /* 650 */ 2323, 2363, 2302, 2364, 2303, 2365, 2368, 2336, 2319, 2331,
+ /* 660 */ 2369, 2338, 2324, 2345, 2377, 2354, 2341, 2350, 2396, 2366,
+ /* 670 */ 2399, 2356, 2357, 2347, 2355, 2359, 2367, 2360, 2407, 2370,
+ /* 680 */ 2372, 2408, 2409, 2412, 2413, 2373, 2220, 2414, 2355, 2374,
+ /* 690 */ 2418, 2355, 2378, 2419, 2420, 2352, 2421, 2423, 2394, 2379,
+ /* 700 */ 2387, 2432, 2398, 2381, 2392, 2437, 2402, 2385, 2397, 2440,
+ /* 710 */ 2410, 2389, 2401, 2447, 2448, 2450, 2451, 2452, 2453, 2332,
+ /* 720 */ 2343, 2424, 2433, 2454, 2434, 2425, 2426, 2427, 2429, 2431,
+ /* 730 */ 2435, 2436, 2438, 2441, 2449, 2457, 2442, 2444, 2446, 2455,
+ /* 740 */ 2469, 2459, 2470, 2473, 2502, 2481, 2417, 2507, 2486, 2474,
+ /* 750 */ 2512, 2514, 2515, 2480, 2519, 2484, 2521, 2488, 2522, 2503,
+ /* 760 */ 2506, 2491, 2492, 2493, 2415, 2422, 2530, 2349, 2304, 2306,
+ /* 770 */ 2428, 2309, 2355, 2487, 2535, 2351, 2500, 2518, 2545, 2361,
+ /* 780 */ 2524, 2362, 2348, 2548, 2549, 2382, 2371, 2383, 2375, 2547,
+ /* 790 */ 2520, 2238, 2439, 2461, 2443, 2463, 2516, 2525, 2466, 2505,
+ /* 800 */ 2472, 2508, 2471, 2467, 2529, 2537, 2475, 2477, 2489, 2494,
+ /* 810 */ 2495, 2555, 2539, 2556, 2497, 2567, 2295, 2531, 2498, 2583,
+ /* 820 */ 2504, 2581, 2511, 2513, 2615, 2591, 2317, 2587, 2601, 2602,
+ /* 830 */ 2603, 2604, 2605, 2526, 2527, 2594, 2376, 2614, 2597, 2651,
+ /* 840 */ 2652, 2538, 2610, 2540, 2541, 2543, 2544, 2464, 2546, 2655,
+ /* 850 */ 2618, 2468, 2663, 2550, 2554, 2476, 2620, 2479, 2637, 2558,
+ /* 860 */ 2390, 2563, 2675, 2656, 2458, 2565, 2566, 2569, 2571, 2573,
+ /* 870 */ 2574, 2576, 2578, 2589, 2596, 2598, 2599, 2580, 2632, 2611,
+ /* 880 */ 2616, 2634, 2593, 2694, 2462, 2617, 2619, 2730, 2621, 2623,
+ /* 890 */ 2551, 2689, 2624, 2626, 2735, 2714, 2628, 2629, 2355, 2690,
+ /* 900 */ 2633, 2640, 2644, 2641, 2646, 2636, 2742, 2542, 2654, 2731,
+ /* 910 */ 2736, 2659, 2660, 2739, 2662, 2664, 2746, 2578, 2667, 2748,
+ /* 920 */ 2589, 2670, 2752, 2596, 2673, 2754, 2598, 2642, 2657, 2658,
+ /* 930 */ 2661, 2676, 2745, 2678, 2760, 2682, 2745, 2745, 2777, 2725,
+ /* 940 */ 2727, 2781, 2768, 2769, 2770, 2771, 2772, 2775, 2776, 2778,
+ /* 950 */ 2779, 2780, 2782, 2737, 2704, 2738, 2708, 2788, 2786, 2787,
+ /* 960 */ 2789, 2802, 2791, 2793, 2794, 2751, 2449, 2798, 2457, 2800,
+ /* 970 */ 2801, 2809, 2816, 2831, 2818, 2838, 2819, 2803, 2812, 2858,
+ /* 980 */ 2823, 2806, 2817, 2862, 2828, 2811, 2824, 2863, 2833, 2813,
+ /* 990 */ 2826, 2872, 2841, 2874, 2856, 2843, 2887, 2870, 2861, 2860,
+ /* 1000 */ 2864, 2875, 2877, 2879, 2880, 2878, 2883,
};
-#define YY_REDUCE_COUNT (401)
-#define YY_REDUCE_MIN (-527)
-#define YY_REDUCE_MAX (3593)
+#define YY_REDUCE_COUNT (402)
+#define YY_REDUCE_MIN (-529)
+#define YY_REDUCE_MAX (3959)
static const short yy_reduce_ofst[] = {
- /* 0 */ -139, -344, -203, 1235, 1265, 1390, 1499, 1536, 1587, 1623,
- /* 10 */ 649, 1669, 1711, 1749, 1836, 1885, -98, 611, 1371, 1990,
- /* 20 */ 2017, 2036, 2057, 2103, 2170, 2189, 2216, 2329, 2356, 2393,
- /* 30 */ 2420, 2484, 2505, 2525, 2551, 2590, 2616, 2721, 2742, 2759,
- /* 40 */ 2826, 2868, 2890, 2911, 2932, 2999, 3020, 3125, 3145, 3167,
- /* 50 */ 3250, 3272, 3291, 3314, 3378, 3400, 3419, 3468, 3553, 3573,
- /* 60 */ 3593, -339, 161, 470, -79, 158, 528, 832, 897, 786,
- /* 70 */ 898, 904, 291, -527, -93, 330, -525, -177, 608, -270,
- /* 80 */ -424, -133, 416, 885, -271, -117, -393, -391, -260, -399,
- /* 90 */ -389, -333, -6, 69, -246, 168, 174, 382, 474, 607,
- /* 100 */ -105, 344, 620, 645, 660, 689, 367, -288, 223, -290,
- /* 110 */ 721, 747, -209, 303, 780, 170, 793, 262, 883, 931,
- /* 120 */ 938, 984, 435, 1034, 1085, 1124, 547, 1132, -78, 588,
- /* 130 */ 581, 269, -99, -99, 406, -421, -103, -219, 112, 351,
- /* 140 */ 2, 159, 357, 532, 657, 672, 722, 916, 970, 973,
- /* 150 */ 1003, 1007, 1032, 1043, 1088, 1089, 1093, 1128, 1133, 217,
- /* 160 */ 414, -348, 404, 686, 790, 711, 414, 579, 699, 651,
- /* 170 */ 697, 55, -404, 763, 882, 671, 684, 839, 851, 412,
- /* 180 */ 933, 54, 497, 1101, 907, 956, -397, 859, 368, 503,
- /* 190 */ 605, 623, 631, 663, 1100, 1264, 1245, 1261, 1193, 1193,
- /* 200 */ 1161, 1174, 1182, 1198, 1326, 1193, 1302, 1302, 1324, 1328,
- /* 210 */ 1335, 1288, 1196, 1197, 1199, 1281, 1209, 1302, 1295, 1360,
- /* 220 */ 1284, 1379, 1337, 1309, 1331, 1338, 1302, 1255, 1259, 1239,
- /* 230 */ 1275, 1260, 1341, 1381, 1330, 1311, 1411, 1339, 1325, 1406,
- /* 240 */ 1340, 1409, 1347, 1416, 1427, 1375, 1430, 1377, 1383, 1433,
- /* 250 */ 1436, 1443, 1385, 1392, 1398, 1399, 1441, 1444, 1455, 1457,
- /* 260 */ 1448, 1460, 1461, 1462, 1472, 1471, 1476, 1473, 1393, 1475,
- /* 270 */ 1478, 1434, 1479, 1494, 1429, 1492, 1506, 1496, 1447, 1504,
- /* 280 */ 1456, 1508, 1509, 1516, 1510, 1527, 1493, 1495, 1497, 1498,
- /* 290 */ 1500, 1501, 1505, 1511, 1513, 1514, 1518, 1521, 1545, 1547,
- /* 300 */ 1549, 1480, 1515, 1519, 1450, 1463, 1466, 1544, 1469, 1474,
- /* 310 */ 1477, 1520, 1551, 1483, 1559, 1523, 1418, 1525, 1420, 1528,
- /* 320 */ 1428, 1424, 1432, 1431, 1438, 1445, 1524, 1451, 1454, 1417,
- /* 330 */ 1453, 1459, 1609, 1522, 1467, 1481, 1612, 1615, 1616, 1561,
- /* 340 */ 1582, 1584, 1596, 1608, 1565, 1613, 1571, 1639, 1614, 1589,
- /* 350 */ 1651, 1530, 1617, 1591, 1607, 1654, 1638, 1655, 1664, 1621,
- /* 360 */ 1626, 1628, 1629, 1630, 1632, 1633, 1635, 1647, 1652, 1656,
- /* 370 */ 1668, 1672, 1674, 1676, 1683, 1684, 1687, 1690, 1692, 1694,
- /* 380 */ 1699, 1678, 1700, 1682, 1697, 1689, 1695, 1702, 1712, 1716,
- /* 390 */ 1680, 1710, 1618, 1620, 1681, 1691, 1698, 1724, 1717, 1728,
- /* 400 */ 1726, 1727,
+ /* 0 */ -233, -345, -60, -203, 978, 1481, 1562, 1592, 1675, 1705,
+ /* 10 */ 1802, 1845, 1883, 267, 622, 1996, 306, 662, 2063, 2093,
+ /* 20 */ 2198, 2219, 2249, 2339, 2380, 2445, 2465, 2485, 2570, 2590,
+ /* 30 */ 2666, 2702, 2743, 2827, 2848, 2876, 2916, 2959, 3001, 3041,
+ /* 40 */ 3084, 3130, 3167, 3213, 3235, 3278, 3303, 3324, 3346, 3471,
+ /* 50 */ 3490, 3510, 3577, 3615, 3661, 3682, 3750, 3772, 3793, 3818,
+ /* 60 */ 3939, 3959, -320, -38, 276, -296, 556, 965, 1109, 1179,
+ /* 70 */ -341, -112, 190, 160, -529, -367, -75, -526, -450, -240,
+ /* 80 */ -408, -425, 232, -133, 31, -264, -76, -394, -389, 260,
+ /* 90 */ 284, 574, -430, 58, 263, 70, 46, 365, 427, 438,
+ /* 100 */ 578, -287, 278, 606, 609, 612, 646, 338, 229, 468,
+ /* 110 */ 455, 680, 683, 682, 265, 756, 318, 759, -11, 768,
+ /* 120 */ 789, 794, 796, 708, 802, 878, 913, 615, 953, -331,
+ /* 130 */ 762, 876, 791, -503, -503, 372, 636, -364, -163, -148,
+ /* 140 */ 262, -346, 387, 576, 644, 734, 973, 976, 977, 984,
+ /* 150 */ 989, 994, 996, 1005, 1018, 1027, 1029, 1030, 1039, 1050,
+ /* 160 */ -258, 132, 138, 803, 910, 1022, 1024, 132, 919, 933,
+ /* 170 */ 243, 486, 707, 991, 1031, -84, 691, 855, 391, 858,
+ /* 180 */ 898, 1014, 395, 1006, 891, 1061, 1062, -53, 1108, -424,
+ /* 190 */ -412, 746, 755, 1053, 1078, 540, 1104, 1193, 1129, 1083,
+ /* 200 */ 1083, 1084, 1040, 1116, 1135, 1284, 1083, 1301, 1301, 1327,
+ /* 210 */ 1328, 1382, 1324, 1232, 1233, 1234, 1316, 1236, 1301, 1331,
+ /* 220 */ 1386, 1297, 1391, 1348, 1315, 1337, 1340, 1301, 1263, 1264,
+ /* 230 */ 1240, 1282, 1267, 1350, 1392, 1341, 1322, 1420, 1342, 1333,
+ /* 240 */ 1415, 1344, 1422, 1355, 1434, 1435, 1383, 1440, 1385, 1394,
+ /* 250 */ 1443, 1456, 1477, 1423, 1427, 1431, 1436, 1467, 1475, 1489,
+ /* 260 */ 1492, 1483, 1495, 1496, 1497, 1513, 1510, 1515, 1518, 1425,
+ /* 270 */ 1501, 1507, 1471, 1511, 1520, 1450, 1516, 1524, 1519, 1468,
+ /* 280 */ 1525, 1478, 1527, 1529, 1539, 1532, 1547, 1514, 1517, 1526,
+ /* 290 */ 1528, 1530, 1537, 1541, 1543, 1546, 1549, 1558, 1554, 1553,
+ /* 300 */ 1566, 1552, 1522, 1523, 1548, 1473, 1484, 1482, 1565, 1504,
+ /* 310 */ 1533, 1500, 1551, 1594, 1559, 1597, 1561, 1459, 1563, 1460,
+ /* 320 */ 1564, 1463, 1469, 1470, 1479, 1474, 1485, 1568, 1486, 1494,
+ /* 330 */ 1466, 1487, 1490, 1634, 1569, 1503, 1506, 1640, 1638, 1642,
+ /* 340 */ 1581, 1604, 1605, 1610, 1611, 1586, 1613, 1612, 1647, 1623,
+ /* 350 */ 1601, 1666, 1567, 1636, 1626, 1622, 1683, 1663, 1692, 1697,
+ /* 360 */ 1657, 1658, 1664, 1665, 1669, 1670, 1671, 1672, 1673, 1674,
+ /* 370 */ 1676, 1678, 1679, 1685, 1686, 1694, 1695, 1699, 1703, 1706,
+ /* 380 */ 1710, 1711, 1707, 1714, 1726, 1721, 1741, 1745, 1746, 1749,
+ /* 390 */ 1751, 1661, 1715, 1654, 1677, 1724, 1727, 1716, 1731, 1718,
+ /* 400 */ 1732, 1755, 1764,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 10 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 20 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 30 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 40 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 50 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 60 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 70 */ 2254, 2629, 2254, 2254, 2585, 2254, 2254, 2254, 2254, 2254,
- /* 80 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2592,
- /* 90 */ 2592, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 100 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 110 */ 2254, 2254, 2360, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 120 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 130 */ 2254, 2358, 2896, 2254, 3022, 2670, 2254, 2254, 2925, 2254,
- /* 140 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 150 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 160 */ 2908, 2254, 2254, 2331, 2331, 2254, 2908, 2908, 2908, 2868,
- /* 170 */ 2868, 2358, 2254, 2254, 2360, 2254, 2672, 2254, 2254, 2254,
- /* 180 */ 2254, 2254, 2254, 2254, 2254, 2254, 2501, 2284, 2254, 2254,
- /* 190 */ 2254, 2254, 2254, 2254, 2655, 2254, 2254, 2954, 2900, 2901,
- /* 200 */ 3016, 2254, 2957, 2919, 2254, 2914, 2254, 2254, 2254, 2254,
- /* 210 */ 2254, 2944, 2254, 2254, 2254, 2254, 2254, 2254, 2597, 2254,
- /* 220 */ 2698, 2254, 2446, 2649, 2254, 2254, 2254, 2254, 2254, 3000,
- /* 230 */ 2898, 2938, 2254, 2254, 2948, 2254, 2254, 2254, 2686, 2360,
- /* 240 */ 2254, 2360, 2642, 2580, 2254, 2590, 2254, 2590, 2587, 2254,
- /* 250 */ 2254, 2254, 2590, 2587, 2587, 2587, 2434, 2430, 2254, 2254,
- /* 260 */ 2428, 2254, 2254, 2254, 2254, 2314, 2254, 2314, 2254, 2360,
- /* 270 */ 2360, 2254, 2360, 2254, 2254, 2360, 2254, 2360, 2254, 2360,
- /* 280 */ 2254, 2360, 2360, 2254, 2360, 2254, 2254, 2254, 2254, 2254,
- /* 290 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 300 */ 2254, 2254, 2254, 2254, 2684, 2665, 2254, 2358, 2254, 2653,
- /* 310 */ 2651, 2254, 2358, 2948, 2254, 2254, 2970, 2965, 2970, 2965,
- /* 320 */ 2984, 2980, 2970, 2989, 2986, 2950, 2948, 2931, 2927, 3019,
- /* 330 */ 3006, 3002, 2254, 2254, 2936, 2934, 2254, 2358, 2358, 2965,
- /* 340 */ 2254, 2254, 2254, 2254, 2965, 2254, 2254, 2358, 2254, 2254,
- /* 350 */ 2358, 2254, 2254, 2254, 2254, 2358, 2254, 2358, 2254, 2254,
- /* 360 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 370 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 380 */ 2254, 2463, 2254, 2254, 2358, 2254, 2286, 2288, 2298, 2254,
- /* 390 */ 2644, 3022, 2670, 2675, 2625, 2625, 2504, 2504, 3022, 2504,
- /* 400 */ 2361, 2259, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 410 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2803, 2254, 2254,
- /* 420 */ 2254, 2254, 2254, 2254, 2983, 2982, 2804, 2254, 2872, 2871,
- /* 430 */ 2870, 2861, 2803, 2459, 2254, 2254, 2254, 2802, 2801, 2254,
- /* 440 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2616,
- /* 450 */ 2615, 2795, 2254, 2254, 2796, 2794, 2793, 2254, 2254, 2254,
- /* 460 */ 2254, 2254, 2254, 2254, 2254, 2254, 2450, 2254, 2254, 2447,
- /* 470 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 480 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 3003, 3007, 2254,
- /* 490 */ 2254, 2254, 2254, 2897, 2254, 2254, 2254, 2254, 2774, 2254,
- /* 500 */ 2254, 2254, 2254, 2254, 2742, 2737, 2728, 2719, 2734, 2725,
- /* 510 */ 2713, 2731, 2722, 2710, 2707, 2254, 2472, 2254, 2254, 2254,
- /* 520 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 530 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 540 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 550 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 560 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 570 */ 2254, 2254, 2586, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 580 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 590 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 600 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 610 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 620 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 630 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2601, 2254, 2254,
- /* 640 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 650 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 660 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 670 */ 2254, 2303, 2781, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 680 */ 2254, 2254, 2254, 2254, 2254, 2254, 2784, 2254, 2254, 2785,
- /* 690 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 700 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 710 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 720 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 730 */ 2254, 2254, 2405, 2404, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 740 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 750 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 760 */ 2254, 2254, 2786, 2254, 2254, 2254, 2254, 2669, 2254, 2254,
- /* 770 */ 2776, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 780 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2999, 2951, 2254,
- /* 790 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 800 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 810 */ 2254, 2774, 2254, 2981, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 820 */ 2254, 2997, 2254, 3001, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 830 */ 2254, 2907, 2903, 2254, 2254, 2899, 2254, 2254, 2254, 2254,
- /* 840 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 850 */ 2254, 2254, 2254, 2254, 2254, 2254, 2858, 2254, 2254, 2254,
- /* 860 */ 2892, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2500,
- /* 870 */ 2499, 2498, 2497, 2254, 2254, 2254, 2254, 2254, 2254, 2786,
- /* 880 */ 2254, 2789, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 890 */ 2254, 2254, 2254, 2254, 2254, 2773, 2254, 2837, 2836, 2254,
- /* 900 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2494, 2254,
- /* 910 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 920 */ 2254, 2254, 2254, 2254, 2478, 2476, 2475, 2474, 2254, 2511,
- /* 930 */ 2254, 2254, 2254, 2507, 2506, 2254, 2254, 2254, 2254, 2254,
- /* 940 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 950 */ 2254, 2254, 2254, 2254, 2379, 2254, 2254, 2254, 2254, 2254,
- /* 960 */ 2254, 2254, 2254, 2371, 2254, 2370, 2254, 2254, 2254, 2254,
- /* 970 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 980 */ 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254,
- /* 990 */ 2254, 2254, 2254, 2254, 2254, 2283, 2254, 2254, 2254, 2254,
- /* 1000 */ 2254, 2254, 2254, 2254,
+ /* 0 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 10 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 20 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 30 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 40 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 50 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 60 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 70 */ 2263, 2263, 2638, 2263, 2263, 2594, 2263, 2263, 2263, 2263,
+ /* 80 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 90 */ 2601, 2601, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 100 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 110 */ 2263, 2263, 2263, 2369, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 120 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 130 */ 2263, 2263, 2367, 2908, 2263, 3034, 2679, 2263, 2263, 2937,
+ /* 140 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 150 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 160 */ 2263, 2920, 2263, 2263, 2340, 2340, 2263, 2920, 2920, 2920,
+ /* 170 */ 2880, 2880, 2367, 2263, 2263, 2369, 2263, 2681, 2263, 2263,
+ /* 180 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2510, 2293, 2263,
+ /* 190 */ 2263, 2263, 2263, 2263, 2263, 2664, 2263, 2263, 2966, 2912,
+ /* 200 */ 2913, 3028, 2263, 2969, 2931, 2263, 2926, 2263, 2263, 2263,
+ /* 210 */ 2263, 2263, 2956, 2263, 2263, 2263, 2263, 2263, 2263, 2606,
+ /* 220 */ 2263, 2707, 2263, 2455, 2658, 2263, 2263, 2263, 2263, 2263,
+ /* 230 */ 3012, 2910, 2950, 2263, 2263, 2960, 2263, 2263, 2263, 2695,
+ /* 240 */ 2369, 2263, 2369, 2651, 2589, 2263, 2599, 2263, 2599, 2596,
+ /* 250 */ 2263, 2263, 2263, 2599, 2596, 2596, 2596, 2443, 2439, 2263,
+ /* 260 */ 2263, 2437, 2263, 2263, 2263, 2263, 2323, 2263, 2323, 2263,
+ /* 270 */ 2369, 2369, 2263, 2369, 2263, 2263, 2369, 2263, 2369, 2263,
+ /* 280 */ 2369, 2263, 2369, 2369, 2263, 2369, 2263, 2263, 2263, 2263,
+ /* 290 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 300 */ 2263, 2263, 2263, 2263, 2263, 2693, 2674, 2263, 2367, 2263,
+ /* 310 */ 2662, 2660, 2263, 2367, 2960, 2263, 2263, 2982, 2977, 2982,
+ /* 320 */ 2977, 2996, 2992, 2982, 3001, 2998, 2962, 2960, 2943, 2939,
+ /* 330 */ 3031, 3018, 3014, 2263, 2263, 2948, 2946, 2263, 2367, 2367,
+ /* 340 */ 2977, 2263, 2263, 2263, 2263, 2977, 2263, 2263, 2367, 2263,
+ /* 350 */ 2263, 2367, 2263, 2263, 2263, 2263, 2367, 2263, 2367, 2263,
+ /* 360 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 370 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 380 */ 2263, 2263, 2472, 2263, 2263, 2367, 2263, 2295, 2297, 2307,
+ /* 390 */ 2263, 2653, 3034, 2679, 2684, 2634, 2634, 2513, 2513, 3034,
+ /* 400 */ 2513, 2370, 2268, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 410 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2812, 2263,
+ /* 420 */ 2263, 2263, 2263, 2263, 2263, 2995, 2994, 2813, 2263, 2884,
+ /* 430 */ 2883, 2882, 2873, 2812, 2468, 2263, 2263, 2263, 2811, 2810,
+ /* 440 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 450 */ 2625, 2624, 2804, 2263, 2263, 2805, 2803, 2802, 2263, 2263,
+ /* 460 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2459, 2263, 2263,
+ /* 470 */ 2456, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 480 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 3015, 3019,
+ /* 490 */ 2263, 2263, 2263, 2263, 2909, 2263, 2263, 2263, 2263, 2263,
+ /* 500 */ 2783, 2263, 2263, 2263, 2263, 2263, 2751, 2746, 2737, 2728,
+ /* 510 */ 2743, 2734, 2722, 2740, 2731, 2719, 2716, 2263, 2481, 2263,
+ /* 520 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 530 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 540 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 550 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 560 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 570 */ 2263, 2263, 2263, 2263, 2595, 2263, 2263, 2263, 2263, 2263,
+ /* 580 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 590 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 600 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 610 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 620 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 630 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2610,
+ /* 640 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 650 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 660 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 670 */ 2263, 2263, 2263, 2312, 2790, 2263, 2263, 2263, 2263, 2263,
+ /* 680 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2793, 2263,
+ /* 690 */ 2263, 2794, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 700 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 710 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 720 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 730 */ 2263, 2263, 2263, 2263, 2414, 2413, 2263, 2263, 2263, 2263,
+ /* 740 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 750 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 760 */ 2263, 2263, 2263, 2263, 2795, 2263, 2263, 2263, 2263, 2678,
+ /* 770 */ 2263, 2263, 2785, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 780 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 3011,
+ /* 790 */ 2963, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 800 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 810 */ 2263, 2263, 2263, 2783, 2263, 2993, 2263, 2263, 2263, 2263,
+ /* 820 */ 2263, 2263, 2263, 3009, 2263, 3013, 2263, 2263, 2263, 2263,
+ /* 830 */ 2263, 2263, 2263, 2919, 2915, 2263, 2263, 2911, 2263, 2263,
+ /* 840 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 850 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2870, 2263,
+ /* 860 */ 2263, 2263, 2904, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 870 */ 2263, 2263, 2509, 2508, 2507, 2506, 2263, 2263, 2263, 2263,
+ /* 880 */ 2263, 2263, 2795, 2263, 2798, 2263, 2263, 2263, 2263, 2263,
+ /* 890 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2782, 2263,
+ /* 900 */ 2847, 2846, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 910 */ 2263, 2503, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 920 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2487, 2485, 2484,
+ /* 930 */ 2483, 2263, 2520, 2263, 2263, 2263, 2516, 2515, 2263, 2263,
+ /* 940 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 950 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2388, 2263, 2263,
+ /* 960 */ 2263, 2263, 2263, 2263, 2263, 2263, 2380, 2263, 2379, 2263,
+ /* 970 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 980 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263,
+ /* 990 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2292, 2263,
+ /* 1000 */ 2263, 2263, 2263, 2263, 2263, 2263, 2263,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1880,12 +1954,12 @@ static const YYCODETYPE yyFallback[] = {
0, /* BWLIMIT => nothing */
0, /* START => nothing */
0, /* TIMESTAMP => nothing */
- 336, /* END => ABORT */
+ 337, /* END => ABORT */
0, /* TABLE => nothing */
0, /* NK_LP => nothing */
0, /* NK_RP => nothing */
0, /* USING => nothing */
- 336, /* FILE => ABORT */
+ 337, /* FILE => ABORT */
0, /* STABLE => nothing */
0, /* COLUMN => nothing */
0, /* MODIFY => nothing */
@@ -1953,7 +2027,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* VNODES => nothing */
0, /* ALIVE => nothing */
0, /* VIEWS => nothing */
- 336, /* VIEW => ABORT */
+ 337, /* VIEW => ABORT */
0, /* COMPACTS => nothing */
0, /* NORMAL => nothing */
0, /* CHILD => nothing */
@@ -1996,7 +2070,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* PAUSE => nothing */
0, /* RESUME => nothing */
0, /* PRIMARY => nothing */
- 336, /* KEY => ABORT */
+ 337, /* KEY => ABORT */
0, /* TRIGGER => nothing */
0, /* AT_ONCE => nothing */
0, /* WINDOW_CLOSE => nothing */
@@ -2035,9 +2109,10 @@ static const YYCODETYPE yyFallback[] = {
0, /* CAST => nothing */
0, /* POSITION => nothing */
0, /* IN => nothing */
- 336, /* FOR => ABORT */
+ 337, /* FOR => ABORT */
0, /* NOW => nothing */
0, /* TODAY => nothing */
+ 0, /* RAND => nothing */
0, /* SUBSTR => nothing */
0, /* SUBSTRING => nothing */
0, /* BOTH => nothing */
@@ -2068,7 +2143,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* LEFT => nothing */
0, /* RIGHT => nothing */
0, /* OUTER => nothing */
- 336, /* SEMI => ABORT */
+ 337, /* SEMI => ABORT */
0, /* ANTI => nothing */
0, /* ASOF => nothing */
0, /* WINDOW => nothing */
@@ -2104,51 +2179,51 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 336, /* AFTER => ABORT */
- 336, /* ATTACH => ABORT */
- 336, /* BEFORE => ABORT */
- 336, /* BEGIN => ABORT */
- 336, /* BITAND => ABORT */
- 336, /* BITNOT => ABORT */
- 336, /* BITOR => ABORT */
- 336, /* BLOCKS => ABORT */
- 336, /* CHANGE => ABORT */
- 336, /* COMMA => ABORT */
- 336, /* CONCAT => ABORT */
- 336, /* CONFLICT => ABORT */
- 336, /* COPY => ABORT */
- 336, /* DEFERRED => ABORT */
- 336, /* DELIMITERS => ABORT */
- 336, /* DETACH => ABORT */
- 336, /* DIVIDE => ABORT */
- 336, /* DOT => ABORT */
- 336, /* EACH => ABORT */
- 336, /* FAIL => ABORT */
- 336, /* GLOB => ABORT */
- 336, /* ID => ABORT */
- 336, /* IMMEDIATE => ABORT */
- 336, /* IMPORT => ABORT */
- 336, /* INITIALLY => ABORT */
- 336, /* INSTEAD => ABORT */
- 336, /* ISNULL => ABORT */
- 336, /* MODULES => ABORT */
- 336, /* NK_BITNOT => ABORT */
- 336, /* NK_SEMI => ABORT */
- 336, /* NOTNULL => ABORT */
- 336, /* OF => ABORT */
- 336, /* PLUS => ABORT */
- 336, /* PRIVILEGE => ABORT */
- 336, /* RAISE => ABORT */
- 336, /* RESTRICT => ABORT */
- 336, /* ROW => ABORT */
- 336, /* STAR => ABORT */
- 336, /* STATEMENT => ABORT */
- 336, /* STRICT => ABORT */
- 336, /* STRING => ABORT */
- 336, /* TIMES => ABORT */
- 336, /* VALUES => ABORT */
- 336, /* VARIABLE => ABORT */
- 336, /* WAL => ABORT */
+ 337, /* AFTER => ABORT */
+ 337, /* ATTACH => ABORT */
+ 337, /* BEFORE => ABORT */
+ 337, /* BEGIN => ABORT */
+ 337, /* BITAND => ABORT */
+ 337, /* BITNOT => ABORT */
+ 337, /* BITOR => ABORT */
+ 337, /* BLOCKS => ABORT */
+ 337, /* CHANGE => ABORT */
+ 337, /* COMMA => ABORT */
+ 337, /* CONCAT => ABORT */
+ 337, /* CONFLICT => ABORT */
+ 337, /* COPY => ABORT */
+ 337, /* DEFERRED => ABORT */
+ 337, /* DELIMITERS => ABORT */
+ 337, /* DETACH => ABORT */
+ 337, /* DIVIDE => ABORT */
+ 337, /* DOT => ABORT */
+ 337, /* EACH => ABORT */
+ 337, /* FAIL => ABORT */
+ 337, /* GLOB => ABORT */
+ 337, /* ID => ABORT */
+ 337, /* IMMEDIATE => ABORT */
+ 337, /* IMPORT => ABORT */
+ 337, /* INITIALLY => ABORT */
+ 337, /* INSTEAD => ABORT */
+ 337, /* ISNULL => ABORT */
+ 337, /* MODULES => ABORT */
+ 337, /* NK_BITNOT => ABORT */
+ 337, /* NK_SEMI => ABORT */
+ 337, /* NOTNULL => ABORT */
+ 337, /* OF => ABORT */
+ 337, /* PLUS => ABORT */
+ 337, /* PRIVILEGE => ABORT */
+ 337, /* RAISE => ABORT */
+ 337, /* RESTRICT => ABORT */
+ 337, /* ROW => ABORT */
+ 337, /* STAR => ABORT */
+ 337, /* STATEMENT => ABORT */
+ 337, /* STRICT => ABORT */
+ 337, /* STRING => ABORT */
+ 337, /* TIMES => ABORT */
+ 337, /* VALUES => ABORT */
+ 337, /* VARIABLE => ABORT */
+ 337, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -2503,299 +2578,301 @@ static const char *const yyTokenName[] = {
/* 268 */ "FOR",
/* 269 */ "NOW",
/* 270 */ "TODAY",
- /* 271 */ "SUBSTR",
- /* 272 */ "SUBSTRING",
- /* 273 */ "BOTH",
- /* 274 */ "TRAILING",
- /* 275 */ "LEADING",
- /* 276 */ "TIMEZONE",
- /* 277 */ "CLIENT_VERSION",
- /* 278 */ "SERVER_VERSION",
- /* 279 */ "SERVER_STATUS",
- /* 280 */ "CURRENT_USER",
- /* 281 */ "PI",
- /* 282 */ "CASE",
- /* 283 */ "WHEN",
- /* 284 */ "THEN",
- /* 285 */ "ELSE",
- /* 286 */ "BETWEEN",
- /* 287 */ "IS",
- /* 288 */ "NK_LT",
- /* 289 */ "NK_GT",
- /* 290 */ "NK_LE",
- /* 291 */ "NK_GE",
- /* 292 */ "NK_NE",
- /* 293 */ "MATCH",
- /* 294 */ "NMATCH",
- /* 295 */ "CONTAINS",
- /* 296 */ "JOIN",
- /* 297 */ "INNER",
- /* 298 */ "LEFT",
- /* 299 */ "RIGHT",
- /* 300 */ "OUTER",
- /* 301 */ "SEMI",
- /* 302 */ "ANTI",
- /* 303 */ "ASOF",
- /* 304 */ "WINDOW",
- /* 305 */ "WINDOW_OFFSET",
- /* 306 */ "JLIMIT",
- /* 307 */ "SELECT",
- /* 308 */ "NK_HINT",
- /* 309 */ "DISTINCT",
- /* 310 */ "WHERE",
- /* 311 */ "PARTITION",
- /* 312 */ "BY",
- /* 313 */ "SESSION",
- /* 314 */ "STATE_WINDOW",
- /* 315 */ "EVENT_WINDOW",
- /* 316 */ "COUNT_WINDOW",
- /* 317 */ "SLIDING",
- /* 318 */ "FILL",
- /* 319 */ "VALUE",
- /* 320 */ "VALUE_F",
- /* 321 */ "NONE",
- /* 322 */ "PREV",
- /* 323 */ "NULL_F",
- /* 324 */ "LINEAR",
- /* 325 */ "NEXT",
- /* 326 */ "HAVING",
- /* 327 */ "RANGE",
- /* 328 */ "EVERY",
- /* 329 */ "ORDER",
- /* 330 */ "SLIMIT",
- /* 331 */ "SOFFSET",
- /* 332 */ "LIMIT",
- /* 333 */ "OFFSET",
- /* 334 */ "ASC",
- /* 335 */ "NULLS",
- /* 336 */ "ABORT",
- /* 337 */ "AFTER",
- /* 338 */ "ATTACH",
- /* 339 */ "BEFORE",
- /* 340 */ "BEGIN",
- /* 341 */ "BITAND",
- /* 342 */ "BITNOT",
- /* 343 */ "BITOR",
- /* 344 */ "BLOCKS",
- /* 345 */ "CHANGE",
- /* 346 */ "COMMA",
- /* 347 */ "CONCAT",
- /* 348 */ "CONFLICT",
- /* 349 */ "COPY",
- /* 350 */ "DEFERRED",
- /* 351 */ "DELIMITERS",
- /* 352 */ "DETACH",
- /* 353 */ "DIVIDE",
- /* 354 */ "DOT",
- /* 355 */ "EACH",
- /* 356 */ "FAIL",
- /* 357 */ "GLOB",
- /* 358 */ "ID",
- /* 359 */ "IMMEDIATE",
- /* 360 */ "IMPORT",
- /* 361 */ "INITIALLY",
- /* 362 */ "INSTEAD",
- /* 363 */ "ISNULL",
- /* 364 */ "MODULES",
- /* 365 */ "NK_BITNOT",
- /* 366 */ "NK_SEMI",
- /* 367 */ "NOTNULL",
- /* 368 */ "OF",
- /* 369 */ "PLUS",
- /* 370 */ "PRIVILEGE",
- /* 371 */ "RAISE",
- /* 372 */ "RESTRICT",
- /* 373 */ "ROW",
- /* 374 */ "STAR",
- /* 375 */ "STATEMENT",
- /* 376 */ "STRICT",
- /* 377 */ "STRING",
- /* 378 */ "TIMES",
- /* 379 */ "VALUES",
- /* 380 */ "VARIABLE",
- /* 381 */ "WAL",
- /* 382 */ "cmd",
- /* 383 */ "account_options",
- /* 384 */ "alter_account_options",
- /* 385 */ "literal",
- /* 386 */ "alter_account_option",
- /* 387 */ "ip_range_list",
- /* 388 */ "white_list",
- /* 389 */ "white_list_opt",
- /* 390 */ "is_import_opt",
- /* 391 */ "is_createdb_opt",
- /* 392 */ "user_name",
- /* 393 */ "sysinfo_opt",
- /* 394 */ "privileges",
- /* 395 */ "priv_level",
- /* 396 */ "with_opt",
- /* 397 */ "priv_type_list",
- /* 398 */ "priv_type",
- /* 399 */ "db_name",
- /* 400 */ "table_name",
- /* 401 */ "topic_name",
- /* 402 */ "search_condition",
- /* 403 */ "dnode_endpoint",
- /* 404 */ "force_opt",
- /* 405 */ "unsafe_opt",
- /* 406 */ "not_exists_opt",
- /* 407 */ "db_options",
- /* 408 */ "exists_opt",
- /* 409 */ "alter_db_options",
- /* 410 */ "speed_opt",
- /* 411 */ "start_opt",
- /* 412 */ "end_opt",
- /* 413 */ "integer_list",
- /* 414 */ "variable_list",
- /* 415 */ "retention_list",
- /* 416 */ "signed",
- /* 417 */ "alter_db_option",
- /* 418 */ "retention",
- /* 419 */ "full_table_name",
- /* 420 */ "column_def_list",
- /* 421 */ "tags_def_opt",
- /* 422 */ "table_options",
- /* 423 */ "multi_create_clause",
- /* 424 */ "tag_list_opt",
- /* 425 */ "tags_def",
- /* 426 */ "multi_drop_clause",
- /* 427 */ "alter_table_clause",
- /* 428 */ "alter_table_options",
- /* 429 */ "column_name",
- /* 430 */ "type_name",
- /* 431 */ "column_options",
- /* 432 */ "tags_literal",
- /* 433 */ "create_subtable_clause",
- /* 434 */ "specific_cols_opt",
- /* 435 */ "tags_literal_list",
- /* 436 */ "drop_table_clause",
- /* 437 */ "col_name_list",
- /* 438 */ "tag_def_list",
- /* 439 */ "tag_def",
- /* 440 */ "column_def",
- /* 441 */ "type_name_default_len",
- /* 442 */ "duration_list",
- /* 443 */ "rollup_func_list",
- /* 444 */ "alter_table_option",
- /* 445 */ "duration_literal",
- /* 446 */ "rollup_func_name",
- /* 447 */ "function_name",
- /* 448 */ "col_name",
- /* 449 */ "db_kind_opt",
- /* 450 */ "table_kind_db_name_cond_opt",
- /* 451 */ "like_pattern_opt",
- /* 452 */ "db_name_cond_opt",
- /* 453 */ "table_name_cond",
- /* 454 */ "from_db_opt",
- /* 455 */ "table_kind",
- /* 456 */ "tag_item",
- /* 457 */ "column_alias",
- /* 458 */ "tsma_name",
- /* 459 */ "tsma_func_list",
- /* 460 */ "full_tsma_name",
- /* 461 */ "func_list",
- /* 462 */ "index_options",
- /* 463 */ "full_index_name",
- /* 464 */ "index_name",
- /* 465 */ "sliding_opt",
- /* 466 */ "sma_stream_opt",
- /* 467 */ "func",
- /* 468 */ "sma_func_name",
- /* 469 */ "expression_list",
- /* 470 */ "with_meta",
- /* 471 */ "query_or_subquery",
- /* 472 */ "where_clause_opt",
- /* 473 */ "cgroup_name",
- /* 474 */ "analyze_opt",
- /* 475 */ "explain_options",
- /* 476 */ "insert_query",
- /* 477 */ "or_replace_opt",
- /* 478 */ "agg_func_opt",
- /* 479 */ "bufsize_opt",
- /* 480 */ "language_opt",
- /* 481 */ "full_view_name",
- /* 482 */ "view_name",
- /* 483 */ "stream_name",
- /* 484 */ "stream_options",
- /* 485 */ "col_list_opt",
- /* 486 */ "tag_def_or_ref_opt",
- /* 487 */ "subtable_opt",
- /* 488 */ "ignore_opt",
- /* 489 */ "column_stream_def_list",
- /* 490 */ "column_stream_def",
- /* 491 */ "stream_col_options",
- /* 492 */ "expression",
- /* 493 */ "on_vgroup_id",
- /* 494 */ "dnode_list",
- /* 495 */ "literal_func",
- /* 496 */ "signed_literal",
- /* 497 */ "literal_list",
- /* 498 */ "table_alias",
- /* 499 */ "expr_or_subquery",
- /* 500 */ "pseudo_column",
- /* 501 */ "column_reference",
- /* 502 */ "function_expression",
- /* 503 */ "case_when_expression",
- /* 504 */ "star_func",
- /* 505 */ "star_func_para_list",
- /* 506 */ "trim_specification_type",
- /* 507 */ "substr_func",
- /* 508 */ "noarg_func",
- /* 509 */ "other_para_list",
- /* 510 */ "star_func_para",
- /* 511 */ "when_then_list",
- /* 512 */ "case_when_else_opt",
- /* 513 */ "common_expression",
- /* 514 */ "when_then_expr",
- /* 515 */ "predicate",
- /* 516 */ "compare_op",
- /* 517 */ "in_op",
- /* 518 */ "in_predicate_value",
- /* 519 */ "boolean_value_expression",
- /* 520 */ "boolean_primary",
- /* 521 */ "from_clause_opt",
- /* 522 */ "table_reference_list",
- /* 523 */ "table_reference",
- /* 524 */ "table_primary",
- /* 525 */ "joined_table",
- /* 526 */ "alias_opt",
- /* 527 */ "subquery",
- /* 528 */ "parenthesized_joined_table",
- /* 529 */ "join_type",
- /* 530 */ "join_subtype",
- /* 531 */ "join_on_clause_opt",
- /* 532 */ "window_offset_clause_opt",
- /* 533 */ "jlimit_clause_opt",
- /* 534 */ "window_offset_literal",
- /* 535 */ "query_specification",
- /* 536 */ "hint_list",
- /* 537 */ "set_quantifier_opt",
- /* 538 */ "tag_mode_opt",
- /* 539 */ "select_list",
- /* 540 */ "partition_by_clause_opt",
- /* 541 */ "range_opt",
- /* 542 */ "every_opt",
- /* 543 */ "fill_opt",
- /* 544 */ "twindow_clause_opt",
- /* 545 */ "group_by_clause_opt",
- /* 546 */ "having_clause_opt",
- /* 547 */ "select_item",
- /* 548 */ "partition_list",
- /* 549 */ "partition_item",
- /* 550 */ "interval_sliding_duration_literal",
- /* 551 */ "fill_mode",
- /* 552 */ "group_by_list",
- /* 553 */ "query_expression",
- /* 554 */ "query_simple",
- /* 555 */ "order_by_clause_opt",
- /* 556 */ "slimit_clause_opt",
- /* 557 */ "limit_clause_opt",
- /* 558 */ "union_query_expression",
- /* 559 */ "query_simple_or_subquery",
- /* 560 */ "sort_specification_list",
- /* 561 */ "sort_specification",
- /* 562 */ "ordering_specification_opt",
- /* 563 */ "null_ordering_opt",
+ /* 271 */ "RAND",
+ /* 272 */ "SUBSTR",
+ /* 273 */ "SUBSTRING",
+ /* 274 */ "BOTH",
+ /* 275 */ "TRAILING",
+ /* 276 */ "LEADING",
+ /* 277 */ "TIMEZONE",
+ /* 278 */ "CLIENT_VERSION",
+ /* 279 */ "SERVER_VERSION",
+ /* 280 */ "SERVER_STATUS",
+ /* 281 */ "CURRENT_USER",
+ /* 282 */ "PI",
+ /* 283 */ "CASE",
+ /* 284 */ "WHEN",
+ /* 285 */ "THEN",
+ /* 286 */ "ELSE",
+ /* 287 */ "BETWEEN",
+ /* 288 */ "IS",
+ /* 289 */ "NK_LT",
+ /* 290 */ "NK_GT",
+ /* 291 */ "NK_LE",
+ /* 292 */ "NK_GE",
+ /* 293 */ "NK_NE",
+ /* 294 */ "MATCH",
+ /* 295 */ "NMATCH",
+ /* 296 */ "CONTAINS",
+ /* 297 */ "JOIN",
+ /* 298 */ "INNER",
+ /* 299 */ "LEFT",
+ /* 300 */ "RIGHT",
+ /* 301 */ "OUTER",
+ /* 302 */ "SEMI",
+ /* 303 */ "ANTI",
+ /* 304 */ "ASOF",
+ /* 305 */ "WINDOW",
+ /* 306 */ "WINDOW_OFFSET",
+ /* 307 */ "JLIMIT",
+ /* 308 */ "SELECT",
+ /* 309 */ "NK_HINT",
+ /* 310 */ "DISTINCT",
+ /* 311 */ "WHERE",
+ /* 312 */ "PARTITION",
+ /* 313 */ "BY",
+ /* 314 */ "SESSION",
+ /* 315 */ "STATE_WINDOW",
+ /* 316 */ "EVENT_WINDOW",
+ /* 317 */ "COUNT_WINDOW",
+ /* 318 */ "SLIDING",
+ /* 319 */ "FILL",
+ /* 320 */ "VALUE",
+ /* 321 */ "VALUE_F",
+ /* 322 */ "NONE",
+ /* 323 */ "PREV",
+ /* 324 */ "NULL_F",
+ /* 325 */ "LINEAR",
+ /* 326 */ "NEXT",
+ /* 327 */ "HAVING",
+ /* 328 */ "RANGE",
+ /* 329 */ "EVERY",
+ /* 330 */ "ORDER",
+ /* 331 */ "SLIMIT",
+ /* 332 */ "SOFFSET",
+ /* 333 */ "LIMIT",
+ /* 334 */ "OFFSET",
+ /* 335 */ "ASC",
+ /* 336 */ "NULLS",
+ /* 337 */ "ABORT",
+ /* 338 */ "AFTER",
+ /* 339 */ "ATTACH",
+ /* 340 */ "BEFORE",
+ /* 341 */ "BEGIN",
+ /* 342 */ "BITAND",
+ /* 343 */ "BITNOT",
+ /* 344 */ "BITOR",
+ /* 345 */ "BLOCKS",
+ /* 346 */ "CHANGE",
+ /* 347 */ "COMMA",
+ /* 348 */ "CONCAT",
+ /* 349 */ "CONFLICT",
+ /* 350 */ "COPY",
+ /* 351 */ "DEFERRED",
+ /* 352 */ "DELIMITERS",
+ /* 353 */ "DETACH",
+ /* 354 */ "DIVIDE",
+ /* 355 */ "DOT",
+ /* 356 */ "EACH",
+ /* 357 */ "FAIL",
+ /* 358 */ "GLOB",
+ /* 359 */ "ID",
+ /* 360 */ "IMMEDIATE",
+ /* 361 */ "IMPORT",
+ /* 362 */ "INITIALLY",
+ /* 363 */ "INSTEAD",
+ /* 364 */ "ISNULL",
+ /* 365 */ "MODULES",
+ /* 366 */ "NK_BITNOT",
+ /* 367 */ "NK_SEMI",
+ /* 368 */ "NOTNULL",
+ /* 369 */ "OF",
+ /* 370 */ "PLUS",
+ /* 371 */ "PRIVILEGE",
+ /* 372 */ "RAISE",
+ /* 373 */ "RESTRICT",
+ /* 374 */ "ROW",
+ /* 375 */ "STAR",
+ /* 376 */ "STATEMENT",
+ /* 377 */ "STRICT",
+ /* 378 */ "STRING",
+ /* 379 */ "TIMES",
+ /* 380 */ "VALUES",
+ /* 381 */ "VARIABLE",
+ /* 382 */ "WAL",
+ /* 383 */ "cmd",
+ /* 384 */ "account_options",
+ /* 385 */ "alter_account_options",
+ /* 386 */ "literal",
+ /* 387 */ "alter_account_option",
+ /* 388 */ "ip_range_list",
+ /* 389 */ "white_list",
+ /* 390 */ "white_list_opt",
+ /* 391 */ "is_import_opt",
+ /* 392 */ "is_createdb_opt",
+ /* 393 */ "user_name",
+ /* 394 */ "sysinfo_opt",
+ /* 395 */ "privileges",
+ /* 396 */ "priv_level",
+ /* 397 */ "with_opt",
+ /* 398 */ "priv_type_list",
+ /* 399 */ "priv_type",
+ /* 400 */ "db_name",
+ /* 401 */ "table_name",
+ /* 402 */ "topic_name",
+ /* 403 */ "search_condition",
+ /* 404 */ "dnode_endpoint",
+ /* 405 */ "force_opt",
+ /* 406 */ "unsafe_opt",
+ /* 407 */ "not_exists_opt",
+ /* 408 */ "db_options",
+ /* 409 */ "exists_opt",
+ /* 410 */ "alter_db_options",
+ /* 411 */ "speed_opt",
+ /* 412 */ "start_opt",
+ /* 413 */ "end_opt",
+ /* 414 */ "integer_list",
+ /* 415 */ "variable_list",
+ /* 416 */ "retention_list",
+ /* 417 */ "signed",
+ /* 418 */ "alter_db_option",
+ /* 419 */ "retention",
+ /* 420 */ "full_table_name",
+ /* 421 */ "column_def_list",
+ /* 422 */ "tags_def_opt",
+ /* 423 */ "table_options",
+ /* 424 */ "multi_create_clause",
+ /* 425 */ "tag_list_opt",
+ /* 426 */ "tags_def",
+ /* 427 */ "multi_drop_clause",
+ /* 428 */ "alter_table_clause",
+ /* 429 */ "alter_table_options",
+ /* 430 */ "column_name",
+ /* 431 */ "type_name",
+ /* 432 */ "column_options",
+ /* 433 */ "tags_literal",
+ /* 434 */ "create_subtable_clause",
+ /* 435 */ "specific_cols_opt",
+ /* 436 */ "tags_literal_list",
+ /* 437 */ "drop_table_clause",
+ /* 438 */ "col_name_list",
+ /* 439 */ "tag_def_list",
+ /* 440 */ "tag_def",
+ /* 441 */ "column_def",
+ /* 442 */ "type_name_default_len",
+ /* 443 */ "duration_list",
+ /* 444 */ "rollup_func_list",
+ /* 445 */ "alter_table_option",
+ /* 446 */ "duration_literal",
+ /* 447 */ "rollup_func_name",
+ /* 448 */ "function_name",
+ /* 449 */ "col_name",
+ /* 450 */ "db_kind_opt",
+ /* 451 */ "table_kind_db_name_cond_opt",
+ /* 452 */ "like_pattern_opt",
+ /* 453 */ "db_name_cond_opt",
+ /* 454 */ "table_name_cond",
+ /* 455 */ "from_db_opt",
+ /* 456 */ "table_kind",
+ /* 457 */ "tag_item",
+ /* 458 */ "column_alias",
+ /* 459 */ "tsma_name",
+ /* 460 */ "tsma_func_list",
+ /* 461 */ "full_tsma_name",
+ /* 462 */ "func_list",
+ /* 463 */ "index_options",
+ /* 464 */ "full_index_name",
+ /* 465 */ "index_name",
+ /* 466 */ "sliding_opt",
+ /* 467 */ "sma_stream_opt",
+ /* 468 */ "func",
+ /* 469 */ "sma_func_name",
+ /* 470 */ "expression_list",
+ /* 471 */ "with_meta",
+ /* 472 */ "query_or_subquery",
+ /* 473 */ "where_clause_opt",
+ /* 474 */ "cgroup_name",
+ /* 475 */ "analyze_opt",
+ /* 476 */ "explain_options",
+ /* 477 */ "insert_query",
+ /* 478 */ "or_replace_opt",
+ /* 479 */ "agg_func_opt",
+ /* 480 */ "bufsize_opt",
+ /* 481 */ "language_opt",
+ /* 482 */ "full_view_name",
+ /* 483 */ "view_name",
+ /* 484 */ "stream_name",
+ /* 485 */ "stream_options",
+ /* 486 */ "col_list_opt",
+ /* 487 */ "tag_def_or_ref_opt",
+ /* 488 */ "subtable_opt",
+ /* 489 */ "ignore_opt",
+ /* 490 */ "column_stream_def_list",
+ /* 491 */ "column_stream_def",
+ /* 492 */ "stream_col_options",
+ /* 493 */ "expression",
+ /* 494 */ "on_vgroup_id",
+ /* 495 */ "dnode_list",
+ /* 496 */ "literal_func",
+ /* 497 */ "signed_literal",
+ /* 498 */ "literal_list",
+ /* 499 */ "table_alias",
+ /* 500 */ "expr_or_subquery",
+ /* 501 */ "pseudo_column",
+ /* 502 */ "column_reference",
+ /* 503 */ "function_expression",
+ /* 504 */ "case_when_expression",
+ /* 505 */ "star_func",
+ /* 506 */ "star_func_para_list",
+ /* 507 */ "trim_specification_type",
+ /* 508 */ "substr_func",
+ /* 509 */ "rand_func",
+ /* 510 */ "noarg_func",
+ /* 511 */ "other_para_list",
+ /* 512 */ "star_func_para",
+ /* 513 */ "when_then_list",
+ /* 514 */ "case_when_else_opt",
+ /* 515 */ "common_expression",
+ /* 516 */ "when_then_expr",
+ /* 517 */ "predicate",
+ /* 518 */ "compare_op",
+ /* 519 */ "in_op",
+ /* 520 */ "in_predicate_value",
+ /* 521 */ "boolean_value_expression",
+ /* 522 */ "boolean_primary",
+ /* 523 */ "from_clause_opt",
+ /* 524 */ "table_reference_list",
+ /* 525 */ "table_reference",
+ /* 526 */ "table_primary",
+ /* 527 */ "joined_table",
+ /* 528 */ "alias_opt",
+ /* 529 */ "subquery",
+ /* 530 */ "parenthesized_joined_table",
+ /* 531 */ "join_type",
+ /* 532 */ "join_subtype",
+ /* 533 */ "join_on_clause_opt",
+ /* 534 */ "window_offset_clause_opt",
+ /* 535 */ "jlimit_clause_opt",
+ /* 536 */ "window_offset_literal",
+ /* 537 */ "query_specification",
+ /* 538 */ "hint_list",
+ /* 539 */ "set_quantifier_opt",
+ /* 540 */ "tag_mode_opt",
+ /* 541 */ "select_list",
+ /* 542 */ "partition_by_clause_opt",
+ /* 543 */ "range_opt",
+ /* 544 */ "every_opt",
+ /* 545 */ "fill_opt",
+ /* 546 */ "twindow_clause_opt",
+ /* 547 */ "group_by_clause_opt",
+ /* 548 */ "having_clause_opt",
+ /* 549 */ "select_item",
+ /* 550 */ "partition_list",
+ /* 551 */ "partition_item",
+ /* 552 */ "interval_sliding_duration_literal",
+ /* 553 */ "fill_mode",
+ /* 554 */ "group_by_list",
+ /* 555 */ "query_expression",
+ /* 556 */ "query_simple",
+ /* 557 */ "order_by_clause_opt",
+ /* 558 */ "slimit_clause_opt",
+ /* 559 */ "limit_clause_opt",
+ /* 560 */ "union_query_expression",
+ /* 561 */ "query_simple_or_subquery",
+ /* 562 */ "sort_specification_list",
+ /* 563 */ "sort_specification",
+ /* 564 */ "ordering_specification_opt",
+ /* 565 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -3381,196 +3458,199 @@ static const char *const yyRuleName[] = {
/* 575 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP",
/* 576 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP",
/* 577 */ "function_expression ::= literal_func",
- /* 578 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 579 */ "literal_func ::= NOW",
- /* 580 */ "literal_func ::= TODAY",
- /* 581 */ "substr_func ::= SUBSTR",
- /* 582 */ "substr_func ::= SUBSTRING",
- /* 583 */ "trim_specification_type ::= BOTH",
- /* 584 */ "trim_specification_type ::= TRAILING",
- /* 585 */ "trim_specification_type ::= LEADING",
- /* 586 */ "noarg_func ::= NOW",
- /* 587 */ "noarg_func ::= TODAY",
- /* 588 */ "noarg_func ::= TIMEZONE",
- /* 589 */ "noarg_func ::= DATABASE",
- /* 590 */ "noarg_func ::= CLIENT_VERSION",
- /* 591 */ "noarg_func ::= SERVER_VERSION",
- /* 592 */ "noarg_func ::= SERVER_STATUS",
- /* 593 */ "noarg_func ::= CURRENT_USER",
- /* 594 */ "noarg_func ::= USER",
- /* 595 */ "noarg_func ::= PI",
- /* 596 */ "star_func ::= COUNT",
- /* 597 */ "star_func ::= FIRST",
- /* 598 */ "star_func ::= LAST",
- /* 599 */ "star_func ::= LAST_ROW",
- /* 600 */ "star_func_para_list ::= NK_STAR",
- /* 601 */ "star_func_para_list ::= other_para_list",
- /* 602 */ "other_para_list ::= star_func_para",
- /* 603 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 604 */ "star_func_para ::= expr_or_subquery",
- /* 605 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 606 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 607 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 608 */ "when_then_list ::= when_then_expr",
- /* 609 */ "when_then_list ::= when_then_list when_then_expr",
- /* 610 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 611 */ "case_when_else_opt ::=",
- /* 612 */ "case_when_else_opt ::= ELSE common_expression",
- /* 613 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 614 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 615 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 616 */ "predicate ::= expr_or_subquery IS NULL",
- /* 617 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 618 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 619 */ "compare_op ::= NK_LT",
- /* 620 */ "compare_op ::= NK_GT",
- /* 621 */ "compare_op ::= NK_LE",
- /* 622 */ "compare_op ::= NK_GE",
- /* 623 */ "compare_op ::= NK_NE",
- /* 624 */ "compare_op ::= NK_EQ",
- /* 625 */ "compare_op ::= LIKE",
- /* 626 */ "compare_op ::= NOT LIKE",
- /* 627 */ "compare_op ::= MATCH",
- /* 628 */ "compare_op ::= NMATCH",
- /* 629 */ "compare_op ::= CONTAINS",
- /* 630 */ "in_op ::= IN",
- /* 631 */ "in_op ::= NOT IN",
- /* 632 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 633 */ "boolean_value_expression ::= boolean_primary",
- /* 634 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 635 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 636 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 637 */ "boolean_primary ::= predicate",
- /* 638 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 639 */ "common_expression ::= expr_or_subquery",
- /* 640 */ "common_expression ::= boolean_value_expression",
- /* 641 */ "from_clause_opt ::=",
- /* 642 */ "from_clause_opt ::= FROM table_reference_list",
- /* 643 */ "table_reference_list ::= table_reference",
- /* 644 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 645 */ "table_reference ::= table_primary",
- /* 646 */ "table_reference ::= joined_table",
- /* 647 */ "table_primary ::= table_name alias_opt",
- /* 648 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 649 */ "table_primary ::= subquery alias_opt",
- /* 650 */ "table_primary ::= parenthesized_joined_table",
- /* 651 */ "alias_opt ::=",
- /* 652 */ "alias_opt ::= table_alias",
- /* 653 */ "alias_opt ::= AS table_alias",
- /* 654 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 655 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 656 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt",
- /* 657 */ "join_type ::=",
- /* 658 */ "join_type ::= INNER",
- /* 659 */ "join_type ::= LEFT",
- /* 660 */ "join_type ::= RIGHT",
- /* 661 */ "join_type ::= FULL",
- /* 662 */ "join_subtype ::=",
- /* 663 */ "join_subtype ::= OUTER",
- /* 664 */ "join_subtype ::= SEMI",
- /* 665 */ "join_subtype ::= ANTI",
- /* 666 */ "join_subtype ::= ASOF",
- /* 667 */ "join_subtype ::= WINDOW",
- /* 668 */ "join_on_clause_opt ::=",
- /* 669 */ "join_on_clause_opt ::= ON search_condition",
- /* 670 */ "window_offset_clause_opt ::=",
- /* 671 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP",
- /* 672 */ "window_offset_literal ::= NK_VARIABLE",
- /* 673 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE",
- /* 674 */ "jlimit_clause_opt ::=",
- /* 675 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER",
- /* 676 */ "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",
- /* 677 */ "hint_list ::=",
- /* 678 */ "hint_list ::= NK_HINT",
- /* 679 */ "tag_mode_opt ::=",
- /* 680 */ "tag_mode_opt ::= TAGS",
- /* 681 */ "set_quantifier_opt ::=",
- /* 682 */ "set_quantifier_opt ::= DISTINCT",
- /* 683 */ "set_quantifier_opt ::= ALL",
- /* 684 */ "select_list ::= select_item",
- /* 685 */ "select_list ::= select_list NK_COMMA select_item",
- /* 686 */ "select_item ::= NK_STAR",
- /* 687 */ "select_item ::= common_expression",
- /* 688 */ "select_item ::= common_expression column_alias",
- /* 689 */ "select_item ::= common_expression AS column_alias",
- /* 690 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 691 */ "where_clause_opt ::=",
- /* 692 */ "where_clause_opt ::= WHERE search_condition",
- /* 693 */ "partition_by_clause_opt ::=",
- /* 694 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 695 */ "partition_list ::= partition_item",
- /* 696 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 697 */ "partition_item ::= expr_or_subquery",
- /* 698 */ "partition_item ::= expr_or_subquery column_alias",
- /* 699 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 700 */ "twindow_clause_opt ::=",
- /* 701 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
- /* 702 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 703 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 704 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 705 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
- /* 706 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP",
- /* 707 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 708 */ "sliding_opt ::=",
- /* 709 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
- /* 710 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
- /* 711 */ "interval_sliding_duration_literal ::= NK_STRING",
- /* 712 */ "interval_sliding_duration_literal ::= NK_INTEGER",
- /* 713 */ "fill_opt ::=",
- /* 714 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 715 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
- /* 716 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
- /* 717 */ "fill_mode ::= NONE",
- /* 718 */ "fill_mode ::= PREV",
- /* 719 */ "fill_mode ::= NULL",
- /* 720 */ "fill_mode ::= NULL_F",
- /* 721 */ "fill_mode ::= LINEAR",
- /* 722 */ "fill_mode ::= NEXT",
- /* 723 */ "group_by_clause_opt ::=",
- /* 724 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 725 */ "group_by_list ::= expr_or_subquery",
- /* 726 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 727 */ "having_clause_opt ::=",
- /* 728 */ "having_clause_opt ::= HAVING search_condition",
- /* 729 */ "range_opt ::=",
- /* 730 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 731 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
- /* 732 */ "every_opt ::=",
- /* 733 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 734 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 735 */ "query_simple ::= query_specification",
- /* 736 */ "query_simple ::= union_query_expression",
- /* 737 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 738 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 739 */ "query_simple_or_subquery ::= query_simple",
- /* 740 */ "query_simple_or_subquery ::= subquery",
- /* 741 */ "query_or_subquery ::= query_expression",
- /* 742 */ "query_or_subquery ::= subquery",
- /* 743 */ "order_by_clause_opt ::=",
- /* 744 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 745 */ "slimit_clause_opt ::=",
- /* 746 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 747 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 748 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 749 */ "limit_clause_opt ::=",
- /* 750 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 751 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 752 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 753 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 754 */ "subquery ::= NK_LP subquery NK_RP",
- /* 755 */ "search_condition ::= common_expression",
- /* 756 */ "sort_specification_list ::= sort_specification",
- /* 757 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 758 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 759 */ "ordering_specification_opt ::=",
- /* 760 */ "ordering_specification_opt ::= ASC",
- /* 761 */ "ordering_specification_opt ::= DESC",
- /* 762 */ "null_ordering_opt ::=",
- /* 763 */ "null_ordering_opt ::= NULLS FIRST",
- /* 764 */ "null_ordering_opt ::= NULLS LAST",
- /* 765 */ "column_options ::=",
- /* 766 */ "column_options ::= column_options PRIMARY KEY",
- /* 767 */ "column_options ::= column_options NK_ID NK_STRING",
+ /* 578 */ "function_expression ::= rand_func",
+ /* 579 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 580 */ "literal_func ::= NOW",
+ /* 581 */ "literal_func ::= TODAY",
+ /* 582 */ "rand_func ::= RAND NK_LP NK_RP",
+ /* 583 */ "rand_func ::= RAND NK_LP expression_list NK_RP",
+ /* 584 */ "substr_func ::= SUBSTR",
+ /* 585 */ "substr_func ::= SUBSTRING",
+ /* 586 */ "trim_specification_type ::= BOTH",
+ /* 587 */ "trim_specification_type ::= TRAILING",
+ /* 588 */ "trim_specification_type ::= LEADING",
+ /* 589 */ "noarg_func ::= NOW",
+ /* 590 */ "noarg_func ::= TODAY",
+ /* 591 */ "noarg_func ::= TIMEZONE",
+ /* 592 */ "noarg_func ::= DATABASE",
+ /* 593 */ "noarg_func ::= CLIENT_VERSION",
+ /* 594 */ "noarg_func ::= SERVER_VERSION",
+ /* 595 */ "noarg_func ::= SERVER_STATUS",
+ /* 596 */ "noarg_func ::= CURRENT_USER",
+ /* 597 */ "noarg_func ::= USER",
+ /* 598 */ "noarg_func ::= PI",
+ /* 599 */ "star_func ::= COUNT",
+ /* 600 */ "star_func ::= FIRST",
+ /* 601 */ "star_func ::= LAST",
+ /* 602 */ "star_func ::= LAST_ROW",
+ /* 603 */ "star_func_para_list ::= NK_STAR",
+ /* 604 */ "star_func_para_list ::= other_para_list",
+ /* 605 */ "other_para_list ::= star_func_para",
+ /* 606 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 607 */ "star_func_para ::= expr_or_subquery",
+ /* 608 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 609 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 610 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 611 */ "when_then_list ::= when_then_expr",
+ /* 612 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 613 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 614 */ "case_when_else_opt ::=",
+ /* 615 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 616 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 617 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 618 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 619 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 620 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 621 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 622 */ "compare_op ::= NK_LT",
+ /* 623 */ "compare_op ::= NK_GT",
+ /* 624 */ "compare_op ::= NK_LE",
+ /* 625 */ "compare_op ::= NK_GE",
+ /* 626 */ "compare_op ::= NK_NE",
+ /* 627 */ "compare_op ::= NK_EQ",
+ /* 628 */ "compare_op ::= LIKE",
+ /* 629 */ "compare_op ::= NOT LIKE",
+ /* 630 */ "compare_op ::= MATCH",
+ /* 631 */ "compare_op ::= NMATCH",
+ /* 632 */ "compare_op ::= CONTAINS",
+ /* 633 */ "in_op ::= IN",
+ /* 634 */ "in_op ::= NOT IN",
+ /* 635 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 636 */ "boolean_value_expression ::= boolean_primary",
+ /* 637 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 638 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 639 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 640 */ "boolean_primary ::= predicate",
+ /* 641 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 642 */ "common_expression ::= expr_or_subquery",
+ /* 643 */ "common_expression ::= boolean_value_expression",
+ /* 644 */ "from_clause_opt ::=",
+ /* 645 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 646 */ "table_reference_list ::= table_reference",
+ /* 647 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 648 */ "table_reference ::= table_primary",
+ /* 649 */ "table_reference ::= joined_table",
+ /* 650 */ "table_primary ::= table_name alias_opt",
+ /* 651 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 652 */ "table_primary ::= subquery alias_opt",
+ /* 653 */ "table_primary ::= parenthesized_joined_table",
+ /* 654 */ "alias_opt ::=",
+ /* 655 */ "alias_opt ::= table_alias",
+ /* 656 */ "alias_opt ::= AS table_alias",
+ /* 657 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 658 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 659 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt",
+ /* 660 */ "join_type ::=",
+ /* 661 */ "join_type ::= INNER",
+ /* 662 */ "join_type ::= LEFT",
+ /* 663 */ "join_type ::= RIGHT",
+ /* 664 */ "join_type ::= FULL",
+ /* 665 */ "join_subtype ::=",
+ /* 666 */ "join_subtype ::= OUTER",
+ /* 667 */ "join_subtype ::= SEMI",
+ /* 668 */ "join_subtype ::= ANTI",
+ /* 669 */ "join_subtype ::= ASOF",
+ /* 670 */ "join_subtype ::= WINDOW",
+ /* 671 */ "join_on_clause_opt ::=",
+ /* 672 */ "join_on_clause_opt ::= ON search_condition",
+ /* 673 */ "window_offset_clause_opt ::=",
+ /* 674 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP",
+ /* 675 */ "window_offset_literal ::= NK_VARIABLE",
+ /* 676 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE",
+ /* 677 */ "jlimit_clause_opt ::=",
+ /* 678 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER",
+ /* 679 */ "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",
+ /* 680 */ "hint_list ::=",
+ /* 681 */ "hint_list ::= NK_HINT",
+ /* 682 */ "tag_mode_opt ::=",
+ /* 683 */ "tag_mode_opt ::= TAGS",
+ /* 684 */ "set_quantifier_opt ::=",
+ /* 685 */ "set_quantifier_opt ::= DISTINCT",
+ /* 686 */ "set_quantifier_opt ::= ALL",
+ /* 687 */ "select_list ::= select_item",
+ /* 688 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 689 */ "select_item ::= NK_STAR",
+ /* 690 */ "select_item ::= common_expression",
+ /* 691 */ "select_item ::= common_expression column_alias",
+ /* 692 */ "select_item ::= common_expression AS column_alias",
+ /* 693 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 694 */ "where_clause_opt ::=",
+ /* 695 */ "where_clause_opt ::= WHERE search_condition",
+ /* 696 */ "partition_by_clause_opt ::=",
+ /* 697 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 698 */ "partition_list ::= partition_item",
+ /* 699 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 700 */ "partition_item ::= expr_or_subquery",
+ /* 701 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 702 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 703 */ "twindow_clause_opt ::=",
+ /* 704 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
+ /* 705 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 706 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 707 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 708 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
+ /* 709 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP",
+ /* 710 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 711 */ "sliding_opt ::=",
+ /* 712 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
+ /* 713 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
+ /* 714 */ "interval_sliding_duration_literal ::= NK_STRING",
+ /* 715 */ "interval_sliding_duration_literal ::= NK_INTEGER",
+ /* 716 */ "fill_opt ::=",
+ /* 717 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 718 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
+ /* 719 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
+ /* 720 */ "fill_mode ::= NONE",
+ /* 721 */ "fill_mode ::= PREV",
+ /* 722 */ "fill_mode ::= NULL",
+ /* 723 */ "fill_mode ::= NULL_F",
+ /* 724 */ "fill_mode ::= LINEAR",
+ /* 725 */ "fill_mode ::= NEXT",
+ /* 726 */ "group_by_clause_opt ::=",
+ /* 727 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 728 */ "group_by_list ::= expr_or_subquery",
+ /* 729 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 730 */ "having_clause_opt ::=",
+ /* 731 */ "having_clause_opt ::= HAVING search_condition",
+ /* 732 */ "range_opt ::=",
+ /* 733 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 734 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
+ /* 735 */ "every_opt ::=",
+ /* 736 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 737 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 738 */ "query_simple ::= query_specification",
+ /* 739 */ "query_simple ::= union_query_expression",
+ /* 740 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 741 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 742 */ "query_simple_or_subquery ::= query_simple",
+ /* 743 */ "query_simple_or_subquery ::= subquery",
+ /* 744 */ "query_or_subquery ::= query_expression",
+ /* 745 */ "query_or_subquery ::= subquery",
+ /* 746 */ "order_by_clause_opt ::=",
+ /* 747 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 748 */ "slimit_clause_opt ::=",
+ /* 749 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 750 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 751 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 752 */ "limit_clause_opt ::=",
+ /* 753 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 754 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 755 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 756 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 757 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 758 */ "search_condition ::= common_expression",
+ /* 759 */ "sort_specification_list ::= sort_specification",
+ /* 760 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 761 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 762 */ "ordering_specification_opt ::=",
+ /* 763 */ "ordering_specification_opt ::= ASC",
+ /* 764 */ "ordering_specification_opt ::= DESC",
+ /* 765 */ "null_ordering_opt ::=",
+ /* 766 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 767 */ "null_ordering_opt ::= NULLS LAST",
+ /* 768 */ "column_options ::=",
+ /* 769 */ "column_options ::= column_options PRIMARY KEY",
+ /* 770 */ "column_options ::= column_options NK_ID NK_STRING",
};
#endif /* NDEBUG */
@@ -3695,264 +3775,265 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 382: /* cmd */
- case 385: /* literal */
- case 396: /* with_opt */
- case 402: /* search_condition */
- case 407: /* db_options */
- case 409: /* alter_db_options */
- case 411: /* start_opt */
- case 412: /* end_opt */
- case 416: /* signed */
- case 418: /* retention */
- case 419: /* full_table_name */
- case 422: /* table_options */
- case 427: /* alter_table_clause */
- case 428: /* alter_table_options */
- case 431: /* column_options */
- case 432: /* tags_literal */
- case 433: /* create_subtable_clause */
- case 436: /* drop_table_clause */
- case 439: /* tag_def */
- case 440: /* column_def */
- case 445: /* duration_literal */
- case 446: /* rollup_func_name */
- case 448: /* col_name */
- case 451: /* like_pattern_opt */
- case 452: /* db_name_cond_opt */
- case 453: /* table_name_cond */
- case 454: /* from_db_opt */
- case 456: /* tag_item */
- case 460: /* full_tsma_name */
- case 462: /* index_options */
- case 463: /* full_index_name */
- case 465: /* sliding_opt */
- case 466: /* sma_stream_opt */
- case 467: /* func */
- case 471: /* query_or_subquery */
- case 472: /* where_clause_opt */
- case 475: /* explain_options */
- case 476: /* insert_query */
- case 481: /* full_view_name */
- case 484: /* stream_options */
- case 487: /* subtable_opt */
- case 490: /* column_stream_def */
- case 491: /* stream_col_options */
- case 492: /* expression */
- case 495: /* literal_func */
- case 496: /* signed_literal */
- case 499: /* expr_or_subquery */
- case 500: /* pseudo_column */
- case 501: /* column_reference */
- case 502: /* function_expression */
- case 503: /* case_when_expression */
- case 510: /* star_func_para */
- case 512: /* case_when_else_opt */
- case 513: /* common_expression */
- case 514: /* when_then_expr */
- case 515: /* predicate */
- case 518: /* in_predicate_value */
- case 519: /* boolean_value_expression */
- case 520: /* boolean_primary */
- case 521: /* from_clause_opt */
- case 522: /* table_reference_list */
- case 523: /* table_reference */
- case 524: /* table_primary */
- case 525: /* joined_table */
- case 527: /* subquery */
- case 528: /* parenthesized_joined_table */
- case 531: /* join_on_clause_opt */
- case 532: /* window_offset_clause_opt */
- case 533: /* jlimit_clause_opt */
- case 534: /* window_offset_literal */
- case 535: /* query_specification */
- case 541: /* range_opt */
- case 542: /* every_opt */
- case 543: /* fill_opt */
- case 544: /* twindow_clause_opt */
- case 546: /* having_clause_opt */
- case 547: /* select_item */
- case 549: /* partition_item */
- case 550: /* interval_sliding_duration_literal */
- case 553: /* query_expression */
- case 554: /* query_simple */
- case 556: /* slimit_clause_opt */
- case 557: /* limit_clause_opt */
- case 558: /* union_query_expression */
- case 559: /* query_simple_or_subquery */
- case 561: /* sort_specification */
+ case 383: /* cmd */
+ case 386: /* literal */
+ case 397: /* with_opt */
+ case 403: /* search_condition */
+ case 408: /* db_options */
+ case 410: /* alter_db_options */
+ case 412: /* start_opt */
+ case 413: /* end_opt */
+ case 417: /* signed */
+ case 419: /* retention */
+ case 420: /* full_table_name */
+ case 423: /* table_options */
+ case 428: /* alter_table_clause */
+ case 429: /* alter_table_options */
+ case 432: /* column_options */
+ case 433: /* tags_literal */
+ case 434: /* create_subtable_clause */
+ case 437: /* drop_table_clause */
+ case 440: /* tag_def */
+ case 441: /* column_def */
+ case 446: /* duration_literal */
+ case 447: /* rollup_func_name */
+ case 449: /* col_name */
+ case 452: /* like_pattern_opt */
+ case 453: /* db_name_cond_opt */
+ case 454: /* table_name_cond */
+ case 455: /* from_db_opt */
+ case 457: /* tag_item */
+ case 461: /* full_tsma_name */
+ case 463: /* index_options */
+ case 464: /* full_index_name */
+ case 466: /* sliding_opt */
+ case 467: /* sma_stream_opt */
+ case 468: /* func */
+ case 472: /* query_or_subquery */
+ case 473: /* where_clause_opt */
+ case 476: /* explain_options */
+ case 477: /* insert_query */
+ case 482: /* full_view_name */
+ case 485: /* stream_options */
+ case 488: /* subtable_opt */
+ case 491: /* column_stream_def */
+ case 492: /* stream_col_options */
+ case 493: /* expression */
+ case 496: /* literal_func */
+ case 497: /* signed_literal */
+ case 500: /* expr_or_subquery */
+ case 501: /* pseudo_column */
+ case 502: /* column_reference */
+ case 503: /* function_expression */
+ case 504: /* case_when_expression */
+ case 509: /* rand_func */
+ case 512: /* star_func_para */
+ case 514: /* case_when_else_opt */
+ case 515: /* common_expression */
+ case 516: /* when_then_expr */
+ case 517: /* predicate */
+ case 520: /* in_predicate_value */
+ case 521: /* boolean_value_expression */
+ case 522: /* boolean_primary */
+ case 523: /* from_clause_opt */
+ case 524: /* table_reference_list */
+ case 525: /* table_reference */
+ case 526: /* table_primary */
+ case 527: /* joined_table */
+ case 529: /* subquery */
+ case 530: /* parenthesized_joined_table */
+ case 533: /* join_on_clause_opt */
+ case 534: /* window_offset_clause_opt */
+ case 535: /* jlimit_clause_opt */
+ case 536: /* window_offset_literal */
+ case 537: /* query_specification */
+ case 543: /* range_opt */
+ case 544: /* every_opt */
+ case 545: /* fill_opt */
+ case 546: /* twindow_clause_opt */
+ case 548: /* having_clause_opt */
+ case 549: /* select_item */
+ case 551: /* partition_item */
+ case 552: /* interval_sliding_duration_literal */
+ case 555: /* query_expression */
+ case 556: /* query_simple */
+ case 558: /* slimit_clause_opt */
+ case 559: /* limit_clause_opt */
+ case 560: /* union_query_expression */
+ case 561: /* query_simple_or_subquery */
+ case 563: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy248));
+ nodesDestroyNode((yypminor->yy724));
}
break;
- case 383: /* account_options */
- case 384: /* alter_account_options */
- case 386: /* alter_account_option */
- case 410: /* speed_opt */
- case 470: /* with_meta */
- case 479: /* bufsize_opt */
+ case 384: /* account_options */
+ case 385: /* alter_account_options */
+ case 387: /* alter_account_option */
+ case 411: /* speed_opt */
+ case 471: /* with_meta */
+ case 480: /* bufsize_opt */
{
}
break;
- case 387: /* ip_range_list */
- case 388: /* white_list */
- case 389: /* white_list_opt */
- case 413: /* integer_list */
- case 414: /* variable_list */
- case 415: /* retention_list */
- case 420: /* column_def_list */
- case 421: /* tags_def_opt */
- case 423: /* multi_create_clause */
- case 424: /* tag_list_opt */
- case 425: /* tags_def */
- case 426: /* multi_drop_clause */
- case 434: /* specific_cols_opt */
- case 435: /* tags_literal_list */
- case 437: /* col_name_list */
- case 438: /* tag_def_list */
- case 442: /* duration_list */
- case 443: /* rollup_func_list */
- case 461: /* func_list */
- case 469: /* expression_list */
- case 485: /* col_list_opt */
- case 486: /* tag_def_or_ref_opt */
- case 489: /* column_stream_def_list */
- case 494: /* dnode_list */
- case 497: /* literal_list */
- case 505: /* star_func_para_list */
- case 509: /* other_para_list */
- case 511: /* when_then_list */
- case 536: /* hint_list */
- case 539: /* select_list */
- case 540: /* partition_by_clause_opt */
- case 545: /* group_by_clause_opt */
- case 548: /* partition_list */
- case 552: /* group_by_list */
- case 555: /* order_by_clause_opt */
- case 560: /* sort_specification_list */
+ case 388: /* ip_range_list */
+ case 389: /* white_list */
+ case 390: /* white_list_opt */
+ case 414: /* integer_list */
+ case 415: /* variable_list */
+ case 416: /* retention_list */
+ case 421: /* column_def_list */
+ case 422: /* tags_def_opt */
+ case 424: /* multi_create_clause */
+ case 425: /* tag_list_opt */
+ case 426: /* tags_def */
+ case 427: /* multi_drop_clause */
+ case 435: /* specific_cols_opt */
+ case 436: /* tags_literal_list */
+ case 438: /* col_name_list */
+ case 439: /* tag_def_list */
+ case 443: /* duration_list */
+ case 444: /* rollup_func_list */
+ case 462: /* func_list */
+ case 470: /* expression_list */
+ case 486: /* col_list_opt */
+ case 487: /* tag_def_or_ref_opt */
+ case 490: /* column_stream_def_list */
+ case 495: /* dnode_list */
+ case 498: /* literal_list */
+ case 506: /* star_func_para_list */
+ case 511: /* other_para_list */
+ case 513: /* when_then_list */
+ case 538: /* hint_list */
+ case 541: /* select_list */
+ case 542: /* partition_by_clause_opt */
+ case 547: /* group_by_clause_opt */
+ case 550: /* partition_list */
+ case 554: /* group_by_list */
+ case 557: /* order_by_clause_opt */
+ case 562: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy928));
+ nodesDestroyList((yypminor->yy712));
}
break;
- case 390: /* is_import_opt */
- case 391: /* is_createdb_opt */
- case 393: /* sysinfo_opt */
+ case 391: /* is_import_opt */
+ case 392: /* is_createdb_opt */
+ case 394: /* sysinfo_opt */
{
}
break;
- case 392: /* user_name */
- case 399: /* db_name */
- case 400: /* table_name */
- case 401: /* topic_name */
- case 403: /* dnode_endpoint */
- case 429: /* column_name */
- case 447: /* function_name */
- case 457: /* column_alias */
- case 458: /* tsma_name */
- case 464: /* index_name */
- case 468: /* sma_func_name */
- case 473: /* cgroup_name */
- case 480: /* language_opt */
- case 482: /* view_name */
- case 483: /* stream_name */
- case 493: /* on_vgroup_id */
- case 498: /* table_alias */
- case 504: /* star_func */
- case 507: /* substr_func */
- case 508: /* noarg_func */
- case 526: /* alias_opt */
+ case 393: /* user_name */
+ case 400: /* db_name */
+ case 401: /* table_name */
+ case 402: /* topic_name */
+ case 404: /* dnode_endpoint */
+ case 430: /* column_name */
+ case 448: /* function_name */
+ case 458: /* column_alias */
+ case 459: /* tsma_name */
+ case 465: /* index_name */
+ case 469: /* sma_func_name */
+ case 474: /* cgroup_name */
+ case 481: /* language_opt */
+ case 483: /* view_name */
+ case 484: /* stream_name */
+ case 494: /* on_vgroup_id */
+ case 499: /* table_alias */
+ case 505: /* star_func */
+ case 508: /* substr_func */
+ case 510: /* noarg_func */
+ case 528: /* alias_opt */
{
}
break;
- case 394: /* privileges */
- case 397: /* priv_type_list */
- case 398: /* priv_type */
+ case 395: /* privileges */
+ case 398: /* priv_type_list */
+ case 399: /* priv_type */
{
}
break;
- case 395: /* priv_level */
+ case 396: /* priv_level */
{
}
break;
- case 404: /* force_opt */
- case 405: /* unsafe_opt */
- case 406: /* not_exists_opt */
- case 408: /* exists_opt */
- case 474: /* analyze_opt */
- case 477: /* or_replace_opt */
- case 478: /* agg_func_opt */
- case 488: /* ignore_opt */
- case 537: /* set_quantifier_opt */
- case 538: /* tag_mode_opt */
+ case 405: /* force_opt */
+ case 406: /* unsafe_opt */
+ case 407: /* not_exists_opt */
+ case 409: /* exists_opt */
+ case 475: /* analyze_opt */
+ case 478: /* or_replace_opt */
+ case 479: /* agg_func_opt */
+ case 489: /* ignore_opt */
+ case 539: /* set_quantifier_opt */
+ case 540: /* tag_mode_opt */
{
}
break;
- case 417: /* alter_db_option */
- case 444: /* alter_table_option */
+ case 418: /* alter_db_option */
+ case 445: /* alter_table_option */
{
}
break;
- case 430: /* type_name */
- case 441: /* type_name_default_len */
+ case 431: /* type_name */
+ case 442: /* type_name_default_len */
{
}
break;
- case 449: /* db_kind_opt */
- case 455: /* table_kind */
+ case 450: /* db_kind_opt */
+ case 456: /* table_kind */
{
}
break;
- case 450: /* table_kind_db_name_cond_opt */
+ case 451: /* table_kind_db_name_cond_opt */
{
}
break;
- case 459: /* tsma_func_list */
+ case 460: /* tsma_func_list */
{
- nodesDestroyNode((yypminor->yy248));
+ nodesDestroyNode((yypminor->yy724));
}
break;
- case 506: /* trim_specification_type */
+ case 507: /* trim_specification_type */
{
}
break;
- case 516: /* compare_op */
- case 517: /* in_op */
+ case 518: /* compare_op */
+ case 519: /* in_op */
{
}
break;
- case 529: /* join_type */
+ case 531: /* join_type */
{
}
break;
- case 530: /* join_subtype */
+ case 532: /* join_subtype */
{
}
break;
- case 551: /* fill_mode */
+ case 553: /* fill_mode */
{
}
break;
- case 562: /* ordering_specification_opt */
+ case 564: /* ordering_specification_opt */
{
}
break;
- case 563: /* null_ordering_opt */
+ case 565: /* null_ordering_opt */
{
}
@@ -4254,774 +4335,777 @@ static void yy_shift(
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
** of that rule */
static const YYCODETYPE yyRuleInfoLhs[] = {
- 382, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- 382, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- 383, /* (2) account_options ::= */
- 383, /* (3) account_options ::= account_options PPS literal */
- 383, /* (4) account_options ::= account_options TSERIES literal */
- 383, /* (5) account_options ::= account_options STORAGE literal */
- 383, /* (6) account_options ::= account_options STREAMS literal */
- 383, /* (7) account_options ::= account_options QTIME literal */
- 383, /* (8) account_options ::= account_options DBS literal */
- 383, /* (9) account_options ::= account_options USERS literal */
- 383, /* (10) account_options ::= account_options CONNS literal */
- 383, /* (11) account_options ::= account_options STATE literal */
- 384, /* (12) alter_account_options ::= alter_account_option */
- 384, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- 386, /* (14) alter_account_option ::= PASS literal */
- 386, /* (15) alter_account_option ::= PPS literal */
- 386, /* (16) alter_account_option ::= TSERIES literal */
- 386, /* (17) alter_account_option ::= STORAGE literal */
- 386, /* (18) alter_account_option ::= STREAMS literal */
- 386, /* (19) alter_account_option ::= QTIME literal */
- 386, /* (20) alter_account_option ::= DBS literal */
- 386, /* (21) alter_account_option ::= USERS literal */
- 386, /* (22) alter_account_option ::= CONNS literal */
- 386, /* (23) alter_account_option ::= STATE literal */
- 387, /* (24) ip_range_list ::= NK_STRING */
- 387, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
- 388, /* (26) white_list ::= HOST ip_range_list */
- 389, /* (27) white_list_opt ::= */
- 389, /* (28) white_list_opt ::= white_list */
- 390, /* (29) is_import_opt ::= */
- 390, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */
- 391, /* (31) is_createdb_opt ::= */
- 391, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */
- 382, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */
- 382, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */
- 382, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- 382, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- 382, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */
- 382, /* (38) cmd ::= ALTER USER user_name ADD white_list */
- 382, /* (39) cmd ::= ALTER USER user_name DROP white_list */
- 382, /* (40) cmd ::= DROP USER user_name */
- 393, /* (41) sysinfo_opt ::= */
- 393, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */
- 382, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
- 382, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
- 394, /* (45) privileges ::= ALL */
- 394, /* (46) privileges ::= priv_type_list */
- 394, /* (47) privileges ::= SUBSCRIBE */
- 397, /* (48) priv_type_list ::= priv_type */
- 397, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- 398, /* (50) priv_type ::= READ */
- 398, /* (51) priv_type ::= WRITE */
- 398, /* (52) priv_type ::= ALTER */
- 395, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */
- 395, /* (54) priv_level ::= db_name NK_DOT NK_STAR */
- 395, /* (55) priv_level ::= db_name NK_DOT table_name */
- 395, /* (56) priv_level ::= topic_name */
- 396, /* (57) with_opt ::= */
- 396, /* (58) with_opt ::= WITH search_condition */
- 382, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */
- 382, /* (60) cmd ::= CREATE DNODE dnode_endpoint */
- 382, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- 382, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */
- 382, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */
- 382, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
- 382, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
- 382, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- 382, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- 382, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */
- 382, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- 382, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */
- 403, /* (71) dnode_endpoint ::= NK_STRING */
- 403, /* (72) dnode_endpoint ::= NK_ID */
- 403, /* (73) dnode_endpoint ::= NK_IPTOKEN */
- 404, /* (74) force_opt ::= */
- 404, /* (75) force_opt ::= FORCE */
- 405, /* (76) unsafe_opt ::= UNSAFE */
- 382, /* (77) cmd ::= ALTER CLUSTER NK_STRING */
- 382, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
- 382, /* (79) cmd ::= ALTER LOCAL NK_STRING */
- 382, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- 382, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- 382, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- 382, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
- 382, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- 382, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- 382, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- 382, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- 382, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- 382, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- 382, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
- 382, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
- 382, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- 382, /* (93) cmd ::= DROP DATABASE exists_opt db_name */
- 382, /* (94) cmd ::= USE db_name */
- 382, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */
- 382, /* (96) cmd ::= FLUSH DATABASE db_name */
- 382, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */
- 382, /* (98) cmd ::= S3MIGRATE DATABASE db_name */
- 382, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
- 406, /* (100) not_exists_opt ::= IF NOT EXISTS */
- 406, /* (101) not_exists_opt ::= */
- 408, /* (102) exists_opt ::= IF EXISTS */
- 408, /* (103) exists_opt ::= */
- 407, /* (104) db_options ::= */
- 407, /* (105) db_options ::= db_options BUFFER NK_INTEGER */
- 407, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */
- 407, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */
- 407, /* (108) db_options ::= db_options COMP NK_INTEGER */
- 407, /* (109) db_options ::= db_options DURATION NK_INTEGER */
- 407, /* (110) db_options ::= db_options DURATION NK_VARIABLE */
- 407, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */
- 407, /* (112) db_options ::= db_options MINROWS NK_INTEGER */
- 407, /* (113) db_options ::= db_options KEEP integer_list */
- 407, /* (114) db_options ::= db_options KEEP variable_list */
- 407, /* (115) db_options ::= db_options PAGES NK_INTEGER */
- 407, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */
- 407, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- 407, /* (118) db_options ::= db_options PRECISION NK_STRING */
- 407, /* (119) db_options ::= db_options REPLICA NK_INTEGER */
- 407, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */
- 407, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- 407, /* (122) db_options ::= db_options RETENTIONS retention_list */
- 407, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */
- 407, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- 407, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- 407, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- 407, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- 407, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- 407, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- 407, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- 407, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- 407, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- 407, /* (133) db_options ::= db_options TABLE_PREFIX signed */
- 407, /* (134) db_options ::= db_options TABLE_SUFFIX signed */
- 407, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
- 407, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
- 407, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */
- 407, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */
- 407, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
- 407, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
- 409, /* (141) alter_db_options ::= alter_db_option */
- 409, /* (142) alter_db_options ::= alter_db_options alter_db_option */
- 417, /* (143) alter_db_option ::= BUFFER NK_INTEGER */
- 417, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */
- 417, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */
- 417, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- 417, /* (147) alter_db_option ::= KEEP integer_list */
- 417, /* (148) alter_db_option ::= KEEP variable_list */
- 417, /* (149) alter_db_option ::= PAGES NK_INTEGER */
- 417, /* (150) alter_db_option ::= REPLICA NK_INTEGER */
- 417, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- 417, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- 417, /* (153) alter_db_option ::= MINROWS NK_INTEGER */
- 417, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
- 417, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- 417, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
- 417, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- 417, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
- 417, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */
- 417, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */
- 417, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
- 417, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
- 413, /* (163) integer_list ::= NK_INTEGER */
- 413, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- 414, /* (165) variable_list ::= NK_VARIABLE */
- 414, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- 415, /* (167) retention_list ::= retention */
- 415, /* (168) retention_list ::= retention_list NK_COMMA retention */
- 418, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- 418, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
- 410, /* (171) speed_opt ::= */
- 410, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */
- 411, /* (173) start_opt ::= */
- 411, /* (174) start_opt ::= START WITH NK_INTEGER */
- 411, /* (175) start_opt ::= START WITH NK_STRING */
- 411, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */
- 412, /* (177) end_opt ::= */
- 412, /* (178) end_opt ::= END WITH NK_INTEGER */
- 412, /* (179) end_opt ::= END WITH NK_STRING */
- 412, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */
- 382, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- 382, /* (182) cmd ::= CREATE TABLE multi_create_clause */
- 382, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
- 382, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- 382, /* (185) cmd ::= DROP TABLE multi_drop_clause */
- 382, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */
- 382, /* (187) cmd ::= ALTER TABLE alter_table_clause */
- 382, /* (188) cmd ::= ALTER STABLE alter_table_clause */
- 427, /* (189) alter_table_clause ::= full_table_name alter_table_options */
- 427, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
- 427, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- 427, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- 427, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
- 427, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- 427, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- 427, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */
- 427, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- 427, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- 427, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
- 423, /* (200) multi_create_clause ::= create_subtable_clause */
- 423, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */
- 433, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
- 426, /* (203) multi_drop_clause ::= drop_table_clause */
- 426, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
- 436, /* (205) drop_table_clause ::= exists_opt full_table_name */
- 434, /* (206) specific_cols_opt ::= */
- 434, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- 419, /* (208) full_table_name ::= table_name */
- 419, /* (209) full_table_name ::= db_name NK_DOT table_name */
- 438, /* (210) tag_def_list ::= tag_def */
- 438, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */
- 439, /* (212) tag_def ::= column_name type_name */
- 420, /* (213) column_def_list ::= column_def */
- 420, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */
- 440, /* (215) column_def ::= column_name type_name column_options */
- 430, /* (216) type_name ::= BOOL */
- 430, /* (217) type_name ::= TINYINT */
- 430, /* (218) type_name ::= SMALLINT */
- 430, /* (219) type_name ::= INT */
- 430, /* (220) type_name ::= INTEGER */
- 430, /* (221) type_name ::= BIGINT */
- 430, /* (222) type_name ::= FLOAT */
- 430, /* (223) type_name ::= DOUBLE */
- 430, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- 430, /* (225) type_name ::= TIMESTAMP */
- 430, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- 430, /* (227) type_name ::= TINYINT UNSIGNED */
- 430, /* (228) type_name ::= SMALLINT UNSIGNED */
- 430, /* (229) type_name ::= INT UNSIGNED */
- 430, /* (230) type_name ::= BIGINT UNSIGNED */
- 430, /* (231) type_name ::= JSON */
- 430, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- 430, /* (233) type_name ::= MEDIUMBLOB */
- 430, /* (234) type_name ::= BLOB */
- 430, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- 430, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
- 430, /* (237) type_name ::= DECIMAL */
- 430, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- 430, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 441, /* (240) type_name_default_len ::= BINARY */
- 441, /* (241) type_name_default_len ::= NCHAR */
- 441, /* (242) type_name_default_len ::= VARCHAR */
- 441, /* (243) type_name_default_len ::= VARBINARY */
- 421, /* (244) tags_def_opt ::= */
- 421, /* (245) tags_def_opt ::= tags_def */
- 425, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
- 422, /* (247) table_options ::= */
- 422, /* (248) table_options ::= table_options COMMENT NK_STRING */
- 422, /* (249) table_options ::= table_options MAX_DELAY duration_list */
- 422, /* (250) table_options ::= table_options WATERMARK duration_list */
- 422, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- 422, /* (252) table_options ::= table_options TTL NK_INTEGER */
- 422, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- 422, /* (254) table_options ::= table_options DELETE_MARK duration_list */
- 428, /* (255) alter_table_options ::= alter_table_option */
- 428, /* (256) alter_table_options ::= alter_table_options alter_table_option */
- 444, /* (257) alter_table_option ::= COMMENT NK_STRING */
- 444, /* (258) alter_table_option ::= TTL NK_INTEGER */
- 442, /* (259) duration_list ::= duration_literal */
- 442, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */
- 443, /* (261) rollup_func_list ::= rollup_func_name */
- 443, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- 446, /* (263) rollup_func_name ::= function_name */
- 446, /* (264) rollup_func_name ::= FIRST */
- 446, /* (265) rollup_func_name ::= LAST */
- 437, /* (266) col_name_list ::= col_name */
- 437, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */
- 448, /* (268) col_name ::= column_name */
- 382, /* (269) cmd ::= SHOW DNODES */
- 382, /* (270) cmd ::= SHOW USERS */
- 382, /* (271) cmd ::= SHOW USERS FULL */
- 382, /* (272) cmd ::= SHOW USER PRIVILEGES */
- 382, /* (273) cmd ::= SHOW db_kind_opt DATABASES */
- 382, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
- 382, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- 382, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */
- 382, /* (277) cmd ::= SHOW MNODES */
- 382, /* (278) cmd ::= SHOW QNODES */
- 382, /* (279) cmd ::= SHOW ARBGROUPS */
- 382, /* (280) cmd ::= SHOW FUNCTIONS */
- 382, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- 382, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
- 382, /* (283) cmd ::= SHOW STREAMS */
- 382, /* (284) cmd ::= SHOW ACCOUNTS */
- 382, /* (285) cmd ::= SHOW APPS */
- 382, /* (286) cmd ::= SHOW CONNECTIONS */
- 382, /* (287) cmd ::= SHOW LICENCES */
- 382, /* (288) cmd ::= SHOW GRANTS */
- 382, /* (289) cmd ::= SHOW GRANTS FULL */
- 382, /* (290) cmd ::= SHOW GRANTS LOGS */
- 382, /* (291) cmd ::= SHOW CLUSTER MACHINES */
- 382, /* (292) cmd ::= SHOW CREATE DATABASE db_name */
- 382, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */
- 382, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */
- 382, /* (295) cmd ::= SHOW ENCRYPTIONS */
- 382, /* (296) cmd ::= SHOW QUERIES */
- 382, /* (297) cmd ::= SHOW SCORES */
- 382, /* (298) cmd ::= SHOW TOPICS */
- 382, /* (299) cmd ::= SHOW VARIABLES */
- 382, /* (300) cmd ::= SHOW CLUSTER VARIABLES */
- 382, /* (301) cmd ::= SHOW LOCAL VARIABLES */
- 382, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- 382, /* (303) cmd ::= SHOW BNODES */
- 382, /* (304) cmd ::= SHOW SNODES */
- 382, /* (305) cmd ::= SHOW CLUSTER */
- 382, /* (306) cmd ::= SHOW TRANSACTIONS */
- 382, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- 382, /* (308) cmd ::= SHOW CONSUMERS */
- 382, /* (309) cmd ::= SHOW SUBSCRIPTIONS */
- 382, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- 382, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
- 382, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- 382, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
- 382, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
- 382, /* (315) cmd ::= SHOW VNODES */
- 382, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */
- 382, /* (317) cmd ::= SHOW CLUSTER ALIVE */
- 382, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
- 382, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */
- 382, /* (320) cmd ::= SHOW COMPACTS */
- 382, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */
- 450, /* (322) table_kind_db_name_cond_opt ::= */
- 450, /* (323) table_kind_db_name_cond_opt ::= table_kind */
- 450, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */
- 450, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
- 455, /* (326) table_kind ::= NORMAL */
- 455, /* (327) table_kind ::= CHILD */
- 452, /* (328) db_name_cond_opt ::= */
- 452, /* (329) db_name_cond_opt ::= db_name NK_DOT */
- 451, /* (330) like_pattern_opt ::= */
- 451, /* (331) like_pattern_opt ::= LIKE NK_STRING */
- 453, /* (332) table_name_cond ::= table_name */
- 454, /* (333) from_db_opt ::= */
- 454, /* (334) from_db_opt ::= FROM db_name */
- 424, /* (335) tag_list_opt ::= */
- 424, /* (336) tag_list_opt ::= tag_item */
- 424, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
- 456, /* (338) tag_item ::= TBNAME */
- 456, /* (339) tag_item ::= QTAGS */
- 456, /* (340) tag_item ::= column_name */
- 456, /* (341) tag_item ::= column_name column_alias */
- 456, /* (342) tag_item ::= column_name AS column_alias */
- 449, /* (343) db_kind_opt ::= */
- 449, /* (344) db_kind_opt ::= USER */
- 449, /* (345) db_kind_opt ::= SYSTEM */
- 382, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
- 382, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
- 382, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */
- 382, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */
- 460, /* (350) full_tsma_name ::= tsma_name */
- 460, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */
- 459, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
- 382, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
- 382, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
- 382, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */
- 463, /* (356) full_index_name ::= index_name */
- 463, /* (357) full_index_name ::= db_name NK_DOT index_name */
- 462, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- 462, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
- 461, /* (360) func_list ::= func */
- 461, /* (361) func_list ::= func_list NK_COMMA func */
- 467, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */
- 468, /* (363) sma_func_name ::= function_name */
- 468, /* (364) sma_func_name ::= COUNT */
- 468, /* (365) sma_func_name ::= FIRST */
- 468, /* (366) sma_func_name ::= LAST */
- 468, /* (367) sma_func_name ::= LAST_ROW */
- 466, /* (368) sma_stream_opt ::= */
- 466, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- 466, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- 466, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- 470, /* (372) with_meta ::= AS */
- 470, /* (373) with_meta ::= WITH META AS */
- 470, /* (374) with_meta ::= ONLY META AS */
- 382, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- 382, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
- 382, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
- 382, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */
- 382, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- 382, /* (380) cmd ::= DESC full_table_name */
- 382, /* (381) cmd ::= DESCRIBE full_table_name */
- 382, /* (382) cmd ::= RESET QUERY CACHE */
- 382, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- 382, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
- 474, /* (385) analyze_opt ::= */
- 474, /* (386) analyze_opt ::= ANALYZE */
- 475, /* (387) explain_options ::= */
- 475, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */
- 475, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */
- 382, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
- 382, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */
- 478, /* (392) agg_func_opt ::= */
- 478, /* (393) agg_func_opt ::= AGGREGATE */
- 479, /* (394) bufsize_opt ::= */
- 479, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */
- 480, /* (396) language_opt ::= */
- 480, /* (397) language_opt ::= LANGUAGE NK_STRING */
- 477, /* (398) or_replace_opt ::= */
- 477, /* (399) or_replace_opt ::= OR REPLACE */
- 382, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
- 382, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */
- 481, /* (402) full_view_name ::= view_name */
- 481, /* (403) full_view_name ::= db_name NK_DOT view_name */
- 382, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
- 382, /* (405) cmd ::= DROP STREAM exists_opt stream_name */
- 382, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */
- 382, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
- 485, /* (408) col_list_opt ::= */
- 485, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */
- 489, /* (410) column_stream_def_list ::= column_stream_def */
- 489, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */
- 490, /* (412) column_stream_def ::= column_name stream_col_options */
- 491, /* (413) stream_col_options ::= */
- 491, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */
- 486, /* (415) tag_def_or_ref_opt ::= */
- 486, /* (416) tag_def_or_ref_opt ::= tags_def */
- 486, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */
- 484, /* (418) stream_options ::= */
- 484, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */
- 484, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- 484, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- 484, /* (422) stream_options ::= stream_options WATERMARK duration_literal */
- 484, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- 484, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- 484, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */
- 484, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
- 487, /* (427) subtable_opt ::= */
- 487, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- 488, /* (429) ignore_opt ::= */
- 488, /* (430) ignore_opt ::= IGNORE UNTREATED */
- 382, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */
- 382, /* (432) cmd ::= KILL QUERY NK_STRING */
- 382, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */
- 382, /* (434) cmd ::= KILL COMPACT NK_INTEGER */
- 382, /* (435) cmd ::= BALANCE VGROUP */
- 382, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
- 382, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
- 382, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- 382, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- 382, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */
- 493, /* (441) on_vgroup_id ::= */
- 493, /* (442) on_vgroup_id ::= ON NK_INTEGER */
- 494, /* (443) dnode_list ::= DNODE NK_INTEGER */
- 494, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */
- 382, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */
- 382, /* (446) cmd ::= query_or_subquery */
- 382, /* (447) cmd ::= insert_query */
- 476, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- 476, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */
- 432, /* (450) tags_literal ::= NK_INTEGER */
- 432, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
- 432, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */
- 432, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */
- 432, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
- 432, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */
- 432, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */
- 432, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */
- 432, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */
- 432, /* (459) tags_literal ::= NK_FLOAT */
- 432, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */
- 432, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */
- 432, /* (462) tags_literal ::= NK_BIN */
- 432, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */
- 432, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */
- 432, /* (465) tags_literal ::= NK_PLUS NK_BIN */
- 432, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */
- 432, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */
- 432, /* (468) tags_literal ::= NK_MINUS NK_BIN */
- 432, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */
- 432, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */
- 432, /* (471) tags_literal ::= NK_HEX */
- 432, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */
- 432, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */
- 432, /* (474) tags_literal ::= NK_PLUS NK_HEX */
- 432, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */
- 432, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */
- 432, /* (477) tags_literal ::= NK_MINUS NK_HEX */
- 432, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */
- 432, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */
- 432, /* (480) tags_literal ::= NK_STRING */
- 432, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */
- 432, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */
- 432, /* (483) tags_literal ::= NK_BOOL */
- 432, /* (484) tags_literal ::= NULL */
- 432, /* (485) tags_literal ::= literal_func */
- 432, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */
- 432, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */
- 435, /* (488) tags_literal_list ::= tags_literal */
- 435, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */
- 385, /* (490) literal ::= NK_INTEGER */
- 385, /* (491) literal ::= NK_FLOAT */
- 385, /* (492) literal ::= NK_STRING */
- 385, /* (493) literal ::= NK_BOOL */
- 385, /* (494) literal ::= TIMESTAMP NK_STRING */
- 385, /* (495) literal ::= duration_literal */
- 385, /* (496) literal ::= NULL */
- 385, /* (497) literal ::= NK_QUESTION */
- 445, /* (498) duration_literal ::= NK_VARIABLE */
- 416, /* (499) signed ::= NK_INTEGER */
- 416, /* (500) signed ::= NK_PLUS NK_INTEGER */
- 416, /* (501) signed ::= NK_MINUS NK_INTEGER */
- 416, /* (502) signed ::= NK_FLOAT */
- 416, /* (503) signed ::= NK_PLUS NK_FLOAT */
- 416, /* (504) signed ::= NK_MINUS NK_FLOAT */
- 496, /* (505) signed_literal ::= signed */
- 496, /* (506) signed_literal ::= NK_STRING */
- 496, /* (507) signed_literal ::= NK_BOOL */
- 496, /* (508) signed_literal ::= TIMESTAMP NK_STRING */
- 496, /* (509) signed_literal ::= duration_literal */
- 496, /* (510) signed_literal ::= NULL */
- 496, /* (511) signed_literal ::= literal_func */
- 496, /* (512) signed_literal ::= NK_QUESTION */
- 497, /* (513) literal_list ::= signed_literal */
- 497, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */
- 399, /* (515) db_name ::= NK_ID */
- 400, /* (516) table_name ::= NK_ID */
- 429, /* (517) column_name ::= NK_ID */
- 447, /* (518) function_name ::= NK_ID */
- 482, /* (519) view_name ::= NK_ID */
- 498, /* (520) table_alias ::= NK_ID */
- 457, /* (521) column_alias ::= NK_ID */
- 457, /* (522) column_alias ::= NK_ALIAS */
- 392, /* (523) user_name ::= NK_ID */
- 401, /* (524) topic_name ::= NK_ID */
- 483, /* (525) stream_name ::= NK_ID */
- 473, /* (526) cgroup_name ::= NK_ID */
- 464, /* (527) index_name ::= NK_ID */
- 458, /* (528) tsma_name ::= NK_ID */
- 499, /* (529) expr_or_subquery ::= expression */
- 492, /* (530) expression ::= literal */
- 492, /* (531) expression ::= pseudo_column */
- 492, /* (532) expression ::= column_reference */
- 492, /* (533) expression ::= function_expression */
- 492, /* (534) expression ::= case_when_expression */
- 492, /* (535) expression ::= NK_LP expression NK_RP */
- 492, /* (536) expression ::= NK_PLUS expr_or_subquery */
- 492, /* (537) expression ::= NK_MINUS expr_or_subquery */
- 492, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- 492, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- 492, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- 492, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- 492, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- 492, /* (543) expression ::= column_reference NK_ARROW NK_STRING */
- 492, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- 492, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- 469, /* (546) expression_list ::= expr_or_subquery */
- 469, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- 501, /* (548) column_reference ::= column_name */
- 501, /* (549) column_reference ::= table_name NK_DOT column_name */
- 501, /* (550) column_reference ::= NK_ALIAS */
- 501, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */
- 500, /* (552) pseudo_column ::= ROWTS */
- 500, /* (553) pseudo_column ::= TBNAME */
- 500, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */
- 500, /* (555) pseudo_column ::= QSTART */
- 500, /* (556) pseudo_column ::= QEND */
- 500, /* (557) pseudo_column ::= QDURATION */
- 500, /* (558) pseudo_column ::= WSTART */
- 500, /* (559) pseudo_column ::= WEND */
- 500, /* (560) pseudo_column ::= WDURATION */
- 500, /* (561) pseudo_column ::= IROWTS */
- 500, /* (562) pseudo_column ::= ISFILLED */
- 500, /* (563) pseudo_column ::= QTAGS */
- 502, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */
- 502, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- 502, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- 502, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */
- 502, /* (568) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
- 502, /* (569) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
- 502, /* (570) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
- 502, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- 502, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
- 502, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */
- 502, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- 502, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
- 502, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */
- 502, /* (577) function_expression ::= literal_func */
- 495, /* (578) literal_func ::= noarg_func NK_LP NK_RP */
- 495, /* (579) literal_func ::= NOW */
- 495, /* (580) literal_func ::= TODAY */
- 507, /* (581) substr_func ::= SUBSTR */
- 507, /* (582) substr_func ::= SUBSTRING */
- 506, /* (583) trim_specification_type ::= BOTH */
- 506, /* (584) trim_specification_type ::= TRAILING */
- 506, /* (585) trim_specification_type ::= LEADING */
- 508, /* (586) noarg_func ::= NOW */
- 508, /* (587) noarg_func ::= TODAY */
- 508, /* (588) noarg_func ::= TIMEZONE */
- 508, /* (589) noarg_func ::= DATABASE */
- 508, /* (590) noarg_func ::= CLIENT_VERSION */
- 508, /* (591) noarg_func ::= SERVER_VERSION */
- 508, /* (592) noarg_func ::= SERVER_STATUS */
- 508, /* (593) noarg_func ::= CURRENT_USER */
- 508, /* (594) noarg_func ::= USER */
- 508, /* (595) noarg_func ::= PI */
- 504, /* (596) star_func ::= COUNT */
- 504, /* (597) star_func ::= FIRST */
- 504, /* (598) star_func ::= LAST */
- 504, /* (599) star_func ::= LAST_ROW */
- 505, /* (600) star_func_para_list ::= NK_STAR */
- 505, /* (601) star_func_para_list ::= other_para_list */
- 509, /* (602) other_para_list ::= star_func_para */
- 509, /* (603) other_para_list ::= other_para_list NK_COMMA star_func_para */
- 510, /* (604) star_func_para ::= expr_or_subquery */
- 510, /* (605) star_func_para ::= table_name NK_DOT NK_STAR */
- 503, /* (606) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- 503, /* (607) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- 511, /* (608) when_then_list ::= when_then_expr */
- 511, /* (609) when_then_list ::= when_then_list when_then_expr */
- 514, /* (610) when_then_expr ::= WHEN common_expression THEN common_expression */
- 512, /* (611) case_when_else_opt ::= */
- 512, /* (612) case_when_else_opt ::= ELSE common_expression */
- 515, /* (613) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- 515, /* (614) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- 515, /* (615) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- 515, /* (616) predicate ::= expr_or_subquery IS NULL */
- 515, /* (617) predicate ::= expr_or_subquery IS NOT NULL */
- 515, /* (618) predicate ::= expr_or_subquery in_op in_predicate_value */
- 516, /* (619) compare_op ::= NK_LT */
- 516, /* (620) compare_op ::= NK_GT */
- 516, /* (621) compare_op ::= NK_LE */
- 516, /* (622) compare_op ::= NK_GE */
- 516, /* (623) compare_op ::= NK_NE */
- 516, /* (624) compare_op ::= NK_EQ */
- 516, /* (625) compare_op ::= LIKE */
- 516, /* (626) compare_op ::= NOT LIKE */
- 516, /* (627) compare_op ::= MATCH */
- 516, /* (628) compare_op ::= NMATCH */
- 516, /* (629) compare_op ::= CONTAINS */
- 517, /* (630) in_op ::= IN */
- 517, /* (631) in_op ::= NOT IN */
- 518, /* (632) in_predicate_value ::= NK_LP literal_list NK_RP */
- 519, /* (633) boolean_value_expression ::= boolean_primary */
- 519, /* (634) boolean_value_expression ::= NOT boolean_primary */
- 519, /* (635) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- 519, /* (636) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- 520, /* (637) boolean_primary ::= predicate */
- 520, /* (638) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- 513, /* (639) common_expression ::= expr_or_subquery */
- 513, /* (640) common_expression ::= boolean_value_expression */
- 521, /* (641) from_clause_opt ::= */
- 521, /* (642) from_clause_opt ::= FROM table_reference_list */
- 522, /* (643) table_reference_list ::= table_reference */
- 522, /* (644) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- 523, /* (645) table_reference ::= table_primary */
- 523, /* (646) table_reference ::= joined_table */
- 524, /* (647) table_primary ::= table_name alias_opt */
- 524, /* (648) table_primary ::= db_name NK_DOT table_name alias_opt */
- 524, /* (649) table_primary ::= subquery alias_opt */
- 524, /* (650) table_primary ::= parenthesized_joined_table */
- 526, /* (651) alias_opt ::= */
- 526, /* (652) alias_opt ::= table_alias */
- 526, /* (653) alias_opt ::= AS table_alias */
- 528, /* (654) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- 528, /* (655) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- 525, /* (656) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
- 529, /* (657) join_type ::= */
- 529, /* (658) join_type ::= INNER */
- 529, /* (659) join_type ::= LEFT */
- 529, /* (660) join_type ::= RIGHT */
- 529, /* (661) join_type ::= FULL */
- 530, /* (662) join_subtype ::= */
- 530, /* (663) join_subtype ::= OUTER */
- 530, /* (664) join_subtype ::= SEMI */
- 530, /* (665) join_subtype ::= ANTI */
- 530, /* (666) join_subtype ::= ASOF */
- 530, /* (667) join_subtype ::= WINDOW */
- 531, /* (668) join_on_clause_opt ::= */
- 531, /* (669) join_on_clause_opt ::= ON search_condition */
- 532, /* (670) window_offset_clause_opt ::= */
- 532, /* (671) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
- 534, /* (672) window_offset_literal ::= NK_VARIABLE */
- 534, /* (673) window_offset_literal ::= NK_MINUS NK_VARIABLE */
- 533, /* (674) jlimit_clause_opt ::= */
- 533, /* (675) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
- 535, /* (676) 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 */
- 536, /* (677) hint_list ::= */
- 536, /* (678) hint_list ::= NK_HINT */
- 538, /* (679) tag_mode_opt ::= */
- 538, /* (680) tag_mode_opt ::= TAGS */
- 537, /* (681) set_quantifier_opt ::= */
- 537, /* (682) set_quantifier_opt ::= DISTINCT */
- 537, /* (683) set_quantifier_opt ::= ALL */
- 539, /* (684) select_list ::= select_item */
- 539, /* (685) select_list ::= select_list NK_COMMA select_item */
- 547, /* (686) select_item ::= NK_STAR */
- 547, /* (687) select_item ::= common_expression */
- 547, /* (688) select_item ::= common_expression column_alias */
- 547, /* (689) select_item ::= common_expression AS column_alias */
- 547, /* (690) select_item ::= table_name NK_DOT NK_STAR */
- 472, /* (691) where_clause_opt ::= */
- 472, /* (692) where_clause_opt ::= WHERE search_condition */
- 540, /* (693) partition_by_clause_opt ::= */
- 540, /* (694) partition_by_clause_opt ::= PARTITION BY partition_list */
- 548, /* (695) partition_list ::= partition_item */
- 548, /* (696) partition_list ::= partition_list NK_COMMA partition_item */
- 549, /* (697) partition_item ::= expr_or_subquery */
- 549, /* (698) partition_item ::= expr_or_subquery column_alias */
- 549, /* (699) partition_item ::= expr_or_subquery AS column_alias */
- 544, /* (700) twindow_clause_opt ::= */
- 544, /* (701) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
- 544, /* (702) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- 544, /* (703) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- 544, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- 544, /* (705) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- 544, /* (706) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
- 544, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 465, /* (708) sliding_opt ::= */
- 465, /* (709) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
- 550, /* (710) interval_sliding_duration_literal ::= NK_VARIABLE */
- 550, /* (711) interval_sliding_duration_literal ::= NK_STRING */
- 550, /* (712) interval_sliding_duration_literal ::= NK_INTEGER */
- 543, /* (713) fill_opt ::= */
- 543, /* (714) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- 543, /* (715) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
- 543, /* (716) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
- 551, /* (717) fill_mode ::= NONE */
- 551, /* (718) fill_mode ::= PREV */
- 551, /* (719) fill_mode ::= NULL */
- 551, /* (720) fill_mode ::= NULL_F */
- 551, /* (721) fill_mode ::= LINEAR */
- 551, /* (722) fill_mode ::= NEXT */
- 545, /* (723) group_by_clause_opt ::= */
- 545, /* (724) group_by_clause_opt ::= GROUP BY group_by_list */
- 552, /* (725) group_by_list ::= expr_or_subquery */
- 552, /* (726) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- 546, /* (727) having_clause_opt ::= */
- 546, /* (728) having_clause_opt ::= HAVING search_condition */
- 541, /* (729) range_opt ::= */
- 541, /* (730) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- 541, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
- 542, /* (732) every_opt ::= */
- 542, /* (733) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- 553, /* (734) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- 554, /* (735) query_simple ::= query_specification */
- 554, /* (736) query_simple ::= union_query_expression */
- 558, /* (737) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- 558, /* (738) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- 559, /* (739) query_simple_or_subquery ::= query_simple */
- 559, /* (740) query_simple_or_subquery ::= subquery */
- 471, /* (741) query_or_subquery ::= query_expression */
- 471, /* (742) query_or_subquery ::= subquery */
- 555, /* (743) order_by_clause_opt ::= */
- 555, /* (744) order_by_clause_opt ::= ORDER BY sort_specification_list */
- 556, /* (745) slimit_clause_opt ::= */
- 556, /* (746) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- 556, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- 556, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 557, /* (749) limit_clause_opt ::= */
- 557, /* (750) limit_clause_opt ::= LIMIT NK_INTEGER */
- 557, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- 557, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 527, /* (753) subquery ::= NK_LP query_expression NK_RP */
- 527, /* (754) subquery ::= NK_LP subquery NK_RP */
- 402, /* (755) search_condition ::= common_expression */
- 560, /* (756) sort_specification_list ::= sort_specification */
- 560, /* (757) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- 561, /* (758) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- 562, /* (759) ordering_specification_opt ::= */
- 562, /* (760) ordering_specification_opt ::= ASC */
- 562, /* (761) ordering_specification_opt ::= DESC */
- 563, /* (762) null_ordering_opt ::= */
- 563, /* (763) null_ordering_opt ::= NULLS FIRST */
- 563, /* (764) null_ordering_opt ::= NULLS LAST */
- 431, /* (765) column_options ::= */
- 431, /* (766) column_options ::= column_options PRIMARY KEY */
- 431, /* (767) column_options ::= column_options NK_ID NK_STRING */
+ 383, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ 383, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ 384, /* (2) account_options ::= */
+ 384, /* (3) account_options ::= account_options PPS literal */
+ 384, /* (4) account_options ::= account_options TSERIES literal */
+ 384, /* (5) account_options ::= account_options STORAGE literal */
+ 384, /* (6) account_options ::= account_options STREAMS literal */
+ 384, /* (7) account_options ::= account_options QTIME literal */
+ 384, /* (8) account_options ::= account_options DBS literal */
+ 384, /* (9) account_options ::= account_options USERS literal */
+ 384, /* (10) account_options ::= account_options CONNS literal */
+ 384, /* (11) account_options ::= account_options STATE literal */
+ 385, /* (12) alter_account_options ::= alter_account_option */
+ 385, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ 387, /* (14) alter_account_option ::= PASS literal */
+ 387, /* (15) alter_account_option ::= PPS literal */
+ 387, /* (16) alter_account_option ::= TSERIES literal */
+ 387, /* (17) alter_account_option ::= STORAGE literal */
+ 387, /* (18) alter_account_option ::= STREAMS literal */
+ 387, /* (19) alter_account_option ::= QTIME literal */
+ 387, /* (20) alter_account_option ::= DBS literal */
+ 387, /* (21) alter_account_option ::= USERS literal */
+ 387, /* (22) alter_account_option ::= CONNS literal */
+ 387, /* (23) alter_account_option ::= STATE literal */
+ 388, /* (24) ip_range_list ::= NK_STRING */
+ 388, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
+ 389, /* (26) white_list ::= HOST ip_range_list */
+ 390, /* (27) white_list_opt ::= */
+ 390, /* (28) white_list_opt ::= white_list */
+ 391, /* (29) is_import_opt ::= */
+ 391, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */
+ 392, /* (31) is_createdb_opt ::= */
+ 392, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */
+ 383, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */
+ 383, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */
+ 383, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ 383, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ 383, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */
+ 383, /* (38) cmd ::= ALTER USER user_name ADD white_list */
+ 383, /* (39) cmd ::= ALTER USER user_name DROP white_list */
+ 383, /* (40) cmd ::= DROP USER user_name */
+ 394, /* (41) sysinfo_opt ::= */
+ 394, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ 383, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
+ 383, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
+ 395, /* (45) privileges ::= ALL */
+ 395, /* (46) privileges ::= priv_type_list */
+ 395, /* (47) privileges ::= SUBSCRIBE */
+ 398, /* (48) priv_type_list ::= priv_type */
+ 398, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ 399, /* (50) priv_type ::= READ */
+ 399, /* (51) priv_type ::= WRITE */
+ 399, /* (52) priv_type ::= ALTER */
+ 396, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ 396, /* (54) priv_level ::= db_name NK_DOT NK_STAR */
+ 396, /* (55) priv_level ::= db_name NK_DOT table_name */
+ 396, /* (56) priv_level ::= topic_name */
+ 397, /* (57) with_opt ::= */
+ 397, /* (58) with_opt ::= WITH search_condition */
+ 383, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */
+ 383, /* (60) cmd ::= CREATE DNODE dnode_endpoint */
+ 383, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ 383, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ 383, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ 383, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
+ 383, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
+ 383, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ 383, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ 383, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */
+ 383, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ 383, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */
+ 404, /* (71) dnode_endpoint ::= NK_STRING */
+ 404, /* (72) dnode_endpoint ::= NK_ID */
+ 404, /* (73) dnode_endpoint ::= NK_IPTOKEN */
+ 405, /* (74) force_opt ::= */
+ 405, /* (75) force_opt ::= FORCE */
+ 406, /* (76) unsafe_opt ::= UNSAFE */
+ 383, /* (77) cmd ::= ALTER CLUSTER NK_STRING */
+ 383, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
+ 383, /* (79) cmd ::= ALTER LOCAL NK_STRING */
+ 383, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ 383, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ 383, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ 383, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
+ 383, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ 383, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ 383, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ 383, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ 383, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ 383, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ 383, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
+ 383, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
+ 383, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ 383, /* (93) cmd ::= DROP DATABASE exists_opt db_name */
+ 383, /* (94) cmd ::= USE db_name */
+ 383, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */
+ 383, /* (96) cmd ::= FLUSH DATABASE db_name */
+ 383, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */
+ 383, /* (98) cmd ::= S3MIGRATE DATABASE db_name */
+ 383, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+ 407, /* (100) not_exists_opt ::= IF NOT EXISTS */
+ 407, /* (101) not_exists_opt ::= */
+ 409, /* (102) exists_opt ::= IF EXISTS */
+ 409, /* (103) exists_opt ::= */
+ 408, /* (104) db_options ::= */
+ 408, /* (105) db_options ::= db_options BUFFER NK_INTEGER */
+ 408, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */
+ 408, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */
+ 408, /* (108) db_options ::= db_options COMP NK_INTEGER */
+ 408, /* (109) db_options ::= db_options DURATION NK_INTEGER */
+ 408, /* (110) db_options ::= db_options DURATION NK_VARIABLE */
+ 408, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */
+ 408, /* (112) db_options ::= db_options MINROWS NK_INTEGER */
+ 408, /* (113) db_options ::= db_options KEEP integer_list */
+ 408, /* (114) db_options ::= db_options KEEP variable_list */
+ 408, /* (115) db_options ::= db_options PAGES NK_INTEGER */
+ 408, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */
+ 408, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ 408, /* (118) db_options ::= db_options PRECISION NK_STRING */
+ 408, /* (119) db_options ::= db_options REPLICA NK_INTEGER */
+ 408, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */
+ 408, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ 408, /* (122) db_options ::= db_options RETENTIONS retention_list */
+ 408, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ 408, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ 408, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ 408, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ 408, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 408, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ 408, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 408, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ 408, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ 408, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ 408, /* (133) db_options ::= db_options TABLE_PREFIX signed */
+ 408, /* (134) db_options ::= db_options TABLE_SUFFIX signed */
+ 408, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
+ 408, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
+ 408, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */
+ 408, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */
+ 408, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
+ 408, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
+ 410, /* (141) alter_db_options ::= alter_db_option */
+ 410, /* (142) alter_db_options ::= alter_db_options alter_db_option */
+ 418, /* (143) alter_db_option ::= BUFFER NK_INTEGER */
+ 418, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */
+ 418, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */
+ 418, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ 418, /* (147) alter_db_option ::= KEEP integer_list */
+ 418, /* (148) alter_db_option ::= KEEP variable_list */
+ 418, /* (149) alter_db_option ::= PAGES NK_INTEGER */
+ 418, /* (150) alter_db_option ::= REPLICA NK_INTEGER */
+ 418, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ 418, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ 418, /* (153) alter_db_option ::= MINROWS NK_INTEGER */
+ 418, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+ 418, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 418, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+ 418, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 418, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
+ 418, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */
+ 418, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */
+ 418, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
+ 418, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
+ 414, /* (163) integer_list ::= NK_INTEGER */
+ 414, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ 415, /* (165) variable_list ::= NK_VARIABLE */
+ 415, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ 416, /* (167) retention_list ::= retention */
+ 416, /* (168) retention_list ::= retention_list NK_COMMA retention */
+ 419, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ 419, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
+ 411, /* (171) speed_opt ::= */
+ 411, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */
+ 412, /* (173) start_opt ::= */
+ 412, /* (174) start_opt ::= START WITH NK_INTEGER */
+ 412, /* (175) start_opt ::= START WITH NK_STRING */
+ 412, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */
+ 413, /* (177) end_opt ::= */
+ 413, /* (178) end_opt ::= END WITH NK_INTEGER */
+ 413, /* (179) end_opt ::= END WITH NK_STRING */
+ 413, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */
+ 383, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ 383, /* (182) cmd ::= CREATE TABLE multi_create_clause */
+ 383, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
+ 383, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ 383, /* (185) cmd ::= DROP TABLE multi_drop_clause */
+ 383, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */
+ 383, /* (187) cmd ::= ALTER TABLE alter_table_clause */
+ 383, /* (188) cmd ::= ALTER STABLE alter_table_clause */
+ 428, /* (189) alter_table_clause ::= full_table_name alter_table_options */
+ 428, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
+ 428, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ 428, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ 428, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
+ 428, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ 428, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ 428, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */
+ 428, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ 428, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ 428, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
+ 424, /* (200) multi_create_clause ::= create_subtable_clause */
+ 424, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ 434, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
+ 427, /* (203) multi_drop_clause ::= drop_table_clause */
+ 427, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
+ 437, /* (205) drop_table_clause ::= exists_opt full_table_name */
+ 435, /* (206) specific_cols_opt ::= */
+ 435, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ 420, /* (208) full_table_name ::= table_name */
+ 420, /* (209) full_table_name ::= db_name NK_DOT table_name */
+ 439, /* (210) tag_def_list ::= tag_def */
+ 439, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */
+ 440, /* (212) tag_def ::= column_name type_name */
+ 421, /* (213) column_def_list ::= column_def */
+ 421, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */
+ 441, /* (215) column_def ::= column_name type_name column_options */
+ 431, /* (216) type_name ::= BOOL */
+ 431, /* (217) type_name ::= TINYINT */
+ 431, /* (218) type_name ::= SMALLINT */
+ 431, /* (219) type_name ::= INT */
+ 431, /* (220) type_name ::= INTEGER */
+ 431, /* (221) type_name ::= BIGINT */
+ 431, /* (222) type_name ::= FLOAT */
+ 431, /* (223) type_name ::= DOUBLE */
+ 431, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ 431, /* (225) type_name ::= TIMESTAMP */
+ 431, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ 431, /* (227) type_name ::= TINYINT UNSIGNED */
+ 431, /* (228) type_name ::= SMALLINT UNSIGNED */
+ 431, /* (229) type_name ::= INT UNSIGNED */
+ 431, /* (230) type_name ::= BIGINT UNSIGNED */
+ 431, /* (231) type_name ::= JSON */
+ 431, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ 431, /* (233) type_name ::= MEDIUMBLOB */
+ 431, /* (234) type_name ::= BLOB */
+ 431, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ 431, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+ 431, /* (237) type_name ::= DECIMAL */
+ 431, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ 431, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 442, /* (240) type_name_default_len ::= BINARY */
+ 442, /* (241) type_name_default_len ::= NCHAR */
+ 442, /* (242) type_name_default_len ::= VARCHAR */
+ 442, /* (243) type_name_default_len ::= VARBINARY */
+ 422, /* (244) tags_def_opt ::= */
+ 422, /* (245) tags_def_opt ::= tags_def */
+ 426, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
+ 423, /* (247) table_options ::= */
+ 423, /* (248) table_options ::= table_options COMMENT NK_STRING */
+ 423, /* (249) table_options ::= table_options MAX_DELAY duration_list */
+ 423, /* (250) table_options ::= table_options WATERMARK duration_list */
+ 423, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ 423, /* (252) table_options ::= table_options TTL NK_INTEGER */
+ 423, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ 423, /* (254) table_options ::= table_options DELETE_MARK duration_list */
+ 429, /* (255) alter_table_options ::= alter_table_option */
+ 429, /* (256) alter_table_options ::= alter_table_options alter_table_option */
+ 445, /* (257) alter_table_option ::= COMMENT NK_STRING */
+ 445, /* (258) alter_table_option ::= TTL NK_INTEGER */
+ 443, /* (259) duration_list ::= duration_literal */
+ 443, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */
+ 444, /* (261) rollup_func_list ::= rollup_func_name */
+ 444, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ 447, /* (263) rollup_func_name ::= function_name */
+ 447, /* (264) rollup_func_name ::= FIRST */
+ 447, /* (265) rollup_func_name ::= LAST */
+ 438, /* (266) col_name_list ::= col_name */
+ 438, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */
+ 449, /* (268) col_name ::= column_name */
+ 383, /* (269) cmd ::= SHOW DNODES */
+ 383, /* (270) cmd ::= SHOW USERS */
+ 383, /* (271) cmd ::= SHOW USERS FULL */
+ 383, /* (272) cmd ::= SHOW USER PRIVILEGES */
+ 383, /* (273) cmd ::= SHOW db_kind_opt DATABASES */
+ 383, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
+ 383, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ 383, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ 383, /* (277) cmd ::= SHOW MNODES */
+ 383, /* (278) cmd ::= SHOW QNODES */
+ 383, /* (279) cmd ::= SHOW ARBGROUPS */
+ 383, /* (280) cmd ::= SHOW FUNCTIONS */
+ 383, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ 383, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+ 383, /* (283) cmd ::= SHOW STREAMS */
+ 383, /* (284) cmd ::= SHOW ACCOUNTS */
+ 383, /* (285) cmd ::= SHOW APPS */
+ 383, /* (286) cmd ::= SHOW CONNECTIONS */
+ 383, /* (287) cmd ::= SHOW LICENCES */
+ 383, /* (288) cmd ::= SHOW GRANTS */
+ 383, /* (289) cmd ::= SHOW GRANTS FULL */
+ 383, /* (290) cmd ::= SHOW GRANTS LOGS */
+ 383, /* (291) cmd ::= SHOW CLUSTER MACHINES */
+ 383, /* (292) cmd ::= SHOW CREATE DATABASE db_name */
+ 383, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */
+ 383, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */
+ 383, /* (295) cmd ::= SHOW ENCRYPTIONS */
+ 383, /* (296) cmd ::= SHOW QUERIES */
+ 383, /* (297) cmd ::= SHOW SCORES */
+ 383, /* (298) cmd ::= SHOW TOPICS */
+ 383, /* (299) cmd ::= SHOW VARIABLES */
+ 383, /* (300) cmd ::= SHOW CLUSTER VARIABLES */
+ 383, /* (301) cmd ::= SHOW LOCAL VARIABLES */
+ 383, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ 383, /* (303) cmd ::= SHOW BNODES */
+ 383, /* (304) cmd ::= SHOW SNODES */
+ 383, /* (305) cmd ::= SHOW CLUSTER */
+ 383, /* (306) cmd ::= SHOW TRANSACTIONS */
+ 383, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ 383, /* (308) cmd ::= SHOW CONSUMERS */
+ 383, /* (309) cmd ::= SHOW SUBSCRIPTIONS */
+ 383, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ 383, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+ 383, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ 383, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+ 383, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
+ 383, /* (315) cmd ::= SHOW VNODES */
+ 383, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */
+ 383, /* (317) cmd ::= SHOW CLUSTER ALIVE */
+ 383, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+ 383, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */
+ 383, /* (320) cmd ::= SHOW COMPACTS */
+ 383, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */
+ 451, /* (322) table_kind_db_name_cond_opt ::= */
+ 451, /* (323) table_kind_db_name_cond_opt ::= table_kind */
+ 451, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */
+ 451, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+ 456, /* (326) table_kind ::= NORMAL */
+ 456, /* (327) table_kind ::= CHILD */
+ 453, /* (328) db_name_cond_opt ::= */
+ 453, /* (329) db_name_cond_opt ::= db_name NK_DOT */
+ 452, /* (330) like_pattern_opt ::= */
+ 452, /* (331) like_pattern_opt ::= LIKE NK_STRING */
+ 454, /* (332) table_name_cond ::= table_name */
+ 455, /* (333) from_db_opt ::= */
+ 455, /* (334) from_db_opt ::= FROM db_name */
+ 425, /* (335) tag_list_opt ::= */
+ 425, /* (336) tag_list_opt ::= tag_item */
+ 425, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ 457, /* (338) tag_item ::= TBNAME */
+ 457, /* (339) tag_item ::= QTAGS */
+ 457, /* (340) tag_item ::= column_name */
+ 457, /* (341) tag_item ::= column_name column_alias */
+ 457, /* (342) tag_item ::= column_name AS column_alias */
+ 450, /* (343) db_kind_opt ::= */
+ 450, /* (344) db_kind_opt ::= USER */
+ 450, /* (345) db_kind_opt ::= SYSTEM */
+ 383, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
+ 383, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
+ 383, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */
+ 383, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */
+ 461, /* (350) full_tsma_name ::= tsma_name */
+ 461, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */
+ 460, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
+ 383, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+ 383, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+ 383, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */
+ 464, /* (356) full_index_name ::= index_name */
+ 464, /* (357) full_index_name ::= db_name NK_DOT index_name */
+ 463, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ 463, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+ 462, /* (360) func_list ::= func */
+ 462, /* (361) func_list ::= func_list NK_COMMA func */
+ 468, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */
+ 469, /* (363) sma_func_name ::= function_name */
+ 469, /* (364) sma_func_name ::= COUNT */
+ 469, /* (365) sma_func_name ::= FIRST */
+ 469, /* (366) sma_func_name ::= LAST */
+ 469, /* (367) sma_func_name ::= LAST_ROW */
+ 467, /* (368) sma_stream_opt ::= */
+ 467, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ 467, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ 467, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ 471, /* (372) with_meta ::= AS */
+ 471, /* (373) with_meta ::= WITH META AS */
+ 471, /* (374) with_meta ::= ONLY META AS */
+ 383, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ 383, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+ 383, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+ 383, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */
+ 383, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ 383, /* (380) cmd ::= DESC full_table_name */
+ 383, /* (381) cmd ::= DESCRIBE full_table_name */
+ 383, /* (382) cmd ::= RESET QUERY CACHE */
+ 383, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ 383, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ 475, /* (385) analyze_opt ::= */
+ 475, /* (386) analyze_opt ::= ANALYZE */
+ 476, /* (387) explain_options ::= */
+ 476, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */
+ 476, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */
+ 383, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+ 383, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */
+ 479, /* (392) agg_func_opt ::= */
+ 479, /* (393) agg_func_opt ::= AGGREGATE */
+ 480, /* (394) bufsize_opt ::= */
+ 480, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ 481, /* (396) language_opt ::= */
+ 481, /* (397) language_opt ::= LANGUAGE NK_STRING */
+ 478, /* (398) or_replace_opt ::= */
+ 478, /* (399) or_replace_opt ::= OR REPLACE */
+ 383, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+ 383, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */
+ 482, /* (402) full_view_name ::= view_name */
+ 482, /* (403) full_view_name ::= db_name NK_DOT view_name */
+ 383, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+ 383, /* (405) cmd ::= DROP STREAM exists_opt stream_name */
+ 383, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */
+ 383, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+ 486, /* (408) col_list_opt ::= */
+ 486, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */
+ 490, /* (410) column_stream_def_list ::= column_stream_def */
+ 490, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */
+ 491, /* (412) column_stream_def ::= column_name stream_col_options */
+ 492, /* (413) stream_col_options ::= */
+ 492, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */
+ 487, /* (415) tag_def_or_ref_opt ::= */
+ 487, /* (416) tag_def_or_ref_opt ::= tags_def */
+ 487, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */
+ 485, /* (418) stream_options ::= */
+ 485, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */
+ 485, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ 485, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ 485, /* (422) stream_options ::= stream_options WATERMARK duration_literal */
+ 485, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ 485, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ 485, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */
+ 485, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ 488, /* (427) subtable_opt ::= */
+ 488, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ 489, /* (429) ignore_opt ::= */
+ 489, /* (430) ignore_opt ::= IGNORE UNTREATED */
+ 383, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */
+ 383, /* (432) cmd ::= KILL QUERY NK_STRING */
+ 383, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */
+ 383, /* (434) cmd ::= KILL COMPACT NK_INTEGER */
+ 383, /* (435) cmd ::= BALANCE VGROUP */
+ 383, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+ 383, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
+ 383, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ 383, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ 383, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */
+ 494, /* (441) on_vgroup_id ::= */
+ 494, /* (442) on_vgroup_id ::= ON NK_INTEGER */
+ 495, /* (443) dnode_list ::= DNODE NK_INTEGER */
+ 495, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ 383, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ 383, /* (446) cmd ::= query_or_subquery */
+ 383, /* (447) cmd ::= insert_query */
+ 477, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ 477, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ 433, /* (450) tags_literal ::= NK_INTEGER */
+ 433, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
+ 433, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */
+ 433, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */
+ 433, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
+ 433, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */
+ 433, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */
+ 433, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */
+ 433, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */
+ 433, /* (459) tags_literal ::= NK_FLOAT */
+ 433, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */
+ 433, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */
+ 433, /* (462) tags_literal ::= NK_BIN */
+ 433, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */
+ 433, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */
+ 433, /* (465) tags_literal ::= NK_PLUS NK_BIN */
+ 433, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */
+ 433, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */
+ 433, /* (468) tags_literal ::= NK_MINUS NK_BIN */
+ 433, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */
+ 433, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */
+ 433, /* (471) tags_literal ::= NK_HEX */
+ 433, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */
+ 433, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */
+ 433, /* (474) tags_literal ::= NK_PLUS NK_HEX */
+ 433, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */
+ 433, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */
+ 433, /* (477) tags_literal ::= NK_MINUS NK_HEX */
+ 433, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */
+ 433, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */
+ 433, /* (480) tags_literal ::= NK_STRING */
+ 433, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */
+ 433, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */
+ 433, /* (483) tags_literal ::= NK_BOOL */
+ 433, /* (484) tags_literal ::= NULL */
+ 433, /* (485) tags_literal ::= literal_func */
+ 433, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */
+ 433, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */
+ 436, /* (488) tags_literal_list ::= tags_literal */
+ 436, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */
+ 386, /* (490) literal ::= NK_INTEGER */
+ 386, /* (491) literal ::= NK_FLOAT */
+ 386, /* (492) literal ::= NK_STRING */
+ 386, /* (493) literal ::= NK_BOOL */
+ 386, /* (494) literal ::= TIMESTAMP NK_STRING */
+ 386, /* (495) literal ::= duration_literal */
+ 386, /* (496) literal ::= NULL */
+ 386, /* (497) literal ::= NK_QUESTION */
+ 446, /* (498) duration_literal ::= NK_VARIABLE */
+ 417, /* (499) signed ::= NK_INTEGER */
+ 417, /* (500) signed ::= NK_PLUS NK_INTEGER */
+ 417, /* (501) signed ::= NK_MINUS NK_INTEGER */
+ 417, /* (502) signed ::= NK_FLOAT */
+ 417, /* (503) signed ::= NK_PLUS NK_FLOAT */
+ 417, /* (504) signed ::= NK_MINUS NK_FLOAT */
+ 497, /* (505) signed_literal ::= signed */
+ 497, /* (506) signed_literal ::= NK_STRING */
+ 497, /* (507) signed_literal ::= NK_BOOL */
+ 497, /* (508) signed_literal ::= TIMESTAMP NK_STRING */
+ 497, /* (509) signed_literal ::= duration_literal */
+ 497, /* (510) signed_literal ::= NULL */
+ 497, /* (511) signed_literal ::= literal_func */
+ 497, /* (512) signed_literal ::= NK_QUESTION */
+ 498, /* (513) literal_list ::= signed_literal */
+ 498, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */
+ 400, /* (515) db_name ::= NK_ID */
+ 401, /* (516) table_name ::= NK_ID */
+ 430, /* (517) column_name ::= NK_ID */
+ 448, /* (518) function_name ::= NK_ID */
+ 483, /* (519) view_name ::= NK_ID */
+ 499, /* (520) table_alias ::= NK_ID */
+ 458, /* (521) column_alias ::= NK_ID */
+ 458, /* (522) column_alias ::= NK_ALIAS */
+ 393, /* (523) user_name ::= NK_ID */
+ 402, /* (524) topic_name ::= NK_ID */
+ 484, /* (525) stream_name ::= NK_ID */
+ 474, /* (526) cgroup_name ::= NK_ID */
+ 465, /* (527) index_name ::= NK_ID */
+ 459, /* (528) tsma_name ::= NK_ID */
+ 500, /* (529) expr_or_subquery ::= expression */
+ 493, /* (530) expression ::= literal */
+ 493, /* (531) expression ::= pseudo_column */
+ 493, /* (532) expression ::= column_reference */
+ 493, /* (533) expression ::= function_expression */
+ 493, /* (534) expression ::= case_when_expression */
+ 493, /* (535) expression ::= NK_LP expression NK_RP */
+ 493, /* (536) expression ::= NK_PLUS expr_or_subquery */
+ 493, /* (537) expression ::= NK_MINUS expr_or_subquery */
+ 493, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ 493, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ 493, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ 493, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ 493, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ 493, /* (543) expression ::= column_reference NK_ARROW NK_STRING */
+ 493, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ 493, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ 470, /* (546) expression_list ::= expr_or_subquery */
+ 470, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ 502, /* (548) column_reference ::= column_name */
+ 502, /* (549) column_reference ::= table_name NK_DOT column_name */
+ 502, /* (550) column_reference ::= NK_ALIAS */
+ 502, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */
+ 501, /* (552) pseudo_column ::= ROWTS */
+ 501, /* (553) pseudo_column ::= TBNAME */
+ 501, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */
+ 501, /* (555) pseudo_column ::= QSTART */
+ 501, /* (556) pseudo_column ::= QEND */
+ 501, /* (557) pseudo_column ::= QDURATION */
+ 501, /* (558) pseudo_column ::= WSTART */
+ 501, /* (559) pseudo_column ::= WEND */
+ 501, /* (560) pseudo_column ::= WDURATION */
+ 501, /* (561) pseudo_column ::= IROWTS */
+ 501, /* (562) pseudo_column ::= ISFILLED */
+ 501, /* (563) pseudo_column ::= QTAGS */
+ 503, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */
+ 503, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ 503, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ 503, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */
+ 503, /* (568) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
+ 503, /* (569) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
+ 503, /* (570) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
+ 503, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+ 503, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
+ 503, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */
+ 503, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+ 503, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
+ 503, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */
+ 503, /* (577) function_expression ::= literal_func */
+ 503, /* (578) function_expression ::= rand_func */
+ 496, /* (579) literal_func ::= noarg_func NK_LP NK_RP */
+ 496, /* (580) literal_func ::= NOW */
+ 496, /* (581) literal_func ::= TODAY */
+ 509, /* (582) rand_func ::= RAND NK_LP NK_RP */
+ 509, /* (583) rand_func ::= RAND NK_LP expression_list NK_RP */
+ 508, /* (584) substr_func ::= SUBSTR */
+ 508, /* (585) substr_func ::= SUBSTRING */
+ 507, /* (586) trim_specification_type ::= BOTH */
+ 507, /* (587) trim_specification_type ::= TRAILING */
+ 507, /* (588) trim_specification_type ::= LEADING */
+ 510, /* (589) noarg_func ::= NOW */
+ 510, /* (590) noarg_func ::= TODAY */
+ 510, /* (591) noarg_func ::= TIMEZONE */
+ 510, /* (592) noarg_func ::= DATABASE */
+ 510, /* (593) noarg_func ::= CLIENT_VERSION */
+ 510, /* (594) noarg_func ::= SERVER_VERSION */
+ 510, /* (595) noarg_func ::= SERVER_STATUS */
+ 510, /* (596) noarg_func ::= CURRENT_USER */
+ 510, /* (597) noarg_func ::= USER */
+ 510, /* (598) noarg_func ::= PI */
+ 505, /* (599) star_func ::= COUNT */
+ 505, /* (600) star_func ::= FIRST */
+ 505, /* (601) star_func ::= LAST */
+ 505, /* (602) star_func ::= LAST_ROW */
+ 506, /* (603) star_func_para_list ::= NK_STAR */
+ 506, /* (604) star_func_para_list ::= other_para_list */
+ 511, /* (605) other_para_list ::= star_func_para */
+ 511, /* (606) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ 512, /* (607) star_func_para ::= expr_or_subquery */
+ 512, /* (608) star_func_para ::= table_name NK_DOT NK_STAR */
+ 504, /* (609) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ 504, /* (610) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ 513, /* (611) when_then_list ::= when_then_expr */
+ 513, /* (612) when_then_list ::= when_then_list when_then_expr */
+ 516, /* (613) when_then_expr ::= WHEN common_expression THEN common_expression */
+ 514, /* (614) case_when_else_opt ::= */
+ 514, /* (615) case_when_else_opt ::= ELSE common_expression */
+ 517, /* (616) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ 517, /* (617) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ 517, /* (618) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ 517, /* (619) predicate ::= expr_or_subquery IS NULL */
+ 517, /* (620) predicate ::= expr_or_subquery IS NOT NULL */
+ 517, /* (621) predicate ::= expr_or_subquery in_op in_predicate_value */
+ 518, /* (622) compare_op ::= NK_LT */
+ 518, /* (623) compare_op ::= NK_GT */
+ 518, /* (624) compare_op ::= NK_LE */
+ 518, /* (625) compare_op ::= NK_GE */
+ 518, /* (626) compare_op ::= NK_NE */
+ 518, /* (627) compare_op ::= NK_EQ */
+ 518, /* (628) compare_op ::= LIKE */
+ 518, /* (629) compare_op ::= NOT LIKE */
+ 518, /* (630) compare_op ::= MATCH */
+ 518, /* (631) compare_op ::= NMATCH */
+ 518, /* (632) compare_op ::= CONTAINS */
+ 519, /* (633) in_op ::= IN */
+ 519, /* (634) in_op ::= NOT IN */
+ 520, /* (635) in_predicate_value ::= NK_LP literal_list NK_RP */
+ 521, /* (636) boolean_value_expression ::= boolean_primary */
+ 521, /* (637) boolean_value_expression ::= NOT boolean_primary */
+ 521, /* (638) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ 521, /* (639) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ 522, /* (640) boolean_primary ::= predicate */
+ 522, /* (641) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ 515, /* (642) common_expression ::= expr_or_subquery */
+ 515, /* (643) common_expression ::= boolean_value_expression */
+ 523, /* (644) from_clause_opt ::= */
+ 523, /* (645) from_clause_opt ::= FROM table_reference_list */
+ 524, /* (646) table_reference_list ::= table_reference */
+ 524, /* (647) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ 525, /* (648) table_reference ::= table_primary */
+ 525, /* (649) table_reference ::= joined_table */
+ 526, /* (650) table_primary ::= table_name alias_opt */
+ 526, /* (651) table_primary ::= db_name NK_DOT table_name alias_opt */
+ 526, /* (652) table_primary ::= subquery alias_opt */
+ 526, /* (653) table_primary ::= parenthesized_joined_table */
+ 528, /* (654) alias_opt ::= */
+ 528, /* (655) alias_opt ::= table_alias */
+ 528, /* (656) alias_opt ::= AS table_alias */
+ 530, /* (657) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ 530, /* (658) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ 527, /* (659) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
+ 531, /* (660) join_type ::= */
+ 531, /* (661) join_type ::= INNER */
+ 531, /* (662) join_type ::= LEFT */
+ 531, /* (663) join_type ::= RIGHT */
+ 531, /* (664) join_type ::= FULL */
+ 532, /* (665) join_subtype ::= */
+ 532, /* (666) join_subtype ::= OUTER */
+ 532, /* (667) join_subtype ::= SEMI */
+ 532, /* (668) join_subtype ::= ANTI */
+ 532, /* (669) join_subtype ::= ASOF */
+ 532, /* (670) join_subtype ::= WINDOW */
+ 533, /* (671) join_on_clause_opt ::= */
+ 533, /* (672) join_on_clause_opt ::= ON search_condition */
+ 534, /* (673) window_offset_clause_opt ::= */
+ 534, /* (674) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
+ 536, /* (675) window_offset_literal ::= NK_VARIABLE */
+ 536, /* (676) window_offset_literal ::= NK_MINUS NK_VARIABLE */
+ 535, /* (677) jlimit_clause_opt ::= */
+ 535, /* (678) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
+ 537, /* (679) 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 */
+ 538, /* (680) hint_list ::= */
+ 538, /* (681) hint_list ::= NK_HINT */
+ 540, /* (682) tag_mode_opt ::= */
+ 540, /* (683) tag_mode_opt ::= TAGS */
+ 539, /* (684) set_quantifier_opt ::= */
+ 539, /* (685) set_quantifier_opt ::= DISTINCT */
+ 539, /* (686) set_quantifier_opt ::= ALL */
+ 541, /* (687) select_list ::= select_item */
+ 541, /* (688) select_list ::= select_list NK_COMMA select_item */
+ 549, /* (689) select_item ::= NK_STAR */
+ 549, /* (690) select_item ::= common_expression */
+ 549, /* (691) select_item ::= common_expression column_alias */
+ 549, /* (692) select_item ::= common_expression AS column_alias */
+ 549, /* (693) select_item ::= table_name NK_DOT NK_STAR */
+ 473, /* (694) where_clause_opt ::= */
+ 473, /* (695) where_clause_opt ::= WHERE search_condition */
+ 542, /* (696) partition_by_clause_opt ::= */
+ 542, /* (697) partition_by_clause_opt ::= PARTITION BY partition_list */
+ 550, /* (698) partition_list ::= partition_item */
+ 550, /* (699) partition_list ::= partition_list NK_COMMA partition_item */
+ 551, /* (700) partition_item ::= expr_or_subquery */
+ 551, /* (701) partition_item ::= expr_or_subquery column_alias */
+ 551, /* (702) partition_item ::= expr_or_subquery AS column_alias */
+ 546, /* (703) twindow_clause_opt ::= */
+ 546, /* (704) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ 546, /* (705) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ 546, /* (706) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 546, /* (707) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 546, /* (708) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ 546, /* (709) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ 546, /* (710) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 466, /* (711) sliding_opt ::= */
+ 466, /* (712) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ 552, /* (713) interval_sliding_duration_literal ::= NK_VARIABLE */
+ 552, /* (714) interval_sliding_duration_literal ::= NK_STRING */
+ 552, /* (715) interval_sliding_duration_literal ::= NK_INTEGER */
+ 545, /* (716) fill_opt ::= */
+ 545, /* (717) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ 545, /* (718) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ 545, /* (719) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ 553, /* (720) fill_mode ::= NONE */
+ 553, /* (721) fill_mode ::= PREV */
+ 553, /* (722) fill_mode ::= NULL */
+ 553, /* (723) fill_mode ::= NULL_F */
+ 553, /* (724) fill_mode ::= LINEAR */
+ 553, /* (725) fill_mode ::= NEXT */
+ 547, /* (726) group_by_clause_opt ::= */
+ 547, /* (727) group_by_clause_opt ::= GROUP BY group_by_list */
+ 554, /* (728) group_by_list ::= expr_or_subquery */
+ 554, /* (729) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 548, /* (730) having_clause_opt ::= */
+ 548, /* (731) having_clause_opt ::= HAVING search_condition */
+ 543, /* (732) range_opt ::= */
+ 543, /* (733) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ 543, /* (734) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 544, /* (735) every_opt ::= */
+ 544, /* (736) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ 555, /* (737) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ 556, /* (738) query_simple ::= query_specification */
+ 556, /* (739) query_simple ::= union_query_expression */
+ 560, /* (740) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ 560, /* (741) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ 561, /* (742) query_simple_or_subquery ::= query_simple */
+ 561, /* (743) query_simple_or_subquery ::= subquery */
+ 472, /* (744) query_or_subquery ::= query_expression */
+ 472, /* (745) query_or_subquery ::= subquery */
+ 557, /* (746) order_by_clause_opt ::= */
+ 557, /* (747) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 558, /* (748) slimit_clause_opt ::= */
+ 558, /* (749) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ 558, /* (750) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ 558, /* (751) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 559, /* (752) limit_clause_opt ::= */
+ 559, /* (753) limit_clause_opt ::= LIMIT NK_INTEGER */
+ 559, /* (754) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ 559, /* (755) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 529, /* (756) subquery ::= NK_LP query_expression NK_RP */
+ 529, /* (757) subquery ::= NK_LP subquery NK_RP */
+ 403, /* (758) search_condition ::= common_expression */
+ 562, /* (759) sort_specification_list ::= sort_specification */
+ 562, /* (760) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ 563, /* (761) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 564, /* (762) ordering_specification_opt ::= */
+ 564, /* (763) ordering_specification_opt ::= ASC */
+ 564, /* (764) ordering_specification_opt ::= DESC */
+ 565, /* (765) null_ordering_opt ::= */
+ 565, /* (766) null_ordering_opt ::= NULLS FIRST */
+ 565, /* (767) null_ordering_opt ::= NULLS LAST */
+ 432, /* (768) column_options ::= */
+ 432, /* (769) column_options ::= column_options PRIMARY KEY */
+ 432, /* (770) column_options ::= column_options NK_ID NK_STRING */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -5605,196 +5689,199 @@ static const signed char yyRuleInfoNRhs[] = {
-8, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
-4, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */
-1, /* (577) function_expression ::= literal_func */
- -3, /* (578) literal_func ::= noarg_func NK_LP NK_RP */
- -1, /* (579) literal_func ::= NOW */
- -1, /* (580) literal_func ::= TODAY */
- -1, /* (581) substr_func ::= SUBSTR */
- -1, /* (582) substr_func ::= SUBSTRING */
- -1, /* (583) trim_specification_type ::= BOTH */
- -1, /* (584) trim_specification_type ::= TRAILING */
- -1, /* (585) trim_specification_type ::= LEADING */
- -1, /* (586) noarg_func ::= NOW */
- -1, /* (587) noarg_func ::= TODAY */
- -1, /* (588) noarg_func ::= TIMEZONE */
- -1, /* (589) noarg_func ::= DATABASE */
- -1, /* (590) noarg_func ::= CLIENT_VERSION */
- -1, /* (591) noarg_func ::= SERVER_VERSION */
- -1, /* (592) noarg_func ::= SERVER_STATUS */
- -1, /* (593) noarg_func ::= CURRENT_USER */
- -1, /* (594) noarg_func ::= USER */
- -1, /* (595) noarg_func ::= PI */
- -1, /* (596) star_func ::= COUNT */
- -1, /* (597) star_func ::= FIRST */
- -1, /* (598) star_func ::= LAST */
- -1, /* (599) star_func ::= LAST_ROW */
- -1, /* (600) star_func_para_list ::= NK_STAR */
- -1, /* (601) star_func_para_list ::= other_para_list */
- -1, /* (602) other_para_list ::= star_func_para */
- -3, /* (603) other_para_list ::= other_para_list NK_COMMA star_func_para */
- -1, /* (604) star_func_para ::= expr_or_subquery */
- -3, /* (605) star_func_para ::= table_name NK_DOT NK_STAR */
- -4, /* (606) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- -5, /* (607) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- -1, /* (608) when_then_list ::= when_then_expr */
- -2, /* (609) when_then_list ::= when_then_list when_then_expr */
- -4, /* (610) when_then_expr ::= WHEN common_expression THEN common_expression */
- 0, /* (611) case_when_else_opt ::= */
- -2, /* (612) case_when_else_opt ::= ELSE common_expression */
- -3, /* (613) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- -5, /* (614) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- -6, /* (615) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- -3, /* (616) predicate ::= expr_or_subquery IS NULL */
- -4, /* (617) predicate ::= expr_or_subquery IS NOT NULL */
- -3, /* (618) predicate ::= expr_or_subquery in_op in_predicate_value */
- -1, /* (619) compare_op ::= NK_LT */
- -1, /* (620) compare_op ::= NK_GT */
- -1, /* (621) compare_op ::= NK_LE */
- -1, /* (622) compare_op ::= NK_GE */
- -1, /* (623) compare_op ::= NK_NE */
- -1, /* (624) compare_op ::= NK_EQ */
- -1, /* (625) compare_op ::= LIKE */
- -2, /* (626) compare_op ::= NOT LIKE */
- -1, /* (627) compare_op ::= MATCH */
- -1, /* (628) compare_op ::= NMATCH */
- -1, /* (629) compare_op ::= CONTAINS */
- -1, /* (630) in_op ::= IN */
- -2, /* (631) in_op ::= NOT IN */
- -3, /* (632) in_predicate_value ::= NK_LP literal_list NK_RP */
- -1, /* (633) boolean_value_expression ::= boolean_primary */
- -2, /* (634) boolean_value_expression ::= NOT boolean_primary */
- -3, /* (635) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- -3, /* (636) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- -1, /* (637) boolean_primary ::= predicate */
- -3, /* (638) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- -1, /* (639) common_expression ::= expr_or_subquery */
- -1, /* (640) common_expression ::= boolean_value_expression */
- 0, /* (641) from_clause_opt ::= */
- -2, /* (642) from_clause_opt ::= FROM table_reference_list */
- -1, /* (643) table_reference_list ::= table_reference */
- -3, /* (644) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- -1, /* (645) table_reference ::= table_primary */
- -1, /* (646) table_reference ::= joined_table */
- -2, /* (647) table_primary ::= table_name alias_opt */
- -4, /* (648) table_primary ::= db_name NK_DOT table_name alias_opt */
- -2, /* (649) table_primary ::= subquery alias_opt */
- -1, /* (650) table_primary ::= parenthesized_joined_table */
- 0, /* (651) alias_opt ::= */
- -1, /* (652) alias_opt ::= table_alias */
- -2, /* (653) alias_opt ::= AS table_alias */
- -3, /* (654) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- -3, /* (655) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- -8, /* (656) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
- 0, /* (657) join_type ::= */
- -1, /* (658) join_type ::= INNER */
- -1, /* (659) join_type ::= LEFT */
- -1, /* (660) join_type ::= RIGHT */
- -1, /* (661) join_type ::= FULL */
- 0, /* (662) join_subtype ::= */
- -1, /* (663) join_subtype ::= OUTER */
- -1, /* (664) join_subtype ::= SEMI */
- -1, /* (665) join_subtype ::= ANTI */
- -1, /* (666) join_subtype ::= ASOF */
- -1, /* (667) join_subtype ::= WINDOW */
- 0, /* (668) join_on_clause_opt ::= */
- -2, /* (669) join_on_clause_opt ::= ON search_condition */
- 0, /* (670) window_offset_clause_opt ::= */
- -6, /* (671) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
- -1, /* (672) window_offset_literal ::= NK_VARIABLE */
- -2, /* (673) window_offset_literal ::= NK_MINUS NK_VARIABLE */
- 0, /* (674) jlimit_clause_opt ::= */
- -2, /* (675) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
- -14, /* (676) 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, /* (677) hint_list ::= */
- -1, /* (678) hint_list ::= NK_HINT */
- 0, /* (679) tag_mode_opt ::= */
- -1, /* (680) tag_mode_opt ::= TAGS */
- 0, /* (681) set_quantifier_opt ::= */
- -1, /* (682) set_quantifier_opt ::= DISTINCT */
- -1, /* (683) set_quantifier_opt ::= ALL */
- -1, /* (684) select_list ::= select_item */
- -3, /* (685) select_list ::= select_list NK_COMMA select_item */
- -1, /* (686) select_item ::= NK_STAR */
- -1, /* (687) select_item ::= common_expression */
- -2, /* (688) select_item ::= common_expression column_alias */
- -3, /* (689) select_item ::= common_expression AS column_alias */
- -3, /* (690) select_item ::= table_name NK_DOT NK_STAR */
- 0, /* (691) where_clause_opt ::= */
- -2, /* (692) where_clause_opt ::= WHERE search_condition */
- 0, /* (693) partition_by_clause_opt ::= */
- -3, /* (694) partition_by_clause_opt ::= PARTITION BY partition_list */
- -1, /* (695) partition_list ::= partition_item */
- -3, /* (696) partition_list ::= partition_list NK_COMMA partition_item */
- -1, /* (697) partition_item ::= expr_or_subquery */
- -2, /* (698) partition_item ::= expr_or_subquery column_alias */
- -3, /* (699) partition_item ::= expr_or_subquery AS column_alias */
- 0, /* (700) twindow_clause_opt ::= */
- -6, /* (701) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
- -4, /* (702) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- -6, /* (703) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- -8, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- -7, /* (705) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- -4, /* (706) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
- -6, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 0, /* (708) sliding_opt ::= */
- -4, /* (709) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
- -1, /* (710) interval_sliding_duration_literal ::= NK_VARIABLE */
- -1, /* (711) interval_sliding_duration_literal ::= NK_STRING */
- -1, /* (712) interval_sliding_duration_literal ::= NK_INTEGER */
- 0, /* (713) fill_opt ::= */
- -4, /* (714) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- -6, /* (715) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
- -6, /* (716) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
- -1, /* (717) fill_mode ::= NONE */
- -1, /* (718) fill_mode ::= PREV */
- -1, /* (719) fill_mode ::= NULL */
- -1, /* (720) fill_mode ::= NULL_F */
- -1, /* (721) fill_mode ::= LINEAR */
- -1, /* (722) fill_mode ::= NEXT */
- 0, /* (723) group_by_clause_opt ::= */
- -3, /* (724) group_by_clause_opt ::= GROUP BY group_by_list */
- -1, /* (725) group_by_list ::= expr_or_subquery */
- -3, /* (726) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- 0, /* (727) having_clause_opt ::= */
- -2, /* (728) having_clause_opt ::= HAVING search_condition */
- 0, /* (729) range_opt ::= */
- -6, /* (730) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- -4, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
- 0, /* (732) every_opt ::= */
- -4, /* (733) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- -4, /* (734) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- -1, /* (735) query_simple ::= query_specification */
- -1, /* (736) query_simple ::= union_query_expression */
- -4, /* (737) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- -3, /* (738) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- -1, /* (739) query_simple_or_subquery ::= query_simple */
- -1, /* (740) query_simple_or_subquery ::= subquery */
- -1, /* (741) query_or_subquery ::= query_expression */
- -1, /* (742) query_or_subquery ::= subquery */
- 0, /* (743) order_by_clause_opt ::= */
- -3, /* (744) order_by_clause_opt ::= ORDER BY sort_specification_list */
- 0, /* (745) slimit_clause_opt ::= */
- -2, /* (746) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- -4, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- -4, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 0, /* (749) limit_clause_opt ::= */
- -2, /* (750) limit_clause_opt ::= LIMIT NK_INTEGER */
- -4, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- -4, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- -3, /* (753) subquery ::= NK_LP query_expression NK_RP */
- -3, /* (754) subquery ::= NK_LP subquery NK_RP */
- -1, /* (755) search_condition ::= common_expression */
- -1, /* (756) sort_specification_list ::= sort_specification */
- -3, /* (757) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- -3, /* (758) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- 0, /* (759) ordering_specification_opt ::= */
- -1, /* (760) ordering_specification_opt ::= ASC */
- -1, /* (761) ordering_specification_opt ::= DESC */
- 0, /* (762) null_ordering_opt ::= */
- -2, /* (763) null_ordering_opt ::= NULLS FIRST */
- -2, /* (764) null_ordering_opt ::= NULLS LAST */
- 0, /* (765) column_options ::= */
- -3, /* (766) column_options ::= column_options PRIMARY KEY */
- -3, /* (767) column_options ::= column_options NK_ID NK_STRING */
+ -1, /* (578) function_expression ::= rand_func */
+ -3, /* (579) literal_func ::= noarg_func NK_LP NK_RP */
+ -1, /* (580) literal_func ::= NOW */
+ -1, /* (581) literal_func ::= TODAY */
+ -3, /* (582) rand_func ::= RAND NK_LP NK_RP */
+ -4, /* (583) rand_func ::= RAND NK_LP expression_list NK_RP */
+ -1, /* (584) substr_func ::= SUBSTR */
+ -1, /* (585) substr_func ::= SUBSTRING */
+ -1, /* (586) trim_specification_type ::= BOTH */
+ -1, /* (587) trim_specification_type ::= TRAILING */
+ -1, /* (588) trim_specification_type ::= LEADING */
+ -1, /* (589) noarg_func ::= NOW */
+ -1, /* (590) noarg_func ::= TODAY */
+ -1, /* (591) noarg_func ::= TIMEZONE */
+ -1, /* (592) noarg_func ::= DATABASE */
+ -1, /* (593) noarg_func ::= CLIENT_VERSION */
+ -1, /* (594) noarg_func ::= SERVER_VERSION */
+ -1, /* (595) noarg_func ::= SERVER_STATUS */
+ -1, /* (596) noarg_func ::= CURRENT_USER */
+ -1, /* (597) noarg_func ::= USER */
+ -1, /* (598) noarg_func ::= PI */
+ -1, /* (599) star_func ::= COUNT */
+ -1, /* (600) star_func ::= FIRST */
+ -1, /* (601) star_func ::= LAST */
+ -1, /* (602) star_func ::= LAST_ROW */
+ -1, /* (603) star_func_para_list ::= NK_STAR */
+ -1, /* (604) star_func_para_list ::= other_para_list */
+ -1, /* (605) other_para_list ::= star_func_para */
+ -3, /* (606) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ -1, /* (607) star_func_para ::= expr_or_subquery */
+ -3, /* (608) star_func_para ::= table_name NK_DOT NK_STAR */
+ -4, /* (609) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ -5, /* (610) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ -1, /* (611) when_then_list ::= when_then_expr */
+ -2, /* (612) when_then_list ::= when_then_list when_then_expr */
+ -4, /* (613) when_then_expr ::= WHEN common_expression THEN common_expression */
+ 0, /* (614) case_when_else_opt ::= */
+ -2, /* (615) case_when_else_opt ::= ELSE common_expression */
+ -3, /* (616) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ -5, /* (617) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ -6, /* (618) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ -3, /* (619) predicate ::= expr_or_subquery IS NULL */
+ -4, /* (620) predicate ::= expr_or_subquery IS NOT NULL */
+ -3, /* (621) predicate ::= expr_or_subquery in_op in_predicate_value */
+ -1, /* (622) compare_op ::= NK_LT */
+ -1, /* (623) compare_op ::= NK_GT */
+ -1, /* (624) compare_op ::= NK_LE */
+ -1, /* (625) compare_op ::= NK_GE */
+ -1, /* (626) compare_op ::= NK_NE */
+ -1, /* (627) compare_op ::= NK_EQ */
+ -1, /* (628) compare_op ::= LIKE */
+ -2, /* (629) compare_op ::= NOT LIKE */
+ -1, /* (630) compare_op ::= MATCH */
+ -1, /* (631) compare_op ::= NMATCH */
+ -1, /* (632) compare_op ::= CONTAINS */
+ -1, /* (633) in_op ::= IN */
+ -2, /* (634) in_op ::= NOT IN */
+ -3, /* (635) in_predicate_value ::= NK_LP literal_list NK_RP */
+ -1, /* (636) boolean_value_expression ::= boolean_primary */
+ -2, /* (637) boolean_value_expression ::= NOT boolean_primary */
+ -3, /* (638) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ -3, /* (639) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ -1, /* (640) boolean_primary ::= predicate */
+ -3, /* (641) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ -1, /* (642) common_expression ::= expr_or_subquery */
+ -1, /* (643) common_expression ::= boolean_value_expression */
+ 0, /* (644) from_clause_opt ::= */
+ -2, /* (645) from_clause_opt ::= FROM table_reference_list */
+ -1, /* (646) table_reference_list ::= table_reference */
+ -3, /* (647) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ -1, /* (648) table_reference ::= table_primary */
+ -1, /* (649) table_reference ::= joined_table */
+ -2, /* (650) table_primary ::= table_name alias_opt */
+ -4, /* (651) table_primary ::= db_name NK_DOT table_name alias_opt */
+ -2, /* (652) table_primary ::= subquery alias_opt */
+ -1, /* (653) table_primary ::= parenthesized_joined_table */
+ 0, /* (654) alias_opt ::= */
+ -1, /* (655) alias_opt ::= table_alias */
+ -2, /* (656) alias_opt ::= AS table_alias */
+ -3, /* (657) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ -3, /* (658) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ -8, /* (659) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
+ 0, /* (660) join_type ::= */
+ -1, /* (661) join_type ::= INNER */
+ -1, /* (662) join_type ::= LEFT */
+ -1, /* (663) join_type ::= RIGHT */
+ -1, /* (664) join_type ::= FULL */
+ 0, /* (665) join_subtype ::= */
+ -1, /* (666) join_subtype ::= OUTER */
+ -1, /* (667) join_subtype ::= SEMI */
+ -1, /* (668) join_subtype ::= ANTI */
+ -1, /* (669) join_subtype ::= ASOF */
+ -1, /* (670) join_subtype ::= WINDOW */
+ 0, /* (671) join_on_clause_opt ::= */
+ -2, /* (672) join_on_clause_opt ::= ON search_condition */
+ 0, /* (673) window_offset_clause_opt ::= */
+ -6, /* (674) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
+ -1, /* (675) window_offset_literal ::= NK_VARIABLE */
+ -2, /* (676) window_offset_literal ::= NK_MINUS NK_VARIABLE */
+ 0, /* (677) jlimit_clause_opt ::= */
+ -2, /* (678) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
+ -14, /* (679) 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, /* (680) hint_list ::= */
+ -1, /* (681) hint_list ::= NK_HINT */
+ 0, /* (682) tag_mode_opt ::= */
+ -1, /* (683) tag_mode_opt ::= TAGS */
+ 0, /* (684) set_quantifier_opt ::= */
+ -1, /* (685) set_quantifier_opt ::= DISTINCT */
+ -1, /* (686) set_quantifier_opt ::= ALL */
+ -1, /* (687) select_list ::= select_item */
+ -3, /* (688) select_list ::= select_list NK_COMMA select_item */
+ -1, /* (689) select_item ::= NK_STAR */
+ -1, /* (690) select_item ::= common_expression */
+ -2, /* (691) select_item ::= common_expression column_alias */
+ -3, /* (692) select_item ::= common_expression AS column_alias */
+ -3, /* (693) select_item ::= table_name NK_DOT NK_STAR */
+ 0, /* (694) where_clause_opt ::= */
+ -2, /* (695) where_clause_opt ::= WHERE search_condition */
+ 0, /* (696) partition_by_clause_opt ::= */
+ -3, /* (697) partition_by_clause_opt ::= PARTITION BY partition_list */
+ -1, /* (698) partition_list ::= partition_item */
+ -3, /* (699) partition_list ::= partition_list NK_COMMA partition_item */
+ -1, /* (700) partition_item ::= expr_or_subquery */
+ -2, /* (701) partition_item ::= expr_or_subquery column_alias */
+ -3, /* (702) partition_item ::= expr_or_subquery AS column_alias */
+ 0, /* (703) twindow_clause_opt ::= */
+ -6, /* (704) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ -4, /* (705) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ -6, /* (706) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ -8, /* (707) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ -7, /* (708) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ -4, /* (709) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ -6, /* (710) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 0, /* (711) sliding_opt ::= */
+ -4, /* (712) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ -1, /* (713) interval_sliding_duration_literal ::= NK_VARIABLE */
+ -1, /* (714) interval_sliding_duration_literal ::= NK_STRING */
+ -1, /* (715) interval_sliding_duration_literal ::= NK_INTEGER */
+ 0, /* (716) fill_opt ::= */
+ -4, /* (717) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ -6, /* (718) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ -6, /* (719) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ -1, /* (720) fill_mode ::= NONE */
+ -1, /* (721) fill_mode ::= PREV */
+ -1, /* (722) fill_mode ::= NULL */
+ -1, /* (723) fill_mode ::= NULL_F */
+ -1, /* (724) fill_mode ::= LINEAR */
+ -1, /* (725) fill_mode ::= NEXT */
+ 0, /* (726) group_by_clause_opt ::= */
+ -3, /* (727) group_by_clause_opt ::= GROUP BY group_by_list */
+ -1, /* (728) group_by_list ::= expr_or_subquery */
+ -3, /* (729) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 0, /* (730) having_clause_opt ::= */
+ -2, /* (731) having_clause_opt ::= HAVING search_condition */
+ 0, /* (732) range_opt ::= */
+ -6, /* (733) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ -4, /* (734) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 0, /* (735) every_opt ::= */
+ -4, /* (736) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ -4, /* (737) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ -1, /* (738) query_simple ::= query_specification */
+ -1, /* (739) query_simple ::= union_query_expression */
+ -4, /* (740) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ -3, /* (741) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ -1, /* (742) query_simple_or_subquery ::= query_simple */
+ -1, /* (743) query_simple_or_subquery ::= subquery */
+ -1, /* (744) query_or_subquery ::= query_expression */
+ -1, /* (745) query_or_subquery ::= subquery */
+ 0, /* (746) order_by_clause_opt ::= */
+ -3, /* (747) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 0, /* (748) slimit_clause_opt ::= */
+ -2, /* (749) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ -4, /* (750) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ -4, /* (751) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 0, /* (752) limit_clause_opt ::= */
+ -2, /* (753) limit_clause_opt ::= LIMIT NK_INTEGER */
+ -4, /* (754) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ -4, /* (755) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ -3, /* (756) subquery ::= NK_LP query_expression NK_RP */
+ -3, /* (757) subquery ::= NK_LP subquery NK_RP */
+ -1, /* (758) search_condition ::= common_expression */
+ -1, /* (759) sort_specification_list ::= sort_specification */
+ -3, /* (760) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ -3, /* (761) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 0, /* (762) ordering_specification_opt ::= */
+ -1, /* (763) ordering_specification_opt ::= ASC */
+ -1, /* (764) ordering_specification_opt ::= DESC */
+ 0, /* (765) null_ordering_opt ::= */
+ -2, /* (766) null_ordering_opt ::= NULLS FIRST */
+ -2, /* (767) null_ordering_opt ::= NULLS LAST */
+ 0, /* (768) column_options ::= */
+ -3, /* (769) column_options ::= column_options PRIMARY KEY */
+ -3, /* (770) column_options ::= column_options NK_ID NK_STRING */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -5838,11 +5925,11 @@ static YYACTIONTYPE yy_reduce(
YYMINORTYPE yylhsminor;
case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,383,&yymsp[0].minor);
+ yy_destructor(yypParser,384,&yymsp[0].minor);
break;
case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,384,&yymsp[0].minor);
+ yy_destructor(yypParser,385,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -5856,20 +5943,20 @@ static YYACTIONTYPE yy_reduce(
case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9);
case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
- { yy_destructor(yypParser,383,&yymsp[-2].minor);
+ { yy_destructor(yypParser,384,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,385,&yymsp[0].minor);
+ yy_destructor(yypParser,386,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
- { yy_destructor(yypParser,386,&yymsp[0].minor);
+ { yy_destructor(yypParser,387,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
- { yy_destructor(yypParser,384,&yymsp[-1].minor);
+ { yy_destructor(yypParser,385,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,386,&yymsp[0].minor);
+ yy_destructor(yypParser,387,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -5883,18 +5970,18 @@ static YYACTIONTYPE yy_reduce(
case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22);
case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
{ }
- yy_destructor(yypParser,385,&yymsp[0].minor);
+ yy_destructor(yypParser,386,&yymsp[0].minor);
break;
case 24: /* ip_range_list ::= NK_STRING */
- { yylhsminor.yy928 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
- { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy712 = yylhsminor.yy712;
break;
case 26: /* white_list ::= HOST ip_range_list */
- { yymsp[-1].minor.yy928 = yymsp[0].minor.yy928; }
+ { yymsp[-1].minor.yy712 = yymsp[0].minor.yy712; }
break;
case 27: /* white_list_opt ::= */
case 206: /* specific_cols_opt ::= */ yytestcase(yyruleno==206);
@@ -5902,151 +5989,151 @@ static YYACTIONTYPE yy_reduce(
case 335: /* tag_list_opt ::= */ yytestcase(yyruleno==335);
case 408: /* col_list_opt ::= */ yytestcase(yyruleno==408);
case 415: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==415);
- case 693: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==693);
- case 723: /* group_by_clause_opt ::= */ yytestcase(yyruleno==723);
- case 743: /* order_by_clause_opt ::= */ yytestcase(yyruleno==743);
- { yymsp[1].minor.yy928 = NULL; }
+ case 696: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==696);
+ case 726: /* group_by_clause_opt ::= */ yytestcase(yyruleno==726);
+ case 746: /* order_by_clause_opt ::= */ yytestcase(yyruleno==746);
+ { yymsp[1].minor.yy712 = NULL; }
break;
case 28: /* white_list_opt ::= white_list */
case 245: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==245);
case 416: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==416);
- case 601: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==601);
- { yylhsminor.yy928 = yymsp[0].minor.yy928; }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ case 604: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==604);
+ { yylhsminor.yy712 = yymsp[0].minor.yy712; }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
case 29: /* is_import_opt ::= */
case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31);
- { yymsp[1].minor.yy695 = 0; }
+ { yymsp[1].minor.yy107 = 0; }
break;
case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */
case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32);
case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42);
- { yymsp[-1].minor.yy695 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+ { yymsp[-1].minor.yy107 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */
{
- pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy401, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy695, yymsp[-1].minor.yy695, yymsp[-2].minor.yy695);
- pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy928);
+ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy461, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy107, yymsp[-1].minor.yy107, yymsp[-2].minor.yy107);
+ pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy712);
}
break;
case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */
- { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+ { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy461, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+ { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy461, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
break;
case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+ { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy461, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */
- { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); }
+ { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy461, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); }
break;
case 38: /* cmd ::= ALTER USER user_name ADD white_list */
- { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy928); }
+ { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy461, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy712); }
break;
case 39: /* cmd ::= ALTER USER user_name DROP white_list */
- { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy401, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy928); }
+ { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy461, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy712); }
break;
case 40: /* cmd ::= DROP USER user_name */
- { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy461); }
break;
case 41: /* sysinfo_opt ::= */
- { yymsp[1].minor.yy695 = 1; }
+ { yymsp[1].minor.yy107 = 1; }
break;
case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
- { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy525, &yymsp[-3].minor.yy1041, &yymsp[0].minor.yy401, yymsp[-2].minor.yy248); }
+ { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy145, &yymsp[-3].minor.yy517, &yymsp[0].minor.yy461, yymsp[-2].minor.yy724); }
break;
case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
- { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy525, &yymsp[-3].minor.yy1041, &yymsp[0].minor.yy401, yymsp[-2].minor.yy248); }
+ { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy145, &yymsp[-3].minor.yy517, &yymsp[0].minor.yy461, yymsp[-2].minor.yy724); }
break;
case 45: /* privileges ::= ALL */
- { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_ALL; }
+ { yymsp[0].minor.yy145 = PRIVILEGE_TYPE_ALL; }
break;
case 46: /* privileges ::= priv_type_list */
case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48);
- { yylhsminor.yy525 = yymsp[0].minor.yy525; }
- yymsp[0].minor.yy525 = yylhsminor.yy525;
+ { yylhsminor.yy145 = yymsp[0].minor.yy145; }
+ yymsp[0].minor.yy145 = yylhsminor.yy145;
break;
case 47: /* privileges ::= SUBSCRIBE */
- { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_SUBSCRIBE; }
+ { yymsp[0].minor.yy145 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
- { yylhsminor.yy525 = yymsp[-2].minor.yy525 | yymsp[0].minor.yy525; }
- yymsp[-2].minor.yy525 = yylhsminor.yy525;
+ { yylhsminor.yy145 = yymsp[-2].minor.yy145 | yymsp[0].minor.yy145; }
+ yymsp[-2].minor.yy145 = yylhsminor.yy145;
break;
case 50: /* priv_type ::= READ */
- { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_READ; }
+ { yymsp[0].minor.yy145 = PRIVILEGE_TYPE_READ; }
break;
case 51: /* priv_type ::= WRITE */
- { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_WRITE; }
+ { yymsp[0].minor.yy145 = PRIVILEGE_TYPE_WRITE; }
break;
case 52: /* priv_type ::= ALTER */
- { yymsp[0].minor.yy525 = PRIVILEGE_TYPE_ALTER; }
+ { yymsp[0].minor.yy145 = PRIVILEGE_TYPE_ALTER; }
break;
case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
- { yylhsminor.yy1041.first = yymsp[-2].minor.yy0; yylhsminor.yy1041.second = yymsp[0].minor.yy0; }
- yymsp[-2].minor.yy1041 = yylhsminor.yy1041;
+ { yylhsminor.yy517.first = yymsp[-2].minor.yy0; yylhsminor.yy517.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy517 = yylhsminor.yy517;
break;
case 54: /* priv_level ::= db_name NK_DOT NK_STAR */
- { yylhsminor.yy1041.first = yymsp[-2].minor.yy401; yylhsminor.yy1041.second = yymsp[0].minor.yy0; }
- yymsp[-2].minor.yy1041 = yylhsminor.yy1041;
+ { yylhsminor.yy517.first = yymsp[-2].minor.yy461; yylhsminor.yy517.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy517 = yylhsminor.yy517;
break;
case 55: /* priv_level ::= db_name NK_DOT table_name */
- { yylhsminor.yy1041.first = yymsp[-2].minor.yy401; yylhsminor.yy1041.second = yymsp[0].minor.yy401; }
- yymsp[-2].minor.yy1041 = yylhsminor.yy1041;
+ { yylhsminor.yy517.first = yymsp[-2].minor.yy461; yylhsminor.yy517.second = yymsp[0].minor.yy461; }
+ yymsp[-2].minor.yy517 = yylhsminor.yy517;
break;
case 56: /* priv_level ::= topic_name */
- { yylhsminor.yy1041.first = yymsp[0].minor.yy401; yylhsminor.yy1041.second = nil_token; }
- yymsp[0].minor.yy1041 = yylhsminor.yy1041;
+ { yylhsminor.yy517.first = yymsp[0].minor.yy461; yylhsminor.yy517.second = nil_token; }
+ yymsp[0].minor.yy517 = yylhsminor.yy517;
break;
case 57: /* with_opt ::= */
case 173: /* start_opt ::= */ yytestcase(yyruleno==173);
case 177: /* end_opt ::= */ yytestcase(yyruleno==177);
case 330: /* like_pattern_opt ::= */ yytestcase(yyruleno==330);
case 427: /* subtable_opt ::= */ yytestcase(yyruleno==427);
- case 611: /* case_when_else_opt ::= */ yytestcase(yyruleno==611);
- case 641: /* from_clause_opt ::= */ yytestcase(yyruleno==641);
- case 668: /* join_on_clause_opt ::= */ yytestcase(yyruleno==668);
- case 670: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==670);
- case 674: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==674);
- case 691: /* where_clause_opt ::= */ yytestcase(yyruleno==691);
- case 700: /* twindow_clause_opt ::= */ yytestcase(yyruleno==700);
- case 708: /* sliding_opt ::= */ yytestcase(yyruleno==708);
- case 713: /* fill_opt ::= */ yytestcase(yyruleno==713);
- case 727: /* having_clause_opt ::= */ yytestcase(yyruleno==727);
- case 729: /* range_opt ::= */ yytestcase(yyruleno==729);
- case 732: /* every_opt ::= */ yytestcase(yyruleno==732);
- case 745: /* slimit_clause_opt ::= */ yytestcase(yyruleno==745);
- case 749: /* limit_clause_opt ::= */ yytestcase(yyruleno==749);
- { yymsp[1].minor.yy248 = NULL; }
+ case 614: /* case_when_else_opt ::= */ yytestcase(yyruleno==614);
+ case 644: /* from_clause_opt ::= */ yytestcase(yyruleno==644);
+ case 671: /* join_on_clause_opt ::= */ yytestcase(yyruleno==671);
+ case 673: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==673);
+ case 677: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==677);
+ case 694: /* where_clause_opt ::= */ yytestcase(yyruleno==694);
+ case 703: /* twindow_clause_opt ::= */ yytestcase(yyruleno==703);
+ case 711: /* sliding_opt ::= */ yytestcase(yyruleno==711);
+ case 716: /* fill_opt ::= */ yytestcase(yyruleno==716);
+ case 730: /* having_clause_opt ::= */ yytestcase(yyruleno==730);
+ case 732: /* range_opt ::= */ yytestcase(yyruleno==732);
+ case 735: /* every_opt ::= */ yytestcase(yyruleno==735);
+ case 748: /* slimit_clause_opt ::= */ yytestcase(yyruleno==748);
+ case 752: /* limit_clause_opt ::= */ yytestcase(yyruleno==752);
+ { yymsp[1].minor.yy724 = NULL; }
break;
case 58: /* with_opt ::= WITH search_condition */
- case 642: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==642);
- case 669: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==669);
- case 692: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==692);
- case 728: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==728);
- { yymsp[-1].minor.yy248 = yymsp[0].minor.yy248; }
+ case 645: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==645);
+ case 672: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==672);
+ case 695: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==695);
+ case 731: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==731);
+ { yymsp[-1].minor.yy724 = yymsp[0].minor.yy724; }
break;
case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */
{ pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 60: /* cmd ::= CREATE DNODE dnode_endpoint */
- { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy401, NULL); }
+ { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy461, NULL); }
break;
case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0); }
+ { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy0); }
break;
case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
- { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy89, false); }
+ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy429, false); }
break;
case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
- { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy89, false); }
+ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy461, yymsp[0].minor.yy429, false); }
break;
case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
- { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy89); }
+ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy429); }
break;
case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
- { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy401, false, yymsp[0].minor.yy89); }
+ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy461, false, yymsp[0].minor.yy429); }
break;
case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -6084,24 +6171,24 @@ static YYACTIONTYPE yy_reduce(
case 526: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==526);
case 527: /* index_name ::= NK_ID */ yytestcase(yyruleno==527);
case 528: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==528);
- case 581: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==581);
- case 582: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==582);
- case 586: /* noarg_func ::= NOW */ yytestcase(yyruleno==586);
- case 587: /* noarg_func ::= TODAY */ yytestcase(yyruleno==587);
- case 588: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==588);
- case 589: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==589);
- case 590: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==590);
- case 591: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==591);
- case 592: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==592);
- case 593: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==593);
- case 594: /* noarg_func ::= USER */ yytestcase(yyruleno==594);
- case 595: /* noarg_func ::= PI */ yytestcase(yyruleno==595);
- case 596: /* star_func ::= COUNT */ yytestcase(yyruleno==596);
- case 597: /* star_func ::= FIRST */ yytestcase(yyruleno==597);
- case 598: /* star_func ::= LAST */ yytestcase(yyruleno==598);
- case 599: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==599);
- { yylhsminor.yy401 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy401 = yylhsminor.yy401;
+ case 584: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==584);
+ case 585: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==585);
+ case 589: /* noarg_func ::= NOW */ yytestcase(yyruleno==589);
+ case 590: /* noarg_func ::= TODAY */ yytestcase(yyruleno==590);
+ case 591: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==591);
+ case 592: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==592);
+ case 593: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==593);
+ case 594: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==594);
+ case 595: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==595);
+ case 596: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==596);
+ case 597: /* noarg_func ::= USER */ yytestcase(yyruleno==597);
+ case 598: /* noarg_func ::= PI */ yytestcase(yyruleno==598);
+ case 599: /* star_func ::= COUNT */ yytestcase(yyruleno==599);
+ case 600: /* star_func ::= FIRST */ yytestcase(yyruleno==600);
+ case 601: /* star_func ::= LAST */ yytestcase(yyruleno==601);
+ case 602: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==602);
+ { yylhsminor.yy461 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy461 = yylhsminor.yy461;
break;
case 74: /* force_opt ::= */
case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101);
@@ -6110,17 +6197,17 @@ static YYACTIONTYPE yy_reduce(
case 392: /* agg_func_opt ::= */ yytestcase(yyruleno==392);
case 398: /* or_replace_opt ::= */ yytestcase(yyruleno==398);
case 429: /* ignore_opt ::= */ yytestcase(yyruleno==429);
- case 679: /* tag_mode_opt ::= */ yytestcase(yyruleno==679);
- case 681: /* set_quantifier_opt ::= */ yytestcase(yyruleno==681);
- { yymsp[1].minor.yy89 = false; }
+ case 682: /* tag_mode_opt ::= */ yytestcase(yyruleno==682);
+ case 684: /* set_quantifier_opt ::= */ yytestcase(yyruleno==684);
+ { yymsp[1].minor.yy429 = false; }
break;
case 75: /* force_opt ::= FORCE */
case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76);
case 386: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==386);
case 393: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==393);
- case 680: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==680);
- case 682: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==682);
- { yymsp[0].minor.yy89 = true; }
+ case 683: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==683);
+ case 685: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==685);
+ { yymsp[0].minor.yy429 = true; }
break;
case 77: /* cmd ::= ALTER CLUSTER NK_STRING */
{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -6168,271 +6255,271 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); }
break;
case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy89, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy429, &yymsp[-1].minor.yy461, yymsp[0].minor.yy724); }
break;
case 93: /* cmd ::= DROP DATABASE exists_opt db_name */
- { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy429, &yymsp[0].minor.yy461); }
break;
case 94: /* cmd ::= USE db_name */
- { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy461); }
break;
case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */
- { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy461, yymsp[0].minor.yy724); }
break;
case 96: /* cmd ::= FLUSH DATABASE db_name */
- { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy461); }
break;
case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */
- { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy604); }
+ { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy461, yymsp[0].minor.yy696); }
break;
case 98: /* cmd ::= S3MIGRATE DATABASE db_name */
- { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy461); }
break;
case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
- { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy401, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy461, yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
break;
case 100: /* not_exists_opt ::= IF NOT EXISTS */
- { yymsp[-2].minor.yy89 = true; }
+ { yymsp[-2].minor.yy429 = true; }
break;
case 102: /* exists_opt ::= IF EXISTS */
case 399: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==399);
case 430: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==430);
- { yymsp[-1].minor.yy89 = true; }
+ { yymsp[-1].minor.yy429 = true; }
break;
case 104: /* db_options ::= */
- { yymsp[1].minor.yy248 = createDefaultDatabaseOptions(pCxt); }
+ { yymsp[1].minor.yy724 = createDefaultDatabaseOptions(pCxt); }
break;
case 105: /* db_options ::= db_options BUFFER NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 108: /* db_options ::= db_options COMP NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 109: /* db_options ::= db_options DURATION NK_INTEGER */
case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110);
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 112: /* db_options ::= db_options MINROWS NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 113: /* db_options ::= db_options KEEP integer_list */
case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114);
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_KEEP, yymsp[0].minor.yy928); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_KEEP, yymsp[0].minor.yy712); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 115: /* db_options ::= db_options PAGES NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 118: /* db_options ::= db_options PRECISION NK_STRING */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 119: /* db_options ::= db_options REPLICA NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 122: /* db_options ::= db_options RETENTIONS retention_list */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_RETENTIONS, yymsp[0].minor.yy928); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_RETENTIONS, yymsp[0].minor.yy712); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 127: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-3].minor.yy248, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-3].minor.yy724, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 129: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-3].minor.yy248, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-3].minor.yy724, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 133: /* db_options ::= db_options TABLE_PREFIX signed */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy248); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy724); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 134: /* db_options ::= db_options TABLE_SUFFIX signed */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy248); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy724); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137);
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
- { yylhsminor.yy248 = setDatabaseOption(pCxt, yymsp[-2].minor.yy248, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setDatabaseOption(pCxt, yymsp[-2].minor.yy724, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 141: /* alter_db_options ::= alter_db_option */
- { yylhsminor.yy248 = createAlterDatabaseOptions(pCxt); yylhsminor.yy248 = setAlterDatabaseOption(pCxt, yylhsminor.yy248, &yymsp[0].minor.yy677); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterDatabaseOptions(pCxt); yylhsminor.yy724 = setAlterDatabaseOption(pCxt, yylhsminor.yy724, &yymsp[0].minor.yy533); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 142: /* alter_db_options ::= alter_db_options alter_db_option */
- { yylhsminor.yy248 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy248, &yymsp[0].minor.yy677); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy724, &yymsp[0].minor.yy533); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 143: /* alter_db_option ::= BUFFER NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */
- { yymsp[-1].minor.yy677.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 147: /* alter_db_option ::= KEEP integer_list */
case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148);
- { yymsp[-1].minor.yy677.type = DB_OPTION_KEEP; yymsp[-1].minor.yy677.pList = yymsp[0].minor.yy928; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_KEEP; yymsp[-1].minor.yy533.pList = yymsp[0].minor.yy712; }
break;
case 149: /* alter_db_option ::= PAGES NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_PAGES; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_PAGES; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 150: /* alter_db_option ::= REPLICA NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_WAL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_WAL; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 153: /* alter_db_option ::= MINROWS NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 155: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy677.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy677.val = t;
+ yymsp[-2].minor.yy533.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy533.val = t;
}
break;
case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 157: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy677.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy677.val = t;
+ yymsp[-2].minor.yy533.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy533.val = t;
}
break;
case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159);
- { yymsp[-1].minor.yy677.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
- { yymsp[-1].minor.yy677.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
- { yymsp[-1].minor.yy677.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 163: /* integer_list ::= NK_INTEGER */
- { yylhsminor.yy928 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
case 444: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==444);
- { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy712 = yylhsminor.yy712;
break;
case 165: /* variable_list ::= NK_VARIABLE */
- { yylhsminor.yy928 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy712 = yylhsminor.yy712;
break;
case 167: /* retention_list ::= retention */
case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200);
@@ -6446,13 +6533,13 @@ static YYACTIONTYPE yy_reduce(
case 410: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==410);
case 488: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==488);
case 513: /* literal_list ::= signed_literal */ yytestcase(yyruleno==513);
- case 602: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==602);
- case 608: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==608);
- case 684: /* select_list ::= select_item */ yytestcase(yyruleno==684);
- case 695: /* partition_list ::= partition_item */ yytestcase(yyruleno==695);
- case 756: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==756);
- { yylhsminor.yy928 = createNodeList(pCxt, yymsp[0].minor.yy248); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ case 605: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==605);
+ case 611: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==611);
+ case 687: /* select_list ::= select_item */ yytestcase(yyruleno==687);
+ case 698: /* partition_list ::= partition_item */ yytestcase(yyruleno==698);
+ case 759: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==759);
+ { yylhsminor.yy712 = createNodeList(pCxt, yymsp[0].minor.yy724); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
case 168: /* retention_list ::= retention_list NK_COMMA retention */
case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204);
@@ -6465,296 +6552,296 @@ static YYACTIONTYPE yy_reduce(
case 411: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==411);
case 489: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==489);
case 514: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==514);
- case 603: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==603);
- case 685: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==685);
- case 696: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==696);
- case 757: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==757);
- { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, yymsp[0].minor.yy248); }
- yymsp[-2].minor.yy928 = yylhsminor.yy928;
+ case 606: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==606);
+ case 688: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==688);
+ case 699: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==699);
+ case 760: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==760);
+ { yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, yymsp[0].minor.yy724); }
+ yymsp[-2].minor.yy712 = yylhsminor.yy712;
break;
case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170);
- { yylhsminor.yy248 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 171: /* speed_opt ::= */
case 394: /* bufsize_opt ::= */ yytestcase(yyruleno==394);
- { yymsp[1].minor.yy604 = 0; }
+ { yymsp[1].minor.yy696 = 0; }
break;
case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */
case 395: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==395);
- { yymsp[-1].minor.yy604 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+ { yymsp[-1].minor.yy696 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 174: /* start_opt ::= START WITH NK_INTEGER */
case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178);
- { yymsp[-2].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
+ { yymsp[-2].minor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
break;
case 175: /* start_opt ::= START WITH NK_STRING */
case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179);
- { yymsp[-2].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ { yymsp[-2].minor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180);
- { yymsp[-3].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ { yymsp[-3].minor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184);
- { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy89, yymsp[-5].minor.yy248, yymsp[-3].minor.yy928, yymsp[-1].minor.yy928, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy429, yymsp[-5].minor.yy724, yymsp[-3].minor.yy712, yymsp[-1].minor.yy712, yymsp[0].minor.yy724); }
break;
case 182: /* cmd ::= CREATE TABLE multi_create_clause */
- { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy928); }
+ { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy712); }
break;
case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
- { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy89, yymsp[-5].minor.yy248, yymsp[-3].minor.yy928, &yymsp[0].minor.yy0); }
+ { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy429, yymsp[-5].minor.yy724, yymsp[-3].minor.yy712, &yymsp[0].minor.yy0); }
break;
case 185: /* cmd ::= DROP TABLE multi_drop_clause */
- { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy928); }
+ { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy712); }
break;
case 186: /* cmd ::= DROP STABLE exists_opt full_table_name */
- { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy429, yymsp[0].minor.yy724); }
break;
case 187: /* cmd ::= ALTER TABLE alter_table_clause */
case 446: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==446);
case 447: /* cmd ::= insert_query */ yytestcase(yyruleno==447);
- { pCxt->pRootNode = yymsp[0].minor.yy248; }
+ { pCxt->pRootNode = yymsp[0].minor.yy724; }
break;
case 188: /* cmd ::= ALTER STABLE alter_table_clause */
- { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy724); }
break;
case 189: /* alter_table_clause ::= full_table_name alter_table_options */
- { yylhsminor.yy248 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
- { yylhsminor.yy248 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy248, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy401, yymsp[-1].minor.yy976, yymsp[0].minor.yy248); }
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy724, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy461, yymsp[-1].minor.yy1016, yymsp[0].minor.yy724); }
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
- { yylhsminor.yy248 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy248, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy401); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy724, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy461); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- { yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy724, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy461, yymsp[0].minor.yy1016); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
- { yylhsminor.yy248 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy401, yymsp[0].minor.yy248); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy724, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy461, yymsp[0].minor.yy724); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- { yylhsminor.yy248 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy724, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy461, &yymsp[0].minor.yy461); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- { yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy724, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy461, yymsp[0].minor.yy1016); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */
- { yylhsminor.yy248 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy248, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy401); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy724, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy461); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- { yylhsminor.yy248 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy724, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy461, yymsp[0].minor.yy1016); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- { yylhsminor.yy248 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy248, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy724, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy461, &yymsp[0].minor.yy461); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
- { yylhsminor.yy248 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy248, &yymsp[-2].minor.yy401, yymsp[0].minor.yy248); }
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy724, &yymsp[-2].minor.yy461, yymsp[0].minor.yy724); }
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
- case 609: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==609);
- { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-1].minor.yy928, yymsp[0].minor.yy248); }
- yymsp[-1].minor.yy928 = yylhsminor.yy928;
+ case 612: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==612);
+ { yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy724); }
+ yymsp[-1].minor.yy712 = yylhsminor.yy712;
break;
case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
- { yylhsminor.yy248 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy89, yymsp[-8].minor.yy248, yymsp[-6].minor.yy248, yymsp[-5].minor.yy928, yymsp[-2].minor.yy928, yymsp[0].minor.yy248); }
- yymsp[-9].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy429, yymsp[-8].minor.yy724, yymsp[-6].minor.yy724, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712, yymsp[0].minor.yy724); }
+ yymsp[-9].minor.yy724 = yylhsminor.yy724;
break;
case 205: /* drop_table_clause ::= exists_opt full_table_name */
- { yylhsminor.yy248 = createDropTableClause(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createDropTableClause(pCxt, yymsp[-1].minor.yy429, yymsp[0].minor.yy724); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 207: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
case 409: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==409);
- { yymsp[-2].minor.yy928 = yymsp[-1].minor.yy928; }
+ { yymsp[-2].minor.yy712 = yymsp[-1].minor.yy712; }
break;
case 208: /* full_table_name ::= table_name */
case 350: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==350);
- { yylhsminor.yy248 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy401, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy461, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 209: /* full_table_name ::= db_name NK_DOT table_name */
case 351: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==351);
- { yylhsminor.yy248 = createRealTableNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401, NULL); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRealTableNode(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy461, NULL); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 212: /* tag_def ::= column_name type_name */
- { yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy401, yymsp[0].minor.yy976, NULL); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy461, yymsp[0].minor.yy1016, NULL); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 215: /* column_def ::= column_name type_name column_options */
- { yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy401, yymsp[-1].minor.yy976, yymsp[0].minor.yy248); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy461, yymsp[-1].minor.yy1016, yymsp[0].minor.yy724); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 216: /* type_name ::= BOOL */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_BOOL); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 217: /* type_name ::= TINYINT */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 218: /* type_name ::= SMALLINT */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 219: /* type_name ::= INT */
case 220: /* type_name ::= INTEGER */ yytestcase(yyruleno==220);
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_INT); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 221: /* type_name ::= BIGINT */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 222: /* type_name ::= FLOAT */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 223: /* type_name ::= DOUBLE */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 224: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+ { yymsp[-3].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 225: /* type_name ::= TIMESTAMP */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 226: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+ { yymsp[-3].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 227: /* type_name ::= TINYINT UNSIGNED */
- { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+ { yymsp[-1].minor.yy1016 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 228: /* type_name ::= SMALLINT UNSIGNED */
- { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+ { yymsp[-1].minor.yy1016 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 229: /* type_name ::= INT UNSIGNED */
- { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_UINT); }
+ { yymsp[-1].minor.yy1016 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 230: /* type_name ::= BIGINT UNSIGNED */
- { yymsp[-1].minor.yy976 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+ { yymsp[-1].minor.yy1016 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 231: /* type_name ::= JSON */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_JSON); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 232: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+ { yymsp[-3].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 233: /* type_name ::= MEDIUMBLOB */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 234: /* type_name ::= BLOB */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_BLOB); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 235: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+ { yymsp[-3].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 236: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
- { yymsp[-3].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
+ { yymsp[-3].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
break;
case 237: /* type_name ::= DECIMAL */
- { yymsp[0].minor.yy976 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ { yymsp[0].minor.yy1016 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- { yymsp[-3].minor.yy976 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ { yymsp[-3].minor.yy1016 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { yymsp[-5].minor.yy976 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ { yymsp[-5].minor.yy1016 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 240: /* type_name_default_len ::= BINARY */
- { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); }
+ { yymsp[0].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); }
break;
case 241: /* type_name_default_len ::= NCHAR */
- { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); }
+ { yymsp[0].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); }
break;
case 242: /* type_name_default_len ::= VARCHAR */
- { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); }
+ { yymsp[0].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); }
break;
case 243: /* type_name_default_len ::= VARBINARY */
- { yymsp[0].minor.yy976 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); }
+ { yymsp[0].minor.yy1016 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); }
break;
case 246: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */
case 417: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417);
- { yymsp[-3].minor.yy928 = yymsp[-1].minor.yy928; }
+ { yymsp[-3].minor.yy712 = yymsp[-1].minor.yy712; }
break;
case 247: /* table_options ::= */
- { yymsp[1].minor.yy248 = createDefaultTableOptions(pCxt); }
+ { yymsp[1].minor.yy724 = createDefaultTableOptions(pCxt); }
break;
case 248: /* table_options ::= table_options COMMENT NK_STRING */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-2].minor.yy724, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 249: /* table_options ::= table_options MAX_DELAY duration_list */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy928); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-2].minor.yy724, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy712); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 250: /* table_options ::= table_options WATERMARK duration_list */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy928); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-2].minor.yy724, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy712); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 251: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-4].minor.yy248, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy928); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-4].minor.yy724, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy712); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 252: /* table_options ::= table_options TTL NK_INTEGER */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-2].minor.yy724, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 253: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-4].minor.yy248, TABLE_OPTION_SMA, yymsp[-1].minor.yy928); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-4].minor.yy724, TABLE_OPTION_SMA, yymsp[-1].minor.yy712); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
case 254: /* table_options ::= table_options DELETE_MARK duration_list */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-2].minor.yy248, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy928); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-2].minor.yy724, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy712); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 255: /* alter_table_options ::= alter_table_option */
- { yylhsminor.yy248 = createAlterTableOptions(pCxt); yylhsminor.yy248 = setTableOption(pCxt, yylhsminor.yy248, yymsp[0].minor.yy677.type, &yymsp[0].minor.yy677.val); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createAlterTableOptions(pCxt); yylhsminor.yy724 = setTableOption(pCxt, yylhsminor.yy724, yymsp[0].minor.yy533.type, &yymsp[0].minor.yy533.val); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 256: /* alter_table_options ::= alter_table_options alter_table_option */
- { yylhsminor.yy248 = setTableOption(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy677.type, &yymsp[0].minor.yy677.val); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setTableOption(pCxt, yymsp[-1].minor.yy724, yymsp[0].minor.yy533.type, &yymsp[0].minor.yy533.val); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 257: /* alter_table_option ::= COMMENT NK_STRING */
- { yymsp[-1].minor.yy677.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 258: /* alter_table_option ::= TTL NK_INTEGER */
- { yymsp[-1].minor.yy677.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy677.val = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy533.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy533.val = yymsp[0].minor.yy0; }
break;
case 259: /* duration_list ::= duration_literal */
case 546: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==546);
- { yylhsminor.yy928 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy724)); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
case 260: /* duration_list ::= duration_list NK_COMMA duration_literal */
case 547: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==547);
- { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); }
- yymsp[-2].minor.yy928 = yylhsminor.yy928;
+ { yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, releaseRawExprNode(pCxt, yymsp[0].minor.yy724)); }
+ yymsp[-2].minor.yy712 = yylhsminor.yy712;
break;
case 263: /* rollup_func_name ::= function_name */
- { yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[0].minor.yy401, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createFunctionNode(pCxt, &yymsp[0].minor.yy461, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 264: /* rollup_func_name ::= FIRST */
case 265: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==265);
case 339: /* tag_item ::= QTAGS */ yytestcase(yyruleno==339);
- { yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 268: /* col_name ::= column_name */
case 340: /* tag_item ::= column_name */ yytestcase(yyruleno==340);
- { yylhsminor.yy248 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy401); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy461); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 269: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
@@ -6771,19 +6858,19 @@ static YYACTIONTYPE yy_reduce(
case 273: /* cmd ::= SHOW db_kind_opt DATABASES */
{
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
- (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy1042);
+ (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy973);
}
break;
case 274: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
{
- pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy373, yymsp[0].minor.yy248, OP_TYPE_LIKE);
+ pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy801, yymsp[0].minor.yy724, OP_TYPE_LIKE);
}
break;
case 275: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, OP_TYPE_LIKE); }
+ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy724, yymsp[0].minor.yy724, OP_TYPE_LIKE); }
break;
case 276: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
- { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy248, NULL, OP_TYPE_LIKE); }
+ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy724, NULL, OP_TYPE_LIKE); }
break;
case 277: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
@@ -6798,10 +6885,10 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
case 281: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy248, yymsp[-1].minor.yy248, OP_TYPE_EQUAL); }
+ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy724, yymsp[-1].minor.yy724, OP_TYPE_EQUAL); }
break;
case 282: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
- { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy401), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401), OP_TYPE_EQUAL); }
+ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy461), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy461), OP_TYPE_EQUAL); }
break;
case 283: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
@@ -6829,14 +6916,14 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); }
break;
case 292: /* cmd ::= SHOW CREATE DATABASE db_name */
- { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy461); }
break;
case 293: /* cmd ::= SHOW CREATE TABLE full_table_name */
- { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy724); }
break;
case 294: /* cmd ::= SHOW CREATE STABLE full_table_name */
{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT,
- yymsp[0].minor.yy248); }
+ yymsp[0].minor.yy724); }
break;
case 295: /* cmd ::= SHOW ENCRYPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); }
@@ -6858,7 +6945,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
case 302: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy724); }
break;
case 303: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
@@ -6873,7 +6960,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
case 307: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy724); }
break;
case 308: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
@@ -6882,16 +6969,16 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
case 310: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy248, yymsp[-1].minor.yy248, OP_TYPE_EQUAL); }
+ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy724, yymsp[-1].minor.yy724, OP_TYPE_EQUAL); }
break;
case 311: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
- { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy401), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401), OP_TYPE_EQUAL); }
+ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy461), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy461), OP_TYPE_EQUAL); }
break;
case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248, yymsp[-3].minor.yy928); }
+ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy724, yymsp[0].minor.yy724, yymsp[-3].minor.yy712); }
break;
case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
- { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy401), yymsp[-4].minor.yy928); }
+ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy461), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy461), yymsp[-4].minor.yy712); }
break;
case 314: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
@@ -6900,16 +6987,16 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); }
break;
case 316: /* cmd ::= SHOW db_name_cond_opt ALIVE */
- { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy248, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
+ { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy724, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
break;
case 317: /* cmd ::= SHOW CLUSTER ALIVE */
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
break;
case 318: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
- { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, OP_TYPE_LIKE); }
+ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy724, yymsp[0].minor.yy724, OP_TYPE_LIKE); }
break;
case 319: /* cmd ::= SHOW CREATE VIEW full_table_name */
- { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy724); }
break;
case 320: /* cmd ::= SHOW COMPACTS */
{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
@@ -6918,260 +7005,260 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
case 322: /* table_kind_db_name_cond_opt ::= */
- { yymsp[1].minor.yy373.kind = SHOW_KIND_ALL; yymsp[1].minor.yy373.dbName = nil_token; }
+ { yymsp[1].minor.yy801.kind = SHOW_KIND_ALL; yymsp[1].minor.yy801.dbName = nil_token; }
break;
case 323: /* table_kind_db_name_cond_opt ::= table_kind */
- { yylhsminor.yy373.kind = yymsp[0].minor.yy1042; yylhsminor.yy373.dbName = nil_token; }
- yymsp[0].minor.yy373 = yylhsminor.yy373;
+ { yylhsminor.yy801.kind = yymsp[0].minor.yy973; yylhsminor.yy801.dbName = nil_token; }
+ yymsp[0].minor.yy801 = yylhsminor.yy801;
break;
case 324: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */
- { yylhsminor.yy373.kind = SHOW_KIND_ALL; yylhsminor.yy373.dbName = yymsp[-1].minor.yy401; }
- yymsp[-1].minor.yy373 = yylhsminor.yy373;
+ { yylhsminor.yy801.kind = SHOW_KIND_ALL; yylhsminor.yy801.dbName = yymsp[-1].minor.yy461; }
+ yymsp[-1].minor.yy801 = yylhsminor.yy801;
break;
case 325: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
- { yylhsminor.yy373.kind = yymsp[-2].minor.yy1042; yylhsminor.yy373.dbName = yymsp[-1].minor.yy401; }
- yymsp[-2].minor.yy373 = yylhsminor.yy373;
+ { yylhsminor.yy801.kind = yymsp[-2].minor.yy973; yylhsminor.yy801.dbName = yymsp[-1].minor.yy461; }
+ yymsp[-2].minor.yy801 = yylhsminor.yy801;
break;
case 326: /* table_kind ::= NORMAL */
- { yymsp[0].minor.yy1042 = SHOW_KIND_TABLES_NORMAL; }
+ { yymsp[0].minor.yy973 = SHOW_KIND_TABLES_NORMAL; }
break;
case 327: /* table_kind ::= CHILD */
- { yymsp[0].minor.yy1042 = SHOW_KIND_TABLES_CHILD; }
+ { yymsp[0].minor.yy973 = SHOW_KIND_TABLES_CHILD; }
break;
case 328: /* db_name_cond_opt ::= */
case 333: /* from_db_opt ::= */ yytestcase(yyruleno==333);
- { yymsp[1].minor.yy248 = createDefaultDatabaseCondValue(pCxt); }
+ { yymsp[1].minor.yy724 = createDefaultDatabaseCondValue(pCxt); }
break;
case 329: /* db_name_cond_opt ::= db_name NK_DOT */
- { yylhsminor.yy248 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy401); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy461); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 331: /* like_pattern_opt ::= LIKE NK_STRING */
- { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ { yymsp[-1].minor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
case 332: /* table_name_cond ::= table_name */
- { yylhsminor.yy248 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy461); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 334: /* from_db_opt ::= FROM db_name */
- { yymsp[-1].minor.yy248 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy401); }
+ { yymsp[-1].minor.yy724 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy461); }
break;
case 338: /* tag_item ::= TBNAME */
- { yylhsminor.yy248 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 341: /* tag_item ::= column_name column_alias */
- { yylhsminor.yy248 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy401), &yymsp[0].minor.yy401); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy461), &yymsp[0].minor.yy461); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 342: /* tag_item ::= column_name AS column_alias */
- { yylhsminor.yy248 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy401), &yymsp[0].minor.yy401); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy461), &yymsp[0].minor.yy461); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 343: /* db_kind_opt ::= */
- { yymsp[1].minor.yy1042 = SHOW_KIND_ALL; }
+ { yymsp[1].minor.yy973 = SHOW_KIND_ALL; }
break;
case 344: /* db_kind_opt ::= USER */
- { yymsp[0].minor.yy1042 = SHOW_KIND_DATABASES_USER; }
+ { yymsp[0].minor.yy973 = SHOW_KIND_DATABASES_USER; }
break;
case 345: /* db_kind_opt ::= SYSTEM */
- { yymsp[0].minor.yy1042 = SHOW_KIND_DATABASES_SYSTEM; }
+ { yymsp[0].minor.yy973 = SHOW_KIND_DATABASES_SYSTEM; }
break;
case 346: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
- { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy89, &yymsp[-7].minor.yy401, yymsp[-4].minor.yy248, yymsp[-5].minor.yy248, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
+ { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy429, &yymsp[-7].minor.yy461, yymsp[-4].minor.yy724, yymsp[-5].minor.yy724, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
break;
case 347: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
- { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy89, &yymsp[-6].minor.yy401, NULL, yymsp[-4].minor.yy248, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
+ { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy429, &yymsp[-6].minor.yy461, NULL, yymsp[-4].minor.yy724, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
break;
case 348: /* cmd ::= DROP TSMA exists_opt full_tsma_name */
- { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy429, yymsp[0].minor.yy724); }
break;
case 349: /* cmd ::= SHOW db_name_cond_opt TSMAS */
- { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy248); }
+ { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy724); }
break;
case 352: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
- { yymsp[-3].minor.yy248 = createTSMAOptions(pCxt, yymsp[-1].minor.yy928); }
+ { yymsp[-3].minor.yy724 = createTSMAOptions(pCxt, yymsp[-1].minor.yy712); }
break;
case 353: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
- { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy89, yymsp[-3].minor.yy248, yymsp[-1].minor.yy248, NULL, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy429, yymsp[-3].minor.yy724, yymsp[-1].minor.yy724, NULL, yymsp[0].minor.yy724); }
break;
case 354: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
- { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy89, yymsp[-5].minor.yy248, yymsp[-3].minor.yy248, yymsp[-1].minor.yy928, NULL); }
+ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy429, yymsp[-5].minor.yy724, yymsp[-3].minor.yy724, yymsp[-1].minor.yy712, NULL); }
break;
case 355: /* cmd ::= DROP INDEX exists_opt full_index_name */
- { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy429, yymsp[0].minor.yy724); }
break;
case 356: /* full_index_name ::= index_name */
- { yylhsminor.yy248 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy401); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy461); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 357: /* full_index_name ::= db_name NK_DOT index_name */
- { yylhsminor.yy248 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy461); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 358: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- { yymsp[-9].minor.yy248 = createIndexOption(pCxt, yymsp[-7].minor.yy928, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
+ { yymsp[-9].minor.yy724 = createIndexOption(pCxt, yymsp[-7].minor.yy712, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), NULL, yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
break;
case 359: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
- { yymsp[-11].minor.yy248 = createIndexOption(pCxt, yymsp[-9].minor.yy928, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
+ { yymsp[-11].minor.yy724 = createIndexOption(pCxt, yymsp[-9].minor.yy712, releaseRawExprNode(pCxt, yymsp[-5].minor.yy724), releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
break;
case 362: /* func ::= sma_func_name NK_LP expression_list NK_RP */
- { yylhsminor.yy248 = createFunctionNode(pCxt, &yymsp[-3].minor.yy401, yymsp[-1].minor.yy928); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createFunctionNode(pCxt, &yymsp[-3].minor.yy461, yymsp[-1].minor.yy712); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 363: /* sma_func_name ::= function_name */
- case 652: /* alias_opt ::= table_alias */ yytestcase(yyruleno==652);
- { yylhsminor.yy401 = yymsp[0].minor.yy401; }
- yymsp[0].minor.yy401 = yylhsminor.yy401;
+ case 655: /* alias_opt ::= table_alias */ yytestcase(yyruleno==655);
+ { yylhsminor.yy461 = yymsp[0].minor.yy461; }
+ yymsp[0].minor.yy461 = yylhsminor.yy461;
break;
case 368: /* sma_stream_opt ::= */
case 418: /* stream_options ::= */ yytestcase(yyruleno==418);
- { yymsp[1].minor.yy248 = createStreamOptions(pCxt); }
+ { yymsp[1].minor.yy724 = createStreamOptions(pCxt); }
break;
case 369: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- { ((SStreamOptions*)yymsp[-2].minor.yy248)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { ((SStreamOptions*)yymsp[-2].minor.yy724)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy724); yylhsminor.yy724 = yymsp[-2].minor.yy724; }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 370: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- { ((SStreamOptions*)yymsp[-2].minor.yy248)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { ((SStreamOptions*)yymsp[-2].minor.yy724)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy724); yylhsminor.yy724 = yymsp[-2].minor.yy724; }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 371: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- { ((SStreamOptions*)yymsp[-2].minor.yy248)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); yylhsminor.yy248 = yymsp[-2].minor.yy248; }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { ((SStreamOptions*)yymsp[-2].minor.yy724)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy724); yylhsminor.yy724 = yymsp[-2].minor.yy724; }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 372: /* with_meta ::= AS */
- { yymsp[0].minor.yy604 = 0; }
+ { yymsp[0].minor.yy696 = 0; }
break;
case 373: /* with_meta ::= WITH META AS */
- { yymsp[-2].minor.yy604 = 1; }
+ { yymsp[-2].minor.yy696 = 1; }
break;
case 374: /* with_meta ::= ONLY META AS */
- { yymsp[-2].minor.yy604 = 2; }
+ { yymsp[-2].minor.yy696 = 2; }
break;
case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy401, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy429, &yymsp[-2].minor.yy461, yymsp[0].minor.yy724); }
break;
case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
- { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy401, &yymsp[0].minor.yy401, yymsp[-2].minor.yy604); }
+ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy429, &yymsp[-3].minor.yy461, &yymsp[0].minor.yy461, yymsp[-2].minor.yy696); }
break;
case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
- { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy89, &yymsp[-4].minor.yy401, yymsp[-1].minor.yy248, yymsp[-3].minor.yy604, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy429, &yymsp[-4].minor.yy461, yymsp[-1].minor.yy724, yymsp[-3].minor.yy696, yymsp[0].minor.yy724); }
break;
case 378: /* cmd ::= DROP TOPIC exists_opt topic_name */
- { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy429, &yymsp[0].minor.yy461); }
break;
case 379: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy429, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy461); }
break;
case 380: /* cmd ::= DESC full_table_name */
case 381: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==381);
- { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy724); }
break;
case 382: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
case 383: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
case 384: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==384);
- { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy89, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy429, yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
break;
case 387: /* explain_options ::= */
- { yymsp[1].minor.yy248 = createDefaultExplainOptions(pCxt); }
+ { yymsp[1].minor.yy724 = createDefaultExplainOptions(pCxt); }
break;
case 388: /* explain_options ::= explain_options VERBOSE NK_BOOL */
- { yylhsminor.yy248 = setExplainVerbose(pCxt, yymsp[-2].minor.yy248, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setExplainVerbose(pCxt, yymsp[-2].minor.yy724, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 389: /* explain_options ::= explain_options RATIO NK_FLOAT */
- { yylhsminor.yy248 = setExplainRatio(pCxt, yymsp[-2].minor.yy248, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setExplainRatio(pCxt, yymsp[-2].minor.yy724, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 390: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
- { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy89, yymsp[-9].minor.yy89, &yymsp[-6].minor.yy401, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy976, yymsp[-1].minor.yy604, &yymsp[0].minor.yy401, yymsp[-10].minor.yy89); }
+ { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy429, yymsp[-9].minor.yy429, &yymsp[-6].minor.yy461, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy1016, yymsp[-1].minor.yy696, &yymsp[0].minor.yy461, yymsp[-10].minor.yy429); }
break;
case 391: /* cmd ::= DROP FUNCTION exists_opt function_name */
- { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy429, &yymsp[0].minor.yy461); }
break;
case 396: /* language_opt ::= */
case 441: /* on_vgroup_id ::= */ yytestcase(yyruleno==441);
- { yymsp[1].minor.yy401 = nil_token; }
+ { yymsp[1].minor.yy461 = nil_token; }
break;
case 397: /* language_opt ::= LANGUAGE NK_STRING */
case 442: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==442);
- { yymsp[-1].minor.yy401 = yymsp[0].minor.yy0; }
+ { yymsp[-1].minor.yy461 = yymsp[0].minor.yy0; }
break;
case 400: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
- { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy89, yymsp[-2].minor.yy248, &yymsp[-1].minor.yy0, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy429, yymsp[-2].minor.yy724, &yymsp[-1].minor.yy0, yymsp[0].minor.yy724); }
break;
case 401: /* cmd ::= DROP VIEW exists_opt full_view_name */
- { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy429, yymsp[0].minor.yy724); }
break;
case 402: /* full_view_name ::= view_name */
- { yylhsminor.yy248 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy401); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy461); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 403: /* full_view_name ::= db_name NK_DOT view_name */
- { yylhsminor.yy248 = createViewNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createViewNode(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy461); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 404: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
- { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy89, &yymsp[-8].minor.yy401, yymsp[-5].minor.yy248, yymsp[-7].minor.yy248, yymsp[-3].minor.yy928, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, yymsp[-4].minor.yy928); }
+ { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy429, &yymsp[-8].minor.yy461, yymsp[-5].minor.yy724, yymsp[-7].minor.yy724, yymsp[-3].minor.yy712, yymsp[-2].minor.yy724, yymsp[0].minor.yy724, yymsp[-4].minor.yy712); }
break;
case 405: /* cmd ::= DROP STREAM exists_opt stream_name */
- { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy429, &yymsp[0].minor.yy461); }
break;
case 406: /* cmd ::= PAUSE STREAM exists_opt stream_name */
- { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy429, &yymsp[0].minor.yy461); }
break;
case 407: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
- { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy89, yymsp[-1].minor.yy89, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy429, yymsp[-1].minor.yy429, &yymsp[0].minor.yy461); }
break;
case 412: /* column_stream_def ::= column_name stream_col_options */
- { yylhsminor.yy248 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy401, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy248); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy461, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy724); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 413: /* stream_col_options ::= */
- case 765: /* column_options ::= */ yytestcase(yyruleno==765);
- { yymsp[1].minor.yy248 = createDefaultColumnOptions(pCxt); }
+ case 768: /* column_options ::= */ yytestcase(yyruleno==768);
+ { yymsp[1].minor.yy724 = createDefaultColumnOptions(pCxt); }
break;
case 414: /* stream_col_options ::= stream_col_options PRIMARY KEY */
- case 766: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==766);
- { yylhsminor.yy248 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy248); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 769: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==769);
+ { yylhsminor.yy724 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy724); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 419: /* stream_options ::= stream_options TRIGGER AT_ONCE */
case 420: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==420);
- { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setStreamOptions(pCxt, yymsp[-2].minor.yy724, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 421: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-3].minor.yy248, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setStreamOptions(pCxt, yymsp[-3].minor.yy724, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy724)); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 422: /* stream_options ::= stream_options WATERMARK duration_literal */
- { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setStreamOptions(pCxt, yymsp[-2].minor.yy724, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy724)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 423: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-3].minor.yy248, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setStreamOptions(pCxt, yymsp[-3].minor.yy724, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 424: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setStreamOptions(pCxt, yymsp[-2].minor.yy724, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 425: /* stream_options ::= stream_options DELETE_MARK duration_literal */
- { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-2].minor.yy248, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setStreamOptions(pCxt, yymsp[-2].minor.yy724, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy724)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 426: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
- { yylhsminor.yy248 = setStreamOptions(pCxt, yymsp[-3].minor.yy248, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = setStreamOptions(pCxt, yymsp[-3].minor.yy724, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 428: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 709: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==709);
- case 733: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==733);
- { yymsp[-3].minor.yy248 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy248); }
+ case 712: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==712);
+ case 736: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==736);
+ { yymsp[-3].minor.yy724 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy724); }
break;
case 431: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
@@ -7189,37 +7276,37 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
case 436: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
- { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy461); }
break;
case 437: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
- { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy401); }
+ { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy461); }
break;
case 438: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 439: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy928); }
+ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy712); }
break;
case 440: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 443: /* dnode_list ::= DNODE NK_INTEGER */
- { yymsp[-1].minor.yy928 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ { yymsp[-1].minor.yy712 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
case 445: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
- { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
+ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
break;
case 448: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- { yymsp[-6].minor.yy248 = createInsertStmt(pCxt, yymsp[-4].minor.yy248, yymsp[-2].minor.yy928, yymsp[0].minor.yy248); }
+ { yymsp[-6].minor.yy724 = createInsertStmt(pCxt, yymsp[-4].minor.yy724, yymsp[-2].minor.yy712, yymsp[0].minor.yy724); }
break;
case 449: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
- { yymsp[-3].minor.yy248 = createInsertStmt(pCxt, yymsp[-1].minor.yy248, NULL, yymsp[0].minor.yy248); }
+ { yymsp[-3].minor.yy724 = createInsertStmt(pCxt, yymsp[-1].minor.yy724, NULL, yymsp[0].minor.yy724); }
break;
case 450: /* tags_literal ::= NK_INTEGER */
case 462: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==462);
case 471: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==471);
- { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 451: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
case 452: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==452);
@@ -7231,11 +7318,11 @@ static YYACTIONTYPE yy_reduce(
case 482: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==482);
{
SToken l = yymsp[-2].minor.yy0;
- SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
+ SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
l.n = (r.z + r.n) - l.z;
- yylhsminor.yy248 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy248);
+ yylhsminor.yy724 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy724);
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 453: /* tags_literal ::= NK_PLUS NK_INTEGER */
case 456: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==456);
@@ -7246,9 +7333,9 @@ static YYACTIONTYPE yy_reduce(
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
+ yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 454: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==455);
@@ -7264,70 +7351,70 @@ static YYACTIONTYPE yy_reduce(
case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==479);
{
SToken l = yymsp[-3].minor.yy0;
- SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
+ SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
l.n = (r.z + r.n) - l.z;
- yylhsminor.yy248 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy248);
+ yylhsminor.yy724 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy724);
}
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 459: /* tags_literal ::= NK_FLOAT */
- { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 460: /* tags_literal ::= NK_PLUS NK_FLOAT */
case 461: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==461);
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
+ yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 480: /* tags_literal ::= NK_STRING */
- { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 483: /* tags_literal ::= NK_BOOL */
- { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 484: /* tags_literal ::= NULL */
- { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 485: /* tags_literal ::= literal_func */
- { yylhsminor.yy248 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy248); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy724); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 486: /* tags_literal ::= literal_func NK_PLUS duration_literal */
case 487: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==487);
{
- SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
+ SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
l.n = (r.z + r.n) - l.z;
- yylhsminor.yy248 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy248, yymsp[0].minor.yy248);
+ yylhsminor.yy724 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy724, yymsp[0].minor.yy724);
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 490: /* literal ::= NK_INTEGER */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 491: /* literal ::= NK_FLOAT */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 492: /* literal ::= NK_STRING */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 493: /* literal ::= NK_BOOL */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 494: /* literal ::= TIMESTAMP NK_STRING */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 495: /* literal ::= duration_literal */
case 505: /* signed_literal ::= signed */ yytestcase(yyruleno==505);
@@ -7337,198 +7424,199 @@ static YYACTIONTYPE yy_reduce(
case 533: /* expression ::= function_expression */ yytestcase(yyruleno==533);
case 534: /* expression ::= case_when_expression */ yytestcase(yyruleno==534);
case 577: /* function_expression ::= literal_func */ yytestcase(yyruleno==577);
- case 633: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==633);
- case 637: /* boolean_primary ::= predicate */ yytestcase(yyruleno==637);
- case 639: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==639);
- case 640: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==640);
- case 643: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==643);
- case 645: /* table_reference ::= table_primary */ yytestcase(yyruleno==645);
- case 646: /* table_reference ::= joined_table */ yytestcase(yyruleno==646);
- case 650: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==650);
- case 735: /* query_simple ::= query_specification */ yytestcase(yyruleno==735);
- case 736: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==736);
- case 739: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==739);
- case 741: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==741);
- { yylhsminor.yy248 = yymsp[0].minor.yy248; }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ case 578: /* function_expression ::= rand_func */ yytestcase(yyruleno==578);
+ case 636: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==636);
+ case 640: /* boolean_primary ::= predicate */ yytestcase(yyruleno==640);
+ case 642: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==642);
+ case 643: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==643);
+ case 646: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==646);
+ case 648: /* table_reference ::= table_primary */ yytestcase(yyruleno==648);
+ case 649: /* table_reference ::= joined_table */ yytestcase(yyruleno==649);
+ case 653: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==653);
+ case 738: /* query_simple ::= query_specification */ yytestcase(yyruleno==738);
+ case 739: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==739);
+ case 742: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==742);
+ case 744: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==744);
+ { yylhsminor.yy724 = yymsp[0].minor.yy724; }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 496: /* literal ::= NULL */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 497: /* literal ::= NK_QUESTION */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 498: /* duration_literal ::= NK_VARIABLE */
- case 710: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==710);
- case 711: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==711);
- case 712: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==712);
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ case 713: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==713);
+ case 714: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==714);
+ case 715: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==715);
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 499: /* signed ::= NK_INTEGER */
- { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 500: /* signed ::= NK_PLUS NK_INTEGER */
- { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ { yymsp[-1].minor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
case 501: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 502: /* signed ::= NK_FLOAT */
- { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 503: /* signed ::= NK_PLUS NK_FLOAT */
- { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ { yymsp[-1].minor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
case 504: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 506: /* signed_literal ::= NK_STRING */
- { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 507: /* signed_literal ::= NK_BOOL */
- { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 508: /* signed_literal ::= TIMESTAMP NK_STRING */
- { yymsp[-1].minor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ { yymsp[-1].minor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 509: /* signed_literal ::= duration_literal */
case 511: /* signed_literal ::= literal_func */ yytestcase(yyruleno==511);
- case 604: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==604);
- case 687: /* select_item ::= common_expression */ yytestcase(yyruleno==687);
- case 697: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==697);
- case 740: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==740);
- case 742: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==742);
- case 755: /* search_condition ::= common_expression */ yytestcase(yyruleno==755);
- { yylhsminor.yy248 = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ case 607: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==607);
+ case 690: /* select_item ::= common_expression */ yytestcase(yyruleno==690);
+ case 700: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==700);
+ case 743: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==743);
+ case 745: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==745);
+ case 758: /* search_condition ::= common_expression */ yytestcase(yyruleno==758);
+ { yylhsminor.yy724 = releaseRawExprNode(pCxt, yymsp[0].minor.yy724); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 510: /* signed_literal ::= NULL */
- { yylhsminor.yy248 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 512: /* signed_literal ::= NK_QUESTION */
- { yylhsminor.yy248 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 531: /* expression ::= pseudo_column */
- { yylhsminor.yy248 = yymsp[0].minor.yy248; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy248, true); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = yymsp[0].minor.yy724; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy724, true); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 535: /* expression ::= NK_LP expression NK_RP */
- case 638: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==638);
- case 754: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==754);
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 641: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==641);
+ case 757: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==757);
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 536: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy248));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy724));
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 537: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy248), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy724), NULL));
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
case 538: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 539: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 540: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 541: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 542: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 543: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 544: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 545: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 548: /* column_reference ::= column_name */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy401, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy401)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy461, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy461)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 549: /* column_reference ::= table_name NK_DOT column_name */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401, createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy401)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy461, createColumnNode(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy461)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 550: /* column_reference ::= NK_ALIAS */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 551: /* column_reference ::= table_name NK_DOT NK_ALIAS */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 552: /* pseudo_column ::= ROWTS */
case 553: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==553);
@@ -7541,444 +7629,449 @@ static YYACTIONTYPE yy_reduce(
case 561: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==561);
case 562: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==562);
case 563: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==563);
- case 579: /* literal_func ::= NOW */ yytestcase(yyruleno==579);
- case 580: /* literal_func ::= TODAY */ yytestcase(yyruleno==580);
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ case 580: /* literal_func ::= NOW */ yytestcase(yyruleno==580);
+ case 581: /* literal_func ::= TODAY */ yytestcase(yyruleno==581);
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
case 554: /* pseudo_column ::= table_name NK_DOT TBNAME */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy401)))); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy461)))); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
case 564: /* function_expression ::= function_name NK_LP expression_list NK_RP */
case 565: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==565);
case 573: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==573);
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy401, yymsp[-1].minor.yy928)); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy461, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy461, yymsp[-1].minor.yy712)); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 566: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==567);
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy976)); }
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), yymsp[-1].minor.yy1016)); }
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
case 568: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248))); }
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724))); }
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
case 569: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), TRIM_TYPE_BOTH)); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724), TRIM_TYPE_BOTH)); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
case 570: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), yymsp[-3].minor.yy72)); }
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724), yymsp[-3].minor.yy796)); }
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
case 571: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), TRIM_TYPE_BOTH)); }
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724), TRIM_TYPE_BOTH)); }
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
case 572: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), yymsp[-4].minor.yy72)); }
- yymsp[-6].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724), yymsp[-4].minor.yy796)); }
+ yymsp[-6].minor.yy724 = yylhsminor.yy724;
break;
case 574: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy401, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248))); }
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy461, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724))); }
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
case 575: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy401, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248))); }
- yymsp[-7].minor.yy248 = yylhsminor.yy248;
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy461, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy724), releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724))); }
+ yymsp[-7].minor.yy724 = yylhsminor.yy724;
break;
case 576: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy928)); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ case 583: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==583);
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy712)); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
- case 578: /* literal_func ::= noarg_func NK_LP NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy401, NULL)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 579: /* literal_func ::= noarg_func NK_LP NK_RP */
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy461, NULL)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 583: /* trim_specification_type ::= BOTH */
- { yymsp[0].minor.yy72 = TRIM_TYPE_BOTH; }
+ case 582: /* rand_func ::= RAND NK_LP NK_RP */
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
+ break;
+ case 586: /* trim_specification_type ::= BOTH */
+ { yymsp[0].minor.yy796 = TRIM_TYPE_BOTH; }
break;
- case 584: /* trim_specification_type ::= TRAILING */
- { yymsp[0].minor.yy72 = TRIM_TYPE_TRAILING; }
+ case 587: /* trim_specification_type ::= TRAILING */
+ { yymsp[0].minor.yy796 = TRIM_TYPE_TRAILING; }
break;
- case 585: /* trim_specification_type ::= LEADING */
- { yymsp[0].minor.yy72 = TRIM_TYPE_LEADING; }
+ case 588: /* trim_specification_type ::= LEADING */
+ { yymsp[0].minor.yy796 = TRIM_TYPE_LEADING; }
break;
- case 600: /* star_func_para_list ::= NK_STAR */
- { yylhsminor.yy928 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ case 603: /* star_func_para_list ::= NK_STAR */
+ { yylhsminor.yy712 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
- case 605: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 690: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==690);
- { yylhsminor.yy248 = createColumnNode(pCxt, &yymsp[-2].minor.yy401, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 608: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 693: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==693);
+ { yylhsminor.yy724 = createColumnNode(pCxt, &yymsp[-2].minor.yy461, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 606: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy928, yymsp[-1].minor.yy248)); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ case 609: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy712, yymsp[-1].minor.yy724)); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
- case 607: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-2].minor.yy928, yymsp[-1].minor.yy248)); }
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ case 610: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), yymsp[-2].minor.yy712, yymsp[-1].minor.yy724)); }
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
- case 610: /* when_then_expr ::= WHEN common_expression THEN common_expression */
- { yymsp[-3].minor.yy248 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)); }
+ case 613: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+ { yymsp[-3].minor.yy724 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)); }
break;
- case 612: /* case_when_else_opt ::= ELSE common_expression */
- { yymsp[-1].minor.yy248 = releaseRawExprNode(pCxt, yymsp[0].minor.yy248); }
+ case 615: /* case_when_else_opt ::= ELSE common_expression */
+ { yymsp[-1].minor.yy724 = releaseRawExprNode(pCxt, yymsp[0].minor.yy724); }
break;
- case 613: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 618: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==618);
+ case 616: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 621: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==621);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy716, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy164, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 614: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 617: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy248), releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy724), releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-4].minor.yy248 = yylhsminor.yy248;
+ yymsp[-4].minor.yy724 = yylhsminor.yy724;
break;
- case 615: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 618: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy724), releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-5].minor.yy248 = yylhsminor.yy248;
+ yymsp[-5].minor.yy724 = yylhsminor.yy724;
break;
- case 616: /* predicate ::= expr_or_subquery IS NULL */
+ case 619: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), NULL));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 617: /* predicate ::= expr_or_subquery IS NOT NULL */
+ case 620: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), NULL));
}
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
- case 619: /* compare_op ::= NK_LT */
- { yymsp[0].minor.yy716 = OP_TYPE_LOWER_THAN; }
+ case 622: /* compare_op ::= NK_LT */
+ { yymsp[0].minor.yy164 = OP_TYPE_LOWER_THAN; }
break;
- case 620: /* compare_op ::= NK_GT */
- { yymsp[0].minor.yy716 = OP_TYPE_GREATER_THAN; }
+ case 623: /* compare_op ::= NK_GT */
+ { yymsp[0].minor.yy164 = OP_TYPE_GREATER_THAN; }
break;
- case 621: /* compare_op ::= NK_LE */
- { yymsp[0].minor.yy716 = OP_TYPE_LOWER_EQUAL; }
+ case 624: /* compare_op ::= NK_LE */
+ { yymsp[0].minor.yy164 = OP_TYPE_LOWER_EQUAL; }
break;
- case 622: /* compare_op ::= NK_GE */
- { yymsp[0].minor.yy716 = OP_TYPE_GREATER_EQUAL; }
+ case 625: /* compare_op ::= NK_GE */
+ { yymsp[0].minor.yy164 = OP_TYPE_GREATER_EQUAL; }
break;
- case 623: /* compare_op ::= NK_NE */
- { yymsp[0].minor.yy716 = OP_TYPE_NOT_EQUAL; }
+ case 626: /* compare_op ::= NK_NE */
+ { yymsp[0].minor.yy164 = OP_TYPE_NOT_EQUAL; }
break;
- case 624: /* compare_op ::= NK_EQ */
- { yymsp[0].minor.yy716 = OP_TYPE_EQUAL; }
+ case 627: /* compare_op ::= NK_EQ */
+ { yymsp[0].minor.yy164 = OP_TYPE_EQUAL; }
break;
- case 625: /* compare_op ::= LIKE */
- { yymsp[0].minor.yy716 = OP_TYPE_LIKE; }
+ case 628: /* compare_op ::= LIKE */
+ { yymsp[0].minor.yy164 = OP_TYPE_LIKE; }
break;
- case 626: /* compare_op ::= NOT LIKE */
- { yymsp[-1].minor.yy716 = OP_TYPE_NOT_LIKE; }
+ case 629: /* compare_op ::= NOT LIKE */
+ { yymsp[-1].minor.yy164 = OP_TYPE_NOT_LIKE; }
break;
- case 627: /* compare_op ::= MATCH */
- { yymsp[0].minor.yy716 = OP_TYPE_MATCH; }
+ case 630: /* compare_op ::= MATCH */
+ { yymsp[0].minor.yy164 = OP_TYPE_MATCH; }
break;
- case 628: /* compare_op ::= NMATCH */
- { yymsp[0].minor.yy716 = OP_TYPE_NMATCH; }
+ case 631: /* compare_op ::= NMATCH */
+ { yymsp[0].minor.yy164 = OP_TYPE_NMATCH; }
break;
- case 629: /* compare_op ::= CONTAINS */
- { yymsp[0].minor.yy716 = OP_TYPE_JSON_CONTAINS; }
+ case 632: /* compare_op ::= CONTAINS */
+ { yymsp[0].minor.yy164 = OP_TYPE_JSON_CONTAINS; }
break;
- case 630: /* in_op ::= IN */
- { yymsp[0].minor.yy716 = OP_TYPE_IN; }
+ case 633: /* in_op ::= IN */
+ { yymsp[0].minor.yy164 = OP_TYPE_IN; }
break;
- case 631: /* in_op ::= NOT IN */
- { yymsp[-1].minor.yy716 = OP_TYPE_NOT_IN; }
+ case 634: /* in_op ::= NOT IN */
+ { yymsp[-1].minor.yy164 = OP_TYPE_NOT_IN; }
break;
- case 632: /* in_predicate_value ::= NK_LP literal_list NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy928)); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 635: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy712)); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 634: /* boolean_value_expression ::= NOT boolean_primary */
+ case 637: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy248), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy724), NULL));
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
- case 635: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 638: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 636: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 639: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy248);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy248);
- yylhsminor.yy248 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), releaseRawExprNode(pCxt, yymsp[0].minor.yy248)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy724);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy724);
+ yylhsminor.yy724 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), releaseRawExprNode(pCxt, yymsp[0].minor.yy724)));
}
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 644: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { yylhsminor.yy248 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy248, yymsp[0].minor.yy248, NULL); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 647: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { yylhsminor.yy724 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy724, yymsp[0].minor.yy724, NULL); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 647: /* table_primary ::= table_name alias_opt */
- { yylhsminor.yy248 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ case 650: /* table_primary ::= table_name alias_opt */
+ { yylhsminor.yy724 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy461, &yymsp[0].minor.yy461); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
- case 648: /* table_primary ::= db_name NK_DOT table_name alias_opt */
- { yylhsminor.yy248 = createRealTableNode(pCxt, &yymsp[-3].minor.yy401, &yymsp[-1].minor.yy401, &yymsp[0].minor.yy401); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ case 651: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+ { yylhsminor.yy724 = createRealTableNode(pCxt, &yymsp[-3].minor.yy461, &yymsp[-1].minor.yy461, &yymsp[0].minor.yy461); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
- case 649: /* table_primary ::= subquery alias_opt */
- { yylhsminor.yy248 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), &yymsp[0].minor.yy401); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ case 652: /* table_primary ::= subquery alias_opt */
+ { yylhsminor.yy724 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724), &yymsp[0].minor.yy461); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
- case 651: /* alias_opt ::= */
- { yymsp[1].minor.yy401 = nil_token; }
+ case 654: /* alias_opt ::= */
+ { yymsp[1].minor.yy461 = nil_token; }
break;
- case 653: /* alias_opt ::= AS table_alias */
- { yymsp[-1].minor.yy401 = yymsp[0].minor.yy401; }
+ case 656: /* alias_opt ::= AS table_alias */
+ { yymsp[-1].minor.yy461 = yymsp[0].minor.yy461; }
break;
- case 654: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 655: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==655);
- { yymsp[-2].minor.yy248 = yymsp[-1].minor.yy248; }
+ case 657: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 658: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==658);
+ { yymsp[-2].minor.yy724 = yymsp[-1].minor.yy724; }
break;
- case 656: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
+ case 659: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
{
- yylhsminor.yy248 = createJoinTableNode(pCxt, yymsp[-6].minor.yy804, yymsp[-5].minor.yy582, yymsp[-7].minor.yy248, yymsp[-3].minor.yy248, yymsp[-2].minor.yy248);
- yylhsminor.yy248 = addWindowOffsetClause(pCxt, yylhsminor.yy248, yymsp[-1].minor.yy248);
- yylhsminor.yy248 = addJLimitClause(pCxt, yylhsminor.yy248, yymsp[0].minor.yy248);
+ yylhsminor.yy724 = createJoinTableNode(pCxt, yymsp[-6].minor.yy916, yymsp[-5].minor.yy798, yymsp[-7].minor.yy724, yymsp[-3].minor.yy724, yymsp[-2].minor.yy724);
+ yylhsminor.yy724 = addWindowOffsetClause(pCxt, yylhsminor.yy724, yymsp[-1].minor.yy724);
+ yylhsminor.yy724 = addJLimitClause(pCxt, yylhsminor.yy724, yymsp[0].minor.yy724);
}
- yymsp[-7].minor.yy248 = yylhsminor.yy248;
+ yymsp[-7].minor.yy724 = yylhsminor.yy724;
break;
- case 657: /* join_type ::= */
- { yymsp[1].minor.yy804 = JOIN_TYPE_INNER; }
+ case 660: /* join_type ::= */
+ { yymsp[1].minor.yy916 = JOIN_TYPE_INNER; }
break;
- case 658: /* join_type ::= INNER */
- { yymsp[0].minor.yy804 = JOIN_TYPE_INNER; }
+ case 661: /* join_type ::= INNER */
+ { yymsp[0].minor.yy916 = JOIN_TYPE_INNER; }
break;
- case 659: /* join_type ::= LEFT */
- { yymsp[0].minor.yy804 = JOIN_TYPE_LEFT; }
+ case 662: /* join_type ::= LEFT */
+ { yymsp[0].minor.yy916 = JOIN_TYPE_LEFT; }
break;
- case 660: /* join_type ::= RIGHT */
- { yymsp[0].minor.yy804 = JOIN_TYPE_RIGHT; }
+ case 663: /* join_type ::= RIGHT */
+ { yymsp[0].minor.yy916 = JOIN_TYPE_RIGHT; }
break;
- case 661: /* join_type ::= FULL */
- { yymsp[0].minor.yy804 = JOIN_TYPE_FULL; }
+ case 664: /* join_type ::= FULL */
+ { yymsp[0].minor.yy916 = JOIN_TYPE_FULL; }
break;
- case 662: /* join_subtype ::= */
- { yymsp[1].minor.yy582 = JOIN_STYPE_NONE; }
+ case 665: /* join_subtype ::= */
+ { yymsp[1].minor.yy798 = JOIN_STYPE_NONE; }
break;
- case 663: /* join_subtype ::= OUTER */
- { yymsp[0].minor.yy582 = JOIN_STYPE_OUTER; }
+ case 666: /* join_subtype ::= OUTER */
+ { yymsp[0].minor.yy798 = JOIN_STYPE_OUTER; }
break;
- case 664: /* join_subtype ::= SEMI */
- { yymsp[0].minor.yy582 = JOIN_STYPE_SEMI; }
+ case 667: /* join_subtype ::= SEMI */
+ { yymsp[0].minor.yy798 = JOIN_STYPE_SEMI; }
break;
- case 665: /* join_subtype ::= ANTI */
- { yymsp[0].minor.yy582 = JOIN_STYPE_ANTI; }
+ case 668: /* join_subtype ::= ANTI */
+ { yymsp[0].minor.yy798 = JOIN_STYPE_ANTI; }
break;
- case 666: /* join_subtype ::= ASOF */
- { yymsp[0].minor.yy582 = JOIN_STYPE_ASOF; }
+ case 669: /* join_subtype ::= ASOF */
+ { yymsp[0].minor.yy798 = JOIN_STYPE_ASOF; }
break;
- case 667: /* join_subtype ::= WINDOW */
- { yymsp[0].minor.yy582 = JOIN_STYPE_WIN; }
+ case 670: /* join_subtype ::= WINDOW */
+ { yymsp[0].minor.yy798 = JOIN_STYPE_WIN; }
break;
- case 671: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
- { yymsp[-5].minor.yy248 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
+ case 674: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
+ { yymsp[-5].minor.yy724 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
break;
- case 672: /* window_offset_literal ::= NK_VARIABLE */
- { yylhsminor.yy248 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ case 675: /* window_offset_literal ::= NK_VARIABLE */
+ { yylhsminor.yy724 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
- case 673: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */
+ case 676: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy248 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
+ yylhsminor.yy724 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
}
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
- case 675: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */
- case 746: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==746);
- case 750: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==750);
- { yymsp[-1].minor.yy248 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 678: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */
+ case 749: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==749);
+ case 753: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==753);
+ { yymsp[-1].minor.yy724 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 676: /* 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 */
+ case 679: /* 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 */
{
- yymsp[-13].minor.yy248 = createSelectStmt(pCxt, yymsp[-11].minor.yy89, yymsp[-9].minor.yy928, yymsp[-8].minor.yy248, yymsp[-12].minor.yy928);
- yymsp[-13].minor.yy248 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy248, yymsp[-10].minor.yy89);
- yymsp[-13].minor.yy248 = addWhereClause(pCxt, yymsp[-13].minor.yy248, yymsp[-7].minor.yy248);
- yymsp[-13].minor.yy248 = addPartitionByClause(pCxt, yymsp[-13].minor.yy248, yymsp[-6].minor.yy928);
- yymsp[-13].minor.yy248 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy248, yymsp[-2].minor.yy248);
- yymsp[-13].minor.yy248 = addGroupByClause(pCxt, yymsp[-13].minor.yy248, yymsp[-1].minor.yy928);
- yymsp[-13].minor.yy248 = addHavingClause(pCxt, yymsp[-13].minor.yy248, yymsp[0].minor.yy248);
- yymsp[-13].minor.yy248 = addRangeClause(pCxt, yymsp[-13].minor.yy248, yymsp[-5].minor.yy248);
- yymsp[-13].minor.yy248 = addEveryClause(pCxt, yymsp[-13].minor.yy248, yymsp[-4].minor.yy248);
- yymsp[-13].minor.yy248 = addFillClause(pCxt, yymsp[-13].minor.yy248, yymsp[-3].minor.yy248);
+ yymsp[-13].minor.yy724 = createSelectStmt(pCxt, yymsp[-11].minor.yy429, yymsp[-9].minor.yy712, yymsp[-8].minor.yy724, yymsp[-12].minor.yy712);
+ yymsp[-13].minor.yy724 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy724, yymsp[-10].minor.yy429);
+ yymsp[-13].minor.yy724 = addWhereClause(pCxt, yymsp[-13].minor.yy724, yymsp[-7].minor.yy724);
+ yymsp[-13].minor.yy724 = addPartitionByClause(pCxt, yymsp[-13].minor.yy724, yymsp[-6].minor.yy712);
+ yymsp[-13].minor.yy724 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy724, yymsp[-2].minor.yy724);
+ yymsp[-13].minor.yy724 = addGroupByClause(pCxt, yymsp[-13].minor.yy724, yymsp[-1].minor.yy712);
+ yymsp[-13].minor.yy724 = addHavingClause(pCxt, yymsp[-13].minor.yy724, yymsp[0].minor.yy724);
+ yymsp[-13].minor.yy724 = addRangeClause(pCxt, yymsp[-13].minor.yy724, yymsp[-5].minor.yy724);
+ yymsp[-13].minor.yy724 = addEveryClause(pCxt, yymsp[-13].minor.yy724, yymsp[-4].minor.yy724);
+ yymsp[-13].minor.yy724 = addFillClause(pCxt, yymsp[-13].minor.yy724, yymsp[-3].minor.yy724);
}
break;
- case 677: /* hint_list ::= */
- { yymsp[1].minor.yy928 = createHintNodeList(pCxt, NULL); }
+ case 680: /* hint_list ::= */
+ { yymsp[1].minor.yy712 = createHintNodeList(pCxt, NULL); }
break;
- case 678: /* hint_list ::= NK_HINT */
- { yylhsminor.yy928 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ case 681: /* hint_list ::= NK_HINT */
+ { yylhsminor.yy712 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
- case 683: /* set_quantifier_opt ::= ALL */
- { yymsp[0].minor.yy89 = false; }
+ case 686: /* set_quantifier_opt ::= ALL */
+ { yymsp[0].minor.yy429 = false; }
break;
- case 686: /* select_item ::= NK_STAR */
- { yylhsminor.yy248 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy248 = yylhsminor.yy248;
+ case 689: /* select_item ::= NK_STAR */
+ { yylhsminor.yy724 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy724 = yylhsminor.yy724;
break;
- case 688: /* select_item ::= common_expression column_alias */
- case 698: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==698);
- { yylhsminor.yy248 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248), &yymsp[0].minor.yy401); }
- yymsp[-1].minor.yy248 = yylhsminor.yy248;
+ case 691: /* select_item ::= common_expression column_alias */
+ case 701: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==701);
+ { yylhsminor.yy724 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724), &yymsp[0].minor.yy461); }
+ yymsp[-1].minor.yy724 = yylhsminor.yy724;
break;
- case 689: /* select_item ::= common_expression AS column_alias */
- case 699: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==699);
- { yylhsminor.yy248 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), &yymsp[0].minor.yy401); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 692: /* select_item ::= common_expression AS column_alias */
+ case 702: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==702);
+ { yylhsminor.yy724 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), &yymsp[0].minor.yy461); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 694: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 724: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==724);
- case 744: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==744);
- { yymsp[-2].minor.yy928 = yymsp[0].minor.yy928; }
+ case 697: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 727: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==727);
+ case 747: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==747);
+ { yymsp[-2].minor.yy712 = yymsp[0].minor.yy712; }
break;
- case 701: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
- { yymsp[-5].minor.yy248 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
+ case 704: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ { yymsp[-5].minor.yy724 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
break;
- case 702: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- { yymsp[-3].minor.yy248 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
+ case 705: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ { yymsp[-3].minor.yy724 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
break;
- case 703: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- { yymsp[-5].minor.yy248 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), NULL, yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
+ case 706: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ { yymsp[-5].minor.yy724 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), NULL, yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
break;
- case 704: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- { yymsp[-7].minor.yy248 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy248), releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), yymsp[-1].minor.yy248, yymsp[0].minor.yy248); }
+ case 707: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ { yymsp[-7].minor.yy724 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy724), releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), yymsp[-1].minor.yy724, yymsp[0].minor.yy724); }
break;
- case 705: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- { yymsp[-6].minor.yy248 = createEventWindowNode(pCxt, yymsp[-3].minor.yy248, yymsp[0].minor.yy248); }
+ case 708: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ { yymsp[-6].minor.yy724 = createEventWindowNode(pCxt, yymsp[-3].minor.yy724, yymsp[0].minor.yy724); }
break;
- case 706: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
- { yymsp[-3].minor.yy248 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); }
+ case 709: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ { yymsp[-3].minor.yy724 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- case 707: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { yymsp[-5].minor.yy248 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); }
+ case 710: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ { yymsp[-5].minor.yy724 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- case 714: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { yymsp[-3].minor.yy248 = createFillNode(pCxt, yymsp[-1].minor.yy583, NULL); }
+ case 717: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { yymsp[-3].minor.yy724 = createFillNode(pCxt, yymsp[-1].minor.yy58, NULL); }
break;
- case 715: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
- { yymsp[-5].minor.yy248 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy928)); }
+ case 718: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ { yymsp[-5].minor.yy724 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy712)); }
break;
- case 716: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
- { yymsp[-5].minor.yy248 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy928)); }
+ case 719: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ { yymsp[-5].minor.yy724 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy712)); }
break;
- case 717: /* fill_mode ::= NONE */
- { yymsp[0].minor.yy583 = FILL_MODE_NONE; }
+ case 720: /* fill_mode ::= NONE */
+ { yymsp[0].minor.yy58 = FILL_MODE_NONE; }
break;
- case 718: /* fill_mode ::= PREV */
- { yymsp[0].minor.yy583 = FILL_MODE_PREV; }
+ case 721: /* fill_mode ::= PREV */
+ { yymsp[0].minor.yy58 = FILL_MODE_PREV; }
break;
- case 719: /* fill_mode ::= NULL */
- { yymsp[0].minor.yy583 = FILL_MODE_NULL; }
+ case 722: /* fill_mode ::= NULL */
+ { yymsp[0].minor.yy58 = FILL_MODE_NULL; }
break;
- case 720: /* fill_mode ::= NULL_F */
- { yymsp[0].minor.yy583 = FILL_MODE_NULL_F; }
+ case 723: /* fill_mode ::= NULL_F */
+ { yymsp[0].minor.yy58 = FILL_MODE_NULL_F; }
break;
- case 721: /* fill_mode ::= LINEAR */
- { yymsp[0].minor.yy583 = FILL_MODE_LINEAR; }
+ case 724: /* fill_mode ::= LINEAR */
+ { yymsp[0].minor.yy58 = FILL_MODE_LINEAR; }
break;
- case 722: /* fill_mode ::= NEXT */
- { yymsp[0].minor.yy583 = FILL_MODE_NEXT; }
+ case 725: /* fill_mode ::= NEXT */
+ { yymsp[0].minor.yy58 = FILL_MODE_NEXT; }
break;
- case 725: /* group_by_list ::= expr_or_subquery */
- { yylhsminor.yy928 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); }
- yymsp[0].minor.yy928 = yylhsminor.yy928;
+ case 728: /* group_by_list ::= expr_or_subquery */
+ { yylhsminor.yy712 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy724))); }
+ yymsp[0].minor.yy712 = yylhsminor.yy712;
break;
- case 726: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- { yylhsminor.yy928 = addNodeToList(pCxt, yymsp[-2].minor.yy928, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy248))); }
- yymsp[-2].minor.yy928 = yylhsminor.yy928;
+ case 729: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ { yylhsminor.yy712 = addNodeToList(pCxt, yymsp[-2].minor.yy712, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy724))); }
+ yymsp[-2].minor.yy712 = yylhsminor.yy712;
break;
- case 730: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- { yymsp[-5].minor.yy248 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy248), releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
+ case 733: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ { yymsp[-5].minor.yy724 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy724), releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
break;
- case 731: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
- { yymsp[-3].minor.yy248 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy248)); }
+ case 734: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ { yymsp[-3].minor.yy724 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy724)); }
break;
- case 734: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 737: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy248 = addOrderByClause(pCxt, yymsp[-3].minor.yy248, yymsp[-2].minor.yy928);
- yylhsminor.yy248 = addSlimitClause(pCxt, yylhsminor.yy248, yymsp[-1].minor.yy248);
- yylhsminor.yy248 = addLimitClause(pCxt, yylhsminor.yy248, yymsp[0].minor.yy248);
+ yylhsminor.yy724 = addOrderByClause(pCxt, yymsp[-3].minor.yy724, yymsp[-2].minor.yy712);
+ yylhsminor.yy724 = addSlimitClause(pCxt, yylhsminor.yy724, yymsp[-1].minor.yy724);
+ yylhsminor.yy724 = addLimitClause(pCxt, yylhsminor.yy724, yymsp[0].minor.yy724);
}
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
- case 737: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- { yylhsminor.yy248 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy248, yymsp[0].minor.yy248); }
- yymsp[-3].minor.yy248 = yylhsminor.yy248;
+ case 740: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ { yylhsminor.yy724 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy724, yymsp[0].minor.yy724); }
+ yymsp[-3].minor.yy724 = yylhsminor.yy724;
break;
- case 738: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- { yylhsminor.yy248 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy248, yymsp[0].minor.yy248); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 741: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ { yylhsminor.yy724 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy724, yymsp[0].minor.yy724); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 747: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 751: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==751);
- { yymsp[-3].minor.yy248 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 750: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 754: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==754);
+ { yymsp[-3].minor.yy724 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 748: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 752: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==752);
- { yymsp[-3].minor.yy248 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 751: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 755: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==755);
+ { yymsp[-3].minor.yy724 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 753: /* subquery ::= NK_LP query_expression NK_RP */
- { yylhsminor.yy248 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy248); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 756: /* subquery ::= NK_LP query_expression NK_RP */
+ { yylhsminor.yy724 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy724); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 758: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- { yylhsminor.yy248 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy248), yymsp[-1].minor.yy482, yymsp[0].minor.yy721); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 761: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ { yylhsminor.yy724 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy724), yymsp[-1].minor.yy746, yymsp[0].minor.yy417); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
- case 759: /* ordering_specification_opt ::= */
- { yymsp[1].minor.yy482 = ORDER_ASC; }
+ case 762: /* ordering_specification_opt ::= */
+ { yymsp[1].minor.yy746 = ORDER_ASC; }
break;
- case 760: /* ordering_specification_opt ::= ASC */
- { yymsp[0].minor.yy482 = ORDER_ASC; }
+ case 763: /* ordering_specification_opt ::= ASC */
+ { yymsp[0].minor.yy746 = ORDER_ASC; }
break;
- case 761: /* ordering_specification_opt ::= DESC */
- { yymsp[0].minor.yy482 = ORDER_DESC; }
+ case 764: /* ordering_specification_opt ::= DESC */
+ { yymsp[0].minor.yy746 = ORDER_DESC; }
break;
- case 762: /* null_ordering_opt ::= */
- { yymsp[1].minor.yy721 = NULL_ORDER_DEFAULT; }
+ case 765: /* null_ordering_opt ::= */
+ { yymsp[1].minor.yy417 = NULL_ORDER_DEFAULT; }
break;
- case 763: /* null_ordering_opt ::= NULLS FIRST */
- { yymsp[-1].minor.yy721 = NULL_ORDER_FIRST; }
+ case 766: /* null_ordering_opt ::= NULLS FIRST */
+ { yymsp[-1].minor.yy417 = NULL_ORDER_FIRST; }
break;
- case 764: /* null_ordering_opt ::= NULLS LAST */
- { yymsp[-1].minor.yy721 = NULL_ORDER_LAST; }
+ case 767: /* null_ordering_opt ::= NULLS LAST */
+ { yymsp[-1].minor.yy417 = NULL_ORDER_LAST; }
break;
- case 767: /* column_options ::= column_options NK_ID NK_STRING */
- { yylhsminor.yy248 = setColumnOptions(pCxt, yymsp[-2].minor.yy248, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy248 = yylhsminor.yy248;
+ case 770: /* column_options ::= column_options NK_ID NK_STRING */
+ { yylhsminor.yy724 = setColumnOptions(pCxt, yymsp[-2].minor.yy724, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy724 = yylhsminor.yy724;
break;
default:
break;
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index 7da4f93dee..988440227b 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -294,6 +294,9 @@ static bool scanPathOptIsSpecifiedFuncType(const SFunctionNode* pFunc, bool (*ty
return true;
}
+static bool isMinMaxFunction(int32_t funcType) {
+ return funcType == FUNCTION_TYPE_MIN || funcType == FUNCTION_TYPE_MAX;
+}
static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSdrFuncs, SNodeList** pDsoFuncs) {
SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent);
SNodeList* pTmpSdrFuncs = NULL;
@@ -303,7 +306,8 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd
FOREACH(pNode, pAllFuncs) {
SFunctionNode* pFunc = (SFunctionNode*)pNode;
int32_t code = TSDB_CODE_SUCCESS;
- if (scanPathOptIsSpecifiedFuncType(pFunc, fmIsSpecialDataRequiredFunc)) {
+ if ((!isMinMaxFunction(pFunc->funcType) && scanPathOptIsSpecifiedFuncType(pFunc, fmIsSpecialDataRequiredFunc)) ||
+ (isMinMaxFunction(pFunc->funcType) && pFunc->hasSMA)) {
SNode* pNew = NULL;
code = nodesCloneNode(pNode, &pNew);
if (TSDB_CODE_SUCCESS == code) {
diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c
index 34821d05cd..7c7439eac3 100644
--- a/source/libs/qcom/src/queryUtil.c
+++ b/source/libs/qcom/src/queryUtil.c
@@ -671,3 +671,7 @@ void freeDbCfgInfo(SDbCfgInfo* pInfo) {
}
taosMemoryFree(pInfo);
}
+
+void* getTaskPoolWorkerCb() {
+ return taskQueue.wrokrerPool.pCb;
+}
diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c
index 2526ac73bc..1a9d3e7ba9 100644
--- a/source/libs/qworker/src/qworker.c
+++ b/source/libs/qworker/src/qworker.c
@@ -1478,6 +1478,7 @@ int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64
ctx->explainRes = explainRes;
rHandle.pMsgCb = taosMemoryCalloc(1, sizeof(SMsgCb));
+ rHandle.pWorkerCb = qwMsg->pWorkerCb;
if (NULL == rHandle.pMsgCb) {
QW_ERR_JRET(terrno);
}
diff --git a/source/libs/scalar/inc/sclInt.h b/source/libs/scalar/inc/sclInt.h
index d6d77ffd7b..34fd5dc8b0 100644
--- a/source/libs/scalar/inc/sclInt.h
+++ b/source/libs/scalar/inc/sclInt.h
@@ -30,7 +30,7 @@ typedef struct SOperatorValueType {
typedef struct SScalarCtx {
int32_t code;
- bool dual;
+ bool dual; /* whether select stmt has from stmt */
SArray* pBlockList; /* element is SSDataBlock* */
SHashObj* pRes; /* element is SScalarParam */
void* param; // additional parameter (meta actually) for acquire value such as tbname/tags values
diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c
index 382b83012d..ec48dd50ae 100644
--- a/source/libs/scalar/src/filter.c
+++ b/source/libs/scalar/src/filter.c
@@ -1274,6 +1274,16 @@ int32_t filterAddUnitToGroup(SFilterGroup *group, uint32_t unitIdx) {
return TSDB_CODE_SUCCESS;
}
+static void filterFreeGroup(void *pItem) {
+ if (pItem == NULL) {
+ return;
+ }
+
+ SFilterGroup *p = (SFilterGroup *)pItem;
+ taosMemoryFreeClear(p->unitIdxs);
+ taosMemoryFreeClear(p->unitFlags);
+}
+
int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) {
SOperatorNode *node = (SOperatorNode *)tree;
int32_t ret = TSDB_CODE_SUCCESS;
@@ -1336,9 +1346,11 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) {
SFilterGroup fgroup = {0};
code = filterAddUnitToGroup(&fgroup, uidx);
if (TSDB_CODE_SUCCESS != code) {
+ filterFreeGroup((void*)&fgroup);
break;
}
if (NULL == taosArrayPush(group, &fgroup)) {
+ filterFreeGroup((void*)&fgroup);
code = TSDB_CODE_OUT_OF_MEMORY;
break;
}
@@ -1658,16 +1670,6 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
return TSDB_CODE_SUCCESS;
}
-static void filterFreeGroup(void *pItem) {
- if (pItem == NULL) {
- return;
- }
-
- SFilterGroup *p = (SFilterGroup *)pItem;
- taosMemoryFreeClear(p->unitIdxs);
- taosMemoryFreeClear(p->unitFlags);
-}
-
EDealRes fltTreeToGroup(SNode *pNode, void *pContext) {
int32_t code = TSDB_CODE_SUCCESS;
SArray *preGroup = NULL;
@@ -2247,7 +2249,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
return TSDB_CODE_SCALAR_CONVERT_ERROR;
}
varDataSetLen(newValData, len);
- (void)varDataCopy(fi->data, newValData);
+ varDataCopy(fi->data, newValData);
}
}
@@ -2944,25 +2946,44 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t gResNum
for (int32_t n = 0; n < usize; ++n) {
SFilterUnit *u = (SFilterUnit *)taosArrayGetP((SArray *)colInfo->info, n);
if (NULL == u) {
- FLT_ERR_JRET(TSDB_CODE_OUT_OF_RANGE);
+ code = TSDB_CODE_OUT_OF_RANGE;
+ break;
}
- FLT_ERR_JRET(filterAddUnitFromUnit(info, &oinfo, u, &uidx));
- FLT_ERR_JRET(filterAddUnitToGroup(&ng, uidx));
+ code = filterAddUnitFromUnit(info, &oinfo, u, &uidx);
+ if (TSDB_CODE_SUCCESS != code) {
+ break;
+ }
+ code = filterAddUnitToGroup(&ng, uidx);
+ if (TSDB_CODE_SUCCESS != code) {
+ break;
+ }
+ }
+ if (TSDB_CODE_SUCCESS != code) {
+ break;
}
continue;
}
+ if (TSDB_CODE_SUCCESS != code) {
+ filterFreeGroup((void*)&ng);
+ FLT_ERR_JRET(code);
+ }
if (colInfo->type != RANGE_TYPE_MR_CTX) {
fltError("filterRewrite get invalid col type : %d", colInfo->type);
FLT_ERR_JRET(TSDB_CODE_QRY_FILTER_INVALID_TYPE);
}
- FLT_ERR_JRET(filterAddGroupUnitFromCtx(info, &oinfo, colInfo->info, res->colIdx[m], &ng, optr, group));
+ code = filterAddGroupUnitFromCtx(info, &oinfo, colInfo->info, res->colIdx[m], &ng, optr, group);
+ if (TSDB_CODE_SUCCESS != code) {
+ filterFreeGroup((void*)&ng);
+ FLT_ERR_JRET(code);
+ }
}
if (ng.unitNum > 0) {
if (NULL == taosArrayPush(group, &ng)) {
+ filterFreeGroup((void*)&ng);
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
}
@@ -4571,7 +4592,7 @@ int32_t filterConverNcharColumns(SFilterInfo *info, int32_t rows, bool *gotNchar
if (k == varSrcLen) {
/* NULL */
varDataLen(dst) = (VarDataLenT)varSrcLen;
- (void)varDataCopy(dst, src);
+ varDataCopy(dst, src);
continue;
}
bool ret = taosMbsToUcs4(varDataVal(src), varDataLen(src), (TdUcs4 *)varDataVal(dst), bufSize, &len);
@@ -5238,22 +5259,20 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p,
*pResultStatus = FILTER_RESULT_ALL_QUALIFIED;
return TSDB_CODE_SUCCESS;
}
-
+ int32_t code = TSDB_CODE_SUCCESS;
SScalarParam output = {0};
SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)};
- int32_t code = sclCreateColumnInfoData(&type, pSrc->info.rows, &output);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
+ FLT_ERR_JRET(sclCreateColumnInfoData(&type, pSrc->info.rows, &output));
if (info->scalarMode) {
SArray *pList = taosArrayInit(1, POINTER_BYTES);
if (NULL == pList) {
- FLT_ERR_RET(terrno);
+ FLT_ERR_JRET(terrno);
}
if (NULL == taosArrayPush(pList, &pSrc)) {
- FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ taosArrayDestroy(pList);
+ FLT_ERR_JRET(terrno);
}
code = scalarCalculate(info->sclCtx.node, pList, &output);
@@ -5261,7 +5280,7 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p,
*p = output.columnData;
- FLT_ERR_RET(code);
+ FLT_ERR_JRET(code);
if (output.numOfQualified == output.numOfRows) {
*pResultStatus = FILTER_RESULT_ALL_QUALIFIED;
@@ -5277,11 +5296,12 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p,
output.numOfRows = pSrc->info.rows;
if (*p == NULL) {
- return TSDB_CODE_APP_ERROR;
+ fltError("filterExecute failed, column data is NULL");
+ FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
}
bool keepAll = false;
- FLT_ERR_RET((info->func)(info, pSrc->info.rows, *p, statis, numOfCols, &output.numOfQualified, &keepAll));
+ FLT_ERR_JRET((info->func)(info, pSrc->info.rows, *p, statis, numOfCols, &output.numOfQualified, &keepAll));
// todo this should be return during filter procedure
if (keepAll) {
@@ -5304,6 +5324,10 @@ int32_t filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p,
}
return TSDB_CODE_SUCCESS;
+_return:
+ sclFreeParam(&output);
+ *p = NULL;
+ return code;
}
typedef struct SClassifyConditionCxt {
diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c
index ee79c9a66e..b9a95a3216 100644
--- a/source/libs/scalar/src/scalar.c
+++ b/source/libs/scalar/src/scalar.c
@@ -74,7 +74,7 @@ int32_t sclConvertValueToSclParam(SValueNode *pValueNode, SScalarParam *out, int
code = colDataSetVal(in.columnData, 0, nodesGetValueFromNode(pValueNode), false);
if (code != TSDB_CODE_SUCCESS) {
- goto _exit;
+ goto _exit;
}
code = colInfoDataEnsureCapacity(out->columnData, 1, true);
@@ -91,7 +91,7 @@ _exit:
}
int32_t sclExtendResRows(SScalarParam *pDst, SScalarParam *pSrc, SArray *pBlockList) {
- SSDataBlock *pb = taosArrayGetP(pBlockList, 0);
+ SSDataBlock *pb = taosArrayGetP(pBlockList, 0);
if (NULL == pb) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_RANGE);
}
@@ -839,8 +839,8 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o
}
// 1=1 and tag_column = 1
- int32_t ind = (i >= params[m].numOfRows)? (params[m].numOfRows - 1):i;
- char* p = colDataGetData(params[m].columnData, ind);
+ int32_t ind = (i >= params[m].numOfRows) ? (params[m].numOfRows - 1) : i;
+ char *p = colDataGetData(params[m].columnData, ind);
GET_TYPED_DATA(value, bool, params[m].columnData->info.type, p);
@@ -1029,7 +1029,7 @@ _return:
EDealRes sclRewriteNullInOptr(SNode **pNode, SScalarCtx *ctx, EOperatorType opType) {
if (opType <= OP_TYPE_CALC_MAX) {
SValueNode *res = NULL;
- ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&res);
+ ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode **)&res);
if (NULL == res) {
sclError("make value node failed");
return DEAL_RES_ERROR;
@@ -1041,7 +1041,7 @@ EDealRes sclRewriteNullInOptr(SNode **pNode, SScalarCtx *ctx, EOperatorType opTy
*pNode = (SNode *)res;
} else {
SValueNode *res = NULL;
- ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&res);
+ ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode **)&res);
if (NULL == res) {
sclError("make value node failed");
return DEAL_RES_ERROR;
@@ -1094,7 +1094,6 @@ static uint8_t sclGetOpValueNodeTsPrecision(SNode *pLeft, SNode *pRight) {
return 0;
}
-
int32_t sclConvertOpValueNodeTs(SOperatorNode *node) {
if (node->pLeft && SCL_IS_VAR_VALUE_NODE(node->pLeft)) {
if (node->pRight && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pRight)->resType.type)) {
@@ -1105,13 +1104,12 @@ int32_t sclConvertOpValueNodeTs(SOperatorNode *node) {
if (node->pLeft && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pLeft)->resType.type)) {
if (SCL_IS_VAR_VALUE_NODE(node->pRight)) {
SCL_ERR_RET(sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, node->pRight),
- (SValueNode *)node->pRight));
+ (SValueNode *)node->pRight));
} else if (QUERY_NODE_NODE_LIST == node->pRight->type) {
SNode *pNode;
FOREACH(pNode, ((SNodeListNode *)node->pRight)->pNodeList) {
if (SCL_IS_VAR_VALUE_NODE(pNode)) {
- SCL_ERR_RET(
- sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, pNode), (SValueNode *)pNode));
+ SCL_ERR_RET(sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, pNode), (SValueNode *)pNode));
}
}
}
@@ -1120,7 +1118,6 @@ int32_t sclConvertOpValueNodeTs(SOperatorNode *node) {
return TSDB_CODE_SUCCESS;
}
-
int32_t sclConvertCaseWhenValueNodeTs(SCaseWhenNode *node) {
if (NULL == node->pCase) {
return TSDB_CODE_SUCCESS;
@@ -1140,7 +1137,7 @@ int32_t sclConvertCaseWhenValueNodeTs(SCaseWhenNode *node) {
FOREACH(pNode, node->pWhenThenList) {
if (SCL_IS_VAR_VALUE_NODE(((SWhenThenNode *)pNode)->pWhen)) {
SCL_ERR_RET(sclConvertToTsValueNode(((SExprNode *)node->pCase)->resType.precision,
- (SValueNode *)((SWhenThenNode *)pNode)->pWhen));
+ (SValueNode *)((SWhenThenNode *)pNode)->pWhen));
}
}
}
@@ -1182,7 +1179,8 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) {
EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) {
SFunctionNode *node = (SFunctionNode *)*pNode;
SNode *tnode = NULL;
- if ((!fmIsScalarFunc(node->funcId) && (!ctx->dual)) || fmIsUserDefinedFunc(node->funcId)) {
+ if ((!fmIsScalarFunc(node->funcId) && (!ctx->dual)) ||
+ fmIsUserDefinedFunc(node->funcId)) {
return DEAL_RES_CONTINUE;
}
@@ -1201,7 +1199,7 @@ EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) {
}
SValueNode *res = NULL;
- ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&res);
+ ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode **)&res);
if (NULL == res) {
sclError("make value node failed");
sclFreeParam(&output);
@@ -1275,7 +1273,7 @@ EDealRes sclRewriteLogic(SNode **pNode, SScalarCtx *ctx) {
}
SValueNode *res = NULL;
- ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&res);
+ ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode **)&res);
if (NULL == res) {
sclError("make value node failed");
sclFreeParam(&output);
@@ -1346,7 +1344,7 @@ EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) {
}
SValueNode *res = NULL;
- ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&res);
+ ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode **)&res);
if (NULL == res) {
sclError("make value node failed");
sclFreeParam(&output);
@@ -1409,7 +1407,7 @@ EDealRes sclRewriteCaseWhen(SNode **pNode, SScalarCtx *ctx) {
}
SValueNode *res = NULL;
- ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&res);
+ ctx->code = nodesMakeNode(QUERY_NODE_VALUE, (SNode **)&res);
if (NULL == res) {
sclError("make value node failed");
sclFreeParam(&output);
@@ -1426,7 +1424,8 @@ EDealRes sclRewriteCaseWhen(SNode **pNode, SScalarCtx *ctx) {
} else {
int32_t type = output.columnData->info.type;
if (IS_VAR_DATA_TYPE(type)) { // todo refactor
- res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData) + 1, sizeof(char)); // add \0 to the end for print json value
+ res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData) + 1,
+ sizeof(char)); // add \0 to the end for print json value
if (NULL == res->datum.p) {
sclError("calloc %d failed", (int)(varDataTLen(output.columnData->pData) + 1));
sclFreeParam(&output);
@@ -1587,7 +1586,10 @@ EDealRes sclWalkTarget(SNode *pNode, SScalarCtx *ctx) {
block->info.rows = res->numOfRows;
sclFreeParam(res);
- (void)taosHashRemove(ctx->pRes, (void *)&target->pExpr, POINTER_BYTES);
+ ctx->code = taosHashRemove(ctx->pRes, (void *)&target->pExpr, POINTER_BYTES);
+ if (TSDB_CODE_SUCCESS != ctx->code) {
+ return DEAL_RES_ERROR;
+ }
return DEAL_RES_CONTINUE;
}
@@ -1683,8 +1685,7 @@ 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_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;
@@ -1720,13 +1721,14 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
SDataType rdt = ((SExprNode *)(pOp->pRight))->resType;
- if (ldt.type == TSDB_DATA_TYPE_VARBINARY || !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;
}
- if (nodesIsMatchRegularOp(pOp)) {
- SValueNode* node = (SValueNode*)(pOp->pRight);
- if(checkRegexPattern(node->literal) != TSDB_CODE_SUCCESS){
+ SValueNode *node = (SValueNode *)(pOp->pRight);
+ if (!node->placeholderNo && nodesIsMatchRegularOp(pOp)) {
+ if (checkRegexPattern(node->literal) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR;
}
}
@@ -1762,7 +1764,7 @@ 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){
+ 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;
@@ -1813,7 +1815,7 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) {
}
sclFreeParam(res);
- (void)taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
+ SCL_ERR_JRET(taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES));
}
_return:
diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c
index 7fae646e8f..5fc7c06d57 100644
--- a/source/libs/scalar/src/sclfunc.c
+++ b/source/libs/scalar/src/sclfunc.c
@@ -2887,6 +2887,21 @@ int32_t floorFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOut
return doScalarFunction(pInput, inputNum, pOutput, floorf, floor);
}
+int32_t randFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
+ if (!IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[0]))) {
+ int32_t seed;
+ GET_TYPED_DATA(seed, int32_t, GET_PARAM_TYPE(&pInput[0]), pInput[0].columnData->pData);
+ taosSeedRand(seed);
+ }
+ int32_t numOfRows = inputNum == 1 ? pInput[0].numOfRows : TMAX(pInput[0].numOfRows, pInput[1].numOfRows);
+ for (int32_t i = 0; i < numOfRows; ++i) {
+ double random_value = (double)(taosRand() % RAND_MAX) / RAND_MAX;
+ colDataSetDouble(pOutput->columnData, i, &random_value);
+ }
+ pOutput->numOfRows = numOfRows;
+ return TSDB_CODE_SUCCESS;
+}
+
static double decimalFn(double val1, double val2, _double_fn fn) {
if (val1 > DBL_MAX || val1 < -DBL_MAX) {
return val1;
diff --git a/source/libs/scalar/test/filter/filterTests.cpp b/source/libs/scalar/test/filter/filterTests.cpp
index b970bf5297..70d6f7d0ae 100644
--- a/source/libs/scalar/test/filter/filterTests.cpp
+++ b/source/libs/scalar/test/filter/filterTests.cpp
@@ -76,7 +76,7 @@ int32_t flttMakeValueNode(SNode **pNode, int32_t dataType, void *value) {
if (NULL == vnode->datum.p) {
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
- (void)varDataCopy(vnode->datum.p, value);
+ varDataCopy(vnode->datum.p, value);
vnode->node.resType.bytes = varDataLen(value);
} else {
vnode->node.resType.bytes = tDataTypes[dataType].bytes;
diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp
index c29f7b8a5b..e14b772ea8 100644
--- a/source/libs/scalar/test/scalar/scalarTests.cpp
+++ b/source/libs/scalar/test/scalar/scalarTests.cpp
@@ -120,7 +120,9 @@ int32_t scltAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t
SCL_ERR_RET(TSDB_CODE_APP_ERROR);
}
- (void)taosArrayPush(pBlockList, &res);
+ if (NULL == taosArrayPush(pBlockList, &res)) {
+ SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
*dataBlockId = taosArrayGetSize(pBlockList) - 1;
res->info.id.blockId = *dataBlockId;
*slotId = 0;
@@ -161,7 +163,7 @@ int32_t scltMakeValueNode(SNode **pNode, int32_t dataType, void *value) {
if (NULL == vnode->datum.p) {
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
- (void)varDataCopy(vnode->datum.p, value);
+ varDataCopy(vnode->datum.p, value);
vnode->node.resType.bytes = varDataTLen(value);
} else {
vnode->node.resType.bytes = tDataTypes[dataType].bytes;
@@ -1382,7 +1384,9 @@ int32_t makeCalculate(void *json, void *key, int32_t rightType, void *rightData,
SNode *opNode = NULL;
SCL_ERR_RET(makeJsonArrow(&src, &opNode, json, (char *)key));
- (void)taosArrayPush(blockList, &src);
+ if (NULL == taosArrayPush(blockList, &src)) {
+ SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
SCL_ERR_RET(makeOperator(&opNode, blockList, opType, rightType, rightData, isReverse));
@@ -1909,7 +1913,7 @@ TEST(columnTest, bigint_column_multi_binary_column) {
SArray *blockList = taosArrayInit(1, POINTER_BYTES);
ASSERT_NE(blockList, nullptr);
- (void)taosArrayPush(blockList, &src);
+ ASSERT_NE(taosArrayPush(blockList, &src), nullptr);
SColumnInfo colInfo = createColumnInfo(1, TSDB_DATA_TYPE_DOUBLE, sizeof(double));
int16_t dataBlockId = 0, slotId = 0;
diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h
index f12d0fd246..3a25f37895 100644
--- a/source/libs/scheduler/inc/schInt.h
+++ b/source/libs/scheduler/inc/schInt.h
@@ -306,6 +306,7 @@ typedef struct SSchJob {
char *sql;
SQueryProfileSummary summary;
int8_t source;
+ void *pWorkerCb;
} SSchJob;
typedef struct SSchTaskCtx {
diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c
index cf4a132eb5..8e2fbb878d 100644
--- a/source/libs/scheduler/src/schJob.c
+++ b/source/libs/scheduler/src/schJob.c
@@ -836,6 +836,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
pJob->userRes.execFp = pReq->execFp;
pJob->userRes.cbParam = pReq->cbParam;
pJob->source = pReq->source;
+ pJob->pWorkerCb = pReq->pWorkerCb;
if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) {
qDebug("qid:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId);
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index 4e34a47902..bf88248259 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -144,7 +144,6 @@ int32_t schProcessExplainRsp(SSchJob *pJob, SSchTask *pTask, SExplainRsp *rsp) {
int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDataBuf *pMsg, int32_t rspCode) {
int32_t code = 0;
- char *msg = pMsg->pData;
int32_t msgSize = pMsg->len;
int32_t msgType = pMsg->msgType;
@@ -158,9 +157,9 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
}
case TDMT_VND_CREATE_TABLE_RSP: {
SVCreateTbBatchRsp batchRsp = {0};
- if (msg) {
+ if (pMsg->pData) {
SDecoder coder = {0};
- tDecoderInit(&coder, msg, msgSize);
+ tDecoderInit(&coder, pMsg->pData, msgSize);
code = tDecodeSVCreateTbBatchRsp(&coder, &batchRsp);
if (TSDB_CODE_SUCCESS == code && batchRsp.nRsps > 0) {
SCH_LOCK(SCH_WRITE, &pJob->resLock);
@@ -206,16 +205,16 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
}
SCH_ERR_JRET(rspCode);
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break;
}
case TDMT_VND_DROP_TABLE_RSP: {
SVDropTbBatchRsp batchRsp = {0};
- if (msg) {
+ if (pMsg->pData) {
SDecoder coder = {0};
- tDecoderInit(&coder, msg, msgSize);
+ tDecoderInit(&coder, pMsg->pData, msgSize);
code = tDecodeSVDropTbBatchRsp(&coder, &batchRsp);
if (TSDB_CODE_SUCCESS == code && batchRsp.nRsps > 0) {
for (int32_t i = 0; i < batchRsp.nRsps; ++i) {
@@ -232,16 +231,16 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
}
SCH_ERR_JRET(rspCode);
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break;
}
case TDMT_VND_ALTER_TABLE_RSP: {
SVAlterTbRsp rsp = {0};
- if (msg) {
+ if (pMsg->pData) {
SDecoder coder = {0};
- tDecoderInit(&coder, msg, msgSize);
+ tDecoderInit(&coder, pMsg->pData, msgSize);
code = tDecodeSVAlterTbRsp(&coder, &rsp);
tDecoderClear(&coder);
SCH_ERR_JRET(code);
@@ -253,11 +252,11 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
SCH_ERR_JRET(rspCode);
- if (NULL == msg) {
+ if (NULL == pMsg->pData) {
SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT);
}
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break;
@@ -265,10 +264,10 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
case TDMT_VND_SUBMIT_RSP: {
SCH_ERR_JRET(rspCode);
- if (msg) {
+ if (pMsg->pData) {
SDecoder coder = {0};
SSubmitRsp2 *rsp = taosMemoryMalloc(sizeof(*rsp));
- tDecoderInit(&coder, msg, msgSize);
+ tDecoderInit(&coder, pMsg->pData, msgSize);
code = tDecodeSSubmitRsp2(&coder, rsp);
tDecoderClear(&coder);
if (code) {
@@ -319,7 +318,7 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
}
}
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
@@ -328,10 +327,10 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
case TDMT_VND_DELETE_RSP: {
SCH_ERR_JRET(rspCode);
- if (msg) {
+ if (pMsg->pData) {
SDecoder coder = {0};
SVDeleteRsp rsp = {0};
- tDecoderInit(&coder, msg, msgSize);
+ tDecoderInit(&coder, pMsg->pData, msgSize);
if (tDecodeSVDeleteRsp(&coder, &rsp) < 0) {
code = terrno;
tDecoderClear(&coder);
@@ -343,7 +342,7 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
SCH_TASK_DLOG("delete succeed, affectedRows:%" PRId64, rsp.affectedRows);
}
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
@@ -352,7 +351,7 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
case TDMT_SCH_QUERY_RSP:
case TDMT_SCH_MERGE_QUERY_RSP: {
SCH_ERR_JRET(rspCode);
- if (NULL == msg) {
+ if (NULL == pMsg->pData) {
SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT);
}
@@ -365,7 +364,7 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
}
SQueryTableRsp rsp = {0};
- if (tDeserializeSQueryTableRsp(msg, msgSize, &rsp) < 0) {
+ if (tDeserializeSQueryTableRsp(pMsg->pData, msgSize, &rsp) < 0) {
SCH_TASK_ELOG("tDeserializeSQueryTableRsp failed, msgSize:%d", msgSize);
SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_MSG);
}
@@ -376,7 +375,7 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
(void)atomic_add_fetch_64(&pJob->resNumOfRows, rsp.affectedRows);
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
@@ -384,7 +383,7 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
}
case TDMT_SCH_EXPLAIN_RSP: {
SCH_ERR_JRET(rspCode);
- if (NULL == msg) {
+ if (NULL == pMsg->pData) {
SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT);
}
@@ -399,20 +398,20 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
}
SExplainRsp rsp = {0};
- if (tDeserializeSExplainRsp(msg, msgSize, &rsp)) {
+ if (tDeserializeSExplainRsp(pMsg->pData, msgSize, &rsp)) {
tFreeSExplainRsp(&rsp);
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
SCH_ERR_JRET(schProcessExplainRsp(pJob, pTask, &rsp));
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
break;
}
case TDMT_SCH_FETCH_RSP:
case TDMT_SCH_MERGE_FETCH_RSP: {
- code = schProcessFetchRsp(pJob, pTask, msg, rspCode);
- msg = NULL;
+ code = schProcessFetchRsp(pJob, pTask, pMsg->pData, rspCode);
+ pMsg->pData = NULL;
SCH_ERR_JRET(code);
break;
}
@@ -435,7 +434,7 @@ int32_t schProcessResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SD
_return:
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_RET(schProcessOnTaskFailure(pJob, pTask, code));
}
@@ -445,7 +444,6 @@ _return:
int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDataBuf *pMsg, int32_t rspCode) {
int32_t code = 0;
int32_t msgType = pMsg->msgType;
- char *msg = pMsg->pData;
bool dropExecNode = (msgType == TDMT_SCH_LINK_BROKEN || SCH_NETWORK_ERR(rspCode));
if (SCH_IS_QUERY_JOB(pJob)) {
@@ -467,7 +465,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
_return:
- taosMemoryFreeClear(msg);
+ taosMemoryFreeClear(pMsg->pData);
SCH_RET(schProcessOnTaskFailure(pJob, pTask, code));
}
diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c
index 729c5066ac..59b8954a48 100644
--- a/source/libs/scheduler/src/schTask.c
+++ b/source/libs/scheduler/src/schTask.c
@@ -1134,6 +1134,7 @@ int32_t schLaunchLocalTask(SSchJob *pJob, SSchTask *pTask) {
qwMsg.msg = pTask->plan;
qwMsg.msgType = pTask->plan->msgType;
qwMsg.connInfo.handle = pJob->conn.pTrans;
+ qwMsg.pWorkerCb = pJob->pWorkerCb;
if (SCH_IS_EXPLAIN_JOB(pJob)) {
explainRes = taosArrayInit(pJob->taskNum, sizeof(SExplainLocalRsp));
diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c
index 91196f31e0..41124d8543 100644
--- a/source/libs/stream/src/streamCheckStatus.c
+++ b/source/libs/stream/src/streamCheckStatus.c
@@ -65,12 +65,7 @@ int32_t streamTaskCheckStatus(SStreamTask* pTask, int32_t upstreamTaskId, int32_
", prev:%" PRId64,
id, upstreamTaskId, vgId, stage, pInfo->stage);
// record the checkpoint failure id and sent to mnode
- streamMutexLock(&pTask->lock);
- ETaskStatus status = streamTaskGetStatus(pTask).state;
- if (status == TASK_STATUS__CK) {
- streamTaskSetFailedCheckpointId(pTask);
- }
- streamMutexUnlock(&pTask->lock);
+ streamTaskSetCheckpointFailed(pTask);
}
if (pInfo->stage != stage) {
diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c
index d0bf24bd03..e091d0f34b 100644
--- a/source/libs/stream/src/streamCheckpoint.c
+++ b/source/libs/stream/src/streamCheckpoint.c
@@ -153,9 +153,9 @@ int32_t streamTaskProcessCheckpointTriggerRsp(SStreamTask* pTask, SCheckpointTri
streamMutexUnlock(&pInfo->lock);
// NOTE: here we do not do the duplicated checkpoint-trigger msg check, since it will be done by following functions.
- (void)appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER, pRsp->checkpointId, pRsp->transId,
- pRsp->upstreamTaskId);
- return TSDB_CODE_SUCCESS;
+ int32_t code = appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER, pRsp->checkpointId, pRsp->transId,
+ pRsp->upstreamTaskId);
+ return code;
}
int32_t streamTaskSendCheckpointTriggerMsg(SStreamTask* pTask, int32_t dstTaskId, int32_t downstreamNodeId,
@@ -192,6 +192,7 @@ int32_t streamTaskSendCheckpointTriggerMsg(SStreamTask* pTask, int32_t dstTaskId
int32_t continueDispatchCheckpointTriggerBlock(SStreamDataBlock* pBlock, SStreamTask* pTask) {
pBlock->srcTaskId = pTask->id.taskId;
pBlock->srcVgId = pTask->pMeta->vgId;
+
if (pTask->chkInfo.pActiveInfo->dispatchTrigger == true) {
stError("s-task:%s already dispatch checkpoint-trigger, not dispatch again", pTask->id.idStr);
return 0;
@@ -246,7 +247,7 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock
code = initCheckpointReadyMsg(pTask, pInfo->nodeId, pBlock->srcTaskId, pInfo->childId, checkpointId, &msg);
if (code == TSDB_CODE_SUCCESS) {
- (void)tmsgSendReq(&pInfo->epSet, &msg);
+ code = tmsgSendReq(&pInfo->epSet, &msg);
}
}
@@ -358,9 +359,9 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock
if (type == TASK_OUTPUT__FIXED_DISPATCH || type == TASK_OUTPUT__SHUFFLE_DISPATCH) {
stDebug("s-task:%s set childIdx:%d, and add checkpoint-trigger block into outputQ", id, pTask->info.selfChildId);
- (void)continueDispatchCheckpointTriggerBlock(pBlock, pTask); // todo handle this failure
+ code = continueDispatchCheckpointTriggerBlock(pBlock, pTask); // todo handle this failure
} else { // only one task exists, no need to dispatch downstream info
- (void)appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, pActiveInfo->activeId, pActiveInfo->transId,
+ code = appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, pActiveInfo->activeId, pActiveInfo->transId,
-1);
streamFreeQitem((SStreamQueueItem*)pBlock);
}
@@ -372,7 +373,7 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock
// todo: handle this
// update the child Id for downstream tasks
- (void) streamAddCheckpointReadyMsg(pTask, pBlock->srcTaskId, pTask->info.selfChildId, checkpointId);
+ code = streamAddCheckpointReadyMsg(pTask, pBlock->srcTaskId, pTask->info.selfChildId, checkpointId);
// there are still some upstream tasks not send checkpoint request, do nothing and wait for then
if (pActiveInfo->allUpstreamTriggerRecv != 1) {
@@ -384,7 +385,7 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock
if (taskLevel == TASK_LEVEL__SINK) {
stDebug("s-task:%s process checkpoint-trigger block, all %d upstreams sent, send ready msg to upstream", id, num);
streamFreeQitem((SStreamQueueItem*)pBlock);
- (void)streamTaskBuildCheckpoint(pTask); // todo: not handle error yet
+ code = streamTaskBuildCheckpoint(pTask); // todo: not handle error yet
} else { // source & agg tasks need to forward the checkpoint msg downwards
stDebug("s-task:%s process checkpoint-trigger block, all %d upstreams sent, forwards to downstream", id, num);
flushStateDataInExecutor(pTask, (SStreamQueueItem*)pBlock);
@@ -480,7 +481,7 @@ int32_t streamProcessCheckpointReadyMsg(SStreamTask* pTask, int64_t checkpointId
} else {
if ((notReady == 0) && (code == 0) && (!alreadyHandled)) {
stDebug("s-task:%s all downstream tasks have completed build checkpoint, do checkpoint for current task", id);
- (void)appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, checkpointId, transId, -1);
+ code = appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT, checkpointId, transId, -1);
}
}
@@ -562,7 +563,7 @@ int32_t streamTaskUpdateTaskCheckpointInfo(SStreamTask* pTask, bool restored, SV
// drop task should not in the meta-lock, and drop the related fill-history task now
streamMetaWUnLock(pMeta);
if (pReq->dropRelHTask) {
- (void) streamMetaUnregisterTask(pMeta, pReq->hStreamId, pReq->hTaskId);
+ code = streamMetaUnregisterTask(pMeta, pReq->hStreamId, pReq->hTaskId);
int32_t numOfTasks = streamMetaGetNumOfTasks(pMeta);
stDebug("s-task:%s vgId:%d related fill-history task:0x%x dropped in update checkpointInfo, remain tasks:%d",
id, vgId, pReq->taskId, numOfTasks);
@@ -639,14 +640,14 @@ int32_t streamTaskUpdateTaskCheckpointInfo(SStreamTask* pTask, bool restored, SV
if (code != TSDB_CODE_SUCCESS) {
stError("s-task:%s vgId:%d failed to save task info after do checkpoint, checkpointId:%" PRId64 ", since %s", id,
vgId, pReq->checkpointId, terrstr());
- return code;
+ return TSDB_CODE_SUCCESS;
}
streamMetaWUnLock(pMeta);
// drop task should not in the meta-lock, and drop the related fill-history task now
if (pReq->dropRelHTask) {
- (void) streamMetaUnregisterTask(pMeta, pReq->hStreamId, pReq->hTaskId);
+ code = streamMetaUnregisterTask(pMeta, pReq->hStreamId, pReq->hTaskId);
int32_t numOfTasks = streamMetaGetNumOfTasks(pMeta);
stDebug("s-task:%s vgId:%d related fill-history task:0x%x dropped, remain tasks:%d", id, vgId,
(int32_t)pReq->hTaskId, numOfTasks);
@@ -673,6 +674,15 @@ void streamTaskSetFailedCheckpointId(SStreamTask* pTask) {
}
}
+void streamTaskSetCheckpointFailed(SStreamTask* pTask) {
+ streamMutexLock(&pTask->lock);
+ ETaskStatus status = streamTaskGetStatus(pTask).state;
+ if (status == TASK_STATUS__CK) {
+ streamTaskSetFailedCheckpointId(pTask);
+ }
+ streamMutexUnlock(&pTask->lock);
+}
+
static int32_t getCheckpointDataMeta(const char* id, const char* path, SArray* list) {
int32_t code = 0;
int32_t cap = strlen(path) + 64;
@@ -982,7 +992,11 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) {
// do send retrieve checkpoint trigger msg to upstream
int32_t size = taosArrayGetSize(pNotSendList);
- (void)doSendRetrieveTriggerMsg(pTask, pNotSendList);
+ int32_t code = doSendRetrieveTriggerMsg(pTask, pNotSendList);
+ if (code) {
+ stError("s-task:%s vgId:%d failed to retrieve trigger msg, code:%s", pTask->id.idStr, vgId, tstrerror(code));
+ }
+
streamMutexUnlock(&pActiveInfo->lock);
// check every 100ms
@@ -1111,26 +1125,20 @@ void streamTaskGetTriggerRecvStatus(SStreamTask* pTask, int32_t* pRecved, int32_
// record the dispatch checkpoint trigger info in the list
// memory insufficient may cause the stream computing stopped
-void streamTaskInitTriggerDispatchInfo(SStreamTask* pTask) {
+int32_t streamTaskInitTriggerDispatchInfo(SStreamTask* pTask) {
SActiveCheckpointInfo* pInfo = pTask->chkInfo.pActiveInfo;
+ int64_t now = taosGetTimestampMs();
- int64_t now = taosGetTimestampMs();
streamMutexLock(&pInfo->lock);
-
- // outputQ should be empty here
- if (streamQueueGetNumOfUnAccessedItems(pTask->outputq.queue) > 0) {
- stFatal("s-task:%s items are still in outputQ, failed to init trigger dispatch info", pTask->id.idStr);
- return;
- }
-
pInfo->dispatchTrigger = true;
if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) {
STaskDispatcherFixed* pDispatch = &pTask->outputInfo.fixedDispatcher;
STaskTriggerSendInfo p = {.sendTs = now, .recved = false, .nodeId = pDispatch->nodeId, .taskId = pDispatch->taskId};
void* px = taosArrayPush(pInfo->pDispatchTriggerList, &p);
- if (px == NULL) {
- // pause the stream task, if memory not enough
+ if (px == NULL) { // pause the stream task, if memory not enough
+ streamMutexUnlock(&pInfo->lock);
+ return terrno;
}
} else {
for (int32_t i = 0; i < streamTaskGetNumOfDownstream(pTask); ++i) {
@@ -1141,13 +1149,15 @@ void streamTaskInitTriggerDispatchInfo(SStreamTask* pTask) {
STaskTriggerSendInfo p = {.sendTs = now, .recved = false, .nodeId = pVgInfo->vgId, .taskId = pVgInfo->taskId};
void* px = taosArrayPush(pInfo->pDispatchTriggerList, &p);
- if (px == NULL) {
- // pause the stream task, if memory not enough
+ if (px == NULL) { // pause the stream task, if memory not enough
+ streamMutexUnlock(&pInfo->lock);
+ return terrno;
}
}
}
streamMutexUnlock(&pInfo->lock);
+ return 0;
}
int32_t streamTaskGetNumOfConfirmed(SActiveCheckpointInfo* pInfo) {
@@ -1257,7 +1267,11 @@ static int32_t uploadCheckpointToS3(const char* id, const char* path) {
}
}
- (void) taosCloseDir(&pDir);
+ int32_t ret = taosCloseDir(&pDir);
+ if (code == 0 && ret != 0) {
+ code = ret;
+ }
+
return code;
}
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 0bc090cdfe..2a32a1d522 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -726,8 +726,11 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S
}
int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
- const char* id = pTask->id.idStr;
- int32_t numOfElems = streamQueueGetNumOfItems(pTask->outputq.queue);
+ const char* id = pTask->id.idStr;
+ int32_t code = 0;
+ SStreamDataBlock* pBlock = NULL;
+
+ int32_t numOfElems = streamQueueGetNumOfItems(pTask->outputq.queue);
if (numOfElems > 0) {
double size = SIZE_IN_MiB(taosQueueMemorySize(pTask->outputq.queue->pQueue));
int32_t numOfUnAccessed = streamQueueGetNumOfUnAccessedItems(pTask->outputq.queue);
@@ -755,35 +758,49 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
stDebug("s-task:%s start to dispatch msg, set output status:%d", id, pTask->outputq.status);
}
- SStreamDataBlock* pBlock = NULL;
- streamQueueNextItem(pTask->outputq.queue, (SStreamQueueItem**)&pBlock);
- if (pBlock == NULL) {
- atomic_store_8(&pTask->outputq.status, TASK_OUTPUT_STATUS__NORMAL);
- stDebug("s-task:%s not dispatch since no elems in outputQ, output status:%d", id, pTask->outputq.status);
- return 0;
- }
+ while (1) {
+ streamQueueNextItem(pTask->outputq.queue, (SStreamQueueItem**)&pBlock);
+ if (pBlock == NULL) {
+ atomic_store_8(&pTask->outputq.status, TASK_OUTPUT_STATUS__NORMAL);
+ stDebug("s-task:%s not dispatch since no elems in outputQ, output status:%d", id, pTask->outputq.status);
+ return 0;
+ }
- int32_t type = pBlock->type;
- if (!(type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__CHECKPOINT_TRIGGER ||
- type == STREAM_INPUT__TRANS_STATE)) {
- stError("s-task:%s invalid dispatch block type:%d", id, type);
- return TSDB_CODE_INTERNAL_ERROR;
- }
+ int32_t type = pBlock->type;
+ if (!(type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__CHECKPOINT_TRIGGER ||
+ type == STREAM_INPUT__TRANS_STATE)) {
+ stError("s-task:%s invalid dispatch block type:%d", id, type);
+ return TSDB_CODE_INTERNAL_ERROR;
+ }
- pTask->execInfo.dispatch += 1;
+ pTask->execInfo.dispatch += 1;
- streamMutexLock(&pTask->msgInfo.lock);
- initDispatchInfo(&pTask->msgInfo, pTask->execInfo.dispatch);
- streamMutexUnlock(&pTask->msgInfo.lock);
+ streamMutexLock(&pTask->msgInfo.lock);
+ initDispatchInfo(&pTask->msgInfo, pTask->execInfo.dispatch);
+ streamMutexUnlock(&pTask->msgInfo.lock);
- int32_t code = doBuildDispatchMsg(pTask, pBlock);
- if (code == 0) {
- destroyStreamDataBlock(pBlock);
- } else { // todo handle build dispatch msg failed
- }
+ code = doBuildDispatchMsg(pTask, pBlock);
+ if (code == 0) {
+ destroyStreamDataBlock(pBlock);
+ } else { // todo handle build dispatch msg failed
+ }
- if (type == STREAM_INPUT__CHECKPOINT_TRIGGER) {
- streamTaskInitTriggerDispatchInfo(pTask);
+ if (type == STREAM_INPUT__CHECKPOINT_TRIGGER) {
+ // outputQ should be empty here, otherwise, set the checkpoint failed due to the retrieve req happens
+ if (streamQueueGetNumOfUnAccessedItems(pTask->outputq.queue) > 0) {
+ stError("s-task:%s items are still in outputQ due to downstream retrieve, failed to init trigger dispatch",
+ pTask->id.idStr);
+ streamTaskSetCheckpointFailed(pTask);
+ clearBufferedDispatchMsg(pTask);
+ continue;
+ }
+
+ code = streamTaskInitTriggerDispatchInfo(pTask);
+ if (code != TSDB_CODE_SUCCESS) { // todo handle error
+ }
+ }
+
+ break;
}
code = sendDispatchMsg(pTask, pTask->msgInfo.pData);
@@ -1238,7 +1255,11 @@ int32_t streamAddCheckpointSourceRspMsg(SStreamCheckpointSourceReq* pReq, SRpcHa
.recvTs = taosGetTimestampMs(), .transId = pReq->transId, .checkpointId = pReq->checkpointId};
// todo retry until it success
- (void)streamTaskBuildCheckpointSourceRsp(pReq, pRpcInfo, &info.msg, TSDB_CODE_SUCCESS);
+ int32_t code = streamTaskBuildCheckpointSourceRsp(pReq, pRpcInfo, &info.msg, TSDB_CODE_SUCCESS);
+ if (code) {
+ stError("s-task:%s failed to build checkpoint-source rsp, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo;
streamMutexLock(&pActiveInfo->lock);
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index fca0bf403f..bf4567a273 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -98,14 +98,13 @@ static int32_t doDumpResult(SStreamTask* pTask, SStreamQueueItem* pItem, SArray*
void streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* totalSize, int32_t* totalBlocks) {
int32_t code = TSDB_CODE_SUCCESS;
void* pExecutor = pTask->exec.pExecutor;
-
- *totalBlocks = 0;
- *totalSize = 0;
-
int32_t size = 0;
int32_t numOfBlocks = 0;
SArray* pRes = NULL;
+ *totalBlocks = 0;
+ *totalSize = 0;
+
while (1) {
if (pRes == NULL) {
pRes = taosArrayInit(4, sizeof(SSDataBlock));
@@ -131,7 +130,8 @@ void streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* to
if (pItem->type == STREAM_INPUT__DATA_RETRIEVE) {
SSDataBlock block = {0};
const SStreamDataBlock* pRetrieveBlock = (const SStreamDataBlock*)pItem;
- int32_t num = taosArrayGetSize(pRetrieveBlock->blocks);
+
+ int32_t num = taosArrayGetSize(pRetrieveBlock->blocks);
if (num != 1) {
stError("s-task:%s invalid retrieve block number:%d, ignore", pTask->id.idStr, num);
continue;
@@ -244,9 +244,10 @@ static void streamScanHistoryDataImpl(SStreamTask* pTask, SArray* pRes, int32_t*
SSDataBlock* output = NULL;
uint64_t ts = 0;
code = qExecTask(exec, &output, &ts);
- if (code != TSDB_CODE_TSC_QUERY_KILLED && code != TSDB_CODE_SUCCESS) {
+ if (code != TSDB_CODE_TSC_QUERY_KILLED && code != TSDB_CODE_SUCCESS) { // if out of memory occurs, quit
stError("s-task:%s scan-history data error occurred code:%s, continue scan-history", pTask->id.idStr,
tstrerror(code));
+ qResetTaskCode(exec);
continue;
}
@@ -596,12 +597,32 @@ void streamProcessTransstateBlock(SStreamTask* pTask, SStreamDataBlock* pBlock)
// static void streamTaskSetIdleInfo(SStreamTask* pTask, int32_t idleTime) { pTask->status.schedIdleTime = idleTime; }
static void setLastExecTs(SStreamTask* pTask, int64_t ts) { pTask->status.lastExecTs = ts; }
+static void doRecordThroughput(STaskExecStatisInfo* pInfo, int64_t totalBlocks, int64_t totalSize, int64_t blockSize,
+ double st, const char* id) {
+ double el = (taosGetTimestampMs() - st) / 1000.0;
+
+ stDebug("s-task:%s batch of input blocks exec end, elapsed time:%.2fs, result size:%.2fMiB, numOfBlocks:%" PRId64, id,
+ el, SIZE_IN_MiB(totalSize), totalBlocks);
+
+ pInfo->outputDataBlocks += totalBlocks;
+ pInfo->outputDataSize += totalSize;
+ if (fabs(el - 0.0) <= DBL_EPSILON) {
+ pInfo->procsThroughput = 0;
+ pInfo->outputThroughput = 0;
+ } else {
+ pInfo->outputThroughput = (totalSize / el);
+ pInfo->procsThroughput = (blockSize / el);
+ }
+}
+
static void doStreamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pBlock, int32_t num) {
const char* id = pTask->id.idStr;
int32_t blockSize = 0;
int64_t st = taosGetTimestampMs();
SCheckpointInfo* pInfo = &pTask->chkInfo;
int64_t ver = pInfo->processedVer;
+ int64_t totalSize = 0;
+ int32_t totalBlocks = 0;
stDebug("s-task:%s start to process batch blocks, num:%d, type:%s", id, num, streamQueueItemGetTypeStr(pBlock->type));
@@ -611,23 +632,8 @@ static void doStreamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pBlock, i
return;
}
- int64_t totalSize = 0;
- int32_t totalBlocks = 0;
streamTaskExecImpl(pTask, pBlock, &totalSize, &totalBlocks);
-
- double el = (taosGetTimestampMs() - st) / 1000.0;
- stDebug("s-task:%s batch of input blocks exec end, elapsed time:%.2fs, result size:%.2fMiB, numOfBlocks:%d", id, el,
- SIZE_IN_MiB(totalSize), totalBlocks);
-
- pTask->execInfo.outputDataBlocks += totalBlocks;
- pTask->execInfo.outputDataSize += totalSize;
- if (fabs(el - 0.0) <= DBL_EPSILON) {
- pTask->execInfo.procsThroughput = 0;
- pTask->execInfo.outputThroughput = 0;
- } else {
- pTask->execInfo.outputThroughput = (totalSize / el);
- pTask->execInfo.procsThroughput = (blockSize / el);
- }
+ doRecordThroughput(&pTask->execInfo, totalBlocks, totalSize, blockSize, st, pTask->id.idStr);
// update the currentVer if processing the submit blocks.
if (!(pInfo->checkpointVer <= pInfo->nextProcessVer && ver >= pInfo->checkpointVer)) {
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
index 084eb7b827..36d0086ac6 100644
--- a/source/libs/stream/src/streamMeta.c
+++ b/source/libs/stream/src/streamMeta.c
@@ -1224,7 +1224,7 @@ void streamMetaWUnLock(SStreamMeta* pMeta) {
}
int32_t streamMetaSendMsgBeforeCloseTasks(SStreamMeta* pMeta, SArray** pList) {
- QRY_OPTR_CHECK(pList);
+ QRY_PARAM_CHECK(pList);
int32_t code = 0;
SArray* pTaskList = taosArrayDup(pMeta->pTaskList, NULL);
@@ -1254,16 +1254,7 @@ int32_t streamMetaSendMsgBeforeCloseTasks(SStreamMeta* pMeta, SArray** pList) {
continue;
}
- streamMutexLock(&pTask->lock);
-
- SStreamTaskState pState = streamTaskGetStatus(pTask);
- if (pState.state == TASK_STATUS__CK) {
- streamTaskSetFailedCheckpointId(pTask);
- } else {
- stDebug("s-task:%s status:%s not reset the checkpoint", pTask->id.idStr, pState.name);
- }
-
- streamMutexUnlock(&pTask->lock);
+ streamTaskSetCheckpointFailed(pTask);
streamMetaReleaseTask(pMeta, pTask);
}
diff --git a/source/libs/stream/src/streamMsg.c b/source/libs/stream/src/streamMsg.c
index 8105614d76..1c512888e7 100644
--- a/source/libs/stream/src/streamMsg.c
+++ b/source/libs/stream/src/streamMsg.c
@@ -19,281 +19,347 @@
#include "streamInt.h"
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamUpstreamEpInfo* pInfo) {
- if (tEncodeI32(pEncoder, pInfo->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pInfo->nodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pInfo->childId) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pInfo->epSet) < 0) return -1;
- if (tEncodeI64(pEncoder, pInfo->stage) < 0) return -1;
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pInfo->taskId));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pInfo->nodeId));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pInfo->childId));
+ TAOS_CHECK_RETURN(tEncodeSEpSet(pEncoder, &pInfo->epSet));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pInfo->stage));
return 0;
}
int32_t tDecodeStreamEpInfo(SDecoder* pDecoder, SStreamUpstreamEpInfo* pInfo) {
- if (tDecodeI32(pDecoder, &pInfo->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pInfo->nodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pInfo->childId) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &pInfo->epSet) < 0) return -1;
- if (tDecodeI64(pDecoder, &pInfo->stage) < 0) return -1;
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pInfo->taskId));
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pInfo->nodeId));
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pInfo->childId));
+ TAOS_CHECK_RETURN(tDecodeSEpSet(pDecoder, &pInfo->epSet));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pInfo->stage));
return 0;
}
int32_t tEncodeStreamCheckpointSourceReq(SEncoder* pEncoder, const SStreamCheckpointSourceReq* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->checkpointId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->nodeId) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pReq->mgmtEps) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->mnodeId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->expireTime) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->transId) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->mndTrigger) < 0) return -1;
+ TAOS_CHECK_RETURN(tStartEncode(pEncoder));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pReq->checkpointId));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pReq->taskId));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pReq->nodeId));
+ TAOS_CHECK_RETURN(tEncodeSEpSet(pEncoder, &pReq->mgmtEps));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pReq->mnodeId));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pReq->expireTime));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pReq->transId));
+ TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pReq->mndTrigger));
tEndEncode(pEncoder);
return pEncoder->pos;
}
int32_t tDecodeStreamCheckpointSourceReq(SDecoder* pDecoder, SStreamCheckpointSourceReq* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->checkpointId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->nodeId) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &pReq->mgmtEps) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->mnodeId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->expireTime) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->transId) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->mndTrigger) < 0) return -1;
+ TAOS_CHECK_RETURN(tStartDecode(pDecoder));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pReq->checkpointId));
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pReq->taskId));
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pReq->nodeId));
+ TAOS_CHECK_RETURN(tDecodeSEpSet(pDecoder, &pReq->mgmtEps));
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pReq->mnodeId));
+ TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pReq->expireTime));
+ TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pReq->transId));
+ TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pReq->mndTrigger));
tEndDecode(pDecoder);
return 0;
}
int32_t tEncodeStreamCheckpointSourceRsp(SEncoder* pEncoder, const SStreamCheckpointSourceRsp* pRsp) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->streamId) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->checkpointId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->nodeId) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->expireTime) < 0) return -1;
- if (tEncodeI8(pEncoder, pRsp->success) < 0) return -1;
+ TAOS_CHECK_RETURN(tStartEncode(pEncoder));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->streamId));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->checkpointId));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->taskId));
+ TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pRsp->nodeId));
+ TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->expireTime));
+ TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pRsp->success));
tEndEncode(pEncoder);
return pEncoder->pos;
}
int32_t tEncodeStreamTaskUpdateMsg(SEncoder* pEncoder, const SStreamTaskNodeUpdateMsg* pMsg) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pMsg->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pMsg->taskId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pMsg->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pMsg->taskId));
int32_t size = taosArrayGetSize(pMsg->pNodeList);
- if (tEncodeI32(pEncoder, size) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, size));
for (int32_t i = 0; i < size; ++i) {
SNodeUpdateInfo* pInfo = taosArrayGet(pMsg->pNodeList, i);
if (pInfo == NULL) {
- return terrno;
+ TAOS_CHECK_EXIT(terrno);
}
- if (tEncodeI32(pEncoder, pInfo->nodeId) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pInfo->prevEp) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pInfo->newEp) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pInfo->nodeId));
+ TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pInfo->prevEp));
+ TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pInfo->newEp));
}
// todo this new attribute will be result in being incompatible with previous version
- if (tEncodeI32(pEncoder, pMsg->transId) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pMsg->transId));
tEndEncode(pEncoder);
- return pEncoder->pos;
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeStreamTaskUpdateMsg(SDecoder* pDecoder, SStreamTaskNodeUpdateMsg* pMsg) {
int32_t code = 0;
+ int32_t lino;
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pMsg->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pMsg->taskId) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pMsg->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pMsg->taskId));
int32_t size = 0;
- if (tDecodeI32(pDecoder, &size) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &size));
pMsg->pNodeList = taosArrayInit(size, sizeof(SNodeUpdateInfo));
+ if (pMsg->pNodeList == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < size; ++i) {
SNodeUpdateInfo info = {0};
- if (tDecodeI32(pDecoder, &info.nodeId) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &info.prevEp) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &info.newEp) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &info.nodeId));
+ TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &info.prevEp));
+ TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &info.newEp));
- void* p = taosArrayPush(pMsg->pNodeList, &info);
- if (p == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
+ if (taosArrayPush(pMsg->pNodeList, &info) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
}
}
- if (tDecodeI32(pDecoder, &pMsg->transId) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pMsg->transId));
tEndDecode(pDecoder);
+_exit:
return code;
}
int32_t tEncodeStreamTaskCheckReq(SEncoder* pEncoder, const SStreamTaskCheckReq* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->reqId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->childId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->stage) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->reqId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->downstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->downstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->childId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->stage));
tEndEncode(pEncoder);
- return pEncoder->pos;
+
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeStreamTaskCheckReq(SDecoder* pDecoder, SStreamTaskCheckReq* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->reqId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->downstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->downstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->childId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->stage) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->reqId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->downstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->downstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->childId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->stage));
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tEncodeStreamTaskCheckRsp(SEncoder* pEncoder, const SStreamTaskCheckRsp* pRsp) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->reqId) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->upstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->upstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->downstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->downstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->childId) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->oldStage) < 0) return -1;
- if (tEncodeI8(pEncoder, pRsp->status) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pRsp->reqId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pRsp->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->upstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->upstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->downstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->downstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->childId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pRsp->oldStage));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pRsp->status));
tEndEncode(pEncoder);
- return pEncoder->pos;
+
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeStreamTaskCheckRsp(SDecoder* pDecoder, SStreamTaskCheckRsp* pRsp) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->reqId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->upstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->upstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->downstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->downstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->childId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->oldStage) < 0) return -1;
- if (tDecodeI8(pDecoder, &pRsp->status) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->reqId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->upstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->upstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->downstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->downstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->childId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->oldStage));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pRsp->status));
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tEncodeStreamCheckpointReadyMsg(SEncoder* pEncoder, const SStreamCheckpointReadyMsg* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->checkpointId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->childId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->checkpointId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->downstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->downstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->childId));
tEndEncode(pEncoder);
- return pEncoder->pos;
+
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeStreamCheckpointReadyMsg(SDecoder* pDecoder, SStreamCheckpointReadyMsg* pRsp) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->streamId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->checkpointId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->downstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->downstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->upstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->upstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->childId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->streamId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->checkpointId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->downstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->downstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->upstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->upstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->childId));
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tEncodeStreamDispatchReq(SEncoder* pEncoder, const SStreamDispatchReq* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->stage) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->msgId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->srcVgId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->type) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->type) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamChildId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamRelTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->blockNum) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->totalLen) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->stage));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->msgId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->srcVgId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->type));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->type));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamChildId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamRelTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->blockNum));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->totalLen));
if (taosArrayGetSize(pReq->data) != pReq->blockNum || taosArrayGetSize(pReq->dataLen) != pReq->blockNum) {
stError("invalid dispatch req msg");
- return TSDB_CODE_INVALID_MSG;
+ TAOS_CHECK_EXIT(TSDB_CODE_INVALID_MSG);
}
for (int32_t i = 0; i < pReq->blockNum; i++) {
int32_t* pLen = taosArrayGet(pReq->dataLen, i);
void* data = taosArrayGetP(pReq->data, i);
if (data == NULL || pLen == NULL) {
- return terrno;
+ TAOS_CHECK_EXIT(terrno);
}
- if (tEncodeI32(pEncoder, *pLen) < 0) return -1;
- if (tEncodeBinary(pEncoder, data, *pLen) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, *pLen));
+ TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, data, *pLen));
}
tEndEncode(pEncoder);
- return pEncoder->pos;
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->stage) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->msgId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->srcVgId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->type) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->type) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamChildId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamRelTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->blockNum) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->totalLen) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
- pReq->data = taosArrayInit(pReq->blockNum, sizeof(void*));
- pReq->dataLen = taosArrayInit(pReq->blockNum, sizeof(int32_t));
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->stage));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->msgId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->srcVgId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->type));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->type));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamChildId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamRelTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->blockNum));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->totalLen));
+
+ if ((pReq->data = taosArrayInit(pReq->blockNum, sizeof(void*))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ if ((pReq->dataLen = taosArrayInit(pReq->blockNum, sizeof(int32_t))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < pReq->blockNum; i++) {
int32_t len1;
uint64_t len2;
void* data;
- if (tDecodeI32(pDecoder, &len1) < 0) return -1;
- if (tDecodeBinaryAlloc(pDecoder, &data, &len2) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &len1));
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(pDecoder, &data, &len2));
if (len1 != len2) {
- return TSDB_CODE_INVALID_MSG;
+ TAOS_CHECK_EXIT(TSDB_CODE_INVALID_MSG);
}
- void* p = taosArrayPush(pReq->dataLen, &len1);
- if (p == NULL) {
- tEndDecode(pDecoder);
- return TSDB_CODE_OUT_OF_MEMORY;
+ if (taosArrayPush(pReq->dataLen, &len1) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
}
- p = taosArrayPush(pReq->data, &data);
- if (p == NULL) {
- tEndDecode(pDecoder);
- return TSDB_CODE_OUT_OF_MEMORY;
+ if (taosArrayPush(pReq->data, &data) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
}
}
tEndDecode(pDecoder);
- return 0;
+_exit:
+ return code;
}
void tCleanupStreamDispatchReq(SStreamDispatchReq* pReq) {
@@ -302,188 +368,220 @@ void tCleanupStreamDispatchReq(SStreamDispatchReq* pReq) {
}
int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->reqId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->dstNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->dstTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->srcNodeId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->srcTaskId) < 0) return -1;
- if (tEncodeBinary(pEncoder, (const uint8_t*)pReq->pRetrieve, pReq->retrieveLen) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->reqId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->dstNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->dstTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->srcNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->srcTaskId));
+ TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, (const uint8_t*)pReq->pRetrieve, pReq->retrieveLen));
tEndEncode(pEncoder);
- return pEncoder->pos;
+
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->reqId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->dstNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->dstTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->srcNodeId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->srcTaskId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->reqId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->dstNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->dstTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->srcNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->srcTaskId));
uint64_t len = 0;
- if (tDecodeBinaryAlloc(pDecoder, (void**)&pReq->pRetrieve, &len) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(pDecoder, (void**)&pReq->pRetrieve, &len));
pReq->retrieveLen = (int32_t)len;
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
void tCleanupStreamRetrieveReq(SStreamRetrieveReq* pReq) { taosMemoryFree(pReq->pRetrieve); }
int32_t tEncodeStreamTaskCheckpointReq(SEncoder* pEncoder, const SStreamTaskCheckpointReq* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->nodeId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->nodeId));
tEndEncode(pEncoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tDecodeStreamTaskCheckpointReq(SDecoder* pDecoder, SStreamTaskCheckpointReq* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->nodeId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->nodeId));
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->vgId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->numOfTasks) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->vgId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->numOfTasks));
for (int32_t i = 0; i < pReq->numOfTasks; ++i) {
STaskStatusEntry* ps = taosArrayGet(pReq->pTaskStatus, i);
if (ps == NULL) {
- return terrno;
+ TAOS_CHECK_EXIT(terrno);
}
- if (tEncodeI64(pEncoder, ps->id.streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, ps->id.taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, ps->status) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->stage) < 0) return -1;
- if (tEncodeI32(pEncoder, ps->nodeId) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->inputQUsed) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->inputRate) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->procsTotal) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->procsThroughput) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->outputTotal) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->outputThroughput) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->sinkQuota) < 0) return -1;
- if (tEncodeDouble(pEncoder, ps->sinkDataSize) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->processedVer) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->verRange.minVer) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->verRange.maxVer) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->checkpointInfo.activeId) < 0) return -1;
- if (tEncodeI8(pEncoder, ps->checkpointInfo.failed) < 0) return -1;
- if (tEncodeI32(pEncoder, ps->checkpointInfo.activeTransId) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->checkpointInfo.latestId) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->checkpointInfo.latestVer) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->checkpointInfo.latestTime) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->checkpointInfo.latestSize) < 0) return -1;
- if (tEncodeI8(pEncoder, ps->checkpointInfo.remoteBackup) < 0) return -1;
- if (tEncodeI8(pEncoder, ps->checkpointInfo.consensusChkptId) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->checkpointInfo.consensusTs) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->startTime) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->startCheckpointId) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->startCheckpointVer) < 0) return -1;
- if (tEncodeI64(pEncoder, ps->hTaskId) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->id.streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, ps->id.taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, ps->status));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->stage));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, ps->nodeId));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->inputQUsed));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->inputRate));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->procsTotal));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->procsThroughput));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->outputTotal));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->outputThroughput));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->sinkQuota));
+ TAOS_CHECK_EXIT(tEncodeDouble(pEncoder, ps->sinkDataSize));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->processedVer));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->verRange.minVer));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->verRange.maxVer));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->checkpointInfo.activeId));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, ps->checkpointInfo.failed));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, ps->checkpointInfo.activeTransId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->checkpointInfo.latestId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->checkpointInfo.latestVer));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->checkpointInfo.latestTime));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->checkpointInfo.latestSize));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, ps->checkpointInfo.remoteBackup));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, ps->checkpointInfo.consensusChkptId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->checkpointInfo.consensusTs));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->startTime));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->startCheckpointId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->startCheckpointVer));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, ps->hTaskId));
}
int32_t numOfVgs = taosArrayGetSize(pReq->pUpdateNodes);
- if (tEncodeI32(pEncoder, numOfVgs) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, numOfVgs));
for (int j = 0; j < numOfVgs; ++j) {
int32_t* pVgId = taosArrayGet(pReq->pUpdateNodes, j);
if (pVgId == NULL) {
- return terrno;
+ TAOS_CHECK_EXIT(terrno);
}
- if (tEncodeI32(pEncoder, *pVgId) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, *pVgId));
}
- if (tEncodeI32(pEncoder, pReq->msgId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->ts) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->msgId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->ts));
tEndEncode(pEncoder);
- return pEncoder->pos;
+
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeStreamHbMsg(SDecoder* pDecoder, SStreamHbMsg* pReq) {
int32_t code = 0;
+ int32_t lino;
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->vgId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->numOfTasks) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->vgId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->numOfTasks));
- pReq->pTaskStatus = taosArrayInit(pReq->numOfTasks, sizeof(STaskStatusEntry));
+ if ((pReq->pTaskStatus = taosArrayInit(pReq->numOfTasks, sizeof(STaskStatusEntry))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < pReq->numOfTasks; ++i) {
int32_t taskId = 0;
STaskStatusEntry entry = {0};
- if (tDecodeI64(pDecoder, &entry.id.streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &entry.status) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.stage) < 0) return -1;
- if (tDecodeI32(pDecoder, &entry.nodeId) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.inputQUsed) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.inputRate) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.procsTotal) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.procsThroughput) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.outputTotal) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.outputThroughput) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.sinkQuota) < 0) return -1;
- if (tDecodeDouble(pDecoder, &entry.sinkDataSize) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.processedVer) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.verRange.minVer) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.verRange.maxVer) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.checkpointInfo.activeId) < 0) return -1;
- if (tDecodeI8(pDecoder, &entry.checkpointInfo.failed) < 0) return -1;
- if (tDecodeI32(pDecoder, &entry.checkpointInfo.activeTransId) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.id.streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &entry.status));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.stage));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &entry.nodeId));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.inputQUsed));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.inputRate));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.procsTotal));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.procsThroughput));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.outputTotal));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.outputThroughput));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.sinkQuota));
+ TAOS_CHECK_EXIT(tDecodeDouble(pDecoder, &entry.sinkDataSize));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.processedVer));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.verRange.minVer));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.verRange.maxVer));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.checkpointInfo.activeId));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &entry.checkpointInfo.failed));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &entry.checkpointInfo.activeTransId));
- if (tDecodeI64(pDecoder, &entry.checkpointInfo.latestId) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.checkpointInfo.latestVer) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.checkpointInfo.latestTime) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.checkpointInfo.latestSize) < 0) return -1;
- if (tDecodeI8(pDecoder, &entry.checkpointInfo.remoteBackup) < 0) return -1;
- if (tDecodeI8(pDecoder, &entry.checkpointInfo.consensusChkptId) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.checkpointInfo.consensusTs) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.startTime) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.startCheckpointId) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.startCheckpointVer) < 0) return -1;
- if (tDecodeI64(pDecoder, &entry.hTaskId) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.checkpointInfo.latestId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.checkpointInfo.latestVer));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.checkpointInfo.latestTime));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.checkpointInfo.latestSize));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &entry.checkpointInfo.remoteBackup));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &entry.checkpointInfo.consensusChkptId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.checkpointInfo.consensusTs));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.startTime));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.startCheckpointId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.startCheckpointVer));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &entry.hTaskId));
entry.id.taskId = taskId;
- void* p = taosArrayPush(pReq->pTaskStatus, &entry);
- if (p == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
+ if (taosArrayPush(pReq->pTaskStatus, &entry) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
}
}
int32_t numOfVgs = 0;
- if (tDecodeI32(pDecoder, &numOfVgs) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &numOfVgs));
- pReq->pUpdateNodes = taosArrayInit(numOfVgs, sizeof(int32_t));
+ if ((pReq->pUpdateNodes = taosArrayInit(numOfVgs, sizeof(int32_t))) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int j = 0; j < numOfVgs; ++j) {
int32_t vgId = 0;
- if (tDecodeI32(pDecoder, &vgId) < 0) return -1;
- void* p = taosArrayPush(pReq->pUpdateNodes, &vgId);
- if (p == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &vgId));
+ if (taosArrayPush(pReq->pUpdateNodes, &vgId) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
}
}
- if (tDecodeI32(pDecoder, &pReq->msgId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->ts) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->msgId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->ts));
tEndDecode(pDecoder);
- return 0;
- _err:
- tEndDecode(pDecoder);
+_exit:
return code;
}
@@ -508,212 +606,250 @@ void tCleanupStreamHbMsg(SStreamHbMsg* pMsg) {
}
int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pTask->ver) < 0) return -1;
- if (tEncodeI64(pEncoder, pTask->id.streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pTask->id.taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pTask->info.totalLevel) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->info.taskLevel) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->outputInfo.type) < 0) return -1;
- if (tEncodeI16(pEncoder, pTask->msgInfo.msgType) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
- if (tEncodeI8(pEncoder, pTask->status.taskStatus) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->status.schedStatus) < 0) return -1;
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->ver));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->id.streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->id.taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.totalLevel));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->info.taskLevel));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->outputInfo.type));
+ TAOS_CHECK_EXIT(tEncodeI16(pEncoder, pTask->msgInfo.msgType));
- if (tEncodeI32(pEncoder, pTask->info.selfChildId) < 0) return -1;
- if (tEncodeI32(pEncoder, pTask->info.nodeId) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pTask->info.epSet) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pTask->info.mnodeEpset) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->status.taskStatus));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->status.schedStatus));
- if (tEncodeI64(pEncoder, pTask->chkInfo.checkpointId) < 0) return -1;
- if (tEncodeI64(pEncoder, pTask->chkInfo.checkpointVer) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->info.fillHistory) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.selfChildId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.nodeId));
+ TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pTask->info.epSet));
+ TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pTask->info.mnodeEpset));
- if (tEncodeI64(pEncoder, pTask->hTaskInfo.id.streamId)) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->chkInfo.checkpointId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->chkInfo.checkpointVer));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->info.fillHistory));
+
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->hTaskInfo.id.streamId));
int32_t taskId = pTask->hTaskInfo.id.taskId;
- if (tEncodeI32(pEncoder, taskId)) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, taskId));
- if (tEncodeI64(pEncoder, pTask->streamTaskId.streamId)) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->streamTaskId.streamId));
taskId = pTask->streamTaskId.taskId;
- if (tEncodeI32(pEncoder, taskId)) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, taskId));
- if (tEncodeU64(pEncoder, pTask->dataRange.range.minVer)) return -1;
- if (tEncodeU64(pEncoder, pTask->dataRange.range.maxVer)) return -1;
- if (tEncodeI64(pEncoder, pTask->dataRange.window.skey)) return -1;
- if (tEncodeI64(pEncoder, pTask->dataRange.window.ekey)) return -1;
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTask->dataRange.range.minVer));
+ TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTask->dataRange.range.maxVer));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->dataRange.window.skey));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->dataRange.window.ekey));
int32_t epSz = taosArrayGetSize(pTask->upstreamInfo.pList);
- if (tEncodeI32(pEncoder, epSz) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, epSz));
for (int32_t i = 0; i < epSz; i++) {
SStreamUpstreamEpInfo* pInfo = taosArrayGetP(pTask->upstreamInfo.pList, i);
- if (tEncodeStreamEpInfo(pEncoder, pInfo) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeStreamEpInfo(pEncoder, pInfo));
}
if (pTask->info.taskLevel != TASK_LEVEL__SINK) {
- if (tEncodeCStr(pEncoder, pTask->exec.qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTask->exec.qmsg));
}
if (pTask->outputInfo.type == TASK_OUTPUT__TABLE) {
- if (tEncodeI64(pEncoder, pTask->outputInfo.tbSink.stbUid) < 0) return -1;
- if (tEncodeCStr(pEncoder, pTask->outputInfo.tbSink.stbFullName) < 0) return -1;
- if (tEncodeSSchemaWrapper(pEncoder, pTask->outputInfo.tbSink.pSchemaWrapper) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->outputInfo.tbSink.stbUid));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTask->outputInfo.tbSink.stbFullName));
+ TAOS_CHECK_EXIT(tEncodeSSchemaWrapper(pEncoder, pTask->outputInfo.tbSink.pSchemaWrapper));
} else if (pTask->outputInfo.type == TASK_OUTPUT__SMA) {
- if (tEncodeI64(pEncoder, pTask->outputInfo.smaSink.smaId) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->outputInfo.smaSink.smaId));
} else if (pTask->outputInfo.type == TASK_OUTPUT__FETCH) {
- if (tEncodeI8(pEncoder, pTask->outputInfo.fetchSink.reserved) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->outputInfo.fetchSink.reserved));
} else if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) {
- if (tEncodeI32(pEncoder, pTask->outputInfo.fixedDispatcher.taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pTask->outputInfo.fixedDispatcher.nodeId) < 0) return -1;
- if (tEncodeSEpSet(pEncoder, &pTask->outputInfo.fixedDispatcher.epSet) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->outputInfo.fixedDispatcher.taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->outputInfo.fixedDispatcher.nodeId));
+ TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pTask->outputInfo.fixedDispatcher.epSet));
} else if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) {
- if (tSerializeSUseDbRspImp(pEncoder, &pTask->outputInfo.shuffleDispatcher.dbInfo) < 0) return -1;
- if (tEncodeCStr(pEncoder, pTask->outputInfo.shuffleDispatcher.stbFullName) < 0) return -1;
+ TAOS_CHECK_EXIT(tSerializeSUseDbRspImp(pEncoder, &pTask->outputInfo.shuffleDispatcher.dbInfo));
+ TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTask->outputInfo.shuffleDispatcher.stbFullName));
}
- if (tEncodeI64(pEncoder, pTask->info.delaySchedParam) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->subtableWithoutMd5) < 0) return -1;
- if (tEncodeCStrWithLen(pEncoder, pTask->reserve, sizeof(pTask->reserve) - 1) < 0) return -1;
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->info.delaySchedParam));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->subtableWithoutMd5));
+ TAOS_CHECK_EXIT(tEncodeCStrWithLen(pEncoder, pTask->reserve, sizeof(pTask->reserve) - 1));
tEndEncode(pEncoder);
- return 0;
+_exit:
+ return code;
}
int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
int32_t taskId = 0;
+ int32_t code = 0;
+ int32_t lino;
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTask->ver) < 0) return -1;
- if (pTask->ver <= SSTREAM_TASK_INCOMPATIBLE_VER || pTask->ver > SSTREAM_TASK_VER) return -1;
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->ver));
+ if (pTask->ver <= SSTREAM_TASK_INCOMPATIBLE_VER || pTask->ver > SSTREAM_TASK_VER) {
+ TAOS_CHECK_EXIT(TSDB_CODE_INVALID_MSG);
+ }
- if (tDecodeI64(pDecoder, &pTask->id.streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pTask->id.taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pTask->info.totalLevel) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->info.taskLevel) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->outputInfo.type) < 0) return -1;
- if (tDecodeI16(pDecoder, &pTask->msgInfo.msgType) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->id.streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->id.taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.totalLevel));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->info.taskLevel));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->outputInfo.type));
+ TAOS_CHECK_EXIT(tDecodeI16(pDecoder, &pTask->msgInfo.msgType));
- if (tDecodeI8(pDecoder, &pTask->status.taskStatus) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->status.schedStatus) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->status.taskStatus));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->status.schedStatus));
- if (tDecodeI32(pDecoder, &pTask->info.selfChildId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pTask->info.nodeId) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &pTask->info.epSet) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &pTask->info.mnodeEpset) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.selfChildId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.nodeId));
+ TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &pTask->info.epSet));
+ TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &pTask->info.mnodeEpset));
- if (tDecodeI64(pDecoder, &pTask->chkInfo.checkpointId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTask->chkInfo.checkpointVer) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->info.fillHistory) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->chkInfo.checkpointId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->chkInfo.checkpointVer));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->info.fillHistory));
- if (tDecodeI64(pDecoder, &pTask->hTaskInfo.id.streamId)) return -1;
- if (tDecodeI32(pDecoder, &taskId)) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->hTaskInfo.id.streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &taskId));
pTask->hTaskInfo.id.taskId = taskId;
- if (tDecodeI64(pDecoder, &pTask->streamTaskId.streamId)) return -1;
- if (tDecodeI32(pDecoder, &taskId)) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->streamTaskId.streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &taskId));
pTask->streamTaskId.taskId = taskId;
- if (tDecodeU64(pDecoder, (uint64_t*)&pTask->dataRange.range.minVer)) return -1;
- if (tDecodeU64(pDecoder, (uint64_t*)&pTask->dataRange.range.maxVer)) return -1;
- if (tDecodeI64(pDecoder, &pTask->dataRange.window.skey)) return -1;
- if (tDecodeI64(pDecoder, &pTask->dataRange.window.ekey)) return -1;
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, (uint64_t*)&pTask->dataRange.range.minVer));
+ TAOS_CHECK_EXIT(tDecodeU64(pDecoder, (uint64_t*)&pTask->dataRange.range.maxVer));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->dataRange.window.skey));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->dataRange.window.ekey));
int32_t epSz = -1;
- if (tDecodeI32(pDecoder, &epSz) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &epSz) < 0);
- pTask->upstreamInfo.pList = taosArrayInit(epSz, POINTER_BYTES);
+ if ((pTask->upstreamInfo.pList = taosArrayInit(epSz, POINTER_BYTES)) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
for (int32_t i = 0; i < epSz; i++) {
SStreamUpstreamEpInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamUpstreamEpInfo));
- if (pInfo == NULL) return -1;
- if (tDecodeStreamEpInfo(pDecoder, pInfo) < 0) {
- taosMemoryFreeClear(pInfo);
- return -1;
+ if (pInfo == NULL) {
+ TAOS_CHECK_EXIT(terrno);
}
- void* p = taosArrayPush(pTask->upstreamInfo.pList, &pInfo);
- if (p == NULL) {
- tEndDecode(pDecoder);
- return -1;
+ if ((code = tDecodeStreamEpInfo(pDecoder, pInfo)) < 0) {
+ taosMemoryFreeClear(pInfo);
+ goto _exit;
+ }
+ if (taosArrayPush(pTask->upstreamInfo.pList, &pInfo) == NULL) {
+ TAOS_CHECK_EXIT(terrno);
}
}
if (pTask->info.taskLevel != TASK_LEVEL__SINK) {
- if (tDecodeCStrAlloc(pDecoder, &pTask->exec.qmsg) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pTask->exec.qmsg));
}
if (pTask->outputInfo.type == TASK_OUTPUT__TABLE) {
- if (tDecodeI64(pDecoder, &pTask->outputInfo.tbSink.stbUid) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pTask->outputInfo.tbSink.stbFullName) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->outputInfo.tbSink.stbUid));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTask->outputInfo.tbSink.stbFullName));
pTask->outputInfo.tbSink.pSchemaWrapper = taosMemoryCalloc(1, sizeof(SSchemaWrapper));
- if (pTask->outputInfo.tbSink.pSchemaWrapper == NULL) return -1;
- if (tDecodeSSchemaWrapper(pDecoder, pTask->outputInfo.tbSink.pSchemaWrapper) < 0) return -1;
+ if (pTask->outputInfo.tbSink.pSchemaWrapper == NULL) {
+ TAOS_CHECK_EXIT(terrno);
+ }
+ TAOS_CHECK_EXIT(tDecodeSSchemaWrapper(pDecoder, pTask->outputInfo.tbSink.pSchemaWrapper));
} else if (pTask->outputInfo.type == TASK_OUTPUT__SMA) {
- if (tDecodeI64(pDecoder, &pTask->outputInfo.smaSink.smaId) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->outputInfo.smaSink.smaId));
} else if (pTask->outputInfo.type == TASK_OUTPUT__FETCH) {
- if (tDecodeI8(pDecoder, &pTask->outputInfo.fetchSink.reserved) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->outputInfo.fetchSink.reserved));
} else if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) {
- if (tDecodeI32(pDecoder, &pTask->outputInfo.fixedDispatcher.taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pTask->outputInfo.fixedDispatcher.nodeId) < 0) return -1;
- if (tDecodeSEpSet(pDecoder, &pTask->outputInfo.fixedDispatcher.epSet) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->outputInfo.fixedDispatcher.taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->outputInfo.fixedDispatcher.nodeId));
+ TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &pTask->outputInfo.fixedDispatcher.epSet));
} else if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) {
- if (tDeserializeSUseDbRspImp(pDecoder, &pTask->outputInfo.shuffleDispatcher.dbInfo) < 0) return -1;
- if (tDecodeCStrTo(pDecoder, pTask->outputInfo.shuffleDispatcher.stbFullName) < 0) return -1;
+ TAOS_CHECK_EXIT(tDeserializeSUseDbRspImp(pDecoder, &pTask->outputInfo.shuffleDispatcher.dbInfo));
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTask->outputInfo.shuffleDispatcher.stbFullName));
}
- if (tDecodeI64(pDecoder, &pTask->info.delaySchedParam) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->info.delaySchedParam));
if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER) {
- if (tDecodeI8(pDecoder, &pTask->subtableWithoutMd5) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->subtableWithoutMd5));
}
- if (tDecodeCStrTo(pDecoder, pTask->reserve) < 0) return -1;
+ TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTask->reserve));
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tEncodeStreamTaskChkptReport(SEncoder* pEncoder, const SCheckpointReport* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->nodeId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->checkpointId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->checkpointVer) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->checkpointTs) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->transId) < 0) return -1;
- if (tEncodeI8(pEncoder, pReq->dropHTask) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->nodeId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->checkpointId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->checkpointVer));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->checkpointTs));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->transId));
+ TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pReq->dropHTask));
tEndEncode(pEncoder);
- return 0;
+
+_exit:
+ return code;
}
int32_t tDecodeStreamTaskChkptReport(SDecoder* pDecoder, SCheckpointReport* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->nodeId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->checkpointId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->checkpointVer) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->checkpointTs) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->transId) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->dropHTask) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->nodeId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->checkpointId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->checkpointVer));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->checkpointTs));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->transId));
+ TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pReq->dropHTask));
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
-int32_t tEncodeRestoreCheckpointInfo (SEncoder* pEncoder, const SRestoreCheckpointInfo* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->startTs) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->checkpointId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->transId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->nodeId) < 0) return -1;
+int32_t tEncodeRestoreCheckpointInfo(SEncoder* pEncoder, const SRestoreCheckpointInfo* pReq) {
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->startTs));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->checkpointId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->transId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->nodeId));
tEndEncode(pEncoder);
- return pEncoder->pos;
+
+_exit:
+ if (code) {
+ return code;
+ } else {
+ return pEncoder->pos;
+ }
}
int32_t tDecodeRestoreCheckpointInfo(SDecoder* pDecoder, SRestoreCheckpointInfo* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->startTs) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->checkpointId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->transId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->nodeId) < 0) return -1;
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->startTs));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->checkpointId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->transId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->nodeId));
tEndDecode(pDecoder);
- return 0;
+
+_exit:
+ return code;
}
diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c
index eca728b2d5..3765d0f9d3 100644
--- a/source/libs/stream/src/streamQueue.c
+++ b/source/libs/stream/src/streamQueue.c
@@ -287,7 +287,7 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem)
"s-task:%s inputQ is full, capacity(size:%d num:%dMiB), current(blocks:%d, size:%.2fMiB) stop to push data",
pTask->id.idStr, STREAM_TASK_QUEUE_CAPACITY, STREAM_TASK_QUEUE_CAPACITY_IN_SIZE, total, size);
streamDataSubmitDestroy(px);
- return -1;
+ return TSDB_CODE_OUT_OF_MEMORY;
}
int32_t msgLen = px->submit.msgLen;
@@ -312,7 +312,7 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem)
stTrace("s-task:%s input queue is full, capacity:%d size:%d MiB, current(blocks:%d, size:%.2fMiB) abort",
pTask->id.idStr, STREAM_TASK_QUEUE_CAPACITY, STREAM_TASK_QUEUE_CAPACITY_IN_SIZE, total, size);
streamFreeQitem(pItem);
- return -1;
+ return TSDB_CODE_OUT_OF_MEMORY;
}
int32_t code = taosWriteQitem(pQueue, pItem);
diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c
index 585cf63cfc..2d54547aa2 100644
--- a/source/libs/stream/src/streamSched.c
+++ b/source/libs/stream/src/streamSched.c
@@ -19,7 +19,7 @@
static void streamTaskResumeHelper(void* param, void* tmrId);
static void streamTaskSchedHelper(void* param, void* tmrId);
-int32_t streamSetupScheduleTrigger(SStreamTask* pTask) {
+void streamSetupScheduleTrigger(SStreamTask* pTask) {
if (pTask->info.delaySchedParam != 0 && pTask->info.fillHistory == 0) {
int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1);
stDebug("s-task:%s setup scheduler trigger, ref:%d delay:%" PRId64 " ms", pTask->id.idStr, ref,
@@ -29,8 +29,6 @@ int32_t streamSetupScheduleTrigger(SStreamTask* pTask) {
taosTmrStart(streamTaskSchedHelper, (int32_t)pTask->info.delaySchedParam, pTask, streamTimer);
pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE;
}
-
- return 0;
}
int32_t streamTrySchedExec(SStreamTask* pTask) {
@@ -47,7 +45,7 @@ int32_t streamTaskSchedTask(SMsgCb* pMsgCb, int32_t vgId, int64_t streamId, int3
SStreamTaskRunReq* pRunReq = rpcMallocCont(sizeof(SStreamTaskRunReq));
if (pRunReq == NULL) {
stError("vgId:%d failed to create msg to start stream task:0x%x exec, type:%d, code:%s", vgId, taskId, execType,
- terrstr());
+ tstrerror(terrno));
return terrno;
}
@@ -94,7 +92,7 @@ void streamTaskResumeHelper(void* param, void* tmrId) {
SStreamTaskState p = streamTaskGetStatus(pTask);
if (p.state == TASK_STATUS__DROPPING || p.state == TASK_STATUS__STOP) {
- (void) streamTaskSetSchedStatusInactive(pTask);
+ int8_t status = streamTaskSetSchedStatusInactive(pTask);
int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1);
stDebug("s-task:%s status:%s not resume task, ref:%d", pId->idStr, p.name, ref);
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index 0791784656..6d8f90f7f6 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -24,8 +24,8 @@
#include "wal.h"
static void streamTaskDestroyUpstreamInfo(SUpstreamInfo* pUpstreamInfo);
-static void streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdated);
-static void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdate);
+static int32_t streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdated);
+static int32_t streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdate);
static void streamTaskDestroyActiveChkptInfo(SActiveCheckpointInfo* pInfo);
static int32_t addToTaskset(SArray* pArray, SStreamTask* pTask) {
@@ -36,15 +36,25 @@ static int32_t addToTaskset(SArray* pArray, SStreamTask* pTask) {
}
static int32_t doUpdateTaskEpset(SStreamTask* pTask, int32_t nodeId, SEpSet* pEpSet, bool* pUpdated) {
- char buf[512] = {0};
+ int32_t code = 0;
+ char buf[512] = {0};
+
if (pTask->info.nodeId == nodeId) { // execution task should be moved away
bool isEqual = isEpsetEqual(&pTask->info.epSet, pEpSet);
- (void)epsetToStr(pEpSet, buf, tListLen(buf));
+ code = epsetToStr(pEpSet, buf, tListLen(buf));
+ if (code) { // print error and continue
+ stError("%s failed to convert epset to str, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
if (!isEqual) {
(*pUpdated) = true;
char tmp[512] = {0};
- (void)epsetToStr(&pTask->info.epSet, tmp, tListLen(tmp)); // only for log file, ignore errors
+ code = epsetToStr(&pTask->info.epSet, tmp, tListLen(tmp)); // only for log file, ignore errors
+ if (code) { // print error and continue
+ stError("%s failed to convert epset to str, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
epsetAssign(&pTask->info.epSet, pEpSet);
stDebug("s-task:0x%x (vgId:%d) self node epset is updated %s, old:%s", pTask->id.taskId, nodeId, buf, tmp);
@@ -56,15 +66,15 @@ static int32_t doUpdateTaskEpset(SStreamTask* pTask, int32_t nodeId, SEpSet* pEp
// check for the dispatch info and the upstream task info
int32_t level = pTask->info.taskLevel;
if (level == TASK_LEVEL__SOURCE) {
- streamTaskUpdateDownstreamInfo(pTask, nodeId, pEpSet, pUpdated);
+ code = streamTaskUpdateDownstreamInfo(pTask, nodeId, pEpSet, pUpdated);
} else if (level == TASK_LEVEL__AGG) {
- streamTaskUpdateUpstreamInfo(pTask, nodeId, pEpSet, pUpdated);
- streamTaskUpdateDownstreamInfo(pTask, nodeId, pEpSet, pUpdated);
+ code = streamTaskUpdateUpstreamInfo(pTask, nodeId, pEpSet, pUpdated);
+ code = streamTaskUpdateDownstreamInfo(pTask, nodeId, pEpSet, pUpdated);
} else { // TASK_LEVEL__SINK
- streamTaskUpdateUpstreamInfo(pTask, nodeId, pEpSet, pUpdated);
+ code = streamTaskUpdateUpstreamInfo(pTask, nodeId, pEpSet, pUpdated);
}
- return 0;
+ return code;
}
static void freeItem(void* p) {
@@ -227,17 +237,17 @@ void tFreeStreamTask(SStreamTask* pTask) {
}
if (pTask->schedInfo.pDelayTimer != NULL) {
- (void)taosTmrStop(pTask->schedInfo.pDelayTimer);
+ streamTmrStop(pTask->schedInfo.pDelayTimer);
pTask->schedInfo.pDelayTimer = NULL;
}
if (pTask->hTaskInfo.pTimer != NULL) {
- (void)taosTmrStop(pTask->hTaskInfo.pTimer);
+ streamTmrStop(pTask->hTaskInfo.pTimer);
pTask->hTaskInfo.pTimer = NULL;
}
if (pTask->msgInfo.pRetryTmr != NULL) {
- (void)taosTmrStop(pTask->msgInfo.pRetryTmr);
+ streamTmrStop(pTask->msgInfo.pRetryTmr);
pTask->msgInfo.pRetryTmr = NULL;
}
@@ -402,8 +412,14 @@ int32_t streamTaskSetBackendPath(SStreamTask* pTask) {
return 0;
}
+
int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, int64_t ver) {
- (void)createStreamTaskIdStr(pTask->id.streamId, pTask->id.taskId, &pTask->id.idStr);
+ int32_t code = createStreamTaskIdStr(pTask->id.streamId, pTask->id.taskId, &pTask->id.idStr);
+ if (code) {
+ stError("0x%x failed create stream task id str, code:%s", pTask->id.taskId, tstrerror(code));
+ return code;
+ }
+
pTask->refCnt = 1;
pTask->inputq.status = TASK_INPUT_STATUS__NORMAL;
@@ -419,7 +435,7 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i
pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE;
pTask->status.timerActive = 0;
- int32_t code = streamCreateStateMachine(pTask);
+ code = streamCreateStateMachine(pTask);
if (pTask->status.pSM == NULL || code != TSDB_CODE_SUCCESS) {
stError("s-task:%s failed create state-machine for stream task, initialization failed, code:%s", pTask->id.idStr,
tstrerror(code));
@@ -439,6 +455,7 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i
code = taosThreadMutexInit(&pTask->msgInfo.lock, NULL);
if (code) {
+ stError("s-task:0x%x failed to init msgInfo mutex, code:%s", pTask->id.taskId, tstrerror(code));
return code;
}
@@ -484,16 +501,14 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i
pOutputInfo->pNodeEpsetUpdateList = taosArrayInit(4, sizeof(SDownstreamTaskEpset));
if (pOutputInfo->pNodeEpsetUpdateList == NULL) {
- stError("s-task:%s failed to prepare downstreamUpdateList, code:%s", pTask->id.idStr,
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- return TSDB_CODE_OUT_OF_MEMORY;
+ stError("s-task:%s failed to prepare downstreamUpdateList, code:%s", pTask->id.idStr, tstrerror(terrno));
+ return terrno;
}
pTask->taskCheckInfo.pList = taosArrayInit(4, sizeof(SDownstreamStatusInfo));
if (pTask->taskCheckInfo.pList == NULL) {
- stError("s-task:%s failed to prepare taskCheckInfo list, code:%s", pTask->id.idStr,
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- return TSDB_CODE_OUT_OF_MEMORY;
+ stError("s-task:%s failed to prepare taskCheckInfo list, code:%s", pTask->id.idStr, tstrerror(terrno));
+ return terrno;
}
if (pTask->chkInfo.pActiveInfo == NULL) {
@@ -539,9 +554,14 @@ int32_t streamTaskSetUpstreamInfo(SStreamTask* pTask, const SStreamTask* pUpstre
return (p == NULL) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS;
}
-void streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdated) {
- char buf[512] = {0};
- (void)epsetToStr(pEpSet, buf, tListLen(buf)); // ignore error since it is only for log file.
+int32_t streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdated) {
+ int32_t code = 0;
+ char buf[512] = {0};
+ code = epsetToStr(pEpSet, buf, tListLen(buf)); // ignore error since it is only for log file.
+ if (code != 0) { // print error and continue
+ stError("%s failed to convert epset to str, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
int32_t numOfUpstream = taosArrayGetSize(pTask->upstreamInfo.pList);
for (int32_t i = 0; i < numOfUpstream; ++i) {
@@ -552,7 +572,11 @@ void streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpS
*pUpdated = true;
char tmp[512] = {0};
- (void)epsetToStr(&pInfo->epSet, tmp, tListLen(tmp));
+ code = epsetToStr(&pInfo->epSet, tmp, tListLen(tmp));
+ if (code != 0) { // print error and continue
+ stError("%s failed to convert epset to str, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
epsetAssign(&pInfo->epSet, pEpSet);
stDebug("s-task:0x%x update the upstreamInfo taskId:0x%x(nodeId:%d) newEpset:%s old:%s", pTask->id.taskId,
@@ -565,6 +589,8 @@ void streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpS
break;
}
}
+
+ return code;
}
void streamTaskDestroyUpstreamInfo(SUpstreamInfo* pUpstreamInfo) {
@@ -585,9 +611,13 @@ void streamTaskSetFixedDownstreamInfo(SStreamTask* pTask, const SStreamTask* pDo
pTask->msgInfo.msgType = TDMT_STREAM_TASK_DISPATCH;
}
-void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdated) {
- char buf[512] = {0};
- (void)epsetToStr(pEpSet, buf, tListLen(buf)); // ignore the error since only for log files.
+int32_t streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet, bool* pUpdated) {
+ char buf[512] = {0};
+ int32_t code = epsetToStr(pEpSet, buf, tListLen(buf)); // ignore the error since only for log files.
+ if (code != 0) { // print error and continue
+ stError("%s failed to convert epset to str, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
int32_t id = pTask->id.taskId;
int8_t type = pTask->outputInfo.type;
@@ -605,8 +635,13 @@ void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SE
bool isEqual = isEpsetEqual(&pVgInfo->epSet, pEpSet);
if (!isEqual) {
*pUpdated = true;
+
char tmp[512] = {0};
- (void)epsetToStr(&pVgInfo->epSet, tmp, tListLen(tmp));
+ code = epsetToStr(&pVgInfo->epSet, tmp, tListLen(tmp));
+ if (code != 0) { // print error and continue
+ stError("%s failed to convert epset to str, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
epsetAssign(&pVgInfo->epSet, pEpSet);
stDebug("s-task:0x%x update dispatch info, task:0x%x(nodeId:%d) newEpset:%s old:%s", id, pVgInfo->taskId,
@@ -626,7 +661,11 @@ void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SE
*pUpdated = true;
char tmp[512] = {0};
- (void)epsetToStr(&pDispatcher->epSet, tmp, tListLen(tmp));
+ code = epsetToStr(&pDispatcher->epSet, tmp, tListLen(tmp));
+ if (code != 0) { // print error and continue
+ stError("%s failed to convert epset to str, code:%s", pTask->id.idStr, tstrerror(code));
+ return code;
+ }
epsetAssign(&pDispatcher->epSet, pEpSet);
stDebug("s-task:0x%x update dispatch info, task:0x%x(nodeId:%d) newEpset:%s old:%s", id, pDispatcher->taskId,
@@ -637,6 +676,8 @@ void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SE
}
}
}
+
+ return code;
}
int32_t streamTaskStop(SStreamTask* pTask) {
@@ -977,7 +1018,10 @@ static int32_t taskPauseCallback(SStreamTask* pTask, void* param) {
}
void streamTaskPause(SStreamTask* pTask) {
- (void)streamTaskHandleEventAsync(pTask->status.pSM, TASK_EVENT_PAUSE, taskPauseCallback, NULL);
+ int32_t code = streamTaskHandleEventAsync(pTask->status.pSM, TASK_EVENT_PAUSE, taskPauseCallback, NULL);
+ if (code) {
+ stError("s-task:%s failed handle pause event async, code:%s", pTask->id.idStr, tstrerror(code));
+ }
}
void streamTaskResume(SStreamTask* pTask) {
@@ -1098,15 +1142,12 @@ static int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq*
return terrno = code;
}
- // enqueue
- stDebug("s-task:%s (vgId:%d level:%d) recv retrieve req from task:0x%x(vgId:%d),QID:0x%" PRIx64, pTask->id.idStr,
- pTask->pMeta->vgId, pTask->info.taskLevel, pReq->srcTaskId, pReq->srcNodeId, pReq->reqId);
-
pData->type = STREAM_INPUT__DATA_RETRIEVE;
pData->srcVgId = 0;
code = streamRetrieveReqToData(pReq, pData, pTask->id.idStr);
if (code != TSDB_CODE_SUCCESS) {
+ stError("s-task:%s failed to convert retrieve-data to block, code:%s", pTask->id.idStr, tstrerror(code));
taosFreeQitem(pData);
return code;
}
@@ -1185,13 +1226,13 @@ void streamTaskDestroyActiveChkptInfo(SActiveCheckpointInfo* pInfo) {
SStreamTmrInfo* pTriggerTmr = &pInfo->chkptTriggerMsgTmr;
if (pTriggerTmr->tmrHandle != NULL) {
- (void)taosTmrStop(pTriggerTmr->tmrHandle);
+ streamTmrStop(pTriggerTmr->tmrHandle);
pTriggerTmr->tmrHandle = NULL;
}
SStreamTmrInfo* pReadyTmr = &pInfo->chkptReadyMsgTmr;
if (pReadyTmr->tmrHandle != NULL) {
- (void)taosTmrStop(pReadyTmr->tmrHandle);
+ streamTmrStop(pReadyTmr->tmrHandle);
pReadyTmr->tmrHandle = NULL;
}
diff --git a/source/libs/stream/src/streamTimer.c b/source/libs/stream/src/streamTimer.c
index b6275c0eb1..5e12f51c9d 100644
--- a/source/libs/stream/src/streamTimer.c
+++ b/source/libs/stream/src/streamTimer.c
@@ -42,13 +42,16 @@ int32_t streamTimerGetInstance(tmr_h* pTmr) {
void streamTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void* param, void* handle, tmr_h* pTmrId, int32_t vgId,
const char* pMsg) {
-// while (1) {
- bool ret = taosTmrReset(fp, mseconds, param, handle, pTmrId);
- if (ret) {
-// break;
- }
-// stError("vgId:%d failed to reset tmr: %s, try again", vgId, pMsg);
-// }
+ bool ret = taosTmrReset(fp, mseconds, param, handle, pTmrId);
+ if (ret) {
+ }
+}
+
+void streamTmrStop(tmr_h tmrId) {
+ bool stop = taosTmrStop(tmrId);
+ if (stop) {
+ // todo
+ }
}
int32_t streamCleanBeforeQuitTmr(SStreamTmrInfo* pInfo, SStreamTask* pTask) {
diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c
index 3f7210d3c9..58ed50da65 100644
--- a/source/libs/stream/src/streamUpdate.c
+++ b/source/libs/stream/src/streamUpdate.c
@@ -231,7 +231,7 @@ _end:
static int32_t getSBf(SUpdateInfo* pInfo, TSKEY ts, SScalableBf** ppSBf) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
- if (ts <= 0) {
+ if (ts < 0) {
code = TSDB_CODE_FAILED;
QUERY_CHECK_CODE(code, lino, _end);
}
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index a0236c38b8..8e709f8809 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -1421,12 +1421,12 @@ int32_t syncNodeRestore(SSyncNode* pSyncNode) {
if (lastVer != -1 && endIndex != lastVer + 1) {
code = TSDB_CODE_WAL_LOG_INCOMPLETE;
- sError("vgId:%d, failed to restore sync node since %s. expected lastLogIndex:%" PRId64 ", lastVer:%" PRId64 "",
- pSyncNode->vgId, terrstr(), endIndex - 1, lastVer);
- TAOS_RETURN(code);
+ sWarn("vgId:%d, failed to restore sync node since %s. expected lastLogIndex:%" PRId64 ", lastVer:%" PRId64 "",
+ pSyncNode->vgId, terrstr(), endIndex - 1, lastVer);
+ // TAOS_RETURN(code);
}
- if (endIndex != lastVer + 1) return TSDB_CODE_SYN_INTERNAL_ERROR;
+ // if (endIndex != lastVer + 1) return TSDB_CODE_SYN_INTERNAL_ERROR;
pSyncNode->commitIndex = TMAX(pSyncNode->commitIndex, commitIndex);
sInfo("vgId:%d, restore sync until commitIndex:%" PRId64, pSyncNode->vgId, pSyncNode->commitIndex);
diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c
index 11997d089c..afa048f0ac 100644
--- a/source/util/src/tcompare.c
+++ b/source/util/src/tcompare.c
@@ -1227,7 +1227,11 @@ static void checkRegexCache(void* param, void* tmrId) {
if(sRegexCache.exit) {
goto _exit;
}
- (void)taosTmrReset(checkRegexCache, REGEX_CACHE_CLEAR_TIME * 1000, param, sRegexCache.regexCacheTmr, &tmrId);
+ bool ret = taosTmrReset(checkRegexCache, REGEX_CACHE_CLEAR_TIME * 1000, param, sRegexCache.regexCacheTmr, &tmrId);
+ if (!ret) {
+ uError("failed to reset regex cache timer");
+ goto _exit;
+ }
if (taosHashGetSize(sRegexCache.regexHash) < MAX_REGEX_CACHE_SIZE) {
goto _exit;
}
@@ -1238,7 +1242,10 @@ static void checkRegexCache(void* param, void* tmrId) {
if (taosGetTimestampSec() - (*ppUsingRegex)->lastUsedTime > REGEX_CACHE_CLEAR_TIME) {
size_t len = 0;
char* key = (char*)taosHashGetKey(ppUsingRegex, &len);
- (void)taosHashRemove(sRegexCache.regexHash, key, len);
+ if (TSDB_CODE_SUCCESS != taosHashRemove(sRegexCache.regexHash, key, len)) {
+ uError("failed to remove regex pattern %s from cache", key);
+ goto _exit;
+ }
}
ppUsingRegex = taosHashIterate(sRegexCache.regexHash, ppUsingRegex);
}
@@ -1285,7 +1292,10 @@ void DestroyRegexCache(){
#endif
int32_t code = 0;
uInfo("[regex cache] destory regex cache");
- (void)taosTmrStopA(&sRegexCache.timer);
+ bool ret = taosTmrStopA(&sRegexCache.timer);
+ if (!ret) {
+ uError("failed to stop regex cache timer");
+ }
taosWLockLatch(&sRegexCache.mutex);
sRegexCache.exit = true;
taosHashCleanup(sRegexCache.regexHash);
diff --git a/tests/army/alter/alterConfig.py b/tests/army/alter/alterConfig.py
index 6f709eb802..f8c52551e3 100644
--- a/tests/army/alter/alterConfig.py
+++ b/tests/army/alter/alterConfig.py
@@ -28,6 +28,28 @@ from frame import *
class TDTestCase(TBase):
+ def alterCachemodel(self):
+ """Add test case for altering cache model(TS-5390)
+ """
+ # drop database if exists
+ tdSql.execute(f"drop database if exists db3590;")
+ # create database with cachemodel 'none'
+ tdSql.execute(f"create database db3590 vgroups 1 replica 1 cachemodel 'none';")
+ tdSql.execute("use db3590;")
+ tdSql.execute("create table ntb1 (ts timestamp, ival1 int);")
+ tdSql.execute("insert into ntb1 values(now, 1);")
+ tdSql.execute("flush database db3590;")
+ # alter table schema
+ tdSql.execute("alter table ntb1 add column ival2 int;")
+ tdSql.execute("insert into ntb1 values(now, 2, NULL);")
+ # alter table schema again
+ tdSql.execute("alter table ntb1 add column ival3 int;")
+ # alter database with cachemodel 'both‘
+ tdSql.execute("alter database db3590 cachemodel 'both';")
+ # wait for cachemodel avaiable
+ time.sleep(5)
+ tdSql.query("select last(*) from ntb1;")
+
def alterTtlConfig(self):
"""Add test case for altering ttl config
"""
@@ -86,6 +108,8 @@ class TDTestCase(TBase):
self.alterSupportVnodes()
# TS-5191
self.alterTtlConfig()
+ # TS-5390
+ self.alterCachemodel()
tdLog.success(f"{__file__} successfully executed")
diff --git a/tests/army/cluster/clusterBasic.py b/tests/army/cluster/clusterBasic.py
index 8dceecab38..1ec23e56ea 100644
--- a/tests/army/cluster/clusterBasic.py
+++ b/tests/army/cluster/clusterBasic.py
@@ -31,40 +31,61 @@ from frame.clusterCommonCheck import clusterComCheck
class TDTestCase(TBase):
def init(self, conn, logSql, replicaVar=3):
super(TDTestCase, self).init(conn, logSql, replicaVar=3, db="db")
- self.dnodeNum = 3
- self.mnodeNum = 3
+ self.vgroupNum = 3
tdSql.init(conn.cursor(), logSql)
def checkClusterEmptyDB(self):
while 1:
- if clusterComCheck.checkDnodes(3): break
+ if clusterComCheck.checkDnodes(5): break
tdSql.query("show cluster alive;")
tdSql.checkData(0, 0, 1)
sc.dnodeStop(3)
while 1:
- if clusterComCheck.checkDnodes(2): break
+ if clusterComCheck.checkDnodes(4): break
tdSql.query("show cluster alive;")
tdSql.checkData(0, 0, 1)
+ sc.dnodeStop(2)
+ while 1:
+ if clusterComCheck.checkDnodes(3): break
+ tdSql.query("show cluster alive;")
+ tdSql.checkData(0, 0, 1)
def checkClusterWithDB(self):
sc.dnodeStart(3)
+ sc.dnodeStart(2)
while 1:
- if clusterComCheck.checkDnodes(3): break
+ if clusterComCheck.checkDnodes(5): break
+
tdSql.execute(f'drop database if exists {self.db}')
- tdSql.execute(f'create database {self.db} replica 3')
+ tdSql.execute(f'create database {self.db} replica {self.replicaVar} vgroups {self.vgroupNum}')
+ while 1:
+ leader_status = clusterComCheck.check_vgroups_status_with_offline(vgroup_numbers=self.vgroupNum, db_replica=self.replicaVar)
+ if leader_status >= 0: break
+ leader_status = clusterComCheck.check_vgroups_status_with_offline(vgroup_numbers=self.vgroupNum, db_replica=self.replicaVar)
tdSql.query("show cluster alive;")
- print(tdSql.getResult("show cluster alive;"))
- tdSql.checkData(0, 0, 1)
+ tdSql.checkData(0, 0, leader_status)
sc.dnodeStop(3)
while 1:
- if clusterComCheck.checkDnodes(2): break
+ if clusterComCheck.checkDnodes(4): break
+ while 1:
+ leader_status = clusterComCheck.check_vgroups_status_with_offline(vgroup_numbers=self.vgroupNum, db_replica=self.replicaVar)
+ if leader_status >= 0: break
+ leader_status = clusterComCheck.check_vgroups_status_with_offline(vgroup_numbers=self.vgroupNum, db_replica=self.replicaVar)
tdSql.query("show cluster alive;")
- print(tdSql.getResult("show cluster alive;"))
- tdSql.checkData(0, 0, 1)
-
+ tdSql.checkData(0, 0, leader_status)
+
+ sc.dnodeStop(2)
+ while 1:
+ if clusterComCheck.checkDnodes(3): break
+ while 1:
+ leader_status = clusterComCheck.check_vgroups_status_with_offline(vgroup_numbers=self.vgroupNum, db_replica=self.replicaVar)
+ if leader_status >= 0: break
+ leader_status = clusterComCheck.check_vgroups_status_with_offline(vgroup_numbers=self.vgroupNum, db_replica=self.replicaVar)
+ tdSql.query("show cluster alive;")
+ tdSql.checkData(0, 0, leader_status)
# run
def run(self):
@@ -73,8 +94,9 @@ class TDTestCase(TBase):
self.checkClusterWithDB()
def stop(self):
- sc.dnodeStop(2)
sc.dnodeStop(1)
+ sc.dnodeStop(4)
+ sc.dnodeStop(5)
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
diff --git a/tests/army/frame/clusterCommonCheck.py b/tests/army/frame/clusterCommonCheck.py
index cca70a88b7..9cbac776b9 100644
--- a/tests/army/frame/clusterCommonCheck.py
+++ b/tests/army/frame/clusterCommonCheck.py
@@ -44,7 +44,7 @@ class ClusterComCheck:
tdSql.query("select * from information_schema.ins_dnodes")
# tdLog.debug(tdSql.res)
status=0
- for i in range(dnodeNumbers):
+ for i in range(len(tdSql.res)):
if tdSql.res[i][4] == "ready":
status+=1
# tdLog.info(status)
@@ -228,6 +228,46 @@ class ClusterComCheck:
tdLog.debug(tdSql.res)
tdLog.exit("stop mnodes on dnode 2 or 3 failed in 10s")
+ def check_vgroups_status_with_offline(self,vgroup_numbers=2,db_replica=3,count_number=10,db_name="db"):
+ """
+ n nodes cluster, 3 replica database
+ return 1, n leaders, stable status
+ return 2, 0 < num of leader < n, stable status
+ return 0, no leader, stable status
+ return -1, Elections not yet completed, unstable status
+ """
+ vgroup_numbers = int(vgroup_numbers)
+ self.db_replica = int(db_replica)
+ tdLog.debug("start to check status of vgroups")
+ count=0
+ leader_number = 0
+ while count < count_number:
+ time.sleep(1)
+ count+=1
+ tdSql.query(f"show {db_name}.vgroups;")
+ if tdSql.getRows() != vgroup_numbers :
+ continue
+ for i in range(vgroup_numbers):
+ print(tdSql.res[i])
+ if 'leader' in tdSql.res[i]:leader_number += 1
+ elif tdSql.res[i].count('follower') + tdSql.res[i].count('candidate') >= 2:
+ tdLog.debug("Elections not yet completed")
+ return -1
+ else: # only one 'follower' or 'offline'
+ tdLog.debug("Not in compliance with Raft protocol, unable to complete election")
+ if leader_number == vgroup_numbers:
+ tdLog.debug("Leader election for all vgroups completed")
+ return 1
+ elif leader_number == 0:
+ tdLog.debug("all vnodes is follower")
+ return 0
+ else:
+ tdLog.debug(f"there is {vgroup_numbers} vgroups, and leader elections for {leader_number} vgroups competed")
+ return 2
+ else:
+ tdLog.debug(tdSql.res)
+ tdLog.notice(f"elections of {db_name} all vgroups with replica {self.db_replica} are failed in {count} s ")
+
def check_vgroups_status(self,vgroup_numbers=2,db_replica=3,count_number=10,db_name="db"):
""" check vgroups status in 10s after db vgroups status is changed """
vgroup_numbers = int(vgroup_numbers)
diff --git a/tests/army/query/function/ans/max.csv b/tests/army/query/function/ans/max.csv
new file mode 100644
index 0000000000..62df7c5d53
--- /dev/null
+++ b/tests/army/query/function/ans/max.csv
@@ -0,0 +1,480 @@
+9999
+11.9989996
+224
+x
+一二三四五六七八九十
+四
+一二三四五六七八九十
+四
+1110
+2838
+4566
+6294
+8022
+9750
+9999
+3206
+4934
+6662
+8390
+9999
+1846
+3574
+5302
+7030
+8758
+9999
+2214
+3942
+5670
+7398
+9126
+9999
+2582
+4310
+6038
+7766
+9494
+9999
+2950
+4678
+6406
+8134
+9862
+9999
+3318
+5046
+6774
+8502
+9999
+1958
+3686
+5414
+7142
+8870
+9999
+2326
+4054
+5782
+7510
+9238
+9999
+2694
+4422
+6150
+7878
+9606
+9999
+11.9989996
+11.9969997
+11.9969997
+11.9989996
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9980001
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9980001
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9980001
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9980001
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9980001
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9980001
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9989996
+11.9989996
+11.9989996
+11.9989996
+11.9969997
+11.9989996
+11.9989996
+11.9989996
+11.9860001
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+224
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+一二三四五六七八九十
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
+四
diff --git a/tests/army/query/function/ans/min.csv b/tests/army/query/function/ans/min.csv
new file mode 100644
index 0000000000..d87f2264d7
--- /dev/null
+++ b/tests/army/query/function/ans/min.csv
@@ -0,0 +1,480 @@
+0
+8.0000000
+215
+haha
+abc一二三abc一二三abc
+a
+abc一二三abc一二三abc
+a
+0
+1111
+2839
+4567
+6295
+8023
+0
+1479
+3207
+4935
+6663
+0
+119
+1847
+3575
+5303
+7031
+0
+487
+2215
+3943
+5671
+7399
+0
+855
+2583
+4311
+6039
+7767
+0
+1223
+2951
+4679
+6407
+8135
+0
+1591
+3319
+5047
+6775
+0
+231
+1959
+3687
+5415
+7143
+0
+599
+2327
+4055
+5783
+7511
+0
+967
+2695
+4423
+6151
+7879
+9607
+8.0000000
+8.0000000
+8.0000000
+8.0010004
+8.0010004
+8.0000000
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0030003
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0030003
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0000000
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0000000
+8.0000000
+8.0000000
+8.0010004
+8.0089998
+8.0000000
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0030003
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0019999
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0000000
+8.0000000
+8.0000000
+8.0019999
+8.0010004
+8.0000000
+8.0050001
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+215
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+haha
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+abc一二三abc一二三abc
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/tests/army/query/function/in/max.in b/tests/army/query/function/in/max.in
new file mode 100644
index 0000000000..8415983989
--- /dev/null
+++ b/tests/army/query/function/in/max.in
@@ -0,0 +1,16 @@
+select MAX(id) from ts_4893.meters;
+select MAX(current) from ts_4893.meters;
+select MAX(voltage) from ts_4893.meters;
+select MAX(name) from ts_4893.meters;
+select MAX(nch1) from ts_4893.meters;
+select MAX(nch2) from ts_4893.meters;
+select MAX(var1) from ts_4893.meters;
+select MAX(var2) from ts_4893.meters;
+select MAX(id) from ts_4893.meters interval(60d);
+select MAX(current) from ts_4893.meters interval(60d);
+select MAX(voltage) from ts_4893.meters interval(60d);
+select MAX(name) from ts_4893.meters interval(60d);
+select MAX(nch1) from ts_4893.meters interval(60d);
+select MAX(nch2) from ts_4893.meters interval(60d);
+select MAX(var1) from ts_4893.meters interval(60d);
+select MAX(var2) from ts_4893.meters interval(60d);
\ No newline at end of file
diff --git a/tests/army/query/function/in/min.in b/tests/army/query/function/in/min.in
new file mode 100644
index 0000000000..5f6c516bd7
--- /dev/null
+++ b/tests/army/query/function/in/min.in
@@ -0,0 +1,16 @@
+select MIN(id) from ts_4893.meters;
+select MIN(current) from ts_4893.meters;
+select MIN(voltage) from ts_4893.meters;
+select MIN(name) from ts_4893.meters;
+select MIN(nch1) from ts_4893.meters;
+select MIN(nch2) from ts_4893.meters;
+select MIN(var1) from ts_4893.meters;
+select MIN(var2) from ts_4893.meters;
+select MIN(id) from ts_4893.meters interval(60d);
+select MIN(current) from ts_4893.meters interval(60d);
+select MIN(voltage) from ts_4893.meters interval(60d);
+select MIN(name) from ts_4893.meters interval(60d);
+select MIN(nch1) from ts_4893.meters interval(60d);
+select MIN(nch2) from ts_4893.meters interval(60d);
+select MIN(var1) from ts_4893.meters interval(60d);
+select MIN(var2) from ts_4893.meters interval(60d);
\ No newline at end of file
diff --git a/tests/army/query/function/test_function.py b/tests/army/query/function/test_function.py
index 77967f7815..4981e93563 100644
--- a/tests/army/query/function/test_function.py
+++ b/tests/army/query/function/test_function.py
@@ -505,12 +505,35 @@ class TDTestCase(TBase):
tdSql.query("select var_pop(null) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
-
def test_error(self):
tdSql.error(
"select * from (select to_iso8601(ts, timezone()), timezone() from meters order by ts desc) limit 1000;",
expectErrInfo="Not supported timzone format") # TS-5340
+ def test_min(self):
+ self.test_normal_query("min")
+ tdSql.query("select min(var1), min(id) from ts_4893.d0;")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 'abc一二三abc一二三abc')
+ tdSql.checkData(0, 1, 0)
+ def test_max(self):
+ self.test_normal_query("max")
+ tdSql.query("select max(var1), max(id) from ts_4893.d0;")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, '一二三四五六七八九十')
+ tdSql.checkData(0, 1, 9999)
+ def test_rand(self):
+ tdSql.query("select rand();")
+ tdSql.checkRows(1)
+
+ tdSql.query("select rand(1);")
+ tdSql.checkRows(1)
+
+ tdSql.query("select rand(1) from ts_4893.meters limit 10;")
+ tdSql.checkRows(10)
+
+ tdSql.query("select rand(id) from ts_4893.d0 limit 10;")
+ tdSql.checkRows(10)
# run
def run(self):
tdLog.debug(f"start to excute {__file__}")
@@ -528,6 +551,7 @@ class TDTestCase(TBase):
self.test_sign()
self.test_degrees()
self.test_radians()
+ self.test_rand()
# char function
self.test_char_length()
@@ -551,6 +575,10 @@ class TDTestCase(TBase):
self.test_stddev()
self.test_varpop()
+ # select function
+ self.test_min()
+ self.test_max()
+
# error function
self.test_error()
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index ea459959e9..c8e0a624d5 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -24,7 +24,7 @@
,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_desc.py -N 3 -L 3 -D 2
,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_null.py
,,y,army,./pytest.sh python3 ./test.py -f cluster/incSnapshot.py -N 3
-,,y,army,./pytest.sh python3 ./test.py -f cluster/clusterBasic.py -N 3
+,,y,army,./pytest.sh python3 ./test.py -f cluster/clusterBasic.py -N 5
,,y,army,./pytest.sh python3 ./test.py -f query/query_basic.py -N 3
,,y,army,./pytest.sh python3 ./test.py -f query/accuracy/test_query_accuracy.py
,,y,army,./pytest.sh python3 ./test.py -f insert/insert_basic.py -N 3
@@ -351,7 +351,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/splitVGroupWal.py -N 3 -n 3
,,n,system-test,python3 ./test.py -f 0-others/timeRangeWise.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/delete_check.py
-,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_hot_refresh_configurations.py
+#,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_hot_refresh_configurations.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/subscribe_stream_privilege.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/empty_identifier.py
@@ -1270,7 +1270,7 @@
,,y,script,./test.sh -f tsim/snode/basic1.sim
,,y,script,./test.sh -f tsim/mnode/basic1.sim
,,y,script,./test.sh -f tsim/mnode/basic2.sim
-,,y,script,./test.sh -f tsim/mnode/basic3.sim
+#,,y,script,./test.sh -f tsim/mnode/basic3.sim
,,y,script,./test.sh -f tsim/mnode/basic4.sim
,,y,script,./test.sh -f tsim/mnode/basic5.sim
,,y,script,./test.sh -f tsim/show/basic.sim
diff --git a/tests/script/api/makefile b/tests/script/api/makefile
index d848dca194..d8a4e19218 100644
--- a/tests/script/api/makefile
+++ b/tests/script/api/makefile
@@ -7,11 +7,13 @@ LFLAGS = '-Wl,-rpath,/usr/local/taos/driver/' -ltaos -lpthread -lm -lrt
CFLAGS = -O0 -g -Wno-deprecated -fPIC -Wno-unused-result -Wconversion \
-Wno-char-subscripts -D_REENTRANT -Wno-format -D_REENTRANT -DLINUX \
-Wno-unused-function -D_M_X64 -I/usr/local/taos/include -std=gnu99 -Wno-sign-conversion
+#CFLAGS += -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment
all: $(TARGET)
exe:
gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS)
+ gcc $(CFLAGS) ./stmt2-test.c -o $(ROOT)stmt2-test $(LFLAGS)
gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS)
gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS)
gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS)
@@ -20,9 +22,15 @@ exe:
gcc $(CFLAGS) ./insert_stb.c -o $(ROOT)insert_stb $(LFLAGS)
gcc $(CFLAGS) ./tmqViewTest.c -o $(ROOT)tmqViewTest $(LFLAGS)
gcc $(CFLAGS) ./stmtQuery.c -o $(ROOT)stmtQuery $(LFLAGS)
+ gcc $(CFLAGS) ./stmt.c -o $(ROOT)stmt $(LFLAGS)
+ gcc $(CFLAGS) ./stmt2.c -o $(ROOT)stmt2 $(LFLAGS)
+ gcc $(CFLAGS) ./stmt2-example.c -o $(ROOT)stmt2-example $(LFLAGS)
+ gcc $(CFLAGS) ./stmt2-nohole.c -o $(ROOT)stmt2-nohole $(LFLAGS)
+ gcc $(CFLAGS) ./stmt-crash.c -o $(ROOT)stmt-crash $(LFLAGS)
clean:
rm $(ROOT)batchprepare
+ rm $(ROOT)stmt2-test
rm $(ROOT)stopquery
rm $(ROOT)dbTableRoute
rm $(ROOT)insertSameTs
@@ -31,3 +39,8 @@ clean:
rm $(ROOT)insert_stb
rm $(ROOT)tmqViewTest
rm $(ROOT)stmtQuery
+ rm $(ROOT)stmt
+ rm $(ROOT)stmt2
+ rm $(ROOT)stmt2-example
+ rm $(ROOT)stmt2-nohole
+ rm $(ROOT)stmt-crash
diff --git a/tests/script/api/stmt-crash.c b/tests/script/api/stmt-crash.c
new file mode 100644
index 0000000000..310e7c4910
--- /dev/null
+++ b/tests/script/api/stmt-crash.c
@@ -0,0 +1,289 @@
+// TAOS standard API example. The same syntax as MySQL, but only a subet
+// to compile: gcc -o prepare prepare.c -ltaos
+
+#include
+#include
+#include
+#include "taos.h"
+
+void taosMsleep(int mseconds);
+
+int main(int argc, char *argv[]) {
+ TAOS *taos;
+ TAOS_RES *result;
+ int code;
+ TAOS_STMT *stmt;
+
+ // connect to server
+ if (argc < 2) {
+ printf("please input server ip \n");
+ return 0;
+ }
+
+ // taos = taos_connect(argv[1], "root", "Taosdata.1234", NULL, 0);
+ taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
+ if (taos == NULL) {
+ printf("failed to connect to db, reason:%s\n", taos_errstr(taos));
+ exit(1);
+ }
+
+ result = taos_query(taos, "drop database demo");
+ taos_free_result(result);
+
+ result = taos_query(taos, "create database demo");
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("failed to create database, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+ taos_free_result(result);
+
+ result = taos_query(taos, "use demo");
+ taos_free_result(result);
+
+ // create table
+ const char *sql =
+ "create stable s1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin "
+ "binary(40), blob nchar(10), varbin varbinary(16)) tags(groupId INT);";
+ result = taos_query(taos, sql);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("failed to create table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+ taos_free_result(result);
+
+ // sleep for one second to make sure table is created on data node
+ // taosMsleep(1000);
+
+ // insert 10 records
+ struct {
+ int64_t ts;
+ int8_t b;
+ int8_t v1;
+ int16_t v2;
+ int32_t v4;
+ int64_t v8;
+ float f4;
+ double f8;
+ char bin[40];
+ char blob[80];
+ int8_t varbin[16];
+ } v = {0};
+
+ int32_t boolLen = sizeof(int8_t);
+ int32_t sintLen = sizeof(int16_t);
+ int32_t intLen = sizeof(int32_t);
+ int32_t bintLen = sizeof(int64_t);
+ int32_t floatLen = sizeof(float);
+ int32_t doubleLen = sizeof(double);
+ int32_t binLen = sizeof(v.bin);
+ int32_t ncharLen = 30;
+
+ stmt = taos_stmt_init(taos);
+ TAOS_MULTI_BIND params[11];
+ params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
+ params[0].buffer_length = sizeof(v.ts);
+ params[0].buffer = &v.ts;
+ params[0].length = &bintLen;
+ params[0].is_null = NULL;
+ params[0].num = 1;
+
+ params[1].buffer_type = TSDB_DATA_TYPE_BOOL;
+ params[1].buffer_length = sizeof(v.b);
+ params[1].buffer = &v.b;
+ params[1].length = &boolLen;
+ params[1].is_null = NULL;
+ params[1].num = 1;
+
+ params[2].buffer_type = TSDB_DATA_TYPE_TINYINT;
+ params[2].buffer_length = sizeof(v.v1);
+ params[2].buffer = &v.v1;
+ params[2].length = &boolLen;
+ params[2].is_null = NULL;
+ params[2].num = 1;
+
+ params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT;
+ params[3].buffer_length = sizeof(v.v2);
+ params[3].buffer = &v.v2;
+ params[3].length = &sintLen;
+ params[3].is_null = NULL;
+ params[3].num = 1;
+
+ params[4].buffer_type = TSDB_DATA_TYPE_INT;
+ params[4].buffer_length = sizeof(v.v4);
+ params[4].buffer = &v.v4;
+ params[4].length = &intLen;
+ params[4].is_null = NULL;
+ params[4].num = 1;
+
+ params[5].buffer_type = TSDB_DATA_TYPE_BIGINT;
+ params[5].buffer_length = sizeof(v.v8);
+ params[5].buffer = &v.v8;
+ params[5].length = &bintLen;
+ params[5].is_null = NULL;
+ params[5].num = 1;
+
+ params[6].buffer_type = TSDB_DATA_TYPE_FLOAT;
+ params[6].buffer_length = sizeof(v.f4);
+ params[6].buffer = &v.f4;
+ params[6].length = &floatLen;
+ params[6].is_null = NULL;
+ params[6].num = 1;
+
+ params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE;
+ params[7].buffer_length = sizeof(v.f8);
+ params[7].buffer = &v.f8;
+ params[7].length = &doubleLen;
+ params[7].is_null = NULL;
+ params[7].num = 1;
+
+ params[8].buffer_type = TSDB_DATA_TYPE_BINARY;
+ params[8].buffer_length = sizeof(v.bin);
+ params[8].buffer = v.bin;
+ params[8].length = &binLen;
+ params[8].is_null = NULL;
+ params[8].num = 1;
+
+ strcpy(v.blob, "一二三四五六七八九十");
+ params[9].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ params[9].buffer_length = sizeof(v.blob);
+ params[9].buffer = v.blob;
+ params[9].length = &ncharLen;
+ params[9].is_null = NULL;
+ params[9].num = 1;
+
+ int8_t tmp[16] = {'a', 0, 1, 13, '1'};
+ int32_t vbinLen = 5;
+ memcpy(v.varbin, tmp, sizeof(v.varbin));
+ params[10].buffer_type = TSDB_DATA_TYPE_VARBINARY;
+ params[10].buffer_length = sizeof(v.varbin);
+ params[10].buffer = v.varbin;
+ params[10].length = &vbinLen;
+ params[10].is_null = NULL;
+ params[10].num = 1;
+
+ TAOS_MULTI_BIND tags[1];
+
+ int32_t id1 = 0;
+
+ tags[0].buffer_type = TSDB_DATA_TYPE_INT;
+ tags[0].buffer_length = sizeof(int);
+ tags[0].buffer = &id1;
+ tags[0].length = NULL;
+ tags[0].is_null = NULL;
+ tags[0].num = 1;
+
+ char is_null = 1;
+
+ sql = "insert into ? using s1 tags(?) values(?,?,?,?,?,?,?,?,?,?,?)";
+ code = taos_stmt_prepare(stmt, sql, 0);
+ if (code != 0) {
+ printf("failed to execute taos_stmt_prepare. code:0x%x\n", code);
+ }
+
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+ code = taos_stmt_set_tbname_tags(stmt, "m1", tags);
+ v.ts = 1591060628000;
+ v.b = (int8_t)0 % 2;
+ v.v1 = (int8_t)0;
+ v.v2 = (int16_t)(0 * 2);
+ v.v4 = (int32_t)(0 * 4);
+ v.v8 = (int64_t)(0 * 8);
+ v.f4 = (float)(0 * 40);
+ v.f8 = (double)(0 * 80);
+ for (int j = 0; j < sizeof(v.bin); ++j) {
+ v.bin[j] = (char)(0 + '0');
+ }
+ taos_stmt_bind_param(stmt, params);
+ taos_stmt_add_batch(stmt);
+
+ code = taos_stmt_set_tbname_tags(stmt, "m2", tags);
+ v.ts = 1591060628000 + 1;
+ v.b = (int8_t)1 % 2;
+ v.v1 = (int8_t)1;
+ v.v2 = (int16_t)(1 * 2);
+ v.v4 = (int32_t)(1 * 4);
+ v.v8 = (int64_t)(1 * 8);
+ v.f4 = (float)(1 * 40);
+ v.f8 = (double)(1 * 80);
+ for (int j = 0; j < sizeof(v.bin); ++j) {
+ v.bin[j] = (char)(1 + '0');
+ }
+ taos_stmt_bind_param(stmt, params);
+ taos_stmt_add_batch(stmt);
+ /*
+ for (int i = 0; i < 10; ++i) {
+ if(i % 2 != 0) {
+ code = taos_stmt_set_tbname(stmt, "m1");
+ } else {
+ code = taos_stmt_set_tbname(stmt, "m2");
+ }
+ v.ts += 1;
+ for (int j = 1; j < 11; ++j) {
+ params[j].is_null = ((i == j) ? &is_null : 0);
+ }
+ v.b = (int8_t)i % 2;
+ v.v1 = (int8_t)i;
+ v.v2 = (int16_t)(i * 2);
+ v.v4 = (int32_t)(i * 4);
+ v.v8 = (int64_t)(i * 8);
+ v.f4 = (float)(i * 40);
+ v.f8 = (double)(i * 80);
+ for (int j = 0; j < sizeof(v.bin); ++j) {
+ v.bin[j] = (char)(i + '0');
+ }
+
+ taos_stmt_bind_param(stmt, params);
+ taos_stmt_add_batch(stmt);
+ }
+ */
+ // printf("taos multi bind num:%d\n", params[1].num);
+ if (taos_stmt_execute(stmt) != 0) {
+ printf("failed to execute insert statement.\n");
+ exit(1);
+ }
+ taos_stmt_close(stmt);
+
+ // query the records
+ stmt = taos_stmt_init(taos);
+ taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0);
+ v.v1 = 5;
+ v.v2 = 15;
+ taos_stmt_bind_param(stmt, params + 2);
+ if (taos_stmt_execute(stmt) != 0) {
+ printf("failed to execute select statement.\n");
+ exit(1);
+ }
+
+ result = taos_stmt_use_result(stmt);
+
+ TAOS_ROW row;
+ int rows = 0;
+ int num_fields = taos_num_fields(result);
+ TAOS_FIELD *fields = taos_fetch_fields(result);
+
+ // fetch the records row by row
+ while ((row = taos_fetch_row(result))) {
+ char temp[256] = {0};
+ rows++;
+ taos_print_row(temp, row, fields, num_fields);
+ printf("%s\n", temp);
+ }
+ if (rows == 2) {
+ printf("two rows are fetched as expectation\n");
+ } else {
+ printf("expect two rows, but %d rows are fetched\n", rows);
+ }
+
+ // taos_free_result(result);
+ taos_stmt_close(stmt);
+
+ return 0;
+}
diff --git a/tests/script/api/stmt2-example.c b/tests/script/api/stmt2-example.c
new file mode 100644
index 0000000000..803e54c156
--- /dev/null
+++ b/tests/script/api/stmt2-example.c
@@ -0,0 +1,87 @@
+#include
+#include
+#include
+#include "taos.h"
+
+void do_query(TAOS* taos, const char* sql) {
+ TAOS_RES* result = taos_query(taos, sql);
+ int code = taos_errno(result);
+ if (code) {
+ printf("failed to query: %s, reason:%s\n", sql, taos_errstr(result));
+ taos_free_result(result);
+ return;
+ }
+ taos_free_result(result);
+}
+
+void do_stmt(TAOS* taos) {
+ do_query(taos, "drop database if exists db");
+ do_query(taos, "create database db");
+ do_query(taos, "create table db.stb (ts timestamp, b binary(10)) tags(t1 int, t2 binary(10))");
+
+ struct {
+ int64_t ts[2];
+ char b[16];
+ } v;
+
+ int32_t b_len[2], t64_len[2];
+ char is_null[2] = {0};
+ char is_null2[2] = {0, 2};
+ // TAOS_STMT2_OPTION option = {0};
+ // TAOS_STMT2_OPTION option = {0, true, true, stmtAsyncQueryCb, NULL};
+ TAOS_STMT2_OPTION option = {0, true, false, NULL, NULL};
+
+ char* tbs[2] = {"tb", "tb2"};
+ int t1_val[2] = {0, 1};
+ int t2_len[2] = {3, 3};
+ TAOS_STMT2_BIND tags[2][2] = {{{0, &t1_val[0], NULL, NULL, 0}, {0, "a1", &t2_len[0], NULL, 0}},
+ {{0, &t1_val[1], NULL, NULL, 0}, {0, "a2", &t2_len[1], NULL, 0}}};
+ TAOS_STMT2_BIND params[2][2] = {
+ {{TSDB_DATA_TYPE_TIMESTAMP, v.ts, NULL, is_null, 2}, {TSDB_DATA_TYPE_BINARY, v.b, b_len, is_null2, 2}},
+ {{TSDB_DATA_TYPE_TIMESTAMP, v.ts, NULL, is_null, 2}, {TSDB_DATA_TYPE_BINARY, v.b, b_len, is_null2, 2}}};
+ TAOS_STMT2_BIND* tagv[2] = {&tags[0][0], &tags[1][0]};
+ TAOS_STMT2_BIND* paramv[2] = {¶ms[0][0], ¶ms[1][0]};
+ TAOS_STMT2_BINDV bindv = {2, &tbs[0], &tagv[0], ¶mv[0]};
+
+ TAOS_STMT2* stmt = taos_stmt2_init(taos, &option);
+ const char* sql = "insert into db.? using db.stb tags(?, ?) values(?,?)";
+ int code = taos_stmt2_prepare(stmt, sql, 0);
+ if (code != 0) {
+ printf("failed to execute taos_stmt2_prepare. error:%s\n", taos_stmt2_error(stmt));
+ taos_stmt2_close(stmt);
+ return;
+ }
+
+ int64_t ts = 1591060628000;
+ for (int i = 0; i < 2; ++i) {
+ // v.ts[i] = ts++;
+ v.ts[i] = ts;
+ // t64_len[i] = sizeof(int64_t);
+ }
+ strcpy(v.b, "abcdefg");
+ b_len[0] = (int)strlen(v.b);
+ strcpy(v.b + b_len[0], "xyz");
+ b_len[1] = 3;
+
+ taos_stmt2_bind_param(stmt, &bindv, -1);
+
+ if (taos_stmt2_exec(stmt, NULL)) {
+ printf("failed to execute insert statement.error:%s\n", taos_stmt2_error(stmt));
+ taos_stmt2_close(stmt);
+ return;
+ }
+
+ taos_stmt2_close(stmt);
+}
+
+int main() {
+ TAOS* taos = taos_connect("localhost", "root", "taosdata", "", 0);
+ if (!taos) {
+ printf("failed to connect to db, reason:%s\n", taos_errstr(taos));
+ exit(1);
+ }
+
+ do_stmt(taos);
+ taos_close(taos);
+ taos_cleanup();
+}
diff --git a/tests/script/api/stmt2-nohole.c b/tests/script/api/stmt2-nohole.c
new file mode 100644
index 0000000000..b29dd3e826
--- /dev/null
+++ b/tests/script/api/stmt2-nohole.c
@@ -0,0 +1,369 @@
+// sample code to verify all TDengine API
+// to compile: gcc -o apitest apitest.c -ltaos
+
+#include
+#include
+#include
+#include
+#include
+#include "taos.h"
+static int64_t count = 10000;
+
+int64_t genReqid() {
+ count += 100;
+ return count;
+}
+
+sem_t sem;
+
+void stmtAsyncQueryCb(void* param, TAOS_RES* pRes, int code) {
+ int affected_rows = taos_affected_rows(pRes);
+ printf("\033[31maffected rows:%d\033[0m\n", affected_rows);
+ (void)sem_post(&sem);
+ return;
+ /*
+ SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)param;
+ if (code == 0 && pRes) {
+ if (qParam->fetch) {
+ taos_fetch_rows_a(pRes, sqAsyncFetchCb, param);
+ } else {
+ if (qParam->free) {
+ taos_free_result(pRes);
+ }
+ *qParam->end = 1;
+ }
+ } else {
+ sqError("select", taos_errstr(pRes));
+ *qParam->end = 1;
+ taos_free_result(pRes);
+ }
+ */
+}
+
+void veriry_stmt(TAOS* taos) {
+ TAOS_RES* result = taos_query(taos, "drop database if exists test;");
+ taos_free_result(result);
+ usleep(100000);
+ result = taos_query(taos, "create database test;");
+
+ int code = taos_errno(result);
+ if (code != 0) {
+ printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result));
+ taos_free_result(result);
+ return;
+ }
+ taos_free_result(result);
+
+ usleep(100000);
+ taos_select_db(taos, "test");
+
+ // create table
+ /*
+ const char* sql =
+ "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin "
+ "binary(40), blob nchar(10))";
+ */
+ const char* sql =
+ "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob2 "
+ "nchar(10), blob nchar(10))";
+ result = taos_query(taos, sql);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result));
+ taos_free_result(result);
+ return;
+ }
+ taos_free_result(result);
+
+ sql =
+ "create table m2 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob2 "
+ "nchar(10), blob nchar(10))";
+ result = taos_query(taos, sql);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result));
+ taos_free_result(result);
+ return;
+ }
+ taos_free_result(result);
+
+ // insert 10 records
+ struct {
+ int64_t ts[10];
+ int8_t b[10];
+ int8_t v1[10];
+ int16_t v2[10];
+ int32_t v4[10];
+ int64_t v8[10];
+ float f4[10];
+ double f8[10];
+ char bin[10][40];
+ // char blob[10][80];
+ // char blob2[10][80];
+ char blob[1024];
+ char blob2[1024];
+ } v;
+
+ int32_t* t8_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t16_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t32_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t64_len = malloc(sizeof(int32_t) * 10);
+ int32_t* float_len = malloc(sizeof(int32_t) * 10);
+ int32_t* double_len = malloc(sizeof(int32_t) * 10);
+ int32_t* bin_len = malloc(sizeof(int32_t) * 10);
+ int32_t* blob_len = malloc(sizeof(int32_t) * 10);
+ int32_t* blob_len2 = malloc(sizeof(int32_t) * 10);
+
+#include "time.h"
+ clock_t start, end;
+ TAOS_STMT2_OPTION option = {0, true, false, stmtAsyncQueryCb, NULL};
+
+ start = clock();
+ TAOS_STMT2* stmt = taos_stmt2_init(taos, &option);
+ end = clock();
+ printf("init time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ // TAOS_MULTI_BIND params[10];
+ TAOS_STMT2_BIND params[10];
+ char is_null2[10] = {0};
+ char is_null[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 2};
+
+ params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
+ // params[0].buffer_length = sizeof(v.ts[0]);
+ params[0].buffer = v.ts;
+ params[0].length = NULL; // t64_len;
+ params[0].is_null = is_null2;
+ params[0].num = 10;
+
+ params[1].buffer_type = TSDB_DATA_TYPE_BOOL;
+ // params[1].buffer_length = sizeof(v.b[0]);
+ params[1].buffer = v.b;
+ params[1].length = NULL; // t8_len;
+ params[1].is_null = is_null;
+ params[1].num = 10;
+
+ params[2].buffer_type = TSDB_DATA_TYPE_TINYINT;
+ // params[2].buffer_length = sizeof(v.v1[0]);
+ params[2].buffer = v.v1;
+ params[2].length = NULL; // t8_len;
+ params[2].is_null = is_null;
+ params[2].num = 10;
+
+ params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT;
+ // params[3].buffer_length = sizeof(v.v2[0]);
+ params[3].buffer = v.v2;
+ params[3].length = NULL; // t16_len;
+ params[3].is_null = is_null;
+ params[3].num = 10;
+
+ params[4].buffer_type = TSDB_DATA_TYPE_INT;
+ // params[4].buffer_length = sizeof(v.v4[0]);
+ params[4].buffer = v.v4;
+ params[4].length = NULL; // t32_len;
+ params[4].is_null = is_null;
+ params[4].num = 10;
+
+ params[5].buffer_type = TSDB_DATA_TYPE_BIGINT;
+ // params[5].buffer_length = sizeof(v.v8[0]);
+ params[5].buffer = v.v8;
+ params[5].length = NULL; // t64_len;
+ params[5].is_null = is_null;
+ params[5].num = 10;
+
+ params[6].buffer_type = TSDB_DATA_TYPE_FLOAT;
+ // params[6].buffer_length = sizeof(v.f4[0]);
+ params[6].buffer = v.f4;
+ params[6].length = NULL; // float_len;
+ params[6].is_null = is_null;
+ params[6].num = 10;
+
+ params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE;
+ // params[7].buffer_length = sizeof(v.f8[0]);
+ params[7].buffer = v.f8;
+ params[7].length = NULL; // double_len;
+ params[7].is_null = is_null;
+ params[7].num = 10;
+ /*
+ params[8].buffer_type = TSDB_DATA_TYPE_BINARY;
+ //params[8].buffer_length = sizeof(v.bin[0]);
+ params[8].buffer = v.bin;
+ params[8].length = bin_len;
+ params[8].is_null = is_null;
+ params[8].num = 10;
+ */
+ params[8].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ // params[8].buffer_length = sizeof(v.blob2[0]);
+ params[8].buffer = v.blob2;
+ params[8].length = blob_len2;
+ params[8].is_null = is_null;
+ params[8].num = 10;
+
+ params[9].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ // params[9].buffer_length = sizeof(v.blob[0]);
+ params[9].buffer = v.blob;
+ params[9].length = blob_len;
+ params[9].is_null = is_null;
+ params[9].num = 10;
+
+ sql = "insert into ? (ts, b, v1, v2, v4, v8, f4, f8, blob2, blob) values(?,?,?,?,?,?,?,?,?,?)";
+ start = clock();
+ code = taos_stmt2_prepare(stmt, sql, 0);
+ end = clock();
+ printf("prepare time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ /*
+ code = taos_stmt_set_tbname(stmt, "m1");
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ */
+
+ int64_t ts = 1591060628000;
+ char* blob2_buffer = v.blob2;
+ char* blob_buffer = v.blob;
+ const char* blob2_str[] = {
+ "一二三四五六七十九八", "一二三四五六七十九", "一二三四五六七十", "一二三四五六七", "一二三四五六",
+ "一二三四五", "一二三四", "一二三", "一二", "一",
+ };
+ const char* blob_str[] = {
+ "一", "一二", "一二三", "一二三四", "一二三四五",
+ "一二三四五六", "一二三四五六七", "一二三四五六七八", "一二三四五六七八九", "一二三四五六七八九十",
+ };
+ for (int i = 0; i < 10; ++i) {
+ // is_null[i] = 0;
+
+ v.ts[i] = ts++;
+ // v.b[i] = (int8_t)i % 2;
+ v.b[i] = (int8_t)i % 10;
+ v.v1[i] = (int8_t)i;
+ v.v2[i] = (int16_t)(i * 2);
+ v.v4[i] = (int32_t)(i * 4);
+ v.v8[i] = (int64_t)(i * 8);
+ v.f4[i] = (float)(i * 40);
+ v.f8[i] = (double)(i * 80);
+ for (int j = 0; j < sizeof(v.bin[0]); ++j) {
+ v.bin[i][j] = (char)(i + '0');
+ }
+ // strcpy(v.blob2[i], "一二三四五六七十九八");
+ // strcpy(v.blob[i], "一二三四五六七八九十");
+ // const char* blob2_str = "一二三四五六七十九八";
+ // const char* blob_str = "一二三四五六七八九十";
+ strcpy(blob2_buffer, blob2_str[i]);
+ strcpy(blob_buffer, blob_str[i]);
+
+ t8_len[i] = sizeof(int8_t);
+ t16_len[i] = sizeof(int16_t);
+ t32_len[i] = sizeof(int32_t);
+ t64_len[i] = sizeof(int64_t);
+ float_len[i] = sizeof(float);
+ double_len[i] = sizeof(double);
+ bin_len[i] = sizeof(v.bin[0]);
+ // blob_len[i] = (int32_t)strlen(v.blob[i]);
+ // blob_len2[i] = (int32_t)strlen(v.blob2[i]);
+ blob_len[i] = (int32_t)strlen(blob_str[i]);
+ blob_len2[i] = (int32_t)strlen(blob2_str[i]);
+ blob_buffer += blob_len[i];
+ blob2_buffer += blob_len2[i];
+ }
+ int run_time = 0;
+ char* tbname = "m2";
+ TAOS_STMT2_BIND* bind_cols[1] = {¶ms[0]};
+ TAOS_STMT2_BINDV bindv = {1, &tbname, NULL, &bind_cols[0]};
+_bind_again:
+ start = clock();
+ // taos_stmt2_bind_param(stmt, "m1", NULL, params, -1);
+ taos_stmt2_bind_param(stmt, &bindv, -1);
+ end = clock();
+ printf("bind time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ // taos_stmt_bind_param_batch(stmt, params);
+ // taos_stmt_add_batch(stmt);
+ /*
+ int param_count = -1;
+ code = taos_stmt2_param_count(stmt, ¶m_count);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_param_count. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ printf("param_count: %d\n", param_count);
+ */
+ TAOS_FIELD_E* fields = NULL;
+ int field_count = -1;
+ start = clock();
+ code = taos_stmt2_get_fields(stmt, TAOS_FIELD_TBNAME, &field_count, NULL);
+ end = clock();
+ printf("get fields time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_param_count. error:%s\033[0m\n", taos_stmt2_error(stmt));
+ taos_stmt2_close(stmt);
+ return;
+ }
+ printf("col field_count: %d\n", field_count);
+ start = clock();
+ taos_stmt2_free_fields(stmt, fields);
+ end = clock();
+ printf("free time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ /*
+ code = taos_stmt2_get_fields(stmt, TAOS_FIELD_TAG, &field_count, &fields);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_param_count. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ printf("tag field_count: %d\n", field_count);
+ taos_stmt2_free_fields(stmt, fields);
+ */
+ // if (taos_stmt_execute(stmt) != 0) {
+ (void)sem_init(&sem, 0, 0);
+ start = clock();
+ // if (taos_stmt2_exec(stmt, NULL, stmtAsyncQueryCb, NULL) != 0) {
+ if (taos_stmt2_exec(stmt, NULL) != 0) {
+ printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt2_close(stmt);
+ return;
+ }
+ end = clock();
+ printf("exec time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+
+ sem_wait(&sem);
+ (void)sem_destroy(&sem);
+ if (++run_time < 2) {
+ goto _bind_again;
+ }
+ taos_stmt2_close(stmt);
+
+ free(t8_len);
+ free(t16_len);
+ free(t32_len);
+ free(t64_len);
+ free(float_len);
+ free(double_len);
+ free(bin_len);
+ free(blob_len);
+ free(blob_len2);
+}
+
+int main(int argc, char* argv[]) {
+ const char* host = "127.0.0.1";
+ const char* user = "root";
+ const char* passwd = "taosdata";
+
+ taos_options(TSDB_OPTION_TIMEZONE, "GMT-8");
+ TAOS* taos = taos_connect(host, user, passwd, "", 0);
+ if (taos == NULL) {
+ printf("\033[31mfailed to connect to db, reason:%s\033[0m\n", taos_errstr(taos));
+ exit(1);
+ }
+
+ printf("********* verify stmt query **********\n");
+ veriry_stmt(taos);
+
+ printf("done\n");
+ taos_close(taos);
+ taos_cleanup();
+}
diff --git a/tests/script/api/stmt2-test.c b/tests/script/api/stmt2-test.c
new file mode 100644
index 0000000000..2bbceec92e
--- /dev/null
+++ b/tests/script/api/stmt2-test.c
@@ -0,0 +1,3201 @@
+// TAOS standard API example. The same syntax as MySQL, but only a subet
+// to compile: gcc -o prepare prepare.c -ltaos
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../../../include/client/taos.h"
+
+#define FUNCTION_TEST_IDX 1
+#define TIME_PRECISION_MILLI 0
+#define TIME_PRECISION_MICRO 1
+#define TIME_PRECISION_NANO 2
+
+int32_t shortColList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_INT};
+int32_t fullColList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_BOOL, TSDB_DATA_TYPE_TINYINT,
+ TSDB_DATA_TYPE_UTINYINT, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_USMALLINT,
+ TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_UINT, TSDB_DATA_TYPE_BIGINT,
+ TSDB_DATA_TYPE_UBIGINT, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE,
+ TSDB_DATA_TYPE_BINARY, TSDB_DATA_TYPE_NCHAR};
+int32_t bindColTypeList[] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_NCHAR};
+int32_t optrIdxList[] = {5, 11};
+
+typedef struct {
+ char *oper;
+ int32_t paramNum;
+ bool enclose;
+} OperInfo;
+
+typedef struct {
+ char *funcName;
+ int32_t paramNum;
+} FuncInfo;
+
+typedef enum {
+ BP_BIND_TAG = 1,
+ BP_BIND_COL,
+} BP_BIND_TYPE;
+
+#define BP_BIND_TYPE_STR(t) (((t) == BP_BIND_COL) ? "column" : "tag")
+
+OperInfo operInfo[] = {
+ {">", 2, false}, {">=", 2, false}, {"<", 2, false}, {"<=", 2, false},
+ {"=", 2, false}, {"<>", 2, false}, {"in", 2, true}, {"not in", 2, true},
+
+ {"like", 2, false}, {"not like", 2, false}, {"match", 2, false}, {"nmatch", 2, false},
+};
+
+int32_t operatorList[] = {0, 1, 2, 3, 4, 5, 6, 7};
+int32_t varoperatorList[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+
+FuncInfo funcInfo[] = {
+ {"count", 1},
+ {"sum", 1},
+ {"min", 1},
+};
+
+#define BP_STARTUP_TS 1591060628000
+
+char *bpStbPrefix = "st";
+char *bpTbPrefix = "t";
+int32_t bpDefaultStbId = 1;
+int64_t bpTs;
+
+// char *operatorList[] = {">", ">=", "<", "<=", "=", "<>", "in", "not in"};
+// char *varoperatorList[] = {">", ">=", "<", "<=", "=", "<>", "in", "not in", "like", "not like", "match", "nmatch"};
+
+#define tListLen(x) (sizeof(x) / sizeof((x)[0]))
+#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
+#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
+#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE)
+#define IS_NUMERIC_TYPE(_t) ((IS_SIGNED_NUMERIC_TYPE(_t)) || (IS_UNSIGNED_NUMERIC_TYPE(_t)) || (IS_FLOAT_TYPE(_t)))
+
+typedef struct {
+ bool singleTbInsert;
+ int32_t singleTbIdx;
+
+ int64_t *tsData;
+ bool *boolData;
+ int8_t *tinyData;
+ uint8_t *utinyData;
+ int16_t *smallData;
+ uint16_t *usmallData;
+ int32_t *intData;
+ uint32_t *uintData;
+ int64_t *bigData;
+ uint64_t *ubigData;
+ float *floatData;
+ double *doubleData;
+ char *binaryData;
+ char *isNull;
+ int32_t *binaryLen;
+ TAOS_STMT2_BIND *pBind;
+ TAOS_STMT2_BIND *pTags;
+ char *sql;
+ int32_t *colTypes;
+ int32_t colNum;
+} BindData;
+
+int32_t gVarCharSize = 10;
+int32_t gVarCharLen = 5;
+
+int32_t gExecLoopTimes = 1; // no change
+int32_t gFullColNum = tListLen(fullColList);
+
+int insertMBSETest1(TAOS_STMT2 *stmt, TAOS *taos);
+int insertMBSETest2(TAOS_STMT2 *stmt, TAOS *taos);
+int insertMBMETest1(TAOS_STMT2 *stmt, TAOS *taos);
+int insertMBMETest2(TAOS_STMT2 *stmt, TAOS *taos);
+int insertMBMETest3(TAOS_STMT2 *stmt, TAOS *taos);
+int insertMBMETest4(TAOS_STMT2 *stmt, TAOS *taos);
+int insertMPMETest1(TAOS_STMT2 *stmt, TAOS *taos);
+int insertAUTOTest1(TAOS_STMT2 *stmt, TAOS *taos);
+int insertAUTOTest2(TAOS_STMT2 *stmt, TAOS *taos);
+int insertAUTOTest3(TAOS_STMT2 *stmt, TAOS *taos);
+int queryColumnTest(TAOS_STMT2 *stmt, TAOS *taos);
+int queryMiscTest(TAOS_STMT2 *stmt, TAOS *taos);
+int insertNonExistsTb(TAOS_STMT2 *stmt, TAOS *taos);
+int insertVarLenErr(TAOS_STMT2 *stmt, TAOS *taos);
+int insertStbTest(TAOS_STMT2 *stmt, TAOS *taos);
+
+enum {
+ TTYPE_INSERT = 1,
+ TTYPE_INSERT_NG,
+ TTYPE_QUERY,
+};
+
+typedef struct {
+ char caseDesc[128];
+ int32_t colNum;
+ int32_t *colList; // full table column list
+ int32_t testType;
+ int32_t autoCreateTbl;
+ bool duplicateValue;
+ bool fullCol;
+ int32_t (*runFn)(TAOS_STMT2 *, TAOS *);
+ int32_t tblNum;
+ int32_t rowNum;
+ int32_t bindRowNum;
+ int32_t bindColNum; // equal colNum in full column case
+ int32_t bindTagNum; // equal colNum in full column case
+ int32_t bindNullNum;
+ int32_t runTimes;
+ int32_t preCaseIdx;
+ bool stbInsert;
+} CaseCfg;
+
+CaseCfg gCase[] = {
+ {"insert:MBSE0-FULL", tListLen(shortColList), shortColList, TTYPE_INSERT, 0, false, true, insertMBSETest1, 1, 10,
+ 10, 0, 0, 0, 1, -1, false},
+ {"insert:MBSE0-FULL", tListLen(shortColList), shortColList, TTYPE_INSERT, 0, false, true, insertMBSETest1, 10, 100,
+ 10, 0, 0, 0, 1, -1, false},
+
+ {"insert:MBSE1-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertMBSETest1, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:MBSE1-C012", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBSETest1, 10, 10, 2,
+ 12, 0, 0, 1, -1, false},
+ {"insert:MBSE1-C002", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBSETest1, 10, 10, 2,
+ 2, 0, 0, 1, -1, false},
+
+ {"insert:MBSE2-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertMBSETest2, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:MBSE2-C012", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBSETest2, 10, 10, 2,
+ 12, 0, 0, 1, -1, false},
+ {"insert:MBSE2-C002", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBSETest2, 10, 10, 2,
+ 2, 0, 0, 1, -1, false},
+
+ {"insert:MBME1-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertMBMETest1, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:MBME1-C012", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest1, 10, 10, 2,
+ 12, 0, 0, 1, -1, false},
+ {"insert:MBME1-C002", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest1, 10, 10, 2,
+ 2, 0, 0, 1, -1, false},
+
+ // 11
+ {"insert:MBME2-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertMBMETest2, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:MBME2-C012", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest2, 10, 10, 2,
+ 12, 0, 0, 1, -1, false},
+ {"insert:MBME2-C002", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest2, 10, 10, 2,
+ 2, 0, 0, 1, -1, false},
+
+ {"insert:MBME3-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertMBMETest3, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:MBME3-C012", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest3, 10, 10, 2,
+ 12, 0, 0, 1, -1, false},
+ {"insert:MBME3-C002", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest3, 10, 10, 2,
+ 2, 0, 0, 1, -1, false},
+
+ {"insert:MBME4-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertMBMETest4, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:MBME4-C012", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest4, 10, 10, 2,
+ 12, 0, 0, 1, -1, false},
+ {"insert:MBME4-C002", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMBMETest4, 10, 10, 2,
+ 2, 0, 0, 1, -1, false},
+
+ {"insert:MPME1-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertMPMETest1, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:MPME1-C012", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, false, insertMPMETest1, 10, 10, 2,
+ 12, 0, 0, 1, -1, false},
+
+ {"insert:STBI-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, false, true, insertStbTest, 10, 10, 2, 0,
+ 0, 0, 1, -1, true},
+
+ // 23
+ {"insert:AUTO1-FULL", tListLen(fullColList), fullColList, TTYPE_INSERT, 1, false, true, insertAUTOTest1, 10, 10, 2,
+ 0, 0, 0, 1, -1, false},
+ {"insert:AUTO2-TBEXISTS", tListLen(fullColList), fullColList, TTYPE_INSERT, 3, false, true, insertAUTOTest2, 10, 10,
+ 2, 0, 0, 0, 1, -1, false},
+ // {"insert:AUTO3-NTB", tListLen(fullColList), fullColList, TTYPE_INSERT, 0, true, true, insertAUTOTest3, 10, 10,
+ // 2, 0, 0, 0, 1, -1, false},
+
+ {"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryColumnTest, 10, 10, 1,
+ 3, 0, 0, 1, 2, false},
+ {"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryMiscTest, 10, 10, 1, 3,
+ 0, 0, 1, 2, false},
+
+ {"query:NG-TBNEXISTS", tListLen(fullColList), fullColList, TTYPE_INSERT_NG, 0, false, false, insertNonExistsTb, 10,
+ 10, 1, 3, 0, 0, 1, -1, false},
+ {"query:NG-VARLENERR", tListLen(fullColList), fullColList, TTYPE_INSERT_NG, 0, false, true, insertVarLenErr, 10, 10,
+ 1, 3, 0, 0, 1, -1, false},
+
+ // {"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryColumnTest, 1, 10,
+ // 1, 1, 0, 0, 1, 2, false},
+ // {"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryMiscTest, 2, 10, 1,
+ // 1, 0, 0, 1, 2, false},
+
+};
+
+CaseCfg *gCurCase = NULL;
+
+typedef struct {
+ char caseCatalog[255];
+ int32_t bindNullNum;
+ bool checkParamNum;
+ bool printRes;
+ bool printCreateTblSql;
+ bool printQuerySql;
+ bool printStmtSql;
+ bool printVerbose;
+ bool autoCreateTbl;
+ bool numericParam;
+ uint8_t precision;
+ int32_t rowNum; // row num for one table
+ int32_t bindColNum;
+ int32_t bindTagNum;
+ int32_t bindRowNum; // row num for once bind
+ int32_t bindColTypeNum;
+ int32_t *bindColTypeList;
+ int32_t bindTagTypeNum;
+ int32_t *bindTagTypeList;
+ int32_t optrIdxListNum;
+ int32_t *optrIdxList;
+ int32_t funcIdxListNum;
+ int32_t *funcIdxList;
+ int32_t runTimes;
+ int32_t caseIdx; // static case idx
+ int32_t caseNum; // num in static case list
+ int32_t caseRunIdx; // runtime case idx
+ int32_t caseRunNum; // total run case num
+} CaseCtrl;
+
+#if 0
+CaseCtrl gCaseCtrl = {
+ .precision = TIME_PRECISION_MILLI,
+ .bindNullNum = 0,
+ .printCreateTblSql = true,
+ .printQuerySql = true,
+ .printStmtSql = true,
+ .printVerbose = true,
+ .printRes = true,
+ .autoCreateTbl = false,
+ .numericParam = false,
+ .rowNum = 0,
+ .bindColNum = 0,
+ .bindTagNum = 0,
+ .bindRowNum = 0,
+ .bindColTypeNum = 0,
+ .bindColTypeList = NULL,
+ .bindTagTypeNum = 0,
+ .bindTagTypeList = NULL,
+ .optrIdxListNum = 0,
+ .optrIdxList = NULL,
+ .funcIdxListNum = 0,
+ .funcIdxList = NULL,
+ .checkParamNum = false,
+ .runTimes = 0,
+ .caseIdx = 20,
+ .caseNum = 1,
+ .caseRunIdx = -1,
+ .caseRunNum = -1,
+};
+#endif
+
+#if 1
+CaseCtrl gCaseCtrl = {
+ // default
+ .precision = TIME_PRECISION_MILLI,
+ .bindNullNum = 0,
+ .printCreateTblSql = true,
+ .printQuerySql = true,
+ .printStmtSql = true,
+ .printVerbose = false,
+ .printRes = true,
+ .autoCreateTbl = false,
+ .numericParam = false,
+ .rowNum = 0,
+ .bindColNum = 0,
+ .bindTagNum = 0,
+ .bindRowNum = 0,
+ .bindColTypeNum = 0,
+ .bindColTypeList = NULL,
+ .bindTagTypeNum = 0,
+ .bindTagTypeList = NULL,
+ .optrIdxListNum = 0,
+ .optrIdxList = NULL,
+ .funcIdxListNum = 0,
+ .funcIdxList = NULL,
+ .checkParamNum = false,
+ .runTimes = 0,
+ .caseIdx = -1,
+ .caseNum = -1,
+ .caseRunIdx = -1,
+ .caseRunNum = -1,
+};
+#endif
+
+#if 0
+CaseCtrl gCaseCtrl = { // query case with specified col&oper
+ .bindNullNum = 1,
+ .printCreateTblSql = false,
+ .printQuerySql = true,
+ .printStmtSql = true,
+ .rowNum = 0,
+ .bindColNum = 0,
+ .bindRowNum = 0,
+ .optrIdxListNum = tListLen(optrIdxList),
+ .optrIdxList = optrIdxList,
+ .bindColTypeNum = tListLen(bindColTypeList),
+ .bindColTypeList = bindColTypeList,
+ .checkParamNum = false,
+ .printRes = true,
+ .runTimes = 0,
+ .caseRunIdx = -1,
+ .caseIdx = 5,
+ .caseNum = 1,
+ .caseRunNum = 1,
+};
+#endif
+
+#if 0
+CaseCtrl gCaseCtrl = { // query case with specified col&oper
+ .bindNullNum = 0,
+ .printCreateTblSql = true,
+ .printQuerySql = true,
+ .printStmtSql = true,
+ .autoCreateTbl = true,
+ .rowNum = 0,
+ .bindColNum = 0,
+ .bindTagNum = 0,
+ .bindRowNum = 0,
+ .bindColTypeNum = 0,
+ .bindColTypeList = bindColTypeList,
+ .optrIdxListNum = 0,
+ .optrIdxList = optrIdxList,
+ .checkParamNum = false,
+ .printRes = true,
+ .runTimes = 0,
+ .caseRunIdx = -1,
+ .optrIdxListNum = tListLen(optrIdxList),
+ .optrIdxList = optrIdxList,
+ .bindColTypeNum = tListLen(bindColTypeList),
+ .bindColTypeList = bindColTypeList,
+ .caseRunIdx = -1,
+ .caseIdx = 24,
+ .caseNum = 1,
+ .caseRunNum = 1,
+};
+#endif
+
+int32_t taosGetTimeOfDay(struct timeval *tv) { return gettimeofday(tv, NULL); }
+void *taosMemoryMalloc(uint64_t size) { return malloc(size); }
+
+void *taosMemoryCalloc(int32_t num, int32_t size) { return calloc(num, size); }
+void taosMemoryFree(const void *ptr) {
+ if (ptr == NULL) return;
+
+ return free((void *)ptr);
+}
+
+static int64_t taosGetTimestampMs() {
+ struct timeval systemTime;
+ taosGetTimeOfDay(&systemTime);
+ return (int64_t)systemTime.tv_sec * 1000LL + (int64_t)systemTime.tv_usec / 1000;
+}
+
+static int64_t taosGetTimestampUs() {
+ struct timeval systemTime;
+ taosGetTimeOfDay(&systemTime);
+ return (int64_t)systemTime.tv_sec * 1000000LL + (int64_t)systemTime.tv_usec;
+}
+
+bool colExists(TAOS_STMT2_BIND *pBind, int32_t dataType) {
+ int32_t i = 0;
+ while (true) {
+ if (0 == pBind[i].buffer_type) {
+ return false;
+ }
+
+ if (pBind[i].buffer_type == dataType) {
+ return true;
+ }
+
+ ++i;
+ }
+}
+
+void generateInsertSQL(BindData *data) {
+ int32_t len = 0;
+ if (gCurCase->tblNum > 1) {
+ if (data->singleTbInsert) {
+ len = sprintf(data->sql, "insert into %s%d ", bpTbPrefix, data->singleTbIdx);
+ } else {
+ len = sprintf(data->sql, "insert into ? ");
+ }
+ } else {
+ len = sprintf(data->sql, "insert into %s0 ", bpTbPrefix);
+ }
+
+ if (gCurCase->bindTagNum > 0) {
+ len += sprintf(data->sql + len, "using %s%d ", bpStbPrefix, bpDefaultStbId);
+
+ if (!gCurCase->fullCol) {
+ len += sprintf(data->sql + len, "(");
+ for (int c = 0; c < gCurCase->bindTagNum; ++c) {
+ if (c) {
+ len += sprintf(data->sql + len, ",");
+ }
+ switch (data->pTags[c].buffer_type) {
+ case TSDB_DATA_TYPE_BOOL:
+ len += sprintf(data->sql + len, "tbooldata");
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ len += sprintf(data->sql + len, "ttinydata");
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ len += sprintf(data->sql + len, "tsmalldata");
+ break;
+ case TSDB_DATA_TYPE_INT:
+ len += sprintf(data->sql + len, "tintdata");
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ len += sprintf(data->sql + len, "tbigdata");
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ len += sprintf(data->sql + len, "tfloatdata");
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ len += sprintf(data->sql + len, "tdoubledata");
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ len += sprintf(data->sql + len, "tbinarydata");
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ len += sprintf(data->sql + len, "tts");
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ len += sprintf(data->sql + len, "tnchardata");
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ len += sprintf(data->sql + len, "tutinydata");
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ len += sprintf(data->sql + len, "tusmalldata");
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ len += sprintf(data->sql + len, "tuintdata");
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ len += sprintf(data->sql + len, "tubigdata");
+ break;
+ default:
+ printf("!!!invalid tag type:%d", data->pTags[c].buffer_type);
+ exit(1);
+ }
+ }
+
+ len += sprintf(data->sql + len, ") ");
+ }
+
+ len += sprintf(data->sql + len, "tags (");
+ for (int c = 0; c < gCurCase->bindTagNum; ++c) {
+ if (c) {
+ len += sprintf(data->sql + len, ",");
+ }
+ len += sprintf(data->sql + len, "?");
+ }
+ len += sprintf(data->sql + len, ") ");
+ }
+
+ if (!gCurCase->fullCol) {
+ len += sprintf(data->sql + len, "(");
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ if (c) {
+ len += sprintf(data->sql + len, ",");
+ }
+ switch (data->pBind[c].buffer_type) {
+ case TSDB_DATA_TYPE_BOOL:
+ len += sprintf(data->sql + len, "booldata");
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ len += sprintf(data->sql + len, "tinydata");
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ len += sprintf(data->sql + len, "smalldata");
+ break;
+ case TSDB_DATA_TYPE_INT:
+ len += sprintf(data->sql + len, "intdata");
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ len += sprintf(data->sql + len, "bigdata");
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ len += sprintf(data->sql + len, "floatdata");
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ len += sprintf(data->sql + len, "doubledata");
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ len += sprintf(data->sql + len, "binarydata");
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ len += sprintf(data->sql + len, "ts");
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ len += sprintf(data->sql + len, "nchardata");
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ len += sprintf(data->sql + len, "utinydata");
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ len += sprintf(data->sql + len, "usmalldata");
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ len += sprintf(data->sql + len, "uintdata");
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ len += sprintf(data->sql + len, "ubigdata");
+ break;
+ default:
+ printf("!!!invalid col type:%d", data->pBind[c].buffer_type);
+ exit(1);
+ }
+ }
+
+ len += sprintf(data->sql + len, ") ");
+ }
+
+ len += sprintf(data->sql + len, "values (");
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ if (c) {
+ len += sprintf(data->sql + len, ",");
+ }
+ len += sprintf(data->sql + len, "?");
+ }
+ len += sprintf(data->sql + len, ")");
+
+ if (gCaseCtrl.printStmtSql) {
+ printf("\tSQL: %s\n", data->sql);
+ }
+}
+
+void bpAppendOperatorParam(BindData *data, int32_t *len, int32_t dataType, int32_t idx) {
+ OperInfo *pInfo = NULL;
+
+ if (gCaseCtrl.optrIdxListNum > 0) {
+ pInfo = &operInfo[gCaseCtrl.optrIdxList[idx]];
+ } else {
+ if (TSDB_DATA_TYPE_VARCHAR == dataType || TSDB_DATA_TYPE_NCHAR == dataType || TSDB_DATA_TYPE_GEOMETRY == dataType) {
+#if 1
+ pInfo = &operInfo[varoperatorList[rand() % tListLen(varoperatorList)]];
+#else
+ pInfo = &operInfo[11];
+#endif
+ } else {
+ pInfo = &operInfo[operatorList[rand() % tListLen(operatorList)]];
+ }
+ }
+
+ switch (pInfo->paramNum) {
+ case 2:
+ if (pInfo->enclose) {
+ *len += sprintf(data->sql + *len, " %s (?)", pInfo->oper);
+ } else {
+ *len += sprintf(data->sql + *len, " %s ?", pInfo->oper);
+ }
+ break;
+ default:
+ printf("!!!invalid operator paramNum:%d\n", pInfo->paramNum);
+ exit(1);
+ }
+}
+
+void bpAppendFunctionParam(BindData *data, int32_t *len, int32_t dataType, int32_t idx) {
+ FuncInfo *pInfo = NULL;
+
+ if (gCaseCtrl.funcIdxListNum > 0) {
+ pInfo = &funcInfo[gCaseCtrl.funcIdxList[idx]];
+ } else {
+ pInfo = &funcInfo[rand() % tListLen(funcInfo)];
+ }
+
+ switch (pInfo->paramNum) {
+ case 1:
+ *len += sprintf(data->sql + *len, " %s(?)", pInfo->funcName);
+ break;
+ default:
+ printf("!!!invalid function paramNum:%d\n", pInfo->paramNum);
+ exit(1);
+ }
+}
+
+int32_t bpAppendColumnName(BindData *data, int32_t type, int32_t len) {
+ switch (type) {
+ case TSDB_DATA_TYPE_BOOL:
+ return sprintf(data->sql + len, "booldata");
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ return sprintf(data->sql + len, "tinydata");
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ return sprintf(data->sql + len, "smalldata");
+ break;
+ case TSDB_DATA_TYPE_INT:
+ return sprintf(data->sql + len, "intdata");
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ return sprintf(data->sql + len, "bigdata");
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ return sprintf(data->sql + len, "floatdata");
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ return sprintf(data->sql + len, "doubledata");
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ return sprintf(data->sql + len, "binarydata");
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ return sprintf(data->sql + len, "ts");
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ return sprintf(data->sql + len, "nchardata");
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ return sprintf(data->sql + len, "utinydata");
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ return sprintf(data->sql + len, "usmalldata");
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ return sprintf(data->sql + len, "uintdata");
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ return sprintf(data->sql + len, "ubigdata");
+ break;
+ default:
+ printf("!!!invalid col type:%d", type);
+ exit(1);
+ }
+
+ return 0;
+}
+
+void generateQueryCondSQL(BindData *data, int32_t tblIdx) {
+ int32_t len = sprintf(data->sql, "select * from %s%d where ", bpTbPrefix, tblIdx);
+ if (!gCurCase->fullCol) {
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ if (c) {
+ len += sprintf(data->sql + len, " and ");
+ }
+ len += bpAppendColumnName(data, data->pBind[c].buffer_type, len);
+
+ bpAppendOperatorParam(data, &len, data->pBind[c].buffer_type, c);
+ }
+ }
+
+ if (gCaseCtrl.printStmtSql) {
+ printf("\tSTMT SQL: %s\n", data->sql);
+ }
+}
+
+void bpGenerateConstInOpSQL(BindData *data, int32_t tblIdx) {
+ int32_t len = 0;
+ len = sprintf(data->sql, "select ");
+
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ if (c) {
+ len += sprintf(data->sql + len, ", ");
+ }
+
+ len += bpAppendColumnName(data, data->pBind[c].buffer_type, len);
+
+ bpAppendOperatorParam(data, &len, data->pBind[c].buffer_type, c);
+ }
+
+ len += sprintf(data->sql + len, " from %s%d", bpTbPrefix, tblIdx);
+}
+
+void bpGenerateConstInFuncSQL(BindData *data, int32_t tblIdx) {
+ int32_t len = 0;
+ len = sprintf(data->sql, "select ");
+
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ if (c) {
+ len += sprintf(data->sql + len, ", ");
+ }
+
+ bpAppendFunctionParam(data, &len, data->pBind[c].buffer_type, c);
+ }
+
+ len += sprintf(data->sql + len, " from %s%d", bpTbPrefix, tblIdx);
+}
+
+void generateQueryMiscSQL(BindData *data, int32_t tblIdx) {
+ if (tblIdx == FUNCTION_TEST_IDX && gCurCase->bindNullNum <= 0) {
+ bpGenerateConstInFuncSQL(data, tblIdx);
+ } else {
+ switch (tblIdx) {
+ case 0:
+ // TODO FILL TEST
+ default:
+ bpGenerateConstInOpSQL(data, tblIdx);
+ break;
+ }
+ }
+
+ if (gCaseCtrl.printStmtSql) {
+ printf("\tSTMT SQL: %s\n", data->sql);
+ }
+}
+
+void generateErrorSQL(BindData *data, int32_t tblIdx) {
+ int32_t len = 0;
+ data->sql = taosMemoryCalloc(1, 1024);
+
+ switch (tblIdx) {
+ case 0:
+ len = sprintf(data->sql, "insert into %s%d values (?, 1)", bpTbPrefix, tblIdx);
+ break;
+ case 1:
+ len = sprintf(data->sql, "select * from ?");
+ break;
+ case 2:
+ len = sprintf(data->sql, "select * from %s%d where ? = ?", bpTbPrefix, tblIdx);
+ break;
+ default:
+ len = sprintf(data->sql, "select count(*) from %s%d group by ?", bpTbPrefix, tblIdx);
+ break;
+ }
+
+ if (gCaseCtrl.printStmtSql) {
+ printf("\tSTMT SQL: %s\n", data->sql);
+ }
+}
+
+void generateColDataType(bool isQuery, BindData *data, int32_t bindIdx, int32_t colIdx, int32_t *dataType) {
+ if (bindIdx < gCurCase->bindColNum) {
+ if (gCaseCtrl.bindColTypeNum) {
+ *dataType = gCaseCtrl.bindColTypeList[colIdx];
+ return;
+ } else if (gCurCase->fullCol) {
+ *dataType = gCurCase->colList[bindIdx];
+ return;
+ } else if (gCaseCtrl.numericParam) {
+ while (true) {
+ *dataType = rand() % (TSDB_DATA_TYPE_MAX - 1) + 1;
+ if (!IS_NUMERIC_TYPE(*dataType)) {
+ continue;
+ }
+
+ break;
+ }
+ return;
+ } else if (0 == colIdx && !isQuery) {
+ *dataType = TSDB_DATA_TYPE_TIMESTAMP;
+ return;
+ } else {
+ while (true) {
+#if 1
+ *dataType = rand() % (TSDB_DATA_TYPE_MAX - 1) + 1;
+#else
+ if (!colExists(data->pBind, TSDB_DATA_TYPE_NCHAR)) {
+ *dataType = TSDB_DATA_TYPE_NCHAR;
+ } else {
+ *dataType = rand() % (TSDB_DATA_TYPE_MAX - 1) + 1;
+ }
+#endif
+ if (*dataType == TSDB_DATA_TYPE_JSON || *dataType == TSDB_DATA_TYPE_DECIMAL ||
+ *dataType == TSDB_DATA_TYPE_BLOB || *dataType == TSDB_DATA_TYPE_MEDIUMBLOB ||
+ *dataType == TSDB_DATA_TYPE_VARBINARY || *dataType == TSDB_DATA_TYPE_GEOMETRY) {
+ continue;
+ }
+
+ if (colExists(data->pBind, *dataType)) {
+ continue;
+ }
+
+ break;
+ }
+ }
+ } else {
+ *dataType = data->pBind[bindIdx % gCurCase->bindColNum].buffer_type;
+ }
+}
+
+void generateTagDataType(BindData *data, int32_t bindIdx, int32_t colIdx, int32_t *dataType) {
+ if (bindIdx < gCurCase->bindTagNum) {
+ if (gCaseCtrl.bindTagTypeNum) {
+ *dataType = gCaseCtrl.bindTagTypeList[colIdx];
+ return;
+ } else if (gCurCase->fullCol) {
+ *dataType = gCurCase->colList[bindIdx];
+ return;
+ } else {
+ while (true) {
+ *dataType = rand() % (TSDB_DATA_TYPE_MAX - 1) + 1;
+ if (*dataType == TSDB_DATA_TYPE_JSON || *dataType == TSDB_DATA_TYPE_DECIMAL ||
+ *dataType == TSDB_DATA_TYPE_BLOB || *dataType == TSDB_DATA_TYPE_MEDIUMBLOB ||
+ *dataType == TSDB_DATA_TYPE_VARBINARY || *dataType == TSDB_DATA_TYPE_GEOMETRY) {
+ continue;
+ }
+
+ if (colExists(data->pTags, *dataType)) {
+ continue;
+ }
+
+ break;
+ }
+ }
+ } else {
+ *dataType = data->pTags[bindIdx % gCurCase->bindTagNum].buffer_type;
+ }
+}
+
+int32_t prepareColData(bool isQuery, BP_BIND_TYPE bType, BindData *data, int32_t bindIdx, int32_t rowIdx,
+ int32_t colIdx) {
+ int32_t dataType = TSDB_DATA_TYPE_TIMESTAMP;
+ TAOS_STMT2_BIND *pBase = NULL;
+
+ if (bType == BP_BIND_TAG) {
+ pBase = data->pTags;
+ generateTagDataType(data, bindIdx, colIdx, &dataType);
+ } else {
+ pBase = data->pBind;
+ generateColDataType(isQuery, data, bindIdx, colIdx, &dataType);
+ }
+
+ switch (dataType) {
+ case TSDB_DATA_TYPE_BOOL:
+ // pBase[bindIdx].buffer_length = sizeof(bool);
+ pBase[bindIdx].buffer = data->boolData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ // pBase[bindIdx].buffer_length = sizeof(int8_t);
+ pBase[bindIdx].buffer = data->tinyData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ // pBase[bindIdx].buffer_length = sizeof(int16_t);
+ pBase[bindIdx].buffer = data->smallData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_INT:
+ // pBase[bindIdx].buffer_length = sizeof(int32_t);
+ pBase[bindIdx].buffer = data->intData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ // pBase[bindIdx].buffer_length = sizeof(int64_t);
+ pBase[bindIdx].buffer = data->bigData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ // pBase[bindIdx].buffer_length = sizeof(float);
+ pBase[bindIdx].buffer = data->floatData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ // pBase[bindIdx].buffer_length = sizeof(double);
+ pBase[bindIdx].buffer = data->doubleData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_GEOMETRY:
+ // pBase[bindIdx].buffer_length = gVarCharSize;
+ // pBase[bindIdx].buffer = data->binaryData + rowIdx * gVarCharSize;
+ pBase[bindIdx].buffer = data->binaryData + rowIdx * gVarCharLen;
+ pBase[bindIdx].length = data->binaryLen;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ // pBase[bindIdx].buffer_length = sizeof(int64_t);
+ pBase[bindIdx].buffer = data->tsData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = NULL;
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ // pBase[bindIdx].buffer_length = gVarCharSize;
+ // pBase[bindIdx].buffer = data->binaryData + rowIdx * gVarCharSize;
+ pBase[bindIdx].buffer = data->binaryData + rowIdx * gVarCharLen;
+ pBase[bindIdx].length = data->binaryLen;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ // pBase[bindIdx].buffer_length = sizeof(uint8_t);
+ pBase[bindIdx].buffer = data->utinyData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ // pBase[bindIdx].buffer_length = sizeof(uint16_t);
+ pBase[bindIdx].buffer = data->usmallData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ // pBase[bindIdx].buffer_length = sizeof(uint32_t);
+ pBase[bindIdx].buffer = data->uintData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ // pBase[bindIdx].buffer_length = sizeof(uint64_t);
+ pBase[bindIdx].buffer = data->ubigData + rowIdx;
+ pBase[bindIdx].length = NULL;
+ pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL;
+ break;
+ default:
+ printf("!!!invalid col type:%d", dataType);
+ exit(1);
+ }
+
+ pBase[bindIdx].buffer_type = dataType;
+ pBase[bindIdx].num = gCurCase->bindRowNum;
+
+ if (bType == BP_BIND_TAG) {
+ pBase[bindIdx].num = 1;
+ }
+
+ return 0;
+}
+
+int32_t prepareInsertData(BindData *data) {
+ uint64_t allRowNum = gCurCase->rowNum * gCurCase->tblNum;
+
+ data->colNum = 0;
+ data->colTypes = taosMemoryCalloc(30, sizeof(int32_t));
+ data->sql = taosMemoryCalloc(1, 1024);
+ data->pBind =
+ taosMemoryCalloc((int32_t)(allRowNum / gCurCase->bindRowNum) * gCurCase->bindColNum, sizeof(TAOS_STMT2_BIND));
+ data->pTags = taosMemoryCalloc(gCurCase->tblNum * gCurCase->bindTagNum, sizeof(TAOS_STMT2_BIND));
+ data->tsData = taosMemoryMalloc(allRowNum * sizeof(int64_t));
+ data->boolData = taosMemoryMalloc(allRowNum * sizeof(bool));
+ data->tinyData = taosMemoryMalloc(allRowNum * sizeof(int8_t));
+ data->utinyData = taosMemoryMalloc(allRowNum * sizeof(uint8_t));
+ data->smallData = taosMemoryMalloc(allRowNum * sizeof(int16_t));
+ data->usmallData = taosMemoryMalloc(allRowNum * sizeof(uint16_t));
+ data->intData = taosMemoryMalloc(allRowNum * sizeof(int32_t));
+ data->uintData = taosMemoryMalloc(allRowNum * sizeof(uint32_t));
+ data->bigData = taosMemoryMalloc(allRowNum * sizeof(int64_t));
+ data->ubigData = taosMemoryMalloc(allRowNum * sizeof(uint64_t));
+ data->floatData = taosMemoryMalloc(allRowNum * sizeof(float));
+ data->doubleData = taosMemoryMalloc(allRowNum * sizeof(double));
+ data->binaryData = taosMemoryMalloc(allRowNum * gVarCharSize);
+ data->binaryLen = taosMemoryMalloc(allRowNum * sizeof(int32_t));
+ if (gCurCase->bindNullNum) {
+ data->isNull = taosMemoryCalloc((int32_t)allRowNum, sizeof(char));
+ }
+
+ for (int32_t i = 0; i < allRowNum; ++i) {
+ if (gCurCase->duplicateValue) {
+ data->tsData[i] = bpTs;
+ if (i % 2 == 1) {
+ bpTs++;
+ }
+ } else {
+ data->tsData[i] = bpTs++;
+ }
+ data->boolData[i] = (bool)(i % 2);
+ data->tinyData[i] = (int8_t)i;
+ data->utinyData[i] = (uint8_t)(i + 1);
+ data->smallData[i] = (int16_t)i;
+ data->usmallData[i] = (uint16_t)(i + 1);
+ data->intData[i] = (int32_t)i;
+ data->uintData[i] = (uint32_t)(i + 1);
+ data->bigData[i] = (int64_t)i;
+ data->ubigData[i] = (uint64_t)(i + 1);
+ data->floatData[i] = (float)i;
+ data->doubleData[i] = (double)(i + 1);
+ // memset(data->binaryData + gVarCharSize * i, 'a' + i % 26, gVarCharLen);
+ memset(data->binaryData + gVarCharLen * i, 'a' + i % 26, gVarCharLen);
+ if (gCurCase->bindNullNum) {
+ data->isNull[i] = (char)(i % 2);
+ }
+ data->binaryLen[i] = gVarCharLen;
+ }
+
+ for (int b = 0; b < (allRowNum / gCurCase->bindRowNum); b++) {
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ prepareColData(false, BP_BIND_COL, data, b * gCurCase->bindColNum + c, b * gCurCase->bindRowNum, c);
+ }
+ }
+
+ for (int b = 0; b < gCurCase->tblNum; b++) {
+ for (int c = 0; c < gCurCase->bindTagNum; ++c) {
+ prepareColData(false, BP_BIND_TAG, data, b * gCurCase->bindTagNum + c, b, c);
+ }
+ }
+
+ generateInsertSQL(data);
+
+ return 0;
+}
+
+int32_t prepareQueryCondData(BindData *data, int32_t tblIdx) {
+ uint64_t bindNum = gCurCase->rowNum / gCurCase->bindRowNum;
+
+ data->colNum = 0;
+ data->colTypes = taosMemoryCalloc(30, sizeof(int32_t));
+ data->sql = taosMemoryCalloc(1, 1024);
+ data->pBind = taosMemoryCalloc((int32_t)bindNum * gCurCase->bindColNum, sizeof(TAOS_STMT2_BIND));
+ data->tsData = taosMemoryMalloc(bindNum * sizeof(int64_t));
+ data->boolData = taosMemoryMalloc(bindNum * sizeof(bool));
+ data->tinyData = taosMemoryMalloc(bindNum * sizeof(int8_t));
+ data->utinyData = taosMemoryMalloc(bindNum * sizeof(uint8_t));
+ data->smallData = taosMemoryMalloc(bindNum * sizeof(int16_t));
+ data->usmallData = taosMemoryMalloc(bindNum * sizeof(uint16_t));
+ data->intData = taosMemoryMalloc(bindNum * sizeof(int32_t));
+ data->uintData = taosMemoryMalloc(bindNum * sizeof(uint32_t));
+ data->bigData = taosMemoryMalloc(bindNum * sizeof(int64_t));
+ data->ubigData = taosMemoryMalloc(bindNum * sizeof(uint64_t));
+ data->floatData = taosMemoryMalloc(bindNum * sizeof(float));
+ data->doubleData = taosMemoryMalloc(bindNum * sizeof(double));
+ data->binaryData = taosMemoryMalloc(bindNum * gVarCharSize);
+ data->binaryLen = taosMemoryMalloc(bindNum * sizeof(int32_t));
+ if (gCurCase->bindNullNum) {
+ data->isNull = taosMemoryCalloc((int32_t)bindNum, sizeof(char));
+ }
+
+ for (int32_t i = 0; i < bindNum; ++i) {
+ data->tsData[i] = bpTs + tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum;
+ data->boolData[i] = (bool)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->tinyData[i] = (int8_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->utinyData[i] = (uint8_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->smallData[i] = (int16_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->usmallData[i] = (uint16_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->intData[i] = (int32_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->uintData[i] = (uint32_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->bigData[i] = (int64_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->ubigData[i] = (uint64_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->floatData[i] = (float)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->doubleData[i] = (double)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ // memset(data->binaryData + gVarCharSize * i, 'a' + i % 26, gVarCharLen);
+ memset(data->binaryData + gVarCharLen * i, 'a' + i % 26, gVarCharLen);
+ if (gCurCase->bindNullNum) {
+ data->isNull[i] = (char)(i % 2);
+ }
+ data->binaryLen[i] = gVarCharLen;
+ }
+
+ for (int b = 0; b < bindNum; b++) {
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ prepareColData(true, BP_BIND_COL, data, b * gCurCase->bindColNum + c, b * gCurCase->bindRowNum, c);
+ }
+ }
+
+ generateQueryCondSQL(data, tblIdx);
+
+ return 0;
+}
+
+int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) {
+ uint64_t bindNum = gCurCase->rowNum / gCurCase->bindRowNum;
+
+ data->colNum = 0;
+ data->colTypes = taosMemoryCalloc(30, sizeof(int32_t));
+ data->sql = taosMemoryCalloc(1, 1024);
+ data->pBind = taosMemoryCalloc((int32_t)bindNum * gCurCase->bindColNum, sizeof(TAOS_STMT2_BIND));
+ data->tsData = taosMemoryMalloc(bindNum * sizeof(int64_t));
+ data->boolData = taosMemoryMalloc(bindNum * sizeof(bool));
+ data->tinyData = taosMemoryMalloc(bindNum * sizeof(int8_t));
+ data->utinyData = taosMemoryMalloc(bindNum * sizeof(uint8_t));
+ data->smallData = taosMemoryMalloc(bindNum * sizeof(int16_t));
+ data->usmallData = taosMemoryMalloc(bindNum * sizeof(uint16_t));
+ data->intData = taosMemoryMalloc(bindNum * sizeof(int32_t));
+ data->uintData = taosMemoryMalloc(bindNum * sizeof(uint32_t));
+ data->bigData = taosMemoryMalloc(bindNum * sizeof(int64_t));
+ data->ubigData = taosMemoryMalloc(bindNum * sizeof(uint64_t));
+ data->floatData = taosMemoryMalloc(bindNum * sizeof(float));
+ data->doubleData = taosMemoryMalloc(bindNum * sizeof(double));
+ data->binaryData = taosMemoryMalloc(bindNum * gVarCharSize);
+ data->binaryLen = taosMemoryMalloc(bindNum * sizeof(int32_t));
+ if (gCurCase->bindNullNum) {
+ data->isNull = taosMemoryCalloc((int32_t)bindNum, sizeof(char));
+ }
+
+ for (int32_t i = 0; i < bindNum; ++i) {
+ data->tsData[i] = bpTs + tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum;
+ data->boolData[i] = (bool)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->tinyData[i] = (int8_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->utinyData[i] = (uint8_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->smallData[i] = (int16_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->usmallData[i] = (uint16_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->intData[i] = (int32_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->uintData[i] = (uint32_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->bigData[i] = (int64_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->ubigData[i] = (uint64_t)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->floatData[i] = (float)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ data->doubleData[i] = (double)(tblIdx * gCurCase->rowNum + rand() % gCurCase->rowNum);
+ // memset(data->binaryData + gVarCharSize * i, 'a' + i % 26, gVarCharLen);
+ memset(data->binaryData + gVarCharLen * i, 'a' + i % 26, gVarCharLen);
+ if (gCurCase->bindNullNum) {
+ data->isNull[i] = (char)(i % 2);
+ }
+ data->binaryLen[i] = gVarCharLen;
+ }
+
+ if (tblIdx == FUNCTION_TEST_IDX) {
+ gCaseCtrl.numericParam = true;
+ } else {
+ gCaseCtrl.numericParam = false;
+ }
+
+ for (int b = 0; b < bindNum; b++) {
+ for (int c = 0; c < gCurCase->bindColNum; ++c) {
+ prepareColData(true, BP_BIND_COL, data, b * gCurCase->bindColNum + c, b * gCurCase->bindRowNum, c);
+ }
+ }
+
+ gCaseCtrl.numericParam = false;
+
+ generateQueryMiscSQL(data, tblIdx);
+
+ return 0;
+}
+
+void destroyData(BindData *data) {
+ taosMemoryFree(data->tsData);
+ taosMemoryFree(data->boolData);
+ taosMemoryFree(data->tinyData);
+ taosMemoryFree(data->utinyData);
+ taosMemoryFree(data->smallData);
+ taosMemoryFree(data->usmallData);
+ taosMemoryFree(data->intData);
+ taosMemoryFree(data->uintData);
+ taosMemoryFree(data->bigData);
+ taosMemoryFree(data->ubigData);
+ taosMemoryFree(data->floatData);
+ taosMemoryFree(data->doubleData);
+ taosMemoryFree(data->binaryData);
+ taosMemoryFree(data->binaryLen);
+ taosMemoryFree(data->isNull);
+ taosMemoryFree(data->pBind);
+ taosMemoryFree(data->pTags);
+ taosMemoryFree(data->colTypes);
+ taosMemoryFree(data->sql);
+}
+
+void bpFetchRows(TAOS_RES *result, bool printr, int32_t *rows) {
+ TAOS_ROW row;
+ int num_fields = taos_num_fields(result);
+ TAOS_FIELD *fields = taos_fetch_fields(result);
+ char temp[256];
+
+ // fetch the records row by row
+ while ((row = taos_fetch_row(result))) {
+ (*rows)++;
+ if (printr) {
+ memset(temp, 0, sizeof(temp));
+ taos_print_row(temp, row, fields, num_fields);
+ printf("\t[%s]\n", temp);
+ }
+ }
+}
+
+void bpExecQuery(TAOS *taos, char *sql, bool printr, int32_t *rows) {
+ TAOS_RES *result = taos_query(taos, sql);
+ int code = taos_errno(result);
+ if (code != 0) {
+ printf("!!!failed to query table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+
+ bpFetchRows(result, printr, rows);
+
+ taos_free_result(result);
+}
+
+int32_t bpAppendValueString(char *buf, int type, void *value, int32_t valueLen, int32_t *len) {
+ switch (type) {
+ case TSDB_DATA_TYPE_NULL:
+ *len += sprintf(buf + *len, "null");
+ break;
+
+ case TSDB_DATA_TYPE_BOOL:
+ *len += sprintf(buf + *len, (*(bool *)value) ? "true" : "false");
+ break;
+
+ case TSDB_DATA_TYPE_TINYINT:
+ *len += sprintf(buf + *len, "%d", *(int8_t *)value);
+ break;
+
+ case TSDB_DATA_TYPE_SMALLINT:
+ *len += sprintf(buf + *len, "%d", *(int16_t *)value);
+ break;
+
+ case TSDB_DATA_TYPE_INT:
+ *len += sprintf(buf + *len, "%d", *(int32_t *)value);
+ break;
+
+ case TSDB_DATA_TYPE_BIGINT:
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ *len += sprintf(buf + *len, "%ld", *(int64_t *)value);
+ break;
+
+ case TSDB_DATA_TYPE_FLOAT:
+ *len += sprintf(buf + *len, "%e", *(float *)value);
+ break;
+
+ case TSDB_DATA_TYPE_DOUBLE:
+ *len += sprintf(buf + *len, "%e", *(double *)value);
+ break;
+
+ case TSDB_DATA_TYPE_BINARY:
+ case TSDB_DATA_TYPE_VARBINARY:
+ case TSDB_DATA_TYPE_NCHAR:
+ case TSDB_DATA_TYPE_GEOMETRY:
+ buf[*len] = '\'';
+ ++(*len);
+ memcpy(buf + *len, value, valueLen);
+ *len += valueLen;
+ buf[*len] = '\'';
+ ++(*len);
+ break;
+
+ case TSDB_DATA_TYPE_UTINYINT:
+ *len += sprintf(buf + *len, "%d", *(uint8_t *)value);
+ break;
+
+ case TSDB_DATA_TYPE_USMALLINT:
+ *len += sprintf(buf + *len, "%d", *(uint16_t *)value);
+ break;
+
+ case TSDB_DATA_TYPE_UINT:
+ *len += sprintf(buf + *len, "%u", *(uint32_t *)value);
+ break;
+
+ case TSDB_DATA_TYPE_UBIGINT:
+ *len += sprintf(buf + *len, "%lu", *(uint64_t *)value);
+ break;
+
+ default:
+ printf("!!!invalid data type:%d\n", type);
+ exit(1);
+ }
+}
+
+static TAOS_STMT2 *st_stmt2_init(TAOS *taos, bool stb_insert) {
+ TAOS_STMT2_OPTION option = {0};
+ if (stb_insert) {
+ option.singleStbInsert = true;
+ option.singleTableBindOnce = true;
+ }
+
+ return taos_stmt2_init(taos, &option);
+}
+
+static int st_stmt2_close(TAOS_STMT2 *stmt) { return taos_stmt2_close(stmt); }
+
+static char *st_stmt2_error(TAOS_STMT2 *stmt) { return taos_stmt2_error(stmt); }
+
+static int st_stmt2_prepare(TAOS_STMT2 *stmt, const char *sql, unsigned long length) {
+ return taos_stmt2_prepare(stmt, sql, length);
+}
+
+static int st_stmt2_bind(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx) {
+ return taos_stmt2_bind_param(stmt, bindv, col_idx);
+}
+
+static int st_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows) { return taos_stmt2_exec(stmt, affected_rows); }
+
+static int st_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert) { return taos_stmt2_is_insert(stmt, insert); }
+
+static int st_stmt2_num_params(TAOS_STMT2 *stmt, int *count) {
+ return taos_stmt2_get_fields(stmt, TAOS_FIELD_QUERY, count, NULL);
+}
+
+static int st_stmt2_get_tag_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_E **fields) {
+ return taos_stmt2_get_fields(stmt, TAOS_FIELD_TAG, count, fields);
+}
+
+static int st_stmt2_get_col_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_E **fields) {
+ return taos_stmt2_get_fields(stmt, TAOS_FIELD_COL, count, fields);
+}
+
+static int st_stmt2_get_param(TAOS_STMT2 *stmt, int idx, int *type, int *bytes) {
+ int32_t code = 0, nums = 0;
+ TAOS_FIELD_E *fields = NULL;
+
+ code = taos_stmt2_get_fields(stmt, TAOS_FIELD_COL, &nums, &fields);
+ if (code) {
+ return code;
+ }
+
+ if (idx > nums) {
+ taosMemoryFree(fields);
+ return -1;
+ }
+
+ *type = fields[idx].type;
+ *bytes = fields[idx].bytes;
+
+ taosMemoryFree(fields);
+ return 0;
+}
+
+static int st_stmt2_set_tbname(TAOS_STMT2 *stmt, char *name) {
+ TAOS_STMT2_BINDV bindv = {0};
+ bindv.count = 1;
+ bindv.tbnames = &name;
+ return taos_stmt2_bind_param(stmt, &bindv, -1);
+}
+
+static int st_stmt2_set_tags(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *tags) {
+ TAOS_STMT2_BINDV bindv = {0};
+ bindv.count = 1;
+ bindv.tags = &tags;
+ return taos_stmt2_bind_param(stmt, &bindv, -1);
+}
+
+static int st_stmt2_set_tbname_tags(TAOS_STMT2 *stmt, char *name, TAOS_STMT2_BIND *tags) {
+ TAOS_STMT2_BINDV bindv = {0};
+ bindv.count = 1;
+ bindv.tbnames = &name;
+ bindv.tags = &tags;
+ return taos_stmt2_bind_param(stmt, &bindv, -1);
+}
+
+static int st_stmt2_bind_param_batch(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind) {
+ TAOS_STMT2_BINDV bindv = {0};
+ bindv.count = 1;
+ bindv.bind_cols = &bind;
+ return taos_stmt2_bind_param(stmt, &bindv, -1);
+}
+
+static int st_stmt2_bind_single_param_batch(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind, int col_idx) {
+ TAOS_STMT2_BINDV bindv = {0};
+ bindv.count = 1;
+ bindv.bind_cols = &bind;
+ return taos_stmt2_bind_param(stmt, &bindv, col_idx);
+}
+
+static int st_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind) {
+ TAOS_STMT2_BINDV bindv = {0};
+ bindv.count = 1;
+ bindv.bind_cols = &bind;
+ return taos_stmt2_bind_param(stmt, &bindv, -1);
+}
+
+static int st_stmt2_add_batch(TAOS_STMT2 *stmt) { return 0; }
+
+static TAOS_RES *st_stmt2_use_result(TAOS_STMT2 *stmt) { return taos_stmt2_result(stmt); }
+
+void bpCheckIsInsert(TAOS_STMT2 *stmt, int32_t insert) {
+ int32_t isInsert = 0;
+ if (st_stmt2_is_insert(stmt, &isInsert)) {
+ printf("!!!st_stmt2_is_insert error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (insert != isInsert) {
+ printf("!!!is insert failed\n");
+ exit(1);
+ }
+}
+
+void bpCheckParamNum(TAOS_STMT2 *stmt) {
+ int32_t num = 0;
+ if (st_stmt2_num_params(stmt, &num)) {
+ printf("!!!st_stmt2_num_params error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (gCurCase->bindColNum != num) {
+ printf("!!!is insert failed\n");
+ exit(1);
+ }
+}
+
+void bpCheckAffectedRows(TAOS_STMT2 *stmt, int32_t times) {
+ /* TODO: affected rows from exec
+ int32_t rows = taos_stmt_affected_rows(stmt);
+ int32_t insertNum = gCurCase->rowNum * gCurCase->tblNum * times;
+ if (gCurCase->duplicateValue) {
+ insertNum /= 2;
+ }
+ if (insertNum != rows) {
+ printf("!!!affected rows %d mis-match with insert num %d\n", rows, insertNum);
+ exit(1);
+ }
+ */
+}
+
+void bpCheckQueryResult(TAOS_STMT2 *stmt, TAOS *taos, char *stmtSql, TAOS_STMT2_BIND *bind) {
+ // query using sql
+ char sql[1024];
+ int32_t len = 0;
+ char *p = stmtSql;
+ char *s = NULL;
+ int32_t sqlResNum = 0;
+
+ for (int32_t i = 0; true; ++i, p = s + 1) {
+ s = strchr(p, '?');
+ if (NULL == s) {
+ strcpy(&sql[len], p);
+ break;
+ }
+
+ memcpy(&sql[len], p, (int64_t)s - (int64_t)p);
+ len += (int32_t)((int64_t)s - (int64_t)p);
+
+ if (bind[i].is_null && bind[i].is_null[0]) {
+ bpAppendValueString(sql, TSDB_DATA_TYPE_NULL, NULL, 0, &len);
+ continue;
+ }
+
+ bpAppendValueString(sql, bind[i].buffer_type, bind[i].buffer, (bind[i].length ? bind[i].length[0] : 0), &len);
+ }
+
+ if (gCaseCtrl.printQuerySql) {
+ printf("\tQuery SQL: %s\n", sql);
+ }
+
+ bpExecQuery(taos, sql, gCaseCtrl.printRes, &sqlResNum);
+
+ // query using stmt
+ TAOS_RES *res = st_stmt2_use_result(stmt);
+ int32_t stmtResNum = 0;
+ bpFetchRows(res, gCaseCtrl.printRes, &stmtResNum);
+
+ if (sqlResNum != stmtResNum) {
+ printf("!!!sql res num %d mis-match stmt res num %d\n", sqlResNum, stmtResNum);
+ exit(1);
+ }
+
+ printf("***sql res num match stmt res num %d\n", stmtResNum);
+}
+
+void bpCheckColTagFields(TAOS_STMT2 *stmt, int32_t fieldNum, TAOS_FIELD_E *pFields, int32_t expecteNum,
+ TAOS_STMT2_BIND *pBind, BP_BIND_TYPE type) {
+ int32_t code = 0;
+
+ if (fieldNum != expecteNum) {
+ printf("!!!%s field num %d mis-match expect num %d\n", BP_BIND_TYPE_STR(type), fieldNum, expecteNum);
+ exit(1);
+ }
+
+ if (type == BP_BIND_COL) {
+ if (pFields[0].precision != gCaseCtrl.precision) {
+ printf("!!!db precision %d mis-match expect %d\n", pFields[0].precision, gCaseCtrl.precision);
+ exit(1);
+ }
+ }
+
+ for (int32_t i = 0; i < fieldNum; ++i) {
+ if (pFields[i].type != pBind[i].buffer_type) {
+ printf("!!!%s %dth field type %d mis-match expect type %d\n", BP_BIND_TYPE_STR(type), i, pFields[i].type,
+ pBind[i].buffer_type);
+ exit(1);
+ }
+
+ 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);
+ }
+ */
+ } else if (pFields[i].type == TSDB_DATA_TYPE_NCHAR) {
+ /*
+ if (pFields[i].bytes != (pBind[i].buffer_length * 4 + 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);
+ }
+ */
+ /*} else if (pFields[i].bytes != pBind[i].buffer_length) {
+ 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);
+ exit(1);*/
+ }
+ }
+
+ if (type == BP_BIND_COL) {
+ int fieldType = 0;
+ int fieldBytes = 0;
+ for (int32_t i = 0; i < fieldNum; ++i) {
+ code = st_stmt2_get_param(stmt, i, &fieldType, &fieldBytes);
+ if (code) {
+ printf("!!!st_stmt2_get_param error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (pFields[i].type != fieldType) {
+ printf("!!!%s %dth field type %d mis-match expect type %d\n", BP_BIND_TYPE_STR(type), i, fieldType,
+ pFields[i].type);
+ exit(1);
+ }
+
+ if (pFields[i].bytes != fieldBytes) {
+ printf("!!!%s %dth field len %d mis-match expect len %d\n", BP_BIND_TYPE_STR(type), i, fieldBytes,
+ pFields[i].bytes);
+ exit(1);
+ }
+ }
+ }
+
+ if (gCaseCtrl.printVerbose) {
+ printf("%s fields check passed\n", BP_BIND_TYPE_STR(type));
+ }
+}
+
+void bpCheckTagFields(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *pBind) {
+ int32_t code = 0;
+ int fieldNum = 0;
+ TAOS_FIELD_E *pFields = NULL;
+ code = st_stmt2_get_tag_fields(stmt, &fieldNum, &pFields);
+ if (code != 0) {
+ printf("!!!st_stmt2_get_tag_fields error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckColTagFields(stmt, fieldNum, pFields, gCurCase->bindTagNum, pBind, BP_BIND_TAG);
+ taosMemoryFree(pFields);
+}
+
+void bpCheckColFields(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *pBind) {
+ if (gCurCase->testType == TTYPE_QUERY) {
+ return;
+ }
+
+ int32_t code = 0;
+ int fieldNum = 0;
+ TAOS_FIELD_E *pFields = NULL;
+ code = st_stmt2_get_col_fields(stmt, &fieldNum, &pFields);
+ if (code != 0) {
+ printf("!!!st_stmt2_get_col_fields error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckColTagFields(stmt, fieldNum, pFields, gCurCase->bindColNum, pBind, BP_BIND_COL);
+ taosMemoryFree(pFields);
+}
+
+void bpShowBindParam(TAOS_STMT2_BIND *bind, int32_t num) {
+ for (int32_t i = 0; i < num; ++i) {
+ TAOS_STMT2_BIND *b = &bind[i];
+ printf("Bind %d: type[%d],buf[%p],len[%d],null[%d],num[%d]\n", i, b->buffer_type, b->buffer,
+ /*b->buffer_length,*/ b->length ? *b->length : 0, b->is_null ? *b->is_null : 0, b->num);
+ }
+}
+
+int32_t bpBindParam(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind, bool expectFail) {
+ static int32_t n = 0;
+
+ if (!expectFail) {
+ bpCheckColFields(stmt, bind);
+ }
+
+ if (gCurCase->bindRowNum > 1) {
+ if (0 == (n++ % 2) || gCurCase->stbInsert) {
+ if (st_stmt2_bind_param_batch(stmt, bind)) {
+ if (expectFail) return 0;
+ printf("!!!st_stmt2_bind_param_batch error:%s\n", st_stmt2_error(stmt));
+ bpShowBindParam(bind, gCurCase->bindColNum);
+ exit(1);
+ }
+ } else {
+ for (int32_t i = 0; i < gCurCase->bindColNum; ++i) {
+ if (st_stmt2_bind_single_param_batch(stmt, bind + i, i)) {
+ if (expectFail) continue;
+ printf("!!!st_stmt2_bind_single_param_batch %d error:%s\n", i, st_stmt2_error(stmt));
+ bpShowBindParam(bind, gCurCase->bindColNum);
+ exit(1);
+ }
+ }
+ }
+ } else {
+ if (0 == (n++ % 2)) {
+ if (st_stmt2_bind_param_batch(stmt, bind)) {
+ if (expectFail) return 0;
+ printf("!!!st_stmt2_bind_param_batch error:%s\n", st_stmt2_error(stmt));
+ bpShowBindParam(bind, gCurCase->bindColNum);
+ exit(1);
+ }
+ } else {
+ if (st_stmt2_bind_param(stmt, bind)) {
+ if (expectFail) return 0;
+ printf("!!!st_stmt2_bind_param error:%s\n", st_stmt2_error(stmt));
+ bpShowBindParam(bind, gCurCase->bindColNum);
+ exit(1);
+ }
+ }
+ }
+
+ return 0;
+}
+
+int32_t bpSetTableNameTags(BindData *data, int32_t tblIdx, char *tblName, TAOS_STMT2 *stmt) {
+ int32_t code = 0;
+ if (gCurCase->bindTagNum > 0) {
+ if ((rand() % 2) == 0) {
+ code = st_stmt2_set_tbname(stmt, tblName);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckTagFields(stmt, data->pTags + tblIdx * gCurCase->bindTagNum);
+
+ return st_stmt2_set_tags(stmt, data->pTags + tblIdx * gCurCase->bindTagNum);
+ } else {
+ return st_stmt2_set_tbname_tags(stmt, tblName, data->pTags + tblIdx * gCurCase->bindTagNum);
+ }
+ } else {
+ return st_stmt2_set_tbname(stmt, tblName);
+ }
+}
+
+/* prepare [settbname [bind add]] exec */
+int insertMBSETest1(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+ bpCheckAffectedRows(stmt, 1);
+
+ destroyData(&data);
+
+ return 0;
+}
+
+/* prepare [settbname bind add] exec */
+int insertMBSETest2(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+ bpCheckAffectedRows(stmt, 1);
+
+ destroyData(&data);
+
+ return 0;
+}
+
+/* prepare [settbname [bind add] exec] */
+int insertMBMETest1(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+ bpCheckAffectedRows(stmt, 1);
+
+ destroyData(&data);
+
+ return 0;
+}
+
+/* prepare [settbname [bind add exec]] */
+int insertMBMETest2(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+ bpCheckAffectedRows(stmt, 1);
+
+ destroyData(&data);
+
+ return 0;
+}
+
+/* prepare [settbname [settbname bind add exec]] */
+int insertMBMETest3(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+ bpCheckAffectedRows(stmt, 1);
+
+ destroyData(&data);
+
+ return 0;
+}
+
+/* prepare [settbname bind add exec] */
+int insertMBMETest4(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+ bpCheckAffectedRows(stmt, 1);
+
+ destroyData(&data);
+
+ return 0;
+}
+
+/* [prepare [settbname [bind add] exec]] */
+int insertMPMETest1(TAOS_STMT2 *stmt, TAOS *taos) {
+ int32_t loop = 0;
+
+ while (gCurCase->bindColNum >= 2) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ destroyData(&data);
+
+ gCurCase->bindColNum -= 2;
+ gCurCase->fullCol = false;
+ loop++;
+ }
+
+ bpCheckAffectedRows(stmt, loop);
+
+ gExecLoopTimes = loop;
+
+ return 0;
+}
+
+/* prepare [settbname [bind] exec] */
+int insertStbTest(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ destroyData(&data);
+
+ bpCheckAffectedRows(stmt, 1);
+
+ return 0;
+}
+
+/* [prepare [settbnametag [bind add] exec]] */
+int insertAUTOTest1(TAOS_STMT2 *stmt, TAOS *taos) {
+ int32_t loop = 0;
+
+ while (gCurCase->bindTagNum > 0 && gCurCase->bindColNum > 0) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname_tags error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ destroyData(&data);
+
+ gCurCase->bindColNum -= 2;
+ gCurCase->bindTagNum -= 2;
+ gCurCase->fullCol = false;
+ loop++;
+ }
+
+ bpCheckAffectedRows(stmt, loop);
+
+ gExecLoopTimes = loop;
+
+ return 0;
+}
+
+/* [prepare [settbnametag [bind add exec]]] */
+int insertAUTOTest2(TAOS_STMT2 *stmt, TAOS *taos) {
+ int32_t loop = 0;
+
+ while (gCurCase->bindTagNum > 0 && gCurCase->bindColNum > 0) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ char buf[32];
+ sprintf(buf, "t%d", t);
+ code = bpSetTableNameTags(&data, t, buf, stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname_tags error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ destroyData(&data);
+
+ gCurCase->bindColNum -= 2;
+ gCurCase->bindTagNum -= 2;
+ gCurCase->fullCol = false;
+ loop++;
+ }
+
+ bpCheckAffectedRows(stmt, loop);
+
+ gExecLoopTimes = loop;
+
+ return 0;
+}
+
+/* normal table [prepare [bind add exec]] */
+int insertAUTOTest3(TAOS_STMT2 *stmt, TAOS *taos) {
+ int32_t loop = 0;
+
+ while (gCurCase->bindColNum > 0) {
+ BindData data = {0};
+ data.singleTbInsert = true;
+ prepareInsertData(&data);
+
+ int32_t bindTimes = gCurCase->rowNum / gCurCase->bindRowNum;
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ data.singleTbIdx = t;
+ generateInsertSQL(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ for (int32_t b = 0; b < bindTimes; ++b) {
+ bpCheckIsInsert(stmt, 1);
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ if (bpBindParam(stmt, data.pBind + t * bindTimes * gCurCase->bindColNum + b * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ destroyData(&data);
+
+ gCurCase->bindColNum -= 2;
+ gCurCase->fullCol = false;
+ loop++;
+ }
+
+ bpCheckAffectedRows(stmt, loop);
+
+ gExecLoopTimes = loop;
+
+ return 0;
+}
+
+/* select * from table */
+int queryColumnTest(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ memset(&data, 0, sizeof(data));
+ prepareQueryCondData(&data, t);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ for (int32_t n = 0; n < (gCurCase->rowNum / gCurCase->bindRowNum); ++n) {
+ bpCheckIsInsert(stmt, 0);
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ if (bpBindParam(stmt, data.pBind + n * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (rand() % 2 == 0) {
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckQueryResult(stmt, taos, data.sql, data.pBind + n * gCurCase->bindColNum);
+ }
+
+ bpCheckIsInsert(stmt, 0);
+
+ destroyData(&data);
+ }
+
+ return 0;
+}
+
+/* value in query sql */
+int queryMiscTest(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ memset(&data, 0, sizeof(data));
+ prepareQueryMiscData(&data, t);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ for (int32_t n = 0; n < (gCurCase->rowNum / gCurCase->bindRowNum); ++n) {
+ bpCheckIsInsert(stmt, 0);
+
+ if (gCaseCtrl.checkParamNum) {
+ bpCheckParamNum(stmt);
+ }
+
+ if (bpBindParam(stmt, data.pBind + n * gCurCase->bindColNum, false)) {
+ exit(1);
+ }
+
+ if (rand() % 2 == 0) {
+ if (st_stmt2_add_batch(stmt)) {
+ printf("!!!st_stmt2_add_batch error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+ }
+
+ if (st_stmt2_exec(stmt, NULL) != 0) {
+ printf("!!!st_stmt2_exec error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckQueryResult(stmt, taos, data.sql, data.pBind + n * gCurCase->bindColNum);
+ }
+
+ bpCheckIsInsert(stmt, 0);
+
+ destroyData(&data);
+ }
+
+ return 0;
+}
+
+int insertNonExistsTb(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ char *buf = "tbnexist";
+ code = bpSetTableNameTags(&data, 0, buf, stmt);
+ if (code == 0) {
+ printf("!!!st_stmt2_set_tbname expected error not occurred\n");
+ exit(1);
+ }
+
+ if (0 == st_stmt2_bind_param_batch(stmt, data.pBind)) {
+ printf("!!!st_stmt2_bind_param_batch expected error not occurred\n");
+ exit(1);
+ }
+
+ if (0 == st_stmt2_exec(stmt, NULL)) {
+ printf("!!!st_stmt2_execute expected error not occurred\n");
+ exit(1);
+ }
+
+ destroyData(&data);
+
+ return 0;
+}
+
+void bpAddWrongVarBuffLen(TAOS_STMT2_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_VARBINARY ||
+ pBind[i].buffer_type == TSDB_DATA_TYPE_NCHAR) {
+ *pBind[i].length += 100;
+ }
+ }
+}
+
+int insertVarLenErr(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("!!!failed to execute st_stmt2_prepare. error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ code = bpSetTableNameTags(&data, 0, "t0", stmt);
+ if (code != 0) {
+ printf("!!!st_stmt2_set_tbname error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ bpAddWrongVarBuffLen(data.pBind);
+
+ if (bpBindParam(stmt, data.pBind, true)) {
+ exit(1);
+ }
+
+ destroyData(&data);
+
+ return 0;
+}
+
+int errorSQLTest1(TAOS_STMT2 *stmt, TAOS *taos) {
+ BindData data = {0};
+
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ memset(&data, 0, sizeof(data));
+ generateErrorSQL(&data, t);
+
+ int code = st_stmt2_prepare(stmt, data.sql, 0);
+ if (code != 0) {
+ printf("*st_stmt2_prepare error as expected, error:%s\n", st_stmt2_error(stmt));
+ } else {
+ printf("!!!st_stmt2_prepare succeed, which should be error\n");
+ exit(1);
+ }
+
+ destroyData(&data);
+ }
+
+ return 0;
+}
+
+void prepareCheckResultImpl(TAOS *taos, char *tname, bool printr, int expected, bool silent) {
+ if (TTYPE_INSERT_NG == gCurCase->testType) {
+ return;
+ }
+
+ char sql[255] = "SELECT * FROM ";
+ int32_t rows = 0;
+
+ strcat(sql, tname);
+ bpExecQuery(taos, sql, printr, &rows);
+
+ if (rows == expected) {
+ if (!silent) {
+ printf("***%d rows are fetched as expected from %s\n", rows, tname);
+ }
+ } else {
+ printf("!!!expect rows %d mis-match rows %d fetched from %s\n", expected, rows, tname);
+ exit(1);
+ }
+}
+
+void prepareCheckResult(TAOS *taos, bool silent) {
+ char buf[32];
+ for (int32_t t = 0; t < gCurCase->tblNum; ++t) {
+ if (gCurCase->tblNum > 1) {
+ sprintf(buf, "%s%d", bpTbPrefix, t);
+ } else {
+ sprintf(buf, "%s%d", bpTbPrefix, 0);
+ }
+
+ prepareCheckResultImpl(
+ taos, buf, gCaseCtrl.printRes,
+ gCurCase->duplicateValue ? (gCurCase->rowNum * gExecLoopTimes / 2) : (gCurCase->rowNum * gExecLoopTimes),
+ silent);
+ }
+
+ gExecLoopTimes = 1;
+}
+
+// 120table 60 record each table
+int sql_perf1(TAOS *taos) {
+ char *sql[3000] = {0};
+ TAOS_RES *result;
+
+ for (int i = 0; i < 3000; i++) {
+ sql[i] = taosMemoryCalloc(1, 1048576);
+ }
+
+ int len = 0;
+ int tss = 0;
+ for (int l = 0; l < 3000; ++l) {
+ len = sprintf(sql[l], "insert into ");
+ for (int t = 0; t < 120; ++t) {
+ len += sprintf(sql[l] + len, "m%d values ", t);
+ for (int m = 0; m < 60; ++m) {
+ len += sprintf(sql[l] + len,
+ "(%d, %d, %d, %d, %d, %d, %f, %f, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", "
+ "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") ",
+ tss++, m, m, m, m, m, m + 1.0, m + 1.0);
+ }
+ }
+ }
+
+ int64_t starttime = taosGetTimestampUs();
+ for (int i = 0; i < 3000; ++i) {
+ result = taos_query(taos, sql[i]);
+ int code = taos_errno(result);
+ if (code != 0) {
+ printf("%d failed to query table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+
+ taos_free_result(result);
+ }
+ int64_t endtime = taosGetTimestampUs();
+ printf("insert total %d records, used %u seconds, avg:%.1f useconds\n", 3000 * 120 * 60,
+ (endtime - starttime) / 1000000UL, (endtime - starttime) / (3000 * 120 * 60));
+
+ for (int i = 0; i < 3000; i++) {
+ taosMemoryFree(sql[i]);
+ }
+
+ return 0;
+}
+
+// one table 60 records one time
+int sql_perf_s1(TAOS *taos) {
+ char **sql = calloc(1, sizeof(char *) * 360000);
+ TAOS_RES *result;
+
+ for (int i = 0; i < 360000; i++) {
+ sql[i] = taosMemoryCalloc(1, 9000);
+ }
+
+ int len = 0;
+ int tss = 0;
+ int id = 0;
+ for (int t = 0; t < 120; ++t) {
+ for (int l = 0; l < 3000; ++l) {
+ len = sprintf(sql[id], "insert into m%d values ", t);
+ for (int m = 0; m < 60; ++m) {
+ len += sprintf(sql[id] + len,
+ "(%d, %d, %d, %d, %d, %d, %f, %f, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", "
+ "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\") ",
+ tss++, m, m, m, m, m, m + 1.0, m + 1.0);
+ }
+ if (len >= 9000) {
+ printf("sql:%s,len:%d\n", sql[id], len);
+ exit(1);
+ }
+ ++id;
+ }
+ }
+
+ unsigned long long starttime = taosGetTimestampUs();
+ for (int i = 0; i < 360000; ++i) {
+ result = taos_query(taos, sql[i]);
+ int code = taos_errno(result);
+ if (code != 0) {
+ printf("failed to query table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+
+ taos_free_result(result);
+ }
+ unsigned long long endtime = taosGetTimestampUs();
+ printf("insert total %d records, used %u seconds, avg:%.1f useconds\n", 3000 * 120 * 60,
+ (endtime - starttime) / 1000000UL, (endtime - starttime) / (3000 * 120 * 60));
+
+ for (int i = 0; i < 360000; i++) {
+ taosMemoryFree(sql[i]);
+ }
+
+ taosMemoryFree(sql);
+
+ return 0;
+}
+
+// small record size
+int sql_s_perf1(TAOS *taos) {
+ char *sql[3000] = {0};
+ TAOS_RES *result;
+
+ for (int i = 0; i < 3000; i++) {
+ sql[i] = taosMemoryCalloc(1, 1048576);
+ }
+
+ int len = 0;
+ int tss = 0;
+ for (int l = 0; l < 3000; ++l) {
+ len = sprintf(sql[l], "insert into ");
+ for (int t = 0; t < 120; ++t) {
+ len += sprintf(sql[l] + len, "m%d values ", t);
+ for (int m = 0; m < 60; ++m) {
+ len += sprintf(sql[l] + len, "(%d, %d) ", tss++, m % 2);
+ }
+ }
+ }
+
+ unsigned long long starttime = taosGetTimestampUs();
+ for (int i = 0; i < 3000; ++i) {
+ result = taos_query(taos, sql[i]);
+ int code = taos_errno(result);
+ if (code != 0) {
+ printf("failed to query table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+
+ taos_free_result(result);
+ }
+ unsigned long long endtime = taosGetTimestampUs();
+ printf("insert total %d records, used %u seconds, avg:%.1f useconds\n", 3000 * 120 * 60,
+ (endtime - starttime) / 1000000UL, (endtime - starttime) / (3000 * 120 * 60));
+
+ for (int i = 0; i < 3000; i++) {
+ taosMemoryFree(sql[i]);
+ }
+
+ return 0;
+}
+
+void generateCreateTableSQL(char *buf, int32_t tblIdx, int32_t colNum, int32_t *colList, int32_t tableType) {
+ int32_t blen = 0;
+ blen = sprintf(buf, "create table %s%d ", (1 == tableType ? bpStbPrefix : bpTbPrefix), tblIdx);
+
+ if (tableType == 3) {
+ blen += sprintf(buf + blen, "using %s%d", bpStbPrefix, bpDefaultStbId);
+ }
+
+ if (tableType == 0 || tableType == 1) {
+ blen += sprintf(buf + blen, " (");
+
+ for (int c = 0; c < colNum; ++c) {
+ if (c > 0) {
+ blen += sprintf(buf + blen, ",");
+ }
+
+ switch (colList[c]) {
+ case TSDB_DATA_TYPE_BOOL:
+ blen += sprintf(buf + blen, "booldata bool");
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ blen += sprintf(buf + blen, "tinydata tinyint");
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ blen += sprintf(buf + blen, "smalldata smallint");
+ break;
+ case TSDB_DATA_TYPE_INT:
+ blen += sprintf(buf + blen, "intdata int");
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ blen += sprintf(buf + blen, "bigdata bigint");
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ blen += sprintf(buf + blen, "floatdata float");
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ blen += sprintf(buf + blen, "doubledata double");
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ blen += sprintf(buf + blen, "binarydata binary(%d)", gVarCharSize);
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ blen += sprintf(buf + blen, "ts timestamp");
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ blen += sprintf(buf + blen, "nchardata nchar(%d)", gVarCharSize);
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ blen += sprintf(buf + blen, "utinydata tinyint unsigned");
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ blen += sprintf(buf + blen, "usmalldata smallint unsigned");
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ blen += sprintf(buf + blen, "uintdata int unsigned");
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ blen += sprintf(buf + blen, "ubigdata bigint unsigned");
+ break;
+ default:
+ printf("invalid col type:%d", colList[c]);
+ exit(1);
+ }
+ }
+
+ blen += sprintf(buf + blen, ")");
+ }
+
+ if (1 == tableType) {
+ blen += sprintf(buf + blen, " tags (");
+ for (int c = 0; c < colNum; ++c) {
+ if (c > 0) {
+ blen += sprintf(buf + blen, ",");
+ }
+ switch (colList[c]) {
+ case TSDB_DATA_TYPE_BOOL:
+ blen += sprintf(buf + blen, "tbooldata bool");
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ blen += sprintf(buf + blen, "ttinydata tinyint");
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ blen += sprintf(buf + blen, "tsmalldata smallint");
+ break;
+ case TSDB_DATA_TYPE_INT:
+ blen += sprintf(buf + blen, "tintdata int");
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ blen += sprintf(buf + blen, "tbigdata bigint");
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ blen += sprintf(buf + blen, "tfloatdata float");
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ blen += sprintf(buf + blen, "tdoubledata double");
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ blen += sprintf(buf + blen, "tbinarydata binary(%d)", gVarCharSize);
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ blen += sprintf(buf + blen, "tts timestamp");
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ blen += sprintf(buf + blen, "tnchardata nchar(%d)", gVarCharSize);
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ blen += sprintf(buf + blen, "tutinydata tinyint unsigned");
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ blen += sprintf(buf + blen, "tusmalldata smallint unsigned");
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ blen += sprintf(buf + blen, "tuintdata int unsigned");
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ blen += sprintf(buf + blen, "tubigdata bigint unsigned");
+ break;
+ default:
+ printf("invalid col type:%d", colList[c]);
+ exit(1);
+ }
+ }
+
+ blen += sprintf(buf + blen, ")");
+ }
+
+ if (3 == tableType) {
+ blen += sprintf(buf + blen, " tags (");
+ for (int c = 0; c < colNum; ++c) {
+ if (c > 0) {
+ blen += sprintf(buf + blen, ",");
+ }
+ switch (colList[c]) {
+ case TSDB_DATA_TYPE_BOOL:
+ blen += sprintf(buf + blen, "%s", rand() % 2 ? "true" : "false");
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_INT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ blen += sprintf(buf + blen, "%f", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ blen += sprintf(buf + blen, "%f", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ blen += sprintf(buf + blen, "'var%d'", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ blen += sprintf(buf + blen, "%lld", bpTs);
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ blen += sprintf(buf + blen, "'nch%d'", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ blen += sprintf(buf + blen, "%d", rand() % 128);
+ break;
+ default:
+ printf("invalid col type:%d", colList[c]);
+ exit(1);
+ }
+ }
+
+ blen += sprintf(buf + blen, ")");
+ }
+
+ if (gCaseCtrl.printCreateTblSql) {
+ printf("\tCreate Table SQL:%s\n", buf);
+ }
+}
+
+char *bpPrecisionStr(uint8_t precision) {
+ switch (precision) {
+ case TIME_PRECISION_MILLI:
+ return "ms";
+ case TIME_PRECISION_MICRO:
+ return "us";
+ case TIME_PRECISION_NANO:
+ return "ns";
+ default:
+ return "unknwon";
+ }
+}
+
+void bpSetStartupTs() {
+ switch (gCaseCtrl.precision) {
+ case TIME_PRECISION_MILLI:
+ bpTs = BP_STARTUP_TS;
+ break;
+ case TIME_PRECISION_MICRO:
+ bpTs = BP_STARTUP_TS * 1000;
+ break;
+ case TIME_PRECISION_NANO:
+ bpTs = BP_STARTUP_TS * 1000000;
+ break;
+ default:
+ bpTs = BP_STARTUP_TS;
+ break;
+ }
+}
+
+void prepare(TAOS *taos, int32_t colNum, int32_t *colList, int prepareStb) {
+ TAOS_RES *result;
+ int code;
+ char createDbSql[128] = {0};
+
+ result = taos_query(taos, "drop database demo");
+ taos_free_result(result);
+
+ sprintf(createDbSql, "create database demo keep 36500 precision \"%s\"", bpPrecisionStr(gCaseCtrl.precision));
+ printf("\tCreate Database SQL:%s\n", createDbSql);
+
+ result = taos_query(taos, createDbSql);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("!!!failed to create database, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+ taos_free_result(result);
+
+ result = taos_query(taos, "use demo");
+ taos_free_result(result);
+
+ if (0 == prepareStb) {
+ // create table
+ for (int i = 0; i < 10; i++) {
+ char buf[1024];
+ generateCreateTableSQL(buf, i, colNum, colList, 0);
+ result = taos_query(taos, buf);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("!!!failed to create table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+ taos_free_result(result);
+ }
+ } else {
+ if (1 == prepareStb || 3 == prepareStb) {
+ char buf[1024];
+ generateCreateTableSQL(buf, bpDefaultStbId, colNum, colList, 1);
+
+ result = taos_query(taos, buf);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("!!!failed to create table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+ taos_free_result(result);
+ }
+
+ if (3 == prepareStb) {
+ for (int i = 0; i < 10; i++) {
+ char buf[1024];
+ generateCreateTableSQL(buf, i, colNum, colList, 3);
+ result = taos_query(taos, buf);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("!!!failed to create table, reason:%s\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(1);
+ }
+ taos_free_result(result);
+ }
+ }
+ }
+}
+
+int32_t runCase(TAOS *taos, int32_t caseIdx, int32_t caseRunIdx, bool silent) {
+ TAOS_STMT2 *stmt = NULL;
+ int64_t beginUs, endUs, totalUs;
+ CaseCfg cfg = gCase[caseIdx];
+ CaseCfg cfgBk;
+ gCurCase = &cfg;
+
+ bpSetStartupTs();
+
+ if ((gCaseCtrl.bindColTypeNum || gCaseCtrl.bindColNum) && (gCurCase->colNum != gFullColNum)) {
+ return 1;
+ }
+
+ if (gCurCase->preCaseIdx >= 0) {
+ bool printRes = gCaseCtrl.printRes;
+ bool printStmtSql = gCaseCtrl.printStmtSql;
+ gCaseCtrl.printRes = false;
+ gCaseCtrl.printStmtSql = false;
+ runCase(taos, gCurCase->preCaseIdx, caseRunIdx, true);
+ gCaseCtrl.printRes = printRes;
+ gCaseCtrl.printStmtSql = printStmtSql;
+
+ gCurCase = &cfg;
+ }
+
+ if (gCaseCtrl.runTimes) {
+ gCurCase->runTimes = gCaseCtrl.runTimes;
+ }
+
+ if (gCaseCtrl.rowNum) {
+ gCurCase->rowNum = gCaseCtrl.rowNum;
+ }
+
+ if (gCaseCtrl.autoCreateTbl) {
+ if (gCurCase->testType == TTYPE_INSERT && gCurCase->tblNum > 1) {
+ gCurCase->autoCreateTbl = 1;
+ if (gCurCase->bindTagNum <= 0) {
+ gCurCase->bindTagNum = gCurCase->colNum;
+ }
+ } else {
+ return 1;
+ }
+ }
+
+ if (gCurCase->fullCol) {
+ gCurCase->bindColNum = gCurCase->colNum;
+ if (gCurCase->autoCreateTbl) {
+ gCurCase->bindTagNum = gCurCase->colNum;
+ }
+ }
+
+ gCurCase->bindNullNum = gCaseCtrl.bindNullNum;
+ if (gCaseCtrl.bindColNum) {
+ gCurCase->bindColNum = gCaseCtrl.bindColNum;
+ gCurCase->fullCol = false;
+ }
+ if (gCaseCtrl.bindTagNum) {
+ gCurCase->bindTagNum = gCaseCtrl.bindTagNum;
+ gCurCase->fullCol = false;
+ }
+ if (gCaseCtrl.bindRowNum) {
+ gCurCase->bindRowNum = gCaseCtrl.bindRowNum;
+ }
+ if (gCaseCtrl.bindColTypeNum) {
+ gCurCase->bindColNum = gCaseCtrl.bindColTypeNum;
+ gCurCase->fullCol = false;
+ }
+ if (gCaseCtrl.bindTagTypeNum) {
+ gCurCase->bindTagNum = gCaseCtrl.bindTagTypeNum;
+ gCurCase->fullCol = false;
+ }
+
+ if (!silent) {
+ printf("* Case %d - [%s]%s Begin *\n", caseRunIdx, gCaseCtrl.caseCatalog, gCurCase->caseDesc);
+ }
+
+ totalUs = 0;
+ cfgBk = cfg;
+ for (int32_t n = 0; n < gCurCase->runTimes; ++n) {
+ if (gCurCase->preCaseIdx < 0) {
+ prepare(taos, gCurCase->colNum, gCurCase->colList, gCurCase->autoCreateTbl);
+ }
+
+ beginUs = taosGetTimestampUs();
+
+ stmt = st_stmt2_init(taos, gCurCase->stbInsert);
+ if (!stmt) {
+ printf("!!!st_stmt2_init failed, error:%s\n", st_stmt2_error(stmt));
+ exit(1);
+ }
+
+ (*gCurCase->runFn)(stmt, taos);
+
+ (void)st_stmt2_close(stmt);
+
+ endUs = taosGetTimestampUs();
+ totalUs += (endUs - beginUs);
+
+ prepareCheckResult(taos, silent);
+
+ cfg = cfgBk;
+ }
+
+ if (!silent) {
+ printf("* Case %d - [%s]%s [AvgTime:%.3fms] End *\n", caseRunIdx, gCaseCtrl.caseCatalog, gCurCase->caseDesc,
+ ((double)totalUs) / 1000 / gCurCase->runTimes);
+ }
+
+ return 0;
+}
+
+void *runCaseList(TAOS *taos) {
+ static int32_t caseRunIdx = 0;
+ static int32_t caseRunNum = 0;
+ int32_t caseNum = 0;
+ int32_t caseIdx = (gCaseCtrl.caseIdx >= 0) ? gCaseCtrl.caseIdx : 0;
+
+ for (int32_t i = caseIdx; i < sizeof(gCase) / sizeof(gCase[0]); ++i) {
+ if (gCaseCtrl.caseNum > 0 && caseNum >= gCaseCtrl.caseNum) {
+ break;
+ }
+
+ if (gCaseCtrl.caseRunNum > 0 && caseRunNum >= gCaseCtrl.caseRunNum) {
+ break;
+ }
+
+ if (gCaseCtrl.caseRunIdx >= 0 && caseRunIdx < gCaseCtrl.caseRunIdx) {
+ caseRunIdx++;
+ continue;
+ }
+
+ if (runCase(taos, i, caseRunIdx, false)) {
+ continue;
+ }
+
+ caseRunIdx++;
+ caseNum++;
+ caseRunNum++;
+ }
+
+ return NULL;
+}
+
+void runAll(TAOS *taos) {
+ strcpy(gCaseCtrl.caseCatalog, "Default Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ runCaseList(taos);
+
+#if 1
+ strcpy(gCaseCtrl.caseCatalog, "Micro DB precision Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.precision = TIME_PRECISION_MICRO;
+ runCaseList(taos);
+ gCaseCtrl.precision = TIME_PRECISION_MILLI;
+
+ strcpy(gCaseCtrl.caseCatalog, "Nano DB precision Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.precision = TIME_PRECISION_NANO;
+ runCaseList(taos);
+ gCaseCtrl.precision = TIME_PRECISION_MILLI;
+
+ strcpy(gCaseCtrl.caseCatalog, "Auto Create Table Test");
+ gCaseCtrl.autoCreateTbl = true;
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ runCaseList(taos);
+ gCaseCtrl.autoCreateTbl = false;
+
+ strcpy(gCaseCtrl.caseCatalog, "Null Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.bindNullNum = 1;
+ runCaseList(taos);
+ gCaseCtrl.bindNullNum = 0;
+
+ strcpy(gCaseCtrl.caseCatalog, "Bind Row Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.bindRowNum = 1;
+ runCaseList(taos);
+ gCaseCtrl.bindRowNum = 0;
+
+ strcpy(gCaseCtrl.caseCatalog, "Row Num Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.rowNum = 1000;
+ gCaseCtrl.printRes = false;
+ runCaseList(taos);
+ gCaseCtrl.rowNum = 0;
+ gCaseCtrl.printRes = true;
+
+ strcpy(gCaseCtrl.caseCatalog, "Runtimes Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.runTimes = 2;
+ runCaseList(taos);
+ gCaseCtrl.runTimes = 0;
+
+ strcpy(gCaseCtrl.caseCatalog, "Check Param Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.checkParamNum = true;
+ runCaseList(taos);
+ gCaseCtrl.checkParamNum = false;
+
+ strcpy(gCaseCtrl.caseCatalog, "Bind Col Num Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.bindColNum = 6;
+ runCaseList(taos);
+ gCaseCtrl.bindColNum = 0;
+
+#endif
+
+ /*
+ strcpy(gCaseCtrl.caseCatalog, "Bind Col Type Test");
+ printf("%s Begin\n", gCaseCtrl.caseCatalog);
+ gCaseCtrl.bindColTypeNum = tListLen(bindColTypeList);
+ gCaseCtrl.bindColTypeList = bindColTypeList;
+ runCaseList(taos);
+ */
+
+ printf("All Test End\n");
+}
+
+int main(int argc, char *argv[]) {
+ TAOS *taos = NULL;
+
+ srand((unsigned int)time(NULL));
+
+ // connect to server
+ if (argc < 2) {
+ printf("please input server ip \n");
+ return 0;
+ }
+
+ taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
+ if (taos == NULL) {
+ printf("failed to connect to db, reason:%s\n", taos_errstr(taos));
+ exit(1);
+ }
+
+ runAll(taos);
+
+ taos_close(taos);
+
+ return 0;
+}
diff --git a/tests/script/api/stmt2.c b/tests/script/api/stmt2.c
new file mode 100644
index 0000000000..82537905dc
--- /dev/null
+++ b/tests/script/api/stmt2.c
@@ -0,0 +1,323 @@
+// sample code to verify all TDengine API
+// to compile: gcc -o apitest apitest.c -ltaos
+
+#include
+#include
+#include
+#include
+#include "taos.h"
+static int64_t count = 10000;
+
+int64_t genReqid() {
+ count += 100;
+ return count;
+}
+
+void stmtAsyncQueryCb(void* param, TAOS_RES* pRes, int code) {
+ int affected_rows = taos_affected_rows(pRes);
+ return;
+ /*
+ SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)param;
+ if (code == 0 && pRes) {
+ if (qParam->fetch) {
+ taos_fetch_rows_a(pRes, sqAsyncFetchCb, param);
+ } else {
+ if (qParam->free) {
+ taos_free_result(pRes);
+ }
+ *qParam->end = 1;
+ }
+ } else {
+ sqError("select", taos_errstr(pRes));
+ *qParam->end = 1;
+ taos_free_result(pRes);
+ }
+ */
+}
+
+void veriry_stmt(TAOS* taos) {
+ TAOS_RES* result = taos_query(taos, "drop database if exists test;");
+ taos_free_result(result);
+ usleep(100000);
+ result = taos_query(taos, "create database test;");
+
+ int code = taos_errno(result);
+ if (code != 0) {
+ printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result));
+ taos_free_result(result);
+ return;
+ }
+ taos_free_result(result);
+
+ usleep(100000);
+ taos_select_db(taos, "test");
+
+ // create table
+ /*
+ const char* sql =
+ "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin "
+ "binary(40), blob nchar(10))";
+ */
+ const char* sql =
+ "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob2 "
+ "nchar(10), blob nchar(10))";
+ result = taos_query(taos, sql);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result));
+ taos_free_result(result);
+ return;
+ }
+ taos_free_result(result);
+
+ // insert 10 records
+ struct {
+ int64_t ts[10];
+ int8_t b[10];
+ int8_t v1[10];
+ int16_t v2[10];
+ int32_t v4[10];
+ int64_t v8[10];
+ float f4[10];
+ double f8[10];
+ char bin[10][40];
+ char blob[10][80];
+ char blob2[10][80];
+ } v;
+
+ int32_t* t8_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t16_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t32_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t64_len = malloc(sizeof(int32_t) * 10);
+ int32_t* float_len = malloc(sizeof(int32_t) * 10);
+ int32_t* double_len = malloc(sizeof(int32_t) * 10);
+ int32_t* bin_len = malloc(sizeof(int32_t) * 10);
+ int32_t* blob_len = malloc(sizeof(int32_t) * 10);
+ int32_t* blob_len2 = malloc(sizeof(int32_t) * 10);
+
+#include "time.h"
+ clock_t start, end;
+ TAOS_STMT2_OPTION option = {0, true, true, stmtAsyncQueryCb, NULL};
+
+ start = clock();
+ TAOS_STMT2* stmt = taos_stmt2_init(taos, &option);
+ end = clock();
+ printf("init time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ // TAOS_MULTI_BIND params[10];
+ TAOS_STMT2_BIND params[10];
+ char is_null[10] = {0};
+
+ params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
+ // params[0].buffer_length = sizeof(v.ts[0]);
+ params[0].buffer = v.ts;
+ params[0].length = t64_len;
+ params[0].is_null = is_null;
+ params[0].num = 10;
+
+ params[1].buffer_type = TSDB_DATA_TYPE_BOOL;
+ // params[1].buffer_length = sizeof(v.b[0]);
+ params[1].buffer = v.b;
+ params[1].length = t8_len;
+ params[1].is_null = is_null;
+ params[1].num = 10;
+
+ params[2].buffer_type = TSDB_DATA_TYPE_TINYINT;
+ // params[2].buffer_length = sizeof(v.v1[0]);
+ params[2].buffer = v.v1;
+ params[2].length = t8_len;
+ params[2].is_null = is_null;
+ params[2].num = 10;
+
+ params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT;
+ // params[3].buffer_length = sizeof(v.v2[0]);
+ params[3].buffer = v.v2;
+ params[3].length = t16_len;
+ params[3].is_null = is_null;
+ params[3].num = 10;
+
+ params[4].buffer_type = TSDB_DATA_TYPE_INT;
+ // params[4].buffer_length = sizeof(v.v4[0]);
+ params[4].buffer = v.v4;
+ params[4].length = t32_len;
+ params[4].is_null = is_null;
+ params[4].num = 10;
+
+ params[5].buffer_type = TSDB_DATA_TYPE_BIGINT;
+ // params[5].buffer_length = sizeof(v.v8[0]);
+ params[5].buffer = v.v8;
+ params[5].length = t64_len;
+ params[5].is_null = is_null;
+ params[5].num = 10;
+
+ params[6].buffer_type = TSDB_DATA_TYPE_FLOAT;
+ // params[6].buffer_length = sizeof(v.f4[0]);
+ params[6].buffer = v.f4;
+ params[6].length = float_len;
+ params[6].is_null = is_null;
+ params[6].num = 10;
+
+ params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE;
+ // params[7].buffer_length = sizeof(v.f8[0]);
+ params[7].buffer = v.f8;
+ params[7].length = double_len;
+ params[7].is_null = is_null;
+ params[7].num = 10;
+ /*
+ params[8].buffer_type = TSDB_DATA_TYPE_BINARY;
+ //params[8].buffer_length = sizeof(v.bin[0]);
+ params[8].buffer = v.bin;
+ params[8].length = bin_len;
+ params[8].is_null = is_null;
+ params[8].num = 10;
+ */
+ params[8].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ // params[8].buffer_length = sizeof(v.blob2[0]);
+ params[8].buffer = v.blob2;
+ params[8].length = blob_len2;
+ params[8].is_null = is_null;
+ params[8].num = 10;
+
+ params[9].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ // params[9].buffer_length = sizeof(v.blob[0]);
+ params[9].buffer = v.blob;
+ params[9].length = blob_len;
+ params[9].is_null = is_null;
+ params[9].num = 10;
+
+ sql = "insert into ? (ts, b, v1, v2, v4, v8, f4, f8, blob2, blob) values(?,?,?,?,?,?,?,?,?,?)";
+ start = clock();
+ code = taos_stmt2_prepare(stmt, sql, 0);
+ end = clock();
+ printf("prepare time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ /*
+ code = taos_stmt_set_tbname(stmt, "m1");
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ */
+
+ int64_t ts = 1591060628000;
+ for (int i = 0; i < 10; ++i) {
+ is_null[i] = 0;
+
+ v.ts[i] = ts++;
+ v.b[i] = (int8_t)i % 2;
+ v.v1[i] = (int8_t)i;
+ v.v2[i] = (int16_t)(i * 2);
+ v.v4[i] = (int32_t)(i * 4);
+ v.v8[i] = (int64_t)(i * 8);
+ v.f4[i] = (float)(i * 40);
+ v.f8[i] = (double)(i * 80);
+ for (int j = 0; j < sizeof(v.bin[0]); ++j) {
+ v.bin[i][j] = (char)(i + '0');
+ }
+ strcpy(v.blob2[i], "一二三四五六七十九八");
+ strcpy(v.blob[i], "一二三四五六七八九十");
+
+ t8_len[i] = sizeof(int8_t);
+ t16_len[i] = sizeof(int16_t);
+ t32_len[i] = sizeof(int32_t);
+ t64_len[i] = sizeof(int64_t);
+ float_len[i] = sizeof(float);
+ double_len[i] = sizeof(double);
+ bin_len[i] = sizeof(v.bin[0]);
+ blob_len[i] = (int32_t)strlen(v.blob[i]);
+ blob_len2[i] = (int32_t)strlen(v.blob2[i]);
+ }
+
+ char* tbname = "m1";
+ TAOS_STMT2_BIND* bind_cols[1] = {¶ms[0]};
+ TAOS_STMT2_BINDV bindv = {1, &tbname, NULL, &bind_cols[0]};
+ start = clock();
+ // taos_stmt2_bind_param(stmt, "m1", NULL, params, -1);
+ taos_stmt2_bind_param(stmt, &bindv, -1);
+ end = clock();
+ printf("bind time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ // taos_stmt_bind_param_batch(stmt, params);
+ // taos_stmt_add_batch(stmt);
+ /*
+ int param_count = -1;
+ code = taos_stmt2_param_count(stmt, ¶m_count);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_param_count. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ printf("param_count: %d\n", param_count);
+ */
+ TAOS_FIELD_E* fields = NULL;
+ int field_count = -1;
+ start = clock();
+ code = taos_stmt2_get_fields(stmt, TAOS_FIELD_COL, &field_count, NULL);
+ end = clock();
+ printf("get fields time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_param_count. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ printf("col field_count: %d\n", field_count);
+ start = clock();
+ taos_stmt2_free_fields(stmt, fields);
+ end = clock();
+ printf("free time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+ /*
+ code = taos_stmt2_get_fields(stmt, TAOS_FIELD_TAG, &field_count, &fields);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_param_count. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ return;
+ }
+ printf("tag field_count: %d\n", field_count);
+ taos_stmt2_free_fields(stmt, fields);
+ */
+ // if (taos_stmt_execute(stmt) != 0) {
+ start = clock();
+ // if (taos_stmt2_exec(stmt, NULL, stmtAsyncQueryCb, NULL) != 0) {
+ if (taos_stmt2_exec(stmt, NULL) != 0) {
+ printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt2_close(stmt);
+ return;
+ }
+ end = clock();
+ printf("exec time:%f\n", (double)(end - start) / CLOCKS_PER_SEC);
+
+ taos_stmt2_close(stmt);
+
+ free(t8_len);
+ free(t16_len);
+ free(t32_len);
+ free(t64_len);
+ free(float_len);
+ free(double_len);
+ free(bin_len);
+ free(blob_len);
+ free(blob_len2);
+}
+
+int main(int argc, char* argv[]) {
+ const char* host = "127.0.0.1";
+ const char* user = "root";
+ const char* passwd = "taosdata";
+
+ taos_options(TSDB_OPTION_TIMEZONE, "GMT-8");
+ TAOS* taos = taos_connect(host, user, passwd, "", 0);
+ if (taos == NULL) {
+ printf("\033[31mfailed to connect to db, reason:%s\033[0m\n", taos_errstr(taos));
+ exit(1);
+ }
+
+ printf("********* verify stmt query **********\n");
+ veriry_stmt(taos);
+
+ printf("done\n");
+ taos_close(taos);
+ taos_cleanup();
+}
diff --git a/tests/script/tsim/parser/nchar.sim b/tests/script/tsim/parser/nchar.sim
index 9358a31cc1..86a854d8e7 100644
--- a/tests/script/tsim/parser/nchar.sim
+++ b/tests/script/tsim/parser/nchar.sim
@@ -226,8 +226,6 @@ if $data10 != 5 then
endi
sql_error select avg(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql_error select sum(tbcol) from $mt where tbcol1 = 1 group by tgcol
-sql_error select min(tbcol) from $mt where tbcol1 = 1 group by tgcol
-sql_error select max(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql select first(tbcol), tgcol from $mt where tbcol1 = 1 group by tgcol order by tgcol
if $rows != 2 then
diff --git a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
index 692212d511..a7b90846ce 100644
--- a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
+++ b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim
@@ -35,16 +35,12 @@ sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) in
sql create sma index sma_index_name2 on stb function(sum(c1),first(c1), last(c1), first(c4),last(c4),count(c4),first(c5),last(c5),count(c5),apercentile(c1,80,"t-digest"), avg(c2),count(c3), spread(c3), stddev(c2), hyperloglog(c2), hyperloglog(c4), hyperloglog(c5)) interval(5m,10s) sliding(5m);
# for varchar/binary
sql_error create sma index sma_index_name3 on stb function(sum(c4)) interval(5m,10s) sliding(5m);
-sql_error create sma index sma_index_name3 on stb function(min(c4)) interval(5m,10s) sliding(5m);
-sql_error create sma index sma_index_name3 on stb function(max(c4)) interval(5m,10s) sliding(5m);
sql_error create sma index sma_index_name3 on stb function(avg(c4)) interval(5m,10s) sliding(5m);
sql_error create sma index sma_index_name3 on stb function(apercentile(c4)) interval(5m,10s) sliding(5m);
sql_error create sma index sma_index_name3 on stb function(spread(c4)) interval(5m,10s) sliding(5m);
sql_error create sma index sma_index_name3 on stb function(stddev(c4)) interval(5m,10s) sliding(5m);
# for nchar
sql_error create sma index sma_index_name3 on stb function(sum(c5)) interval(5m,10s) sliding(5m);
-sql_error create sma index sma_index_name3 on stb function(min(c5)) interval(5m,10s) sliding(5m);
-sql_error create sma index sma_index_name3 on stb function(max(c5)) interval(5m,10s) sliding(5m);
sql_error create sma index sma_index_name3 on stb function(avg(c5)) interval(5m,10s) sliding(5m);
sql_error create sma index sma_index_name3 on stb function(apercentile(c5)) interval(5m,10s) sliding(5m);
sql_error create sma index sma_index_name3 on stb function(spread(c5)) interval(5m,10s) sliding(5m);
diff --git a/tests/system-test/2-query/min.py b/tests/system-test/2-query/min.py
index bf9993da64..8aa6f2001e 100644
--- a/tests/system-test/2-query/min.py
+++ b/tests/system-test/2-query/min.py
@@ -41,8 +41,6 @@ class TDTestCase:
tdSql.error(f"select min(now()) from {dbname}.stb_1")
tdSql.error(f"select min(ts) from {dbname}.stb_1")
tdSql.error(f"select min(col7) from {dbname}.stb_1")
- tdSql.error(f"select min(col8) from {dbname}.stb_1")
- tdSql.error(f"select min(col9) from {dbname}.stb_1")
tdSql.error(f"select min(a) from {dbname}.stb_1")
tdSql.query(f"select min(1) from {dbname}.stb_1")
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.stb_1")
@@ -69,13 +67,15 @@ class TDTestCase:
tdSql.checkData(0, 0, np.min(floatData))
tdSql.query(f"select min(col1) from {dbname}.stb_1 where col2>=5")
tdSql.checkData(0,0,5)
+ tdSql.query(f"select min(col8) from {dbname}.stb_1")
+ tdSql.checkData(0,0,'taosdata1')
+ tdSql.query(f"select min(col9) from {dbname}.stb_1")
+ tdSql.checkData(0,0,'涛思数据1')
tdSql.error(f"select min(now()) from {dbname}.stb_1")
tdSql.error(f"select min(ts) from {dbname}.stb_1")
tdSql.error(f"select min(col7) from {dbname}.stb_1")
- tdSql.error(f"select min(col8) from {dbname}.stb_1")
- tdSql.error(f"select min(col9) from {dbname}.stb_1")
tdSql.error(f"select min(a) from {dbname}.stb_1")
tdSql.query(f"select min(1) from {dbname}.stb_1")
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.stb_1")
@@ -102,12 +102,14 @@ class TDTestCase:
tdSql.checkData(0, 0, np.min(floatData))
tdSql.query(f"select min(col1) from {dbname}.stb where col2>=5")
tdSql.checkData(0,0,5)
+ tdSql.query(f"select min(col8) from {dbname}.stb")
+ tdSql.checkData(0,0,'taosdata1')
+ tdSql.query(f"select min(col9) from {dbname}.stb")
+ tdSql.checkData(0,0,'涛思数据1')
tdSql.error(f"select min(now()) from {dbname}.stb_1")
tdSql.error(f"select min(ts) from {dbname}.stb_1")
tdSql.error(f"select min(col7) from {dbname}.ntb")
- tdSql.error(f"select min(col8) from {dbname}.ntb")
- tdSql.error(f"select min(col9) from {dbname}.ntb")
tdSql.error(f"select min(a) from {dbname}.ntb")
tdSql.query(f"select min(1) from {dbname}.ntb")
tdSql.error(f"select min(count(c1),count(c2)) from {dbname}.ntb")
@@ -134,6 +136,10 @@ class TDTestCase:
tdSql.checkData(0, 0, np.min(floatData))
tdSql.query(f"select min(col1) from {dbname}.ntb where col2>=5")
tdSql.checkData(0,0,5)
+ tdSql.query(f"select min(col8) from {dbname}.ntb")
+ tdSql.checkData(0,0,'taosdata1')
+ tdSql.query(f"select min(col9) from {dbname}.ntb")
+ tdSql.checkData(0,0,'涛思数据1')
def stop(self):
diff --git a/tests/system-test/2-query/percentile.py b/tests/system-test/2-query/percentile.py
index e01aae97c0..46fff0201e 100644
--- a/tests/system-test/2-query/percentile.py
+++ b/tests/system-test/2-query/percentile.py
@@ -124,6 +124,9 @@ class TDTestCase:
tdSql.query(f'select percentile(col1, 9.9, 19.9, 29.9, 39.9, 49.9, 59.9, 69.9, 79.9, 89.9, 99.9) from {self.ntbname}')
tdSql.checkData(0, 0, '[0.891000, 1.791000, 2.691000, 3.591000, 4.491000, 5.391000, 6.291000, 7.191000, 8.091000, 8.991000]')
+ tdSql.query(f'select percentile(col1 * 1e+200, 9.9, 19.9, 29.9, 39.9, 49.9, 59.9, 69.9, 79.9, 89.9, 99.9) from {self.ntbname}')
+ tdSql.checkRows(1);
+
tdSql.error(f'select percentile(col1) from {self.ntbname}')
tdSql.error(f'select percentile(col1, -1) from {self.ntbname}')
tdSql.error(f'select percentile(col1, 101) from {self.ntbname}')
@@ -166,6 +169,9 @@ class TDTestCase:
tdSql.query(f'select percentile(col1, 9.9, 19.9, 29.9, 39.9, 49.9, 59.9, 69.9, 79.9, 89.9, 99.9) from {self.stbname}_0')
tdSql.checkData(0, 0, '[0.891000, 1.791000, 2.691000, 3.591000, 4.491000, 5.391000, 6.291000, 7.191000, 8.091000, 8.991000]')
+ tdSql.query(f'select percentile(col1 * 1e+200, 9.9, 19.9, 29.9, 39.9, 49.9, 59.9, 69.9, 79.9, 89.9, 99.9) from {self.stbname}_0')
+ tdSql.checkRows(1);
+
tdSql.error(f'select percentile(col1) from {self.stbname}_0')
tdSql.error(f'select percentile(col1, -1) from {self.stbname}_0')
tdSql.error(f'select percentile(col1, 101) from {self.stbname}_0')
diff --git a/tests/system-test/2-query/select_null.py b/tests/system-test/2-query/select_null.py
index d6e48e4f99..bd92e4cf5c 100755
--- a/tests/system-test/2-query/select_null.py
+++ b/tests/system-test/2-query/select_null.py
@@ -122,21 +122,27 @@ class TDTestCase:
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t1) from %s.stb0 where ts= 0:
+ showLog(f" i={i} wait cluster alive ok.\n")
+ return True
+
+ showLog(f" i={i} wait cluster alive ...\n")
+ time.sleep(1)
+
+ showLog(f" i={i} wait cluster alive failed.\n")
+ return False
+
+def waitCompactFinish(loop):
+ for i in range(loop):
+ command = 'taos -s "show compacts;" '
+ out,err = run(command)
+ if out.find("Query OK, 0 row(s) in set") >= 0:
+ showLog(f" i={i} wait compact finish ok\n")
+ return True
+
+ showLog(f" i={i} wait compact ...\n")
+ time.sleep(1)
+
+ showLog(f" i={i} wait compact failed.\n")
+ return False
+
+
+def getTypeName(datatype):
+ str1 = datatype.split(",")[0]
+ str2 = str1.split(":")[1]
+ str3 = str2.replace('"','').replace(' ','')
+ return str3
+
+
+def getMatch(datatype, algo):
+ if algo == "tsz":
+ if datatype == "float" or datatype == "double":
+ return True
+ else:
+ return False
+ else:
+ return True
+
+
+def generateJsonFile(datatype, typeName, algo):
+ print(f"doTest dataType: {typeName} algo: {algo} \n")
+
+ # replace compress
+ datatype = datatype.replace("@COMPRESS", algo)
+ # replace datatype
+ context = readFileContext(templateFile)
+ context = context.replace("@DATATYPE", datatype)
+ # write to file
+ fileName = f"json/{typeName}.json"
+ if os.path.exists(fileName):
+ os.remove(fileName)
+ writeFileContext(fileName, context)
+
+ return fileName
+
+def taosdStart():
+ cmd = "nohup /usr/bin/taosd 2>&1 & "
+ ret = exec(cmd)
+ print(f"exec taosd ret = {ret}\n")
+ time.sleep(3)
+ waitClusterAlive(10)
+
+def taosdStop():
+ i = 1
+ toBeKilled = "taosd"
+ killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled
+ psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled
+ processID = subprocess.check_output(psCmd, shell=True)
+ while(processID):
+ os.system(killCmd)
+ time.sleep(1)
+ processID = subprocess.check_output(psCmd, shell=True)
+ print(f"i={i} kill taosd pid={processID}")
+ i += 1
+
+def cleanAndStartTaosd():
+
+ taosdStop()
+ # clear
+ exec(f"rm -rf {dataDir}")
+ # start
+ taosdStart()
+
+def findContextValue(context, label):
+ start = context.find(label)
+ if start == -1 :
+ return ""
+ start += len(label) + 2
+ # skip blank
+ while context[start] == ' ':
+ start += 1
+
+ # find end ','
+ end = start
+ ends = [',','}',']', 0]
+ while context[end] not in ends:
+ end += 1
+
+ print(f"start = {start} end={end}\n")
+ return context[start:end]
+
+
+def writeTemplateInfo(resultFile):
+ context = readFileContext(templateFile)
+ vgroups = findContextValue(context, "vgroups")
+ childCount = findContextValue(context, "childtable_count")
+ insertRows = findContextValue(context, "insert_rows")
+ line = f"vgroups = {vgroups}\nchildtable_count = {childCount}\ninsert_rows = {insertRows}\n\n"
+ print(line)
+ appendFileContext(resultFile, line)
+
+def totalCompressRate(typeName, algo, resultFile):
+ global Number
+ # flush
+ command = 'taos -s "flush database dbrate;"'
+ rets = exec(command)
+ command = 'taos -s "compact database dbrate;"'
+ rets = exec(command)
+ waitCompactFinish(60)
+
+ # read compress rate
+ command = 'taos -s "show table distributed dbrate.meters\G;"'
+ rets = runRetList(command)
+ print(rets)
+ str1 = rets[5]
+ str2 = str1.split(" ")[6]
+ pos = str2.find("=[")
+ rate = str2[pos+2:]
+ print("rate =" + rate)
+
+ # total data file size
+ dataSize = getFolderSize(f"{dataDir}/vnode/")
+ dataSizeMB = int(dataSize/1024/1024)
+
+ # appand to file
+
+ Number += 1
+ context = "%10s %10s %10s %10s %10s\n"%( Number, algo, typeName, str(dataSizeMB)+"M", rate+"%")
+ showLog(context)
+ appendFileContext(resultFile, context)
+
+
+def doTest(dataType, typeName, algo, resultFile):
+ print(f"doTest dataType: {typeName} algo: {algo} \n")
+ cleanAndStartTaosd()
+
+ # json
+ jsonFile = generateJsonFile(dataType, typeName, algo)
+ # run taosBenchmark
+ exec(f"taosBenchmark -f {jsonFile}")
+
+ # total compress rate
+ totalCompressRate(typeName, algo, resultFile)
+
+def main():
+ # test types
+ dataTypes = [
+ '{"type": "bool", "count":100, "min": 0, "max": 1, "compress":"@COMPRESS"}',
+ '{"type": "tinyint", "count":100, "min": 0, "max": 100, "compress":"@COMPRESS"}',
+ '{"type": "smallint", "count":100, "min": 0, "max": 1000, "compress":"@COMPRESS"}',
+ '{"type": "int", "count":100, "min": 0, "max": 100000, "compress":"@COMPRESS"}',
+ '{"type": "bigint", "count":100, "min": 0, "max": 1000000, "compress":"@COMPRESS"}',
+ '{"type": "float", "count":100, "min": 0, "max": 1000, "compress":"@COMPRESS"}',
+ '{"type": "double", "count":100, "min": 0, "max": 1000, "compress":"@COMPRESS"}',
+ '{"type": "binary", "count":100, "len": 64, "compress":"@COMPRESS"}',
+ '{"type": "nchar", "count":100, "len": 64, "compress":"@COMPRESS"}'
+ ]
+
+ # test compress method
+ algos = ["lz4", "zlib", "zstd", "xz", "tsz"]
+
+ # record result
+ resultFile = "./result.txt"
+ timestamp = time.time()
+
+ now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp))
+ context = f"\n---------------------- test rate ({now}) ---------------------------------\n"
+ appendFileContext(resultFile, context)
+ # json info
+ writeTemplateInfo(resultFile)
+ # head
+ context = "%10s %10s %10s %10s %10s\n"%("No","compress","dataType", "dataSize","rate")
+ appendFileContext(resultFile, context)
+
+
+ # loop for all types
+ for dataType in dataTypes:
+ typeName = getTypeName(dataType)
+ for algo in algos:
+ if getMatch(typeName, algo) is False:
+ print(f"warning dataType {typeName} not match with algo {algo} \n")
+ continue
+ # do test
+ doTest(dataType, typeName, algo, resultFile)
+ appendFileContext(resultFile, " \n")
+
+if __name__ == "__main__":
+ print("welcome use TDengine compress rate test tools.\n")
+ main()
\ No newline at end of file
diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c
index 7fdfd29542..84da746afd 100644
--- a/tools/shell/src/shellEngine.c
+++ b/tools/shell/src/shellEngine.c
@@ -48,15 +48,15 @@ static char *shellFormatTimestamp(char *buf, int64_t val, int32_t precision);
static int64_t shellDumpResultToFile(const char *fname, TAOS_RES *tres);
static void shellPrintNChar(const char *str, int32_t length, int32_t width);
static void shellPrintGeometry(const unsigned char *str, int32_t length, int32_t width);
-static void shellVerticalPrintResult(TAOS_RES *tres, tsDumpInfo* dump_info);
-static void shellHorizontalPrintResult(TAOS_RES *tres, tsDumpInfo* dump_info);
+static void shellVerticalPrintResult(TAOS_RES *tres, tsDumpInfo *dump_info);
+static void shellHorizontalPrintResult(TAOS_RES *tres, tsDumpInfo *dump_info);
static int64_t shellDumpResult(TAOS_RES *tres, char *fname, int32_t *error_no, bool vertical, const char *sql);
static void shellReadHistory();
static void shellWriteHistory();
static void shellPrintError(TAOS_RES *tres, int64_t st);
static bool shellIsCommentLine(char *line);
static void shellSourceFile(const char *file);
-static bool shellGetGrantInfo(char* buf);
+static bool shellGetGrantInfo(char *buf);
static void shellCleanup(void *arg);
static void *shellCancelHandler(void *arg);
@@ -165,12 +165,12 @@ int32_t shellRunCommand(char *command, bool recordHistory) {
// add help or help;
if (strncasecmp(command, "help", 4) == 0) {
- if(command[4] == ';' || command[4] == ' ' || command[4] == 0) {
- showHelp();
- return 0;
+ if (command[4] == ';' || command[4] == ' ' || command[4] == 0) {
+ showHelp();
+ return 0;
}
}
-
+
if (recordHistory) shellRecordCommandToHistory(command);
char quote = 0, *cmd = command;
@@ -197,19 +197,18 @@ int32_t shellRunCommand(char *command, bool recordHistory) {
return shellRunSingleCommand(cmd);
}
-
-char * strendG(const char* pstr) {
- if(pstr == NULL) {
+char *strendG(const char *pstr) {
+ if (pstr == NULL) {
return NULL;
}
size_t len = strlen(pstr);
- if(len < 4) {
+ if (len < 4) {
return NULL;
}
- char * p = (char *)pstr + len - 2;
- if (strcmp(p, "\\G") == 0 ){
+ char *p = (char *)pstr + len - 2;
+ if (strcmp(p, "\\G") == 0) {
return p;
}
@@ -285,10 +284,11 @@ void shellRunSingleCommandImp(char *command) {
et = taosGetTimestampUs();
if (error_no == 0) {
- printf("Query OK, %"PRId64 " row(s) in set (%.6fs)\r\n", numOfRows, (et - st) / 1E6);
+ printf("Query OK, %" PRId64 " row(s) in set (%.6fs)\r\n", numOfRows, (et - st) / 1E6);
} else {
terrno = error_no;
- printf("Query interrupted (%s), %"PRId64 " row(s) in set (%.6fs)\r\n", taos_errstr(NULL), numOfRows, (et - st) / 1E6);
+ printf("Query interrupted (%s), %" PRId64 " row(s) in set (%.6fs)\r\n", taos_errstr(NULL), numOfRows,
+ (et - st) / 1E6);
}
taos_free_result(pSql);
} else {
@@ -366,10 +366,10 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i
return;
}
- char quotationStr[2] ={'"', 0};
+ char quotationStr[2] = {'"', 0};
int32_t width;
- int n = 0;
+ int n = 0;
#define LENGTH 64
char buf[LENGTH] = {0};
switch (field->type) {
@@ -431,8 +431,8 @@ 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;
+ char *tmp = (char *)taosMemoryCalloc(length * 2 + 1, 1);
+ if (tmp == NULL) break;
for (int32_t i = 0; i < length; i++) {
tmp[bufIndex] = val[i];
bufIndex++;
@@ -446,19 +446,19 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i
taosFprintfFile(pFile, "%s%s%s", quotationStr, tmp, quotationStr);
taosMemoryFree(tmp);
} break;
- case TSDB_DATA_TYPE_VARBINARY:{
- void* tmp = NULL;
+ case TSDB_DATA_TYPE_VARBINARY: {
+ void *tmp = NULL;
uint32_t size = 0;
- if(taosAscii2Hex(val, length, &tmp, &size) < 0){
+ if (taosAscii2Hex(val, length, &tmp, &size) < 0) {
break;
}
taosFprintfFile(pFile, "%s%s%s", quotationStr, tmp, quotationStr);
taosMemoryFree(tmp);
break;
}
- case TSDB_DATA_TYPE_GEOMETRY:{
- char* tmp = (char*)taosMemoryCalloc(length * 2 + 1, 1);
- if(tmp == NULL) 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);
@@ -635,12 +635,12 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
return;
}
- int n = 0;
-#define LENGTH 64
+ 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);
+ shellPrintString(((((int32_t)(*((char *)val))) == TSDB_FALSE) ? "false" : "true"), width);
break;
case TSDB_DATA_TYPE_TINYINT:
printf("%*d", width, *((int8_t *)val));
@@ -680,7 +680,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
break;
case TSDB_DATA_TYPE_DOUBLE:
if (tsEnableScience) {
- snprintf(buf, LENGTH, "%*.15e", width,GET_DOUBLE_VAL(val));
+ snprintf(buf, LENGTH, "%*.15e", width, GET_DOUBLE_VAL(val));
printf("%s", buf);
} else {
n = snprintf(buf, LENGTH, "%*.15f", width, GET_DOUBLE_VAL(val));
@@ -691,10 +691,10 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
}
}
break;
- case TSDB_DATA_TYPE_VARBINARY:{
- void* data = NULL;
+ case TSDB_DATA_TYPE_VARBINARY: {
+ void *data = NULL;
uint32_t size = 0;
- if(taosAscii2Hex(val, length, &data, &size) < 0){
+ if (taosAscii2Hex(val, length, &data, &size) < 0) {
break;
}
shellPrintNChar(data, size, width);
@@ -867,7 +867,7 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) {
} else {
return TMAX(field->bytes + 2, width);
}
- case TSDB_DATA_TYPE_VARBINARY:{
+ case TSDB_DATA_TYPE_VARBINARY: {
int32_t bytes = field->bytes * 2 + 2;
if (bytes > shell.args.displayWidth) {
return TMAX(shell.args.displayWidth, width);
@@ -1121,8 +1121,9 @@ void shellSourceFile(const char *file) {
char *line = taosMemoryMalloc(TSDB_MAX_ALLOWED_SQL_LEN + 1);
while ((read_len = taosGetsFile(pFile, TSDB_MAX_ALLOWED_SQL_LEN, line)) > 0) {
- if ( cmd_len + read_len >= TSDB_MAX_ALLOWED_SQL_LEN) {
- printf("read command line too long over 1M, ignore this line. cmd_len = %d read_len=%d \n", (int32_t)cmd_len, read_len);
+ if (cmd_len + read_len >= TSDB_MAX_ALLOWED_SQL_LEN) {
+ printf("read command line too long over 1M, ignore this line. cmd_len = %d read_len=%d \n", (int32_t)cmd_len,
+ read_len);
cmd_len = 0;
memset(line, 0, TSDB_MAX_ALLOWED_SQL_LEN + 1);
continue;
@@ -1156,7 +1157,7 @@ void shellSourceFile(const char *file) {
taosCloseFile(&pFile);
}
-bool shellGetGrantInfo(char* buf) {
+bool shellGetGrantInfo(char *buf) {
bool community = true;
char sinfo[256] = {0};
tstrncpy(sinfo, taos_get_server_info(shell.conn), sizeof(sinfo));
@@ -1207,8 +1208,7 @@ bool shellGetGrantInfo(char* buf) {
sprintf(buf, "Server is %s, %s and will never expire.\r\n", serverVersion, sinfo);
} else {
community = false;
- sprintf(buf, "Server is %s, %s and will expire at %s.\r\n", serverVersion, sinfo,
- expiretime);
+ sprintf(buf, "Server is %s, %s and will expire at %s.\r\n", serverVersion, sinfo, expiretime);
}
taos_free_result(tres);
@@ -1324,13 +1324,13 @@ int32_t shellExecute() {
shellSetConn(shell.conn, runOnce);
shellReadHistory();
- if(shell.args.is_bi_mode) {
- // need set bi mode
- printf("Set BI mode is true.\n");
+ if (shell.args.is_bi_mode) {
+ // need set bi mode
+ printf("Set BI mode is true.\n");
#ifndef WEBSOCKET
taos_set_conn_mode(shell.conn, TAOS_CONN_MODE_BI, 1);
#endif
- }
+ }
if (runOnce) {
if (pArgs->commands != NULL) {
@@ -1373,22 +1373,22 @@ int32_t shellExecute() {
#ifdef WEBSOCKET
if (!shell.args.restful && !shell.args.cloud) {
#endif
-char* buf = taosMemoryMalloc(512);
-bool community = shellGetGrantInfo(buf);
+ char *buf = taosMemoryMalloc(512);
+ bool community = shellGetGrantInfo(buf);
#ifndef WINDOWS
printfIntroduction(community);
#else
#ifndef WEBSOCKET
- if(community) {
+ if (community) {
showAD(false);
}
-#endif
#endif
-// printf version
-if(!community) {
- printf("%s\n", buf);
-}
-taosMemoryFree(buf);
+#endif
+ // printf version
+ if (!community) {
+ printf("%s\n", buf);
+ }
+ taosMemoryFree(buf);
#ifdef WEBSOCKET
}
@@ -1407,7 +1407,7 @@ taosMemoryFree(buf);
if (community) {
showAD(true);
}
-#endif
+#endif
taosThreadJoin(spid, NULL);
diff --git a/tools/shell/src/shellMain.c b/tools/shell/src/shellMain.c
index d3ca60ab87..71acf23e41 100644
--- a/tools/shell/src/shellMain.c
+++ b/tools/shell/src/shellMain.c
@@ -50,12 +50,14 @@ int main(int argc, char *argv[]) {
shell.args.local = false;
#endif
+#if 0
#if !defined(WINDOWS)
taosSetSignal(SIGBUS, shellCrashHandler);
#endif
taosSetSignal(SIGABRT, shellCrashHandler);
taosSetSignal(SIGFPE, shellCrashHandler);
taosSetSignal(SIGSEGV, shellCrashHandler);
+#endif
if (shellCheckIntSize() != 0) {
return -1;