diff --git a/cmake/cmake.define b/cmake/cmake.define index 542b4b4489..a739a77d21 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.0) set(CMAKE_VERBOSE_MAKEFILE OFF) +set(TD_BUILD_TAOSA_INTERNAL FALSE) #set output directory SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib) @@ -141,13 +142,13 @@ ELSE () SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") ENDIF() - IF (COMPILER_SUPPORT_FMA) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") - ENDIF() IF ("${SIMD_SUPPORT}" MATCHES "true") - IF (COMPILER_SUPPORT_AVX) + IF (COMPILER_SUPPORT_FMA) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") + ENDIF() + IF (COMPILER_SUPPORT_AVX) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") ENDIF() diff --git a/cmake/cmake.install b/cmake/cmake.install index fd1e080dda..67634625ce 100644 --- a/cmake/cmake.install +++ b/cmake/cmake.install @@ -21,7 +21,7 @@ IF (TD_LINUX) ELSEIF (TD_WINDOWS) SET(TD_MAKE_INSTALL_SH "${TD_SOURCE_DIR}/packaging/tools/make_install.bat") INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")") - INSTALL(CODE "execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER})") + INSTALL(CODE "execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER} ${TD_BUILD_TAOSA_INTERNAL})") ELSEIF (TD_DARWIN) SET(TD_MAKE_INSTALL_SH "${TD_SOURCE_DIR}/packaging/tools/make_install.sh") INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")") diff --git a/cmake/cmake.version b/cmake/cmake.version index b4084bd095..f43465bf1d 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.2.0") + SET(TD_VER_NUMBER "3.0.2.1") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index a47b3b0feb..3e2e879e38 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG f0c1753 + GIT_TAG a2e9920 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md index 0aec22fbc0..c3c7e5928b 100644 --- a/docs/en/12-taos-sql/02-database.md +++ b/docs/en/12-taos-sql/02-database.md @@ -30,6 +30,8 @@ database_option: { | WAL_LEVEL {1 | 2} | VGROUPS value | SINGLE_STABLE {0 | 1} + | TABLE_PREFIX value + | TABLE_SUFFIX value | WAL_RETENTION_PERIOD value | WAL_ROLL_PERIOD value | WAL_RETENTION_SIZE value @@ -67,6 +69,8 @@ database_option: { - SINGLE_STABLE: specifies whether the database can contain more than one supertable. - 0: The database can contain multiple supertables. - 1: The database can contain only one supertable. +- TABLE_PREFIX:The prefix length in the table name that is ignored when distributing table to vnode based on table name. +- TABLE_SUFFIX:The suffix length in the table name that is ignored when distributing table to vnode based on table name. - WAL_RETENTION_PERIOD: specifies the time after which WAL files are deleted. This parameter is used for data subscription. Enter a time in seconds. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is 4 days. - WAL_RETENTION_SIZE: specifies the size at which WAL files are deleted. This parameter is used for data subscription. Enter a size in KB. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is -1. - WAL_ROLL_PERIOD: specifies the time after which WAL files are rotated. After this period elapses, a new WAL file is created. The default value of single copy is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk. The default values of multiple copy is 1 day. diff --git a/docs/en/12-taos-sql/20-keywords.md b/docs/en/12-taos-sql/20-keywords.md index 4b479b866b..23f85947e3 100644 --- a/docs/en/12-taos-sql/20-keywords.md +++ b/docs/en/12-taos-sql/20-keywords.md @@ -17,6 +17,7 @@ The following list shows all reserved keywords: - ADD - AFTER - AGGREGATE +- ALIVE - ALL - ALTER - ANALYZE diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md index 08e8df6252..2db3e7cb31 100644 --- a/docs/en/12-taos-sql/24-show.md +++ b/docs/en/12-taos-sql/24-show.md @@ -178,76 +178,138 @@ SHOW TABLE DISTRIBUTED table_name; Shows how table data is distributed. -Examples: show table distributed d0\G; Display the block distribution of table `d0` in detailed format. +Examples: Below is an example of this command to display the block distribution of table `d0` in detailed format. +```sql +show table distributed d0\G; +``` + +
+ Show Example +

 *************************** 1.row ***************************
 _block_dist: Total_Blocks=[5] Total_Size=[93.65 Kb] Average_size=[18.73 Kb] Compression_Ratio=[23.98 %]
 
 Total_Blocks :  Table `d0` contains total 5 blocks
+
 Total_Size:  The total size of all the data blocks in table `d0` is 93.65 KB 
+
 Average_size:  The average size of each block is 18.73 KB
+
 Compression_Ratio: The data compression rate is 23.98%
  
 *************************** 2.row ***************************
 _block_dist: Total_Rows=[20000] Inmem_Rows=[0] MinRows=[3616] MaxRows=[4096] Average_Rows=[4000]
 
 Total_Rows: Table `d0` contains 20,000 rows
+
 Inmem_Rows: The rows still in memory, i.e. not committed in disk, is 0, i.e. none such rows
+
 MinRows:  The minimum number of rows in a block is 3,616 
+
 MaxRows: The maximum number of rows in a block is 4,096B
+
 Average_Rows: The average number of rows in a block is 4,000
 
 *************************** 3.row ***************************
 _block_dist: Total_Tables=[1] Total_Files=[2]
 
 Total_Tables:  The number of child tables, 1 in this example
+
 Total_Files:   The number of files storing the table's data, 2 in this example
 
 *************************** 4.row ***************************
+
 _block_dist: --------------------------------------------------------------------------------
+
 *************************** 5.row ***************************
+
 _block_dist: 0100 |
+
 *************************** 6.row ***************************
+
 _block_dist: 0299 |
+
 *************************** 7.row ***************************
+
 _block_dist: 0498 |
+
 *************************** 8.row ***************************
+
 _block_dist: 0697 |
+
 *************************** 9.row ***************************
+
 _block_dist: 0896 |
+
 *************************** 10.row ***************************
+
 _block_dist: 1095 |
+
 *************************** 11.row ***************************
+
 _block_dist: 1294 |
+
 *************************** 12.row ***************************
+
 _block_dist: 1493 |
+
 *************************** 13.row ***************************
+
 _block_dist: 1692 |
+
 *************************** 14.row ***************************
+
 _block_dist: 1891 |
+
 *************************** 15.row ***************************
+
 _block_dist: 2090 |
+
 *************************** 16.row ***************************
+
 _block_dist: 2289 |
+
 *************************** 17.row ***************************
+
 _block_dist: 2488 |
+
 *************************** 18.row ***************************
+
 _block_dist: 2687 |
+
 *************************** 19.row ***************************
+
 _block_dist: 2886 |
+
 *************************** 20.row ***************************
+
 _block_dist: 3085 |
+
 *************************** 21.row ***************************
+
 _block_dist: 3284 |
+
 *************************** 22.row ***************************
+
 _block_dist: 3483 |||||||||||||||||  1 (20.00%)
+
 *************************** 23.row ***************************
+
 _block_dist: 3682 |
+
 *************************** 24.row ***************************
+
 _block_dist: 3881 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  4 (80.00%)
+
 Query OK, 24 row(s) in set (0.002444s)
 
-  The above show the block distribution percentage according to the number of rows in each block. In the above example, `_block_dist: 3483 |||||||||||||||||  1 (20.00%)` means there is one block whose rows is between 3,483 and 3,681. `_block_dist: 3881 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096. The number of blocks whose rows fall in other range is zero.
+
+
+ + The above show the block distribution percentage according to the number of rows in each block. In the above example, we can get below information: + - `_block_dist: 3483 ||||||||||||||||| 1 (20.00%)` means there is one block whose rows is between 3,483 and 3,681. + - `_block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096. - The number of blocks whose rows fall in other range is zero. ## SHOW TAGS diff --git a/docs/en/14-reference/04-taosadapter.md b/docs/en/14-reference/04-taosadapter.md index 870cebb103..9eb6cb9213 100644 --- a/docs/en/14-reference/04-taosadapter.md +++ b/docs/en/14-reference/04-taosadapter.md @@ -21,6 +21,7 @@ taosAdapter provides the following features. - Seamless connection to collectd - Seamless connection to StatsD - Supports Prometheus remote_read and remote_write +- Get table's VGroup ID ## taosAdapter architecture diagram @@ -178,6 +179,7 @@ See [example/config/taosadapter.toml](https://github.com/taosdata/taosadapter/bl node_export is an exporter for machine metrics. Please visit [https://github.com/prometheus/node_exporter](https://github.com/prometheus/node_exporter) for more information. - Support for Prometheus remote_read and remote_write remote_read and remote_write are interfaces for Prometheus data read and write from/to other data storage solution. Please visit [https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis](https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis) for more information. +- Get table's VGroup ID. For more information about VGroup, please refer to [primary-logic-unit](/tdinternal/arch/#primary-logic-unit). ## Interfaces @@ -199,7 +201,7 @@ Support InfluxDB query parameters as follows. - `precision` The time precision used by TDengine - `u` TDengine user name - `p` TDengine password -- `ttl` The time to live of automatically created sub-table. This value cannot be updated. TDengine will use the ttl value of the frist data of sub-table to create sub-table. For more information, please refer [Create Table](/taos-sql/table/#create-table) +- `ttl` The time to live of automatically created sub-table. This value cannot be updated. TDengine will use the ttl value of the first data of sub-table to create sub-table. For more information, please refer [Create Table](/taos-sql/table/#create-table) Note: InfluxDB token authorization is not supported at present. Only Basic authorization and query parameter validation are supported. Example: curl --request POST http://127.0.0.1:6041/influxdb/v1/write?db=test --user "root:taosdata" --data-binary "measurement,host=host1 field1=2i,field2=2.0 1577836800000000000" @@ -241,6 +243,10 @@ node_export is an exporter of hardware and OS metrics exposed by the \*NIX kerne +### Get table's VGroup ID + +You can call `http://:6041/rest/vgid?db=&table=` to get table's VGroup ID. For more information about VGroup, please refer to [primary-logic-unit](/tdinternal/arch/#primary-logic-unit). + ## Memory usage optimization methods taosAdapter will monitor its memory usage during operation and adjust it with two thresholds. Valid values are integers between 1 to 100, and represent a percentage of the system's physical memory. diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index bcfcaf9ffb..9b83c5fd65 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.2.2 + + + ## 3.0.2.1 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 6013aacc35..dd44e43ab6 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.0 + + + ## 2.3.3 diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index 232a6c7326..df52a0890b 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -30,6 +30,8 @@ database_option: { | WAL_LEVEL {1 | 2} | VGROUPS value | SINGLE_STABLE {0 | 1} + | TABLE_PREFIX value + | TABLE_SUFFIX value | WAL_RETENTION_PERIOD value | WAL_ROLL_PERIOD value | WAL_RETENTION_SIZE value @@ -67,6 +69,8 @@ database_option: { - SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表,用于超级表列非常多的情况。 - 0:表示可以创建多张超级表。 - 1:表示只可以创建一张超级表。 +- TABLE_PREFIX:内部存储引擎根据表名分配存储该表数据的 VNODE 时要忽略的前缀的长度。 +- TABLE_SUFFIX:内部存储引擎根据表名分配存储该表数据的 VNODE 时要忽略的后缀的长度。 - WAL_RETENTION_PERIOD:wal 文件的额外保留策略,用于数据订阅。wal 的保存时长,单位为 s。单副本默认为 0,即落盘后立即删除。-1 表示不删除。多副本默认为 4 天。 - WAL_RETENTION_SIZE:wal 文件的额外保留策略,用于数据订阅。wal 的保存的最大上限,单位为 KB。单副本默认为 0,即落盘后立即删除。多副本默认为-1,表示不删除。 - WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当 wal 文件创建并写入后,经过该时间,会自动创建一个新的 wal 文件。单副本默认为 0,即仅在落盘时创建新文件。多副本默认为 1 天。 diff --git a/docs/zh/12-taos-sql/20-keywords.md b/docs/zh/12-taos-sql/20-keywords.md index 8013698fce..8fd704ef55 100644 --- a/docs/zh/12-taos-sql/20-keywords.md +++ b/docs/zh/12-taos-sql/20-keywords.md @@ -18,6 +18,7 @@ description: TDengine 保留关键字的详细列表 - ADD - AFTER - AGGREGATE +- ALIVE - ALL - ALTER - ANALYZE diff --git a/docs/zh/12-taos-sql/24-show.md b/docs/zh/12-taos-sql/24-show.md index a65746e7f9..2b875199b5 100644 --- a/docs/zh/12-taos-sql/24-show.md +++ b/docs/zh/12-taos-sql/24-show.md @@ -183,6 +183,10 @@ SHOW TABLE DISTRIBUTED table_name; 语句: show table distributed d0\G; 竖行显示表 d0 的 BLOCK 分布情况 +
+ 显示示例 +

+
 *************************** 1.row ***************************
 
 _block_dist: Total_Blocks=[5] Total_Size=[93.65 Kb] Average_size=[18.73 Kb] Compression_Ratio=[23.98 %]
@@ -244,6 +248,8 @@ _block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 Query OK, 24 row(s) in set (0.002444s)
 
+
+
上面是块中包含数据行数的块儿分布情况图,这里的 0100 0299 0498 … 表示的是每个块中包含的数据行数,上面的意思就是这个表的 5 个块,分布在 3483 ~3681 行的块有 1 个,占整个块的 20%,分布在 3881 ~ 4096(最大行数)的块数为 4 个,占整个块的 80%, 其它区域内分布块数为 0。 diff --git a/docs/zh/12-taos-sql/29-changes.md b/docs/zh/12-taos-sql/29-changes.md index 1ab7f4f016..1e421f95e1 100644 --- a/docs/zh/12-taos-sql/29-changes.md +++ b/docs/zh/12-taos-sql/29-changes.md @@ -94,6 +94,7 @@ description: "TDengine 3.0 版本的语法变更说明" | 9 | SAMPLE | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。 | 10 | STATECOUNT | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。 | 11 | STATEDURATION | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。 +| 12 | TIMETRUNCATE | 增强 | 增加ignore_timezone参数,可选是否使用,默认值为1. ## SCHEMALESS 变更 diff --git a/docs/zh/14-reference/04-taosadapter.md b/docs/zh/14-reference/04-taosadapter.md index 0909ddf639..5c155bdd6e 100644 --- a/docs/zh/14-reference/04-taosadapter.md +++ b/docs/zh/14-reference/04-taosadapter.md @@ -21,6 +21,7 @@ taosAdapter 提供以下功能: - 无缝连接到 collectd - 无缝连接到 StatsD - 支持 Prometheus remote_read 和 remote_write +- 获取 table 所在的虚拟节点组(VGroup)的 VGroup ID ## taosAdapter 架构图 @@ -178,6 +179,7 @@ AllowWebSockets node_export 是一个机器指标的导出器。请访问 [https://github.com/prometheus/node_exporter](https://github.com/prometheus/node_exporter) 了解更多信息。 - 支持 Prometheus remote_read 和 remote_write remote_read 和 remote_write 是 Prometheus 数据读写分离的集群方案。请访问[https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis](https://prometheus.io/blog/2019/10/10/remote-read-meets-streaming/#remote-apis) 了解更多信息。 +- 获取 table 所在的虚拟节点组(VGroup)的 VGroup ID。关于虚拟节点组(VGroup)的更多信息,请访问[整体架构文档](/tdinternal/arch/#主要逻辑单元) 。 ## 接口 @@ -240,6 +242,10 @@ Prometheus 使用的由 \*NIX 内核暴露的硬件和操作系统指标的输 +### 获取 table 的 VGroup ID + +可以访问 http 接口 `http://:6041/rest/vgid?db=&table=
` 获取 table 的 VGroup ID。关于虚拟节点组(VGroup)的更多信息,请访问[整体架构文档](/tdinternal/arch/#主要逻辑单元) 。 + ## 内存使用优化方法 taosAdapter 将监测自身运行过程中内存使用率并通过两个阈值进行调节。有效值范围为 -1 到 100 的整数,单位为系统物理内存的百分比。 @@ -282,7 +288,7 @@ http 返回内容: ## taosAdapter 监控指标 -taosAdapter 采集 http 相关指标、cpu 百分比和内存百分比。 +taosAdapter 采集 http 相关指标、CPU 百分比和内存百分比。 ### http 接口 @@ -294,13 +300,13 @@ http://:6041/metrics ### 写入 TDengine -taosAdapter 支持将 http 监控、cpu 百分比和内存百分比写入 TDengine。 +taosAdapter 支持将 http 监控、CPU 百分比和内存百分比写入 TDengine。 有关配置参数 | **配置项** | **描述** | **默认值** | |-------------------------|--------------------------------------------|----------| -| monitor.collectDuration | cpu 和内存采集间隔 | 3s | +| monitor.collectDuration | CPU 和内存采集间隔 | 3s | | monitor.identity | 当前taosadapter 的标识符如果不设置将使用 'hostname:port' | | | monitor.incgroup | 是否是 cgroup 中运行(容器中运行设置为 true) | false | | monitor.writeToTD | 是否写入到 TDengine | false | diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index 0fe6555162..e19b2133e4 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.2.2 + + + ## 3.0.2.1 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 331f6832c0..b2ead5b264 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.0 + + + ## 2.3.3 diff --git a/include/common/taosdef.h b/include/common/taosdef.h index bf4de9d4de..d1ca446904 100644 --- a/include/common/taosdef.h +++ b/include/common/taosdef.h @@ -30,6 +30,11 @@ typedef int64_t tb_uid_t; #define IS_TSWINDOW_SPECIFIED(win) (((win).skey != INT64_MIN) || ((win).ekey != INT64_MAX)) #define TSWINDOW_IS_EQUAL(t1, t2) (((t1).skey == (t2).skey) && ((t1).ekey == (t2).ekey)) +//define show cluster alive and show db.alive +#define SHOW_STATUS_NOT_AVAILABLE 0 +#define SHOW_STATUS_AVAILABLE 1 +#define SHOW_STATUS_HALF_AVAILABLE 2 + typedef enum { TSDB_SUPER_TABLE = 1, // super table TSDB_CHILD_TABLE = 2, // table created from super table diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 9ecbd2f839..2643273555 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -292,6 +292,7 @@ typedef struct STableBlockDistInfo { uint16_t numOfFiles; uint32_t numOfTables; uint32_t numOfBlocks; + uint32_t numOfVgroups; uint64_t totalSize; uint64_t totalRows; int32_t maxRows; diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 9e8a139b31..d445fc26e8 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -55,7 +55,7 @@ extern int32_t tsNumOfMnodeQueryThreads; extern int32_t tsNumOfMnodeFetchThreads; extern int32_t tsNumOfMnodeReadThreads; extern int32_t tsNumOfVnodeQueryThreads; -extern int32_t tsNumOfVnodeStreamThreads; +extern float tsRatioOfVnodeStreamThreads; extern int32_t tsNumOfVnodeFetchThreads; extern int32_t tsNumOfVnodeRsmaThreads; extern int32_t tsNumOfQnodeQueryThreads; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 603d6cfd67..800f9e2eb7 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1751,6 +1751,8 @@ typedef struct { #define STREAM_FILL_HISTORY_ON 1 #define STREAM_FILL_HISTORY_OFF 0 #define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF +#define STREAM_CREATE_STABLE_TRUE 1 +#define STREAM_CREATE_STABLE_FALSE 0 typedef struct { char name[TSDB_STREAM_FNAME_LEN]; @@ -1768,6 +1770,8 @@ typedef struct { SArray* pTags; // array of SField // 3.0.20 int64_t checkpointFreq; // ms + // 3.0.2.3 + int8_t createStb; } SCMCreateStreamReq; typedef struct { diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 04970ccc34..597371d9d1 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -175,171 +175,172 @@ #define TK_CONSUMERS 157 #define TK_SUBSCRIPTIONS 158 #define TK_VNODES 159 -#define TK_LIKE 160 -#define TK_TBNAME 161 -#define TK_QTAGS 162 -#define TK_AS 163 -#define TK_INDEX 164 -#define TK_FUNCTION 165 -#define TK_INTERVAL 166 -#define TK_COUNT 167 -#define TK_LAST_ROW 168 -#define TK_TOPIC 169 -#define TK_WITH 170 -#define TK_META 171 -#define TK_CONSUMER 172 -#define TK_GROUP 173 -#define TK_DESC 174 -#define TK_DESCRIBE 175 -#define TK_RESET 176 -#define TK_QUERY 177 -#define TK_CACHE 178 -#define TK_EXPLAIN 179 -#define TK_ANALYZE 180 -#define TK_VERBOSE 181 -#define TK_NK_BOOL 182 -#define TK_RATIO 183 -#define TK_NK_FLOAT 184 -#define TK_OUTPUTTYPE 185 -#define TK_AGGREGATE 186 -#define TK_BUFSIZE 187 -#define TK_STREAM 188 -#define TK_INTO 189 -#define TK_TRIGGER 190 -#define TK_AT_ONCE 191 -#define TK_WINDOW_CLOSE 192 -#define TK_IGNORE 193 -#define TK_EXPIRED 194 -#define TK_FILL_HISTORY 195 -#define TK_SUBTABLE 196 -#define TK_KILL 197 -#define TK_CONNECTION 198 -#define TK_TRANSACTION 199 -#define TK_BALANCE 200 -#define TK_VGROUP 201 -#define TK_MERGE 202 -#define TK_REDISTRIBUTE 203 -#define TK_SPLIT 204 -#define TK_DELETE 205 -#define TK_INSERT 206 -#define TK_NULL 207 -#define TK_NK_QUESTION 208 -#define TK_NK_ARROW 209 -#define TK_ROWTS 210 -#define TK_QSTART 211 -#define TK_QEND 212 -#define TK_QDURATION 213 -#define TK_WSTART 214 -#define TK_WEND 215 -#define TK_WDURATION 216 -#define TK_IROWTS 217 -#define TK_ISFILLED 218 -#define TK_CAST 219 -#define TK_NOW 220 -#define TK_TODAY 221 -#define TK_TIMEZONE 222 -#define TK_CLIENT_VERSION 223 -#define TK_SERVER_VERSION 224 -#define TK_SERVER_STATUS 225 -#define TK_CURRENT_USER 226 -#define TK_CASE 227 -#define TK_END 228 -#define TK_WHEN 229 -#define TK_THEN 230 -#define TK_ELSE 231 -#define TK_BETWEEN 232 -#define TK_IS 233 -#define TK_NK_LT 234 -#define TK_NK_GT 235 -#define TK_NK_LE 236 -#define TK_NK_GE 237 -#define TK_NK_NE 238 -#define TK_MATCH 239 -#define TK_NMATCH 240 -#define TK_CONTAINS 241 -#define TK_IN 242 -#define TK_JOIN 243 -#define TK_INNER 244 -#define TK_SELECT 245 -#define TK_DISTINCT 246 -#define TK_WHERE 247 -#define TK_PARTITION 248 -#define TK_BY 249 -#define TK_SESSION 250 -#define TK_STATE_WINDOW 251 -#define TK_EVENT_WINDOW 252 -#define TK_START 253 -#define TK_SLIDING 254 -#define TK_FILL 255 -#define TK_VALUE 256 -#define TK_NONE 257 -#define TK_PREV 258 -#define TK_LINEAR 259 -#define TK_NEXT 260 -#define TK_HAVING 261 -#define TK_RANGE 262 -#define TK_EVERY 263 -#define TK_ORDER 264 -#define TK_SLIMIT 265 -#define TK_SOFFSET 266 -#define TK_LIMIT 267 -#define TK_OFFSET 268 -#define TK_ASC 269 -#define TK_NULLS 270 -#define TK_ABORT 271 -#define TK_AFTER 272 -#define TK_ATTACH 273 -#define TK_BEFORE 274 -#define TK_BEGIN 275 -#define TK_BITAND 276 -#define TK_BITNOT 277 -#define TK_BITOR 278 -#define TK_BLOCKS 279 -#define TK_CHANGE 280 -#define TK_COMMA 281 -#define TK_COMPACT 282 -#define TK_CONCAT 283 -#define TK_CONFLICT 284 -#define TK_COPY 285 -#define TK_DEFERRED 286 -#define TK_DELIMITERS 287 -#define TK_DETACH 288 -#define TK_DIVIDE 289 -#define TK_DOT 290 -#define TK_EACH 291 -#define TK_FAIL 292 -#define TK_FILE 293 -#define TK_FOR 294 -#define TK_GLOB 295 -#define TK_ID 296 -#define TK_IMMEDIATE 297 -#define TK_IMPORT 298 -#define TK_INITIALLY 299 -#define TK_INSTEAD 300 -#define TK_ISNULL 301 -#define TK_KEY 302 -#define TK_MODULES 303 -#define TK_NK_BITNOT 304 -#define TK_NK_SEMI 305 -#define TK_NOTNULL 306 -#define TK_OF 307 -#define TK_PLUS 308 -#define TK_PRIVILEGE 309 -#define TK_RAISE 310 -#define TK_REPLACE 311 -#define TK_RESTRICT 312 -#define TK_ROW 313 -#define TK_SEMI 314 -#define TK_STAR 315 -#define TK_STATEMENT 316 -#define TK_STRICT 317 -#define TK_STRING 318 -#define TK_TIMES 319 -#define TK_UPDATE 320 -#define TK_VALUES 321 -#define TK_VARIABLE 322 -#define TK_VIEW 323 -#define TK_WAL 324 +#define TK_ALIVE 160 +#define TK_LIKE 161 +#define TK_TBNAME 162 +#define TK_QTAGS 163 +#define TK_AS 164 +#define TK_INDEX 165 +#define TK_FUNCTION 166 +#define TK_INTERVAL 167 +#define TK_COUNT 168 +#define TK_LAST_ROW 169 +#define TK_TOPIC 170 +#define TK_WITH 171 +#define TK_META 172 +#define TK_CONSUMER 173 +#define TK_GROUP 174 +#define TK_DESC 175 +#define TK_DESCRIBE 176 +#define TK_RESET 177 +#define TK_QUERY 178 +#define TK_CACHE 179 +#define TK_EXPLAIN 180 +#define TK_ANALYZE 181 +#define TK_VERBOSE 182 +#define TK_NK_BOOL 183 +#define TK_RATIO 184 +#define TK_NK_FLOAT 185 +#define TK_OUTPUTTYPE 186 +#define TK_AGGREGATE 187 +#define TK_BUFSIZE 188 +#define TK_STREAM 189 +#define TK_INTO 190 +#define TK_TRIGGER 191 +#define TK_AT_ONCE 192 +#define TK_WINDOW_CLOSE 193 +#define TK_IGNORE 194 +#define TK_EXPIRED 195 +#define TK_FILL_HISTORY 196 +#define TK_SUBTABLE 197 +#define TK_KILL 198 +#define TK_CONNECTION 199 +#define TK_TRANSACTION 200 +#define TK_BALANCE 201 +#define TK_VGROUP 202 +#define TK_MERGE 203 +#define TK_REDISTRIBUTE 204 +#define TK_SPLIT 205 +#define TK_DELETE 206 +#define TK_INSERT 207 +#define TK_NULL 208 +#define TK_NK_QUESTION 209 +#define TK_NK_ARROW 210 +#define TK_ROWTS 211 +#define TK_QSTART 212 +#define TK_QEND 213 +#define TK_QDURATION 214 +#define TK_WSTART 215 +#define TK_WEND 216 +#define TK_WDURATION 217 +#define TK_IROWTS 218 +#define TK_ISFILLED 219 +#define TK_CAST 220 +#define TK_NOW 221 +#define TK_TODAY 222 +#define TK_TIMEZONE 223 +#define TK_CLIENT_VERSION 224 +#define TK_SERVER_VERSION 225 +#define TK_SERVER_STATUS 226 +#define TK_CURRENT_USER 227 +#define TK_CASE 228 +#define TK_END 229 +#define TK_WHEN 230 +#define TK_THEN 231 +#define TK_ELSE 232 +#define TK_BETWEEN 233 +#define TK_IS 234 +#define TK_NK_LT 235 +#define TK_NK_GT 236 +#define TK_NK_LE 237 +#define TK_NK_GE 238 +#define TK_NK_NE 239 +#define TK_MATCH 240 +#define TK_NMATCH 241 +#define TK_CONTAINS 242 +#define TK_IN 243 +#define TK_JOIN 244 +#define TK_INNER 245 +#define TK_SELECT 246 +#define TK_DISTINCT 247 +#define TK_WHERE 248 +#define TK_PARTITION 249 +#define TK_BY 250 +#define TK_SESSION 251 +#define TK_STATE_WINDOW 252 +#define TK_EVENT_WINDOW 253 +#define TK_START 254 +#define TK_SLIDING 255 +#define TK_FILL 256 +#define TK_VALUE 257 +#define TK_NONE 258 +#define TK_PREV 259 +#define TK_LINEAR 260 +#define TK_NEXT 261 +#define TK_HAVING 262 +#define TK_RANGE 263 +#define TK_EVERY 264 +#define TK_ORDER 265 +#define TK_SLIMIT 266 +#define TK_SOFFSET 267 +#define TK_LIMIT 268 +#define TK_OFFSET 269 +#define TK_ASC 270 +#define TK_NULLS 271 +#define TK_ABORT 272 +#define TK_AFTER 273 +#define TK_ATTACH 274 +#define TK_BEFORE 275 +#define TK_BEGIN 276 +#define TK_BITAND 277 +#define TK_BITNOT 278 +#define TK_BITOR 279 +#define TK_BLOCKS 280 +#define TK_CHANGE 281 +#define TK_COMMA 282 +#define TK_COMPACT 283 +#define TK_CONCAT 284 +#define TK_CONFLICT 285 +#define TK_COPY 286 +#define TK_DEFERRED 287 +#define TK_DELIMITERS 288 +#define TK_DETACH 289 +#define TK_DIVIDE 290 +#define TK_DOT 291 +#define TK_EACH 292 +#define TK_FAIL 293 +#define TK_FILE 294 +#define TK_FOR 295 +#define TK_GLOB 296 +#define TK_ID 297 +#define TK_IMMEDIATE 298 +#define TK_IMPORT 299 +#define TK_INITIALLY 300 +#define TK_INSTEAD 301 +#define TK_ISNULL 302 +#define TK_KEY 303 +#define TK_MODULES 304 +#define TK_NK_BITNOT 305 +#define TK_NK_SEMI 306 +#define TK_NOTNULL 307 +#define TK_OF 308 +#define TK_PLUS 309 +#define TK_PRIVILEGE 310 +#define TK_RAISE 311 +#define TK_REPLACE 312 +#define TK_RESTRICT 313 +#define TK_ROW 314 +#define TK_SEMI 315 +#define TK_STAR 316 +#define TK_STATEMENT 317 +#define TK_STRICT 318 +#define TK_STRING 319 +#define TK_TIMES 320 +#define TK_UPDATE 321 +#define TK_VALUES 322 +#define TK_VARIABLE 323 +#define TK_VIEW 324 +#define TK_WAL 325 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index a95db86d3f..0e2d043174 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -44,6 +44,7 @@ typedef enum { AUTH_TYPE_READ = 1, AUTH_TYPE_WRITE, AUTH_TYPE_OTHER, + AUTH_TYPE_READ_OR_WRITE, } AUTH_TYPE; typedef struct SUserAuthInfo { diff --git a/include/libs/command/command.h b/include/libs/command/command.h index b3339a417b..a8b1a0902a 100644 --- a/include/libs/command/command.h +++ b/include/libs/command/command.h @@ -22,7 +22,7 @@ typedef struct SExplainCtx SExplainCtx; -int32_t qExecCommand(bool sysInfoUser, SNode *pStmt, SRetrieveTableRsp **pRsp); +int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode *pStmt, SRetrieveTableRsp **pRsp); int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp); int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs); diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 4d9c0866c3..871dd60741 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -215,6 +215,7 @@ int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver); int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver); int32_t qStreamRecoverFinish(qTaskInfo_t tinfo); int32_t qStreamRestoreParam(qTaskInfo_t tinfo); +bool qStreamRecoverScanFinished(qTaskInfo_t tinfo); #ifdef __cplusplus } diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 66988ff135..d77f2b6233 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -40,6 +40,7 @@ extern "C" { #define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE) #define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) +#define SHOW_ALIVE_RESULT_COLS 1 #define PRIVILEGE_TYPE_MASK(n) (1 << n) #define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0) @@ -262,6 +263,11 @@ typedef struct SShowCreateDatabaseStmt { void* pCfg; // SDbCfgInfo } SShowCreateDatabaseStmt; +typedef struct SShowAliveStmt { + ENodeType type; + char dbName[TSDB_DB_NAME_LEN]; +} SShowAliveStmt; + typedef struct SShowCreateTableStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; @@ -295,7 +301,7 @@ typedef struct SShowTableTagsStmt { SNodeList* pTags; } SShowTableTagsStmt; -typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType; +typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT, INDEX_TYPE_NORMAL } EIndexType; typedef struct SIndexOptions { ENodeType type; @@ -401,6 +407,7 @@ typedef struct SCreateStreamStmt { SNode* pQuery; SNodeList* pTags; SNode* pSubtable; + SNodeList* pCols; } SCreateStreamStmt; typedef struct SDropStreamStmt { diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index e111f36077..24b436ec99 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -208,6 +208,8 @@ typedef enum ENodeType { QUERY_NODE_DELETE_STMT, QUERY_NODE_INSERT_STMT, QUERY_NODE_QUERY, + QUERY_NODE_SHOW_DB_ALIVE_STMT, + QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT, // logic plan node QUERY_NODE_LOGIC_PLAN_SCAN = 1000, diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 3f0fc048de..2d14391247 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -51,6 +51,7 @@ typedef struct SExprNode { char userAlias[TSDB_COL_NAME_LEN]; SArray* pAssociation; bool orderAlias; + bool asAlias; } SExprNode; typedef enum EColumnType { @@ -127,8 +128,7 @@ typedef struct SLogicConditionNode { } SLogicConditionNode; typedef struct SNodeListNode { - ENodeType type; // QUERY_NODE_NODE_LIST - SDataType dataType; + SExprNode node; // QUERY_NODE_NODE_LIST SNodeList* pNodeList; } SNodeListNode; diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 4bd23082c4..bbf332c4d4 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -286,7 +286,7 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_RESTORING || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR) #define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_MNODE_NOT_FOUND) -#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL) +#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) #define NEED_REDIRECT_ERROR(_code) \ (NO_RET_REDIRECT_ERROR(_code) || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \ diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index a2a512fb07..0f57da2b80 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -409,21 +409,6 @@ static FORCE_INLINE void streamTaskInputFail(SStreamTask* pTask) { atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__FAILED); } -static FORCE_INLINE int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBlock* pBlock) { - if (pTask->outputType == TASK_OUTPUT__TABLE) { - pTask->tbSink.tbSinkFunc(pTask, pTask->tbSink.vnode, 0, pBlock->blocks); - taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); - taosFreeQitem(pBlock); - } else if (pTask->outputType == TASK_OUTPUT__SMA) { - pTask->smaSink.smaSink(pTask->smaSink.vnode, pTask->smaSink.smaId, pBlock->blocks); - taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); - taosFreeQitem(pBlock); - } else { - taosWriteQitem(pTask->outputQueue->queue, pBlock); - } - return 0; -} - typedef struct { SMsgHead head; int64_t streamId; @@ -601,6 +586,7 @@ int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp); int32_t streamTryExec(SStreamTask* pTask); int32_t streamSchedExec(SStreamTask* pTask); +int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBlock* pBlock); int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz); diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index a13d203889..559dc1009d 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -153,10 +153,10 @@ typedef struct SSyncFSM { void (*FpBecomeFollowerCb)(const struct SSyncFSM* pFsm); int32_t (*FpGetSnapshot)(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot, void* pReaderParam, void** ppReader); - int32_t (*FpGetSnapshotInfo)(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot); + void (*FpGetSnapshotInfo)(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot); int32_t (*FpSnapshotStartRead)(const struct SSyncFSM* pFsm, void* pReaderParam, void** ppReader); - int32_t (*FpSnapshotStopRead)(const struct SSyncFSM* pFsm, void* pReader); + void (*FpSnapshotStopRead)(const struct SSyncFSM* pFsm, void* pReader); int32_t (*FpSnapshotDoRead)(const struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32_t* len); int32_t (*FpSnapshotStartWrite)(const struct SSyncFSM* pFsm, void* pWriterParam, void** ppWriter); diff --git a/include/os/osMemory.h b/include/os/osMemory.h index 4681ff6674..e6a4488287 100644 --- a/include/os/osMemory.h +++ b/include/os/osMemory.h @@ -22,12 +22,16 @@ extern "C" { // If the error is in a third-party library, place this header file under the third-party library header file. // When you want to use this feature, you should find or add the same function in the following sectio +#if !defined(WINDOWS) + #ifndef ALLOW_FORBID_FUNC #define malloc MALLOC_FUNC_TAOS_FORBID #define calloc CALLOC_FUNC_TAOS_FORBID #define realloc REALLOC_FUNC_TAOS_FORBID #define free FREE_FUNC_TAOS_FORBID -#endif +#endif // ifndef ALLOW_FORBID_FUNC + +#endif // if !defined(WINDOWS) void *taosMemoryMalloc(int64_t size); void *taosMemoryCalloc(int64_t num, int64_t size); diff --git a/include/os/osSysinfo.h b/include/os/osSysinfo.h index 7765a60f88..dbe4d6801e 100644 --- a/include/os/osSysinfo.h +++ b/include/os/osSysinfo.h @@ -70,6 +70,7 @@ typedef struct { SysNameInfo taosGetSysNameInfo(); bool taosCheckCurrentInDll(); +int taosGetlocalhostname(char *hostname, size_t maxLen); #ifdef __cplusplus } diff --git a/include/os/osSystem.h b/include/os/osSystem.h index 8f1f5c58d5..58f34d26f0 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -62,11 +62,38 @@ void taosResetTerminalMode(); taosMemoryFree(strings); \ } #else +#include +#include + +#define STACKSIZE 64 #define taosPrintTrace(flags, level, dflag) \ { \ - taosPrintLog(flags, level, dflag, \ - "backtrace not implemented on windows, so detailed stack information cannot be printed"); \ - } + unsigned int i; \ + void* stack[STACKSIZE]; \ + unsigned short frames; \ + SYMBOL_INFO* symbol; \ + HANDLE process; \ + \ + process = GetCurrentProcess(); \ + \ + SymInitialize(process, NULL, TRUE); \ + \ + frames = CaptureStackBackTrace(0, STACKSIZE, stack, NULL); \ + symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1); \ + if (symbol != NULL) { \ + symbol->MaxNameLen = 255; \ + symbol->SizeOfStruct = sizeof(SYMBOL_INFO); \ + \ + if (frames > 0) { \ + taosPrintLog(flags, level, dflag, "obtained %d stack frames", frames); \ + for (i = 0; i < frames; i++) { \ + SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \ + taosPrintLog(flags, level, dflag, "frame:%i: %s - 0x%0X", frames - i - 1, symbol->Name, symbol->Address); \ + } \ + } \ + free(symbol); \ + } \ + } #endif #ifdef __cplusplus diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 8c2816c854..1bfcae5681 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -65,6 +65,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017) // #define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018) // #define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) // +#define TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED TAOS_DEF_ERROR_CODE(0, 0x0020) // "Vgroup could not be connected" +#define TSDB_CODE_RPC_SOMENODE_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0021) // //common & util #define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) // @@ -204,9 +206,15 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_CANT_DROP_LEADER TAOS_DEF_ERROR_CODE(0, 0x0333) #define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0334) #define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0335) +// #define TSDB_CODE_MND_INVALID_DNODE_CFG_... TAOS_DEF_ERROR_CODE(0, 0x0336) // 2.x +// #define TSDB_CODE_MND_BALANCE_ENABLED TAOS_DEF_ERROR_CODE(0, 0x0337) // 2.x #define TSDB_CODE_MND_VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0338) #define TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0339) +// #define TSDB_CODE_MND_DNODE_NOT_FREE TAOS_DEF_ERROR_CODE(0, 0x033A) // 2.x #define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x033B) +// #define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x033C) // 2.x +// #define TSDB_CODE_MND_DNODE_ID_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033D) // 2.x +// #define TSDB_CODE_MND_DNODE_EP_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033E) // 2.x // mnode-acct #define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340) @@ -298,6 +306,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_VGROUP_UN_CHANGED TAOS_DEF_ERROR_CODE(0, 0x03B5) #define TSDB_CODE_MND_HAS_OFFLINE_DNODE TAOS_DEF_ERROR_CODE(0, 0x03B6) #define TSDB_CODE_MND_INVALID_REPLICA TAOS_DEF_ERROR_CODE(0, 0x03B7) +#define TSDB_CODE_MND_DNODE_IN_CREATING TAOS_DEF_ERROR_CODE(0, 0x03B8) +#define TSDB_CODE_MND_DNODE_IN_DROPPING TAOS_DEF_ERROR_CODE(0, 0x03B9) // mnode-stable-part2 #define TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03C0) @@ -318,6 +328,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D4) #define TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL TAOS_DEF_ERROR_CODE(0, 0x03D5) #define TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED TAOS_DEF_ERROR_CODE(0, 0x03D6) //internal +#define TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x03D7) #define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03DF) // mnode-mq @@ -509,6 +520,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912) #define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913) #define TSDB_CODE_SYN_RESTORING TAOS_DEF_ERROR_CODE(0, 0x0914) +#define TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG TAOS_DEF_ERROR_CODE(0, 0x0915) // internal +#define TSDB_CODE_SYN_BUFFER_FULL TAOS_DEF_ERROR_CODE(0, 0x0916) // #define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF) // tq diff --git a/include/util/tdef.h b/include/util/tdef.h index 7cd4f57771..4cf4f73b9b 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -255,7 +255,7 @@ typedef enum ELogicConditionType { #define TSDB_EP_LEN (TSDB_FQDN_LEN + 6) #define TSDB_IPv4ADDR_LEN 16 #define TSDB_FILENAME_LEN 128 -#define TSDB_SHOW_SQL_LEN 1024 +#define TSDB_SHOW_SQL_LEN 2048 #define TSDB_SLOW_QUERY_SQL_LEN 512 #define TSDB_SHOW_SUBQUERY_LEN 1000 diff --git a/include/util/tworker.h b/include/util/tworker.h index 8766f87a08..0636f16dbb 100644 --- a/include/util/tworker.h +++ b/include/util/tworker.h @@ -17,6 +17,7 @@ #define _TD_UTIL_WORKER_H_ #include "tqueue.h" +#include "tarray.h" #ifdef __cplusplus extern "C" { @@ -26,10 +27,10 @@ typedef struct SQWorkerPool SQWorkerPool; typedef struct SWWorkerPool SWWorkerPool; typedef struct SQWorker { - int32_t id; // worker id - int64_t pid; // thread pid - TdThread thread; // thread id - SQWorkerPool *pool; + int32_t id; // worker id + int64_t pid; // thread pid + TdThread thread; // thread id + void *pool; } SQWorker; typedef struct SQWorkerPool { @@ -42,6 +43,14 @@ typedef struct SQWorkerPool { TdThreadMutex mutex; } SQWorkerPool; +typedef struct SAutoQWorkerPool { + float ratio; + STaosQset *qset; + const char *name; + SArray *workers; + TdThreadMutex mutex; +} SAutoQWorkerPool; + typedef struct SWWorker { int32_t id; // worker id int64_t pid; // thread pid @@ -65,6 +74,11 @@ void tQWorkerCleanup(SQWorkerPool *pool); STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp); void tQWorkerFreeQueue(SQWorkerPool *pool, STaosQueue *queue); +int32_t tAutoQWorkerInit(SAutoQWorkerPool *pool); +void tAutoQWorkerCleanup(SAutoQWorkerPool *pool); +STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem fp); +void tAutoQWorkerFreeQueue(SAutoQWorkerPool *pool, STaosQueue *queue); + int32_t tWWorkerInit(SWWorkerPool *pool); void tWWorkerCleanup(SWWorkerPool *pool); STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp); diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index c19519f9a1..bf7418ad79 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -14,6 +14,7 @@ set binary_dir=%3 set binary_dir=%binary_dir:/=\\% set osType=%4 set verNumber=%5 +set Enterprise=%6 set target_dir=C:\\TDengine if not exist %target_dir% ( @@ -57,7 +58,33 @@ if exist %binary_dir%\\build\\lib\\taosws.dll ( if exist %binary_dir%\\build\\bin\\taosdump.exe ( copy %binary_dir%\\build\\bin\\taosdump.exe %target_dir% > nul ) - +if %Enterprise% == TRUE ( + if exist %binary_dir%\\build\\bin\\taosx.exe ( + copy %binary_dir%\\build\\bin\\taosx.exe %target_dir% > nul + ) + if exist %binary_dir%\\build\\bin\\tmq_sim.exe ( + copy %binary_dir%\\build\\bin\\tmq_sim.exe %target_dir% > nul + ) + if exist %binary_dir%\\build\\bin\\tsim.exe ( + copy %binary_dir%\\build\\bin\\tsim.exe %target_dir% > nul + ) + if exist %binary_dir%\\build\\bin\\tmq_taosx_ci.exe ( + copy %binary_dir%\\build\\bin\\tmq_taosx_ci.exe %target_dir% > nul + ) + if exist %binary_dir%\\build\\bin\\tmq_demo.exe ( + copy %binary_dir%\\build\\bin\\tmq_demo.exe %target_dir% > nul + ) + if exist %binary_dir%\\build\\bin\\dumper.exe ( + copy %binary_dir%\\build\\bin\\dumper.exe %target_dir% > nul + ) + if exist %binary_dir%\\build\\bin\\runUdf.exe ( + copy %binary_dir%\\build\\bin\\runUdf.exe %target_dir% > nul + ) + if exist %binary_dir%\\build\\bin\\create_table.exe ( + copy %binary_dir%\\build\\bin\\create_table.exe %target_dir% > nul + ) +) + copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul copy %binary_dir%\\build\\bin\\udfd.exe %target_dir% > nul diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index f30a8a637e..0ee548242f 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -348,7 +348,8 @@ cd ${release_dir} # install_dir has been distinguishes cluster from edege, so comments this code pkg_name=${install_dir}-${osType}-${cpuType} -taostools_pkg_name=${taostools_install_dir}-${osType}-${cpuType} +versionCompFirst=$(echo ${versionComp} | awk -F '.' '{print $1}') +taostools_pkg_name=${taostools_install_dir}-${osType}-${cpuType}-comp${versionCompFirst} # if [ "$verMode" == "cluster" ]; then # pkg_name=${install_dir}-${osType}-${cpuType} diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d0fc88425d..75288cfa14 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -122,6 +122,12 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas char* key = getClusterKey(user, secretEncrypt, ip, port); + tscInfo("connecting to server, numOfEps:%d inUse:%d user:%s db:%s key:%s", epSet.epSet.numOfEps, epSet.epSet.inUse, + user, db, key); + for (int32_t i = 0; i < epSet.epSet.numOfEps; ++i) { + tscInfo("ep:%d, %s:%u", i, epSet.epSet.eps[i].fqdn, epSet.epSet.eps[i].port); + } + SAppInstInfo** pInst = NULL; taosThreadMutexLock(&appInfo.mutex); @@ -142,7 +148,7 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas taosHashPut(appInfo.pInstMap, key, strlen(key), &p, POINTER_BYTES); p->instKey = key; key = NULL; - tscDebug("new app inst mgr %p, user:%s, ip:%s, port:%d", p, user, ip, port); + tscDebug("new app inst mgr %p, user:%s, ip:%s, port:%d", p, user, epSet.epSet.eps[0].fqdn, epSet.epSet.eps[0].port); pInst = &p; } @@ -266,7 +272,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { SRetrieveTableRsp* pRsp = NULL; - int32_t code = qExecCommand(pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp); + int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp); if (TSDB_CODE_SUCCESS == code && NULL != pRsp) { code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true); } @@ -304,7 +310,7 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { return; } - int32_t code = qExecCommand(pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp); + int32_t code = qExecCommand(&pRequest->pTscObj->id ,pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp); if (TSDB_CODE_SUCCESS == code && NULL != pRsp) { code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true); } @@ -1397,6 +1403,21 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet)); } + // pMsg is response msg + if (pMsg->msgType == TDMT_MND_CONNECT + 1) { + // restore origin code + if (pMsg->code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { + pMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + } else if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_BROKEN_LINK; + } + } else { + // uniform to one error code: TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED + if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; + } + } + AsyncArg* arg = taosMemoryCalloc(1, sizeof(AsyncArg)); arg->msg = *pMsg; arg->pEpset = tEpSet; diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index bdd38fa690..0918b99cda 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -179,7 +179,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { } string = cJSON_PrintUnformatted(json); -end: + end: cJSON_Delete(json); tFreeSMAltertbReq(&req); return string; @@ -200,7 +200,7 @@ static char* processCreateStb(SMqMetaRsp* metaRsp) { } string = buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE); -_err: + _err: tDecoderClear(&coder); return string; } @@ -220,7 +220,7 @@ static char* processAlterStb(SMqMetaRsp* metaRsp) { } string = buildAlterSTableJson(req.alterOriData, req.alterOriDataLen); -_err: + _err: tDecoderClear(&coder); return string; } @@ -302,7 +302,7 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { cJSON_AddItemToArray(tags, tag); } -end: + end: cJSON_AddItemToObject(json, "tags", tags); taosArrayDestroy(pTagVals); } @@ -360,7 +360,7 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) { } } -_exit: + _exit: for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pCreateReq = req.pReqs + iReq; taosMemoryFreeClear(pCreateReq->comment); @@ -393,7 +393,7 @@ static char* processAutoCreateTable(STaosxRsp* rsp) { } string = buildCreateCTableJson(pCreateReq, rsp->createTableNum); -_exit: + _exit: for (int i = 0; i < rsp->createTableNum; i++) { tDecoderClear(&decoder[i]); taosMemoryFreeClear(pCreateReq[i].comment); @@ -515,7 +515,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { } string = cJSON_PrintUnformatted(json); -_exit: + _exit: cJSON_Delete(json); tDecoderClear(&decoder); return string; @@ -548,11 +548,50 @@ static char* processDropSTable(SMqMetaRsp* metaRsp) { string = cJSON_PrintUnformatted(json); -_exit: + _exit: cJSON_Delete(json); tDecoderClear(&decoder); return string; } +static char* processDeleteTable(SMqMetaRsp* metaRsp){ + SDeleteRes req = {0}; + SDecoder coder = {0}; + int32_t code = TSDB_CODE_SUCCESS; + cJSON* json = NULL; + char* string = NULL; + + // decode and process req + void* data = POINTER_SHIFT(metaRsp->metaRsp, sizeof(SMsgHead)); + int32_t len = metaRsp->metaRspLen - sizeof(SMsgHead); + + tDecoderInit(&coder, data, len); + if (tDecodeDeleteRes(&coder, &req) < 0) { + code = TSDB_CODE_INVALID_PARA; + goto _exit; + } + + // getTbName(req.tableFName); + char sql[256] = {0}; + snprintf(sql, sizeof(sql), "delete from `%s` where `%s` >= %" PRId64 " and `%s` <= %" PRId64, req.tableFName, + req.tsColName, req.skey, req.tsColName, req.ekey); + uDebug("delete sql:%s\n", sql); + + json = cJSON_CreateObject(); + if (json == NULL) { + goto _exit; + } + cJSON* type = cJSON_CreateString("delete"); + cJSON_AddItemToObject(json, "type", type); + cJSON* sqlJson = cJSON_CreateString(sql); + cJSON_AddItemToObject(json, "sql", sqlJson); + + string = cJSON_PrintUnformatted(json); + + _exit: + cJSON_Delete(json); + tDecoderClear(&coder); + return string; +} static char* processDropTable(SMqMetaRsp* metaRsp) { SDecoder decoder = {0}; @@ -590,7 +629,7 @@ static char* processDropTable(SMqMetaRsp* metaRsp) { string = cJSON_PrintUnformatted(json); -_exit: + _exit: cJSON_Delete(json); tDecoderClear(&decoder); return string; @@ -678,7 +717,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; taosMemoryFree(pCmdMsg.pMsg); -end: + end: destroyRequest(pRequest); tFreeSMCreateStbReq(&pReq); tDecoderClear(&coder); @@ -748,7 +787,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; taosMemoryFree(pCmdMsg.pMsg); -end: + end: destroyRequest(pRequest); tDecoderClear(&coder); return code; @@ -809,9 +848,9 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyCreateTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); // loop to create table @@ -891,7 +930,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; -end: + end: for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pCreateReq = req.pReqs + iReq; taosMemoryFreeClear(pCreateReq->comment); @@ -961,9 +1000,9 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyDropTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); // loop to create table for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { @@ -1015,7 +1054,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { } code = pRequest->code; -end: + end: taosHashCleanup(pVgroupHashmap); destroyRequest(pRequest); tDecoderClear(&coder); @@ -1083,7 +1122,7 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) { } taos_free_result(res); -end: + end: tDecoderClear(&coder); return code; } @@ -1130,9 +1169,9 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { } SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; SVgroupInfo pInfo = {0}; SName pName = {0}; @@ -1191,7 +1230,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { code = handleAlterTbExecRes(pRes->res, pCatalog); } } -end: + end: taosArrayDestroy(pArray); if (pVgData) taosMemoryFreeClear(pVgData->pData); taosMemoryFreeClear(pVgData); @@ -1354,7 +1393,7 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname) launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; -end: + end: taosMemoryFreeClear(pTableMeta); qDestroyQuery(pQuery); destroyRequest(pRequest); @@ -1414,7 +1453,6 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { goto end; } pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); - uDebug("raw data block num:%d\n", rspObj.rsp.blockNum); while (++rspObj.resIter < rspObj.rsp.blockNum) { SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(rspObj.rsp.blockData, rspObj.resIter); @@ -1474,7 +1512,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; -end: + end: tDeleteSMqDataRsp(&rspObj.rsp); tDecoderClear(&decoder); qDestroyQuery(pQuery); @@ -1647,7 +1685,12 @@ char* tmq_get_json_meta(TAOS_RES* res) { return processAlterTable(&pMetaRspObj->metaRsp); } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { return processDropTable(&pMetaRspObj->metaRsp); + } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { + return processDropTable(&pMetaRspObj->metaRsp); + } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DELETE) { + return processDeleteTable(&pMetaRspObj->metaRsp); } + return NULL; } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 1dd8117c1e..8905dc2132 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1902,10 +1902,6 @@ tmq_res_t tmq_get_res_type(TAOS_RES* res) { if (TD_RES_TMQ(res)) { return TMQ_RES_DATA; } else if (TD_RES_TMQ_META(res)) { - SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; - if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DELETE) { - return TMQ_RES_DATA; - } return TMQ_RES_TABLE_META; } else if (TD_RES_TMQ_METADATA(res)) { return TMQ_RES_METADATA; diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 4373f309ca..3dfa32ccc5 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1879,7 +1879,7 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) { char pBuf[128] = {0}; int32_t sz = taosArrayGetSize(dataBlocks); for (int32_t i = 0; i < sz; i++) { - SSDataBlock* pDataBlock = taosArrayGetP(dataBlocks, i); + SSDataBlock* pDataBlock = taosArrayGet(dataBlocks, i); size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock); int32_t rows = pDataBlock->info.rows; @@ -1891,21 +1891,37 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) { for (int32_t k = 0; k < numOfCols; k++) { SColumnInfoData* pColInfoData = taosArrayGet(pDataBlock->pDataBlock, k); void* var = POINTER_SHIFT(pColInfoData->pData, j * pColInfoData->info.bytes); + if (k == 0) { + printf("cols:%d |", (int32_t)numOfCols); + } if (colDataIsNull(pColInfoData, rows, j, NULL)) { printf(" %15s |", "NULL"); continue; } + switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_TIMESTAMP: formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI); printf(" %25s |", pBuf); break; case TSDB_DATA_TYPE_BOOL: - printf(" %15d |", *(int32_t*)var); + printf(" %15" PRIi8 " |", *(int8_t*)var); + break; + case TSDB_DATA_TYPE_TINYINT: + printf(" %15" PRIi8 " |", *(int8_t*)var); + break; + case TSDB_DATA_TYPE_SMALLINT: + printf(" %15" PRIi16 " |", *(int16_t*)var); break; case TSDB_DATA_TYPE_INT: printf(" %15d |", *(int32_t*)var); break; + case TSDB_DATA_TYPE_UTINYINT: + printf(" %15" PRIu8 " |", *(uint8_t*)var); + break; + case TSDB_DATA_TYPE_USMALLINT: + printf(" %15" PRIu16 " |", *(uint16_t*)var); + break; case TSDB_DATA_TYPE_UINT: printf(" %15u |", *(uint32_t*)var); break; diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 11bd340f8e..5d19012273 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -2091,28 +2091,28 @@ _exit: return code; } -int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, - int32_t nRows, char* lengthOrbitmap, char *data) { +int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap, + char *data) { int32_t code = 0; if (IS_VAR_DATA_TYPE(type)) { // var-length data type for (int32_t i = 0; i < nRows; ++i) { - int32_t offset = *((int32_t*)lengthOrbitmap + i); + int32_t offset = *((int32_t *)lengthOrbitmap + i); if (offset == -1) { code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); if (code) goto _exit; } else { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE]( - pColData, (uint8_t *)varDataVal(data + offset), varDataLen(data + offset)); + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, (uint8_t *)varDataVal(data + offset), + varDataLen(data + offset)); } } } else { // fixed-length data type bool allValue = true; - bool allNull = true; + bool allNull = true; for (int32_t i = 0; i < nRows; ++i) { - if(!colDataIsNull_f(lengthOrbitmap, i)){ + if (!colDataIsNull_f(lengthOrbitmap, i)) { allNull = false; - }else{ + } else { allValue = false; } } @@ -2120,8 +2120,7 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt if (allValue) { // optimize (todo) for (int32_t i = 0; i < nRows; ++i) { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE]( - pColData, (uint8_t *)data + bytes * i, bytes); + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, (uint8_t *)data + bytes * i, bytes); } } else if (allNull) { // optimize (todo) @@ -2135,14 +2134,13 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0); if (code) goto _exit; } else { - code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE]( - pColData, (uint8_t *)data + bytes * i, bytes); + code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, (uint8_t *)data + bytes * i, bytes); } } } } - _exit: +_exit: return code; } @@ -2218,13 +2216,18 @@ static int32_t tColDataSwapValue(SColData *pColData, int32_t i, int32_t j) { if (nData1 > nData2) { memcpy(pData, pColData->pData + pColData->aOffset[i], nData1); memcpy(pColData->pData + pColData->aOffset[i], pColData->pData + pColData->aOffset[j], nData2); - memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i] + nData1, + // memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i] + nData1, + // pColData->aOffset[j] - pColData->aOffset[i + 1]); + memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i + 1], pColData->aOffset[j] - pColData->aOffset[i + 1]); memcpy(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pData, nData1); } else { memcpy(pData, pColData->pData + pColData->aOffset[j], nData2); memcpy(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pColData->pData + pColData->aOffset[i], nData1); - memmove(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pColData->pData + pColData->aOffset[i] + nData1, + // memmove(pColData->pData + pColData->aOffset[j] + nData2 - nData1, pColData->pData + pColData->aOffset[i] + + // nData1, + // pColData->aOffset[j] - pColData->aOffset[i + 1]); + memmove(pColData->pData + pColData->aOffset[i] + nData2, pColData->pData + pColData->aOffset[i + 1], pColData->aOffset[j] - pColData->aOffset[i + 1]); memcpy(pColData->pData + pColData->aOffset[i], pData, nData2); } @@ -2244,6 +2247,7 @@ static int32_t tColDataSwapValue(SColData *pColData, int32_t i, int32_t j) { _exit: return code; } + static void tColDataSwap(SColData *pColData, int32_t i, int32_t j) { ASSERT(i < j); ASSERT(j < pColData->nVal); @@ -2278,9 +2282,174 @@ static void tColDataSwap(SColData *pColData, int32_t i, int32_t j) { break; } } -static void tColDataSort(SColData *aColData, int32_t nColData) { - if (aColData[0].nVal == 0) return; - // TODO + +static int32_t tColDataCopyRowCell(SColData *pFromColData, int32_t iFromRow, SColData *pToColData, int32_t iToRow) { + int32_t code = TSDB_CODE_SUCCESS; + + if (IS_VAR_DATA_TYPE(pToColData->type)) { + int32_t nData = (iFromRow < pFromColData->nVal - 1) + ? pFromColData->aOffset[iFromRow + 1] - pFromColData->aOffset[iFromRow] + : pFromColData->nData - pFromColData->aOffset[iFromRow]; + if (iToRow == 0) { + pToColData->aOffset[iToRow] = 0; + } + + if (iToRow < pToColData->nVal - 1) { + pToColData->aOffset[iToRow + 1] = pToColData->aOffset[iToRow] + nData; + } + + memcpy(pToColData->pData + pToColData->aOffset[iToRow], pFromColData->pData + pFromColData->aOffset[iFromRow], + nData); + } else { + memcpy(&pToColData->pData[TYPE_BYTES[pToColData->type] * iToRow], + &pFromColData->pData[TYPE_BYTES[pToColData->type] * iFromRow], TYPE_BYTES[pToColData->type]); + } + return code; +} + +static int32_t tColDataCopyRowSingleCol(SColData *pFromColData, int32_t iFromRow, SColData *pToColData, + int32_t iToRow) { + int32_t code = TSDB_CODE_SUCCESS; + + switch (pFromColData->flag) { + case HAS_NONE: + case HAS_NULL: + break; + case (HAS_NULL | HAS_NONE): { + SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow)); + } break; + case HAS_VALUE: { + tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow); + } break; + case (HAS_VALUE | HAS_NONE): + case (HAS_VALUE | HAS_NULL): { + SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow)); + tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow); + } break; + case (HAS_VALUE | HAS_NULL | HAS_NONE): { + SET_BIT2(pToColData->pBitMap, iToRow, GET_BIT2(pFromColData->pBitMap, iFromRow)); + tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow); + } break; + default: + return -1; + } + + return code; +} + +static int32_t tColDataCopyRow(SColData *aFromColData, int32_t iFromRow, SColData *aToColData, int32_t iToRow, + int32_t nColData) { + int32_t code = TSDB_CODE_SUCCESS; + + for (int32_t i = 0; i < nColData; i++) { + code = tColDataCopyRowSingleCol(&aFromColData[i], iFromRow, &aToColData[i], iToRow); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + + return code; +} + +static int32_t tColDataCopyRowAppend(SColData *aFromColData, int32_t iFromRow, SColData *aToColData, int32_t nColData) { + int32_t code = TSDB_CODE_SUCCESS; + + for (int32_t i = 0; i < nColData; i++) { + SColVal cv = {0}; + tColDataGetValue(&aFromColData[i], iFromRow, &cv); + code = tColDataAppendValue(&aToColData[i], &cv); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + + return code; +} + +static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t mid, int32_t end, int32_t nColData) { + SColData *aDstColData = NULL; + TSKEY *aKey = (TSKEY *)aColData[0].pData; + + int32_t i = start, j = mid + 1, k = 0; + + if (end > start) { + aDstColData = taosMemoryCalloc(1, sizeof(SColData) * nColData); + for (int c = 0; c < nColData; ++c) { + tColDataInit(&aDstColData[c], aColData[c].cid, aColData[c].type, aColData[c].smaOn); + } + if (aDstColData == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + /* + for (int32_t i = 0; i < nColData; i++) { + tColDataCopy(&aColData[i], &aDstColData[i], tColDataDefaultMalloc, NULL); + } + */ + } + + while (i <= mid && j <= end) { + if (aKey[i] <= aKey[j]) { + // tColDataCopyRow(aColData, i++, aDstColData, k++); + tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); + } else { + // tColDataCopyRow(aColData, j++, aDstColData, k++); + tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); + } + } + + while (i <= mid) { + // tColDataCopyRow(aColData, i++, aDstColData, k++); + tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); + } + + while (j <= end) { + // tColDataCopyRow(aColData, j++, aDstColData, k++); + tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); + } + + for (i = start, k = 0; i <= end; ++i, ++k) { + tColDataCopyRow(aDstColData, k, aColData, i, nColData); + } + + if (aDstColData) { + for (int32_t i = 0; i < nColData; i++) { + tColDataDestroy(&aDstColData[i]); + } + taosMemoryFree(aDstColData); + } + + return TSDB_CODE_SUCCESS; +} + +static int32_t tColDataMergeSort(SColData *aColData, int32_t start, int32_t end, int32_t nColData) { + int32_t ret = TSDB_CODE_SUCCESS; + int32_t mid; + + if (start >= end) { + return TSDB_CODE_SUCCESS; + } + + mid = (start + end) / 2; + + ret = tColDataMergeSort(aColData, start, mid, nColData); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + + ret = tColDataMergeSort(aColData, mid + 1, end, nColData); + if (ret != TSDB_CODE_SUCCESS) { + return ret; + } + + return tColDataMergeSortMerge(aColData, start, mid, end, nColData); +} + +static int32_t tColDataSort(SColData *aColData, int32_t nColData) { + int32_t nVal = aColData[0].nVal; + + if (nVal < 2) return TSDB_CODE_SUCCESS; + + return tColDataMergeSort(aColData, 0, nVal - 1, nColData); } static void tColDataMergeImpl(SColData *pColData, int32_t iStart, int32_t iEnd /* not included */) { switch (pColData->flag) { @@ -2530,6 +2699,15 @@ void tColDataSortMerge(SArray *colDataArr) { tColDataSort(aColData, nColData); } + if (doMerge != 1) { + for (int32_t iVal = 1; iVal < aColData[0].nVal; ++iVal) { + if (aKey[iVal] == aKey[iVal - 1]) { + doMerge = 1; + break; + } + } + } + // merge ------- if (doMerge) { tColDataMerge(aColData, nColData); diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 9caf0cc33e..98b9b566ec 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -47,7 +47,7 @@ int32_t tsNumOfMnodeQueryThreads = 4; int32_t tsNumOfMnodeFetchThreads = 1; int32_t tsNumOfMnodeReadThreads = 1; int32_t tsNumOfVnodeQueryThreads = 4; -int32_t tsNumOfVnodeStreamThreads = 2; +float tsRatioOfVnodeStreamThreads = 1.0; int32_t tsNumOfVnodeFetchThreads = 4; int32_t tsNumOfVnodeRsmaThreads = 2; int32_t tsNumOfQnodeQueryThreads = 4; @@ -392,9 +392,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { tsNumOfVnodeQueryThreads = TMAX(tsNumOfVnodeQueryThreads, 4); if (cfgAddInt32(pCfg, "numOfVnodeQueryThreads", tsNumOfVnodeQueryThreads, 4, 1024, 0) != 0) return -1; - tsNumOfVnodeStreamThreads = tsNumOfCores / 4; - tsNumOfVnodeStreamThreads = TMAX(tsNumOfVnodeStreamThreads, 4); - if (cfgAddInt32(pCfg, "numOfVnodeStreamThreads", tsNumOfVnodeStreamThreads, 4, 1024, 0) != 0) return -1; + if (cfgAddFloat(pCfg, "ratioOfVnodeStreamThreads", tsRatioOfVnodeStreamThreads, 0.01, 100, 0) != 0) return -1; tsNumOfVnodeFetchThreads = tsNumOfCores / 4; tsNumOfVnodeFetchThreads = TMAX(tsNumOfVnodeFetchThreads, 4); @@ -513,11 +511,9 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem->stype = stype; } - pItem = cfgGetItem(tsCfg, "numOfVnodeStreamThreads"); + pItem = cfgGetItem(tsCfg, "ratioOfVnodeStreamThreads"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsNumOfVnodeStreamThreads = numOfCores / 4; - tsNumOfVnodeStreamThreads = TMAX(tsNumOfVnodeStreamThreads, 4); - pItem->i32 = tsNumOfVnodeStreamThreads; + pItem->fval = tsRatioOfVnodeStreamThreads; pItem->stype = stype; } @@ -710,7 +706,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsNumOfCommitThreads = cfgGetItem(pCfg, "numOfCommitThreads")->i32; tsNumOfMnodeReadThreads = cfgGetItem(pCfg, "numOfMnodeReadThreads")->i32; tsNumOfVnodeQueryThreads = cfgGetItem(pCfg, "numOfVnodeQueryThreads")->i32; - tsNumOfVnodeStreamThreads = cfgGetItem(pCfg, "numOfVnodeStreamThreads")->i32; + tsRatioOfVnodeStreamThreads = cfgGetItem(pCfg, "ratioOfVnodeStreamThreads")->fval; tsNumOfVnodeFetchThreads = cfgGetItem(pCfg, "numOfVnodeFetchThreads")->i32; tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32; tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32; @@ -1316,12 +1312,17 @@ void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal, if (pItem != NULL && (rewrite || pItem->i32 == 0)) { pItem->i32 = flagVal; } - *pFlagPtr = flagVal; + if (pFlagPtr != NULL) { + *pFlagPtr = flagVal; + } } void taosSetAllDebugFlag(int32_t flag, bool rewrite) { if (flag <= 0) return; + taosSetDebugFlag(NULL, "debugFlag", flag, rewrite); + taosSetDebugFlag(NULL, "simDebugFlag", flag, rewrite); + taosSetDebugFlag(NULL, "tmrDebugFlag", flag, rewrite); taosSetDebugFlag(&uDebugFlag, "uDebugFlag", flag, rewrite); taosSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag, rewrite); taosSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag, rewrite); @@ -1340,6 +1341,5 @@ void taosSetAllDebugFlag(int32_t flag, bool rewrite) { taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag, rewrite); taosSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag, rewrite); taosSetDebugFlag(&metaDebugFlag, "metaDebugFlag", flag, rewrite); - taosSetDebugFlag(&metaDebugFlag, "tmrDebugFlag", flag, rewrite); uInfo("all debug flag are set to %d", flag); } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 95a72843e8..83f447fd0e 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5424,6 +5424,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; if (tEncodeCStr(&encoder, pField->name) < 0) return -1; } + if (tEncodeI8(&encoder, pReq->createStb) < 0) return -1; tEndEncode(&encoder); @@ -5484,6 +5485,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea } } } + if (tDecodeI8(&decoder, &pReq->createStb) < 0) return -1; tEndDecode(&decoder); @@ -6936,6 +6938,8 @@ void tDestroySSubmitTbData(SSubmitTbData *pTbData, int32_t flag) { } void tDestroySSubmitReq2(SSubmitReq2 *pReq, int32_t flag) { + if (pReq->aSubmitTbData == NULL) return; + int32_t nSubmitTbData = TARRAY_SIZE(pReq->aSubmitTbData); SSubmitTbData *aSubmitTbData = (SSubmitTbData *)TARRAY_DATA(pReq->aSubmitTbData); diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index a8103351b4..a432201413 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -268,6 +268,11 @@ int mainWindows(int argc, char **argv) { if (dmInit() != 0) { dError("failed to init dnode since %s", terrstr()); + + taosCleanupCfg(); + taosCloseLog(); + taosCleanupArgs(); + taosConvDestroy(); return -1; } diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 39eeeb32ea..3e9084bd11 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -41,6 +41,8 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) { pMgmt->statusSeq); pMgmt->pData->dropped = 1; dmWriteEps(pMgmt->pData); + dInfo("dnode will exit since it is in the dropped state"); + raise(SIGINT); } } else { SStatusRsp statusRsp = {0}; diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index b5c554e0ca..6e724f4d43 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -26,20 +26,20 @@ extern "C" { #endif typedef struct SVnodeMgmt { - SDnodeData *pData; - SMsgCb msgCb; - const char *path; - const char *name; - SQWorkerPool queryPool; - SQWorkerPool streamPool; - SWWorkerPool fetchPool; - SSingleWorker mgmtWorker; - SHashObj *hash; - TdThreadRwlock lock; - SVnodesStat state; - STfs *pTfs; - TdThread thread; - bool stop; + SDnodeData *pData; + SMsgCb msgCb; + const char *path; + const char *name; + SQWorkerPool queryPool; + SAutoQWorkerPool streamPool; + SWWorkerPool fetchPool; + SSingleWorker mgmtWorker; + SHashObj *hash; + TdThreadRwlock lock; + SVnodesStat state; + STfs *pTfs; + TdThread thread; + bool stop; } SVnodeMgmt; typedef struct { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 7e3915f3d1..202dc50ac6 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -140,6 +140,12 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtype) { const STraceId *trace = &pMsg->info.traceId; + if (pMsg->contLen < sizeof(SMsgHead)) { + dGError("invalid rpc msg with no msg head at pCont. pMsg:%p, type:%s, contLen:%d", pMsg, TMSG_INFO(pMsg->msgType), + pMsg->contLen); + return -1; + } + SMsgHead *pHead = pMsg->pCont; int32_t code = 0; @@ -233,6 +239,14 @@ int32_t vmPutMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { } int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { + if (pRpc->contLen < sizeof(SMsgHead)) { + dError("invalid rpc msg with no msg head at pCont. pRpc:%p, type:%s, len:%d", pRpc, TMSG_INFO(pRpc->msgType), + pRpc->contLen); + rpcFreeCont(pRpc->pCont); + pRpc->pCont = NULL; + return -1; + } + SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM, pRpc->contLen); if (pMsg == NULL) { rpcFreeCont(pRpc->pCont); @@ -304,7 +318,7 @@ int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) { (void)tMultiWorkerInit(&pVnode->pApplyW, &acfg); pVnode->pQueryQ = tQWorkerAllocQueue(&pMgmt->queryPool, pVnode, (FItem)vmProcessQueryQueue); - pVnode->pStreamQ = tQWorkerAllocQueue(&pMgmt->streamPool, pVnode, (FItem)vmProcessStreamQueue); + pVnode->pStreamQ = tAutoQWorkerAllocQueue(&pMgmt->streamPool, pVnode, (FItem)vmProcessStreamQueue); pVnode->pFetchQ = tWWorkerAllocQueue(&pMgmt->fetchPool, pVnode, (FItems)vmProcessFetchQueue); if (pVnode->pWriteW.queue == NULL || pVnode->pSyncW.queue == NULL || pVnode->pSyncCtrlW.queue == NULL || @@ -330,7 +344,7 @@ int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) { void vmFreeQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) { tQWorkerFreeQueue(&pMgmt->queryPool, pVnode->pQueryQ); - tQWorkerFreeQueue(&pMgmt->streamPool, pVnode->pStreamQ); + tAutoQWorkerFreeQueue(&pMgmt->streamPool, pVnode->pStreamQ); tWWorkerFreeQueue(&pMgmt->fetchPool, pVnode->pFetchQ); pVnode->pQueryQ = NULL; pVnode->pStreamQ = NULL; @@ -345,11 +359,10 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) { pQPool->max = tsNumOfVnodeQueryThreads; if (tQWorkerInit(pQPool) != 0) return -1; - SQWorkerPool *pStreamPool = &pMgmt->streamPool; + SAutoQWorkerPool *pStreamPool = &pMgmt->streamPool; pStreamPool->name = "vnode-stream"; - pStreamPool->min = tsNumOfVnodeStreamThreads; - pStreamPool->max = tsNumOfVnodeStreamThreads; - if (tQWorkerInit(pStreamPool) != 0) return -1; + pStreamPool->ratio = tsRatioOfVnodeStreamThreads; + if (tAutoQWorkerInit(pStreamPool) != 0) return -1; SWWorkerPool *pFPool = &pMgmt->fetchPool; pFPool->name = "vnode-fetch"; @@ -371,7 +384,7 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) { void vmStopWorker(SVnodeMgmt *pMgmt) { tQWorkerCleanup(&pMgmt->queryPool); - tQWorkerCleanup(&pMgmt->streamPool); + tAutoQWorkerCleanup(&pMgmt->streamPool); tWWorkerCleanup(&pMgmt->fetchPool); dDebug("vnode workers are closed"); } diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 5e1dcc6353..0ff41d429e 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -53,6 +53,15 @@ static bool dmFailFastFp(tmsg_t msgType) { return msgType == TDMT_SYNC_HEARTBEAT || msgType == TDMT_SYNC_APPEND_ENTRIES; } +static void dmConvertErrCode(tmsg_t msgType) { + if (terrno != TSDB_CODE_APP_IS_STOPPING) { + return; + } + if ((msgType > TDMT_VND_MSG && msgType < TDMT_VND_MAX_MSG) || + (msgType > TDMT_SCH_MSG && msgType < TDMT_SCH_MAX_MSG)) { + terrno = TSDB_CODE_VND_STOPPED; + } +} static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { SDnodeTrans *pTrans = &pDnode->trans; int32_t code = -1; @@ -102,6 +111,11 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { dGError("msg:%p, type:%s pCont is NULL", pRpc, TMSG_INFO(pRpc->msgType)); terrno = TSDB_CODE_INVALID_MSG_LEN; goto _OVER; + } else if ((pRpc->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pRpc->code == TSDB_CODE_RPC_BROKEN_LINK) && + (!IsReq(pRpc)) && (pRpc->pCont == NULL)) { + dGError("msg:%p, type:%s pCont is NULL, err: %s", pRpc, TMSG_INFO(pRpc->msgType), tstrerror(pRpc->code)); + terrno = pRpc->code; + goto _OVER; } if (pHandle->defaultNtype == NODE_END) { @@ -152,6 +166,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { _OVER: if (code != 0) { + dmConvertErrCode(pRpc->msgType); if (terrno != 0) code = terrno; if (pMsg) { dGTrace("msg:%p, failed to process %s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr()); @@ -233,8 +248,9 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { rpcRe static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_MNODE_NOT_FOUND || - code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED || - code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { + code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED || code == TSDB_CODE_SYN_NOT_LEADER || + code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED || code == TSDB_CODE_APP_IS_STARTING || + code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || msgType == TDMT_SCH_MERGE_FETCH) { return false; diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 4e93a1d96e..2f824b48b4 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -193,6 +193,7 @@ typedef struct { int64_t lastAccessTime; int32_t accessTimes; int32_t numOfVnodes; + int32_t numOfOtherNodes; int32_t numOfSupportVnodes; float numOfCores; int64_t memTotal; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 0715556da2..8a4f6c2195 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -557,6 +557,8 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, mInfo("trans:%d, used to create db:%s", pTrans->id, pCreate->db); mndTransSetDbName(pTrans, dbObj.name, NULL); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; + mndTransSetOper(pTrans, MND_OPER_CREATE_DB); if (mndSetCreateDbRedoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER; if (mndSetCreateDbUndoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto _OVER; @@ -776,7 +778,7 @@ static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *p int32_t code = -1; mndTransSetDbName(pTrans, pOld->name, NULL); - if (mndTrancCheckConflict(pMnode, pTrans) != 0) return -1; + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; if (mndSetAlterDbRedoLogs(pMnode, pTrans, pOld, pNew) != 0) goto _OVER; if (mndSetAlterDbCommitLogs(pMnode, pTrans, pOld, pNew) != 0) goto _OVER; @@ -1038,7 +1040,7 @@ static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) { mInfo("trans:%d, used to drop db:%s", pTrans->id, pDb->name); mndTransSetDbName(pTrans, pDb->name, NULL); - + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; if (mndCheckTopicExist(pMnode, pDb) < 0) goto _OVER; if (mndSetDropDbRedoLogs(pMnode, pTrans, pDb) != 0) goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 5772864ba8..d7b16c2c8e 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -217,8 +217,18 @@ SDnodeObj *mndAcquireDnode(SMnode *pMnode, int32_t dnodeId) { SSdb *pSdb = pMnode->pSdb; SDnodeObj *pDnode = sdbAcquire(pSdb, SDB_DNODE, &dnodeId); if (pDnode == NULL) { - terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; + if (terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) { + terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; + } else if (terrno == TSDB_CODE_SDB_OBJ_CREATING) { + terrno = TSDB_CODE_MND_DNODE_IN_CREATING; + } else if (terrno == TSDB_CODE_SDB_OBJ_DROPPING) { + terrno = TSDB_CODE_MND_DNODE_IN_DROPPING; + } else { + terrno = TSDB_CODE_APP_ERROR; + mFatal("dnode:%d, failed to acquire db since %s", dnodeId, terrstr()); + } } + return pDnode; } @@ -254,6 +264,27 @@ static SDnodeObj *mndAcquireDnodeByEp(SMnode *pMnode, char *pEpStr) { return NULL; } +static SDnodeObj *mndAcquireDnodeAllStatusByEp(SMnode *pMnode, char *pEpStr) { + SSdb *pSdb = pMnode->pSdb; + + void *pIter = NULL; + while (1) { + SDnodeObj *pDnode = NULL; + ESdbStatus objStatus = 0; + pIter = sdbFetchAll(pSdb, SDB_DNODE, pIter, (void **)&pDnode, &objStatus, true); + if (pIter == NULL) break; + + if (strncasecmp(pEpStr, pDnode->ep, TSDB_EP_LEN) == 0) { + sdbCancelFetch(pSdb, pIter); + return pDnode; + } + + sdbRelease(pSdb, pDnode); + } + + return NULL; +} + int32_t mndGetDnodeSize(SMnode *pMnode) { SSdb *pSdb = pMnode->pSdb; return sdbGetSize(pSdb, SDB_DNODE); @@ -340,12 +371,22 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { } else { pDnode = mndAcquireDnode(pMnode, statusReq.dnodeId); if (pDnode == NULL) { + int32_t err = terrno; pDnode = mndAcquireDnodeByEp(pMnode, statusReq.dnodeEp); if (pDnode != NULL) { pDnode->offlineReason = DND_REASON_DNODE_ID_NOT_MATCH; + terrno = err; + goto _OVER; + } + + mError("dnode:%d, %s not exist, code:0x%x", statusReq.dnodeId, statusReq.dnodeEp, err); + if (err == TSDB_CODE_MND_DNODE_NOT_EXIST) { + terrno = err; + goto _OVER; + } else { + pDnode = mndAcquireDnodeAllStatusByEp(pMnode, statusReq.dnodeEp); + if (pDnode == NULL) goto _OVER; } - mError("dnode:%d, %s not exist", statusReq.dnodeId, statusReq.dnodeEp); - goto _OVER; } } @@ -356,8 +397,6 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { bool reboot = (pDnode->rebootTime != statusReq.rebootTime); bool needCheck = !online || dnodeChanged || reboot; - pDnode->accessTimes++; - pDnode->lastAccessTime = curMs; const STraceId *trace = &pReq->info.traceId; mGTrace("dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d", pDnode->id, pDnode->accessTimes, needCheck, online, reboot, dnodeChanged, statusReq.statusSeq); @@ -493,6 +532,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { pReq->info.rsp = pHead; } + pDnode->accessTimes++; + pDnode->lastAccessTime = curMs; code = 0; _OVER: @@ -517,6 +558,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode"); if (pTrans == NULL) goto _OVER; mInfo("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; pRaw = mndDnodeActionEncode(&dnodeObj); if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER; @@ -698,6 +740,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mInfo("trans:%d, used to drop dnode:%d, force:%d", pTrans->id, pDnode->id, force); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; pRaw = mndDnodeActionEncode(pDnode); if (pRaw == NULL) goto _OVER; @@ -762,11 +805,12 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { pDnode = mndAcquireDnode(pMnode, dropReq.dnodeId); if (pDnode == NULL) { - char ep[TSDB_EP_LEN + 1] = {0}; + int32_t err = terrno; + char ep[TSDB_EP_LEN + 1] = {0}; snprintf(ep, sizeof(ep), dropReq.fqdn, dropReq.port); pDnode = mndAcquireDnodeByEp(pMnode, ep); if (pDnode == NULL) { - terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; + terrno = err; goto _OVER; } } @@ -967,11 +1011,12 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; int32_t cols = 0; + ESdbStatus objStatus = 0; SDnodeObj *pDnode = NULL; int64_t curMs = taosGetTimestampMs(); while (numOfRows < rows) { - pShow->pIter = sdbFetch(pSdb, SDB_DNODE, pShow->pIter, (void **)&pDnode); + pShow->pIter = sdbFetchAll(pSdb, SDB_DNODE, pShow->pIter, (void **)&pDnode, &objStatus, true); if (pShow->pIter == NULL) break; bool online = mndIsDnodeOnline(pDnode, curMs); @@ -993,8 +1038,20 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, (const char *)&pDnode->numOfSupportVnodes, false); + const char *status = "ready"; + if (objStatus == SDB_STATUS_CREATING) status = "creating"; + if (objStatus == SDB_STATUS_DROPPING) status = "dropping"; + if (!online) { + if (objStatus == SDB_STATUS_CREATING) + status = "creating*"; + else if (objStatus == SDB_STATUS_DROPPING) + status = "dropping*"; + else + status = "offline"; + } + char b1[9] = {0}; - STR_TO_VARSTR(b1, online ? "ready" : "offline"); + STR_TO_VARSTR(b1, status); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, b1, false); diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 9c847c1138..b9448797ea 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -390,6 +390,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mInfo("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; if (mndSetCreateMnodeRedoActions(pMnode, pTrans, pDnode, &mnodeObj) != 0) goto _OVER; if (mndSetCreateMnodeRedoLogs(pMnode, pTrans, &mnodeObj) != 0) goto _OVER; @@ -526,6 +527,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) { if (pTrans == NULL) goto _OVER; mndTransSetSerial(pTrans); mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; @@ -633,6 +635,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB const char *status = "ready"; if (objStatus == SDB_STATUS_CREATING) status = "creating"; if (objStatus == SDB_STATUS_DROPPING) status = "dropping"; + if (!mndIsDnodeOnline(pObj->pDnode, curMs)) status = "offline"; char b3[9 + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(b3, status, pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index e6a6e6ae5b..2d1f6eb505 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -595,6 +595,8 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-sma"); if (pTrans == NULL) goto _OVER; mndTransSetDbName(pTrans, pDb->name, NULL); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; + mndTransSetSerial(pTrans); mInfo("trans:%d, used to create sma:%s stream:%s", pTrans->id, pCreate->name, streamObj.name); @@ -809,6 +811,8 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p mInfo("trans:%d, used to drop sma:%s", pTrans->id, pSma->name); mndTransSetDbName(pTrans, pDb->name, NULL); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; + mndTransSetSerial(pTrans); char streamName[TSDB_TABLE_FNAME_LEN] = {0}; diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index c611cfb6e1..54b3202d24 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -823,6 +823,7 @@ _OVER: int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { mndTransSetDbName(pTrans, pDb->name, pStb->name); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) return -1; if (mndSetCreateStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1; if (mndSetCreateStbUndoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1; if (mndSetCreateStbCommitLogs(pMnode, pTrans, pDb, pStb) != 0) return -1; @@ -1856,6 +1857,7 @@ static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbOb mInfo("trans:%d, used to alter stb:%s", pTrans->id, pStb->name); mndTransSetDbName(pTrans, pDb->name, pStb->name); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; if (needRsp) { void *pCont = NULL; @@ -2055,6 +2057,7 @@ static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *p mInfo("trans:%d, used to drop stb:%s", pTrans->id, pStb->name); mndTransSetDbName(pTrans, pDb->name, pStb->name); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; if (mndSetDropStbRedoLogs(pMnode, pTrans, pStb) != 0) goto _OVER; if (mndSetDropStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 10ecd56280..61374aa0bf 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -631,11 +631,13 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); goto _OVER; } - mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetDb); mInfo("trans:%d, used to create stream:%s", pTrans->id, createStreamReq.name); + mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetDb); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; + // create stb for stream - if (mndCreateStbForStream(pMnode, pTrans, &streamObj, pReq->info.conn.user) < 0) { + if (createStreamReq.createStb == STREAM_CREATE_STABLE_TRUE && mndCreateStbForStream(pMnode, pTrans, &streamObj, pReq->info.conn.user) < 0) { mError("trans:%d, failed to create stb for stream %s since %s", pTrans->id, createStreamReq.name, terrstr()); mndTransDrop(pTrans); goto _OVER; @@ -781,6 +783,12 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) { STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "stream-checkpoint"); if (pTrans == NULL) return -1; mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) { + mndReleaseStream(pMnode, pStream); + mndTransDrop(pTrans); + return -1; + } + taosRLockLatch(&pStream->lock); // 1. redo action: broadcast checkpoint source msg for all source vg int32_t totLevel = taosArrayGetSize(pStream->tasks); @@ -871,11 +879,11 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { } if (mndCheckDbPrivilegeByName(pMnode, pReq->info.conn.user, MND_OPER_WRITE_DB, pStream->targetDb) != 0) { + sdbRelease(pMnode->pSdb, pStream); return -1; } STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "drop-stream"); - mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); if (pTrans == NULL) { mError("stream:%s, failed to drop since %s", dropReq.name, terrstr()); sdbRelease(pMnode->pSdb, pStream); @@ -883,6 +891,13 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { } mInfo("trans:%d, used to drop stream:%s", pTrans->id, dropReq.name); + mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) { + sdbRelease(pMnode->pSdb, pStream); + mndTransDrop(pTrans); + return -1; + } + // drop all tasks if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) { mError("stream:%s, failed to drop task since %s", dropReq.name, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 55e073a8a4..418474baa6 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -442,7 +442,12 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) { STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "tmq-reb"); if (pTrans == NULL) return -1; + mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) { + mndTransDrop(pTrans); + return -1; + } // make txn: // 1. redo action: action to all vg diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index c96faddc4c..54d8aa7f60 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -142,10 +142,9 @@ int32_t mndSyncGetSnapshot(const SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pRe return 0; } -int32_t mndSyncGetSnapshotInfo(const SSyncFSM *pFsm, SSnapshot *pSnapshot) { +static void mndSyncGetSnapshotInfo(const SSyncFSM *pFsm, SSnapshot *pSnapshot) { SMnode *pMnode = pFsm->data; sdbGetCommitInfo(pMnode->pSdb, &pSnapshot->lastApplyIndex, &pSnapshot->lastApplyTerm, &pSnapshot->lastConfigIndex); - return 0; } void mndRestoreFinish(const SSyncFSM *pFsm) { @@ -170,10 +169,10 @@ int32_t mndSnapshotStartRead(const SSyncFSM *pFsm, void *pParam, void **ppReader return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, NULL, NULL, NULL); } -int32_t mndSnapshotStopRead(const SSyncFSM *pFsm, void *pReader) { +static void mndSnapshotStopRead(const SSyncFSM *pFsm, void *pReader) { mInfo("stop to read snapshot from sdb"); SMnode *pMnode = pFsm->data; - return sdbStopRead(pMnode->pSdb, pReader); + sdbStopRead(pMnode->pSdb, pReader); } int32_t mndSnapshotDoRead(const SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) { diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index f25ebda38f..7f5ebd4a90 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -701,13 +701,19 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) { } STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "drop-topic"); - mndTransSetDbName(pTrans, pTopic->db, NULL); if (pTrans == NULL) { mError("topic:%s, failed to drop since %s", pTopic->name, terrstr()); mndReleaseTopic(pMnode, pTopic); return -1; } + mndTransSetDbName(pTrans, pTopic->db, NULL); + if (mndTrancCheckConflict(pMnode, pTrans) != 0) { + mndReleaseTopic(pMnode, pTopic); + mndTransDrop(pTrans); + return -1; + } + mInfo("trans:%d, used to drop topic:%s", pTrans->id, pTopic->name); // TODO check if rebalancing diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index b92be19741..718fc5c73f 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -957,9 +957,13 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) { for (int32_t i = 0; i < size; ++i) { SRpcHandleInfo *pInfo = taosArrayGet(pTrans->pRpcArray, i); if (pInfo->handle != NULL) { - if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { + if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL; } + if (code == TSDB_CODE_SYN_TIMEOUT) { + code = TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT; + } + if (i != 0 && code == 0) { code = TSDB_CODE_MNODE_NOT_FOUND; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 31ab1f3259..2550c68cfb 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -425,6 +425,7 @@ void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgOb static bool mndResetDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2, void *p3) { SDnodeObj *pDnode = pObj; pDnode->numOfVnodes = 0; + pDnode->numOfOtherNodes = 0; return true; } @@ -447,7 +448,7 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2 pDnode->numOfVnodes, pDnode->numOfSupportVnodes, isMnode, online, pDnode->memAvail, pDnode->memUsed); if (isMnode) { - pDnode->numOfVnodes++; + pDnode->numOfOtherNodes++; } if (online && pDnode->numOfSupportVnodes > 0) { @@ -468,14 +469,25 @@ SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId) { sdbTraverse(pSdb, SDB_DNODE, mndResetDnodesArrayFp, NULL, NULL, NULL); sdbTraverse(pSdb, SDB_DNODE, mndBuildDnodesArrayFp, pArray, &exceptDnodeId, NULL); + + mDebug("build %d dnodes array", (int32_t)taosArrayGetSize(pArray)); + for (int32_t i = 0; i < (int32_t)taosArrayGetSize(pArray); ++i) { + SDnodeObj *pDnode = taosArrayGet(pArray, i); + mDebug("dnode:%d, vnodes:%d others:%d", pDnode->id, pDnode->numOfVnodes, pDnode->numOfOtherNodes); + } return pArray; } static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return *dnode1Id >= *dnode2Id ? 1 : 0; } +static float mndGetDnodeScore(SDnodeObj *pDnode, int32_t additionDnodes, float ratio) { + float totalDnodes = pDnode->numOfVnodes + (float)pDnode->numOfOtherNodes * ratio + additionDnodes; + return totalDnodes / pDnode->numOfSupportVnodes; +} + static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) { - float d1Score = (float)pDnode1->numOfVnodes / pDnode1->numOfSupportVnodes; - float d2Score = (float)pDnode2->numOfVnodes / pDnode2->numOfSupportVnodes; + float d1Score = mndGetDnodeScore(pDnode1, 0, 0.9); + float d2Score = mndGetDnodeScore(pDnode2, 0, 0.9); return d1Score >= d2Score ? 1 : 0; } @@ -494,7 +506,12 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup int32_t allocedVnodes = 0; void *pIter = NULL; + mDebug("start to sort %d dnodes", (int32_t)taosArrayGetSize(pArray)); taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes); + for (int32_t i = 0; i < (int32_t)taosArrayGetSize(pArray); ++i) { + SDnodeObj *pDnode = taosArrayGet(pArray, i); + mDebug("dnode:%d, score:%f", pDnode->id, mndGetDnodeScore(pDnode, 0, 0.9)); + } int32_t size = taosArrayGetSize(pArray); if (size < pVgroup->replica) { @@ -875,7 +892,7 @@ static int32_t mndAddVnodeToVgroup(SMnode *pMnode, STrans *pTrans, SVgObj *pVgro taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes); for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) { SDnodeObj *pDnode = taosArrayGet(pArray, i); - mInfo("dnode:%d, equivalent vnodes:%d", pDnode->id, pDnode->numOfVnodes); + mInfo("dnode:%d, equivalent vnodes:%d others:%d", pDnode->id, pDnode->numOfVnodes, pDnode->numOfOtherNodes); } SVnodeGid *pVgid = &pVgroup->vnodeGid[pVgroup->replica]; @@ -935,7 +952,7 @@ static int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, STrans *pTrans, SVgObj * taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes); for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) { SDnodeObj *pDnode = taosArrayGet(pArray, i); - mInfo("dnode:%d, equivalent vnodes:%d", pDnode->id, pDnode->numOfVnodes); + mInfo("dnode:%d, equivalent vnodes:%d others:%d", pDnode->id, pDnode->numOfVnodes, pDnode->numOfOtherNodes); } int32_t code = -1; @@ -1970,16 +1987,16 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) { taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes); for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) { SDnodeObj *pDnode = taosArrayGet(pArray, i); - mInfo("dnode:%d, equivalent vnodes:%d support:%d, score:%f", pDnode->id, pDnode->numOfVnodes, - pDnode->numOfSupportVnodes, (float)pDnode->numOfVnodes / pDnode->numOfSupportVnodes); + mInfo("dnode:%d, equivalent vnodes:%d others:%d support:%d, score:%f", pDnode->id, pDnode->numOfVnodes, + pDnode->numOfSupportVnodes, pDnode->numOfOtherNodes, mndGetDnodeScore(pDnode, 0, 1)); } SDnodeObj *pSrc = taosArrayGet(pArray, taosArrayGetSize(pArray) - 1); SDnodeObj *pDst = taosArrayGet(pArray, 0); - float srcScore = (float)(pSrc->numOfVnodes - 1) / pSrc->numOfSupportVnodes; - float dstScore = (float)(pDst->numOfVnodes + 1) / pDst->numOfSupportVnodes; - mInfo("trans:%d, after balance, src dnode:%d score:%f, dst dnode:%d score:%f", pTrans->id, pSrc->id, srcScore, + float srcScore = mndGetDnodeScore(pSrc, -1, 1); + float dstScore = mndGetDnodeScore(pDst, 1, 1); + mInfo("trans:%d, after balance, src dnode:%d score:%f, dst dnode:%d score:%f", pTrans->id, pSrc->id, dstScore, pDst->id, dstScore); if (srcScore > dstScore - 0.000001) { diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index a6d81ecc0d..e799f08a17 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -392,7 +392,7 @@ void *sdbGetRowObj(SSdbRow *pRow); void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow, bool callFunc); int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *term, int64_t *config); -int32_t sdbStopRead(SSdb *pSdb, SSdbIter *pIter); +void sdbStopRead(SSdb *pSdb, SSdbIter *pIter); int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len); int32_t sdbStartWrite(SSdb *pSdb, SSdbIter **ppIter); diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 318a746bb0..f43b6bdb25 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -585,10 +585,7 @@ int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *ter return 0; } -int32_t sdbStopRead(SSdb *pSdb, SSdbIter *pIter) { - sdbCloseIter(pIter); - return 0; -} +void sdbStopRead(SSdb *pSdb, SSdbIter *pIter) { sdbCloseIter(pIter); } int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) { int32_t maxlen = 4096; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index aa4d2fea4f..a7564e352c 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -185,7 +185,7 @@ void *tsdbGetIvtIdx(SMeta *pMeta); uint64_t getReaderMaxVersion(STsdbReader *pReader); int32_t tsdbCacherowsReaderOpen(void *pVnode, int32_t type, void *pTableIdList, int32_t numOfTables, int32_t numOfCols, - uint64_t suid, void **pReader); + uint64_t suid, void **pReader, const char* idstr); int32_t tsdbRetrieveCacheRows(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray *pTableUids); void *tsdbCacherowsReaderClose(void *pReader); int32_t tsdbGetTableSchema(SVnode *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid); @@ -275,7 +275,7 @@ int32_t smaGetTSmaDays(SVnodeCfg *pCfg, void *pCont, uint32_t contLen, int32_t * // SVSnapReader int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapReader **ppReader); -int32_t vnodeSnapReaderClose(SVSnapReader *pReader); +void vnodeSnapReaderClose(SVSnapReader *pReader); int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData); // SVSnapWriter int32_t vnodeSnapWriterOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapWriter **ppWriter); diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index 0ef8e8bac5..9a89c732bd 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -121,6 +121,7 @@ typedef struct { struct STQ { SVnode* pVnode; char* path; + int64_t walLogLastVer; SRWLatch pushLock; diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 0c47399985..49f8d9be3c 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -726,21 +726,21 @@ void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo); // tsdbCache ============================================================================================== typedef struct SCacheRowsReader { - SVnode *pVnode; - STSchema *pSchema; - uint64_t uid; - uint64_t suid; - char **transferBuf; // todo remove it soon - int32_t numOfCols; - int32_t type; - int32_t tableIndex; // currently returned result tables - + SVnode *pVnode; + STSchema *pSchema; + uint64_t uid; + uint64_t suid; + char **transferBuf; // todo remove it soon + int32_t numOfCols; + int32_t type; + int32_t tableIndex; // currently returned result tables STableKeyInfo *pTableList; // table id list int32_t numOfTables; SSttBlockLoadInfo *pLoadInfo; STsdbReadSnap *pReadSnap; SDataFReader *pDataFReader; SDataFReader *pDataFReaderLast; + const char *idstr; } SCacheRowsReader; typedef struct { diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 15bcafa9f4..d160cd1fac 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -90,7 +90,9 @@ typedef struct SCommitInfo SCommitInfo; #define VND_INFO_FNAME "vnode.json" // vnd.h -void* vnodeBufPoolMalloc(SVBufPool* pPool, int32_t size); + +void* vnodeBufPoolMalloc(SVBufPool* pPool, int size); +void* vnodeBufPoolMallocAligned(SVBufPool* pPool, int size); void vnodeBufPoolFree(SVBufPool* pPool, void* p); void vnodeBufPoolRef(SVBufPool* pPool); void vnodeBufPoolUnRef(SVBufPool* pPool); @@ -199,6 +201,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t version, char* msg, int32_t msgLen); int32_t tqProcessTaskRecoverFinishReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskRecoverFinishRsp(STQ* pTq, SRpcMsg* pMsg); +int32_t tqCheckLogInWal(STQ* pTq, int64_t version); int32_t tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchema* pSchema, SSchemaWrapper* pTagSchemaWrapper, bool createTb, int64_t suid, const char* stbFullName, diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 37dcec4f85..893bf1b496 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -54,9 +54,9 @@ struct SMetaCache { // query cache struct STagFilterResCache { + TdThreadMutex lock; SHashObj* pTableEntry; SLRUCache* pUidResCache; - uint64_t keyBuf[3]; } sTagFilterResCache; }; @@ -140,6 +140,8 @@ int32_t metaCacheOpen(SMeta* pMeta) { } taosHashSetFreeFp(pCache->sTagFilterResCache.pTableEntry, freeCacheEntryFp); + taosThreadMutexInit(&pCache->sTagFilterResCache.lock, NULL); + pMeta->pCache = pCache; return code; @@ -159,6 +161,8 @@ void metaCacheClose(SMeta* pMeta) { taosHashCleanup(pMeta->pCache->sTagFilterResCache.pTableEntry); taosLRUCacheCleanup(pMeta->pCache->sTagFilterResCache.pUidResCache); + taosThreadMutexDestroy(&pMeta->pCache->sTagFilterResCache.lock); + taosMemoryFree(pMeta->pCache); pMeta->pCache = NULL; } @@ -206,7 +210,7 @@ _exit: int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { int32_t code = 0; - // ASSERT(metaIsWLocked(pMeta)); + // meta is wlocked for calling this func. // search SMetaCache* pCache = pMeta->pCache; @@ -217,7 +221,10 @@ int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { } if (*ppEntry) { // update - ASSERT(pInfo->suid == (*ppEntry)->info.suid); + if (pInfo->suid != (*ppEntry)->info.suid) { + metaError("meta/cache: suid should be same as the one in cache."); + return TSDB_CODE_FAILED; + } if (pInfo->version > (*ppEntry)->info.version) { (*ppEntry)->info.version = pInfo->version; (*ppEntry)->info.skmVer = pInfo->skmVer; @@ -336,7 +343,7 @@ _exit: int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo) { int32_t code = 0; - // ASSERT(metaIsWLocked(pMeta)); + // meta is wlocked for calling this func. // search SMetaCache* pCache = pMeta->pCache; @@ -422,63 +429,82 @@ int32_t metaStatsCacheGet(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo) { int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray* pList1, bool* acquireRes) { - uint64_t* pBuf = pMeta->pCache->sTagFilterResCache.keyBuf; - // generate the composed key for LRU cache - SLRUCache* pCache = pMeta->pCache->sTagFilterResCache.pUidResCache; + SLRUCache* pCache = pMeta->pCache->sTagFilterResCache.pUidResCache; + SHashObj* pTableMap = pMeta->pCache->sTagFilterResCache.pTableEntry; + TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock; - pBuf[0] = suid; - memcpy(&pBuf[1], pKey, keyLen); + uint64_t buf[3] = {0}; + uint32_t times = 0; + + *acquireRes = 0; + buf[0] = suid; + memcpy(&buf[1], pKey, keyLen); + + taosThreadMutexLock(pLock); int32_t len = keyLen + sizeof(uint64_t); - LRUHandle* pHandle = taosLRUCacheLookup(pCache, pBuf, len); + LRUHandle* pHandle = taosLRUCacheLookup(pCache, buf, len); if (pHandle == NULL) { - *acquireRes = 0; + taosThreadMutexUnlock(pLock); return TSDB_CODE_SUCCESS; - } else { // do some book mark work after acquiring the filter result from cache - STagFilterResEntry** pEntry = taosHashGet(pMeta->pCache->sTagFilterResCache.pTableEntry, &suid, sizeof(uint64_t)); - ASSERT(pEntry != NULL); - *acquireRes = 1; + } - const char* p = taosLRUCacheValue(pMeta->pCache->sTagFilterResCache.pUidResCache, pHandle); - int32_t size = *(int32_t*)p; - taosArrayAddBatch(pList1, p + sizeof(int32_t), size); + // do some book mark work after acquiring the filter result from cache + STagFilterResEntry** pEntry = taosHashGet(pTableMap, &suid, sizeof(uint64_t)); + if (NULL == pEntry) { + metaError("meta/cache: pEntry should not be NULL."); + return TSDB_CODE_FAILED; + } - (*pEntry)->qTimes += 1; - taosLRUCacheRelease(pCache, pHandle, false); + *acquireRes = 1; - // check if scanning all items are necessary or not - if ((*pEntry)->qTimes >= 5000 && TD_DLIST_NELES(&(*pEntry)->list) > 10) { - SArray* pList = taosArrayInit(64, POINTER_BYTES); + const char* p = taosLRUCacheValue(pCache, pHandle); + int32_t size = *(int32_t*)p; - SListIter iter = {0}; - tdListInitIter(&(*pEntry)->list, &iter, TD_LIST_FORWARD); + // set the result into the buffer + taosArrayAddBatch(pList1, p + sizeof(int32_t), size); - SListNode* pNode = NULL; - while ((pNode = tdListNext(&iter)) != NULL) { - memcpy(&pBuf[1], pNode->data, keyLen); + times = atomic_add_fetch_32(&(*pEntry)->qTimes, 1); + taosLRUCacheRelease(pCache, pHandle, false); - // check whether it is existed in LRU cache, and remove it from linked list if not. - LRUHandle* pRes = taosLRUCacheLookup(pCache, pBuf, len); - if (pRes == NULL) { // remove the item in the linked list - taosArrayPush(pList, &pNode); - } else { - taosLRUCacheRelease(pCache, pRes, false); - } + // unlock meta + taosThreadMutexUnlock(pLock); + + // check if scanning all items are necessary or not + if (times >= 5000 && TD_DLIST_NELES(&(*pEntry)->list) > 10) { + taosThreadMutexLock(pLock); + + SArray* pInvalidRes = taosArrayInit(64, POINTER_BYTES); + + SListIter iter = {0}; + tdListInitIter(&(*pEntry)->list, &iter, TD_LIST_FORWARD); + + SListNode* pNode = NULL; + while ((pNode = tdListNext(&iter)) != NULL) { + memcpy(&buf[1], pNode->data, keyLen); + + // check whether it is existed in LRU cache, and remove it from linked list if not. + LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len); + if (pRes == NULL) { // remove the item in the linked list + taosArrayPush(pInvalidRes, &pNode); + } else { + taosLRUCacheRelease(pCache, pRes, false); } - - // remove the keys, of which query uid lists have been replaced already. - size_t s = taosArrayGetSize(pList); - for (int32_t i = 0; i < s; ++i) { - SListNode** p1 = taosArrayGet(pList, i); - tdListPopNode(&(*pEntry)->list, *p1); - taosMemoryFree(*p1); - } - - (*pEntry)->qTimes = 0; // reset the query times - - taosArrayDestroy(pList); } + + // remove the keys, of which query uid lists have been replaced already. + size_t s = taosArrayGetSize(pInvalidRes); + for (int32_t i = 0; i < s; ++i) { + SListNode** p1 = taosArrayGet(pInvalidRes, i); + tdListPopNode(&(*pEntry)->list, *p1); + taosMemoryFree(*p1); + } + + atomic_store_32(&(*pEntry)->qTimes, 0); // reset the query times + taosArrayDestroy(pInvalidRes); + + taosThreadMutexUnlock(pLock); } return TSDB_CODE_SUCCESS; @@ -510,8 +536,11 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int return TSDB_CODE_SUCCESS; } - SLRUCache* pCache = pMeta->pCache->sTagFilterResCache.pUidResCache; - SHashObj* pTableEntry = pMeta->pCache->sTagFilterResCache.pTableEntry; + SLRUCache* pCache = pMeta->pCache->sTagFilterResCache.pUidResCache; + SHashObj* pTableEntry = pMeta->pCache->sTagFilterResCache.pTableEntry; + TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock; + + taosThreadMutexLock(pLock); STagFilterResEntry** pEntry = taosHashGet(pTableEntry, &suid, sizeof(uint64_t)); if (pEntry == NULL) { @@ -524,15 +553,21 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int tdListAppend(&(*pEntry)->list, pKey); } - uint64_t* pBuf = pMeta->pCache->sTagFilterResCache.keyBuf; - pBuf[0] = suid; + uint64_t buf[3] = {0}; + buf[0] = suid; - memcpy(&pBuf[1], pKey, keyLen); - ASSERT(sizeof(uint64_t) + keyLen == 24); + memcpy(&buf[1], pKey, keyLen); + if (sizeof(uint64_t) + keyLen != 24) { + metaError("meta/cache: incorrect keyLen:%" PRId32 " length.", keyLen); + return TSDB_CODE_FAILED; + } // add to cache. - taosLRUCacheInsert(pCache, pBuf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, + taosLRUCacheInsert(pCache, buf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, TAOS_LRU_PRIORITY_LOW); + + taosThreadMutexUnlock(pLock); + metaDebug("vgId:%d, suid:%" PRIu64 " list cache added into cache, total:%d, tables:%d", TD_VID(pMeta->pVnode), suid, (int32_t)taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry)); @@ -541,15 +576,19 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int // remove the lru cache that are expired due to the tags value update, or creating, or dropping, of child tables int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) { - STagFilterResEntry** pEntry = taosHashGet(pMeta->pCache->sTagFilterResCache.pTableEntry, &suid, sizeof(uint64_t)); - if (pEntry == NULL || listNEles(&(*pEntry)->list) == 0) { - return TSDB_CODE_SUCCESS; - } - int32_t keyLen = sizeof(uint64_t) * 3; uint64_t p[3] = {0}; p[0] = suid; + TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock; + + taosThreadMutexLock(pLock); + STagFilterResEntry** pEntry = taosHashGet(pMeta->pCache->sTagFilterResCache.pTableEntry, &suid, sizeof(uint64_t)); + if (pEntry == NULL || listNEles(&(*pEntry)->list) == 0) { + taosThreadMutexUnlock(pLock); + return TSDB_CODE_SUCCESS; + } + SListIter iter = {0}; tdListInitIter(&(*pEntry)->list, &iter, TD_LIST_FORWARD); @@ -562,5 +601,6 @@ int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) { (*pEntry)->qTimes = 0; tdListEmpty(&(*pEntry)->list); + taosThreadMutexUnlock(pLock); return TSDB_CODE_SUCCESS; } diff --git a/source/dnode/vnode/src/meta/metaCommit.c b/source/dnode/vnode/src/meta/metaCommit.c index ac8d99ccf0..f61930b84c 100644 --- a/source/dnode/vnode/src/meta/metaCommit.c +++ b/source/dnode/vnode/src/meta/metaCommit.c @@ -15,8 +15,10 @@ #include "meta.h" -static FORCE_INLINE void *metaMalloc(void *pPool, size_t size) { return vnodeBufPoolMalloc((SVBufPool *)pPool, size); } -static FORCE_INLINE void metaFree(void *pPool, void *p) { vnodeBufPoolFree((SVBufPool *)pPool, p); } +static FORCE_INLINE void *metaMalloc(void *pPool, size_t size) { + return vnodeBufPoolMallocAligned((SVBufPool *)pPool, size); +} +static FORCE_INLINE void metaFree(void *pPool, void *p) { vnodeBufPoolFree((SVBufPool *)pPool, p); } // begin a meta txn int metaBegin(SMeta *pMeta, int8_t heap) { diff --git a/source/dnode/vnode/src/meta/metaEntry.c b/source/dnode/vnode/src/meta/metaEntry.c index 72f7365a1e..e50931ac06 100644 --- a/source/dnode/vnode/src/meta/metaEntry.c +++ b/source/dnode/vnode/src/meta/metaEntry.c @@ -51,7 +51,9 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) { } else if (pME->type == TSDB_TSMA_TABLE) { if (tEncodeTSma(pCoder, pME->smaEntry.tsma) < 0) return -1; } else { - ASSERT(0); + metaError("meta/entry: invalide table type: %" PRId8 " encode failed.", pME->type); + + return -1; } tEndEncode(pCoder); @@ -99,7 +101,9 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { } if (tDecodeTSma(pCoder, pME->smaEntry.tsma, true) < 0) return -1; } else { - ASSERT(0); + metaError("meta/entry: invalide table type: %" PRId8 " decode failed.", pME->type); + + return -1; } tEndDecode(pCoder); diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 1b5f742559..a78239eb56 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -358,7 +358,10 @@ static int tagIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL return -1; } - ASSERT(pTagIdxKey1->type == pTagIdxKey2->type); + if (pTagIdxKey1->type != pTagIdxKey2->type) { + metaError("meta/open: incorrect tag idx type."); + return TSDB_CODE_FAILED; + } // check NULL, NULL is always the smallest if (pTagIdxKey1->isNull && !pTagIdxKey2->isNull) { diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 619ae03ae4..0697f68f89 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -19,7 +19,7 @@ void metaReaderInit(SMetaReader *pReader, SMeta *pMeta, int32_t flags) { memset(pReader, 0, sizeof(*pReader)); pReader->flags = flags; pReader->pMeta = pMeta; - if (!(flags & META_READER_NOLOCK)) { + if (pReader->pMeta && !(flags & META_READER_NOLOCK)) { metaRLock(pMeta); } } @@ -152,7 +152,7 @@ bool metaIsTableExist(SMeta *pMeta, tb_uid_t uid) { } int metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid) { - SMeta *pMeta = pReader->pMeta; + SMeta *pMeta = pReader->pMeta; int64_t version1; // query uid.idx @@ -239,7 +239,6 @@ int metaGetTableSzNameByUid(void *meta, uint64_t uid, char *tbName) { return 0; } - int metaGetTableUidByName(void *meta, char *tbName, uint64_t *uid) { int code = 0; SMetaReader mr = {0}; @@ -653,7 +652,11 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv goto _exit; } - ASSERT(c); + if (c == 0) { + metaError("meta/query: incorrect c: %" PRId32 ".", c); + code = TSDB_CODE_FAILED; + goto _exit; + } if (c < 0) { tdbTbcMoveToPrev(pSkmDbC); @@ -677,7 +680,11 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv } } - ASSERT(sver > 0); + if (sver <= 0) { + metaError("meta/query: incorrect sver: %" PRId32 ".", sver); + code = TSDB_CODE_FAILED; + goto _exit; + } skmDbKey.uid = suid ? suid : uid; skmDbKey.sver = sver; @@ -737,9 +744,7 @@ int64_t metaGetTimeSeriesNum(SMeta *pMeta) { return pMeta->pVnode->config.vndStats.numOfTimeSeries + pMeta->pVnode->config.vndStats.numOfNTimeSeries; } -int64_t metaGetNtbNum(SMeta *pMeta) { - return pMeta->pVnode->config.vndStats.numOfNTables; -} +int64_t metaGetNtbNum(SMeta *pMeta) { return pMeta->pVnode->config.vndStats.numOfNTables; } typedef struct { SMeta *pMeta; diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index 054e785980..4dcb7f4ec0 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -100,7 +100,10 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { break; } - ASSERT(pData && nData); + if (!pData || !nData) { + metaError("meta/snap: invalide nData: %" PRId32 " meta snap read failed.", nData); + goto _exit; + } *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData); if (*ppData == NULL) { @@ -113,8 +116,8 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { pHdr->size = nData; memcpy(pHdr->data, pData, nData); - metaInfo("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " nData:%d", - TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData); + metaDebug("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " blockLen:%d", + TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData); _exit: return code; @@ -356,7 +359,11 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t for (int i = 0; i < taosArrayGetSize(ctx->idList); i++) { int64_t* uid = taosArrayGet(ctx->idList, i); SIdInfo* idData = (SIdInfo*)taosHashGet(ctx->idVersion, uid, sizeof(int64_t)); - ASSERT(idData); + if (!idData) { + metaError("meta/snap: null idData"); + return TSDB_CODE_FAILED; + } + idData->index = i; metaDebug("tmqsnap init idVersion uid:%" PRIi64 " version:%" PRIi64 " index:%d", *uid, idData->version, idData->index); @@ -473,7 +480,10 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index); ctx->index++; SIdInfo* idInfo = (SIdInfo*)taosHashGet(ctx->idVersion, uidTmp, sizeof(tb_uid_t)); - ASSERT(idInfo); + if (!idInfo) { + metaError("meta/snap: null idInfo"); + return TSDB_CODE_FAILED; + } *uid = *uidTmp; ret = MoveToPosition(ctx, idInfo->version, *uidTmp); @@ -507,7 +517,11 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in (ctx->subType == TOPIC_SUB_TYPE__TABLE && me.type == TSDB_CHILD_TABLE && me.ctbEntry.suid == ctx->suid)) { STableInfoForChildTable* data = (STableInfoForChildTable*)taosHashGet(ctx->suidInfo, &me.ctbEntry.suid, sizeof(tb_uid_t)); - ASSERT(data); + if (!data) { + metaError("meta/snap: null data"); + return TSDB_CODE_FAILED; + } + SVCreateTbReq req = {0}; req.type = TSDB_CHILD_TABLE; @@ -528,7 +542,8 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in } else { SArray* pTagVals = NULL; if (tTagToValArray((const STag*)p, &pTagVals) != 0) { - ASSERT(0); + metaError("meta/snap: tag to val array failed."); + return TSDB_CODE_FAILED; } int16_t nCols = taosArrayGetSize(pTagVals); for (int j = 0; j < nCols; ++j) { @@ -572,7 +587,8 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in ret = buildNormalChildTableInfo(&req, pBuf, contLen); *type = TDMT_VND_CREATE_TABLE; } else { - ASSERT(0); + metaError("meta/snap: invalid topic sub type: %" PRId8 " get meta from snap failed.", ctx->subType); + ret = -1; } tDecoderClear(&dc); @@ -593,7 +609,10 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx) { int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index); ctx->index++; SIdInfo* idInfo = (SIdInfo*)taosHashGet(ctx->idVersion, uidTmp, sizeof(tb_uid_t)); - ASSERT(idInfo); + if (!idInfo) { + metaError("meta/snap: null idInfo"); + return result; + } int32_t ret = MoveToPosition(ctx, idInfo->version, *uidTmp); if (ret != 0) { diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index dc295ae5e7..0aaf6417a8 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -46,7 +46,7 @@ static void metaGetEntryInfo(const SMetaEntry *pEntry, SMetaInfo *pInfo) { pInfo->suid = 0; pInfo->skmVer = pEntry->ntbEntry.schemaRow.version; } else { - ASSERT(0); + metaError("meta/table: invalide table type: %" PRId8 " get entry info failed.", pEntry->type); } } @@ -342,10 +342,18 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(ret == 0 && c == 0); + if (!(ret == 0 && c == 0)) { + metaError("meta/table: invalide ret: %" PRId32 " or c: %" PRId32 "alter stb failed.", ret, c); + return -1; + } ret = tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); - ASSERT(ret == 0); + if (ret < 0) { + tdbTbcClose(pTbDbc); + + terrno = TSDB_CODE_TDB_STB_NOT_EXIST; + return -1; + } oStbEntry.pBuf = taosMemoryMalloc(nData); memcpy(oStbEntry.pBuf, pData, nData); @@ -558,7 +566,8 @@ static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME) { ctime = pME->ntbEntry.ctime; ttlDays = pME->ntbEntry.ttlDays; } else { - ASSERT(0); + metaError("meta/table: invalide table type: %" PRId8 " build ttl idx key failed.", pME->type); + return; } if (ttlDays <= 0) return; @@ -710,8 +719,8 @@ int metaUpdateCtimeIdx(SMeta *pMeta, const SMetaEntry *pME) { if (metaBuildCtimeIdxKey(&ctimeKey, pME) < 0) { return 0; } - metaDebug("vgId:%d, start to save ctime:%" PRId64 " uid:%" PRId64 " ct:%" PRId64, TD_VID(pMeta->pVnode), pME->version, - pME->uid, ctimeKey.ctime); + metaTrace("vgId:%d, start to save version:%" PRId64 " uid:%" PRId64 " ctime:%" PRId64, TD_VID(pMeta->pVnode), + pME->version, pME->uid, ctimeKey.ctime); return tdbTbInsert(pMeta->pCtimeIdx, &ctimeKey, sizeof(ctimeKey), NULL, 0, pMeta->txn); } @@ -773,7 +782,10 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - ASSERT(c == 0); + if (c != 0) { + metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c); + return -1; + } tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -783,7 +795,11 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(c == 0); + if (c != 0) { + metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c); + return -1; + } + tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); // get table entry @@ -792,7 +808,11 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl memcpy(entry.pBuf, pData, nData); tDecoderInit(&dc, entry.pBuf, nData); ret = metaDecodeEntry(&dc, &entry); - ASSERT(ret == 0); + if (ret != 0) { + tDecoderClear(&dc); + metaError("meta/table: invalide ret: %" PRId32 " alt tb column failed.", ret); + return -1; + } if (entry.type != TSDB_NORMAL_TABLE) { terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION; @@ -812,7 +832,11 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl if (iCol >= pSchema->nCols) break; pColumn = &pSchema->pSchema[iCol]; - ASSERT(pAlterTbReq->colName); + if (NULL == pAlterTbReq->colName) { + metaError("meta/table: null pAlterTbReq->colName"); + return -1; + } + if (strcmp(pColumn->name, pAlterTbReq->colName) == 0) break; iCol++; } @@ -964,7 +988,10 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - ASSERT(c == 0); + if (c != 0) { + metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c); + return -1; + } tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -977,7 +1004,11 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA /* get ctbEntry */ tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(c == 0); + if (c != 0) { + metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c); + return -1; + } + tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); ctbEntry.pBuf = taosMemoryMalloc(nData); @@ -1075,7 +1106,11 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA metaUpdateTagIdx(pMeta, &ctbEntry); } - ASSERT(ctbEntry.ctbEntry.pTags); + if (NULL == ctbEntry.ctbEntry.pTags) { + metaError("meta/table: null tags, update tag val failed."); + goto _err; + } + SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid}; tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags, ((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn); @@ -1130,7 +1165,10 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - ASSERT(c == 0); + if (c != 0) { + metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c); + return -1; + } tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -1140,7 +1178,11 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(c == 0); + if (c != 0) { + metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c); + return -1; + } + tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); // get table entry @@ -1149,7 +1191,11 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p memcpy(entry.pBuf, pData, nData); tDecoderInit(&dc, entry.pBuf, nData); ret = metaDecodeEntry(&dc, &entry); - ASSERT(ret == 0); + if (ret != 0) { + tDecoderClear(&dc); + metaError("meta/table: invalide ret: %" PRId32 " alt tb options failed.", ret); + return -1; + } entry.version = version; metaWLock(pMeta); @@ -1408,7 +1454,8 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) { } else if (pME->type == TSDB_NORMAL_TABLE) { pSW = &pME->ntbEntry.schemaRow; } else { - ASSERT(0); + metaError("meta/table: invalide table type: %" PRId8 " save skm db failed.", pME->type); + return TSDB_CODE_FAILED; } skmDbKey.uid = pME->uid; diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index e633d93de6..2b96307c6a 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -241,7 +241,7 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char SRpcMsg submitReqMsg = { .msgType = TDMT_VND_SUBMIT, .pCont = pSubmitReq, - .contLen = ntohl(contLen), + .contLen = contLen, }; if (tmsgPutToQueue(&pSma->pVnode->msgCb, WRITE_QUEUE, &submitReqMsg) < 0) { diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 6490906298..d0017e4ba2 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -80,6 +80,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode) { } pTq->path = strdup(path); pTq->pVnode = pVnode; + pTq->walLogLastVer = pVnode->pWal->vers.lastVer; pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK); taosHashSetFreeFp(pTq->pHandle, destroySTqHandle); @@ -1013,6 +1014,7 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) { tqError("unable to encode rsp %d", __LINE__); return -1; } + void* buf = rpcMallocCont(sizeof(SMsgHead) + len); ((SMsgHead*)buf)->vgId = htonl(req.upstreamNodeId); @@ -1542,3 +1544,5 @@ FAIL: taosFreeQitem(pMsg); return -1; } + +int32_t tqCheckLogInWal(STQ* pTq, int64_t version) { return version <= pTq->walLogLastVer; } diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 09fdd64c7e..342b4ea6ba 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -426,7 +426,7 @@ int32_t tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchema* p goto _end; } - for (int32_t j = 0; j < rows; j++) { + for (int32_t j = 0; j < rows; ++j) { taosArrayClear(pVals); for (int32_t k = 0; k < pTSchema->numOfCols; k++) { const STColumn* pCol = &pTSchema->columns[k]; @@ -469,7 +469,7 @@ int32_t tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchema* p if (NULL == pBuf) { goto _end; } - ((SMsgHead*)pBuf)->vgId = htonl(TD_VID(pVnode)); + ((SMsgHead*)pBuf)->vgId = TD_VID(pVnode); ((SMsgHead*)pBuf)->contLen = htonl(len); tEncoderInit(&encoder, POINTER_SHIFT(pBuf, sizeof(SMsgHead)), len - sizeof(SMsgHead)); if (tEncodeSSubmitReq2(&encoder, pReq) < 0) { @@ -756,24 +756,14 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void* tqDebug("vgId:%d, task %d write into table, block num: %d", TD_VID(pVnode), pTask->taskId, blockSz); - void* pBuf = NULL; - SSubmitReq2* pReq = NULL; - SArray* tagArray = NULL; - SArray* pVals = NULL; + void* pBuf = NULL; + SArray* tagArray = NULL; + SArray* pVals = NULL; if (!(tagArray = taosArrayInit(1, sizeof(STagVal)))) { goto _end; } - if (!(pReq = taosMemoryCalloc(1, sizeof(SSubmitReq2)))) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - goto _end; - } - - if (!(pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData)))) { - goto _end; - } - for (int32_t i = 0; i < blockSz; i++) { SSDataBlock* pDataBlock = taosArrayGet(pBlocks, i); if (pDataBlock->info.type == STREAM_DELETE_RESULT) { @@ -948,13 +938,17 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void* taosArrayPush(tbData.aRowP, &pRow); } - taosArrayClear(pReq->aSubmitTbData); - taosArrayPush(pReq->aSubmitTbData, &tbData); + SSubmitReq2 submitReq = {0}; + if (!(submitReq.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData)))) { + goto _end; + } + + taosArrayPush(submitReq.aSubmitTbData, &tbData); // encode int32_t len; int32_t code; - tEncodeSize(tEncodeSSubmitReq2, pReq, len, code); + tEncodeSize(tEncodeSSubmitReq2, &submitReq, len, code); SEncoder encoder; len += sizeof(SMsgHead); pBuf = rpcMallocCont(len); @@ -964,7 +958,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void* ((SMsgHead*)pBuf)->vgId = TD_VID(pVnode); ((SMsgHead*)pBuf)->contLen = htonl(len); tEncoderInit(&encoder, POINTER_SHIFT(pBuf, sizeof(SMsgHead)), len - sizeof(SMsgHead)); - if (tEncodeSSubmitReq2(&encoder, pReq) < 0) { + if (tEncodeSSubmitReq2(&encoder, &submitReq) < 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; tqError("failed to encode submit req since %s", terrstr()); tEncoderClear(&encoder); @@ -972,6 +966,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void* continue; } tEncoderClear(&encoder); + tDestroySSubmitReq2(&submitReq, TSDB_MSG_FLG_ENCODE); SRpcMsg msg = { .msgType = TDMT_VND_SUBMIT, @@ -988,8 +983,6 @@ _end: taosArrayDestroy(tagArray); taosArrayDestroy(pVals); // TODO: change - tDestroySSubmitReq2(pReq, TSDB_MSG_FLG_ENCODE); - taosMemoryFree(pReq); } #if 0 diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 7375148d25..c7b36ebb22 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1473,29 +1473,6 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader * return code; } -// int32_t tsdbCacheLastArray2Row(SArray *pLastArray, STSRow **ppRow, STSchema *pTSchema) { -// int32_t code = 0; -// int16_t nCol = taosArrayGetSize(pLastArray); -// SArray *pColArray = taosArrayInit(nCol, sizeof(SColVal)); - -// for (int16_t iCol = 0; iCol < nCol; ++iCol) { -// SLastCol *tTsVal = (SLastCol *)taosArrayGet(pLastArray, iCol); -// SColVal *tColVal = &tTsVal->colVal; -// taosArrayPush(pColArray, tColVal); -// } - -// code = tdSTSRowNew(pColArray, pTSchema, ppRow); -// if (code) goto _err; - -// taosArrayDestroy(pColArray); - -// return code; - -// _err: -// taosArrayDestroy(pColArray); - -// return code; -// } int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *pr, LRUHandle **handle) { int32_t code = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 76e5897e53..9f48125638 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -20,9 +20,8 @@ #define HASTYPE(_type, _t) (((_type) & (_t)) == (_t)) -static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pReader, const int32_t* slotIds, - void** pRes) { - ASSERT(pReader->numOfCols <= taosArrayGetSize(pBlock->pDataBlock)); +static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pReader, const int32_t* slotIds, + void** pRes, const char* idStr) { int32_t numOfRows = pBlock->info.rows; if (HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST)) { @@ -65,9 +64,7 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea } pBlock->info.rows += allNullRow ? 0 : 1; - } else { - ASSERT(HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST_ROW)); - + } else if (HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST_ROW)) { for (int32_t i = 0; i < pReader->numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); @@ -94,11 +91,16 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea } pBlock->info.rows += 1; + } else { + tsdbError("invalid retrieve type:%d, %s", pReader->type, idStr); + return TSDB_CODE_INVALID_PARA; } + + return TSDB_CODE_SUCCESS; } int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, int32_t numOfTables, int32_t numOfCols, - uint64_t suid, void** pReader) { + uint64_t suid, void** pReader, const char* idstr) { *pReader = NULL; SCacheRowsReader* p = taosMemoryCalloc(1, sizeof(SCacheRowsReader)); if (p == NULL) { @@ -142,6 +144,8 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, return TSDB_CODE_OUT_OF_MEMORY; } + p->idstr = taosMemoryStrDup(idstr); + *pReader = p; return TSDB_CODE_SUCCESS; } @@ -160,6 +164,7 @@ void* tsdbCacherowsReaderClose(void* pReader) { destroyLastBlockLoadInfo(p->pLoadInfo); + taosMemoryFree((void*) p->idstr); taosMemoryFree(pReader); return NULL; } @@ -312,7 +317,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } if (hasRes) { - saveOneRow(pLastCols, pResBlock, pr, slotIds, pRes); + saveOneRow(pLastCols, pResBlock, pr, slotIds, pRes, pr->idstr); } } else if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_ALL)) { @@ -331,7 +336,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 continue; } - saveOneRow(pRow, pResBlock, pr, slotIds, pRes); + saveOneRow(pRow, pResBlock, pr, slotIds, pRes, pr->idstr); // TODO reset the pRes taosArrayPush(pTableUidList, &pKeyInfo->uid); diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index eebfde49db..1f99444cf3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -32,13 +32,13 @@ struct SLDataIter { }; SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols) { - SSttBlockLoadInfo *pLoadInfo = taosMemoryCalloc(TSDB_DEFAULT_STT_FILE, sizeof(SSttBlockLoadInfo)); + SSttBlockLoadInfo *pLoadInfo = taosMemoryCalloc(TSDB_MAX_STT_TRIGGER, sizeof(SSttBlockLoadInfo)); if (pLoadInfo == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } - for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) { + for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) { pLoadInfo[i].blockIndex[0] = -1; pLoadInfo[i].blockIndex[1] = -1; pLoadInfo[i].currentLoadBlockIndex = 1; @@ -63,7 +63,7 @@ SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, } void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { - for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) { + for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) { pLoadInfo[i].currentLoadBlockIndex = 1; pLoadInfo[i].blockIndex[0] = -1; pLoadInfo[i].blockIndex[1] = -1; @@ -77,14 +77,14 @@ void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { } void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double *el) { - for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) { + for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) { *el += pLoadInfo[i].elapsedTime; *blocks += pLoadInfo[i].loadBlocks; } } void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { - for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) { + for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) { pLoadInfo[i].currentLoadBlockIndex = 1; pLoadInfo[i].blockIndex[0] = -1; pLoadInfo[i].blockIndex[1] = -1; @@ -158,9 +158,9 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) { pBlock, el, idStr); pInfo->blockIndex[pInfo->currentLoadBlockIndex] = pIter->iSttBlk; - tsdbDebug("last block index list:%d, %d, %s", pInfo->blockIndex[0], pInfo->blockIndex[1], idStr); - pIter->iRow = (pIter->backward) ? pInfo->blockData[pInfo->currentLoadBlockIndex].nRow : -1; + + tsdbDebug("last block index list:%d, %d, rowIndex:%d %s", pInfo->blockIndex[0], pInfo->blockIndex[1], pIter->iRow, idStr); return &pInfo->blockData[pInfo->currentLoadBlockIndex]; _exit: @@ -419,6 +419,7 @@ static void findNextValidRow(SLDataIter *pIter, const char *idStr) { pBlockData->aUid != NULL) { i = binarySearchForStartRowIndex((uint64_t *)pBlockData->aUid, pBlockData->nRow, pIter->uid, pIter->backward); if (i == -1) { + tsdbDebug("failed to find the data in pBlockData, uid:%"PRIu64" , %s", pIter->uid, idStr); pIter->iRow = -1; return; } @@ -500,7 +501,12 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) { if (iBlockL != pIter->iSttBlk) { pBlockData = loadLastBlock(pIter, idStr); - pIter->iRow += step; + if (pBlockData == NULL) { + goto _exit; + } + + // set start row index + pIter->iRow = pIter->backward? pBlockData->nRow-1:0; } } @@ -561,7 +567,6 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead pMTree->pLoadInfo = pBlockLoadInfo; pMTree->destroyLoadInfo = destroyLoadInfo; - ASSERT(pMTree->pLoadInfo != NULL); for (int32_t i = 0; i < pFReader->pSet->nSttF; ++i) { // open all last file struct SLDataIter *pIter = NULL; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 9dd4556202..1938f751a2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -244,7 +244,7 @@ static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pC return TSDB_CODE_SUCCESS; } -static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) { +static int32_t updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) { int32_t i = 0, j = 0; while (i < pSchema->numOfCols && j < pSupInfo->numOfCols) { @@ -252,7 +252,7 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) if (pTCol->colId == pSupInfo->colId[j]) { if (!IS_BSMA_ON(pTCol)) { pSupInfo->smaValid = false; - return; + return TSDB_CODE_SUCCESS; } i += 1; @@ -261,9 +261,11 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) // do nothing i += 1; } else { - ASSERT(0); + return TSDB_CODE_INVALID_PARA; } } + + return TSDB_CODE_SUCCESS; } static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) { @@ -398,7 +400,6 @@ static void destroyAllBlockScanInfo(SHashObj* pTableMap) { } static bool isEmptyQueryTimeWindow(STimeWindow* pWindow) { - ASSERT(pWindow != NULL); return pWindow->skey > pWindow->ekey; } @@ -582,7 +583,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd } if (VND_IS_TSMA(pVnode)) { - tsdbDebug("vgId:%d, tsma is selected to query", TD_VID(pVnode)); + tsdbDebug("vgId:%d, tsma is selected to query, %s", TD_VID(pVnode), idstr); } initReaderStatus(&pReader->status); @@ -597,7 +598,6 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd pReader->type = pCond->type; pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows); pReader->blockInfoBuf.numPerBucket = 1000; // 1000 tables per bucket - ASSERT(pCond->numOfCols > 0); if (pReader->pResBlock == NULL) { pReader->freeBlock = true; @@ -608,6 +608,12 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd } } + if (pCond->numOfCols <= 0) { + tsdbError("vgId:%d, invalid column number %d in query cond, %s", TD_VID(pVnode), pCond->numOfCols, idstr); + code = TSDB_CODE_INVALID_PARA; + goto _end; + } + // todo refactor. limitOutputBufferSize(pCond, &pReader->capacity); @@ -796,8 +802,9 @@ static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_ } static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) { - if (taosArrayGetSize(pBlockIter->blockList) == 0) { - ASSERT(pBlockIter->numOfBlocks == taosArrayGetSize(pBlockIter->blockList)); + size_t num = taosArrayGetSize(pBlockIter->blockList); + if (num == 0) { + ASSERT(pBlockIter->numOfBlocks == num); return NULL; } @@ -807,73 +814,6 @@ static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) { static SDataBlk* getCurrentBlock(SDataBlockIter* pBlockIter) { return &pBlockIter->block; } -int32_t binarySearchForTs(char* pValue, int num, TSKEY key, int order) { - int32_t midPos = -1; - int32_t numOfRows; - - ASSERT(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); - - TSKEY* keyList = (TSKEY*)pValue; - int32_t firstPos = 0; - int32_t lastPos = num - 1; - - if (order == TSDB_ORDER_DESC) { - // find the first position which is smaller than the key - while (1) { - if (key >= keyList[firstPos]) return firstPos; - if (key == keyList[lastPos]) return lastPos; - - if (key < keyList[lastPos]) { - lastPos += 1; - if (lastPos >= num) { - return -1; - } else { - return lastPos; - } - } - - numOfRows = lastPos - firstPos + 1; - midPos = (numOfRows >> 1) + firstPos; - - if (key < keyList[midPos]) { - firstPos = midPos + 1; - } else if (key > keyList[midPos]) { - lastPos = midPos - 1; - } else { - break; - } - } - - } else { - // find the first position which is bigger than the key - while (1) { - if (key <= keyList[firstPos]) return firstPos; - if (key == keyList[lastPos]) return lastPos; - - if (key > keyList[lastPos]) { - lastPos = lastPos + 1; - if (lastPos >= num) - return -1; - else - return lastPos; - } - - numOfRows = lastPos - firstPos + 1; - midPos = (numOfRows >> 1u) + firstPos; - - if (key < keyList[midPos]) { - lastPos = midPos - 1; - } else if (key > keyList[midPos]) { - firstPos = midPos + 1; - } else { - break; - } - } - } - - return midPos; -} - static int doBinarySearchKey(TSKEY* keyList, int num, int pos, TSKEY key, int order) { // start end position int s, e; @@ -974,8 +914,8 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo int32_t step = asc ? 1 : -1; - // make sure it is aligned to 8bit - ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); + // make sure it is aligned to 8bit, the allocated memory address is aligned to 256bit +// ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); // 1. copy data in a batch model memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes); @@ -1073,11 +1013,20 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn // pDumpInfo->rowIndex = 0; } else if (!asc && pReader->window.ekey >= pBlock->maxKey.ts) { // pDumpInfo->rowIndex = pBlock->nRow - 1; - } else { + } else { // find the appropriate the start position in current block, and set it to be the current rowIndex int32_t pos = asc ? pBlock->nRow - 1 : 0; int32_t order = asc ? TSDB_ORDER_DESC : TSDB_ORDER_ASC; int64_t key = asc ? pReader->window.skey : pReader->window.ekey; pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, key, order); + + if (pDumpInfo->rowIndex < 0) { + tsdbError( + "%p failed to locate the start position in current block, global index:%d, table index:%d, brange:%" PRId64 + "-%" PRId64 ", minVer:%" PRId64 ", maxVer:%" PRId64 " %s", + pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, pBlock->minVer, + pBlock->maxVer, pReader->idStr); + return TSDB_CODE_INVALID_PARA; + } } } @@ -1186,7 +1135,6 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - ASSERT(pBlockInfo != NULL); SDataBlk* pBlock = getCurrentBlock(pBlockIter); code = tsdbReadDataBlock(pReader->pFileReader, pBlock, pBlockData); @@ -1224,8 +1172,6 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) { } static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) { - ASSERT(numOfTables >= 1); - pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); pSup->pDataBlockInfo = taosMemoryCalloc(1, POINTER_BYTES * numOfTables); @@ -1332,7 +1278,10 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte sup.numOfTables += 1; } - ASSERT(numOfBlocks == cnt); + if (numOfBlocks != cnt && sup.numOfTables != numOfTables) { + cleanupBlockOrderSupporter(&sup); + return TSDB_CODE_INVALID_PARA; + } // since there is only one table qualified, blocks are not sorted if (sup.numOfTables == 1) { @@ -1354,10 +1303,9 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables %s", pReader, cnt, sup.numOfTables, pReader->idStr); - ASSERT(cnt <= numOfBlocks && sup.numOfTables <= numOfTables); - SMultiwayMergeTreeInfo* pTree = NULL; - uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar); + + uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar); if (ret != TSDB_CODE_SUCCESS) { cleanupBlockOrderSupporter(&sup); return TSDB_CODE_OUT_OF_MEMORY; @@ -1435,8 +1383,6 @@ static bool getNeighborBlockOfSameTable(SFileDataBlockInfo* pBlockInfo, STableBl } static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlockInfo* pFBlockInfo) { - ASSERT(pBlockIter != NULL && pFBlockInfo != NULL); - int32_t step = ASCENDING_TRAVERSE(pBlockIter->order) ? 1 : -1; int32_t index = pBlockIter->index; @@ -1449,7 +1395,6 @@ static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlock index += step; } - ASSERT(0); return -1; } @@ -1928,7 +1873,6 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, } doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); - ASSERT(mergeBlockData); // merge with block data if ts == key if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) { @@ -1994,7 +1938,6 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader tsdbRowMergerClear(&merge); return code; } else { - ASSERT(0); return TSDB_CODE_SUCCESS; } } else { // desc order @@ -2015,7 +1958,6 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader); TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader); - ASSERT(pRow != NULL && piRow != NULL); int64_t tsLast = INT64_MIN; if (hasDataInLastBlock(pLastBlockReader)) { @@ -2239,7 +2181,6 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea if (pReader->pReadSnap->pMem != NULL) { d = tsdbGetTbDataFromMemTable(pReader->pReadSnap->pMem, pReader->suid, pBlockScanInfo->uid); if (d != NULL) { - ASSERT(pBlockScanInfo->iter.iter == NULL); code = tsdbTbDataIterCreate(d, &startKey, backward, &pBlockScanInfo->iter.iter); if (code == TSDB_CODE_SUCCESS) { pBlockScanInfo->iter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iter.iter) != NULL); @@ -2353,10 +2294,9 @@ static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader) { static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLastBlockReader->mergeTree.pIter != NULL; } bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) { - if (pBlockData->nRow > 0) { - ASSERT(pBlockData->nRow == pDumpInfo->totalRows); + if ((pBlockData->nRow > 0) && (pBlockData->nRow != pDumpInfo->totalRows)) { + return false; // this is an invalid result. } - return pBlockData->nRow > 0 && (!pDumpInfo->allDumped); } @@ -2423,6 +2363,46 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI } } +static int32_t loadNeighborIfOverlap(SFileDataBlockInfo* pBlockInfo, STableBlockScanInfo* pBlockScanInfo, + STsdbReader* pReader, bool* loadNeighbor) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1; + int32_t nextIndex = -1; + SBlockIndex nxtBIndex = {0}; + + *loadNeighbor = false; + SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter); + + bool hasNeighbor = getNeighborBlockOfSameTable(pBlockInfo, pBlockScanInfo, &nextIndex, pReader->order, &nxtBIndex); + if (!hasNeighbor) { // do nothing + return code; + } + + if (overlapWithNeighborBlock(pBlock, &nxtBIndex, pReader->order)) { // load next block + SReaderStatus* pStatus = &pReader->status; + SDataBlockIter* pBlockIter = &pStatus->blockIter; + + // 1. find the next neighbor block in the scan block list + SFileDataBlockInfo fb = {.uid = pBlockInfo->uid, .tbBlockIdx = nextIndex}; + int32_t neighborIndex = findFileBlockInfoIndex(pBlockIter, &fb); + + // 2. remove it from the scan block list + setFileBlockActiveInBlockIter(pBlockIter, neighborIndex, step); + + // 3. load the neighbor block, and set it to be the currently accessed file data block + code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pBlockInfo->uid); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + // 4. check the data values + initBlockDumpInfo(pReader, pBlockIter); + *loadNeighbor = true; + } + + return code; +} + static int32_t buildComposedDataBlock(STsdbReader* pReader) { int32_t code = TSDB_CODE_SUCCESS; @@ -2481,39 +2461,13 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter); if (pDumpInfo->rowIndex >= pBlock->nRow || pDumpInfo->rowIndex < 0) { - SBlockIndex bIndex = {0}; - int32_t nextIndex = -1; - bool hasNeighbor = false; - if (pBlockInfo != NULL) { - hasNeighbor = getNeighborBlockOfSameTable(pBlockInfo, pBlockScanInfo, &nextIndex, pReader->order, &bIndex); - } + pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter); // NOTE: get the new block info - if (!hasNeighbor) { // do nothing - setBlockAllDumped(pDumpInfo, pBlock->maxKey.ts, pReader->order); - break; - } - - if (overlapWithNeighborBlock(pBlock, &bIndex, pReader->order)) { // load next block - SReaderStatus* pStatus = &pReader->status; - SDataBlockIter* pBlockIter = &pStatus->blockIter; - - // 1. find the next neighbor block in the scan block list - SFileDataBlockInfo fb = {.uid = pBlockInfo->uid, .tbBlockIdx = nextIndex}; - int32_t neighborIndex = findFileBlockInfoIndex(pBlockIter, &fb); - - // 2. remove it from the scan block list - setFileBlockActiveInBlockIter(pBlockIter, neighborIndex, step); - - // 3. load the neighbor block, and set it to be the currently accessed file data block - code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pBlockInfo->uid); - if (code != TSDB_CODE_SUCCESS) { - setBlockAllDumped(pDumpInfo, pBlock->maxKey.ts, pReader->order); - break; - } - - // 4. check the data values - initBlockDumpInfo(pReader, pBlockIter); - } else { + // continue check for the next file block if the last ts in the current block + // is overlapped with the next neighbor block + bool loadNeighbor = false; + code = loadNeighborIfOverlap(pBlockInfo, pBlockScanInfo, pReader, &loadNeighbor); + if ((!loadNeighbor) || (code != 0)) { setBlockAllDumped(pDumpInfo, pBlock->maxKey.ts, pReader->order); break; } @@ -2573,7 +2527,6 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* int32_t code = 0; SArray* pDelData = taosArrayInit(4, sizeof(SDelData)); - ASSERT(pReader->pReadSnap != NULL); SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile; if (pDelFile && taosArrayGetSize(pReader->pDelIdx) > 0) { @@ -2779,7 +2732,10 @@ static bool moveToNextTable(SUidOrderCheckInfo* pOrderedCheckInfo, SReaderStatus uint64_t uid = pOrderedCheckInfo->tableUidList[pOrderedCheckInfo->currentIndex]; pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid)); - ASSERT(pStatus->pTableIter != NULL); + if (pStatus->pTableIter == NULL) { + return false; + } + return true; } @@ -2854,7 +2810,6 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader); if (pBlockInfo == NULL) { // build data block from last data file - ASSERT(pBlockIter->numOfBlocks == 0); code = buildComposedDataBlock(pReader); } else if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) { code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pScanInfo->uid); @@ -3124,10 +3079,10 @@ SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond, int8_ } bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order, SVersionRange* pVerRange) { - ASSERT(pKey != NULL); if (pDelList == NULL) { return false; } + size_t num = taosArrayGetSize(pDelList); bool asc = ASCENDING_TRAVERSE(order); int32_t step = asc ? 1 : -1; @@ -3330,35 +3285,10 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn *state = CHECK_FILEBLOCK_QUIT; int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1; - int32_t nextIndex = -1; - SBlockIndex bIndex = {0}; - - bool hasNeighbor = getNeighborBlockOfSameTable(pFBlock, pScanInfo, &nextIndex, pReader->order, &bIndex); - if (!hasNeighbor) { // do nothing - return 0; - } - - bool overlap = overlapWithNeighborBlock(pBlock, &bIndex, pReader->order); - if (overlap) { // load next block - SReaderStatus* pStatus = &pReader->status; - SDataBlockIter* pBlockIter = &pStatus->blockIter; - - // 1. find the next neighbor block in the scan block list - SFileDataBlockInfo fb = {.uid = pFBlock->uid, .tbBlockIdx = nextIndex}; - int32_t neighborIndex = findFileBlockInfoIndex(pBlockIter, &fb); - - // 2. remove it from the scan block list - setFileBlockActiveInBlockIter(pBlockIter, neighborIndex, step); - - // 3. load the neighbor block, and set it to be the currently accessed file data block - int32_t code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pFBlock->uid); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - // 4. check the data values - initBlockDumpInfo(pReader, pBlockIter); + bool loadNeighbor = true; + int32_t code = loadNeighborIfOverlap(pFBlock, pScanInfo, pReader, &loadNeighbor); + if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) { pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step); if (pDumpInfo->rowIndex >= pDumpInfo->totalRows) { @@ -3366,7 +3296,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn } } - return TSDB_CODE_SUCCESS; + return code; } int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader, @@ -3552,6 +3482,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p } int32_t code = tsdbRowMergerGetRow(&merge, pTSRow); + tsdbRowMergerClear(&merge); return code; } @@ -3744,13 +3675,11 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e } } while (1); - ASSERT(pBlock->info.rows <= capacity); return TSDB_CODE_SUCCESS; } // TODO refactor: with createDataBlockScanInfo int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t num) { - ASSERT(pReader != NULL); int32_t size = taosHashGetSize(pReader->status.pTableMap); STableBlockScanInfo** p = NULL; @@ -3883,15 +3812,16 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL } if (pReader->pSchema != NULL) { - updateBlockSMAInfo(pReader->pSchema, &pReader->suppInfo); + code = updateBlockSMAInfo(pReader->pSchema, &pReader->suppInfo); + if (code != TSDB_CODE_SUCCESS) { + goto _err; + } } STsdbReader* p = (pReader->innerReader[0] != NULL) ? pReader->innerReader[0] : pReader; pReader->status.pTableMap = createDataBlockScanInfo(p, &pReader->blockInfoBuf, pTableList, numOfTables); if (pReader->status.pTableMap == NULL) { - tsdbReaderClose(p); *ppReader = NULL; - code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } @@ -4114,7 +4044,6 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { } static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) { - ASSERT(pReader != NULL); *rows = pReader->pResBlock->info.rows; *uid = pReader->pResBlock->info.id.uid; *pWindow = pReader->pResBlock->info.window; @@ -4158,25 +4087,27 @@ static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_ } int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, bool* allHave) { + SColumnDataAgg*** pBlockSMA = &pDataBlock->pBlockAgg; + int32_t code = 0; - SColumnDataAgg ***pBlockSMA = &pDataBlock->pBlockAgg; *allHave = false; + *pBlockSMA = NULL; if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) { - *pBlockSMA = NULL; return TSDB_CODE_SUCCESS; } // there is no statistics data for composed block if (pReader->status.composedDataBlock || (!pReader->suppInfo.smaValid)) { - *pBlockSMA = NULL; return TSDB_CODE_SUCCESS; } SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter); SBlockLoadSuppInfo* pSup = &pReader->suppInfo; - ASSERT(pReader->pResBlock->info.id.uid == pFBlock->uid); + if (pReader->pResBlock->info.id.uid != pFBlock->uid) { + return TSDB_CODE_SUCCESS; + } SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter); if (tDataBlkHasSma(pBlock)) { @@ -4204,13 +4135,10 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, // update the number of NULL data rows size_t numOfCols = pSup->numOfCols; - int32_t i = 0, j = 0; - size_t size = taosArrayGetSize(pSup->pColAgg); - // ensure capacity - if(pDataBlock->pDataBlock) { - size_t colsNum = taosArrayGetSize(pDataBlock->pDataBlock); - taosArrayEnsureCap(pSup->pColAgg, colsNum); + if (pDataBlock->pDataBlock) { + size_t colsNum = taosArrayGetSize(pDataBlock->pDataBlock); + taosArrayEnsureCap(pSup->pColAgg, colsNum); } SSDataBlock* pResBlock = pReader->pResBlock; @@ -4221,8 +4149,9 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, // do fill all null column value SMA info doFillNullColSMA(pSup, pBlock->nRow, numOfCols, pTsAgg); + size_t size = taosArrayGetSize(pSup->pColAgg); - i = 0, j = 0; + int32_t i = 0, j = 0; while (j < numOfCols && i < size) { SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i); if (pAgg->colId == pSup->colId[j]) { @@ -4232,15 +4161,8 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, } else if (pAgg->colId < pSup->colId[j]) { i += 1; } else if (pSup->colId[j] < pAgg->colId) { - if (pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID) { - pResBlock->pBlockAgg[pSup->slotId[j]] = &pSup->tsColAgg; - } else { - // all date in this block are null - SColumnDataAgg nullColAgg = {.colId = pSup->colId[j], .numOfNull = pBlock->nRow}; - taosArrayPush(pSup->pColAgg, &nullColAgg); - - pResBlock->pBlockAgg[pSup->slotId[j]] = taosArrayGetLast(pSup->pColAgg); - } + // ASSERT(pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID); + pResBlock->pBlockAgg[pSup->slotId[j]] = &pSup->tsColAgg; j += 1; } } @@ -4349,6 +4271,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa int32_t code = TSDB_CODE_SUCCESS; pTableBlockInfo->totalSize = 0; pTableBlockInfo->totalRows = 0; + pTableBlockInfo->numOfVgroups = 1; // find the start data block in file SReaderStatus* pStatus = &pReader->status; @@ -4393,6 +4316,8 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa pTableBlockInfo->numOfSmallBlocks += 1; } + pTableBlockInfo->totalSize += pBlock->aSubBlock[0].szBlock; + int32_t bucketIndex = getBucketIndex(pTableBlockInfo->defMinRows, bucketRange, numOfRows); pTableBlockInfo->blockRowsHisto[bucketIndex]++; @@ -4470,9 +4395,12 @@ int32_t tsdbGetTableSchema(SVnode* pVnode, int64_t uid, STSchema** pSchema, int6 return terrno; } sversion = mr.me.stbEntry.schemaRow.version; - } else { - ASSERT(mr.me.type == TSDB_NORMAL_TABLE); + } else if (mr.me.type == TSDB_NORMAL_TABLE) { sversion = mr.me.ntbEntry.schemaRow.version; + } else { + terrno = TSDB_CODE_INVALID_PARA; + metaReaderClear(&mr); + return terrno; } metaReaderClear(&mr); diff --git a/source/dnode/vnode/src/vnd/vnodeBufPool.c b/source/dnode/vnode/src/vnd/vnodeBufPool.c index 7b2f7eb7ad..e67f2cc59a 100644 --- a/source/dnode/vnode/src/vnd/vnodeBufPool.c +++ b/source/dnode/vnode/src/vnd/vnodeBufPool.c @@ -123,7 +123,48 @@ void vnodeBufPoolReset(SVBufPool *pPool) { pPool->ptr = pPool->node.data; } -void *vnodeBufPoolMalloc(SVBufPool *pPool, int32_t size) { + +void *vnodeBufPoolMallocAligned(SVBufPool *pPool, int size) { + SVBufPoolNode *pNode; + void *p = NULL; + uint8_t *ptr = NULL; + int paddingLen = 0; + ASSERT(pPool != NULL); + + if (pPool->lock) taosThreadSpinLock(pPool->lock); + + ptr = pPool->ptr; + paddingLen = (((long)ptr + 7) & ~7) - (long)ptr; + + if (pPool->node.size >= pPool->ptr - pPool->node.data + size + paddingLen) { + // allocate from the anchor node + p = pPool->ptr + paddingLen; + size += paddingLen; + pPool->ptr = pPool->ptr + size; + pPool->size += size; + } else { + // allocate a new node + pNode = taosMemoryMalloc(sizeof(*pNode) + size); + if (pNode == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + if (pPool->lock) taosThreadSpinUnlock(pPool->lock); + return NULL; + } + + p = pNode->data; + pNode->size = size; + pNode->prev = pPool->pTail; + pNode->pnext = &pPool->pTail; + pPool->pTail->pnext = &pNode->prev; + pPool->pTail = pNode; + + pPool->size = pPool->size + sizeof(*pNode) + size; + } + if (pPool->lock) taosThreadSpinUnlock(pPool->lock); + return p; +} + +void *vnodeBufPoolMalloc(SVBufPool *pPool, int size) { SVBufPoolNode *pNode; void *p = NULL; ASSERT(pPool != NULL); diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index 2e0370a81c..0874a88cfe 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -184,18 +184,51 @@ _err: return -1; } -static int32_t vnodePrepareCommit(SVnode *pVnode) { +static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) { int32_t code = 0; + int32_t lino = 0; + char dir[TSDB_FILENAME_LEN] = {0}; + tsem_wait(&pVnode->canCommit); + pVnode->state.commitTerm = pVnode->state.applyTerm; + + pInfo->info.config = pVnode->config; + pInfo->info.state.committed = pVnode->state.applied; + pInfo->info.state.commitTerm = pVnode->state.applyTerm; + pInfo->info.state.commitID = pVnode->state.commitID; + pInfo->pVnode = pVnode; + pInfo->txn = metaGetTxn(pVnode->pMeta); + + // save info + if (pVnode->pTfs) { + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); + } else { + snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); + } + if (vnodeSaveInfo(dir, &pInfo->info) < 0) { + code = terrno; + TSDB_CHECK_CODE(code, lino, _exit); + } + tsdbPrepareCommit(pVnode->pTsdb); + metaPrepareAsyncCommit(pVnode->pMeta); + code = smaPrepareAsyncCommit(pVnode->pSma); if (code) goto _exit; -_exit: vnodeBufPoolUnRef(pVnode->inUse); pVnode->inUse = NULL; + +_exit: + if (code) { + vError("vgId:%d, %s failed at line %d since %s, commit id:%" PRId64, TD_VID(pVnode), __func__, lino, + tstrerror(code), pVnode->state.commitID); + } else { + vDebug("vgId:%d, %s done", TD_VID(pVnode), __func__); + } + return code; } @@ -217,33 +250,32 @@ _exit: int vnodeAsyncCommit(SVnode *pVnode) { int32_t code = 0; - // prepare to commit - code = vnodePrepareCommit(pVnode); - if (code) goto _exit; - - // schedule the task - pVnode->state.commitTerm = pVnode->state.applyTerm; - SCommitInfo *pInfo = (SCommitInfo *)taosMemoryCalloc(1, sizeof(*pInfo)); if (NULL == pInfo) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } - pInfo->info.config = pVnode->config; - pInfo->info.state.committed = pVnode->state.applied; - pInfo->info.state.commitTerm = pVnode->state.applyTerm; - pInfo->info.state.commitID = pVnode->state.commitID; - pInfo->pVnode = pVnode; - pInfo->txn = metaGetTxn(pVnode->pMeta); + + // prepare to commit + code = vnodePrepareCommit(pVnode, pInfo); + if (TSDB_CODE_SUCCESS != code) { + goto _exit; + } + + // schedule the task code = vnodeScheduleTask(vnodeCommitTask, pInfo); _exit: if (code) { + if (NULL != pInfo) { + taosMemoryFree(pInfo); + } tsem_post(&pVnode->canCommit); vError("vgId:%d, %s failed since %s, commit id:%" PRId64, TD_VID(pVnode), __func__, tstrerror(code), pVnode->state.commitID); } else { - vDebug("vgId:%d, %s done", TD_VID(pVnode), __func__); + vInfo("vgId:%d, vnode async commit done, commitId:%" PRId64 " term:%" PRId64 " applied:%" PRId64, TD_VID(pVnode), + pVnode->state.commitID, pVnode->state.applyTerm, pVnode->state.applied); } return code; } @@ -262,7 +294,7 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) { char dir[TSDB_FILENAME_LEN] = {0}; SVnode *pVnode = pInfo->pVnode; - vInfo("vgId:%d, start to commit, commit ID:%" PRId64 " version:%" PRId64 " term: %" PRId64, TD_VID(pVnode), + vInfo("vgId:%d, start to commit, commitId:%" PRId64 " version:%" PRId64 " term: %" PRId64, TD_VID(pVnode), pVnode->state.commitID, pVnode->state.applied, pVnode->state.applyTerm); // persist wal before starting @@ -271,16 +303,11 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) { return -1; } - // save info if (pVnode->pTfs) { snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); } else { snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); } - if (vnodeSaveInfo(dir, &pInfo->info) < 0) { - code = terrno; - TSDB_CHECK_CODE(code, lino, _exit); - } // walBeginSnapshot(pVnode->pWal, pVnode->state.applied); syncBeginSnapshot(pVnode->sync, pVnode->state.applied); diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index 40705e553b..2fc06fba86 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -67,9 +67,8 @@ _err: return code; } -int32_t vnodeSnapReaderClose(SVSnapReader *pReader) { - int32_t code = 0; - +void vnodeSnapReaderClose(SVSnapReader *pReader) { + vInfo("vgId:%d, close vnode snapshot reader", TD_VID(pReader->pVnode)); if (pReader->pRsmaReader) { rsmaSnapReaderClose(&pReader->pRsmaReader); } @@ -82,9 +81,7 @@ int32_t vnodeSnapReaderClose(SVSnapReader *pReader) { metaSnapReaderClose(&pReader->pMetaReader); } - vInfo("vgId:%d, vnode snapshot reader closed", TD_VID(pReader->pVnode)); taosMemoryFree(pReader); - return code; } int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData) { @@ -260,8 +257,8 @@ _exit: pReader->index++; *nData = sizeof(SSnapDataHdr) + pHdr->size; pHdr->index = pReader->index; - vInfo("vgId:%d, vnode snapshot read data,index:%" PRId64 " type:%d nData:%d ", TD_VID(pReader->pVnode), - pReader->index, pHdr->type, *nData); + vDebug("vgId:%d, vnode snapshot read data, index:%" PRId64 " type:%d blockLen:%d ", TD_VID(pReader->pVnode), + pReader->index, pHdr->type, *nData); } else { vInfo("vgId:%d, vnode snapshot read data end, index:%" PRId64, TD_VID(pReader->pVnode), pReader->index); } @@ -426,8 +423,8 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) { ASSERT(pHdr->index == pWriter->index + 1); pWriter->index = pHdr->index; - vInfo("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d nData:%d", TD_VID(pVnode), pHdr->index, - pHdr->type, nData); + vDebug("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d blockLen:%d", TD_VID(pVnode), pHdr->index, + pHdr->type, nData); switch (pHdr->type) { case SNAP_DATA_CFG: { diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 84f3462e2a..ec92316505 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -217,6 +217,10 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp if (!syncUtilUserCommit(pMsg->msgType)) goto _exit; + if (pMsg->msgType == TDMT_VND_STREAM_RECOVER_BLOCKING_STAGE || pMsg->msgType == TDMT_STREAM_TASK_CHECK_RSP) { + if (tqCheckLogInWal(pVnode->pTq, version)) return 0; + } + // skip header pReq = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); len = pMsg->contLen - sizeof(SMsgHead); @@ -1352,7 +1356,7 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void SSingleDeleteReq *pOneReq = taosArrayGet(deleteReq.deleteReqs, i); char *name = pOneReq->tbname; if (metaGetTableEntryByName(&mr, name) < 0) { - vDebug("stream delete msg, skip vgId:%d since no table: %s", pVnode->config.vgId, name); + vDebug("vgId:%d, stream delete msg, skip since no table: %s", pVnode->config.vgId, name); continue; } diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 2c23646db1..5697487743 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -380,9 +380,8 @@ static int32_t vnodeSyncSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) { return code; } -static int32_t vnodeSyncGetSnapshot(const SSyncFSM *pFsm, SSnapshot *pSnapshot) { +static void vnodeSyncGetSnapshotInfo(const SSyncFSM *pFsm, SSnapshot *pSnapshot) { vnodeGetSnapshot(pFsm->data, pSnapshot); - return 0; } static int32_t vnodeSyncApplyMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) { @@ -392,9 +391,9 @@ static int32_t vnodeSyncApplyMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsm const STraceId *trace = &pMsg->info.traceId; vGTrace("vgId:%d, commit-cb is excuted, fsm:%p, index:%" PRId64 ", term:%" PRIu64 ", msg-index:%" PRId64 - ", weak:%d, code:%d, state:%d %s, type:%s", + ", weak:%d, code:%d, state:%d %s, type:%s code:0x%x", pVnode->config.vgId, pFsm, pMeta->index, pMeta->term, pMsg->info.conn.applyIndex, pMeta->isWeak, pMeta->code, - pMeta->state, syncStr(pMeta->state), TMSG_INFO(pMsg->msgType)); + pMeta->state, syncStr(pMeta->state), TMSG_INFO(pMsg->msgType), pMsg->code); return tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, pMsg); } @@ -424,10 +423,9 @@ static int32_t vnodeSnapshotStartRead(const SSyncFSM *pFsm, void *pParam, void * return code; } -static int32_t vnodeSnapshotStopRead(const SSyncFSM *pFsm, void *pReader) { +static void vnodeSnapshotStopRead(const SSyncFSM *pFsm, void *pReader) { SVnode *pVnode = pFsm->data; - int32_t code = vnodeSnapReaderClose(pReader); - return code; + vnodeSnapReaderClose(pReader); } static int32_t vnodeSnapshotDoRead(const SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) { @@ -467,9 +465,9 @@ static int32_t vnodeSnapshotStopWrite(const SSyncFSM *pFsm, void *pWriter, bool static int32_t vnodeSnapshotDoWrite(const SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) { SVnode *pVnode = pFsm->data; - vDebug("vgId:%d, continue write vnode snapshot, len:%d", pVnode->config.vgId, len); + vDebug("vgId:%d, continue write vnode snapshot, blockLen:%d", pVnode->config.vgId, len); int32_t code = vnodeSnapWrite(pWriter, pBuf, len); - vDebug("vgId:%d, continue write vnode snapshot finished, len:%d", pVnode->config.vgId, len); + vDebug("vgId:%d, continue write vnode snapshot finished, blockLen:%d", pVnode->config.vgId, len); return code; } @@ -539,7 +537,7 @@ static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) { pFsm->FpCommitCb = vnodeSyncCommitMsg; pFsm->FpPreCommitCb = vnodeSyncPreCommitMsg; pFsm->FpRollBackCb = vnodeSyncRollBackMsg; - pFsm->FpGetSnapshotInfo = vnodeSyncGetSnapshot; + pFsm->FpGetSnapshotInfo = vnodeSyncGetSnapshotInfo; pFsm->FpRestoreFinishCb = vnodeRestoreFinish; pFsm->FpLeaderTransferCb = NULL; pFsm->FpApplyQueueEmptyCb = vnodeApplyQueueEmpty; diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 6e072a9630..9cbad139bf 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -485,6 +485,9 @@ typedef struct SCtgOperation { ctgOpFunc func; } SCtgOperation; +#define CTG_AUTH_READ(_t) ((_t) == AUTH_TYPE_READ || (_t) == AUTH_TYPE_READ_OR_WRITE) +#define CTG_AUTH_WRITE(_t) ((_t) == AUTH_TYPE_WRITE || (_t) == AUTH_TYPE_READ_OR_WRITE) + #define CTG_QUEUE_INC() atomic_add_fetch_64(&gCtgMgmt.queue.qRemainNum, 1) #define CTG_QUEUE_DEC() atomic_sub_fetch_64(&gCtgMgmt.queue.qRemainNum, 1) @@ -579,34 +582,34 @@ typedef struct SCtgOperation { #define CTG_LOCK(type, _lock) \ do { \ if (CTG_READ == (type)) { \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before read lock"); \ CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosRLockLatch(_lock); \ CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) > 0); \ + ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value after read lock"); \ } else { \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before write lock"); \ CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosWLockLatch(_lock); \ CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY); \ + ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \ } \ } while (0) #define CTG_UNLOCK(type, _lock) \ do { \ if (CTG_READ == (type)) { \ - assert(atomic_load_32((_lock)) > 0); \ + ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \ CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosRUnLockLatch(_lock); \ CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \ } else { \ - assert(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY); \ + ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \ CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosWUnLockLatch(_lock); \ CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \ } \ } while (0) diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index e9e0bae8d7..acd0fb9d8c 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -352,9 +352,9 @@ int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, co goto _return; } - if (type == AUTH_TYPE_READ && authRsp.readDbs && taosHashGet(authRsp.readDbs, dbFName, strlen(dbFName))) { + if (CTG_AUTH_READ(type) && authRsp.readDbs && taosHashGet(authRsp.readDbs, dbFName, strlen(dbFName))) { *pass = true; - } else if (type == AUTH_TYPE_WRITE && authRsp.writeDbs && taosHashGet(authRsp.writeDbs, dbFName, strlen(dbFName))) { + } else if (CTG_AUTH_WRITE(type) && authRsp.writeDbs && taosHashGet(authRsp.writeDbs, dbFName, strlen(dbFName))) { *pass = true; } diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 5b01ac1fb9..b8590c9255 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -471,17 +471,20 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob* pJob, con } int32_t ctgInitTask(SCtgJob* pJob, CTG_TASK_TYPE type, void* param, int32_t* taskId) { + int32_t code = 0; int32_t tid = atomic_fetch_add_32(&pJob->taskIdx, 1); CTG_LOCK(CTG_WRITE, &pJob->taskLock); - CTG_ERR_RET((*gCtgAsyncFps[type].initFp)(pJob, tid, param)); - CTG_UNLOCK(CTG_WRITE, &pJob->taskLock); + CTG_ERR_JRET((*gCtgAsyncFps[type].initFp)(pJob, tid, param)); if (taskId) { *taskId = tid; } - return TSDB_CODE_SUCCESS; +_return: + CTG_UNLOCK(CTG_WRITE, &pJob->taskLock); + + return code; } int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const SCatalogReq* pReq, catalogCallback fp, @@ -1549,10 +1552,10 @@ int32_t ctgHandleGetUserRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf* goto _return; } - if (ctx->user.type == AUTH_TYPE_READ && pOut->readDbs && + if (CTG_AUTH_READ(ctx->user.type) && pOut->readDbs && taosHashGet(pOut->readDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) { pass = true; - } else if (ctx->user.type == AUTH_TYPE_WRITE && pOut->writeDbs && + } else if (CTG_AUTH_WRITE(ctx->user.type) && pOut->writeDbs && taosHashGet(pOut->writeDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) { pass = true; } diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 94ee295fe4..c266cc1df9 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -718,11 +718,11 @@ int32_t ctgChkAuthFromCache(SCatalog *pCtg, char *user, char *dbFName, AUTH_TYPE return TSDB_CODE_SUCCESS; } - if (pUser->readDbs && taosHashGet(pUser->readDbs, dbFName, strlen(dbFName)) && type == AUTH_TYPE_READ) { + if (pUser->readDbs && taosHashGet(pUser->readDbs, dbFName, strlen(dbFName)) && CTG_AUTH_READ(type)) { *pass = true; } - if (pUser->writeDbs && taosHashGet(pUser->writeDbs, dbFName, strlen(dbFName)) && type == AUTH_TYPE_WRITE) { + if (pUser->writeDbs && taosHashGet(pUser->writeDbs, dbFName, strlen(dbFName)) && CTG_AUTH_WRITE(type)) { *pass = true; } @@ -2500,6 +2500,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_LOCK(CTG_READ, &pCache->metaLock); if (NULL == pCache->pMeta) { + CTG_UNLOCK(CTG_READ, &pCache->metaLock); ctgDebug("tb %s meta not in cache, dbFName:%s", pName->tname, dbFName); ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1); diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index b6ff1c8b98..a6c0d1c401 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -22,7 +22,6 @@ extern SCatalogMgmt gCtgMgmt; SCtgDebug gCTGDebug = {0}; void ctgdUserCallback(SMetaData *pResult, void *param, int32_t code) { - ASSERT(*(int32_t *)param == 1); taosMemoryFree(param); qDebug("async call result: %s", tstrerror(code)); diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 7cc6c90d30..3b037e2062 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -40,7 +40,9 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu msgNum = taosArrayGetSize(batchRsp.pRsps); } - ASSERT(taskNum == msgNum || 0 == msgNum); + if (ASSERTS(taskNum == msgNum || 0 == msgNum, "taskNum %d mis-match msgNum %d", taskNum, msgNum)) { + msgNum = 0; + } ctgDebug("QID:0x%" PRIx64 " ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId, TMSG_INFO(cbParam->reqType + 1)); @@ -58,11 +60,19 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu if (msgNum > 0) { pRsp = taosArrayGet(batchRsp.pRsps, i); - taskMsg.msgType = pRsp->reqType; - taskMsg.pData = pRsp->msg; - taskMsg.len = pRsp->msgLen; - - ASSERT(pRsp->msgIdx == *msgIdx); + if (ASSERTS(pRsp->msgIdx == *msgIdx, "rsp msgIdx %d mis-match msgIdx %d", pRsp->msgIdx, *msgIdx)) { + pRsp = &rsp; + pRsp->msgIdx = *msgIdx; + pRsp->reqType = -1; + pRsp->rspCode = 0; + taskMsg.msgType = -1; + taskMsg.pData = NULL; + taskMsg.len = 0; + } else { + taskMsg.msgType = pRsp->reqType; + taskMsg.pData = pRsp->msg; + taskMsg.len = pRsp->msgLen; + } } else { pRsp = &rsp; pRsp->msgIdx = *msgIdx; diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index a179ec24f9..c87f6953eb 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -21,6 +21,7 @@ #include "tdatablock.h" #include "tglobal.h" #include "tgrant.h" +#include "taosdef.h" extern SConfig* tsCfg; @@ -40,7 +41,6 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe (*pRsp)->numOfCols = htonl(numOfCols); int32_t len = blockEncode(pBlock, (*pRsp)->data, numOfCols); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); return TSDB_CODE_SUCCESS; } @@ -154,6 +154,23 @@ static int32_t buildCreateDBResultDataBlock(SSDataBlock** pOutput) { return code; } +static int32_t buildAliveResultDataBlock(SSDataBlock** pOutput) { + SSDataBlock* pBlock = createDataBlock(); + if (NULL == pBlock) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + SColumnInfoData infoData = createColumnInfoData(TSDB_DATA_TYPE_INT, sizeof(int32_t), 1); + int32_t code = blockDataAppendColInfo(pBlock, &infoData); + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = pBlock; + } else { + blockDataDestroy(pBlock); + } + return code; +} + int64_t getValOfDiffPrecision(int8_t unit, int64_t val) { int64_t v = 0; switch (unit) { @@ -281,6 +298,108 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S colDataAppend(pCol2, 0, buf2, false); } +#define CHECK_LEADER(n) (row[n] && (fields[n].type == TSDB_DATA_TYPE_VARCHAR && strncasecmp(row[n], "leader", varDataLen((char *)row[n] - VARSTR_HEADER_SIZE)) == 0)) +// on this row, if have leader return true else return false +bool existLeaderRole(TAOS_ROW row, TAOS_FIELD* fields, int nFields) { + // vgroup_id | db_name | tables | v1_dnode | v1_status | v2_dnode | v2_status | v3_dnode | v3_status | v4_dnode | + // v4_status | cacheload | tsma | + if (nFields != 13) { + return false; + } + + // check have leader on cloumn v*_status on 4 6 8 10 + if (CHECK_LEADER(4) || CHECK_LEADER(6) || CHECK_LEADER(8) || CHECK_LEADER(10)) { + return true; + } + + return false; +} + +// get db alive status, return 1 is alive else return 0 +int32_t getAliveStatusFromApi(int64_t* pConnId, char* dbName, int32_t* pStatus) { + char sql[128 + TSDB_DB_NAME_LEN] = "select * from information_schema.ins_vgroups"; + int32_t code; + + // filter with db name + if (dbName && dbName[0] != 0) { + char str[64 + TSDB_DB_NAME_LEN] = ""; + // test db name exist + sprintf(str, "show create database %s ;", dbName); + TAOS_RES* dbRes = taos_query(pConnId, str); + code = taos_errno(dbRes); + if (code != TSDB_CODE_SUCCESS) { + taos_free_result(dbRes); + return code; + } + taos_free_result(dbRes); + + sprintf(str, " where db_name='%s' ;", dbName); + strcat(sql, str); + } + + TAOS_RES* res = taos_query(pConnId, sql); + code = taos_errno(res); + if (code != TSDB_CODE_SUCCESS) { + taos_free_result(res); + return code; + } + + TAOS_ROW row = NULL; + TAOS_FIELD* fields = taos_fetch_fields(res); + int32_t nFields = taos_num_fields(res); + int32_t nAvailble = 0; + int32_t nUnAvailble = 0; + + while ((row = taos_fetch_row(res)) != NULL) { + if (existLeaderRole(row, fields, nFields)) { + nAvailble++; + } else { + nUnAvailble++; + } + } + taos_free_result(res); + + int32_t status = 0; + if (nAvailble + nUnAvailble == 0 || nUnAvailble == 0) { + status = SHOW_STATUS_AVAILABLE; + } else if (nAvailble > 0 && nUnAvailble > 0) { + status = SHOW_STATUS_HALF_AVAILABLE; + } else { + status = SHOW_STATUS_NOT_AVAILABLE; + } + + if (pStatus) { + *pStatus = status; + } + return TSDB_CODE_SUCCESS; +} + +static int32_t setAliveResultIntoDataBlock(int64_t* pConnId, SSDataBlock* pBlock, char* dbName) { + blockDataEnsureCapacity(pBlock, 1); + pBlock->info.rows = 1; + + SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0); + int32_t status = 0; + int32_t code = getAliveStatusFromApi(pConnId, dbName, &status); + if (code == TSDB_CODE_SUCCESS) { + colDataAppend(pCol1, 0, (const char*)&status, false); + } + return code; +} + +static int32_t execShowAliveStatus(int64_t* pConnId, SShowAliveStmt* pStmt, SRetrieveTableRsp** pRsp) { + SSDataBlock* pBlock = NULL; + int32_t code = buildAliveResultDataBlock(&pBlock); + if (TSDB_CODE_SUCCESS == code) { + code = setAliveResultIntoDataBlock(pConnId, pBlock, pStmt->dbName); + } + if (TSDB_CODE_SUCCESS == code) { + code = buildRetrieveTableRsp(pBlock, SHOW_ALIVE_RESULT_COLS, pRsp); + } + blockDataDestroy(pBlock); + return code; +} + static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveTableRsp** pRsp) { SSDataBlock* pBlock = NULL; int32_t code = buildCreateDBResultDataBlock(&pBlock); @@ -736,7 +855,7 @@ static int32_t execSelectWithoutFrom(SSelectStmt* pSelect, SRetrieveTableRsp** p return code; } -int32_t qExecCommand(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) { +int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) { switch (nodeType(pStmt)) { case QUERY_NODE_DESCRIBE_STMT: return execDescribe(sysInfoUser, pStmt, pRsp); @@ -754,6 +873,9 @@ int32_t qExecCommand(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) { return execShowLocalVariables(pRsp); case QUERY_NODE_SELECT_STMT: return execSelectWithoutFrom((SSelectStmt*)pStmt, pRsp); + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: + return execShowAliveStatus(pConnId, (SShowAliveStmt*)pStmt, pRsp); default: break; } diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 253718048d..38222112a1 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1666,7 +1666,6 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { rsp->numOfRows = htobe64((int64_t)rowNum); int32_t len = blockEncode(pBlock, rsp->data, taosArrayGetSize(pBlock->pDataBlock)); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); rsp->compLen = htonl(len); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 3d3a08c8d0..44202b5412 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -138,6 +138,7 @@ typedef struct { SSchemaWrapper* schema; char tbName[TSDB_TABLE_NAME_LEN]; int8_t recoverStep; + int8_t recoverScanFinished; SQueryTableDataCond tableCond; int64_t fillHistoryVer1; int64_t fillHistoryVer2; @@ -471,6 +472,11 @@ typedef struct SStreamScanInfo { SNodeList* pGroupTags; SNode* pTagCond; SNode* pTagIndexCond; + + // recover + int32_t blockRecoverContiCnt; + int32_t blockRecoverTotCnt; + } SStreamScanInfo; typedef struct { @@ -659,7 +665,6 @@ typedef struct SStreamFillOperatorInfo { SSDataBlock* pRes; SSDataBlock* pSrcBlock; int32_t srcRowIndex; - SSDataBlock* pPrevSrcBlock; SSDataBlock* pSrcDelBlock; int32_t srcDelRowIndex; SSDataBlock* pDelRes; diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 672bb09b14..294424746a 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -90,7 +90,7 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe uint64_t suid = tableListGetSuid(pTableList); code = tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pList, totalTables, - taosArrayGetSize(pInfo->matchInfo.pList), suid, &pInfo->pLastrowReader); + taosArrayGetSize(pInfo->matchInfo.pList), suid, &pInfo->pLastrowReader, pTaskInfo->id.str); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -216,7 +216,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { } tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pList, num, - taosArrayGetSize(pInfo->matchInfo.pList), suid, &pInfo->pLastrowReader); + taosArrayGetSize(pInfo->matchInfo.pList), suid, &pInfo->pLastrowReader, pTaskInfo->id.str); taosArrayClear(pInfo->pUidList); code = tsdbRetrieveCacheRows(pInfo->pLastrowReader, pInfo->pRes, pInfo->pSlotIds, pInfo->pUidList); diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index eff7a5ef93..a8051ea7c3 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -62,8 +62,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock); pEntry->dataLen = sizeof(SDeleterRes); - ASSERT(1 == pEntry->numOfRows); - ASSERT(3 == pEntry->numOfCols); +// ASSERT(1 == pEntry->numOfRows); +// ASSERT(3 == pEntry->numOfCols); pBuf->useSize = sizeof(SDataCacheEntry); @@ -167,7 +167,6 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDeleterBuf* pBuf = NULL; taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf); - ASSERT(NULL != pBuf); memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf)); taosFreeQitem(pBuf); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index c2fa438c80..a603bffba5 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn pBuf->useSize = sizeof(SDataCacheEntry); pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, numOfCols); - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); +// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); +// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); pBuf->useSize += pEntry->dataLen; @@ -162,15 +162,14 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDispatchBuf* pBuf = NULL; taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf); - ASSERT(NULL != pBuf); memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf)); taosFreeQitem(pBuf); SDataCacheEntry* pEntry = (SDataCacheEntry*)pDispatcher->nextOutput.pData; *pLen = pEntry->dataLen; - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); +// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); +// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); *pQueryEnd = pDispatcher->queryEnd; qDebug("got data len %" PRId64 ", row num %d in sink", *pLen, @@ -193,8 +192,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) { pOutput->numOfCols = pEntry->numOfCols; pOutput->compressed = pEntry->compressed; - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); +// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); +// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); atomic_sub_fetch_64(&pDispatcher->cachedSize, pEntry->dataLen); atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pEntry->dataLen); diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c index ca6149d42c..0800b415bd 100644 --- a/source/libs/executor/src/dataInserter.c +++ b/source/libs/executor/src/dataInserter.c @@ -41,6 +41,7 @@ typedef struct SDataInserterHandle { SHashObj* pCols; int32_t status; bool queryEnd; + bool fullOrderColList; uint64_t useconds; uint64_t cachedSize; TdThreadMutex mutex; @@ -153,7 +154,6 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp SSubmitReq2* pReq = *ppReq; SArray* pVals = NULL; int32_t numOfBlks = 0; - bool fullCol = (pInserter->pNode->pCols->length == pTSchema->numOfCols); terrno = TSDB_CODE_SUCCESS; @@ -196,7 +196,7 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp for (int32_t k = 0; k < pTSchema->numOfCols; ++k) { // iterate by column int16_t colIdx = k; const STColumn* pCol = &pTSchema->columns[k]; - if (!fullCol) { + if (!pInserter->fullOrderColList) { int16_t* slotId = taosHashGet(pInserter->pCols, &pCol->colId, sizeof(pCol->colId)); if (NULL == slotId) { continue; @@ -439,12 +439,19 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat return TSDB_CODE_OUT_OF_MEMORY; } + inserter->fullOrderColList = pInserterNode->pCols->length == inserter->pSchema->numOfCols; + inserter->pCols = taosHashInit(pInserterNode->pCols->length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK); SNode* pNode = NULL; + int32_t i = 0; FOREACH(pNode, pInserterNode->pCols) { SColumnNode* pCol = (SColumnNode*)pNode; taosHashPut(inserter->pCols, &pCol->colId, sizeof(pCol->colId), &pCol->slotId, sizeof(pCol->slotId)); + if (inserter->fullOrderColList && pCol->colId != inserter->pSchema->columns[i].colId) { + inserter->fullOrderColList = false; + } + ++i; } tsem_init(&inserter->ready, 0, 0); diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 4103ca82dc..9873c52006 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -373,7 +373,6 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { pRsp->useconds = htobe64(pRsp->useconds); pRsp->numOfBlocks = htonl(pRsp->numOfBlocks); - ASSERT(pRsp != NULL); qDebug("%s fetch rsp received, index:%d, blocks:%d, rows:%" PRId64 ", %p", pSourceDataInfo->taskId, index, pRsp->numOfBlocks, pRsp->numOfRows, pExchangeInfo); } else { diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 3e0c5a9901..0a2802ba37 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -896,35 +896,35 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); + /*ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE);*/ + /*ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX);*/ pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || - pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); + /*ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||*/ + /*pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);*/ qInfo("restore stream param for interval: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { SStreamSessionAggOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); + /*ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE);*/ + /*ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX);*/ pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || - pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); + /*ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||*/ + /*pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);*/ qInfo("restore stream param for session: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) { SStreamStateAggOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); + /*ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE);*/ + /*ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX);*/ pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || - pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); + /*ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||*/ + /*pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);*/ qInfo("restore stream param for state: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } @@ -932,7 +932,7 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { if (pOperator->numOfDownstream != 1 || pOperator->pDownstream[0] == NULL) { if (pOperator->numOfDownstream > 1) { qError("unexpected stream, multiple downstream"); - ASSERT(0); + /*ASSERT(0);*/ return -1; } return 0; @@ -942,6 +942,10 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { } return 0; } +bool qStreamRecoverScanFinished(qTaskInfo_t tinfo) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + return pTaskInfo->streamInfo.recoverScanFinished; +} void* qExtractReaderFromStreamScanner(void* scanner) { SStreamScanInfo* pInfo = scanner; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 1c80eff685..149efef884 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -99,11 +99,11 @@ static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SC int32_t status); static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t order, int32_t scanFlag, bool createDummyCol); +static int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprSupp* pSup, SDiskbasedBuf* pBuf, + SGroupResInfo* pGroupResInfo); void setOperatorCompleted(SOperatorInfo* pOperator) { pOperator->status = OP_EXEC_DONE; - ASSERT(pOperator->pTaskInfo != NULL); - pOperator->cost.totalCost = (taosGetTimestampUs() - pOperator->pTaskInfo->cost.start) / 1000.0; setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); } @@ -139,9 +139,6 @@ SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, return fpSet; } -static int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprSupp* pSup, SDiskbasedBuf* pBuf, - SGroupResInfo* pGroupResInfo); - SResultRow* getNewResultRow(SDiskbasedBuf* pResultBuf, int32_t* currentPageId, int32_t interBufSize) { SFilePage* pData = NULL; @@ -200,7 +197,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR // in case of repeat scan/reverse scan, no new time window added. if (isIntervalQuery) { - if (masterscan && p1 != NULL) { // the *p1 may be NULL in case of sliding+offset exists. + if (p1 != NULL) { // the *p1 may be NULL in case of sliding+offset exists. pResult = getResultRowByPos(pResultBuf, p1, true); ASSERT(pResult->pageId == p1->pageId && pResult->offset == p1->offset); } @@ -245,7 +242,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR } // a new buffer page for each table. Needs to opt this design -static int32_t addNewWindowResultBuf(SResultRow* pWindowRes, SDiskbasedBuf* pResultBuf, int32_t tid, uint32_t size) { +static int32_t addNewWindowResultBuf(SResultRow* pWindowRes, SDiskbasedBuf* pResultBuf, uint32_t size) { if (pWindowRes->pageId != -1) { return 0; } @@ -525,7 +522,7 @@ bool functionNeedToExecute(SqlFunctionCtx* pCtx) { return true; } -static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SFunctParam* pFuncParam, int32_t type, +static int32_t doCreateConstantValColumnSMAInfo(SInputColumnInfoData* pInput, SFunctParam* pFuncParam, int32_t type, int32_t paramIndex, int32_t numOfRows) { if (pInput->pData[paramIndex] == NULL) { pInput->pData[paramIndex] = taosMemoryCalloc(1, sizeof(SColumnInfoData)); @@ -549,8 +546,6 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF da = pInput->pColumnDataAgg[paramIndex]; } - ASSERT(!IS_VAR_DATA_TYPE(type)); - if (type == TSDB_DATA_TYPE_BIGINT) { int64_t v = pFuncParam->param.i; *da = (SColumnDataAgg){.numOfNull = 0, .min = v, .max = v, .sum = v * numOfRows}; @@ -571,7 +566,7 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF } else if (type == TSDB_DATA_TYPE_TIMESTAMP) { // do nothing } else { - ASSERT(0); + qError("invalid constant type for sma info"); } return TSDB_CODE_SUCCESS; @@ -601,7 +596,7 @@ void setBlockSMAInfo(SqlFunctionCtx* pCtx, SExprInfo* pExprInfo, SSDataBlock* pB // the data in the corresponding SColumnInfoData will not be used. pInput->pData[j] = taosArrayGet(pBlock->pDataBlock, slotId); } else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) { - doCreateConstantValColumnAggInfo(pInput, pFuncParam, pFuncParam->param.nType, j, pBlock->info.rows); + doCreateConstantValColumnSMAInfo(pInput, pFuncParam, pFuncParam->param.nType, j, pBlock->info.rows); } } } else { @@ -916,8 +911,7 @@ void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uin * 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 = - addNewWindowResultBuf(pResultRow, pAggInfo->aggSup.pResultBuf, groupId, pAggInfo->binfo.pRes->info.rowSize); + int32_t ret = addNewWindowResultBuf(pResultRow, pAggInfo->aggSup.pResultBuf, pAggInfo->binfo.pRes->info.rowSize); if (ret != TSDB_CODE_SUCCESS) { return; } @@ -1579,8 +1573,7 @@ void destroyOperatorInfo(SOperatorInfo* pOperator) { // each operator should be set their own function to return total cost buffer int32_t optrDefaultBufFn(SOperatorInfo* pOperator) { if (pOperator->blocking) { - ASSERT(0); - return 0; + return -1; } else { return 0; } @@ -2207,7 +2200,6 @@ static int32_t extractTbscanInStreamOpTree(SOperatorInfo* pOperator, STableScanI return extractTbscanInStreamOpTree(pOperator->pDownstream[0], ppInfo); } else { SStreamScanInfo* pInfo = pOperator->info; - ASSERT(pInfo->pTableScanOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN); *ppInfo = pInfo->pTableScanOp->info; return 0; } @@ -2219,13 +2211,11 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) { *ppNode = (STableScanPhysiNode*)pNode; return 0; } else { - ASSERT(0); terrno = TSDB_CODE_APP_ERROR; return -1; } } else { if (LIST_LENGTH(pNode->pChildren) != 1) { - ASSERT(0); terrno = TSDB_CODE_APP_ERROR; return -1; } @@ -2235,32 +2225,6 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) { return -1; } -#if 0 -int32_t rebuildReader(SOperatorInfo* pOperator, SSubplan* plan, SReadHandle* pHandle, int64_t uid, int64_t ts) { - STableScanInfo* pTableScanInfo = NULL; - if (extractTbscanInStreamOpTree(pOperator, &pTableScanInfo) < 0) { - return -1; - } - - STableScanPhysiNode* pNode = NULL; - if (extractTableScanNode(plan->pNode, &pNode) < 0) { - ASSERT(0); - } - - tsdbReaderClose(pTableScanInfo->dataReader); - - STableListInfo info = {0}; - pTableScanInfo->dataReader = doCreateDataReader(pNode, pHandle, &info, NULL); - if (pTableScanInfo->dataReader == NULL) { - ASSERT(0); - qError("failed to create data reader"); - return TSDB_CODE_APP_ERROR; - } - // TODO: set uid and ts to data reader - return 0; -} -#endif - int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, qTaskInfo_t* pTaskInfo, SReadHandle* readHandle) { SExecTaskInfo* pTask = *(SExecTaskInfo**)pTaskInfo; diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 8d5af64777..187c8f582a 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -147,6 +147,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey); } else { + pBlock->info.dataLoad = 1; blockDataUpdateTsWindow(pBlock, pInfo->primarySrcSlotId); blockDataCleanup(pInfo->pRes); @@ -170,6 +171,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { // Fill the previous group data block, before handle the data block of new group. // Close the fill operation for previous group data block taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey); + pInfo->pFillInfo->prev.key = 0; } } @@ -470,7 +472,6 @@ static void destroyStreamFillOperatorInfo(void* param) { pInfo->pFillSup = destroyStreamFillSupporter(pInfo->pFillSup); pInfo->pRes = blockDataDestroy(pInfo->pRes); pInfo->pSrcBlock = blockDataDestroy(pInfo->pSrcBlock); - pInfo->pPrevSrcBlock = blockDataDestroy(pInfo->pPrevSrcBlock); pInfo->pDelRes = blockDataDestroy(pInfo->pDelRes); pInfo->matchInfo.pList = taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFree(pInfo); @@ -992,12 +993,6 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) { if (pInfo->srcRowIndex == 0) { keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize); - SSDataBlock* preBlock = pInfo->pPrevSrcBlock; - if (preBlock->info.rows > 0) { - int preRowId = preBlock->info.rows - 1; - SColumnInfoData* pPreTsCol = taosArrayGet(preBlock->pDataBlock, pInfo->primaryTsCol); - doFillResults(pOperator, pFillSup, pFillInfo, preBlock, (TSKEY*)pPreTsCol->pData, preRowId, pRes); - } pInfo->srcRowIndex++; } @@ -1011,9 +1006,8 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) { } pInfo->srcRowIndex++; } + doFillResults(pOperator, pFillSup, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex - 1, pRes); blockDataUpdateTsWindow(pRes, pInfo->primaryTsCol); - blockDataCleanup(pInfo->pPrevSrcBlock); - copyDataBlock(pInfo->pPrevSrcBlock, pInfo->pSrcBlock); blockDataCleanup(pInfo->pSrcBlock); } @@ -1173,7 +1167,6 @@ static void doDeleteFillResult(SOperatorInfo* pOperator) { } static void resetStreamFillInfo(SStreamFillOperatorInfo* pInfo) { - blockDataCleanup(pInfo->pPrevSrcBlock); tSimpleHashClear(pInfo->pFillSup->pResMap); pInfo->pFillSup->hasDelete = false; taosArrayClear(pInfo->pFillInfo->delRanges); @@ -1231,13 +1224,6 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); if (pBlock == NULL) { pOperator->status = OP_RES_TO_RETURN; - SSDataBlock* preBlock = pInfo->pPrevSrcBlock; - if (preBlock->info.rows > 0) { - int preRowId = preBlock->info.rows - 1; - SColumnInfoData* pPreTsCol = taosArrayGet(preBlock->pDataBlock, pInfo->primaryTsCol); - doFillResults(pOperator, pInfo->pFillSup, pInfo->pFillInfo, preBlock, (TSKEY*)pPreTsCol->pData, preRowId, - pInfo->pRes); - } pInfo->pFillInfo->preRowKey = INT64_MIN; if (pInfo->pRes->info.rows > 0) { printDataBlock(pInfo->pRes, "stream fill"); @@ -1411,10 +1397,8 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi initResultSizeInfo(&pOperator->resultInfo, 4096); pInfo->pRes = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc); pInfo->pSrcBlock = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc); - pInfo->pPrevSrcBlock = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc); blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); blockDataEnsureCapacity(pInfo->pSrcBlock, pOperator->resultInfo.capacity); - blockDataEnsureCapacity(pInfo->pPrevSrcBlock, pOperator->resultInfo.capacity); pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pInfo->pRes); if (!pInfo->pFillInfo) { diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 8a097a23ce..88ed9eccb3 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -42,38 +42,40 @@ typedef struct SJoinOperatorInfo { static void setJoinColumnInfo(SColumnInfo* pColumn, const SColumnNode* pColumnNode); static SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator); static void destroyMergeJoinOperator(void* param); -static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t numOfDownstream, - SSortMergeJoinPhysiNode* pJoinNode); +static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t num, + SSortMergeJoinPhysiNode* pJoinNode, const char* idStr); -static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t numOfDownstream, - SSortMergeJoinPhysiNode* pJoinNode) { +static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t num, + SSortMergeJoinPhysiNode* pJoinNode, const char* idStr) { SNode* pMergeCondition = pJoinNode->pMergeCondition; - if (nodeType(pMergeCondition) == QUERY_NODE_OPERATOR) { - SOperatorNode* pNode = (SOperatorNode*)pMergeCondition; - SColumnNode* col1 = (SColumnNode*)pNode->pLeft; - SColumnNode* col2 = (SColumnNode*)pNode->pRight; - SColumnNode* leftTsCol = NULL; - SColumnNode* rightTsCol = NULL; - if (col1->dataBlockId == col2->dataBlockId ) { + if (nodeType(pMergeCondition) != QUERY_NODE_OPERATOR) { + qError("not support this in join operator, %s", idStr); + return; // do not handle this + } + + SOperatorNode* pNode = (SOperatorNode*)pMergeCondition; + SColumnNode* col1 = (SColumnNode*)pNode->pLeft; + SColumnNode* col2 = (SColumnNode*)pNode->pRight; + SColumnNode* leftTsCol = NULL; + SColumnNode* rightTsCol = NULL; + if (col1->dataBlockId == col2->dataBlockId) { + leftTsCol = col1; + rightTsCol = col2; + } else { + if (col1->dataBlockId == pDownstream[0]->resultDataBlockId) { + ASSERT(col2->dataBlockId == pDownstream[1]->resultDataBlockId); leftTsCol = col1; rightTsCol = col2; } else { - if (col1->dataBlockId == pDownstream[0]->resultDataBlockId) { - ASSERT(col2->dataBlockId == pDownstream[1]->resultDataBlockId); - leftTsCol = col1; - rightTsCol = col2; - } else { - ASSERT(col1->dataBlockId == pDownstream[1]->resultDataBlockId); - ASSERT(col2->dataBlockId == pDownstream[0]->resultDataBlockId); - leftTsCol = col2; - rightTsCol = col1; - } + ASSERT(col1->dataBlockId == pDownstream[1]->resultDataBlockId); + ASSERT(col2->dataBlockId == pDownstream[0]->resultDataBlockId); + leftTsCol = col2; + rightTsCol = col1; } - setJoinColumnInfo(&pInfo->leftCol, leftTsCol); - setJoinColumnInfo(&pInfo->rightCol, rightTsCol); - } else { - ASSERT(false); - }} + } + setJoinColumnInfo(&pInfo->leftCol, leftTsCol); + setJoinColumnInfo(&pInfo->rightCol, rightTsCol); +} SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo) { @@ -97,7 +99,7 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t pOperator->exprSupp.pExprInfo = pExprInfo; pOperator->exprSupp.numOfExprs = numOfCols; - extractTimeCondition(pInfo, pDownstream, numOfDownstream, pJoinNode); + extractTimeCondition(pInfo, pDownstream, numOfDownstream, pJoinNode, GET_TASKID(pTaskInfo)); if (pJoinNode->pOnConditions != NULL && pJoinNode->node.pConditions != NULL) { pInfo->pCondAfterMerge = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); @@ -364,8 +366,6 @@ static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs char* pRightVal = colDataGetData(pRightCol, pJoinInfo->rightPos); *pRightTs = *(int64_t*)pRightVal; - ASSERT(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); - ASSERT(pRightCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); return true; } diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 221ba0e8d6..0cccc75ef5 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -317,7 +317,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { if (pProjectInfo->mergeDataBlocks) { if (pRes->info.rows > 0) { - pFinalRes->info.id.groupId = pRes->info.id.groupId; + pFinalRes->info.id.groupId = 0; //clear groupId pFinalRes->info.version = pRes->info.version; // continue merge data, ignore the group id @@ -351,6 +351,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { SSDataBlock* p = pProjectInfo->mergeDataBlocks ? pFinalRes : pRes; pOperator->resultInfo.totalRows += p->info.rows; + p->info.dataLoad = 1; if (pOperator->cost.openCost == 0) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; @@ -700,13 +701,30 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc if (pExpr[k].pExpr->nodeType == QUERY_NODE_COLUMN) { // it is a project query SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId); if (pResult->info.rows > 0 && !createNewColModel) { - colDataMergeCol(pColInfoData, pResult->info.rows, (int32_t*)&pResult->info.capacity, pInputData->pData[0], - pInputData->numOfRows); - } else { - colDataAssign(pColInfoData, pInputData->pData[0], pInputData->numOfRows, &pResult->info); - } + if (pInputData->pData[0] == NULL) { + int32_t slotId = pfCtx->param[0].pCol->slotId; - numOfRows = pInputData->numOfRows; + SColumnInfoData* pInput = taosArrayGet(pSrcBlock->pDataBlock, slotId); + + colDataMergeCol(pColInfoData, pResult->info.rows, (int32_t*)&pResult->info.capacity, pInput, + pSrcBlock->info.rows); + } else { + colDataMergeCol(pColInfoData, pResult->info.rows, (int32_t*)&pResult->info.capacity, pInputData->pData[0], + pInputData->numOfRows); + } + } else { + if (pInputData->pData[0] == NULL) { + int32_t slotId = pfCtx->param[0].pCol->slotId; + + SColumnInfoData* pInput = taosArrayGet(pSrcBlock->pDataBlock, slotId); + colDataAssign(pColInfoData, pInput, pSrcBlock->info.rows, &pResult->info); + + numOfRows = pSrcBlock->info.rows; + } else { + colDataAssign(pColInfoData, pInputData->pData[0], pInputData->numOfRows, &pResult->info); + numOfRows = pInputData->numOfRows; + } + } } else if (pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE) { SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8a87cd5a0e..b2aa2269a2 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -232,30 +232,6 @@ static bool doLoadBlockSMA(STableScanBase* pTableScanInfo, SSDataBlock* pBlock, if (!allColumnsHaveAgg) { return false; } - -#if 0 - // if (allColumnsHaveAgg == true) { - int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); - - // todo create this buffer during creating operator - if (pBlock->pBlockAgg == NULL) { - pBlock->pBlockAgg = taosMemoryCalloc(numOfCols, POINTER_BYTES); - if (pBlock->pBlockAgg == NULL) { - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); - } - } - - size_t num = taosArrayGetSize(pTableScanInfo->matchInfo.pList); - for (int32_t i = 0; i < num; ++i) { - SColMatchItem* pColMatchInfo = taosArrayGet(pTableScanInfo->matchInfo.pList, i); - if (!pColMatchInfo->needOutput) { - continue; - } - - pBlock->pBlockAgg[pColMatchInfo->dstSlotId] = pColAgg[i]; - } -#endif - return true; } @@ -1790,11 +1766,18 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pTSInfo->scanTimes = 0; pTSInfo->currentGroupId = -1; pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN; + pTaskInfo->streamInfo.recoverScanFinished = false; } if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN) { + if (pInfo->blockRecoverContiCnt > 100) { + pInfo->blockRecoverTotCnt += pInfo->blockRecoverContiCnt; + pInfo->blockRecoverContiCnt = 0; + return NULL; + } SSDataBlock* pBlock = doTableScan(pInfo->pTableScanOp); if (pBlock != NULL) { + pInfo->blockRecoverContiCnt++; calBlockTbName(pInfo, pBlock); if (pInfo->pUpdateInfo) { TSKEY maxTs = updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex); @@ -1812,6 +1795,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pTSInfo->base.cond.startVersion = -1; pTSInfo->base.cond.endVersion = -1; + pTaskInfo->streamInfo.recoverScanFinished = true; return NULL; } @@ -2243,6 +2227,7 @@ static void destroyStreamScanOperatorInfo(void* param) { SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond, SExecTaskInfo* pTaskInfo) { + SArray* pColIds = NULL; SStreamScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); @@ -2265,7 +2250,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys } int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList); - SArray* pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); + pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); for (int32_t i = 0; i < numOfOutput; ++i) { SColMatchItem* id = taosArrayGet(pInfo->matchInfo.pList, i); @@ -2362,6 +2347,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys memcpy(&pTaskInfo->streamInfo.tableCond, &pTSInfo->base.cond, sizeof(SQueryTableDataCond)); } else { taosArrayDestroy(pColIds); + pColIds = NULL; } // create the pseduo columns info diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 7ac007b7cb..f5dc6cc623 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -46,13 +46,15 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pOperator->pTaskInfo = pTaskInfo; SDataBlockDescNode* pDescNode = pSortNode->node.pOutputDataBlockDesc; - int32_t numOfCols = 0; - SSDataBlock* pResBlock = createDataBlockFromDescNode(pDescNode); - SExprInfo* pExprInfo = createExprInfo(pSortNode->pExprs, NULL, &numOfCols); + int32_t numOfCols = 0; + SExprInfo* pExprInfo = createExprInfo(pSortNode->pExprs, NULL, &numOfCols); int32_t numOfOutputCols = 0; int32_t code = extractColMatchInfo(pSortNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } pOperator->exprSupp.pCtx = createSqlFunctionCtx(pExprInfo, numOfCols, &pOperator->exprSupp.rowEntryInfoOffset); initResultSizeInfo(&pOperator->resultInfo, 1024); @@ -61,7 +63,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* goto _error; } - pInfo->binfo.pRes = pResBlock; + pInfo->binfo.pRes = createDataBlockFromDescNode(pDescNode); pInfo->pSortInfo = createSortInfo(pSortNode->pSortKeys); initLimitInfo(pSortNode->node.pLimit, pSortNode->node.pSlimit, &pInfo->limitInfo); @@ -86,7 +88,10 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* _error: pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; - taosMemoryFree(pInfo); + if (pInfo != NULL) { + destroySortOperatorInfo(pInfo); + } + taosMemoryFree(pOperator); return NULL; } @@ -139,7 +144,6 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -272,7 +276,6 @@ void destroySortOperatorInfo(void* param) { } int32_t getExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - ASSERT(pOptr != NULL); SSortExecInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SSortOperatorInfo* pOperatorInfo = (SSortOperatorInfo*)pOptr->info; @@ -329,7 +332,6 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -746,7 +748,6 @@ void destroyMultiwayMergeOperatorInfo(void* param) { } int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - ASSERT(pOptr != NULL); SSortExecInfo* pSortExecInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SMultiwayMergeOperatorInfo* pInfo = (SMultiwayMergeOperatorInfo*)pOptr->info; diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index d30c1fbfa1..ab1feabf60 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -37,6 +37,22 @@ static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey); +static void setNotFillColumn(SFillInfo* pFillInfo, SColumnInfoData* pDstColInfo, int32_t rowIndex, int32_t colIdx) { + SRowVal* p = NULL; + if (FILL_IS_ASC_FILL(pFillInfo)) { + if (pFillInfo->prev.key != 0) { + p = &pFillInfo->prev; // prev has been set value + } else { // otherwise, use the value in the next row + p = &pFillInfo->next; + } + } else { + p = &pFillInfo->next; + } + + SGroupKeys* pKey = taosArrayGet(p->pRowVal, colIdx); + doSetVal(pDstColInfo, rowIndex, pKey); +} + static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowIndex) { for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; @@ -45,19 +61,7 @@ static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowInd if (pCol->notFillCol) { bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfo, rowIndex); if (!filled) { - SRowVal* p = NULL; - if (FILL_IS_ASC_FILL(pFillInfo)) { - if (pFillInfo->prev.key != 0) { - p = &pFillInfo->prev; // prev has been set value - } else { // otherwise, use the value in the next row - p = &pFillInfo->next; - } - } else { - p = &pFillInfo->next; - } - - SGroupKeys* pKey = taosArrayGet(p->pRowVal, i); - doSetVal(pDstColInfo, rowIndex, pKey); + setNotFillColumn(pFillInfo, pDstColInfo, rowIndex, i); } } else { colDataAppendNULL(pDstColInfo, rowIndex); @@ -124,28 +128,23 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* // set the other values if (pFillInfo->type == TSDB_FILL_PREV) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; - for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index); if (!filled) { - SGroupKeys* pKey = taosArrayGet(p, i); - doSetVal(pDstColInfoData, index, pKey); + setNotFillColumn(pFillInfo, pDstColInfoData, index, i); } } } else if (pFillInfo->type == TSDB_FILL_NEXT) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next.pRowVal : pFillInfo->prev.pRowVal; // todo refactor: start from 0 not 1 for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index); if (!filled) { - SGroupKeys* pKey = taosArrayGet(p, i); - doSetVal(pDstColInfoData, index, pKey); + setNotFillColumn(pFillInfo, pDstColInfoData, index, i); } } } else if (pFillInfo->type == TSDB_FILL_LINEAR) { @@ -163,9 +162,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* if (pCol->notFillCol) { bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstCol, index); if (!filled) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; - SGroupKeys* pKey = taosArrayGet(p, i); - doSetVal(pDstCol, index, pKey); + setNotFillColumn(pFillInfo, pDstCol, index, i); } } else { SGroupKeys* pKey = taosArrayGet(pFillInfo->prev.pRowVal, i); @@ -205,9 +202,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* if (pCol->notFillCol) { bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDst, index); if (!filled) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; - SGroupKeys* pKey = taosArrayGet(p, i); - doSetVal(pDst, index, pKey); + setNotFillColumn(pFillInfo, pDst, index, i); } } else { SVariant* pVar = &pFillInfo->pFillCol[i].fillVal; diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 8db03f99c5..f5ceeeafe7 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -147,9 +147,23 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo } + +static FORCE_INLINE int32_t timeSliceEnsureBlockCapacity(STimeSliceOperatorInfo* pSliceInfo, SSDataBlock* pBlock) { + if (pBlock->info.rows < pBlock->info.capacity) { + return TSDB_CODE_SUCCESS; + } + + uint32_t winNum = (pSliceInfo->win.ekey - pSliceInfo->win.skey) / pSliceInfo->interval.interval; + uint32_t newRowsNum = pBlock->info.rows + TMIN(winNum / 4 + 1, 1048576); + blockDataEnsureCapacity(pBlock, newRowsNum); + + return TSDB_CODE_SUCCESS; +} + + static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock, bool beforeTs) { int32_t rows = pResBlock->info.rows; - blockDataEnsureCapacity(pResBlock, rows + 1); + timeSliceEnsureBlockCapacity(pSliceInfo, pResBlock); // todo set the correct primary timestamp column // output the result @@ -269,7 +283,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp static void addCurrentRowToResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock, SSDataBlock* pSrcBlock, int32_t index) { - blockDataEnsureCapacity(pResBlock, pResBlock->info.rows + 1); + timeSliceEnsureBlockCapacity(pSliceInfo, pResBlock); for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) { SExprInfo* pExprInfo = &pExprSup->pExprInfo[j]; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index ca64fd135e..0de38fe500 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -907,7 +907,7 @@ static void removeDeleteResults(SHashObj* pUpdatedMap, SArray* pDelWins) { } bool isOverdue(TSKEY ekey, STimeWindowAggSupp* pTwSup) { - ASSERT(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0); + ASSERTS(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0, "maxts should greater than 0"); return pTwSup->maxTs != INT64_MIN && ekey < pTwSup->maxTs - pTwSup->waterMark; } @@ -1037,7 +1037,7 @@ SResultRowPosition addToOpenWindowList(SResultRowInfo* pResultRowInfo, const SRe int64_t* extractTsCol(SSDataBlock* pBlock, const SIntervalAggOperatorInfo* pInfo) { TSKEY* tsCols = NULL; - if (pBlock->pDataBlock != NULL && pBlock->info.dataLoad == 1) { + if (pBlock->pDataBlock != NULL && pBlock->info.dataLoad) { SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); tsCols = (int64_t*)pColDataInfo->pData; ASSERT(tsCols[0] != 0); @@ -1396,7 +1396,6 @@ static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) { while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); uint64_t groupId = *(uint64_t*)key; - ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t)); SResultRowPosition* pPos = (SResultRowPosition*)pIte; int32_t code = saveWinResult(ts, pPos->pageId, pPos->offset, groupId, resWins); @@ -1547,7 +1546,7 @@ static void closeChildIntervalWindow(SOperatorInfo* pOperator, SArray* pChildren for (int32_t i = 0; i < size; i++) { SOperatorInfo* pChildOp = taosArrayGetP(pChildren, i); SStreamIntervalOperatorInfo* pChInfo = pChildOp->info; - ASSERT(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + ASSERTS(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE, "children trigger type should be at once"); pChInfo->twAggSup.maxTs = TMAX(pChInfo->twAggSup.maxTs, maxTs); closeStreamIntervalWindow(pChInfo->aggSup.pResultRowHashTable, &pChInfo->twAggSup, &pChInfo->interval, NULL, NULL, NULL, pOperator); @@ -1767,8 +1766,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh .maxTs = INT64_MIN, }; - ASSERT(as.calTrigger != STREAM_TRIGGER_MAX_DELAY); - pInfo->win = pTaskInfo->window; pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; pInfo->resultTsOrder = (pPhyNode->window.outputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; @@ -2252,7 +2249,6 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB return; } blockDataEnsureCapacity(pBlock, size - (*pIndex)); - ASSERT(3 <= taosArrayGetSize(pBlock->pDataBlock)); SColumnInfoData* pStartTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pEndTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pGroupId = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); @@ -2346,6 +2342,17 @@ void doBuildResult(SOperatorInfo* pOperator, SStreamState* pState, SSDataBlock* buildDataBlockFromGroupRes(pOperator, pState, pBlock, &pOperator->exprSupp, pGroupResInfo); } +static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo, + TSKEY* primaryKeys, int32_t prevPosition) { + int32_t startPos = prevPosition + 1; + if (startPos == pDataBlockInfo->rows) { + startPos = -1; + } else { + *pNext = getFinalTimeWindow(primaryKeys[startPos], pInterval); + } + return startPos; +} + static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBlock, uint64_t groupId, SHashObj* pUpdatedMap) { SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperatorInfo->info; @@ -2359,7 +2366,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p SResultRow* pResult = NULL; int32_t forwardRows = 0; - ASSERT(pSDataBlock->pDataBlock != NULL); SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); tsCols = (int64_t*)pColDataInfo->pData; @@ -2456,8 +2462,12 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p } int32_t prevEndPos = (forwardRows - 1) * step + startPos; ASSERT(pSDataBlock->info.window.skey > 0 && pSDataBlock->info.window.ekey > 0); - startPos = - getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); + if (IS_FINAL_OP(pInfo)) { + startPos = getNextQualifiedFinalWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos); + } else { + startPos = + getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); + } if (startPos < 0) { break; } @@ -2482,7 +2492,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - ASSERT(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2543,7 +2552,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->numOfDatapack++; printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv"); - ASSERT(pBlock->info.type != STREAM_INVERT); if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) { pInfo->binfo.pRes->info.type = pBlock->info.type; } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || @@ -2633,7 +2641,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - ASSERT(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2688,7 +2695,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, .deleteMarkSaved = 0, .calTriggerSaved = 0, }; - ASSERT(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY); + ASSERTS(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY, "trigger type should not be max delay"); pInfo->primaryTsIndex = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; initResultSizeInfo(&pOperator->resultInfo, 4096); @@ -2713,7 +2720,6 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, initStreamFunciton(pOperator->exprSupp.pCtx, pOperator->exprSupp.numOfExprs); - ASSERT(numOfCols > 0); initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); pInfo->pState = taosMemoryCalloc(1, sizeof(SStreamState)); @@ -2724,6 +2730,9 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->pChildren = NULL; if (numOfChild > 0) { pInfo->pChildren = taosArrayInit(numOfChild, sizeof(void*)); + if (!pInfo->pChildren) { + goto _error; + } for (int32_t i = 0; i < numOfChild; i++) { SOperatorInfo* pChildOp = createStreamFinalIntervalOperatorInfo(NULL, pPhyNode, pTaskInfo, 0); if (pChildOp) { @@ -2746,7 +2755,6 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, // semi interval operator does not catch result pInfo->isFinal = false; pOperator->name = "StreamSemiIntervalOperator"; - ASSERT(pInfo->aggSup.currentPageId == -1); } if (!IS_FINAL_OP(pInfo) || numOfChild == 0) { @@ -3162,15 +3170,6 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData } } -void deleteWindow(SArray* pWinInfos, int32_t index, FDelete fp) { - ASSERT(index >= 0 && index < taosArrayGetSize(pWinInfos)); - if (fp) { - void* ptr = taosArrayGet(pWinInfos, index); - fp(ptr); - } - taosArrayRemove(pWinInfos, index); -} - static void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SArray* result) { SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startDatas = (TSKEY*)pStartTsCol->pData; @@ -3218,7 +3217,6 @@ static int32_t copyUpdateResult(SSHashObj* pStUpdated, SArray* pUpdated) { int32_t iter = 0; while ((pIte = tSimpleHashIterate(pStUpdated, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); - ASSERT(keyLen == sizeof(SSessionKey)); taosArrayPush(pUpdated, key); } taosArraySort(pUpdated, sessionKeyCompareAsc); @@ -3279,7 +3277,6 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; int32_t numOfOutput = pSup->numOfExprs; int32_t numOfChildren = taosArrayGetSize(pInfo->pChildren); - ASSERT(pInfo->pChildren); for (int32_t i = 0; i < size; i++) { SSessionKey* pWinKey = taosArrayGet(pWinArray, i); @@ -3380,7 +3377,6 @@ static void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted) { void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) { pGroupResInfo->pRows = pArrayList; pGroupResInfo->index = 0; - ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } void doBuildSessionResult(SOperatorInfo* pOperator, SStreamState* pState, SGroupResInfo* pGroupResInfo, @@ -4811,7 +4807,6 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys int32_t code = TSDB_CODE_SUCCESS; int32_t numOfCols = 0; SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &numOfCols); - ASSERT(numOfCols > 0); SSDataBlock* pResBlock = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); SInterval interval = { @@ -4831,7 +4826,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys .deleteMark = getDeleteMark(pIntervalPhyNode), }; - ASSERT(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY); + ASSERTS(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY, "trigger type should not be max delay"); pOperator->pTaskInfo = pTaskInfo; pInfo->interval = interval; diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c index 484d917069..fd6215e3a1 100644 --- a/source/libs/executor/src/tsimplehash.c +++ b/source/libs/executor/src/tsimplehash.c @@ -49,7 +49,9 @@ static FORCE_INLINE int32_t taosHashCapacity(int32_t length) { } SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { - ASSERT(fn != NULL); + if (fn == NULL) { + return NULL; + } if (capacity == 0) { capacity = 4; @@ -66,7 +68,6 @@ SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { pHashObj->equalFp = memcmp; pHashObj->hashFp = fn; - ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); pHashObj->hashList = (SHNode **)taosMemoryCalloc(pHashObj->capacity, sizeof(void *)); if (!pHashObj->hashList) { diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 30911887bb..fa0cdb3943 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -800,6 +800,7 @@ STupleHandle* tsortNextTuple(SSortHandle* pHandle) { } } + // all sources are completed. if (pHandle->cmpParam.numOfSources == pHandle->numOfCompletedSources) { return NULL; } diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h index 307a82e256..a7ac53fab6 100644 --- a/source/libs/function/inc/builtinsimpl.h +++ b/source/libs/function/inc/builtinsimpl.h @@ -32,6 +32,7 @@ typedef struct SSumRes { int16_t type; int64_t prevTs; bool isPrevTsSet; + bool overflow; // if overflow is true, dsum to be used for any type; } SSumRes; typedef struct SMinmaxResInfo { diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 111da6d6ba..a1e39b3548 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1995,6 +1995,22 @@ static FORCE_INLINE TSKEY getRowPTs(SColumnInfoData* pTsColInfo, int32_t rowInde return *(TSKEY*)colDataGetData(pTsColInfo, rowIndex); } +static void prepareBuf(SqlFunctionCtx* pCtx) { + if (pCtx->subsidiaries.rowLen == 0) { + int32_t rowLen = 0; + for (int32_t j = 0; j < pCtx->subsidiaries.num; ++j) { + SqlFunctionCtx* pc = pCtx->subsidiaries.pCtx[j]; + rowLen += pc->pExpr->base.resSchema.bytes; + } + + pCtx->subsidiaries.rowLen = rowLen + pCtx->subsidiaries.num * sizeof(bool); + pCtx->subsidiaries.buf = taosMemoryMalloc(pCtx->subsidiaries.rowLen); + } + + ASSERT(pCtx->subsidiaries.buf != NULL); + ASSERT(pCtx->subsidiaries.rowLen > 0); +} + static void firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowIndex, SqlFunctionCtx* pCtx, SFirstLastRes* pInfo) { if (pCtx->subsidiaries.num <= 0) { @@ -2003,8 +2019,6 @@ static void firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowInde if (!pInfo->hasResult) { pInfo->pos = saveTupleData(pCtx, rowIndex, pSrcBlock, NULL); - ASSERT(pCtx->subsidiaries.buf != NULL); - ASSERT(pCtx->subsidiaries.rowLen > 0); } else { updateTupleData(pCtx, rowIndex, pSrcBlock, &pInfo->pos); } @@ -2960,16 +2974,7 @@ static STuplePos doSaveTupleData(SSerializeDataHandle* pHandle, const void* pBuf } STuplePos saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, const STupleKey* pKey) { - if (pCtx->subsidiaries.rowLen == 0) { - int32_t rowLen = 0; - for (int32_t j = 0; j < pCtx->subsidiaries.num; ++j) { - SqlFunctionCtx* pc = pCtx->subsidiaries.pCtx[j]; - rowLen += pc->pExpr->base.resSchema.bytes; - } - - pCtx->subsidiaries.rowLen = rowLen + pCtx->subsidiaries.num * sizeof(bool); - pCtx->subsidiaries.buf = taosMemoryMalloc(pCtx->subsidiaries.rowLen); - } + prepareBuf(pCtx); char* buf = serializeTupleData(pSrcBlock, rowIndex, &pCtx->subsidiaries, pCtx->subsidiaries.buf); return doSaveTupleData(&pCtx->saveHandle, buf, pCtx->subsidiaries.rowLen, pKey); @@ -2989,6 +2994,8 @@ static int32_t doUpdateTupleData(SSerializeDataHandle* pHandle, const void* pBuf } int32_t updateTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STuplePos* pPos) { + prepareBuf(pCtx); + char* buf = serializeTupleData(pSrcBlock, rowIndex, &pCtx->subsidiaries, pCtx->subsidiaries.buf); doUpdateTupleData(&pCtx->saveHandle, buf, pCtx->subsidiaries.rowLen, pPos); return TSDB_CODE_SUCCESS; @@ -5185,6 +5192,7 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) { pDistInfo->numOfBlocks += p1.numOfBlocks; pDistInfo->numOfTables += p1.numOfTables; pDistInfo->numOfInmemRows += p1.numOfInmemRows; + pDistInfo->numOfVgroups += p1.numOfVgroups; pDistInfo->totalSize += p1.totalSize; pDistInfo->totalRows += p1.totalRows; pDistInfo->numOfFiles += p1.numOfFiles; @@ -5219,6 +5227,7 @@ int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDist if (tEncodeU16(&encoder, pInfo->numOfFiles) < 0) return -1; if (tEncodeU32(&encoder, pInfo->numOfBlocks) < 0) return -1; if (tEncodeU32(&encoder, pInfo->numOfTables) < 0) return -1; + if (tEncodeU32(&encoder, pInfo->numOfVgroups) < 0) return -1; if (tEncodeU64(&encoder, pInfo->totalSize) < 0) return -1; if (tEncodeU64(&encoder, pInfo->totalRows) < 0) return -1; @@ -5250,6 +5259,7 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo if (tDecodeU16(&decoder, &pInfo->numOfFiles) < 0) return -1; if (tDecodeU32(&decoder, &pInfo->numOfBlocks) < 0) return -1; if (tDecodeU32(&decoder, &pInfo->numOfTables) < 0) return -1; + if (tDecodeU32(&decoder, &pInfo->numOfVgroups) < 0) return -1; if (tDecodeU64(&decoder, &pInfo->totalSize) < 0) return -1; if (tDecodeU64(&decoder, &pInfo->totalRows) < 0) return -1; @@ -5292,7 +5302,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t len = sprintf(st + VARSTR_HEADER_SIZE, "Total_Blocks=[%d] Total_Size=[%.2f Kb] Average_size=[%.2f Kb] Compression_Ratio=[%.2f %c]", - pData->numOfBlocks, pData->totalSize / 1024.0, averageSize, compRatio, '%'); + pData->numOfBlocks, pData->totalSize / 1024.0, averageSize/1024.0, compRatio, '%'); varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); @@ -5310,7 +5320,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { colDataAppend(pColInfo, row++, st, false); len = sprintf(st + VARSTR_HEADER_SIZE, "Total_Tables=[%d] Total_Files=[%d] Total_Vgroups=[%d]", pData->numOfTables, - pData->numOfFiles, 0); + pData->numOfFiles, pData->numOfVgroups); varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); diff --git a/source/libs/function/src/detail/tavgfunction.c b/source/libs/function/src/detail/tavgfunction.c index 60bf30d8ed..8e010181d1 100644 --- a/source/libs/function/src/detail/tavgfunction.c +++ b/source/libs/function/src/detail/tavgfunction.c @@ -41,6 +41,57 @@ } \ } while (0) +// define signed number sum with check overflow +#define CHECK_OVERFLOW_SUM_SIGNED(out, val) \ + if (out->sum.overflow) { \ + out->sum.dsum += val; \ + } else if (out->sum.isum > 0 && val > 0 && INT64_MAX - out->sum.isum <= val || \ + out->sum.isum < 0 && val < 0 && INT64_MIN - out->sum.isum >= val) { \ + double dsum = (double)out->sum.isum; \ + out->sum.overflow = true; \ + out->sum.dsum = dsum + val; \ + } else { \ + out->sum.isum += val; \ + } + +// val is big than INT64_MAX, val come from merge +#define CHECK_OVERFLOW_SUM_SIGNED_BIG(out, val, big) \ + if (out->sum.overflow) { \ + out->sum.dsum += val; \ + } else if (out->sum.isum > 0 && val > 0 && INT64_MAX - out->sum.isum <= val || \ + out->sum.isum < 0 && val < 0 && INT64_MIN - out->sum.isum >= val || \ + big) { \ + double dsum = (double)out->sum.isum; \ + out->sum.overflow = true; \ + out->sum.dsum = dsum + val; \ + } else { \ + out->sum.isum += val; \ + } + +// define unsigned number sum with check overflow +#define CHECK_OVERFLOW_SUM_UNSIGNED(out, val) \ + if (out->sum.overflow) { \ + out->sum.dsum += val; \ + } else if (UINT64_MAX - out->sum.usum <= val) { \ + double dsum = (double)out->sum.usum; \ + out->sum.overflow = true; \ + out->sum.dsum = dsum + val; \ + } else { \ + out->sum.usum += val; \ + } + +// val is big than UINT64_MAX, val come from merge +#define CHECK_OVERFLOW_SUM_UNSIGNED_BIG(out, val, big) \ + if (out->sum.overflow) { \ + out->sum.dsum += val; \ + } else if (UINT64_MAX - out->sum.usum <= val || big) { \ + double dsum = (double)out->sum.usum; \ + out->sum.overflow = true; \ + out->sum.dsum = dsum + val; \ + } else { \ + out->sum.usum += val; \ + } + typedef struct SAvgRes { double result; SSumRes sum; @@ -319,9 +370,9 @@ static int32_t calculateAvgBySMAInfo(SAvgRes* pRes, int32_t numOfRows, int32_t t pRes->count += numOfElem; if (IS_SIGNED_NUMERIC_TYPE(type)) { - pRes->sum.isum += pAgg->sum; + CHECK_OVERFLOW_SUM_SIGNED(pRes, pAgg->sum); } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { - pRes->sum.usum += pAgg->sum; + CHECK_OVERFLOW_SUM_UNSIGNED(pRes, pAgg->sum); } else if (IS_FLOAT_TYPE(type)) { pRes->sum.dsum += GET_DOUBLE_VAL((const char*)&(pAgg->sum)); } @@ -344,7 +395,7 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pRes, plist[i]) } break; @@ -359,7 +410,7 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pRes, plist[i]) } break; } @@ -373,7 +424,7 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pRes, plist[i]) } break; @@ -388,7 +439,7 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pRes, plist[i]) } break; } @@ -402,7 +453,7 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.usum += plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pRes, plist[i]) } break; @@ -417,7 +468,7 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.usum += plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pRes, plist[i]) } break; } @@ -431,7 +482,7 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.usum += plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pRes, plist[i]) } break; @@ -446,7 +497,8 @@ static int32_t doAddNumericVector(SColumnInfoData* pCol, int32_t type, SInputCol numOfElems += 1; pRes->count += 1; - pRes->sum.usum += plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pRes, plist[i]) + } break; } @@ -527,9 +579,9 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { } else { for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { if (type == TSDB_DATA_TYPE_TINYINT) { - pAvgRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pAvgRes, plist[i]) } else { - pAvgRes->sum.usum += (uint8_t)plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pAvgRes, (uint8_t)plist[i]) } } } @@ -546,9 +598,9 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { } else { for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { if (type == TSDB_DATA_TYPE_SMALLINT) { - pAvgRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pAvgRes, plist[i]) } else { - pAvgRes->sum.usum += (uint16_t)plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pAvgRes, (uint16_t)plist[i]) } } } @@ -565,9 +617,9 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { } else { for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { if (type == TSDB_DATA_TYPE_INT) { - pAvgRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pAvgRes, plist[i]) } else { - pAvgRes->sum.usum += (uint32_t)plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pAvgRes, (uint32_t)plist[i]) } } } @@ -584,9 +636,9 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { } else { for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { if (type == TSDB_DATA_TYPE_BIGINT) { - pAvgRes->sum.isum += plist[i]; + CHECK_OVERFLOW_SUM_SIGNED(pAvgRes, plist[i]) } else { - pAvgRes->sum.usum += (uint64_t)plist[i]; + CHECK_OVERFLOW_SUM_UNSIGNED(pAvgRes, (uint64_t)plist[i]) } } } @@ -639,9 +691,11 @@ static void avgTransferInfo(SAvgRes* pInput, SAvgRes* pOutput) { pOutput->type = pInput->type; if (IS_SIGNED_NUMERIC_TYPE(pOutput->type)) { - pOutput->sum.isum += pInput->sum.isum; + bool overflow = pInput->sum.overflow; + CHECK_OVERFLOW_SUM_SIGNED_BIG(pOutput, (overflow ? pInput->sum.dsum : pInput->sum.isum), overflow); } else if (IS_UNSIGNED_NUMERIC_TYPE(pOutput->type)) { - pOutput->sum.usum += pInput->sum.usum; + bool overflow = pInput->sum.overflow; + CHECK_OVERFLOW_SUM_UNSIGNED_BIG(pOutput, (overflow ? pInput->sum.dsum : pInput->sum.usum), overflow); } else { pOutput->sum.dsum += pInput->sum.dsum; } @@ -741,9 +795,9 @@ int32_t avgCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type; if (IS_SIGNED_NUMERIC_TYPE(type)) { - pDBuf->sum.isum += pSBuf->sum.isum; + CHECK_OVERFLOW_SUM_SIGNED(pDBuf, pSBuf->sum.isum) } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { - pDBuf->sum.usum += pSBuf->sum.usum; + CHECK_OVERFLOW_SUM_UNSIGNED(pDBuf, pSBuf->sum.usum) } else { pDBuf->sum.dsum += pSBuf->sum.dsum; } @@ -759,7 +813,10 @@ int32_t avgFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t type = pRes->type; if (pRes->count > 0) { - if (IS_SIGNED_NUMERIC_TYPE(type)) { + if(pRes->sum.overflow) { + // overflow flag set , use dsum + pRes->result = pRes->sum.dsum / ((double)pRes->count); + }else if (IS_SIGNED_NUMERIC_TYPE(type)) { pRes->result = pRes->sum.isum / ((double)pRes->count); } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { pRes->result = pRes->sum.usum / ((double)pRes->count); diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 0b309bc8f5..acfd5c07af 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -841,36 +841,42 @@ int32_t convertScalarParamToDataBlock(SScalarParam *input, int32_t numOfCols, SS for (int32_t i = 0; i < numOfCols; ++i) { numOfRows = (input[i].numOfRows > numOfRows) ? input[i].numOfRows : numOfRows; } - output->info.rows = numOfRows; - output->pDataBlock = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); - for (int32_t i = 0; i < numOfCols; ++i) { - if ((input+i)->numOfRows < numOfRows) { - SColumnInfoData* pColInfoData = (input+i)->columnData; - int32_t startRow = (input+i)->numOfRows; - int32_t expandRows = numOfRows - startRow; - colInfoDataEnsureCapacity(pColInfoData, numOfRows, false); + + // create the basic block info structure + for(int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData* pInfo = input[i].columnData; + SColumnInfoData d = {0}; + d.info = pInfo->info; + + blockDataAppendColInfo(output, &d); + } + + blockDataEnsureCapacity(output, numOfRows); + + for(int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData* pDest = taosArrayGet(output->pDataBlock, i); + + SColumnInfoData* pColInfoData = input[i].columnData; + colDataAssign(pDest, pColInfoData, input[i].numOfRows, &output->info); + + if (input[i].numOfRows < numOfRows) { + int32_t startRow = input[i].numOfRows; + int expandRows = numOfRows - startRow; bool isNull = colDataIsNull_s(pColInfoData, (input+i)->numOfRows - 1); if (isNull) { - colDataAppendNNULL(pColInfoData, startRow, expandRows); + colDataAppendNNULL(pDest, startRow, expandRows); } else { char* src = colDataGetData(pColInfoData, (input + i)->numOfRows - 1); - int32_t bytes = pColInfoData->info.bytes; - char* data = taosMemoryMalloc(bytes); - memcpy(data, src, bytes); for (int j = 0; j < expandRows; ++j) { - colDataAppend(pColInfoData, startRow+j, data, false); + colDataAppend(pDest, startRow+j, src, false); } //colDataAppendNItems(pColInfoData, startRow, data, expandRows); - taosMemoryFree(data); } } - - taosArrayPush(output->pDataBlock, (input + i)->columnData); - - if (IS_VAR_DATA_TYPE((input + i)->columnData->info.type)) { - output->info.hasVarCol = true; - } } + + output->info.rows = numOfRows; + return 0; } @@ -1824,8 +1830,8 @@ int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t convertDataBlockToScalarParm(&resultBlock, output); taosArrayDestroy(resultBlock.pDataBlock); } - - taosArrayDestroy(inputBlock.pDataBlock); + + blockDataFreeRes(&inputBlock); return err; } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 40c75ce6ba..6c88e4d5c8 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -606,6 +606,7 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { } static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_SYN_NOT_LEADER || + code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || diff --git a/source/libs/index/inc/indexFstFile.h b/source/libs/index/inc/indexFstFile.h index 0ddffe7df0..d15141f79a 100644 --- a/source/libs/index/inc/indexFstFile.h +++ b/source/libs/index/inc/indexFstFile.h @@ -44,6 +44,11 @@ typedef struct IFileCtx { bool readOnly; char buf[256]; int64_t size; + + char* wBuf; + int32_t wBufOffset; + int32_t wBufCap; + #ifdef USE_MMAP char* ptr; #endif diff --git a/source/libs/index/src/indexFilter.c b/source/libs/index/src/indexFilter.c index 5a86bc8678..07696c3822 100644 --- a/source/libs/index/src/indexFilter.c +++ b/source/libs/index/src/indexFilter.c @@ -255,7 +255,7 @@ static int32_t sifInitParam(SNode *node, SIFParam *param, SIFCtx *ctx) { indexError("invalid length for node:%p, length: %d", node, LIST_LENGTH(nl->pNodeList)); SIF_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } - SIF_ERR_RET(scalarGenerateSetFromList((void **)¶m->pFilter, node, nl->dataType.type)); + SIF_ERR_RET(scalarGenerateSetFromList((void **)¶m->pFilter, node, nl->node.resType.type)); if (taosHashPut(ctx->pRes, &node, POINTER_BYTES, param, sizeof(*param))) { taosHashCleanup(param->pFilter); indexError("taosHashPut nodeList failed, size:%d", (int32_t)sizeof(*param)); diff --git a/source/libs/index/src/indexFstFile.c b/source/libs/index/src/indexFstFile.c index 5538584754..4620af8694 100644 --- a/source/libs/index/src/indexFstFile.c +++ b/source/libs/index/src/indexFstFile.c @@ -38,14 +38,41 @@ static FORCE_INLINE void idxGenLRUKey(char* buf, const char* path, int32_t block return; } static FORCE_INLINE int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len) { + int tlen = len; if (ctx->type == TFILE) { - int nwr = taosWriteFile(ctx->file.pFile, buf, len); - assert(nwr == len); + int32_t cap = ctx->file.wBufCap; + if (len + ctx->file.wBufOffset >= cap) { + int32_t nw = cap - ctx->file.wBufOffset; + memcpy(ctx->file.wBuf + ctx->file.wBufOffset, buf, nw); + taosWriteFile(ctx->file.pFile, ctx->file.wBuf, cap); + + memset(ctx->file.wBuf, 0, cap); + ctx->file.wBufOffset = 0; + + len -= nw; + buf += nw; + + nw = (len / cap) * cap; + if (nw != 0) { + taosWriteFile(ctx->file.pFile, buf, nw); + } + + len -= nw; + buf += nw; + if (len != 0) { + memcpy(ctx->file.wBuf, buf, len); + } + ctx->file.wBufOffset += len; + } else { + memcpy(ctx->file.wBuf + ctx->file.wBufOffset, buf, len); + ctx->file.wBufOffset += len; + } + } else { memcpy(ctx->mem.buf + ctx->offset, buf, len); } - ctx->offset += len; - return len; + ctx->offset += tlen; + return tlen; } static FORCE_INLINE int idxFileCtxDoRead(IFileCtx* ctx, uint8_t* buf, int len) { int nRead = 0; @@ -127,14 +154,22 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of } static FORCE_INLINE int idxFileCtxGetSize(IFileCtx* ctx) { if (ctx->type == TFILE) { - int64_t file_size = 0; - taosStatFile(ctx->file.buf, &file_size, NULL); - return (int)file_size; + if (ctx->file.readOnly == false) { + return ctx->offset; + } else { + int64_t file_size = 0; + taosStatFile(ctx->file.buf, &file_size, NULL); + return (int)file_size; + } } return 0; } static FORCE_INLINE int idxFileCtxDoFlush(IFileCtx* ctx) { if (ctx->type == TFILE) { + if (ctx->file.wBufOffset > 0) { + int32_t nw = taosWriteFile(ctx->file.pFile, ctx->file.wBuf, ctx->file.wBufOffset); + ctx->file.wBufOffset = 0; + } taosFsyncFile(ctx->file.pFile); } else { // do nothing @@ -157,10 +192,15 @@ IFileCtx* idxFileCtxCreate(WriterType type, const char* path, bool readOnly, int ctx->file.pFile = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); taosFtruncateFile(ctx->file.pFile, 0); taosStatFile(path, &ctx->file.size, NULL); + + ctx->file.wBufOffset = 0; + ctx->file.wBufCap = kBlockSize * 4; + ctx->file.wBuf = taosMemoryCalloc(1, ctx->file.wBufCap); } else { ctx->file.pFile = taosOpenFile(path, TD_FILE_READ); - taosFStatFile(ctx->file.pFile, &ctx->file.size, NULL); + ctx->file.wBufOffset = 0; + #ifdef USE_MMAP ctx->file.ptr = (char*)tfMmapReadOnly(ctx->file.pFile, ctx->file.size); #endif @@ -195,17 +235,18 @@ void idxFileCtxDestroy(IFileCtx* ctx, bool remove) { if (ctx->type == TMEMORY) { taosMemoryFree(ctx->mem.buf); } else { + if (ctx->file.wBufOffset > 0) { + int32_t nw = taosWriteFile(ctx->file.pFile, ctx->file.wBuf, ctx->file.wBufOffset); + ctx->file.wBufOffset = 0; + } ctx->flush(ctx); + taosMemoryFreeClear(ctx->file.wBuf); taosCloseFile(&ctx->file.pFile); if (ctx->file.readOnly) { #ifdef USE_MMAP munmap(ctx->file.ptr, ctx->file.size); #endif } - if (ctx->file.readOnly == false) { - int64_t file_size = 0; - taosStatFile(ctx->file.buf, &file_size, NULL); - } if (remove) { unlink(ctx->file.buf); } diff --git a/source/libs/index/test/index_executor_tests.cpp b/source/libs/index/test/index_executor_tests.cpp index c8a7ca98f0..232675d32f 100644 --- a/source/libs/index/test/index_executor_tests.cpp +++ b/source/libs/index/test/index_executor_tests.cpp @@ -139,7 +139,7 @@ void sifMakeOpNode(SNode **pNode, EOperatorType opType, int32_t resType, SNode * void sifMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) { SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_NODE_LIST); SNodeListNode *lnode = (SNodeListNode *)node; - lnode->dataType.type = resType; + lnode->node.resType.type = resType; lnode->pNodeList = list; *pNode = (SNode *)lnode; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index aab018c879..fb9560341e 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -318,7 +318,7 @@ static int32_t intervalWindowNodeCopy(const SIntervalWindowNode* pSrc, SInterval } static int32_t nodeListNodeCopy(const SNodeListNode* pSrc, SNodeListNode* pDst) { - COPY_OBJECT_FIELD(dataType, sizeof(SDataType)); + COPY_OBJECT_FIELD(node.resType, sizeof(SDataType)); CLONE_NODE_LIST_FIELD(pNodeList); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 45d65d5ea1..c17077950f 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -173,6 +173,10 @@ const char* nodesNodeName(ENodeType type) { return "BalanceVgroupStmt"; case QUERY_NODE_MERGE_VGROUP_STMT: return "MergeVgroupStmt"; + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + return "ShowDbAliveStmt"; + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: + return "ShowClusterAliveStmt"; case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT: return "RedistributeVgroupStmt"; case QUERY_NODE_SPLIT_VGROUP_STMT: @@ -3903,7 +3907,7 @@ static const char* jkNodeListNodeList = "NodeList"; static int32_t nodeListNodeToJson(const void* pObj, SJson* pJson) { const SNodeListNode* pNode = (const SNodeListNode*)pObj; - int32_t code = tjsonAddObject(pJson, jkNodeListDataType, dataTypeToJson, &pNode->dataType); + int32_t code = tjsonAddObject(pJson, jkNodeListDataType, dataTypeToJson, &pNode->node.resType); if (TSDB_CODE_SUCCESS == code) { code = nodeListToJson(pJson, jkNodeListNodeList, pNode->pNodeList); } @@ -3914,7 +3918,7 @@ static int32_t nodeListNodeToJson(const void* pObj, SJson* pJson) { static int32_t jsonToNodeListNode(const SJson* pJson, void* pObj) { SNodeListNode* pNode = (SNodeListNode*)pObj; - int32_t code = tjsonToObject(pJson, jkNodeListDataType, jsonToDataType, &pNode->dataType); + int32_t code = tjsonToObject(pJson, jkNodeListDataType, jsonToDataType, &pNode->node.resType); if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkNodeListNodeList, &pNode->pNodeList); } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index cb441053ce..f5e4bc1ea4 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -1298,7 +1298,7 @@ enum { NODE_LIST_CODE_DATA_TYPE = 1, NODE_LIST_CODE_NODE_LIST }; static int32_t nodeListNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { const SNodeListNode* pNode = (const SNodeListNode*)pObj; - int32_t code = tlvEncodeObj(pEncoder, NODE_LIST_CODE_DATA_TYPE, dataTypeInlineToMsg, &pNode->dataType); + int32_t code = tlvEncodeObj(pEncoder, NODE_LIST_CODE_DATA_TYPE, dataTypeInlineToMsg, &pNode->node.resType); if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeObj(pEncoder, NODE_LIST_CODE_NODE_LIST, nodeListToMsg, pNode->pNodeList); } @@ -1314,7 +1314,7 @@ static int32_t msgToNodeListNode(STlvDecoder* pDecoder, void* pObj) { tlvForEach(pDecoder, pTlv, code) { switch (pTlv->type) { case NODE_LIST_CODE_DATA_TYPE: - code = tlvDecodeObjFromTlv(pTlv, msgToDataTypeInline, &pNode->dataType); + code = tlvDecodeObjFromTlv(pTlv, msgToDataTypeInline, &pNode->node.resType); break; case NODE_LIST_CODE_NODE_LIST: code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pNodeList); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index dd06326dcb..61bb3778fa 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -434,6 +434,9 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SShowDnodeVariablesStmt)); case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: return makeNode(type, sizeof(SShowCreateDatabaseStmt)); + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: + return makeNode(type, sizeof(SShowAliveStmt)); case QUERY_NODE_SHOW_CREATE_TABLE_STMT: case QUERY_NODE_SHOW_CREATE_STABLE_STMT: return makeNode(type, sizeof(SShowCreateTableStmt)); @@ -960,6 +963,8 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_USERS_STMT: case QUERY_NODE_SHOW_LICENCES_STMT: case QUERY_NODE_SHOW_VGROUPS_STMT: + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: case QUERY_NODE_SHOW_TOPICS_STMT: case QUERY_NODE_SHOW_CONSUMERS_STMT: case QUERY_NODE_SHOW_CONNECTIONS_STMT: diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index c74ec9c147..5fb652213c 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -176,6 +176,7 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type); SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName, EOperatorType tableCondType); SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); +SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type); SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable); SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern); @@ -197,7 +198,7 @@ SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, cons SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery); SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, - const SToken* pSubDbName, bool withMeta); + SToken* pSubDbName, bool withMeta); SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pRealTable, bool withMeta); SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName); @@ -216,7 +217,7 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName); SNode* createStreamOptions(SAstCreateContext* pCxt); SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, - SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery); + SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols); SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName); SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId); SNode* createKillQueryStmt(SAstCreateContext* pCxt, const SToken* pQueryId); diff --git a/source/libs/parser/inc/parInsertUtil.h b/source/libs/parser/inc/parInsertUtil.h index 86d98c5515..7b816359f9 100644 --- a/source/libs/parser/inc/parInsertUtil.h +++ b/source/libs/parser/inc/parInsertUtil.h @@ -35,128 +35,27 @@ struct SToken; } \ } while (0) -#define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) - -typedef enum EOrderStatus { - ORDER_STATUS_UNKNOWN = 0, - ORDER_STATUS_ORDERED = 1, - ORDER_STATUS_DISORDERED = 2, -} EOrderStatus; - -typedef enum EValStat { - VAL_STAT_HAS = 0x0, // 0 means has val - VAL_STAT_NONE = 0x01, // 1 means no val -} EValStat; - -typedef struct SBoundColumn { - int32_t offset; // all column offset value - int32_t toffset; // first part offset for SDataRow TODO: get offset from STSchema on future - uint8_t valStat; // EValStat. denote if current column bound or not(0 means has val, 1 means no val) -} SBoundColumn; - -typedef struct { - col_id_t schemaColIdx; - col_id_t boundIdx; - col_id_t finalIdx; -} SBoundIdxInfo; - -typedef struct SParsedDataColInfo { - col_id_t numOfCols; - col_id_t numOfBound; - uint16_t flen; // TODO: get from STSchema - uint16_t allNullLen; // TODO: get from STSchema(base on SDataRow) - uint16_t extendedVarLen; - uint16_t boundNullLen; // bound column len with all NULL value(without VarDataOffsetT/SColIdx part) - col_id_t *boundColumns; // bound column idx according to schema - SBoundColumn *cols; - SBoundIdxInfo *colIdxInfo; - int8_t orderStatus; // bound columns -} SParsedDataColInfo; - -typedef struct SInsertParseBaseContext { - SParseContext *pComCxt; - char *pSql; - SMsgBuf msg; -} SInsertParseBaseContext; - -typedef struct SInsertParseSyntaxCxt { - SParseContext *pComCxt; - char *pSql; - SMsgBuf msg; - SParseMetaCache *pMetaCache; -} SInsertParseSyntaxCxt; - -typedef struct SMemParam { - SRowBuilder *rb; - SSchema *schema; - int32_t toffset; - col_id_t colIdx; -} SMemParam; - -typedef struct { - uint8_t rowType; // default is 0, that is SDataRow - int32_t rowSize; -} SMemRowBuilder; - -typedef struct STableDataBlocks { - int8_t tsSource; // where does the UNIX timestamp come from, server or client - bool ordered; // if current rows are ordered or not - int32_t vgId; // virtual group id - int64_t prevTS; // previous timestamp, recorded to decide if the records array is ts ascending - int32_t numOfTables; // number of tables in current submit block - int32_t rowSize; // row size for current table - uint32_t nAllocSize; - uint32_t headerSize; // header for table info (uid, tid, submit metadata) - uint32_t size; - STableMeta *pTableMeta; // the tableMeta of current table, the table meta will be used during submit, keep a ref to - // avoid to be removed from cache - char *pData; - bool cloned; - int32_t createTbReqLen; - SParsedDataColInfo boundColumnInfo; - SRowBuilder rowBuilder; -} STableDataBlocks; - -int32_t insGetExtendedRowSize(STableDataBlocks *pBlock); -void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo *spd, col_id_t idx, int32_t *toffset, col_id_t *colIdx); -int32_t insSetBlockInfo(SSubmitBlk *pBlocks, STableDataBlocks *dataBuf, int32_t numOfRows, SMsgBuf *pMsg); -int32_t insSchemaIdxCompar(const void *lhs, const void *rhs); -int32_t insBoundIdxCompar(const void *lhs, const void *rhs); -void insSetBoundColumnInfo(SParsedDataColInfo *pColList, SSchema *pSchema, col_id_t numOfCols); -void insDestroyBlockArrayList(SArray *pDataBlockList); -void insDestroyBlockHashmap(SHashObj *pDataBlockHash); -int32_t insInitRowBuilder(SRowBuilder *pBuilder, int16_t schemaVer, SParsedDataColInfo *pColInfo); -int32_t insGetDataBlockFromList(SHashObj *pHashList, void *id, int32_t idLen, int32_t size, int32_t startOffset, - int32_t rowSize, STableMeta *pTableMeta, STableDataBlocks **dataBlocks, - SArray *pBlockList, SVCreateTbReq *pCreateTbReq); -int32_t insMergeTableDataBlocks(SHashObj *pHashObj, SArray **pVgDataBlocks); -int32_t insBuildCreateTbMsg(STableDataBlocks *pBlocks, SVCreateTbReq *pCreateTbReq); -int32_t insAllocateMemForSize(STableDataBlocks *pDataBlock, int32_t allSize); -int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf); -int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema *pSchema); -void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname, - SArray *tagName, uint8_t tagNum, int32_t ttl); -int32_t insMemRowAppend(SMsgBuf *pMsgBuf, const void *value, int32_t len, void *param); -int32_t insCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start); -int32_t insBuildOutput(SHashObj *pVgroupsHashObj, SArray *pVgDataBlocks, SArray **pDataBlocks); -void insDestroyDataBlock(STableDataBlocks *pDataBlock); - typedef struct SVgroupDataCxt { int32_t vgId; SSubmitReq2 *pData; } SVgroupDataCxt; +int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf); +int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema *pSchema); +void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname, + SArray *tagName, uint8_t tagNum, int32_t ttl); int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo *pInfo); void insCheckTableDataOrder(STableDataCxt *pTableCxt, TSKEY tsKey); int32_t insGetTableDataCxt(SHashObj *pHash, void *id, int32_t idLen, STableMeta *pTableMeta, SVCreateTbReq **pCreateTbReq, STableDataCxt **pTableCxt, bool colMode); -int32_t initTableColSubmitData(STableDataCxt* pTableCxt); +int32_t initTableColSubmitData(STableDataCxt *pTableCxt); int32_t insMergeTableDataCxt(SHashObj *pTableHash, SArray **pVgDataBlocks); int32_t insBuildVgDataBlocks(SHashObj *pVgroupsHashObj, SArray *pVgDataBlocks, SArray **pDataBlocks); void insDestroyTableDataCxtHashMap(SHashObj *pTableCxtHash); void insDestroyVgroupDataCxt(SVgroupDataCxt *pVgCxt); void insDestroyVgroupDataCxtList(SArray *pVgCxtList); void insDestroyVgroupDataCxtHashMap(SHashObj *pVgCxtHash); -void insDestroyTableDataCxt(STableDataCxt* pTableCxt); -void destroyBoundColInfo(SBoundColInfo* pInfo); +void insDestroyTableDataCxt(STableDataCxt *pTableCxt); +void insDestroyBoundColInfo(SBoundColInfo *pInfo); + #endif // TDENGINE_PAR_INSERT_UTIL_H diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index cd1260584e..ec158f27a3 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -433,6 +433,9 @@ cmd ::= SHOW TAGS FROM table_name_cond(A) from_db_opt(B). cmd ::= SHOW TABLE TAGS tag_list_opt(C) FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowTableTagsStmt(pCxt, A, B, C); } cmd ::= SHOW VNODES NK_INTEGER(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), NULL); } cmd ::= SHOW VNODES NK_STRING(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &A)); } +// show alive +cmd ::= SHOW db_name_cond_opt(A) ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, A, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +cmd ::= SHOW CLUSTER ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); } db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createIdentifierValueNode(pCxt, &B); } @@ -458,14 +461,16 @@ tag_item(A) ::= column_name(B) column_alias(C). tag_item(A) ::= column_name(B) AS column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); } /************************************************ create index ********************************************************/ -cmd ::= CREATE SMA INDEX not_exists_opt(D) +cmd ::= CREATE SMA INDEX not_exists_opt(D) full_table_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); } +cmd ::= CREATE INDEX not_exists_opt(D) + full_table_name(A) ON full_table_name(B) NK_LP col_name_list(C) NK_RP. { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, D, A, B, C, NULL); } cmd ::= DROP INDEX exists_opt(B) full_table_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, A); } -index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL +index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL NK_LP duration_literal(C) NK_RP sliding_opt(D) sma_stream_opt(E). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), NULL, D, E); } -index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL - NK_LP duration_literal(C) NK_COMMA duration_literal(D) NK_RP sliding_opt(E) +index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL + NK_LP duration_literal(C) NK_COMMA duration_literal(D) NK_RP sliding_opt(E) sma_stream_opt(F). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), E, F); } %type func_list { SNodeList* } @@ -539,9 +544,15 @@ bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). /************************************************ create/drop stream **************************************************/ cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A) stream_options(B) INTO - full_table_name(C) tags_def_opt(F) subtable_opt(G) AS query_or_subquery(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, C, B, F, G, D); } + full_table_name(C) col_list_opt(H) tags_def_opt(F) subtable_opt(G) + AS query_or_subquery(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, C, B, F, G, D, H); } cmd ::= DROP STREAM exists_opt(A) stream_name(B). { pCxt->pRootNode = createDropStreamStmt(pCxt, A, &B); } +%type col_list_opt { SNodeList* } +%destructor col_list_opt { nodesDestroyList($$); } +col_list_opt(A) ::= . { A = NULL; } +col_list_opt(A) ::= NK_LP col_name_list(B) NK_RP. { A = B; } + stream_options(A) ::= . { A = createStreamOptions(pCxt); } stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 6e6fdd64b2..553a289466 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -694,6 +694,7 @@ SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias) pExpr->aliasName[len] = '\0'; strncpy(pExpr->userAlias, pAlias->z, len); pExpr->userAlias[len] = '\0'; + pExpr->asAlias = true; return pNode; } @@ -1369,6 +1370,38 @@ SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { return (SNode*)pStmt; } +SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pNode, ENodeType type) { + CHECK_PARSER_STATUS(pCxt); + SToken dbToken = {0}; + SToken* pDbToken = NULL; + + if (pNode) { + SValueNode* pDbName = (SValueNode*)pNode; + if (pDbName->literal) { + dbToken.z = pDbName->literal; + dbToken.n = strlen(pDbName->literal); + pDbToken = &dbToken; + } + } + + if (pDbToken && !checkDbName(pCxt, pDbToken, true)) { + nodesDestroyNode(pNode); + return NULL; + } + + SShowAliveStmt* pStmt = (SShowAliveStmt*)nodesMakeNode(type); + CHECK_OUT_OF_MEM(pStmt); + + if (pDbToken) { + COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbToken); + } + if (pNode) { + nodesDestroyNode(pNode); + } + + return (SNode*)pStmt; +} + SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable) { CHECK_PARSER_STATUS(pCxt); SShowCreateTableStmt* pStmt = (SShowCreateTableStmt*)nodesMakeNode(type); @@ -1592,8 +1625,11 @@ SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, } SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, - const SToken* pSubDbName, bool withMeta) { + SToken* pSubDbName, bool withMeta) { CHECK_PARSER_STATUS(pCxt); + if (!checkDbName(pCxt, pSubDbName, true)) { + return NULL; + } SCreateTopicStmt* pStmt = (SCreateTopicStmt*)nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT); CHECK_OUT_OF_MEM(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName); @@ -1741,21 +1777,20 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { } SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, - SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery) { + SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols) { CHECK_PARSER_STATUS(pCxt); SCreateStreamStmt* pStmt = (SCreateStreamStmt*)nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); CHECK_OUT_OF_MEM(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->streamName, pStreamName); - if (NULL != pRealTable) { - strcpy(pStmt->targetDbName, ((SRealTableNode*)pRealTable)->table.dbName); - strcpy(pStmt->targetTabName, ((SRealTableNode*)pRealTable)->table.tableName); - nodesDestroyNode(pRealTable); - } + strcpy(pStmt->targetDbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->targetTabName, ((SRealTableNode*)pRealTable)->table.tableName); + nodesDestroyNode(pRealTable); pStmt->ignoreExists = ignoreExists; pStmt->pOptions = (SStreamOptions*)pOptions; pStmt->pQuery = pQuery; pStmt->pTags = pTags; pStmt->pSubtable = pSubtable; + pStmt->pCols = pCols; return (SNode*)pStmt; } diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index b57690f9b1..fae62626fa 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -355,7 +355,12 @@ static int32_t collectMetaKeyFromDescribe(SCollectMetaKeyCxt* pCxt, SDescribeStm } static int32_t collectMetaKeyFromCreateStream(SCollectMetaKeyCxt* pCxt, SCreateStreamStmt* pStmt) { - return collectMetaKeyFromQuery(pCxt, pStmt->pQuery); + int32_t code = + reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->targetDbName, pStmt->targetTabName, pCxt->pMetaCache); + if (TSDB_CODE_SUCCESS == code) { + code = collectMetaKeyFromQuery(pCxt, pStmt->pQuery); + } + return code; } static int32_t collectMetaKeyFromShowDnodes(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { @@ -434,7 +439,7 @@ static int32_t collectMetaKeyFromShowStables(SCollectMetaKeyCxt* pCxt, SShowStmt pCxt->pMetaCache); if (TSDB_CODE_SUCCESS == code) { code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, - ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ, pCxt->pMetaCache); + ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache); } return code; } @@ -452,7 +457,7 @@ static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt* } if (TSDB_CODE_SUCCESS == code) { code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, - ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ, pCxt->pMetaCache); + ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache); } return code; } diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index fe82ce8706..e4de60fd05 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -97,7 +97,7 @@ static int32_t authInsert(SAuthCxt* pCxt, SInsertStmt* pInsert) { } static int32_t authShowTables(SAuthCxt* pCxt, SShowStmt* pStmt) { - return checkAuth(pCxt, ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ); + return checkAuth(pCxt, ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE); } static int32_t authShowCreateTable(SAuthCxt* pCxt, SShowCreateTableStmt* pStmt) { @@ -145,6 +145,8 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { case QUERY_NODE_SHOW_CLUSTER_STMT: case QUERY_NODE_SHOW_LICENCES_STMT: case QUERY_NODE_SHOW_VGROUPS_STMT: + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT: case QUERY_NODE_SHOW_VNODES_STMT: diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index 6fe72beea6..e613739f26 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -357,7 +357,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc } end: - destroyBoundColInfo(&bindTags); + insDestroyBoundColInfo(&bindTags); taosMemoryFree(pCreateTblReq); taosArrayDestroy(tagName); return ret; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 20a9770c5f..582bb466d2 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1466,7 +1466,7 @@ static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeMod } static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { - destroyBoundColInfo(&pCxt->tags); + insDestroyBoundColInfo(&pCxt->tags); taosMemoryFreeClear(pStmt->pTableMeta); tdDestroySVCreateTbReq(pStmt->pCreateTblReq); taosMemoryFreeClear(pStmt->pCreateTblReq); @@ -1527,7 +1527,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif } static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { - SParsedDataColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags)); + SBoundColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags)); if (NULL == tags) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1937,6 +1937,6 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) { code = setRefreshMate(*pQuery); } - destroyBoundColInfo(&context.tags); + insDestroyBoundColInfo(&context.tags); return code; } diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index cc2ca48a1f..b3018d63b4 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -22,179 +22,6 @@ #include "tRealloc.h" #include "tdatablock.h" -typedef struct SBlockKeyTuple { - TSKEY skey; - void* payloadAddr; - int16_t index; -} SBlockKeyTuple; - -typedef struct SBlockKeyInfo { - int32_t maxBytesAlloc; - SBlockKeyTuple* pKeyTuple; -} SBlockKeyInfo; - -typedef struct { - int32_t index; - SArray* rowArray; // array of merged rows(mem allocated by tRealloc/free by tFree) - STSchema* pSchema; - int64_t tbUid; // suid for child table, uid for normal table -} SBlockRowMerger; - -static FORCE_INLINE void tdResetSBlockRowMerger(SBlockRowMerger* pMerger) { - if (pMerger) { - pMerger->index = -1; - } -} - -static void tdFreeSBlockRowMerger(SBlockRowMerger* pMerger) { - if (pMerger) { - int32_t size = taosArrayGetSize(pMerger->rowArray); - for (int32_t i = 0; i < size; ++i) { - tFree(*(void**)taosArrayGet(pMerger->rowArray, i)); - } - taosArrayDestroy(pMerger->rowArray); - - taosMemoryFreeClear(pMerger->pSchema); - taosMemoryFree(pMerger); - } -} - -static int32_t rowDataCompar(const void* lhs, const void* rhs) { - TSKEY left = *(TSKEY*)lhs; - TSKEY right = *(TSKEY*)rhs; - if (left == right) { - return 0; - } else { - return left > right ? 1 : -1; - } -} - -static int32_t rowDataComparStable(const void* lhs, const void* rhs) { - TSKEY left = *(TSKEY*)lhs; - TSKEY right = *(TSKEY*)rhs; - if (left == right) { - return ((SBlockKeyTuple*)lhs)->index - ((SBlockKeyTuple*)rhs)->index; - } else { - return left > right ? 1 : -1; - } -} - -int32_t insGetExtendedRowSize(STableDataBlocks* pBlock) { - STableComInfo* pTableInfo = &pBlock->pTableMeta->tableInfo; - ASSERT(pBlock->rowSize == pTableInfo->rowSize); - return pBlock->rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + pBlock->boundColumnInfo.extendedVarLen + - (int32_t)TD_BITMAP_BYTES(pTableInfo->numOfColumns - 1); -} - -void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo* spd, col_id_t idx, int32_t* toffset, - col_id_t* colIdx) { - col_id_t schemaIdx = 0; - if (IS_DATA_COL_ORDERED(spd)) { - schemaIdx = spd->boundColumns[idx]; - if (TD_IS_TP_ROW_T(rowType)) { - *toffset = (spd->cols + schemaIdx)->toffset; // the offset of firstPart - *colIdx = schemaIdx; - } else { - *toffset = idx * sizeof(SKvRowIdx); // the offset of SKvRowIdx - *colIdx = idx; - } - } else { - ASSERT(idx == (spd->colIdxInfo + idx)->boundIdx); - schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx; - if (TD_IS_TP_ROW_T(rowType)) { - *toffset = (spd->cols + schemaIdx)->toffset; - *colIdx = schemaIdx; - } else { - *toffset = ((spd->colIdxInfo + idx)->finalIdx) * sizeof(SKvRowIdx); - *colIdx = (spd->colIdxInfo + idx)->finalIdx; - } - } -} - -int32_t insSetBlockInfo(SSubmitBlk* pBlocks, STableDataBlocks* dataBuf, int32_t numOfRows, SMsgBuf* pMsg) { - pBlocks->suid = (TSDB_NORMAL_TABLE == dataBuf->pTableMeta->tableType ? 0 : dataBuf->pTableMeta->suid); - pBlocks->uid = dataBuf->pTableMeta->uid; - pBlocks->sversion = dataBuf->pTableMeta->sversion; - pBlocks->schemaLen = dataBuf->createTbReqLen; - - if (pBlocks->numOfRows + numOfRows >= INT32_MAX) { - return buildInvalidOperationMsg(pMsg, "too many rows in sql, total number of rows should be less than INT32_MAX"); - } - pBlocks->numOfRows += numOfRows; - return TSDB_CODE_SUCCESS; -} - -void insSetBoundColumnInfo(SParsedDataColInfo* pColList, SSchema* pSchema, col_id_t numOfCols) { - pColList->numOfCols = numOfCols; - pColList->numOfBound = numOfCols; - pColList->orderStatus = ORDER_STATUS_ORDERED; // default is ORDERED for non-bound mode - pColList->boundColumns = taosMemoryCalloc(pColList->numOfCols, sizeof(col_id_t)); - pColList->cols = taosMemoryCalloc(pColList->numOfCols, sizeof(SBoundColumn)); - pColList->colIdxInfo = NULL; - pColList->flen = 0; - pColList->allNullLen = 0; - - int32_t nVar = 0; - for (int32_t i = 0; i < pColList->numOfCols; ++i) { - uint8_t type = pSchema[i].type; - if (i > 0) { - pColList->cols[i].offset = pColList->cols[i - 1].offset + pSchema[i - 1].bytes; - pColList->cols[i].toffset = pColList->flen; - pColList->flen += TYPE_BYTES[type]; - } - switch (type) { - case TSDB_DATA_TYPE_BINARY: - pColList->allNullLen += (VARSTR_HEADER_SIZE + CHAR_BYTES); - ++nVar; - break; - case TSDB_DATA_TYPE_NCHAR: - pColList->allNullLen += (VARSTR_HEADER_SIZE + TSDB_NCHAR_SIZE); - ++nVar; - break; - default: - break; - } - pColList->boundColumns[i] = i; - } - pColList->allNullLen += pColList->flen; - pColList->boundNullLen = pColList->allNullLen; // default set allNullLen - pColList->extendedVarLen = (uint16_t)(nVar * sizeof(VarDataOffsetT)); -} - -int32_t insSchemaIdxCompar(const void* lhs, const void* rhs) { - uint16_t left = *(uint16_t*)lhs; - uint16_t right = *(uint16_t*)rhs; - - if (left == right) { - return 0; - } else { - return left > right ? 1 : -1; - } -} - -int32_t insBoundIdxCompar(const void* lhs, const void* rhs) { - uint16_t left = *(uint16_t*)POINTER_SHIFT(lhs, sizeof(uint16_t)); - uint16_t right = *(uint16_t*)POINTER_SHIFT(rhs, sizeof(uint16_t)); - - if (left == right) { - return 0; - } else { - return left > right ? 1 : -1; - } -} - -void destroyBoundColumnInfo(void* pBoundInfo) { - if (NULL == pBoundInfo) { - return; - } - - SParsedDataColInfo* pColList = (SParsedDataColInfo*)pBoundInfo; - - taosMemoryFreeClear(pColList->boundColumns); - taosMemoryFreeClear(pColList->cols); - taosMemoryFreeClear(pColList->colIdxInfo); -} - void qDestroyBoundColInfo(void* pInfo) { if (NULL == pInfo) { return; @@ -205,548 +32,6 @@ void qDestroyBoundColInfo(void* pInfo) { taosMemoryFreeClear(pBoundInfo->pColIndex); } -static int32_t createTableDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOffset, STableMeta* pTableMeta, - STableDataBlocks** dataBlocks) { - STableDataBlocks* dataBuf = (STableDataBlocks*)taosMemoryCalloc(1, sizeof(STableDataBlocks)); - if (dataBuf == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - dataBuf->nAllocSize = (uint32_t)defaultSize; - dataBuf->headerSize = startOffset; - - // the header size will always be the startOffset value, reserved for the subumit block header - if (dataBuf->nAllocSize <= dataBuf->headerSize) { - dataBuf->nAllocSize = dataBuf->headerSize * 2; - } - - dataBuf->pData = taosMemoryMalloc(dataBuf->nAllocSize); - if (dataBuf->pData == NULL) { - taosMemoryFreeClear(dataBuf); - return TSDB_CODE_OUT_OF_MEMORY; - } - memset(dataBuf->pData, 0, sizeof(SSubmitBlk)); - - dataBuf->pTableMeta = tableMetaDup(pTableMeta); - - SParsedDataColInfo* pColInfo = &dataBuf->boundColumnInfo; - SSchema* pSchema = getTableColumnSchema(dataBuf->pTableMeta); - insSetBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns); - - dataBuf->ordered = true; - dataBuf->prevTS = INT64_MIN; - dataBuf->rowSize = rowSize; - dataBuf->size = startOffset; - dataBuf->vgId = dataBuf->pTableMeta->vgId; - - assert(defaultSize > 0 && pTableMeta != NULL && dataBuf->pTableMeta != NULL); - - *dataBlocks = dataBuf; - return TSDB_CODE_SUCCESS; -} - -int32_t insBuildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) { - SEncoder coder = {0}; - char* pBuf; - int32_t len; - - int32_t ret = 0; - tEncodeSize(tEncodeSVCreateTbReq, pCreateTbReq, len, ret); - if (pBlocks->nAllocSize - pBlocks->size < len) { - pBlocks->nAllocSize += len + pBlocks->rowSize; - char* pTmp = taosMemoryRealloc(pBlocks->pData, pBlocks->nAllocSize); - if (pTmp != NULL) { - pBlocks->pData = pTmp; - memset(pBlocks->pData + pBlocks->size, 0, pBlocks->nAllocSize - pBlocks->size); - } else { - pBlocks->nAllocSize -= len + pBlocks->rowSize; - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - pBuf = pBlocks->pData + pBlocks->size; - - tEncoderInit(&coder, pBuf, len); - int32_t code = tEncodeSVCreateTbReq(&coder, pCreateTbReq); - tEncoderClear(&coder); - pBlocks->size += len; - pBlocks->createTbReqLen = len; - - return code; -} - -void insDestroyDataBlock(STableDataBlocks* pDataBlock) { - if (pDataBlock == NULL) { - return; - } - - taosMemoryFreeClear(pDataBlock->pData); - taosMemoryFreeClear(pDataBlock->pTableMeta); - destroyBoundColumnInfo(&pDataBlock->boundColumnInfo); - taosMemoryFreeClear(pDataBlock); -} - -int32_t insGetDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32_t size, int32_t startOffset, - int32_t rowSize, STableMeta* pTableMeta, STableDataBlocks** dataBlocks, - SArray* pBlockList, SVCreateTbReq* pCreateTbReq) { - *dataBlocks = NULL; - STableDataBlocks** t1 = (STableDataBlocks**)taosHashGet(pHashList, (const char*)id, idLen); - if (t1 != NULL) { - *dataBlocks = *t1; - } - - if (*dataBlocks == NULL) { - int32_t ret = createTableDataBlock((size_t)size, rowSize, startOffset, pTableMeta, dataBlocks); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - - if (NULL != pCreateTbReq && NULL != pCreateTbReq->ctb.pTag) { - ret = insBuildCreateTbMsg(*dataBlocks, pCreateTbReq); - if (ret != TSDB_CODE_SUCCESS) { - insDestroyDataBlock(*dataBlocks); - return ret; - } - } - - // converting to 'const char*' is to handle coverity scan errors - taosHashPut(pHashList, (const char*)id, idLen, (const char*)dataBlocks, POINTER_BYTES); - if (pBlockList) { - taosArrayPush(pBlockList, dataBlocks); - } - } - - return TSDB_CODE_SUCCESS; -} - -void insDestroyBlockArrayList(SArray* pDataBlockList) { - if (pDataBlockList == NULL) { - return; - } - - size_t size = taosArrayGetSize(pDataBlockList); - for (int32_t i = 0; i < size; i++) { - void* p = taosArrayGetP(pDataBlockList, i); - insDestroyDataBlock(p); - } - - taosArrayDestroy(pDataBlockList); -} - -void insDestroyBlockHashmap(SHashObj* pDataBlockHash) { - if (pDataBlockHash == NULL) { - return; - } - - void** p1 = taosHashIterate(pDataBlockHash, NULL); - while (p1) { - SBoundColInfo* pBlocks = *p1; - destroyBoundColInfo(pBlocks); - - p1 = taosHashIterate(pDataBlockHash, p1); - } - - taosHashCleanup(pDataBlockHash); -} - -// data block is disordered, sort it in ascending order -static int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo) { - SSubmitBlk* pBlocks = (SSubmitBlk*)dataBuf->pData; - int16_t nRows = pBlocks->numOfRows; - - // size is less than the total size, since duplicated rows may be removed yet. - - // allocate memory - size_t nAlloc = nRows * sizeof(SBlockKeyTuple); - if (pBlkKeyInfo->pKeyTuple == NULL || pBlkKeyInfo->maxBytesAlloc < nAlloc) { - char* tmp = taosMemoryRealloc(pBlkKeyInfo->pKeyTuple, nAlloc); - if (tmp == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pBlkKeyInfo->pKeyTuple = (SBlockKeyTuple*)tmp; - pBlkKeyInfo->maxBytesAlloc = (int32_t)nAlloc; - } - memset(pBlkKeyInfo->pKeyTuple, 0, nAlloc); - - int32_t extendedRowSize = insGetExtendedRowSize(dataBuf); - SBlockKeyTuple* pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - char* pBlockData = pBlocks->data + pBlocks->schemaLen; - int n = 0; - while (n < nRows) { - pBlkKeyTuple->skey = TD_ROW_KEY((STSRow*)pBlockData); - pBlkKeyTuple->payloadAddr = pBlockData; - pBlkKeyTuple->index = n; - - // next loop - pBlockData += extendedRowSize; - ++pBlkKeyTuple; - ++n; - } - - if (!dataBuf->ordered) { - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - - // todo. qsort is unstable, if timestamp is same, should get the last one - taosSort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); - - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - int32_t i = 0; - int32_t j = 1; - while (j < nRows) { - TSKEY ti = (pBlkKeyTuple + i)->skey; - TSKEY tj = (pBlkKeyTuple + j)->skey; - - if (ti == tj) { - ++j; - continue; - } - - int32_t nextPos = (++i); - if (nextPos != j) { - memmove(pBlkKeyTuple + nextPos, pBlkKeyTuple + j, sizeof(SBlockKeyTuple)); - } - ++j; - } - - dataBuf->ordered = true; - pBlocks->numOfRows = i + 1; - } - - dataBuf->size = sizeof(SSubmitBlk) + pBlocks->numOfRows * extendedRowSize; - dataBuf->prevTS = INT64_MIN; - - return 0; -} - -static void* tdGetCurRowFromBlockMerger(SBlockRowMerger* pBlkRowMerger) { - if (pBlkRowMerger && (pBlkRowMerger->index >= 0)) { - ASSERT(pBlkRowMerger->index < taosArrayGetSize(pBlkRowMerger->rowArray)); - return *(void**)taosArrayGet(pBlkRowMerger->rowArray, pBlkRowMerger->index); - } - return NULL; -} - -static int32_t tdBlockRowMerge(STableMeta* pTableMeta, SBlockKeyTuple* pEndKeyTp, int32_t nDupRows, - SBlockRowMerger** pBlkRowMerger, int32_t rowSize) { - ASSERT(nDupRows > 1); - SBlockKeyTuple* pStartKeyTp = pEndKeyTp - (nDupRows - 1); - ASSERT(pStartKeyTp->skey == pEndKeyTp->skey); - - // TODO: optimization if end row is all normal -#if 0 - STSRow* pEndRow = (STSRow*)pEndKeyTp->payloadAddr; - if(isNormal(pEndRow)) { // set the end row if it is normal and return directly - pStartKeyTp->payloadAddr = pEndKeyTp->payloadAddr; - return TSDB_CODE_SUCCESS; - } -#endif - - if (!(*pBlkRowMerger)) { - (*pBlkRowMerger) = taosMemoryCalloc(1, sizeof(**pBlkRowMerger)); - if (!(*pBlkRowMerger)) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - (*pBlkRowMerger)->index = -1; - if (!(*pBlkRowMerger)->rowArray) { - (*pBlkRowMerger)->rowArray = taosArrayInit(1, sizeof(void*)); - if (!(*pBlkRowMerger)->rowArray) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - } - } - - if ((*pBlkRowMerger)->pSchema) { - if ((*pBlkRowMerger)->pSchema->version != pTableMeta->sversion) { - taosMemoryFreeClear((*pBlkRowMerger)->pSchema); - } else { - if ((*pBlkRowMerger)->tbUid != (pTableMeta->suid > 0 ? pTableMeta->suid : pTableMeta->uid)) { - taosMemoryFreeClear((*pBlkRowMerger)->pSchema); - } - } - } - - if (!(*pBlkRowMerger)->pSchema) { - (*pBlkRowMerger)->pSchema = - tBuildTSchema(pTableMeta->schema, pTableMeta->tableInfo.numOfColumns, pTableMeta->sversion); - - if (!(*pBlkRowMerger)->pSchema) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - (*pBlkRowMerger)->tbUid = pTableMeta->suid > 0 ? pTableMeta->suid : pTableMeta->uid; - } - - void* pDestRow = NULL; - ++((*pBlkRowMerger)->index); - if ((*pBlkRowMerger)->index < taosArrayGetSize((*pBlkRowMerger)->rowArray)) { - void** pAlloc = (void**)taosArrayGet((*pBlkRowMerger)->rowArray, (*pBlkRowMerger)->index); - if (tRealloc((uint8_t**)pAlloc, rowSize) != 0) { - return TSDB_CODE_FAILED; - } - pDestRow = *pAlloc; - } else { - if (tRealloc((uint8_t**)&pDestRow, rowSize) != 0) { - return TSDB_CODE_FAILED; - } - taosArrayPush((*pBlkRowMerger)->rowArray, &pDestRow); - } - - // merge rows to pDestRow - STSchema* pSchema = (*pBlkRowMerger)->pSchema; - SArray* pArray = taosArrayInit(pSchema->numOfCols, sizeof(SColVal)); - for (int32_t i = 0; i < pSchema->numOfCols; ++i) { - SColVal colVal = {0}; - for (int32_t j = 0; j < nDupRows; ++j) { - tTSRowGetVal((pEndKeyTp - j)->payloadAddr, pSchema, i, &colVal); - if (!COL_VAL_IS_NONE(&colVal)) { - break; - } - } - taosArrayPush(pArray, &colVal); - } - if (tdSTSRowNew(pArray, pSchema, (STSRow**)&pDestRow) < 0) { - taosArrayDestroy(pArray); - return TSDB_CODE_FAILED; - } - - taosArrayDestroy(pArray); - return TSDB_CODE_SUCCESS; -} - -// data block is disordered, sort it in ascending order, and merge dup rows if exists -static int sortMergeDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo, - SBlockRowMerger** ppBlkRowMerger) { - SSubmitBlk* pBlocks = (SSubmitBlk*)dataBuf->pData; - STableMeta* pTableMeta = dataBuf->pTableMeta; - int32_t nRows = pBlocks->numOfRows; - - // size is less than the total size, since duplicated rows may be removed. - - // allocate memory - size_t nAlloc = nRows * sizeof(SBlockKeyTuple); - if (pBlkKeyInfo->pKeyTuple == NULL || pBlkKeyInfo->maxBytesAlloc < nAlloc) { - char* tmp = taosMemoryRealloc(pBlkKeyInfo->pKeyTuple, nAlloc); - if (tmp == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pBlkKeyInfo->pKeyTuple = (SBlockKeyTuple*)tmp; - pBlkKeyInfo->maxBytesAlloc = (int32_t)nAlloc; - } - memset(pBlkKeyInfo->pKeyTuple, 0, nAlloc); - - tdResetSBlockRowMerger(*ppBlkRowMerger); - - int32_t extendedRowSize = insGetExtendedRowSize(dataBuf); - SBlockKeyTuple* pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - char* pBlockData = pBlocks->data + pBlocks->schemaLen; - int32_t n = 0; - while (n < nRows) { - pBlkKeyTuple->skey = TD_ROW_KEY((STSRow*)pBlockData); - pBlkKeyTuple->payloadAddr = pBlockData; - pBlkKeyTuple->index = n; - - // next loop - pBlockData += extendedRowSize; - ++pBlkKeyTuple; - ++n; - } - - if (!dataBuf->ordered) { - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - - taosSort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); - - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - bool hasDup = false; - int32_t nextPos = 0; - int32_t i = 0; - int32_t j = 1; - - while (j < nRows) { - TSKEY ti = (pBlkKeyTuple + i)->skey; - TSKEY tj = (pBlkKeyTuple + j)->skey; - - if (ti == tj) { - ++j; - continue; - } - - if ((j - i) > 1) { - if (tdBlockRowMerge(pTableMeta, (pBlkKeyTuple + j - 1), j - i, ppBlkRowMerger, extendedRowSize) < 0) { - return TSDB_CODE_FAILED; - } - (pBlkKeyTuple + nextPos)->payloadAddr = tdGetCurRowFromBlockMerger(*ppBlkRowMerger); - if (!hasDup) { - hasDup = true; - } - i = j; - } else { - if (hasDup) { - memmove(pBlkKeyTuple + nextPos, pBlkKeyTuple + i, sizeof(SBlockKeyTuple)); - } - ++i; - } - - ++nextPos; - ++j; - } - - if ((j - i) > 1) { - ASSERT((pBlkKeyTuple + i)->skey == (pBlkKeyTuple + j - 1)->skey); - if (tdBlockRowMerge(pTableMeta, (pBlkKeyTuple + j - 1), j - i, ppBlkRowMerger, extendedRowSize) < 0) { - return TSDB_CODE_FAILED; - } - (pBlkKeyTuple + nextPos)->payloadAddr = tdGetCurRowFromBlockMerger(*ppBlkRowMerger); - } else if (hasDup) { - memmove(pBlkKeyTuple + nextPos, pBlkKeyTuple + i, sizeof(SBlockKeyTuple)); - } - - dataBuf->ordered = true; - pBlocks->numOfRows = nextPos + 1; - } - - dataBuf->size = sizeof(SSubmitBlk) + pBlocks->numOfRows * extendedRowSize; - dataBuf->prevTS = INT64_MIN; - - return TSDB_CODE_SUCCESS; -} - -// Erase the empty space reserved for binary data -static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, SBlockKeyTuple* blkKeyTuple) { - // TODO: optimize this function, handle the case while binary is not presented - int32_t nonDataLen = sizeof(SSubmitBlk) + pTableDataBlock->createTbReqLen; - SSubmitBlk* pBlock = pDataBlock; - memcpy(pDataBlock, pTableDataBlock->pData, nonDataLen); - pDataBlock = (char*)pDataBlock + nonDataLen; - - pBlock->schemaLen = pTableDataBlock->createTbReqLen; - pBlock->dataLen = 0; - - int32_t numOfRows = pBlock->numOfRows; - for (int32_t i = 0; i < numOfRows; ++i) { - void* payload = (blkKeyTuple + i)->payloadAddr; - TDRowLenT rowTLen = TD_ROW_LEN((STSRow*)payload); - memcpy(pDataBlock, payload, rowTLen); - pDataBlock = POINTER_SHIFT(pDataBlock, rowTLen); - pBlock->dataLen += rowTLen; - } - - return pBlock->dataLen + pBlock->schemaLen; -} - -int32_t insMergeTableDataBlocks(SHashObj* pHashObj, SArray** pVgDataBlocks) { - const int INSERT_HEAD_SIZE = sizeof(SSubmitReq); - int code = 0; - SHashObj* pVnodeDataBlockHashList = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false); - SArray* pVnodeDataBlockList = taosArrayInit(8, POINTER_BYTES); - - STableDataBlocks** p = taosHashIterate(pHashObj, NULL); - STableDataBlocks* pOneTableBlock = *p; - SBlockKeyInfo blkKeyInfo = {0}; // share by pOneTableBlock - SBlockRowMerger* pBlkRowMerger = NULL; - - while (pOneTableBlock) { - SSubmitBlk* pBlocks = (SSubmitBlk*)pOneTableBlock->pData; - if (pBlocks->numOfRows > 0) { - STableDataBlocks* dataBuf = NULL; - pOneTableBlock->pTableMeta->vgId = pOneTableBlock->vgId; // for schemaless, restore origin vgId - int32_t ret = insGetDataBlockFromList(pVnodeDataBlockHashList, &pOneTableBlock->vgId, - sizeof(pOneTableBlock->vgId), TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0, - pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList, NULL); - if (ret != TSDB_CODE_SUCCESS) { - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - insDestroyBlockArrayList(pVnodeDataBlockList); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - return ret; - } - ASSERT(pOneTableBlock->pTableMeta->tableInfo.rowSize > 0); - // the maximum expanded size in byte when a row-wise data is converted to SDataRow format - int64_t destSize = dataBuf->size + pOneTableBlock->size + - sizeof(STColumn) * getNumOfColumns(pOneTableBlock->pTableMeta) + - pOneTableBlock->createTbReqLen; - - if (dataBuf->nAllocSize < destSize) { - dataBuf->nAllocSize = (uint32_t)(destSize * 1.5); - char* tmp = taosMemoryRealloc(dataBuf->pData, dataBuf->nAllocSize); - if (tmp != NULL) { - dataBuf->pData = tmp; - } else { // failed to allocate memory, free already allocated memory and return error code - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - insDestroyBlockArrayList(pVnodeDataBlockList); - taosMemoryFreeClear(dataBuf->pData); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - if ((code = sortMergeDataBlockDupRows(pOneTableBlock, &blkKeyInfo, &pBlkRowMerger)) != 0) { - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - insDestroyBlockArrayList(pVnodeDataBlockList); - taosMemoryFreeClear(dataBuf->pData); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - return code; - } - ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); - - // erase the empty space reserved for binary data - int32_t finalLen = trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, blkKeyInfo.pKeyTuple); - - dataBuf->size += (finalLen + sizeof(SSubmitBlk)); - assert(dataBuf->size <= dataBuf->nAllocSize); - dataBuf->numOfTables += 1; - } - - p = taosHashIterate(pHashObj, p); - if (p == NULL) { - break; - } - - pOneTableBlock = *p; - } - - // free the table data blocks; - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - *pVgDataBlocks = pVnodeDataBlockList; - return TSDB_CODE_SUCCESS; -} - -int32_t insAllocateMemForSize(STableDataBlocks* pDataBlock, int32_t allSize) { - size_t remain = pDataBlock->nAllocSize - pDataBlock->size; - uint32_t nAllocSizeOld = pDataBlock->nAllocSize; - - // expand the allocated size - if (remain < allSize) { - pDataBlock->nAllocSize = (pDataBlock->size + allSize) * 1.5; - - char* tmp = taosMemoryRealloc(pDataBlock->pData, (size_t)pDataBlock->nAllocSize); - if (tmp != NULL) { - pDataBlock->pData = tmp; - memset(pDataBlock->pData + pDataBlock->size, 0, pDataBlock->nAllocSize - pDataBlock->size); - } else { - // do nothing, if allocate more memory failed - pDataBlock->nAllocSize = nAllocSizeOld; - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - return TSDB_CODE_SUCCESS; -} - -int32_t insInitRowBuilder(SRowBuilder* pBuilder, int16_t schemaVer, SParsedDataColInfo* pColInfo) { - ASSERT(pColInfo->numOfCols > 0 && (pColInfo->numOfBound <= pColInfo->numOfCols)); - tdSRowInit(pBuilder, schemaVer); - tdSRowSetExtendedInfo(pBuilder, pColInfo->numOfCols, pColInfo->numOfBound, pColInfo->flen, pColInfo->allNullLen, - pColInfo->boundNullLen); - return TSDB_CODE_SUCCESS; -} - static char* tableNameGetPosition(SToken* pToken, char target) { bool inEscape = false; bool inQuote = false; @@ -875,98 +160,6 @@ void insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, i return; } -int32_t insMemRowAppend(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param) { - SMemParam* pa = (SMemParam*)param; - SRowBuilder* rb = pa->rb; - - if (value == NULL) { // it is a null data - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NULL, value, false, pa->toffset, pa->colIdx); - return TSDB_CODE_SUCCESS; - } - - if (TSDB_DATA_TYPE_BINARY == pa->schema->type) { - const char* rowEnd = tdRowEnd(rb->pBuf); - STR_WITH_SIZE_TO_VARSTR(rowEnd, value, len); - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); - } else if (TSDB_DATA_TYPE_NCHAR == pa->schema->type) { - // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' - int32_t output = 0; - const char* rowEnd = tdRowEnd(rb->pBuf); - if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(rowEnd), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) { - if (errno == E2BIG) { - return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pa->schema->name); - } - char buf[512] = {0}; - snprintf(buf, tListLen(buf), "%s", strerror(errno)); - return buildSyntaxErrMsg(pMsgBuf, buf, value); - } - varDataSetLen(rowEnd, output); - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); - } else { - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, value, false, pa->toffset, pa->colIdx); - } - - return TSDB_CODE_SUCCESS; -} - -int32_t insCheckTimestamp(STableDataBlocks* pDataBlocks, const char* start) { - // once the data block is disordered, we do NOT keep previous timestamp any more - if (!pDataBlocks->ordered) { - return TSDB_CODE_SUCCESS; - } - - TSKEY k = *(TSKEY*)start; - if (k <= pDataBlocks->prevTS) { - pDataBlocks->ordered = false; - } - - pDataBlocks->prevTS = k; - return TSDB_CODE_SUCCESS; -} - -static void buildMsgHeader(STableDataBlocks* src, SVgDataBlocks* blocks) { - SSubmitReq* submit = (SSubmitReq*)blocks->pData; - submit->header.vgId = htonl(blocks->vg.vgId); - submit->header.contLen = htonl(blocks->size); - submit->length = submit->header.contLen; - submit->numOfBlocks = htonl(blocks->numOfTables); - SSubmitBlk* blk = (SSubmitBlk*)(submit + 1); - int32_t numOfBlocks = blocks->numOfTables; - while (numOfBlocks--) { - int32_t dataLen = blk->dataLen; - int32_t schemaLen = blk->schemaLen; - blk->uid = htobe64(blk->uid); - blk->suid = htobe64(blk->suid); - blk->sversion = htonl(blk->sversion); - blk->dataLen = htonl(blk->dataLen); - blk->schemaLen = htonl(blk->schemaLen); - blk->numOfRows = htonl(blk->numOfRows); - blk = (SSubmitBlk*)(blk->data + schemaLen + dataLen); - } -} - -int32_t insBuildOutput(SHashObj* pVgroupsHashObj, SArray* pVgDataBlocks, SArray** pDataBlocks) { - size_t numOfVg = taosArrayGetSize(pVgDataBlocks); - *pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES); - if (NULL == *pDataBlocks) { - return TSDB_CODE_OUT_OF_MEMORY; - } - for (size_t i = 0; i < numOfVg; ++i) { - STableDataBlocks* src = taosArrayGetP(pVgDataBlocks, i); - SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); - if (NULL == dst) { - return TSDB_CODE_OUT_OF_MEMORY; - } - taosHashGetDup(pVgroupsHashObj, (const char*)&src->vgId, sizeof(src->vgId), &dst->vg); - dst->numOfTables = src->numOfTables; - dst->size = src->size; - TSWAP(dst->pData, src->pData); - buildMsgHeader(src, dst); - taosArrayPush(*pDataBlocks, &dst); - } - return TSDB_CODE_SUCCESS; -} - static void initBoundCols(int32_t ncols, int16_t* pBoundCols) { for (int32_t i = 0; i < ncols; ++i) { pBoundCols[i] = i; @@ -1010,7 +203,7 @@ void insCheckTableDataOrder(STableDataCxt* pTableCxt, TSKEY tsKey) { return; } -void destroyBoundColInfo(SBoundColInfo* pInfo) { taosMemoryFreeClear(pInfo->pColIndex); } +void insDestroyBoundColInfo(SBoundColInfo* pInfo) { taosMemoryFreeClear(pInfo->pColIndex); } static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreateTbReq, STableDataCxt** pOutput, bool colMode) { @@ -1120,7 +313,7 @@ void insDestroyTableDataCxt(STableDataCxt* pTableCxt) { taosMemoryFreeClear(pTableCxt->pMeta); tDestroyTSchema(pTableCxt->pSchema); - destroyBoundColInfo(&pTableCxt->boundColsInfo); + insDestroyBoundColInfo(&pTableCxt->boundColsInfo); taosArrayDestroyEx(pTableCxt->pValues, destroyColVal); if (pTableCxt->pData) { tDestroySSubmitTbData(pTableCxt->pData, TSDB_MSG_FLG_ENCODE); diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 94b32a3de2..cacb6f3c3b 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -269,6 +269,7 @@ static SKeyword keywordTable[] = { {"_WDURATION", TK_WDURATION}, {"_WEND", TK_WEND}, {"_WSTART", TK_WSTART}, + {"ALIVE", TK_ALIVE}, }; // clang-format on diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a5bb660c37..cdbebec91c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -352,7 +352,7 @@ static int32_t getTableMetaImpl(STranslateContext* pCxt, const SName* pName, STa code = catalogGetTableMeta(pParCxt->pCatalog, &conn, pName, pMeta); } } - if (TSDB_CODE_SUCCESS != code && TSDB_CODE_TSC_INVALID_TABLE_NAME != code) { + if (TSDB_CODE_SUCCESS != code && TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { parserError("0x%" PRIx64 " catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId, tstrerror(code), pName->dbname, pName->tname); } @@ -1579,7 +1579,7 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu "%s(*) is only supported in SELECTed list", pFunc->functionName); } } - if (tsKeepColumnName && 1 == LIST_LENGTH(pFunc->pParameterList)) { + if (tsKeepColumnName && 1 == LIST_LENGTH(pFunc->pParameterList) && !pFunc->node.asAlias) { strcpy(pFunc->node.userAlias, ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->userAlias); } return TSDB_CODE_SUCCESS; @@ -4569,8 +4569,89 @@ typedef struct SSampleAstInfo { SNode* pSliding; SNodeList* pPartitionByList; STableMeta* pRollupTableMeta; + bool createSmaIndex; } SSampleAstInfo; +static int32_t buildTableForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) { + SRealTableNode* pTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE); + if (NULL == pTable) { + return TSDB_CODE_OUT_OF_MEMORY; + } + snprintf(pTable->table.dbName, sizeof(pTable->table.dbName), "%s", pInfo->pDbName); + snprintf(pTable->table.tableName, sizeof(pTable->table.tableName), "%s", pInfo->pTableName); + TSWAP(pTable->pMeta, pInfo->pRollupTableMeta); + *pOutput = (SNode*)pTable; + return TSDB_CODE_SUCCESS; +} + +static int32_t addWstartToSampleProjects(SNodeList* pProjectionList) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "_wstart"); + return nodesListPushFront(pProjectionList, (SNode*)pFunc); +} + +static int32_t addWendToSampleProjects(SNodeList* pProjectionList) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "_wend"); + return nodesListAppend(pProjectionList, (SNode*)pFunc); +} + +static int32_t addWdurationToSampleProjects(SNodeList* pProjectionList) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "_wduration"); + return nodesListAppend(pProjectionList, (SNode*)pFunc); +} + +static int32_t buildProjectsForSampleAst(SSampleAstInfo* pInfo, SNodeList** pList) { + SNodeList* pProjectionList = pInfo->pFuncs; + pInfo->pFuncs = NULL; + + int32_t code = addWstartToSampleProjects(pProjectionList); + if (TSDB_CODE_SUCCESS == code && pInfo->createSmaIndex) { + code = addWendToSampleProjects(pProjectionList); + if (TSDB_CODE_SUCCESS == code) { + code = addWdurationToSampleProjects(pProjectionList); + } + } + + if (TSDB_CODE_SUCCESS == code) { + SNode* pProject = NULL; + FOREACH(pProject, pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } + *pList = pProjectionList; + } else { + nodesDestroyList(pProjectionList); + } + return code; +} + +static int32_t buildIntervalForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) { + SIntervalWindowNode* pInterval = (SIntervalWindowNode*)nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW); + if (NULL == pInterval) { + return TSDB_CODE_OUT_OF_MEMORY; + } + TSWAP(pInterval->pInterval, pInfo->pInterval); + TSWAP(pInterval->pOffset, pInfo->pOffset); + TSWAP(pInterval->pSliding, pInfo->pSliding); + pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN); + if (NULL == pInterval->pCol) { + nodesDestroyNode((SNode*)pInterval); + return TSDB_CODE_OUT_OF_MEMORY; + } + ((SColumnNode*)pInterval->pCol)->colId = PRIMARYKEY_TIMESTAMP_COL_ID; + strcpy(((SColumnNode*)pInterval->pCol)->colName, ROWTS_PSEUDO_COLUMN_NAME); + *pOutput = (SNode*)pInterval; + return TSDB_CODE_SUCCESS; +} + static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, char** pAst, int32_t* pLen, char** pExpr, int32_t* pExprLen) { SSelectStmt* pSelect = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); @@ -4579,48 +4660,18 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch } sprintf(pSelect->stmtName, "%p", pSelect); - SRealTableNode* pTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE); - if (NULL == pTable) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; + int32_t code = buildTableForSampleAst(pInfo, &pSelect->pFromTable); + if (TSDB_CODE_SUCCESS == code) { + code = buildProjectsForSampleAst(pInfo, &pSelect->pProjectionList); } - snprintf(pTable->table.dbName, sizeof(pTable->table.dbName), "%s", pInfo->pDbName); - snprintf(pTable->table.tableName, sizeof(pTable->table.tableName), "%s", pInfo->pTableName); - TSWAP(pTable->pMeta, pInfo->pRollupTableMeta); - pSelect->pFromTable = (SNode*)pTable; - - TSWAP(pSelect->pProjectionList, pInfo->pFuncs); - SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); - if (NULL == pSelect->pProjectionList || NULL == pFunc) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; + if (TSDB_CODE_SUCCESS == code) { + TSWAP(pSelect->pPartitionByList, pInfo->pPartitionByList); + code = buildIntervalForSampleAst(pInfo, &pSelect->pWindow); } - strcpy(pFunc->functionName, "_wstart"); - nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); - SNode* pProject = NULL; - FOREACH(pProject, pSelect->pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } - - TSWAP(pSelect->pPartitionByList, pInfo->pPartitionByList); - - SIntervalWindowNode* pInterval = (SIntervalWindowNode*)nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW); - if (NULL == pInterval) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; + if (TSDB_CODE_SUCCESS == code) { + pCxt->createStream = true; + code = translateQuery(pCxt, (SNode*)pSelect); } - pSelect->pWindow = (SNode*)pInterval; - TSWAP(pInterval->pInterval, pInfo->pInterval); - TSWAP(pInterval->pOffset, pInfo->pOffset); - TSWAP(pInterval->pSliding, pInfo->pSliding); - pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN); - if (NULL == pInterval->pCol) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; - } - ((SColumnNode*)pInterval->pCol)->colId = PRIMARYKEY_TIMESTAMP_COL_ID; - strcpy(((SColumnNode*)pInterval->pCol)->colName, ROWTS_PSEUDO_COLUMN_NAME); - - pCxt->createStream = true; - int32_t code = translateQuery(pCxt, (SNode*)pSelect); if (TSDB_CODE_SUCCESS == code) { code = nodesNodeToString((SNode*)pSelect, false, pAst, pLen); } @@ -4928,10 +4979,10 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* return TSDB_CODE_SUCCESS; } -static SSchema* getColSchema(STableMeta* pTableMeta, const char* pColName) { +static const SSchema* getColSchema(const STableMeta* pTableMeta, const char* pColName) { int32_t numOfFields = getNumOfTags(pTableMeta) + getNumOfColumns(pTableMeta); for (int32_t i = 0; i < numOfFields; ++i) { - SSchema* pSchema = pTableMeta->schema + i; + const SSchema* pSchema = pTableMeta->schema + i; if (0 == strcmp(pColName, pSchema->name)) { return pSchema; } @@ -4951,7 +5002,8 @@ static SSchema* getTagSchema(STableMeta* pTableMeta, const char* pTagName) { return NULL; } -static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta) { +static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTableStmt* pStmt, + const STableMeta* pTableMeta) { SSchema* pTagsSchema = getTableTagSchema(pTableMeta); if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON && (pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG || pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG || @@ -4970,7 +5022,7 @@ static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTable return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Table is not super table"); } - SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); + const SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); if (NULL == pSchema) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); } else if (!IS_VAR_DATA_TYPE(pSchema->type) || pSchema->type != pStmt->dataType.type || @@ -5162,6 +5214,7 @@ static int32_t getSmaIndexSql(STranslateContext* pCxt, char** pSql, int32_t* pLe } static int32_t buildSampleAstInfoByIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SSampleAstInfo* pInfo) { + pInfo->createSmaIndex = true; pInfo->pDbName = pStmt->dbName; pInfo->pTableName = pStmt->tableName; pInfo->pFuncs = nodesCloneList(pStmt->pOptions->pFuncs); @@ -5651,7 +5704,8 @@ static int32_t addSubtableInfoToCreateStreamQuery(STranslateContext* pCxt, SCrea return code; } -static int32_t checkStreamQuery(STranslateContext* pCxt, SSelectStmt* pSelect) { +static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { + SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; if (TSDB_DATA_TYPE_TIMESTAMP != ((SExprNode*)nodesListGetNode(pSelect->pProjectionList, 0))->resType.type || !pSelect->isTimeLineResult || crossTableWithoutAggOper(pSelect) || NULL != pSelect->pOrderByList || crossTableWithUdaf(pSelect)) { @@ -5661,9 +5715,146 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SSelectStmt* pSelect) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "SUBTABLE expression must be of VARCHAR type"); } + if (NULL == pSelect->pWindow && STREAM_TRIGGER_AT_ONCE != pStmt->pOptions->triggerType) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "The trigger mode of non window query can only be AT_ONCE"); + } return TSDB_CODE_SUCCESS; } +static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STableMeta* pMeta, SNodeList* pProjections) { + if (getNumOfColumns(pMeta) != LIST_LENGTH(pProjections)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); + } + + SSchema* pSchemas = getTableColumnSchema(pMeta); + int32_t index = 0; + SNode* pProj = NULL; + FOREACH(pProj, pProjections) { + SSchema* pSchema = pSchemas + index; + SDataType dt = {.type = pSchema->type, .bytes = pSchema->bytes}; + if (!dataTypeEqual(&dt, &((SExprNode*)pProj)->resType)) { + SNode* pFunc = NULL; + int32_t code = createCastFunc(pCxt, pProj, dt, &pFunc); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + REPLACE_NODE(pFunc); + } + } + + return TSDB_CODE_SUCCESS; +} + +typedef struct SProjColPos { + int32_t colId; + SNode* pProj; +} SProjColPos; + +static int32_t projColPosCompar(const void* l, const void* r) { + return ((SProjColPos*)l)->colId < ((SProjColPos*)r)->colId; +} + +static void projColPosDelete(void* p) { taosMemoryFree(((SProjColPos*)p)->pProj); } + +static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSchema, SNode* pProj, SArray* pProjColPos) { + SNode* pNewProj = nodesCloneNode(pProj); + if (NULL == pNewProj) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + int32_t code = TSDB_CODE_SUCCESS; + SDataType dt = {.type = pSchema->type, .bytes = pSchema->bytes}; + if (!dataTypeEqual(&dt, &((SExprNode*)pNewProj)->resType)) { + SNode* pFunc = NULL; + code = createCastFunc(pCxt, pNewProj, dt, &pFunc); + pNewProj = pFunc; + } + if (TSDB_CODE_SUCCESS == code) { + SProjColPos pos = {.colId = pSchema->colId, .pProj = pNewProj}; + code = (NULL == taosArrayPush(pProjColPos, &pos) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS); + } + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode(pNewProj); + } + return code; +} + +static int32_t adjustOrderOfProjection(STranslateContext* pCxt, SNodeList* pCols, const STableMeta* pMeta, + SNodeList** pProjections) { + if (LIST_LENGTH(pCols) != LIST_LENGTH(*pProjections)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, "Illegal number of columns"); + } + + SArray* pProjColPos = taosArrayInit(LIST_LENGTH(pCols), sizeof(SProjColPos)); + if (NULL == pProjColPos) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + int32_t code = TSDB_CODE_SUCCESS; + SNode* pCol = NULL; + SNode* pProj = NULL; + FORBOTH(pCol, pCols, pProj, *pProjections) { + const SSchema* pSchema = getColSchema(pMeta, ((SColumnNode*)pCol)->colName); + code = addProjToProjColPos(pCxt, pSchema, pProj, pProjColPos); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + SNodeList* pNewProjections = NULL; + if (TSDB_CODE_SUCCESS == code) { + taosArraySort(pProjColPos, projColPosCompar); + int32_t num = taosArrayGetSize(pProjColPos); + pNewProjections = nodesMakeList(); + if (NULL == pNewProjections) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < num; ++i) { + SProjColPos* pPos = taosArrayGet(pProjColPos, i); + code = nodesListStrictAppend(pNewProjections, pPos->pProj); + pPos->pProj = NULL; + } + } + + if (TSDB_CODE_SUCCESS == code) { + taosArrayDestroy(pProjColPos); + nodesDestroyList(*pProjections); + *pProjections = pNewProjections; + } else { + taosArrayDestroyEx(pProjColPos, projColPosDelete); + nodesDestroyList(pNewProjections); + } + + return code; +} + +static int32_t adjustStreamQueryForExistTableImpl(STranslateContext* pCxt, SCreateStreamStmt* pStmt, + const STableMeta* pMeta) { + SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; + if (NULL == pStmt->pCols) { + return adjustDataTypeOfProjections(pCxt, pMeta, pSelect->pProjectionList); + } + return adjustOrderOfProjection(pCxt, pStmt->pCols, pMeta, &pSelect->pProjectionList); +} + +static int32_t adjustStreamQueryForExistTable(STranslateContext* pCxt, SCreateStreamStmt* pStmt, + SCMCreateStreamReq* pReq) { + STableMeta* pMeta = NULL; + int32_t code = getTableMeta(pCxt, pStmt->targetDbName, pStmt->targetTabName, &pMeta); + if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) { + if (NULL != pStmt->pCols) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pStmt->targetTabName); + } + pReq->createStb = STREAM_CREATE_STABLE_TRUE; + return TSDB_CODE_SUCCESS; + } + if (TSDB_CODE_SUCCESS == code) { + code = adjustStreamQueryForExistTableImpl(pCxt, pStmt, pMeta); + } + return code; +} + static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { pCxt->createStream = true; int32_t code = addWstartTsToCreateStreamQuery(pCxt, pStmt->pQuery); @@ -5674,7 +5865,10 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt code = translateQuery(pCxt, pStmt->pQuery); } if (TSDB_CODE_SUCCESS == code) { - code = checkStreamQuery(pCxt, (SSelectStmt*)pStmt->pQuery); + code = checkStreamQuery(pCxt, pStmt); + } + if (TSDB_CODE_SUCCESS == code) { + code = adjustStreamQueryForExistTable(pCxt, pStmt, pReq); } if (TSDB_CODE_SUCCESS == code) { getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB); @@ -6170,6 +6364,20 @@ static int32_t extractShowCreateDatabaseResultSchema(int32_t* numOfCols, SSchema return TSDB_CODE_SUCCESS; } +static int32_t extractShowAliveResultSchema(int32_t* numOfCols, SSchema** pSchema) { + *numOfCols = 1; + *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); + if (NULL == (*pSchema)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + (*pSchema)[0].type = TSDB_DATA_TYPE_INT; + (*pSchema)[0].bytes = sizeof(int32_t); + strcpy((*pSchema)[0].name, "status"); + + return TSDB_CODE_SUCCESS; +} + static int32_t extractShowCreateTableResultSchema(int32_t* numOfCols, SSchema** pSchema) { *numOfCols = 2; *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); @@ -6221,6 +6429,9 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS return extractDescribeResultSchema(numOfCols, pSchema); case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: return extractShowCreateDatabaseResultSchema(numOfCols, pSchema); + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: + return extractShowAliveResultSchema(numOfCols, pSchema); case QUERY_NODE_SHOW_CREATE_TABLE_STMT: case QUERY_NODE_SHOW_CREATE_STABLE_STMT: return extractShowCreateTableResultSchema(numOfCols, pSchema); @@ -7299,12 +7510,12 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S return TSDB_CODE_SUCCESS; } -static int32_t buildDropColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta, +static int32_t buildDropColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, const STableMeta* pTableMeta, SVAlterTbReq* pReq) { if (2 == getNumOfColumns(pTableMeta)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DROP_COL); } - SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); + const SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); if (NULL == pSchema) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); } else if (PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { @@ -7320,11 +7531,11 @@ static int32_t buildDropColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, return TSDB_CODE_SUCCESS; } -static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta, +static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, const STableMeta* pTableMeta, SVAlterTbReq* pReq) { pReq->colModBytes = calcTypeBytes(pStmt->dataType); pReq->colModType = pStmt->dataType.type; - SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); + const SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); if (NULL == pSchema) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); } else if (!IS_VAR_DATA_TYPE(pSchema->type) || pSchema->type != pStmt->dataType.type || @@ -7740,6 +7951,8 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { break; case QUERY_NODE_DESCRIBE_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: + case QUERY_NODE_SHOW_DB_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: case QUERY_NODE_SHOW_CREATE_TABLE_STMT: case QUERY_NODE_SHOW_CREATE_STABLE_STMT: case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 1021aab6f0..84040bd7a8 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 461 +#define YYNOCODE 463 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOrder yy32; - SToken yy77; - int32_t yy248; - int8_t yy287; - ENullOrder yy385; - EJoinType yy560; - SNode* yy600; - SNodeList* yy601; - SAlterOption yy661; - EOperatorType yy666; - int64_t yy717; - EFillMode yy798; - bool yy841; - SDataType yy888; + bool yy63; + int32_t yy122; + EOrder yy162; + SDataType yy200; + SNode* yy320; + EJoinType yy334; + int8_t yy475; + int64_t yy483; + SNodeList* yy570; + SAlterOption yy695; + ENullOrder yy715; + EFillMode yy762; + SToken yy815; + EOperatorType yy828; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,18 +139,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 714 -#define YYNRULE 545 -#define YYNRULE_WITH_ACTION 545 -#define YYNTOKEN 325 -#define YY_MAX_SHIFT 713 -#define YY_MIN_SHIFTREDUCE 1061 -#define YY_MAX_SHIFTREDUCE 1605 -#define YY_ERROR_ACTION 1606 -#define YY_ACCEPT_ACTION 1607 -#define YY_NO_ACTION 1608 -#define YY_MIN_REDUCE 1609 -#define YY_MAX_REDUCE 2153 +#define YYNSTATE 727 +#define YYNRULE 550 +#define YYNRULE_WITH_ACTION 550 +#define YYNTOKEN 326 +#define YY_MAX_SHIFT 726 +#define YY_MIN_SHIFTREDUCE 1075 +#define YY_MAX_SHIFTREDUCE 1624 +#define YY_ERROR_ACTION 1625 +#define YY_ACCEPT_ACTION 1626 +#define YY_NO_ACTION 1627 +#define YY_MIN_REDUCE 1628 +#define YY_MAX_REDUCE 2177 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -217,843 +217,792 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3069) +#define YY_ACTTAB_COUNT (2803) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 35, 276, 460, 1876, 461, 1645, 469, 367, 461, 1645, - /* 10 */ 1808, 1810, 45, 43, 1535, 1954, 1874, 590, 1751, 466, - /* 20 */ 362, 407, 1385, 38, 37, 462, 1950, 44, 42, 41, - /* 30 */ 40, 39, 169, 1465, 459, 1383, 229, 464, 1651, 1792, - /* 40 */ 571, 602, 38, 37, 2124, 602, 44, 42, 41, 40, - /* 50 */ 39, 8, 602, 334, 1862, 1946, 1952, 345, 1460, 570, - /* 60 */ 175, 320, 187, 18, 2125, 572, 613, 38, 37, 1967, - /* 70 */ 1391, 44, 42, 41, 40, 39, 468, 1411, 583, 464, - /* 80 */ 1651, 38, 37, 45, 43, 44, 42, 41, 40, 39, - /* 90 */ 2129, 362, 171, 1385, 1609, 14, 136, 327, 81, 2026, - /* 100 */ 1985, 80, 60, 27, 1465, 1802, 1383, 1412, 586, 134, - /* 110 */ 159, 1572, 1621, 1936, 603, 619, 48, 710, 125, 124, - /* 120 */ 123, 122, 121, 120, 119, 118, 117, 48, 126, 1460, - /* 130 */ 100, 160, 1467, 1468, 18, 499, 1716, 443, 1494, 1966, - /* 140 */ 64, 1391, 478, 2002, 135, 1762, 103, 1968, 623, 1970, - /* 150 */ 1971, 618, 1754, 613, 1410, 2129, 1815, 146, 172, 2124, - /* 160 */ 2055, 1440, 1450, 355, 356, 2051, 14, 1466, 1469, 257, - /* 170 */ 2063, 582, 1813, 127, 581, 2128, 566, 2124, 177, 2125, - /* 180 */ 2127, 2129, 1386, 1595, 1384, 2124, 2081, 528, 710, 1263, - /* 190 */ 1264, 260, 570, 175, 1495, 191, 190, 2125, 572, 49, - /* 200 */ 526, 2128, 524, 1467, 1468, 2125, 2126, 1389, 1390, 53, - /* 210 */ 1439, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 615, - /* 220 */ 611, 1458, 1459, 1461, 1462, 1463, 1464, 2, 60, 60, - /* 230 */ 89, 60, 1440, 1450, 2070, 1410, 156, 116, 1466, 1469, - /* 240 */ 115, 114, 113, 112, 111, 110, 109, 108, 107, 648, - /* 250 */ 259, 227, 178, 1386, 2070, 1384, 1528, 38, 37, 1632, - /* 260 */ 2067, 44, 42, 41, 40, 39, 34, 360, 1489, 1490, - /* 270 */ 1491, 1492, 1493, 1497, 1498, 1499, 1500, 178, 1389, 1390, - /* 280 */ 2066, 1439, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, - /* 290 */ 615, 611, 1458, 1459, 1461, 1462, 1463, 1464, 2, 396, - /* 300 */ 11, 45, 43, 1936, 1954, 1385, 1539, 1631, 1985, 362, - /* 310 */ 408, 1385, 1410, 86, 322, 1950, 565, 532, 1383, 530, - /* 320 */ 398, 394, 1465, 409, 1383, 1220, 645, 644, 643, 1224, - /* 330 */ 642, 1226, 1227, 641, 1229, 638, 1678, 1235, 635, 1237, - /* 340 */ 1238, 632, 629, 213, 1946, 1952, 357, 1460, 1180, 178, - /* 350 */ 401, 1936, 18, 1391, 1815, 613, 564, 1532, 164, 1391, - /* 360 */ 1113, 366, 1112, 1410, 495, 491, 487, 483, 210, 1630, - /* 370 */ 1813, 1629, 45, 43, 1470, 212, 1316, 1317, 178, 178, - /* 380 */ 362, 178, 1385, 1182, 14, 44, 42, 41, 40, 39, - /* 390 */ 657, 1114, 547, 1465, 1409, 1383, 2124, 1113, 1628, 1112, - /* 400 */ 710, 514, 513, 512, 85, 1094, 710, 208, 1610, 131, - /* 410 */ 508, 2130, 175, 1936, 507, 1936, 2125, 572, 1460, 506, - /* 420 */ 511, 1467, 1468, 1602, 1627, 505, 267, 268, 1114, 116, - /* 430 */ 1391, 266, 115, 114, 113, 112, 111, 110, 109, 108, - /* 440 */ 107, 583, 1936, 1411, 1096, 1626, 1099, 1100, 1391, 1876, - /* 450 */ 1440, 1450, 603, 1441, 1815, 46, 1466, 1469, 11, 353, - /* 460 */ 9, 331, 1873, 590, 603, 1386, 54, 1384, 1936, 575, - /* 470 */ 1813, 1386, 134, 1384, 207, 201, 1625, 710, 180, 206, - /* 480 */ 38, 37, 474, 1762, 44, 42, 41, 40, 39, 1936, - /* 490 */ 1389, 1390, 1467, 1468, 84, 1762, 1389, 1390, 199, 1439, - /* 500 */ 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 615, 611, - /* 510 */ 1458, 1459, 1461, 1462, 1463, 1464, 2, 1758, 1601, 1412, - /* 520 */ 1936, 1440, 1450, 583, 1142, 1624, 571, 1466, 1469, 603, - /* 530 */ 2124, 585, 173, 2063, 2064, 603, 132, 2068, 1413, 514, - /* 540 */ 513, 512, 1386, 405, 1384, 570, 175, 131, 508, 406, - /* 550 */ 2125, 572, 507, 1623, 134, 1330, 1331, 506, 511, 1143, - /* 560 */ 1762, 1967, 1620, 505, 1809, 1810, 1762, 1389, 1390, 1936, - /* 570 */ 1439, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 615, - /* 580 */ 611, 1458, 1459, 1461, 1462, 1463, 1464, 2, 45, 43, - /* 590 */ 1329, 1332, 1985, 1740, 84, 354, 362, 1936, 1385, 1531, - /* 600 */ 620, 1607, 605, 157, 2027, 1936, 1936, 619, 130, 1465, - /* 610 */ 228, 1383, 1764, 11, 174, 2063, 2064, 1757, 132, 2068, - /* 620 */ 38, 37, 1967, 2070, 44, 42, 41, 40, 39, 519, - /* 630 */ 561, 1966, 1413, 603, 1460, 2002, 669, 1562, 103, 1968, - /* 640 */ 623, 1970, 1971, 618, 529, 613, 1391, 126, 137, 2065, - /* 650 */ 143, 2026, 2055, 1985, 504, 478, 356, 2051, 226, 45, - /* 660 */ 43, 620, 259, 603, 1762, 377, 1936, 362, 619, 1385, - /* 670 */ 607, 46, 2027, 522, 1619, 1362, 1363, 415, 516, 1618, - /* 680 */ 1465, 184, 1383, 225, 1753, 60, 558, 1560, 1561, 1563, - /* 690 */ 1564, 576, 1966, 710, 1762, 1950, 2002, 510, 509, 161, - /* 700 */ 1968, 623, 1970, 1971, 618, 1460, 613, 547, 1467, 1468, - /* 710 */ 1738, 2124, 542, 368, 567, 562, 556, 1391, 1936, 67, - /* 720 */ 1739, 157, 66, 1936, 1946, 1952, 2130, 175, 1475, 1747, - /* 730 */ 1764, 2125, 572, 1617, 1410, 613, 649, 1440, 1450, 1806, - /* 740 */ 548, 2092, 14, 1466, 1469, 603, 38, 37, 1496, 1749, - /* 750 */ 44, 42, 41, 40, 39, 31, 169, 2128, 1386, 429, - /* 760 */ 1384, 38, 37, 503, 710, 44, 42, 41, 40, 39, - /* 770 */ 1745, 400, 657, 399, 1616, 237, 1762, 1936, 1863, 1467, - /* 780 */ 1468, 1737, 1615, 1389, 1390, 502, 1439, 1442, 1443, 1444, - /* 790 */ 1445, 1446, 1447, 1448, 1449, 615, 611, 1458, 1459, 1461, - /* 800 */ 1462, 1463, 1464, 2, 41, 40, 39, 603, 1440, 1450, - /* 810 */ 319, 50, 1408, 3, 1466, 1469, 365, 94, 1936, 437, - /* 820 */ 32, 430, 450, 232, 157, 449, 1936, 655, 614, 1386, - /* 830 */ 1501, 1384, 1614, 1764, 1551, 178, 681, 679, 1762, 1755, - /* 840 */ 421, 1955, 451, 647, 157, 423, 148, 147, 652, 651, - /* 850 */ 650, 145, 1950, 1765, 1389, 1390, 1410, 1439, 1442, 1443, - /* 860 */ 1444, 1445, 1446, 1447, 1448, 1449, 615, 611, 1458, 1459, - /* 870 */ 1461, 1462, 1463, 1464, 2, 1441, 1936, 670, 1413, 1732, - /* 880 */ 158, 1946, 1952, 33, 1845, 296, 335, 1675, 655, 38, - /* 890 */ 37, 1858, 613, 44, 42, 41, 40, 39, 411, 294, - /* 900 */ 70, 1815, 183, 69, 1858, 1858, 1622, 148, 147, 652, - /* 910 */ 651, 650, 145, 13, 12, 185, 189, 1814, 1099, 1100, - /* 920 */ 99, 195, 456, 454, 653, 2095, 654, 1806, 447, 1806, - /* 930 */ 96, 442, 441, 440, 439, 436, 435, 434, 433, 432, - /* 940 */ 428, 427, 426, 425, 336, 418, 417, 416, 589, 413, - /* 950 */ 412, 333, 687, 686, 685, 684, 372, 60, 683, 682, - /* 960 */ 138, 677, 676, 675, 674, 673, 672, 671, 150, 667, - /* 970 */ 666, 665, 371, 370, 662, 661, 660, 659, 658, 1613, - /* 980 */ 254, 603, 655, 1612, 290, 603, 375, 1792, 374, 578, - /* 990 */ 547, 2075, 1528, 603, 2124, 476, 102, 1441, 1717, 477, - /* 1000 */ 1967, 148, 147, 652, 651, 650, 145, 1759, 1508, 2130, - /* 1010 */ 175, 140, 1762, 128, 2125, 572, 1762, 218, 574, 71, - /* 1020 */ 216, 236, 220, 1936, 1762, 219, 52, 1936, 547, 603, - /* 1030 */ 547, 1985, 2124, 546, 2124, 424, 78, 77, 404, 586, - /* 1040 */ 583, 182, 603, 142, 1936, 1394, 619, 2130, 175, 2130, - /* 1050 */ 175, 559, 2125, 572, 2125, 572, 543, 1923, 535, 318, - /* 1060 */ 1762, 603, 392, 235, 390, 386, 382, 379, 376, 79, - /* 1070 */ 1966, 134, 1967, 1762, 2002, 587, 1393, 103, 1968, 623, - /* 1080 */ 1970, 1971, 618, 603, 613, 222, 62, 224, 221, 172, - /* 1090 */ 223, 2055, 1762, 1665, 211, 356, 2051, 271, 603, 603, - /* 1100 */ 547, 1658, 87, 1985, 2124, 384, 1656, 178, 603, 610, - /* 1110 */ 339, 620, 598, 600, 1762, 515, 1936, 2082, 619, 2130, - /* 1120 */ 175, 1957, 601, 517, 2125, 572, 1967, 603, 520, 1762, - /* 1130 */ 1762, 176, 2063, 2064, 241, 132, 2068, 248, 1559, 1762, - /* 1140 */ 47, 277, 1966, 1604, 1605, 1986, 2002, 264, 373, 103, - /* 1150 */ 1968, 623, 1970, 1971, 618, 663, 613, 1985, 1762, 68, - /* 1160 */ 144, 2144, 1867, 2055, 146, 620, 1646, 356, 2051, 1959, - /* 1170 */ 1936, 340, 619, 338, 337, 62, 501, 1161, 2089, 664, - /* 1180 */ 503, 1652, 1803, 603, 47, 47, 243, 1967, 13, 12, - /* 1190 */ 2085, 627, 1327, 584, 1397, 144, 1966, 369, 256, 269, - /* 1200 */ 2002, 1159, 502, 103, 1968, 623, 1970, 1971, 618, 253, - /* 1210 */ 613, 595, 273, 579, 1762, 2144, 1213, 2055, 1985, 1, - /* 1220 */ 146, 356, 2051, 129, 4, 1396, 620, 1502, 359, 358, - /* 1230 */ 705, 1936, 2102, 619, 378, 1349, 1451, 289, 1399, 144, - /* 1240 */ 383, 332, 284, 1241, 188, 410, 1413, 1245, 414, 1465, - /* 1250 */ 1967, 1392, 1868, 1486, 445, 419, 1408, 1966, 438, 444, - /* 1260 */ 431, 2002, 1860, 446, 103, 1968, 623, 1970, 1971, 618, - /* 1270 */ 1967, 613, 1252, 452, 1460, 1250, 2144, 453, 2055, 192, - /* 1280 */ 455, 1985, 356, 2051, 457, 1414, 1391, 458, 467, 620, - /* 1290 */ 1416, 149, 470, 554, 1936, 198, 619, 200, 1411, 471, - /* 1300 */ 1415, 1985, 472, 1417, 473, 203, 205, 475, 82, 620, - /* 1310 */ 83, 479, 1116, 209, 1936, 496, 619, 497, 500, 498, - /* 1320 */ 1966, 1752, 321, 106, 2002, 534, 215, 103, 1968, 623, - /* 1330 */ 1970, 1971, 618, 609, 613, 536, 285, 230, 1748, 2144, - /* 1340 */ 1966, 2055, 217, 151, 2002, 356, 2051, 103, 1968, 623, - /* 1350 */ 1970, 1971, 618, 152, 613, 1750, 2118, 1746, 153, 2144, - /* 1360 */ 154, 2055, 1913, 1912, 537, 356, 2051, 538, 233, 541, - /* 1370 */ 713, 544, 560, 1967, 551, 2086, 2074, 2101, 593, 557, - /* 1380 */ 2100, 346, 2096, 7, 283, 563, 569, 249, 239, 242, - /* 1390 */ 2077, 165, 247, 552, 550, 250, 549, 347, 1400, 168, - /* 1400 */ 1395, 580, 577, 1528, 1985, 703, 699, 695, 691, 281, - /* 1410 */ 251, 2147, 620, 255, 252, 2123, 133, 1936, 1412, 619, - /* 1420 */ 2071, 588, 261, 1403, 1405, 350, 591, 596, 286, 287, - /* 1430 */ 592, 1884, 1967, 1883, 1882, 352, 611, 1458, 1459, 1461, - /* 1440 */ 1462, 1463, 1464, 1966, 288, 101, 1763, 2002, 274, 597, - /* 1450 */ 103, 1968, 623, 1970, 1971, 618, 59, 613, 91, 93, - /* 1460 */ 2036, 95, 2030, 1985, 2055, 625, 280, 1807, 356, 2051, - /* 1470 */ 1733, 620, 291, 706, 707, 709, 1936, 315, 619, 51, - /* 1480 */ 295, 599, 1930, 323, 324, 293, 1967, 1929, 300, 75, - /* 1490 */ 1928, 314, 304, 1927, 76, 1924, 380, 381, 1377, 1378, - /* 1500 */ 181, 1922, 1966, 385, 387, 388, 2002, 389, 1921, 103, - /* 1510 */ 1968, 623, 1970, 1971, 618, 391, 613, 1985, 1920, 393, - /* 1520 */ 262, 2028, 1919, 2055, 395, 620, 397, 356, 2051, 1918, - /* 1530 */ 1936, 1352, 619, 1895, 1351, 1894, 402, 1356, 1893, 231, - /* 1540 */ 403, 1892, 1853, 1307, 1852, 1850, 139, 1967, 1849, 1848, - /* 1550 */ 1851, 1847, 1846, 1844, 1843, 1842, 1966, 186, 420, 1841, - /* 1560 */ 2002, 422, 1840, 103, 1968, 623, 1970, 1971, 618, 1839, - /* 1570 */ 613, 1838, 1837, 1836, 1835, 606, 1834, 2055, 1985, 1833, - /* 1580 */ 1832, 356, 2051, 1831, 1830, 1829, 620, 1828, 1827, 1826, - /* 1590 */ 1825, 1936, 1824, 619, 448, 1817, 1816, 1309, 141, 1823, - /* 1600 */ 1822, 1821, 1820, 1819, 1818, 1967, 1680, 1679, 1677, 1641, - /* 1610 */ 196, 170, 1188, 1956, 1640, 193, 194, 1966, 1908, 1102, - /* 1620 */ 73, 2002, 197, 1902, 104, 1968, 623, 1970, 1971, 618, - /* 1630 */ 1101, 613, 1891, 463, 1890, 204, 1985, 74, 2055, 1870, - /* 1640 */ 465, 1741, 2054, 2051, 620, 1676, 1674, 480, 1672, 1936, - /* 1650 */ 202, 619, 482, 1670, 484, 1135, 486, 488, 481, 1967, - /* 1660 */ 490, 1668, 492, 485, 494, 1655, 1654, 1637, 489, 1743, - /* 1670 */ 1257, 1256, 493, 1742, 61, 1966, 1171, 1179, 1178, 2002, - /* 1680 */ 678, 680, 104, 1968, 623, 1970, 1971, 618, 1967, 613, - /* 1690 */ 1985, 1177, 1176, 1173, 1172, 1170, 2055, 1666, 620, 214, - /* 1700 */ 608, 2051, 341, 1936, 1659, 619, 342, 1657, 343, 521, - /* 1710 */ 1636, 523, 518, 1635, 525, 1634, 527, 1367, 105, 1985, - /* 1720 */ 1366, 531, 1369, 26, 1907, 1358, 55, 617, 1901, 621, - /* 1730 */ 539, 155, 1936, 2002, 619, 1889, 104, 1968, 623, 1970, - /* 1740 */ 1971, 618, 1887, 613, 2129, 28, 1967, 19, 16, 553, - /* 1750 */ 2055, 1574, 246, 555, 326, 2051, 58, 63, 1966, 238, - /* 1760 */ 245, 1957, 2002, 30, 240, 312, 1968, 623, 1970, 1971, - /* 1770 */ 618, 616, 613, 604, 2020, 21, 163, 1985, 1589, 20, - /* 1780 */ 17, 1588, 348, 1558, 244, 620, 29, 1593, 1550, 1594, - /* 1790 */ 1936, 88, 619, 540, 234, 1595, 344, 1592, 349, 1888, - /* 1800 */ 1967, 57, 545, 258, 56, 1525, 166, 1524, 5, 1886, - /* 1810 */ 6, 1885, 22, 594, 263, 265, 1966, 1556, 270, 1869, - /* 1820 */ 2002, 65, 90, 162, 1968, 623, 1970, 1971, 618, 92, - /* 1830 */ 613, 1985, 96, 275, 272, 23, 12, 1401, 1432, 620, - /* 1840 */ 2005, 167, 179, 612, 1936, 1455, 619, 1453, 36, 626, - /* 1850 */ 624, 1234, 364, 15, 1967, 630, 1452, 1424, 1487, 24, - /* 1860 */ 25, 622, 1242, 628, 633, 1239, 631, 636, 639, 1236, - /* 1870 */ 1966, 634, 1477, 1230, 2002, 573, 2145, 104, 1968, 623, - /* 1880 */ 1970, 1971, 618, 637, 613, 1985, 1228, 640, 1219, 1233, - /* 1890 */ 278, 2055, 646, 620, 1232, 97, 2052, 1231, 1936, 98, - /* 1900 */ 619, 10, 1251, 1476, 1247, 72, 1967, 1133, 656, 1167, - /* 1910 */ 1166, 1165, 1164, 1163, 1162, 1160, 1158, 1186, 1157, 1156, - /* 1920 */ 668, 1154, 1967, 1153, 1966, 1152, 1151, 1183, 2002, 279, - /* 1930 */ 1150, 161, 1968, 623, 1970, 1971, 618, 1985, 613, 1139, - /* 1940 */ 1149, 1148, 1181, 1145, 1144, 620, 1141, 1140, 1138, 1673, - /* 1950 */ 1936, 688, 619, 1985, 690, 1671, 692, 694, 689, 1669, - /* 1960 */ 696, 620, 693, 698, 1667, 700, 1936, 697, 619, 1653, - /* 1970 */ 701, 702, 704, 2093, 1091, 1633, 1966, 712, 282, 708, - /* 1980 */ 2002, 1608, 1387, 306, 1968, 623, 1970, 1971, 618, 711, - /* 1990 */ 613, 1608, 1966, 292, 1608, 1608, 2002, 1608, 1608, 162, - /* 2000 */ 1968, 623, 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, - /* 2010 */ 1608, 1967, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2020 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 568, 1608, 1967, - /* 2030 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2040 */ 1608, 1608, 1985, 1608, 1608, 1608, 1608, 351, 1608, 1608, - /* 2050 */ 620, 1608, 2146, 1608, 1608, 1936, 1608, 619, 1608, 1608, - /* 2060 */ 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 617, 1608, - /* 2070 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2080 */ 1608, 1966, 1608, 1967, 1608, 2002, 1608, 1608, 313, 1968, - /* 2090 */ 623, 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, 1966, - /* 2100 */ 1967, 1608, 1608, 2002, 1608, 1608, 312, 1968, 623, 1970, - /* 2110 */ 1971, 618, 1608, 613, 1985, 2021, 1608, 1608, 1608, 361, - /* 2120 */ 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, - /* 2130 */ 1608, 1985, 1608, 1608, 1608, 1608, 363, 1608, 1608, 620, - /* 2140 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2150 */ 1608, 1608, 1967, 1966, 1608, 1608, 1608, 2002, 1608, 1608, - /* 2160 */ 313, 1968, 623, 1970, 1971, 618, 1608, 613, 1967, 1608, - /* 2170 */ 1966, 1608, 1608, 1608, 2002, 1608, 1608, 313, 1968, 623, - /* 2180 */ 1970, 1971, 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, - /* 2190 */ 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1985, - /* 2200 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, - /* 2210 */ 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, - /* 2220 */ 1967, 1608, 533, 1608, 1608, 1608, 2002, 1608, 1608, 308, - /* 2230 */ 1968, 623, 1970, 1971, 618, 1608, 613, 1608, 1966, 1608, - /* 2240 */ 1608, 1608, 2002, 1608, 1608, 297, 1968, 623, 1970, 1971, - /* 2250 */ 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2260 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2270 */ 1608, 1608, 1608, 1608, 1967, 1608, 1608, 1608, 1608, 1608, - /* 2280 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2290 */ 1966, 1608, 1608, 1608, 2002, 1967, 1608, 298, 1968, 623, - /* 2300 */ 1970, 1971, 618, 1608, 613, 1985, 1608, 1608, 1608, 1608, - /* 2310 */ 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, - /* 2320 */ 619, 1608, 1608, 1608, 1608, 1608, 1985, 1608, 1608, 1608, - /* 2330 */ 1608, 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, - /* 2340 */ 1608, 619, 1608, 1608, 1966, 1608, 1608, 1608, 2002, 1608, - /* 2350 */ 1608, 299, 1968, 623, 1970, 1971, 618, 1608, 613, 1608, - /* 2360 */ 1608, 1608, 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, - /* 2370 */ 1608, 1967, 305, 1968, 623, 1970, 1971, 618, 1608, 613, - /* 2380 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1967, - /* 2390 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2400 */ 1608, 1608, 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2410 */ 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, - /* 2420 */ 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, - /* 2430 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2440 */ 1608, 1966, 1608, 1967, 1608, 2002, 1608, 1608, 309, 1968, - /* 2450 */ 623, 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, 1966, - /* 2460 */ 1967, 1608, 1608, 2002, 1608, 1608, 301, 1968, 623, 1970, - /* 2470 */ 1971, 618, 1608, 613, 1985, 1608, 1608, 1608, 1608, 1608, - /* 2480 */ 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, - /* 2490 */ 1608, 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2500 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2510 */ 1608, 1608, 1967, 1966, 1608, 1608, 1608, 2002, 1608, 1608, - /* 2520 */ 310, 1968, 623, 1970, 1971, 618, 1608, 613, 1967, 1608, - /* 2530 */ 1966, 1608, 1608, 1608, 2002, 1608, 1608, 302, 1968, 623, - /* 2540 */ 1970, 1971, 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, - /* 2550 */ 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1985, - /* 2560 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, - /* 2570 */ 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, - /* 2580 */ 1967, 1608, 1966, 1608, 1608, 1608, 2002, 1608, 1608, 311, - /* 2590 */ 1968, 623, 1970, 1971, 618, 1608, 613, 1608, 1966, 1608, - /* 2600 */ 1608, 1608, 2002, 1967, 1608, 303, 1968, 623, 1970, 1971, - /* 2610 */ 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2620 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2630 */ 1608, 1608, 1608, 1608, 1985, 1608, 1608, 1608, 1608, 1608, - /* 2640 */ 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, - /* 2650 */ 1966, 1608, 1608, 1608, 2002, 1967, 1608, 316, 1968, 623, - /* 2660 */ 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, 1608, 1608, - /* 2670 */ 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, 1608, 1608, - /* 2680 */ 317, 1968, 623, 1970, 1971, 618, 1985, 613, 1608, 1608, - /* 2690 */ 1608, 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, - /* 2700 */ 1608, 619, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2710 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1967, 1608, - /* 2720 */ 1608, 1608, 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, - /* 2730 */ 1608, 1608, 1979, 1968, 623, 1970, 1971, 618, 1608, 613, - /* 2740 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1985, - /* 2750 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, - /* 2760 */ 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, - /* 2770 */ 1967, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2780 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1966, 1967, - /* 2790 */ 1608, 1608, 2002, 1608, 1608, 1978, 1968, 623, 1970, 1971, - /* 2800 */ 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2810 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2820 */ 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, - /* 2830 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2840 */ 1966, 1967, 1608, 1608, 2002, 1608, 1608, 1977, 1968, 623, - /* 2850 */ 1970, 1971, 618, 1608, 613, 1608, 1608, 1967, 1608, 1966, - /* 2860 */ 1608, 1608, 1608, 2002, 1608, 1608, 328, 1968, 623, 1970, - /* 2870 */ 1971, 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2880 */ 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1985, 1608, - /* 2890 */ 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, 1608, - /* 2900 */ 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, 1967, - /* 2910 */ 1608, 1966, 1608, 1608, 1608, 2002, 1608, 1608, 329, 1968, - /* 2920 */ 623, 1970, 1971, 618, 1608, 613, 1608, 1966, 1608, 1608, - /* 2930 */ 1608, 2002, 1967, 1608, 325, 1968, 623, 1970, 1971, 618, - /* 2940 */ 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, - /* 2950 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2960 */ 1608, 1608, 1608, 1985, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2970 */ 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1966, - /* 2980 */ 1608, 1608, 1608, 2002, 1967, 1608, 330, 1968, 623, 1970, - /* 2990 */ 1971, 618, 1608, 613, 1608, 1608, 1608, 1608, 1608, 1608, - /* 3000 */ 1608, 1608, 621, 1608, 1608, 1608, 2002, 1608, 1608, 308, - /* 3010 */ 1968, 623, 1970, 1971, 618, 1985, 613, 1608, 1608, 1608, - /* 3020 */ 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, - /* 3030 */ 619, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 3040 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 3050 */ 1608, 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, 1608, - /* 3060 */ 1608, 307, 1968, 623, 1970, 1971, 618, 1608, 613, + /* 0 */ 35, 282, 1770, 1898, 2153, 1898, 233, 581, 2148, 1811, + /* 10 */ 1978, 2148, 45, 43, 1554, 361, 1896, 603, 1895, 603, + /* 20 */ 370, 1974, 1404, 1978, 2152, 1759, 580, 179, 2149, 2151, + /* 30 */ 1991, 2149, 582, 1484, 1974, 1402, 44, 42, 41, 40, + /* 40 */ 39, 538, 38, 37, 1772, 2152, 44, 42, 41, 40, + /* 50 */ 39, 1970, 1976, 352, 536, 1974, 534, 593, 1479, 1429, + /* 60 */ 1626, 2009, 626, 18, 1970, 1976, 365, 476, 375, 596, + /* 70 */ 1410, 1827, 1829, 472, 1960, 626, 632, 470, 415, 471, + /* 80 */ 1664, 1430, 1834, 45, 43, 1970, 1976, 488, 138, 338, + /* 90 */ 615, 370, 163, 1404, 1640, 14, 626, 334, 1832, 469, + /* 100 */ 616, 1990, 474, 1670, 1484, 2026, 1402, 1431, 107, 1992, + /* 110 */ 636, 1994, 1995, 631, 130, 626, 616, 723, 324, 2153, + /* 120 */ 176, 509, 2079, 2148, 385, 1879, 364, 2075, 615, 1479, + /* 130 */ 130, 1781, 1486, 1487, 18, 615, 187, 514, 1513, 2152, + /* 140 */ 181, 1410, 478, 2149, 2150, 474, 1670, 1781, 2105, 262, + /* 150 */ 2087, 592, 161, 131, 591, 581, 2009, 2148, 1108, 2148, + /* 160 */ 173, 1784, 1459, 1469, 575, 48, 14, 557, 1485, 1488, + /* 170 */ 1429, 2148, 580, 179, 580, 179, 616, 2149, 582, 2149, + /* 180 */ 582, 341, 1883, 1405, 173, 1403, 2154, 179, 723, 345, + /* 190 */ 54, 2149, 582, 1347, 1348, 1514, 1864, 1110, 265, 1113, + /* 200 */ 1114, 1332, 1333, 1486, 1487, 574, 1884, 1781, 1408, 1409, + /* 210 */ 48, 1458, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, + /* 220 */ 628, 624, 1477, 1478, 1480, 1481, 1482, 1483, 2, 1346, + /* 230 */ 1349, 273, 274, 1459, 1469, 60, 272, 90, 120, 1485, + /* 240 */ 1488, 119, 118, 117, 116, 115, 114, 113, 112, 111, + /* 250 */ 346, 264, 344, 343, 1405, 511, 1403, 38, 37, 513, + /* 260 */ 488, 44, 42, 41, 40, 39, 1581, 34, 368, 1508, + /* 270 */ 1509, 1510, 1511, 1512, 1516, 1517, 1518, 1519, 60, 1408, + /* 280 */ 1409, 512, 1458, 1461, 1462, 1463, 1464, 1465, 1466, 1467, + /* 290 */ 1468, 628, 624, 1477, 1478, 1480, 1481, 1482, 1483, 2, + /* 300 */ 49, 11, 45, 43, 1697, 1429, 1127, 584, 1126, 1404, + /* 310 */ 370, 140, 1404, 1979, 2050, 568, 1579, 1580, 1582, 1583, + /* 320 */ 1991, 216, 1402, 1484, 1974, 1402, 1234, 658, 657, 656, + /* 330 */ 1238, 655, 1240, 1241, 654, 1243, 651, 1128, 1249, 648, + /* 340 */ 1251, 1252, 645, 642, 1194, 1591, 60, 433, 1479, 84, + /* 350 */ 64, 2009, 1558, 18, 1970, 1976, 432, 1410, 1429, 633, + /* 360 */ 1410, 182, 104, 134, 1960, 626, 632, 1828, 1829, 524, + /* 370 */ 523, 522, 1776, 45, 43, 1489, 139, 135, 518, 1196, + /* 380 */ 60, 370, 517, 1404, 1773, 14, 182, 516, 521, 2153, + /* 390 */ 84, 1990, 164, 515, 1484, 2026, 1402, 1735, 107, 1992, + /* 400 */ 636, 1994, 1995, 631, 723, 626, 1431, 723, 141, 576, + /* 410 */ 147, 2050, 2079, 1777, 31, 217, 364, 2075, 1628, 1479, + /* 420 */ 38, 37, 1486, 1487, 44, 42, 41, 40, 39, 182, + /* 430 */ 168, 1410, 11, 408, 9, 407, 505, 501, 497, 493, + /* 440 */ 214, 60, 129, 128, 127, 126, 125, 124, 123, 122, + /* 450 */ 121, 182, 1459, 1469, 1430, 571, 46, 1494, 1485, 1488, + /* 460 */ 1629, 38, 37, 1429, 1834, 44, 42, 41, 40, 39, + /* 470 */ 1405, 350, 1403, 1405, 296, 1403, 85, 1811, 723, 212, + /* 480 */ 1832, 120, 1614, 1757, 119, 118, 117, 116, 115, 114, + /* 490 */ 113, 112, 111, 1486, 1487, 1408, 1409, 182, 1408, 1409, + /* 500 */ 1460, 1458, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, + /* 510 */ 628, 624, 1477, 1478, 1480, 1481, 1482, 1483, 2, 524, + /* 520 */ 523, 522, 1428, 1459, 1469, 520, 519, 135, 518, 1485, + /* 530 */ 1488, 182, 517, 479, 362, 471, 1664, 516, 521, 577, + /* 540 */ 572, 566, 161, 515, 1405, 670, 1403, 211, 205, 150, + /* 550 */ 264, 1783, 210, 38, 37, 484, 453, 44, 42, 41, + /* 560 */ 40, 39, 593, 670, 1991, 1432, 1277, 1278, 661, 1408, + /* 570 */ 1409, 203, 1458, 1461, 1462, 1463, 1464, 1465, 1466, 1467, + /* 580 */ 1468, 628, 624, 1477, 1478, 1480, 1481, 1482, 1483, 2, + /* 590 */ 45, 43, 182, 138, 662, 2009, 1651, 1825, 370, 373, + /* 600 */ 1404, 53, 1834, 633, 175, 1460, 11, 161, 1960, 358, + /* 610 */ 632, 1484, 231, 1402, 195, 194, 1783, 1821, 1832, 38, + /* 620 */ 37, 1991, 1834, 44, 42, 41, 40, 39, 1621, 363, + /* 630 */ 41, 40, 39, 593, 1834, 1990, 1479, 452, 1832, 2026, + /* 640 */ 1960, 374, 312, 1992, 636, 1994, 1995, 631, 1410, 626, + /* 650 */ 1832, 1410, 2009, 595, 177, 2087, 2088, 682, 136, 2092, + /* 660 */ 633, 45, 43, 616, 138, 1960, 616, 632, 98, 370, + /* 670 */ 376, 1404, 1650, 46, 616, 87, 329, 184, 161, 542, + /* 680 */ 413, 540, 1484, 1127, 1402, 1126, 578, 1783, 414, 1991, + /* 690 */ 1774, 618, 1990, 2051, 1781, 723, 2026, 1781, 1641, 108, + /* 700 */ 1992, 636, 1994, 1995, 631, 1781, 626, 1479, 616, 242, + /* 710 */ 1486, 1487, 232, 2079, 1128, 404, 1960, 2078, 2075, 1410, + /* 720 */ 2009, 1879, 423, 1620, 1758, 178, 2087, 2088, 630, 136, + /* 730 */ 2092, 616, 189, 1960, 616, 632, 406, 402, 1766, 1781, + /* 740 */ 1459, 1469, 694, 692, 14, 438, 1485, 1488, 439, 38, + /* 750 */ 37, 13, 12, 44, 42, 41, 40, 39, 2094, 1671, + /* 760 */ 1990, 1405, 1781, 1403, 2026, 1781, 723, 318, 1992, 636, + /* 770 */ 1994, 1995, 631, 629, 626, 617, 2044, 666, 1381, 1382, + /* 780 */ 1825, 1486, 1487, 1432, 2091, 27, 1408, 1409, 593, 1458, + /* 790 */ 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 628, 624, + /* 800 */ 1477, 1478, 1480, 1481, 1482, 1483, 2, 616, 718, 616, + /* 810 */ 616, 1459, 1469, 327, 513, 1427, 616, 1485, 1488, 138, + /* 820 */ 191, 486, 446, 234, 487, 460, 1834, 620, 459, 2051, + /* 830 */ 1778, 668, 1405, 1879, 1403, 1649, 512, 1515, 1781, 1432, + /* 840 */ 1781, 1781, 1833, 429, 193, 461, 1527, 1781, 431, 1429, + /* 850 */ 152, 151, 665, 664, 663, 149, 81, 1408, 1409, 80, + /* 860 */ 1458, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 628, + /* 870 */ 624, 1477, 1478, 1480, 1481, 1482, 1483, 2, 1756, 1960, + /* 880 */ 180, 2087, 2088, 162, 136, 2092, 33, 2094, 302, 342, + /* 890 */ 1694, 616, 38, 37, 2094, 1551, 44, 42, 41, 40, + /* 900 */ 39, 419, 300, 70, 667, 553, 69, 1825, 8, 32, + /* 910 */ 38, 37, 588, 2090, 44, 42, 41, 40, 39, 1520, + /* 920 */ 2089, 683, 1781, 1751, 199, 466, 464, 188, 1113, 1114, + /* 930 */ 623, 457, 2099, 1547, 451, 450, 449, 448, 445, 444, + /* 940 */ 443, 442, 441, 437, 436, 435, 434, 326, 426, 425, + /* 950 */ 424, 1991, 421, 420, 340, 700, 699, 698, 697, 380, + /* 960 */ 60, 696, 695, 142, 690, 689, 688, 687, 686, 685, + /* 970 */ 684, 154, 680, 679, 678, 379, 378, 675, 674, 673, + /* 980 */ 672, 671, 2009, 241, 1648, 668, 240, 50, 616, 3, + /* 990 */ 633, 1460, 1768, 1647, 668, 1960, 616, 632, 1570, 106, + /* 1000 */ 1646, 1947, 377, 71, 152, 151, 665, 664, 663, 149, + /* 1010 */ 597, 585, 1991, 152, 151, 665, 664, 663, 149, 1781, + /* 1020 */ 552, 144, 1990, 132, 616, 88, 2026, 1781, 1960, 166, + /* 1030 */ 1992, 636, 1994, 1995, 631, 529, 626, 1960, 601, 1764, + /* 1040 */ 78, 77, 412, 2009, 1960, 186, 616, 616, 1736, 392, + /* 1050 */ 539, 596, 1645, 79, 416, 1781, 1960, 237, 632, 1644, + /* 1060 */ 602, 277, 222, 325, 230, 220, 400, 417, 398, 394, + /* 1070 */ 390, 387, 384, 224, 1991, 1505, 223, 1781, 1781, 532, + /* 1080 */ 409, 583, 2169, 1990, 526, 616, 616, 2026, 1981, 229, + /* 1090 */ 107, 1992, 636, 1994, 1995, 631, 1960, 626, 616, 611, + /* 1100 */ 613, 616, 176, 1960, 2079, 2009, 259, 226, 364, 2075, + /* 1110 */ 225, 182, 614, 633, 1547, 283, 1781, 1781, 1960, 1991, + /* 1120 */ 632, 228, 1684, 557, 227, 67, 52, 2148, 66, 1781, + /* 1130 */ 2106, 627, 1781, 556, 1623, 1624, 1983, 589, 1550, 1643, + /* 1140 */ 1642, 1639, 2154, 179, 525, 1990, 1413, 2149, 582, 2026, + /* 1150 */ 2009, 1638, 107, 1992, 636, 1994, 1995, 631, 633, 626, + /* 1160 */ 1677, 150, 660, 1960, 2168, 632, 2079, 2119, 1637, 1412, + /* 1170 */ 364, 2075, 38, 37, 1675, 1991, 44, 42, 41, 40, + /* 1180 */ 39, 2113, 527, 1960, 1960, 1960, 1636, 1635, 1634, 1633, + /* 1190 */ 1990, 1632, 569, 1631, 2026, 1960, 530, 107, 1992, 636, + /* 1200 */ 1994, 1995, 631, 2010, 626, 1991, 2009, 1888, 1156, 2168, + /* 1210 */ 62, 2079, 1960, 1379, 633, 364, 2075, 367, 366, 1960, + /* 1220 */ 215, 632, 246, 13, 12, 150, 2126, 1418, 381, 47, + /* 1230 */ 1960, 1960, 1960, 1960, 586, 1960, 2009, 1960, 1484, 270, + /* 1240 */ 1411, 68, 148, 1157, 633, 1665, 1990, 150, 253, 1960, + /* 1250 */ 2026, 632, 1822, 107, 1992, 636, 1994, 1995, 631, 62, + /* 1260 */ 626, 1991, 1578, 1479, 258, 2168, 594, 2079, 47, 47, + /* 1270 */ 261, 364, 2075, 1, 248, 1410, 1990, 600, 640, 148, + /* 1280 */ 2026, 1344, 564, 107, 1992, 636, 1994, 1995, 631, 2109, + /* 1290 */ 626, 275, 2009, 608, 279, 2168, 1416, 2079, 150, 1227, + /* 1300 */ 633, 364, 2075, 133, 676, 1960, 4, 632, 148, 386, + /* 1310 */ 391, 1521, 2142, 103, 339, 677, 599, 1366, 192, 1415, + /* 1320 */ 1470, 295, 622, 100, 418, 290, 1175, 1432, 160, 383, + /* 1330 */ 1255, 1259, 1990, 1889, 422, 427, 2026, 1173, 382, 107, + /* 1340 */ 1992, 636, 1994, 1995, 631, 455, 626, 1427, 440, 1881, + /* 1350 */ 1266, 2168, 447, 2079, 454, 1264, 545, 364, 2075, 557, + /* 1360 */ 153, 456, 462, 2148, 463, 196, 465, 467, 2098, 1433, + /* 1370 */ 468, 1991, 557, 1435, 477, 1430, 2148, 480, 2154, 179, + /* 1380 */ 202, 557, 481, 2149, 582, 2148, 1434, 204, 1419, 482, + /* 1390 */ 1414, 2154, 179, 1436, 483, 207, 2149, 582, 485, 557, + /* 1400 */ 2154, 179, 2009, 2148, 209, 2149, 582, 82, 83, 489, + /* 1410 */ 633, 213, 1130, 1422, 1424, 1960, 506, 632, 2154, 179, + /* 1420 */ 507, 508, 510, 2149, 582, 110, 624, 1477, 1478, 1480, + /* 1430 */ 1481, 1482, 1483, 1771, 1991, 219, 1937, 1767, 221, 155, + /* 1440 */ 328, 156, 1990, 1769, 1765, 157, 2026, 158, 546, 107, + /* 1450 */ 1992, 636, 1994, 1995, 631, 1936, 626, 544, 86, 235, + /* 1460 */ 547, 2054, 548, 2079, 146, 2009, 291, 364, 2075, 551, + /* 1470 */ 238, 561, 554, 633, 2110, 2120, 570, 2125, 1960, 1991, + /* 1480 */ 632, 606, 244, 567, 2101, 247, 353, 573, 2124, 7, + /* 1490 */ 579, 252, 562, 169, 560, 254, 255, 559, 2171, 256, + /* 1500 */ 354, 590, 257, 2147, 587, 1990, 1547, 137, 1431, 2026, + /* 1510 */ 2009, 260, 107, 1992, 636, 1994, 1995, 631, 633, 626, + /* 1520 */ 598, 2095, 604, 1960, 2052, 632, 2079, 357, 266, 93, + /* 1530 */ 364, 2075, 292, 293, 605, 1991, 1906, 609, 1905, 610, + /* 1540 */ 1904, 360, 95, 97, 1782, 59, 294, 2060, 99, 1752, + /* 1550 */ 1990, 297, 1826, 286, 2026, 638, 719, 107, 1992, 636, + /* 1560 */ 1994, 1995, 631, 722, 626, 51, 2009, 321, 720, 619, + /* 1570 */ 306, 2079, 301, 330, 633, 364, 2075, 320, 1954, 1960, + /* 1580 */ 1991, 632, 299, 331, 310, 1953, 75, 1952, 1951, 76, + /* 1590 */ 1948, 388, 389, 1396, 1397, 185, 393, 1946, 395, 396, + /* 1600 */ 397, 1945, 399, 1944, 401, 1943, 1990, 1942, 403, 405, + /* 1610 */ 2026, 2009, 1368, 108, 1992, 636, 1994, 1995, 631, 633, + /* 1620 */ 626, 1369, 1917, 1916, 1960, 1991, 632, 2079, 410, 411, + /* 1630 */ 1915, 621, 2075, 1914, 1872, 1871, 1323, 1869, 143, 1868, + /* 1640 */ 1867, 1870, 1991, 1866, 1865, 1863, 1862, 1861, 190, 428, + /* 1650 */ 1860, 634, 430, 1874, 1859, 2026, 2009, 1858, 108, 1992, + /* 1660 */ 636, 1994, 1995, 631, 633, 626, 1857, 1856, 1855, 1960, + /* 1670 */ 1854, 632, 2079, 2009, 1853, 1852, 333, 2075, 145, 1844, + /* 1680 */ 1843, 633, 1851, 1850, 1849, 1848, 1960, 1991, 632, 1847, + /* 1690 */ 1846, 1845, 1842, 1873, 1841, 1840, 1990, 1839, 1325, 1838, + /* 1700 */ 2026, 458, 1836, 165, 1992, 636, 1994, 1995, 631, 1837, + /* 1710 */ 626, 1835, 1202, 1990, 1699, 1698, 197, 2026, 2009, 198, + /* 1720 */ 108, 1992, 636, 1994, 1995, 631, 633, 626, 1696, 1660, + /* 1730 */ 200, 1960, 1116, 632, 2079, 73, 1115, 1659, 1930, 2076, + /* 1740 */ 1991, 1924, 174, 1913, 558, 2116, 201, 1980, 1912, 74, + /* 1750 */ 473, 475, 206, 208, 1892, 1760, 1991, 1695, 1990, 1693, + /* 1760 */ 490, 1691, 2026, 492, 491, 165, 1992, 636, 1994, 1995, + /* 1770 */ 631, 2009, 626, 496, 494, 495, 1149, 1689, 499, 633, + /* 1780 */ 498, 500, 1687, 503, 1960, 502, 632, 2009, 504, 1674, + /* 1790 */ 1673, 1656, 359, 1762, 1270, 633, 1761, 1271, 1193, 1192, + /* 1800 */ 1960, 1191, 632, 1185, 1190, 1685, 1187, 2117, 347, 1991, + /* 1810 */ 1186, 1990, 61, 1184, 691, 2026, 1678, 693, 166, 1992, + /* 1820 */ 636, 1994, 1995, 631, 348, 626, 528, 1990, 218, 1676, + /* 1830 */ 349, 2026, 531, 1655, 319, 1992, 636, 1994, 1995, 631, + /* 1840 */ 2009, 626, 533, 1654, 535, 1653, 537, 109, 630, 1386, + /* 1850 */ 1385, 541, 1388, 1960, 1929, 632, 1375, 1923, 159, 549, + /* 1860 */ 26, 1911, 1909, 2153, 19, 16, 565, 563, 20, 55, + /* 1870 */ 1593, 2170, 58, 239, 28, 243, 250, 251, 1981, 245, + /* 1880 */ 1990, 550, 167, 351, 2026, 30, 63, 318, 1992, 636, + /* 1890 */ 1994, 1995, 631, 555, 626, 1577, 2045, 1569, 249, 1991, + /* 1900 */ 1613, 29, 5, 6, 1608, 89, 1607, 1614, 21, 17, + /* 1910 */ 355, 726, 1612, 1611, 356, 1544, 57, 263, 1543, 1910, + /* 1920 */ 170, 1908, 1907, 1891, 1890, 289, 92, 607, 94, 91, + /* 1930 */ 2009, 56, 269, 22, 271, 369, 12, 276, 633, 65, + /* 1940 */ 172, 281, 1575, 1960, 96, 632, 716, 712, 708, 704, + /* 1950 */ 287, 23, 100, 278, 1991, 1420, 171, 183, 2029, 1506, + /* 1960 */ 1451, 1474, 1496, 625, 637, 639, 372, 10, 635, 1495, + /* 1970 */ 1990, 643, 1472, 1233, 2026, 36, 15, 319, 1992, 636, + /* 1980 */ 1994, 1995, 631, 24, 626, 2009, 105, 1471, 25, 280, + /* 1990 */ 371, 1443, 1256, 633, 641, 646, 1253, 644, 1960, 1250, + /* 2000 */ 632, 647, 649, 652, 1244, 1248, 650, 1991, 1242, 653, + /* 2010 */ 101, 659, 102, 284, 1265, 72, 1247, 1246, 1261, 1147, + /* 2020 */ 1245, 669, 612, 1181, 1180, 1990, 1179, 1178, 1177, 2026, + /* 2030 */ 1991, 1200, 319, 1992, 636, 1994, 1995, 631, 2009, 626, + /* 2040 */ 1176, 1174, 1172, 1171, 1170, 681, 633, 285, 1168, 1167, + /* 2050 */ 1166, 1960, 1991, 632, 1165, 1164, 1163, 268, 1162, 1195, + /* 2060 */ 1197, 2009, 267, 1159, 1158, 1155, 1154, 1153, 1152, 633, + /* 2070 */ 1692, 701, 1690, 702, 1960, 1991, 632, 703, 543, 1373, + /* 2080 */ 707, 236, 2026, 2009, 705, 314, 1992, 636, 1994, 1995, + /* 2090 */ 631, 633, 626, 1688, 706, 709, 1960, 1991, 632, 710, + /* 2100 */ 711, 1990, 1686, 713, 714, 2026, 2009, 1672, 303, 1992, + /* 2110 */ 636, 1994, 1995, 631, 633, 626, 715, 717, 1105, 1960, + /* 2120 */ 1652, 632, 288, 1990, 721, 725, 1406, 2026, 2009, 724, + /* 2130 */ 304, 1992, 636, 1994, 1995, 631, 633, 626, 298, 1627, + /* 2140 */ 1627, 1960, 1627, 632, 1627, 1627, 1990, 1627, 1627, 1627, + /* 2150 */ 2026, 1627, 1991, 305, 1992, 636, 1994, 1995, 631, 1627, + /* 2160 */ 626, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1990, 1991, + /* 2170 */ 1627, 1627, 2026, 1627, 1627, 311, 1992, 636, 1994, 1995, + /* 2180 */ 631, 1627, 626, 2009, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2190 */ 1627, 633, 1627, 1627, 1627, 1627, 1960, 1627, 632, 1627, + /* 2200 */ 2009, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 633, 1627, + /* 2210 */ 1627, 1627, 1627, 1960, 1991, 632, 1627, 1627, 1627, 1627, + /* 2220 */ 1627, 1627, 1627, 1990, 1627, 1627, 1627, 2026, 1627, 1627, + /* 2230 */ 315, 1992, 636, 1994, 1995, 631, 1627, 626, 1627, 1627, + /* 2240 */ 1990, 1627, 1627, 1627, 2026, 2009, 1627, 307, 1992, 636, + /* 2250 */ 1994, 1995, 631, 633, 626, 1627, 1627, 1627, 1960, 1627, + /* 2260 */ 632, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2270 */ 1991, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2280 */ 1627, 1627, 1627, 1627, 1627, 1990, 1627, 1627, 1627, 2026, + /* 2290 */ 1627, 1627, 316, 1992, 636, 1994, 1995, 631, 1627, 626, + /* 2300 */ 1991, 2009, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 633, + /* 2310 */ 1627, 1627, 1627, 1627, 1960, 1627, 632, 1627, 1627, 1627, + /* 2320 */ 1627, 1627, 1627, 1991, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2330 */ 1627, 2009, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 633, + /* 2340 */ 1627, 1990, 1627, 1627, 1960, 2026, 632, 1627, 308, 1992, + /* 2350 */ 636, 1994, 1995, 631, 2009, 626, 1627, 1627, 1627, 1627, + /* 2360 */ 1627, 1627, 633, 1627, 1627, 1627, 1627, 1960, 1991, 632, + /* 2370 */ 1627, 1990, 1627, 1627, 1627, 2026, 1627, 1627, 317, 1992, + /* 2380 */ 636, 1994, 1995, 631, 1627, 626, 1627, 1991, 1627, 1627, + /* 2390 */ 1627, 1627, 1627, 1627, 1990, 1627, 1627, 1627, 2026, 2009, + /* 2400 */ 1627, 309, 1992, 636, 1994, 1995, 631, 633, 626, 1627, + /* 2410 */ 1627, 1627, 1960, 1991, 632, 1627, 1627, 1627, 2009, 1627, + /* 2420 */ 1627, 1627, 1627, 1627, 1627, 1627, 633, 1627, 1627, 1627, + /* 2430 */ 1627, 1960, 1627, 632, 1627, 1627, 1627, 1627, 1627, 1990, + /* 2440 */ 1627, 1627, 1627, 2026, 2009, 1627, 322, 1992, 636, 1994, + /* 2450 */ 1995, 631, 633, 626, 1627, 1627, 1627, 1960, 1990, 632, + /* 2460 */ 1627, 1627, 2026, 1627, 1627, 323, 1992, 636, 1994, 1995, + /* 2470 */ 631, 1991, 626, 1627, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2480 */ 1627, 1627, 1627, 1627, 1990, 1627, 1627, 1991, 2026, 1627, + /* 2490 */ 1627, 2003, 1992, 636, 1994, 1995, 631, 1627, 626, 1627, + /* 2500 */ 1627, 1627, 2009, 1627, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2510 */ 633, 1627, 1627, 1627, 1627, 1960, 1627, 632, 2009, 1627, + /* 2520 */ 1627, 1627, 1627, 1627, 1627, 1627, 633, 1627, 1627, 1627, + /* 2530 */ 1627, 1960, 1627, 632, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2540 */ 1627, 1627, 1990, 1991, 1627, 1627, 2026, 1627, 1627, 2002, + /* 2550 */ 1992, 636, 1994, 1995, 631, 1627, 626, 1627, 1990, 1627, + /* 2560 */ 1991, 1627, 2026, 1627, 1627, 2001, 1992, 636, 1994, 1995, + /* 2570 */ 631, 1627, 626, 1627, 2009, 1627, 1627, 1627, 1627, 1627, + /* 2580 */ 1627, 1627, 633, 1627, 1627, 1627, 1627, 1960, 1991, 632, + /* 2590 */ 1627, 2009, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 633, + /* 2600 */ 1627, 1627, 1627, 1627, 1960, 1627, 632, 1627, 1627, 1627, + /* 2610 */ 1627, 1627, 1627, 1627, 1990, 1627, 1627, 1627, 2026, 2009, + /* 2620 */ 1627, 335, 1992, 636, 1994, 1995, 631, 633, 626, 1627, + /* 2630 */ 1627, 1990, 1960, 1627, 632, 2026, 1627, 1627, 336, 1992, + /* 2640 */ 636, 1994, 1995, 631, 1991, 626, 1627, 1627, 1627, 1627, + /* 2650 */ 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1990, + /* 2660 */ 1627, 1991, 1627, 2026, 1627, 1627, 332, 1992, 636, 1994, + /* 2670 */ 1995, 631, 1627, 626, 1627, 2009, 1627, 1627, 1627, 1627, + /* 2680 */ 1627, 1627, 1627, 633, 1627, 1627, 1627, 1627, 1960, 1627, + /* 2690 */ 632, 1627, 2009, 1627, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2700 */ 633, 1627, 1627, 1627, 1627, 1960, 1627, 632, 1627, 1627, + /* 2710 */ 1627, 1627, 1627, 1627, 1627, 1990, 1627, 1991, 1627, 2026, + /* 2720 */ 1627, 1627, 337, 1992, 636, 1994, 1995, 631, 1627, 626, + /* 2730 */ 1627, 1627, 634, 1627, 1627, 1627, 2026, 1627, 1627, 314, + /* 2740 */ 1992, 636, 1994, 1995, 631, 1627, 626, 1627, 2009, 1627, + /* 2750 */ 1627, 1627, 1627, 1627, 1627, 1627, 633, 1627, 1627, 1627, + /* 2760 */ 1627, 1960, 1627, 632, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2770 */ 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, + /* 2780 */ 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1627, 1990, 1627, + /* 2790 */ 1627, 1627, 2026, 1627, 1627, 313, 1992, 636, 1994, 1995, + /* 2800 */ 631, 1627, 626, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 420, 421, 332, 374, 334, 335, 332, 370, 334, 335, - /* 10 */ 373, 374, 12, 13, 14, 361, 387, 388, 360, 14, - /* 20 */ 20, 336, 22, 8, 9, 20, 372, 12, 13, 14, - /* 30 */ 15, 16, 359, 33, 333, 35, 352, 336, 337, 355, - /* 40 */ 431, 20, 8, 9, 435, 20, 12, 13, 14, 15, - /* 50 */ 16, 39, 20, 380, 381, 401, 402, 403, 58, 450, - /* 60 */ 451, 376, 58, 63, 455, 456, 412, 8, 9, 328, - /* 70 */ 70, 12, 13, 14, 15, 16, 333, 20, 336, 336, - /* 80 */ 337, 8, 9, 12, 13, 12, 13, 14, 15, 16, - /* 90 */ 3, 20, 358, 22, 0, 95, 415, 63, 94, 418, - /* 100 */ 359, 97, 95, 44, 33, 371, 35, 20, 367, 367, - /* 110 */ 327, 96, 329, 372, 336, 374, 95, 117, 24, 25, - /* 120 */ 26, 27, 28, 29, 30, 31, 32, 95, 350, 58, - /* 130 */ 340, 343, 132, 133, 63, 357, 348, 79, 104, 398, - /* 140 */ 4, 70, 62, 402, 354, 367, 405, 406, 407, 408, - /* 150 */ 409, 410, 362, 412, 20, 431, 359, 44, 417, 435, - /* 160 */ 419, 161, 162, 366, 423, 424, 95, 167, 168, 427, - /* 170 */ 428, 429, 375, 431, 432, 451, 20, 435, 437, 455, - /* 180 */ 456, 431, 182, 96, 184, 435, 445, 21, 117, 132, - /* 190 */ 133, 58, 450, 451, 160, 137, 138, 455, 456, 95, - /* 200 */ 34, 451, 36, 132, 133, 455, 456, 207, 208, 96, - /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 95, 95, - /* 230 */ 97, 95, 161, 162, 404, 20, 163, 21, 167, 168, - /* 240 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 106, - /* 250 */ 163, 127, 245, 182, 404, 184, 244, 8, 9, 328, - /* 260 */ 430, 12, 13, 14, 15, 16, 232, 233, 234, 235, - /* 270 */ 236, 237, 238, 239, 240, 241, 242, 245, 207, 208, - /* 280 */ 430, 210, 211, 212, 213, 214, 215, 216, 217, 218, - /* 290 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 177, - /* 300 */ 229, 12, 13, 372, 361, 22, 14, 328, 359, 20, - /* 310 */ 22, 22, 20, 189, 190, 372, 367, 193, 35, 195, - /* 320 */ 198, 199, 33, 35, 35, 108, 109, 110, 111, 112, - /* 330 */ 113, 114, 115, 116, 117, 118, 0, 120, 121, 122, - /* 340 */ 123, 124, 125, 33, 401, 402, 403, 58, 35, 245, - /* 350 */ 389, 372, 63, 70, 359, 412, 407, 4, 48, 70, - /* 360 */ 20, 366, 22, 20, 54, 55, 56, 57, 58, 328, - /* 370 */ 375, 328, 12, 13, 14, 35, 161, 162, 245, 245, - /* 380 */ 20, 245, 22, 70, 95, 12, 13, 14, 15, 16, - /* 390 */ 62, 51, 431, 33, 20, 35, 435, 20, 328, 22, - /* 400 */ 117, 65, 66, 67, 94, 4, 117, 97, 0, 73, - /* 410 */ 74, 450, 451, 372, 78, 372, 455, 456, 58, 83, - /* 420 */ 84, 132, 133, 174, 328, 89, 126, 127, 51, 21, - /* 430 */ 70, 131, 24, 25, 26, 27, 28, 29, 30, 31, - /* 440 */ 32, 336, 372, 20, 43, 328, 45, 46, 70, 374, - /* 450 */ 161, 162, 336, 161, 359, 95, 167, 168, 229, 384, - /* 460 */ 231, 366, 387, 388, 336, 182, 350, 184, 372, 44, - /* 470 */ 375, 182, 367, 184, 164, 165, 328, 117, 350, 169, - /* 480 */ 8, 9, 172, 367, 12, 13, 14, 15, 16, 372, - /* 490 */ 207, 208, 132, 133, 342, 367, 207, 208, 188, 210, - /* 500 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - /* 510 */ 221, 222, 223, 224, 225, 226, 227, 365, 269, 20, - /* 520 */ 372, 161, 162, 336, 35, 328, 431, 167, 168, 336, - /* 530 */ 435, 426, 427, 428, 429, 336, 431, 432, 20, 65, - /* 540 */ 66, 67, 182, 350, 184, 450, 451, 73, 74, 350, - /* 550 */ 455, 456, 78, 328, 367, 132, 133, 83, 84, 70, - /* 560 */ 367, 328, 328, 89, 373, 374, 367, 207, 208, 372, - /* 570 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 580 */ 220, 221, 222, 223, 224, 225, 226, 227, 12, 13, - /* 590 */ 167, 168, 359, 0, 342, 351, 20, 372, 22, 246, - /* 600 */ 367, 325, 416, 359, 418, 372, 372, 374, 356, 33, - /* 610 */ 126, 35, 368, 229, 427, 428, 429, 365, 431, 432, - /* 620 */ 8, 9, 328, 404, 12, 13, 14, 15, 16, 4, - /* 630 */ 166, 398, 20, 336, 58, 402, 70, 207, 405, 406, - /* 640 */ 407, 408, 409, 410, 19, 412, 70, 350, 415, 430, - /* 650 */ 417, 418, 419, 359, 357, 62, 423, 424, 33, 12, - /* 660 */ 13, 367, 163, 336, 367, 389, 372, 20, 374, 22, - /* 670 */ 416, 95, 418, 48, 328, 191, 192, 350, 53, 328, - /* 680 */ 33, 163, 35, 58, 361, 95, 256, 257, 258, 259, - /* 690 */ 260, 266, 398, 117, 367, 372, 402, 345, 346, 405, - /* 700 */ 406, 407, 408, 409, 410, 58, 412, 431, 132, 133, - /* 710 */ 0, 435, 393, 351, 250, 251, 252, 70, 372, 94, - /* 720 */ 0, 359, 97, 372, 401, 402, 450, 451, 14, 360, - /* 730 */ 368, 455, 456, 328, 20, 412, 369, 161, 162, 372, - /* 740 */ 446, 447, 95, 167, 168, 336, 8, 9, 160, 360, - /* 750 */ 12, 13, 14, 15, 16, 2, 359, 3, 182, 350, - /* 760 */ 184, 8, 9, 107, 117, 12, 13, 14, 15, 16, - /* 770 */ 360, 181, 62, 183, 328, 163, 367, 372, 381, 132, - /* 780 */ 133, 0, 328, 207, 208, 129, 210, 211, 212, 213, - /* 790 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - /* 800 */ 224, 225, 226, 227, 14, 15, 16, 336, 161, 162, - /* 810 */ 18, 42, 20, 44, 167, 168, 351, 340, 372, 27, - /* 820 */ 232, 350, 30, 360, 359, 33, 372, 107, 360, 182, - /* 830 */ 242, 184, 328, 368, 96, 245, 345, 346, 367, 362, - /* 840 */ 48, 361, 50, 360, 359, 53, 126, 127, 128, 129, - /* 850 */ 130, 131, 372, 368, 207, 208, 20, 210, 211, 212, - /* 860 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - /* 870 */ 223, 224, 225, 226, 227, 161, 372, 347, 20, 349, - /* 880 */ 18, 401, 402, 2, 0, 23, 94, 0, 107, 8, - /* 890 */ 9, 367, 412, 12, 13, 14, 15, 16, 106, 37, - /* 900 */ 38, 359, 378, 41, 367, 367, 329, 126, 127, 128, - /* 910 */ 129, 130, 131, 1, 2, 378, 378, 375, 45, 46, - /* 920 */ 95, 59, 60, 61, 369, 382, 369, 372, 136, 372, - /* 930 */ 105, 139, 140, 141, 142, 143, 144, 145, 146, 147, - /* 940 */ 148, 149, 150, 151, 152, 153, 154, 155, 389, 157, - /* 950 */ 158, 159, 65, 66, 67, 68, 69, 95, 71, 72, - /* 960 */ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - /* 970 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 328, - /* 980 */ 459, 336, 107, 328, 352, 336, 389, 355, 389, 44, - /* 990 */ 431, 243, 244, 336, 435, 350, 134, 161, 348, 350, - /* 1000 */ 328, 126, 127, 128, 129, 130, 131, 350, 96, 450, - /* 1010 */ 451, 42, 367, 44, 455, 456, 367, 99, 264, 106, - /* 1020 */ 102, 163, 99, 372, 367, 102, 163, 372, 431, 336, - /* 1030 */ 431, 359, 435, 170, 435, 151, 174, 175, 176, 367, - /* 1040 */ 336, 179, 336, 350, 372, 35, 374, 450, 451, 450, - /* 1050 */ 451, 448, 455, 456, 455, 456, 350, 0, 389, 197, - /* 1060 */ 367, 336, 200, 58, 202, 203, 204, 205, 206, 156, - /* 1070 */ 398, 367, 328, 367, 402, 350, 35, 405, 406, 407, - /* 1080 */ 408, 409, 410, 336, 412, 99, 44, 99, 102, 417, - /* 1090 */ 102, 419, 367, 0, 338, 423, 424, 350, 336, 336, - /* 1100 */ 431, 0, 97, 359, 435, 48, 0, 245, 336, 63, - /* 1110 */ 37, 367, 350, 350, 367, 22, 372, 445, 374, 450, - /* 1120 */ 451, 47, 350, 22, 455, 456, 328, 336, 22, 367, - /* 1130 */ 367, 427, 428, 429, 44, 431, 432, 442, 96, 367, - /* 1140 */ 44, 350, 398, 132, 133, 359, 402, 44, 338, 405, - /* 1150 */ 406, 407, 408, 409, 410, 13, 412, 359, 367, 44, - /* 1160 */ 44, 417, 382, 419, 44, 367, 335, 423, 424, 95, - /* 1170 */ 372, 98, 374, 100, 101, 44, 103, 35, 434, 13, - /* 1180 */ 107, 0, 371, 336, 44, 44, 96, 328, 1, 2, - /* 1190 */ 382, 44, 96, 433, 184, 44, 398, 350, 452, 96, - /* 1200 */ 402, 35, 129, 405, 406, 407, 408, 409, 410, 425, - /* 1210 */ 412, 96, 96, 268, 367, 417, 96, 419, 359, 436, - /* 1220 */ 44, 423, 424, 44, 247, 184, 367, 96, 12, 13, - /* 1230 */ 49, 372, 434, 374, 400, 180, 96, 96, 22, 44, - /* 1240 */ 48, 399, 391, 96, 42, 379, 20, 96, 379, 33, - /* 1250 */ 328, 35, 382, 207, 160, 377, 20, 398, 379, 377, - /* 1260 */ 336, 402, 336, 377, 405, 406, 407, 408, 409, 410, - /* 1270 */ 328, 412, 96, 93, 58, 96, 417, 344, 419, 336, - /* 1280 */ 336, 359, 423, 424, 336, 20, 70, 330, 330, 367, - /* 1290 */ 20, 96, 395, 434, 372, 342, 374, 342, 20, 374, - /* 1300 */ 20, 359, 337, 20, 390, 342, 342, 337, 342, 367, - /* 1310 */ 342, 336, 52, 342, 372, 339, 374, 339, 359, 330, - /* 1320 */ 398, 359, 330, 336, 402, 196, 359, 405, 406, 407, - /* 1330 */ 408, 409, 410, 117, 412, 397, 395, 340, 359, 417, - /* 1340 */ 398, 419, 359, 359, 402, 423, 424, 405, 406, 407, - /* 1350 */ 408, 409, 410, 359, 412, 359, 434, 359, 359, 417, - /* 1360 */ 359, 419, 372, 372, 187, 423, 424, 394, 340, 374, - /* 1370 */ 19, 336, 255, 328, 372, 382, 434, 441, 254, 372, - /* 1380 */ 441, 372, 382, 261, 33, 372, 173, 440, 385, 385, - /* 1390 */ 444, 441, 443, 263, 262, 439, 248, 270, 182, 48, - /* 1400 */ 184, 267, 265, 244, 359, 54, 55, 56, 57, 58, - /* 1410 */ 438, 460, 367, 453, 400, 454, 367, 372, 20, 374, - /* 1420 */ 404, 336, 340, 207, 208, 337, 372, 165, 385, 385, - /* 1430 */ 372, 372, 328, 372, 372, 372, 220, 221, 222, 223, - /* 1440 */ 224, 225, 226, 398, 355, 94, 367, 402, 97, 383, - /* 1450 */ 405, 406, 407, 408, 409, 410, 95, 412, 340, 340, - /* 1460 */ 422, 95, 417, 359, 419, 363, 340, 372, 423, 424, - /* 1470 */ 349, 367, 336, 36, 331, 330, 372, 396, 374, 392, - /* 1480 */ 326, 130, 0, 386, 386, 341, 328, 0, 353, 189, - /* 1490 */ 0, 353, 353, 0, 42, 0, 35, 201, 35, 35, - /* 1500 */ 35, 0, 398, 201, 35, 35, 402, 201, 0, 405, - /* 1510 */ 406, 407, 408, 409, 410, 201, 412, 359, 0, 35, - /* 1520 */ 169, 417, 0, 419, 22, 367, 35, 423, 424, 0, - /* 1530 */ 372, 184, 374, 0, 182, 0, 178, 186, 0, 188, - /* 1540 */ 177, 0, 0, 47, 0, 0, 42, 328, 0, 0, - /* 1550 */ 0, 0, 0, 0, 0, 0, 398, 151, 35, 0, - /* 1560 */ 402, 151, 0, 405, 406, 407, 408, 409, 410, 0, - /* 1570 */ 412, 0, 0, 0, 0, 417, 0, 419, 359, 0, - /* 1580 */ 0, 423, 424, 0, 0, 0, 367, 0, 0, 0, - /* 1590 */ 0, 372, 0, 374, 135, 0, 0, 22, 42, 0, - /* 1600 */ 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, - /* 1610 */ 42, 44, 35, 47, 0, 58, 58, 398, 0, 14, - /* 1620 */ 39, 402, 40, 0, 405, 406, 407, 408, 409, 410, - /* 1630 */ 14, 412, 0, 47, 0, 173, 359, 39, 419, 0, - /* 1640 */ 47, 0, 423, 424, 367, 0, 0, 35, 0, 372, - /* 1650 */ 39, 374, 39, 0, 35, 64, 39, 35, 48, 328, - /* 1660 */ 39, 0, 35, 48, 39, 0, 0, 0, 48, 0, - /* 1670 */ 35, 22, 48, 0, 104, 398, 22, 35, 35, 402, - /* 1680 */ 44, 44, 405, 406, 407, 408, 409, 410, 328, 412, - /* 1690 */ 359, 35, 35, 35, 35, 35, 419, 0, 367, 102, - /* 1700 */ 423, 424, 22, 372, 0, 374, 22, 0, 22, 35, - /* 1710 */ 0, 35, 50, 0, 35, 0, 22, 35, 20, 359, - /* 1720 */ 35, 194, 96, 95, 0, 35, 163, 367, 0, 398, - /* 1730 */ 22, 185, 372, 402, 374, 0, 405, 406, 407, 408, - /* 1740 */ 409, 410, 0, 412, 3, 95, 328, 44, 249, 228, - /* 1750 */ 419, 96, 47, 253, 423, 424, 44, 3, 398, 95, - /* 1760 */ 44, 47, 402, 44, 96, 405, 406, 407, 408, 409, - /* 1770 */ 410, 411, 412, 413, 414, 44, 95, 359, 35, 249, - /* 1780 */ 249, 35, 35, 96, 95, 367, 95, 35, 96, 96, - /* 1790 */ 372, 95, 374, 163, 165, 96, 163, 35, 35, 0, - /* 1800 */ 328, 44, 171, 47, 243, 96, 47, 96, 170, 0, - /* 1810 */ 170, 0, 95, 166, 96, 95, 398, 96, 95, 0, - /* 1820 */ 402, 95, 39, 405, 406, 407, 408, 409, 410, 95, - /* 1830 */ 412, 359, 105, 47, 164, 44, 2, 22, 22, 367, - /* 1840 */ 95, 47, 47, 95, 372, 96, 374, 96, 95, 35, - /* 1850 */ 106, 119, 35, 95, 328, 35, 96, 96, 207, 95, - /* 1860 */ 95, 209, 96, 95, 35, 96, 95, 35, 35, 96, - /* 1870 */ 398, 95, 228, 96, 402, 457, 458, 405, 406, 407, - /* 1880 */ 408, 409, 410, 95, 412, 359, 96, 95, 22, 119, - /* 1890 */ 44, 419, 107, 367, 119, 95, 424, 119, 372, 95, - /* 1900 */ 374, 230, 35, 228, 22, 95, 328, 64, 63, 35, - /* 1910 */ 35, 35, 35, 35, 35, 35, 35, 70, 35, 35, - /* 1920 */ 92, 35, 328, 35, 398, 35, 22, 70, 402, 44, - /* 1930 */ 35, 405, 406, 407, 408, 409, 410, 359, 412, 22, - /* 1940 */ 35, 35, 35, 35, 35, 367, 35, 35, 35, 0, - /* 1950 */ 372, 35, 374, 359, 39, 0, 35, 39, 48, 0, - /* 1960 */ 35, 367, 48, 39, 0, 35, 372, 48, 374, 0, - /* 1970 */ 48, 39, 35, 447, 35, 0, 398, 20, 22, 21, - /* 1980 */ 402, 461, 22, 405, 406, 407, 408, 409, 410, 21, - /* 1990 */ 412, 461, 398, 22, 461, 461, 402, 461, 461, 405, - /* 2000 */ 406, 407, 408, 409, 410, 461, 412, 461, 461, 461, - /* 2010 */ 461, 328, 461, 461, 461, 461, 461, 461, 461, 461, - /* 2020 */ 461, 461, 461, 461, 461, 461, 461, 449, 461, 328, - /* 2030 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - /* 2040 */ 461, 461, 359, 461, 461, 461, 461, 364, 461, 461, - /* 2050 */ 367, 461, 458, 461, 461, 372, 461, 374, 461, 461, - /* 2060 */ 359, 461, 461, 461, 461, 461, 461, 461, 367, 461, - /* 2070 */ 461, 461, 461, 372, 461, 374, 461, 461, 461, 461, - /* 2080 */ 461, 398, 461, 328, 461, 402, 461, 461, 405, 406, - /* 2090 */ 407, 408, 409, 410, 461, 412, 461, 461, 461, 398, - /* 2100 */ 328, 461, 461, 402, 461, 461, 405, 406, 407, 408, - /* 2110 */ 409, 410, 461, 412, 359, 414, 461, 461, 461, 364, - /* 2120 */ 461, 461, 367, 461, 461, 461, 461, 372, 461, 374, - /* 2130 */ 461, 359, 461, 461, 461, 461, 364, 461, 461, 367, - /* 2140 */ 461, 461, 461, 461, 372, 461, 374, 461, 461, 461, - /* 2150 */ 461, 461, 328, 398, 461, 461, 461, 402, 461, 461, - /* 2160 */ 405, 406, 407, 408, 409, 410, 461, 412, 328, 461, - /* 2170 */ 398, 461, 461, 461, 402, 461, 461, 405, 406, 407, - /* 2180 */ 408, 409, 410, 359, 412, 461, 461, 461, 461, 461, - /* 2190 */ 461, 367, 461, 461, 461, 461, 372, 461, 374, 359, - /* 2200 */ 461, 461, 461, 461, 461, 461, 461, 367, 461, 461, - /* 2210 */ 461, 461, 372, 461, 374, 461, 461, 461, 461, 461, - /* 2220 */ 328, 461, 398, 461, 461, 461, 402, 461, 461, 405, - /* 2230 */ 406, 407, 408, 409, 410, 461, 412, 461, 398, 461, - /* 2240 */ 461, 461, 402, 461, 461, 405, 406, 407, 408, 409, - /* 2250 */ 410, 359, 412, 461, 461, 461, 461, 461, 461, 367, - /* 2260 */ 461, 461, 461, 461, 372, 461, 374, 461, 461, 461, - /* 2270 */ 461, 461, 461, 461, 328, 461, 461, 461, 461, 461, - /* 2280 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - /* 2290 */ 398, 461, 461, 461, 402, 328, 461, 405, 406, 407, - /* 2300 */ 408, 409, 410, 461, 412, 359, 461, 461, 461, 461, - /* 2310 */ 461, 461, 461, 367, 461, 461, 461, 461, 372, 461, - /* 2320 */ 374, 461, 461, 461, 461, 461, 359, 461, 461, 461, - /* 2330 */ 461, 461, 461, 461, 367, 461, 461, 461, 461, 372, - /* 2340 */ 461, 374, 461, 461, 398, 461, 461, 461, 402, 461, - /* 2350 */ 461, 405, 406, 407, 408, 409, 410, 461, 412, 461, - /* 2360 */ 461, 461, 461, 461, 461, 398, 461, 461, 461, 402, - /* 2370 */ 461, 328, 405, 406, 407, 408, 409, 410, 461, 412, - /* 2380 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 328, - /* 2390 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - /* 2400 */ 461, 461, 359, 461, 461, 461, 461, 461, 461, 461, - /* 2410 */ 367, 461, 461, 461, 461, 372, 461, 374, 461, 461, - /* 2420 */ 359, 461, 461, 461, 461, 461, 461, 461, 367, 461, - /* 2430 */ 461, 461, 461, 372, 461, 374, 461, 461, 461, 461, - /* 2440 */ 461, 398, 461, 328, 461, 402, 461, 461, 405, 406, - /* 2450 */ 407, 408, 409, 410, 461, 412, 461, 461, 461, 398, - /* 2460 */ 328, 461, 461, 402, 461, 461, 405, 406, 407, 408, - /* 2470 */ 409, 410, 461, 412, 359, 461, 461, 461, 461, 461, - /* 2480 */ 461, 461, 367, 461, 461, 461, 461, 372, 461, 374, - /* 2490 */ 461, 359, 461, 461, 461, 461, 461, 461, 461, 367, - /* 2500 */ 461, 461, 461, 461, 372, 461, 374, 461, 461, 461, - /* 2510 */ 461, 461, 328, 398, 461, 461, 461, 402, 461, 461, - /* 2520 */ 405, 406, 407, 408, 409, 410, 461, 412, 328, 461, - /* 2530 */ 398, 461, 461, 461, 402, 461, 461, 405, 406, 407, - /* 2540 */ 408, 409, 410, 359, 412, 461, 461, 461, 461, 461, - /* 2550 */ 461, 367, 461, 461, 461, 461, 372, 461, 374, 359, - /* 2560 */ 461, 461, 461, 461, 461, 461, 461, 367, 461, 461, - /* 2570 */ 461, 461, 372, 461, 374, 461, 461, 461, 461, 461, - /* 2580 */ 328, 461, 398, 461, 461, 461, 402, 461, 461, 405, - /* 2590 */ 406, 407, 408, 409, 410, 461, 412, 461, 398, 461, - /* 2600 */ 461, 461, 402, 328, 461, 405, 406, 407, 408, 409, - /* 2610 */ 410, 359, 412, 461, 461, 461, 461, 461, 461, 367, - /* 2620 */ 461, 461, 461, 461, 372, 461, 374, 461, 461, 461, - /* 2630 */ 461, 461, 461, 461, 359, 461, 461, 461, 461, 461, - /* 2640 */ 461, 461, 367, 461, 461, 461, 461, 372, 461, 374, - /* 2650 */ 398, 461, 461, 461, 402, 328, 461, 405, 406, 407, - /* 2660 */ 408, 409, 410, 461, 412, 461, 461, 461, 461, 461, - /* 2670 */ 461, 461, 461, 398, 461, 461, 461, 402, 461, 461, - /* 2680 */ 405, 406, 407, 408, 409, 410, 359, 412, 461, 461, - /* 2690 */ 461, 461, 461, 461, 367, 461, 461, 461, 461, 372, - /* 2700 */ 461, 374, 461, 461, 461, 461, 461, 461, 461, 461, - /* 2710 */ 461, 461, 461, 461, 461, 461, 461, 461, 328, 461, - /* 2720 */ 461, 461, 461, 461, 461, 398, 461, 461, 461, 402, - /* 2730 */ 461, 461, 405, 406, 407, 408, 409, 410, 461, 412, - /* 2740 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 359, - /* 2750 */ 461, 461, 461, 461, 461, 461, 461, 367, 461, 461, - /* 2760 */ 461, 461, 372, 461, 374, 461, 461, 461, 461, 461, - /* 2770 */ 328, 461, 461, 461, 461, 461, 461, 461, 461, 461, - /* 2780 */ 461, 461, 461, 461, 461, 461, 461, 461, 398, 328, - /* 2790 */ 461, 461, 402, 461, 461, 405, 406, 407, 408, 409, - /* 2800 */ 410, 359, 412, 461, 461, 461, 461, 461, 461, 367, - /* 2810 */ 461, 461, 461, 461, 372, 461, 374, 461, 461, 461, - /* 2820 */ 359, 461, 461, 461, 461, 461, 461, 461, 367, 461, - /* 2830 */ 461, 461, 461, 372, 461, 374, 461, 461, 461, 461, - /* 2840 */ 398, 328, 461, 461, 402, 461, 461, 405, 406, 407, - /* 2850 */ 408, 409, 410, 461, 412, 461, 461, 328, 461, 398, - /* 2860 */ 461, 461, 461, 402, 461, 461, 405, 406, 407, 408, - /* 2870 */ 409, 410, 359, 412, 461, 461, 461, 461, 461, 461, - /* 2880 */ 367, 461, 461, 461, 461, 372, 461, 374, 359, 461, - /* 2890 */ 461, 461, 461, 461, 461, 461, 367, 461, 461, 461, - /* 2900 */ 461, 372, 461, 374, 461, 461, 461, 461, 461, 328, - /* 2910 */ 461, 398, 461, 461, 461, 402, 461, 461, 405, 406, - /* 2920 */ 407, 408, 409, 410, 461, 412, 461, 398, 461, 461, - /* 2930 */ 461, 402, 328, 461, 405, 406, 407, 408, 409, 410, - /* 2940 */ 359, 412, 461, 461, 461, 461, 461, 461, 367, 461, - /* 2950 */ 461, 461, 461, 372, 461, 374, 461, 461, 461, 461, - /* 2960 */ 461, 461, 461, 359, 461, 461, 461, 461, 461, 461, - /* 2970 */ 461, 367, 461, 461, 461, 461, 372, 461, 374, 398, - /* 2980 */ 461, 461, 461, 402, 328, 461, 405, 406, 407, 408, - /* 2990 */ 409, 410, 461, 412, 461, 461, 461, 461, 461, 461, - /* 3000 */ 461, 461, 398, 461, 461, 461, 402, 461, 461, 405, - /* 3010 */ 406, 407, 408, 409, 410, 359, 412, 461, 461, 461, - /* 3020 */ 461, 461, 461, 367, 461, 461, 461, 461, 372, 461, - /* 3030 */ 374, 461, 461, 461, 461, 461, 461, 461, 461, 461, - /* 3040 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - /* 3050 */ 461, 461, 461, 461, 398, 461, 461, 461, 402, 461, - /* 3060 */ 461, 405, 406, 407, 408, 409, 410, 461, 412, 325, - /* 3070 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3080 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3090 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3100 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3110 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3120 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3130 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3140 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3150 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3160 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3170 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3180 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3190 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3200 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3210 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3220 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3230 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3240 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3250 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3260 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3270 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3280 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3290 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3300 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3310 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3320 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3330 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3340 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3350 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3360 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3370 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3380 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3390 */ 325, 325, 325, 325, + /* 0 */ 422, 423, 361, 375, 433, 375, 353, 433, 437, 356, + /* 10 */ 362, 437, 12, 13, 14, 385, 388, 389, 388, 389, + /* 20 */ 20, 373, 22, 362, 453, 0, 452, 453, 457, 458, + /* 30 */ 329, 457, 458, 33, 373, 35, 12, 13, 14, 15, + /* 40 */ 16, 21, 8, 9, 362, 3, 12, 13, 14, 15, + /* 50 */ 16, 403, 404, 405, 34, 373, 36, 337, 58, 20, + /* 60 */ 326, 360, 414, 63, 403, 404, 405, 14, 371, 368, + /* 70 */ 70, 374, 375, 20, 373, 414, 375, 333, 337, 335, + /* 80 */ 336, 20, 360, 12, 13, 403, 404, 62, 368, 367, + /* 90 */ 20, 20, 328, 22, 330, 95, 414, 63, 376, 334, + /* 100 */ 337, 400, 337, 338, 33, 404, 35, 20, 407, 408, + /* 110 */ 409, 410, 411, 412, 351, 414, 337, 117, 377, 433, + /* 120 */ 419, 358, 421, 437, 390, 368, 425, 426, 20, 58, + /* 130 */ 351, 368, 132, 133, 63, 20, 379, 358, 104, 453, + /* 140 */ 439, 70, 334, 457, 458, 337, 338, 368, 447, 429, + /* 150 */ 430, 431, 360, 433, 434, 433, 360, 437, 4, 437, + /* 160 */ 360, 369, 162, 163, 368, 95, 95, 433, 168, 169, + /* 170 */ 20, 437, 452, 453, 452, 453, 337, 457, 458, 457, + /* 180 */ 458, 381, 382, 183, 360, 185, 452, 453, 117, 37, + /* 190 */ 351, 457, 458, 132, 133, 161, 0, 43, 58, 45, + /* 200 */ 46, 162, 163, 132, 133, 409, 382, 368, 208, 209, + /* 210 */ 95, 211, 212, 213, 214, 215, 216, 217, 218, 219, + /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 168, + /* 230 */ 169, 126, 127, 162, 163, 95, 131, 97, 21, 168, + /* 240 */ 169, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 250 */ 98, 164, 100, 101, 183, 103, 185, 8, 9, 107, + /* 260 */ 62, 12, 13, 14, 15, 16, 208, 233, 234, 235, + /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 95, 208, + /* 280 */ 209, 129, 211, 212, 213, 214, 215, 216, 217, 218, + /* 290 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + /* 300 */ 95, 230, 12, 13, 0, 20, 20, 265, 22, 22, + /* 310 */ 20, 417, 22, 362, 420, 257, 258, 259, 260, 261, + /* 320 */ 329, 35, 35, 33, 373, 35, 108, 109, 110, 111, + /* 330 */ 112, 113, 114, 115, 116, 117, 118, 51, 120, 121, + /* 340 */ 122, 123, 124, 125, 35, 96, 95, 151, 58, 343, + /* 350 */ 4, 360, 14, 63, 403, 404, 160, 70, 20, 368, + /* 360 */ 70, 246, 341, 357, 373, 414, 375, 374, 375, 65, + /* 370 */ 66, 67, 366, 12, 13, 14, 355, 73, 74, 70, + /* 380 */ 95, 20, 78, 22, 363, 95, 246, 83, 84, 3, + /* 390 */ 343, 400, 344, 89, 33, 404, 35, 349, 407, 408, + /* 400 */ 409, 410, 411, 412, 117, 414, 20, 117, 417, 20, + /* 410 */ 419, 420, 421, 366, 2, 33, 425, 426, 0, 58, + /* 420 */ 8, 9, 132, 133, 12, 13, 14, 15, 16, 246, + /* 430 */ 48, 70, 230, 182, 232, 184, 54, 55, 56, 57, + /* 440 */ 58, 95, 24, 25, 26, 27, 28, 29, 30, 31, + /* 450 */ 32, 246, 162, 163, 20, 167, 95, 14, 168, 169, + /* 460 */ 0, 8, 9, 20, 360, 12, 13, 14, 15, 16, + /* 470 */ 183, 367, 185, 183, 353, 185, 94, 356, 117, 97, + /* 480 */ 376, 21, 96, 0, 24, 25, 26, 27, 28, 29, + /* 490 */ 30, 31, 32, 132, 133, 208, 209, 246, 208, 209, + /* 500 */ 162, 211, 212, 213, 214, 215, 216, 217, 218, 219, + /* 510 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 65, + /* 520 */ 66, 67, 20, 162, 163, 346, 347, 73, 74, 168, + /* 530 */ 169, 246, 78, 333, 352, 335, 336, 83, 84, 251, + /* 540 */ 252, 253, 360, 89, 183, 62, 185, 165, 166, 44, + /* 550 */ 164, 369, 170, 8, 9, 173, 79, 12, 13, 14, + /* 560 */ 15, 16, 337, 62, 329, 20, 132, 133, 106, 208, + /* 570 */ 209, 189, 211, 212, 213, 214, 215, 216, 217, 218, + /* 580 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + /* 590 */ 12, 13, 246, 368, 370, 360, 329, 373, 20, 352, + /* 600 */ 22, 96, 360, 368, 359, 162, 230, 360, 373, 367, + /* 610 */ 375, 33, 127, 35, 137, 138, 369, 372, 376, 8, + /* 620 */ 9, 329, 360, 12, 13, 14, 15, 16, 175, 367, + /* 630 */ 14, 15, 16, 337, 360, 400, 58, 160, 376, 404, + /* 640 */ 373, 367, 407, 408, 409, 410, 411, 412, 70, 414, + /* 650 */ 376, 70, 360, 428, 429, 430, 431, 70, 433, 434, + /* 660 */ 368, 12, 13, 337, 368, 373, 337, 375, 341, 20, + /* 670 */ 352, 22, 329, 95, 337, 190, 191, 351, 360, 194, + /* 680 */ 351, 196, 33, 20, 35, 22, 451, 369, 351, 329, + /* 690 */ 363, 418, 400, 420, 368, 117, 404, 368, 330, 407, + /* 700 */ 408, 409, 410, 411, 412, 368, 414, 58, 337, 164, + /* 710 */ 132, 133, 126, 421, 51, 178, 373, 425, 426, 70, + /* 720 */ 360, 368, 351, 270, 0, 429, 430, 431, 368, 433, + /* 730 */ 434, 337, 379, 373, 337, 375, 199, 200, 361, 368, + /* 740 */ 162, 163, 346, 347, 95, 351, 168, 169, 351, 8, + /* 750 */ 9, 1, 2, 12, 13, 14, 15, 16, 406, 0, + /* 760 */ 400, 183, 368, 185, 404, 368, 117, 407, 408, 409, + /* 770 */ 410, 411, 412, 413, 414, 415, 416, 370, 192, 193, + /* 780 */ 373, 132, 133, 20, 432, 44, 208, 209, 337, 211, + /* 790 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + /* 800 */ 222, 223, 224, 225, 226, 227, 228, 337, 49, 337, + /* 810 */ 337, 162, 163, 18, 107, 20, 337, 168, 169, 368, + /* 820 */ 58, 351, 27, 351, 351, 30, 360, 418, 33, 420, + /* 830 */ 351, 107, 183, 368, 185, 329, 129, 161, 368, 20, + /* 840 */ 368, 368, 376, 48, 379, 50, 96, 368, 53, 20, + /* 850 */ 126, 127, 128, 129, 130, 131, 94, 208, 209, 97, + /* 860 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + /* 870 */ 221, 222, 223, 224, 225, 226, 227, 228, 0, 373, + /* 880 */ 429, 430, 431, 18, 433, 434, 2, 406, 23, 94, + /* 890 */ 0, 337, 8, 9, 406, 4, 12, 13, 14, 15, + /* 900 */ 16, 106, 37, 38, 370, 351, 41, 373, 39, 233, + /* 910 */ 8, 9, 44, 432, 12, 13, 14, 15, 16, 243, + /* 920 */ 432, 348, 368, 350, 59, 60, 61, 164, 45, 46, + /* 930 */ 63, 136, 244, 245, 139, 140, 141, 142, 143, 144, + /* 940 */ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + /* 950 */ 155, 329, 157, 158, 159, 65, 66, 67, 68, 69, + /* 960 */ 95, 71, 72, 73, 74, 75, 76, 77, 78, 79, + /* 970 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + /* 980 */ 90, 91, 360, 164, 329, 107, 58, 42, 337, 44, + /* 990 */ 368, 162, 361, 329, 107, 373, 337, 375, 96, 134, + /* 1000 */ 329, 0, 351, 106, 126, 127, 128, 129, 130, 131, + /* 1010 */ 351, 44, 329, 126, 127, 128, 129, 130, 131, 368, + /* 1020 */ 394, 42, 400, 44, 337, 97, 404, 368, 373, 407, + /* 1030 */ 408, 409, 410, 411, 412, 4, 414, 373, 351, 361, + /* 1040 */ 175, 176, 177, 360, 373, 180, 337, 337, 349, 48, + /* 1050 */ 19, 368, 329, 156, 22, 368, 373, 361, 375, 329, + /* 1060 */ 351, 351, 99, 198, 33, 102, 201, 35, 203, 204, + /* 1070 */ 205, 206, 207, 99, 329, 208, 102, 368, 368, 48, + /* 1080 */ 390, 459, 460, 400, 53, 337, 337, 404, 47, 58, + /* 1090 */ 407, 408, 409, 410, 411, 412, 373, 414, 337, 351, + /* 1100 */ 351, 337, 419, 373, 421, 360, 461, 99, 425, 426, + /* 1110 */ 102, 246, 351, 368, 245, 351, 368, 368, 373, 329, + /* 1120 */ 375, 99, 0, 433, 102, 94, 164, 437, 97, 368, + /* 1130 */ 447, 361, 368, 171, 132, 133, 95, 269, 247, 329, + /* 1140 */ 329, 329, 452, 453, 22, 400, 35, 457, 458, 404, + /* 1150 */ 360, 329, 407, 408, 409, 410, 411, 412, 368, 414, + /* 1160 */ 0, 44, 361, 373, 419, 375, 421, 383, 329, 35, + /* 1170 */ 425, 426, 8, 9, 0, 329, 12, 13, 14, 15, + /* 1180 */ 16, 436, 22, 373, 373, 373, 329, 329, 329, 329, + /* 1190 */ 400, 329, 450, 329, 404, 373, 22, 407, 408, 409, + /* 1200 */ 410, 411, 412, 360, 414, 329, 360, 383, 35, 419, + /* 1210 */ 44, 421, 373, 96, 368, 425, 426, 12, 13, 373, + /* 1220 */ 339, 375, 44, 1, 2, 44, 436, 22, 339, 44, + /* 1230 */ 373, 373, 373, 373, 267, 373, 360, 373, 33, 44, + /* 1240 */ 35, 44, 44, 70, 368, 336, 400, 44, 444, 373, + /* 1250 */ 404, 375, 372, 407, 408, 409, 410, 411, 412, 44, + /* 1260 */ 414, 329, 96, 58, 427, 419, 435, 421, 44, 44, + /* 1270 */ 454, 425, 426, 438, 96, 70, 400, 96, 44, 44, + /* 1280 */ 404, 96, 436, 407, 408, 409, 410, 411, 412, 383, + /* 1290 */ 414, 96, 360, 96, 96, 419, 185, 421, 44, 96, + /* 1300 */ 368, 425, 426, 44, 13, 373, 248, 375, 44, 402, + /* 1310 */ 48, 96, 436, 95, 401, 13, 390, 181, 42, 185, + /* 1320 */ 96, 96, 117, 105, 380, 392, 35, 20, 164, 390, + /* 1330 */ 96, 96, 400, 383, 380, 378, 404, 35, 390, 407, + /* 1340 */ 408, 409, 410, 411, 412, 161, 414, 20, 337, 337, + /* 1350 */ 96, 419, 380, 421, 378, 96, 390, 425, 426, 433, + /* 1360 */ 96, 378, 93, 437, 345, 337, 337, 337, 436, 20, + /* 1370 */ 331, 329, 433, 20, 331, 20, 437, 396, 452, 453, + /* 1380 */ 343, 433, 375, 457, 458, 437, 20, 343, 183, 338, + /* 1390 */ 185, 452, 453, 20, 391, 343, 457, 458, 338, 433, + /* 1400 */ 452, 453, 360, 437, 343, 457, 458, 343, 343, 337, + /* 1410 */ 368, 343, 52, 208, 209, 373, 340, 375, 452, 453, + /* 1420 */ 340, 331, 360, 457, 458, 337, 221, 222, 223, 224, + /* 1430 */ 225, 226, 227, 360, 329, 360, 373, 360, 360, 360, + /* 1440 */ 331, 360, 400, 360, 360, 360, 404, 360, 399, 407, + /* 1450 */ 408, 409, 410, 411, 412, 373, 414, 197, 95, 341, + /* 1460 */ 188, 419, 395, 421, 398, 360, 396, 425, 426, 375, + /* 1470 */ 341, 373, 337, 368, 383, 383, 256, 443, 373, 329, + /* 1480 */ 375, 255, 386, 373, 446, 386, 373, 373, 443, 262, + /* 1490 */ 174, 445, 264, 443, 263, 442, 441, 249, 462, 440, + /* 1500 */ 271, 268, 402, 456, 266, 400, 245, 368, 20, 404, + /* 1510 */ 360, 455, 407, 408, 409, 410, 411, 412, 368, 414, + /* 1520 */ 337, 406, 373, 373, 419, 375, 421, 338, 341, 341, + /* 1530 */ 425, 426, 386, 386, 373, 329, 373, 166, 373, 384, + /* 1540 */ 373, 373, 341, 341, 368, 95, 356, 424, 95, 350, + /* 1550 */ 400, 337, 373, 341, 404, 364, 36, 407, 408, 409, + /* 1560 */ 410, 411, 412, 331, 414, 393, 360, 397, 332, 419, + /* 1570 */ 354, 421, 327, 387, 368, 425, 426, 354, 0, 373, + /* 1580 */ 329, 375, 342, 387, 354, 0, 190, 0, 0, 42, + /* 1590 */ 0, 35, 202, 35, 35, 35, 202, 0, 35, 35, + /* 1600 */ 202, 0, 202, 0, 35, 0, 400, 0, 22, 35, + /* 1610 */ 404, 360, 183, 407, 408, 409, 410, 411, 412, 368, + /* 1620 */ 414, 185, 0, 0, 373, 329, 375, 421, 179, 178, + /* 1630 */ 0, 425, 426, 0, 0, 0, 47, 0, 42, 0, + /* 1640 */ 0, 0, 329, 0, 0, 0, 0, 0, 151, 35, + /* 1650 */ 0, 400, 151, 0, 0, 404, 360, 0, 407, 408, + /* 1660 */ 409, 410, 411, 412, 368, 414, 0, 0, 0, 373, + /* 1670 */ 0, 375, 421, 360, 0, 0, 425, 426, 42, 0, + /* 1680 */ 0, 368, 0, 0, 0, 0, 373, 329, 375, 0, + /* 1690 */ 0, 0, 0, 0, 0, 0, 400, 0, 22, 0, + /* 1700 */ 404, 135, 0, 407, 408, 409, 410, 411, 412, 0, + /* 1710 */ 414, 0, 35, 400, 0, 0, 58, 404, 360, 58, + /* 1720 */ 407, 408, 409, 410, 411, 412, 368, 414, 0, 0, + /* 1730 */ 42, 373, 14, 375, 421, 39, 14, 0, 0, 426, + /* 1740 */ 329, 0, 44, 0, 448, 449, 40, 47, 0, 39, + /* 1750 */ 47, 47, 39, 174, 0, 0, 329, 0, 400, 0, + /* 1760 */ 35, 0, 404, 39, 48, 407, 408, 409, 410, 411, + /* 1770 */ 412, 360, 414, 39, 35, 48, 64, 0, 48, 368, + /* 1780 */ 35, 39, 0, 48, 373, 35, 375, 360, 39, 0, + /* 1790 */ 0, 0, 365, 0, 22, 368, 0, 35, 35, 35, + /* 1800 */ 373, 35, 375, 22, 35, 0, 35, 449, 22, 329, + /* 1810 */ 35, 400, 104, 35, 44, 404, 0, 44, 407, 408, + /* 1820 */ 409, 410, 411, 412, 22, 414, 50, 400, 102, 0, + /* 1830 */ 22, 404, 35, 0, 407, 408, 409, 410, 411, 412, + /* 1840 */ 360, 414, 35, 0, 35, 0, 22, 20, 368, 35, + /* 1850 */ 35, 195, 96, 373, 0, 375, 35, 0, 186, 22, + /* 1860 */ 95, 0, 0, 3, 44, 250, 254, 229, 250, 164, + /* 1870 */ 96, 460, 44, 166, 95, 95, 44, 47, 47, 96, + /* 1880 */ 400, 164, 95, 164, 404, 44, 3, 407, 408, 409, + /* 1890 */ 410, 411, 412, 172, 414, 96, 416, 96, 95, 329, + /* 1900 */ 96, 95, 171, 171, 35, 95, 35, 96, 44, 250, + /* 1910 */ 35, 19, 35, 35, 35, 96, 44, 47, 96, 0, + /* 1920 */ 47, 0, 0, 0, 0, 33, 39, 167, 39, 95, + /* 1930 */ 360, 244, 96, 95, 95, 365, 2, 95, 368, 95, + /* 1940 */ 48, 47, 96, 373, 95, 375, 54, 55, 56, 57, + /* 1950 */ 58, 44, 105, 165, 329, 22, 47, 47, 95, 208, + /* 1960 */ 22, 96, 229, 95, 106, 35, 35, 231, 210, 229, + /* 1970 */ 400, 35, 96, 22, 404, 95, 95, 407, 408, 409, + /* 1980 */ 410, 411, 412, 95, 414, 360, 94, 96, 95, 97, + /* 1990 */ 365, 96, 96, 368, 95, 35, 96, 95, 373, 96, + /* 2000 */ 375, 95, 35, 35, 96, 119, 95, 329, 96, 95, + /* 2010 */ 95, 107, 95, 44, 35, 95, 119, 119, 22, 64, + /* 2020 */ 119, 63, 130, 35, 35, 400, 35, 35, 35, 404, + /* 2030 */ 329, 70, 407, 408, 409, 410, 411, 412, 360, 414, + /* 2040 */ 35, 35, 35, 35, 35, 92, 368, 44, 35, 35, + /* 2050 */ 35, 373, 329, 375, 22, 35, 35, 165, 35, 35, + /* 2060 */ 70, 360, 170, 35, 35, 35, 35, 22, 35, 368, + /* 2070 */ 0, 35, 0, 48, 373, 329, 375, 39, 400, 187, + /* 2080 */ 39, 189, 404, 360, 35, 407, 408, 409, 410, 411, + /* 2090 */ 412, 368, 414, 0, 48, 35, 373, 329, 375, 48, + /* 2100 */ 39, 400, 0, 35, 48, 404, 360, 0, 407, 408, + /* 2110 */ 409, 410, 411, 412, 368, 414, 39, 35, 35, 373, + /* 2120 */ 0, 375, 22, 400, 21, 20, 22, 404, 360, 21, + /* 2130 */ 407, 408, 409, 410, 411, 412, 368, 414, 22, 463, + /* 2140 */ 463, 373, 463, 375, 463, 463, 400, 463, 463, 463, + /* 2150 */ 404, 463, 329, 407, 408, 409, 410, 411, 412, 463, + /* 2160 */ 414, 463, 463, 463, 463, 463, 463, 463, 400, 329, + /* 2170 */ 463, 463, 404, 463, 463, 407, 408, 409, 410, 411, + /* 2180 */ 412, 463, 414, 360, 463, 463, 463, 463, 463, 463, + /* 2190 */ 463, 368, 463, 463, 463, 463, 373, 463, 375, 463, + /* 2200 */ 360, 463, 463, 463, 463, 463, 463, 463, 368, 463, + /* 2210 */ 463, 463, 463, 373, 329, 375, 463, 463, 463, 463, + /* 2220 */ 463, 463, 463, 400, 463, 463, 463, 404, 463, 463, + /* 2230 */ 407, 408, 409, 410, 411, 412, 463, 414, 463, 463, + /* 2240 */ 400, 463, 463, 463, 404, 360, 463, 407, 408, 409, + /* 2250 */ 410, 411, 412, 368, 414, 463, 463, 463, 373, 463, + /* 2260 */ 375, 463, 463, 463, 463, 463, 463, 463, 463, 463, + /* 2270 */ 329, 463, 463, 463, 463, 463, 463, 463, 463, 463, + /* 2280 */ 463, 463, 463, 463, 463, 400, 463, 463, 463, 404, + /* 2290 */ 463, 463, 407, 408, 409, 410, 411, 412, 463, 414, + /* 2300 */ 329, 360, 463, 463, 463, 463, 463, 463, 463, 368, + /* 2310 */ 463, 463, 463, 463, 373, 463, 375, 463, 463, 463, + /* 2320 */ 463, 463, 463, 329, 463, 463, 463, 463, 463, 463, + /* 2330 */ 463, 360, 463, 463, 463, 463, 463, 463, 463, 368, + /* 2340 */ 463, 400, 463, 463, 373, 404, 375, 463, 407, 408, + /* 2350 */ 409, 410, 411, 412, 360, 414, 463, 463, 463, 463, + /* 2360 */ 463, 463, 368, 463, 463, 463, 463, 373, 329, 375, + /* 2370 */ 463, 400, 463, 463, 463, 404, 463, 463, 407, 408, + /* 2380 */ 409, 410, 411, 412, 463, 414, 463, 329, 463, 463, + /* 2390 */ 463, 463, 463, 463, 400, 463, 463, 463, 404, 360, + /* 2400 */ 463, 407, 408, 409, 410, 411, 412, 368, 414, 463, + /* 2410 */ 463, 463, 373, 329, 375, 463, 463, 463, 360, 463, + /* 2420 */ 463, 463, 463, 463, 463, 463, 368, 463, 463, 463, + /* 2430 */ 463, 373, 463, 375, 463, 463, 463, 463, 463, 400, + /* 2440 */ 463, 463, 463, 404, 360, 463, 407, 408, 409, 410, + /* 2450 */ 411, 412, 368, 414, 463, 463, 463, 373, 400, 375, + /* 2460 */ 463, 463, 404, 463, 463, 407, 408, 409, 410, 411, + /* 2470 */ 412, 329, 414, 463, 463, 463, 463, 463, 463, 463, + /* 2480 */ 463, 463, 463, 463, 400, 463, 463, 329, 404, 463, + /* 2490 */ 463, 407, 408, 409, 410, 411, 412, 463, 414, 463, + /* 2500 */ 463, 463, 360, 463, 463, 463, 463, 463, 463, 463, + /* 2510 */ 368, 463, 463, 463, 463, 373, 463, 375, 360, 463, + /* 2520 */ 463, 463, 463, 463, 463, 463, 368, 463, 463, 463, + /* 2530 */ 463, 373, 463, 375, 463, 463, 463, 463, 463, 463, + /* 2540 */ 463, 463, 400, 329, 463, 463, 404, 463, 463, 407, + /* 2550 */ 408, 409, 410, 411, 412, 463, 414, 463, 400, 463, + /* 2560 */ 329, 463, 404, 463, 463, 407, 408, 409, 410, 411, + /* 2570 */ 412, 463, 414, 463, 360, 463, 463, 463, 463, 463, + /* 2580 */ 463, 463, 368, 463, 463, 463, 463, 373, 329, 375, + /* 2590 */ 463, 360, 463, 463, 463, 463, 463, 463, 463, 368, + /* 2600 */ 463, 463, 463, 463, 373, 463, 375, 463, 463, 463, + /* 2610 */ 463, 463, 463, 463, 400, 463, 463, 463, 404, 360, + /* 2620 */ 463, 407, 408, 409, 410, 411, 412, 368, 414, 463, + /* 2630 */ 463, 400, 373, 463, 375, 404, 463, 463, 407, 408, + /* 2640 */ 409, 410, 411, 412, 329, 414, 463, 463, 463, 463, + /* 2650 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 400, + /* 2660 */ 463, 329, 463, 404, 463, 463, 407, 408, 409, 410, + /* 2670 */ 411, 412, 463, 414, 463, 360, 463, 463, 463, 463, + /* 2680 */ 463, 463, 463, 368, 463, 463, 463, 463, 373, 463, + /* 2690 */ 375, 463, 360, 463, 463, 463, 463, 463, 463, 463, + /* 2700 */ 368, 463, 463, 463, 463, 373, 463, 375, 463, 463, + /* 2710 */ 463, 463, 463, 463, 463, 400, 463, 329, 463, 404, + /* 2720 */ 463, 463, 407, 408, 409, 410, 411, 412, 463, 414, + /* 2730 */ 463, 463, 400, 463, 463, 463, 404, 463, 463, 407, + /* 2740 */ 408, 409, 410, 411, 412, 463, 414, 463, 360, 463, + /* 2750 */ 463, 463, 463, 463, 463, 463, 368, 463, 463, 463, + /* 2760 */ 463, 373, 463, 375, 463, 463, 463, 463, 463, 463, + /* 2770 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, + /* 2780 */ 463, 463, 463, 463, 463, 463, 463, 463, 400, 463, + /* 2790 */ 463, 463, 404, 463, 463, 407, 408, 409, 410, 411, + /* 2800 */ 412, 463, 414, 326, 326, 326, 326, 326, 326, 326, + /* 2810 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2820 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2830 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2840 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2850 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2860 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2870 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2880 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2890 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2900 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2910 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2920 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2930 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2940 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2950 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2960 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2970 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2980 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 2990 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3000 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3010 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3020 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3030 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3040 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3050 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3060 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3070 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3080 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3090 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3100 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3110 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, + /* 3120 */ 326, 326, 326, 326, 326, 326, 326, 326, 326, }; -#define YY_SHIFT_COUNT (713) +#define YY_SHIFT_COUNT (726) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1975) +#define YY_SHIFT_MAX (2120) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 862, 0, 71, 0, 289, 289, 289, 289, 289, 289, - /* 10 */ 289, 289, 289, 289, 289, 360, 576, 576, 647, 576, - /* 20 */ 576, 576, 576, 576, 576, 576, 576, 576, 576, 576, - /* 30 */ 576, 576, 576, 576, 576, 576, 576, 576, 576, 576, - /* 40 */ 576, 576, 576, 576, 576, 576, 576, 576, 32, 134, - /* 50 */ 21, 590, 133, 7, 104, 7, 21, 21, 1216, 1216, - /* 60 */ 7, 1216, 1216, 136, 7, 423, 25, 25, 423, 401, - /* 70 */ 401, 215, 57, 5, 5, 25, 25, 25, 25, 25, - /* 80 */ 25, 25, 25, 25, 25, 80, 25, 25, 156, 25, - /* 90 */ 25, 25, 343, 25, 25, 343, 25, 343, 343, 343, - /* 100 */ 25, 328, 792, 34, 34, 216, 474, 283, 283, 283, - /* 110 */ 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - /* 120 */ 283, 283, 283, 283, 283, 283, 1073, 87, 215, 57, - /* 130 */ 593, 313, 499, 499, 499, 710, 229, 229, 313, 374, - /* 140 */ 374, 374, 143, 384, 343, 378, 343, 378, 378, 143, - /* 150 */ 566, 217, 217, 217, 217, 217, 217, 217, 1351, 408, - /* 160 */ 336, 612, 249, 430, 340, 464, 292, 714, 377, 518, - /* 170 */ 873, 656, 858, 748, 12, 754, 748, 769, 353, 836, - /* 180 */ 977, 1192, 1055, 1202, 1226, 1202, 1094, 1236, 1236, 1202, - /* 190 */ 1094, 1094, 1180, 1236, 1236, 1236, 1265, 1265, 1270, 80, - /* 200 */ 1278, 80, 1280, 1283, 80, 1280, 80, 80, 80, 1236, - /* 210 */ 80, 1260, 1260, 1265, 343, 343, 343, 343, 343, 343, - /* 220 */ 343, 343, 343, 343, 343, 1236, 1265, 378, 378, 1129, - /* 230 */ 1270, 328, 1177, 1278, 328, 1236, 1226, 1226, 378, 1117, - /* 240 */ 1124, 378, 1117, 1124, 378, 378, 343, 1122, 1213, 1117, - /* 250 */ 1130, 1132, 1148, 977, 1127, 1134, 1137, 1159, 374, 1398, - /* 260 */ 1236, 1280, 328, 1124, 378, 378, 378, 378, 378, 1124, - /* 270 */ 378, 1262, 328, 143, 328, 374, 1361, 1366, 378, 566, - /* 280 */ 1236, 328, 1437, 1265, 3069, 3069, 3069, 3069, 3069, 3069, - /* 290 */ 3069, 3069, 3069, 887, 310, 94, 625, 15, 59, 738, - /* 300 */ 720, 753, 881, 73, 781, 472, 472, 472, 472, 472, - /* 310 */ 472, 472, 472, 472, 875, 124, 373, 373, 122, 4, - /* 320 */ 58, 166, 484, 300, 300, 790, 912, 588, 790, 790, - /* 330 */ 790, 113, 1057, 288, 969, 913, 884, 918, 923, 986, - /* 340 */ 988, 1093, 1101, 1106, 1005, 1042, 1090, 1011, 425, 945, - /* 350 */ 863, 1096, 1103, 1115, 1116, 1120, 1187, 1131, 1010, 1041, - /* 360 */ 1046, 1140, 1074, 1141, 1147, 1151, 1176, 1179, 1195, 825, - /* 370 */ 1142, 1166, 489, 1181, 1482, 1487, 1300, 1490, 1493, 1452, - /* 380 */ 1495, 1461, 1296, 1463, 1464, 1465, 1302, 1501, 1469, 1470, - /* 390 */ 1306, 1508, 1314, 1518, 1484, 1522, 1502, 1529, 1491, 1347, - /* 400 */ 1352, 1533, 1535, 1358, 1363, 1538, 1541, 1496, 1542, 1544, - /* 410 */ 1545, 1504, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, - /* 420 */ 1406, 1523, 1559, 1410, 1562, 1569, 1571, 1572, 1573, 1574, - /* 430 */ 1576, 1579, 1580, 1583, 1584, 1585, 1587, 1588, 1589, 1556, - /* 440 */ 1590, 1592, 1599, 1600, 1601, 1575, 1602, 1603, 1604, 1459, - /* 450 */ 1595, 1596, 1577, 1606, 1557, 1607, 1558, 1608, 1609, 1568, - /* 460 */ 1581, 1567, 1566, 1605, 1586, 1616, 1593, 1614, 1582, 1598, - /* 470 */ 1618, 1623, 1632, 1611, 1462, 1634, 1639, 1641, 1591, 1645, - /* 480 */ 1646, 1612, 1610, 1613, 1648, 1619, 1615, 1617, 1653, 1622, - /* 490 */ 1620, 1621, 1661, 1627, 1624, 1625, 1665, 1666, 1667, 1669, - /* 500 */ 1570, 1597, 1635, 1649, 1673, 1642, 1643, 1656, 1657, 1636, - /* 510 */ 1637, 1658, 1659, 1654, 1660, 1697, 1680, 1704, 1684, 1662, - /* 520 */ 1707, 1686, 1674, 1710, 1676, 1713, 1679, 1715, 1694, 1698, - /* 530 */ 1682, 1685, 1527, 1626, 1628, 1724, 1563, 1690, 1728, 1546, - /* 540 */ 1708, 1630, 1629, 1735, 1742, 1633, 1631, 1741, 1703, 1499, - /* 550 */ 1650, 1655, 1664, 1638, 1521, 1640, 1500, 1668, 1712, 1687, - /* 560 */ 1681, 1689, 1691, 1692, 1716, 1705, 1714, 1696, 1719, 1530, - /* 570 */ 1693, 1699, 1754, 1731, 1531, 1743, 1746, 1747, 1752, 1762, - /* 580 */ 1763, 1709, 1711, 1756, 1561, 1757, 1759, 1799, 1809, 1811, - /* 590 */ 1717, 1718, 1721, 1720, 1723, 1647, 1726, 1819, 1783, 1670, - /* 600 */ 1734, 1727, 1566, 1786, 1791, 1644, 1671, 1675, 1834, 1815, - /* 610 */ 1651, 1745, 1749, 1748, 1751, 1753, 1760, 1794, 1758, 1764, - /* 620 */ 1795, 1761, 1816, 1652, 1765, 1744, 1766, 1814, 1817, 1768, - /* 630 */ 1769, 1820, 1771, 1773, 1829, 1776, 1777, 1832, 1788, 1790, - /* 640 */ 1833, 1792, 1732, 1770, 1775, 1778, 1866, 1785, 1800, 1846, - /* 650 */ 1804, 1867, 1810, 1846, 1846, 1882, 1843, 1845, 1874, 1875, - /* 660 */ 1876, 1877, 1878, 1879, 1880, 1881, 1883, 1884, 1847, 1828, - /* 670 */ 1885, 1886, 1888, 1890, 1904, 1895, 1905, 1906, 1857, 1636, - /* 680 */ 1907, 1637, 1908, 1909, 1911, 1912, 1917, 1913, 1949, 1916, - /* 690 */ 1910, 1915, 1955, 1921, 1914, 1918, 1959, 1925, 1919, 1924, - /* 700 */ 1964, 1930, 1922, 1932, 1969, 1937, 1939, 1975, 1956, 1958, - /* 710 */ 1960, 1971, 1968, 1957, + /* 0 */ 865, 0, 71, 0, 290, 290, 290, 290, 290, 290, + /* 10 */ 290, 290, 290, 290, 290, 361, 578, 578, 649, 578, + /* 20 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, + /* 30 */ 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, + /* 40 */ 578, 578, 578, 578, 578, 578, 578, 578, 115, 285, + /* 50 */ 70, 251, 140, 183, 205, 183, 70, 70, 1205, 1205, + /* 60 */ 183, 1205, 1205, 346, 183, 61, 108, 108, 61, 154, + /* 70 */ 154, 39, 434, 53, 53, 108, 108, 108, 108, 108, + /* 80 */ 108, 108, 108, 108, 108, 198, 150, 108, 108, 389, + /* 90 */ 108, 150, 108, 108, 108, 108, 150, 108, 108, 150, + /* 100 */ 108, 150, 150, 150, 108, 501, 795, 34, 34, 217, + /* 110 */ 454, 287, 287, 287, 287, 287, 287, 287, 287, 287, + /* 120 */ 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, + /* 130 */ 152, 386, 39, 434, 25, 309, 87, 87, 87, 483, + /* 140 */ 202, 202, 309, 502, 502, 502, 462, 376, 150, 581, + /* 150 */ 150, 581, 581, 462, 587, 218, 218, 218, 218, 218, + /* 160 */ 218, 218, 1892, 460, 304, 545, 453, 58, 286, 288, + /* 170 */ 338, 443, 663, 763, 883, 707, 819, 688, 869, 42, + /* 180 */ 688, 945, 891, 829, 1058, 1262, 1136, 1276, 1307, 1276, + /* 190 */ 1184, 1327, 1327, 1276, 1184, 1184, 1269, 1327, 1327, 1327, + /* 200 */ 1349, 1349, 1353, 198, 1355, 198, 1366, 1373, 198, 1366, + /* 210 */ 198, 198, 198, 1327, 198, 1360, 1360, 1349, 150, 150, + /* 220 */ 150, 150, 150, 150, 150, 150, 150, 150, 150, 1327, + /* 230 */ 1349, 581, 581, 1260, 1363, 1353, 501, 1272, 1355, 501, + /* 240 */ 1327, 1307, 1307, 581, 1220, 1226, 581, 1220, 1226, 581, + /* 250 */ 581, 150, 1227, 1316, 1220, 1228, 1231, 1248, 1058, 1229, + /* 260 */ 1233, 1238, 1261, 502, 1488, 1327, 1366, 501, 501, 1226, + /* 270 */ 581, 581, 581, 581, 581, 1226, 581, 1371, 501, 462, + /* 280 */ 501, 502, 1450, 1453, 581, 587, 1327, 501, 1520, 1349, + /* 290 */ 2803, 2803, 2803, 2803, 2803, 2803, 2803, 2803, 2803, 890, + /* 300 */ 382, 418, 1031, 249, 741, 902, 724, 412, 884, 1164, + /* 310 */ 878, 611, 611, 611, 611, 611, 611, 611, 611, 611, + /* 320 */ 887, 485, 24, 24, 477, 537, 196, 762, 20, 586, + /* 330 */ 105, 105, 616, 750, 676, 616, 616, 616, 505, 1001, + /* 340 */ 1032, 979, 897, 963, 974, 1008, 1022, 1122, 1160, 1174, + /* 350 */ 1117, 928, 1166, 1178, 1002, 967, 868, 962, 1181, 1185, + /* 360 */ 1195, 1197, 1198, 1203, 1222, 1215, 1111, 1134, 867, 1224, + /* 370 */ 1041, 1225, 1234, 1235, 1254, 1259, 1264, 1218, 1291, 1302, + /* 380 */ 1173, 759, 1578, 1585, 1396, 1587, 1588, 1547, 1590, 1556, + /* 390 */ 1390, 1558, 1559, 1560, 1394, 1597, 1563, 1564, 1398, 1601, + /* 400 */ 1400, 1603, 1569, 1605, 1586, 1607, 1574, 1436, 1429, 1622, + /* 410 */ 1623, 1449, 1451, 1630, 1633, 1589, 1634, 1635, 1637, 1596, + /* 420 */ 1639, 1640, 1641, 1643, 1644, 1645, 1646, 1647, 1497, 1614, + /* 430 */ 1650, 1501, 1653, 1654, 1657, 1666, 1667, 1668, 1670, 1674, + /* 440 */ 1675, 1682, 1683, 1684, 1685, 1689, 1690, 1691, 1636, 1679, + /* 450 */ 1680, 1692, 1693, 1694, 1695, 1676, 1697, 1699, 1709, 1566, + /* 460 */ 1702, 1711, 1677, 1714, 1658, 1715, 1661, 1728, 1729, 1688, + /* 470 */ 1696, 1698, 1700, 1718, 1703, 1722, 1704, 1737, 1706, 1710, + /* 480 */ 1738, 1741, 1743, 1713, 1579, 1748, 1754, 1755, 1712, 1757, + /* 490 */ 1759, 1725, 1716, 1724, 1761, 1739, 1727, 1734, 1777, 1745, + /* 500 */ 1730, 1742, 1782, 1750, 1735, 1749, 1789, 1790, 1791, 1793, + /* 510 */ 1708, 1726, 1762, 1772, 1796, 1763, 1764, 1766, 1769, 1770, + /* 520 */ 1773, 1771, 1775, 1781, 1778, 1805, 1786, 1816, 1802, 1776, + /* 530 */ 1829, 1808, 1797, 1833, 1807, 1843, 1809, 1845, 1824, 1827, + /* 540 */ 1814, 1815, 1656, 1756, 1765, 1854, 1705, 1821, 1857, 1672, + /* 550 */ 1837, 1717, 1707, 1861, 1862, 1719, 1721, 1860, 1820, 1615, + /* 560 */ 1779, 1774, 1780, 1731, 1638, 1732, 1612, 1783, 1828, 1799, + /* 570 */ 1787, 1803, 1806, 1801, 1832, 1830, 1831, 1810, 1841, 1618, + /* 580 */ 1804, 1811, 1883, 1864, 1659, 1869, 1871, 1875, 1877, 1878, + /* 590 */ 1879, 1819, 1822, 1870, 1687, 1872, 1873, 1919, 1921, 1922, + /* 600 */ 1923, 1834, 1887, 1838, 1836, 1846, 1839, 1842, 1760, 1844, + /* 610 */ 1924, 1889, 1788, 1849, 1847, 1700, 1894, 1907, 1733, 1736, + /* 620 */ 1740, 1934, 1933, 1751, 1863, 1865, 1868, 1876, 1880, 1891, + /* 630 */ 1909, 1881, 1888, 1910, 1895, 1938, 1758, 1893, 1858, 1896, + /* 640 */ 1930, 1931, 1899, 1900, 1936, 1902, 1903, 1960, 1906, 1908, + /* 650 */ 1967, 1911, 1912, 1968, 1914, 1886, 1897, 1898, 1901, 1951, + /* 660 */ 1904, 1915, 1969, 1917, 1979, 1920, 1969, 1969, 1996, 1955, + /* 670 */ 1958, 1988, 1989, 1991, 1992, 1993, 2005, 2006, 2007, 2008, + /* 680 */ 2009, 1961, 1953, 2003, 2013, 2014, 2015, 2032, 2020, 2021, + /* 690 */ 2023, 1990, 1770, 2024, 1773, 2028, 2029, 2030, 2031, 2045, + /* 700 */ 2033, 2070, 2036, 2025, 2038, 2072, 2049, 2046, 2041, 2093, + /* 710 */ 2060, 2051, 2061, 2102, 2068, 2056, 2077, 2107, 2082, 2083, + /* 720 */ 2120, 2100, 2103, 2104, 2116, 2108, 2105, }; -#define YY_REDUCE_COUNT (292) -#define YY_REDUCE_MIN (-420) -#define YY_REDUCE_MAX (2656) +#define YY_REDUCE_COUNT (298) +#define YY_REDUCE_MIN (-429) +#define YY_REDUCE_MAX (2388) static const short yy_reduce_ofst[] = { - /* 0 */ 276, -259, 233, 672, 744, 798, 859, 922, 942, 1045, - /* 10 */ 1104, 1158, 1219, 1277, 1331, 1360, 294, 1418, 1472, 1526, - /* 20 */ 1578, 1594, 1683, 1701, 1755, 1772, 1824, 1840, 1892, 1946, - /* 30 */ 1967, 2043, 2061, 2115, 2132, 2184, 2200, 2252, 2275, 2327, - /* 40 */ 2390, 2442, 2461, 2513, 2529, 2581, 2604, 2656, -258, 95, - /* 50 */ 105, -39, 559, 597, 599, 669, 187, 704, -346, -57, - /* 60 */ -391, 323, 480, -276, -250, 75, -222, 297, -371, -330, - /* 70 */ -326, -327, -363, -299, -257, 116, 128, 193, 199, 327, - /* 80 */ 409, 471, 645, 649, 657, 252, 693, 706, -51, 725, - /* 90 */ 747, 762, 244, 763, 772, -203, 791, 465, -5, 362, - /* 100 */ 847, -210, -315, -420, -420, -217, -212, -69, -21, 41, - /* 110 */ 43, 70, 96, 117, 148, 197, 225, 234, 346, 351, - /* 120 */ 405, 446, 454, 504, 651, 655, -266, -170, 397, 191, - /* 130 */ 152, 352, -170, -150, 219, 477, 186, 254, 491, 524, - /* 140 */ 537, 538, -316, -319, 485, 367, 542, 555, 557, 632, - /* 150 */ 530, -342, 369, 389, 410, 463, 468, 483, 319, 577, - /* 160 */ 650, 543, 521, 603, 756, 695, 786, 786, 810, 780, - /* 170 */ 831, 811, 808, 760, 760, 746, 760, 784, 783, 786, - /* 180 */ 834, 842, 851, 866, 870, 869, 878, 924, 926, 879, - /* 190 */ 882, 886, 933, 943, 944, 948, 957, 958, 897, 953, - /* 200 */ 925, 955, 965, 914, 963, 970, 964, 966, 968, 975, - /* 210 */ 971, 976, 978, 989, 959, 962, 967, 979, 983, 984, - /* 220 */ 994, 996, 998, 999, 1001, 987, 992, 990, 991, 938, - /* 230 */ 941, 997, 973, 995, 1028, 1035, 993, 1000, 1002, 936, - /* 240 */ 1003, 1007, 939, 1004, 1009, 1013, 786, 946, 949, 950, - /* 250 */ 947, 956, 972, 1014, 951, 961, 960, 760, 1049, 1016, - /* 260 */ 1085, 1088, 1082, 1043, 1054, 1058, 1059, 1061, 1062, 1044, - /* 270 */ 1063, 1066, 1118, 1089, 1119, 1079, 1038, 1102, 1095, 1121, - /* 280 */ 1136, 1126, 1143, 1145, 1087, 1081, 1097, 1098, 1135, 1138, - /* 290 */ 1139, 1144, 1154, + /* 0 */ -266, -299, -9, 683, 745, 790, 846, 876, 932, 1042, + /* 10 */ 1105, 1150, 292, 1206, 1251, 360, 1296, 622, 1313, 1358, + /* 20 */ 235, 1411, 1427, 1480, 1570, 1625, 1678, 1701, 1723, 1746, + /* 30 */ 1768, 1823, 1840, 1885, 1941, 1971, 1994, 2039, 2058, 2084, + /* 40 */ 2142, 2158, 2214, 2231, 2259, 2315, 2332, 2388, -280, -278, + /* 50 */ 225, 690, 926, 939, 948, 966, 296, 451, -352, -339, + /* 60 */ -426, -318, -49, -429, -314, -370, -237, -221, -372, -256, + /* 70 */ 200, -200, -303, -235, -192, -161, 326, 329, 337, 371, + /* 80 */ 394, 397, 470, 473, 479, 6, 104, 472, 554, -204, + /* 90 */ 659, 242, 687, 709, 710, 748, 182, 749, 761, 262, + /* 100 */ 764, 247, 274, 318, 651, 21, -259, -422, -422, -236, + /* 110 */ 48, 267, 343, 506, 655, 664, 671, 723, 730, 810, + /* 120 */ 811, 812, 822, 839, 857, 858, 859, 860, 862, 864, + /* 130 */ 245, 352, -176, -7, 47, 179, 352, 481, 488, 327, + /* 140 */ 273, 409, 396, -243, 353, 465, -347, -106, -208, 224, + /* 150 */ 466, 407, 534, 121, 573, -359, 377, 631, 678, 696, + /* 160 */ 770, 801, 626, 368, 699, 784, 645, 742, 881, 804, + /* 170 */ 843, 843, 889, 824, 909, 880, 906, 831, 831, 816, + /* 180 */ 831, 837, 835, 843, 907, 913, 933, 944, 950, 954, + /* 190 */ 957, 1011, 1012, 972, 976, 983, 1019, 1028, 1029, 1030, + /* 200 */ 1039, 1043, 981, 1037, 1007, 1044, 1051, 1003, 1052, 1060, + /* 210 */ 1061, 1064, 1065, 1072, 1068, 1076, 1080, 1090, 1062, 1073, + /* 220 */ 1075, 1077, 1078, 1079, 1081, 1083, 1084, 1085, 1087, 1088, + /* 230 */ 1109, 1063, 1082, 1049, 1066, 1070, 1118, 1067, 1094, 1129, + /* 240 */ 1135, 1091, 1092, 1098, 1034, 1096, 1110, 1045, 1099, 1113, + /* 250 */ 1114, 843, 1038, 1046, 1050, 1053, 1055, 1059, 1100, 1036, + /* 260 */ 1047, 1056, 831, 1139, 1115, 1183, 1189, 1187, 1188, 1146, + /* 270 */ 1149, 1161, 1163, 1165, 1167, 1147, 1168, 1155, 1201, 1190, + /* 280 */ 1202, 1176, 1123, 1191, 1179, 1199, 1214, 1212, 1236, 1232, + /* 290 */ 1172, 1170, 1186, 1196, 1216, 1223, 1230, 1240, 1245, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 10 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 20 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 30 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 40 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 50 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 60 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 70 */ 1606, 1861, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 80 */ 1606, 1606, 1606, 1606, 1606, 1684, 1606, 1606, 1606, 1606, - /* 90 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 100 */ 1606, 1682, 1854, 2057, 1606, 1606, 1606, 1606, 1606, 1606, - /* 110 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 120 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 2069, 1606, 1606, - /* 130 */ 1684, 1606, 2069, 2069, 2069, 1682, 2029, 2029, 1606, 1606, - /* 140 */ 1606, 1606, 1791, 1606, 1606, 1606, 1606, 1606, 1606, 1791, - /* 150 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1903, 1606, - /* 160 */ 1606, 2094, 2148, 1606, 1606, 2097, 1606, 1606, 1606, 1866, - /* 170 */ 1606, 1744, 2084, 2061, 2075, 2132, 2062, 2059, 2078, 1606, - /* 180 */ 2088, 1606, 1896, 1859, 1606, 1859, 1856, 1606, 1606, 1859, - /* 190 */ 1856, 1856, 1735, 1606, 1606, 1606, 1606, 1606, 1606, 1684, - /* 200 */ 1606, 1684, 1606, 1606, 1684, 1606, 1684, 1684, 1684, 1606, - /* 210 */ 1684, 1663, 1663, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 220 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1916, - /* 230 */ 1606, 1682, 1905, 1606, 1682, 1606, 1606, 1606, 1606, 2105, - /* 240 */ 2103, 1606, 2105, 2103, 1606, 1606, 1606, 2117, 2113, 2105, - /* 250 */ 2121, 2119, 2090, 2088, 2151, 2138, 2134, 2075, 1606, 1606, - /* 260 */ 1606, 1606, 1682, 2103, 1606, 1606, 1606, 1606, 1606, 2103, - /* 270 */ 1606, 1606, 1682, 1606, 1682, 1606, 1606, 1760, 1606, 1606, - /* 280 */ 1606, 1682, 1638, 1606, 1898, 1909, 1881, 1881, 1794, 1794, - /* 290 */ 1794, 1685, 1611, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 300 */ 1606, 1606, 1606, 1606, 1606, 2116, 2115, 1984, 1606, 2033, - /* 310 */ 2032, 2031, 2022, 1983, 1756, 1606, 1982, 1981, 1606, 1606, - /* 320 */ 1606, 1606, 1606, 1872, 1871, 1975, 1606, 1606, 1976, 1974, - /* 330 */ 1973, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 340 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 2135, 2139, - /* 350 */ 1606, 1606, 1606, 1606, 1606, 1606, 2058, 1606, 1606, 1606, - /* 360 */ 1606, 1606, 1958, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 370 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 380 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 390 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 400 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 410 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 420 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 430 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 440 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 450 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 460 */ 1606, 1643, 1963, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 470 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 480 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 490 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 500 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1723, - /* 510 */ 1722, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 520 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 530 */ 1606, 1606, 1606, 1966, 1606, 1606, 1606, 1606, 1606, 1606, - /* 540 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 2131, 2091, 1606, - /* 550 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 560 */ 1606, 1606, 1606, 1606, 1606, 1606, 1958, 1606, 2114, 1606, - /* 570 */ 1606, 2129, 1606, 2133, 1606, 1606, 1606, 1606, 1606, 1606, - /* 580 */ 1606, 2068, 2064, 1606, 1606, 2060, 1606, 1606, 1606, 1606, - /* 590 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 600 */ 1606, 1606, 1957, 1606, 2019, 1606, 1606, 1606, 2053, 1606, - /* 610 */ 1606, 2004, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 620 */ 1606, 1966, 1606, 1969, 1606, 1606, 1606, 1606, 1606, 1788, - /* 630 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 640 */ 1606, 1606, 1773, 1771, 1770, 1769, 1606, 1766, 1606, 1801, - /* 650 */ 1606, 1606, 1606, 1797, 1796, 1606, 1606, 1606, 1606, 1606, - /* 660 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 670 */ 1703, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1695, - /* 680 */ 1606, 1694, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 690 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 700 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 710 */ 1606, 1606, 1606, 1606, + /* 0 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 10 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 20 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 30 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 40 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 50 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 60 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 70 */ 1625, 1882, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 80 */ 1625, 1625, 1625, 1625, 1625, 1703, 1625, 1625, 1625, 1625, + /* 90 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 100 */ 1625, 1625, 1625, 1625, 1625, 1701, 1875, 2081, 1625, 1625, + /* 110 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 120 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 130 */ 1625, 2093, 1625, 1625, 1703, 1625, 2093, 2093, 2093, 1701, + /* 140 */ 2053, 2053, 1625, 1625, 1625, 1625, 1810, 1625, 1625, 1625, + /* 150 */ 1625, 1625, 1625, 1810, 1625, 1625, 1625, 1625, 1625, 1625, + /* 160 */ 1625, 1625, 1925, 1625, 1625, 2118, 2172, 1625, 1625, 2121, + /* 170 */ 1625, 1625, 1625, 1887, 1625, 1763, 2108, 2085, 2099, 2156, + /* 180 */ 2086, 2083, 2102, 1625, 2112, 1625, 1918, 1880, 1625, 1880, + /* 190 */ 1877, 1625, 1625, 1880, 1877, 1877, 1754, 1625, 1625, 1625, + /* 200 */ 1625, 1625, 1625, 1703, 1625, 1703, 1625, 1625, 1703, 1625, + /* 210 */ 1703, 1703, 1703, 1625, 1703, 1682, 1682, 1625, 1625, 1625, + /* 220 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 230 */ 1625, 1625, 1625, 1940, 1931, 1625, 1701, 1927, 1625, 1701, + /* 240 */ 1625, 1625, 1625, 1625, 2129, 2127, 1625, 2129, 2127, 1625, + /* 250 */ 1625, 1625, 2141, 2137, 2129, 2145, 2143, 2114, 2112, 2175, + /* 260 */ 2162, 2158, 2099, 1625, 1625, 1625, 1625, 1701, 1701, 2127, + /* 270 */ 1625, 1625, 1625, 1625, 1625, 2127, 1625, 1625, 1701, 1625, + /* 280 */ 1701, 1625, 1625, 1779, 1625, 1625, 1625, 1701, 1657, 1625, + /* 290 */ 1920, 1933, 1903, 1903, 1813, 1813, 1813, 1704, 1630, 1625, + /* 300 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 310 */ 1625, 2140, 2139, 2008, 1625, 2057, 2056, 2055, 2046, 2007, + /* 320 */ 1775, 1625, 2006, 2005, 1625, 1625, 1625, 1625, 1625, 1625, + /* 330 */ 1894, 1893, 1999, 1625, 1625, 2000, 1998, 1997, 1625, 1625, + /* 340 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 350 */ 1625, 1625, 1625, 1625, 1625, 2159, 2163, 1625, 1625, 1625, + /* 360 */ 1625, 1625, 1625, 1625, 2082, 1625, 1625, 1625, 1625, 1625, + /* 370 */ 1982, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 380 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 390 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 400 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 410 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 420 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 430 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 440 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 450 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 460 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 470 */ 1625, 1662, 1987, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 480 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 490 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 500 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 510 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1742, + /* 520 */ 1741, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 530 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 540 */ 1625, 1625, 1625, 1990, 1625, 1625, 1625, 1625, 1625, 1625, + /* 550 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 2155, 2115, 1625, + /* 560 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 570 */ 1625, 1625, 1625, 1625, 1625, 1625, 1982, 1625, 2138, 1625, + /* 580 */ 1625, 2153, 1625, 2157, 1625, 1625, 1625, 1625, 1625, 1625, + /* 590 */ 1625, 2092, 2088, 1625, 1625, 2084, 1625, 1625, 1625, 1625, + /* 600 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 610 */ 1625, 1625, 1625, 1625, 1625, 1981, 1625, 2043, 1625, 1625, + /* 620 */ 1625, 2077, 1625, 1625, 2028, 1625, 1625, 1625, 1625, 1625, + /* 630 */ 1625, 1625, 1625, 1625, 1990, 1625, 1993, 1625, 1625, 1625, + /* 640 */ 1625, 1625, 1807, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 650 */ 1625, 1625, 1625, 1625, 1625, 1792, 1790, 1789, 1788, 1625, + /* 660 */ 1785, 1625, 1820, 1625, 1625, 1625, 1816, 1815, 1625, 1625, + /* 670 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 680 */ 1625, 1625, 1625, 1722, 1625, 1625, 1625, 1625, 1625, 1625, + /* 690 */ 1625, 1625, 1714, 1625, 1713, 1625, 1625, 1625, 1625, 1625, + /* 700 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 710 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, 1625, + /* 720 */ 1625, 1625, 1625, 1625, 1625, 1625, 1625, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1233,6 +1182,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* CONSUMERS => nothing */ 0, /* SUBSCRIPTIONS => nothing */ 0, /* VNODES => nothing */ + 0, /* ALIVE => nothing */ 0, /* LIKE => nothing */ 0, /* TBNAME => nothing */ 0, /* QTAGS => nothing */ @@ -1301,7 +1251,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* SERVER_STATUS => nothing */ 0, /* CURRENT_USER => nothing */ 0, /* CASE => nothing */ - 271, /* END => ABORT */ + 272, /* END => ABORT */ 0, /* WHEN => nothing */ 0, /* THEN => nothing */ 0, /* ELSE => nothing */ @@ -1345,59 +1295,59 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 271, /* AFTER => ABORT */ - 271, /* ATTACH => ABORT */ - 271, /* BEFORE => ABORT */ - 271, /* BEGIN => ABORT */ - 271, /* BITAND => ABORT */ - 271, /* BITNOT => ABORT */ - 271, /* BITOR => ABORT */ - 271, /* BLOCKS => ABORT */ - 271, /* CHANGE => ABORT */ - 271, /* COMMA => ABORT */ - 271, /* COMPACT => ABORT */ - 271, /* CONCAT => ABORT */ - 271, /* CONFLICT => ABORT */ - 271, /* COPY => ABORT */ - 271, /* DEFERRED => ABORT */ - 271, /* DELIMITERS => ABORT */ - 271, /* DETACH => ABORT */ - 271, /* DIVIDE => ABORT */ - 271, /* DOT => ABORT */ - 271, /* EACH => ABORT */ - 271, /* FAIL => ABORT */ - 271, /* FILE => ABORT */ - 271, /* FOR => ABORT */ - 271, /* GLOB => ABORT */ - 271, /* ID => ABORT */ - 271, /* IMMEDIATE => ABORT */ - 271, /* IMPORT => ABORT */ - 271, /* INITIALLY => ABORT */ - 271, /* INSTEAD => ABORT */ - 271, /* ISNULL => ABORT */ - 271, /* KEY => ABORT */ - 271, /* MODULES => ABORT */ - 271, /* NK_BITNOT => ABORT */ - 271, /* NK_SEMI => ABORT */ - 271, /* NOTNULL => ABORT */ - 271, /* OF => ABORT */ - 271, /* PLUS => ABORT */ - 271, /* PRIVILEGE => ABORT */ - 271, /* RAISE => ABORT */ - 271, /* REPLACE => ABORT */ - 271, /* RESTRICT => ABORT */ - 271, /* ROW => ABORT */ - 271, /* SEMI => ABORT */ - 271, /* STAR => ABORT */ - 271, /* STATEMENT => ABORT */ - 271, /* STRICT => ABORT */ - 271, /* STRING => ABORT */ - 271, /* TIMES => ABORT */ - 271, /* UPDATE => ABORT */ - 271, /* VALUES => ABORT */ - 271, /* VARIABLE => ABORT */ - 271, /* VIEW => ABORT */ - 271, /* WAL => ABORT */ + 272, /* AFTER => ABORT */ + 272, /* ATTACH => ABORT */ + 272, /* BEFORE => ABORT */ + 272, /* BEGIN => ABORT */ + 272, /* BITAND => ABORT */ + 272, /* BITNOT => ABORT */ + 272, /* BITOR => ABORT */ + 272, /* BLOCKS => ABORT */ + 272, /* CHANGE => ABORT */ + 272, /* COMMA => ABORT */ + 272, /* COMPACT => ABORT */ + 272, /* CONCAT => ABORT */ + 272, /* CONFLICT => ABORT */ + 272, /* COPY => ABORT */ + 272, /* DEFERRED => ABORT */ + 272, /* DELIMITERS => ABORT */ + 272, /* DETACH => ABORT */ + 272, /* DIVIDE => ABORT */ + 272, /* DOT => ABORT */ + 272, /* EACH => ABORT */ + 272, /* FAIL => ABORT */ + 272, /* FILE => ABORT */ + 272, /* FOR => ABORT */ + 272, /* GLOB => ABORT */ + 272, /* ID => ABORT */ + 272, /* IMMEDIATE => ABORT */ + 272, /* IMPORT => ABORT */ + 272, /* INITIALLY => ABORT */ + 272, /* INSTEAD => ABORT */ + 272, /* ISNULL => ABORT */ + 272, /* KEY => ABORT */ + 272, /* MODULES => ABORT */ + 272, /* NK_BITNOT => ABORT */ + 272, /* NK_SEMI => ABORT */ + 272, /* NOTNULL => ABORT */ + 272, /* OF => ABORT */ + 272, /* PLUS => ABORT */ + 272, /* PRIVILEGE => ABORT */ + 272, /* RAISE => ABORT */ + 272, /* REPLACE => ABORT */ + 272, /* RESTRICT => ABORT */ + 272, /* ROW => ABORT */ + 272, /* SEMI => ABORT */ + 272, /* STAR => ABORT */ + 272, /* STATEMENT => ABORT */ + 272, /* STRICT => ABORT */ + 272, /* STRING => ABORT */ + 272, /* TIMES => ABORT */ + 272, /* UPDATE => ABORT */ + 272, /* VALUES => ABORT */ + 272, /* VARIABLE => ABORT */ + 272, /* VIEW => ABORT */ + 272, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1645,307 +1595,309 @@ static const char *const yyTokenName[] = { /* 157 */ "CONSUMERS", /* 158 */ "SUBSCRIPTIONS", /* 159 */ "VNODES", - /* 160 */ "LIKE", - /* 161 */ "TBNAME", - /* 162 */ "QTAGS", - /* 163 */ "AS", - /* 164 */ "INDEX", - /* 165 */ "FUNCTION", - /* 166 */ "INTERVAL", - /* 167 */ "COUNT", - /* 168 */ "LAST_ROW", - /* 169 */ "TOPIC", - /* 170 */ "WITH", - /* 171 */ "META", - /* 172 */ "CONSUMER", - /* 173 */ "GROUP", - /* 174 */ "DESC", - /* 175 */ "DESCRIBE", - /* 176 */ "RESET", - /* 177 */ "QUERY", - /* 178 */ "CACHE", - /* 179 */ "EXPLAIN", - /* 180 */ "ANALYZE", - /* 181 */ "VERBOSE", - /* 182 */ "NK_BOOL", - /* 183 */ "RATIO", - /* 184 */ "NK_FLOAT", - /* 185 */ "OUTPUTTYPE", - /* 186 */ "AGGREGATE", - /* 187 */ "BUFSIZE", - /* 188 */ "STREAM", - /* 189 */ "INTO", - /* 190 */ "TRIGGER", - /* 191 */ "AT_ONCE", - /* 192 */ "WINDOW_CLOSE", - /* 193 */ "IGNORE", - /* 194 */ "EXPIRED", - /* 195 */ "FILL_HISTORY", - /* 196 */ "SUBTABLE", - /* 197 */ "KILL", - /* 198 */ "CONNECTION", - /* 199 */ "TRANSACTION", - /* 200 */ "BALANCE", - /* 201 */ "VGROUP", - /* 202 */ "MERGE", - /* 203 */ "REDISTRIBUTE", - /* 204 */ "SPLIT", - /* 205 */ "DELETE", - /* 206 */ "INSERT", - /* 207 */ "NULL", - /* 208 */ "NK_QUESTION", - /* 209 */ "NK_ARROW", - /* 210 */ "ROWTS", - /* 211 */ "QSTART", - /* 212 */ "QEND", - /* 213 */ "QDURATION", - /* 214 */ "WSTART", - /* 215 */ "WEND", - /* 216 */ "WDURATION", - /* 217 */ "IROWTS", - /* 218 */ "ISFILLED", - /* 219 */ "CAST", - /* 220 */ "NOW", - /* 221 */ "TODAY", - /* 222 */ "TIMEZONE", - /* 223 */ "CLIENT_VERSION", - /* 224 */ "SERVER_VERSION", - /* 225 */ "SERVER_STATUS", - /* 226 */ "CURRENT_USER", - /* 227 */ "CASE", - /* 228 */ "END", - /* 229 */ "WHEN", - /* 230 */ "THEN", - /* 231 */ "ELSE", - /* 232 */ "BETWEEN", - /* 233 */ "IS", - /* 234 */ "NK_LT", - /* 235 */ "NK_GT", - /* 236 */ "NK_LE", - /* 237 */ "NK_GE", - /* 238 */ "NK_NE", - /* 239 */ "MATCH", - /* 240 */ "NMATCH", - /* 241 */ "CONTAINS", - /* 242 */ "IN", - /* 243 */ "JOIN", - /* 244 */ "INNER", - /* 245 */ "SELECT", - /* 246 */ "DISTINCT", - /* 247 */ "WHERE", - /* 248 */ "PARTITION", - /* 249 */ "BY", - /* 250 */ "SESSION", - /* 251 */ "STATE_WINDOW", - /* 252 */ "EVENT_WINDOW", - /* 253 */ "START", - /* 254 */ "SLIDING", - /* 255 */ "FILL", - /* 256 */ "VALUE", - /* 257 */ "NONE", - /* 258 */ "PREV", - /* 259 */ "LINEAR", - /* 260 */ "NEXT", - /* 261 */ "HAVING", - /* 262 */ "RANGE", - /* 263 */ "EVERY", - /* 264 */ "ORDER", - /* 265 */ "SLIMIT", - /* 266 */ "SOFFSET", - /* 267 */ "LIMIT", - /* 268 */ "OFFSET", - /* 269 */ "ASC", - /* 270 */ "NULLS", - /* 271 */ "ABORT", - /* 272 */ "AFTER", - /* 273 */ "ATTACH", - /* 274 */ "BEFORE", - /* 275 */ "BEGIN", - /* 276 */ "BITAND", - /* 277 */ "BITNOT", - /* 278 */ "BITOR", - /* 279 */ "BLOCKS", - /* 280 */ "CHANGE", - /* 281 */ "COMMA", - /* 282 */ "COMPACT", - /* 283 */ "CONCAT", - /* 284 */ "CONFLICT", - /* 285 */ "COPY", - /* 286 */ "DEFERRED", - /* 287 */ "DELIMITERS", - /* 288 */ "DETACH", - /* 289 */ "DIVIDE", - /* 290 */ "DOT", - /* 291 */ "EACH", - /* 292 */ "FAIL", - /* 293 */ "FILE", - /* 294 */ "FOR", - /* 295 */ "GLOB", - /* 296 */ "ID", - /* 297 */ "IMMEDIATE", - /* 298 */ "IMPORT", - /* 299 */ "INITIALLY", - /* 300 */ "INSTEAD", - /* 301 */ "ISNULL", - /* 302 */ "KEY", - /* 303 */ "MODULES", - /* 304 */ "NK_BITNOT", - /* 305 */ "NK_SEMI", - /* 306 */ "NOTNULL", - /* 307 */ "OF", - /* 308 */ "PLUS", - /* 309 */ "PRIVILEGE", - /* 310 */ "RAISE", - /* 311 */ "REPLACE", - /* 312 */ "RESTRICT", - /* 313 */ "ROW", - /* 314 */ "SEMI", - /* 315 */ "STAR", - /* 316 */ "STATEMENT", - /* 317 */ "STRICT", - /* 318 */ "STRING", - /* 319 */ "TIMES", - /* 320 */ "UPDATE", - /* 321 */ "VALUES", - /* 322 */ "VARIABLE", - /* 323 */ "VIEW", - /* 324 */ "WAL", - /* 325 */ "cmd", - /* 326 */ "account_options", - /* 327 */ "alter_account_options", - /* 328 */ "literal", - /* 329 */ "alter_account_option", - /* 330 */ "user_name", - /* 331 */ "sysinfo_opt", - /* 332 */ "privileges", - /* 333 */ "priv_level", - /* 334 */ "priv_type_list", - /* 335 */ "priv_type", - /* 336 */ "db_name", - /* 337 */ "topic_name", - /* 338 */ "dnode_endpoint", - /* 339 */ "force_opt", - /* 340 */ "not_exists_opt", - /* 341 */ "db_options", - /* 342 */ "exists_opt", - /* 343 */ "alter_db_options", - /* 344 */ "speed_opt", - /* 345 */ "integer_list", - /* 346 */ "variable_list", - /* 347 */ "retention_list", - /* 348 */ "alter_db_option", - /* 349 */ "retention", - /* 350 */ "full_table_name", - /* 351 */ "column_def_list", - /* 352 */ "tags_def_opt", - /* 353 */ "table_options", - /* 354 */ "multi_create_clause", - /* 355 */ "tags_def", - /* 356 */ "multi_drop_clause", - /* 357 */ "alter_table_clause", - /* 358 */ "alter_table_options", - /* 359 */ "column_name", - /* 360 */ "type_name", - /* 361 */ "signed_literal", - /* 362 */ "create_subtable_clause", - /* 363 */ "specific_cols_opt", - /* 364 */ "expression_list", - /* 365 */ "drop_table_clause", - /* 366 */ "col_name_list", - /* 367 */ "table_name", - /* 368 */ "column_def", - /* 369 */ "duration_list", - /* 370 */ "rollup_func_list", - /* 371 */ "alter_table_option", - /* 372 */ "duration_literal", - /* 373 */ "rollup_func_name", - /* 374 */ "function_name", - /* 375 */ "col_name", - /* 376 */ "db_name_cond_opt", - /* 377 */ "like_pattern_opt", - /* 378 */ "table_name_cond", - /* 379 */ "from_db_opt", - /* 380 */ "tag_list_opt", - /* 381 */ "tag_item", - /* 382 */ "column_alias", - /* 383 */ "index_options", - /* 384 */ "func_list", - /* 385 */ "sliding_opt", - /* 386 */ "sma_stream_opt", - /* 387 */ "func", - /* 388 */ "sma_func_name", - /* 389 */ "query_or_subquery", - /* 390 */ "cgroup_name", - /* 391 */ "analyze_opt", - /* 392 */ "explain_options", - /* 393 */ "agg_func_opt", - /* 394 */ "bufsize_opt", - /* 395 */ "stream_name", - /* 396 */ "stream_options", - /* 397 */ "subtable_opt", - /* 398 */ "expression", - /* 399 */ "dnode_list", - /* 400 */ "where_clause_opt", - /* 401 */ "signed", - /* 402 */ "literal_func", - /* 403 */ "literal_list", - /* 404 */ "table_alias", - /* 405 */ "expr_or_subquery", - /* 406 */ "pseudo_column", - /* 407 */ "column_reference", - /* 408 */ "function_expression", - /* 409 */ "case_when_expression", - /* 410 */ "star_func", - /* 411 */ "star_func_para_list", - /* 412 */ "noarg_func", - /* 413 */ "other_para_list", - /* 414 */ "star_func_para", - /* 415 */ "when_then_list", - /* 416 */ "case_when_else_opt", - /* 417 */ "common_expression", - /* 418 */ "when_then_expr", - /* 419 */ "predicate", - /* 420 */ "compare_op", - /* 421 */ "in_op", - /* 422 */ "in_predicate_value", - /* 423 */ "boolean_value_expression", - /* 424 */ "boolean_primary", - /* 425 */ "from_clause_opt", - /* 426 */ "table_reference_list", - /* 427 */ "table_reference", - /* 428 */ "table_primary", - /* 429 */ "joined_table", - /* 430 */ "alias_opt", - /* 431 */ "subquery", - /* 432 */ "parenthesized_joined_table", - /* 433 */ "join_type", - /* 434 */ "search_condition", - /* 435 */ "query_specification", - /* 436 */ "set_quantifier_opt", - /* 437 */ "select_list", - /* 438 */ "partition_by_clause_opt", - /* 439 */ "range_opt", - /* 440 */ "every_opt", - /* 441 */ "fill_opt", - /* 442 */ "twindow_clause_opt", - /* 443 */ "group_by_clause_opt", - /* 444 */ "having_clause_opt", - /* 445 */ "select_item", - /* 446 */ "partition_list", - /* 447 */ "partition_item", - /* 448 */ "fill_mode", - /* 449 */ "group_by_list", - /* 450 */ "query_expression", - /* 451 */ "query_simple", - /* 452 */ "order_by_clause_opt", - /* 453 */ "slimit_clause_opt", - /* 454 */ "limit_clause_opt", - /* 455 */ "union_query_expression", - /* 456 */ "query_simple_or_subquery", - /* 457 */ "sort_specification_list", - /* 458 */ "sort_specification", - /* 459 */ "ordering_specification_opt", - /* 460 */ "null_ordering_opt", + /* 160 */ "ALIVE", + /* 161 */ "LIKE", + /* 162 */ "TBNAME", + /* 163 */ "QTAGS", + /* 164 */ "AS", + /* 165 */ "INDEX", + /* 166 */ "FUNCTION", + /* 167 */ "INTERVAL", + /* 168 */ "COUNT", + /* 169 */ "LAST_ROW", + /* 170 */ "TOPIC", + /* 171 */ "WITH", + /* 172 */ "META", + /* 173 */ "CONSUMER", + /* 174 */ "GROUP", + /* 175 */ "DESC", + /* 176 */ "DESCRIBE", + /* 177 */ "RESET", + /* 178 */ "QUERY", + /* 179 */ "CACHE", + /* 180 */ "EXPLAIN", + /* 181 */ "ANALYZE", + /* 182 */ "VERBOSE", + /* 183 */ "NK_BOOL", + /* 184 */ "RATIO", + /* 185 */ "NK_FLOAT", + /* 186 */ "OUTPUTTYPE", + /* 187 */ "AGGREGATE", + /* 188 */ "BUFSIZE", + /* 189 */ "STREAM", + /* 190 */ "INTO", + /* 191 */ "TRIGGER", + /* 192 */ "AT_ONCE", + /* 193 */ "WINDOW_CLOSE", + /* 194 */ "IGNORE", + /* 195 */ "EXPIRED", + /* 196 */ "FILL_HISTORY", + /* 197 */ "SUBTABLE", + /* 198 */ "KILL", + /* 199 */ "CONNECTION", + /* 200 */ "TRANSACTION", + /* 201 */ "BALANCE", + /* 202 */ "VGROUP", + /* 203 */ "MERGE", + /* 204 */ "REDISTRIBUTE", + /* 205 */ "SPLIT", + /* 206 */ "DELETE", + /* 207 */ "INSERT", + /* 208 */ "NULL", + /* 209 */ "NK_QUESTION", + /* 210 */ "NK_ARROW", + /* 211 */ "ROWTS", + /* 212 */ "QSTART", + /* 213 */ "QEND", + /* 214 */ "QDURATION", + /* 215 */ "WSTART", + /* 216 */ "WEND", + /* 217 */ "WDURATION", + /* 218 */ "IROWTS", + /* 219 */ "ISFILLED", + /* 220 */ "CAST", + /* 221 */ "NOW", + /* 222 */ "TODAY", + /* 223 */ "TIMEZONE", + /* 224 */ "CLIENT_VERSION", + /* 225 */ "SERVER_VERSION", + /* 226 */ "SERVER_STATUS", + /* 227 */ "CURRENT_USER", + /* 228 */ "CASE", + /* 229 */ "END", + /* 230 */ "WHEN", + /* 231 */ "THEN", + /* 232 */ "ELSE", + /* 233 */ "BETWEEN", + /* 234 */ "IS", + /* 235 */ "NK_LT", + /* 236 */ "NK_GT", + /* 237 */ "NK_LE", + /* 238 */ "NK_GE", + /* 239 */ "NK_NE", + /* 240 */ "MATCH", + /* 241 */ "NMATCH", + /* 242 */ "CONTAINS", + /* 243 */ "IN", + /* 244 */ "JOIN", + /* 245 */ "INNER", + /* 246 */ "SELECT", + /* 247 */ "DISTINCT", + /* 248 */ "WHERE", + /* 249 */ "PARTITION", + /* 250 */ "BY", + /* 251 */ "SESSION", + /* 252 */ "STATE_WINDOW", + /* 253 */ "EVENT_WINDOW", + /* 254 */ "START", + /* 255 */ "SLIDING", + /* 256 */ "FILL", + /* 257 */ "VALUE", + /* 258 */ "NONE", + /* 259 */ "PREV", + /* 260 */ "LINEAR", + /* 261 */ "NEXT", + /* 262 */ "HAVING", + /* 263 */ "RANGE", + /* 264 */ "EVERY", + /* 265 */ "ORDER", + /* 266 */ "SLIMIT", + /* 267 */ "SOFFSET", + /* 268 */ "LIMIT", + /* 269 */ "OFFSET", + /* 270 */ "ASC", + /* 271 */ "NULLS", + /* 272 */ "ABORT", + /* 273 */ "AFTER", + /* 274 */ "ATTACH", + /* 275 */ "BEFORE", + /* 276 */ "BEGIN", + /* 277 */ "BITAND", + /* 278 */ "BITNOT", + /* 279 */ "BITOR", + /* 280 */ "BLOCKS", + /* 281 */ "CHANGE", + /* 282 */ "COMMA", + /* 283 */ "COMPACT", + /* 284 */ "CONCAT", + /* 285 */ "CONFLICT", + /* 286 */ "COPY", + /* 287 */ "DEFERRED", + /* 288 */ "DELIMITERS", + /* 289 */ "DETACH", + /* 290 */ "DIVIDE", + /* 291 */ "DOT", + /* 292 */ "EACH", + /* 293 */ "FAIL", + /* 294 */ "FILE", + /* 295 */ "FOR", + /* 296 */ "GLOB", + /* 297 */ "ID", + /* 298 */ "IMMEDIATE", + /* 299 */ "IMPORT", + /* 300 */ "INITIALLY", + /* 301 */ "INSTEAD", + /* 302 */ "ISNULL", + /* 303 */ "KEY", + /* 304 */ "MODULES", + /* 305 */ "NK_BITNOT", + /* 306 */ "NK_SEMI", + /* 307 */ "NOTNULL", + /* 308 */ "OF", + /* 309 */ "PLUS", + /* 310 */ "PRIVILEGE", + /* 311 */ "RAISE", + /* 312 */ "REPLACE", + /* 313 */ "RESTRICT", + /* 314 */ "ROW", + /* 315 */ "SEMI", + /* 316 */ "STAR", + /* 317 */ "STATEMENT", + /* 318 */ "STRICT", + /* 319 */ "STRING", + /* 320 */ "TIMES", + /* 321 */ "UPDATE", + /* 322 */ "VALUES", + /* 323 */ "VARIABLE", + /* 324 */ "VIEW", + /* 325 */ "WAL", + /* 326 */ "cmd", + /* 327 */ "account_options", + /* 328 */ "alter_account_options", + /* 329 */ "literal", + /* 330 */ "alter_account_option", + /* 331 */ "user_name", + /* 332 */ "sysinfo_opt", + /* 333 */ "privileges", + /* 334 */ "priv_level", + /* 335 */ "priv_type_list", + /* 336 */ "priv_type", + /* 337 */ "db_name", + /* 338 */ "topic_name", + /* 339 */ "dnode_endpoint", + /* 340 */ "force_opt", + /* 341 */ "not_exists_opt", + /* 342 */ "db_options", + /* 343 */ "exists_opt", + /* 344 */ "alter_db_options", + /* 345 */ "speed_opt", + /* 346 */ "integer_list", + /* 347 */ "variable_list", + /* 348 */ "retention_list", + /* 349 */ "alter_db_option", + /* 350 */ "retention", + /* 351 */ "full_table_name", + /* 352 */ "column_def_list", + /* 353 */ "tags_def_opt", + /* 354 */ "table_options", + /* 355 */ "multi_create_clause", + /* 356 */ "tags_def", + /* 357 */ "multi_drop_clause", + /* 358 */ "alter_table_clause", + /* 359 */ "alter_table_options", + /* 360 */ "column_name", + /* 361 */ "type_name", + /* 362 */ "signed_literal", + /* 363 */ "create_subtable_clause", + /* 364 */ "specific_cols_opt", + /* 365 */ "expression_list", + /* 366 */ "drop_table_clause", + /* 367 */ "col_name_list", + /* 368 */ "table_name", + /* 369 */ "column_def", + /* 370 */ "duration_list", + /* 371 */ "rollup_func_list", + /* 372 */ "alter_table_option", + /* 373 */ "duration_literal", + /* 374 */ "rollup_func_name", + /* 375 */ "function_name", + /* 376 */ "col_name", + /* 377 */ "db_name_cond_opt", + /* 378 */ "like_pattern_opt", + /* 379 */ "table_name_cond", + /* 380 */ "from_db_opt", + /* 381 */ "tag_list_opt", + /* 382 */ "tag_item", + /* 383 */ "column_alias", + /* 384 */ "index_options", + /* 385 */ "func_list", + /* 386 */ "sliding_opt", + /* 387 */ "sma_stream_opt", + /* 388 */ "func", + /* 389 */ "sma_func_name", + /* 390 */ "query_or_subquery", + /* 391 */ "cgroup_name", + /* 392 */ "analyze_opt", + /* 393 */ "explain_options", + /* 394 */ "agg_func_opt", + /* 395 */ "bufsize_opt", + /* 396 */ "stream_name", + /* 397 */ "stream_options", + /* 398 */ "col_list_opt", + /* 399 */ "subtable_opt", + /* 400 */ "expression", + /* 401 */ "dnode_list", + /* 402 */ "where_clause_opt", + /* 403 */ "signed", + /* 404 */ "literal_func", + /* 405 */ "literal_list", + /* 406 */ "table_alias", + /* 407 */ "expr_or_subquery", + /* 408 */ "pseudo_column", + /* 409 */ "column_reference", + /* 410 */ "function_expression", + /* 411 */ "case_when_expression", + /* 412 */ "star_func", + /* 413 */ "star_func_para_list", + /* 414 */ "noarg_func", + /* 415 */ "other_para_list", + /* 416 */ "star_func_para", + /* 417 */ "when_then_list", + /* 418 */ "case_when_else_opt", + /* 419 */ "common_expression", + /* 420 */ "when_then_expr", + /* 421 */ "predicate", + /* 422 */ "compare_op", + /* 423 */ "in_op", + /* 424 */ "in_predicate_value", + /* 425 */ "boolean_value_expression", + /* 426 */ "boolean_primary", + /* 427 */ "from_clause_opt", + /* 428 */ "table_reference_list", + /* 429 */ "table_reference", + /* 430 */ "table_primary", + /* 431 */ "joined_table", + /* 432 */ "alias_opt", + /* 433 */ "subquery", + /* 434 */ "parenthesized_joined_table", + /* 435 */ "join_type", + /* 436 */ "search_condition", + /* 437 */ "query_specification", + /* 438 */ "set_quantifier_opt", + /* 439 */ "select_list", + /* 440 */ "partition_by_clause_opt", + /* 441 */ "range_opt", + /* 442 */ "every_opt", + /* 443 */ "fill_opt", + /* 444 */ "twindow_clause_opt", + /* 445 */ "group_by_clause_opt", + /* 446 */ "having_clause_opt", + /* 447 */ "select_item", + /* 448 */ "partition_list", + /* 449 */ "partition_item", + /* 450 */ "fill_mode", + /* 451 */ "group_by_list", + /* 452 */ "query_expression", + /* 453 */ "query_simple", + /* 454 */ "order_by_clause_opt", + /* 455 */ "slimit_clause_opt", + /* 456 */ "limit_clause_opt", + /* 457 */ "union_query_expression", + /* 458 */ "query_simple_or_subquery", + /* 459 */ "sort_specification_list", + /* 460 */ "sort_specification", + /* 461 */ "ordering_specification_opt", + /* 462 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2198,306 +2150,311 @@ static const char *const yyRuleName[] = { /* 242 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", /* 243 */ "cmd ::= SHOW VNODES NK_INTEGER", /* 244 */ "cmd ::= SHOW VNODES NK_STRING", - /* 245 */ "db_name_cond_opt ::=", - /* 246 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 247 */ "like_pattern_opt ::=", - /* 248 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 249 */ "table_name_cond ::= table_name", - /* 250 */ "from_db_opt ::=", - /* 251 */ "from_db_opt ::= FROM db_name", - /* 252 */ "tag_list_opt ::=", - /* 253 */ "tag_list_opt ::= tag_item", - /* 254 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 255 */ "tag_item ::= TBNAME", - /* 256 */ "tag_item ::= QTAGS", - /* 257 */ "tag_item ::= column_name", - /* 258 */ "tag_item ::= column_name column_alias", - /* 259 */ "tag_item ::= column_name AS column_alias", - /* 260 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", - /* 261 */ "cmd ::= DROP INDEX exists_opt full_table_name", - /* 262 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 263 */ "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", - /* 264 */ "func_list ::= func", - /* 265 */ "func_list ::= func_list NK_COMMA func", - /* 266 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 267 */ "sma_func_name ::= function_name", - /* 268 */ "sma_func_name ::= COUNT", - /* 269 */ "sma_func_name ::= FIRST", - /* 270 */ "sma_func_name ::= LAST", - /* 271 */ "sma_func_name ::= LAST_ROW", - /* 272 */ "sma_stream_opt ::=", - /* 273 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 274 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 275 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 276 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 277 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 278 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 279 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 280 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 281 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 282 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 283 */ "cmd ::= DESC full_table_name", - /* 284 */ "cmd ::= DESCRIBE full_table_name", - /* 285 */ "cmd ::= RESET QUERY CACHE", - /* 286 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 287 */ "analyze_opt ::=", - /* 288 */ "analyze_opt ::= ANALYZE", - /* 289 */ "explain_options ::=", - /* 290 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 291 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 292 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 293 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 294 */ "agg_func_opt ::=", - /* 295 */ "agg_func_opt ::= AGGREGATE", - /* 296 */ "bufsize_opt ::=", - /* 297 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 298 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", - /* 299 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 300 */ "stream_options ::=", - /* 301 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 302 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 303 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 304 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 305 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 306 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 307 */ "subtable_opt ::=", - /* 308 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 309 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 310 */ "cmd ::= KILL QUERY NK_STRING", - /* 311 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 312 */ "cmd ::= BALANCE VGROUP", - /* 313 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 314 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 315 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 316 */ "dnode_list ::= DNODE NK_INTEGER", - /* 317 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 318 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 319 */ "cmd ::= query_or_subquery", - /* 320 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 321 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", - /* 322 */ "literal ::= NK_INTEGER", - /* 323 */ "literal ::= NK_FLOAT", - /* 324 */ "literal ::= NK_STRING", - /* 325 */ "literal ::= NK_BOOL", - /* 326 */ "literal ::= TIMESTAMP NK_STRING", - /* 327 */ "literal ::= duration_literal", - /* 328 */ "literal ::= NULL", - /* 329 */ "literal ::= NK_QUESTION", - /* 330 */ "duration_literal ::= NK_VARIABLE", - /* 331 */ "signed ::= NK_INTEGER", - /* 332 */ "signed ::= NK_PLUS NK_INTEGER", - /* 333 */ "signed ::= NK_MINUS NK_INTEGER", - /* 334 */ "signed ::= NK_FLOAT", - /* 335 */ "signed ::= NK_PLUS NK_FLOAT", - /* 336 */ "signed ::= NK_MINUS NK_FLOAT", - /* 337 */ "signed_literal ::= signed", - /* 338 */ "signed_literal ::= NK_STRING", - /* 339 */ "signed_literal ::= NK_BOOL", - /* 340 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 341 */ "signed_literal ::= duration_literal", - /* 342 */ "signed_literal ::= NULL", - /* 343 */ "signed_literal ::= literal_func", - /* 344 */ "signed_literal ::= NK_QUESTION", - /* 345 */ "literal_list ::= signed_literal", - /* 346 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 347 */ "db_name ::= NK_ID", - /* 348 */ "table_name ::= NK_ID", - /* 349 */ "column_name ::= NK_ID", - /* 350 */ "function_name ::= NK_ID", - /* 351 */ "table_alias ::= NK_ID", - /* 352 */ "column_alias ::= NK_ID", - /* 353 */ "user_name ::= NK_ID", - /* 354 */ "topic_name ::= NK_ID", - /* 355 */ "stream_name ::= NK_ID", - /* 356 */ "cgroup_name ::= NK_ID", - /* 357 */ "expr_or_subquery ::= expression", - /* 358 */ "expression ::= literal", - /* 359 */ "expression ::= pseudo_column", - /* 360 */ "expression ::= column_reference", - /* 361 */ "expression ::= function_expression", - /* 362 */ "expression ::= case_when_expression", - /* 363 */ "expression ::= NK_LP expression NK_RP", - /* 364 */ "expression ::= NK_PLUS expr_or_subquery", - /* 365 */ "expression ::= NK_MINUS expr_or_subquery", - /* 366 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 367 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 368 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 369 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 370 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 371 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 372 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 373 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 374 */ "expression_list ::= expr_or_subquery", - /* 375 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 376 */ "column_reference ::= column_name", - /* 377 */ "column_reference ::= table_name NK_DOT column_name", - /* 378 */ "pseudo_column ::= ROWTS", - /* 379 */ "pseudo_column ::= TBNAME", - /* 380 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 381 */ "pseudo_column ::= QSTART", - /* 382 */ "pseudo_column ::= QEND", - /* 383 */ "pseudo_column ::= QDURATION", - /* 384 */ "pseudo_column ::= WSTART", - /* 385 */ "pseudo_column ::= WEND", - /* 386 */ "pseudo_column ::= WDURATION", - /* 387 */ "pseudo_column ::= IROWTS", - /* 388 */ "pseudo_column ::= ISFILLED", - /* 389 */ "pseudo_column ::= QTAGS", - /* 390 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 391 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 392 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 393 */ "function_expression ::= literal_func", - /* 394 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 395 */ "literal_func ::= NOW", - /* 396 */ "noarg_func ::= NOW", - /* 397 */ "noarg_func ::= TODAY", - /* 398 */ "noarg_func ::= TIMEZONE", - /* 399 */ "noarg_func ::= DATABASE", - /* 400 */ "noarg_func ::= CLIENT_VERSION", - /* 401 */ "noarg_func ::= SERVER_VERSION", - /* 402 */ "noarg_func ::= SERVER_STATUS", - /* 403 */ "noarg_func ::= CURRENT_USER", - /* 404 */ "noarg_func ::= USER", - /* 405 */ "star_func ::= COUNT", - /* 406 */ "star_func ::= FIRST", - /* 407 */ "star_func ::= LAST", - /* 408 */ "star_func ::= LAST_ROW", - /* 409 */ "star_func_para_list ::= NK_STAR", - /* 410 */ "star_func_para_list ::= other_para_list", - /* 411 */ "other_para_list ::= star_func_para", - /* 412 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 413 */ "star_func_para ::= expr_or_subquery", - /* 414 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 415 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 416 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 417 */ "when_then_list ::= when_then_expr", - /* 418 */ "when_then_list ::= when_then_list when_then_expr", - /* 419 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 420 */ "case_when_else_opt ::=", - /* 421 */ "case_when_else_opt ::= ELSE common_expression", - /* 422 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 423 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 424 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 425 */ "predicate ::= expr_or_subquery IS NULL", - /* 426 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 427 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 428 */ "compare_op ::= NK_LT", - /* 429 */ "compare_op ::= NK_GT", - /* 430 */ "compare_op ::= NK_LE", - /* 431 */ "compare_op ::= NK_GE", - /* 432 */ "compare_op ::= NK_NE", - /* 433 */ "compare_op ::= NK_EQ", - /* 434 */ "compare_op ::= LIKE", - /* 435 */ "compare_op ::= NOT LIKE", - /* 436 */ "compare_op ::= MATCH", - /* 437 */ "compare_op ::= NMATCH", - /* 438 */ "compare_op ::= CONTAINS", - /* 439 */ "in_op ::= IN", - /* 440 */ "in_op ::= NOT IN", - /* 441 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 442 */ "boolean_value_expression ::= boolean_primary", - /* 443 */ "boolean_value_expression ::= NOT boolean_primary", - /* 444 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 445 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 446 */ "boolean_primary ::= predicate", - /* 447 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 448 */ "common_expression ::= expr_or_subquery", - /* 449 */ "common_expression ::= boolean_value_expression", - /* 450 */ "from_clause_opt ::=", - /* 451 */ "from_clause_opt ::= FROM table_reference_list", - /* 452 */ "table_reference_list ::= table_reference", - /* 453 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 454 */ "table_reference ::= table_primary", - /* 455 */ "table_reference ::= joined_table", - /* 456 */ "table_primary ::= table_name alias_opt", - /* 457 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 458 */ "table_primary ::= subquery alias_opt", - /* 459 */ "table_primary ::= parenthesized_joined_table", - /* 460 */ "alias_opt ::=", - /* 461 */ "alias_opt ::= table_alias", - /* 462 */ "alias_opt ::= AS table_alias", - /* 463 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 464 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 465 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 466 */ "join_type ::=", - /* 467 */ "join_type ::= INNER", - /* 468 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 469 */ "set_quantifier_opt ::=", - /* 470 */ "set_quantifier_opt ::= DISTINCT", - /* 471 */ "set_quantifier_opt ::= ALL", - /* 472 */ "select_list ::= select_item", - /* 473 */ "select_list ::= select_list NK_COMMA select_item", - /* 474 */ "select_item ::= NK_STAR", - /* 475 */ "select_item ::= common_expression", - /* 476 */ "select_item ::= common_expression column_alias", - /* 477 */ "select_item ::= common_expression AS column_alias", - /* 478 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 479 */ "where_clause_opt ::=", - /* 480 */ "where_clause_opt ::= WHERE search_condition", - /* 481 */ "partition_by_clause_opt ::=", - /* 482 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 483 */ "partition_list ::= partition_item", - /* 484 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 485 */ "partition_item ::= expr_or_subquery", - /* 486 */ "partition_item ::= expr_or_subquery column_alias", - /* 487 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 488 */ "twindow_clause_opt ::=", - /* 489 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 490 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 491 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 492 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 493 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 494 */ "sliding_opt ::=", - /* 495 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 496 */ "fill_opt ::=", - /* 497 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 498 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 499 */ "fill_mode ::= NONE", - /* 500 */ "fill_mode ::= PREV", - /* 501 */ "fill_mode ::= NULL", - /* 502 */ "fill_mode ::= LINEAR", - /* 503 */ "fill_mode ::= NEXT", - /* 504 */ "group_by_clause_opt ::=", - /* 505 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 506 */ "group_by_list ::= expr_or_subquery", - /* 507 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 508 */ "having_clause_opt ::=", - /* 509 */ "having_clause_opt ::= HAVING search_condition", - /* 510 */ "range_opt ::=", - /* 511 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 512 */ "every_opt ::=", - /* 513 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 514 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 515 */ "query_simple ::= query_specification", - /* 516 */ "query_simple ::= union_query_expression", - /* 517 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 518 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 519 */ "query_simple_or_subquery ::= query_simple", - /* 520 */ "query_simple_or_subquery ::= subquery", - /* 521 */ "query_or_subquery ::= query_expression", - /* 522 */ "query_or_subquery ::= subquery", - /* 523 */ "order_by_clause_opt ::=", - /* 524 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 525 */ "slimit_clause_opt ::=", - /* 526 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 527 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 528 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 529 */ "limit_clause_opt ::=", - /* 530 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 531 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 532 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 533 */ "subquery ::= NK_LP query_expression NK_RP", - /* 534 */ "subquery ::= NK_LP subquery NK_RP", - /* 535 */ "search_condition ::= common_expression", - /* 536 */ "sort_specification_list ::= sort_specification", - /* 537 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 538 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 539 */ "ordering_specification_opt ::=", - /* 540 */ "ordering_specification_opt ::= ASC", - /* 541 */ "ordering_specification_opt ::= DESC", - /* 542 */ "null_ordering_opt ::=", - /* 543 */ "null_ordering_opt ::= NULLS FIRST", - /* 544 */ "null_ordering_opt ::= NULLS LAST", + /* 245 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 246 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 247 */ "db_name_cond_opt ::=", + /* 248 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 249 */ "like_pattern_opt ::=", + /* 250 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 251 */ "table_name_cond ::= table_name", + /* 252 */ "from_db_opt ::=", + /* 253 */ "from_db_opt ::= FROM db_name", + /* 254 */ "tag_list_opt ::=", + /* 255 */ "tag_list_opt ::= tag_item", + /* 256 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 257 */ "tag_item ::= TBNAME", + /* 258 */ "tag_item ::= QTAGS", + /* 259 */ "tag_item ::= column_name", + /* 260 */ "tag_item ::= column_name column_alias", + /* 261 */ "tag_item ::= column_name AS column_alias", + /* 262 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", + /* 263 */ "cmd ::= CREATE INDEX not_exists_opt full_table_name ON full_table_name NK_LP col_name_list NK_RP", + /* 264 */ "cmd ::= DROP INDEX exists_opt full_table_name", + /* 265 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 266 */ "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", + /* 267 */ "func_list ::= func", + /* 268 */ "func_list ::= func_list NK_COMMA func", + /* 269 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 270 */ "sma_func_name ::= function_name", + /* 271 */ "sma_func_name ::= COUNT", + /* 272 */ "sma_func_name ::= FIRST", + /* 273 */ "sma_func_name ::= LAST", + /* 274 */ "sma_func_name ::= LAST_ROW", + /* 275 */ "sma_stream_opt ::=", + /* 276 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 277 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 278 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 279 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 280 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 281 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 282 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 283 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 284 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 285 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 286 */ "cmd ::= DESC full_table_name", + /* 287 */ "cmd ::= DESCRIBE full_table_name", + /* 288 */ "cmd ::= RESET QUERY CACHE", + /* 289 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 290 */ "analyze_opt ::=", + /* 291 */ "analyze_opt ::= ANALYZE", + /* 292 */ "explain_options ::=", + /* 293 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 294 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 295 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 296 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 297 */ "agg_func_opt ::=", + /* 298 */ "agg_func_opt ::= AGGREGATE", + /* 299 */ "bufsize_opt ::=", + /* 300 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 301 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tags_def_opt subtable_opt AS query_or_subquery", + /* 302 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 303 */ "col_list_opt ::=", + /* 304 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 305 */ "stream_options ::=", + /* 306 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 307 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 308 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 309 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 310 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 311 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 312 */ "subtable_opt ::=", + /* 313 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 314 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 315 */ "cmd ::= KILL QUERY NK_STRING", + /* 316 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 317 */ "cmd ::= BALANCE VGROUP", + /* 318 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 319 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 320 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 321 */ "dnode_list ::= DNODE NK_INTEGER", + /* 322 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 323 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 324 */ "cmd ::= query_or_subquery", + /* 325 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 326 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", + /* 327 */ "literal ::= NK_INTEGER", + /* 328 */ "literal ::= NK_FLOAT", + /* 329 */ "literal ::= NK_STRING", + /* 330 */ "literal ::= NK_BOOL", + /* 331 */ "literal ::= TIMESTAMP NK_STRING", + /* 332 */ "literal ::= duration_literal", + /* 333 */ "literal ::= NULL", + /* 334 */ "literal ::= NK_QUESTION", + /* 335 */ "duration_literal ::= NK_VARIABLE", + /* 336 */ "signed ::= NK_INTEGER", + /* 337 */ "signed ::= NK_PLUS NK_INTEGER", + /* 338 */ "signed ::= NK_MINUS NK_INTEGER", + /* 339 */ "signed ::= NK_FLOAT", + /* 340 */ "signed ::= NK_PLUS NK_FLOAT", + /* 341 */ "signed ::= NK_MINUS NK_FLOAT", + /* 342 */ "signed_literal ::= signed", + /* 343 */ "signed_literal ::= NK_STRING", + /* 344 */ "signed_literal ::= NK_BOOL", + /* 345 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 346 */ "signed_literal ::= duration_literal", + /* 347 */ "signed_literal ::= NULL", + /* 348 */ "signed_literal ::= literal_func", + /* 349 */ "signed_literal ::= NK_QUESTION", + /* 350 */ "literal_list ::= signed_literal", + /* 351 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 352 */ "db_name ::= NK_ID", + /* 353 */ "table_name ::= NK_ID", + /* 354 */ "column_name ::= NK_ID", + /* 355 */ "function_name ::= NK_ID", + /* 356 */ "table_alias ::= NK_ID", + /* 357 */ "column_alias ::= NK_ID", + /* 358 */ "user_name ::= NK_ID", + /* 359 */ "topic_name ::= NK_ID", + /* 360 */ "stream_name ::= NK_ID", + /* 361 */ "cgroup_name ::= NK_ID", + /* 362 */ "expr_or_subquery ::= expression", + /* 363 */ "expression ::= literal", + /* 364 */ "expression ::= pseudo_column", + /* 365 */ "expression ::= column_reference", + /* 366 */ "expression ::= function_expression", + /* 367 */ "expression ::= case_when_expression", + /* 368 */ "expression ::= NK_LP expression NK_RP", + /* 369 */ "expression ::= NK_PLUS expr_or_subquery", + /* 370 */ "expression ::= NK_MINUS expr_or_subquery", + /* 371 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 372 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 373 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 374 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 375 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 376 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 377 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 378 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 379 */ "expression_list ::= expr_or_subquery", + /* 380 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 381 */ "column_reference ::= column_name", + /* 382 */ "column_reference ::= table_name NK_DOT column_name", + /* 383 */ "pseudo_column ::= ROWTS", + /* 384 */ "pseudo_column ::= TBNAME", + /* 385 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 386 */ "pseudo_column ::= QSTART", + /* 387 */ "pseudo_column ::= QEND", + /* 388 */ "pseudo_column ::= QDURATION", + /* 389 */ "pseudo_column ::= WSTART", + /* 390 */ "pseudo_column ::= WEND", + /* 391 */ "pseudo_column ::= WDURATION", + /* 392 */ "pseudo_column ::= IROWTS", + /* 393 */ "pseudo_column ::= ISFILLED", + /* 394 */ "pseudo_column ::= QTAGS", + /* 395 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 396 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 397 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 398 */ "function_expression ::= literal_func", + /* 399 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 400 */ "literal_func ::= NOW", + /* 401 */ "noarg_func ::= NOW", + /* 402 */ "noarg_func ::= TODAY", + /* 403 */ "noarg_func ::= TIMEZONE", + /* 404 */ "noarg_func ::= DATABASE", + /* 405 */ "noarg_func ::= CLIENT_VERSION", + /* 406 */ "noarg_func ::= SERVER_VERSION", + /* 407 */ "noarg_func ::= SERVER_STATUS", + /* 408 */ "noarg_func ::= CURRENT_USER", + /* 409 */ "noarg_func ::= USER", + /* 410 */ "star_func ::= COUNT", + /* 411 */ "star_func ::= FIRST", + /* 412 */ "star_func ::= LAST", + /* 413 */ "star_func ::= LAST_ROW", + /* 414 */ "star_func_para_list ::= NK_STAR", + /* 415 */ "star_func_para_list ::= other_para_list", + /* 416 */ "other_para_list ::= star_func_para", + /* 417 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 418 */ "star_func_para ::= expr_or_subquery", + /* 419 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 420 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 421 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 422 */ "when_then_list ::= when_then_expr", + /* 423 */ "when_then_list ::= when_then_list when_then_expr", + /* 424 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 425 */ "case_when_else_opt ::=", + /* 426 */ "case_when_else_opt ::= ELSE common_expression", + /* 427 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 428 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 429 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 430 */ "predicate ::= expr_or_subquery IS NULL", + /* 431 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 432 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 433 */ "compare_op ::= NK_LT", + /* 434 */ "compare_op ::= NK_GT", + /* 435 */ "compare_op ::= NK_LE", + /* 436 */ "compare_op ::= NK_GE", + /* 437 */ "compare_op ::= NK_NE", + /* 438 */ "compare_op ::= NK_EQ", + /* 439 */ "compare_op ::= LIKE", + /* 440 */ "compare_op ::= NOT LIKE", + /* 441 */ "compare_op ::= MATCH", + /* 442 */ "compare_op ::= NMATCH", + /* 443 */ "compare_op ::= CONTAINS", + /* 444 */ "in_op ::= IN", + /* 445 */ "in_op ::= NOT IN", + /* 446 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 447 */ "boolean_value_expression ::= boolean_primary", + /* 448 */ "boolean_value_expression ::= NOT boolean_primary", + /* 449 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 450 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 451 */ "boolean_primary ::= predicate", + /* 452 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 453 */ "common_expression ::= expr_or_subquery", + /* 454 */ "common_expression ::= boolean_value_expression", + /* 455 */ "from_clause_opt ::=", + /* 456 */ "from_clause_opt ::= FROM table_reference_list", + /* 457 */ "table_reference_list ::= table_reference", + /* 458 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 459 */ "table_reference ::= table_primary", + /* 460 */ "table_reference ::= joined_table", + /* 461 */ "table_primary ::= table_name alias_opt", + /* 462 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 463 */ "table_primary ::= subquery alias_opt", + /* 464 */ "table_primary ::= parenthesized_joined_table", + /* 465 */ "alias_opt ::=", + /* 466 */ "alias_opt ::= table_alias", + /* 467 */ "alias_opt ::= AS table_alias", + /* 468 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 469 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 470 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 471 */ "join_type ::=", + /* 472 */ "join_type ::= INNER", + /* 473 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 474 */ "set_quantifier_opt ::=", + /* 475 */ "set_quantifier_opt ::= DISTINCT", + /* 476 */ "set_quantifier_opt ::= ALL", + /* 477 */ "select_list ::= select_item", + /* 478 */ "select_list ::= select_list NK_COMMA select_item", + /* 479 */ "select_item ::= NK_STAR", + /* 480 */ "select_item ::= common_expression", + /* 481 */ "select_item ::= common_expression column_alias", + /* 482 */ "select_item ::= common_expression AS column_alias", + /* 483 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 484 */ "where_clause_opt ::=", + /* 485 */ "where_clause_opt ::= WHERE search_condition", + /* 486 */ "partition_by_clause_opt ::=", + /* 487 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 488 */ "partition_list ::= partition_item", + /* 489 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 490 */ "partition_item ::= expr_or_subquery", + /* 491 */ "partition_item ::= expr_or_subquery column_alias", + /* 492 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 493 */ "twindow_clause_opt ::=", + /* 494 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 495 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 496 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 497 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 498 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 499 */ "sliding_opt ::=", + /* 500 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 501 */ "fill_opt ::=", + /* 502 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 503 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 504 */ "fill_mode ::= NONE", + /* 505 */ "fill_mode ::= PREV", + /* 506 */ "fill_mode ::= NULL", + /* 507 */ "fill_mode ::= LINEAR", + /* 508 */ "fill_mode ::= NEXT", + /* 509 */ "group_by_clause_opt ::=", + /* 510 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 511 */ "group_by_list ::= expr_or_subquery", + /* 512 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 513 */ "having_clause_opt ::=", + /* 514 */ "having_clause_opt ::= HAVING search_condition", + /* 515 */ "range_opt ::=", + /* 516 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 517 */ "every_opt ::=", + /* 518 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 519 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 520 */ "query_simple ::= query_specification", + /* 521 */ "query_simple ::= union_query_expression", + /* 522 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 523 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 524 */ "query_simple_or_subquery ::= query_simple", + /* 525 */ "query_simple_or_subquery ::= subquery", + /* 526 */ "query_or_subquery ::= query_expression", + /* 527 */ "query_or_subquery ::= subquery", + /* 528 */ "order_by_clause_opt ::=", + /* 529 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 530 */ "slimit_clause_opt ::=", + /* 531 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 532 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 533 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 534 */ "limit_clause_opt ::=", + /* 535 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 536 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 537 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 538 */ "subquery ::= NK_LP query_expression NK_RP", + /* 539 */ "subquery ::= NK_LP subquery NK_RP", + /* 540 */ "search_condition ::= common_expression", + /* 541 */ "sort_specification_list ::= sort_specification", + /* 542 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 543 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 544 */ "ordering_specification_opt ::=", + /* 545 */ "ordering_specification_opt ::= ASC", + /* 546 */ "ordering_specification_opt ::= DESC", + /* 547 */ "null_ordering_opt ::=", + /* 548 */ "null_ordering_opt ::= NULLS FIRST", + /* 549 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2624,194 +2581,195 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 325: /* cmd */ - case 328: /* literal */ - case 341: /* db_options */ - case 343: /* alter_db_options */ - case 349: /* retention */ - case 350: /* full_table_name */ - case 353: /* table_options */ - case 357: /* alter_table_clause */ - case 358: /* alter_table_options */ - case 361: /* signed_literal */ - case 362: /* create_subtable_clause */ - case 365: /* drop_table_clause */ - case 368: /* column_def */ - case 372: /* duration_literal */ - case 373: /* rollup_func_name */ - case 375: /* col_name */ - case 376: /* db_name_cond_opt */ - case 377: /* like_pattern_opt */ - case 378: /* table_name_cond */ - case 379: /* from_db_opt */ - case 381: /* tag_item */ - case 383: /* index_options */ - case 385: /* sliding_opt */ - case 386: /* sma_stream_opt */ - case 387: /* func */ - case 389: /* query_or_subquery */ - case 392: /* explain_options */ - case 396: /* stream_options */ - case 397: /* subtable_opt */ - case 398: /* expression */ - case 400: /* where_clause_opt */ - case 401: /* signed */ - case 402: /* literal_func */ - case 405: /* expr_or_subquery */ - case 406: /* pseudo_column */ - case 407: /* column_reference */ - case 408: /* function_expression */ - case 409: /* case_when_expression */ - case 414: /* star_func_para */ - case 416: /* case_when_else_opt */ - case 417: /* common_expression */ - case 418: /* when_then_expr */ - case 419: /* predicate */ - case 422: /* in_predicate_value */ - case 423: /* boolean_value_expression */ - case 424: /* boolean_primary */ - case 425: /* from_clause_opt */ - case 426: /* table_reference_list */ - case 427: /* table_reference */ - case 428: /* table_primary */ - case 429: /* joined_table */ - case 431: /* subquery */ - case 432: /* parenthesized_joined_table */ - case 434: /* search_condition */ - case 435: /* query_specification */ - case 439: /* range_opt */ - case 440: /* every_opt */ - case 441: /* fill_opt */ - case 442: /* twindow_clause_opt */ - case 444: /* having_clause_opt */ - case 445: /* select_item */ - case 447: /* partition_item */ - case 450: /* query_expression */ - case 451: /* query_simple */ - case 453: /* slimit_clause_opt */ - case 454: /* limit_clause_opt */ - case 455: /* union_query_expression */ - case 456: /* query_simple_or_subquery */ - case 458: /* sort_specification */ + case 326: /* cmd */ + case 329: /* literal */ + case 342: /* db_options */ + case 344: /* alter_db_options */ + case 350: /* retention */ + case 351: /* full_table_name */ + case 354: /* table_options */ + case 358: /* alter_table_clause */ + case 359: /* alter_table_options */ + case 362: /* signed_literal */ + case 363: /* create_subtable_clause */ + case 366: /* drop_table_clause */ + case 369: /* column_def */ + case 373: /* duration_literal */ + case 374: /* rollup_func_name */ + case 376: /* col_name */ + case 377: /* db_name_cond_opt */ + case 378: /* like_pattern_opt */ + case 379: /* table_name_cond */ + case 380: /* from_db_opt */ + case 382: /* tag_item */ + case 384: /* index_options */ + case 386: /* sliding_opt */ + case 387: /* sma_stream_opt */ + case 388: /* func */ + case 390: /* query_or_subquery */ + case 393: /* explain_options */ + case 397: /* stream_options */ + case 399: /* subtable_opt */ + case 400: /* expression */ + case 402: /* where_clause_opt */ + case 403: /* signed */ + case 404: /* literal_func */ + case 407: /* expr_or_subquery */ + case 408: /* pseudo_column */ + case 409: /* column_reference */ + case 410: /* function_expression */ + case 411: /* case_when_expression */ + case 416: /* star_func_para */ + case 418: /* case_when_else_opt */ + case 419: /* common_expression */ + case 420: /* when_then_expr */ + case 421: /* predicate */ + case 424: /* in_predicate_value */ + case 425: /* boolean_value_expression */ + case 426: /* boolean_primary */ + case 427: /* from_clause_opt */ + case 428: /* table_reference_list */ + case 429: /* table_reference */ + case 430: /* table_primary */ + case 431: /* joined_table */ + case 433: /* subquery */ + case 434: /* parenthesized_joined_table */ + case 436: /* search_condition */ + case 437: /* query_specification */ + case 441: /* range_opt */ + case 442: /* every_opt */ + case 443: /* fill_opt */ + case 444: /* twindow_clause_opt */ + case 446: /* having_clause_opt */ + case 447: /* select_item */ + case 449: /* partition_item */ + case 452: /* query_expression */ + case 453: /* query_simple */ + case 455: /* slimit_clause_opt */ + case 456: /* limit_clause_opt */ + case 457: /* union_query_expression */ + case 458: /* query_simple_or_subquery */ + case 460: /* sort_specification */ { - nodesDestroyNode((yypminor->yy600)); + nodesDestroyNode((yypminor->yy320)); } break; - case 326: /* account_options */ - case 327: /* alter_account_options */ - case 329: /* alter_account_option */ - case 344: /* speed_opt */ - case 394: /* bufsize_opt */ + case 327: /* account_options */ + case 328: /* alter_account_options */ + case 330: /* alter_account_option */ + case 345: /* speed_opt */ + case 395: /* bufsize_opt */ { } break; - case 330: /* user_name */ - case 333: /* priv_level */ - case 336: /* db_name */ - case 337: /* topic_name */ - case 338: /* dnode_endpoint */ - case 359: /* column_name */ - case 367: /* table_name */ - case 374: /* function_name */ - case 382: /* column_alias */ - case 388: /* sma_func_name */ - case 390: /* cgroup_name */ - case 395: /* stream_name */ - case 404: /* table_alias */ - case 410: /* star_func */ - case 412: /* noarg_func */ - case 430: /* alias_opt */ + case 331: /* user_name */ + case 334: /* priv_level */ + case 337: /* db_name */ + case 338: /* topic_name */ + case 339: /* dnode_endpoint */ + case 360: /* column_name */ + case 368: /* table_name */ + case 375: /* function_name */ + case 383: /* column_alias */ + case 389: /* sma_func_name */ + case 391: /* cgroup_name */ + case 396: /* stream_name */ + case 406: /* table_alias */ + case 412: /* star_func */ + case 414: /* noarg_func */ + case 432: /* alias_opt */ { } break; - case 331: /* sysinfo_opt */ + case 332: /* sysinfo_opt */ { } break; - case 332: /* privileges */ - case 334: /* priv_type_list */ - case 335: /* priv_type */ + case 333: /* privileges */ + case 335: /* priv_type_list */ + case 336: /* priv_type */ { } break; - case 339: /* force_opt */ - case 340: /* not_exists_opt */ - case 342: /* exists_opt */ - case 391: /* analyze_opt */ - case 393: /* agg_func_opt */ - case 436: /* set_quantifier_opt */ + case 340: /* force_opt */ + case 341: /* not_exists_opt */ + case 343: /* exists_opt */ + case 392: /* analyze_opt */ + case 394: /* agg_func_opt */ + case 438: /* set_quantifier_opt */ { } break; - case 345: /* integer_list */ - case 346: /* variable_list */ - case 347: /* retention_list */ - case 351: /* column_def_list */ - case 352: /* tags_def_opt */ - case 354: /* multi_create_clause */ - case 355: /* tags_def */ - case 356: /* multi_drop_clause */ - case 363: /* specific_cols_opt */ - case 364: /* expression_list */ - case 366: /* col_name_list */ - case 369: /* duration_list */ - case 370: /* rollup_func_list */ - case 380: /* tag_list_opt */ - case 384: /* func_list */ - case 399: /* dnode_list */ - case 403: /* literal_list */ - case 411: /* star_func_para_list */ - case 413: /* other_para_list */ - case 415: /* when_then_list */ - case 437: /* select_list */ - case 438: /* partition_by_clause_opt */ - case 443: /* group_by_clause_opt */ - case 446: /* partition_list */ - case 449: /* group_by_list */ - case 452: /* order_by_clause_opt */ - case 457: /* sort_specification_list */ + case 346: /* integer_list */ + case 347: /* variable_list */ + case 348: /* retention_list */ + case 352: /* column_def_list */ + case 353: /* tags_def_opt */ + case 355: /* multi_create_clause */ + case 356: /* tags_def */ + case 357: /* multi_drop_clause */ + case 364: /* specific_cols_opt */ + case 365: /* expression_list */ + case 367: /* col_name_list */ + case 370: /* duration_list */ + case 371: /* rollup_func_list */ + case 381: /* tag_list_opt */ + case 385: /* func_list */ + case 398: /* col_list_opt */ + case 401: /* dnode_list */ + case 405: /* literal_list */ + case 413: /* star_func_para_list */ + case 415: /* other_para_list */ + case 417: /* when_then_list */ + case 439: /* select_list */ + case 440: /* partition_by_clause_opt */ + case 445: /* group_by_clause_opt */ + case 448: /* partition_list */ + case 451: /* group_by_list */ + case 454: /* order_by_clause_opt */ + case 459: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy601)); + nodesDestroyList((yypminor->yy570)); } break; - case 348: /* alter_db_option */ - case 371: /* alter_table_option */ + case 349: /* alter_db_option */ + case 372: /* alter_table_option */ { } break; - case 360: /* type_name */ + case 361: /* type_name */ { } break; - case 420: /* compare_op */ - case 421: /* in_op */ + case 422: /* compare_op */ + case 423: /* in_op */ { } break; - case 433: /* join_type */ + case 435: /* join_type */ { } break; - case 448: /* fill_mode */ + case 450: /* fill_mode */ { } break; - case 459: /* ordering_specification_opt */ + case 461: /* ordering_specification_opt */ { } break; - case 460: /* null_ordering_opt */ + case 462: /* null_ordering_opt */ { } @@ -3102,551 +3060,556 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 325, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 325, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 326, /* (2) account_options ::= */ - 326, /* (3) account_options ::= account_options PPS literal */ - 326, /* (4) account_options ::= account_options TSERIES literal */ - 326, /* (5) account_options ::= account_options STORAGE literal */ - 326, /* (6) account_options ::= account_options STREAMS literal */ - 326, /* (7) account_options ::= account_options QTIME literal */ - 326, /* (8) account_options ::= account_options DBS literal */ - 326, /* (9) account_options ::= account_options USERS literal */ - 326, /* (10) account_options ::= account_options CONNS literal */ - 326, /* (11) account_options ::= account_options STATE literal */ - 327, /* (12) alter_account_options ::= alter_account_option */ - 327, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 329, /* (14) alter_account_option ::= PASS literal */ - 329, /* (15) alter_account_option ::= PPS literal */ - 329, /* (16) alter_account_option ::= TSERIES literal */ - 329, /* (17) alter_account_option ::= STORAGE literal */ - 329, /* (18) alter_account_option ::= STREAMS literal */ - 329, /* (19) alter_account_option ::= QTIME literal */ - 329, /* (20) alter_account_option ::= DBS literal */ - 329, /* (21) alter_account_option ::= USERS literal */ - 329, /* (22) alter_account_option ::= CONNS literal */ - 329, /* (23) alter_account_option ::= STATE literal */ - 325, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - 325, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - 325, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 325, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 325, /* (28) cmd ::= DROP USER user_name */ - 331, /* (29) sysinfo_opt ::= */ - 331, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 325, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - 325, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - 332, /* (33) privileges ::= ALL */ - 332, /* (34) privileges ::= priv_type_list */ - 332, /* (35) privileges ::= SUBSCRIBE */ - 334, /* (36) priv_type_list ::= priv_type */ - 334, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 335, /* (38) priv_type ::= READ */ - 335, /* (39) priv_type ::= WRITE */ - 333, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 333, /* (41) priv_level ::= db_name NK_DOT NK_STAR */ - 333, /* (42) priv_level ::= topic_name */ - 325, /* (43) cmd ::= CREATE DNODE dnode_endpoint */ - 325, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 325, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 325, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 325, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 325, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 325, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */ - 325, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 338, /* (51) dnode_endpoint ::= NK_STRING */ - 338, /* (52) dnode_endpoint ::= NK_ID */ - 338, /* (53) dnode_endpoint ::= NK_IPTOKEN */ - 339, /* (54) force_opt ::= */ - 339, /* (55) force_opt ::= FORCE */ - 325, /* (56) cmd ::= ALTER LOCAL NK_STRING */ - 325, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 325, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 325, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 325, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 325, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 325, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 325, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 325, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 325, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 325, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 325, /* (67) cmd ::= DROP DATABASE exists_opt db_name */ - 325, /* (68) cmd ::= USE db_name */ - 325, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ - 325, /* (70) cmd ::= FLUSH DATABASE db_name */ - 325, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ - 340, /* (72) not_exists_opt ::= IF NOT EXISTS */ - 340, /* (73) not_exists_opt ::= */ - 342, /* (74) exists_opt ::= IF EXISTS */ - 342, /* (75) exists_opt ::= */ - 341, /* (76) db_options ::= */ - 341, /* (77) db_options ::= db_options BUFFER NK_INTEGER */ - 341, /* (78) db_options ::= db_options CACHEMODEL NK_STRING */ - 341, /* (79) db_options ::= db_options CACHESIZE NK_INTEGER */ - 341, /* (80) db_options ::= db_options COMP NK_INTEGER */ - 341, /* (81) db_options ::= db_options DURATION NK_INTEGER */ - 341, /* (82) db_options ::= db_options DURATION NK_VARIABLE */ - 341, /* (83) db_options ::= db_options MAXROWS NK_INTEGER */ - 341, /* (84) db_options ::= db_options MINROWS NK_INTEGER */ - 341, /* (85) db_options ::= db_options KEEP integer_list */ - 341, /* (86) db_options ::= db_options KEEP variable_list */ - 341, /* (87) db_options ::= db_options PAGES NK_INTEGER */ - 341, /* (88) db_options ::= db_options PAGESIZE NK_INTEGER */ - 341, /* (89) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 341, /* (90) db_options ::= db_options PRECISION NK_STRING */ - 341, /* (91) db_options ::= db_options REPLICA NK_INTEGER */ - 341, /* (92) db_options ::= db_options VGROUPS NK_INTEGER */ - 341, /* (93) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 341, /* (94) db_options ::= db_options RETENTIONS retention_list */ - 341, /* (95) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 341, /* (96) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 341, /* (97) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 341, /* (98) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 341, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 341, /* (100) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 341, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 341, /* (102) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 341, /* (103) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 341, /* (104) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 341, /* (105) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ - 341, /* (106) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ - 343, /* (107) alter_db_options ::= alter_db_option */ - 343, /* (108) alter_db_options ::= alter_db_options alter_db_option */ - 348, /* (109) alter_db_option ::= BUFFER NK_INTEGER */ - 348, /* (110) alter_db_option ::= CACHEMODEL NK_STRING */ - 348, /* (111) alter_db_option ::= CACHESIZE NK_INTEGER */ - 348, /* (112) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 348, /* (113) alter_db_option ::= KEEP integer_list */ - 348, /* (114) alter_db_option ::= KEEP variable_list */ - 348, /* (115) alter_db_option ::= PAGES NK_INTEGER */ - 348, /* (116) alter_db_option ::= REPLICA NK_INTEGER */ - 348, /* (117) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 348, /* (118) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 345, /* (119) integer_list ::= NK_INTEGER */ - 345, /* (120) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 346, /* (121) variable_list ::= NK_VARIABLE */ - 346, /* (122) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 347, /* (123) retention_list ::= retention */ - 347, /* (124) retention_list ::= retention_list NK_COMMA retention */ - 349, /* (125) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 344, /* (126) speed_opt ::= */ - 344, /* (127) speed_opt ::= MAX_SPEED NK_INTEGER */ - 325, /* (128) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 325, /* (129) cmd ::= CREATE TABLE multi_create_clause */ - 325, /* (130) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 325, /* (131) cmd ::= DROP TABLE multi_drop_clause */ - 325, /* (132) cmd ::= DROP STABLE exists_opt full_table_name */ - 325, /* (133) cmd ::= ALTER TABLE alter_table_clause */ - 325, /* (134) cmd ::= ALTER STABLE alter_table_clause */ - 357, /* (135) alter_table_clause ::= full_table_name alter_table_options */ - 357, /* (136) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - 357, /* (137) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 357, /* (138) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 357, /* (139) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 357, /* (140) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 357, /* (141) alter_table_clause ::= full_table_name DROP TAG column_name */ - 357, /* (142) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 357, /* (143) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 357, /* (144) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - 354, /* (145) multi_create_clause ::= create_subtable_clause */ - 354, /* (146) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 362, /* (147) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - 356, /* (148) multi_drop_clause ::= drop_table_clause */ - 356, /* (149) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - 365, /* (150) drop_table_clause ::= exists_opt full_table_name */ - 363, /* (151) specific_cols_opt ::= */ - 363, /* (152) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 350, /* (153) full_table_name ::= table_name */ - 350, /* (154) full_table_name ::= db_name NK_DOT table_name */ - 351, /* (155) column_def_list ::= column_def */ - 351, /* (156) column_def_list ::= column_def_list NK_COMMA column_def */ - 368, /* (157) column_def ::= column_name type_name */ - 368, /* (158) column_def ::= column_name type_name COMMENT NK_STRING */ - 360, /* (159) type_name ::= BOOL */ - 360, /* (160) type_name ::= TINYINT */ - 360, /* (161) type_name ::= SMALLINT */ - 360, /* (162) type_name ::= INT */ - 360, /* (163) type_name ::= INTEGER */ - 360, /* (164) type_name ::= BIGINT */ - 360, /* (165) type_name ::= FLOAT */ - 360, /* (166) type_name ::= DOUBLE */ - 360, /* (167) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 360, /* (168) type_name ::= TIMESTAMP */ - 360, /* (169) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 360, /* (170) type_name ::= TINYINT UNSIGNED */ - 360, /* (171) type_name ::= SMALLINT UNSIGNED */ - 360, /* (172) type_name ::= INT UNSIGNED */ - 360, /* (173) type_name ::= BIGINT UNSIGNED */ - 360, /* (174) type_name ::= JSON */ - 360, /* (175) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 360, /* (176) type_name ::= MEDIUMBLOB */ - 360, /* (177) type_name ::= BLOB */ - 360, /* (178) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 360, /* (179) type_name ::= DECIMAL */ - 360, /* (180) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 360, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 352, /* (182) tags_def_opt ::= */ - 352, /* (183) tags_def_opt ::= tags_def */ - 355, /* (184) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 353, /* (185) table_options ::= */ - 353, /* (186) table_options ::= table_options COMMENT NK_STRING */ - 353, /* (187) table_options ::= table_options MAX_DELAY duration_list */ - 353, /* (188) table_options ::= table_options WATERMARK duration_list */ - 353, /* (189) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 353, /* (190) table_options ::= table_options TTL NK_INTEGER */ - 353, /* (191) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 353, /* (192) table_options ::= table_options DELETE_MARK duration_list */ - 358, /* (193) alter_table_options ::= alter_table_option */ - 358, /* (194) alter_table_options ::= alter_table_options alter_table_option */ - 371, /* (195) alter_table_option ::= COMMENT NK_STRING */ - 371, /* (196) alter_table_option ::= TTL NK_INTEGER */ - 369, /* (197) duration_list ::= duration_literal */ - 369, /* (198) duration_list ::= duration_list NK_COMMA duration_literal */ - 370, /* (199) rollup_func_list ::= rollup_func_name */ - 370, /* (200) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 373, /* (201) rollup_func_name ::= function_name */ - 373, /* (202) rollup_func_name ::= FIRST */ - 373, /* (203) rollup_func_name ::= LAST */ - 366, /* (204) col_name_list ::= col_name */ - 366, /* (205) col_name_list ::= col_name_list NK_COMMA col_name */ - 375, /* (206) col_name ::= column_name */ - 325, /* (207) cmd ::= SHOW DNODES */ - 325, /* (208) cmd ::= SHOW USERS */ - 325, /* (209) cmd ::= SHOW USER PRIVILEGES */ - 325, /* (210) cmd ::= SHOW DATABASES */ - 325, /* (211) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - 325, /* (212) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 325, /* (213) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 325, /* (214) cmd ::= SHOW MNODES */ - 325, /* (215) cmd ::= SHOW QNODES */ - 325, /* (216) cmd ::= SHOW FUNCTIONS */ - 325, /* (217) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 325, /* (218) cmd ::= SHOW STREAMS */ - 325, /* (219) cmd ::= SHOW ACCOUNTS */ - 325, /* (220) cmd ::= SHOW APPS */ - 325, /* (221) cmd ::= SHOW CONNECTIONS */ - 325, /* (222) cmd ::= SHOW LICENCES */ - 325, /* (223) cmd ::= SHOW GRANTS */ - 325, /* (224) cmd ::= SHOW CREATE DATABASE db_name */ - 325, /* (225) cmd ::= SHOW CREATE TABLE full_table_name */ - 325, /* (226) cmd ::= SHOW CREATE STABLE full_table_name */ - 325, /* (227) cmd ::= SHOW QUERIES */ - 325, /* (228) cmd ::= SHOW SCORES */ - 325, /* (229) cmd ::= SHOW TOPICS */ - 325, /* (230) cmd ::= SHOW VARIABLES */ - 325, /* (231) cmd ::= SHOW CLUSTER VARIABLES */ - 325, /* (232) cmd ::= SHOW LOCAL VARIABLES */ - 325, /* (233) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 325, /* (234) cmd ::= SHOW BNODES */ - 325, /* (235) cmd ::= SHOW SNODES */ - 325, /* (236) cmd ::= SHOW CLUSTER */ - 325, /* (237) cmd ::= SHOW TRANSACTIONS */ - 325, /* (238) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 325, /* (239) cmd ::= SHOW CONSUMERS */ - 325, /* (240) cmd ::= SHOW SUBSCRIPTIONS */ - 325, /* (241) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 325, /* (242) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 325, /* (243) cmd ::= SHOW VNODES NK_INTEGER */ - 325, /* (244) cmd ::= SHOW VNODES NK_STRING */ - 376, /* (245) db_name_cond_opt ::= */ - 376, /* (246) db_name_cond_opt ::= db_name NK_DOT */ - 377, /* (247) like_pattern_opt ::= */ - 377, /* (248) like_pattern_opt ::= LIKE NK_STRING */ - 378, /* (249) table_name_cond ::= table_name */ - 379, /* (250) from_db_opt ::= */ - 379, /* (251) from_db_opt ::= FROM db_name */ - 380, /* (252) tag_list_opt ::= */ - 380, /* (253) tag_list_opt ::= tag_item */ - 380, /* (254) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 381, /* (255) tag_item ::= TBNAME */ - 381, /* (256) tag_item ::= QTAGS */ - 381, /* (257) tag_item ::= column_name */ - 381, /* (258) tag_item ::= column_name column_alias */ - 381, /* (259) tag_item ::= column_name AS column_alias */ - 325, /* (260) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ - 325, /* (261) cmd ::= DROP INDEX exists_opt full_table_name */ - 383, /* (262) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 383, /* (263) 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 */ - 384, /* (264) func_list ::= func */ - 384, /* (265) func_list ::= func_list NK_COMMA func */ - 387, /* (266) func ::= sma_func_name NK_LP expression_list NK_RP */ - 388, /* (267) sma_func_name ::= function_name */ - 388, /* (268) sma_func_name ::= COUNT */ - 388, /* (269) sma_func_name ::= FIRST */ - 388, /* (270) sma_func_name ::= LAST */ - 388, /* (271) sma_func_name ::= LAST_ROW */ - 386, /* (272) sma_stream_opt ::= */ - 386, /* (273) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 386, /* (274) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 386, /* (275) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 325, /* (276) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 325, /* (277) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - 325, /* (278) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - 325, /* (279) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - 325, /* (280) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - 325, /* (281) cmd ::= DROP TOPIC exists_opt topic_name */ - 325, /* (282) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 325, /* (283) cmd ::= DESC full_table_name */ - 325, /* (284) cmd ::= DESCRIBE full_table_name */ - 325, /* (285) cmd ::= RESET QUERY CACHE */ - 325, /* (286) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 391, /* (287) analyze_opt ::= */ - 391, /* (288) analyze_opt ::= ANALYZE */ - 392, /* (289) explain_options ::= */ - 392, /* (290) explain_options ::= explain_options VERBOSE NK_BOOL */ - 392, /* (291) explain_options ::= explain_options RATIO NK_FLOAT */ - 325, /* (292) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - 325, /* (293) cmd ::= DROP FUNCTION exists_opt function_name */ - 393, /* (294) agg_func_opt ::= */ - 393, /* (295) agg_func_opt ::= AGGREGATE */ - 394, /* (296) bufsize_opt ::= */ - 394, /* (297) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 325, /* (298) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ - 325, /* (299) cmd ::= DROP STREAM exists_opt stream_name */ - 396, /* (300) stream_options ::= */ - 396, /* (301) stream_options ::= stream_options TRIGGER AT_ONCE */ - 396, /* (302) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 396, /* (303) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 396, /* (304) stream_options ::= stream_options WATERMARK duration_literal */ - 396, /* (305) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 396, /* (306) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 397, /* (307) subtable_opt ::= */ - 397, /* (308) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 325, /* (309) cmd ::= KILL CONNECTION NK_INTEGER */ - 325, /* (310) cmd ::= KILL QUERY NK_STRING */ - 325, /* (311) cmd ::= KILL TRANSACTION NK_INTEGER */ - 325, /* (312) cmd ::= BALANCE VGROUP */ - 325, /* (313) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 325, /* (314) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 325, /* (315) cmd ::= SPLIT VGROUP NK_INTEGER */ - 399, /* (316) dnode_list ::= DNODE NK_INTEGER */ - 399, /* (317) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 325, /* (318) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 325, /* (319) cmd ::= query_or_subquery */ - 325, /* (320) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 325, /* (321) cmd ::= INSERT INTO full_table_name query_or_subquery */ - 328, /* (322) literal ::= NK_INTEGER */ - 328, /* (323) literal ::= NK_FLOAT */ - 328, /* (324) literal ::= NK_STRING */ - 328, /* (325) literal ::= NK_BOOL */ - 328, /* (326) literal ::= TIMESTAMP NK_STRING */ - 328, /* (327) literal ::= duration_literal */ - 328, /* (328) literal ::= NULL */ - 328, /* (329) literal ::= NK_QUESTION */ - 372, /* (330) duration_literal ::= NK_VARIABLE */ - 401, /* (331) signed ::= NK_INTEGER */ - 401, /* (332) signed ::= NK_PLUS NK_INTEGER */ - 401, /* (333) signed ::= NK_MINUS NK_INTEGER */ - 401, /* (334) signed ::= NK_FLOAT */ - 401, /* (335) signed ::= NK_PLUS NK_FLOAT */ - 401, /* (336) signed ::= NK_MINUS NK_FLOAT */ - 361, /* (337) signed_literal ::= signed */ - 361, /* (338) signed_literal ::= NK_STRING */ - 361, /* (339) signed_literal ::= NK_BOOL */ - 361, /* (340) signed_literal ::= TIMESTAMP NK_STRING */ - 361, /* (341) signed_literal ::= duration_literal */ - 361, /* (342) signed_literal ::= NULL */ - 361, /* (343) signed_literal ::= literal_func */ - 361, /* (344) signed_literal ::= NK_QUESTION */ - 403, /* (345) literal_list ::= signed_literal */ - 403, /* (346) literal_list ::= literal_list NK_COMMA signed_literal */ - 336, /* (347) db_name ::= NK_ID */ - 367, /* (348) table_name ::= NK_ID */ - 359, /* (349) column_name ::= NK_ID */ - 374, /* (350) function_name ::= NK_ID */ - 404, /* (351) table_alias ::= NK_ID */ - 382, /* (352) column_alias ::= NK_ID */ - 330, /* (353) user_name ::= NK_ID */ - 337, /* (354) topic_name ::= NK_ID */ - 395, /* (355) stream_name ::= NK_ID */ - 390, /* (356) cgroup_name ::= NK_ID */ - 405, /* (357) expr_or_subquery ::= expression */ - 398, /* (358) expression ::= literal */ - 398, /* (359) expression ::= pseudo_column */ - 398, /* (360) expression ::= column_reference */ - 398, /* (361) expression ::= function_expression */ - 398, /* (362) expression ::= case_when_expression */ - 398, /* (363) expression ::= NK_LP expression NK_RP */ - 398, /* (364) expression ::= NK_PLUS expr_or_subquery */ - 398, /* (365) expression ::= NK_MINUS expr_or_subquery */ - 398, /* (366) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 398, /* (367) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 398, /* (368) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 398, /* (369) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 398, /* (370) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 398, /* (371) expression ::= column_reference NK_ARROW NK_STRING */ - 398, /* (372) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 398, /* (373) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 364, /* (374) expression_list ::= expr_or_subquery */ - 364, /* (375) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 407, /* (376) column_reference ::= column_name */ - 407, /* (377) column_reference ::= table_name NK_DOT column_name */ - 406, /* (378) pseudo_column ::= ROWTS */ - 406, /* (379) pseudo_column ::= TBNAME */ - 406, /* (380) pseudo_column ::= table_name NK_DOT TBNAME */ - 406, /* (381) pseudo_column ::= QSTART */ - 406, /* (382) pseudo_column ::= QEND */ - 406, /* (383) pseudo_column ::= QDURATION */ - 406, /* (384) pseudo_column ::= WSTART */ - 406, /* (385) pseudo_column ::= WEND */ - 406, /* (386) pseudo_column ::= WDURATION */ - 406, /* (387) pseudo_column ::= IROWTS */ - 406, /* (388) pseudo_column ::= ISFILLED */ - 406, /* (389) pseudo_column ::= QTAGS */ - 408, /* (390) function_expression ::= function_name NK_LP expression_list NK_RP */ - 408, /* (391) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 408, /* (392) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 408, /* (393) function_expression ::= literal_func */ - 402, /* (394) literal_func ::= noarg_func NK_LP NK_RP */ - 402, /* (395) literal_func ::= NOW */ - 412, /* (396) noarg_func ::= NOW */ - 412, /* (397) noarg_func ::= TODAY */ - 412, /* (398) noarg_func ::= TIMEZONE */ - 412, /* (399) noarg_func ::= DATABASE */ - 412, /* (400) noarg_func ::= CLIENT_VERSION */ - 412, /* (401) noarg_func ::= SERVER_VERSION */ - 412, /* (402) noarg_func ::= SERVER_STATUS */ - 412, /* (403) noarg_func ::= CURRENT_USER */ - 412, /* (404) noarg_func ::= USER */ - 410, /* (405) star_func ::= COUNT */ - 410, /* (406) star_func ::= FIRST */ - 410, /* (407) star_func ::= LAST */ - 410, /* (408) star_func ::= LAST_ROW */ - 411, /* (409) star_func_para_list ::= NK_STAR */ - 411, /* (410) star_func_para_list ::= other_para_list */ - 413, /* (411) other_para_list ::= star_func_para */ - 413, /* (412) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 414, /* (413) star_func_para ::= expr_or_subquery */ - 414, /* (414) star_func_para ::= table_name NK_DOT NK_STAR */ - 409, /* (415) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 409, /* (416) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 415, /* (417) when_then_list ::= when_then_expr */ - 415, /* (418) when_then_list ::= when_then_list when_then_expr */ - 418, /* (419) when_then_expr ::= WHEN common_expression THEN common_expression */ - 416, /* (420) case_when_else_opt ::= */ - 416, /* (421) case_when_else_opt ::= ELSE common_expression */ - 419, /* (422) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 419, /* (423) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 419, /* (424) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 419, /* (425) predicate ::= expr_or_subquery IS NULL */ - 419, /* (426) predicate ::= expr_or_subquery IS NOT NULL */ - 419, /* (427) predicate ::= expr_or_subquery in_op in_predicate_value */ - 420, /* (428) compare_op ::= NK_LT */ - 420, /* (429) compare_op ::= NK_GT */ - 420, /* (430) compare_op ::= NK_LE */ - 420, /* (431) compare_op ::= NK_GE */ - 420, /* (432) compare_op ::= NK_NE */ - 420, /* (433) compare_op ::= NK_EQ */ - 420, /* (434) compare_op ::= LIKE */ - 420, /* (435) compare_op ::= NOT LIKE */ - 420, /* (436) compare_op ::= MATCH */ - 420, /* (437) compare_op ::= NMATCH */ - 420, /* (438) compare_op ::= CONTAINS */ - 421, /* (439) in_op ::= IN */ - 421, /* (440) in_op ::= NOT IN */ - 422, /* (441) in_predicate_value ::= NK_LP literal_list NK_RP */ - 423, /* (442) boolean_value_expression ::= boolean_primary */ - 423, /* (443) boolean_value_expression ::= NOT boolean_primary */ - 423, /* (444) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 423, /* (445) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 424, /* (446) boolean_primary ::= predicate */ - 424, /* (447) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 417, /* (448) common_expression ::= expr_or_subquery */ - 417, /* (449) common_expression ::= boolean_value_expression */ - 425, /* (450) from_clause_opt ::= */ - 425, /* (451) from_clause_opt ::= FROM table_reference_list */ - 426, /* (452) table_reference_list ::= table_reference */ - 426, /* (453) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 427, /* (454) table_reference ::= table_primary */ - 427, /* (455) table_reference ::= joined_table */ - 428, /* (456) table_primary ::= table_name alias_opt */ - 428, /* (457) table_primary ::= db_name NK_DOT table_name alias_opt */ - 428, /* (458) table_primary ::= subquery alias_opt */ - 428, /* (459) table_primary ::= parenthesized_joined_table */ - 430, /* (460) alias_opt ::= */ - 430, /* (461) alias_opt ::= table_alias */ - 430, /* (462) alias_opt ::= AS table_alias */ - 432, /* (463) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 432, /* (464) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 429, /* (465) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 433, /* (466) join_type ::= */ - 433, /* (467) join_type ::= INNER */ - 435, /* (468) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 436, /* (469) set_quantifier_opt ::= */ - 436, /* (470) set_quantifier_opt ::= DISTINCT */ - 436, /* (471) set_quantifier_opt ::= ALL */ - 437, /* (472) select_list ::= select_item */ - 437, /* (473) select_list ::= select_list NK_COMMA select_item */ - 445, /* (474) select_item ::= NK_STAR */ - 445, /* (475) select_item ::= common_expression */ - 445, /* (476) select_item ::= common_expression column_alias */ - 445, /* (477) select_item ::= common_expression AS column_alias */ - 445, /* (478) select_item ::= table_name NK_DOT NK_STAR */ - 400, /* (479) where_clause_opt ::= */ - 400, /* (480) where_clause_opt ::= WHERE search_condition */ - 438, /* (481) partition_by_clause_opt ::= */ - 438, /* (482) partition_by_clause_opt ::= PARTITION BY partition_list */ - 446, /* (483) partition_list ::= partition_item */ - 446, /* (484) partition_list ::= partition_list NK_COMMA partition_item */ - 447, /* (485) partition_item ::= expr_or_subquery */ - 447, /* (486) partition_item ::= expr_or_subquery column_alias */ - 447, /* (487) partition_item ::= expr_or_subquery AS column_alias */ - 442, /* (488) twindow_clause_opt ::= */ - 442, /* (489) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - 442, /* (490) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 442, /* (491) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - 442, /* (492) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - 442, /* (493) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 385, /* (494) sliding_opt ::= */ - 385, /* (495) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 441, /* (496) fill_opt ::= */ - 441, /* (497) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 441, /* (498) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - 448, /* (499) fill_mode ::= NONE */ - 448, /* (500) fill_mode ::= PREV */ - 448, /* (501) fill_mode ::= NULL */ - 448, /* (502) fill_mode ::= LINEAR */ - 448, /* (503) fill_mode ::= NEXT */ - 443, /* (504) group_by_clause_opt ::= */ - 443, /* (505) group_by_clause_opt ::= GROUP BY group_by_list */ - 449, /* (506) group_by_list ::= expr_or_subquery */ - 449, /* (507) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 444, /* (508) having_clause_opt ::= */ - 444, /* (509) having_clause_opt ::= HAVING search_condition */ - 439, /* (510) range_opt ::= */ - 439, /* (511) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 440, /* (512) every_opt ::= */ - 440, /* (513) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 450, /* (514) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 451, /* (515) query_simple ::= query_specification */ - 451, /* (516) query_simple ::= union_query_expression */ - 455, /* (517) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 455, /* (518) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 456, /* (519) query_simple_or_subquery ::= query_simple */ - 456, /* (520) query_simple_or_subquery ::= subquery */ - 389, /* (521) query_or_subquery ::= query_expression */ - 389, /* (522) query_or_subquery ::= subquery */ - 452, /* (523) order_by_clause_opt ::= */ - 452, /* (524) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 453, /* (525) slimit_clause_opt ::= */ - 453, /* (526) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 453, /* (527) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 453, /* (528) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 454, /* (529) limit_clause_opt ::= */ - 454, /* (530) limit_clause_opt ::= LIMIT NK_INTEGER */ - 454, /* (531) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 454, /* (532) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 431, /* (533) subquery ::= NK_LP query_expression NK_RP */ - 431, /* (534) subquery ::= NK_LP subquery NK_RP */ - 434, /* (535) search_condition ::= common_expression */ - 457, /* (536) sort_specification_list ::= sort_specification */ - 457, /* (537) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 458, /* (538) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 459, /* (539) ordering_specification_opt ::= */ - 459, /* (540) ordering_specification_opt ::= ASC */ - 459, /* (541) ordering_specification_opt ::= DESC */ - 460, /* (542) null_ordering_opt ::= */ - 460, /* (543) null_ordering_opt ::= NULLS FIRST */ - 460, /* (544) null_ordering_opt ::= NULLS LAST */ + 326, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 326, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 327, /* (2) account_options ::= */ + 327, /* (3) account_options ::= account_options PPS literal */ + 327, /* (4) account_options ::= account_options TSERIES literal */ + 327, /* (5) account_options ::= account_options STORAGE literal */ + 327, /* (6) account_options ::= account_options STREAMS literal */ + 327, /* (7) account_options ::= account_options QTIME literal */ + 327, /* (8) account_options ::= account_options DBS literal */ + 327, /* (9) account_options ::= account_options USERS literal */ + 327, /* (10) account_options ::= account_options CONNS literal */ + 327, /* (11) account_options ::= account_options STATE literal */ + 328, /* (12) alter_account_options ::= alter_account_option */ + 328, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 330, /* (14) alter_account_option ::= PASS literal */ + 330, /* (15) alter_account_option ::= PPS literal */ + 330, /* (16) alter_account_option ::= TSERIES literal */ + 330, /* (17) alter_account_option ::= STORAGE literal */ + 330, /* (18) alter_account_option ::= STREAMS literal */ + 330, /* (19) alter_account_option ::= QTIME literal */ + 330, /* (20) alter_account_option ::= DBS literal */ + 330, /* (21) alter_account_option ::= USERS literal */ + 330, /* (22) alter_account_option ::= CONNS literal */ + 330, /* (23) alter_account_option ::= STATE literal */ + 326, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + 326, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + 326, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 326, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 326, /* (28) cmd ::= DROP USER user_name */ + 332, /* (29) sysinfo_opt ::= */ + 332, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 326, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + 326, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + 333, /* (33) privileges ::= ALL */ + 333, /* (34) privileges ::= priv_type_list */ + 333, /* (35) privileges ::= SUBSCRIBE */ + 335, /* (36) priv_type_list ::= priv_type */ + 335, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 336, /* (38) priv_type ::= READ */ + 336, /* (39) priv_type ::= WRITE */ + 334, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 334, /* (41) priv_level ::= db_name NK_DOT NK_STAR */ + 334, /* (42) priv_level ::= topic_name */ + 326, /* (43) cmd ::= CREATE DNODE dnode_endpoint */ + 326, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 326, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 326, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 326, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 326, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 326, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */ + 326, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 339, /* (51) dnode_endpoint ::= NK_STRING */ + 339, /* (52) dnode_endpoint ::= NK_ID */ + 339, /* (53) dnode_endpoint ::= NK_IPTOKEN */ + 340, /* (54) force_opt ::= */ + 340, /* (55) force_opt ::= FORCE */ + 326, /* (56) cmd ::= ALTER LOCAL NK_STRING */ + 326, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 326, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 326, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 326, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 326, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 326, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 326, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 326, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 326, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 326, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 326, /* (67) cmd ::= DROP DATABASE exists_opt db_name */ + 326, /* (68) cmd ::= USE db_name */ + 326, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ + 326, /* (70) cmd ::= FLUSH DATABASE db_name */ + 326, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ + 341, /* (72) not_exists_opt ::= IF NOT EXISTS */ + 341, /* (73) not_exists_opt ::= */ + 343, /* (74) exists_opt ::= IF EXISTS */ + 343, /* (75) exists_opt ::= */ + 342, /* (76) db_options ::= */ + 342, /* (77) db_options ::= db_options BUFFER NK_INTEGER */ + 342, /* (78) db_options ::= db_options CACHEMODEL NK_STRING */ + 342, /* (79) db_options ::= db_options CACHESIZE NK_INTEGER */ + 342, /* (80) db_options ::= db_options COMP NK_INTEGER */ + 342, /* (81) db_options ::= db_options DURATION NK_INTEGER */ + 342, /* (82) db_options ::= db_options DURATION NK_VARIABLE */ + 342, /* (83) db_options ::= db_options MAXROWS NK_INTEGER */ + 342, /* (84) db_options ::= db_options MINROWS NK_INTEGER */ + 342, /* (85) db_options ::= db_options KEEP integer_list */ + 342, /* (86) db_options ::= db_options KEEP variable_list */ + 342, /* (87) db_options ::= db_options PAGES NK_INTEGER */ + 342, /* (88) db_options ::= db_options PAGESIZE NK_INTEGER */ + 342, /* (89) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 342, /* (90) db_options ::= db_options PRECISION NK_STRING */ + 342, /* (91) db_options ::= db_options REPLICA NK_INTEGER */ + 342, /* (92) db_options ::= db_options VGROUPS NK_INTEGER */ + 342, /* (93) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 342, /* (94) db_options ::= db_options RETENTIONS retention_list */ + 342, /* (95) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 342, /* (96) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 342, /* (97) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 342, /* (98) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 342, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 342, /* (100) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 342, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 342, /* (102) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 342, /* (103) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 342, /* (104) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 342, /* (105) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + 342, /* (106) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + 344, /* (107) alter_db_options ::= alter_db_option */ + 344, /* (108) alter_db_options ::= alter_db_options alter_db_option */ + 349, /* (109) alter_db_option ::= BUFFER NK_INTEGER */ + 349, /* (110) alter_db_option ::= CACHEMODEL NK_STRING */ + 349, /* (111) alter_db_option ::= CACHESIZE NK_INTEGER */ + 349, /* (112) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 349, /* (113) alter_db_option ::= KEEP integer_list */ + 349, /* (114) alter_db_option ::= KEEP variable_list */ + 349, /* (115) alter_db_option ::= PAGES NK_INTEGER */ + 349, /* (116) alter_db_option ::= REPLICA NK_INTEGER */ + 349, /* (117) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 349, /* (118) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 346, /* (119) integer_list ::= NK_INTEGER */ + 346, /* (120) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 347, /* (121) variable_list ::= NK_VARIABLE */ + 347, /* (122) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 348, /* (123) retention_list ::= retention */ + 348, /* (124) retention_list ::= retention_list NK_COMMA retention */ + 350, /* (125) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 345, /* (126) speed_opt ::= */ + 345, /* (127) speed_opt ::= MAX_SPEED NK_INTEGER */ + 326, /* (128) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 326, /* (129) cmd ::= CREATE TABLE multi_create_clause */ + 326, /* (130) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 326, /* (131) cmd ::= DROP TABLE multi_drop_clause */ + 326, /* (132) cmd ::= DROP STABLE exists_opt full_table_name */ + 326, /* (133) cmd ::= ALTER TABLE alter_table_clause */ + 326, /* (134) cmd ::= ALTER STABLE alter_table_clause */ + 358, /* (135) alter_table_clause ::= full_table_name alter_table_options */ + 358, /* (136) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 358, /* (137) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 358, /* (138) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 358, /* (139) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 358, /* (140) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 358, /* (141) alter_table_clause ::= full_table_name DROP TAG column_name */ + 358, /* (142) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 358, /* (143) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 358, /* (144) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + 355, /* (145) multi_create_clause ::= create_subtable_clause */ + 355, /* (146) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 363, /* (147) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + 357, /* (148) multi_drop_clause ::= drop_table_clause */ + 357, /* (149) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + 366, /* (150) drop_table_clause ::= exists_opt full_table_name */ + 364, /* (151) specific_cols_opt ::= */ + 364, /* (152) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 351, /* (153) full_table_name ::= table_name */ + 351, /* (154) full_table_name ::= db_name NK_DOT table_name */ + 352, /* (155) column_def_list ::= column_def */ + 352, /* (156) column_def_list ::= column_def_list NK_COMMA column_def */ + 369, /* (157) column_def ::= column_name type_name */ + 369, /* (158) column_def ::= column_name type_name COMMENT NK_STRING */ + 361, /* (159) type_name ::= BOOL */ + 361, /* (160) type_name ::= TINYINT */ + 361, /* (161) type_name ::= SMALLINT */ + 361, /* (162) type_name ::= INT */ + 361, /* (163) type_name ::= INTEGER */ + 361, /* (164) type_name ::= BIGINT */ + 361, /* (165) type_name ::= FLOAT */ + 361, /* (166) type_name ::= DOUBLE */ + 361, /* (167) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 361, /* (168) type_name ::= TIMESTAMP */ + 361, /* (169) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 361, /* (170) type_name ::= TINYINT UNSIGNED */ + 361, /* (171) type_name ::= SMALLINT UNSIGNED */ + 361, /* (172) type_name ::= INT UNSIGNED */ + 361, /* (173) type_name ::= BIGINT UNSIGNED */ + 361, /* (174) type_name ::= JSON */ + 361, /* (175) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 361, /* (176) type_name ::= MEDIUMBLOB */ + 361, /* (177) type_name ::= BLOB */ + 361, /* (178) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 361, /* (179) type_name ::= DECIMAL */ + 361, /* (180) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 361, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 353, /* (182) tags_def_opt ::= */ + 353, /* (183) tags_def_opt ::= tags_def */ + 356, /* (184) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 354, /* (185) table_options ::= */ + 354, /* (186) table_options ::= table_options COMMENT NK_STRING */ + 354, /* (187) table_options ::= table_options MAX_DELAY duration_list */ + 354, /* (188) table_options ::= table_options WATERMARK duration_list */ + 354, /* (189) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 354, /* (190) table_options ::= table_options TTL NK_INTEGER */ + 354, /* (191) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 354, /* (192) table_options ::= table_options DELETE_MARK duration_list */ + 359, /* (193) alter_table_options ::= alter_table_option */ + 359, /* (194) alter_table_options ::= alter_table_options alter_table_option */ + 372, /* (195) alter_table_option ::= COMMENT NK_STRING */ + 372, /* (196) alter_table_option ::= TTL NK_INTEGER */ + 370, /* (197) duration_list ::= duration_literal */ + 370, /* (198) duration_list ::= duration_list NK_COMMA duration_literal */ + 371, /* (199) rollup_func_list ::= rollup_func_name */ + 371, /* (200) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 374, /* (201) rollup_func_name ::= function_name */ + 374, /* (202) rollup_func_name ::= FIRST */ + 374, /* (203) rollup_func_name ::= LAST */ + 367, /* (204) col_name_list ::= col_name */ + 367, /* (205) col_name_list ::= col_name_list NK_COMMA col_name */ + 376, /* (206) col_name ::= column_name */ + 326, /* (207) cmd ::= SHOW DNODES */ + 326, /* (208) cmd ::= SHOW USERS */ + 326, /* (209) cmd ::= SHOW USER PRIVILEGES */ + 326, /* (210) cmd ::= SHOW DATABASES */ + 326, /* (211) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + 326, /* (212) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 326, /* (213) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 326, /* (214) cmd ::= SHOW MNODES */ + 326, /* (215) cmd ::= SHOW QNODES */ + 326, /* (216) cmd ::= SHOW FUNCTIONS */ + 326, /* (217) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 326, /* (218) cmd ::= SHOW STREAMS */ + 326, /* (219) cmd ::= SHOW ACCOUNTS */ + 326, /* (220) cmd ::= SHOW APPS */ + 326, /* (221) cmd ::= SHOW CONNECTIONS */ + 326, /* (222) cmd ::= SHOW LICENCES */ + 326, /* (223) cmd ::= SHOW GRANTS */ + 326, /* (224) cmd ::= SHOW CREATE DATABASE db_name */ + 326, /* (225) cmd ::= SHOW CREATE TABLE full_table_name */ + 326, /* (226) cmd ::= SHOW CREATE STABLE full_table_name */ + 326, /* (227) cmd ::= SHOW QUERIES */ + 326, /* (228) cmd ::= SHOW SCORES */ + 326, /* (229) cmd ::= SHOW TOPICS */ + 326, /* (230) cmd ::= SHOW VARIABLES */ + 326, /* (231) cmd ::= SHOW CLUSTER VARIABLES */ + 326, /* (232) cmd ::= SHOW LOCAL VARIABLES */ + 326, /* (233) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 326, /* (234) cmd ::= SHOW BNODES */ + 326, /* (235) cmd ::= SHOW SNODES */ + 326, /* (236) cmd ::= SHOW CLUSTER */ + 326, /* (237) cmd ::= SHOW TRANSACTIONS */ + 326, /* (238) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 326, /* (239) cmd ::= SHOW CONSUMERS */ + 326, /* (240) cmd ::= SHOW SUBSCRIPTIONS */ + 326, /* (241) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 326, /* (242) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 326, /* (243) cmd ::= SHOW VNODES NK_INTEGER */ + 326, /* (244) cmd ::= SHOW VNODES NK_STRING */ + 326, /* (245) cmd ::= SHOW db_name_cond_opt ALIVE */ + 326, /* (246) cmd ::= SHOW CLUSTER ALIVE */ + 377, /* (247) db_name_cond_opt ::= */ + 377, /* (248) db_name_cond_opt ::= db_name NK_DOT */ + 378, /* (249) like_pattern_opt ::= */ + 378, /* (250) like_pattern_opt ::= LIKE NK_STRING */ + 379, /* (251) table_name_cond ::= table_name */ + 380, /* (252) from_db_opt ::= */ + 380, /* (253) from_db_opt ::= FROM db_name */ + 381, /* (254) tag_list_opt ::= */ + 381, /* (255) tag_list_opt ::= tag_item */ + 381, /* (256) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 382, /* (257) tag_item ::= TBNAME */ + 382, /* (258) tag_item ::= QTAGS */ + 382, /* (259) tag_item ::= column_name */ + 382, /* (260) tag_item ::= column_name column_alias */ + 382, /* (261) tag_item ::= column_name AS column_alias */ + 326, /* (262) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + 326, /* (263) cmd ::= CREATE INDEX not_exists_opt full_table_name ON full_table_name NK_LP col_name_list NK_RP */ + 326, /* (264) cmd ::= DROP INDEX exists_opt full_table_name */ + 384, /* (265) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 384, /* (266) 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 */ + 385, /* (267) func_list ::= func */ + 385, /* (268) func_list ::= func_list NK_COMMA func */ + 388, /* (269) func ::= sma_func_name NK_LP expression_list NK_RP */ + 389, /* (270) sma_func_name ::= function_name */ + 389, /* (271) sma_func_name ::= COUNT */ + 389, /* (272) sma_func_name ::= FIRST */ + 389, /* (273) sma_func_name ::= LAST */ + 389, /* (274) sma_func_name ::= LAST_ROW */ + 387, /* (275) sma_stream_opt ::= */ + 387, /* (276) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 387, /* (277) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 387, /* (278) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 326, /* (279) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 326, /* (280) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + 326, /* (281) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + 326, /* (282) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + 326, /* (283) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + 326, /* (284) cmd ::= DROP TOPIC exists_opt topic_name */ + 326, /* (285) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 326, /* (286) cmd ::= DESC full_table_name */ + 326, /* (287) cmd ::= DESCRIBE full_table_name */ + 326, /* (288) cmd ::= RESET QUERY CACHE */ + 326, /* (289) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 392, /* (290) analyze_opt ::= */ + 392, /* (291) analyze_opt ::= ANALYZE */ + 393, /* (292) explain_options ::= */ + 393, /* (293) explain_options ::= explain_options VERBOSE NK_BOOL */ + 393, /* (294) explain_options ::= explain_options RATIO NK_FLOAT */ + 326, /* (295) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + 326, /* (296) cmd ::= DROP FUNCTION exists_opt function_name */ + 394, /* (297) agg_func_opt ::= */ + 394, /* (298) agg_func_opt ::= AGGREGATE */ + 395, /* (299) bufsize_opt ::= */ + 395, /* (300) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 326, /* (301) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tags_def_opt subtable_opt AS query_or_subquery */ + 326, /* (302) cmd ::= DROP STREAM exists_opt stream_name */ + 398, /* (303) col_list_opt ::= */ + 398, /* (304) col_list_opt ::= NK_LP col_name_list NK_RP */ + 397, /* (305) stream_options ::= */ + 397, /* (306) stream_options ::= stream_options TRIGGER AT_ONCE */ + 397, /* (307) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 397, /* (308) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 397, /* (309) stream_options ::= stream_options WATERMARK duration_literal */ + 397, /* (310) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 397, /* (311) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 399, /* (312) subtable_opt ::= */ + 399, /* (313) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 326, /* (314) cmd ::= KILL CONNECTION NK_INTEGER */ + 326, /* (315) cmd ::= KILL QUERY NK_STRING */ + 326, /* (316) cmd ::= KILL TRANSACTION NK_INTEGER */ + 326, /* (317) cmd ::= BALANCE VGROUP */ + 326, /* (318) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 326, /* (319) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 326, /* (320) cmd ::= SPLIT VGROUP NK_INTEGER */ + 401, /* (321) dnode_list ::= DNODE NK_INTEGER */ + 401, /* (322) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 326, /* (323) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 326, /* (324) cmd ::= query_or_subquery */ + 326, /* (325) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 326, /* (326) cmd ::= INSERT INTO full_table_name query_or_subquery */ + 329, /* (327) literal ::= NK_INTEGER */ + 329, /* (328) literal ::= NK_FLOAT */ + 329, /* (329) literal ::= NK_STRING */ + 329, /* (330) literal ::= NK_BOOL */ + 329, /* (331) literal ::= TIMESTAMP NK_STRING */ + 329, /* (332) literal ::= duration_literal */ + 329, /* (333) literal ::= NULL */ + 329, /* (334) literal ::= NK_QUESTION */ + 373, /* (335) duration_literal ::= NK_VARIABLE */ + 403, /* (336) signed ::= NK_INTEGER */ + 403, /* (337) signed ::= NK_PLUS NK_INTEGER */ + 403, /* (338) signed ::= NK_MINUS NK_INTEGER */ + 403, /* (339) signed ::= NK_FLOAT */ + 403, /* (340) signed ::= NK_PLUS NK_FLOAT */ + 403, /* (341) signed ::= NK_MINUS NK_FLOAT */ + 362, /* (342) signed_literal ::= signed */ + 362, /* (343) signed_literal ::= NK_STRING */ + 362, /* (344) signed_literal ::= NK_BOOL */ + 362, /* (345) signed_literal ::= TIMESTAMP NK_STRING */ + 362, /* (346) signed_literal ::= duration_literal */ + 362, /* (347) signed_literal ::= NULL */ + 362, /* (348) signed_literal ::= literal_func */ + 362, /* (349) signed_literal ::= NK_QUESTION */ + 405, /* (350) literal_list ::= signed_literal */ + 405, /* (351) literal_list ::= literal_list NK_COMMA signed_literal */ + 337, /* (352) db_name ::= NK_ID */ + 368, /* (353) table_name ::= NK_ID */ + 360, /* (354) column_name ::= NK_ID */ + 375, /* (355) function_name ::= NK_ID */ + 406, /* (356) table_alias ::= NK_ID */ + 383, /* (357) column_alias ::= NK_ID */ + 331, /* (358) user_name ::= NK_ID */ + 338, /* (359) topic_name ::= NK_ID */ + 396, /* (360) stream_name ::= NK_ID */ + 391, /* (361) cgroup_name ::= NK_ID */ + 407, /* (362) expr_or_subquery ::= expression */ + 400, /* (363) expression ::= literal */ + 400, /* (364) expression ::= pseudo_column */ + 400, /* (365) expression ::= column_reference */ + 400, /* (366) expression ::= function_expression */ + 400, /* (367) expression ::= case_when_expression */ + 400, /* (368) expression ::= NK_LP expression NK_RP */ + 400, /* (369) expression ::= NK_PLUS expr_or_subquery */ + 400, /* (370) expression ::= NK_MINUS expr_or_subquery */ + 400, /* (371) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 400, /* (372) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 400, /* (373) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 400, /* (374) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 400, /* (375) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 400, /* (376) expression ::= column_reference NK_ARROW NK_STRING */ + 400, /* (377) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 400, /* (378) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 365, /* (379) expression_list ::= expr_or_subquery */ + 365, /* (380) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 409, /* (381) column_reference ::= column_name */ + 409, /* (382) column_reference ::= table_name NK_DOT column_name */ + 408, /* (383) pseudo_column ::= ROWTS */ + 408, /* (384) pseudo_column ::= TBNAME */ + 408, /* (385) pseudo_column ::= table_name NK_DOT TBNAME */ + 408, /* (386) pseudo_column ::= QSTART */ + 408, /* (387) pseudo_column ::= QEND */ + 408, /* (388) pseudo_column ::= QDURATION */ + 408, /* (389) pseudo_column ::= WSTART */ + 408, /* (390) pseudo_column ::= WEND */ + 408, /* (391) pseudo_column ::= WDURATION */ + 408, /* (392) pseudo_column ::= IROWTS */ + 408, /* (393) pseudo_column ::= ISFILLED */ + 408, /* (394) pseudo_column ::= QTAGS */ + 410, /* (395) function_expression ::= function_name NK_LP expression_list NK_RP */ + 410, /* (396) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 410, /* (397) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 410, /* (398) function_expression ::= literal_func */ + 404, /* (399) literal_func ::= noarg_func NK_LP NK_RP */ + 404, /* (400) literal_func ::= NOW */ + 414, /* (401) noarg_func ::= NOW */ + 414, /* (402) noarg_func ::= TODAY */ + 414, /* (403) noarg_func ::= TIMEZONE */ + 414, /* (404) noarg_func ::= DATABASE */ + 414, /* (405) noarg_func ::= CLIENT_VERSION */ + 414, /* (406) noarg_func ::= SERVER_VERSION */ + 414, /* (407) noarg_func ::= SERVER_STATUS */ + 414, /* (408) noarg_func ::= CURRENT_USER */ + 414, /* (409) noarg_func ::= USER */ + 412, /* (410) star_func ::= COUNT */ + 412, /* (411) star_func ::= FIRST */ + 412, /* (412) star_func ::= LAST */ + 412, /* (413) star_func ::= LAST_ROW */ + 413, /* (414) star_func_para_list ::= NK_STAR */ + 413, /* (415) star_func_para_list ::= other_para_list */ + 415, /* (416) other_para_list ::= star_func_para */ + 415, /* (417) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 416, /* (418) star_func_para ::= expr_or_subquery */ + 416, /* (419) star_func_para ::= table_name NK_DOT NK_STAR */ + 411, /* (420) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 411, /* (421) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 417, /* (422) when_then_list ::= when_then_expr */ + 417, /* (423) when_then_list ::= when_then_list when_then_expr */ + 420, /* (424) when_then_expr ::= WHEN common_expression THEN common_expression */ + 418, /* (425) case_when_else_opt ::= */ + 418, /* (426) case_when_else_opt ::= ELSE common_expression */ + 421, /* (427) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 421, /* (428) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 421, /* (429) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 421, /* (430) predicate ::= expr_or_subquery IS NULL */ + 421, /* (431) predicate ::= expr_or_subquery IS NOT NULL */ + 421, /* (432) predicate ::= expr_or_subquery in_op in_predicate_value */ + 422, /* (433) compare_op ::= NK_LT */ + 422, /* (434) compare_op ::= NK_GT */ + 422, /* (435) compare_op ::= NK_LE */ + 422, /* (436) compare_op ::= NK_GE */ + 422, /* (437) compare_op ::= NK_NE */ + 422, /* (438) compare_op ::= NK_EQ */ + 422, /* (439) compare_op ::= LIKE */ + 422, /* (440) compare_op ::= NOT LIKE */ + 422, /* (441) compare_op ::= MATCH */ + 422, /* (442) compare_op ::= NMATCH */ + 422, /* (443) compare_op ::= CONTAINS */ + 423, /* (444) in_op ::= IN */ + 423, /* (445) in_op ::= NOT IN */ + 424, /* (446) in_predicate_value ::= NK_LP literal_list NK_RP */ + 425, /* (447) boolean_value_expression ::= boolean_primary */ + 425, /* (448) boolean_value_expression ::= NOT boolean_primary */ + 425, /* (449) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 425, /* (450) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 426, /* (451) boolean_primary ::= predicate */ + 426, /* (452) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 419, /* (453) common_expression ::= expr_or_subquery */ + 419, /* (454) common_expression ::= boolean_value_expression */ + 427, /* (455) from_clause_opt ::= */ + 427, /* (456) from_clause_opt ::= FROM table_reference_list */ + 428, /* (457) table_reference_list ::= table_reference */ + 428, /* (458) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 429, /* (459) table_reference ::= table_primary */ + 429, /* (460) table_reference ::= joined_table */ + 430, /* (461) table_primary ::= table_name alias_opt */ + 430, /* (462) table_primary ::= db_name NK_DOT table_name alias_opt */ + 430, /* (463) table_primary ::= subquery alias_opt */ + 430, /* (464) table_primary ::= parenthesized_joined_table */ + 432, /* (465) alias_opt ::= */ + 432, /* (466) alias_opt ::= table_alias */ + 432, /* (467) alias_opt ::= AS table_alias */ + 434, /* (468) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 434, /* (469) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 431, /* (470) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 435, /* (471) join_type ::= */ + 435, /* (472) join_type ::= INNER */ + 437, /* (473) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 438, /* (474) set_quantifier_opt ::= */ + 438, /* (475) set_quantifier_opt ::= DISTINCT */ + 438, /* (476) set_quantifier_opt ::= ALL */ + 439, /* (477) select_list ::= select_item */ + 439, /* (478) select_list ::= select_list NK_COMMA select_item */ + 447, /* (479) select_item ::= NK_STAR */ + 447, /* (480) select_item ::= common_expression */ + 447, /* (481) select_item ::= common_expression column_alias */ + 447, /* (482) select_item ::= common_expression AS column_alias */ + 447, /* (483) select_item ::= table_name NK_DOT NK_STAR */ + 402, /* (484) where_clause_opt ::= */ + 402, /* (485) where_clause_opt ::= WHERE search_condition */ + 440, /* (486) partition_by_clause_opt ::= */ + 440, /* (487) partition_by_clause_opt ::= PARTITION BY partition_list */ + 448, /* (488) partition_list ::= partition_item */ + 448, /* (489) partition_list ::= partition_list NK_COMMA partition_item */ + 449, /* (490) partition_item ::= expr_or_subquery */ + 449, /* (491) partition_item ::= expr_or_subquery column_alias */ + 449, /* (492) partition_item ::= expr_or_subquery AS column_alias */ + 444, /* (493) twindow_clause_opt ::= */ + 444, /* (494) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + 444, /* (495) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 444, /* (496) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + 444, /* (497) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + 444, /* (498) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 386, /* (499) sliding_opt ::= */ + 386, /* (500) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 443, /* (501) fill_opt ::= */ + 443, /* (502) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 443, /* (503) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + 450, /* (504) fill_mode ::= NONE */ + 450, /* (505) fill_mode ::= PREV */ + 450, /* (506) fill_mode ::= NULL */ + 450, /* (507) fill_mode ::= LINEAR */ + 450, /* (508) fill_mode ::= NEXT */ + 445, /* (509) group_by_clause_opt ::= */ + 445, /* (510) group_by_clause_opt ::= GROUP BY group_by_list */ + 451, /* (511) group_by_list ::= expr_or_subquery */ + 451, /* (512) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 446, /* (513) having_clause_opt ::= */ + 446, /* (514) having_clause_opt ::= HAVING search_condition */ + 441, /* (515) range_opt ::= */ + 441, /* (516) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 442, /* (517) every_opt ::= */ + 442, /* (518) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 452, /* (519) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 453, /* (520) query_simple ::= query_specification */ + 453, /* (521) query_simple ::= union_query_expression */ + 457, /* (522) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 457, /* (523) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 458, /* (524) query_simple_or_subquery ::= query_simple */ + 458, /* (525) query_simple_or_subquery ::= subquery */ + 390, /* (526) query_or_subquery ::= query_expression */ + 390, /* (527) query_or_subquery ::= subquery */ + 454, /* (528) order_by_clause_opt ::= */ + 454, /* (529) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 455, /* (530) slimit_clause_opt ::= */ + 455, /* (531) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 455, /* (532) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 455, /* (533) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 456, /* (534) limit_clause_opt ::= */ + 456, /* (535) limit_clause_opt ::= LIMIT NK_INTEGER */ + 456, /* (536) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 456, /* (537) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 433, /* (538) subquery ::= NK_LP query_expression NK_RP */ + 433, /* (539) subquery ::= NK_LP subquery NK_RP */ + 436, /* (540) search_condition ::= common_expression */ + 459, /* (541) sort_specification_list ::= sort_specification */ + 459, /* (542) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 460, /* (543) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 461, /* (544) ordering_specification_opt ::= */ + 461, /* (545) ordering_specification_opt ::= ASC */ + 461, /* (546) ordering_specification_opt ::= DESC */ + 462, /* (547) null_ordering_opt ::= */ + 462, /* (548) null_ordering_opt ::= NULLS FIRST */ + 462, /* (549) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -3897,306 +3860,311 @@ static const signed char yyRuleInfoNRhs[] = { -7, /* (242) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -3, /* (243) cmd ::= SHOW VNODES NK_INTEGER */ -3, /* (244) cmd ::= SHOW VNODES NK_STRING */ - 0, /* (245) db_name_cond_opt ::= */ - -2, /* (246) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (247) like_pattern_opt ::= */ - -2, /* (248) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (249) table_name_cond ::= table_name */ - 0, /* (250) from_db_opt ::= */ - -2, /* (251) from_db_opt ::= FROM db_name */ - 0, /* (252) tag_list_opt ::= */ - -1, /* (253) tag_list_opt ::= tag_item */ - -3, /* (254) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (255) tag_item ::= TBNAME */ - -1, /* (256) tag_item ::= QTAGS */ - -1, /* (257) tag_item ::= column_name */ - -2, /* (258) tag_item ::= column_name column_alias */ - -3, /* (259) tag_item ::= column_name AS column_alias */ - -8, /* (260) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ - -4, /* (261) cmd ::= DROP INDEX exists_opt full_table_name */ - -10, /* (262) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (263) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - -1, /* (264) func_list ::= func */ - -3, /* (265) func_list ::= func_list NK_COMMA func */ - -4, /* (266) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (267) sma_func_name ::= function_name */ - -1, /* (268) sma_func_name ::= COUNT */ - -1, /* (269) sma_func_name ::= FIRST */ - -1, /* (270) sma_func_name ::= LAST */ - -1, /* (271) sma_func_name ::= LAST_ROW */ - 0, /* (272) sma_stream_opt ::= */ - -3, /* (273) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (274) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (275) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -6, /* (276) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (277) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - -9, /* (278) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - -7, /* (279) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - -9, /* (280) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - -4, /* (281) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (282) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (283) cmd ::= DESC full_table_name */ - -2, /* (284) cmd ::= DESCRIBE full_table_name */ - -3, /* (285) cmd ::= RESET QUERY CACHE */ - -4, /* (286) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 0, /* (287) analyze_opt ::= */ - -1, /* (288) analyze_opt ::= ANALYZE */ - 0, /* (289) explain_options ::= */ - -3, /* (290) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (291) explain_options ::= explain_options RATIO NK_FLOAT */ - -10, /* (292) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - -4, /* (293) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (294) agg_func_opt ::= */ - -1, /* (295) agg_func_opt ::= AGGREGATE */ - 0, /* (296) bufsize_opt ::= */ - -2, /* (297) bufsize_opt ::= BUFSIZE NK_INTEGER */ - -11, /* (298) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ - -4, /* (299) cmd ::= DROP STREAM exists_opt stream_name */ - 0, /* (300) stream_options ::= */ - -3, /* (301) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (302) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (303) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (304) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (305) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (306) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 0, /* (307) subtable_opt ::= */ - -4, /* (308) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - -3, /* (309) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (310) cmd ::= KILL QUERY NK_STRING */ - -3, /* (311) cmd ::= KILL TRANSACTION NK_INTEGER */ - -2, /* (312) cmd ::= BALANCE VGROUP */ - -4, /* (313) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (314) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (315) cmd ::= SPLIT VGROUP NK_INTEGER */ - -2, /* (316) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (317) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (318) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (319) cmd ::= query_or_subquery */ - -7, /* (320) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (321) cmd ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (322) literal ::= NK_INTEGER */ - -1, /* (323) literal ::= NK_FLOAT */ - -1, /* (324) literal ::= NK_STRING */ - -1, /* (325) literal ::= NK_BOOL */ - -2, /* (326) literal ::= TIMESTAMP NK_STRING */ - -1, /* (327) literal ::= duration_literal */ - -1, /* (328) literal ::= NULL */ - -1, /* (329) literal ::= NK_QUESTION */ - -1, /* (330) duration_literal ::= NK_VARIABLE */ - -1, /* (331) signed ::= NK_INTEGER */ - -2, /* (332) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (333) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (334) signed ::= NK_FLOAT */ - -2, /* (335) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (336) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (337) signed_literal ::= signed */ - -1, /* (338) signed_literal ::= NK_STRING */ - -1, /* (339) signed_literal ::= NK_BOOL */ - -2, /* (340) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (341) signed_literal ::= duration_literal */ - -1, /* (342) signed_literal ::= NULL */ - -1, /* (343) signed_literal ::= literal_func */ - -1, /* (344) signed_literal ::= NK_QUESTION */ - -1, /* (345) literal_list ::= signed_literal */ - -3, /* (346) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (347) db_name ::= NK_ID */ - -1, /* (348) table_name ::= NK_ID */ - -1, /* (349) column_name ::= NK_ID */ - -1, /* (350) function_name ::= NK_ID */ - -1, /* (351) table_alias ::= NK_ID */ - -1, /* (352) column_alias ::= NK_ID */ - -1, /* (353) user_name ::= NK_ID */ - -1, /* (354) topic_name ::= NK_ID */ - -1, /* (355) stream_name ::= NK_ID */ - -1, /* (356) cgroup_name ::= NK_ID */ - -1, /* (357) expr_or_subquery ::= expression */ - -1, /* (358) expression ::= literal */ - -1, /* (359) expression ::= pseudo_column */ - -1, /* (360) expression ::= column_reference */ - -1, /* (361) expression ::= function_expression */ - -1, /* (362) expression ::= case_when_expression */ - -3, /* (363) expression ::= NK_LP expression NK_RP */ - -2, /* (364) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (365) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (366) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (367) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (368) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (369) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (370) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (371) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (372) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (373) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (374) expression_list ::= expr_or_subquery */ - -3, /* (375) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (376) column_reference ::= column_name */ - -3, /* (377) column_reference ::= table_name NK_DOT column_name */ - -1, /* (378) pseudo_column ::= ROWTS */ - -1, /* (379) pseudo_column ::= TBNAME */ - -3, /* (380) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (381) pseudo_column ::= QSTART */ - -1, /* (382) pseudo_column ::= QEND */ - -1, /* (383) pseudo_column ::= QDURATION */ - -1, /* (384) pseudo_column ::= WSTART */ - -1, /* (385) pseudo_column ::= WEND */ - -1, /* (386) pseudo_column ::= WDURATION */ - -1, /* (387) pseudo_column ::= IROWTS */ - -1, /* (388) pseudo_column ::= ISFILLED */ - -1, /* (389) pseudo_column ::= QTAGS */ - -4, /* (390) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (391) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (392) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (393) function_expression ::= literal_func */ - -3, /* (394) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (395) literal_func ::= NOW */ - -1, /* (396) noarg_func ::= NOW */ - -1, /* (397) noarg_func ::= TODAY */ - -1, /* (398) noarg_func ::= TIMEZONE */ - -1, /* (399) noarg_func ::= DATABASE */ - -1, /* (400) noarg_func ::= CLIENT_VERSION */ - -1, /* (401) noarg_func ::= SERVER_VERSION */ - -1, /* (402) noarg_func ::= SERVER_STATUS */ - -1, /* (403) noarg_func ::= CURRENT_USER */ - -1, /* (404) noarg_func ::= USER */ - -1, /* (405) star_func ::= COUNT */ - -1, /* (406) star_func ::= FIRST */ - -1, /* (407) star_func ::= LAST */ - -1, /* (408) star_func ::= LAST_ROW */ - -1, /* (409) star_func_para_list ::= NK_STAR */ - -1, /* (410) star_func_para_list ::= other_para_list */ - -1, /* (411) other_para_list ::= star_func_para */ - -3, /* (412) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (413) star_func_para ::= expr_or_subquery */ - -3, /* (414) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (415) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (416) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (417) when_then_list ::= when_then_expr */ - -2, /* (418) when_then_list ::= when_then_list when_then_expr */ - -4, /* (419) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (420) case_when_else_opt ::= */ - -2, /* (421) case_when_else_opt ::= ELSE common_expression */ - -3, /* (422) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (423) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (424) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (425) predicate ::= expr_or_subquery IS NULL */ - -4, /* (426) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (427) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (428) compare_op ::= NK_LT */ - -1, /* (429) compare_op ::= NK_GT */ - -1, /* (430) compare_op ::= NK_LE */ - -1, /* (431) compare_op ::= NK_GE */ - -1, /* (432) compare_op ::= NK_NE */ - -1, /* (433) compare_op ::= NK_EQ */ - -1, /* (434) compare_op ::= LIKE */ - -2, /* (435) compare_op ::= NOT LIKE */ - -1, /* (436) compare_op ::= MATCH */ - -1, /* (437) compare_op ::= NMATCH */ - -1, /* (438) compare_op ::= CONTAINS */ - -1, /* (439) in_op ::= IN */ - -2, /* (440) in_op ::= NOT IN */ - -3, /* (441) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (442) boolean_value_expression ::= boolean_primary */ - -2, /* (443) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (444) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (445) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (446) boolean_primary ::= predicate */ - -3, /* (447) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (448) common_expression ::= expr_or_subquery */ - -1, /* (449) common_expression ::= boolean_value_expression */ - 0, /* (450) from_clause_opt ::= */ - -2, /* (451) from_clause_opt ::= FROM table_reference_list */ - -1, /* (452) table_reference_list ::= table_reference */ - -3, /* (453) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (454) table_reference ::= table_primary */ - -1, /* (455) table_reference ::= joined_table */ - -2, /* (456) table_primary ::= table_name alias_opt */ - -4, /* (457) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (458) table_primary ::= subquery alias_opt */ - -1, /* (459) table_primary ::= parenthesized_joined_table */ - 0, /* (460) alias_opt ::= */ - -1, /* (461) alias_opt ::= table_alias */ - -2, /* (462) alias_opt ::= AS table_alias */ - -3, /* (463) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (464) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (465) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (466) join_type ::= */ - -1, /* (467) join_type ::= INNER */ - -12, /* (468) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 0, /* (469) set_quantifier_opt ::= */ - -1, /* (470) set_quantifier_opt ::= DISTINCT */ - -1, /* (471) set_quantifier_opt ::= ALL */ - -1, /* (472) select_list ::= select_item */ - -3, /* (473) select_list ::= select_list NK_COMMA select_item */ - -1, /* (474) select_item ::= NK_STAR */ - -1, /* (475) select_item ::= common_expression */ - -2, /* (476) select_item ::= common_expression column_alias */ - -3, /* (477) select_item ::= common_expression AS column_alias */ - -3, /* (478) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (479) where_clause_opt ::= */ - -2, /* (480) where_clause_opt ::= WHERE search_condition */ - 0, /* (481) partition_by_clause_opt ::= */ - -3, /* (482) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (483) partition_list ::= partition_item */ - -3, /* (484) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (485) partition_item ::= expr_or_subquery */ - -2, /* (486) partition_item ::= expr_or_subquery column_alias */ - -3, /* (487) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (488) twindow_clause_opt ::= */ - -6, /* (489) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - -4, /* (490) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (491) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (492) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (493) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (494) sliding_opt ::= */ - -4, /* (495) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 0, /* (496) fill_opt ::= */ - -4, /* (497) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (498) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - -1, /* (499) fill_mode ::= NONE */ - -1, /* (500) fill_mode ::= PREV */ - -1, /* (501) fill_mode ::= NULL */ - -1, /* (502) fill_mode ::= LINEAR */ - -1, /* (503) fill_mode ::= NEXT */ - 0, /* (504) group_by_clause_opt ::= */ - -3, /* (505) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (506) group_by_list ::= expr_or_subquery */ - -3, /* (507) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (508) having_clause_opt ::= */ - -2, /* (509) having_clause_opt ::= HAVING search_condition */ - 0, /* (510) range_opt ::= */ - -6, /* (511) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 0, /* (512) every_opt ::= */ - -4, /* (513) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (514) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (515) query_simple ::= query_specification */ - -1, /* (516) query_simple ::= union_query_expression */ - -4, /* (517) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (518) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (519) query_simple_or_subquery ::= query_simple */ - -1, /* (520) query_simple_or_subquery ::= subquery */ - -1, /* (521) query_or_subquery ::= query_expression */ - -1, /* (522) query_or_subquery ::= subquery */ - 0, /* (523) order_by_clause_opt ::= */ - -3, /* (524) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (525) slimit_clause_opt ::= */ - -2, /* (526) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (527) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (528) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (529) limit_clause_opt ::= */ - -2, /* (530) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (531) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (532) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (533) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (534) subquery ::= NK_LP subquery NK_RP */ - -1, /* (535) search_condition ::= common_expression */ - -1, /* (536) sort_specification_list ::= sort_specification */ - -3, /* (537) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (538) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (539) ordering_specification_opt ::= */ - -1, /* (540) ordering_specification_opt ::= ASC */ - -1, /* (541) ordering_specification_opt ::= DESC */ - 0, /* (542) null_ordering_opt ::= */ - -2, /* (543) null_ordering_opt ::= NULLS FIRST */ - -2, /* (544) null_ordering_opt ::= NULLS LAST */ + -3, /* (245) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (246) cmd ::= SHOW CLUSTER ALIVE */ + 0, /* (247) db_name_cond_opt ::= */ + -2, /* (248) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (249) like_pattern_opt ::= */ + -2, /* (250) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (251) table_name_cond ::= table_name */ + 0, /* (252) from_db_opt ::= */ + -2, /* (253) from_db_opt ::= FROM db_name */ + 0, /* (254) tag_list_opt ::= */ + -1, /* (255) tag_list_opt ::= tag_item */ + -3, /* (256) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (257) tag_item ::= TBNAME */ + -1, /* (258) tag_item ::= QTAGS */ + -1, /* (259) tag_item ::= column_name */ + -2, /* (260) tag_item ::= column_name column_alias */ + -3, /* (261) tag_item ::= column_name AS column_alias */ + -8, /* (262) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + -9, /* (263) cmd ::= CREATE INDEX not_exists_opt full_table_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (264) cmd ::= DROP INDEX exists_opt full_table_name */ + -10, /* (265) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (266) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + -1, /* (267) func_list ::= func */ + -3, /* (268) func_list ::= func_list NK_COMMA func */ + -4, /* (269) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (270) sma_func_name ::= function_name */ + -1, /* (271) sma_func_name ::= COUNT */ + -1, /* (272) sma_func_name ::= FIRST */ + -1, /* (273) sma_func_name ::= LAST */ + -1, /* (274) sma_func_name ::= LAST_ROW */ + 0, /* (275) sma_stream_opt ::= */ + -3, /* (276) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (277) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (278) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -6, /* (279) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (280) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + -9, /* (281) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + -7, /* (282) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + -9, /* (283) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + -4, /* (284) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (285) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (286) cmd ::= DESC full_table_name */ + -2, /* (287) cmd ::= DESCRIBE full_table_name */ + -3, /* (288) cmd ::= RESET QUERY CACHE */ + -4, /* (289) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 0, /* (290) analyze_opt ::= */ + -1, /* (291) analyze_opt ::= ANALYZE */ + 0, /* (292) explain_options ::= */ + -3, /* (293) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (294) explain_options ::= explain_options RATIO NK_FLOAT */ + -10, /* (295) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + -4, /* (296) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (297) agg_func_opt ::= */ + -1, /* (298) agg_func_opt ::= AGGREGATE */ + 0, /* (299) bufsize_opt ::= */ + -2, /* (300) bufsize_opt ::= BUFSIZE NK_INTEGER */ + -12, /* (301) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tags_def_opt subtable_opt AS query_or_subquery */ + -4, /* (302) cmd ::= DROP STREAM exists_opt stream_name */ + 0, /* (303) col_list_opt ::= */ + -3, /* (304) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (305) stream_options ::= */ + -3, /* (306) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (307) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (308) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (309) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (310) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (311) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 0, /* (312) subtable_opt ::= */ + -4, /* (313) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + -3, /* (314) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (315) cmd ::= KILL QUERY NK_STRING */ + -3, /* (316) cmd ::= KILL TRANSACTION NK_INTEGER */ + -2, /* (317) cmd ::= BALANCE VGROUP */ + -4, /* (318) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (319) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (320) cmd ::= SPLIT VGROUP NK_INTEGER */ + -2, /* (321) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (322) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (323) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (324) cmd ::= query_or_subquery */ + -7, /* (325) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (326) cmd ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (327) literal ::= NK_INTEGER */ + -1, /* (328) literal ::= NK_FLOAT */ + -1, /* (329) literal ::= NK_STRING */ + -1, /* (330) literal ::= NK_BOOL */ + -2, /* (331) literal ::= TIMESTAMP NK_STRING */ + -1, /* (332) literal ::= duration_literal */ + -1, /* (333) literal ::= NULL */ + -1, /* (334) literal ::= NK_QUESTION */ + -1, /* (335) duration_literal ::= NK_VARIABLE */ + -1, /* (336) signed ::= NK_INTEGER */ + -2, /* (337) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (338) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (339) signed ::= NK_FLOAT */ + -2, /* (340) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (341) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (342) signed_literal ::= signed */ + -1, /* (343) signed_literal ::= NK_STRING */ + -1, /* (344) signed_literal ::= NK_BOOL */ + -2, /* (345) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (346) signed_literal ::= duration_literal */ + -1, /* (347) signed_literal ::= NULL */ + -1, /* (348) signed_literal ::= literal_func */ + -1, /* (349) signed_literal ::= NK_QUESTION */ + -1, /* (350) literal_list ::= signed_literal */ + -3, /* (351) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (352) db_name ::= NK_ID */ + -1, /* (353) table_name ::= NK_ID */ + -1, /* (354) column_name ::= NK_ID */ + -1, /* (355) function_name ::= NK_ID */ + -1, /* (356) table_alias ::= NK_ID */ + -1, /* (357) column_alias ::= NK_ID */ + -1, /* (358) user_name ::= NK_ID */ + -1, /* (359) topic_name ::= NK_ID */ + -1, /* (360) stream_name ::= NK_ID */ + -1, /* (361) cgroup_name ::= NK_ID */ + -1, /* (362) expr_or_subquery ::= expression */ + -1, /* (363) expression ::= literal */ + -1, /* (364) expression ::= pseudo_column */ + -1, /* (365) expression ::= column_reference */ + -1, /* (366) expression ::= function_expression */ + -1, /* (367) expression ::= case_when_expression */ + -3, /* (368) expression ::= NK_LP expression NK_RP */ + -2, /* (369) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (370) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (371) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (372) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (373) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (374) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (375) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (376) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (377) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (378) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (379) expression_list ::= expr_or_subquery */ + -3, /* (380) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (381) column_reference ::= column_name */ + -3, /* (382) column_reference ::= table_name NK_DOT column_name */ + -1, /* (383) pseudo_column ::= ROWTS */ + -1, /* (384) pseudo_column ::= TBNAME */ + -3, /* (385) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (386) pseudo_column ::= QSTART */ + -1, /* (387) pseudo_column ::= QEND */ + -1, /* (388) pseudo_column ::= QDURATION */ + -1, /* (389) pseudo_column ::= WSTART */ + -1, /* (390) pseudo_column ::= WEND */ + -1, /* (391) pseudo_column ::= WDURATION */ + -1, /* (392) pseudo_column ::= IROWTS */ + -1, /* (393) pseudo_column ::= ISFILLED */ + -1, /* (394) pseudo_column ::= QTAGS */ + -4, /* (395) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (396) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (397) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (398) function_expression ::= literal_func */ + -3, /* (399) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (400) literal_func ::= NOW */ + -1, /* (401) noarg_func ::= NOW */ + -1, /* (402) noarg_func ::= TODAY */ + -1, /* (403) noarg_func ::= TIMEZONE */ + -1, /* (404) noarg_func ::= DATABASE */ + -1, /* (405) noarg_func ::= CLIENT_VERSION */ + -1, /* (406) noarg_func ::= SERVER_VERSION */ + -1, /* (407) noarg_func ::= SERVER_STATUS */ + -1, /* (408) noarg_func ::= CURRENT_USER */ + -1, /* (409) noarg_func ::= USER */ + -1, /* (410) star_func ::= COUNT */ + -1, /* (411) star_func ::= FIRST */ + -1, /* (412) star_func ::= LAST */ + -1, /* (413) star_func ::= LAST_ROW */ + -1, /* (414) star_func_para_list ::= NK_STAR */ + -1, /* (415) star_func_para_list ::= other_para_list */ + -1, /* (416) other_para_list ::= star_func_para */ + -3, /* (417) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (418) star_func_para ::= expr_or_subquery */ + -3, /* (419) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (420) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (421) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (422) when_then_list ::= when_then_expr */ + -2, /* (423) when_then_list ::= when_then_list when_then_expr */ + -4, /* (424) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (425) case_when_else_opt ::= */ + -2, /* (426) case_when_else_opt ::= ELSE common_expression */ + -3, /* (427) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (428) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (429) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (430) predicate ::= expr_or_subquery IS NULL */ + -4, /* (431) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (432) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (433) compare_op ::= NK_LT */ + -1, /* (434) compare_op ::= NK_GT */ + -1, /* (435) compare_op ::= NK_LE */ + -1, /* (436) compare_op ::= NK_GE */ + -1, /* (437) compare_op ::= NK_NE */ + -1, /* (438) compare_op ::= NK_EQ */ + -1, /* (439) compare_op ::= LIKE */ + -2, /* (440) compare_op ::= NOT LIKE */ + -1, /* (441) compare_op ::= MATCH */ + -1, /* (442) compare_op ::= NMATCH */ + -1, /* (443) compare_op ::= CONTAINS */ + -1, /* (444) in_op ::= IN */ + -2, /* (445) in_op ::= NOT IN */ + -3, /* (446) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (447) boolean_value_expression ::= boolean_primary */ + -2, /* (448) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (449) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (450) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (451) boolean_primary ::= predicate */ + -3, /* (452) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (453) common_expression ::= expr_or_subquery */ + -1, /* (454) common_expression ::= boolean_value_expression */ + 0, /* (455) from_clause_opt ::= */ + -2, /* (456) from_clause_opt ::= FROM table_reference_list */ + -1, /* (457) table_reference_list ::= table_reference */ + -3, /* (458) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (459) table_reference ::= table_primary */ + -1, /* (460) table_reference ::= joined_table */ + -2, /* (461) table_primary ::= table_name alias_opt */ + -4, /* (462) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (463) table_primary ::= subquery alias_opt */ + -1, /* (464) table_primary ::= parenthesized_joined_table */ + 0, /* (465) alias_opt ::= */ + -1, /* (466) alias_opt ::= table_alias */ + -2, /* (467) alias_opt ::= AS table_alias */ + -3, /* (468) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (469) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (470) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (471) join_type ::= */ + -1, /* (472) join_type ::= INNER */ + -12, /* (473) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (474) set_quantifier_opt ::= */ + -1, /* (475) set_quantifier_opt ::= DISTINCT */ + -1, /* (476) set_quantifier_opt ::= ALL */ + -1, /* (477) select_list ::= select_item */ + -3, /* (478) select_list ::= select_list NK_COMMA select_item */ + -1, /* (479) select_item ::= NK_STAR */ + -1, /* (480) select_item ::= common_expression */ + -2, /* (481) select_item ::= common_expression column_alias */ + -3, /* (482) select_item ::= common_expression AS column_alias */ + -3, /* (483) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (484) where_clause_opt ::= */ + -2, /* (485) where_clause_opt ::= WHERE search_condition */ + 0, /* (486) partition_by_clause_opt ::= */ + -3, /* (487) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (488) partition_list ::= partition_item */ + -3, /* (489) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (490) partition_item ::= expr_or_subquery */ + -2, /* (491) partition_item ::= expr_or_subquery column_alias */ + -3, /* (492) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (493) twindow_clause_opt ::= */ + -6, /* (494) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + -4, /* (495) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (496) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (497) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (498) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (499) sliding_opt ::= */ + -4, /* (500) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 0, /* (501) fill_opt ::= */ + -4, /* (502) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (503) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + -1, /* (504) fill_mode ::= NONE */ + -1, /* (505) fill_mode ::= PREV */ + -1, /* (506) fill_mode ::= NULL */ + -1, /* (507) fill_mode ::= LINEAR */ + -1, /* (508) fill_mode ::= NEXT */ + 0, /* (509) group_by_clause_opt ::= */ + -3, /* (510) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (511) group_by_list ::= expr_or_subquery */ + -3, /* (512) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (513) having_clause_opt ::= */ + -2, /* (514) having_clause_opt ::= HAVING search_condition */ + 0, /* (515) range_opt ::= */ + -6, /* (516) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 0, /* (517) every_opt ::= */ + -4, /* (518) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (519) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (520) query_simple ::= query_specification */ + -1, /* (521) query_simple ::= union_query_expression */ + -4, /* (522) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (523) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (524) query_simple_or_subquery ::= query_simple */ + -1, /* (525) query_simple_or_subquery ::= subquery */ + -1, /* (526) query_or_subquery ::= query_expression */ + -1, /* (527) query_or_subquery ::= subquery */ + 0, /* (528) order_by_clause_opt ::= */ + -3, /* (529) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (530) slimit_clause_opt ::= */ + -2, /* (531) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (532) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (533) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (534) limit_clause_opt ::= */ + -2, /* (535) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (536) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (537) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (538) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (539) subquery ::= NK_LP subquery NK_RP */ + -1, /* (540) search_condition ::= common_expression */ + -1, /* (541) sort_specification_list ::= sort_specification */ + -3, /* (542) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (543) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (544) ordering_specification_opt ::= */ + -1, /* (545) ordering_specification_opt ::= ASC */ + -1, /* (546) ordering_specification_opt ::= DESC */ + 0, /* (547) null_ordering_opt ::= */ + -2, /* (548) null_ordering_opt ::= NULLS FIRST */ + -2, /* (549) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4288,11 +4256,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,326,&yymsp[0].minor); + yy_destructor(yypParser,327,&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,327,&yymsp[0].minor); + yy_destructor(yypParser,328,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -4306,20 +4274,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,326,&yymsp[-2].minor); +{ yy_destructor(yypParser,327,&yymsp[-2].minor); { } - yy_destructor(yypParser,328,&yymsp[0].minor); + yy_destructor(yypParser,329,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,329,&yymsp[0].minor); +{ yy_destructor(yypParser,330,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,327,&yymsp[-1].minor); +{ yy_destructor(yypParser,328,&yymsp[-1].minor); { } - yy_destructor(yypParser,329,&yymsp[0].minor); + yy_destructor(yypParser,330,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -4333,81 +4301,81 @@ 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,328,&yymsp[0].minor); + yy_destructor(yypParser,329,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy77, &yymsp[-1].minor.yy0, yymsp[0].minor.yy287); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy815, &yymsp[-1].minor.yy0, yymsp[0].minor.yy475); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy77, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy815, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy77, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy815, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy77, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy815, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy77); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy815); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy287 = 1; } +{ yymsp[1].minor.yy475 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy287 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy475 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy717, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy483, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy815); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy717, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy483, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy815); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); -{ yylhsminor.yy717 = yymsp[0].minor.yy717; } - yymsp[0].minor.yy717 = yylhsminor.yy717; +{ yylhsminor.yy483 = yymsp[0].minor.yy483; } + yymsp[0].minor.yy483 = yylhsminor.yy483; break; case 35: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy717 = yymsp[-2].minor.yy717 | yymsp[0].minor.yy717; } - yymsp[-2].minor.yy717 = yylhsminor.yy717; +{ yylhsminor.yy483 = yymsp[-2].minor.yy483 | yymsp[0].minor.yy483; } + yymsp[-2].minor.yy483 = yylhsminor.yy483; break; case 38: /* priv_type ::= READ */ -{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_READ; } break; case 39: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_WRITE; } break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy77 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy77 = yylhsminor.yy77; +{ yylhsminor.yy815 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy815 = yylhsminor.yy815; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy77 = yymsp[-2].minor.yy77; } - yymsp[-2].minor.yy77 = yylhsminor.yy77; +{ yylhsminor.yy815 = yymsp[-2].minor.yy815; } + yymsp[-2].minor.yy815 = yylhsminor.yy815; break; case 42: /* priv_level ::= topic_name */ - case 267: /* sma_func_name ::= function_name */ yytestcase(yyruleno==267); - case 461: /* alias_opt ::= table_alias */ yytestcase(yyruleno==461); -{ yylhsminor.yy77 = yymsp[0].minor.yy77; } - yymsp[0].minor.yy77 = yylhsminor.yy77; + case 270: /* sma_func_name ::= function_name */ yytestcase(yyruleno==270); + case 466: /* alias_opt ::= table_alias */ yytestcase(yyruleno==466); +{ yylhsminor.yy815 = yymsp[0].minor.yy815; } + yymsp[0].minor.yy815 = yylhsminor.yy815; break; case 43: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy77, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy815, NULL); } break; case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy0); } break; case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy841); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy63); } break; case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy841); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy815, yymsp[0].minor.yy63); } break; case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -4424,49 +4392,49 @@ static YYACTIONTYPE yy_reduce( case 51: /* dnode_endpoint ::= NK_STRING */ case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 268: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==268); - case 269: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==269); - case 270: /* sma_func_name ::= LAST */ yytestcase(yyruleno==270); - case 271: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==271); - case 347: /* db_name ::= NK_ID */ yytestcase(yyruleno==347); - case 348: /* table_name ::= NK_ID */ yytestcase(yyruleno==348); - case 349: /* column_name ::= NK_ID */ yytestcase(yyruleno==349); - case 350: /* function_name ::= NK_ID */ yytestcase(yyruleno==350); - case 351: /* table_alias ::= NK_ID */ yytestcase(yyruleno==351); - case 352: /* column_alias ::= NK_ID */ yytestcase(yyruleno==352); - case 353: /* user_name ::= NK_ID */ yytestcase(yyruleno==353); - case 354: /* topic_name ::= NK_ID */ yytestcase(yyruleno==354); - case 355: /* stream_name ::= NK_ID */ yytestcase(yyruleno==355); - case 356: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==356); - case 396: /* noarg_func ::= NOW */ yytestcase(yyruleno==396); - case 397: /* noarg_func ::= TODAY */ yytestcase(yyruleno==397); - case 398: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==398); - case 399: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==399); - case 400: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==400); - case 401: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==401); - case 402: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==402); - case 403: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==403); - case 404: /* noarg_func ::= USER */ yytestcase(yyruleno==404); - case 405: /* star_func ::= COUNT */ yytestcase(yyruleno==405); - case 406: /* star_func ::= FIRST */ yytestcase(yyruleno==406); - case 407: /* star_func ::= LAST */ yytestcase(yyruleno==407); - case 408: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==408); -{ yylhsminor.yy77 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy77 = yylhsminor.yy77; + case 271: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==271); + case 272: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==272); + case 273: /* sma_func_name ::= LAST */ yytestcase(yyruleno==273); + case 274: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==274); + case 352: /* db_name ::= NK_ID */ yytestcase(yyruleno==352); + case 353: /* table_name ::= NK_ID */ yytestcase(yyruleno==353); + case 354: /* column_name ::= NK_ID */ yytestcase(yyruleno==354); + case 355: /* function_name ::= NK_ID */ yytestcase(yyruleno==355); + case 356: /* table_alias ::= NK_ID */ yytestcase(yyruleno==356); + case 357: /* column_alias ::= NK_ID */ yytestcase(yyruleno==357); + case 358: /* user_name ::= NK_ID */ yytestcase(yyruleno==358); + case 359: /* topic_name ::= NK_ID */ yytestcase(yyruleno==359); + case 360: /* stream_name ::= NK_ID */ yytestcase(yyruleno==360); + case 361: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==361); + case 401: /* noarg_func ::= NOW */ yytestcase(yyruleno==401); + case 402: /* noarg_func ::= TODAY */ yytestcase(yyruleno==402); + case 403: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==403); + case 404: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==404); + case 405: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==405); + case 406: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==406); + case 407: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==407); + case 408: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==408); + case 409: /* noarg_func ::= USER */ yytestcase(yyruleno==409); + case 410: /* star_func ::= COUNT */ yytestcase(yyruleno==410); + case 411: /* star_func ::= FIRST */ yytestcase(yyruleno==411); + case 412: /* star_func ::= LAST */ yytestcase(yyruleno==412); + case 413: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==413); +{ yylhsminor.yy815 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy815 = yylhsminor.yy815; break; case 54: /* force_opt ::= */ case 73: /* not_exists_opt ::= */ yytestcase(yyruleno==73); case 75: /* exists_opt ::= */ yytestcase(yyruleno==75); - case 287: /* analyze_opt ::= */ yytestcase(yyruleno==287); - case 294: /* agg_func_opt ::= */ yytestcase(yyruleno==294); - case 469: /* set_quantifier_opt ::= */ yytestcase(yyruleno==469); -{ yymsp[1].minor.yy841 = false; } + case 290: /* analyze_opt ::= */ yytestcase(yyruleno==290); + case 297: /* agg_func_opt ::= */ yytestcase(yyruleno==297); + case 474: /* set_quantifier_opt ::= */ yytestcase(yyruleno==474); +{ yymsp[1].minor.yy63 = false; } break; case 55: /* force_opt ::= FORCE */ - case 288: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==288); - case 295: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==295); - case 470: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==470); -{ yymsp[0].minor.yy841 = true; } + case 291: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==291); + case 298: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==298); + case 475: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==475); +{ yymsp[0].minor.yy63 = true; } break; case 56: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -4499,206 +4467,206 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy841, &yymsp[-1].minor.yy77, yymsp[0].minor.yy600); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy63, &yymsp[-1].minor.yy815, yymsp[0].minor.yy320); } break; case 67: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy63, &yymsp[0].minor.yy815); } break; case 68: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy77); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy815); } break; case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy600); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy815, yymsp[0].minor.yy320); } break; case 70: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy77); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy815); } break; case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy248); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy815, yymsp[0].minor.yy122); } break; case 72: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy841 = true; } +{ yymsp[-2].minor.yy63 = true; } break; case 74: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy841 = true; } +{ yymsp[-1].minor.yy63 = true; } break; case 76: /* db_options ::= */ -{ yymsp[1].minor.yy600 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy320 = createDefaultDatabaseOptions(pCxt); } break; case 77: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 78: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 79: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 80: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 81: /* db_options ::= db_options DURATION NK_INTEGER */ case 82: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==82); -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 83: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 84: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 85: /* db_options ::= db_options KEEP integer_list */ case 86: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==86); -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_KEEP, yymsp[0].minor.yy601); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_KEEP, yymsp[0].minor.yy570); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 87: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 88: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 89: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 90: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 91: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 92: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 93: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 94: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_RETENTIONS, yymsp[0].minor.yy601); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_RETENTIONS, yymsp[0].minor.yy570); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 95: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 96: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 97: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 98: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 99: /* 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.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-3].minor.yy320, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; case 100: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 101: /* 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.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-3].minor.yy320, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; case 102: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 103: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 104: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 105: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 106: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setDatabaseOption(pCxt, yymsp[-2].minor.yy320, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 107: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy600 = createAlterDatabaseOptions(pCxt); yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yylhsminor.yy600, &yymsp[0].minor.yy661); } - yymsp[0].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterDatabaseOptions(pCxt); yylhsminor.yy320 = setAlterDatabaseOption(pCxt, yylhsminor.yy320, &yymsp[0].minor.yy695); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; case 108: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy600, &yymsp[0].minor.yy661); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy320, &yymsp[0].minor.yy695); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; case 109: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 110: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 111: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 112: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 113: /* alter_db_option ::= KEEP integer_list */ case 114: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==114); -{ yymsp[-1].minor.yy661.type = DB_OPTION_KEEP; yymsp[-1].minor.yy661.pList = yymsp[0].minor.yy601; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_KEEP; yymsp[-1].minor.yy695.pList = yymsp[0].minor.yy570; } break; case 115: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_PAGES; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_PAGES; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 116: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 117: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_WAL; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_WAL; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 118: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 119: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy601 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy601 = yylhsminor.yy601; +{ yylhsminor.yy570 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy570 = yylhsminor.yy570; break; case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 317: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==317); -{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy601 = yylhsminor.yy601; + case 322: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==322); +{ yylhsminor.yy570 = addNodeToList(pCxt, yymsp[-2].minor.yy570, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy570 = yylhsminor.yy570; break; case 121: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy601 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy601 = yylhsminor.yy601; +{ yylhsminor.yy570 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy570 = yylhsminor.yy570; break; case 122: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy601 = yylhsminor.yy601; +{ yylhsminor.yy570 = addNodeToList(pCxt, yymsp[-2].minor.yy570, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy570 = yylhsminor.yy570; break; case 123: /* retention_list ::= retention */ case 145: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==145); @@ -4706,288 +4674,290 @@ static YYACTIONTYPE yy_reduce( case 155: /* column_def_list ::= column_def */ yytestcase(yyruleno==155); case 199: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==199); case 204: /* col_name_list ::= col_name */ yytestcase(yyruleno==204); - case 253: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==253); - case 264: /* func_list ::= func */ yytestcase(yyruleno==264); - case 345: /* literal_list ::= signed_literal */ yytestcase(yyruleno==345); - case 411: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==411); - case 417: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==417); - case 472: /* select_list ::= select_item */ yytestcase(yyruleno==472); - case 483: /* partition_list ::= partition_item */ yytestcase(yyruleno==483); - case 536: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==536); -{ yylhsminor.yy601 = createNodeList(pCxt, yymsp[0].minor.yy600); } - yymsp[0].minor.yy601 = yylhsminor.yy601; + case 255: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==255); + case 267: /* func_list ::= func */ yytestcase(yyruleno==267); + case 350: /* literal_list ::= signed_literal */ yytestcase(yyruleno==350); + case 416: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==416); + case 422: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==422); + case 477: /* select_list ::= select_item */ yytestcase(yyruleno==477); + case 488: /* partition_list ::= partition_item */ yytestcase(yyruleno==488); + case 541: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==541); +{ yylhsminor.yy570 = createNodeList(pCxt, yymsp[0].minor.yy320); } + yymsp[0].minor.yy570 = yylhsminor.yy570; break; case 124: /* retention_list ::= retention_list NK_COMMA retention */ case 156: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==156); case 200: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==200); case 205: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==205); - case 254: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==254); - case 265: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==265); - case 346: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==346); - case 412: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==412); - case 473: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==473); - case 484: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==484); - case 537: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==537); -{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); } - yymsp[-2].minor.yy601 = yylhsminor.yy601; + case 256: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==256); + case 268: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==268); + case 351: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==351); + case 417: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==417); + case 478: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==478); + case 489: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==489); + case 542: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==542); +{ yylhsminor.yy570 = addNodeToList(pCxt, yymsp[-2].minor.yy570, yymsp[0].minor.yy320); } + yymsp[-2].minor.yy570 = yylhsminor.yy570; break; case 125: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy600 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 126: /* speed_opt ::= */ - case 296: /* bufsize_opt ::= */ yytestcase(yyruleno==296); -{ yymsp[1].minor.yy248 = 0; } + case 299: /* bufsize_opt ::= */ yytestcase(yyruleno==299); +{ yymsp[1].minor.yy122 = 0; } break; case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 297: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==297); -{ yymsp[-1].minor.yy248 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 300: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==300); +{ yymsp[-1].minor.yy122 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 128: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 130: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==130); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy841, yymsp[-5].minor.yy600, yymsp[-3].minor.yy601, yymsp[-1].minor.yy601, yymsp[0].minor.yy600); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy63, yymsp[-5].minor.yy320, yymsp[-3].minor.yy570, yymsp[-1].minor.yy570, yymsp[0].minor.yy320); } break; case 129: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy601); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy570); } break; case 131: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy601); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy570); } break; case 132: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy63, yymsp[0].minor.yy320); } break; case 133: /* cmd ::= ALTER TABLE alter_table_clause */ - case 319: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==319); -{ pCxt->pRootNode = yymsp[0].minor.yy600; } + case 324: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==324); +{ pCxt->pRootNode = yymsp[0].minor.yy320; } break; case 134: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy600); } +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy320); } break; case 135: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy600 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy320, yymsp[0].minor.yy320); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; case 136: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy320, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy815, yymsp[0].minor.yy200); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 137: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy77); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy320, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy815); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; case 138: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy320, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy815, yymsp[0].minor.yy200); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 139: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy320, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy815, &yymsp[0].minor.yy815); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 140: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy320, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy815, yymsp[0].minor.yy200); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 141: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy77); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy320, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy815); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; case 142: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy320, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy815, yymsp[0].minor.yy200); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 143: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy320, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy815, &yymsp[0].minor.yy815); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 144: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy600 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy600, &yymsp[-2].minor.yy77, yymsp[0].minor.yy600); } - yymsp[-5].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy320, &yymsp[-2].minor.yy815, yymsp[0].minor.yy320); } + yymsp[-5].minor.yy320 = yylhsminor.yy320; break; case 146: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 149: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==149); - case 418: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==418); -{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-1].minor.yy601, yymsp[0].minor.yy600); } - yymsp[-1].minor.yy601 = yylhsminor.yy601; + case 423: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==423); +{ yylhsminor.yy570 = addNodeToList(pCxt, yymsp[-1].minor.yy570, yymsp[0].minor.yy320); } + yymsp[-1].minor.yy570 = yylhsminor.yy570; break; case 147: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy600 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy841, yymsp[-8].minor.yy600, yymsp[-6].minor.yy600, yymsp[-5].minor.yy601, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); } - yymsp[-9].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy63, yymsp[-8].minor.yy320, yymsp[-6].minor.yy320, yymsp[-5].minor.yy570, yymsp[-2].minor.yy570, yymsp[0].minor.yy320); } + yymsp[-9].minor.yy320 = yylhsminor.yy320; break; case 150: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy600 = createDropTableClause(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createDropTableClause(pCxt, yymsp[-1].minor.yy63, yymsp[0].minor.yy320); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; case 151: /* specific_cols_opt ::= */ case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182); - case 252: /* tag_list_opt ::= */ yytestcase(yyruleno==252); - case 481: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==481); - case 504: /* group_by_clause_opt ::= */ yytestcase(yyruleno==504); - case 523: /* order_by_clause_opt ::= */ yytestcase(yyruleno==523); -{ yymsp[1].minor.yy601 = NULL; } + case 254: /* tag_list_opt ::= */ yytestcase(yyruleno==254); + case 303: /* col_list_opt ::= */ yytestcase(yyruleno==303); + case 486: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==486); + case 509: /* group_by_clause_opt ::= */ yytestcase(yyruleno==509); + case 528: /* order_by_clause_opt ::= */ yytestcase(yyruleno==528); +{ yymsp[1].minor.yy570 = NULL; } break; case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy601 = yymsp[-1].minor.yy601; } + case 304: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==304); +{ yymsp[-2].minor.yy570 = yymsp[-1].minor.yy570; } break; case 153: /* full_table_name ::= table_name */ -{ yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy77, NULL); } - yymsp[0].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy815, NULL); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; case 154: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77, NULL); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createRealTableNode(pCxt, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy815, NULL); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 157: /* column_def ::= column_name type_name */ -{ yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888, NULL); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy815, yymsp[0].minor.yy200, NULL); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; case 158: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-2].minor.yy888, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy815, yymsp[-2].minor.yy200, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; case 159: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 160: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 161: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 162: /* type_name ::= INT */ case 163: /* type_name ::= INTEGER */ yytestcase(yyruleno==163); -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_INT); } break; case 164: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 165: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 166: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 167: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy200 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 168: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 169: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy200 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 170: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy200 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 171: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy200 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 172: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy200 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 173: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy200 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 174: /* type_name ::= JSON */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 175: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy200 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 176: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 177: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 178: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy200 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 179: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy200 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 180: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy888 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy200 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy888 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy200 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 183: /* tags_def_opt ::= tags_def */ - case 410: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==410); -{ yylhsminor.yy601 = yymsp[0].minor.yy601; } - yymsp[0].minor.yy601 = yylhsminor.yy601; + case 415: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==415); +{ yylhsminor.yy570 = yymsp[0].minor.yy570; } + yymsp[0].minor.yy570 = yylhsminor.yy570; break; case 184: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy601 = yymsp[-1].minor.yy601; } +{ yymsp[-3].minor.yy570 = yymsp[-1].minor.yy570; } break; case 185: /* table_options ::= */ -{ yymsp[1].minor.yy600 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy320 = createDefaultTableOptions(pCxt); } break; case 186: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-2].minor.yy320, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 187: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy601); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-2].minor.yy320, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy570); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 188: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy601); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-2].minor.yy320, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy570); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 189: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy601); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-4].minor.yy320, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy570); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 190: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-2].minor.yy320, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 191: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_SMA, yymsp[-1].minor.yy601); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-4].minor.yy320, TABLE_OPTION_SMA, yymsp[-1].minor.yy570); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; case 192: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy601); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-2].minor.yy320, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy570); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; case 193: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy600 = createAlterTableOptions(pCxt); yylhsminor.yy600 = setTableOption(pCxt, yylhsminor.yy600, yymsp[0].minor.yy661.type, &yymsp[0].minor.yy661.val); } - yymsp[0].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createAlterTableOptions(pCxt); yylhsminor.yy320 = setTableOption(pCxt, yylhsminor.yy320, yymsp[0].minor.yy695.type, &yymsp[0].minor.yy695.val); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; case 194: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy661.type, &yymsp[0].minor.yy661.val); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = setTableOption(pCxt, yymsp[-1].minor.yy320, yymsp[0].minor.yy695.type, &yymsp[0].minor.yy695.val); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; case 195: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy661.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 196: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy661.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy695.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy695.val = yymsp[0].minor.yy0; } break; case 197: /* duration_list ::= duration_literal */ - case 374: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==374); -{ yylhsminor.yy601 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } - yymsp[0].minor.yy601 = yylhsminor.yy601; + case 379: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==379); +{ yylhsminor.yy570 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy320)); } + yymsp[0].minor.yy570 = yylhsminor.yy570; break; case 198: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 375: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==375); -{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } - yymsp[-2].minor.yy601 = yylhsminor.yy601; + case 380: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==380); +{ yylhsminor.yy570 = addNodeToList(pCxt, yymsp[-2].minor.yy570, releaseRawExprNode(pCxt, yymsp[0].minor.yy320)); } + yymsp[-2].minor.yy570 = yylhsminor.yy570; break; case 201: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy77, NULL); } - yymsp[0].minor.yy600 = yylhsminor.yy600; +{ yylhsminor.yy320 = createFunctionNode(pCxt, &yymsp[0].minor.yy815, NULL); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; case 202: /* rollup_func_name ::= FIRST */ case 203: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==203); - case 256: /* tag_item ::= QTAGS */ yytestcase(yyruleno==256); -{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 258: /* tag_item ::= QTAGS */ yytestcase(yyruleno==258); +{ yylhsminor.yy320 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; case 206: /* col_name ::= column_name */ - case 257: /* tag_item ::= column_name */ yytestcase(yyruleno==257); -{ yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy77); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 259: /* tag_item ::= column_name */ yytestcase(yyruleno==259); +{ yylhsminor.yy320 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy815); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; case 207: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -5002,13 +4972,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 211: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy320, yymsp[0].minor.yy320, OP_TYPE_LIKE); } break; case 212: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy320, yymsp[0].minor.yy320, OP_TYPE_LIKE); } break; case 213: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy600, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy320, NULL, OP_TYPE_LIKE); } break; case 214: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -5020,7 +4990,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 217: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy320, yymsp[-1].minor.yy320, OP_TYPE_EQUAL); } break; case 218: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -5039,13 +5009,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; case 224: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy77); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy815); } break; case 225: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy600); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy320); } break; case 226: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy600); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy320); } break; case 227: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -5064,7 +5034,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; case 233: /* 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.yy600); } +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy320); } break; case 234: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } @@ -5079,7 +5049,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 238: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy600); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy320); } break; case 239: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -5088,10 +5058,10 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; case 241: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy320, yymsp[-1].minor.yy320, OP_TYPE_EQUAL); } break; case 242: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600, yymsp[-3].minor.yy601); } +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy320, yymsp[0].minor.yy320, yymsp[-3].minor.yy570); } break; case 243: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } @@ -5099,739 +5069,748 @@ static YYACTIONTYPE yy_reduce( case 244: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 245: /* db_name_cond_opt ::= */ - case 250: /* from_db_opt ::= */ yytestcase(yyruleno==250); -{ yymsp[1].minor.yy600 = createDefaultDatabaseCondValue(pCxt); } + case 245: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy320, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 246: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy77); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + case 246: /* cmd ::= SHOW CLUSTER ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 247: /* like_pattern_opt ::= */ - case 307: /* subtable_opt ::= */ yytestcase(yyruleno==307); - case 420: /* case_when_else_opt ::= */ yytestcase(yyruleno==420); - case 450: /* from_clause_opt ::= */ yytestcase(yyruleno==450); - case 479: /* where_clause_opt ::= */ yytestcase(yyruleno==479); - case 488: /* twindow_clause_opt ::= */ yytestcase(yyruleno==488); - case 494: /* sliding_opt ::= */ yytestcase(yyruleno==494); - case 496: /* fill_opt ::= */ yytestcase(yyruleno==496); - case 508: /* having_clause_opt ::= */ yytestcase(yyruleno==508); - case 510: /* range_opt ::= */ yytestcase(yyruleno==510); - case 512: /* every_opt ::= */ yytestcase(yyruleno==512); - case 525: /* slimit_clause_opt ::= */ yytestcase(yyruleno==525); - case 529: /* limit_clause_opt ::= */ yytestcase(yyruleno==529); -{ yymsp[1].minor.yy600 = NULL; } + case 247: /* db_name_cond_opt ::= */ + case 252: /* from_db_opt ::= */ yytestcase(yyruleno==252); +{ yymsp[1].minor.yy320 = createDefaultDatabaseCondValue(pCxt); } break; - case 248: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 248: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy320 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy815); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 249: /* table_name_cond ::= table_name */ -{ yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy77); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 249: /* like_pattern_opt ::= */ + case 312: /* subtable_opt ::= */ yytestcase(yyruleno==312); + case 425: /* case_when_else_opt ::= */ yytestcase(yyruleno==425); + case 455: /* from_clause_opt ::= */ yytestcase(yyruleno==455); + case 484: /* where_clause_opt ::= */ yytestcase(yyruleno==484); + case 493: /* twindow_clause_opt ::= */ yytestcase(yyruleno==493); + case 499: /* sliding_opt ::= */ yytestcase(yyruleno==499); + case 501: /* fill_opt ::= */ yytestcase(yyruleno==501); + case 513: /* having_clause_opt ::= */ yytestcase(yyruleno==513); + case 515: /* range_opt ::= */ yytestcase(yyruleno==515); + case 517: /* every_opt ::= */ yytestcase(yyruleno==517); + case 530: /* slimit_clause_opt ::= */ yytestcase(yyruleno==530); + case 534: /* limit_clause_opt ::= */ yytestcase(yyruleno==534); +{ yymsp[1].minor.yy320 = NULL; } break; - case 251: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy77); } + case 250: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 255: /* tag_item ::= TBNAME */ -{ yylhsminor.yy600 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 251: /* table_name_cond ::= table_name */ +{ yylhsminor.yy320 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy815); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 258: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy77), &yymsp[0].minor.yy77); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + case 253: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy320 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy815); } break; - case 259: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy77), &yymsp[0].minor.yy77); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 257: /* tag_item ::= TBNAME */ +{ yylhsminor.yy320 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 260: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy841, yymsp[-3].minor.yy600, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } + case 260: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy320 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy815), &yymsp[0].minor.yy815); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 261: /* cmd ::= DROP INDEX exists_opt full_table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); } + case 261: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy320 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy815), &yymsp[0].minor.yy815); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 262: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy600 = createIndexOption(pCxt, yymsp[-7].minor.yy601, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } + case 262: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy63, yymsp[-3].minor.yy320, yymsp[-1].minor.yy320, NULL, yymsp[0].minor.yy320); } break; - case 263: /* 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.yy600 = createIndexOption(pCxt, yymsp[-9].minor.yy601, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } + case 263: /* cmd ::= CREATE INDEX not_exists_opt full_table_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy63, yymsp[-5].minor.yy320, yymsp[-3].minor.yy320, yymsp[-1].minor.yy570, NULL); } break; - case 266: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-1].minor.yy601); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + case 264: /* cmd ::= DROP INDEX exists_opt full_table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy63, yymsp[0].minor.yy320); } break; - case 272: /* sma_stream_opt ::= */ - case 300: /* stream_options ::= */ yytestcase(yyruleno==300); -{ yymsp[1].minor.yy600 = createStreamOptions(pCxt); } + case 265: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy320 = createIndexOption(pCxt, yymsp[-7].minor.yy570, releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), NULL, yymsp[-1].minor.yy320, yymsp[0].minor.yy320); } break; - case 273: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - case 304: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==304); -{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 266: /* 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.yy320 = createIndexOption(pCxt, yymsp[-9].minor.yy570, releaseRawExprNode(pCxt, yymsp[-5].minor.yy320), releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), yymsp[-1].minor.yy320, yymsp[0].minor.yy320); } break; - case 274: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 269: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy320 = createFunctionNode(pCxt, &yymsp[-3].minor.yy815, yymsp[-1].minor.yy570); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 275: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 275: /* sma_stream_opt ::= */ + case 305: /* stream_options ::= */ yytestcase(yyruleno==305); +{ yymsp[1].minor.yy320 = createStreamOptions(pCxt); } break; - case 276: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy841, &yymsp[-2].minor.yy77, yymsp[0].minor.yy600); } + case 276: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 309: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==309); +{ ((SStreamOptions*)yymsp[-2].minor.yy320)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy320); yylhsminor.yy320 = yymsp[-2].minor.yy320; } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 277: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy841, &yymsp[-3].minor.yy77, &yymsp[0].minor.yy77, false); } + case 277: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy320)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy320); yylhsminor.yy320 = yymsp[-2].minor.yy320; } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 278: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy841, &yymsp[-5].minor.yy77, &yymsp[0].minor.yy77, true); } + case 278: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy320)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy320); yylhsminor.yy320 = yymsp[-2].minor.yy320; } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 279: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy841, &yymsp[-3].minor.yy77, yymsp[0].minor.yy600, false); } + case 279: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy63, &yymsp[-2].minor.yy815, yymsp[0].minor.yy320); } break; - case 280: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy841, &yymsp[-5].minor.yy77, yymsp[0].minor.yy600, true); } + case 280: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy63, &yymsp[-3].minor.yy815, &yymsp[0].minor.yy815, false); } break; - case 281: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); } + case 281: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy63, &yymsp[-5].minor.yy815, &yymsp[0].minor.yy815, true); } break; - case 282: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy841, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); } + case 282: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy63, &yymsp[-3].minor.yy815, yymsp[0].minor.yy320, false); } break; - case 283: /* cmd ::= DESC full_table_name */ - case 284: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==284); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy600); } + case 283: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy63, &yymsp[-5].minor.yy815, yymsp[0].minor.yy320, true); } break; - case 285: /* cmd ::= RESET QUERY CACHE */ + case 284: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy63, &yymsp[0].minor.yy815); } + break; + case 285: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy63, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy815); } + break; + case 286: /* cmd ::= DESC full_table_name */ + case 287: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==287); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy320); } + break; + case 288: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 286: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy841, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } + case 289: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy63, yymsp[-1].minor.yy320, yymsp[0].minor.yy320); } break; - case 289: /* explain_options ::= */ -{ yymsp[1].minor.yy600 = createDefaultExplainOptions(pCxt); } + case 292: /* explain_options ::= */ +{ yymsp[1].minor.yy320 = createDefaultExplainOptions(pCxt); } break; - case 290: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy600 = setExplainVerbose(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 293: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy320 = setExplainVerbose(pCxt, yymsp[-2].minor.yy320, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 291: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy600 = setExplainRatio(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 294: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy320 = setExplainRatio(pCxt, yymsp[-2].minor.yy320, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 292: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy841, yymsp[-8].minor.yy841, &yymsp[-5].minor.yy77, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy888, yymsp[0].minor.yy248); } + case 295: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy63, yymsp[-8].minor.yy63, &yymsp[-5].minor.yy815, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy200, yymsp[0].minor.yy122); } break; - case 293: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); } + case 296: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy63, &yymsp[0].minor.yy815); } break; - case 298: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy841, &yymsp[-7].minor.yy77, yymsp[-4].minor.yy600, yymsp[-6].minor.yy600, yymsp[-3].minor.yy601, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } + case 301: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tags_def_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy63, &yymsp[-8].minor.yy815, yymsp[-5].minor.yy320, yymsp[-7].minor.yy320, yymsp[-3].minor.yy570, yymsp[-2].minor.yy320, yymsp[0].minor.yy320, yymsp[-4].minor.yy570); } break; - case 299: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); } + case 302: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy63, &yymsp[0].minor.yy815); } break; - case 301: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy600)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy600 = yymsp[-2].minor.yy600; } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 306: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy320)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy320 = yymsp[-2].minor.yy320; } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 302: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy600)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy600 = yymsp[-2].minor.yy600; } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 307: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy320)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy320 = yymsp[-2].minor.yy320; } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 303: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy600)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-3].minor.yy600; } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + case 308: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy320)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy320)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy320); yylhsminor.yy320 = yymsp[-3].minor.yy320; } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 305: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy600)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy600 = yymsp[-3].minor.yy600; } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + case 310: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-3].minor.yy320)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy320 = yymsp[-3].minor.yy320; } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 306: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-2].minor.yy600)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy600 = yymsp[-2].minor.yy600; } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 311: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-2].minor.yy320)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy320 = yymsp[-2].minor.yy320; } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 308: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 495: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==495); - case 513: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==513); -{ yymsp[-3].minor.yy600 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy600); } + case 313: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 500: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==500); + case 518: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==518); +{ yymsp[-3].minor.yy320 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy320); } break; - case 309: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 314: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 310: /* cmd ::= KILL QUERY NK_STRING */ + case 315: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 311: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 316: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 312: /* cmd ::= BALANCE VGROUP */ + case 317: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 313: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 318: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 314: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy601); } + case 319: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy570); } break; - case 315: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 320: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 316: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy601 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 321: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy570 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 318: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } + case 323: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy320, yymsp[0].minor.yy320); } break; - case 320: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy600, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); } + case 325: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy320, yymsp[-2].minor.yy570, yymsp[0].minor.yy320); } break; - case 321: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } + case 326: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy320, NULL, yymsp[0].minor.yy320); } break; - case 322: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 327: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 323: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 328: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 324: /* literal ::= NK_STRING */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 329: /* literal ::= NK_STRING */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 325: /* literal ::= NK_BOOL */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 330: /* literal ::= NK_BOOL */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 326: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + case 331: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 327: /* literal ::= duration_literal */ - case 337: /* signed_literal ::= signed */ yytestcase(yyruleno==337); - case 357: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==357); - case 358: /* expression ::= literal */ yytestcase(yyruleno==358); - case 359: /* expression ::= pseudo_column */ yytestcase(yyruleno==359); - case 360: /* expression ::= column_reference */ yytestcase(yyruleno==360); - case 361: /* expression ::= function_expression */ yytestcase(yyruleno==361); - case 362: /* expression ::= case_when_expression */ yytestcase(yyruleno==362); - case 393: /* function_expression ::= literal_func */ yytestcase(yyruleno==393); - case 442: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==442); - case 446: /* boolean_primary ::= predicate */ yytestcase(yyruleno==446); - case 448: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==448); - case 449: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==449); - case 452: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==452); - case 454: /* table_reference ::= table_primary */ yytestcase(yyruleno==454); - case 455: /* table_reference ::= joined_table */ yytestcase(yyruleno==455); - case 459: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==459); - case 515: /* query_simple ::= query_specification */ yytestcase(yyruleno==515); - case 516: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==516); - case 519: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==519); - case 521: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==521); -{ yylhsminor.yy600 = yymsp[0].minor.yy600; } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 332: /* literal ::= duration_literal */ + case 342: /* signed_literal ::= signed */ yytestcase(yyruleno==342); + case 362: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==362); + case 363: /* expression ::= literal */ yytestcase(yyruleno==363); + case 364: /* expression ::= pseudo_column */ yytestcase(yyruleno==364); + case 365: /* expression ::= column_reference */ yytestcase(yyruleno==365); + case 366: /* expression ::= function_expression */ yytestcase(yyruleno==366); + case 367: /* expression ::= case_when_expression */ yytestcase(yyruleno==367); + case 398: /* function_expression ::= literal_func */ yytestcase(yyruleno==398); + case 447: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==447); + case 451: /* boolean_primary ::= predicate */ yytestcase(yyruleno==451); + case 453: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==453); + case 454: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==454); + case 457: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==457); + case 459: /* table_reference ::= table_primary */ yytestcase(yyruleno==459); + case 460: /* table_reference ::= joined_table */ yytestcase(yyruleno==460); + case 464: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==464); + case 520: /* query_simple ::= query_specification */ yytestcase(yyruleno==520); + case 521: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==521); + case 524: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==524); + case 526: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==526); +{ yylhsminor.yy320 = yymsp[0].minor.yy320; } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 328: /* literal ::= NULL */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 333: /* literal ::= NULL */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 329: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 334: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 330: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 335: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 331: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 336: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 332: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 337: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 333: /* signed ::= NK_MINUS NK_INTEGER */ + case 338: /* 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.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 334: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 339: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 335: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 340: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 336: /* signed ::= NK_MINUS NK_FLOAT */ + case 341: /* 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.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 338: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 343: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 339: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 344: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 340: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 345: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 341: /* signed_literal ::= duration_literal */ - case 343: /* signed_literal ::= literal_func */ yytestcase(yyruleno==343); - case 413: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==413); - case 475: /* select_item ::= common_expression */ yytestcase(yyruleno==475); - case 485: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==485); - case 520: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==520); - case 522: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==522); - case 535: /* search_condition ::= common_expression */ yytestcase(yyruleno==535); -{ yylhsminor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 346: /* signed_literal ::= duration_literal */ + case 348: /* signed_literal ::= literal_func */ yytestcase(yyruleno==348); + case 418: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==418); + case 480: /* select_item ::= common_expression */ yytestcase(yyruleno==480); + case 490: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==490); + case 525: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==525); + case 527: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==527); + case 540: /* search_condition ::= common_expression */ yytestcase(yyruleno==540); +{ yylhsminor.yy320 = releaseRawExprNode(pCxt, yymsp[0].minor.yy320); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 342: /* signed_literal ::= NULL */ -{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 347: /* signed_literal ::= NULL */ +{ yylhsminor.yy320 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 344: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy600 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 349: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy320 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 363: /* expression ::= NK_LP expression NK_RP */ - case 447: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==447); - case 534: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==534); -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 368: /* expression ::= NK_LP expression NK_RP */ + case 452: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==452); + case 539: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==539); +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy320)); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 364: /* expression ::= NK_PLUS expr_or_subquery */ + case 369: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy320)); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 365: /* expression ::= NK_MINUS expr_or_subquery */ + case 370: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy320), NULL)); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 366: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 371: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 367: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 372: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 368: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 373: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 369: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 374: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 370: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 375: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 371: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 376: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 372: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 377: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 373: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 378: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 376: /* column_reference ::= column_name */ -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy77, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy77)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 381: /* column_reference ::= column_name */ +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy815, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy815)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 377: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77, createColumnNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77)); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 382: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy815, createColumnNode(pCxt, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy815)); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 378: /* pseudo_column ::= ROWTS */ - case 379: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==379); - case 381: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==381); - case 382: /* pseudo_column ::= QEND */ yytestcase(yyruleno==382); - case 383: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==383); - case 384: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==384); - case 385: /* pseudo_column ::= WEND */ yytestcase(yyruleno==385); - case 386: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==386); - case 387: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==387); - case 388: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==388); - case 389: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==389); - case 395: /* literal_func ::= NOW */ yytestcase(yyruleno==395); -{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 383: /* pseudo_column ::= ROWTS */ + case 384: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==384); + case 386: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==386); + case 387: /* pseudo_column ::= QEND */ yytestcase(yyruleno==387); + case 388: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==388); + case 389: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==389); + case 390: /* pseudo_column ::= WEND */ yytestcase(yyruleno==390); + case 391: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==391); + case 392: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==392); + case 393: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==393); + case 394: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==394); + case 400: /* literal_func ::= NOW */ yytestcase(yyruleno==400); +{ yylhsminor.yy320 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 380: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy77)))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 385: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy815)))); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 390: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 391: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==391); -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-1].minor.yy601)); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + case 395: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 396: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==396); +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy815, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy815, yymsp[-1].minor.yy570)); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 392: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy888)); } - yymsp[-5].minor.yy600 = yylhsminor.yy600; + case 397: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), yymsp[-1].minor.yy200)); } + yymsp[-5].minor.yy320 = yylhsminor.yy320; break; - case 394: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy77, NULL)); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 399: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy815, NULL)); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 409: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy601 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy601 = yylhsminor.yy601; + case 414: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy570 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy570 = yylhsminor.yy570; break; - case 414: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 478: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==478); -{ yylhsminor.yy600 = createColumnNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 419: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 483: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==483); +{ yylhsminor.yy320 = createColumnNode(pCxt, &yymsp[-2].minor.yy815, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 415: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy601, yymsp[-1].minor.yy600)); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + case 420: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy570, yymsp[-1].minor.yy320)); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 416: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-2].minor.yy601, yymsp[-1].minor.yy600)); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; + case 421: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), yymsp[-2].minor.yy570, yymsp[-1].minor.yy320)); } + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; - case 419: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy600 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } + case 424: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy320 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320)); } break; - case 421: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } + case 426: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy320 = releaseRawExprNode(pCxt, yymsp[0].minor.yy320); } break; - case 422: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 427: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==427); + case 427: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 432: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==432); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy666, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy828, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 423: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 428: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy320), releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-4].minor.yy600 = yylhsminor.yy600; + yymsp[-4].minor.yy320 = yylhsminor.yy320; break; - case 424: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 429: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy320), releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-5].minor.yy600 = yylhsminor.yy600; + yymsp[-5].minor.yy320 = yylhsminor.yy320; break; - case 425: /* predicate ::= expr_or_subquery IS NULL */ + case 430: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), NULL)); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 426: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 431: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), NULL)); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 428: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy666 = OP_TYPE_LOWER_THAN; } + case 433: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy828 = OP_TYPE_LOWER_THAN; } break; - case 429: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy666 = OP_TYPE_GREATER_THAN; } + case 434: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy828 = OP_TYPE_GREATER_THAN; } break; - case 430: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy666 = OP_TYPE_LOWER_EQUAL; } + case 435: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy828 = OP_TYPE_LOWER_EQUAL; } break; - case 431: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy666 = OP_TYPE_GREATER_EQUAL; } + case 436: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy828 = OP_TYPE_GREATER_EQUAL; } break; - case 432: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy666 = OP_TYPE_NOT_EQUAL; } + case 437: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy828 = OP_TYPE_NOT_EQUAL; } break; - case 433: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy666 = OP_TYPE_EQUAL; } + case 438: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy828 = OP_TYPE_EQUAL; } break; - case 434: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy666 = OP_TYPE_LIKE; } + case 439: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy828 = OP_TYPE_LIKE; } break; - case 435: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy666 = OP_TYPE_NOT_LIKE; } + case 440: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy828 = OP_TYPE_NOT_LIKE; } break; - case 436: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy666 = OP_TYPE_MATCH; } + case 441: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy828 = OP_TYPE_MATCH; } break; - case 437: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy666 = OP_TYPE_NMATCH; } + case 442: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy828 = OP_TYPE_NMATCH; } break; - case 438: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy666 = OP_TYPE_JSON_CONTAINS; } + case 443: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy828 = OP_TYPE_JSON_CONTAINS; } break; - case 439: /* in_op ::= IN */ -{ yymsp[0].minor.yy666 = OP_TYPE_IN; } + case 444: /* in_op ::= IN */ +{ yymsp[0].minor.yy828 = OP_TYPE_IN; } break; - case 440: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy666 = OP_TYPE_NOT_IN; } + case 445: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy828 = OP_TYPE_NOT_IN; } break; - case 441: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy601)); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 446: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy570)); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 443: /* boolean_value_expression ::= NOT boolean_primary */ + case 448: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy320), NULL)); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 444: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 449: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 445: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 450: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); - yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy320); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy320); + yylhsminor.yy320 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 451: /* from_clause_opt ::= FROM table_reference_list */ - case 480: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==480); - case 509: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==509); -{ yymsp[-1].minor.yy600 = yymsp[0].minor.yy600; } + case 456: /* from_clause_opt ::= FROM table_reference_list */ + case 485: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==485); + case 514: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==514); +{ yymsp[-1].minor.yy320 = yymsp[0].minor.yy320; } break; - case 453: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy600 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, NULL); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 458: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy320 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy320, yymsp[0].minor.yy320, NULL); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 456: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + case 461: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy320 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy815, &yymsp[0].minor.yy815); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 457: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-3].minor.yy77, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + case 462: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy320 = createRealTableNode(pCxt, &yymsp[-3].minor.yy815, &yymsp[-1].minor.yy815, &yymsp[0].minor.yy815); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 458: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy600 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy77); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + case 463: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy320 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy320), &yymsp[0].minor.yy815); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 460: /* alias_opt ::= */ -{ yymsp[1].minor.yy77 = nil_token; } + case 465: /* alias_opt ::= */ +{ yymsp[1].minor.yy815 = nil_token; } break; - case 462: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy77 = yymsp[0].minor.yy77; } + case 467: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy815 = yymsp[0].minor.yy815; } break; - case 463: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 464: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==464); -{ yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600; } + case 468: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 469: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==469); +{ yymsp[-2].minor.yy320 = yymsp[-1].minor.yy320; } break; - case 465: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy600 = createJoinTableNode(pCxt, yymsp[-4].minor.yy560, yymsp[-5].minor.yy600, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } - yymsp[-5].minor.yy600 = yylhsminor.yy600; + case 470: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy320 = createJoinTableNode(pCxt, yymsp[-4].minor.yy334, yymsp[-5].minor.yy320, yymsp[-2].minor.yy320, yymsp[0].minor.yy320); } + yymsp[-5].minor.yy320 = yylhsminor.yy320; break; - case 466: /* join_type ::= */ -{ yymsp[1].minor.yy560 = JOIN_TYPE_INNER; } + case 471: /* join_type ::= */ +{ yymsp[1].minor.yy334 = JOIN_TYPE_INNER; } break; - case 467: /* join_type ::= INNER */ -{ yymsp[0].minor.yy560 = JOIN_TYPE_INNER; } + case 472: /* join_type ::= INNER */ +{ yymsp[0].minor.yy334 = JOIN_TYPE_INNER; } break; - case 468: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 473: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy600 = createSelectStmt(pCxt, yymsp[-10].minor.yy841, yymsp[-9].minor.yy601, yymsp[-8].minor.yy600); - yymsp[-11].minor.yy600 = addWhereClause(pCxt, yymsp[-11].minor.yy600, yymsp[-7].minor.yy600); - yymsp[-11].minor.yy600 = addPartitionByClause(pCxt, yymsp[-11].minor.yy600, yymsp[-6].minor.yy601); - yymsp[-11].minor.yy600 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy600, yymsp[-2].minor.yy600); - yymsp[-11].minor.yy600 = addGroupByClause(pCxt, yymsp[-11].minor.yy600, yymsp[-1].minor.yy601); - yymsp[-11].minor.yy600 = addHavingClause(pCxt, yymsp[-11].minor.yy600, yymsp[0].minor.yy600); - yymsp[-11].minor.yy600 = addRangeClause(pCxt, yymsp[-11].minor.yy600, yymsp[-5].minor.yy600); - yymsp[-11].minor.yy600 = addEveryClause(pCxt, yymsp[-11].minor.yy600, yymsp[-4].minor.yy600); - yymsp[-11].minor.yy600 = addFillClause(pCxt, yymsp[-11].minor.yy600, yymsp[-3].minor.yy600); + yymsp[-11].minor.yy320 = createSelectStmt(pCxt, yymsp[-10].minor.yy63, yymsp[-9].minor.yy570, yymsp[-8].minor.yy320); + yymsp[-11].minor.yy320 = addWhereClause(pCxt, yymsp[-11].minor.yy320, yymsp[-7].minor.yy320); + yymsp[-11].minor.yy320 = addPartitionByClause(pCxt, yymsp[-11].minor.yy320, yymsp[-6].minor.yy570); + yymsp[-11].minor.yy320 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy320, yymsp[-2].minor.yy320); + yymsp[-11].minor.yy320 = addGroupByClause(pCxt, yymsp[-11].minor.yy320, yymsp[-1].minor.yy570); + yymsp[-11].minor.yy320 = addHavingClause(pCxt, yymsp[-11].minor.yy320, yymsp[0].minor.yy320); + yymsp[-11].minor.yy320 = addRangeClause(pCxt, yymsp[-11].minor.yy320, yymsp[-5].minor.yy320); + yymsp[-11].minor.yy320 = addEveryClause(pCxt, yymsp[-11].minor.yy320, yymsp[-4].minor.yy320); + yymsp[-11].minor.yy320 = addFillClause(pCxt, yymsp[-11].minor.yy320, yymsp[-3].minor.yy320); } break; - case 471: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy841 = false; } + case 476: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy63 = false; } break; - case 474: /* select_item ::= NK_STAR */ -{ yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy600 = yylhsminor.yy600; + case 479: /* select_item ::= NK_STAR */ +{ yylhsminor.yy320 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy320 = yylhsminor.yy320; break; - case 476: /* select_item ::= common_expression column_alias */ - case 486: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==486); -{ yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy77); } - yymsp[-1].minor.yy600 = yylhsminor.yy600; + case 481: /* select_item ::= common_expression column_alias */ + case 491: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==491); +{ yylhsminor.yy320 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy320), &yymsp[0].minor.yy815); } + yymsp[-1].minor.yy320 = yylhsminor.yy320; break; - case 477: /* select_item ::= common_expression AS column_alias */ - case 487: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==487); -{ yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), &yymsp[0].minor.yy77); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 482: /* select_item ::= common_expression AS column_alias */ + case 492: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==492); +{ yylhsminor.yy320 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), &yymsp[0].minor.yy815); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 482: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 505: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==505); - case 524: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==524); -{ yymsp[-2].minor.yy601 = yymsp[0].minor.yy601; } + case 487: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 510: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==510); + case 529: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==529); +{ yymsp[-2].minor.yy570 = yymsp[0].minor.yy570; } break; - case 489: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy600 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } + case 494: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy320 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), releaseRawExprNode(pCxt, yymsp[-1].minor.yy320)); } break; - case 490: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy600 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } + case 495: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy320 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy320)); } break; - case 491: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } + case 496: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy320 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), NULL, yymsp[-1].minor.yy320, yymsp[0].minor.yy320); } break; - case 492: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } + case 497: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy320 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy320), releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), yymsp[-1].minor.yy320, yymsp[0].minor.yy320); } break; - case 493: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy600 = createEventWindowNode(pCxt, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } + case 498: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy320 = createEventWindowNode(pCxt, yymsp[-3].minor.yy320, yymsp[0].minor.yy320); } break; - case 497: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy600 = createFillNode(pCxt, yymsp[-1].minor.yy798, NULL); } + case 502: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy320 = createFillNode(pCxt, yymsp[-1].minor.yy762, NULL); } break; - case 498: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy601)); } + case 503: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy320 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy570)); } break; - case 499: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy798 = FILL_MODE_NONE; } + case 504: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy762 = FILL_MODE_NONE; } break; - case 500: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy798 = FILL_MODE_PREV; } + case 505: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy762 = FILL_MODE_PREV; } break; - case 501: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy798 = FILL_MODE_NULL; } + case 506: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy762 = FILL_MODE_NULL; } break; - case 502: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy798 = FILL_MODE_LINEAR; } + case 507: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy762 = FILL_MODE_LINEAR; } break; - case 503: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy798 = FILL_MODE_NEXT; } + case 508: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy762 = FILL_MODE_NEXT; } break; - case 506: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy601 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } - yymsp[0].minor.yy601 = yylhsminor.yy601; + case 511: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy570 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } + yymsp[0].minor.yy570 = yylhsminor.yy570; break; - case 507: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } - yymsp[-2].minor.yy601 = yylhsminor.yy601; + case 512: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy570 = addNodeToList(pCxt, yymsp[-2].minor.yy570, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy320))); } + yymsp[-2].minor.yy570 = yylhsminor.yy570; break; - case 511: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy600 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } + case 516: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy320 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy320), releaseRawExprNode(pCxt, yymsp[-1].minor.yy320)); } break; - case 514: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 519: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy600 = addOrderByClause(pCxt, yymsp[-3].minor.yy600, yymsp[-2].minor.yy601); - yylhsminor.yy600 = addSlimitClause(pCxt, yylhsminor.yy600, yymsp[-1].minor.yy600); - yylhsminor.yy600 = addLimitClause(pCxt, yylhsminor.yy600, yymsp[0].minor.yy600); + yylhsminor.yy320 = addOrderByClause(pCxt, yymsp[-3].minor.yy320, yymsp[-2].minor.yy570); + yylhsminor.yy320 = addSlimitClause(pCxt, yylhsminor.yy320, yymsp[-1].minor.yy320); + yylhsminor.yy320 = addLimitClause(pCxt, yylhsminor.yy320, yymsp[0].minor.yy320); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 517: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } - yymsp[-3].minor.yy600 = yylhsminor.yy600; + case 522: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy320 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy320, yymsp[0].minor.yy320); } + yymsp[-3].minor.yy320 = yylhsminor.yy320; break; - case 518: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 523: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy320 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy320, yymsp[0].minor.yy320); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 526: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 530: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==530); -{ yymsp[-1].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 531: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 535: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==535); +{ yymsp[-1].minor.yy320 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 527: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 531: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==531); -{ yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 532: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 536: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==536); +{ yymsp[-3].minor.yy320 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 528: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 532: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==532); -{ yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 533: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 537: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==537); +{ yymsp[-3].minor.yy320 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 533: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy600); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 538: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy320 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy320); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 538: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy600 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), yymsp[-1].minor.yy32, yymsp[0].minor.yy385); } - yymsp[-2].minor.yy600 = yylhsminor.yy600; + case 543: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy320 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy320), yymsp[-1].minor.yy162, yymsp[0].minor.yy715); } + yymsp[-2].minor.yy320 = yylhsminor.yy320; break; - case 539: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy32 = ORDER_ASC; } + case 544: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy162 = ORDER_ASC; } break; - case 540: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy32 = ORDER_ASC; } + case 545: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy162 = ORDER_ASC; } break; - case 541: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy32 = ORDER_DESC; } + case 546: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy162 = ORDER_DESC; } break; - case 542: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy385 = NULL_ORDER_DEFAULT; } + case 547: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy715 = NULL_ORDER_DEFAULT; } break; - case 543: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy385 = NULL_ORDER_FIRST; } + case 548: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy715 = NULL_ORDER_FIRST; } break; - case 544: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy385 = NULL_ORDER_LAST; } + case 549: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy715 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 9cc55a7cd5..ac801149f5 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -427,7 +427,7 @@ class MockCatalogServiceImpl { int32_t copyTableSchemaMeta(const string& db, const string& tbname, std::unique_ptr* dst) const { STableMeta* src = getTableSchemaMeta(db, tbname); if (nullptr == src) { - return TSDB_CODE_TSC_INVALID_TABLE_NAME; + return TSDB_CODE_PAR_TABLE_NOT_EXIST; } int32_t len = sizeof(STableMeta) + sizeof(SSchema) * (src->tableInfo.numOfTags + src->tableInfo.numOfColumns); dst->reset((STableMeta*)taosMemoryCalloc(1, len)); diff --git a/source/libs/parser/test/parAlterToBalanceTest.cpp b/source/libs/parser/test/parAlterToBalanceTest.cpp index 51a7bbb0a5..a0de93782d 100644 --- a/source/libs/parser/test/parAlterToBalanceTest.cpp +++ b/source/libs/parser/test/parAlterToBalanceTest.cpp @@ -21,6 +21,25 @@ namespace ParserTest { class ParserInitialATest : public ParserDdlTest {}; +/* + * ALTER ACCOUNT account_name alter_account_options + * + * alter_account_options: + * alter_account_option ... + * + * alter_account_option: { + * PASS value + * | PPS value + * | TSERIES value + * | STORAGE value + * | STREAMS value + * | QTIME value + * | DBS value + * | USERS value + * | CONNS value + * | STATE value + * } + */ TEST_F(ParserInitialATest, alterAccount) { useDb("root", "test"); @@ -48,6 +67,7 @@ TEST_F(ParserInitialATest, alterDnode) { setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DNODE_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_CONFIG_DNODE); SMCfgDnodeReq req = {0}; ASSERT_EQ(tDeserializeSMCfgDnodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(req.dnodeId, expect.dnodeId); @@ -86,9 +106,8 @@ TEST_F(ParserInitialATest, alterDnode) { * | KEEP {int_value | duration_value} -- rang [1, 365000], default 3650, unit day * | PAGES int_value -- rang [64, INT32_MAX], default 256, unit page * | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica - * | STRICT {'off' | 'on'} -- todo: default 'off' * | WAL_LEVEL int_value -- enum 1, 2, default 1 - * | SST_TRIGGER int_value -- rang [1, 16], default 8 + * | STT_TRIGGER int_value -- rang [1, 16], default 8 * } */ TEST_F(ParserInitialATest, alterDatabase) { @@ -130,10 +149,11 @@ TEST_F(ParserInitialATest, alterDatabase) { auto setAlterDbStrict = [&](int8_t strict) { expect.strict = strict; }; auto setAlterDbCacheModel = [&](int8_t cacheModel) { expect.cacheLast = cacheModel; }; auto setAlterDbReplica = [&](int8_t replications) { expect.replications = replications; }; - auto setAlterDbSstTrigger = [&](int8_t sstTrigger) { expect.sstTrigger = sstTrigger; }; + auto setAlterDbSttTrigger = [&](int8_t sstTrigger) { expect.sstTrigger = sstTrigger; }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DATABASE_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_ALTER_DB); SAlterDbReq req = {0}; ASSERT_EQ(tDeserializeSAlterDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(std::string(req.db), std::string(expect.db)); @@ -161,11 +181,12 @@ TEST_F(ParserInitialATest, alterDatabase) { setAlterDbFsync(200); setAlterDbWal(1); setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW); - setAlterDbSstTrigger(16); + setAlterDbSttTrigger(16); setAlterDbBuffer(16); setAlterDbPages(128); + setAlterDbReplica(3); run("ALTER DATABASE test BUFFER 16 CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 PAGES 128 " - "WAL_LEVEL 1 STT_TRIGGER 16"); + "REPLICA 3 WAL_LEVEL 1 STT_TRIGGER 16"); clearAlterDbReq(); initAlterDb("test"); @@ -240,6 +261,22 @@ TEST_F(ParserInitialATest, alterDatabase) { setAlterDbWal(2); run("ALTER DATABASE test WAL_LEVEL 2"); clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbReplica(1); + run("ALTER DATABASE test REPLICA 1"); + setAlterDbReplica(3); + run("ALTER DATABASE test REPLICA 3"); + clearAlterDbReq(); + + initAlterDb("test"); + setAlterDbSttTrigger(1); + run("ALTER DATABASE test STT_TRIGGER 1"); + setAlterDbSttTrigger(4); + run("ALTER DATABASE test STT_TRIGGER 4"); + setAlterDbSttTrigger(16); + run("ALTER DATABASE test STT_TRIGGER 16"); + clearAlterDbReq(); } TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { @@ -260,6 +297,7 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { run("ALTER DATABASE test PAGES 63", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test WAL_LEVEL 3", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test REPLICA 2", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test STT_TRIGGER 0", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test STT_TRIGGER 17", TSDB_CODE_PAR_INVALID_DB_OPTION); // Regardless of the specific sentence @@ -267,7 +305,7 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { } /* - * ALTER LOCAL dnode_id 'config' ['value'] + * ALTER LOCAL 'config' ['value'] */ TEST_F(ParserInitialATest, alterLocal) { useDb("root", "test"); @@ -311,19 +349,19 @@ TEST_F(ParserInitialATest, alterLocal) { * | ADD COLUMN col_name column_type * | DROP COLUMN col_name * | MODIFY COLUMN col_name column_type - * | RENAME COLUMN old_col_name new_col_name -- normal table - * | ADD TAG tag_name tag_type -- super table - * | DROP TAG tag_name -- super table - * | MODIFY TAG tag_name tag_type -- super table - * | RENAME TAG old_tag_name new_tag_name -- super table - * | SET TAG tag_name = new_tag_value -- child table + * | RENAME COLUMN old_col_name new_col_name -- only normal table + * | ADD TAG tag_name tag_type -- only super table + * | DROP TAG tag_name -- only super table + * | MODIFY TAG tag_name tag_type -- only super table + * | RENAME TAG old_tag_name new_tag_name -- only super table + * | SET TAG tag_name = new_tag_value -- only child table * } * * alter_table_options: * alter_table_option ... * * alter_table_option: { - * TTL int_value -- child/normal table + * TTL int_value -- only child/normal table * | COMMENT 'string_value' * } */ @@ -379,6 +417,7 @@ TEST_F(ParserInitialATest, alterSTable) { setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_SUPER_TABLE_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_ALTER_STB); SMAlterStbReq req = {0}; ASSERT_EQ(tDeserializeSMAlterStbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(std::string(req.name), std::string(expect.name)); @@ -444,136 +483,255 @@ TEST_F(ParserInitialATest, alterSTableSemanticCheck) { run("ALTER STABLE st1 TTL 10", TSDB_CODE_PAR_INVALID_ALTER_TABLE); } +/* + * ALTER TABLE [db_name.]tb_name alter_table_clause + * + * alter_table_clause: { + * alter_table_options + * | ADD COLUMN col_name column_type + * | DROP COLUMN col_name + * | MODIFY COLUMN col_name column_type + * | RENAME COLUMN old_col_name new_col_name -- only normal table + * | ADD TAG tag_name tag_type -- only super table + * | DROP TAG tag_name -- only super table + * | MODIFY TAG tag_name tag_type -- only super table + * | RENAME TAG old_tag_name new_tag_name -- only super table + * | SET TAG tag_name = new_tag_value -- only child table + * } + * + * alter_table_options: + * alter_table_option ... + * + * alter_table_option: { + * TTL int_value -- only child/normal table + * | COMMENT 'string_value' + * } + */ TEST_F(ParserInitialATest, alterTable) { useDb("root", "test"); - SVAlterTbReq expect = {0}; + // normal/child table + { + SVAlterTbReq expect = {0}; - auto clearAlterTbReq = [&]() { - free(expect.tbName); - free(expect.colName); - free(expect.colNewName); - free(expect.tagName); - memset(&expect, 0, sizeof(SVAlterTbReq)); - }; + auto clearAlterTbReq = [&]() { + free(expect.tbName); + free(expect.colName); + free(expect.colNewName); + free(expect.tagName); + memset(&expect, 0, sizeof(SVAlterTbReq)); + }; - auto setAlterTableCol = [&](const char* pTbname, int8_t alterType, const char* pColName, int8_t dataType = 0, - int32_t dataBytes = 0, const char* pNewColName = nullptr) { - expect.tbName = strdup(pTbname); - expect.action = alterType; - expect.colName = strdup(pColName); + auto setAlterTableCol = [&](const char* pTbname, int8_t alterType, const char* pColName, int8_t dataType = 0, + int32_t dataBytes = 0, const char* pNewColName = nullptr) { + expect.tbName = strdup(pTbname); + expect.action = alterType; + expect.colName = strdup(pColName); - switch (alterType) { - case TSDB_ALTER_TABLE_ADD_COLUMN: - expect.type = dataType; - expect.flags = COL_SMA_ON; - expect.bytes = dataBytes > 0 ? dataBytes : (dataType > 0 ? tDataTypes[dataType].bytes : 0); - break; - case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: - expect.colModBytes = dataBytes; - break; - case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME: - expect.colNewName = strdup(pNewColName); - break; - default: - break; - } - }; + switch (alterType) { + case TSDB_ALTER_TABLE_ADD_COLUMN: + expect.type = dataType; + expect.flags = COL_SMA_ON; + expect.bytes = dataBytes > 0 ? dataBytes : (dataType > 0 ? tDataTypes[dataType].bytes : 0); + break; + case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES: + expect.colModBytes = dataBytes; + break; + case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME: + expect.colNewName = strdup(pNewColName); + break; + default: + break; + } + }; - auto setAlterTableTag = [&](const char* pTbname, const char* pTagName, uint8_t* pNewVal, uint32_t bytes) { - expect.tbName = strdup(pTbname); - expect.action = TSDB_ALTER_TABLE_UPDATE_TAG_VAL; - expect.tagName = strdup(pTagName); + auto setAlterTableTag = [&](const char* pTbname, const char* pTagName, uint8_t* pNewVal, uint32_t bytes) { + expect.tbName = strdup(pTbname); + expect.action = TSDB_ALTER_TABLE_UPDATE_TAG_VAL; + expect.tagName = strdup(pTagName); - expect.isNull = (nullptr == pNewVal); - expect.nTagVal = bytes; - expect.pTagVal = pNewVal; - }; + expect.isNull = (nullptr == pNewVal); + expect.nTagVal = bytes; + expect.pTagVal = pNewVal; + }; - auto setAlterTableOptions = [&](const char* pTbname, int32_t ttl, char* pComment = nullptr) { - expect.tbName = strdup(pTbname); - expect.action = TSDB_ALTER_TABLE_UPDATE_OPTIONS; - if (-1 != ttl) { - expect.updateTTL = true; - expect.newTTL = ttl; - } - if (nullptr != pComment) { - expect.newCommentLen = strlen(pComment); - expect.newComment = pComment; - } - }; + auto setAlterTableOptions = [&](const char* pTbname, int32_t ttl, char* pComment = nullptr) { + expect.tbName = strdup(pTbname); + expect.action = TSDB_ALTER_TABLE_UPDATE_OPTIONS; + if (-1 != ttl) { + expect.updateTTL = true; + expect.newTTL = ttl; + } + if (nullptr != pComment) { + expect.newCommentLen = strlen(pComment); + expect.newComment = pComment; + } + }; - setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { - ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_VNODE_MODIFY_STMT); - SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_VNODE_MODIFY_STMT); + SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; - ASSERT_EQ(pStmt->sqlNodeType, QUERY_NODE_ALTER_TABLE_STMT); - ASSERT_NE(pStmt->pDataBlocks, nullptr); - ASSERT_EQ(taosArrayGetSize(pStmt->pDataBlocks), 1); - SVgDataBlocks* pVgData = (SVgDataBlocks*)taosArrayGetP(pStmt->pDataBlocks, 0); - void* pBuf = POINTER_SHIFT(pVgData->pData, sizeof(SMsgHead)); - SVAlterTbReq req = {0}; - SDecoder coder = {0}; - tDecoderInit(&coder, (uint8_t*)pBuf, pVgData->size); - ASSERT_EQ(tDecodeSVAlterTbReq(&coder, &req), TSDB_CODE_SUCCESS); + ASSERT_EQ(pStmt->sqlNodeType, QUERY_NODE_ALTER_TABLE_STMT); + ASSERT_NE(pStmt->pDataBlocks, nullptr); + ASSERT_EQ(taosArrayGetSize(pStmt->pDataBlocks), 1); + SVgDataBlocks* pVgData = (SVgDataBlocks*)taosArrayGetP(pStmt->pDataBlocks, 0); + void* pBuf = POINTER_SHIFT(pVgData->pData, sizeof(SMsgHead)); + SVAlterTbReq req = {0}; + SDecoder coder = {0}; + tDecoderInit(&coder, (uint8_t*)pBuf, pVgData->size); + ASSERT_EQ(tDecodeSVAlterTbReq(&coder, &req), TSDB_CODE_SUCCESS); - ASSERT_EQ(std::string(req.tbName), std::string(expect.tbName)); - ASSERT_EQ(req.action, expect.action); - if (nullptr != expect.colName) { - ASSERT_EQ(std::string(req.colName), std::string(expect.colName)); - } - ASSERT_EQ(req.type, expect.type); - ASSERT_EQ(req.flags, expect.flags); - ASSERT_EQ(req.bytes, expect.bytes); - ASSERT_EQ(req.colModBytes, expect.colModBytes); - if (nullptr != expect.colNewName) { - ASSERT_EQ(std::string(req.colNewName), std::string(expect.colNewName)); - } - if (nullptr != expect.tagName) { - ASSERT_EQ(std::string(req.tagName), std::string(expect.tagName)); - } - ASSERT_EQ(req.isNull, expect.isNull); - ASSERT_EQ(req.nTagVal, expect.nTagVal); - ASSERT_EQ(memcmp(req.pTagVal, expect.pTagVal, expect.nTagVal), 0); - ASSERT_EQ(req.updateTTL, expect.updateTTL); - ASSERT_EQ(req.newTTL, expect.newTTL); - if (nullptr != expect.newComment) { - ASSERT_EQ(std::string(req.newComment), std::string(expect.newComment)); - ASSERT_EQ(req.newCommentLen, strlen(req.newComment)); - ASSERT_EQ(expect.newCommentLen, strlen(expect.newComment)); - } + ASSERT_EQ(std::string(req.tbName), std::string(expect.tbName)); + ASSERT_EQ(req.action, expect.action); + if (nullptr != expect.colName) { + ASSERT_EQ(std::string(req.colName), std::string(expect.colName)); + } + ASSERT_EQ(req.type, expect.type); + ASSERT_EQ(req.flags, expect.flags); + ASSERT_EQ(req.bytes, expect.bytes); + ASSERT_EQ(req.colModBytes, expect.colModBytes); + if (nullptr != expect.colNewName) { + ASSERT_EQ(std::string(req.colNewName), std::string(expect.colNewName)); + } + if (nullptr != expect.tagName) { + ASSERT_EQ(std::string(req.tagName), std::string(expect.tagName)); + } + ASSERT_EQ(req.isNull, expect.isNull); + ASSERT_EQ(req.nTagVal, expect.nTagVal); + ASSERT_EQ(memcmp(req.pTagVal, expect.pTagVal, expect.nTagVal), 0); + ASSERT_EQ(req.updateTTL, expect.updateTTL); + ASSERT_EQ(req.newTTL, expect.newTTL); + if (nullptr != expect.newComment) { + ASSERT_EQ(std::string(req.newComment), std::string(expect.newComment)); + ASSERT_EQ(req.newCommentLen, strlen(req.newComment)); + ASSERT_EQ(expect.newCommentLen, strlen(expect.newComment)); + } - tDecoderClear(&coder); - }); + tDecoderClear(&coder); + }); - setAlterTableOptions("t1", 10, nullptr); - run("ALTER TABLE t1 TTL 10"); - clearAlterTbReq(); + setAlterTableOptions("t1", 10, nullptr); + run("ALTER TABLE t1 TTL 10"); + clearAlterTbReq(); - setAlterTableOptions("t1", -1, (char*)"test"); - run("ALTER TABLE t1 COMMENT 'test'"); - clearAlterTbReq(); + setAlterTableOptions("t1", -1, (char*)"test"); + run("ALTER TABLE t1 COMMENT 'test'"); + clearAlterTbReq(); - setAlterTableCol("t1", TSDB_ALTER_TABLE_ADD_COLUMN, "cc1", TSDB_DATA_TYPE_BIGINT); - run("ALTER TABLE t1 ADD COLUMN cc1 BIGINT"); - clearAlterTbReq(); + setAlterTableCol("t1", TSDB_ALTER_TABLE_ADD_COLUMN, "cc1", TSDB_DATA_TYPE_BIGINT); + run("ALTER TABLE t1 ADD COLUMN cc1 BIGINT"); + clearAlterTbReq(); - setAlterTableCol("t1", TSDB_ALTER_TABLE_DROP_COLUMN, "c1"); - run("ALTER TABLE t1 DROP COLUMN c1"); - clearAlterTbReq(); + setAlterTableCol("t1", TSDB_ALTER_TABLE_DROP_COLUMN, "c1"); + run("ALTER TABLE t1 DROP COLUMN c1"); + clearAlterTbReq(); - setAlterTableCol("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, "c2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); - run("ALTER TABLE t1 MODIFY COLUMN c2 VARCHAR(30)"); - clearAlterTbReq(); + setAlterTableCol("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, "c2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); + run("ALTER TABLE t1 MODIFY COLUMN c2 VARCHAR(30)"); + clearAlterTbReq(); - setAlterTableCol("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, "c1", 0, 0, "cc1"); - run("ALTER TABLE t1 RENAME COLUMN c1 cc1"); - clearAlterTbReq(); + setAlterTableCol("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, "c1", 0, 0, "cc1"); + run("ALTER TABLE t1 RENAME COLUMN c1 cc1"); + clearAlterTbReq(); - int32_t val = 10; - setAlterTableTag("st1s1", "tag1", (uint8_t*)&val, sizeof(val)); - run("ALTER TABLE st1s1 SET TAG tag1=10"); - clearAlterTbReq(); + int32_t val = 10; + setAlterTableTag("st1s1", "tag1", (uint8_t*)&val, sizeof(val)); + run("ALTER TABLE st1s1 SET TAG tag1=10"); + clearAlterTbReq(); + } + + // super table + { + SMAlterStbReq expect = {0}; + + auto clearAlterStbReq = [&]() { + tFreeSMAltertbReq(&expect); + memset(&expect, 0, sizeof(SMAlterStbReq)); + }; + + auto setAlterStbReq = [&](const char* pTbname, int8_t alterType, int32_t numOfFields = 0, + const char* pField1Name = nullptr, int8_t field1Type = 0, int32_t field1Bytes = 0, + const char* pField2Name = nullptr, const char* pComment = nullptr) { + int32_t len = snprintf(expect.name, sizeof(expect.name), "0.test.%s", pTbname); + expect.name[len] = '\0'; + expect.alterType = alterType; + if (nullptr != pComment) { + expect.comment = strdup(pComment); + expect.commentLen = strlen(pComment); + } + + expect.numOfFields = numOfFields; + if (NULL == expect.pFields) { + expect.pFields = taosArrayInit(2, sizeof(TAOS_FIELD)); + TAOS_FIELD field = {0}; + taosArrayPush(expect.pFields, &field); + taosArrayPush(expect.pFields, &field); + } + + TAOS_FIELD* pField = (TAOS_FIELD*)taosArrayGet(expect.pFields, 0); + if (NULL != pField1Name) { + strcpy(pField->name, pField1Name); + pField->name[strlen(pField1Name)] = '\0'; + } else { + memset(pField, 0, sizeof(TAOS_FIELD)); + } + pField->type = field1Type; + pField->bytes = field1Bytes > 0 ? field1Bytes : (field1Type > 0 ? tDataTypes[field1Type].bytes : 0); + + pField = (TAOS_FIELD*)taosArrayGet(expect.pFields, 1); + if (NULL != pField2Name) { + strcpy(pField->name, pField2Name); + pField->name[strlen(pField2Name)] = '\0'; + } else { + memset(pField, 0, sizeof(TAOS_FIELD)); + } + pField->type = 0; + pField->bytes = 0; + }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_TABLE_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_ALTER_STB); + SMAlterStbReq req = {0}; + ASSERT_EQ(tDeserializeSMAlterStbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); + ASSERT_EQ(std::string(req.name), std::string(expect.name)); + ASSERT_EQ(req.alterType, expect.alterType); + ASSERT_EQ(req.numOfFields, expect.numOfFields); + if (expect.numOfFields > 0) { + TAOS_FIELD* pField = (TAOS_FIELD*)taosArrayGet(req.pFields, 0); + TAOS_FIELD* pExpectField = (TAOS_FIELD*)taosArrayGet(expect.pFields, 0); + ASSERT_EQ(std::string(pField->name), std::string(pExpectField->name)); + ASSERT_EQ(pField->type, pExpectField->type); + ASSERT_EQ(pField->bytes, pExpectField->bytes); + } + if (expect.numOfFields > 1) { + TAOS_FIELD* pField = (TAOS_FIELD*)taosArrayGet(req.pFields, 1); + TAOS_FIELD* pExpectField = (TAOS_FIELD*)taosArrayGet(expect.pFields, 1); + ASSERT_EQ(std::string(pField->name), std::string(pExpectField->name)); + ASSERT_EQ(pField->type, pExpectField->type); + ASSERT_EQ(pField->bytes, pExpectField->bytes); + } + tFreeSMAltertbReq(&req); + }); + + setAlterStbReq("st1", TSDB_ALTER_TABLE_ADD_TAG, 1, "tag11", TSDB_DATA_TYPE_BIGINT); + run("ALTER TABLE st1 ADD TAG tag11 BIGINT"); + clearAlterStbReq(); + + setAlterStbReq("st1", TSDB_ALTER_TABLE_DROP_TAG, 1, "tag1"); + run("ALTER TABLE st1 DROP TAG tag1"); + clearAlterStbReq(); + + setAlterStbReq("st1", TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, 1, "tag2", TSDB_DATA_TYPE_VARCHAR, + 30 + VARSTR_HEADER_SIZE); + run("ALTER TABLE st1 MODIFY TAG tag2 VARCHAR(30)"); + clearAlterStbReq(); + + setAlterStbReq("st1", TSDB_ALTER_TABLE_UPDATE_TAG_NAME, 2, "tag1", 0, 0, "tag11"); + run("ALTER TABLE st1 RENAME TAG tag1 tag11"); + clearAlterStbReq(); + } } TEST_F(ParserInitialATest, alterTableSemanticCheck) { @@ -588,7 +746,7 @@ TEST_F(ParserInitialATest, alterTableSemanticCheck) { } /* - * ALTER USER user_name PASS str_value + * ALTER USER user_name alter_user_clause * * alter_user_clause: { * PASS str_value @@ -618,6 +776,7 @@ TEST_F(ParserInitialATest, alterUser) { setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_USER_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_ALTER_USER); SAlterUserReq req = {0}; ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSAlterUserReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); diff --git a/source/libs/parser/test/parExplainToSyncdbTest.cpp b/source/libs/parser/test/parExplainToSyncdbTest.cpp index f88d6d316b..f23685b305 100644 --- a/source/libs/parser/test/parExplainToSyncdbTest.cpp +++ b/source/libs/parser/test/parExplainToSyncdbTest.cpp @@ -52,8 +52,8 @@ TEST_F(ParserExplainToSyncdbTest, grant) { ASSERT_EQ(string(req.objname), string(expect.objname)); }); - setAlterUserReq(TSDB_ALTER_USER_ADD_ALL_DB, "wxy", "0.test"); - run("GRANT ALL ON test.* TO wxy"); + setAlterUserReq(TSDB_ALTER_USER_ADD_ALL_DB, "wxy", "0.*"); + run("GRANT ALL ON *.* TO wxy"); setAlterUserReq(TSDB_ALTER_USER_ADD_READ_DB, "wxy", "0.test"); run("GRANT READ ON test.* TO wxy"); @@ -138,10 +138,38 @@ TEST_F(ParserExplainToSyncdbTest, redistributeVgroup) { TEST_F(ParserExplainToSyncdbTest, revoke) { useDb("root", "test"); - run("REVOKE ALL ON test.* FROM wxy"); + SAlterUserReq expect = {0}; + + auto setAlterUserReq = [&](int8_t alterType, const string& user, const string& obj) { + expect.alterType = alterType; + snprintf(expect.user, sizeof(expect.user), "%s", user.c_str()); + snprintf(expect.objname, sizeof(expect.objname), "%s", obj.c_str()); + }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_REVOKE_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_ALTER_USER); + SAlterUserReq req = {0}; + ASSERT_EQ(tDeserializeSAlterUserReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); + ASSERT_EQ(req.alterType, expect.alterType); + ASSERT_EQ(string(req.user), string(expect.user)); + ASSERT_EQ(string(req.objname), string(expect.objname)); + }); + + setAlterUserReq(TSDB_ALTER_USER_REMOVE_ALL_DB, "wxy", "0.*"); + run("REVOKE ALL ON *.* FROM wxy"); + + setAlterUserReq(TSDB_ALTER_USER_REMOVE_READ_DB, "wxy", "0.test"); run("REVOKE READ ON test.* FROM wxy"); + + setAlterUserReq(TSDB_ALTER_USER_REMOVE_WRITE_DB, "wxy", "0.test"); run("REVOKE WRITE ON test.* FROM wxy"); + + setAlterUserReq(TSDB_ALTER_USER_REMOVE_ALL_DB, "wxy", "0.test"); run("REVOKE READ, WRITE ON test.* FROM wxy"); + + setAlterUserReq(TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC, "wxy", "0.tp1"); + run("REVOKE SUBSCRIBE ON tp1 FROM wxy"); } // todo syncdb diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 17d02c1cce..8286ae72e1 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -21,12 +21,35 @@ namespace ParserTest { class ParserInitialCTest : public ParserDdlTest {}; +/* + * CREATE ACCOUNT account_name PASS value [create_account_options] + * + * create_account_options: + * create_account_option ... + * + * create_account_option: { + * PPS value + * | TSERIES value + * | STORAGE value + * | STREAMS value + * | QTIME value + * | DBS value + * | USERS value + * | CONNS value + * | STATE value + * } + */ TEST_F(ParserInitialCTest, createAccount) { useDb("root", "test"); run("CREATE ACCOUNT ac_wxy PASS '123456'", TSDB_CODE_PAR_EXPRIE_STATEMENT, PARSER_STAGE_PARSE); } +/* + * CREATE BNODE ON DNODE dnode_id + * the server does not support it temporarily + */ + /* * CREATE DATABASE [IF NOT EXISTS] db_name [database_options] * @@ -68,7 +91,7 @@ TEST_F(ParserInitialCTest, createDatabase) { memset(&expect, 0, sizeof(SCreateDbReq)); }; - auto setCreateDbReqFunc = [&](const char* pDbname, int8_t igExists = 0) { + auto setCreateDbReq = [&](const char* pDbname, int8_t igExists = 0) { int32_t len = snprintf(expect.db, sizeof(expect.db), "0.%s", pDbname); expect.db[len] = '\0'; expect.ignoreExist = igExists; @@ -102,28 +125,28 @@ TEST_F(ParserInitialCTest, createDatabase) { expect.tsdbPageSize = TSDB_DEFAULT_TSDB_PAGESIZE; }; - auto setDbBufferFunc = [&](int32_t buffer) { expect.buffer = buffer; }; - auto setDbCachelastFunc = [&](int8_t cachelast) { expect.cacheLast = cachelast; }; + auto setDbBuffer = [&](int32_t buffer) { expect.buffer = buffer; }; + auto setDbCachelast = [&](int8_t cachelast) { expect.cacheLast = cachelast; }; auto setDbCachelastSize = [&](int8_t cachelastSize) { expect.cacheLastSize = cachelastSize; }; - auto setDbCompressionFunc = [&](int8_t compressionLevel) { expect.compression = compressionLevel; }; - auto setDbDaysFunc = [&](int32_t daysPerFile) { expect.daysPerFile = daysPerFile; }; - auto setDbFsyncFunc = [&](int32_t fsyncPeriod) { expect.walFsyncPeriod = fsyncPeriod; }; - auto setDbMaxRowsFunc = [&](int32_t maxRowsPerBlock) { expect.maxRows = maxRowsPerBlock; }; - auto setDbMinRowsFunc = [&](int32_t minRowsPerBlock) { expect.minRows = minRowsPerBlock; }; - auto setDbKeepFunc = [&](int32_t keep0, int32_t keep1 = 0, int32_t keep2 = 0) { + auto setDbCompression = [&](int8_t compressionLevel) { expect.compression = compressionLevel; }; + auto setDbDays = [&](int32_t daysPerFile) { expect.daysPerFile = daysPerFile; }; + auto setDbFsync = [&](int32_t fsyncPeriod) { expect.walFsyncPeriod = fsyncPeriod; }; + auto setDbMaxRows = [&](int32_t maxRowsPerBlock) { expect.maxRows = maxRowsPerBlock; }; + auto setDbMinRows = [&](int32_t minRowsPerBlock) { expect.minRows = minRowsPerBlock; }; + auto setDbKeep = [&](int32_t keep0, int32_t keep1 = 0, int32_t keep2 = 0) { expect.daysToKeep0 = keep0; expect.daysToKeep1 = 0 == keep1 ? expect.daysToKeep0 : keep1; expect.daysToKeep2 = 0 == keep2 ? expect.daysToKeep1 : keep2; }; - auto setDbPagesFunc = [&](int32_t pages) { expect.pages = pages; }; - auto setDbPageSizeFunc = [&](int32_t pagesize) { expect.pageSize = pagesize; }; - auto setDbPrecisionFunc = [&](int8_t precision) { expect.precision = precision; }; - auto setDbReplicaFunc = [&](int8_t replica) { expect.replications = replica; }; - auto setDbStrictaFunc = [&](int8_t strict) { expect.strict = strict; }; - auto setDbWalLevelFunc = [&](int8_t walLevel) { expect.walLevel = walLevel; }; - auto setDbVgroupsFunc = [&](int32_t numOfVgroups) { expect.numOfVgroups = numOfVgroups; }; - auto setDbSingleStableFunc = [&](int8_t singleStable) { expect.numOfStables = singleStable; }; - auto addDbRetentionFunc = [&](int64_t freq, int64_t keep, int8_t freqUnit, int8_t keepUnit) { + auto setDbPages = [&](int32_t pages) { expect.pages = pages; }; + auto setDbPageSize = [&](int32_t pagesize) { expect.pageSize = pagesize; }; + auto setDbPrecision = [&](int8_t precision) { expect.precision = precision; }; + auto setDbReplica = [&](int8_t replica) { expect.replications = replica; }; + auto setDbStricta = [&](int8_t strict) { expect.strict = strict; }; + auto setDbWalLevel = [&](int8_t walLevel) { expect.walLevel = walLevel; }; + auto setDbVgroups = [&](int32_t numOfVgroups) { expect.numOfVgroups = numOfVgroups; }; + auto setDbSingleStable = [&](int8_t singleStable) { expect.numOfStables = singleStable; }; + auto addDbRetention = [&](int64_t freq, int64_t keep, int8_t freqUnit, int8_t keepUnit) { SRetention retention = {0}; retention.freq = freq; retention.keep = keep; @@ -135,7 +158,7 @@ TEST_F(ParserInitialCTest, createDatabase) { taosArrayPush(expect.pRetensions, &retention); ++expect.numOfRetensions; }; - auto setDbSchemalessFunc = [&](int8_t schemaless) { expect.schemaless = schemaless; }; + auto setDbSchemaless = [&](int8_t schemaless) { expect.schemaless = schemaless; }; auto setDbWalRetentionPeriod = [&](int32_t walRetentionPeriod) { expect.walRetentionPeriod = walRetentionPeriod; }; auto setDbWalRetentionSize = [&](int32_t walRetentionSize) { expect.walRetentionSize = walRetentionSize; }; auto setDbWalRollPeriod = [&](int32_t walRollPeriod) { expect.walRollPeriod = walRollPeriod; }; @@ -147,6 +170,7 @@ TEST_F(ParserInitialCTest, createDatabase) { setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_DATABASE_STMT); + ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_CREATE_DB); SCreateDbReq req = {0}; ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSCreateDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); @@ -195,32 +219,32 @@ TEST_F(ParserInitialCTest, createDatabase) { tFreeSCreateDbReq(&req); }); - setCreateDbReqFunc("wxy_db"); + setCreateDbReq("wxy_db"); run("CREATE DATABASE wxy_db"); clearCreateDbReq(); - setCreateDbReqFunc("wxy_db", 1); - setDbBufferFunc(64); - setDbCachelastFunc(2); + setCreateDbReq("wxy_db", 1); + setDbBuffer(64); + setDbCachelast(2); setDbCachelastSize(20); - setDbCompressionFunc(1); - setDbDaysFunc(100 * 1440); - setDbFsyncFunc(100); - setDbMaxRowsFunc(1000); - setDbMinRowsFunc(100); - setDbKeepFunc(1440 * 1440); - setDbPagesFunc(96); - setDbPageSizeFunc(8); - setDbPrecisionFunc(TSDB_TIME_PRECISION_NANO); - setDbReplicaFunc(3); - addDbRetentionFunc(15 * MILLISECOND_PER_SECOND, 7 * MILLISECOND_PER_DAY, TIME_UNIT_SECOND, TIME_UNIT_DAY); - addDbRetentionFunc(1 * MILLISECOND_PER_MINUTE, 21 * MILLISECOND_PER_DAY, TIME_UNIT_MINUTE, TIME_UNIT_DAY); - addDbRetentionFunc(15 * MILLISECOND_PER_MINUTE, 500 * MILLISECOND_PER_DAY, TIME_UNIT_MINUTE, TIME_UNIT_DAY); - // setDbStrictaFunc(1); - setDbWalLevelFunc(2); - setDbVgroupsFunc(100); - setDbSingleStableFunc(1); - setDbSchemalessFunc(1); + setDbCompression(1); + setDbDays(100 * 1440); + setDbFsync(100); + setDbMaxRows(1000); + setDbMinRows(100); + setDbKeep(1440 * 1440); + setDbPages(96); + setDbPageSize(8); + setDbPrecision(TSDB_TIME_PRECISION_NANO); + setDbReplica(3); + addDbRetention(15 * MILLISECOND_PER_SECOND, 7 * MILLISECOND_PER_DAY, TIME_UNIT_SECOND, TIME_UNIT_DAY); + addDbRetention(1 * MILLISECOND_PER_MINUTE, 21 * MILLISECOND_PER_DAY, TIME_UNIT_MINUTE, TIME_UNIT_DAY); + addDbRetention(15 * MILLISECOND_PER_MINUTE, 500 * MILLISECOND_PER_DAY, TIME_UNIT_MINUTE, TIME_UNIT_DAY); + // setDbStricta(1); + setDbWalLevel(2); + setDbVgroups(100); + setDbSingleStable(1); + setDbSchemaless(1); setDbWalRetentionPeriod(-1); setDbWalRetentionSize(-1); setDbWalRollPeriod(10); @@ -259,16 +283,16 @@ TEST_F(ParserInitialCTest, createDatabase) { "TSDB_PAGESIZE 32"); clearCreateDbReq(); - setCreateDbReqFunc("wxy_db", 1); - setDbDaysFunc(100); - setDbKeepFunc(1440, 300 * 60, 400 * 1440); + setCreateDbReq("wxy_db", 1); + setDbDays(100); + setDbKeep(1440, 300 * 60, 400 * 1440); run("CREATE DATABASE IF NOT EXISTS wxy_db " "DURATION 100m " "KEEP 1440m,300h,400d "); clearCreateDbReq(); - setCreateDbReqFunc("wxy_db", 1); - setDbReplicaFunc(3); + setCreateDbReq("wxy_db", 1); + setDbReplica(3); setDbWalRetentionPeriod(TSDB_REPS_DEF_DB_WAL_RET_PERIOD); setDbWalRetentionSize(TSDB_REPS_DEF_DB_WAL_RET_SIZE); setDbWalRollPeriod(TSDB_REPS_DEF_DB_WAL_ROLL_PERIOD); @@ -287,6 +311,9 @@ TEST_F(ParserInitialCTest, createDatabaseSemanticCheck) { run("create database db2 retentions 15s:7d,5m:21d,10m:10d", TSDB_CODE_PAR_INVALID_DB_OPTION); } +/* + * CREATE DNODE {dnode_endpoint | dnode_host_name PORT port_val} + */ TEST_F(ParserInitialCTest, createDnode) { useDb("root", "test"); @@ -294,7 +321,7 @@ TEST_F(ParserInitialCTest, createDnode) { auto clearCreateDnodeReq = [&]() { memset(&expect, 0, sizeof(SCreateDnodeReq)); }; - auto setCreateDnodeReqFunc = [&](const char* pFqdn, int32_t port = tsServerPort) { + auto setCreateDnodeReq = [&](const char* pFqdn, int32_t port = tsServerPort) { strcpy(expect.fqdn, pFqdn); expect.port = port; }; @@ -308,39 +335,41 @@ TEST_F(ParserInitialCTest, createDnode) { ASSERT_EQ(req.port, expect.port); }); - setCreateDnodeReqFunc("abc1", 7030); + setCreateDnodeReq("abc1", 7030); run("CREATE DNODE 'abc1' PORT 7030"); clearCreateDnodeReq(); - setCreateDnodeReqFunc("1.1.1.1", 8030); + setCreateDnodeReq("1.1.1.1", 8030); run("CREATE DNODE 1.1.1.1 PORT 8030"); clearCreateDnodeReq(); - setCreateDnodeReqFunc("host1", 9030); + setCreateDnodeReq("host1", 9030); run("CREATE DNODE host1 PORT 9030"); clearCreateDnodeReq(); - setCreateDnodeReqFunc("abc2", 7040); + setCreateDnodeReq("abc2", 7040); run("CREATE DNODE 'abc2:7040'"); clearCreateDnodeReq(); - setCreateDnodeReqFunc("1.1.1.2"); + setCreateDnodeReq("1.1.1.2"); run("CREATE DNODE 1.1.1.2"); clearCreateDnodeReq(); - setCreateDnodeReqFunc("host2"); + setCreateDnodeReq("host2"); run("CREATE DNODE host2"); clearCreateDnodeReq(); } -// CREATE [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name AS library_path OUTPUTTYPE type_name [BUFSIZE value] +/* + * CREATE [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name AS library_path OUTPUTTYPE type_name [BUFSIZE value] + */ TEST_F(ParserInitialCTest, createFunction) { useDb("root", "test"); SCreateFuncReq expect = {0}; - auto setCreateFuncReqFunc = [&](const char* pUdfName, int8_t outputType, int32_t outputBytes = 0, - int8_t funcType = TSDB_FUNC_TYPE_SCALAR, int8_t igExists = 0, int32_t bufSize = 0) { + auto setCreateFuncReq = [&](const char* pUdfName, int8_t outputType, int32_t outputBytes = 0, + int8_t funcType = TSDB_FUNC_TYPE_SCALAR, int8_t igExists = 0, int32_t bufSize = 0) { memset(&expect, 0, sizeof(SCreateFuncReq)); strcpy(expect.name, pUdfName); expect.igExists = igExists; @@ -365,13 +394,69 @@ TEST_F(ParserInitialCTest, createFunction) { ASSERT_EQ(req.bufSize, expect.bufSize); }); - setCreateFuncReqFunc("udf1", TSDB_DATA_TYPE_INT); + setCreateFuncReq("udf1", TSDB_DATA_TYPE_INT); // run("CREATE FUNCTION udf1 AS './build/lib/libudf1.so' OUTPUTTYPE INT"); - setCreateFuncReqFunc("udf2", TSDB_DATA_TYPE_DOUBLE, 0, TSDB_FUNC_TYPE_AGGREGATE, 1, 8); + setCreateFuncReq("udf2", TSDB_DATA_TYPE_DOUBLE, 0, TSDB_FUNC_TYPE_AGGREGATE, 1, 8); // run("CREATE AGGREGATE FUNCTION IF NOT EXISTS udf2 AS './build/lib/libudf2.so' OUTPUTTYPE DOUBLE BUFSIZE 8"); } +/* + * CREATE MNODE ON DNODE dnode_id + */ +TEST_F(ParserInitialCTest, createMnode) { + useDb("root", "test"); + + SMCreateMnodeReq expect = {0}; + + auto setCreateMnodeReq = [&](int32_t dnodeId) { expect.dnodeId = dnodeId; }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_MNODE_STMT); + SMCreateMnodeReq req = {0}; + ASSERT_TRUE(TSDB_CODE_SUCCESS == + tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); + + ASSERT_EQ(req.dnodeId, expect.dnodeId); + }); + + setCreateMnodeReq(1); + run("CREATE MNODE ON DNODE 1"); +} + +/* + * CREATE QNODE ON DNODE dnode_id + */ +TEST_F(ParserInitialCTest, createQnode) { + useDb("root", "test"); + + SMCreateQnodeReq expect = {0}; + + auto setCreateQnodeReq = [&](int32_t dnodeId) { expect.dnodeId = dnodeId; }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_QNODE_STMT); + SMCreateQnodeReq req = {0}; + ASSERT_TRUE(TSDB_CODE_SUCCESS == + tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); + + ASSERT_EQ(req.dnodeId, expect.dnodeId); + }); + + setCreateQnodeReq(1); + run("CREATE QNODE ON DNODE 1"); +} + +/* + * CREATE SMA INDEX index_name ON tb_name index_option + * + * index_option: + * FUNCTION(functions) INTERVAL(interval_val [, interval_offset]) [SLIDING(sliding_val)] + * [WATERMARK(watermark_val)] [MAX_DELAY(max_delay_val)] + * + * functions: + * function [, function] ... + */ TEST_F(ParserInitialCTest, createSmaIndex) { useDb("root", "test"); @@ -439,24 +524,39 @@ TEST_F(ParserInitialCTest, createSmaIndex) { "DELETE_MARK 1000s"); } -TEST_F(ParserInitialCTest, createMnode) { - useDb("root", "test"); - - run("CREATE MNODE ON DNODE 1"); -} - -TEST_F(ParserInitialCTest, createQnode) { - useDb("root", "test"); - - run("CREATE QNODE ON DNODE 1"); -} - +/* + * CREATE SNODE ON DNODE dnode_id + */ TEST_F(ParserInitialCTest, createSnode) { useDb("root", "test"); + SMCreateSnodeReq expect = {0}; + + auto setCreateSnodeReq = [&](int32_t dnodeId) { expect.dnodeId = dnodeId; }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_SNODE_STMT); + SMCreateSnodeReq req = {0}; + ASSERT_TRUE(TSDB_CODE_SUCCESS == + tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); + + ASSERT_EQ(req.dnodeId, expect.dnodeId); + }); + + setCreateSnodeReq(1); run("CREATE SNODE ON DNODE 1"); } +/* + * CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definitionn] ...) + * TAGS (create_definition [, create_definition] ...) [table_options] + * + * create_definition: + * col_name column_definition + * + * column_definition: + * type_name [COMMENT 'string_value'] + */ TEST_F(ParserInitialCTest, createStable) { useDb("root", "test"); @@ -467,7 +567,7 @@ TEST_F(ParserInitialCTest, createStable) { memset(&expect, 0, sizeof(SMCreateStbReq)); }; - auto setCreateStbReqFunc = + auto setCreateStbReq = [&](const char* pDbName, const char* pTbName, int8_t igExists = 0, int64_t delay1 = -1, int64_t delay2 = -1, int64_t watermark1 = TSDB_DEFAULT_ROLLUP_WATERMARK, int64_t watermark2 = TSDB_DEFAULT_ROLLUP_WATERMARK, int64_t deleteMark1 = TSDB_DEFAULT_ROLLUP_DELETE_MARK, int64_t deleteMark2 = TSDB_DEFAULT_ROLLUP_DELETE_MARK, @@ -488,8 +588,8 @@ TEST_F(ParserInitialCTest, createStable) { } }; - auto addFieldToCreateStbReqFunc = [&](bool col, const char* pFieldName, uint8_t type, int32_t bytes = 0, - int8_t flags = COL_SMA_ON) { + auto addFieldToCreateStbReq = [&](bool col, const char* pFieldName, uint8_t type, int32_t bytes = 0, + int8_t flags = COL_SMA_ON) { SField field = {0}; strcpy(field.name, pFieldName); field.type = type; @@ -565,46 +665,46 @@ TEST_F(ParserInitialCTest, createStable) { tFreeSMCreateStbReq(&req); }); - setCreateStbReqFunc("test", "t1"); - addFieldToCreateStbReqFunc(true, "ts", TSDB_DATA_TYPE_TIMESTAMP); - addFieldToCreateStbReqFunc(true, "c1", TSDB_DATA_TYPE_INT); - addFieldToCreateStbReqFunc(false, "id", TSDB_DATA_TYPE_INT); + setCreateStbReq("test", "t1"); + addFieldToCreateStbReq(true, "ts", TSDB_DATA_TYPE_TIMESTAMP); + addFieldToCreateStbReq(true, "c1", TSDB_DATA_TYPE_INT); + addFieldToCreateStbReq(false, "id", TSDB_DATA_TYPE_INT); run("CREATE STABLE t1(ts TIMESTAMP, c1 INT) TAGS(id INT)"); clearCreateStbReq(); - setCreateStbReqFunc("rollup_db", "t1", 1, 100 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_MINUTE, 10, - 1 * MILLISECOND_PER_MINUTE, 1000 * MILLISECOND_PER_SECOND, 200 * MILLISECOND_PER_MINUTE, 100, - "test create table"); - addFieldToCreateStbReqFunc(true, "ts", TSDB_DATA_TYPE_TIMESTAMP, 0, 0); - addFieldToCreateStbReqFunc(true, "c1", TSDB_DATA_TYPE_INT); - addFieldToCreateStbReqFunc(true, "c2", TSDB_DATA_TYPE_UINT); - addFieldToCreateStbReqFunc(true, "c3", TSDB_DATA_TYPE_BIGINT); - addFieldToCreateStbReqFunc(true, "c4", TSDB_DATA_TYPE_UBIGINT, 0, 0); - addFieldToCreateStbReqFunc(true, "c5", TSDB_DATA_TYPE_FLOAT, 0, 0); - addFieldToCreateStbReqFunc(true, "c6", TSDB_DATA_TYPE_DOUBLE, 0, 0); - addFieldToCreateStbReqFunc(true, "c7", TSDB_DATA_TYPE_BINARY, 20 + VARSTR_HEADER_SIZE, 0); - addFieldToCreateStbReqFunc(true, "c8", TSDB_DATA_TYPE_SMALLINT, 0, 0); - addFieldToCreateStbReqFunc(true, "c9", TSDB_DATA_TYPE_USMALLINT, 0, 0); - addFieldToCreateStbReqFunc(true, "c10", TSDB_DATA_TYPE_TINYINT, 0, 0); - addFieldToCreateStbReqFunc(true, "c11", TSDB_DATA_TYPE_UTINYINT, 0, 0); - addFieldToCreateStbReqFunc(true, "c12", TSDB_DATA_TYPE_BOOL, 0, 0); - addFieldToCreateStbReqFunc(true, "c13", TSDB_DATA_TYPE_NCHAR, 30 * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 0); - addFieldToCreateStbReqFunc(true, "c14", TSDB_DATA_TYPE_VARCHAR, 50 + VARSTR_HEADER_SIZE, 0); - addFieldToCreateStbReqFunc(false, "a1", TSDB_DATA_TYPE_TIMESTAMP); - addFieldToCreateStbReqFunc(false, "a2", TSDB_DATA_TYPE_INT); - addFieldToCreateStbReqFunc(false, "a3", TSDB_DATA_TYPE_UINT); - addFieldToCreateStbReqFunc(false, "a4", TSDB_DATA_TYPE_BIGINT); - addFieldToCreateStbReqFunc(false, "a5", TSDB_DATA_TYPE_UBIGINT); - addFieldToCreateStbReqFunc(false, "a6", TSDB_DATA_TYPE_FLOAT); - addFieldToCreateStbReqFunc(false, "a7", TSDB_DATA_TYPE_DOUBLE); - addFieldToCreateStbReqFunc(false, "a8", TSDB_DATA_TYPE_BINARY, 20 + VARSTR_HEADER_SIZE); - addFieldToCreateStbReqFunc(false, "a9", TSDB_DATA_TYPE_SMALLINT); - addFieldToCreateStbReqFunc(false, "a10", TSDB_DATA_TYPE_USMALLINT); - addFieldToCreateStbReqFunc(false, "a11", TSDB_DATA_TYPE_TINYINT); - addFieldToCreateStbReqFunc(false, "a12", TSDB_DATA_TYPE_UTINYINT); - addFieldToCreateStbReqFunc(false, "a13", TSDB_DATA_TYPE_BOOL); - addFieldToCreateStbReqFunc(false, "a14", TSDB_DATA_TYPE_NCHAR, 30 * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); - addFieldToCreateStbReqFunc(false, "a15", TSDB_DATA_TYPE_VARCHAR, 50 + VARSTR_HEADER_SIZE); + setCreateStbReq("rollup_db", "t1", 1, 100 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_MINUTE, 10, + 1 * MILLISECOND_PER_MINUTE, 1000 * MILLISECOND_PER_SECOND, 200 * MILLISECOND_PER_MINUTE, 100, + "test create table"); + addFieldToCreateStbReq(true, "ts", TSDB_DATA_TYPE_TIMESTAMP, 0, 0); + addFieldToCreateStbReq(true, "c1", TSDB_DATA_TYPE_INT); + addFieldToCreateStbReq(true, "c2", TSDB_DATA_TYPE_UINT); + addFieldToCreateStbReq(true, "c3", TSDB_DATA_TYPE_BIGINT); + addFieldToCreateStbReq(true, "c4", TSDB_DATA_TYPE_UBIGINT, 0, 0); + addFieldToCreateStbReq(true, "c5", TSDB_DATA_TYPE_FLOAT, 0, 0); + addFieldToCreateStbReq(true, "c6", TSDB_DATA_TYPE_DOUBLE, 0, 0); + addFieldToCreateStbReq(true, "c7", TSDB_DATA_TYPE_BINARY, 20 + VARSTR_HEADER_SIZE, 0); + addFieldToCreateStbReq(true, "c8", TSDB_DATA_TYPE_SMALLINT, 0, 0); + addFieldToCreateStbReq(true, "c9", TSDB_DATA_TYPE_USMALLINT, 0, 0); + addFieldToCreateStbReq(true, "c10", TSDB_DATA_TYPE_TINYINT, 0, 0); + addFieldToCreateStbReq(true, "c11", TSDB_DATA_TYPE_UTINYINT, 0, 0); + addFieldToCreateStbReq(true, "c12", TSDB_DATA_TYPE_BOOL, 0, 0); + addFieldToCreateStbReq(true, "c13", TSDB_DATA_TYPE_NCHAR, 30 * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 0); + addFieldToCreateStbReq(true, "c14", TSDB_DATA_TYPE_VARCHAR, 50 + VARSTR_HEADER_SIZE, 0); + addFieldToCreateStbReq(false, "a1", TSDB_DATA_TYPE_TIMESTAMP); + addFieldToCreateStbReq(false, "a2", TSDB_DATA_TYPE_INT); + addFieldToCreateStbReq(false, "a3", TSDB_DATA_TYPE_UINT); + addFieldToCreateStbReq(false, "a4", TSDB_DATA_TYPE_BIGINT); + addFieldToCreateStbReq(false, "a5", TSDB_DATA_TYPE_UBIGINT); + addFieldToCreateStbReq(false, "a6", TSDB_DATA_TYPE_FLOAT); + addFieldToCreateStbReq(false, "a7", TSDB_DATA_TYPE_DOUBLE); + addFieldToCreateStbReq(false, "a8", TSDB_DATA_TYPE_BINARY, 20 + VARSTR_HEADER_SIZE); + addFieldToCreateStbReq(false, "a9", TSDB_DATA_TYPE_SMALLINT); + addFieldToCreateStbReq(false, "a10", TSDB_DATA_TYPE_USMALLINT); + addFieldToCreateStbReq(false, "a11", TSDB_DATA_TYPE_TINYINT); + addFieldToCreateStbReq(false, "a12", TSDB_DATA_TYPE_UTINYINT); + addFieldToCreateStbReq(false, "a13", TSDB_DATA_TYPE_BOOL); + addFieldToCreateStbReq(false, "a14", TSDB_DATA_TYPE_NCHAR, 30 * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); + addFieldToCreateStbReq(false, "a15", TSDB_DATA_TYPE_VARCHAR, 50 + VARSTR_HEADER_SIZE); run("CREATE STABLE IF NOT EXISTS rollup_db.t1(" "ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), " "c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, " @@ -630,6 +730,20 @@ TEST_F(ParserInitialCTest, createStableSemanticCheck) { TSDB_CODE_PAR_INVALID_TABLE_OPTION); } +/* + * CREATE STREAM [IF NOT EXISTS] stream_name [stream_options] + * INTO stb_name [TAGS (create_definition [, create_definition] ...)] [SUBTABLE (expr)] AS subquery + * + * stream_options: + * stream_option ... + * + * stream_option: { + * TRIGGER [AT_ONCE | WINDOW_CLOSE | MAX_DELAY time] + * | WATERMARK time + * | IGNORE EXPIRED value + * | FILL_HISTORY value + * } + */ TEST_F(ParserInitialCTest, createStream) { useDb("root", "test"); @@ -641,14 +755,23 @@ TEST_F(ParserInitialCTest, createStream) { }; auto setCreateStreamReq = [&](const char* pStream, const char* pSrcDb, const char* pSql, const char* pDstStb, - int8_t igExists = 0, int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, - int64_t watermark = 0, int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED, - int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY) { + int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t igExists = 0) { snprintf(expect.name, sizeof(expect.name), "0.%s", pStream); snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb); snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); expect.igExists = igExists; expect.sql = strdup(pSql); + expect.createStb = createStb; + expect.triggerType = STREAM_TRIGGER_AT_ONCE; + expect.maxDelay = 0; + expect.watermark = 0; + expect.fillHistory = STREAM_DEFAULT_FILL_HISTORY; + expect.igExpired = STREAM_DEFAULT_IGNORE_EXPIRED; + }; + + auto setStreamOptions = [&](int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, int64_t watermark = 0, + int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED, + int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY) { expect.triggerType = triggerType; expect.maxDelay = maxDelay; expect.watermark = watermark; @@ -699,19 +822,22 @@ TEST_F(ParserInitialCTest, createStream) { ASSERT_EQ(pField->flags, pExpectField->flags); } } + ASSERT_EQ(req.checkpointFreq, expect.checkpointFreq); + ASSERT_EQ(req.createStb, expect.createStb); tFreeSCMCreateStreamReq(&req); }); - setCreateStreamReq("s1", "test", "create stream s1 into st1 as select count(*) from t1 interval(10s)", "st1"); - run("CREATE STREAM s1 INTO st1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); + setCreateStreamReq("s1", "test", "create stream s1 into st3 as select count(*) from t1 interval(10s)", "st3"); + run("CREATE STREAM s1 INTO st3 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); setCreateStreamReq( "s1", "test", - "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 into st1 " + "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 into st3 " "as select count(*) from t1 interval(10s)", - "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND, 0, 1); - run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 INTO st1 AS " + "st3", 1, 1); + setStreamOptions(STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND, 0, 1); + run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 INTO st3 AS " "SELECT COUNT(*) " "FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); @@ -725,6 +851,11 @@ TEST_F(ParserInitialCTest, createStream) { run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " "AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, tag1 id INTERVAL(10S)"); clearCreateStreamReq(); + + setCreateStreamReq("s1", "test", "create stream s1 into st1 as select max(c1), c2 from t1 interval(10s)", "st1", + STREAM_CREATE_STABLE_FALSE); + run("CREATE STREAM s1 INTO st1 AS SELECT MAX(c1), c2 FROM t1 INTERVAL(10S)"); + clearCreateStreamReq(); } TEST_F(ParserInitialCTest, createStreamSemanticCheck) { @@ -734,9 +865,103 @@ TEST_F(ParserInitialCTest, createStreamSemanticCheck) { TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC); } +/* + * CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options] + * + * CREATE TABLE create_subtable_clause + * + * CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) + * [TAGS (create_definition [, create_definitionn] ...)] + * [table_options] + * + * create_subtable_clause: { + * create_subtable_clause [create_subtable_clause] ... + * | [IF NOT EXISTS] [db_name.]tb_name USING [db_name.]stb_name [(tag_name [, tag_name] ...)] + * TAGS (tag_value [, tag_value] ...) + * } + * + * create_definition: + * col_name column_definition + * + * column_definition: + * type_name [comment 'string_value'] + * + * table_options: + * table_option ... + * + * table_option: { + * COMMENT 'string_value' + * | WATERMARK duration[,duration] + * | MAX_DELAY duration[,duration] + * | ROLLUP(func_name [, func_name] ...) + * | SMA(col_name [, col_name] ...) + * | TTL value + * } + */ TEST_F(ParserInitialCTest, createTable) { useDb("root", "test"); + SVCreateTbBatchReq expect = {0}; + + auto addCreateTbReq = [&](const char* pName, bool ignoreExists = false, int32_t ttl = TSDB_DEFAULT_TABLE_TTL, + const char* pComment = nullptr) { + SVCreateTbReq req = {0}; + req.name = strdup(pName); + if (ignoreExists) { + req.flags |= TD_CREATE_IF_NOT_EXISTS; + } + req.ttl = ttl; + if (nullptr != pComment) { + req.comment = strdup(pComment); + req.commentLen = strlen(pComment); + } + ++expect.nReqs; + if (nullptr == expect.pArray) { + expect.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVCreateTbReq)); + } + taosArrayPush(expect.pArray, &req); + }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + return; // todo + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_VNODE_MODIFY_STMT); + SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; + + ASSERT_EQ(pStmt->sqlNodeType, QUERY_NODE_CREATE_TABLE_STMT); + ASSERT_NE(pStmt->pDataBlocks, nullptr); + int32_t numOfBlocks = taosArrayGetSize(pStmt->pDataBlocks); + for (int32_t i = 0; i < numOfBlocks; ++i) { + SVgDataBlocks* pVgData = (SVgDataBlocks*)taosArrayGetP(pStmt->pDataBlocks, i); + void* pBuf = POINTER_SHIFT(pVgData->pData, sizeof(SMsgHead)); + SVCreateTbBatchReq req = {0}; + SDecoder coder = {0}; + tDecoderInit(&coder, (uint8_t*)pBuf, pVgData->size); + ASSERT_EQ(tDecodeSVCreateTbBatchReq(&coder, &req), TSDB_CODE_SUCCESS); + ASSERT_EQ(req.nReqs, expect.nReqs); + for (int32_t j = 0; j < req.nReqs; ++j) { + SVCreateTbReq* pReq = req.pReqs + j; + SVCreateTbReq* pExpect = (SVCreateTbReq*)taosArrayGet(expect.pArray, j); + ASSERT_EQ(pReq->flags, pExpect->flags); + ASSERT_EQ(std::string(pReq->name), std::string(pExpect->name)); + ASSERT_EQ(pReq->uid, pExpect->uid); + ASSERT_EQ(pReq->ctime, pExpect->ctime); + ASSERT_EQ(pReq->ttl, pExpect->ttl); + ASSERT_EQ(pReq->commentLen, pExpect->commentLen); + ASSERT_EQ(std::string(pReq->comment), std::string(pExpect->comment)); + ASSERT_EQ(pReq->type, pExpect->type); + if (TD_NORMAL_TABLE == pExpect->type) { + ASSERT_EQ(pReq->ntb.schemaRow.version, pExpect->ntb.schemaRow.version); + ASSERT_EQ(pReq->ntb.schemaRow.nCols, pExpect->ntb.schemaRow.nCols); + } else if (TD_CHILD_TABLE == pExpect->type) { + ASSERT_EQ(std::string(pReq->ctb.stbName), std::string(pExpect->ctb.stbName)); + ASSERT_EQ(pReq->ctb.tagNum, pExpect->ctb.tagNum); + ASSERT_EQ(pReq->ctb.suid, pExpect->ctb.suid); + } + } + tDecoderClear(&coder); + } + }); + run("CREATE TABLE t1(ts TIMESTAMP, c1 INT)"); run("CREATE TABLE IF NOT EXISTS test.t1(" @@ -761,7 +986,7 @@ TEST_F(ParserInitialCTest, createTable) { "IF NOT EXISTS test.t2 USING test.st1 (tag1, tag2) TAGS(2, 'abc') " "IF NOT EXISTS test.t3 USING test.st1 (tag1, tag2) TAGS(3, 'abc') "); - // run("CREATE TABLE IF NOT EXISTS t1 USING st1 TAGS(1, 'wxy', NOW + 1S)"); + run("CREATE TABLE IF NOT EXISTS t1 USING st1 TAGS(1, 'wxy', NOW + 1S)"); } TEST_F(ParserInitialCTest, createTableSemanticCheck) { @@ -779,6 +1004,11 @@ TEST_F(ParserInitialCTest, createTableSemanticCheck) { run(sql, TSDB_CODE_PAR_TOO_MANY_COLUMNS); } +/* + * CREATE TOPIC [IF NOT EXISTS] topic_name AS subquery + * + * CREATE TOPIC [IF NOT EXISTS] topic_name [WITH META] AS {DATABASE db_name | STABLE stb_name } + */ TEST_F(ParserInitialCTest, createTopic) { useDb("root", "test"); @@ -786,8 +1016,8 @@ TEST_F(ParserInitialCTest, createTopic) { auto clearCreateTopicReq = [&]() { memset(&expect, 0, sizeof(SCMCreateTopicReq)); }; - auto setCreateTopicReqFunc = [&](const char* pTopicName, int8_t igExists, const char* pSql, const char* pAst, - const char* pDbName = nullptr, const char* pTbname = nullptr, int8_t withMeta = 0) { + auto setCreateTopicReq = [&](const char* pTopicName, int8_t igExists, const char* pSql, const char* pAst, + const char* pDbName = nullptr, const char* pTbname = nullptr, int8_t withMeta = 0) { snprintf(expect.name, sizeof(expect.name), "0.%s", pTopicName); expect.igExists = igExists; expect.sql = (char*)pSql; @@ -831,31 +1061,34 @@ TEST_F(ParserInitialCTest, createTopic) { tFreeSCMCreateTopicReq(&req); }); - setCreateTopicReqFunc("tp1", 0, "create topic tp1 as select * from t1", "ast"); + setCreateTopicReq("tp1", 0, "create topic tp1 as select * from t1", "ast"); run("CREATE TOPIC tp1 AS SELECT * FROM t1"); clearCreateTopicReq(); - setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 as select ts, ceil(c1) from t1", "ast"); + setCreateTopicReq("tp1", 1, "create topic if not exists tp1 as select ts, ceil(c1) from t1", "ast"); run("CREATE TOPIC IF NOT EXISTS tp1 AS SELECT ts, CEIL(c1) FROM t1"); clearCreateTopicReq(); - setCreateTopicReqFunc("tp1", 0, "create topic tp1 as database test", nullptr, "test"); + setCreateTopicReq("tp1", 0, "create topic tp1 as database test", nullptr, "test"); run("CREATE TOPIC tp1 AS DATABASE test"); clearCreateTopicReq(); - setCreateTopicReqFunc("tp1", 0, "create topic tp1 with meta as database test", nullptr, "test", nullptr, 1); + setCreateTopicReq("tp1", 0, "create topic tp1 with meta as database test", nullptr, "test", nullptr, 1); run("CREATE TOPIC tp1 WITH META AS DATABASE test"); clearCreateTopicReq(); - setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 as stable st1", nullptr, "test", "st1"); + setCreateTopicReq("tp1", 1, "create topic if not exists tp1 as stable st1", nullptr, "test", "st1"); run("CREATE TOPIC IF NOT EXISTS tp1 AS STABLE st1"); clearCreateTopicReq(); - setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 with meta as stable st1", nullptr, "test", "st1", 1); + setCreateTopicReq("tp1", 1, "create topic if not exists tp1 with meta as stable st1", nullptr, "test", "st1", 1); run("CREATE TOPIC IF NOT EXISTS tp1 WITH META AS STABLE st1"); clearCreateTopicReq(); } +/* + * CREATE USER use_name PASS password [SYSINFO value] + */ TEST_F(ParserInitialCTest, createUser) { useDb("root", "test"); diff --git a/source/libs/parser/test/parInitialDTest.cpp b/source/libs/parser/test/parInitialDTest.cpp index 3ded71242b..3d773d3510 100644 --- a/source/libs/parser/test/parInitialDTest.cpp +++ b/source/libs/parser/test/parInitialDTest.cpp @@ -99,7 +99,7 @@ TEST_F(ParserInitialDTest, dropDnode) { expect.force = force; }; - auto setDropDnodeReqByEndpoint = [&](const char* pFqdn, int32_t port, bool force = false) { + auto setDropDnodeReqByEndpoint = [&](const char* pFqdn, int32_t port = tsServerPort, bool force = false) { strcpy(expect.fqdn, pFqdn); expect.port = port; expect.force = force; @@ -131,6 +131,14 @@ TEST_F(ParserInitialDTest, dropDnode) { setDropDnodeReqByEndpoint("host2", 8030, true); run("DROP DNODE 'host2:8030' FORCE"); clearDropDnodeReq(); + + setDropDnodeReqByEndpoint("host1"); + run("DROP DNODE host1"); + clearDropDnodeReq(); + + setDropDnodeReqByEndpoint("host2", tsServerPort, true); + run("DROP DNODE host2 FORCE"); + clearDropDnodeReq(); } // todo DROP function @@ -174,7 +182,21 @@ TEST_F(ParserInitialDTest, dropMnode) { TEST_F(ParserInitialDTest, dropQnode) { useDb("root", "test"); - run("DROP qnode on dnode 1"); + SMDropQnodeReq expect = {0}; + + auto setDropQnodeReq = [&](int32_t dnodeId) { expect.dnodeId = dnodeId; }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_DROP_QNODE_STMT); + SMDropQnodeReq req = {0}; + ASSERT_TRUE(TSDB_CODE_SUCCESS == + tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); + + ASSERT_EQ(req.dnodeId, expect.dnodeId); + }); + + setDropQnodeReq(1); + run("DROP QNODE ON DNODE 1"); } TEST_F(ParserInitialDTest, dropSnode) { @@ -237,7 +259,20 @@ TEST_F(ParserInitialDTest, dropUser) { login("root"); useDb("root", "test"); - run("DROP user wxy"); + SDropUserReq expect = {0}; + + auto setDropUserReq = [&](const char* pUser) { sprintf(expect.user, "%s", pUser); }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_DROP_USER_STMT); + SDropUserReq req = {0}; + ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSDropUserReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); + + ASSERT_EQ(std::string(req.user), std::string(expect.user)); + }); + + setDropUserReq("wxy"); + run("DROP USER wxy"); } } // namespace ParserTest diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index e1687fc3a5..83341d200a 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1284,18 +1284,14 @@ static int32_t smaIndexOptFindSmaFunc(SNode* pQueryFunc, SNodeList* pSmaFuncs) { return -1; } -static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNodeList* pSmaFuncs, SNodeList** pOutput, - int32_t* pWStrartIndex) { +static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNodeList* pSmaFuncs, + SNodeList** pOutput) { SNodeList* pCols = NULL; SNode* pFunc = NULL; int32_t code = TSDB_CODE_SUCCESS; int32_t index = 0; int32_t smaFuncIndex = -1; - *pWStrartIndex = -1; FOREACH(pFunc, pFuncs) { - if (FUNCTION_TYPE_WSTART == ((SFunctionNode*)pFunc)->funcType) { - *pWStrartIndex = index; - } smaFuncIndex = smaIndexOptFindSmaFunc(pFunc, pSmaFuncs); if (smaFuncIndex < 0) { break; @@ -1317,8 +1313,7 @@ static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNo return code; } -static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo* pIndex, SNodeList** pCols, - int32_t* pWStrartIndex) { +static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo* pIndex, SNodeList** pCols) { SWindowLogicNode* pWindow = (SWindowLogicNode*)pScan->node.pParent; if (!smaIndexOptEqualInterval(pScan, pWindow, pIndex)) { return TSDB_CODE_SUCCESS; @@ -1326,14 +1321,14 @@ static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo SNodeList* pSmaFuncs = NULL; int32_t code = nodesStringToList(pIndex->expr, &pSmaFuncs); if (TSDB_CODE_SUCCESS == code) { - code = smaIndexOptCreateSmaCols(pWindow->pFuncs, pIndex->dstTbUid, pSmaFuncs, pCols, pWStrartIndex); + code = smaIndexOptCreateSmaCols(pWindow->pFuncs, pIndex->dstTbUid, pSmaFuncs, pCols); } nodesDestroyList(pSmaFuncs); return code; } static int32_t smaIndexOptApplyIndex(SLogicSubplan* pLogicSubplan, SScanLogicNode* pScan, STableIndexInfo* pIndex, - SNodeList* pSmaCols, int32_t wstrartIndex) { + SNodeList* pSmaCols) { SLogicNode* pSmaScan = NULL; int32_t code = smaIndexOptCreateSmaScan(pScan, pIndex, pSmaCols, &pSmaScan); if (TSDB_CODE_SUCCESS == code) { @@ -1350,10 +1345,9 @@ static int32_t smaIndexOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogi for (int32_t i = 0; i < nindexes; ++i) { STableIndexInfo* pIndex = taosArrayGet(pScan->pSmaIndexes, i); SNodeList* pSmaCols = NULL; - int32_t wstrartIndex = -1; - code = smaIndexOptCouldApplyIndex(pScan, pIndex, &pSmaCols, &wstrartIndex); + code = smaIndexOptCouldApplyIndex(pScan, pIndex, &pSmaCols); if (TSDB_CODE_SUCCESS == code && NULL != pSmaCols) { - code = smaIndexOptApplyIndex(pLogicSubplan, pScan, pIndex, pSmaCols, wstrartIndex); + code = smaIndexOptApplyIndex(pLogicSubplan, pScan, pIndex, pSmaCols); taosArrayDestroyEx(pScan->pSmaIndexes, smaIndexOptDestroySmaIndex); pScan->pSmaIndexes = NULL; pCxt->optimized = true; diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c index 72931413cc..4b8009347d 100644 --- a/source/libs/planner/src/planUtil.c +++ b/source/libs/planner/src/planUtil.c @@ -138,7 +138,10 @@ static int32_t adjustScanDataRequirement(SScanLogicNode* pScan, EDataOrderLevel } else if (TSDB_SUPER_TABLE == pScan->tableType) { pScan->scanType = SCAN_TYPE_TABLE_MERGE; } - pScan->node.resultDataOrder = requirement; + + if (TSDB_NORMAL_TABLE != pScan->tableType && TSDB_CHILD_TABLE != pScan->tableType) { + pScan->node.resultDataOrder = requirement; + } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/planner/test/planOtherTest.cpp b/source/libs/planner/test/planOtherTest.cpp index 4741d241b5..3a12d62340 100644 --- a/source/libs/planner/test/planOtherTest.cpp +++ b/source/libs/planner/test/planOtherTest.cpp @@ -30,7 +30,7 @@ TEST_F(PlanOtherTest, createTopic) { TEST_F(PlanOtherTest, createStream) { useDb("root", "test"); - run("create stream if not exists s1 trigger window_close watermark 10s into st1 as select count(*) from t1 " + run("create stream if not exists s1 trigger window_close watermark 10s into st3 as select count(*) from t1 " "interval(10s)"); run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " @@ -43,9 +43,9 @@ TEST_F(PlanOtherTest, createStream) { TEST_F(PlanOtherTest, createStreamUseSTable) { useDb("root", "test"); - run("CREATE STREAM IF NOT EXISTS s1 into st1 as SELECT COUNT(*) FROM st1 INTERVAL(10s)"); + run("CREATE STREAM IF NOT EXISTS s1 into st3 as SELECT COUNT(*) FROM st1 INTERVAL(10s)"); - run("CREATE STREAM IF NOT EXISTS s1 into st1 as SELECT COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)"); + run("CREATE STREAM IF NOT EXISTS s1 into st3 as SELECT COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)"); } TEST_F(PlanOtherTest, createSmaIndex) { diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 040ccc1694..d8cd5f4e75 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -116,8 +116,6 @@ int32_t cleanupTaskQueue() { } static void execHelper(struct SSchedMsg* pSchedMsg) { - assert(pSchedMsg != NULL && pSchedMsg->ahandle != NULL); - __async_exec_fn_t execFn = (__async_exec_fn_t)pSchedMsg->ahandle; int32_t code = execFn(pSchedMsg->thandle); if (code != 0 && pSchedMsg->msg != NULL) { @@ -126,8 +124,6 @@ static void execHelper(struct SSchedMsg* pSchedMsg) { } int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code) { - assert(execFn != NULL); - SSchedMsg schedMsg = {0}; schedMsg.fp = execHelper; schedMsg.ahandle = execFn; @@ -138,7 +134,10 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code) } void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { - assert(pMsgBody != NULL); + if (NULL == pMsgBody) { + return; + } + taosMemoryFreeClear(pMsgBody->target.dbFName); taosMemoryFreeClear(pMsgBody->msgInfo.pData); if (pMsgBody->paramFreeFp) { @@ -394,7 +393,7 @@ char* parseTagDatatoJson(void* p) { } else if (pTagVal->nData == 0) { value = cJSON_CreateString(""); } else { - ASSERT(0); + goto end; } cJSON_AddItemToObject(json, tagJsonKey, value); @@ -413,7 +412,7 @@ char* parseTagDatatoJson(void* p) { } cJSON_AddItemToObject(json, tagJsonKey, value); } else { - ASSERT(0); + goto end; } } string = cJSON_PrintUnformatted(json); diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index eb6091d605..cad01d88c3 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -316,34 +316,34 @@ typedef struct SQWorkerMgmt { #define QW_LOCK(type, _lock) \ do { \ if (QW_READ == (type)) { \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before read lock"); \ QW_LOCK_DEBUG("QW RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosRLockLatch(_lock); \ QW_LOCK_DEBUG("QW RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) > 0); \ + ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value after read lock"); \ } else { \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before write lock"); \ QW_LOCK_DEBUG("QW WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosWLockLatch(_lock); \ QW_LOCK_DEBUG("QW WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY); \ + ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \ } \ } while (0) #define QW_UNLOCK(type, _lock) \ do { \ if (QW_READ == (type)) { \ - assert(atomic_load_32((_lock)) > 0); \ + ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \ QW_LOCK_DEBUG("QW RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosRUnLockLatch(_lock); \ QW_LOCK_DEBUG("QW RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \ } else { \ - assert(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY); \ + ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \ QW_LOCK_DEBUG("QW WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosWUnLockLatch(_lock); \ QW_LOCK_DEBUG("QW WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \ } \ } while (0) diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 81f73b1226..e9d9a129a0 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -147,7 +147,6 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { size_t numOfResBlock = taosArrayGetSize(pResList); for (int32_t j = 0; j < numOfResBlock; ++j) { SSDataBlock *pRes = taosArrayGetP(pResList, j); - ASSERT(pRes->info.rows > 0); SInputData inputData = {.pData = pRes}; code = dsPutDataBlock(sinkHandle, &inputData, &qcontinue); diff --git a/source/libs/scalar/inc/sclInt.h b/source/libs/scalar/inc/sclInt.h index d3f29c0e49..0b85675c83 100644 --- a/source/libs/scalar/inc/sclInt.h +++ b/source/libs/scalar/inc/sclInt.h @@ -40,8 +40,11 @@ typedef struct SScalarCtx { #define SCL_DATA_TYPE_DUMMY_HASH 9000 #define SCL_DEFAULT_OP_NUM 10 +#define SCL_IS_NOTNULL_CONST_NODE(_node) ((QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type)) #define SCL_IS_CONST_NODE(_node) \ - ((NULL == (_node)) || (QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type)) + ((NULL == (_node)) || SCL_IS_NOTNULL_CONST_NODE(_node)) +#define SCL_IS_VAR_VALUE_NODE(_node) ((QUERY_NODE_VALUE == (_node)->type) && IS_STR_DATA_TYPE(((SValueNode*)(_node))->node.resType.type)) + #define SCL_IS_CONST_CALC(_ctx) (NULL == (_ctx)->pBlockList) //#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode //*)_node)->node.resType.type) && (((SValueNode *)_node)->placeholderNo <= 0)) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 59e39e3f6f..3795f5ecb9 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -3762,6 +3762,7 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) { return DEAL_RES_CONTINUE; } +/* if (!FILTER_GET_FLAG(stat->info->options, FLT_OPTION_TIMESTAMP)) { return DEAL_RES_CONTINUE; } @@ -3785,7 +3786,7 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) { stat->code = code; return DEAL_RES_ERROR; } - +*/ return DEAL_RES_CONTINUE; } @@ -3931,7 +3932,7 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) { stat->scalarMode = true; return DEAL_RES_CONTINUE; } - int32_t type = vectorGetConvertType(refNode->node.resType.type, listNode->dataType.type); + int32_t type = vectorGetConvertType(refNode->node.resType.type, listNode->node.resType.type); if (0 != type && type != refNode->node.resType.type) { stat->scalarMode = true; return DEAL_RES_CONTINUE; @@ -3955,12 +3956,14 @@ int32_t fltReviseNodes(SFilterInfo *pInfo, SNode **pNode, SFltTreeStat *pStat) { FLT_ERR_JRET(pStat->code); +/* int32_t nodeNum = taosArrayGetSize(pStat->nodeList); for (int32_t i = 0; i < nodeNum; ++i) { SValueNode *valueNode = *(SValueNode **)taosArrayGet(pStat->nodeList, i); FLT_ERR_JRET(sclConvertToTsValueNode(pStat->precision, valueNode)); } +*/ _return: diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index e3436c83c1..debc210f0f 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -349,7 +349,7 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t int32_t type = vectorGetConvertType(ctx->type.selfType, ctx->type.peerType); if (type == 0) { - type = nodeList->dataType.type; + type = nodeList->node.resType.type; } SCL_ERR_RET(scalarGenerateSetFromList((void **)¶m->pHashFilter, node, type)); @@ -507,7 +507,7 @@ int32_t sclGetNodeType(SNode *pNode, SScalarCtx *ctx) { } case QUERY_NODE_NODE_LIST: { SNodeListNode *nodeList = (SNodeListNode *)pNode; - return nodeList->dataType.type; + return nodeList->node.resType.type; } case QUERY_NODE_COLUMN: { SColumnNode *colNode = (SColumnNode *)pNode; @@ -1029,6 +1029,72 @@ bool sclContainsAggFuncNode(SNode *pNode) { return aggFunc; } + +int32_t sclConvertOpValueNodeTs(SOperatorNode *node, SScalarCtx *ctx) { + int32_t code = 0; + + if (node->pLeft && SCL_IS_VAR_VALUE_NODE(node->pLeft)) { + if (node->pRight && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pRight)->resType.type)) { + SCL_ERR_JRET(sclConvertToTsValueNode(((SExprNode *)node->pRight)->resType.precision, (SValueNode*)node->pLeft)); + } + } else if (node->pRight && SCL_IS_NOTNULL_CONST_NODE(node->pRight)) { + if (node->pLeft && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pLeft)->resType.type)) { + if (SCL_IS_VAR_VALUE_NODE(node->pRight)) { + SCL_ERR_JRET(sclConvertToTsValueNode(((SExprNode *)node->pLeft)->resType.precision, (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_JRET(sclConvertToTsValueNode(((SExprNode *)node->pLeft)->resType.precision, (SValueNode*)pNode)); + } + } + } + } + } + + return TSDB_CODE_SUCCESS; + +_return: + + ctx->code = code; + return DEAL_RES_ERROR; +} + + + +int32_t sclConvertCaseWhenValueNodeTs(SCaseWhenNode *node, SScalarCtx *ctx) { + int32_t code = 0; + + if (NULL == node->pCase) { + return TSDB_CODE_SUCCESS; + } + + if (SCL_IS_VAR_VALUE_NODE(node->pCase)) { + SNode* pNode; + FOREACH(pNode, node->pWhenThenList) { + SExprNode *pExpr = (SExprNode *)((SWhenThenNode *)pNode)->pWhen; + if (TSDB_DATA_TYPE_TIMESTAMP == pExpr->resType.type) { + SCL_ERR_JRET(sclConvertToTsValueNode(pExpr->resType.precision, (SValueNode*)node->pCase)); + break; + } + } + } else if (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pCase)->resType.type) { + SNode* pNode; + FOREACH(pNode, node->pWhenThenList) { + if (SCL_IS_VAR_VALUE_NODE(((SWhenThenNode *)pNode)->pWhen)) { + SCL_ERR_JRET(sclConvertToTsValueNode(((SExprNode *)node->pCase)->resType.precision, (SValueNode*)((SWhenThenNode *)pNode)->pWhen)); + } + } + } + + return TSDB_CODE_SUCCESS; + +_return: + + ctx->code = code; + return DEAL_RES_ERROR; +} + EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) { SOperatorNode *node = (SOperatorNode *)*pNode; int32_t code = 0; @@ -1040,15 +1106,6 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) { return sclRewriteNullInOptr(pNode, ctx, node->opType); } - if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pRight && nodesIsExprNode(node->pRight) && - ((SExprNode *)node->pRight)->resType.type == TSDB_DATA_TYPE_TIMESTAMP) { - code = sclConvertToTsValueNode(((SExprNode *)node->pRight)->resType.precision, valueNode); - if (code) { - ctx->code = code; - return DEAL_RES_ERROR; - } - } - if (SCL_IS_COMPARISON_OPERATOR(node->opType) && SCL_DOWNGRADE_DATETYPE(valueNode->node.resType.type)) { sclDowngradeValueType(valueNode); } @@ -1061,15 +1118,6 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) { return sclRewriteNullInOptr(pNode, ctx, node->opType); } - if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pLeft && nodesIsExprNode(node->pLeft) && - ((SExprNode *)node->pLeft)->resType.type == TSDB_DATA_TYPE_TIMESTAMP) { - code = sclConvertToTsValueNode(((SExprNode *)node->pLeft)->resType.precision, valueNode); - if (code) { - ctx->code = code; - return DEAL_RES_ERROR; - } - } - if (SCL_IS_COMPARISON_OPERATOR(node->opType) && SCL_DOWNGRADE_DATETYPE(valueNode->node.resType.type)) { sclDowngradeValueType(valueNode); } @@ -1197,9 +1245,12 @@ EDealRes sclRewriteLogic(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } + EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) { SOperatorNode *node = (SOperatorNode *)*pNode; + SCL_ERR_RET(sclConvertOpValueNodeTs(node, ctx)); + if ((!SCL_IS_CONST_NODE(node->pLeft)) || (!SCL_IS_CONST_NODE(node->pRight))) { return sclRewriteNonConstOperator(pNode, ctx); } @@ -1245,6 +1296,8 @@ EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) { EDealRes sclRewriteCaseWhen(SNode **pNode, SScalarCtx *ctx) { SCaseWhenNode *node = (SCaseWhenNode *)*pNode; + SCL_ERR_RET(sclConvertCaseWhenValueNodeTs(node, ctx)); + if ((!SCL_IS_CONST_NODE(node->pCase)) || (!SCL_IS_CONST_NODE(node->pElse))) { return DEAL_RES_CONTINUE; } diff --git a/source/libs/scalar/test/filter/filterTests.cpp b/source/libs/scalar/test/filter/filterTests.cpp index ca304cd329..2f518e2e59 100644 --- a/source/libs/scalar/test/filter/filterTests.cpp +++ b/source/libs/scalar/test/filter/filterTests.cpp @@ -193,7 +193,7 @@ void flttMakeLogicNodeFromList(SNode **pNode, ELogicConditionType opType, SNodeL void flttMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) { SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_NODE_LIST); SNodeListNode *lnode = (SNodeListNode *)node; - lnode->dataType.type = resType; + lnode->node.resType.type = resType; lnode->pNodeList = list; *pNode = (SNode *)lnode; diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp index dae26d3d58..f5a40c9a87 100644 --- a/source/libs/scalar/test/scalar/scalarTests.cpp +++ b/source/libs/scalar/test/scalar/scalarTests.cpp @@ -233,7 +233,7 @@ void scltMakeOpNode(SNode **pNode, EOperatorType opType, int32_t resType, SNode void scltMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) { SNode *node = (SNode *)nodesMakeNode(QUERY_NODE_NODE_LIST); SNodeListNode *lnode = (SNodeListNode *)node; - lnode->dataType.type = resType; + lnode->node.resType.type = resType; lnode->pNodeList = list; *pNode = (SNode *)lnode; diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 48df7e36a3..2a5eeecd36 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -375,7 +375,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_JOB_NEED_WAIT(_job) (!SCH_IS_QUERY_JOB(_job)) #define SCH_JOB_NEED_DROP(_job) (SCH_IS_QUERY_JOB(_job)) #define SCH_IS_EXPLAIN_JOB(_job) (EXPLAIN_MODE_ANALYZE == (_job)->attr.explainMode) -#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL) +#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) #define SCH_MERGE_TASK_NETWORK_ERR(_task, _code, _len) \ (SCH_NETWORK_ERR(_code) && (((_len) > 0) || (!SCH_IS_DATA_BIND_TASK(_task)) || (_task)->redirectCtx.inRedirect)) #define SCH_REDIRECT_MSGTYPE(_msgType) \ @@ -478,34 +478,34 @@ extern SSchedulerMgmt schMgmt; #define SCH_LOCK(type, _lock) \ do { \ if (SCH_READ == (type)) { \ - assert(atomic_load_32(_lock) >= 0); \ + ASSERTS(atomic_load_32(_lock) >= 0, "invalid lock value before read lock"); \ SCH_LOCK_DEBUG("SCH RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosRLockLatch(_lock); \ SCH_LOCK_DEBUG("SCH RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32(_lock) > 0); \ + ASSERTS(atomic_load_32(_lock) > 0, "invalid lock value after read lock"); \ } else { \ - assert(atomic_load_32(_lock) >= 0); \ + ASSERTS(atomic_load_32(_lock) >= 0, "invalid lock value before write lock"); \ SCH_LOCK_DEBUG("SCH WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosWLockLatch(_lock); \ SCH_LOCK_DEBUG("SCH WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32(_lock) == TD_RWLATCH_WRITE_FLAG_COPY); \ + ASSERTS(atomic_load_32(_lock) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \ } \ } while (0) #define SCH_UNLOCK(type, _lock) \ do { \ if (SCH_READ == (type)) { \ - assert(atomic_load_32((_lock)) > 0); \ + ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \ SCH_LOCK_DEBUG("SCH RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosRUnLockLatch(_lock); \ SCH_LOCK_DEBUG("SCH RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \ } else { \ - assert(atomic_load_32((_lock)) & TD_RWLATCH_WRITE_FLAG_COPY); \ + ASSERTS(atomic_load_32((_lock)) & TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \ SCH_LOCK_DEBUG("SCH WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ taosWUnLockLatch(_lock); \ SCH_LOCK_DEBUG("SCH WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \ - assert(atomic_load_32((_lock)) >= 0); \ + ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \ } \ } while (0) diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index d422f0e88f..6a8f81f8c7 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -668,6 +668,7 @@ void schFreeJobImpl(void *job) { taosMemoryFreeClear(pJob->userRes.execRes); taosMemoryFreeClear(pJob->fetchRes); taosMemoryFreeClear(pJob->sql); + tsem_destroy(&pJob->rspSem); taosMemoryFree(pJob); int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1); @@ -748,7 +749,10 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } - tsem_init(&pJob->rspSem, 0, 0); + if (tsem_init(&pJob->rspSem, 0, 0)) { + SCH_JOB_ELOG("tsem_init failed, errno:%d", errno); + SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } pJob->refId = taosAddRef(schMgmt.jobRef, pJob); if (pJob->refId < 0) { diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index 5b542dd54b..60729c4d0e 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -187,6 +187,23 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq, return status == TASK_INPUT_STATUS__NORMAL ? 0 : -1; } +int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBlock* pBlock) { + if (pTask->outputType == TASK_OUTPUT__TABLE) { + pTask->tbSink.tbSinkFunc(pTask, pTask->tbSink.vnode, 0, pBlock->blocks); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); + taosFreeQitem(pBlock); + } else if (pTask->outputType == TASK_OUTPUT__SMA) { + pTask->smaSink.smaSink(pTask->smaSink.vnode, pTask->smaSink.smaId, pBlock->blocks); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); + taosFreeQitem(pBlock); + } else { + ASSERT(pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH); + taosWriteQitem(pTask->outputQueue->queue, pBlock); + streamDispatch(pTask); + } + return 0; +} + int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pRsp, bool exec) { qDebug("task %d receive dispatch req from node %d task %d", pTask->taskId, pReq->upstreamNodeId, pReq->upstreamTaskId); @@ -199,9 +216,9 @@ int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, S return -1; } - if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) { - streamDispatch(pTask); - } + /*if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {*/ + /*streamDispatch(pTask);*/ + /*}*/ } else { streamSchedExec(pTask); } @@ -237,9 +254,9 @@ int32_t streamProcessRunReq(SStreamTask* pTask) { return -1; } - if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) { - streamDispatch(pTask); - } + /*if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {*/ + /*streamDispatch(pTask);*/ + /*}*/ return 0; } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 4e0b0630bc..f2b1db19e8 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -487,8 +487,6 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat taosMemoryFree(pReqs); } return code; - } else { - ASSERT(0); } return 0; } @@ -514,7 +512,6 @@ int32_t streamDispatch(SStreamTask* pTask) { int32_t code = 0; if (streamDispatchAllBlocks(pTask, pBlock) < 0) { - ASSERT(0); code = -1; streamQueueProcessFail(pTask->outputQueue); atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index c5161ca502..62ba74bd23 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -49,6 +49,10 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* // exec while (1) { + if (pTask->taskStatus == TASK_STATUS__DROPPING) { + return 0; + } + SSDataBlock* output = NULL; uint64_t ts = 0; if ((code = qExecTask(exec, &output, &ts)) < 0) { @@ -113,7 +117,11 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { ASSERT(0); } if (output == NULL) { - finished = true; + if (qStreamRecoverScanFinished(exec)) { + finished = true; + } else { + qSetStreamOpOpen(exec); + } break; } diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index 6889a870d1..52777fd834 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -143,6 +143,7 @@ int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* ASSERT(left >= 0); if (left == 0) { taosArrayDestroy(pTask->checkReqIds); + pTask->checkReqIds = NULL; streamTaskLaunchRecover(pTask, version); } } else if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) { diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index cf388da92c..e26c8a5c5b 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -663,8 +663,7 @@ int32_t streamStateSessionClear(SStreamState* pState) { void* buf = NULL; int32_t size = 0; int32_t code = streamStateSessionGetKVByCur(pCur, &delKey, &buf, &size); - if (code == 0) { - ASSERT(size > 0); + if (code == 0 && size > 0) { memset(buf, 0, size); streamStateSessionPut(pState, &delKey, buf, size); } else { diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index f7252ed8a0..e9aba0bc39 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -175,6 +175,8 @@ void tFreeSStreamTask(SStreamTask* pTask) { } if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) { taosArrayDestroy(pTask->shuffleDispatcher.dbInfo.pVgroupInfos); + taosArrayDestroy(pTask->checkReqIds); + pTask->checkReqIds = NULL; } if (pTask->pState) streamStateClose(pTask->pState); diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index a5524ffbde..b5227152df 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -227,7 +227,7 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* pNode, const SRpcMsg* pMsg); int32_t syncNodeOnAppendEntries(SSyncNode* pNode, const SRpcMsg* pMsg); int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pMsg); int32_t syncNodeOnSnapshot(SSyncNode* ths, const SRpcMsg* pMsg); -int32_t syncNodeOnSnapshotReply(SSyncNode* ths, const SRpcMsg* pMsg); +int32_t syncNodeOnSnapshotRsp(SSyncNode* ths, const SRpcMsg* pMsg); int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pMsg); int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, const SRpcMsg* pMsg); int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pMsg); @@ -238,7 +238,7 @@ int32_t syncNodeStopPingTimer(SSyncNode* pSyncNode); int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms); int32_t syncNodeStopElectTimer(SSyncNode* pSyncNode); int32_t syncNodeRestartElectTimer(SSyncNode* pSyncNode, int32_t ms); -int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode); +void syncNodeResetElectTimer(SSyncNode* pSyncNode); int32_t syncNodeStartHeartbeatTimer(SSyncNode* pSyncNode); int32_t syncNodeStopHeartbeatTimer(SSyncNode* pSyncNode); int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode); diff --git a/source/libs/sync/inc/syncPipeline.h b/source/libs/sync/inc/syncPipeline.h index 8c7edf85ff..a0a0691694 100644 --- a/source/libs/sync/inc/syncPipeline.h +++ b/source/libs/sync/inc/syncPipeline.h @@ -61,7 +61,7 @@ typedef struct SSyncLogBuffer { // SSyncLogRepMgr SSyncLogReplMgr* syncLogReplMgrCreate(); void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr); -int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr); +void syncLogReplMgrReset(SSyncLogReplMgr* pMgr); int32_t syncNodeLogReplMgrInit(SSyncNode* pNode); void syncNodeLogReplMgrDestroy(SSyncNode* pNode); @@ -109,6 +109,8 @@ SSyncRaftEntry* syncLogBufferGetOneEntry(SSyncLogBuffer* pBuf, SSyncNode* pNode, int32_t syncLogBufferValidate(SSyncLogBuffer* pBuf); int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex toIndex); +int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry, + int32_t applyCode); #ifdef __cplusplus } #endif diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index ee83636192..974a8f968e 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -56,7 +56,7 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI void snapshotSenderDestroy(SSyncSnapshotSender *pSender); bool snapshotSenderIsStart(SSyncSnapshotSender *pSender); int32_t snapshotSenderStart(SSyncSnapshotSender *pSender); -int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish); +void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish); int32_t snapshotSend(SSyncSnapshotSender *pSender); int32_t snapshotReSend(SSyncSnapshotSender *pSender); @@ -79,14 +79,14 @@ typedef struct SSyncSnapshotReceiver { SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId fromId); void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver); -int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg); -int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); +void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg); +void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver); void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver); // on message int32_t syncNodeOnSnapshot(SSyncNode *ths, const SRpcMsg *pMsg); -int32_t syncNodeOnSnapshotReply(SSyncNode *ths, const SRpcMsg *pMsg); +int32_t syncNodeOnSnapshotRsp(SSyncNode *ths, const SRpcMsg *pMsg); SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode *pSyncNode, SyncIndex snapshotLastApplyIndex); diff --git a/source/libs/sync/inc/syncUtil.h b/source/libs/sync/inc/syncUtil.h index be14ef91a4..7d08585656 100644 --- a/source/libs/sync/inc/syncUtil.h +++ b/source/libs/sync/inc/syncUtil.h @@ -100,12 +100,6 @@ void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, int64 void syncLogSendHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* pMsg, const char* s); void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* pMsg, int64_t timeDiff, const char* s); -void syncLogSendSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s); -void syncLogRecvSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s); - -void syncLogSendSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s); -void syncLogRecvSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s); - void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s); void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 6a545424fc..1a481a7e14 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -194,18 +194,21 @@ int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg) { code = syncNodeOnSnapshot(pSyncNode, pMsg); break; case TDMT_SYNC_SNAPSHOT_RSP: - code = syncNodeOnSnapshotReply(pSyncNode, pMsg); + code = syncNodeOnSnapshotRsp(pSyncNode, pMsg); break; case TDMT_SYNC_LOCAL_CMD: code = syncNodeOnLocalCmd(pSyncNode, pMsg); break; default: - sError("vgId:%d, failed to process msg:%p since invalid type:%s", pSyncNode->vgId, pMsg, - TMSG_INFO(pMsg->msgType)); + terrno = TSDB_CODE_MSG_NOT_PROCESSED; code = -1; } syncNodeRelease(pSyncNode); + if (code != 0) { + sDebug("vgId:%d, failed to process sync msg:%p type:%s since 0x%x", pSyncNode->vgId, pMsg, TMSG_INFO(pMsg->msgType), + terrno); + } return code; } @@ -228,8 +231,7 @@ int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq) { syncNodeRelease(pNode); if (ret == 1) { - sInfo("send timeout response, seq:%" PRId64 " handle:%p ahandle:%p", seq, rpcMsg.info.handle, - rpcMsg.info.ahandle); + sInfo("send timeout response, seq:%" PRId64 " handle:%p ahandle:%p", seq, rpcMsg.info.handle, rpcMsg.info.ahandle); rpcSendResponse(&rpcMsg); return 0; } else { @@ -705,7 +707,7 @@ int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak, int64_t* seq) { int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_t* seq) { if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { terrno = TSDB_CODE_SYN_NOT_LEADER; - sNError(pSyncNode, "sync propose not leader, %s, type:%s", syncStr(pSyncNode->state), TMSG_INFO(pMsg->msgType)); + sNError(pSyncNode, "sync propose not leader, type:%s", TMSG_INFO(pMsg->msgType)); return -1; } @@ -815,11 +817,9 @@ int32_t syncNodeLogStoreRestoreOnNeed(SSyncNode* pNode) { ASSERTS(pNode->pLogStore != NULL, "log store not created"); ASSERTS(pNode->pFsm != NULL, "pFsm not registered"); ASSERTS(pNode->pFsm->FpGetSnapshotInfo != NULL, "FpGetSnapshotInfo not registered"); - SSnapshot snapshot; - if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { - sError("vgId:%d, failed to get snapshot info since %s", pNode->vgId, terrstr()); - return -1; - } + SSnapshot snapshot = {0}; + pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot); + SyncIndex commitIndex = snapshot.lastApplyIndex; SyncIndex firstVer = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore); SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); @@ -892,10 +892,10 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // init by SSyncInfo pSyncNode->vgId = pSyncInfo->vgId; SSyncCfg* pCfg = &pSyncInfo->syncCfg; - sDebug("vgId:%d, replica:%d selfIndex:%d", pSyncNode->vgId, pCfg->replicaNum, pCfg->myIndex); + sInfo("vgId:%d, start to open sync node, replica:%d selfIndex:%d", pSyncNode->vgId, pCfg->replicaNum, pCfg->myIndex); for (int32_t i = 0; i < pCfg->replicaNum; ++i) { SNodeInfo* pNode = &pCfg->nodeInfo[i]; - sDebug("vgId:%d, index:%d ep:%s:%u", pSyncNode->vgId, i, pNode->nodeFqdn, pNode->nodePort); + sInfo("vgId:%d, index:%d ep:%s:%u", pSyncNode->vgId, i, pNode->nodeFqdn, pNode->nodePort); } memcpy(pSyncNode->path, pSyncInfo->path, sizeof(pSyncNode->path)); @@ -1029,11 +1029,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { SyncIndex commitIndex = SYNC_INDEX_INVALID; if (pSyncNode->pFsm != NULL && pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { SSnapshot snapshot = {0}; - int32_t code = pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - if (code != 0) { - sError("vgId:%d, failed to get snapshot info, code:%d", pSyncNode->vgId, code); - goto _error; - } + pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); if (snapshot.lastApplyIndex > commitIndex) { commitIndex = snapshot.lastApplyIndex; sNTrace(pSyncNode, "reset commit index by snapshot"); @@ -1090,13 +1086,17 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // snapshot senders for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, i); - // ASSERT(pSender != NULL); - (pSyncNode->senders)[i] = pSender; - sSTrace(pSender, "snapshot sender create new while open, data:%p", pSender); + if (pSender == NULL) return NULL; + + pSyncNode->senders[i] = pSender; + sSDebug(pSender, "snapshot sender create while open sync node, data:%p", pSender); } // snapshot receivers pSyncNode->pNewNodeReceiver = snapshotReceiverCreate(pSyncNode, EMPTY_RAFT_ID); + if (pSyncNode->pNewNodeReceiver == NULL) return NULL; + sRDebug(pSyncNode->pNewNodeReceiver, "snapshot receiver create while open sync node, data:%p", + pSyncNode->pNewNodeReceiver); // is config changing pSyncNode->changing = false; @@ -1137,10 +1137,8 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { pSyncNode->hbrSlowNum = 0; pSyncNode->tmrRoutineNum = 0; - sNInfo(pSyncNode, "sync open, node:%p", pSyncNode); - sTrace("vgId:%d, tsElectInterval:%d, tsHeartbeatInterval:%d, tsHeartbeatTimeout:%d", pSyncNode->vgId, tsElectInterval, - tsHeartbeatInterval, tsHeartbeatTimeout); - + sNInfo(pSyncNode, "sync open, node:%p electInterval:%d heartbeatInterval:%d heartbeatTimeout:%d", pSyncNode, + tsElectInterval, tsHeartbeatInterval, tsHeartbeatTimeout); return pSyncNode; _error: @@ -1155,9 +1153,8 @@ _error: void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { if (pSyncNode->pFsm != NULL && pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { - SSnapshot snapshot; - int32_t code = pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - ASSERT(code == 0); + SSnapshot snapshot = {0}; + pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); if (snapshot.lastApplyIndex > pSyncNode->commitIndex) { pSyncNode->commitIndex = snapshot.lastApplyIndex; } @@ -1258,6 +1255,8 @@ void syncNodePreClose(SSyncNode* pSyncNode) { snapshotReceiverForceStop(pSyncNode->pNewNodeReceiver); } + sDebug("vgId:%d, snapshot receiver destroy while preclose sync node, data:%p", pSyncNode->vgId, + pSyncNode->pNewNodeReceiver); snapshotReceiverDestroy(pSyncNode->pNewNodeReceiver); pSyncNode->pNewNodeReceiver = NULL; } @@ -1301,20 +1300,16 @@ void syncNodeClose(SSyncNode* pSyncNode) { syncNodeStopElectTimer(pSyncNode); syncNodeStopHeartbeatTimer(pSyncNode); - if (pSyncNode->pFsm != NULL) { - taosMemoryFree(pSyncNode->pFsm); - } - for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - if ((pSyncNode->senders)[i] != NULL) { - sSTrace((pSyncNode->senders)[i], "snapshot sender destroy while close, data:%p", (pSyncNode->senders)[i]); + if (pSyncNode->senders[i] != NULL) { + sDebug("vgId:%d, snapshot sender destroy while close, data:%p", pSyncNode->vgId, pSyncNode->senders[i]); - if (snapshotSenderIsStart((pSyncNode->senders)[i])) { - snapshotSenderStop((pSyncNode->senders)[i], false); + if (snapshotSenderIsStart(pSyncNode->senders[i])) { + snapshotSenderStop(pSyncNode->senders[i], false); } - snapshotSenderDestroy((pSyncNode->senders)[i]); - (pSyncNode->senders)[i] = NULL; + snapshotSenderDestroy(pSyncNode->senders[i]); + pSyncNode->senders[i] = NULL; } } @@ -1323,10 +1318,15 @@ void syncNodeClose(SSyncNode* pSyncNode) { snapshotReceiverForceStop(pSyncNode->pNewNodeReceiver); } + sDebug("vgId:%d, snapshot receiver destroy while close, data:%p", pSyncNode->vgId, pSyncNode->pNewNodeReceiver); snapshotReceiverDestroy(pSyncNode->pNewNodeReceiver); pSyncNode->pNewNodeReceiver = NULL; } + if (pSyncNode->pFsm != NULL) { + taosMemoryFree(pSyncNode->pFsm); + } + taosMemoryFree(pSyncNode); } @@ -1389,8 +1389,7 @@ int32_t syncNodeRestartElectTimer(SSyncNode* pSyncNode, int32_t ms) { return ret; } -int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode) { - int32_t ret = 0; +void syncNodeResetElectTimer(SSyncNode* pSyncNode) { int32_t electMS; if (pSyncNode->pRaftCfg->isStandBy) { @@ -1398,11 +1397,11 @@ int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode) { } else { electMS = syncUtilElectRandomMS(pSyncNode->electBaseLine, 2 * pSyncNode->electBaseLine); } - ret = syncNodeRestartElectTimer(pSyncNode, electMS); + + (void)syncNodeRestartElectTimer(pSyncNode, electMS); sNTrace(pSyncNode, "reset elect timer, min:%d, max:%d, ms:%d", pSyncNode->electBaseLine, 2 * pSyncNode->electBaseLine, electMS); - return ret; } static int32_t syncNodeDoStartHeartbeatTimer(SSyncNode* pSyncNode) { @@ -1462,23 +1461,20 @@ int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode) { return 0; } -// utils -------------- int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRpcMsg* pMsg) { SEpSet epSet; syncUtilRaftId2EpSet(destRaftId, &epSet); - if (pSyncNode->syncSendMSg != NULL) { - // htonl - syncUtilMsgHtoN(pMsg->pCont); + if (pSyncNode->syncSendMSg != NULL) { + syncUtilMsgHtoN(pMsg->pCont); pMsg->info.noResp = 1; - pSyncNode->syncSendMSg(&epSet, pMsg); + return pSyncNode->syncSendMSg(&epSet, pMsg); } else { sError("vgId:%d, sync send msg by id error, fp-send-msg is null", pSyncNode->vgId); rpcFreeCont(pMsg->pCont); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; return -1; } - - return 0; } int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, SRpcMsg* pMsg) { @@ -1593,7 +1589,7 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde memcpy(oldReplicasId, pSyncNode->replicasId, sizeof(oldReplicasId)); SSyncSnapshotSender* oldSenders[TSDB_MAX_REPLICA]; for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - oldSenders[i] = (pSyncNode->senders)[i]; + oldSenders[i] = pSyncNode->senders[i]; sSTrace(oldSenders[i], "snapshot sender save old"); } @@ -1632,7 +1628,7 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde // clear new for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - (pSyncNode->senders)[i] = NULL; + pSyncNode->senders[i] = NULL; } // reset new @@ -1647,16 +1643,16 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde sNTrace(pSyncNode, "snapshot sender reset for: %" PRId64 ", newIndex:%d, %s:%d, %p", (pSyncNode->replicasId)[i].addr, i, host, port, oldSenders[j]); - (pSyncNode->senders)[i] = oldSenders[j]; + pSyncNode->senders[i] = oldSenders[j]; oldSenders[j] = NULL; reset = true; // reset replicaIndex - int32_t oldreplicaIndex = (pSyncNode->senders)[i]->replicaIndex; - (pSyncNode->senders)[i]->replicaIndex = i; + int32_t oldreplicaIndex = pSyncNode->senders[i]->replicaIndex; + pSyncNode->senders[i]->replicaIndex = i; sNTrace(pSyncNode, "snapshot sender udpate replicaIndex from %d to %d, %s:%d, %p, reset:%d", oldreplicaIndex, - i, host, port, (pSyncNode->senders)[i], reset); + i, host, port, pSyncNode->senders[i], reset); break; } @@ -1665,18 +1661,23 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde // create new for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - if ((pSyncNode->senders)[i] == NULL) { - (pSyncNode->senders)[i] = snapshotSenderCreate(pSyncNode, i); - sSTrace((pSyncNode->senders)[i], "snapshot sender create new while reconfig, data:%p", (pSyncNode->senders)[i]); + if (pSyncNode->senders[i] == NULL) { + pSyncNode->senders[i] = snapshotSenderCreate(pSyncNode, i); + if (pSyncNode->senders[i] == NULL) { + // will be created later while send snapshot + sSError(pSyncNode->senders[i], "snapshot sender create failed while reconfig"); + } else { + sSDebug(pSyncNode->senders[i], "snapshot sender create while reconfig, data:%p", pSyncNode->senders[i]); + } } else { - sSTrace((pSyncNode->senders)[i], "snapshot sender already exist, data:%p", (pSyncNode->senders)[i]); + sSDebug(pSyncNode->senders[i], "snapshot sender already exist, data:%p", pSyncNode->senders[i]); } } // free old for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { if (oldSenders[i] != NULL) { - sNTrace(pSyncNode, "snapshot sender destroy old, data:%p replica-index:%d", oldSenders[i], i); + sSDebug(oldSenders[i], "snapshot sender destroy old, data:%p replica-index:%d", oldSenders[i], i); snapshotSenderDestroy(oldSenders[i]); oldSenders[i] = NULL; } @@ -1851,8 +1852,8 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { SSyncSnapshotSender* pMySender = syncNodeGetSnapshotSender(pSyncNode, &(pSyncNode->myRaftId)); if (pMySender != NULL) { for (int32_t i = 0; i < pSyncNode->pMatchIndex->replicaNum; ++i) { - if ((pSyncNode->senders)[i]->privateTerm > pMySender->privateTerm) { - pMySender->privateTerm = (pSyncNode->senders)[i]->privateTerm; + if (pSyncNode->senders[i]->privateTerm > pMySender->privateTerm) { + pMySender->privateTerm = pSyncNode->senders[i]->privateTerm; } } (pMySender->privateTerm) += 100; @@ -2383,9 +2384,20 @@ int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHand } int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) { + if (pEntry->dataLen < sizeof(SMsgHead)) { + sError("vgId:%d, cannot append an invalid client request with no msg head. type:%s, dataLen:%d", ths->vgId, + TMSG_INFO(pEntry->originalRpcType), pEntry->dataLen); + syncEntryDestroy(pEntry); + return -1; + } + // append to log buffer if (syncLogBufferAppend(ths->pLogBuf, ths, pEntry) < 0) { - sError("vgId:%d, failed to enqueue sync log buffer. index:%" PRId64 "", ths->vgId, pEntry->index); + sError("vgId:%d, failed to enqueue sync log buffer, index:%" PRId64, ths->vgId, pEntry->index); + terrno = TSDB_CODE_SYN_BUFFER_FULL; + (void)syncLogFsmExecute(ths, ths->pFsm, ths->state, ths->pRaftStore->currentTerm, pEntry, + TSDB_CODE_SYN_BUFFER_FULL); + syncEntryDestroy(pEntry); return -1; } @@ -2678,16 +2690,24 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn pEntry = syncEntryBuildFromRpcMsg(pMsg, term, index); } + if (pEntry == NULL) { + sError("vgId:%d, failed to process client request since %s.", ths->vgId, terrstr()); + return -1; + } + if (ths->state == TAOS_SYNC_STATE_LEADER) { if (pRetIndex) { (*pRetIndex) = index; } int32_t code = syncNodeAppend(ths, pEntry); - if (code < 0 && ths->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - ASSERTS(false, "failed to append blocking msg"); + if (code < 0) { + sNError(ths, "failed to append blocking msg"); } return code; + } else { + syncEntryDestroy(pEntry); + pEntry = NULL; } return -1; diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index d875d3ca09..ee649c268c 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -26,6 +26,11 @@ #include "syncSnapshot.h" #include "syncUtil.h" +static bool syncIsMsgBlock(tmsg_t type) { + return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) || + (type == TDMT_VND_UPDATE_TAG_VAL) || (type == TDMT_VND_ALTER_CONFIRM); +} + int64_t syncLogBufferGetEndIndex(SSyncLogBuffer* pBuf) { taosThreadMutexLock(&pBuf->mutex); int64_t index = pBuf->endIndex; @@ -40,7 +45,7 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt if (index - pBuf->startIndex >= pBuf->size) { sError("vgId:%d, failed to append due to sync log buffer full. index:%" PRId64 "", pNode->vgId, index); - goto _out; + goto _err; } ASSERT(index == pBuf->endIndex); @@ -61,9 +66,8 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt taosThreadMutexUnlock(&pBuf->mutex); return 0; -_out: +_err: syncLogBufferValidate(pBuf); - syncEntryDestroy(pEntry); taosThreadMutexUnlock(&pBuf->mutex); return -1; } @@ -99,8 +103,9 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S return prevLogTerm; } - SSnapshot snapshot; - if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) == 0 && prevIndex == snapshot.lastApplyIndex) { + SSnapshot snapshot = {0}; + pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot); + if (prevIndex == snapshot.lastApplyIndex) { return snapshot.lastApplyTerm; } @@ -111,7 +116,7 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S return prevLogTerm; } - sError("vgId:%d, failed to get log term since %s. index: %" PRId64 "", pNode->vgId, terrstr(), prevIndex); + sInfo("vgId:%d, failed to get log term since %s. index:%" PRId64, pNode->vgId, terrstr(), prevIndex); terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; } @@ -145,11 +150,9 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { ASSERTS(pNode->pFsm != NULL, "pFsm not registered"); ASSERTS(pNode->pFsm->FpGetSnapshotInfo != NULL, "FpGetSnapshotInfo not registered"); - SSnapshot snapshot; - if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { - sError("vgId:%d, failed to get snapshot info since %s", pNode->vgId, terrstr()); - goto _err; - } + SSnapshot snapshot = {0}; + pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot); + SyncIndex commitIndex = snapshot.lastApplyIndex; SyncTerm commitTerm = TMAX(snapshot.lastApplyTerm, 0); if (syncLogValidateAlignmentOfCommit(pNode, commitIndex)) { @@ -442,26 +445,25 @@ _out: return matchIndex; } -int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry) { - ASSERTS(pFsm->FpCommitCb != NULL, "No commit cb registered for the FSM"); - +int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry, + int32_t applyCode) { if ((pNode->replicaNum == 1) && pNode->restoreFinish && pNode->vgId != 1) { return 0; } - if (pNode->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - sTrace("vgId:%d, blocking msg ready to execute. index:%" PRId64 ", term: %" PRId64 ", type: %s", pNode->vgId, - pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType)); + if (pNode->vgId != 1 && syncIsMsgBlock(pEntry->originalRpcType)) { + sTrace("vgId:%d, blocking msg ready to execute, index:%" PRId64 ", term:%" PRId64 ", type:%s code:0x%x", + pNode->vgId, pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType), applyCode); } - SRpcMsg rpcMsg = {0}; + SRpcMsg rpcMsg = {.code = applyCode}; syncEntry2OriginalRpc(pEntry, &rpcMsg); SFsmCbMeta cbMeta = {0}; cbMeta.index = pEntry->index; cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(pNode, pEntry->index); cbMeta.isWeak = pEntry->isWeak; - cbMeta.code = 0; + cbMeta.code = applyCode; cbMeta.state = role; cbMeta.seqNum = pEntry->seqNum; cbMeta.term = pEntry->term; @@ -470,7 +472,6 @@ int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, Syn (void)syncRespMgrGetAndDel(pNode->pSyncRespMgr, cbMeta.seqNum, &rpcMsg.info); int32_t code = pFsm->FpCommitCb(pFsm, &rpcMsg, &cbMeta); - ASSERT(rpcMsg.pCont == NULL); return code; } @@ -521,7 +522,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm pEntry->term, TMSG_INFO(pEntry->originalRpcType)); } - if (syncLogFsmExecute(pNode, pFsm, role, term, pEntry) != 0) { + if (syncLogFsmExecute(pNode, pFsm, role, term, pEntry, 0) != 0) { sError("vgId:%d, failed to execute sync log entry. index:%" PRId64 ", term:%" PRId64 ", role: %d, current term: %" PRId64, vgId, pEntry->index, pEntry->term, role, term); @@ -567,7 +568,9 @@ _out: return ret; } -int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { +void syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { + if (pMgr == NULL) return; + ASSERT(pMgr->startIndex >= 0); for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); @@ -577,7 +580,6 @@ int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { pMgr->endIndex = 0; pMgr->restored = false; pMgr->retryBackoff = 0; - return 0; } int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index 018ac5bb7d..3f9f397ef5 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -115,8 +115,8 @@ static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncI const char* sysErrStr = strerror(errno); sNError(pData->pSyncNode, - "wal restore from snapshot error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - snapshotIndex, err, err, errStr, sysErr, sysErrStr); + "wal restore from snapshot error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", snapshotIndex, + err, errStr, sysErr, sysErrStr); return -1; } @@ -212,8 +212,8 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr int32_t sysErr = errno; const char* sysErrStr = strerror(errno); - sNError(pData->pSyncNode, "wal write error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - pEntry->index, err, err, errStr, sysErr, sysErrStr); + sNError(pData->pSyncNode, "wal write error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", + pEntry->index, err, errStr, sysErr, sysErrStr); return -1; } @@ -257,11 +257,11 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR const char* sysErrStr = strerror(errno); if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { - sNTrace(pData->pSyncNode, "wal read not exist, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", index, - err, err, errStr, sysErr, sysErrStr); + sNTrace(pData->pSyncNode, "wal read not exist, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", index, + err, errStr, sysErr, sysErrStr); } else { - sNTrace(pData->pSyncNode, "wal read error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", index, - err, err, errStr, sysErr, sysErrStr); + sNTrace(pData->pSyncNode, "wal read error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", index, err, + errStr, sysErr, sysErrStr); } /* @@ -341,8 +341,8 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn const char* errStr = tstrerror(err); int32_t sysErr = errno; const char* sysErrStr = strerror(errno); - sError("vgId:%d, wal truncate error, from-index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - pData->pSyncNode->vgId, fromIndex, err, err, errStr, sysErr, sysErrStr); + sError("vgId:%d, wal truncate error, from-index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", + pData->pSyncNode->vgId, fromIndex, err, errStr, sysErr, sysErrStr); } // event log @@ -392,8 +392,8 @@ int32_t raftLogUpdateCommitIndex(SSyncLogStore* pLogStore, SyncIndex index) { const char* errStr = tstrerror(err); int32_t sysErr = errno; const char* sysErrStr = strerror(errno); - sError("vgId:%d, wal update commit index error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - pData->pSyncNode->vgId, index, err, err, errStr, sysErr, sysErrStr); + sError("vgId:%d, wal update commit index error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", + pData->pSyncNode->vgId, index, err, errStr, sysErr, sysErrStr); return -1; } return 0; diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c index 79a38cad7a..503c56b1e7 100644 --- a/source/libs/sync/src/syncRespMgr.c +++ b/source/libs/sync/src/syncRespMgr.c @@ -36,21 +36,21 @@ SSyncRespMgr *syncRespMgrCreate(void *data, int64_t ttl) { taosThreadMutexInit(&(pObj->mutex), NULL); SSyncNode *pNode = pObj->data; - sTrace("vgId:%d, create resp manager", pNode->vgId); + sDebug("vgId:%d, resp manager create", pNode->vgId); return pObj; } void syncRespMgrDestroy(SSyncRespMgr *pObj) { - if (pObj != NULL) { - SSyncNode *pNode = pObj->data; - sTrace("vgId:%d, destroy resp manager", pNode->vgId); + if (pObj == NULL) return; - taosThreadMutexLock(&pObj->mutex); - taosHashCleanup(pObj->pRespHash); - taosThreadMutexUnlock(&pObj->mutex); - taosThreadMutexDestroy(&(pObj->mutex)); - taosMemoryFree(pObj); - } + SSyncNode *pNode = pObj->data; + sDebug("vgId:%d, resp manager destroy", pNode->vgId); + + taosThreadMutexLock(&pObj->mutex); + taosHashCleanup(pObj->pRespHash); + taosThreadMutexUnlock(&pObj->mutex); + taosThreadMutexDestroy(&(pObj->mutex)); + taosMemoryFree(pObj); } uint64_t syncRespMgrAdd(SSyncRespMgr *pObj, const SRespStub *pStub) { @@ -107,7 +107,7 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t seq, SRpcHandleInfo *p taosThreadMutexUnlock(&pObj->mutex); return 1; // get one object } else { - sNError(pObj->data, "get-and-del message handle, no object of seq:%" PRIu64, seq); + sNTrace(pObj->data, "get-and-del message handle, no object of seq:%" PRIu64, seq); } taosThreadMutexUnlock(&pObj->mutex); @@ -174,7 +174,7 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) { void syncRespCleanRsp(SSyncRespMgr *pObj) { SSyncNode *pNode = pObj->data; - sTrace("vgId:%d, clean all rsp", pNode->vgId); + sTrace("vgId:%d, clean all resp", pNode->vgId); taosThreadMutexLock(&pObj->mutex); syncRespCleanByTTL(pObj, -1, true); @@ -183,7 +183,7 @@ void syncRespCleanRsp(SSyncRespMgr *pObj) { void syncRespClean(SSyncRespMgr *pObj) { SSyncNode *pNode = pObj->data; - sTrace("vgId:%d, clean rsp by ttl", pNode->vgId); + sTrace("vgId:%d, clean resp by ttl", pNode->vgId); taosThreadMutexLock(&pObj->mutex); syncRespCleanByTTL(pObj, pObj->ttl, false); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 540f40a4c0..f2da2fb2ce 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -26,80 +26,69 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex) { bool condition = (pSyncNode->pFsm->FpSnapshotStartRead != NULL) && (pSyncNode->pFsm->FpSnapshotStopRead != NULL) && (pSyncNode->pFsm->FpSnapshotDoRead != NULL); + if (!condition) return NULL; - SSyncSnapshotSender *pSender = NULL; - if (condition) { - pSender = taosMemoryCalloc(1, sizeof(SSyncSnapshotSender)); - if (pSender == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; - } - - pSender->start = false; - pSender->seq = SYNC_SNAPSHOT_SEQ_INVALID; - pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID; - pSender->pReader = NULL; - pSender->pCurrentBlock = NULL; - pSender->blockLen = 0; - pSender->sendingMS = SYNC_SNAPSHOT_RETRY_MS; - pSender->pSyncNode = pSyncNode; - pSender->replicaIndex = replicaIndex; - pSender->term = pSyncNode->pRaftStore->currentTerm; - pSender->startTime = 0; - pSender->endTime = 0; - pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &(pSender->snapshot)); - pSender->finish = false; - } else { - sError("vgId:%d, cannot create snapshot sender", pSyncNode->vgId); + SSyncSnapshotSender *pSender = taosMemoryCalloc(1, sizeof(SSyncSnapshotSender)); + if (pSender == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; } + pSender->start = false; + pSender->seq = SYNC_SNAPSHOT_SEQ_INVALID; + pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID; + pSender->pReader = NULL; + pSender->pCurrentBlock = NULL; + pSender->blockLen = 0; + pSender->sendingMS = SYNC_SNAPSHOT_RETRY_MS; + pSender->pSyncNode = pSyncNode; + pSender->replicaIndex = replicaIndex; + pSender->term = pSyncNode->pRaftStore->currentTerm; + pSender->startTime = 0; + pSender->endTime = 0; + pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &pSender->snapshot); + pSender->finish = false; + return pSender; } void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { - if (pSender != NULL) { - // free current block - if (pSender->pCurrentBlock != NULL) { - taosMemoryFree(pSender->pCurrentBlock); - pSender->pCurrentBlock = NULL; - } + if (pSender == NULL) return; - // close reader - if (pSender->pReader != NULL) { - int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); - if (ret != 0) { - sNError(pSender->pSyncNode, "stop reader error"); - } - pSender->pReader = NULL; - } - - // free sender - taosMemoryFree(pSender); + // free current block + if (pSender->pCurrentBlock != NULL) { + taosMemoryFree(pSender->pCurrentBlock); + pSender->pCurrentBlock = NULL; } + + // close reader + if (pSender->pReader != NULL) { + pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); + pSender->pReader = NULL; + } + + // free sender + taosMemoryFree(pSender); } bool snapshotSenderIsStart(SSyncSnapshotSender *pSender) { return pSender->start; } int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { - ASSERT(!snapshotSenderIsStart(pSender)); - pSender->start = true; pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN; pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID; pSender->pReader = NULL; pSender->pCurrentBlock = NULL; pSender->blockLen = 0; - pSender->snapshotParam.start = SYNC_INDEX_INVALID; pSender->snapshotParam.end = SYNC_INDEX_INVALID; - pSender->snapshot.data = NULL; pSender->snapshotParam.end = SYNC_INDEX_INVALID; pSender->snapshot.lastApplyIndex = SYNC_INDEX_INVALID; pSender->snapshot.lastApplyTerm = SYNC_TERM_INVALID; pSender->snapshot.lastConfigIndex = SYNC_INDEX_INVALID; - memset(&(pSender->lastConfig), 0, sizeof(pSender->lastConfig)); + memset(&pSender->lastConfig, 0, sizeof(pSender->lastConfig)); pSender->sendingMS = 0; pSender->term = pSender->pSyncNode->pRaftStore->currentTerm; pSender->startTime = taosGetTimestampMs(); @@ -108,11 +97,14 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { // build begin msg SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSend(&rpcMsg, 0, pSender->pSyncNode->vgId); + if (syncBuildSnapshotSend(&rpcMsg, 0, pSender->pSyncNode->vgId) != 0) { + sSError(pSender, "snapshot sender build msg failed since %s", terrstr()); + return -1; + } SyncSnapshotSend *pMsg = rpcMsg.pCont; pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -122,16 +114,21 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { pMsg->startTime = pSender->startTime; pMsg->seq = SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT; - // send msg - syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); - // event log - sSTrace(pSender, "snapshot sender start"); + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender start"); + + // send msg + if (syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { + sSError(pSender, "snapshot sender send msg failed since %s", terrstr()); + return -1; + } + return 0; } -int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { +void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { + sSDebug(pSender, "snapshot sender stop, finish:%d reader:%p", finish, pSender->pReader); + // update flag pSender->start = false; pSender->finish = finish; @@ -139,8 +136,7 @@ int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { // close reader if (pSender->pReader != NULL) { - int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); - ASSERT(ret == 0); + pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); pSender->pReader = NULL; } @@ -150,10 +146,6 @@ int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { pSender->pCurrentBlock = NULL; pSender->blockLen = 0; } - - // event log - sSTrace(pSender, "snapshot sender stop"); - return 0; } // when sender receive ack, call this function to send msg from seq @@ -168,22 +160,31 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { // read data int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotDoRead(pSender->pSyncNode->pFsm, pSender->pReader, - &(pSender->pCurrentBlock), &(pSender->blockLen)); - ASSERT(ret == 0); + &pSender->pCurrentBlock, &pSender->blockLen); + if (ret != 0) { + sSError(pSender, "snapshot sender read failed since %s", terrstr()); + return -1; + } + if (pSender->blockLen > 0) { // has read data + sSDebug(pSender, "snapshot sender continue to read, blockLen:%d seq:%d", pSender->blockLen, pSender->seq); } else { // read finish, update seq to end pSender->seq = SYNC_SNAPSHOT_SEQ_END; + sSInfo(pSender, "snapshot sender read to the end, blockLen:%d seq:%d", pSender->blockLen, pSender->seq); } // build msg SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId); + if (syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId) != 0) { + sSError(pSender, "snapshot sender build msg failed since %s", pSender->pSyncNode->vgId, terrstr()); + return -1; + } SyncSnapshotSend *pMsg = rpcMsg.pCont; pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -192,38 +193,39 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { pMsg->lastConfig = pSender->lastConfig; pMsg->seq = pSender->seq; - // pMsg->privateTerm = pSender->privateTerm; - if (pSender->pCurrentBlock != NULL) { memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); } - // send msg - syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); - - pSender->lastSendTime = taosGetTimestampMs(); - // event log if (pSender->seq == SYNC_SNAPSHOT_SEQ_END) { - sSTrace(pSender, "snapshot sender finish"); + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender finish"); } else { - sSTrace(pSender, "snapshot sender sending"); + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender sending"); } + + // send msg + if (syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { + sSError(pSender, "snapshot sender send msg failed since %s", terrstr()); + return -1; + } + + pSender->lastSendTime = taosGetTimestampMs(); return 0; } // send snapshot data from cache int32_t snapshotReSend(SSyncSnapshotSender *pSender) { - // send current block data - // build msg SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId); + if (syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId) != 0) { + sSError(pSender, "snapshot sender build msg failed since %s", terrstr()); + return -1; + } SyncSnapshotSend *pMsg = rpcMsg.pCont; pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -233,61 +235,63 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) { pMsg->seq = pSender->seq; if (pSender->pCurrentBlock != NULL && pSender->blockLen > 0) { - // pMsg->privateTerm = pSender->privateTerm; memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); } + // event log + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender resend"); + // send msg - syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); + if (syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { + sSError(pSender, "snapshot sender resend msg failed since %s", terrstr()); + return -1; + } pSender->lastSendTime = taosGetTimestampMs(); - - // event log - sSTrace(pSender, "snapshot sender resend"); - return 0; } -static void snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { - ASSERT(pMsg->ack == pSender->seq); +static int32_t snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { + if (pMsg->ack != pSender->seq) { + sSError(pSender, "snapshot sender update seq failed, ack:%d seq:%d", pMsg->ack, pSender->seq); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; + } + pSender->ack = pMsg->ack; - ++(pSender->seq); + pSender->seq++; + + sSDebug(pSender, "snapshot sender update seq:%d", pSender->seq); + return 0; } // return 0, start ok // return 1, last snapshot finish ok // return -1, error int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { - sNTrace(pSyncNode, "starting snapshot ..."); + sNInfo(pSyncNode, "snapshot sender starting ..."); SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, pDestId); if (pSender == NULL) { - sNError(pSyncNode, "start snapshot error, sender is null"); + sNError(pSyncNode, "snapshot sender start error since get failed"); return -1; } - int32_t code = 0; - if (snapshotSenderIsStart(pSender)) { - sNTrace(pSyncNode, "snapshot sender already start, ignore"); + sSInfo(pSender, "snapshot sender already start, ignore"); return 0; } - if (!snapshotSenderIsStart(pSender) && pSender->finish && - taosGetTimestampMs() - pSender->endTime < SNAPSHOT_WAIT_MS) { - sNTrace(pSyncNode, "snapshot sender too frequently, ignore"); - return 1; + if (pSender->finish && taosGetTimestampMs() - pSender->endTime < SNAPSHOT_WAIT_MS) { + sSInfo(pSender, "snapshot sender start too frequently, ignore"); + return 0; } - char host[64]; - uint16_t port; - syncUtilU642Addr(pDestId->addr, host, sizeof(host), &port); - sInfo("vgId:%d, start snapshot for peer: %s:%d", pSyncNode->vgId, host, port); + sSInfo(pSender, "snapshot sender start"); - code = snapshotSenderStart(pSender); + int32_t code = snapshotSenderStart(pSender); if (code != 0) { - sNError(pSyncNode, "snapshot sender start error"); + sSError(pSender, "snapshot sender start error since %s", terrstr()); return -1; } @@ -297,70 +301,70 @@ int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId fromId) { bool condition = (pSyncNode->pFsm->FpSnapshotStartWrite != NULL) && (pSyncNode->pFsm->FpSnapshotStopWrite != NULL) && (pSyncNode->pFsm->FpSnapshotDoWrite != NULL); + if (!condition) return NULL; - SSyncSnapshotReceiver *pReceiver = NULL; - if (condition) { - pReceiver = taosMemoryCalloc(1, sizeof(SSyncSnapshotReceiver)); - if (pReceiver == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; - } - - pReceiver->start = false; - pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; - pReceiver->pWriter = NULL; - pReceiver->pSyncNode = pSyncNode; - pReceiver->fromId = fromId; - pReceiver->term = pSyncNode->pRaftStore->currentTerm; - pReceiver->snapshot.data = NULL; - pReceiver->snapshot.lastApplyIndex = SYNC_INDEX_INVALID; - pReceiver->snapshot.lastApplyTerm = 0; - pReceiver->snapshot.lastConfigIndex = SYNC_INDEX_INVALID; - - } else { - sError("vgId:%d, cannot create snapshot receiver", pSyncNode->vgId); + SSyncSnapshotReceiver *pReceiver = taosMemoryCalloc(1, sizeof(SSyncSnapshotReceiver)); + if (pReceiver == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; } + pReceiver->start = false; + pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; + pReceiver->pWriter = NULL; + pReceiver->pSyncNode = pSyncNode; + pReceiver->fromId = fromId; + pReceiver->term = pSyncNode->pRaftStore->currentTerm; + pReceiver->snapshot.data = NULL; + pReceiver->snapshot.lastApplyIndex = SYNC_INDEX_INVALID; + pReceiver->snapshot.lastApplyTerm = 0; + pReceiver->snapshot.lastConfigIndex = SYNC_INDEX_INVALID; + return pReceiver; } void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) { - if (pReceiver != NULL) { - // close writer - if (pReceiver->pWriter != NULL) { - int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, - false, &(pReceiver->snapshot)); - ASSERT(ret == 0); - pReceiver->pWriter = NULL; - } + if (pReceiver == NULL) return; - // free receiver - taosMemoryFree(pReceiver); + // close writer + if (pReceiver->pWriter != NULL) { + int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, + &pReceiver->snapshot); + if (ret != 0) { + sError("vgId:%d, snapshot receiver stop failed while destroy since %s", pReceiver->pSyncNode->vgId, terrstr()); + } + pReceiver->pWriter = NULL; } + + // free receiver + taosMemoryFree(pReceiver); } bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver) { return pReceiver->start; } // force stop void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { + sRInfo(pReceiver, "snapshot receiver force stop, writer:%p"); + // force close, abandon incomplete data if (pReceiver->pWriter != NULL) { - // event log - sRTrace(pReceiver, "snapshot receiver force stop"); int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, - &(pReceiver->snapshot)); - ASSERT(ret == 0); + &pReceiver->snapshot); + if (ret != 0) { + sRInfo(pReceiver, "snapshot receiver force stop failed since %s", terrstr()); + } pReceiver->pWriter = NULL; } pReceiver->start = false; - - // event log - // sRTrace(pReceiver, "snapshot receiver force stop"); } -int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { - ASSERT(snapshotReceiverIsStart(pReceiver)); +static int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { + if (pReceiver->pWriter != NULL) { + sRError(pReceiver, "vgId:%d, snapshot receiver writer is not null"); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; + } // update ack pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; @@ -369,26 +373,26 @@ int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapsh pReceiver->snapshot.lastApplyIndex = pBeginMsg->lastIndex; pReceiver->snapshot.lastApplyTerm = pBeginMsg->lastTerm; pReceiver->snapshot.lastConfigIndex = pBeginMsg->lastConfigIndex; - pReceiver->snapshotParam.start = pBeginMsg->beginIndex; pReceiver->snapshotParam.end = pBeginMsg->lastIndex; // start writer - ASSERT(pReceiver->pWriter == NULL); - int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, - &(pReceiver->snapshotParam), &(pReceiver->pWriter)); - ASSERT(ret == 0); + int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, &pReceiver->snapshotParam, + &pReceiver->pWriter); + if (ret != 0) { + sRError(pReceiver, "snapshot receiver start write failed since %s", terrstr()); + return -1; + } // event log - sRTrace(pReceiver, "snapshot receiver start writer"); - + sRInfo(pReceiver, "snapshot receiver start write"); return 0; } -int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pPreMsg) { +void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pPreMsg) { if (snapshotReceiverIsStart(pReceiver)) { - sWarn("vgId:%d, snapshot receiver has started.", pReceiver->pSyncNode->vgId); - return 0; + sRInfo(pReceiver, "snapshot receiver has started"); + return; } pReceiver->start = true; @@ -398,49 +402,49 @@ int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend pReceiver->startTime = pPreMsg->startTime; // event log - sRTrace(pReceiver, "snapshot receiver start"); - - return 0; + sRInfo(pReceiver, "snapshot receiver is start"); } // just set start = false // FpSnapshotStopWrite should not be called, assert writer == NULL -int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { +void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { + sRInfo(pReceiver, "snapshot receiver stop, not apply, writer:%p", pReceiver->pWriter); + if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, - &(pReceiver->snapshot)); - ASSERT(ret == 0); + &pReceiver->snapshot); + if (ret != 0) { + sRError(pReceiver, "snapshot receiver stop write failed since %s", terrstr()); + } pReceiver->pWriter = NULL; + } else { + sRInfo(pReceiver, "snapshot receiver stop, writer is null"); } pReceiver->start = false; - - // event log - sRTrace(pReceiver, "snapshot receiver stop"); - return 0; } // when recv last snapshot block, apply data into snapshot static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { - ASSERT(pMsg->seq == SYNC_SNAPSHOT_SEQ_END); - int32_t code = 0; if (pReceiver->pWriter != NULL) { // write data + sRInfo(pReceiver, "snapshot receiver write finish, blockLen:%d seq:%d", pMsg->dataLen, pMsg->seq); if (pMsg->dataLen > 0) { code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, pMsg->dataLen); if (code != 0) { - sNError(pReceiver->pSyncNode, "snapshot write error"); + sRError(pReceiver, "failed to finish snapshot receiver write since %s", terrstr()); return -1; } } // reset wal + sRInfo(pReceiver, "snapshot receiver log restore"); code = pReceiver->pSyncNode->pLogStore->syncLogRestoreFromSnapshot(pReceiver->pSyncNode->pLogStore, pMsg->lastIndex); if (code != 0) { - sNError(pReceiver->pSyncNode, "wal restore from snapshot error"); + sRError(pReceiver, "failed to snapshot receiver log restore since %s", terrstr()); return -1; } @@ -456,10 +460,11 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap } // stop writer, apply data + sRInfo(pReceiver, "snapshot receiver apply write"); code = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, true, - &(pReceiver->snapshot)); + &pReceiver->snapshot); if (code != 0) { - sNError(pReceiver->pSyncNode, "snapshot stop writer true error"); + sRError(pReceiver, "snapshot receiver apply failed since %s", terrstr()); return -1; } pReceiver->pWriter = NULL; @@ -468,34 +473,48 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap pReceiver->ack = SYNC_SNAPSHOT_SEQ_END; } else { - sNError(pReceiver->pSyncNode, "snapshot stop writer true error"); + sRError(pReceiver, "snapshot receiver finish error since writer is null"); return -1; } // event log - sRTrace(pReceiver, "snapshot receiver got last data, finish, apply snapshot"); + sRInfo(pReceiver, "snapshot receiver got last data and apply snapshot finished"); return 0; } // apply data block // update progress -static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { - ASSERT(pMsg->seq == pReceiver->ack + 1); - - if (pReceiver->pWriter != NULL) { - if (pMsg->dataLen > 0) { - // apply data block - int32_t code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, - pMsg->data, pMsg->dataLen); - ASSERT(code == 0); - } - - // update progress - pReceiver->ack = pMsg->seq; - - // event log - sRTrace(pReceiver, "snapshot receiver receiving"); +static int32_t snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { + if (pMsg->seq != pReceiver->ack + 1) { + sRError(pReceiver, "snapshot receiver invalid seq, ack:%d seq:%d", pReceiver->ack, pMsg->seq); + terrno = TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG; + return -1; } + + if (pReceiver->pWriter == NULL) { + sRError(pReceiver, "snapshot receiver failed to write data since writer is null"); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; + } + + sRDebug(pReceiver, "snapshot receiver continue to write, blockLen:%d seq:%d", pMsg->dataLen, pMsg->seq); + + if (pMsg->dataLen > 0) { + // apply data block + int32_t code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, + pMsg->data, pMsg->dataLen); + if (code != 0) { + sRError(pReceiver, "snapshot receiver continue write failed since %s", terrstr()); + return -1; + } + } + + // update progress + pReceiver->ack = pMsg->seq; + + // event log + sRDebug(pReceiver, "snapshot receiver continue to write finish"); + return 0; } SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) { @@ -503,7 +522,7 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) { if (syncNodeIsMnode(ths)) { snapStart = SYNC_INDEX_BEGIN; - + sNInfo(ths, "snapshot begin index is %" PRId64 " since its mnode", snapStart); } else { SSyncLogStoreData *pData = ths->pLogStore->data; SWal *pWal = pData->pWal; @@ -518,6 +537,8 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) { } else { snapStart = ths->commitIndex + 1; } + + sNInfo(ths, "snapshot begin index is %" PRId64, snapStart); } return snapStart; @@ -525,41 +546,50 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) { static int32_t syncNodeOnSnapshotPre(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; + int64_t timeNow = taosGetTimestampMs(); + int32_t code = 0; if (snapshotReceiverIsStart(pReceiver)) { // already start - if (pMsg->startTime > pReceiver->startTime) { + sRInfo(pReceiver, "snapshot receiver startTime:%" PRId64 " > msg startTime:%" PRId64 " start receiver", + pReceiver->startTime, pMsg->startTime); goto _START_RECEIVER; - } else if (pMsg->startTime == pReceiver->startTime) { + sRInfo(pReceiver, "snapshot receiver startTime:%" PRId64 " == msg startTime:%" PRId64 " send reply", + pReceiver->startTime, pMsg->startTime); goto _SEND_REPLY; - } else { // ignore - return 0; + sRError(pReceiver, "snapshot receiver startTime:%" PRId64 " < msg startTime:%" PRId64 " ignore", + pReceiver->startTime, pMsg->startTime); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + code = terrno; + goto _SEND_REPLY; } - } else { // start new + sRInfo(pReceiver, "snapshot receiver not start yet so start new one"); goto _START_RECEIVER; } _START_RECEIVER: - if (taosGetTimestampMs() - pMsg->startTime > SNAPSHOT_MAX_CLOCK_SKEW_MS) { - sNError(pSyncNode, "snapshot receiver time skew too much"); - return -1; + if (timeNow - pMsg->startTime > SNAPSHOT_MAX_CLOCK_SKEW_MS) { + sRError(pReceiver, "snapshot receiver time skew too much, now:%" PRId64 " msg startTime:%" PRId64, timeNow, + pMsg->startTime); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + code = terrno; } else { // waiting for clock match - int64_t timeNow = taosGetTimestampMs(); while (timeNow < pMsg->startTime) { - sNTrace(pSyncNode, "snapshot receiver pre waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, - pMsg->startTime); + sRInfo(pReceiver, "snapshot receiver pre waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, + pMsg->startTime); taosMsleep(10); timeNow = taosGetTimestampMs(); } if (snapshotReceiverIsStart(pReceiver)) { + sRInfo(pReceiver, "snapshot receiver already start and force stop pre one"); snapshotReceiverForceStop(pReceiver); } @@ -571,7 +601,10 @@ _SEND_REPLY: ; // make complier happy SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId); + if (syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId) != 0) { + sRError(pReceiver, "snapshot receiver failed to build resp since %s", terrstr()); + return -1; + } SyncSnapshotRsp *pRspMsg = rpcMsg.pCont; pRspMsg->srcId = pSyncNode->myRaftId; @@ -581,35 +614,53 @@ _SEND_REPLY: pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pMsg->seq; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = syncNodeGetSnapBeginIndex(pSyncNode); // send msg - syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); - return 0; + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, "snapshot receiver pre-snapshot"); + if (syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg) != 0) { + sRError(pReceiver, "snapshot receiver failed to build resp since %s", terrstr()); + return -1; + } + + return code; } static int32_t syncNodeOnSnapshotBegin(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { // condition 1 SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; + int32_t code = TSDB_CODE_SYN_INTERNAL_ERROR; if (!snapshotReceiverIsStart(pReceiver)) { - sNError(pSyncNode, "snapshot receiver not start"); - return -1; + sRError(pReceiver, "snapshot receiver begin failed since not start"); + goto _SEND_REPLY; } if (pReceiver->startTime != pMsg->startTime) { - sNError(pSyncNode, "snapshot receiver time not equal"); - return -1; + sRError(pReceiver, "snapshot receiver begin failed since startTime:%" PRId64 " not equal to msg startTime:%" PRId64, + pReceiver->startTime, pMsg->startTime); + goto _SEND_REPLY; } // start writer - snapshotReceiverStartWriter(pReceiver, pMsg); + if (snapshotReceiverStartWriter(pReceiver, pMsg) != 0) { + sRError(pReceiver, "snapshot receiver begin failed since start writer failed"); + goto _SEND_REPLY; + } + + code = 0; +_SEND_REPLY: + if (code != 0 && terrno != 0) { + code = terrno; + } // build msg SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId); + if (syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId) != 0) { + sRError(pReceiver, "snapshot receiver build resp failed since %s", terrstr()); + return -1; + } SyncSnapshotRsp *pRspMsg = rpcMsg.pCont; pRspMsg->srcId = pSyncNode->myRaftId; @@ -619,16 +670,20 @@ static int32_t syncNodeOnSnapshotBegin(SSyncNode *pSyncNode, SyncSnapshotSend *p pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pReceiver->ack; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; // send msg - syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); - return 0; + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, "snapshot receiver begin"); + if (syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg) != 0) { + sRError(pReceiver, "snapshot receiver send resp failed since %s", terrstr()); + return -1; + } + + return code; } -static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { +static int32_t syncNodeOnSnapshotReceive(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { // condition 4 // transfering SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; @@ -636,18 +691,26 @@ static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotS // waiting for clock match int64_t timeNow = taosGetTimestampMs(); while (timeNow < pMsg->startTime) { - sNTrace(pSyncNode, "snapshot receiver transfering waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, - pMsg->startTime); + sRInfo(pReceiver, "snapshot receiver receiving waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, + pMsg->startTime); taosMsleep(10); + timeNow = taosGetTimestampMs(); } - if (pMsg->seq == pReceiver->ack + 1) { - snapshotReceiverGotData(pReceiver, pMsg); + int32_t code = 0; + if (snapshotReceiverGotData(pReceiver, pMsg) != 0) { + code = terrno; + if (code >= SYNC_SNAPSHOT_SEQ_INVALID) { + code = TSDB_CODE_SYN_INTERNAL_ERROR; + } } // build msg SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId); + if (syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId)) { + sRError(pReceiver, "snapshot receiver build resp failed since %s", terrstr()); + return -1; + } SyncSnapshotRsp *pRspMsg = rpcMsg.pCont; pRspMsg->srcId = pSyncNode->myRaftId; @@ -657,13 +720,17 @@ static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotS pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pReceiver->ack; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; // send msg - syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); - return 0; + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, "snapshot receiver received"); + if (syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg) != 0) { + sRError(pReceiver, "snapshot receiver send resp failed since %s", terrstr()); + return -1; + } + + return code; } static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { @@ -674,8 +741,8 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs // waiting for clock match int64_t timeNow = taosGetTimestampMs(); while (timeNow < pMsg->startTime) { - sNTrace(pSyncNode, "snapshot receiver finish waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, - pMsg->startTime); + sRInfo(pReceiver, "snapshot receiver finish waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, + pMsg->startTime); taosMsleep(10); timeNow = taosGetTimestampMs(); } @@ -687,7 +754,10 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs // build msg SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId); + if (syncBuildSnapshotSendRsp(&rpcMsg, pSyncNode->vgId) != 0) { + sRError(pReceiver, "snapshot receiver build rsp failed since %s", terrstr()); + return -1; + } SyncSnapshotRsp *pRspMsg = rpcMsg.pCont; pRspMsg->srcId = pSyncNode->myRaftId; @@ -697,13 +767,17 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pReceiver->ack; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; // send msg - syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); - return 0; + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, "snapshot receiver end"); + if (syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg) != 0) { + sRError(pReceiver, "snapshot receiver send rsp failed since %s", terrstr()); + return -1; + } + + return code; } // receiver on message @@ -727,17 +801,20 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs // condition 5, got data, update ack // int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { - SyncSnapshotSend *pMsg = pRpcMsg->pCont; + SyncSnapshotSend *pMsg = pRpcMsg->pCont; + SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; // if already drop replica, do not process - if (!syncNodeInRaftGroup(pSyncNode, &(pMsg->srcId))) { + if (!syncNodeInRaftGroup(pSyncNode, &pMsg->srcId)) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "not in my config"); - return 0; + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; } if (pMsg->term < pSyncNode->pRaftStore->currentTerm) { - syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "reject, small term"); - return 0; + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "reject since small term"); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; } if (pMsg->term > pSyncNode->pRaftStore->currentTerm) { @@ -745,68 +822,64 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { } syncNodeResetElectTimer(pSyncNode); - int32_t code = 0; - SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; - - syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, ""); - // state, term, seq/ack + int32_t code = 0; if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) { if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) { - syncNodeOnSnapshotPre(pSyncNode, pMsg); - + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq pre-snapshot"); + code = syncNodeOnSnapshotPre(pSyncNode, pMsg); } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) { - syncNodeOnSnapshotBegin(pSyncNode, pMsg); - + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq begin"); + code = syncNodeOnSnapshotBegin(pSyncNode, pMsg); } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) { - syncNodeOnSnapshotEnd(pSyncNode, pMsg); - (void)syncLogBufferReInit(pSyncNode->pLogBuf, pSyncNode); - + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq end"); + code = syncNodeOnSnapshotEnd(pSyncNode, pMsg); + if (syncLogBufferReInit(pSyncNode->pLogBuf, pSyncNode) != 0) { + sRError(pReceiver, "failed to reinit log buffer since %s", terrstr()); + code = -1; + } } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_FORCE_CLOSE) { // force close, no response + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process force stop"); snapshotReceiverForceStop(pReceiver); - } else if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) { - syncNodeOnSnapshotTransfering(pSyncNode, pMsg); - + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq data"); + code = syncNodeOnSnapshotReceive(pSyncNode, pMsg); } else { // error log - sRTrace(pReceiver, "snapshot receiver recv error seq:%d, my ack:%d", pMsg->seq, pReceiver->ack); - return -1; + sRError(pReceiver, "snapshot receiver recv error seq:%d, my ack:%d", pMsg->seq, pReceiver->ack); + code = -1; } - } else { // error log - sRTrace(pReceiver, "snapshot receiver term not equal"); - return -1; + sRError(pReceiver, "snapshot receiver term not equal"); + code = -1; } } else { // error log - sRTrace(pReceiver, "snapshot receiver not follower"); - return -1; + sRError(pReceiver, "snapshot receiver not follower"); + code = -1; } - return 0; + return code; } -int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { - // get sender - SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId)); - ASSERT(pSender != NULL); - - SSnapshot snapshot; +static int32_t syncNodeOnSnapshotPreRsp(SSyncNode *pSyncNode, SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { + SSnapshot snapshot = {0}; pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); // prepare pSender->snapshotParam.start = pMsg->snapBeginIndex; pSender->snapshotParam.end = snapshot.lastApplyIndex; - sNTrace(pSyncNode, "prepare snapshot, recv-begin:%" PRId64 ", snapshot.last:%" PRId64 ", snapshot.term:%" PRId64, - pMsg->snapBeginIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm); + sSInfo(pSender, "prepare snapshot, recv-begin:%" PRId64 ", snapshot.last:%" PRId64 ", snapshot.term:%" PRId64, + pMsg->snapBeginIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm); if (pMsg->snapBeginIndex > snapshot.lastApplyIndex) { - sNError(pSyncNode, "snapshot last index too small"); + sSError(pSender, "prepare snapshot failed since beginIndex:%d larger than applyIndex:%d", pMsg->snapBeginIndex, + snapshot.lastApplyIndex); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; return -1; } @@ -814,9 +887,9 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) pSender->snapshot = snapshot; // start reader - int32_t code = pSyncNode->pFsm->FpSnapshotStartRead(pSyncNode->pFsm, &(pSender->snapshotParam), &(pSender->pReader)); + int32_t code = pSyncNode->pFsm->FpSnapshotStartRead(pSyncNode->pFsm, &pSender->snapshotParam, &pSender->pReader); if (code != 0) { - sNError(pSyncNode, "create snapshot reader error"); + sSError(pSender, "prepare snapshot failed since %s", terrstr()); return -1; } @@ -828,11 +901,14 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) // build begin msg SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSend(&rpcMsg, 0, pSender->pSyncNode->vgId); + if (syncBuildSnapshotSend(&rpcMsg, 0, pSender->pSyncNode->vgId) != 0) { + sSError(pSender, "prepare snapshot failed since build msg error"); + return -1; + } SyncSnapshotSend *pSendMsg = rpcMsg.pCont; pSendMsg->srcId = pSender->pSyncNode->myRaftId; - pSendMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pSendMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pSendMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pSendMsg->beginIndex = pSender->snapshotParam.start; pSendMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -843,8 +919,11 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) pSendMsg->seq = SYNC_SNAPSHOT_SEQ_BEGIN; // send msg - syncNodeSendMsgById(&pSendMsg->destId, pSender->pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotSend(pSyncNode, pSendMsg, ""); + syncLogSendSyncSnapshotSend(pSyncNode, pSendMsg, "snapshot sender reply pre"); + if (syncNodeSendMsgById(&pSendMsg->destId, pSender->pSyncNode, &rpcMsg) != 0) { + sSError(pSender, "prepare snapshot failed since send msg error"); + return -1; + } return 0; } @@ -855,76 +934,114 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) // condition 2 sender receives ack, set seq = ack + 1, send msg from seq // condition 3 sender receives error msg, just print error log // -int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { +int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { SyncSnapshotRsp *pMsg = pRpcMsg->pCont; // if already drop replica, do not process - if (!syncNodeInRaftGroup(pSyncNode, &(pMsg->srcId))) { + if (!syncNodeInRaftGroup(pSyncNode, &pMsg->srcId)) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "maybe replica already dropped"); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; return -1; } // get sender - SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId)); - ASSERT(pSender != NULL); - - if (pMsg->startTime != pSender->startTime) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "sender/receiver start time not match"); + SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &pMsg->srcId); + if (pSender == NULL) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "sender is null"); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; return -1; } - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, ""); - // state, term, seq/ack - if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) { - if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { - // prepare , send begin msg - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) { - syncNodeOnSnapshotReplyPre(pSyncNode, pMsg); - return 0; - } + if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender not leader"); + sSError(pSender, "snapshot sender not leader"); + terrno = TSDB_CODE_SYN_NOT_LEADER; + goto _ERROR; + } - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_BEGIN) { - snapshotSenderUpdateProgress(pSender, pMsg); - snapshotSend(pSender); - return 0; - } + if (pMsg->startTime != pSender->startTime) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver time not match"); + sSError(pSender, "sender:%" PRId64 " receiver:%" PRId64 " time not match, code:0x%x", pMsg->startTime, + pSender->startTime, pMsg->code); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + goto _ERROR; + } - // receive ack is finish, close sender - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { - snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - if (pMgr) { - syncLogReplMgrReset(pMgr); - } - return 0; - } + if (pMsg->term != pSyncNode->pRaftStore->currentTerm) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver term not match"); + sSError(pSender, "snapshot sender term not equal, msg term:%" PRId64 " currentTerm:%" PRId64, pMsg->term, + pSyncNode->pRaftStore->currentTerm); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + goto _ERROR; + } - // send next msg - if (pMsg->ack == pSender->seq) { - // update sender ack - snapshotSenderUpdateProgress(pSender, pMsg); - snapshotSend(pSender); + if (pMsg->code != 0) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error code"); + sSError(pSender, "snapshot sender receive error code:0x%x and stop sender", pMsg->code); + terrno = pMsg->code; + goto _ERROR; + } - } else if (pMsg->ack == pSender->seq - 1) { - // maybe resend - snapshotReSend(pSender); + // prepare , send begin msg + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq pre-snapshot"); + return syncNodeOnSnapshotPreRsp(pSyncNode, pSender, pMsg); + } - } else { - // error log - sSError(pSender, "snapshot sender recv error ack:%d, my seq:%d", pMsg->ack, pSender->seq); - return -1; - } - } else { - // error log - sSError(pSender, "snapshot sender term not equal"); + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_BEGIN) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq begin"); + if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { + return -1; + } + + if (snapshotSend(pSender) != 0) { + return -1; + } + return 0; + } + + // receive ack is finish, close sender + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); + snapshotSenderStop(pSender, true); + SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); + syncLogReplMgrReset(pMgr); + return 0; + } + + // send next msg + if (pMsg->ack == pSender->seq) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq data"); + // update sender ack + if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { + return -1; + } + if (snapshotSend(pSender) != 0) { + return -1; + } + } else if (pMsg->ack == pSender->seq - 1) { + // maybe resend + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq and resend"); + if (snapshotReSend(pSender) != 0) { return -1; } } else { // error log - sSError(pSender, "snapshot sender not leader"); + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack"); + sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq); + snapshotSenderStop(pSender, true); + SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); + syncLogReplMgrReset(pMgr); return -1; } return 0; + +_ERROR: + snapshotSenderStop(pSender, true); + SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); + syncLogReplMgrReset(pMgr); + + return -1; } diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index a034e6ad83..49a24bebde 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -277,14 +277,12 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo if (pNode != NULL && pNode->pRaftCfg != NULL) { taosPrintLog(flags, level, dflag, - "vgId:%d, sync %s " - "%s" - ", term:%" PRIu64 ", commit-index:%" PRId64 ", first-ver:%" PRId64 ", last-ver:%" PRId64 - ", min:%" PRId64 ", snap:%" PRId64 ", snap-term:%" PRIu64 + "vgId:%d, %s, sync:%s, term:%" PRIu64 ", commit-index:%" PRId64 ", first-ver:%" PRId64 + ", last-ver:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64 ", snap-term:%" PRIu64 ", elect-times:%d, as-leader-times:%d, cfg-ch-times:%d, hit:%d, mis:%d, hb-slow:%d, hbr-slow:%d, " "aq-items:%d, snaping:%" PRId64 ", replicas:%d, last-cfg:%" PRId64 ", chging:%d, restore:%d, quorum:%d, elect-lc-timer:%" PRId64 ", hb:%" PRId64 ", %s, %s, %s, %s", - pNode->vgId, syncStr(pNode->state), eventLog, currentTerm, pNode->commitIndex, logBeginIndex, + pNode->vgId, eventLog, syncStr(pNode->state), currentTerm, pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->electNum, pNode->becomeLeaderNum, pNode->configChangeNum, cacheHit, cacheMiss, pNode->hbSlowNum, pNode->hbrSlowNum, aqItems, pNode->snapshottingIndex, pNode->replicaNum, @@ -330,13 +328,13 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla va_end(argpointer); taosPrintLog(flags, level, dflag, - "vgId:%d, sync %s " - "%s {%p s-param:%" PRId64 " e-param:%" PRId64 " laindex:%" PRId64 " laterm:%" PRIu64 " lcindex:%" PRId64 + "vgId:%d, %s, sync:%s, {%p s-param:%" PRId64 " e-param:%" PRId64 " laindex:%" PRId64 " laterm:%" PRIu64 + " lcindex:%" PRId64 " seq:%d ack:%d finish:%d replica-index:%d %s:%d}" ", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64 ", snap-tm:%" PRIu64 ", sby:%d, stgy:%d, bch:%d, r-num:%d, lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s", - pNode->vgId, syncStr(pNode->state), eventLog, pSender, pSender->snapshotParam.start, + pNode->vgId, eventLog, syncStr(pNode->state), pSender, pSender->snapshotParam.start, pSender->snapshotParam.end, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm, pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack, pSender->finish, pSender->replicaIndex, host, port, pNode->pRaftStore->currentTerm, pNode->commitIndex, logBeginIndex, logLastIndex, @@ -382,14 +380,14 @@ void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t df va_end(argpointer); taosPrintLog(flags, level, dflag, - "vgId:%d, sync %s " - "%s {%p start:%d ack:%d term:%" PRIu64 " start-time:%" PRId64 " from:%s:%d s-param:%" PRId64 + "vgId:%d, %s, sync:%s," + " {%p start:%d ack:%d term:%" PRIu64 " start-time:%" PRId64 " from:%s:%d s-param:%" PRId64 " e-param:%" PRId64 " laindex:%" PRId64 " laterm:%" PRIu64 " lcindex:%" PRId64 "}" ", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64 ", snap-tm:%" PRIu64 ", sby:%d, stgy:%d, bch:%d, r-num:%d, lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s", - pNode->vgId, syncStr(pNode->state), eventLog, pReceiver, pReceiver->start, pReceiver->ack, + pNode->vgId, eventLog, syncStr(pNode->state), pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term, pReceiver->startTime, host, port, pReceiver->snapshotParam.start, pReceiver->snapshotParam.end, pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex, pNode->pRaftStore->currentTerm, pNode->commitIndex, logBeginIndex, @@ -520,95 +518,56 @@ void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* p port, pMsg->term, pMsg->timeStamp, s, timeDiff); } -void syncLogSendSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; - - char host[64]; - uint16_t port; - syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, "send sync-pre-snapshot to %s:%d {term:%" PRId64 "}, %s", host, port, pMsg->term, s); -} - -void syncLogRecvSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; - - char host[64]; - uint16_t port; - syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, "recv sync-pre-snapshot from %s:%d {term:%" PRId64 "}, %s", host, port, pMsg->term, s); -} - -void syncLogSendSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; - - char host[64]; - uint16_t port; - syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, "send sync-pre-snapshot-reply to %s:%d {term:%" PRId64 ", snap-start:%" PRId64 "}, %s", host, port, - pMsg->term, pMsg->snapStart, s); -} - -void syncLogRecvSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; - - char host[64]; - uint16_t port; - syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, "recv sync-pre-snapshot-reply from %s:%d {term:%" PRId64 ", snap-start:%" PRId64 "}, %s", host, - port, pMsg->term, pMsg->snapStart, s); -} - void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; + if (!(sDebugFlag & DEBUG_DEBUG)) return; char host[64]; uint16_t port; syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, - "send sync-snapshot-send to %s:%d {term:%" PRId64 ", begin:%" PRId64 ", end:%" PRId64 ", lterm:%" PRId64 - ", stime:%" PRId64 ", seq:%d}, %s", - host, port, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->seq, s); + sNDebug(pSyncNode, + "send sync-snapshot-send to %s:%u, %s, seq:%d, term:%" PRId64 ", begin:%" PRId64 ", end:%" PRId64 + ", lterm:%" PRId64 ", stime:%" PRId64, + host, port, s, pMsg->seq, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime); } void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; + if (!(sDebugFlag & DEBUG_DEBUG)) return; char host[64]; uint16_t port; syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, - "recv sync-snapshot-send from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 - ", stime:%" PRId64 ", seq:%d, len:%u}, %s", - host, port, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->seq, - pMsg->dataLen, s); + sNDebug(pSyncNode, + "recv sync-snapshot-send from %s:%u, %s, seq:%d, term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 + ", lterm:%" PRId64 ", stime:%" PRId64 ", len:%u", + host, port, s, pMsg->seq, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, + pMsg->dataLen); } void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; - + if (!(sDebugFlag & DEBUG_DEBUG)) return; char host[64]; uint16_t port; syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, - "send sync-snapshot-rsp to %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 - ", stime:%" PRId64 ", ack:%d}, %s", - host, port, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->ack, s); + sNDebug(pSyncNode, + "send sync-snapshot-rsp to %s:%u, %s, ack:%d, term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 + ", lterm:%" PRId64 ", stime:%" PRId64, + host, port, s, pMsg->ack, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime); } void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) { - if (!(sDebugFlag & DEBUG_TRACE)) return; + if (!(sDebugFlag & DEBUG_DEBUG)) return; char host[64]; uint16_t port; syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port); - sNTrace(pSyncNode, - "recv sync-snapshot-rsp from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 - ", stime:%" PRId64 ", ack:%d}, %s", - host, port, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->ack, s); + sNDebug(pSyncNode, + "recv sync-snapshot-rsp from %s:%u, %s, ack:%d, term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 + ", lterm:%" PRId64 ", stime:%" PRId64, + host, port, s, pMsg->ack, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime); } void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) { diff --git a/source/libs/sync/test/syncRaftLogTest2.cpp b/source/libs/sync/test/syncRaftLogTest2.cpp index a7752dcb8b..de9137fbe1 100644 --- a/source/libs/sync/test/syncRaftLogTest2.cpp +++ b/source/libs/sync/test/syncRaftLogTest2.cpp @@ -47,7 +47,7 @@ void init() { pSyncNode->pWal = pWal; pSyncNode->pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM)); - pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; + // pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; } void cleanup() { diff --git a/source/libs/sync/test/syncRaftLogTest3.cpp b/source/libs/sync/test/syncRaftLogTest3.cpp index 31c06625aa..1eed08102f 100644 --- a/source/libs/sync/test/syncRaftLogTest3.cpp +++ b/source/libs/sync/test/syncRaftLogTest3.cpp @@ -47,7 +47,7 @@ void init() { pSyncNode->pWal = pWal; pSyncNode->pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM)); - pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; + // pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; } void cleanup() { diff --git a/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c b/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c index 82e23b2885..f1237e5282 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c @@ -132,7 +132,7 @@ char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver) { } int32_t syncNodeOnPreSnapshot(SSyncNode *ths, SyncPreSnapshot *pMsg) { - syncLogRecvSyncPreSnapshot(ths, pMsg, ""); + // syncLogRecvSyncPreSnapshot(ths, pMsg, ""); SyncPreSnapshotReply *pMsgReply = syncPreSnapshotReplyBuild(ths->vgId); pMsgReply->srcId = ths->myRaftId; @@ -181,7 +181,7 @@ _IGNORE: } int32_t syncNodeOnPreSnapshotReply(SSyncNode *ths, SyncPreSnapshotReply *pMsg) { - syncLogRecvSyncPreSnapshotReply(ths, pMsg, ""); + // syncLogRecvSyncPreSnapshotReply(ths, pMsg, ""); // start snapshot diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 5c1f264460..4e25d72b2b 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -74,7 +74,10 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg SBTree *pBt; int ret; - ASSERT(keyLen != 0); + if (keyLen == 0) { + tdbError("tdb/btree-open: key len cannot be zero."); + return -1; + } *ppBt = NULL; @@ -152,7 +155,11 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg tdbPostCommit(pPager->pEnv, txn); } - ASSERT(pgno != 0); + if (pgno == 0) { + tdbError("tdb/btree-open: pgno cannot be zero."); + tdbOsFree(pBt); + return -1; + } pBt->root = pgno; /* // TODO: pBt->root @@ -192,7 +199,7 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in ret = tdbBtcMoveTo(&btc, pKey, kLen, &c); if (ret < 0) { tdbBtcClose(&btc); - ASSERT(0); + tdbError("tdb/btree-insert: btc move to failed with ret: %d.", ret); return -1; } @@ -202,17 +209,17 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in if (c > 0) { btc.idx++; } else if (c == 0) { - // dup key not allowed - tdbError("unable to insert dup key. pKey: %p, kLen: %d, btc: %p, pTxn: %p", pKey, kLen, &btc, pTxn); - // ASSERT(0); + // dup key not allowed with insert + tdbBtcClose(&btc); + tdbError("tdb/btree-insert: dup key. pKey: %p, kLen: %d, btc: %p, pTxn: %p", pKey, kLen, &btc, pTxn); return -1; } } ret = tdbBtcUpsert(&btc, pKey, kLen, pVal, vLen, 1); if (ret < 0) { - ASSERT(0); tdbBtcClose(&btc); + tdbError("tdb/btree-insert: btc upsert failed with ret: %d.", ret); return -1; } @@ -233,7 +240,7 @@ int tdbBtreeDelete(SBTree *pBt, const void *pKey, int kLen, TXN *pTxn) { ret = tdbBtcMoveTo(&btc, pKey, kLen, &c); if (ret < 0) { tdbBtcClose(&btc); - ASSERT(0); + tdbError("tdb/btree-delete: btc move to failed with ret: %d.", ret); return -1; } @@ -264,7 +271,7 @@ int tdbBtreeUpsert(SBTree *pBt, const void *pKey, int nKey, const void *pData, i // move the cursor ret = tdbBtcMoveTo(&btc, pKey, nKey, &c); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btree-upsert: btc move to failed with ret: %d.", ret); tdbBtcClose(&btc); return -1; } @@ -280,8 +287,8 @@ int tdbBtreeUpsert(SBTree *pBt, const void *pKey, int nKey, const void *pData, i ret = tdbBtcUpsert(&btc, pKey, nKey, pData, nData, c); if (ret < 0) { - ASSERT(0); tdbBtcClose(&btc); + tdbError("tdb/btree-upsert: btc upsert failed with ret: %d.", ret); return -1; } @@ -309,7 +316,8 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL ret = tdbBtcMoveTo(&btc, pKey, kLen, &cret); if (ret < 0) { tdbBtcClose(&btc); - ASSERT(0); + tdbError("tdb/btree-pget: btc move to failed with ret: %d.", ret); + return -1; } if (btc.idx < 0 || cret) { @@ -325,7 +333,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL pTKey = tdbRealloc(*ppKey, cd.kLen); if (pTKey == NULL) { tdbBtcClose(&btc); - ASSERT(0); + tdbError("tdb/btree-pget: realloc pTKey failed."); return -1; } *ppKey = pTKey; @@ -337,7 +345,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL pTVal = tdbRealloc(*ppVal, cd.vLen); if (pTVal == NULL) { tdbBtcClose(&btc); - ASSERT(0); + tdbError("tdb/btree-pget: realloc pTVal failed."); return -1; } *ppVal = pTVal; @@ -350,7 +358,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL } if (TDB_CELLDECODER_FREE_VAL(&cd)) { - tdbDebug("tdb btc/pget/2 decoder: %p pVal free: %p", &cd, cd.pVal); + tdbTrace("tdb btc/pget/2 decoder: %p pVal free: %p", &cd, cd.pVal); tdbFree(cd.pVal); } @@ -366,7 +374,9 @@ static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2 int mlen; int cret; - ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + if (ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL)) { + // -1 is less than + } mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; cret = memcmp(pKey1, pKey2, mlen); @@ -381,36 +391,7 @@ static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2 } return cret; } -/* -static int tdbBtreeOpenImpl(SBTree *pBt) { - // Try to get the root page of the an existing btree - SPgno pgno; - SPage *pPage; - int ret; - { - // 1. TODO: Search the main DB to check if the DB exists - ret = tdbPagerOpenDB(pBt->pPager, &pgno, true, pBt); - ASSERT(ret == 0); - } - - if (pgno != 0) { - pBt->root = pgno; - return 0; - } - - // Try to create a new database - ret = tdbPagerAllocPage(pBt->pPager, &pgno); - if (ret < 0) { - ASSERT(0); - return -1; - } - - ASSERT(pgno != 0); - pBt->root = pgno; - return 0; -} -*/ int tdbBtreeInitPage(SPage *pPage, void *arg, int init) { SBTree *pBt; u8 flags; @@ -546,11 +527,15 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx nOlds = 3; } for (int i = 0; i < nOlds; i++) { - ASSERT(sIdx + i <= nCells); + if (ASSERT(sIdx + i <= nCells)) { + return -1; + } SPgno pgno; if (sIdx + i == nCells) { - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pParent)); + if (ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pParent))) { + return -1; + } pgno = ((SIntHdr *)(pParent->pData))->pgno; } else { pCell = tdbPageGetCell(pParent, sIdx + i); @@ -560,7 +545,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx ret = tdbPagerFetchPage(pBt->pPager, &pgno, pOlds + i, tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = 0}), pTxn); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btree-balance: fetch page failed with ret: %d.", ret); return -1; } @@ -679,7 +664,9 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx szRCell = tdbBtreeCellSize(pPage, pCell, 0, NULL, NULL); } - ASSERT(infoNews[iNew - 1].cnt > 0); + if (ASSERT(infoNews[iNew - 1].cnt > 0)) { + return -1; + } if (infoNews[iNew].size + szRCell >= infoNews[iNew - 1].size - szRCell) { break; @@ -722,7 +709,8 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx iarg.flags = flags; ret = tdbPagerFetchPage(pBt->pPager, &pgno, pNews + iNew, tdbBtreeInitPage, &iarg, pTxn); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btree-balance: fetch page failed with ret: %d.", ret); + return -1; } ret = tdbPagerWrite(pBt->pPager, pNews[iNew]); @@ -766,8 +754,12 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx pCell = tdbPageGetCell(pPage, oIdx); szCell = tdbBtreeCellSize(pPage, pCell, 0, NULL, NULL); - ASSERT(nNewCells <= infoNews[iNew].cnt); - ASSERT(iNew < nNews); + if (ASSERT(nNewCells <= infoNews[iNew].cnt)) { + return -1; + } + if (ASSERT(iNew < nNews)) { + return -1; + } if (nNewCells < infoNews[iNew].cnt) { tdbPageInsertCell(pNews[iNew], nNewCells, pCell, szCell, 0); @@ -806,14 +798,20 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx } } } else { - ASSERT(childNotLeaf); - ASSERT(iNew < nNews - 1); + if (ASSERT(childNotLeaf)) { + return -1; + } + if (ASSERT(iNew < nNews - 1)) { + return -1; + } // set current new page right-most child ((SIntHdr *)pNews[iNew]->pData)->pgno = ((SPgno *)pCell)[0]; // insert to parent as divider cell - ASSERT(iNew < nNews - 1); + if (ASSERT(iNew < nNews - 1)) { + return -1; + } ((SPgno *)pCell)[0] = TDB_PAGE_PGNO(pNews[iNew]); tdbPageInsertCell(pParent, sIdx++, pCell, szCell, 0); @@ -828,7 +826,9 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx } if (childNotLeaf) { - ASSERT(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt); + if (ASSERT(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt)) { + return -1; + } ((SIntHdr *)(pNews[nNews - 1]->pData))->pgno = rPgno; SIntHdr *pIntHdr = (SIntHdr *)pParent->pData; @@ -1018,7 +1018,9 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const nLeft -= kLen; // pack partial val to local if any space left if (nLocal > nHeader + kLen + sizeof(SPgno)) { - ASSERT(pVal != NULL && vLen != 0); + if (ASSERT(pVal != NULL && vLen != 0)) { + return -1; + } memcpy(pCell + nHeader + kLen, pVal, nLocal - nHeader - kLen - sizeof(SPgno)); nLeft -= nLocal - nHeader - kLen - sizeof(SPgno); } @@ -1180,9 +1182,15 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo int nPayload; int ret; - ASSERT(pPage->kLen == TDB_VARIANT_LEN || pPage->kLen == kLen); - ASSERT(pPage->vLen == TDB_VARIANT_LEN || pPage->vLen == vLen); - ASSERT(pKey != NULL && kLen > 0); + if (ASSERT(pPage->kLen == TDB_VARIANT_LEN || pPage->kLen == kLen)) { + return -1; + } + if (ASSERT(pPage->vLen == TDB_VARIANT_LEN || pPage->vLen == vLen)) { + return -1; + } + if (ASSERT(pKey != NULL && kLen > 0)) { + return -1; + } nPayload = 0; nHeader = 0; @@ -1191,7 +1199,10 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo // 1. Encode Header part /* Encode SPgno if interior page */ if (!leaf) { - ASSERT(pPage->vLen == sizeof(SPgno)); + if (pPage->vLen != sizeof(SPgno)) { + tdbError("tdb/btree-encode-cell: invalid cell."); + return -1; + } ((SPgno *)(pCell + nHeader))[0] = ((SPgno *)pVal)[0]; nHeader = nHeader + sizeof(SPgno); @@ -1216,8 +1227,8 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo ret = tdbBtreeEncodePayload(pPage, pCell, nHeader, pKey, kLen, pVal, vLen, &nPayload, pTxn, pBt); if (ret < 0) { // TODO - ASSERT(0); - return 0; + tdbError("tdb/btree-encode-cell: encode payload failed with ret: %d.", ret); + return -1; } *szCell = nHeader + nPayload; @@ -1234,7 +1245,10 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader, int vLen = pDecoder->vLen; if (pDecoder->pVal) { - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); + if (TDB_BTREE_PAGE_IS_LEAF(pPage)) { + tdbError("tdb/btree-decode-payload: leaf page with non-null pVal."); + return -1; + } nPayload = pDecoder->kLen; } else { nPayload = pDecoder->kLen + pDecoder->vLen; @@ -1435,7 +1449,10 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD // 1. Decode header part if (!leaf) { - ASSERT(pPage->vLen == sizeof(SPgno)); + if (pPage->vLen != sizeof(SPgno)) { + tdbError("tdb/btree-decode-cell: invalid cell."); + return -1; + } pDecoder->pgno = ((SPgno *)(pCell + nHeader))[0]; pDecoder->pVal = (u8 *)(&(pDecoder->pgno)); @@ -1449,7 +1466,10 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD } if (pPage->vLen == TDB_VARIANT_LEN) { - ASSERT(leaf); + if (!leaf) { + tdbError("tdb/btree-decode-cell: not a leaf page."); + return -1; + } nHeader += tdbGetVarInt(pCell + nHeader, &(pDecoder->vLen)); } else { pDecoder->vLen = pPage->vLen; @@ -1481,7 +1501,10 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell, int dropOfp, TXN * } if (pPage->vLen == TDB_VARIANT_LEN) { - ASSERT(leaf); + if (!leaf) { + tdbError("tdb/btree-cell-size: not a leaf page."); + return -1; + } nHeader += tdbGetVarInt(pCell + nHeader, &vLen); } else if (leaf) { vLen = pPage->vLen; @@ -1577,29 +1600,42 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { ret = tdbPagerFetchPage(pPager, &pBt->root, &(pBtc->pPage), tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-move-tofirst: fetch page failed with ret: %d.", ret); return -1; } - ASSERT(TDB_BTREE_PAGE_IS_ROOT(pBtc->pPage)); + if (!TDB_BTREE_PAGE_IS_ROOT(pBtc->pPage)) { + tdbError("tdb/btc-move-tofirst: not a root page"); + return -1; + } pBtc->iPage = 0; if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) > 0) { pBtc->idx = 0; } else { // no any data, point to an invalid position - ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + if (!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + tdbError("tdb/btc-move-to-first: not a leaf page."); + return -1; + } + pBtc->idx = -1; return 0; } } else { - ASSERT(0); + // TODO + tdbError("tdb/btc-move-to-first: move from a dirty cursor."); + return -1; #if 0 // move from a position int iPage = 0; for (; iPage < pBtc->iPage; iPage++) { - ASSERT(pBtc->idxStack[iPage] >= 0); + if (pBtc->idxStack[iPage] < 0) { + tdbError("tdb/btc-move-to-first: invalid idx: %d.", pBtc->idxStack[iPage]); + return -1; + } + if (pBtc->idxStack[iPage]) break; } @@ -1621,7 +1657,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-move-tofirst: btc move downward failed with ret: %d.", ret); return -1; } @@ -1646,7 +1682,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { ret = tdbPagerFetchPage(pPager, &pBt->root, &(pBtc->pPage), tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-move-tolast: fetch page failed with ret: %d.", ret); return -1; } @@ -1656,18 +1692,28 @@ int tdbBtcMoveToLast(SBTC *pBtc) { pBtc->idx = TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage) ? nCells - 1 : nCells; } else { // no data at all, point to an invalid position - ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + if (!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + tdbError("tdb/btc-move-to-last: not a leaf page."); + return -1; + } + pBtc->idx = -1; return 0; } } else { - ASSERT(0); + // TODO + tdbError("tdb/btc-move-to-last: move from a dirty cursor."); + return -1; #if 0 int iPage = 0; // downward search for (; iPage < pBtc->iPage; iPage++) { - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pgStack[iPage])); + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pgStack[iPage])) { + tdbError("tdb/btc-move-to-last: leaf page in cursor stack."); + return -1; + } + nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pgStack[iPage]); if (pBtc->idxStack[iPage] != nCells) break; } @@ -1694,7 +1740,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-move-tolast: btc move downward failed with ret: %d.", ret); return -1; } @@ -1752,7 +1798,7 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { ret = tdbBtcMoveToNext(pBtc); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btree-next: btc move to next failed with ret: %d.", ret); return -1; } @@ -1798,7 +1844,7 @@ int tdbBtreePrev(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { ret = tdbBtcMoveToPrev(pBtc); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btree-prev: btc move to prev failed with ret: %d.", ret); return -1; } @@ -1810,7 +1856,10 @@ int tdbBtcMoveToNext(SBTC *pBtc) { int ret; SCell *pCell; - ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + if (!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + tdbError("tdb/btc-move-to-next: not a leaf page."); + return -1; + } if (pBtc->idx < 0) return -1; @@ -1829,7 +1878,10 @@ int tdbBtcMoveToNext(SBTC *pBtc) { tdbBtcMoveUpward(pBtc); pBtc->idx++; - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + tdbError("tdb/btree-decode-cell: should not be a leaf page here."); + return -1; + } if (pBtc->idx <= TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { break; } @@ -1841,7 +1893,7 @@ int tdbBtcMoveToNext(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-move-tonext: btc move downward failed with ret: %d.", ret); return -1; } @@ -1893,8 +1945,15 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { SPgno pgno; SCell *pCell; - ASSERT(pBtc->idx >= 0); - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + if (pBtc->idx < 0) { + tdbError("tdb/btc-move-downward: invalid idx: %d.", pBtc->idx); + return -1; + } + + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + tdbError("tdb/btc-move-downward: should not be a leaf page here."); + return -1; + } if (pBtc->idx < TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { pCell = tdbPageGetCell(pBtc->pPage, pBtc->idx); @@ -1903,7 +1962,10 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { pgno = ((SIntHdr *)pBtc->pPage->pData)->pgno; } - ASSERT(pgno); + if (!pgno) { + tdbError("tdb/btc-move-downward: invalid pgno."); + return -1; + } pBtc->pgStack[pBtc->iPage] = pBtc->pPage; pBtc->idxStack[pBtc->iPage] = pBtc->idx; @@ -1914,7 +1976,7 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { ret = tdbPagerFetchPage(pBtc->pBt->pPager, &pgno, &pBtc->pPage, tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBtc->pBt, .flags = 0}), pBtc->pTxn); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-move-downward: fetch page failed with ret: %d.", ret); return -1; } @@ -1969,7 +2031,10 @@ int tdbBtcDelete(SBTC *pBtc) { int nKey; int ret; - ASSERT(idx >= 0 && idx < nCells); + if (idx < 0 || idx >= nCells) { + tdbError("tdb/btc-delete: idx: %d out of range[%d, %d).", idx, 0, nCells); + return -1; + } // drop the cell on the leaf ret = tdbPagerWrite(pPager, pBtc->pPage); @@ -2007,7 +2072,7 @@ int tdbBtcDelete(SBTC *pBtc) { ret = tdbPageUpdateCell(pPage, idx, pCell, szCell, pBtc->pTxn, pBtc->pBt); if (ret < 0) { tdbOsFree(pCell); - ASSERT(0); + tdbError("tdb/btc-delete: page update cell failed with ret: %d.", ret); return -1; } tdbOsFree(pCell); @@ -2018,11 +2083,14 @@ int tdbBtcDelete(SBTC *pBtc) { } } else { // delete the leaf page and do balance - ASSERT(TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0); + if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) != 0) { + tdbError("tdb/btc-delete: page to be deleted should be empty."); + return -1; + } ret = tdbBtreeBalance(pBtc); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-delete: btree balance failed with ret: %d.", ret); return -1; } } @@ -2039,13 +2107,16 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int void *pBuf; int ret; - ASSERT(pBtc->idx >= 0); + if (pBtc->idx < 0) { + tdbError("tdb/btc-upsert: invalid idx: %d.", pBtc->idx); + return -1; + } // alloc space szBuf = kLen + nData + 14; pBuf = tdbRealloc(pBtc->pBt->pBuf, pBtc->pBt->pageSize > szBuf ? szBuf : pBtc->pBt->pageSize); if (pBuf == NULL) { - ASSERT(0); + tdbError("tdb/btc-upsert: realloc pBuf failed."); return -1; } pBtc->pBt->pBuf = pBuf; @@ -2054,7 +2125,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int // encode cell ret = tdbBtreeEncodeCell(pBtc->pPage, pKey, kLen, pData, nData, pCell, &szCell, pBtc->pTxn, pBtc->pBt); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-upsert: btree encode cell failed with ret: %d.", ret); return -1; } @@ -2067,16 +2138,22 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int // insert or update if (insert) { - ASSERT(pBtc->idx <= nCells); + if (pBtc->idx > nCells) { + tdbError("tdb/btc-upsert: invalid idx: %d, nCells: %d.", pBtc->idx, nCells); + return -1; + } ret = tdbPageInsertCell(pBtc->pPage, pBtc->idx, pCell, szCell, 0); } else { - ASSERT(pBtc->idx < nCells); + if (pBtc->idx >= nCells) { + tdbError("tdb/btc-upsert: invalid idx: %d, nCells: %d.", pBtc->idx, nCells); + return -1; + } ret = tdbPageUpdateCell(pBtc->pPage, pBtc->idx, pCell, szCell, pBtc->pTxn, pBtc->pBt); } if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-upsert: page insert/update cell failed with ret: %d.", ret); return -1; } @@ -2084,7 +2161,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int if (pBtc->pPage->nOverflow > 0) { ret = tdbBtreeBalance(pBtc); if (ret < 0) { - ASSERT(0); + tdbError("tdb/btc-upsert: btree balance failed with ret: %d.", ret); return -1; } } @@ -2109,8 +2186,8 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { // TODO - ASSERT(0); - return 0; + tdbError("tdb/btc-move-to: fetch page failed with ret: %d.", ret); + return -1; } pBtc->iPage = 0; @@ -2118,7 +2195,9 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { // for empty tree, just return with an invalid position if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) return 0; } else { - ASSERT(0); + // TODO + tdbError("tdb/btc-move-to: move from a dirty cursor."); + return -1; #if 0 SPage *pPage; int idx; @@ -2130,7 +2209,10 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { idx = pBtc->idxStack[iPage]; nCells = TDB_PAGE_TOTAL_CELLS(pPage); - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); + if (TDB_BTREE_PAGE_IS_LEAF(pPage)) { + tdbError("tdb/btc-move-to: leaf page in cursor stack."); + return -1; + } // check if key <= current position if (idx < nCells) { @@ -2233,7 +2315,10 @@ int tdbBtcClose(SBTC *pBtc) { if (pBtc->iPage < 0) return 0; for (;;) { - ASSERT(pBtc->pPage); + if (NULL == pBtc->pPage) { + tdbError("tdb/btc-close: null ptr pPage."); + return -1; + } tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage, pBtc->pTxn); diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index c79279c658..952c49db73 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -247,7 +247,10 @@ void tdbEnvRemovePager(TDB *pDb, SPager *pPager) { // remove from the list for (ppPager = &pDb->pgrList; *ppPager && (*ppPager != pPager); ppPager = &((*ppPager)->pNext)) { } - ASSERT(*ppPager == pPager); + if (*ppPager != pPager) { + tdbError("tdb/db: invalid pPager: %p, *ppPager: %p", pPager, *ppPager); + return; + } *ppPager = pPager->pNext; // remove from hash @@ -255,7 +258,10 @@ void tdbEnvRemovePager(TDB *pDb, SPager *pPager) { ppPager = &pDb->pgrHash[hash % pDb->nPgrHash]; for (; *ppPager && *ppPager != pPager; ppPager = &((*ppPager)->pHashNext)) { } - ASSERT(*ppPager == pPager); + if (*ppPager != pPager) { + tdbError("tdb/db: invalid pPager: %p, *ppPager: %p", pPager, *ppPager); + return; + } *ppPager = pPager->pNext; // decrease the counter diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c index 30dcb05f80..262f3d27e6 100644 --- a/source/libs/tdb/src/db/tdbPCache.c +++ b/source/libs/tdb/src/db/tdbPCache.c @@ -205,22 +205,41 @@ static void tdbPCacheFreePage(SPCache *pCache, SPage *pPage) { pCache->pFree = pPage; pPage->isFree = 0; ++pCache->nFree; - tdbTrace("pcache/free page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id); + tdbTrace("pcache/free page %p/%d, pgno:%d, ", pPage, pPage->id, TDB_PAGE_PGNO(pPage)); } else { - tdbTrace("pcache destroy page: %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id); + tdbTrace("pcache/free2 page: %p/%d, pgno:%d, ", pPage, pPage->id, TDB_PAGE_PGNO(pPage)); tdbPCacheRemovePageFromHash(pCache, pPage); tdbPageDestroy(pPage, tdbDefaultFree, NULL); } } +void tdbPCacheInvalidatePage(SPCache *pCache, SPager *pPager, SPgno pgno) { + SPgid pgid; + const SPgid *pPgid = &pgid; + SPage *pPage = NULL; + + memcpy(&pgid, pPager->fid, TDB_FILE_ID_LEN); + pgid.pgno = pgno; + + pPage = pCache->pgHash[tdbPCachePageHash(pPgid) % pCache->nHash]; + while (pPage) { + if (pPage->pgid.pgno == pPgid->pgno && memcmp(pPage->pgid.fileid, pPgid->fileid, TDB_FILE_ID_LEN) == 0) break; + pPage = pPage->pHashNext; + } + + if (pPage) { + tdbPCacheRemovePageFromHash(pCache, pPage); + } +} + void tdbPCacheRelease(SPCache *pCache, SPage *pPage, TXN *pTxn) { i32 nRef; - ASSERT(pTxn); - - // nRef = tdbUnrefPage(pPage); - // ASSERT(nRef >= 0); + if (!pTxn) { + tdbError("tdb/pcache: null ptr pTxn, release failed."); + return; + } tdbPCacheLock(pCache); nRef = tdbUnrefPage(pPage); @@ -256,7 +275,10 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) SPage *pPage = NULL; SPage *pPageH = NULL; - ASSERT(pTxn); + if (!pTxn) { + tdbError("tdb/pcache: null ptr pTxn, fetch impl failed."); + return NULL; + } // 1. Search the hash table pPage = pCache->pgHash[tdbPCachePageHash(pPgid) % pCache->nHash]; @@ -296,8 +318,8 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) if (!pPage && pTxn->xMalloc != NULL) { ret = tdbPageCreate(pCache->szPage, &pPage, pTxn->xMalloc, pTxn->xArg); if (ret < 0 || pPage == NULL) { - // TODO - ASSERT(0); + tdbError("tdb/pcache: ret: %" PRId32 " pPage: %p, page create failed.", ret, pPage); + // TODO: recycle other backup pages return NULL; } @@ -351,7 +373,11 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) static void tdbPCachePinPage(SPCache *pCache, SPage *pPage) { if (pPage->pLruNext != NULL) { - ASSERT(tdbGetPageRef(pPage) == 0); + int32_t nRef = tdbGetPageRef(pPage); + if (nRef != 0) { + tdbError("tdb/pcache: pin page's ref not zero: %" PRId32, nRef); + return; + } pPage->pLruPrev->pLruNext = pPage->pLruNext; pPage->pLruNext->pLruPrev = pPage->pLruPrev; @@ -359,20 +385,31 @@ static void tdbPCachePinPage(SPCache *pCache, SPage *pPage) { pCache->nRecyclable--; - tdbTrace("pcache/pin page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id); + tdbTrace("pcache/pin page %p/%d, pgno:%d, ", pPage, pPage->id, TDB_PAGE_PGNO(pPage)); } } static void tdbPCacheUnpinPage(SPCache *pCache, SPage *pPage) { - i32 nRef; + i32 nRef = tdbGetPageRef(pPage); + if (nRef != 0) { + tdbError("tdb/pcache: unpin page's ref not zero: %" PRId32, nRef); + return; + } + if (!pPage->isLocal) { + tdbError("tdb/pcache: unpin page's not local: %" PRIu8, pPage->isLocal); + return; + } + if (pPage->isDirty) { + tdbError("tdb/pcache: unpin page's dirty: %" PRIu8, pPage->isDirty); + return; + } + if (NULL != pPage->pLruNext) { + tdbError("tdb/pcache: unpin page's pLruNext not null."); + return; + } - ASSERT(pPage->isLocal); - ASSERT(!pPage->isDirty); - ASSERT(tdbGetPageRef(pPage) == 0); - - ASSERT(pPage->pLruNext == NULL); - - tdbTrace("pCache:%p unpin page %p/%d/%d, nPages:%d", pCache, pPage, TDB_PAGE_PGNO(pPage), pPage->id, pCache->nPages); + tdbTrace("pCache:%p unpin page %p/%d, nPages:%d, pgno:%d, ", pCache, pPage, pPage->id, pCache->nPages, + TDB_PAGE_PGNO(pPage)); if (pPage->id < pCache->nPages) { pPage->pLruPrev = &(pCache->lru); pPage->pLruNext = pCache->lru.pLruNext; @@ -404,7 +441,7 @@ static void tdbPCacheRemovePageFromHash(SPCache *pCache, SPage *pPage) { // printf("rmv page %d to hash, pgno %d, pPage %p\n", pPage->id, TDB_PAGE_PGNO(pPage), pPage); } - tdbTrace("pcache/remove page %p/%d/%d from hash %" PRIu32, pPage, TDB_PAGE_PGNO(pPage), pPage->id, h); + tdbTrace("pcache/remove page %p/%d from hash %" PRIu32 " pgno:%d, ", pPage, pPage->id, h, TDB_PAGE_PGNO(pPage)); } static void tdbPCacheAddPageToHash(SPCache *pCache, SPage *pPage) { @@ -415,7 +452,7 @@ static void tdbPCacheAddPageToHash(SPCache *pCache, SPage *pPage) { pCache->nPage++; - tdbTrace("pcache/add page %p/%d/%d to hash %" PRIu32, pPage, TDB_PAGE_PGNO(pPage), pPage->id, h); + tdbTrace("pcache/add page %p/%d to hash %" PRIu32 " pgno:%d, ", pPage, pPage->id, h, TDB_PAGE_PGNO(pPage)); } static int tdbPCacheOpenImpl(SPCache *pCache) { diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index 50dc8e0a65..f19c3f28c0 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -43,9 +43,15 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t) u8 *ptr; int size; - ASSERT(xMalloc); + if (!xMalloc) { + tdbError("tdb/page-create: null xMalloc."); + return -1; + } - ASSERT(TDB_IS_PGSIZE_VLD(pageSize)); + if (!TDB_IS_PGSIZE_VLD(pageSize)) { + tdbError("tdb/page-create: invalid pageSize: %d.", pageSize); + return -1; + } *ppPage = NULL; size = pageSize + sizeof(*pPage); @@ -69,16 +75,24 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t) *ppPage = pPage; - tdbTrace("page/create: %p/%d %p", pPage, pPage->id, xMalloc); + tdbTrace("tdb/page-create: %p/%d %p", pPage, pPage->id, xMalloc); return 0; } int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg) { u8 *ptr; - tdbTrace("page/destroy: %p/%d %p", pPage, pPage->id, xFree); - ASSERT(!pPage->isDirty); - ASSERT(xFree); + tdbTrace("tdb/page-destroy: %p/%d %p", pPage, pPage->id, xFree); + + if (pPage->isDirty) { + tdbError("tdb/page-destroy: dirty page: %" PRIu8 ".", pPage->isDirty); + return -1; + } + + if (!xFree) { + tdbError("tdb/page-destroy: null xFree."); + return -1; + } for (int iOvfl = 0; iOvfl < pPage->nOverflow; iOvfl++) { tdbTrace("tdbPage/destroy/free ovfl cell: %p/%p", pPage->apOvfl[iOvfl], pPage); @@ -105,7 +119,10 @@ void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell pPage->nOverflow = 0; pPage->xCellSize = xCellSize; - ASSERT((u8 *)pPage->pPageFtr == pPage->pFreeEnd); + if ((u8 *)pPage->pPageFtr != pPage->pFreeEnd) { + tdbError("tdb/page-zero: invalid page, pFreeEnd: %p, pPageFtr: %p", pPage->pFreeEnd, pPage->pPageFtr); + return; + } } void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, TXN *, SBTree *pBt)) { @@ -121,8 +138,15 @@ void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell pPage->nOverflow = 0; pPage->xCellSize = xCellSize; - ASSERT(pPage->pFreeEnd >= pPage->pFreeStart); - ASSERT(pPage->pFreeEnd - pPage->pFreeStart <= TDB_PAGE_NFREE(pPage)); + if (pPage->pFreeEnd < pPage->pFreeStart) { + tdbError("tdb/page-init: invalid page, pFreeEnd: %p, pFreeStart: %p", pPage->pFreeEnd, pPage->pFreeStart); + return; + } + if (pPage->pFreeEnd - pPage->pFreeStart > TDB_PAGE_NFREE(pPage)) { + tdbError("tdb/page-init: invalid page, pFreeEnd: %p, pFreeStart: %p, NFREE: %d", pPage->pFreeEnd, pPage->pFreeStart, + TDB_PAGE_NFREE(pPage)); + return; + } } int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl) { @@ -132,7 +156,11 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl int lidx; // local idx SCell *pNewCell; - ASSERT(szCell <= TDB_PAGE_MAX_FREE_BLOCK(pPage, pPage->pPageHdr - pPage->pData)); + if (szCell > TDB_PAGE_MAX_FREE_BLOCK(pPage, pPage->pPageHdr - pPage->pData)) { + tdbError("tdb/page-insert-cell: invalid page, szCell: %d, max free: %lu", szCell, + TDB_PAGE_MAX_FREE_BLOCK(pPage, pPage->pPageHdr - pPage->pData)); + return -1; + } nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); @@ -176,7 +204,11 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl TDB_PAGE_CELL_OFFSET_AT_SET(pPage, lidx, pNewCell - pPage->pData); TDB_PAGE_NCELLS_SET(pPage, nCells + 1); - ASSERT(pPage->pFreeStart == pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * (nCells + 1)); + if (pPage->pFreeStart != pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * (nCells + 1)) { + tdbError("tdb/page-insert-cell: invalid page, pFreeStart: %p, pCellIdx: %p, nCells: %d", pPage->pFreeStart, + pPage->pCellIdx, nCells); + return -1; + } } for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -200,7 +232,10 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { nCells = TDB_PAGE_NCELLS(pPage); - ASSERT(idx >= 0 && idx < nCells + pPage->nOverflow); + if (idx < 0 || idx >= nCells + pPage->nOverflow) { + tdbError("tdb/page-drop-cell: idx: %d out of range, nCells: %d, nOvfl: %d.", idx, nCells, pPage->nOverflow); + return -1; + } iOvfl = 0; for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -228,7 +263,10 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { for (; iOvfl < pPage->nOverflow; iOvfl++) { pPage->aiOvfl[iOvfl]--; - ASSERT(pPage->aiOvfl[iOvfl] > 0); + if (pPage->aiOvfl[iOvfl] <= 0) { + tdbError("tdb/page-drop-cell: invalid ai idx: %d", pPage->aiOvfl[iOvfl]); + return -1; + } } return 0; @@ -240,12 +278,19 @@ void tdbPageCopy(SPage *pFromPage, SPage *pToPage, int deepCopyOvfl) { pToPage->pFreeStart = pToPage->pPageHdr + (pFromPage->pFreeStart - pFromPage->pPageHdr); pToPage->pFreeEnd = (u8 *)(pToPage->pPageFtr) - ((u8 *)pFromPage->pPageFtr - pFromPage->pFreeEnd); - ASSERT(pToPage->pFreeEnd >= pToPage->pFreeStart); + if (pToPage->pFreeEnd < pToPage->pFreeStart) { + tdbError("tdb/page-copy: invalid to page, pFreeStart: %p, pFreeEnd: %p", pToPage->pFreeStart, pToPage->pFreeEnd); + return; + } memcpy(pToPage->pPageHdr, pFromPage->pPageHdr, pFromPage->pFreeStart - pFromPage->pPageHdr); memcpy(pToPage->pFreeEnd, pFromPage->pFreeEnd, (u8 *)pFromPage->pPageFtr - pFromPage->pFreeEnd); - ASSERT(TDB_PAGE_CCELLS(pToPage) == pToPage->pFreeEnd - pToPage->pData); + if (TDB_PAGE_CCELLS(pToPage) != pToPage->pFreeEnd - pToPage->pData) { + tdbError("tdb/page-copy: invalid to page, cell body: %d, range: %ld", TDB_PAGE_CCELLS(pToPage), + pToPage->pFreeEnd - pToPage->pData); + return; + } delta = (pToPage->pPageHdr - pToPage->pData) - (pFromPage->pPageHdr - pFromPage->pData); if (delta != 0) { @@ -295,8 +340,16 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { *ppCell = NULL; nFree = TDB_PAGE_NFREE(pPage); - ASSERT(nFree >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)); - ASSERT(TDB_PAGE_CCELLS(pPage) == pPage->pFreeEnd - pPage->pData); + if (nFree < szCell + TDB_PAGE_OFFSET_SIZE(pPage)) { + tdbError("tdb/page-allocate: invalid cell size, nFree: %d, szCell: %d, szOffset: %d", nFree, szCell, + TDB_PAGE_OFFSET_SIZE(pPage)); + return -1; + } + if (TDB_PAGE_CCELLS(pPage) != pPage->pFreeEnd - pPage->pData) { + tdbError("tdb/page-allocate: invalid page, cell body: %d, range: %ld", TDB_PAGE_CCELLS(pPage), + pPage->pFreeEnd - pPage->pData); + return -1; + } // 1. Try to allocate from the free space block area if (pPage->pFreeEnd - pPage->pFreeStart >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)) { @@ -308,7 +361,10 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { // 2. Try to allocate from the page free list cellFree = TDB_PAGE_FCELL(pPage); - ASSERT(cellFree == 0 || cellFree >= pPage->pFreeEnd - pPage->pData); + if (cellFree != 0 && cellFree < pPage->pFreeEnd - pPage->pData) { + tdbError("tdb/page-allocate: cellFree: %d, pFreeEnd: %p, pData: %p.", cellFree, pPage->pFreeEnd, pPage->pData); + return -1; + } if (cellFree && pPage->pFreeEnd - pPage->pFreeStart >= TDB_PAGE_OFFSET_SIZE(pPage)) { SCell *pPrevFreeCell = NULL; int szPrevFreeCell; @@ -353,16 +409,30 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { // 3. Try to dfragment and allocate again tdbPageDefragment(pPage); - ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree); - ASSERT(nFree == TDB_PAGE_NFREE(pPage)); - ASSERT(pPage->pFreeEnd - pPage->pData == TDB_PAGE_CCELLS(pPage)); + if (pPage->pFreeEnd - pPage->pFreeStart != nFree) { + tdbError("tdb/page-allocate: nFree: %d, pFreeStart: %p, pFreeEnd: %p.", nFree, pPage->pFreeStart, pPage->pFreeEnd); + return -1; + } + if (TDB_PAGE_NFREE(pPage) != nFree) { + tdbError("tdb/page-allocate: nFree: %d, page free: %d.", nFree, TDB_PAGE_NFREE(pPage)); + return -1; + } + if (pPage->pFreeEnd - pPage->pData != TDB_PAGE_CCELLS(pPage)) { + tdbError("tdb/page-allocate: ccells: %d, pFreeStart: %p, pData: %p.", TDB_PAGE_CCELLS(pPage), pPage->pFreeStart, + pPage->pData); + return -1; + } pPage->pFreeEnd -= szCell; pCell = pPage->pFreeEnd; TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData); _alloc_finish: - ASSERT(pCell); + if (NULL == pCell) { + tdbError("tdb/page-allocate: null ptr pCell."); + return -1; + } + pPage->pFreeStart += TDB_PAGE_OFFSET_SIZE(pPage); TDB_PAGE_NFREE_SET(pPage, nFree - szCell - TDB_PAGE_OFFSET_SIZE(pPage)); *ppCell = pCell; @@ -375,9 +445,18 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) { u8 *dest; u8 *src; - ASSERT(pCell >= pPage->pFreeEnd); - ASSERT(pCell + szCell <= (u8 *)(pPage->pPageFtr)); - ASSERT(pCell == TDB_PAGE_CELL_AT(pPage, idx)); + if (pCell < pPage->pFreeEnd) { + tdbError("tdb/page-free: invalid cell, cell: %p, free end: %p", pCell, pPage->pFreeEnd); + return -1; + } + if (pCell + szCell > (u8 *)(pPage->pPageFtr)) { + tdbError("tdb/page-free: cell crosses page footer, cell: %p, size: %d footer: %p", pCell, szCell, pPage->pFreeEnd); + return -1; + } + if (pCell != TDB_PAGE_CELL_AT(pPage, idx)) { + tdbError("tdb/page-free: cell pos incorrect, cell: %p, pos: %p", pCell, TDB_PAGE_CELL_AT(pPage, idx)); + return -1; + } nFree = TDB_PAGE_NFREE(pPage); @@ -390,7 +469,8 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) { pPage->pPageMethods->setFreeCellInfo(pCell, szCell, cellFree); TDB_PAGE_FCELL_SET(pPage, pCell - pPage->pData); } else { - ASSERT(0); + tdbError("tdb/page-free: invalid cell size: %d", szCell); + return -1; } } @@ -417,7 +497,10 @@ static int tdbPageDefragment(SPage *pPage) { nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); - ASSERT(pPage->pFreeEnd - pPage->pFreeStart < nFree); + if (pPage->pFreeEnd - pPage->pFreeStart >= nFree) { + tdbError("tdb/page-defragment: invalid free range, nFree: %d.", nFree); + return -1; + } // Loop to compact the page content // Here we use an O(n^2) algorithm to do the job since @@ -443,11 +526,19 @@ static int tdbPageDefragment(SPage *pPage) { } } - ASSERT(pCell != NULL); + if (NULL == pCell) { + tdbError("tdb/page-defragment: null ptr pCell."); + return -1; + } szCell = (*pPage->xCellSize)(pPage, pCell, 0, NULL, NULL); - ASSERT(pCell + szCell <= pNextCell); + if (pCell + szCell > pNextCell) { + tdbError("tdb/page-defragment: invalid cell range, pCell: %p, szCell: %d, pNextCell: %p.", pCell, szCell, + pNextCell); + return -1; + } + if (pCell + szCell < pNextCell) { memmove(pNextCell - szCell, pCell, szCell); } @@ -457,7 +548,11 @@ static int tdbPageDefragment(SPage *pPage) { TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pNextCell - pPage->pData); } - ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree); + if (pPage->pFreeEnd - pPage->pFreeStart != nFree) { + tdbError("tdb/page-defragment: invalid free range, nFree: %d.", nFree); + return -1; + } + TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData); TDB_PAGE_FCELL_SET(pPage, 0); @@ -483,39 +578,59 @@ typedef struct { // cellNum static inline int getPageCellNum(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellNum; } static inline void setPageCellNum(SPage *pPage, int cellNum) { - ASSERT(cellNum < 65536); + if (cellNum >= 65536) { + tdbError("tdb/page-set-cell-num: invalid cellNum: %d.", cellNum); + return; + } ((SPageHdr *)(pPage->pPageHdr))[0].cellNum = (u16)cellNum; } // cellBody static inline int getPageCellBody(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellBody; } static inline void setPageCellBody(SPage *pPage, int cellBody) { - ASSERT(cellBody < 65536); + if (cellBody >= 65536) { + tdbError("tdb/page-set-cell-body: invalid cellBody: %d.", cellBody); + return; + } ((SPageHdr *)(pPage->pPageHdr))[0].cellBody = (u16)cellBody; } // cellFree static inline int getPageCellFree(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellFree; } static inline void setPageCellFree(SPage *pPage, int cellFree) { - ASSERT(cellFree < 65536); + if (cellFree >= 65536) { + tdbError("tdb/page-set-cell-free: invalid cellFree: %d.", cellFree); + return; + } ((SPageHdr *)(pPage->pPageHdr))[0].cellFree = (u16)cellFree; } // nFree static inline int getPageNFree(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].nFree; } static inline void setPageNFree(SPage *pPage, int nFree) { - ASSERT(nFree < 65536); + if (nFree >= 65536) { + tdbError("tdb/page-set-nfree: invalid nFree: %d.", nFree); + return; + } ((SPageHdr *)(pPage->pPageHdr))[0].nFree = (u16)nFree; } // cell offset static inline int getPageCellOffset(SPage *pPage, int idx) { - ASSERT(idx >= 0 && idx < getPageCellNum(pPage)); + int cellNum = getPageCellNum(pPage); + if (idx < 0 || idx >= cellNum) { + tdbError("tdb/page-cell-offset: idx: %d out of range[%d, %d).", idx, 0, cellNum); + return -1; + } + return ((u16 *)pPage->pCellIdx)[idx]; } static inline void setPageCellOffset(SPage *pPage, int idx, int offset) { - ASSERT(offset < 65536); + if (offset >= 65536) { + tdbError("tdb/page-set-cell-offset: invalid offset: %d.", offset); + return; + } ((u16 *)pPage->pCellIdx)[idx] = (u16)offset; } @@ -590,7 +705,12 @@ static inline void setLPageNFree(SPage *pPage, int nFree) { // cell offset static inline int getLPageCellOffset(SPage *pPage, int idx) { - ASSERT(idx >= 0 && idx < getLPageCellNum(pPage)); + int cellNum = getLPageCellNum(pPage); + if (idx < 0 || idx >= cellNum) { + tdbError("tdb/lpage-cell-offset: idx: %d out of range[%d, %d).", idx, 0, cellNum); + return -1; + } + return TDB_GET_U24(pPage->pCellIdx + 3 * idx); } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index b554170b39..9131eb0909 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -14,7 +14,7 @@ */ #include "tdbInt.h" - +/* #pragma pack(push, 1) typedef struct { u8 hdrString[16]; @@ -26,7 +26,7 @@ typedef struct { #pragma pack(pop) TDB_STATIC_ASSERT(sizeof(SFileHdr) == 128, "Size of file header is not correct"); - +*/ struct hashset_st { size_t nbits; size_t mask; @@ -234,7 +234,6 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { int ret; SPage **ppPage; - // ASSERT(pPager->inTran); if (pPage->isDirty) return 0; // ref page one more time so the page will not be release @@ -243,23 +242,8 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { // Set page as dirty pPage->isDirty = 1; - /* - // Add page to dirty list(TODO: NOT use O(n^2) algorithm) - for (ppPage = &pPager->pDirty; (*ppPage) && TDB_PAGE_PGNO(*ppPage) < TDB_PAGE_PGNO(pPage); - ppPage = &((*ppPage)->pDirtyNext)) { - } - if (*ppPage && TDB_PAGE_PGNO(*ppPage) == TDB_PAGE_PGNO(pPage)) { - tdbUnrefPage(pPage); - - return 0; - } - - ASSERT(*ppPage == NULL || TDB_PAGE_PGNO(*ppPage) > TDB_PAGE_PGNO(pPage)); - pPage->pDirtyNext = *ppPage; - *ppPage = pPage; - */ - tdbTrace("put page: %p %d to dirty tree: %p", pPage, TDB_PAGE_PGNO(pPage), &pPager->rbt); + tdbTrace("tdb/pager-write: put page: %p %d to dirty tree: %p", pPage, TDB_PAGE_PGNO(pPage), &pPager->rbt); tRBTreePut(&pPager->rbt, (SRBTreeNode *)pPage); // Write page to journal if neccessary @@ -299,6 +283,9 @@ int tdbPagerBegin(SPager *pPager, TXN *pTxn) { pTxn->jPageSet = hashset_create(); pPager->pActiveTxn = pTxn; + + tdbDebug("pager/begin: %p, %d/%d, txnId:%" PRId64, pPager, pPager->dbOrigSize, pPager->dbFileSize, pTxn->txnId); + // TODO: write the size of the file /* pPager->inTran = 1; @@ -324,7 +311,11 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) { while ((pNode = tRBTreeIterNext(&iter)) != NULL) { pPage = (SPage *)pNode; - ASSERT(pPage->nOverflow == 0); + if (pPage->nOverflow != 0) { + tdbError("tdb/pager-commit: %p, pPage: %p, ovfl: %d, commit page failed.", pPager, pPage, pPage->nOverflow); + return -1; + } + ret = tdbPagerPWritePageToDB(pPager, pPage); if (ret < 0) { tdbError("failed to write page to db since %s", tstrerror(terrno)); @@ -332,7 +323,8 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) { } } - tdbTrace("tdbttl commit:%p, %d/%d", pPager, pPager->dbOrigSize, pPager->dbFileSize); + tdbDebug("pager/commit: %p, %d/%d, txnId:%" PRId64, pPager, pPager->dbOrigSize, pPager->dbFileSize, pTxn->txnId); + pPager->dbOrigSize = pPager->dbFileSize; // release the page @@ -381,6 +373,8 @@ int tdbPagerPostCommit(SPager *pPager, TXN *pTxn) { // pPager->inTran = 0; + tdbDebug("pager/post-commit:%p, %d/%d", pPager, pPager->dbOrigSize, pPager->dbFileSize); + return 0; } @@ -477,7 +471,7 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) { return -1; } - tdbDebug("tdb/abort: pager:%p,", pPager); + tdbDebug("pager/abort: %p, %d/%d, txnId:%" PRId64, pPager, pPager->dbOrigSize, pPager->dbFileSize, pTxn->txnId); for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) { // read pgno & the page from journal @@ -489,7 +483,9 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) { return -1; } - tdbTrace("tdb/abort: pgno:%d,", pgno); + tdbTrace("pager/abort: restore pgno:%d,", pgno); + + tdbPCacheInvalidatePage(pPager->pCache, pPager, pgno); ret = tdbOsRead(jfd, pageBuf, pPager->pageSize); if (ret < 0) { @@ -529,6 +525,9 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) { SRBTreeNode *pNode = NULL; while ((pNode = tRBTreeIterNext(&iter)) != NULL) { pPage = (SPage *)pNode; + SPgno pgno = TDB_PAGE_PGNO(pPage); + + tdbTrace("pager/abort: drop dirty pgno:%d,", pgno); pPage->isDirty = 0; @@ -538,7 +537,7 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) { tdbPCacheRelease(pPager->pCache, pPage, pTxn); } - tdbTrace("reset dirty tree: %p", &pPager->rbt); + tdbTrace("pager/abort: reset dirty tree: %p", &pPager->rbt); tRBTreeCreate(&pPager->rbt, pageCmpFn); // 4, remove the journal file @@ -599,6 +598,9 @@ int tdbPagerFlushPage(SPager *pPager, TXN *pTxn) { break; } + + tdbDebug("pager/flush: %p, %d/%d, txnId:%" PRId64, pPager, pPager->dbOrigSize, pPager->dbFileSize, pTxn->txnId); + /* tdbTrace("tdb/flush:%p, %d/%d/%d", pPager, pPager->dbOrigSize, pPager->dbFileSize, maxPgno); pPager->dbOrigSize = maxPgno; @@ -638,12 +640,15 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa loadPage = 0; ret = tdbPagerAllocPage(pPager, &pgno); if (ret < 0) { - ASSERT(0); + tdbError("tdb/pager: %p, ret: %d pgno: %" PRIu32 ", alloc page failed.", pPager, ret, pgno); return -1; } } - ASSERT(pgno > 0); + if (pgno == 0) { + tdbError("tdb/pager: %p, ret: %d pgno: %" PRIu32 ", alloc page failed.", pPager, ret, pgno); + return -1; + } // fetch a page container memcpy(&pgid, pPager->fid, TDB_FILE_ID_LEN); @@ -657,7 +662,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa if (!TDB_PAGE_INITIALIZED(pPage)) { ret = tdbPagerInitPage(pPager, pPage, initPage, arg, loadPage); if (ret < 0) { - ASSERT(0); + tdbError("tdb/pager: %p, pPage: %p, init page failed.", pPager, pPage); return -1; } } @@ -665,8 +670,14 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa // printf("thread %" PRId64 " pager fetch page %d pgno %d ppage %p\n", taosGetSelfPthreadId(), pPage->id, // TDB_PAGE_PGNO(pPage), pPage); - ASSERT(TDB_PAGE_INITIALIZED(pPage)); - ASSERT(pPage->pPager == pPager); + if (!TDB_PAGE_INITIALIZED(pPage)) { + tdbError("tdb/pager: %p, pPage: %p, fetch page uninited.", pPager, pPage); + return -1; + } + if (pPage->pPager != pPager) { + tdbError("tdb/pager: %p/%p, fetch page failed.", pPager, pPage->pPager); + return -1; + } *ppgno = pgno; *ppPage = pPage; @@ -708,8 +719,10 @@ int tdbPagerAllocPage(SPager *pPager, SPgno *ppgno) { return -1; } - ASSERT(*ppgno != 0); - + if (*ppgno == 0) { + tdbError("tdb/pager:%p, alloc new page failed.", pPager); + return -1; + } return 0; } @@ -738,7 +751,6 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage nRead = tdbOsPRead(pPager->fd, pPage->pData, pPage->pageSize, ((i64)pPage->pageSize) * (pgno - 1)); tdbTrace("tdb/pager:%p, pgno:%d, nRead:%" PRId64, pPager, pgno, nRead); if (nRead < pPage->pageSize) { - ASSERT(0); tdbError("tdb/pager:%p, pgno:%d, nRead:%" PRId64 "pgSize:%" PRId32, pPager, pgno, nRead, pPage->pageSize); TDB_UNLOCK_PAGE(pPage); return -1; @@ -749,7 +761,8 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage ret = (*initPage)(pPage, arg, init); if (ret < 0) { - ASSERT(0); + tdbError("tdb/pager:%p, pgno:%d, nRead:%" PRId64 "pgSize:%" PRId32 " init page failed.", pPager, pgno, nRead, + pPage->pageSize); TDB_UNLOCK_PAGE(pPage); return -1; } @@ -768,7 +781,8 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage } } } else { - ASSERT(0); + tdbError("tdb/pager:%p, pgno:%d, nRead:%" PRId64 "pgSize:%" PRId32 " lock page failed.", pPager, pgno, nRead, + pPage->pageSize); return -1; } @@ -855,11 +869,19 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + if (tdbOsLSeek(jfd, 0L, SEEK_SET) < 0) { + tdbError("failed to lseek jfd due to %s. file:%s, offset:0", strerror(errno), pPager->dbFileName); + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + pageBuf = tdbOsCalloc(1, pPager->pageSize); if (pageBuf == NULL) { return -1; } + tdbDebug("pager/restore: %p, %d/%d, txnId:%s", pPager, pPager->dbOrigSize, pPager->dbFileSize, jFileName); + for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) { // read pgno & the page from journal SPgno pgno; @@ -870,6 +892,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbTrace("pager/restore: restore pgno:%d,", pgno); + ret = tdbOsRead(jfd, pageBuf, pPager->pageSize); if (ret < 0) { tdbOsFree(pageBuf); @@ -909,7 +933,7 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } - if (tdbOsRemove(pPager->jFileName) < 0 && errno != ENOENT) { + if (tdbOsRemove(jFileName) < 0 && errno != ENOENT) { tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), pPager->jFileName); terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -929,7 +953,12 @@ int tdbPagerRestoreJournals(SPager *pPager) { while ((pDirEntry = tdbReadDir(pDir)) != NULL) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbPagerRestore(pPager, name) < 0) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbPagerRestore(pPager, jname) < 0) { tdbCloseDir(&pDir); tdbError("failed to restore file due to %s. jFileName:%s", strerror(errno), name); @@ -955,7 +984,12 @@ int tdbPagerRollback(SPager *pPager) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbOsRemove(name) < 0 && errno != ENOENT) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbOsRemove(jname) < 0 && errno != ENOENT) { tdbCloseDir(&pDir); tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), name); diff --git a/source/libs/tdb/src/db/tdbTable.c b/source/libs/tdb/src/db/tdbTable.c index 2950169979..18d14fa474 100644 --- a/source/libs/tdb/src/db/tdbTable.c +++ b/source/libs/tdb/src/db/tdbTable.c @@ -105,16 +105,14 @@ int tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprF #endif - ASSERT(pPager != NULL); - if (rollback) { - tdbPagerRollback(pPager); - } else { ret = tdbPagerRestoreJournals(pPager); if (ret < 0) { tdbOsFree(pTb); return -1; } + } else { + tdbPagerRollback(pPager); } // pTb->pBt diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index 055d9c7f98..bc23fdb759 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -18,7 +18,10 @@ int tdbTxnOpen(TXN *pTxn, int64_t txnid, void *(*xMalloc)(void *, size_t), void (*xFree)(void *, void *), void *xArg, int flags) { // not support read-committed version at the moment - ASSERT(flags == 0 || flags == (TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED)); + if (flags != 0 && flags != (TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED)) { + tdbError("tdb/txn: invalid txn flags: %" PRId32, flags); + return -1; + } pTxn->flags = flags; pTxn->txnId = txnid; diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 45e01e83f3..62466e9c47 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -224,6 +224,7 @@ int tdbPCacheAlter(SPCache *pCache, int32_t nPage); SPage *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, TXN *pTxn); void tdbPCacheRelease(SPCache *pCache, SPage *pPage, TXN *pTxn); void tdbPCacheMarkFree(SPCache *pCache, SPage *pPage); +void tdbPCacheInvalidatePage(SPCache *pCache, SPager *pPager, SPgno pgno); int tdbPCacheGetPageSize(SPCache *pCache); // tdbPage.c ==================================== diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index d144a76eb0..1dc79e0cfb 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1665,11 +1665,20 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { if (pCtx->retryCode != TSDB_CODE_SUCCESS) { int32_t code = pResp->code; // return internal code app - if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK) { + if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { pResp->code = pCtx->retryCode; } } + // check whole vnodes is offline on this vgroup + if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { + if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { + pResp->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; + } else if (pResp->code == TSDB_CODE_RPC_BROKEN_LINK) { + pResp->code = TSDB_CODE_RPC_SOMENODE_BROKEN_LINK; + } + } + STraceId* trace = &pResp->info.traceId; bool hasEpSet = cliTryExtractEpSet(pResp, &pCtx->epSet); if (hasEpSet) { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 2b1f68d5f6..7384877313 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1001,6 +1001,13 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, uv_loop_init(srv->loop); char pipeName[PATH_MAX]; + + if (false == taosValidIpAndPort(srv->ip, srv->port)) { + terrno = TAOS_SYSTEM_ERROR(errno); + tError("invalid ip/port, %d:%d, reason:%s", srv->ip, srv->port, terrstr()); + goto End; + } + #if defined(WINDOWS) || defined(DARWIN) int ret = uv_pipe_init(srv->loop, &srv->pipeListen, 0); if (ret != 0) { @@ -1087,12 +1094,6 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, } #endif - if (false == taosValidIpAndPort(srv->ip, srv->port)) { - terrno = TAOS_SYSTEM_ERROR(errno); - tError("invalid ip/port, %d:%d, reason:%s", srv->ip, srv->port, terrstr()); - goto End; - } - if (false == addHandleToAcceptloop(srv)) { goto End; } @@ -1185,8 +1186,8 @@ void transCloseServer(void* arg) { // impl later SServerObj* srv = arg; - tDebug("send quit msg to accept thread"); if (srv->inited) { + tDebug("send quit msg to accept thread"); uv_async_send(srv->pAcceptAsync); taosThreadJoin(srv->thread, NULL); SRV_RELEASE_UV(srv->loop); diff --git a/source/os/CMakeLists.txt b/source/os/CMakeLists.txt index b7cb20896b..3aac5e9775 100644 --- a/source/os/CMakeLists.txt +++ b/source/os/CMakeLists.txt @@ -41,9 +41,13 @@ target_link_libraries( ) if(TD_WINDOWS) target_link_libraries( - os PUBLIC ws2_32 iconv msvcregex wcwidth winmm crashdump + os PUBLIC ws2_32 iconv msvcregex wcwidth winmm crashdump dbghelp ) elseif(TD_DARWIN_64) + find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation) + target_link_libraries(os PUBLIC ${CORE_FOUNDATION_FRAMEWORK}) + find_library(SYSTEM_CONFIGURATION_FRAMEWORK SystemConfiguration) + target_link_libraries(os PUBLIC ${SYSTEM_CONFIGURATION_FRAMEWORK}) target_link_libraries( os PUBLIC dl m iconv ) @@ -55,4 +59,8 @@ endif() IF (JEMALLOC_ENABLED) target_link_libraries(os PUBLIC -ljemalloc) -ENDIF () \ No newline at end of file +ENDIF () + +if(${BUILD_TEST}) + add_subdirectory(test) +endif(${BUILD_TEST}) \ No newline at end of file diff --git a/source/os/src/osEnv.c b/source/os/src/osEnv.c index c4627ffb75..7f0e6d1dee 100644 --- a/source/os/src/osEnv.c +++ b/source/os/src/osEnv.c @@ -37,11 +37,11 @@ float tsNumOfCores = 0; int64_t tsTotalMemoryKB = 0; char *tsProcPath = NULL; -char tsSIMDBuiltins = 0; -char tsSSE42Enable = 0; -char tsAVXEnable = 0; -char tsAVX2Enable = 0; -char tsFMAEnable = 0; +char tsSIMDBuiltins = 0; +char tsSSE42Enable = 0; +char tsAVXEnable = 0; +char tsAVX2Enable = 0; +char tsFMAEnable = 0; void osDefaultInit() { taosSeedRand(taosSafeRand()); diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index d8cccc83ed..ab9829538d 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -560,6 +560,21 @@ int32_t taosFStatFile(TdFilePtr pFile, int64_t *size, int32_t *mtime) { int32_t taosLockFile(TdFilePtr pFile) { #ifdef WINDOWS + BOOL fSuccess = FALSE; + LARGE_INTEGER fileSize; + OVERLAPPED overlapped = {0}; + + HANDLE hFile = (HANDLE)_get_osfhandle(pFile->fd); + + fSuccess = LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, + 0, // reserved + ~0, // number of bytes to lock low + ~0, // number of bytes to lock high + &overlapped // overlapped structure + ); + if (!fSuccess) { + return GetLastError(); + } return 0; #else assert(pFile->fd >= 0); // Please check if you have closed the file. @@ -570,6 +585,14 @@ int32_t taosLockFile(TdFilePtr pFile) { int32_t taosUnLockFile(TdFilePtr pFile) { #ifdef WINDOWS + BOOL fSuccess = FALSE; + OVERLAPPED overlapped = {0}; + HANDLE hFile = (HANDLE)_get_osfhandle(pFile->fd); + + fSuccess = UnlockFileEx(hFile, 0, ~0, ~0, &overlapped); + if (!fSuccess) { + return GetLastError(); + } return 0; #else assert(pFile->fd >= 0); // Please check if you have closed the file. diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c index cd2acac261..dddadd5ff6 100644 --- a/source/os/src/osMath.c +++ b/source/os/src/osMath.c @@ -16,6 +16,7 @@ #define ALLOW_FORBID_FUNC #define _DEFAULT_SOURCE #include "os.h" +#include #ifdef WINDOWS void swapStr(char* j, char* J, int width) { @@ -33,16 +34,5 @@ void swapStr(char* j, char* J, int width) { // todo refactor: 1) move away; 2) use merge sort instead; 3) qsort is not a stable sort actually. void taosSort(void* arr, int64_t sz, int64_t width, __compar_fn_t compar) { -#ifdef WINDOWS - int64_t i, j; - for (i = 0; i < sz - 1; i++) { - for (j = 0; j < sz - 1 - i; j++) { - if (compar((char*)arr + j * width, (char*)arr + (j + 1) * width) > 0.00) { - swapStr((char*)arr + j * width, (char*)arr + (j + 1) * width, width); - } - } - } -#else qsort(arr, sz, width, compar); -#endif } diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index db2a9937b5..6611a937f2 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -988,7 +988,7 @@ int32_t taosGetFqdn(char *fqdn) { #endif char hostname[1024]; hostname[1023] = '\0'; - if (gethostname(hostname, 1023) == -1) { + if (taosGetlocalhostname(hostname, 1023) == -1) { #ifdef WINDOWS printf("failed to get hostname, reason:%s\n", strerror(WSAGetLastError())); #else @@ -998,30 +998,28 @@ int32_t taosGetFqdn(char *fqdn) { return -1; } - struct addrinfo hints = {0}; - struct addrinfo *result = NULL; #ifdef __APPLE__ // on macosx, hostname -f has the form of xxx.local // which will block getaddrinfo for a few seconds if AI_CANONNAME is set // thus, we choose AF_INET (ipv4 for the moment) to make getaddrinfo return // immediately - hints.ai_family = AF_INET; + // hints.ai_family = AF_INET; + strcpy(fqdn, hostname); + strcpy(fqdn+strlen(hostname), ".local"); #else // __APPLE__ + struct addrinfo hints = {0}; + struct addrinfo *result = NULL; hints.ai_flags = AI_CANONNAME; -#endif // __APPLE__ + int32_t ret = getaddrinfo(hostname, NULL, &hints, &result); if (!result) { fprintf(stderr, "failed to get fqdn, code:%d, reason:%s\n", ret, gai_strerror(ret)); return -1; } - -#ifdef __APPLE__ - // refer to comments above - strcpy(fqdn, hostname); -#else // __APPLE__ strcpy(fqdn, result->ai_canonname); -#endif // __APPLE__ freeaddrinfo(result); +#endif // __APPLE__ + return 0; } diff --git a/source/os/src/osString.c b/source/os/src/osString.c index f03778de2f..5419da1c0c 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -116,39 +116,36 @@ TdUcs4 *tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) return memcpy(target_ucs4, source_ucs4, len_ucs4 * sizeof(TdUcs4)); } -int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) { -#ifdef DISALLOW_NCHAR_WITHOUT_ICONV - printf("Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.\n"); - return -1; -#else - iconv_t cd = iconv_open(tsCharset, DEFAULT_UNICODE_ENCODEC); - size_t ucs4_input_len = ucs4_max_len; - size_t outLen = ucs4_max_len; - if (iconv(cd, (char **)&ucs4, &ucs4_input_len, &mbs, &outLen) == -1) { - iconv_close(cd); - return -1; - } - - iconv_close(cd); - return (int32_t)(ucs4_max_len - outLen); -#endif -} - typedef struct { iconv_t conv; int8_t inUse; } SConv; -SConv *gConv = NULL; -int32_t convUsed = 0; -int32_t gConvMaxNum = 0; +typedef enum { M2C = 0, C2M } ConvType; + +// 0: Mbs --> Ucs4 +// 1: Ucs4--> Mbs +SConv *gConv[2] = {NULL, NULL}; +int32_t convUsed[2] = {0, 0}; +int32_t gConvMaxNum[2] = {0, 0}; int32_t taosConvInit(void) { - gConvMaxNum = 512; - gConv = taosMemoryCalloc(gConvMaxNum, sizeof(SConv)); - for (int32_t i = 0; i < gConvMaxNum; ++i) { - gConv[i].conv = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); - if ((iconv_t)-1 == gConv[i].conv || (iconv_t)0 == gConv[i].conv) { + int8_t M2C = 0; + gConvMaxNum[M2C] = 512; + gConvMaxNum[1 - M2C] = 512; + + gConv[M2C] = taosMemoryCalloc(gConvMaxNum[M2C], sizeof(SConv)); + gConv[1 - M2C] = taosMemoryCalloc(gConvMaxNum[1 - M2C], sizeof(SConv)); + + for (int32_t i = 0; i < gConvMaxNum[M2C]; ++i) { + gConv[M2C][i].conv = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); + if ((iconv_t)-1 == gConv[M2C][i].conv || (iconv_t)0 == gConv[M2C][i].conv) { + return -1; + } + } + for (int32_t i = 0; i < gConvMaxNum[1 - M2C]; ++i) { + gConv[1 - M2C][i].conv = iconv_open(tsCharset, DEFAULT_UNICODE_ENCODEC); + if ((iconv_t)-1 == gConv[1 - M2C][i].conv || (iconv_t)0 == gConv[1 - M2C][i].conv) { return -1; } } @@ -157,23 +154,33 @@ int32_t taosConvInit(void) { } void taosConvDestroy() { - for (int32_t i = 0; i < gConvMaxNum; ++i) { - iconv_close(gConv[i].conv); + int8_t M2C = 0; + for (int32_t i = 0; i < gConvMaxNum[M2C]; ++i) { + iconv_close(gConv[M2C][i].conv); } - taosMemoryFreeClear(gConv); - gConvMaxNum = -1; + for (int32_t i = 0; i < gConvMaxNum[1 - M2C]; ++i) { + iconv_close(gConv[1 - M2C][i].conv); + } + taosMemoryFreeClear(gConv[M2C]); + taosMemoryFreeClear(gConv[1 - M2C]); + gConvMaxNum[M2C] = -1; + gConvMaxNum[1 - M2C] = -1; } -iconv_t taosAcquireConv(int32_t *idx) { - if (gConvMaxNum <= 0) { +iconv_t taosAcquireConv(int32_t *idx, ConvType type) { + if (gConvMaxNum[type] <= 0) { *idx = -1; - return iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); + if (type == M2C) { + return iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); + } else { + return iconv_open(tsCharset, DEFAULT_UNICODE_ENCODEC); + } } while (true) { - int32_t used = atomic_add_fetch_32(&convUsed, 1); - if (used > gConvMaxNum) { - used = atomic_sub_fetch_32(&convUsed, 1); + int32_t used = atomic_add_fetch_32(&convUsed[type], 1); + if (used > gConvMaxNum[type]) { + used = atomic_sub_fetch_32(&convUsed[type], 1); sched_yield(); continue; } @@ -181,31 +188,31 @@ iconv_t taosAcquireConv(int32_t *idx) { break; } - int32_t startId = taosGetSelfPthreadId() % gConvMaxNum; + int32_t startId = taosGetSelfPthreadId() % gConvMaxNum[type]; while (true) { - if (gConv[startId].inUse) { - startId = (startId + 1) % gConvMaxNum; + if (gConv[type][startId].inUse) { + startId = (startId + 1) % gConvMaxNum[type]; continue; } - int8_t old = atomic_val_compare_exchange_8(&gConv[startId].inUse, 0, 1); + int8_t old = atomic_val_compare_exchange_8(&gConv[type][startId].inUse, 0, 1); if (0 == old) { break; } } *idx = startId; - return gConv[startId].conv; + return gConv[type][startId].conv; } -void taosReleaseConv(int32_t idx, iconv_t conv) { +void taosReleaseConv(int32_t idx, iconv_t conv, ConvType type) { if (idx < 0) { iconv_close(conv); return; } - atomic_store_8(&gConv[idx].inUse, 0); - atomic_sub_fetch_32(&convUsed, 1); + atomic_store_8(&gConv[type][idx].inUse, 0); + atomic_sub_fetch_32(&convUsed[type], 1); } bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len) { @@ -216,15 +223,15 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4 memset(ucs4, 0, ucs4_max_len); int32_t idx = -1; - iconv_t conv = taosAcquireConv(&idx); + iconv_t conv = taosAcquireConv(&idx, M2C); size_t ucs4_input_len = mbsLength; size_t outLeft = ucs4_max_len; if (iconv(conv, (char **)&mbs, &ucs4_input_len, (char **)&ucs4, &outLeft) == -1) { - taosReleaseConv(idx, conv); + taosReleaseConv(idx, conv, M2C); return false; } - taosReleaseConv(idx, conv); + taosReleaseConv(idx, conv, M2C); if (len != NULL) { *len = (int32_t)(ucs4_max_len - outLeft); if (*len < 0) { @@ -236,6 +243,24 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4 #endif } +int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) { +#ifdef DISALLOW_NCHAR_WITHOUT_ICONV + printf("Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.\n"); + return -1; +#else + + int32_t idx = -1; + iconv_t conv = taosAcquireConv(&idx, C2M); + size_t ucs4_input_len = ucs4_max_len; + size_t outLen = ucs4_max_len; + if (iconv(conv, (char **)&ucs4, &ucs4_input_len, &mbs, &outLen) == -1) { + taosReleaseConv(idx, conv, C2M); + return -1; + } + taosReleaseConv(idx, conv, C2M); + return (int32_t)(ucs4_max_len - outLen); +#endif +} bool taosValidateEncodec(const char *encodec) { #ifdef DISALLOW_NCHAR_WITHOUT_ICONV printf("Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.\n"); diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index e1abe84841..6c9bf40e4d 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -98,6 +98,9 @@ LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS exception); #include #include #include +#include +#include +#include #else @@ -1007,6 +1010,11 @@ SysNameInfo taosGetSysNameInfo() { tstrncpy(info.machine, uts.machine, sizeof(info.machine)); } + char localHostName[512]; + taosGetlocalhostname(localHostName, 512); + TdCmdPtr pCmd = taosOpenCmd("scutil --get LocalHostName"); + tstrncpy(info.nodename, localHostName, sizeof(info.nodename)); + return info; #else SysNameInfo info = {0}; @@ -1042,3 +1050,46 @@ bool taosCheckCurrentInDll() { return false; #endif } + +#ifdef _TD_DARWIN_64 +int taosGetMaclocalhostnameByCommand(char *hostname, size_t maxLen) { + TdCmdPtr pCmd = taosOpenCmd("scutil --get LocalHostName"); + if (pCmd != NULL) { + if (taosGetsCmd(pCmd, maxLen - 1, hostname) > 0) { + int len = strlen(hostname); + if (hostname[len - 1] == '\n') { + hostname[len - 1] = '\0'; + } + return 0; + } + taosCloseCmd(&pCmd); + } + return -1; +} + +int getMacLocalHostNameBySCD(char *hostname, size_t maxLen) { + SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR(""), NULL, NULL); + CFStringRef hostname_cfstr = SCDynamicStoreCopyLocalHostName(store); + if (hostname_cfstr != NULL) { + CFStringGetCString(hostname_cfstr, hostname, maxLen - 1, kCFStringEncodingMacRoman); + CFRelease(hostname_cfstr); + } else { + return -1; + } + CFRelease(store); + return 0; +} +#endif + +int taosGetlocalhostname(char *hostname, size_t maxLen) { +#ifdef _TD_DARWIN_64 + int res = getMacLocalHostNameBySCD(hostname, maxLen); + if (res != 0) { + return taosGetMaclocalhostnameByCommand(hostname, maxLen); + } else { + return 0; + } +#else + return gethostname(hostname, maxLen); +#endif +} diff --git a/source/os/test/CMakeLists.txt b/source/os/test/CMakeLists.txt new file mode 100644 index 0000000000..21fb2ee630 --- /dev/null +++ b/source/os/test/CMakeLists.txt @@ -0,0 +1,24 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8...3.20) +PROJECT(TDengine) + +FIND_PATH(HEADER_GTEST_INCLUDE_DIR gtest.h /usr/include/gtest /usr/local/include/gtest) +FIND_LIBRARY(LIB_GTEST_STATIC_DIR libgtest.a /usr/lib/ /usr/local/lib /usr/lib64) +FIND_LIBRARY(LIB_GTEST_SHARED_DIR libgtest.so /usr/lib/ /usr/local/lib /usr/lib64) + +IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR)) + MESSAGE(STATUS "gTest library found, build os test") + + INCLUDE_DIRECTORIES(${HEADER_GTEST_INCLUDE_DIR}) + AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) + +ENDIF() + +INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc) + +# osTests +add_executable(osTests "osTests.cpp") +target_link_libraries(osTests os util gtest_main) +add_test( + NAME osTests + COMMAND osTests +) \ No newline at end of file diff --git a/source/os/test/osTests.cpp b/source/os/test/osTests.cpp index e69de29bb2..f831f457f9 100644 --- a/source/os/test/osTests.cpp +++ b/source/os/test/osTests.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osTest, osSystem) { + const char *flags = "UTL FATAL "; + ELogLevel level = DEBUG_FATAL; + int32_t dflag = 255; // tsLogEmbedded ? 255 : uDebugFlag + taosPrintTrace(flags, level, dflag); +} + +void fileOperateOnFree(void *param) { + char * fname = (char *)param; + TdFilePtr pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE); + printf("On free thread open file\n"); + ASSERT_NE(pFile, nullptr); + + int ret = taosLockFile(pFile); + printf("On free thread lock file ret:%d\n", ret); + ASSERT_EQ(ret, 0); + + ret = taosUnLockFile(pFile); + printf("On free thread unlock file ret:%d\n", ret); + ASSERT_EQ(ret, 0); + + ret = taosCloseFile(&pFile); + ASSERT_EQ(ret, 0); + printf("On free thread close file ret:%d\n", ret); +} +void *fileOperateOnFreeThread(void *param) { + fileOperateOnFree(param); + return NULL; +} +void fileOperateOnBusy(void *param) { + char * fname = (char *)param; + TdFilePtr pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE); + printf("On busy thread open file\n"); + ASSERT_NE(pFile, nullptr); + + int ret = taosLockFile(pFile); + printf("On busy thread lock file ret:%d\n", ret); + ASSERT_NE(ret, 0); + + ret = taosUnLockFile(pFile); + printf("On busy thread unlock file ret:%d\n", ret); +#ifdef _TD_DARWIN_64 + ASSERT_EQ(ret, 0); +#else + ASSERT_NE(ret, 0); +#endif + + ret = taosCloseFile(&pFile); + printf("On busy thread close file ret:%d\n", ret); + ASSERT_EQ(ret, 0); +} +void *fileOperateOnBusyThread(void *param) { + fileOperateOnBusy(param); + return NULL; +} + +TEST(osTest, osFile) { + char *fname = "./osfiletest1.txt"; + + TdFilePtr pOutFD = taosCreateFile(fname, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC); + ASSERT_NE(pOutFD, nullptr); + printf("create file success\n"); + + TdFilePtr pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE); + printf("open file\n"); + ASSERT_NE(pFile, nullptr); + + int ret = taosLockFile(pFile); + printf("lock file ret:%d\n", ret); + ASSERT_EQ(ret, 0); + + TdThreadAttr thattr; + taosThreadAttrInit(&thattr); + + TdThread thread1, thread2; + taosThreadCreate(&(thread1), &thattr, fileOperateOnBusyThread, (void *)fname); + taosThreadAttrDestroy(&thattr); + + taosThreadJoin(thread1, NULL); + taosThreadClear(&thread1); + + ret = taosUnLockFile(pFile); + printf("unlock file ret:%d\n", ret); + ASSERT_EQ(ret, 0); + + ret = taosCloseFile(&pFile); + printf("close file ret:%d\n", ret); + ASSERT_EQ(ret, 0); + + taosThreadCreate(&(thread2), &thattr, fileOperateOnFreeThread, (void *)fname); + taosThreadAttrDestroy(&thattr); + + taosThreadJoin(thread2, NULL); + taosThreadClear(&thread2); + + //int ret = taosRemoveFile(fname); + //ASSERT_EQ(ret, 0); + //printf("remove file success"); +} + +#pragma GCC diagnostic pop diff --git a/source/util/src/terror.c b/source/util/src/terror.c index f1b0633cbe..7bf63abc5f 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -51,6 +51,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQD TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_TIMEOUT, "Conn read timeout") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED, "some vnode/qnode/mnode(s) out of service") //common & util TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized") @@ -249,16 +250,19 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SINGLE_STB_MODE_DB, "Database is single st TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SCHEMA_VER, "Invalid schema version while alter stb") TAOS_DEFINE_ERROR(TSDB_CODE_MND_STABLE_UID_NOT_MATCH, "Invalid stable uid while alter stb") TAOS_DEFINE_ERROR(TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA, "Field used by tsma") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_CREATING, "Dnode in creating status") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_DROPPING, "Dnode in dropping status") // mnode-trans TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid stage to kill") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CONFLICT, "Conflict transaction not completed") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_UNKNOW_ERROR, "Unknown transaction error") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CLOG_IS_NULL, "Transaction commitlog is null") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL, "Unable to establish connection While execute transaction and will continue in the background") TAOS_DEFINE_ERROR(TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED, "Last Transaction not finished") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL, "Unable to establish connection While execute transaction") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT, "Sync timeout While execute transaction and will continue in the background") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_UNKNOW_ERROR, "Unknown transaction error") // mnode-mq TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOPIC_ALREADY_EXIST, "Topic already exists") @@ -403,6 +407,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_PROPOSE_NOT_READY, "Sync not ready for pr TAOS_DEFINE_ERROR(TSDB_CODE_SYN_STANDBY_NOT_READY, "Sync not ready for standby") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_BATCH_ERROR, "Sync batch error") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_RESTORING, "Sync is restoring") +TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG, "Sync invalid snapshot msg") +TAOS_DEFINE_ERROR(TSDB_CODE_SYN_BUFFER_FULL, "Sync buffer is full") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INTERNAL_ERROR, "Sync internal error") //tq @@ -642,13 +648,10 @@ const char* tstrerror(int32_t err) { // this is a system errno if ((err & 0x00ff0000) == 0x00ff0000) { int32_t code = err & 0x0000ffff; - if (code >= 0 && code < 36) { - return strerror(code); - } else { - return "unknown err"; - } + // strerror can handle any invalid code + // invalid code return Unknown error + return strerror(code); } - int32_t s = 0; int32_t e = sizeof(errors) / sizeof(errors[0]); diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 37874ae250..ced5b4f25e 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -621,11 +621,13 @@ void dBufPrintStatis(const SDiskbasedBuf* pBuf) { const SDiskbasedBufStatis* ps = &pBuf->statis; +#if 0 printf( "Paged buffer closed, total:%.2f Kb (%d Pages), inmem size:%.2f Kb (%d Pages), file size:%.2f Kb, page size:%.2f " "Kb, %s\n", pBuf->totalBufSize / 1024.0, pBuf->numOfPages, listNEles(pBuf->lruList) * pBuf->pageSize / 1024.0, listNEles(pBuf->lruList), pBuf->fileSize / 1024.0, pBuf->pageSize / 1024.0f, pBuf->id); +#endif if (ps->loadPages > 0) { printf( @@ -634,7 +636,7 @@ void dBufPrintStatis(const SDiskbasedBuf* pBuf) { ps->getPages, ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f, ps->loadPages, ps->loadBytes / (1024.0 * ps->loadPages)); } else { - printf("no page loaded\n"); + //printf("no page loaded\n"); } } diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 863cee9b08..a9a84c1860 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -36,7 +36,7 @@ int32_t tQWorkerInit(SQWorkerPool *pool) { worker->pool = pool; } - uDebug("worker:%s is initialized, min:%d max:%d", pool->name, pool->min, pool->max); + uInfo("worker:%s is initialized, min:%d max:%d", pool->name, pool->min, pool->max); return 0; } @@ -51,8 +51,10 @@ void tQWorkerCleanup(SQWorkerPool *pool) { for (int32_t i = 0; i < pool->max; ++i) { SQWorker *worker = pool->workers + i; if (taosCheckPthreadValid(worker->thread)) { + uInfo("worker:%s:%d is stopping", pool->name, worker->id); taosThreadJoin(worker->thread, NULL); taosThreadClear(&worker->thread); + uInfo("worker:%s:%d is stopped", pool->name, worker->id); } } @@ -60,7 +62,7 @@ void tQWorkerCleanup(SQWorkerPool *pool) { taosCloseQset(pool->qset); taosThreadMutexDestroy(&pool->mutex); - uDebug("worker:%s is closed", pool->name); + uInfo("worker:%s is closed", pool->name); } static void *tQWorkerThreadFp(SQWorker *worker) { @@ -119,7 +121,7 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) { taosThreadAttrDestroy(&thAttr); pool->num++; - uDebug("worker:%s:%d is launched, total:%d", pool->name, worker->id, pool->num); + uInfo("worker:%s:%d is launched, total:%d", pool->name, worker->id, pool->num); } while (pool->num < pool->min); } @@ -130,7 +132,134 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) { } void tQWorkerFreeQueue(SQWorkerPool *pool, STaosQueue *queue) { - uDebug("worker:%s, queue:%p is freed", pool->name, queue); + uInfo("worker:%s, queue:%p is freed", pool->name, queue); + taosCloseQueue(queue); +} + +int32_t tAutoQWorkerInit(SAutoQWorkerPool *pool) { + pool->qset = taosOpenQset(); + pool->workers = taosArrayInit(2, sizeof(SQWorker *)); + if (pool->workers == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + (void)taosThreadMutexInit(&pool->mutex, NULL); + + uInfo("worker:%s is initialized as auto", pool->name); + return 0; +} + +void tAutoQWorkerCleanup(SAutoQWorkerPool *pool) { + int32_t size = taosArrayGetSize(pool->workers); + for (int32_t i = 0; i < size; ++i) { + SQWorker *worker = taosArrayGetP(pool->workers, i); + if (taosCheckPthreadValid(worker->thread)) { + taosQsetThreadResume(pool->qset); + } + } + + for (int32_t i = 0; i < size; ++i) { + SQWorker *worker = taosArrayGetP(pool->workers, i); + if (taosCheckPthreadValid(worker->thread)) { + uInfo("worker:%s:%d is stopping", pool->name, worker->id); + taosThreadJoin(worker->thread, NULL); + taosThreadClear(&worker->thread); + uInfo("worker:%s:%d is stopped", pool->name, worker->id); + } + taosMemoryFree(worker); + } + + taosArrayDestroy(pool->workers); + taosCloseQset(pool->qset); + taosThreadMutexDestroy(&pool->mutex); + + uInfo("worker:%s is closed", pool->name); +} + +static void *tAutoQWorkerThreadFp(SQWorker *worker) { + SAutoQWorkerPool *pool = worker->pool; + SQueueInfo qinfo = {0}; + void *msg = NULL; + int32_t code = 0; + + taosBlockSIGPIPE(); + setThreadName(pool->name); + worker->pid = taosGetSelfPthreadId(); + uInfo("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid); + + while (1) { + if (taosReadQitemFromQset(pool->qset, (void **)&msg, &qinfo) == 0) { + uInfo("worker:%s:%d qset:%p, got no message and exiting, thread:%08" PRId64, pool->name, worker->id, pool->qset, + worker->pid); + break; + } + + if (qinfo.fp != NULL) { + qinfo.workerId = worker->id; + qinfo.threadNum = taosArrayGetSize(pool->workers); + (*((FItem)qinfo.fp))(&qinfo, msg); + } + + taosUpdateItemSize(qinfo.queue, 1); + } + + return NULL; +} + +STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem fp) { + STaosQueue *queue = taosOpenQueue(); + if (queue == NULL) return NULL; + + taosThreadMutexLock(&pool->mutex); + taosSetQueueFp(queue, fp, NULL); + taosAddIntoQset(pool->qset, queue, ahandle); + + int32_t queueNum = taosGetQueueNumber(pool->qset); + int32_t curWorkerNum = taosArrayGetSize(pool->workers); + int32_t dstWorkerNum = ceil(queueNum * pool->ratio); + if (dstWorkerNum < 1) dstWorkerNum = 1; + + // spawn a thread to process queue + while (curWorkerNum < dstWorkerNum) { + SQWorker *worker = taosMemoryCalloc(1, sizeof(SQWorker)); + if (worker == NULL || taosArrayPush(pool->workers, &worker) == NULL) { + uError("worker:%s:%d failed to create", pool->name, curWorkerNum); + taosMemoryFree(worker); + taosCloseQueue(queue); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + worker->id = curWorkerNum; + worker->pool = pool; + + TdThreadAttr thAttr; + taosThreadAttrInit(&thAttr); + taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); + + if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tAutoQWorkerThreadFp, worker) != 0) { + uError("worker:%s:%d failed to create thread, total:%d", pool->name, worker->id, curWorkerNum); + (void)taosArrayPop(pool->workers); + taosMemoryFree(worker); + taosCloseQueue(queue); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + taosThreadAttrDestroy(&thAttr); + uInfo("worker:%s:%d is launched, total:%d", pool->name, worker->id, (int32_t)taosArrayGetSize(pool->workers)); + + curWorkerNum++; + } + + taosThreadMutexUnlock(&pool->mutex); + uInfo("worker:%s, queue:%p is allocated, ahandle:%p", pool->name, queue, ahandle); + + return queue; +} + +void tAutoQWorkerFreeQueue(SAutoQWorkerPool *pool, STaosQueue *queue) { + uInfo("worker:%s, queue:%p is freed", pool->name, queue); taosCloseQueue(queue); } @@ -152,7 +281,7 @@ int32_t tWWorkerInit(SWWorkerPool *pool) { worker->pool = pool; } - uDebug("worker:%s is initialized, max:%d", pool->name, pool->max); + uInfo("worker:%s is initialized, max:%d", pool->name, pool->max); return 0; } @@ -169,17 +298,19 @@ void tWWorkerCleanup(SWWorkerPool *pool) { for (int32_t i = 0; i < pool->max; ++i) { SWWorker *worker = pool->workers + i; if (taosCheckPthreadValid(worker->thread)) { + uInfo("worker:%s:%d is stopping", pool->name, worker->id); taosThreadJoin(worker->thread, NULL); taosThreadClear(&worker->thread); taosFreeQall(worker->qall); taosCloseQset(worker->qset); + uInfo("worker:%s:%d is stopped", pool->name, worker->id); } } taosMemoryFreeClear(pool->workers); taosThreadMutexDestroy(&pool->mutex); - uDebug("worker:%s is closed", pool->name); + uInfo("worker:%s is closed", pool->name); } static void *tWWorkerThreadFp(SWWorker *worker) { @@ -235,7 +366,7 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) { taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tWWorkerThreadFp, worker) != 0) goto _OVER; - uDebug("worker:%s:%d is launched, max:%d", pool->name, worker->id, pool->max); + uInfo("worker:%s:%d is launched, max:%d", pool->name, worker->id, pool->max); pool->nextId = (pool->nextId + 1) % pool->max; taosThreadAttrDestroy(&thAttr); @@ -259,13 +390,14 @@ _OVER: } else { while (worker->pid <= 0) taosMsleep(10); queue->threadId = worker->pid; - uInfo("worker:%s, queue:%p is allocated, ahandle:%p thread:%08" PRId64, pool->name, queue, ahandle, queue->threadId); + uInfo("worker:%s, queue:%p is allocated, ahandle:%p thread:%08" PRId64, pool->name, queue, ahandle, + queue->threadId); return queue; } } void tWWorkerFreeQueue(SWWorkerPool *pool, STaosQueue *queue) { - uDebug("worker:%s, queue:%p is freed", pool->name, queue); + uInfo("worker:%s, queue:%p is freed", pool->name, queue); taosCloseQueue(queue); } diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 44bf6cc6f1..15d3fc4a05 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -175,6 +175,7 @@ ,,y,script,./test.sh -f tsim/query/session.sim ,,y,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/query/udf_with_const.sim +,,y,script,./test.sh -f tsim/query/groupby.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim ,,y,script,./test.sh -f tsim/mnode/basic1.sim @@ -313,6 +314,7 @@ ,,y,script,./test.sh -f tsim/scalar/scalar.sim ,,y,script,./test.sh -f tsim/scalar/filter.sim ,,y,script,./test.sh -f tsim/scalar/caseWhen.sim +,,y,script,./test.sh -f tsim/scalar/tsConvert.sim ,,y,script,./test.sh -f tsim/alter/cached_schema_after_alter.sim ,,y,script,./test.sh -f tsim/alter/dnode.sim ,,y,script,./test.sh -f tsim/alter/table.sim @@ -416,6 +418,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/cachemodel.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/sysinfo.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_control.py +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_manage.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/fsync.py ,,n,system-test,python3 ./test.py -f 0-others/compatibility.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py @@ -626,6 +629,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/concat2.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/json_tag.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQueryInterval.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_str.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py @@ -677,8 +681,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/basic5.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb0.py +,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb.py -N 3 -n 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb0.py -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb1.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb2.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb3.py @@ -729,7 +733,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_taosx.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_taosx.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-19201.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -N 5 @@ -795,6 +799,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_str.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py -Q 2 @@ -888,6 +893,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/arctan.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_str.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3 @@ -981,6 +987,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/arctan.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_str.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py -Q 4 diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 9cfd1d368e..bdf3f20e15 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -261,6 +261,70 @@ class TDSql: tdLog.info(f"sql:{self.sql}, row:{row} col:{col} data:{self.queryResult[row][col]} == expect:{data}") + # return true or false replace exit, no print out + def checkRowColNoExit(self, row, col): + caller = inspect.getframeinfo(inspect.stack()[2][0]) + if row < 0: + args = (caller.filename, caller.lineno, self.sql, row) + return False + if col < 0: + args = (caller.filename, caller.lineno, self.sql, row) + return False + if row > self.queryRows: + args = (caller.filename, caller.lineno, self.sql, row, self.queryRows) + return False + if col > self.queryCols: + args = (caller.filename, caller.lineno, self.sql, col, self.queryCols) + return False + + return True + + + # return true or false replace exit, no print out + def checkDataNoExit(self, row, col, data): + if self.checkRowColNoExit(row, col) == False: + return False + if self.queryResult[row][col] != data: + if self.cursor.istype(col, "TIMESTAMP"): + # suppose user want to check nanosecond timestamp if a longer data passed + if (len(data) >= 28): + if pd.to_datetime(self.queryResult[row][col]) == pd.to_datetime(data): + return True + else: + if self.queryResult[row][col] == _parse_datetime(data): + return True + return False + + if str(self.queryResult[row][col]) == str(data): + return True + elif isinstance(data, float): + if abs(data) >= 1 and abs((self.queryResult[row][col] - data) / data) <= 0.000001: + return True + elif abs(data) < 1 and abs(self.queryResult[row][col] - data) <= 0.000001: + return True + else: + return False + else: + return False + + return True + + + # loop execute sql then sleep(waitTime) , if checkData ok break loop + def checkDataLoop(self, row, col, data, sql, loopCount, waitTime): + # loop check util checkData return true + for i in range(loopCount): + self.query(sql) + if self.checkDataNoExit(row, col, data) : + self.checkData(row, col, data) + return + time.sleep(waitTime) + + # last check + self.query(sql) + self.checkData(row, col, data) + + def getData(self, row, col): self.checkRowCol(row, col) return self.queryResult[row][col] diff --git a/tests/pytest/util/taosadapter.py b/tests/pytest/util/taosadapter.py index 5210825cde..79ea86c5bd 100644 --- a/tests/pytest/util/taosadapter.py +++ b/tests/pytest/util/taosadapter.py @@ -235,7 +235,7 @@ class TAdapter: return toBeKilled = "taosadapter" - + if self.running != 0: psCmd = f"ps -ef|grep -w {toBeKilled}| grep -v grep | awk '{{print $2}}'" # psCmd = f"pgrep {toBeKilled}" diff --git a/tests/script/coverage_test.sh b/tests/script/coverage_test.sh index b395047a1c..3f99dde544 100755 --- a/tests/script/coverage_test.sh +++ b/tests/script/coverage_test.sh @@ -66,32 +66,40 @@ function buildTDengine() { function runCasesOneByOne () { while read -r line; do - cmd=`echo $line | cut -d',' -f 5` - if [[ "$2" == "sim" ]] && [[ $cmd == *"test.sh"* ]]; then - case=`echo $cmd | cut -d' ' -f 3` - start_time=`date +%s` - date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ - echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ - || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT - end_time=`date +%s` - echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT - elif [[ "$2" == "system-test" ]] && [[ $line == *"system-test"* ]]; then - case=`echo $cmd | cut -d' ' -f 4` - start_time=`date +%s` - date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ - echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ - echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT - end_time=`date +%s` - echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT - elif [[ "$2" == "develop-test" ]] && [[ $line == *"develop-test"* ]]; then - case=`echo $cmd | cut -d' ' -f 4` - start_time=`date +%s` - date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ - echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ - echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT - end_time=`date +%s` - echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT - fi + if [[ "$line" != "#"* ]]; then + cmd=`echo $line | cut -d',' -f 5` + if [[ "$2" == "sim" ]] && [[ $line == *"script"* ]]; then + case=`echo $cmd | cut -d' ' -f 3` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ + || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT + elif [[ "$2" == "system-test" ]] && [[ $line == *"system-test"* ]]; then + if [[ "$cmd" == *"pytest.sh"* ]]; then + cmd=`echo $cmd | cut -d' ' -f 2-20` + fi + case=`echo $cmd | cut -d' ' -f 4-20` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ + echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT + elif [[ "$2" == "develop-test" ]] && [[ $line == *"develop-test"* ]]; then + if [[ "$cmd" == *"pytest.sh"* ]]; then + cmd=`echo $cmd | cut -d' ' -f 2-20` + fi + case=`echo $cmd | cut -d' ' -f 4-20` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ + echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT + fi + fi done < $1 } diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 662c4a1a6c..217bd66ef6 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -134,6 +134,7 @@ echo "mDebugFlag 143" >> $TAOS_CFG echo "wDebugFlag 143" >> $TAOS_CFG echo "sDebugFlag 143" >> $TAOS_CFG echo "tsdbDebugFlag 143" >> $TAOS_CFG +echo "tdbDebugFlag 143" >> $TAOS_CFG echo "tqDebugFlag 143" >> $TAOS_CFG echo "fsDebugFlag 143" >> $TAOS_CFG echo "idxDebugFlag 143" >> $TAOS_CFG diff --git a/tests/script/test.sh b/tests/script/test.sh index a7a5d34fbe..19180382fd 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -10,13 +10,11 @@ set +e #set -x FILE_NAME= -RELEASE=0 -ASYNC=0 VALGRIND=0 -UNIQUE=0 +TEST=0 UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` -while getopts "f:agvum" arg +while getopts "f:tgv" arg do case $arg in f) @@ -25,8 +23,8 @@ do v) VALGRIND=1 ;; - u) - UNIQUE=1 + t) + TEST=1 ;; g) VALGRIND=2 @@ -140,6 +138,11 @@ if [ -n "$FILE_NAME" ]; then result=$? echo "Execute result:" $result + if [ $TEST -eq 1 ]; then + echo "Exit without check asan errors" + exit 1 + fi + if [ $result -eq 0 ]; then $CODE_DIR/sh/sigint_stop_dnodes.sh $CODE_DIR/sh/checkAsan.sh diff --git a/tests/script/tsim/compute/percentile.sim b/tests/script/tsim/compute/percentile.sim index 836a6baed5..c27441e719 100644 --- a/tests/script/tsim/compute/percentile.sim +++ b/tests/script/tsim/compute/percentile.sim @@ -120,6 +120,17 @@ if $data00 != 5.000000000 then return -1 endi +sql select _wstart, percentile(tbcol, 10) as c from $tb interval(1d) +if $rows != 1 then + return -1 +endi +if $data00 != @20-10-01 00:00:00.000@ then + return -1 +endi +if $data01 != @1.900000000@ then + return -1 +endi + print =============== clear sql drop database $db sql select * from information_schema.ins_databases diff --git a/tests/script/tsim/dnode/balance1.sim b/tests/script/tsim/dnode/balance1.sim index 2b0154c8e5..3bb9c4f3eb 100644 --- a/tests/script/tsim/dnode/balance1.sim +++ b/tests/script/tsim/dnode/balance1.sim @@ -74,10 +74,10 @@ sql insert into d2.t2 values(now+5s, 21) sql select * from information_schema.ins_dnodes print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(2)[2] -if $data(1)[2] != 0 then +if $data(1)[2] != 1 then return -1 endi -if $data(2)[2] != 2 then +if $data(2)[2] != 1 then return -1 endi diff --git a/tests/script/tsim/dnode/balance2.sim b/tests/script/tsim/dnode/balance2.sim index 3f5a42d4d3..9eeb7e1251 100644 --- a/tests/script/tsim/dnode/balance2.sim +++ b/tests/script/tsim/dnode/balance2.sim @@ -161,13 +161,13 @@ print dnode1 openVnodes $data(1)[2] print dnode3 openVnodes $data(3)[2] print dnode4 openVnodes $data(4)[2] print dnode5 openVnodes $data(5)[2] -if $data(1)[2] != 2 then +if $data(1)[2] != 3 then return -1 endi if $data(3)[2] != 3 then return -1 endi -if $data(4)[2] != 4 then +if $data(4)[2] != 3 then return -1 endi if $data(5)[2] != 3 then diff --git a/tests/script/tsim/dnode/balance3.sim b/tests/script/tsim/dnode/balance3.sim index ce328f10bd..2fb284b466 100644 --- a/tests/script/tsim/dnode/balance3.sim +++ b/tests/script/tsim/dnode/balance3.sim @@ -127,10 +127,10 @@ print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(2)[2] print dnode3 openVnodes $data(3)[2] print dnode4 openVnodes $data(4)[2] -if $data(1)[2] != 0 then +if $data(1)[2] != 1 then return -1 endi -if $data(2)[2] != 2 then +if $data(2)[2] != 1 then return -1 endi if $data(3)[2] != 2 then @@ -228,10 +228,10 @@ print dnode1 openVnodes $data(1)[2] print dnode3 openVnodes $data(3)[2] print dnode4 openVnodes $data(4)[2] print dnode5 openVnodes $data(5)[2] -if $data(1)[2] != 1 then +if $data(1)[2] != 2 then return -1 endi -if $data(3)[2] != 3 then +if $data(3)[2] != 2 then return -1 endi if $data(4)[2] != 3 then diff --git a/tests/script/tsim/dnode/balancex.sim b/tests/script/tsim/dnode/balancex.sim index 6b16e8b569..0cfc64a954 100644 --- a/tests/script/tsim/dnode/balancex.sim +++ b/tests/script/tsim/dnode/balancex.sim @@ -142,10 +142,10 @@ print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(2)[2] print dnode2 openVnodes $data(3)[2] print dnode2 openVnodes $data(4)[2] -if $data(1)[2] != 0 then +if $data(1)[2] != 1 then return -1 endi -if $data(2)[2] != 2 then +if $data(2)[2] != 1 then return -1 endi if $data(3)[2] != 2 then diff --git a/tests/script/tsim/dnode/vnode_clean.sim b/tests/script/tsim/dnode/vnode_clean.sim index 112e5f28a4..ba1d083c68 100644 --- a/tests/script/tsim/dnode/vnode_clean.sim +++ b/tests/script/tsim/dnode/vnode_clean.sim @@ -71,10 +71,10 @@ sql insert into d2.t2 values(now+5s, 21) sql select * from information_schema.ins_dnodes print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(2)[2] -if $data(1)[2] != 0 then +if $data(1)[2] != 1 then return -1 endi -if $data(2)[2] != 2 then +if $data(2)[2] != 1 then return -1 endi @@ -181,10 +181,10 @@ sql select * from information_schema.ins_dnodes print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(3)[2] print dnode2 openVnodes $data(4)[2] -if $data(1)[2] != 0 then +if $data(1)[2] != 1 then return -1 endi -if $data(3)[2] != 2 then +if $data(3)[2] != 1 then return -1 endi if $data(4)[2] != 1 then @@ -204,10 +204,10 @@ sql select * from information_schema.ins_dnodes print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(3)[2] print dnode2 openVnodes $data(4)[2] -if $data(1)[2] != 0 then +if $data(1)[2] != 1 then return -1 endi -if $data(3)[2] != 2 then +if $data(3)[2] != 1 then return -1 endi if $data(4)[2] != 2 then @@ -220,13 +220,13 @@ sql select * from information_schema.ins_dnodes print dnode1 openVnodes $data(1)[2] print dnode2 openVnodes $data(3)[2] print dnode2 openVnodes $data(4)[2] -if $data(1)[2] != 1 then +if $data(1)[2] != 2 then return -1 endi if $data(3)[2] != null then return -1 endi -if $data(4)[2] != 3 then +if $data(4)[2] != 2 then return -1 endi diff --git a/tests/script/tsim/insert/insert_select.sim b/tests/script/tsim/insert/insert_select.sim index e3374ee277..333964b1d6 100644 --- a/tests/script/tsim/insert/insert_select.sim +++ b/tests/script/tsim/insert/insert_select.sim @@ -42,4 +42,24 @@ if $rows != 2 then return -1 endi +print ======== step2 +sql drop database if exists db1; +sql create database db1 vgroups 1; +sql use db1; +sql create table t1(ts timestamp, a int, b int ); +sql create table t2(ts timestamp, a int, b int ); +sql insert into t1 values(1648791211000,1,2); +sql insert into t2 (ts, b, a) select ts, a, b from t1; +sql select * from t2; +if $rows != 1 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 1 then + return -1 +endi + + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/fill.sim b/tests/script/tsim/parser/fill.sim index b0841d6712..0510f80419 100644 --- a/tests/script/tsim/parser/fill.sim +++ b/tests/script/tsim/parser/fill.sim @@ -1075,16 +1075,11 @@ if $loop_count == 20 then return -1 endi -if $data00 != 20026 then +if $data00 != 40052 then print =====data00=$data00 goto loop0 endi -if $data10 != 20026 then - print =====data10=$data10 - goto loop0 -endi - sql select _wstart, count(a) from st where ts >= 1648712201000 and ts <= 1648732226000 partition by tbname interval(1s) fill(prev); if $rows != 40052 then diff --git a/tests/script/tsim/query/groupby.sim b/tests/script/tsim/query/groupby.sim new file mode 100644 index 0000000000..03bea4d047 --- /dev/null +++ b/tests/script/tsim/query/groupby.sim @@ -0,0 +1,23 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + + +sql drop database if exists db1; +sql create database db1; +sql use db1; +sql create table test(pos_time TIMESTAMP,target_id INT ,data DOUBLE) tags(scene_id BIGINT,data_stage VARCHAR(64),data_source VARCHAR(64)); + +sql insert into _413254290_108_1001_ using test tags(108,'1001','') values(1667232060000,413254290,1); +sql insert into _413254290_108_1001_ using test tags(108,'1001','') values(1667232061000,413254290,2); +sql insert into _413254290_108_1001_ using test tags(108,'1001','') values(1667232062000,413254290,3); +sql insert into _413254000_108_1001_ using test tags(109,'1001','') values(1667232060000,413254290,3); +sql insert into _413254000_108_1001_ using test tags(109,'1001','') values(1667232062000,413254290,3); + +sql select target_name,max(time_diff) AS time_diff,(count(1)) AS track_count from (select tbname as target_name,diff(pos_time) time_diff from test where tbname in ('_413254290_108_1001_','_413254000_108_1001_') partition by tbname) a group by target_name; +if $rows != 2 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/scalar/tsConvert.sim b/tests/script/tsim/scalar/tsConvert.sim new file mode 100644 index 0000000000..75efdb442f --- /dev/null +++ b/tests/script/tsim/scalar/tsConvert.sim @@ -0,0 +1,127 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ======== step1 +sql drop database if exists db1; +sql create database db1; +sql use db1; +sql create stable st1 (ts timestamp, f1 int, f2 binary(30)) tags(t1 int, t2 binary(30)); +sql create table tb1 using st1 tags(1, '1'); +sql insert into tb1 values ('2022-07-10 16:31:00', 1, '1'); +sql insert into tb1 values ('2022-07-10 16:32:00', 2, '2'); +sql insert into tb1 values ('2022-07-10 16:33:00', 3, '3'); +sql insert into tb1 values ('2022-07-10 16:34:00', 4, '4'); +sql select * from (select ts,TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),timediff(TIMETRUNCATE(ts,1d),TIMETRUNCATE(ts,1h),1h) as td from tb1 where ts >='2022-06-01 00:00:00' and ts <=' 2022-11-3 23:59:59' ) t where td >12; +if $rows != 4 then + return -1 +endi +if $data00 != @22-07-10 16:31:00.000@ then + return -1 +endi +if $data10 != @22-07-10 16:32:00.000@ then + return -1 +endi +if $data20 != @22-07-10 16:33:00.000@ then + return -1 +endi +if $data30 != @22-07-10 16:34:00.000@ then + return -1 +endi + +sql select * from tb1 where ts > '2022-07-10 16:32:00'; +if $rows != 2 then + return -1 +endi +if $data00 != @22-07-10 16:33:00.000@ then + return -1 +endi +if $data10 != @22-07-10 16:34:00.000@ then + return -1 +endi + +sql select * from tb1 where ts + 1 > '2022-07-10 16:32:00'; +if $rows != 3 then + return -1 +endi +if $data00 != @22-07-10 16:32:00.000@ then + return -1 +endi +if $data10 != @22-07-10 16:33:00.000@ then + return -1 +endi +if $data20 != @22-07-10 16:34:00.000@ then + return -1 +endi + +sql select * from tb1 where '2022-07-10 16:32:00' > timestamp '2022-07-10 16:31:59'; +if $rows != 4 then + return -1 +endi +if $data00 != @22-07-10 16:31:00.000@ then + return -1 +endi +if $data10 != @22-07-10 16:32:00.000@ then + return -1 +endi +if $data20 != @22-07-10 16:33:00.000@ then + return -1 +endi +if $data30 != @22-07-10 16:34:00.000@ then + return -1 +endi + +sql select case f1 when '1' then 1 when '2022-07-10 16:32:00' then '2' end from tb1; +if $rows != 4 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi + +sql select case ts when '2022-07-10 16:31:00' then 1 when '2022-07-10 16:32:00' then '2' end from tb1; +if $rows != 4 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 2 then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi + +sql select case '2022-07-10 16:31:00' when ts then 1 when 2022 then '2' else 3 end from tb1; +if $rows != 4 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 3 then + return -1 +endi +if $data20 != 3 then + return -1 +endi +if $data30 != 3 then + return -1 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/basic3.sim b/tests/script/tsim/stream/basic3.sim index 48fb860a72..41e19b19af 100644 --- a/tests/script/tsim/stream/basic3.sim +++ b/tests/script/tsim/stream/basic3.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c debugflag -v 131 -system sh/exec.sh -n dnode1 -s start -v +system sh/cfg.sh -n dnode1 -c debugflag 131 +system sh/exec.sh -n dnode1 -s start sleep 5000 diff --git a/tests/script/tsim/stream/fillIntervalPartitionBy.sim b/tests/script/tsim/stream/fillIntervalPartitionBy.sim index 384aa2c8e4..8c06ca8bbd 100644 --- a/tests/script/tsim/stream/fillIntervalPartitionBy.sim +++ b/tests/script/tsim/stream/fillIntervalPartitionBy.sim @@ -127,7 +127,114 @@ if $rows != 13 then goto loop3 endi +sql insert into t2 values(1648791217000,11,11,11,11.0,'eee') (1648791219000,11,11,11,11.0,'eee') t1 values(1648791217000,11,11,11,11.0,'eee') (1648791219000,11,11,11,11.0,'eee'); +$loop_count = 0 + +loop4: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +sql select * from streamt1 order by group_id, ts; + +if $rows != 20 then + print ====streamt1=rows1=$rows + goto loop4 +endi + +if $data04 == 0 then + print ====streamt1=data04=$data04 + return -1 +endi + +sql select group_id,count(*) from streamt1 group by group_id; + +if $rows != 2 then + print ====streamt1=rows2=$rows + goto loop4 +endi + +sql select * from streamt2 order by group_id, ts; + +if $rows != 20 then + print ====streamt2=rows2=$rows + goto loop4 +endi + +if $data04 == 0 then + print ====streamt2=data04=$data04 + return -1 +endi + +sql select group_id,count(*) from streamt2 group by group_id; + +if $rows != 2 then + print ====streamt2=rows2=$rows + goto loop4 +endi + +sql select * from streamt3 order by group_id, ts; + +if $rows != 20 then + print ====streamt3=rows3=$rows + goto loop4 +endi + +if $data04 == 0 then + print ====streamt3=data04=$data04 + return -1 +endi + +sql select group_id,count(*) from streamt3 group by group_id; + +if $rows != 2 then + print ====streamt3=rows2=$rows + goto loop4 +endi + + +sql select * from streamt4 order by group_id, ts; + +if $rows != 20 then + print ====streamt4=rows4=$rows + goto loop4 +endi + +if $data04 == 0 then + print ====streamt4=data04=$data04 + return -1 +endi + +sql select group_id,count(*) from streamt4 group by group_id; + +if $rows != 2 then + print ====streamt4=rows2=$rows + goto loop4 +endi + +sql select * from streamt5 order by group_id, ts; + +if $rows != 20 then + print ====streamt5=rows5=$rows + goto loop4 +endi + +if $data04 == 0 then + print ====streamt5=data04=$data04 + return -1 +endi + +sql select group_id,count(*) from streamt5 group by group_id; + +if $rows != 2 then + print ====streamt5=rows2=$rows + goto loop4 +endi diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index c9a1ddd922..8287274cd2 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -672,6 +672,123 @@ if $data61 != 1 then goto loop5 endi +print step 8 + +sql drop stream IF EXISTS streams4; +sql drop database IF EXISTS test4; + +sql create database test4 vgroups 6; +sql use test4; +sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); + +sql insert into t1 values(1648791213000,1,1,1,1.0); +sql insert into t1 values(1648791243000,2,1,1,1.0); + +sql insert into t2 values(1648791273000,3,1,1,1.0); +sql insert into t2 values(1648791313000,4,1,1,1.0); + +$loop_count = 0 + +loop6: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt4 order by 1; + +# row 0 +if $rows != 8 then + print ====loop6=rows=$rows + goto loop6 +endi + +if $data01 != 1 then + print ====loop6=data01=$data01 + goto loop6 +endi + +if $data02 != 1 then + print ====loop6=data02=$data02 + return -1 +endi + +if $data11 != 1 then + print ====loop6=data11=$data11 + goto loop6 +endi + +if $data12 != 1 then + print ====loop6=data12=$data12 + return -1 +endi + +if $data21 != 1 then + print ====loop6=data21=$data21 + goto loop6 +endi + +if $data22 != 2 then + print ====loop6=data22=$data22 + return -1 +endi + +if $data31 != 1 then + print ====loop6=data31=$data31 + goto loop6 +endi + +if $data32 != 2 then + print ====loop6=data32=$data32 + return -1 +endi + +if $data41 != 1 then + print ====loop6=data41=$data41 + goto loop6 +endi + +if $data42 != 3 then + print ====loop6=data42=$data42 + return -1 +endi + +if $data51 != 1 then + print ====loop6=data51=$data51 + goto loop6 +endi + +if $data52 != 3 then + print ====loop6=data52=$data52 + return -1 +endi + +if $data61 != 1 then + print ====loop6=data61=$data61 + return -1 +endi + +if $data62 != 4 then + print ====loop6=data62=$data62 + return -1 +endi + +if $data71 != 1 then + print ====loop6=data71=$data71 + return -1 +endi + +if $data72 != 4 then + print ====loop6=data72=$data72 + return -1 +endi + $loop_all = $loop_all + 1 print ============loop_all=$loop_all diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 7220088369..1834432bc9 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -12,6 +12,7 @@ from util.dnodes import * from util.dnodes import TDDnodes from util.dnodes import TDDnode from util.cluster import * +import subprocess BASEVERSION = "3.0.1.8" class TDTestCase: @@ -26,8 +27,21 @@ class TDTestCase: self.replicaVar = int(replicaVar) tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor()) + + def checkProcessPid(self,processName): + i=0 + while i<60: + print(f"wait stop {processName}") + processPid = subprocess.getstatusoutput(f'ps aux|grep {processName} |grep -v "grep"|awk \'{{print $2}}\'')[1] + print(f"times:{i},{processName}-pid:{processPid}") + if(processPid == ""): + break + i += 1 + sleep(1) + else: + print(f'this processName is not stoped in 60s') - + def getBuildPath(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -115,15 +129,15 @@ class TDTestCase: # tdsqlF.query(f"select count(*) from {stb}") # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) os.system("pkill taosd") - sleep(2) + self.checkProcessPid("taosd") print(f"start taosd: nohup taosd -c {cPath} & ") os.system(f" nohup taosd -c {cPath} & " ) sleep(10) tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ") os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y") - os.system("pkill -9 taosd") - + os.system("pkill taosd") # make sure all the data are saved in disk. + self.checkProcessPid("taosd") tdLog.printNoPrefix("==========step2:update new version ") diff --git a/tests/system-test/0-others/user_control.py b/tests/system-test/0-others/user_control.py index 3918828646..d27892b588 100644 --- a/tests/system-test/0-others/user_control.py +++ b/tests/system-test/0-others/user_control.py @@ -283,7 +283,7 @@ class TDTestCase: use.error(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())") elif check_priv == PRIVILEGES_WRITE: use.query(f"use {DBNAME}") - use.error(f"show {DBNAME}.tables") + use.query(f"show {DBNAME}.tables") use.error(f"select * from {DBNAME}.{CTBNAME}") use.query(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())") elif check_priv is None: diff --git a/tests/system-test/0-others/user_manage.py b/tests/system-test/0-others/user_manage.py new file mode 100644 index 0000000000..5148e26b39 --- /dev/null +++ b/tests/system-test/0-others/user_manage.py @@ -0,0 +1,192 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import taos +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +from util.sqlset import * +from taos.tmq import * + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + self.setsql = TDSetSql() + self.stbname = 'stb' + self.binary_length = 20 # the length of binary for column_dict + self.nchar_length = 20 # the length of nchar for column_dict + self.column_dict = { + 'ts' : 'timestamp', + 'col1': 'tinyint', + 'col2': 'smallint', + 'col3': 'int', + 'col4': 'bigint', + 'col5': 'tinyint unsigned', + 'col6': 'smallint unsigned', + 'col7': 'int unsigned', + 'col8': 'bigint unsigned', + 'col9': 'float', + 'col10': 'double', + 'col11': 'bool', + 'col12': f'binary({self.binary_length})', + 'col13': f'nchar({self.nchar_length})' + } + self.tag_dict = { + 'ts_tag' : 'timestamp', + 't1': 'tinyint', + 't2': 'smallint', + 't3': 'int', + 't4': 'bigint', + 't5': 'tinyint unsigned', + 't6': 'smallint unsigned', + 't7': 'int unsigned', + 't8': 'bigint unsigned', + 't9': 'float', + 't10': 'double', + 't11': 'bool', + 't12': f'binary({self.binary_length})', + 't13': f'nchar({self.nchar_length})' + } + self.tag_list = [ + f'now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据"' + ] + self.values_list = [ + f'now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据"' + ] + self.tbnum = 1 + def prepare_data(self): + tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) + for i in range(self.tbnum): + tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_list[i]})') + for j in self.values_list: + tdSql.execute(f'insert into {self.stbname}_{i} values({j})') + def create_user(self): + for user_name in ['jiacy1_all','jiacy1_read','jiacy1_write','jiacy1_none','jiacy0_all','jiacy0_read','jiacy0_write','jiacy0_none']: + if 'jiacy1' in user_name.lower(): + tdSql.execute(f'create user {user_name} pass "123" sysinfo 1') + elif 'jiacy0' in user_name.lower(): + tdSql.execute(f'create user {user_name} pass "123" sysinfo 0') + for user_name in ['jiacy1_all','jiacy1_read','jiacy0_all','jiacy0_read']: + tdSql.execute(f'grant read on db to {user_name}') + for user_name in ['jiacy1_all','jiacy1_write','jiacy0_all','jiacy0_write']: + tdSql.execute(f'grant write on db to {user_name}') + + def user_privilege_check(self): + jiacy1_read_conn = taos.connect(user='jiacy1_read',password='123') + sql = "create table ntb (ts timestamp,c0 int)" + expectErrNotOccured = True + try: + jiacy1_read_conn.execute(sql) + except BaseException: + expectErrNotOccured = False + if expectErrNotOccured: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + tdLog.exit(f"{caller.filename}({caller.lineno}) failed: sql:{sql}, expect error not occured" ) + else: + self.queryRows = 0 + self.queryCols = 0 + self.queryResult = None + tdLog.info(f"sql:{sql}, expect error occured") + pass + def drop_topic(self): + jiacy1_all_conn = taos.connect(user='jiacy1_all',password='123') + jiacy1_read_conn = taos.connect(user='jiacy1_read',password='123') + jiacy1_write_conn = taos.connect(user='jiacy1_write',password='123') + jiacy1_none_conn = taos.connect(user='jiacy1_none',password='123') + jiacy0_all_conn = taos.connect(user='jiacy0_all',password='123') + jiacy0_read_conn = taos.connect(user='jiacy0_read',password='123') + jiacy0_write_conn = taos.connect(user='jiacy0_write',password='123') + jiacy0_none_conn = taos.connect(user='jiacy0_none',password='123') + tdSql.execute('create topic root_db as select * from db.stb') + for user in [jiacy1_all_conn,jiacy1_read_conn,jiacy0_all_conn,jiacy0_read_conn]: + user.execute(f'create topic db_jiacy as select * from db.stb') + user.execute('drop topic db_jiacy') + for user in [jiacy1_write_conn,jiacy1_none_conn,jiacy0_write_conn,jiacy0_none_conn,jiacy1_all_conn,jiacy1_read_conn,jiacy0_all_conn,jiacy0_read_conn]: + sql_list = [] + if user in [jiacy1_all_conn,jiacy1_read_conn,jiacy0_all_conn,jiacy0_read_conn]: + sql_list = ['drop topic root_db'] + elif user in [jiacy1_write_conn,jiacy1_none_conn,jiacy0_write_conn,jiacy0_none_conn]: + sql_list = ['drop topic root_db','create topic db_jiacy as select * from db.stb'] + for sql in sql_list: + expectErrNotOccured = True + try: + user.execute(sql) + except BaseException: + expectErrNotOccured = False + if expectErrNotOccured: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + tdLog.exit(f"{caller.filename}({caller.lineno}) failed: sql:{sql}, expect error not occured" ) + else: + self.queryRows = 0 + self.queryCols = 0 + self.queryResult = None + tdLog.info(f"sql:{sql}, expect error occured") + def tmq_commit_cb_print(tmq, resp, param=None): + print(f"commit: {resp}, tmq: {tmq}, param: {param}") + def subscribe_topic(self): + print("create topic") + tdSql.execute('create topic db_topic as select * from db.stb') + tdSql.execute('grant subscribe on db_topic to jiacy1_all') + print("build consumer") + conf = TaosTmqConf() + conf.set("group.id", "tg2") + conf.set("td.connect.user", "jiacy1_all") + conf.set("td.connect.pass", "123") + conf.set("enable.auto.commit", "true") + conf.set_auto_commit_cb(self.tmq_commit_cb_print, None) + tmq = conf.new_consumer() + print("build topic list") + topic_list = TaosTmqList() + topic_list.append("db_topic") + print("basic consume loop") + tmq.subscribe(topic_list) + sub_list = tmq.subscription() + print("subscribed topics: ", sub_list) + c = 0 + l = 0 + for i in range(10): + if c > 10: + break + res = tmq.poll(10) + print(f"loop {l}") + l += 1 + if res: + c += 1 + topic = res.get_topic_name() + vg = res.get_vgroup_id() + db = res.get_db_name() + print(f"topic: {topic}\nvgroup id: {vg}\ndb: {db}") + for row in res: + print(row) + print("* committed") + tmq.commit(res) + else: + print(f"received empty message at loop {l} (committed {c})") + pass + + def run(self): + tdSql.prepare() + self.create_user() + self.prepare_data() + self.drop_topic() + self.user_privilege_check() + self.subscribe_topic() + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/2-query/avg.py b/tests/system-test/2-query/avg.py index 1d4d9a2494..dd8b38f9ea 100644 --- a/tests/system-test/2-query/avg.py +++ b/tests/system-test/2-query/avg.py @@ -409,7 +409,7 @@ class TDTestCase: tdSql.query(f"select avg(c1) ,avg(c2) , avg(c3) , avg(c4), avg(c5), avg(c6) from {dbname}.sub1_bound ") tdSql.checkRows(1) tdSql.checkData(0,0,920350133.571428537) - tdSql.checkData(0,1,1.3176245766935393e+18) + tdSql.checkData(0,1,3.952873730080618e+18) tdSql.checkData(0,2,14042.142857143) tdSql.checkData(0,3,53.571428571) tdSql.checkData(0,4,5.828571332045761e+37) @@ -419,13 +419,56 @@ class TDTestCase: # check + - * / in functions tdSql.query(f" select avg(c1+1) ,avg(c2) , avg(c3*1) , avg(c4/2), avg(c5)/2, avg(c6) from {dbname}.sub1_bound ") tdSql.checkData(0,0,920350134.5714285) - tdSql.checkData(0,1,1.3176245766935393e+18) + tdSql.checkData(0,1,3.952873730080618e+18) tdSql.checkData(0,2,14042.142857143) tdSql.checkData(0,3,26.785714286) tdSql.checkData(0,4,2.9142856660228804e+37) tdSql.checkData(0,5,None) + # + # test bigint to check overflow + # + def avg_check_overflow(self): + # create db + tdSql.execute(f"drop database if exists db") + tdSql.execute(f"create database if not exists db") + time.sleep(3) + tdSql.execute(f"use db") + tdSql.execute(f"create table db.st(ts timestamp, ibv bigint, ubv bigint unsigned) tags(area int)") + # insert t1 data + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,9223372036854775801,18446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,8223372036854775801,17446744073709551611)") + tdSql.execute(f"insert into db.t1 using db.st tags(1) values(now,7223372036854775801,16446744073709551611)") + # insert t2 data + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,9223372036854775801,18446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,8223372036854775801,17446744073709551611)") + tdSql.execute(f"insert into db.t2 using db.st tags(2) values(now,7223372036854775801,16446744073709551611)") + + # check single table answer + tdSql.query(f"select avg(ibv), avg(ubv) from db.t1") + tdSql.checkRows(1) + tdSql.checkData(0, 0,8.223372036854776e+18) + tdSql.checkData(0, 1,1.744674407370955e+19) + # check super table + tdSql.query(f"select avg(ibv), avg(ubv) from db.st") + tdSql.checkRows(1) + tdSql.checkData(0, 0,8.223372036854776e+18) + tdSql.checkData(0, 1,1.744674407370955e+19) + + # check child query + tdSql.query(f"select avg(ibv), avg(ubv) from (select * from db.st)") + tdSql.checkRows(1) + tdSql.checkData(0, 0,8.223372036854776e+18) + tdSql.checkData(0, 1,1.744674407370955e+19) + + # check group by + tdSql.query(f"select avg(ibv), avg(ubv) from db.st group by tbname") + tdSql.checkRows(2) + tdSql.checkData(0, 0,8.223372036854776e+18) + tdSql.checkData(0, 1,1.744674407370955e+19) + tdSql.checkData(1, 0,8.223372036854776e+18) + tdSql.checkData(1, 1,1.744674407370955e+19) def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdSql.prepare() @@ -455,6 +498,8 @@ class TDTestCase: self.avg_func_filter() self.avg_check_unsigned() + # check avg overflow + self.avg_check_overflow() def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") diff --git a/tests/system-test/2-query/db.py b/tests/system-test/2-query/db.py index d79e2074dd..451fc0caf3 100644 --- a/tests/system-test/2-query/db.py +++ b/tests/system-test/2-query/db.py @@ -58,11 +58,10 @@ class TDTestCase: tdSql.checkRows(21) tdSql.query("show dnode 1 variables like '____debugFlag'") - tdSql.checkRows(2) + tdSql.checkRows(2) def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdSql.prepare(replica = self.replicaVar) - tdLog.printNoPrefix("==========start case1 run ...............") self.case1() diff --git a/tests/system-test/2-query/nestedQueryInterval.py b/tests/system-test/2-query/nestedQueryInterval.py new file mode 100644 index 0000000000..dd43b25e35 --- /dev/null +++ b/tests/system-test/2-query/nestedQueryInterval.py @@ -0,0 +1,847 @@ +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * + +class TDTestCase: + hostname = socket.gethostname() + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + #tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files or "taosd.exe" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def create_tables(self): + tdSql.execute(f"drop database if exists nested") + tdSql.execute(f"create database if not exists nested keep 36500 replica 1") + tdSql.execute(f"use nested") + tdSql.execute(f"use nested") + tdSql.execute(f"create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create stable stable_null_data (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create stable stable_null_childtable (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create table stable_1_1 using stable_1 tags('stable_1_1', '1875819221' , '590058475305213213', '27794' , '-9' , 0 , 'binary1.RwUtFTPELUljKAhTomOd' , 'nchar1.jUSliorTipXBPWUFvgmL' , '70702407145428.500000', '3942240905.627770' ,'0')") + tdSql.execute(f"create table stable_1_2 using stable_1 tags('stable_1_2', '-1129886283' , '8365334906094716813', '-6150' , '57' , 1 , 'binary1.vTmIEcSbytCJAERpWCGd' , 'nchar1.voiUIweoRUDKNWYNjrBV' , '5437.641507', '77141629449.138901' , '1999-09-09 09:09:09.090')") + tdSql.execute(f"create table stable_1_3 using stable_1 tags('stable_1_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , '2099-09-09 09:09:09.090')") + tdSql.execute(f"create table stable_1_4 using stable_1 tags('stable_1_4', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')") + tdSql.execute(f"create table stable_1_5 using stable_1 tags('stable_1_5', '1771737352' , '8519944309455480374', '-8770' , '-7' , 1 , 'binary1.SJUKdVsgafZagrqnYdTh' , 'nchar1.ONFhJIwhhLWJUtLKvKmw' , '31182473.161482', '64.321472' ,'-339837172')") + tdSql.execute(f"create table stable_1_6 using stable_1 tags('stable_1_6', '987461012' , '-776424343185148156', '-6733' , '-115' , 1 , 'binary1.YQTZHyzKNWJIZrDeOKdP' , 'nchar1.BxnvJVUAFklEphKHWIqP' , '60.387150', '385878886707.695007' ,'-1313802358')") + tdSql.execute(f"create table stable_2_1 using stable_2 tags('stable_2_1', '1972317427' , '-3820929692060830425', '18206' , '89' , 1 , 'binary2.InbFxJVQLmIseMeYntEH' , 'nchar2.wkGXcuYevFTHgydogliI' , '656538.907187', '11.667827' ,'0')") + tdSql.execute(f"create table stable_2_2 using stable_2 tags('stable_2_2' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')") + tdSql.execute(f"create table stable_2_3 using stable_2 tags('stable_2_3', '121025327' , '-5067951734787165505', '-4541' , '39' , 1 , 'binary2.PWqqHvgkGRmSULvNblZM' , 'nchar2.BsSqoSHfdDzTWBIDTxIW' , '722578830492.845947', '-62936658111.557999' ,'1719325653')") + tdSql.execute(f"create table stable_2_4 using stable_2 tags('stable_2_4', '-1703445602' , '952583276175911157', '-15847' , '-1' , 1 , 'binary2.ZIRXiGPcWsDDYadmVHbC' , 'nchar2.CkMRgnmReMXbRfKiaHos' , '-2.806483', '620882751.119021' ,'1462034599')") + tdSql.execute(f"create table stable_2_5 using stable_2 tags('stable_2_5', '2022084941' , '-172782721714864542', '-31211' , '-13' , 1 , 'binary2.RgbEIzefrTuDfyRolGgQ' , 'nchar2.ahMsbNznUpydshGChFWR' , '9230.698315', '11569418.757060' ,'1789286591')") + tdSql.execute(f"create table stable_2_6 using stable_2 tags('stable_2_6', '2139131012' , '-2151050146076640638', '11205' , '98' , 1 , 'binary2.XdcwVjbqUuKEFWdeAOGK' , 'nchar2.adnShgPhNhoFUgVrzrIF' , '4896671.448837', '-663422197.440925' ,'-591925015')") + tdSql.execute(f"create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')") + tdSql.execute(f"create table regular_table_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + tdSql.execute(f"create table regular_table_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + tdSql.execute(f"create table regular_table_3 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + tdSql.execute(f"create table regular_table_null (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + + return + + def insert_data(self): + tdLog.debug("start to insert data ............") + + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630000000000, -143708439, -6740796029571244151, 15012, -31, -934058894431.915039, -3695933.334631, 0, 'binary.wEvcyPTYhxxKhVFrShTZ', 'nchar.河南省成都市高明邱街y座 294108', 1630000000000)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000000, -1643794439, -3164709410897301333, -7208, -11, -1306531857188.310059, 632395.211968, 0, 'binary.jrpjGVDqTHJXDbUIxEir', 'nchar.青海省贵阳县牧野邯郸路U座 687168', 1630000000000)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1629999999999, 1048090051, 4753139546176318956, 31490, 65, -8328268324.680830, 74037727.447481, 1, 'binary.QFXcjYxRIgvVcaabbAuo', 'nchar.湖南省畅市璧山石家庄路O座 936681', 1630000000000)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000000, 1054267597, 332752484638053804, 1388, 112, -125.582297, -76003.954672, 1, 'binary.YNzAxeYGxNpFArjidcOh', 'nchar.江西省雪市六枝特深圳街b座 108494', 1630000000000)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000001, -115380468, -2294264221485096401, -20382, -90, -3775423439181.850098, -95439449.928655, 1, 'binary.ilLTZcPTGRSwIjACLGlM', 'nchar.台湾省瑜市平山李街D座 331780', 1630000000001)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000001, -504963560, -8159067702893064842, -5491, -49, 841872.351000, -84748281935263.906250, 1, 'binary.DtKESUYTjuakZGPtBWsn', 'nchar.山东省西宁县房山北镇街k座 852004', 1630000000001)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000000, 1962198354, 5726511532140217455, 20962, -124, -35534.621562, 655.911379, 0, 'binary.kczEOqXlmYDzQxVrxiri', 'nchar.天津市秀英市锡山成都街c座 934752', 1630000000000)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630015000000, -2044434228, -1228575710134602773, 23424, 71, 6.886844, 71.519941, 0, 'binary.iVmwRqGqAbGImLpoUiKX', 'nchar.山东省兰州市山亭卜路d座 110251', 1630000000001)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000000, -1561126129, 4402494144547686327, 19018, -31, 857260.740185, -750.240044, 0, 'binary.qPQkCflOVhWCAnuCCHWY', 'nchar.广东省秀荣市山亭南京路C座 785792', 1630000000001)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630014999999, 1095266727, 2746241631637453300, 7253, 92, -237902303804.821014, 46908.997377, 1, 'binary.NMQGxjbGhMVVbcQEBaEK', 'nchar.台湾省东莞市高坪南京街u座 150902', 1630000000001)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000000, 2130829317, 2085871782840505044, 2484, 30, -3.105125, 29879090388.666199, 1, 'binary.yfnegmvETJTxPrIrvxxe', 'nchar.福建省兴安盟县西夏澳门路p座 460995', 1630000000001)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000001, -1664825220, -5631789961756669368, -23059, -76, 8441.841532, -6705.596239, 1, 'binary.LZlUlCryyKuhhwGGlSjc', 'nchar.四川省巢湖县长寿西宁街O座 989989', 1630000000002)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000001, -1067652799, -5826504339509635297, -390, -15, -66135776826527.101562, -8198121301.465600, 1, 'binary.bppXThGxTXGyhKdEpRgX', 'nchar.四川省桂芳县长寿杭州路M座 546474', 1630000000002)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000000, 1596913082, 1646557549281147083, -14492, -72, 33.692574, 72141847615.397003, 0, 'binary.XxVywbRiXEabPDUoMgxT', 'nchar.重庆市凤兰市城北呼和浩特街O座 959006', 1630000000001)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630030000000, 1109067209, 8318147433525574130, 291, 81, 308262.371110, 3017294.523108, 0, 'binary.mJPDrXToNeEldaahHrjD', 'nchar.新疆维吾尔自治区广州市清河沈阳街F座 287894', 1630000000002)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000000, -995915290, 3161170011949889743, -3415, -62, -5111655245631.230469, -7257779.688047, 0, 'binary.vzcGfGPzmKOqwWlstVmQ', 'nchar.河北省海燕县怀柔齐齐哈尔路O座 679791', 1630000000002)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630029999999, 1270783858, 3618027349082548235, 25887, 84, -659813588408.829956, -32621042966661.398438, 1, 'binary.GqXavHpdBwhbCDrQnpSF', 'nchar.湖北省永安市金平通辽路o座 143728', 1630000000002)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000000, 1739749630, 1610294704102234156, 18492, 117, -24323056593048.300781, 46.116231, 1, 'binary.hzRmZmuYAUsAdQrSEyFm', 'nchar.贵州省杰市南长王街Q座 377635', 1630000000002)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000001, -1718628594, -4057665590789803346, -27617, -32, -84372491943.149796, 5698.767553, 1, 'binary.wPOmeglMuNsatgqVOYvh', 'nchar.新疆维吾尔自治区深圳市长寿梁路l座 415101', 1630000000003)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000001, -97007549, -1557528468040059015, -6101, -18, -34048.334225, -1657.736116, 1, 'binary.eDYjVVXEPBpiilaVwOrx', 'nchar.贵州省成市六枝特傅街t座 803260', 1630000000003)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000000, -2121650398, -1192567467640899873, 27738, 2, -89612476.306992, -5984440.654033, 0, 'binary.BOOyBOTaGGGWppOLcCbQ', 'nchar.天津市峰县朝阳梁街X座 288727', 1630000000002)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 1148326681, -6925816541216354608, -31227, 54, 222564.451289, 8431.504529, 0, 'binary.NHZMOcXRwhSPvmIIxdxp', 'nchar.台湾省台北市魏都路街Y座 785205', 1630000000003)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 544052556, 66604009301449217, 21345, 113, 765168602.280518, -97989380.717398, 0, 'binary.CwzIKVOzfevwyQikTtty', 'nchar.江苏省郑州县新城骆街E座 897275', 1630000000003)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630044999999, 781814072, 820039380718257377, 16412, 8, 13534073596162.000000, 84710586503.486099, 1, 'binary.LBBuZbsGbCPwrtpgpJUU', 'nchar.西藏自治区西宁县牧野孙路U座 873211', 1630000000003)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 2133537352, 8495070517087119217, 650, 4, -99578297.552409, 635328734398.352051, 1, 'binary.NfQiEIznVNaygWdjgrpf', 'nchar.山西省阜新县锡山台北路j座 854425', 1630000000003)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000001, -222510400, -1899555459266145413, -1874, -18, -116.302821, -2969179.976125, 1, 'binary.BgnCkJAICiNgxqiaowKU', 'nchar.上海市淑珍市城东上海路v座 534884', 1630000000004)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000001, -995678859, -7818673459856301613, -15799, -53, 4590.410976, -289305504318.122009, 1, 'binary.jzxySgQRnfthYtrsClss', 'nchar.香港特别行政区洁市东丽白路X座 942700', 1630000000004)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 2039518409, -7951010656620124852, 26555, 97, 317885662.762503, -15671218405798.900391, 0, 'binary.PpJrRRqrlVkrvHDFhGfc', 'nchar.广东省长春县沈河银川街p座 226735', 1630000000003)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630060000000, 723117353, -1590889099228121365, -2895, -118, -9424.662668, 106.531721, 0, 'binary.TublFbdwZUkjDXBnzoCS', 'nchar.内蒙古自治区成都市淄川梁路O座 490394', 1630000000004)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000000, -1943729504, 4725330849524291079, 19350, 23, -72996737.774954, 99.647626, 0, 'binary.NaxwyUiYqMDJixXFkrwl', 'nchar.青海省佛山县浔阳辽阳路i座 673884', 1630000000004)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630059999999, 260526220, 1293392929073191769, 195, 84, -889913.874227, -86079294.573690, 1, 'binary.uSifMBsrTaQhLuYRzSNB', 'nchar.河北省台北市梁平石家庄路p座 882177', 1630000000004)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000000, 1100804375, 8343686791181684001, 11516, 82, -898520.749607, 8.704132, 1, 'binary.mlUobRUmHCNOOqCgXLAC', 'nchar.上海市潮州县魏都永安街n座 239177', 1630000000004)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000001, -1734497021, -6543273238001990224, -9471, -105, 5.215463, -8.406843, 1, 'binary.UnQSdMFNesxovxaQqywB', 'nchar.河北省兰英市高明西安街O座 898407', 1630000000005)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000001, -356952133, -5811125050930035045, -10106, -86, -59731.343942, -6.711605, 1, 'binary.BucKdpqIcWfBATWFIUwQ', 'nchar.台湾省梅市华龙葛路f座 841443', 1630000000005)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000000, -1448303077, 7581281332610752593, -28597, 65, 42652369.542399, 19027309795.674400, 0, 'binary.kNqlJbVupSKDoutNSkZj', 'nchar.内蒙古自治区梅市龙潭郑街P座 821111', 1630000000004)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630075000000, -1735114764, -910694996111564041, 17973, 73, 210.783307, 78353441914751.406250, 0, 'binary.TCDlFpIyMpXfcghfWlUe', 'nchar.湖南省惠州市浔阳章街y座 769412', 1630000000005)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000000, -1569047795, 6154014930112626762, -23107, 71, 7415.321612, -333.790673, 0, 'binary.cQDlPOzuViCfYAjUdgwt', 'nchar.吉林省婷婷市西夏西宁路m座 909021', 1630000000005)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630074999999, 856956546, 6275962241273936020, 9270, 21, -33.848277, 64751237042062.703125, 1, 'binary.ctAKBcRCfQQDgayszuAG', 'nchar.江苏省宁市清河李路g座 724944', 1630000000005)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000000, 1448326946, 7972199845302312059, 705, 105, -204.655811, 732152.198035, 1, 'binary.BcZdTPFgPbkxBUcFljtp', 'nchar.宁夏回族自治区峰县沈北新长春街L座 533383', 1630000000005)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000001, -2035071163, -7787122277706108419, -7254, -103, 5674.411412, 577.478622, 1, 'binary.evhulVVFzQzmcxSxrhKQ', 'nchar.内蒙古自治区亮市合川长沙路n座 765501', 1630000000006)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000001, -306773260, -7374114523451218038, -9388, -82, -62404928835266.203125, 42386299338.397598, 1, 'binary.esbdUcokubRSnOqkJkLB', 'nchar.山东省琴市上街马鞍山路C座 147584', 1630000000006)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000000, -400440831, 3437601667225177538, 20276, -39, -16726360314300.500000, -4598873.151255, 0, 'binary.OkLYkfrvFAWiFDpqiaxV', 'nchar.广东省佛山市璧山孟街L座 706570', 1630000000005)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630090000000, 1973623075, -488129617113651385, -13853, 30, 75272169.904987, 27857.549440, 0, 'binary.xkRVpVawmLMQlKCdvZtZ', 'nchar.江西省磊市怀柔太原路K座 851187', 1630000000006)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000000, -252137090, -5296831169315465834, -20550, -20, -3.941531, -75700534.472326, 0, 'binary.BpKasTBDYsehOyjPzszU', 'nchar.上海市红市西峰张路E座 415889', 1630000000006)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630089999999, 2024548336, 4139843660031507838, 19827, 13, -2167586.132392, -25417449654.380001, 1, 'binary.HAdhzWKQINYLaYkXNWMA', 'nchar.河南省汕尾市沙市张街w座 551925', 1630000000006)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000000, 2107913968, 1289804881586351882, 11892, 64, 5317489029302.500000, -87057162.779656, 1, 'binary.OgWLsotYlsjEVMRdLBuE', 'nchar.安徽省健县西峰太原路Q座 657330', 1630000000006)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000001, -1388002413, -8410442498260521376, -32608, -106, 253633520667.924011, 189217.183223, 1, 'binary.uYfWFNKpQafMupBPxsaQ', 'nchar.重庆市宜都县闵行简街i座 191919', 1630000000007)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000001, -1299395984, -5371389022375922971, -10699, -3, -77152176732086.500000, 3022372632154.790039, 1, 'binary.suubVqjYFZLbSTtupfJz', 'nchar.上海市桂珍市沈河重庆街m座 297301', 1630000000007)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000000, -2027322440, 2494209288710251536, 9722, 36, -5920.224246, -6082294200418.269531, 0, 'binary.AdrnDYFrIaLanobBNtfe', 'nchar.青海省邯郸市新城潮州街n座 431311', 1630000000006)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630105000000, 1693347900, 3148347996562430560, 7984, -125, 851.227689, 36582.261941, 0, 'binary.CRmkBadMfWkcImouLOYC', 'nchar.陕西省澳门市沙湾海口街B座 465135', 1630000000007)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000000, -993042639, -3563434487593064918, 25565, 92, 35189008.309030, 636.547745, 0, 'binary.OoULtmPoUYrnyIRmOomq', 'nchar.内蒙古自治区雷县涪城辽阳路M座 278853', 1630000000007)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630104999999, 896614799, 2243073176348662224, 28908, 61, -27224979.660738, -774.713640, 1, 'binary.eLMnpehchKlvWYooNwzT', 'nchar.山西省六盘水县兴山周路E座 606601', 1630000000007)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000000, 814428057, 1481917516738425350, 15453, 4, 48966471575006.898438, 963385.769898, 1, 'binary.ihMiqNMlQJJZzmmqQCxd', 'nchar.安徽省南昌县翔安济南路m座 375964', 1630000000007)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000001, -449300050, -9120117477577024283, -32402, -33, 10292695658.142700, -34437.176958, 1, 'binary.qKdRIooLiEPovATVrIjv', 'nchar.贵州省淑华县兴山西宁路l座 608705', 1630000000008)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000001, -432206150, -2588236186691485163, -23087, -15, 400818.639211, -4.716588, 1, 'binary.eZOuaAtkYBpffobznIIg', 'nchar.湖北省阜新县高港西安街U座 699140', 1630000000008)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000000, -1368554069, -7541187960916300774, 14988, -91, 1942225715.555290, -70334.201426, 0, 'binary.HvoKMzXkvOzwerEjbwEu', 'nchar.甘肃省佛山县丰都阜新路h座 248791', 1630000000007)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630120000000, 1041114692, -4272739428405588701, -2465, 88, 21784769476439.500000, -68577664683.573502, 0, 'binary.FplIhrrnZDEqcPpMXcCz', 'nchar.广东省亮市清河嘉禾路Q座 453757', 1630000000008)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000000, 176715584, -8079534335031834008, -22423, -105, 2684870082.726260, -8.267891, 0, 'binary.xAOmXPYnrbGdHxHqywad', 'nchar.甘肃省荆门市清浦马鞍山路r座 410741', 1630000000008)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630119999999, 640308875, 3240059255473088756, 31836, 80, -7728815076.892700, 750986226173.490967, 1, 'binary.OzGnekdKxbZxbKgGFJlg', 'nchar.澳门特别行政区台北市白云淮安路B座 375090', 1630000000008)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000000, 1092638007, 8935528528767608896, 4337, 23, -372778.775792, 93085.883825, 1, 'binary.vZySFqduHRgMRgGDCHMO', 'nchar.青海省旭县山亭陈路r座 820766', 1630000000008)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000001, -1961834598, -4976614618620345763, -15019, -7, -181775367037.890015, -489008.481333, 1, 'binary.FbQxRmecVULCPbyUFBtd', 'nchar.河北省志强县浔阳福州街G座 429013', 1630000000009)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000001, -1722034194, -2355585911534022326, -4297, -50, -55.449413, -615331713611.660034, 1, 'binary.JELgidqLYfIKlQGqJxFQ', 'nchar.河南省柳州县花溪田路q座 284391', 1630000000009)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000000, -1171799899, 6798705239630104147, 14631, 13, -690512100.797553, 4942216164.922990, 0, 'binary.JZyfPEyhblizmAILYppl', 'nchar.广东省玉英县孝南沈阳街Y座 637681', 1630000000008)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630135000000, -1384036824, 218630290551636514, 30524, -57, -887.357597, 6.720203, 0, 'binary.NpfAGysaedqwHzyjOEhb', 'nchar.澳门特别行政区六盘水市和平长沙街x座 821514', 1630000000009)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000000, -1305588265, -8021530421135445279, -32118, -94, -3231868745378.140137, -3384463304.343490, 0, 'binary.yAnQLRdPTIoYFmazSvtN', 'nchar.贵州省宜都县海港童路E座 199160', 1630000000009)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630134999999, 152017229, 5533762214494486905, 29777, 107, -597881444.549760, 60.902207, 1, 'binary.CoERNXcHahySItezBpen', 'nchar.云南省北京县海陵张路A座 568099', 1630000000009)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000000, 1236190014, 4653596223295984266, 14748, 21, -5951588996860.620117, 2234250837.617470, 1, 'binary.WwUGpNKIpNfbqTYAZTDT', 'nchar.广东省济南市长寿林街l座 798089', 1630000000009)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000001, -873242705, -7271514029553280325, -7516, -61, 66128079.834318, 77571831.128020, 1, 'binary.LLhLPAXTmmXelsILHdQZ', 'nchar.西藏自治区瑜县长寿天津路t座 566335', 1630000000010)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000001, -2107043391, -6872223014761334604, -253, -30, -2052472.350812, -816315756.554040, 1, 'binary.wvSnelJAPwZethZNEZqM', 'nchar.上海市兴安盟县徐汇陈街L座 910420', 1630000000010)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000000, -283811418, -890001232755261528, -15727, -29, 632302961.122940, 3372672571.351960, 0, 'binary.DNpxbprlJeuvywljvLWV', 'nchar.黑龙江省畅县大东佛山街o座 623470', 1630000000009)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1841425030, 5840114857227443220, 15419, 20, -176685681169.731995, -20366.126795, 0, 'binary.wpRXidgNPOERhEaZlJAM', 'nchar.青海省帅市平山梧州路s座 315192', 1630000000010)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1868258378, -829467537608086421, -15673, 43, -682501443.992492, 564.308967, 0, 'binary.PThYCRdfuhudrwOYOFgy', 'nchar.重庆市欣县丰都唐路B座 999593', 1630000000010)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630149999999, 7371013, 8606554902691526904, 11354, 74, 26482.297818, -6880189394.673160, 1, 'binary.OtbSjvYZOPWbIQOdIrKG', 'nchar.福建省波县璧山嘉禾路X座 190183', 1630000000010)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1574294578, 6360685624760963951, 11117, 71, -272.941943, 29.887578, 1, 'binary.djhaZVhHOWsrnxbiHVTk', 'nchar.西藏自治区南昌县清河拉萨街w座 620924', 1630000000010)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000001, -259884599, -3561655319278167435, -1554, -47, -0.233381, 45265486282274.000000, 1, 'binary.ILwvbvFGWLKDelTSCcDm', 'nchar.河北省哈尔滨市海港梧州路m座 889188', 1630000000011)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000001, -1515650476, -7802732131723416636, -12941, -64, -809.874644, 6032.826263, 1, 'binary.tAYvdysPqcwaHdGoSNgs', 'nchar.上海市玉兰市高明宁德街v座 296568', 1630000000011)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1110286890, -8373744956439073351, 15041, -53, 4069186274.937290, 2.194559, 0, 'binary.auztDxkjzltBpZNEImEj', 'nchar.贵州省平市璧山乐路a座 747181', 1630000000010)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630165000000, -270068972, 7039763496469502050, -17618, 23, -975020808834.901001, 20433408805144.398438, 0, 'binary.FNcyuyrPVVVfxbzDuGlf', 'nchar.宁夏回族自治区平市白云沈阳街Q座 933408', 1630000000011)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000000, 1508766963, -2166535776743943172, -8241, 42, 2.785578, 579582.453552, 0, 'binary.ManjhxWWPYfMDOZgGgDH', 'nchar.宁夏回族自治区石家庄市永川徐路s座 143325', 1630000000011)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630164999999, 1060176497, 5654208159595485509, 24751, 76, -33188910.345760, 3221.783209, 1, 'binary.cZSBdkTCfHzKdaUbRObM', 'nchar.河南省磊市友好方路y座 897409', 1630000000011)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000000, 497425977, 354065118101195712, 31551, 8, -615489296.966200, -71357728420.250000, 1, 'binary.yxlWGAHHdFrrqtbkxmms', 'nchar.西藏自治区惠州县安次汕尾街f座 271896', 1630000000011)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000001, -1895192712, -4432843295407575817, -20962, -98, -233660222.154913, 56771044.886008, 1, 'binary.CYsQdbzmYnNmadYZeaGH', 'nchar.重庆市阜新县永川惠州街l座 567817', 1630000000012)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000001, -716978435, -3103914421806026937, -21749, -50, 700892864.685490, 48303403313.167900, 1, 'binary.BWgPkqjghxVKeRoXrTZu', 'nchar.广西壮族自治区拉萨县萧山海门路k座 599659', 1630000000012)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000000, -1947418103, -2239330846377726020, -32039, -98, 56444198375439.101562, 1600824326231.459961, 0, 'binary.MDSyTDtKwgaMZDQPRBnU', 'nchar.宁夏回族自治区广州市蓟州马鞍山街C座 728186', 1630000000011)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 418330248, -5409102699471857283, -15785, -3, 6935.516881, 35832047684.500603, 0, 'binary.KevLpYjpMOfugEsBCBlm', 'nchar.广东省宜都市蓟州周街Y座 950736', 1630000000012)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 1176493205, 2459630938091775425, -16447, -108, -2248206343057.399902, -6078285.169543, 0, 'binary.hMRUCjOJuPOsbiZnpUAp', 'nchar.台湾省北镇市海港西安街Y座 510871', 1630000000012)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630179999999, 778869650, 849789444462698421, 10597, 31, 7103017.633025, 176806.190116, 1, 'binary.HYiRCyeEqGzFGwoHupCH', 'nchar.上海市杰县安次成都街f座 504387', 1630000000012)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 976603072, 3464432716810727627, 31947, 3, -25689733.219437, 8778.999062, 1, 'binary.oIPQmjoWcexSWGXgBAoz', 'nchar.江苏省丽华县闵行广州路s座 381177', 1630000000012)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000001, -1070149378, -5440223162019446936, -3467, -31, 39057698787674.796875, -90.367916, 1, 'binary.VZKQmmtwMfYTGzlJOyzv', 'nchar.新疆维吾尔自治区丽丽县高坪乌鲁木齐路P座 898975', 1630000000013)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000001, -34074056, -4597641513205145794, -21694, -46, -1647875.388086, 944448733008.215942, 1, 'binary.tJCYGQwLiehXnYdGKEAX', 'nchar.广西壮族自治区巢湖县翔安周街s座 313835', 1630000000013)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 1604229550, 1136238301593252013, -13346, 79, 44.613233, -20420040255472.898438, 0, 'binary.dTQiFvIdRuhkakGujxGq', 'nchar.广西壮族自治区冬梅市秀英张路h座 755432', 1630000000012)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630195000000, -1261626278, 8850592003715310781, -3464, -28, -7417877514167.179688, -337072829176.359009, 0, 'binary.DmaGJbQkLmJQaURuaowv', 'nchar.天津市梧州市友好韩路r座 509518', 1630000000013)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000000, 779648104, 7349237640085656137, 6427, -18, -8212845456.626070, -382.979362, 0, 'binary.CTvjwpLAPIpvFzGoTwwo', 'nchar.陕西省雷县房山济南街v座 822721', 1630000000013)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630194999999, 2139522991, 329464564820839576, 24696, 37, 29057737.124244, 207289.798705, 1, 'binary.WgIELLWDqNqWvdsblKCB', 'nchar.新疆维吾尔自治区马鞍山县孝南天津路c座 644425', 1630000000013)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000000, 1838525411, 7428851921488225564, 29432, 50, -682610786103.390015, -10041.651604, 1, 'binary.KxfGzIGCDurNlCmGKYcc', 'nchar.江苏省建军县淄川唐路A座 669136', 1630000000013)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000001, -1450415363, -2829926279480742311, -27438, -88, -9583575812.348600, 273024623.630804, 1, 'binary.THXDnYCLdvuTXRSUsMnH', 'nchar.河北省丽娟县吉区陈街o座 998303', 1630000000014)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000001, -886751600, -2534482963926108103, -10707, -39, -617571391893.729980, -67.220665, 1, 'binary.hTLReGUfQIJXEaSINBnV', 'nchar.河南省海口县涪城古路p座 921643', 1630000000014)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000000, 1570287998, -344238082251883349, -7319, 81, 90.287960, 88600160.145757, 0, 'binary.dtVTWjArbQtxafOTUJTM', 'nchar.云南省北镇县丰都张路W座 898660', 1630000000013)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 665794589, 6004756980835485088, 2092, -123, -627.945609, -7528668680465.099609, 0, 'binary.IKfpbOnsEUqZvDUDXwxE', 'nchar.云南省深圳县高明黄街I座 754805', 1630000000014)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 1588394658, -8959712112812621693, 2206, -36, -441691927006.486023, 646726.359195, 0, 'binary.aBvZFciAllhXZWLUFnpr', 'nchar.甘肃省建国县房山李路y座 514187', 1630000000014)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630209999999, 1202083307, 5412703541265854339, 12679, 43, -192710.317268, -669700577.626661, 1, 'binary.jzdrBvoIOBydYtlFDBfZ', 'nchar.吉林省淮安市南湖西安街g座 120691', 1630000000014)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 593595969, 819751030048983732, 20912, 107, 9850514448.774269, -5078164092007.000000, 1, 'binary.bJypQCiflteoujptLzMI', 'nchar.湖北省广州县大东华路Q座 390816', 1630000000014)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000001, -808169724, -297187932768772011, -24985, -112, -407819568.753060, -79910028504558.000000, 1, 'binary.sUZnozuiMlgMQjgaKLWT', 'nchar.辽宁省太原市南湖刘街o座 982705', 1630000000015)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000001, -671630434, -2446424003708709538, -6161, -89, -894616811978.269043, -9662906448.356800, 1, 'binary.xabYsCWCjPMPlKTSVUhg', 'nchar.河北省婷市长寿成都街b座 907850', 1630000000015)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 382558478, 5220322206204946702, -11796, -81, 300102736.783901, -1.980706, 0, 'binary.armYvyPdgPaDoNbFvsmU', 'nchar.海南省丹丹市永川戴街g座 757366', 1630000000014)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630225000000, 1556546304, 2632455039606144331, 12588, -78, -9911986.409861, 229879157290.842987, 0, 'binary.GKOAUmTHRsUYNGpJuJXS', 'nchar.西藏自治区浩市龙潭东莞街H座 896444', 1630000000015)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000000, -412103084, 7651422716161914550, -8997, -43, -7588824690.400900, 32094429957.228199, 0, 'binary.vHMehvIzcpBBVNWMluzW', 'nchar.安徽省重庆县朝阳兴城街o座 531109', 1630000000015)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630224999999, 202190259, 6158110401345061186, 25612, 56, 99429428549280.703125, 4845580.749217, 1, 'binary.QFvJnTjavOlzsXAEZVwH', 'nchar.重庆市彬县沈河通辽街r座 998791', 1630000000015)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000000, 1577801807, 7099278354328143832, 21437, 127, 13218371734602.199219, 161023981083.549988, 1, 'binary.wcmkWTSCZNJlHhnahEQx', 'nchar.广东省彬县永川顾路M座 592892', 1630000000015)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000001, -409805763, -6445166879074268180, -22964, -55, -228981.319085, 7949825.592390, 1, 'binary.sbSiqKmjPKvnXbSeKwXG', 'nchar.湖南省沈阳市安次李街u座 919293', 1630000000016)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000001, -1355452771, -6578771374830832013, -11963, -31, 7.979511, -2.355683, 1, 'binary.xkUAxXHQaMRjzWXGozUi', 'nchar.黑龙江省莹县龙潭刘街C座 459661', 1630000000016)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000000, 651625961, 351888809599313432, 19819, 10, 7236673390283.780273, -9467952650.400270, 0, 'binary.JHSbZaIRcqbSjVqzeLeL', 'nchar.河北省合肥市清河曹街a座 227339', 1630000000015)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630240000000, -635394652, -8268124534001451281, -4907, 93, -64765076507.232002, 8584607.867581, 0, 'binary.UPKoftKIqXYBGkgijulk', 'nchar.天津市永安县怀柔合山街K座 967698', 1630000000016)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000000, -213770053, 5635964652235949546, 25274, -124, -5.607006, 535.380902, 0, 'binary.wDdznQCwUKDSARatEpet', 'nchar.四川省北京市翔安佛山街I座 729861', 1630000000016)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630239999999, 238657263, 8869424583833435507, 27884, 75, 7565809000.422980, -416084252676.710022, 1, 'binary.OgrrbsocdxzSAsMKmGFW', 'nchar.辽宁省凤英市魏都李路J座 525191', 1630000000016)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000000, 1210124155, 7042734097723621808, 10874, 73, 86.768567, 6463014968.922540, 1, 'binary.oVXdkvYFywXquaOlhtXC', 'nchar.山西省兰州县花溪齐齐哈尔街s座 800225', 1630000000016)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000001, -1447960279, -635780358358789864, -5330, -51, -91432.263672, 2275481108331.560059, 1, 'binary.gMIOOqmPvHzbiBiPEVsv', 'nchar.香港特别行政区波市崇文惠州街C座 328563', 1630000000017)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000001, -1695106558, -3628563110892589597, -22424, -5, 5.150266, -77282937.851303, 1, 'binary.xJkaFVdbXowwlHYQZaUe', 'nchar.安徽省杭州市西峰邯郸路L座 436694', 1630000000017)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000000, 413277553, -2335706071365382890, 32108, -32, 4843.206092, 46356442353609.296875, 0, 'binary.CoOYGsXiwrFxtoGItDBS', 'nchar.广东省太原市崇文石家庄街q座 321264', 1630000000016)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1654794184, -8374474014569215734, -31917, -15, -938770678.951200, -6731352698.717200, 0, 'binary.QHlEvczXvDhrjeXKechh', 'nchar.广西壮族自治区杭州市城北合肥街Q座 560934', 1630000000017)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1566108371, -3808480661071967050, -30863, 42, -89576902.121811, 78224.319157, 0, 'binary.coyrtmcCFEMDoUzvhCay', 'nchar.江西省芳市涪城银川街b座 311496', 1630000000017)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630254999999, 954795210, 5603814446969530884, 969, 18, -5490774.644756, 178.908991, 1, 'binary.VOdZRucmuTuXzTGKuWfA', 'nchar.四川省宁县城东李路i座 842257', 1630000000017)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1152370442, 5925336630497472314, 12541, 125, -719570559.985753, -8.257668, 1, 'binary.huKmkwvJTPCAFDoXOBlW', 'nchar.安徽省柳州县安次昆明路i座 788628', 1630000000017)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000001, -185956520, -4103946855252239353, -25507, -108, -7.426104, 4211603.554600, 1, 'binary.LsRcBtiQqicggCLXZoWe', 'nchar.福建省玉华县滨城郭路B座 383017', 1630000000018)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000001, -1921474054, -6233300582184415910, -708, -43, -311807806.567927, -658203860771.300049, 1, 'binary.fZeaeMgVywkMCcqxATSP', 'nchar.陕西省杨市沙市吕路y座 145823', 1630000000018)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1570551972, 3518470870097214499, 31701, 67, -937555.256387, 928225.166342, 0, 'binary.JHXTHKFgRbIHElDZDhBC', 'nchar.云南省娜县合川钟街I座 842962', 1630000000017)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630270000000, 41007230, -53608277352743061, 27336, 106, -147300.927027, -84382353.649139, 0, 'binary.wuOctyBeTsCZynkMWYzu', 'nchar.辽宁省惠州市牧野刘路u座 359412', 1630000000018)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000000, -781808333, 579199728109057365, -6090, 83, 77577783.578131, -3329626275.966800, 0, 'binary.jVblcXbShCimKsOQPpIm', 'nchar.江西省太原市兴山辛集街G座 996182', 1630000000018)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630269999999, 1365142146, 4845996538283657204, 32039, 114, 75890.665555, 5702245.657774, 1, 'binary.EnWxuBUlakKcHrXrPBOj', 'nchar.重庆市荣县锡山蒋街H座 306410', 1630000000018)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000000, 333444667, 7150058468897111437, 14463, 56, 8105784073132.780273, 2424186854.253130, 1, 'binary.hWWfvRLXRhrTBXsFKBhN', 'nchar.海南省广州县长寿贵阳路i座 445153', 1630000000018)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000001, -210822579, -5173305434078560312, -32628, -58, -605574731.487583, 8.466106, 1, 'binary.ZKvMAWaDuBEInoXJgQSL', 'nchar.湖北省玲县清城杨街y座 553175', 1630000000019)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000001, -99120821, -6443231186326613201, -4035, -59, 967868262277.944946, -3544.231286, 1, 'binary.QBaMOSBKnDsAwBeYphtn', 'nchar.澳门特别行政区春梅县黄浦西安路O座 267015', 1630000000019)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000000, 1289868664, -3904737247840537443, -9207, 24, 87052030.454020, -5467838.797992, 0, 'binary.QtwNbVNKonvfueApUYkW', 'nchar.海南省强市花溪太原路L座 680108', 1630000000018)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630285000000, 1387304128, 4228361435380026760, -1238, -38, 819.343099, 3269274838.864710, 0, 'binary.QwtMztxuEtuQdccEPSgc', 'nchar.河北省沈阳县沈北新巢湖街F座 514745', 1630000000019)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000000, 1400828058, 7402159199902680827, 4622, -81, 83124160209331.093750, -597482.723308, 0, 'binary.GkCjoKlnQLMdOZQfOaRe', 'nchar.黑龙江省海口市高港北镇路g座 490967', 1630000000019)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630284999999, 952122349, 4226769910009513793, 1618, 46, -82338299659233.500000, -49022614631460.601562, 1, 'binary.lcXghoPWtfUTfSAAJDPS', 'nchar.湖北省巢湖市兴山关街E座 864057', 1630000000019)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000000, 749718159, 3908265828578345378, 4939, 2, -3187143413.393930, -63.396907, 1, 'binary.JgknllAiyOFQYSPvLBrT', 'nchar.广西壮族自治区齐齐哈尔市西峰冉街r座 460995', 1630000000019)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000001, -1152099753, -8078485240322452190, -23406, -63, 7434279511617.269531, -297650111.818850, 1, 'binary.vtvGwZIEcxVUBWDFVniL', 'nchar.香港特别行政区雷县六枝特卫街O座 501711', 1630000000020)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000001, -2025743219, -8360647266536686674, -31408, -127, 3198209717985.200195, -5167244033576.759766, 1, 'binary.EeDihkVVSciCssqEbEgY', 'nchar.湖北省波市高港王街x座 618754', 1630000000020)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000000, -651143475, 6089391424113410155, -28724, 72, -6172591503482.719727, 874675419692.713013, 0, 'binary.wAmJChouNetSkLgButdA', 'nchar.内蒙古自治区淑珍县南溪昆明街X座 457011', 1630000000019)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630300000000, -1036308321, 8505935902679868907, -12126, -56, 21041094684126.500000, -31779.452036, 0, 'binary.CHRMHcuiDKIrbquzMWnc', 'nchar.香港特别行政区桂英市徐汇马路y座 894271', 1630000000020)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000000, -1691555741, -2294462358761347751, -1794, -1, -4454607780157.769531, -197045759.620307, 0, 'binary.dciaYPKuPwWmZtbTNqAa', 'nchar.宁夏回族自治区沈阳市普陀李街p座 330494', 1630000000020)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630299999999, 1198995002, 3637649461872145723, 16760, 95, -2.986117, 21825715.342398, 1, 'binary.CobYIOXzviHBQmtndNfY', 'nchar.湖南省合肥市高坪天津街w座 641163', 1630000000020)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000000, 1641081252, 3497467759234706417, 16909, 61, -156530.187860, -60111517262.459099, 1, 'binary.WegyfVyvBuwzQpvVtxrJ', 'nchar.天津市天津县高明汕尾路L座 748705', 1630000000020)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000001, -1498342366, -7248641586651479050, -14472, -49, -8.737031, -916375489.622606, 1, 'binary.qfSLXCSfQexiQHdraTYY', 'nchar.海南省凤兰市普陀王街a座 920512', 1630000000021)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000001, -1529997535, -3950829483875051901, -14962, -125, 2566536996.957260, 46289841809.267998, 1, 'binary.xcQvVjJSZRlsYkqJLaqC', 'nchar.黑龙江省济南市永川苏街u座 855053', 1630000000021)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000000, 66936834, 6231741803696417438, -26509, 116, -36723525869968.101562, -140577503982.942993, 0, 'binary.JuGZrZpqrsboVygUyAtd', 'nchar.台湾省汕尾县萧山巢湖路n座 479255', 1630000000020)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630315000000, -1768408453, 3912858851624378906, -8457, 115, 63.229176, -5678913267191.299805, 0, 'binary.OaHLnnqkcUEKxOOHCYCJ', 'nchar.甘肃省济南县高明李街w座 328341', 1630000000021)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000000, -1676018488, 5929581737688896192, 587, 50, 8974753.896018, 9867720208144.640625, 0, 'binary.kPHIzCFGzzXfjYJPRBPj', 'nchar.广西壮族自治区齐齐哈尔县滨城杜路G座 832544', 1630000000021)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630314999999, 388708472, 3484566086576549522, 24020, 101, -3436412657.609220, 1.526276, 1, 'binary.VWdcyMxbxjRZCcDesjWH', 'nchar.重庆市娜县清浦周路Q座 318835', 1630000000021)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000000, 1742645526, 7447737287016433535, 11601, 102, 205650774.133360, -718740206925.855957, 1, 'binary.pLVCvWZQFPGWrURwfLcX', 'nchar.湖北省辽阳县静安李路s座 669158', 1630000000021)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000001, -1688761021, -3633609441651034972, -32192, -45, -6589.308664, -96579.525261, 1, 'binary.fsNWygGviERgbHDCTNoU', 'nchar.湖南省合肥市清河马鞍山路g座 155575', 1630000000022)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000001, -1972942235, -7595572329950088744, -21058, -64, -652542.999844, -6645809.678817, 1, 'binary.HeHuMgTlvUMAUlpdnygc', 'nchar.西藏自治区郑州县白云东莞路J座 860659', 1630000000022)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000000, 34583826, -5677401721211288846, 5759, 4, -922.875171, 41207973.369290, 0, 'binary.FgvACcdWyWjXDQzboRVN', 'nchar.山西省台北市南湖北镇路X座 676913', 1630000000021)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 125729034, 5772587033883405659, 31451, 115, 1579351734.492360, 83475.538080, 0, 'binary.YAKBKrKRqlgNweLacnpB', 'nchar.青海省秀华市合川刘街r座 962617', 1630000000022)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 1327440015, 5359031926120752338, 13595, -7, -143.262728, -8.120978, 0, 'binary.VJYIDxwcizIsqjyjvTpO', 'nchar.北京市柳县清河淮安路q座 744491', 1630000000022)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630329999999, 1046617386, 1012222098325008150, 22053, 93, 45723435049.348999, -4738289642.121180, 1, 'binary.OmMMfoOWmDphnVXsqVny', 'nchar.澳门特别行政区建华县永川郭路W座 929334', 1630000000022)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 1996072991, 2291923905975087108, 25734, 49, -988.744553, 891307.838533, 1, 'binary.RIMwMykwFAdjljWnLgTu', 'nchar.天津市重庆县沙市西宁路T座 441908', 1630000000022)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000001, -509016842, -8755338571881630470, -16764, -101, 54206022913.869003, -38597163884.896202, 1, 'binary.miOrdOLIjNjowuqZLMJY', 'nchar.河北省福州县牧野西安街K座 544169', 1630000000023)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000001, -1043050284, -4065479627331509328, -30284, -44, -7442000934306.809570, 8404611937.272200, 1, 'binary.FYEOsVKepLPcPqRAMtQf', 'nchar.江苏省凤英市门头沟莫路D座 821625', 1630000000023)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 1336266375, -3748199673349739489, -14794, -38, -98329032120.339996, 4354904615.450910, 0, 'binary.byOStgFhklLTIvsltIZw', 'nchar.甘肃省丽娟市安次哈尔滨路m座 552966', 1630000000022)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630345000000, -125236222, -7443235125783230646, -4372, -51, -2592298452.864900, -1806314197.669880, 0, 'binary.UJkpaKsbERScbXdQuhvo', 'nchar.宁夏回族自治区柳州县锡山赵街f座 139786', 1630000000023)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000000, -219965012, -4716987119042513689, 24416, -100, -3747315428739.759766, 0.494564, 0, 'binary.NOTNVTroRkOsLgVdkLoJ', 'nchar.重庆市娟县江北哈尔滨街w座 338249', 1630000000023)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630344999999, 1470657859, 2320764016731890530, 27688, 116, 12160748.177215, 83545.714436, 1, 'binary.QLjYhzfGDKcPmHFQjBub', 'nchar.安徽省婷市白云惠州街i座 922795', 1630000000023)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000000, 1908975565, 3788319142030902566, 28513, 73, -810951288254.207031, 704115304293.949951, 1, 'binary.WHaxQQMLidfdINYOwQiY', 'nchar.安徽省淑兰县萧山重庆街W座 385558', 1630000000023)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000001, -720454315, -3301539443338809381, -23269, -40, -354.491111, 9.482702, 1, 'binary.GaEJJOwaHtRTijYNSKrt', 'nchar.香港特别行政区玲县龙潭南宁街R座 455543', 1630000000024)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000001, -1952988609, -8224270172957627373, -12805, -23, -39.405009, 9889.998342, 1, 'binary.nnoIletebLWbHwpqrpjQ', 'nchar.陕西省深圳市长寿兴城路L座 522359', 1630000000024)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000000, -523958452, 2997994281167364719, 22138, 13, 8.626707, -2801928136.443440, 0, 'binary.yqSdjVqJlmWCSBRuPeAS', 'nchar.甘肃省惠州县和平田路N座 869008', 1630000000023)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630360000000, -677274672, -7849607379954530156, -24205, 84, -971756295956.161011, -13922706678085.400391, 0, 'binary.jwdoZKFVRIbdNbxvzglZ', 'nchar.北京市帅县金平沈路L座 955700', 1630000000024)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000000, 1246868406, 8440235059780981684, 17929, -72, -179883228781.260010, 74775.726422, 0, 'binary.AdgnDiCLdBHvjVsUEUlA', 'nchar.福建省张家港市怀柔唐街k座 206637', 1630000000024)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630359999999, 1874112564, 2471561821001658734, 21353, 86, 60186670.967332, 977025.978653, 1, 'binary.tNjvCgdWlmcOHVbLJRMN', 'nchar.福建省太原市闵行郑路j座 374763', 1630000000024)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000000, 1286025365, 9197590639676784477, 7479, 117, -78306895.453520, 16133.105382, 1, 'binary.oyzmHpPVRNdmGjSWoOye', 'nchar.安徽省佳县清河高路t座 131773', 1630000000024)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000001, -805620343, -9199526400762315204, -32703, -90, 255348664.922541, 1.265149, 1, 'binary.rMWNLTrygVpKqbvfAPEQ', 'nchar.西藏自治区大冶县沈河马路x座 692129', 1630000000025)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000001, -1016979209, -233992014932124431, -3372, -83, 1155.736906, 74.581949, 1, 'binary.wfBaavnTeXgzocUDpJkd', 'nchar.青海省兰英县南溪梁街d座 749974', 1630000000025)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000000, 1965870107, -2918841171553952995, -22593, -23, 8305333945954.679688, -3905.740237, 0, 'binary.WijQcImFTfQfgOAyFVuR', 'nchar.贵州省兰英市沙湾广州街R座 380656', 1630000000024)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 1859005003, 1104214274917305717, 10798, 94, 850723.403288, -2.625752, 0, 'binary.uDiGDbJBCeWVuQCYGwQU', 'nchar.江西省海燕县西夏天津街h座 925745', 1630000000025)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 249965459, 4153812250107690762, 8690, -85, -2.375649, -7556996798575.759766, 0, 'binary.OsRPmbVqrwwmstYOvsFp', 'nchar.宁夏回族自治区丹丹市淄川梧州路M座 486374', 1630000000025)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630374999999, 1624260248, 7015806862250068758, 4350, 97, 5194046419.133550, -8059822602.437020, 1, 'binary.OMehRclQHcJBTynDoScY', 'nchar.江苏省兴安盟县长寿拉萨街L座 799456', 1630000000025)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 396319016, 1703630598675774845, 15206, 66, 82212219.419588, -694808505327.339966, 1, 'binary.ThuTfsNgNgkwqdluGnzy', 'nchar.新疆维吾尔自治区重庆市东丽天津街U座 711659', 1630000000025)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000001, -321755377, -7381963169677430909, -17059, -104, -50669392403.276001, 24555.641531, 1, 'binary.pYwaFBbMgRmreHVLLqHM', 'nchar.吉林省关岭县西峰王街A座 128393', 1630000000026)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000001, -3112247, -2326747004845963522, -32753, -15, -6.479060, -4.885868, 1, 'binary.nyUKFiEfATIOqiQYTGYd', 'nchar.北京市深圳市海陵邓街w座 923149', 1630000000026)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 1848873864, -1425149577411932526, -15441, -97, 53983878.838902, 7.604429, 0, 'binary.AebpWwYtnpvpbQojcptM', 'nchar.福建省勇县大东董街D座 925934', 1630000000025)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630390000000, 620402706, -2092872879669844684, 22721, -99, -3.578269, 9.904233, 0, 'binary.kcxyJbYKMUthZCemDZwN', 'nchar.天津市淑英县淄川陶路n座 983382', 1630000000026)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000000, 1424324822, -5344921050768394808, -9933, -104, -579352179419.427002, -8535712823374.900391, 0, 'binary.iQVkXSwNBowzrsOuetLF', 'nchar.辽宁省兰州市蓟州长春路b座 767058', 1630000000026)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630389999999, 1338486910, 5553939443389037108, 7465, 21, 57919539684.215698, -1133897.445424, 1, 'binary.PewhoryOLSZsZOExXrsO', 'nchar.云南省东莞县秀英六盘水街f座 870761', 1630000000026)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000000, 1377263295, 2287159705001305018, 23692, 108, 839604115054.706055, 4528078.990663, 1, 'binary.NQMLbBaxRGpfdrcfKtci', 'nchar.广东省龙市魏都呼和浩特街X座 339810', 1630000000026)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000001, -1972396465, -2625500637464979513, -26565, -22, -441.336819, 4228263266694.529785, 1, 'binary.HCciTUVnuKaUQHOTLmoy', 'nchar.福建省潜江县长寿张街i座 756207', 1630000000027)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000001, -1919101583, -1025584328134825800, -12869, -73, 82107948133.142197, 8170338838.340360, 1, 'binary.SdhXWDcuORDtQtHNqinV', 'nchar.山东省淑珍县龙潭王街u座 917673', 1630000000027)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000000, -342515504, -850995699758580491, -27592, -104, 9983310041114.599609, -3552213.522875, 0, 'binary.mrZLEcTnUkwltOKwWmMG', 'nchar.陕西省六安县东城汪路a座 741921', 1630000000026)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630405000000, -697189031, -5174916001528455052, -18768, 31, 889278993.213705, -4519776483.921300, 0, 'binary.mjvvuLgBZRyYZvSnmrpW', 'nchar.广东省北京县淄川哈尔滨街k座 473589', 1630000000027)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000000, 1399897758, -5070718027080576434, -28441, 81, -6464798967823.299805, 64.959990, 0, 'binary.auzkgdvXEbwhZrzOnCgY', 'nchar.四川省岩市西峰兴安盟街L座 261109', 1630000000027)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630404999999, 586219277, 5261527665322286803, 15053, 17, -7473982.479707, 53758410580.825996, 1, 'binary.ejuJVeKrOYTBIOGtnvwN', 'nchar.黑龙江省英县璧山袁街c座 834323', 1630000000027)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000000, 2069647643, 8085374297895048889, 25867, 38, -9114097802.719160, -511.311795, 1, 'binary.hyODFAlyNDYzGBrgfzQx', 'nchar.河北省荆门市高明蒋路p座 794155', 1630000000027)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000001, -23773554, -991944997406075040, -17827, -70, -817975598.936861, -59647871.118851, 1, 'binary.HMzLCwXDnCBrSjyvRiij', 'nchar.四川省梅县牧野乌鲁木齐街u座 768713', 1630000000028)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000001, -777805682, -6317678604532276560, -15689, -38, -900453816.555716, 384.378368, 1, 'binary.QygspByIGreKmSuckTRN', 'nchar.新疆维吾尔自治区莉县永川巢湖街H座 128070', 1630000000028)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000000, 254749120, 1622387876144097468, 8950, 5, -81.624948, -24.366419, 0, 'binary.prUIqqWJFRMgzMaUTmax', 'nchar.新疆维吾尔自治区惠州县长寿南京路y座 661755', 1630000000027)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630420000000, -1223538957, 2286130958857879860, 13823, 69, 40014883538.375099, -65188739203798.500000, 0, 'binary.YhGtRmitXcCooBPlNxlh', 'nchar.北京市西安县兴山罗街c座 992434', 1630000000028)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000000, 1037952556, -1750883376714996603, 24124, 25, -182.347721, 547.995492, 0, 'binary.JYQaxIMJeszunPLADRsN', 'nchar.青海省玉珍县大东黄街N座 831217', 1630000000028)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630419999999, 403592186, 7560013542016462366, 168, 55, 9517875.498748, 352.106624, 1, 'binary.KbgXOhPmkagxFsFbQakf', 'nchar.澳门特别行政区郑州县沙市长沙路s座 614203', 1630000000028)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000000, 1368705327, 8252423483843671206, 16131, 92, -5515498174334.660156, -3.888975, 1, 'binary.MIPrismzSjiOFMNueQYp', 'nchar.福建省昆明县高港巢湖街t座 950444', 1630000000028)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000001, -1017841441, -1591486103588407573, -17251, -3, -2188221503680.879883, -926521.314582, 1, 'binary.BONmREpjVojUyNnkKVDr', 'nchar.辽宁省北京市浔阳潮州路g座 945777', 1630000000029)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000001, -1833376251, -9184585089936473286, -3917, -99, -92896209472.994095, -1.820004, 1, 'binary.PVpVjMOTKQwOyrnumWdy', 'nchar.北京市淮安市孝南潘街L座 593813', 1630000000029)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000000, 1948244273, -196734016981898350, -12592, 74, 572284.494489, 2864954.350333, 0, 'binary.hfQUVCcsvQaXPEtLGHpD', 'nchar.甘肃省想市翔安通辽街N座 611877', 1630000000028)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630435000000, -838875167, -1361899531005372465, 29323, 99, -1007837437.160790, 3992.134409, 0, 'binary.AXEKjEPNWZzTiqwFpkrg', 'nchar.宁夏回族自治区郑州市徐汇沈阳街X座 928833', 1630000000029)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000000, 1388029674, -546879967630233611, 2763, -36, 672919.301731, -18885480.555128, 0, 'binary.wxQQJhYFoSSMpDGXpiTJ', 'nchar.河北省波县沙市喻路d座 714578', 1630000000029)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630434999999, 2123582595, 7410514965760337418, 2706, 2, 62014125.916508, 2008325132.990800, 1, 'binary.JqrmmSVJyyJSphzDfdfF', 'nchar.浙江省浩市怀柔郑路c座 136184', 1630000000029)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000000, 1201222250, 7502546531668208416, 9700, 30, 71831491844532.593750, -589.390815, 1, 'binary.QjDXDUKqRtDbRoKaLzPh', 'nchar.重庆市玉梅市高坪大冶街Y座 589155', 1630000000029)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000001, -541998051, -1627876155987640389, -18145, -31, -566248120966.409058, 4.742559, 1, 'binary.DAHIBWzujRgGmXHITFdP', 'nchar.宁夏回族自治区博市高坪嘉禾街w座 519572', 1630000000030)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000001, -546978867, -2173360923517013860, -19473, -44, 59.410448, 5922.830565, 1, 'binary.RSrVhjmSLyoKdKZvXTIz', 'nchar.福建省海口县金平东莞街o座 455086', 1630000000030)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000000, -439057091, 8924713488149522354, 7802, 47, 48376534665906.500000, 45445.194835, 0, 'binary.ZDMaZnUxfgdroXGRliPY', 'nchar.吉林省建市沈河范路n座 318872', 1630000000029)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630450000000, -765134201, 347278210407306547, -999, 101, -9542079.208161, 81311055.831151, 0, 'binary.uytkzHZmorAgiDiISVoG', 'nchar.台湾省潜江县沈河罗街d座 335953', 1630000000030)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000000, -883583883, 8388741643434251423, -15135, -94, -68313.913298, -35.800171, 0, 'binary.tzspsEtclAyEBtTUGUVb', 'nchar.安徽省辛集县花溪周路x座 919405', 1630000000030)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630449999999, 863783720, 5196197078377636765, 15104, 13, 51450224872520.898438, 725329.992278, 1, 'binary.iZrgQLIwNNvEhiErAwkt', 'nchar.海南省宇县静安朱街Q座 212815', 1630000000030)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000000, 1599585284, 3659927052268251378, 27540, 113, 426035.852478, -9384.374028, 1, 'binary.yjEiWqUVlFokNWyaFBDd', 'nchar.贵州省海门县上街周路L座 539708', 1630000000030)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000001, -1507574370, -2553743849779578949, -26885, -73, -54390935620.480400, -8539853135856.200195, 1, 'binary.nVGhmvtMlkPpeaBpAFTM', 'nchar.宁夏回族自治区马鞍山市萧山潘路A座 970545', 1630000000031)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000001, -961124591, -9073578603354545587, -23272, -29, 425584796.348519, 190947665.184546, 1, 'binary.kXxbQgCutjoylguhQAdl', 'nchar.天津市旭县房山屈路c座 773300', 1630000000031)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000000, -1705974843, -2143380587844176814, -21730, 59, 5199526189.259490, 7705938.503009, 0, 'binary.bxSiEDFvjRcoPXYDTYCh', 'nchar.福建省淮安市和平赵街l座 610790', 1630000000030)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630465000000, -314548498, -5935072584738796094, -27392, -1, -274339.402115, 3511.621351, 0, 'binary.zPUYZbaXGMPJOywgECDZ', 'nchar.福建省兴安盟市上街昆明路j座 373799', 1630000000031)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000000, 1966145764, 6102444836691824974, -10115, -19, -5651247.555394, -57863153091.628502, 0, 'binary.ZrFDxoPexxwNZrlMQtvg', 'nchar.西藏自治区凯市长寿邯郸街i座 464310', 1630000000031)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630464999999, 1652311395, 2469620212179292220, 8776, 21, -3689.666358, 7851383246.205440, 1, 'binary.GFGXaNXjaQWBuiuIuflv', 'nchar.台湾省荆门市淄川永安街A座 461064', 1630000000031)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000000, 1692550978, 7365080219522096539, 27515, 70, -99952861.539751, 339330736.780068, 1, 'binary.bJznaiQdbEjfsGYBWcoX', 'nchar.新疆维吾尔自治区红梅市上街合肥街V座 387140', 1630000000031)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000001, -881848122, -3511404188725458925, -17230, -50, 6717458.476512, -951.668912, 1, 'binary.WKsWUZoBjTlKVGgAJxPx', 'nchar.青海省云县涪城永安街T座 147122', 1630000000032)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000001, -1473523142, -4395305224463915000, -3855, -100, 72183.581727, 7932375.897433, 1, 'binary.qNxynPRwuwQrqgyuePBu', 'nchar.安徽省沈阳市双滦张街V座 833089', 1630000000032)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000000, -158748589, 6425132610953044127, 18824, 57, -78085392.809785, -521675448.839484, 0, 'binary.TkNybjkEeqjVoGZKWfiU', 'nchar.河南省林县安次陈路l座 523653', 1630000000031)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630480000000, 780205345, -3394022500515803762, -8656, 59, 4353205.758237, 6894995444848.599609, 0, 'binary.dyNGyigdTXCBLJSGKHrJ', 'nchar.天津市秀梅县城北夏街Q座 373284', 1630000000032)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000000, 1285010274, 6775476870679767416, -30268, -78, 2376719.820365, -102060.306247, 0, 'binary.gEkadxughuSyhxVlowaj', 'nchar.甘肃省广州县淄川张路u座 694715', 1630000000032)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630479999999, 133942525, 4687491610368814212, 2473, 123, 74.707449, -37825106590154.500000, 1, 'binary.jFkkgXUPSCrZnMUmiDca', 'nchar.江西省海燕市怀柔辽阳街T座 593401', 1630000000032)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000000, 1198452303, 2827497746106779583, 15755, 3, -96312992172.283997, -7583.330552, 1, 'binary.OuAJuifTLwDmabcKuPpO', 'nchar.陕西省欢县永川李路U座 124763', 1630000000032)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000001, -1161482672, -642941094008198244, -13538, -101, -4415177912288.160156, 57577.407295, 1, 'binary.TMzTATElhmlhyqFvwFKJ', 'nchar.江西省红霞市城东车路h座 867833', 1630000000033)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000001, -2145746929, -2828855748044877841, -24180, -68, 3002911.812991, -5.963978, 1, 'binary.IOKXhDrLSveyxAAZcVVV', 'nchar.山东省桂芝市东城长春街f座 739636', 1630000000033)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000000, -2128865070, -3361908133638881363, -7698, -124, -2810320306.295400, 42424.469553, 0, 'binary.pRTQbYdbdqTUGzTBJjwW', 'nchar.四川省平县和平刘街G座 530429', 1630000000032)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630495000000, -179608812, -2830103688811366966, 17973, -6, -98267364621.484100, -34541396619.394699, 0, 'binary.VMzHtbnrmjokPDZCMXsk', 'nchar.广西壮族自治区永安市魏都海口街Y座 538635', 1630000000033)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000000, 17975727, -9147014879010075409, -29070, 11, 6629237.824116, -644456283208.812988, 0, 'binary.qxIcDfHdizkemidhxBOX', 'nchar.四川省金凤县魏都朱路Y座 167401', 1630000000033)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630494999999, 1748308690, 5607449654092965535, 32130, 79, 662142.922850, -4208712290.375350, 1, 'binary.bsqrWOhUgZliFzqtMCyZ', 'nchar.北京市兴安盟县门头沟夏街W座 853138', 1630000000033)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000000, 292621133, 8029177555041414497, 32719, 52, 9.459390, -85.260795, 1, 'binary.SptfDQZmkxZwzQDPUgly', 'nchar.山西省玉市白云合山街d座 653433', 1630000000033)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000001, -45395742, -3417033390164130042, -31766, -93, -22336078027069.101562, 68135086530908.703125, 1, 'binary.SEnorgonMIgtUKkNTOxP', 'nchar.澳门特别行政区永安县合川吴路W座 144142', 1630000000034)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000001, -1446286464, -2834239883196880371, -9824, -122, 515950931167.439026, 3301610613616.100098, 1, 'binary.pwZptdrFvhLwFfJFLqQh', 'nchar.浙江省桂荣县龙潭徐路e座 191807', 1630000000034)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000000, 147020729, 3276148986164408557, 21995, -8, -669813.120570, -66.191763, 0, 'binary.CDlhPrXllKDbKnpPbQCR', 'nchar.江西省桂香市大兴太原路v座 117465', 1630000000033)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630510000000, -138813503, 6315166587841671464, 1355, 40, 9602.262694, 861862121.594895, 0, 'binary.cvjJVfNMFXXyaKDjkvRu', 'nchar.山西省淮安县静安刘路E座 917860', 1630000000034)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000000, -1499926587, -5494769986822553194, -7513, -59, 20.566688, 164110090.400241, 0, 'binary.ncYYeVQupIbKXmfuwZoJ', 'nchar.浙江省昆明市滨城深圳街C座 408704', 1630000000034)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630509999999, 59717021, 5309467270318718403, 20281, 80, -690547726621.959961, -279234186984.130005, 1, 'binary.XBJIPnZODnweOOXmzRkO', 'nchar.重庆市南京市滨城罗街R座 920733', 1630000000034)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000000, 965932797, 2618901242071795537, 19035, 60, 88667158.776933, 57.714218, 1, 'binary.vPKtTfrDyvkwPapGKBHC', 'nchar.重庆市阳县高坪张路e座 430297', 1630000000034)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000001, -369410792, -8341233851372213560, -21268, -53, -68353.245312, 680.211243, 1, 'binary.HBmqhBQjhNYwAaLJWbpE', 'nchar.新疆维吾尔自治区坤市蓟州曾路Y座 389605', 1630000000035)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000001, -290124344, -5005783105138836089, -31038, -99, -4125833987.987010, -61865.560889, 1, 'binary.msJuffjbXNohLzDghECt', 'nchar.吉林省辽阳县淄川廖路y座 592416', 1630000000035)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000000, 1554805513, 5103394770308878784, -20138, -118, -158087627.334212, -54553.318555, 0, 'binary.QAiiKHDGWEvrjERhDojf', 'nchar.江苏省柳州县江北潜江街R座 415694', 1630000000034)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630525000000, -319429462, 2783408640725418994, -12995, 109, 8059.171767, 34270137051.186001, 0, 'binary.INFGvqMFdDTmdeFePZnQ', 'nchar.青海省南宁市璧山欧街K座 723228', 1630000000035)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000000, -2053704222, -387584738711581594, -28738, 100, 321.108570, 174292.288484, 0, 'binary.JEULkwBGXQMTtcrRCcru', 'nchar.重庆市南昌市东丽大冶路r座 919184', 1630000000035)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630524999999, 1042899672, 525664086008023453, 18210, 36, -992.375585, 67404918237736.601562, 1, 'binary.SyRZdWnAthyOUqpOtOos', 'nchar.内蒙古自治区辛集县华龙武汉街U座 797248', 1630000000035)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000000, 210832777, 8293861208931311807, 3500, 77, -4.291887, 8353937865.544660, 1, 'binary.JNasTUjHeTYxMpjwHQwp', 'nchar.黑龙江省济南市孝南广州路u座 818270', 1630000000035)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000001, -1784712756, -1900282826185833888, -12635, -10, -147742335517.860992, 1892142041.165020, 1, 'binary.FsBnuFMAwIdTjEjYkjBR', 'nchar.天津市丹丹市双滦马鞍山路L座 954700', 1630000000036)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000001, -1963762926, -3093406333417399437, -28946, -93, -361883.201813, -7970832707874.200195, 1, 'binary.AzpaKlaPZcHBJgfiMusA', 'nchar.台湾省桂香市兴山罗街I座 411116', 1630000000036)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000000, -1594406401, 2911814076154398648, 1593, -40, 94252.505169, -57.127701, 0, 'binary.UieVjNVQaDaURDdvbVxx', 'nchar.河南省建华市锡山马鞍山街d座 922365', 1630000000035)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630540000000, -298407008, -890073803487483026, 19138, 22, -13371145012.763000, 787260475.918045, 0, 'binary.ligoRoVSAHzFhUvIDwlE', 'nchar.上海市淑兰市锡山周街z座 377582', 1630000000036)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000000, 1742761629, -3538927150920177969, -26178, -17, -60236333852265.898438, -8776.586953, 0, 'binary.RxvCthLQrpgveOwWJJfo', 'nchar.辽宁省长沙市淄川石路J座 923025', 1630000000036)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630539999999, 656087591, 7671013800748633383, 21136, 114, -9294.519104, 4829386792163.620117, 1, 'binary.vsIjUPiZNVxiFWHzGqkg', 'nchar.湖南省石家庄县城东杨街b座 396607', 1630000000036)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000000, 1908331659, 2529406409884626842, 19478, 70, 33286729894380.898438, -3.973702, 1, 'binary.owpOIRLxxXjudcaMtZsk', 'nchar.重庆市彬县金平牛路B座 110982', 1630000000036)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000001, -70790307, -4087110708810857496, -6014, -118, -605686122.372439, 26511865.401597, 1, 'binary.GLAJYWukLZueieYRsidQ', 'nchar.湖北省峰县牧野辽阳路N座 528796', 1630000000037)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000001, -375748080, -5402179642725069125, -17546, -56, 333.228050, -8211802092271.910156, 1, 'binary.yhkrusrZjfABOqNjyutJ', 'nchar.河南省济南县长寿刘路V座 435013', 1630000000037)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000000, 1483404105, -1062308720694573985, 21132, 127, -3034420855288.169922, -4783009296713.500000, 0, 'binary.pkmpVTKNUbqmEYaWIxNI', 'nchar.吉林省石家庄市六枝特张路z座 262916', 1630000000036)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630555000000, 632563376, -2204241930370454289, 20442, -66, 68778435235.149796, 41338715505.798897, 0, 'binary.RsQnCVXQtzoeXuamUiBl', 'nchar.吉林省洁县永川香港街V座 762000', 1630000000037)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000000, -472397946, 1038938837241211981, -29204, 47, 3047173131.130830, 9172947943.508301, 0, 'binary.gSxMxJFnpWRALREpkZUQ', 'nchar.云南省辽阳市六枝特汕尾路m座 376809', 1630000000037)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630554999999, 396390446, 1620566595591926682, 11031, 85, -9305855762.999241, 1578928.160116, 1, 'binary.pgBGZOKYSliCxHFmGsyp', 'nchar.浙江省军市清浦许路C座 950185', 1630000000037)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000000, 1237088867, 9126129724607826846, 23721, 97, 147.865610, 55260948679.278999, 1, 'binary.EygLnzSPKfjPvserwjwg', 'nchar.青海省济南县普陀太原路P座 240312', 1630000000037)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000001, -1965530504, -871830532885341515, -23233, -76, -3.827964, 9.798035, 1, 'binary.ECLVeNvkmqcTHEoSSxYT', 'nchar.西藏自治区北京市长寿昆明路X座 708472', 1630000000038)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000001, -1484513338, -792998805013840059, -31538, -71, -8141323055.196050, -7510534665057.400391, 1, 'binary.jmfqESFcasFwykqiXlqj', 'nchar.贵州省重庆市吉区张家港路m座 856450', 1630000000038)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000000, 1069828446, 6908596510608104575, 28783, 110, -9162083944.840309, -102.142752, 0, 'binary.gkjpRGJEiQVghWoJbwzo', 'nchar.安徽省潜江县魏都李街r座 766818', 1630000000037)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630570000000, 446510409, -3656476974551396976, 13256, -104, 8171493376646.099609, -530097963872.411987, 0, 'binary.FEewTpfZgngFmPSTSvxJ', 'nchar.内蒙古自治区建华市锡山哈尔滨路U座 278315', 1630000000038)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000000, 1541307361, 3859916508801896099, 21134, 123, -1454095130.880070, -793.944907, 0, 'binary.vUtaMtwXoWgIARQjnHHj', 'nchar.广东省秀华县东丽天津街f座 273761', 1630000000038)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630569999999, 554982384, 4634928837125592948, 23064, 110, -16387837.580834, 67731033.476346, 1, 'binary.zpGkiHSJABZuoZlpNXMp', 'nchar.四川省晶县龙潭太原街d座 373693', 1630000000038)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000000, 1650730478, 2509551581387664974, 17823, 0, -810284073.820230, 9519108910338.419922, 1, 'binary.MykLktVEEpwPHBiBMoqk', 'nchar.山西省峰市门头沟香港路j座 412357', 1630000000038)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000001, -2032946157, -7551742451999725958, -11549, -110, 548121030.233320, 8537.353780, 1, 'binary.lyLVozekCioDlqntmATw', 'nchar.青海省太原市江北宁德街J座 782858', 1630000000039)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000001, -563992071, -3064141540636515026, -15744, -120, -430754463567.528015, -3116194745462.259766, 1, 'binary.sHiKXDptOBQSALxyVOWj', 'nchar.湖南省玉兰市龙潭大冶街I座 537334', 1630000000039)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000000, -2129764760, -4193554531789104653, -23767, 118, 93.790612, 786694048079.288940, 0, 'binary.WQewsnemfqUAFHeLJnXF', 'nchar.新疆维吾尔自治区东市滨城王街s座 713240', 1630000000038)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630585000000, 640199308, -5655660832137064380, -11147, 77, 16876033.858953, -7485.569430, 0, 'binary.bRHphFiZkeWtyDjXqNaO', 'nchar.天津市杨县高坪梁街B座 525434', 1630000000039)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000000, -1686982965, -8299508680322272166, 3619, -126, -64849.198682, -9337.273192, 0, 'binary.IGNxucSArjxWEALkrQRY', 'nchar.安徽省淑兰县城北齐齐哈尔街P座 697435', 1630000000039)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630584999999, 677947760, 1314864805338112674, 15237, 86, -929824456656.410034, -85.764381, 1, 'binary.vfXYvrHXFnDSAHwCndcp', 'nchar.青海省建华县花溪柳州街T座 100213', 1630000000039)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000000, 307125580, 5094829418785488158, 19844, 2, -54041115.787217, 6.233947, 1, 'binary.nAMUcXLvZLCQRHFwNvkT', 'nchar.广东省淑华市上街天津路S座 813901', 1630000000039)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000001, -494862894, -4253955294640876951, -19423, -20, -37835740177817.796875, 51554911990.855003, 1, 'binary.zffLjgnXcDlwdKAxADMr', 'nchar.河北省玉珍县西峰刁路C座 452461', 1630000000040)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000001, -437854754, -8916960191048231333, -6475, -87, 422259.957474, 81115866.296574, 1, 'binary.NlfhDIBFmzxTiVSybgon', 'nchar.新疆维吾尔自治区石家庄县高港大冶街f座 940073', 1630000000040)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000000, 895715893, 6676915082558096536, -2843, 80, 3019829720.850890, 45890083973973.703125, 0, 'binary.YtrhJOiBzFYUzUxxGHcB', 'nchar.河北省桂英县海陵重庆路X座 577152', 1630000000039)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630600000000, 790711145, -5535878799111175644, 24130, 71, -864521126.754360, -5257536.250149, 0, 'binary.uCOCqMGewUkNeUhAbNNf', 'nchar.上海市澳门县大兴海门路k座 319118', 1630000000040)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000000, -1515729891, 6489509016449838006, -19281, 68, -75090633218986.296875, 43026646570.672997, 0, 'binary.zhgeUDYkrfqFOzepcyTJ', 'nchar.北京市北京市南长拉萨街H座 770300', 1630000000040)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630599999999, 1558178384, 7355756171678259138, 18244, 101, -2195442510.130770, -623135577.309077, 1, 'binary.bKLXWDPaBjWRXgOeesiD', 'nchar.江苏省红市长寿贵阳路T座 962883', 1630000000040)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000000, 1292528970, 2464957048738107533, 21085, 23, -97350629.653519, 97632.613057, 1, 'binary.QhAZodfGPuZBebCyHSme', 'nchar.澳门特别行政区建平县山亭邯郸街x座 185831', 1630000000040)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000001, -475557451, -6826045973586477294, -7961, -56, 1705823848847.199951, -268959384930.907990, 1, 'binary.wnZulRregqgognSRRYWI', 'nchar.陕西省桂兰市孝南太原路b座 604090', 1630000000041)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000001, -1662397849, -6337230624292122601, -10537, -31, -7225617.287194, 9.181853, 1, 'binary.dIBenysHkntfJuvBkgWK', 'nchar.安徽省海口县闵行六安街S座 630253', 1630000000041)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000000, 485553847, 7808570548913367950, -25532, 111, 1267936395.925200, 965.329639, 0, 'binary.uUkJRhVNdIFbCCKdSxNu', 'nchar.云南省六盘水市沈河黄街r座 670992', 1630000000040)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630615000000, 1664157316, -3375551224102004419, 200, 88, -745584775385.793945, -699.239448, 0, 'binary.AyZCLhYiMxZgfYXlVciw', 'nchar.吉林省六盘水市清浦贺路O座 851729', 1630000000041)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000000, -1198323418, 1449001209366933334, -29356, 113, 970.596178, -8258648600.433700, 0, 'binary.wnEzpmjBgvHDFbCHrxCx', 'nchar.辽宁省淮安市沈北新拉萨街Q座 858646', 1630000000041)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630614999999, 632223220, 7440877353040054077, 26302, 94, -9662701.768525, -9843725.667981, 1, 'binary.JqnabMfPCrzsTaYczTLh', 'nchar.山西省玉市孝南李路i座 331687', 1630000000041)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000000, 1054653217, 644785387636789462, 23531, 71, -8451351.603558, -83219909153.306000, 1, 'binary.IPnIZyUyPMYVVcGjGYqM', 'nchar.香港特别行政区济南市秀英巫路v座 383455', 1630000000041)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000001, -951785691, -4025456465792961539, -30955, -57, 74739.936019, 23857138186877.699219, 1, 'binary.sKKfLrkShxlGFGromDFZ', 'nchar.江西省宁德市梁平香港街U座 132395', 1630000000042)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000001, -1327031516, -9041664297455549079, -6004, -44, -6224.384964, -39.676621, 1, 'binary.amQNMbMfFfKQljlJEvIS', 'nchar.澳门特别行政区兴城县平山张街J座 904644', 1630000000042)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000000, -1454876122, -1664191631337826145, 2979, -43, 52777147.724176, 1229194365813.330078, 0, 'binary.IxkIHjiRPnVlBdHQSdLm', 'nchar.广西壮族自治区帆县山亭张街G座 965406', 1630000000041)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630630000000, -1983928412, -7333101339332877122, 3761, 37, -38344519.775088, -65261.718170, 0, 'binary.CaPFXqhDLSOaNmNnOsLh', 'nchar.上海市马鞍山市城北宁德路c座 402187', 1630000000042)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000000, -98362180, 3588425829881816071, -9471, -3, -739.807551, -194649953397.838013, 0, 'binary.LQjcSrpQYoEDKvOOlKKI', 'nchar.青海省南宁市孝南宜都路F座 208181', 1630000000042)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630629999999, 826686189, 1712941616400699580, 9250, 116, -92395295608805.296875, -2.541895, 1, 'binary.shGShhPNnWdZQDAdbiHo', 'nchar.辽宁省六盘水市门头沟黄街t座 892638', 1630000000042)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000000, 186750484, 8366250288933508150, 15325, 23, -4695500.207880, -64.107600, 1, 'binary.IkdeyRigedSouvHypNnn', 'nchar.福建省倩县怀柔潮州街g座 858358', 1630000000042)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000001, -667795153, -2546515577402776696, -6866, -12, -8902370.867967, 90891053949.643005, 1, 'binary.OaUjyowfAGaGXKoVLWZR', 'nchar.河南省长春市城东郑路L座 791122', 1630000000043)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000001, -120091173, -4224513340638046957, -14010, -106, 47098343261485.101562, 8407041730175.440430, 1, 'binary.NcaWdgNTvgnnrmOyMSRv', 'nchar.西藏自治区健市南湖北镇路F座 518953', 1630000000043)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000000, 1431440158, 8179550750509486230, -9219, -2, 81300.928795, -56.108837, 0, 'binary.EBrNkPXmiwUfZTalWRtd', 'nchar.广西壮族自治区南宁市锡山罗路W座 812195', 1630000000042)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630645000000, -412013965, -7913679721963250806, 10182, 93, -5654939.111803, -846597080580.864990, 0, 'binary.qEwLmiFwCrLZumFHOYjb', 'nchar.西藏自治区合山县滨城贵阳街j座 422034', 1630000000043)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000000, 1503721252, -1036748170680619716, 3291, -18, 4.597429, 62188775030.721703, 0, 'binary.XKwsLUCTTzTuOxhWzjkr', 'nchar.新疆维吾尔自治区红市大东邯郸路r座 535699', 1630000000043)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630644999999, 1420828021, 2546086650460850227, 17595, 113, 43.359177, 8941185489440.390625, 1, 'binary.AYcgokdEsFMUOIcUpxnM', 'nchar.云南省桂英县高明张街s座 776931', 1630000000043)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000000, 1943840699, 8246807181436486678, 25310, 76, 35456238889763.703125, 642320879.336482, 1, 'binary.RVHWrlKKNsXNwSQINHba', 'nchar.重庆市华市滨城李路l座 828098', 1630000000043)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000001, -2009472018, -7027630570263393098, -21696, -67, -8424796538428.150391, -49416.120873, 1, 'binary.JpOZwpoVKCDjiqsFhbaS', 'nchar.安徽省深圳市高明陈街w座 281329', 1630000000044)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000001, -177128590, -4886914070408811519, -24807, -23, 170878.982356, -2.287124, 1, 'binary.BMICVHrfygzpAnylwEKr', 'nchar.河北省萍市锡山韩路y座 412263', 1630000000044)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000000, 1079184574, 5846412039067228007, -30088, -25, -4212078244.552720, 679329505569.878052, 0, 'binary.gazNmQBKvUAcQQdcOFfh', 'nchar.福建省柳州市翔安石家庄路k座 779547', 1630000000043)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630660000000, -1579595934, -4731667789895780038, 15158, 77, 526489893298.299011, -396.223420, 0, 'binary.xUUoAUpZeJJsquiJOKsO', 'nchar.吉林省兵县闵行乌鲁木齐路Q座 534261', 1630000000044)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000000, -223991084, -2619845069313547475, -14196, 65, 9226.169120, 44944134.392266, 0, 'binary.JGVSgWAUVwADbVUvpSiy', 'nchar.天津市太原县六枝特王街g座 766627', 1630000000044)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630659999999, 395324903, 3937705474539369893, 15533, 65, 0.584074, -967418.449977, 1, 'binary.vWVYYMXIWQAEHBTKKWjP', 'nchar.广西壮族自治区上海市南溪淮安路O座 810462', 1630000000044)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000000, 762050937, 673715091051246407, 16484, 115, 97643376.627697, 763.832549, 1, 'binary.YaiVXlPHKJSEOWuRsRwS', 'nchar.江苏省东莞县友好彭路R座 578518', 1630000000044)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000001, -9754404, -5144925573679303827, -11209, -98, -7.448873, -448115242.603042, 1, 'binary.QNAVDZqImSFgnHpVdWtS', 'nchar.澳门特别行政区沈阳县和平张街H座 176143', 1630000000045)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000001, -1866035632, -2427166402076174209, -27881, -22, 7.396055, -698670.261246, 1, 'binary.uZkazUtEEMgPQgeEXPEe', 'nchar.山西省秀珍县房山西宁街g座 249969', 1630000000045)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000000, -1051806775, 7747932212903150302, -3555, 33, 136.466491, -14409582572.354000, 0, 'binary.tuGfceNZePXxugZSWrOK', 'nchar.湖南省海燕市朝阳长春街y座 700043', 1630000000044)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630675000000, -98786523, -8235989830378110865, 1159, 12, 539082.659713, -335587651.682570, 0, 'binary.XQfGXHbnwGQPulAcrAPX', 'nchar.澳门特别行政区郑州市沈河张路S座 530101', 1630000000045)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000000, -1987879809, 8328244568807450232, -19551, 26, -829281.870267, -2.960861, 0, 'binary.tsChIuGKmCXkiRucjEmc', 'nchar.澳门特别行政区强市长寿银川街V座 830000', 1630000000045)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630674999999, 2068284680, 6162503383056743038, 27733, 48, -35701228967431.296875, -53.652855, 1, 'binary.wNSWJmuVBjpRVVCpksQC', 'nchar.河北省磊县锡山通辽路I座 205908', 1630000000045)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000000, 1151350758, 2480050564933255492, 12388, 102, -738078.108110, 37271792.258503, 1, 'binary.HLSVgACKcmyXKMuAaoCr', 'nchar.云南省龙县丰都乌鲁木齐街j座 584869', 1630000000045)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000001, -853667209, -5695092490915541765, -2174, -112, 26.293549, 2.242559, 1, 'binary.OgZwwWPZuNLXAAdBcanX', 'nchar.四川省巢湖市门头沟广州路C座 781739', 1630000000046)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000001, -1502448521, -720023346921095762, -11220, -47, -4788.467802, -40669738519.174500, 1, 'binary.omeLfsdjbehlFckYepVj', 'nchar.山东省东县城北辛集路e座 898860', 1630000000046)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000000, 1648896854, 7223892135855185984, -5070, -5, 1481003953669.600098, 64887.632295, 0, 'binary.TBMjUXWqSdTfxYFZJeBD', 'nchar.北京市博县金平耿路U座 676471', 1630000000045)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630690000000, -287136285, 1361266513134048206, -3947, 6, -94329.350983, 20808636.344494, 0, 'binary.OdsJNUSWeVvTxQdKykmk', 'nchar.陕西省冬梅市魏都王街J座 907521', 1630000000046)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000000, -1467609417, -3843627157269427935, -5413, -42, -614746115.104684, 58.540238, 0, 'binary.NtWJpduxaSUSCqzynFYI', 'nchar.内蒙古自治区兰英县梁平合山街l座 424641', 1630000000046)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630689999999, 155983724, 4361653758945923763, 29353, 81, -498.227438, -5998.851784, 1, 'binary.MRJjXYWHBZvzaAjTzrli', 'nchar.安徽省丹丹市江北海门路R座 285157', 1630000000046)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000000, 1258506389, 8207419892749460886, 22177, 98, -8132825907524.299805, -80427.275975, 1, 'binary.NKvCFHNYSDBOyLxAkMxr', 'nchar.台湾省荆门市萧山石路c座 773841', 1630000000046)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000001, -1760453704, -2551026868258460946, -4549, -24, 80821.980662, 16.963865, 1, 'binary.pARRcJciJQzdzcCZRqZA', 'nchar.江西省关岭县安次阎路W座 514665', 1630000000047)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000001, -1840599952, -7633977303259618496, -30566, -98, -54802925.996342, -179096513.804220, 1, 'binary.sXxbWKCIeaTzSmMmYYYY', 'nchar.新疆维吾尔自治区娟市清浦唐街G座 762308', 1630000000047)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000000, -1855444632, 2154100108226554299, -9690, 41, -247749.941627, -334792954703.443970, 0, 'binary.zIvNZWbipczRwxcTNujW', 'nchar.黑龙江省帅市和平张路W座 522431', 1630000000046)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630705000000, 1051015641, -2016886488941734520, 25881, 35, -862249.687896, -7581394980.840040, 0, 'binary.HfnUyPAwYxEHQotoCfFT', 'nchar.湖北省郑州县和平哈尔滨街S座 408314', 1630000000047)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000000, -510388953, -8064065802993152150, 32481, -96, 7.338368, -983.214115, 0, 'binary.URxUEcHRhmRFuPRLMOfU', 'nchar.北京市海燕县大东安路T座 198225', 1630000000047)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630704999999, 570191599, 5721926649273388978, 16320, 75, 1203.837639, 108022950538.300003, 1, 'binary.VVxoQGPpWrOYSXzSxWlM', 'nchar.重庆市玉梅县城北北镇街j座 561254', 1630000000047)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000000, 516742969, 5254851840608530925, 22978, 57, 98.947992, 2.621934, 1, 'binary.qJtFyhoRvILawwiVeHZU', 'nchar.上海市宁德县萧山李路a座 549521', 1630000000047)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000001, -1289549437, -4852255743592819912, -21575, -83, 21395693569392.300781, -20107182860.251999, 1, 'binary.mtOMrfEeDMegNqMauPgK', 'nchar.安徽省飞县滨城范街D座 780146', 1630000000048)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000001, -530361614, -2932962238369711981, -20256, -101, 1185.387219, -32573778030.118999, 1, 'binary.VFBPpHGESAAGkeRzIbtK', 'nchar.广西壮族自治区金凤县龙潭沈阳路L座 296744', 1630000000048)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000000, 726917225, 502661849153334288, -12421, -29, -481018.973281, 685.805197, 0, 'binary.XJeHLodwUXxQGrQUyIzI', 'nchar.河北省彬县萧山海门路s座 748879', 1630000000047)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630720000000, -1161611813, 5817478319014146944, -7727, 6, -378647512.223777, 60632396886.272797, 0, 'binary.jEENQpaYOWcVHUYKPaPn', 'nchar.山东省辽阳市兴山关岭路J座 414020', 1630000000048)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000000, 400786735, 1794586209142898723, 29093, -32, 2336.811166, 4.882355, 0, 'binary.xaDzuonslxHsHxVUcTUr', 'nchar.广东省红市南湖兴城路V座 308999', 1630000000048)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630719999999, 1998845359, 296563873066744098, 25562, 88, 543674818246.236023, 589024.805283, 1, 'binary.IROrsLaBEXcULJZvtXDS', 'nchar.河北省婷市南湖奚路F座 111413', 1630000000048)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000000, 1792844644, 7461061401252152973, 21237, 38, -26922171.906852, 2426.989224, 1, 'binary.tkXpypBtMzRGUmlEOHzz', 'nchar.上海市齐齐哈尔县涪城呼和浩特路f座 808674', 1630000000048)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000001, -1746905381, -2536142587987184204, -30442, -113, -76482733.355534, -14901138135.959801, 1, 'binary.WatcMYFnezOmZtsAGUDK', 'nchar.香港特别行政区杭州县六枝特李路Q座 925367', 1630000000049)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000001, -2131665185, -7526157230511290768, -20114, -12, -44.609385, -754455.135801, 1, 'binary.mJjTgToZxAwHTtdlzHCm', 'nchar.湖南省南京市沙湾尤路s座 734395', 1630000000049)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000000, 935471992, -1206109439865175665, -13528, 3, 2923999104624.620117, -91367340672254.593750, 0, 'binary.UeJygdaPzMTyLGaYNqVw', 'nchar.上海市佛山县秀英汪街s座 123655', 1630000000048)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630735000000, -1162065386, -3625158475592858359, 15940, -1, -3.678888, 1905.623857, 0, 'binary.ltmEKwzkvDqQIZWAxJtQ', 'nchar.宁夏回族自治区旭县翔安潜江路e座 531775', 1630000000049)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000000, 27870294, -1672838010426046661, -271, -67, -36401764.482018, -8776255.622473, 0, 'binary.YpzKzQOXpmQFzkDvKTPZ', 'nchar.贵州省波县和平深圳街H座 685163', 1630000000049)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630734999999, 2123054685, 1637804037910336988, 6220, 95, 70038469196607.601562, 3457393391629.479980, 1, 'binary.cRdRGuitRXDuGAWVDxAE', 'nchar.宁夏回族自治区南昌县高港永安路k座 452965', 1630000000049)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000000, 920693621, 6310859245401227510, 303, 79, -60035982.548857, 1543090.996048, 1, 'binary.uTFJycIGGxiHvreuiUWd', 'nchar.黑龙江省重庆市华龙辛集路k座 324574', 1630000000049)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000001, -45388705, -6671698571264178710, -1142, -44, 9.623297, -36288182.831700, 1, 'binary.HMSrCuTIHQiHmuAoGqJK', 'nchar.浙江省六盘水市锡山广州街f座 930027', 1630000000050)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000001, -1979960230, -5366544476848969489, -9255, -38, 13559526845534.199219, -52598830.800144, 1, 'binary.lwsPLPMBhvmOtIthgnDA', 'nchar.香港特别行政区璐县友好李街I座 225346', 1630000000050)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000000, 953316928, 521541905227278512, -7691, 108, 0.929415, 6372.352970, 0, 'binary.FAMTMFGzUQzWeWuWvvCv', 'nchar.青海省浩县吉区李路l座 492272', 1630000000049)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630750000000, 1289374504, -1538126395055742224, -12336, 94, -41.978570, -543035800648.830017, 0, 'binary.SHhbtXRCqxYOqQcWUDtU', 'nchar.台湾省玉英县东丽邵路W座 597939', 1630000000050)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000000, 994205413, -8986580971408422193, 23422, -119, -30609466.792492, 844615733.994923, 0, 'binary.cjCTzFJrdzKdAEluupXy', 'nchar.河北省长沙县长寿任街w座 978621', 1630000000050)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630749999999, 422908755, 5457973965996455589, 7028, 70, 40563882.192469, -9235464112.622881, 1, 'binary.xeqmTUMylYPDFkFJGLQY', 'nchar.澳门特别行政区兵县黄浦六安路y座 904155', 1630000000050)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000000, 798218536, 664231232740969491, 19717, 18, -63.765636, -5311500109000.320312, 1, 'binary.hiiCPuMjaHFEOXUsUyFs', 'nchar.北京市马鞍山县友好杭州路E座 623925', 1630000000050)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000001, -1902203841, -2257246515637886253, -26212, -11, -4386502.688771, 17.396601, 1, 'binary.dEfjmLzekcjvysMUToXa', 'nchar.黑龙江省雪县东城高路T座 703981', 1630000000051)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000001, -519516209, -6438472832772944658, -2516, -5, -137.313109, -21.647080, 1, 'binary.XOwaYPgBCUulNhxMuijU', 'nchar.天津市北京市江北宜都路X座 191896', 1630000000051)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000000, -1936399460, 5919953889802638962, -6029, 116, -47.500353, 6967.754987, 0, 'binary.TEvmwdpcePbbpPUuCcOL', 'nchar.湖北省帆县西峰邯郸街l座 145632', 1630000000050)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630765000000, -115300759, -5011960136761658883, -1020, 94, 23611.457680, 3419810648081.700195, 0, 'binary.CowDUEaCtAEdafPCLLwM', 'nchar.江苏省沈阳县涪城梧州路g座 537113', 1630000000051)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000000, -1632078764, -2531000958759467663, -1282, -120, -44.781583, -983514.899761, 0, 'binary.YgAVHKRKbzDqkjthriDR', 'nchar.宁夏回族自治区桂芳县怀柔辛路h座 764420', 1630000000051)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630764999999, 1335747951, 332059218903242958, 16913, 38, -258359415.692471, -64088.294941, 1, 'binary.ugUzQSUcPjEXMIDrFobB', 'nchar.澳门特别行政区南宁市大东深圳路a座 447398', 1630000000051)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000000, 489030717, 421762966583668765, 31429, 94, -93516881483951.796875, -3894133275.320640, 1, 'binary.pMcnfkpKjgIgIQUaEjjG', 'nchar.广西壮族自治区倩县沙市李街q座 504473', 1630000000051)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000001, -1552553924, -4861456845426343956, -27864, -39, -47713477064.426201, -5155612964147.650391, 1, 'binary.gZMscjyRXoGyNsFLHpoR', 'nchar.广东省梧州市龙潭蒲路T座 644808', 1630000000052)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000001, -915605364, -5868675460644756043, -650, -56, 7433399325297.160156, -52322640586113.500000, 1, 'binary.oopvfRaqoQJMcVsjkWaW', 'nchar.湖北省建平县海陵孙路S座 240665', 1630000000052)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000000, -1546478570, 400491964521467219, 12189, -119, -47542.132966, -2297.923262, 0, 'binary.HeXyWwlnWwUQoKSQqlmu', 'nchar.新疆维吾尔自治区拉萨市蓟州李街B座 664953', 1630000000051)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630780000000, -97528818, 8438123946253432917, -2893, 109, -2306175015456.819824, 13390.816579, 0, 'binary.pqfTTMuvVmSCfxCmFTwS', 'nchar.吉林省莉县新城廖街W座 455043', 1630000000052)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000000, 1001095126, -3172038662584640805, 31275, -17, -6999060.910240, 2846571851.119890, 0, 'binary.CLiSpqGShMtzcfyVTbqa', 'nchar.四川省长沙县东丽张路i座 936342', 1630000000052)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630779999999, 1092904458, 4456537336906696912, 16315, 4, -13230586.214814, 29375192427.605099, 1, 'binary.IAiAMcGMqeACFMkfgGju', 'nchar.福建省汕尾县丰都海门路R座 239728', 1630000000052)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000000, 1949642007, 5173135551369380298, 13811, 118, -59765334.101800, 645915504896.780029, 1, 'binary.KZORRCLafoZgcOOJmook', 'nchar.四川省重庆县新城王街u座 375952', 1630000000052)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000001, -437886009, -8023690985345652194, -14116, -22, -41686906094.233299, -2499063538390.600098, 1, 'binary.jWguWEtBAUgcMKtgXieL', 'nchar.台湾省沈阳市山亭牟路X座 126443', 1630000000053)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000001, -1594359349, -8856134295356844294, -29431, -58, -5120.713906, 18405344215702.800781, 1, 'binary.eeRKiigMAbjCTZnPHkGn', 'nchar.北京市宁德市合川朱路d座 269386', 1630000000053)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000000, -585788677, 3989310696333618920, 29186, 73, -6608.937490, 11.883322, 0, 'binary.lMUQhCelPiyrOIsQUUai', 'nchar.台湾省俊市蓟州淮安街k座 712450', 1630000000052)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630795000000, -738727537, -4908907813359743923, -26386, -105, -841510.274518, -80431949.274122, 0, 'binary.zWAWphEtCuSMACUmkfvN', 'nchar.天津市沈阳县清城杨街X座 500455', 1630000000053)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000000, 393352810, -379075072584781331, 9788, 6, 50170524851777.796875, 44763418392.943497, 0, 'binary.lDVSDncOcANkMxzrtUzK', 'nchar.青海省福州市清城蒋路Y座 567996', 1630000000053)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630794999999, 433850999, 5300519222587016898, 9473, 108, -190097.678270, 2904794070549.299805, 1, 'binary.QBIulMvNBsGMfStAKgCQ', 'nchar.重庆市亮市璧山合肥街U座 535443', 1630000000053)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000000, 1651231384, 6954565384064882242, 12216, 115, 81102616.344608, 39273.314632, 1, 'binary.mFwsFjuuCpdYWXqSMkgn', 'nchar.西藏自治区武汉市滨城太原路b座 798865', 1630000000053)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000001, -1219816305, -7051889644919104807, -28601, -74, 491555.463996, 72211361404034.796875, 1, 'binary.aSnbvFgLheGIahlWoBEf', 'nchar.贵州省倩县大东张街m座 344033', 1630000000054)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000001, -2116828534, -5490698997387226161, -12838, -39, 145344193.926365, -463003297.110519, 1, 'binary.wyWFnvMlYxuviQIhtJTb', 'nchar.贵州省鑫县浔阳贵阳街w座 498999', 1630000000054)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000000, -717310584, 7305335468389593497, 26992, -11, -33.942630, -4.966136, 0, 'binary.dKiRVdIDouQiceoUupoT', 'nchar.青海省银川市秀英叶路A座 419144', 1630000000053)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630810000000, 1063250813, -5121723296303557180, 3452, -49, 128.722024, 8116.722860, 0, 'binary.XwbrXvujPArWLXYhQRQK', 'nchar.内蒙古自治区玉兰市城东银川街O座 519239', 1630000000054)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000000, -433540276, 3265329093020138852, 19837, -63, -8299471626012.559570, -76400754030.522995, 0, 'binary.qUMRRVLolMSqDjJOJGMj', 'nchar.宁夏回族自治区平市高坪广州路D座 168860', 1630000000054)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630809999999, 1771552222, 3276405219271274913, 6311, 75, -9805500055353.400391, -378716.572329, 1, 'binary.YdwgZmlYfeivmxtaWueZ', 'nchar.四川省军市吉区罗街K座 863617', 1630000000054)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000000, 1511546600, 5132492378969879970, 21762, 77, -160772007871.860992, 4897001212199.500000, 1, 'binary.HNELJpdiwwcvGwnYiiQt', 'nchar.青海省六安县沈北新李街G座 938908', 1630000000054)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000001, -429657495, -726300776399539025, -5426, -71, -906430389.497117, 26283347323689.101562, 1, 'binary.yGIWxOkDtQCQgbPJhHFi', 'nchar.福建省娟市丰都董街I座 482079', 1630000000055)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000001, -1918072152, -3958702025992555431, -20124, -100, 325915062.818627, 82697862.465381, 1, 'binary.zNgoJphhqXQOvIxQHzgJ', 'nchar.浙江省秀珍县滨城陈街j座 333330', 1630000000055)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000000, 1166488162, 7007631474167031432, -9261, -6, 6932344629.512100, 531610708.460607, 0, 'binary.OwLQNOOkVKVzVtHPJDqC', 'nchar.黑龙江省娜市朝阳李街y座 366075', 1630000000054)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630825000000, 1579885922, 6474658599299815947, 28280, 52, 105208627.487617, 794627163.462063, 0, 'binary.FEXGjykuWeGEfkKImWDw', 'nchar.四川省淮安县长寿海门路T座 448080', 1630000000055)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000000, 734586506, 5695938165634694036, -6919, -31, 16653611667.163200, 5495624345.768730, 0, 'binary.YXkQvxGjNZCQDlipuLTw', 'nchar.上海市宜都市滨城田街s座 403680', 1630000000055)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630824999999, 1560886565, 601626973389436785, 25259, 120, -10180.909667, -11157634.936217, 1, 'binary.OlTzMGFNSfSrcixpefQx', 'nchar.四川省太原县沈河申路d座 235380', 1630000000055)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000000, 1316061964, 4308983887809754383, 29120, 81, -318524399.639939, -76861841765211.906250, 1, 'binary.BFHoxbNIFRIxSwrutvbT', 'nchar.澳门特别行政区永安市璧山廖街c座 427250', 1630000000055)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000001, -2082927804, -1484742345187780268, -6764, -32, -834228179.920564, 182.911517, 1, 'binary.FTNnvEphxFByhzkfmAhb', 'nchar.甘肃省南昌市东丽南昌街v座 686725', 1630000000056)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000001, -231751967, -5929805332846772894, -26985, 0, -0.118923, -67637720.762575, 1, 'binary.TYBLuEQrsrxSAJbNcCwe', 'nchar.河南省莹县房山石路a座 319475', 1630000000056)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000000, -1500118527, 7742809515581132121, -8755, 59, -47.623223, 4.266104, 0, 'binary.rbQwEMlJmykGPTkOccLp', 'nchar.湖南省辉县和平香港街s座 101830', 1630000000055)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630840000000, -714663691, 5099404450420041478, 27567, 14, 4.945851, -23542476442552.601562, 0, 'binary.tdLqigCoasQnRffCEaDD', 'nchar.江西省太原县华龙何街H座 269392', 1630000000056)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000000, -316339515, 6558297131565034564, 10392, 20, -171972.831509, -13296859.696109, 0, 'binary.sBJTgABqvGumXOfORHBt', 'nchar.吉林省昆明县崇文关岭街K座 822911', 1630000000056)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630839999999, 312047911, 6751577130057851873, 24735, 43, 1278880274.608010, -2.634735, 1, 'binary.yaVlkhtTxxgrtZTsFdxa', 'nchar.云南省台北县魏都张路U座 698041', 1630000000056)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000000, 364153602, 8378783503904272354, 9837, 123, 617669.431755, 134.118945, 1, 'binary.RPldGyMrCeJhQIJpDaWz', 'nchar.重庆市丽华市淄川昆明路y座 543556', 1630000000056)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000001, -1417705247, -1906089795101484200, -3898, -46, 13831918214786.900391, 4384545313581.750000, 1, 'binary.tHnemGaRugDffcmoyWli', 'nchar.青海省建平市清城赵路z座 958026', 1630000000057)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000001, -434542286, -3699533697590169746, -21081, -126, 76.275011, -41585.936197, 1, 'binary.XBOSfXHSompdpAuWKgmz', 'nchar.河北省合肥县滨城重庆街k座 644142', 1630000000057)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000000, -1785884903, -7685034849720410750, -21661, -99, -3153441121.646620, 502521483208.367004, 0, 'binary.MvIfmuaYUqcNIjJBVEAH', 'nchar.重庆市张家港县东丽孟路X座 295908', 1630000000056)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630855000000, 1437018826, 7400326252504732743, -29033, 112, -53177718.768333, -23404.680449, 0, 'binary.XZcaYfmvLZtxhrmzHWEJ', 'nchar.青海省柳市静安陈路h座 801659', 1630000000057)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000000, -869253997, 8132787450326867533, 22924, -123, -902072.768906, 33.572941, 0, 'binary.FjuniySwJpoodedUTAmT', 'nchar.香港特别行政区六盘水县新城太原街W座 631866', 1630000000057)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630854999999, 1667164436, 4152850799576560541, 29745, 75, -450320.964115, 82908.189997, 1, 'binary.NdSzaJxdoQPGYefWPJyi', 'nchar.四川省春梅县璧山刘街a座 898553', 1630000000057)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000000, 1667649794, 1088688853312235292, 9455, 97, -3.427779, -66.503636, 1, 'binary.tvFPXcrLOMTMCJFqcwxT', 'nchar.内蒙古自治区柳县璧山齐齐哈尔街T座 380899', 1630000000057)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000001, -2145233720, -3109219509113963979, -18812, -108, -981408379333.303955, -684.345037, 1, 'binary.jghuIXEGcUtKikJpzLOh', 'nchar.四川省银川县崇文张街H座 193298', 1630000000058)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000001, -1420593489, -5757610227096963226, -16816, -112, 75645.512896, 4840288.738839, 1, 'binary.CCvnOIBQeUgdTvsedOIX', 'nchar.河北省俊市孝南王路V座 596559', 1630000000058)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000000, -1569315493, -7039982472137840249, -11039, 43, 396.176284, -6.336007, 0, 'binary.oNPEvbRQaKHZmlKRACCu', 'nchar.江苏省六盘水市锡山杨路Y座 725607', 1630000000057)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630870000000, 1811347552, -8209360489735809987, -12235, -88, 2775714032.345980, -273997.706213, 0, 'binary.riDaPlhuskGRZsNxzooI', 'nchar.辽宁省潮州市东城徐街R座 431820', 1630000000058)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000000, 1930606515, -6940503292627563742, 14608, -109, -544236.299151, 18944279791.470501, 0, 'binary.vbFXWFeRlIaxUNtkKXIp', 'nchar.甘肃省红霞市门头沟长沙街A座 350032', 1630000000058)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630869999999, 488072919, 4847709443565724927, 25414, 31, -442295.525846, 654487670258.910034, 1, 'binary.RLQFgpAcQCfhuZExHLkx', 'nchar.江苏省巢湖县秀英翁路z座 536419', 1630000000058)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000000, 334934868, 8084257597250217608, 2587, 69, -46356096021.352997, 17315.165561, 1, 'binary.uCbRqUiElxGzVXQYYkmE', 'nchar.云南省太原县黄浦段街q座 675838', 1630000000058)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000001, -1943550230, -3503251484175500724, -28810, -67, 4134905907363.700195, -97.850683, 1, 'binary.ozdeiPLKjSgywqNpCBYN', 'nchar.香港特别行政区西宁县城北王街H座 794624', 1630000000059)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000001, -970612310, -8553425754362908809, -2144, -72, -99455587437.982300, -97357630030126.500000, 1, 'binary.EcHZioPjEFGIxUhBosdz', 'nchar.辽宁省玉兰市新城拉萨路W座 721716', 1630000000059)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000000, -384741102, -7726003315883440776, -2966, -80, -60458.951496, -4975581.359366, 0, 'binary.TZmxmIbpirBCEoTvqUzY', 'nchar.安徽省呼和浩特县六枝特朱路B座 888783', 1630000000058)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630885000000, -2123493348, -4231564094016455736, -31657, 21, 591198324.991950, 794309276463.779053, 0, 'binary.ZKZunxmtjBCRRCZBHTsL', 'nchar.重庆市六盘水市崇文魏街z座 678361', 1630000000059)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000000, 766378371, 492367445257699608, -7708, 99, -3.863619, 5004672.630707, 0, 'binary.AmjCwTkBprSgkFpguYng', 'nchar.山东省健市徐汇兴安盟街z座 942291', 1630000000059)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630884999999, 724025582, 7859514857348468608, 2877, 125, -58160.749327, -8273.730579, 1, 'binary.XZmZYlSRZZddcxEOjfEd', 'nchar.新疆维吾尔自治区潜江县清城梧州路m座 660147', 1630000000059)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000000, 1075248136, 8396611731005005497, 20388, 107, -7832228.556238, 17032.924250, 1, 'binary.xKdxeqytYTWmncKRyiEZ', 'nchar.吉林省琴县清浦台北路t座 640801', 1630000000059)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000001, -2130070769, -5654655793240443105, -30365, -37, 71673.437636, 624958800878.404053, 1, 'binary.qLvSSOSazLTUKvqpCCBL', 'nchar.河南省桂芝市房山韩街x座 576203', 1630000000060)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000001, -1953170165, -7336932030848188049, -12255, -67, -1400233209790.189941, 568697943954.404053, 1, 'binary.pQNaWtAWfSUVMWbrhVmk', 'nchar.天津市晶市清河太原路F座 911684', 1630000000060)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000000, 281132201, 5123656302965848910, 6859, 69, 6896942.124392, 7059472733608.709961, 0, 'binary.PHwnvqWGOkMIPxdQCkTT', 'nchar.安徽省婷市东城太原街x座 154074', 1630000000059)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630900000000, 2108150002, -3953623224839666424, 26021, -120, -3832507656102.310059, 41875460523837.203125, 0, 'binary.eEaxRyDoGrrYZQfYhDwC', 'nchar.福建省杨市山亭陈街X座 274347', 1630000000060)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000000, -95171868, -3159580668189063241, -4074, 47, 82585.410649, -7462199.923442, 0, 'binary.nAHveWPuvkfTISitbBzq', 'nchar.河北省琳县蓟州吴路H座 196552', 1630000000060)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630899999999, 941556630, 7998670511234147715, 15902, 22, -6585.641376, -0.373709, 1, 'binary.WrcojJGdsiZyAaRxYrdw', 'nchar.江苏省东莞市翔安杭州路l座 318171', 1630000000060)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000000, 1042736485, 7949270623018065586, 28676, 76, -61426.518584, -889632484.718458, 1, 'binary.MMPKnkKEPUMKxiatOAXs', 'nchar.北京市杭州县永川梧州街L座 989832', 1630000000060)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000001, -343938435, -815062415332308272, -26680, -52, 5.498240, 63.248674, 1, 'binary.HoqLkegpacFGqzFWeVXL', 'nchar.山西省辽阳市城北沈阳路u座 992590', 1630000000061)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000001, -1788477052, -5188731326210734405, -1324, -57, -2910628601164.899902, 87786.407935, 1, 'binary.LlQNfNmJFPmYIFPwUEzx', 'nchar.重庆市丽华县东丽成都街e座 389910', 1630000000061)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000000, 2018195628, 7377417636728033494, 9220, 11, 4207000288325.890137, -618075239621.894043, 0, 'binary.sazxRvzqSdaThdGddmPa', 'nchar.黑龙江省呼和浩特县南长兴安盟路r座 293112', 1630000000060)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630915000000, -1893993866, -4365820244764275930, 31103, 68, -2066117083545.469971, -5037.126794, 0, 'binary.bMuXKucyDJjBggYIIAvd', 'nchar.上海市玉英县合川许街L座 434453', 1630000000061)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000000, 176036972, 6462275287504332531, -12663, 9, 7238554.481668, -24.426760, 0, 'binary.nCtwVdottyyUkynsejOK', 'nchar.天津市秀荣市浔阳施路B座 784962', 1630000000061)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630914999999, 462886464, 2194905473450940337, 12828, 98, 3.368086, 9.615829, 1, 'binary.BRImBBEftaaKZeOGRSvW', 'nchar.江西省广州县普陀潜江街J座 122271', 1630000000061)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000000, 1703114933, 1832458494225860699, 29866, 118, -3807017124.642100, -912951646003.170044, 1, 'binary.gPctXUuQQLaDZMWiQWzA', 'nchar.陕西省深圳县城北刘路C座 874212', 1630000000061)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000001, -674623669, -6380867918231277409, -1843, -119, 435947.604417, 766787648570.537964, 1, 'binary.XevOOqIPqCmaJUcXaaKz', 'nchar.云南省巢湖市丰都柳州街t座 325613', 1630000000062)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000001, -1559227469, -7051851803063121646, -27579, -65, -509948.590885, 2838.905231, 1, 'binary.QfqLcJjHqpLoidJREEnX', 'nchar.广西壮族自治区桂芝县清城宋路Q座 713677', 1630000000062)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000000, -1205146480, -6555909736905274411, 10866, 11, -917806.522567, 7477874070.574810, 0, 'binary.zDfAtyjfdffSTqbqeobG', 'nchar.北京市春梅县滨城陈路X座 531714', 1630000000061)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630930000000, -1494759877, 7825831993548386780, 3895, -126, -662731502.286191, 540530.198658, 0, 'binary.GGbtLZVCzfmnUdMHExqv', 'nchar.海南省东莞市上街杜街d座 891312', 1630000000062)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000000, -1188314039, -5179463148601079589, -727, -86, 3813.243840, 9214.756895, 0, 'binary.uTiBEULehnYGBTLmKywi', 'nchar.河北省勇市东城石街B座 963105', 1630000000062)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630929999999, 1589240480, 6788343323702456012, 17814, 12, -5156431732058.429688, 47771.262506, 1, 'binary.wJyZOXguJRYIbgIuIRye', 'nchar.浙江省桂花市朝阳杨街E座 783650', 1630000000062)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000000, 1494846642, 513923720305876961, 29664, 79, 77561611.652663, -742112715702.303955, 1, 'binary.ymFCwOLqQdnnsFafDwkr', 'nchar.上海市六盘水市孝南上海路i座 565965', 1630000000062)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000001, -253589870, -4348911754768762667, -11980, -62, -4485569068.944760, 96365.291525, 1, 'binary.CzIxfDKtViliFCPuYkSq', 'nchar.青海省凯县锡山宁德街m座 619840', 1630000000063)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000001, -1105799208, -3800641476990756597, -22387, -123, 63290.349790, 171660453137.690002, 1, 'binary.jQRSOxYnBcNuWfRXmBkT', 'nchar.湖北省丽华县城东西安街w座 178969', 1630000000063)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000000, -1072430928, -1022000926125289868, 18740, 19, -2339625154017.399902, -5914609622.300700, 0, 'binary.ZbiUjpLNbsjFkdkPPfbM', 'nchar.湖南省杭州县南溪黄路D座 533554', 1630000000062)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630945000000, 2135168110, 1934009776464408479, 6695, 72, 16367931616261.000000, -584177.637447, 0, 'binary.ICfwWUnCEvXrJWGQNYjv', 'nchar.海南省秀梅市丰都重庆路G座 676020', 1630000000063)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000000, -1604447094, -5852815210707209114, 17991, 107, 130598712.764873, 289933642.558557, 0, 'binary.yVowiloVQgZDlfKNlbWh', 'nchar.山西省燕市双滦潜江路o座 423049', 1630000000063)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630944999999, 701182235, 666030532933625291, 203, 77, -1.180313, -2809676597535.319824, 1, 'binary.wFVimJeupABVGEvwMiTv', 'nchar.河北省敏市东丽徐街H座 593999', 1630000000063)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000000, 1199058915, 6158980904131584989, 19579, 17, 541875543475.742004, -597076.697923, 1, 'binary.FjLluJSaCVzuHbHvJfzo', 'nchar.甘肃省淑兰市南长马路c座 137684', 1630000000063)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000001, -1563988450, -9012098528369421000, -14380, -126, -444977.754816, 72.749039, 1, 'binary.OjWhbhEvRlHpqFEHXmfR', 'nchar.浙江省南宁市普陀周街r座 756238', 1630000000064)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000001, -135825310, -1557116121902920061, -27295, -123, -9.714553, -1221.739051, 1, 'binary.PoymphzdepeBanAfXkZU', 'nchar.内蒙古自治区颖市花溪吴路Y座 361290', 1630000000064)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000000, 220678360, 6988249753807558085, -2581, 63, 44373988506.265701, -776960795071.900024, 0, 'binary.FceJEjYHrZmPNoGcSJYM', 'nchar.香港特别行政区秀华市金平刘街v座 478775', 1630000000063)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 15376875, -6664581571745752730, -13465, 6, 16623190903.482500, 48981341.814827, 0, 'binary.lwtmrfdurUFDSkHMZuOe', 'nchar.辽宁省晨市南湖辛集街k座 508374', 1630000000064)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 1241969440, -1628740312418081543, 13806, 9, -321375164064.127014, 309512084.295555, 0, 'binary.nxCrfJncdqIIHvFslwbz', 'nchar.重庆市广州县永川太原街S座 529006', 1630000000064)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630959999999, 1631111972, 732723021793120104, 9398, 75, 81.940353, 358.935299, 1, 'binary.QZSHkvsYmRHnGFnyMije', 'nchar.台湾省兴城市孝南兴城街p座 734723', 1630000000064)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 1489317687, 5519190191808186905, 7935, 65, -46699875.436843, -3.678916, 1, 'binary.lMozaeGkbfYcTzrxJcoV', 'nchar.广东省辽阳县龙潭侯街q座 888715', 1630000000064)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000001, -1081644320, -7901892167113844563, -4059, -78, -12875427.525138, 777315388163.552979, 1, 'binary.TDrOTkriDBpZtXBadhIx', 'nchar.青海省萍县西夏潜江路R座 701876', 1630000000065)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000001, -283328976, -5407024306435227732, -18436, -30, -0.910943, 6223301643044.309570, 1, 'binary.bZikexFXrPKScwiyBTtX', 'nchar.台湾省秀华县西峰关岭街Q座 185151', 1630000000065)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 667615766, 7516057978804562053, -6908, 82, 8.929773, -91.562693, 0, 'binary.ugfnkKdKlACxwKMCBEbb', 'nchar.海南省成都市沙市孟路Z座 646247', 1630000000064)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630975000000, 1998856189, -4326051996015773570, 17831, 76, -9.863853, -54574439998977.796875, 0, 'binary.JCxsLYijtQSKzNLYAICB', 'nchar.江西省颖县丰都蔡路q座 399088', 1630000000065)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000000, -1961052557, -8491150711564049542, 24318, -42, -54126426844007.601562, -2466916.622248, 0, 'binary.XijTExPHHgzfADOYawHs', 'nchar.海南省西宁市丰都齐齐哈尔路m座 331224', 1630000000065)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630974999999, 1021775776, 722158673624256018, 6062, 102, -94606143062457.906250, 35023478748411.500000, 1, 'binary.AstGPfaVxEefogcWzDzq', 'nchar.重庆市潜江市江北李街Y座 700708', 1630000000065)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000000, 1449414466, 6336873094660298228, 12438, 74, -790114.216316, -390.420215, 1, 'binary.secMQTXGKVthFXgMEFYl', 'nchar.香港特别行政区上海县西夏谷街n座 477311', 1630000000065)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000001, -1715903601, -471065515874324599, -10712, -65, -64736531762581.101562, -96042855.418683, 1, 'binary.lSSCcLFElDWxKZTdHRLN', 'nchar.天津市北镇县淄川禹街B座 570652', 1630000000066)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000001, -176995412, -7722430198424559895, -29062, -58, -5301089280.401760, -31441552360.634201, 1, 'binary.ikoqYkfzTrxBhYnfmKUW', 'nchar.新疆维吾尔自治区秀珍县浔阳王路D座 979771', 1630000000066)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000000, -65800677, -4755363672240072131, -11875, 34, 67445667.955342, 40434.343296, 0, 'binary.qDCRKCYQnmiDLFcdBAnT', 'nchar.广西壮族自治区北镇县浔阳宜都路W座 236322', 1630000000065)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630990000000, -1190594011, 8137196870545919699, -28040, -9, -68.827873, 52589.409559, 0, 'binary.lTlvbMfWCVccDOCnIDBK', 'nchar.西藏自治区艳市徐汇六安街X座 527915', 1630000000066)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000000, 6478249, -2262813485458902331, 28341, 73, -10648.983192, 21.336997, 0, 'binary.vLfZLtfmMGABLIsYcSuG', 'nchar.贵州省倩市朝阳周路Y座 721501', 1630000000066)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630989999999, 1492685945, 2082419493615737887, 1936, 121, 270330631887.458008, 464724.616085, 1, 'binary.esYXdqdUGVFhLCHHciWA', 'nchar.宁夏回族自治区合肥市永川昆明路Z座 321933', 1630000000066)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000000, 746488837, 4063291949108736915, 11202, 12, -294206344.943296, -54829.586060, 1, 'binary.ynUOCSQSnPGHiIFNcUlr', 'nchar.河北省慧市朝阳台北街m座 705236', 1630000000066)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000001, -457991373, -2036730114286415967, -2136, -105, -5092278572843.200195, 17587773689.161999, 1, 'binary.OCGshioisqgLTUFLRMSc', 'nchar.上海市南宁市沙湾南昌街q座 991276', 1630000000067)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000001, -1242447360, -2110971702178298800, -16302, -30, -4130.477367, 8402.793080, 1, 'binary.jHAuHSxbhQHBBbaHCVSe', 'nchar.云南省石家庄县江北程路B座 226188', 1630000000067)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000000, 71825038, 5708278874002188089, 4731, -80, 86.310448, -81380752238174.406250, 0, 'binary.WsCFazjKcLJjwrFHPelC', 'nchar.新疆维吾尔自治区永安县白云巢湖路j座 278171', 1630000000066)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631005000000, -925781701, -5868946429108894256, 5048, 19, 6559385936.497240, -9870442107.342270, 0, 'binary.iLESXKenJaWTIeKHFleM', 'nchar.新疆维吾尔自治区浩县高坪田街l座 923007', 1630000000067)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000000, -463506149, 8120086957375329125, -6384, 111, -9995250.448939, -736463.811003, 0, 'binary.AcGtBjWRUbXgHysDRMhs', 'nchar.江西省璐县海港惠州街g座 399144', 1630000000067)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631004999999, 306491871, 6281636598236510189, 24086, 67, -639.213146, 35478635363.208801, 1, 'binary.WPbbRgxYIRecrOFSlRYM', 'nchar.西藏自治区宁德市孝南刘路O座 708041', 1630000000067)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000000, 1797589305, 162080808454486608, 29046, 34, -54.791716, -71755480989.907196, 1, 'binary.DdiJOQDpLZuOsXbvtmFm', 'nchar.甘肃省台北县长寿高路t座 429482', 1630000000067)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000001, -709883988, -950329647663976821, -6274, -38, 64687083.568152, -133880631485.500000, 1, 'binary.cADQdfbZkXfcNPPOPQwp', 'nchar.宁夏回族自治区静市江北覃路u座 523043', 1630000000068)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000001, -1863995155, -8908360222222924661, -32472, -104, 82.537309, -89404622537910.703125, 1, 'binary.PBNnqQRGjNfbmaGVYlKD', 'nchar.新疆维吾尔自治区六安县西峰阜新路d座 990661', 1630000000068)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000000, -775088092, -151303921680143861, -23850, -72, -89808431301.207199, -646.674122, 0, 'binary.PGaLWNQGDnVSztoNNsSO', 'nchar.贵州省佳市翔安宜都街Q座 487382', 1630000000067)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631020000000, -487874477, 8081110518718693872, 10742, -8, 59233198.443672, -81768146.768733, 0, 'binary.AfIofVnHdvWMCGyeajlC', 'nchar.广东省利市锡山崔街X座 803273', 1630000000068)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000000, 822234976, 8508573074776208709, 17893, -96, -82.790723, -288719.773859, 0, 'binary.DoAGpoAKorgskVVmqIgo', 'nchar.河南省淑珍市淄川西宁街S座 903273', 1630000000068)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631019999999, 1639981656, 5471134581418657990, 22743, 76, 6306.116018, -7013891.566539, 1, 'binary.mVTonpWtYFauqLNntbcK', 'nchar.山东省巢湖县门头沟黄路g座 818470', 1630000000068)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000000, 1877786780, 1239434978427674122, 3482, 55, 4308520.332734, -7.194133, 1, 'binary.ATBjqErbvWNgzCwEXuVp', 'nchar.辽宁省凯县锡山广州街A座 668121', 1630000000068)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000001, -40134567, -5917934079243952151, -8151, -41, -1.160545, -5389824243.111000, 1, 'binary.hSZKVixlyoxpHpdvwYxY', 'nchar.黑龙江省合山市璧山吕路T座 593619', 1630000000069)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000001, -2005527285, -6681721755343029867, -25686, -12, -362992022448.400024, -5460308076525.500000, 1, 'binary.oWDnMrJWMhYgnspOVCyk', 'nchar.河南省明市城北阜新路D座 863966', 1630000000069)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000000, 24149104, 3385048008347468396, 25731, -51, 8252.733643, -4262287074.133500, 0, 'binary.pwblolLPhJQylCJAhGzn', 'nchar.浙江省柳州县淄川成都路q座 844741', 1630000000068)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631035000000, 212157003, -1467339935461255928, -7186, -34, 7497729511.586900, -98266.367876, 0, 'binary.jDxeCyLAKzKgEHGHAlif', 'nchar.广西壮族自治区桂英县永川张路K座 770340', 1630000000069)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000000, -2004196647, -7368122492859630941, 15455, -76, -57468499221.112396, 3727126030.311050, 0, 'binary.FIJWJSaOYEwWZHqhongU', 'nchar.上海市成都市花溪宜都路B座 441493', 1630000000069)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631034999999, 1412945598, 9027606879125343725, 21349, 38, -73686.799340, 3622986817296.899902, 1, 'binary.EPkNzxzaeCAWQetzzzlv', 'nchar.河南省荆门县沙市梧州街X座 162307', 1630000000069)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000000, 2125121614, 5109732906858974031, 26301, 81, -52025949738.545998, -0.369444, 1, 'binary.bjABIQwvmToiYBuNZkgo', 'nchar.青海省欢县龙潭荆门路q座 401300', 1630000000069)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000001, -517552216, -7052845906951781652, -9720, -120, -259291.640787, -9.749093, 1, 'binary.AmPftzlwURAILqlHhYtv', 'nchar.浙江省凤兰县南湖太原街U座 609741', 1630000000070)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000001, -534996716, -6181873037570436300, -10798, -57, -8617907014714.200195, -583022086.598419, 1, 'binary.EhUOJdpDsZWYyyDDATpW', 'nchar.河北省琳市城东六盘水路z座 798939', 1630000000070)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000000, 502477321, -3940198187319461410, -590, -122, 11555.763461, 3.474600, 0, 'binary.iufgzJsvjLKSoGJGBiLS', 'nchar.黑龙江省佛山市大东兰州街G座 694559', 1630000000069)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631050000000, -1001974902, 6450834421987986410, 3297, 112, -8092802.381089, -13006311.799326, 0, 'binary.ELgeHxhmjoFyFgkFXZui', 'nchar.贵州省阜新县高明永安路M座 392539', 1630000000070)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000000, -1991708456, -864737276653013043, -1035, 104, -621.411878, 358.192500, 0, 'binary.dzcYxzyOZMYgtByHiDTc', 'nchar.重庆市上海县东丽崔街N座 481064', 1630000000070)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631049999999, 1210716085, 5098727175987952663, 14612, 99, 122287663.454320, 1915439.569884, 1, 'binary.xPKETDcCdbWtoYoUCgre', 'nchar.甘肃省晨县上街龚路E座 215933', 1630000000070)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000000, 372703643, 5265014540357675070, 11084, 4, 955.287790, -677466762016.219971, 1, 'binary.TyniuJCZqfeldsiTGmnn', 'nchar.四川省济南市六枝特尚路V座 872192', 1630000000070)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000001, -1186882087, -6843278012193945664, -21562, -48, -73364783.992379, -8374993150.154530, 1, 'binary.HVKExGKBzdrjjQbKdgim', 'nchar.四川省通辽县西夏秦路J座 522373', 1630000000071)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000001, -1513635853, -4943689304527658905, -26256, -17, -157022486.675383, 47593146446.323402, 1, 'binary.xmsafXeSTguAIwMoWsSm', 'nchar.陕西省哈尔滨市大东辛集路G座 719181', 1630000000071)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000000, -2096895302, 2527287882879318478, -11906, 39, -2092909636.574400, 832609111532.883057, 0, 'binary.DpAgGGDNkTqeFPziAoZv', 'nchar.重庆市旭县翔安杨街N座 500333', 1630000000070)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631065000000, -607426580, 480106595535647664, -14319, 71, 485500665.146682, -7157.602006, 0, 'binary.NuToHMvRscGxwMENZqOS', 'nchar.贵州省秀荣县璧山申路Y座 936410', 1630000000071)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000000, -1266376029, 7399492335983317341, 21772, -21, 3959426326750.160156, 4299575.449645, 0, 'binary.sdhZOekTsIiwOYFEShct', 'nchar.重庆市大冶县友好长沙街T座 325982', 1630000000071)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631064999999, 1209625354, 8611086034262933876, 7159, 57, 66305514.987262, -249576.528082, 1, 'binary.xDqLioOjrUudmVTRaKmP', 'nchar.广东省海门市魏都北京街t座 626317', 1630000000071)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000000, 423864530, 7171258036520933259, 5585, 41, -9923192491285.410156, 9.901365, 1, 'binary.JiryCLzxGYRamjkLmMDH', 'nchar.江西省澳门县新城重庆路b座 208813', 1630000000071)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000001, -1049869765, -6885754556853202467, -6460, -118, -883111.347273, 654352667.175980, 1, 'binary.ZcJrqAQpBfTRFJupVZDH', 'nchar.陕西省雪县长寿淮安街o座 362739', 1630000000072)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000001, -1239790498, -4444805752431922421, -28574, -70, -70077.276971, -76046.699605, 1, 'binary.mCAmZahnycvOkwVDVpgV', 'nchar.辽宁省上海市合川赵路q座 784249', 1630000000072)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000000, -1048465520, -2935190573459597102, 21673, 87, -2585566.109742, -2007.606237, 0, 'binary.HNslYqKBtmSuAbsFzwKj', 'nchar.山西省莉市海陵昆明路t座 518218', 1630000000071)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 630458653, 711094046704512569, -30447, 17, 18100.228068, -28061872.208530, 0, 'binary.SrRBINnQSvdBTBKNGHFz', 'nchar.吉林省敏市高明尹街t座 876540', 1630000000072)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 1587008473, -497820597464002656, -14935, -92, -5426069.379042, -9834.237204, 0, 'binary.qRermCLWFAWnLBFapDsH', 'nchar.陕西省军县璧山石家庄街l座 337307', 1630000000072)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631079999999, 482971664, 4456457973181208346, 29811, 105, -2892240.803873, 28282444.178390, 1, 'binary.ZumfNrRUgHCXCqqjBwgX', 'nchar.安徽省宁德县南湖关岭街K座 983548', 1630000000072)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 1255752961, 4617338544672893130, 31384, 45, -3965.493491, -943974751.371172, 1, 'binary.xoiyGCRmWsgMFgfrdONj', 'nchar.内蒙古自治区鹏县南湖石家庄路E座 253529', 1630000000072)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000001, -1695698428, -671923235747543675, -26225, -99, -89596996493.199203, 53.155372, 1, 'binary.VzjkizbqoeqlOEtsqzTd', 'nchar.海南省台北市锡山长春街F座 321351', 1630000000073)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000001, -470196570, -1577429027012366617, -7829, -48, -39.524752, 51706491389416.898438, 1, 'binary.rOSrdNRJmYutBQkKnIvQ', 'nchar.辽宁省哈尔滨县上街南京街x座 664388', 1630000000073)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 752187387, 5814377969189879673, -39, -37, -1240781.998722, -680710584267.488037, 0, 'binary.bFiODlLTjBvFimRGPEZH', 'nchar.上海市桂荣市高明张街U座 936978', 1630000000072)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631095000000, 1299240809, -3372032764175680697, 18966, 71, 284347227.242907, -129822972.670593, 0, 'binary.eqzlYcordfJQQJMBljjF', 'nchar.浙江省台北市大兴邯郸街l座 594497', 1630000000073)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000000, -601799850, -773012696448162526, -24255, 69, -85539.695742, 8483599308481.120117, 0, 'binary.fodqpEDidmdgTobhLwVp', 'nchar.江苏省秀荣县大东李路o座 709775', 1630000000073)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631094999999, 369111551, 4483914872861013771, 27035, 120, -61260954640579.898438, 5141985.329967, 1, 'binary.hBVqWjfnRCktdjBpGTYb', 'nchar.宁夏回族自治区六安市秀英哈尔滨街M座 426619', 1630000000073)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000000, 1544340960, 8517061698296926738, 16940, 119, -62221249203.984596, 7342075383114.320312, 1, 'binary.EbuTOcRDAAmBGOFvyfZO', 'nchar.宁夏回族自治区武汉县龙潭蔡路M座 210568', 1630000000073)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000001, -1324385506, -8127100560658016141, -3090, -49, 1019018870.899400, -86.370275, 1, 'binary.aBZiPEKTvPqdXPsDXgvy', 'nchar.云南省晨县山亭宜都路d座 616893', 1630000000074)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000001, -2055898711, -5445111939290776239, -31593, -49, -77345663240.806595, -914.503516, 1, 'binary.BSnRpSkSznADKblDKOiG', 'nchar.河南省凤兰市高明黄路M座 303020', 1630000000074)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000000, -943484549, 260761652713813572, -31076, 88, 886963.235930, -38250864.484145, 0, 'binary.qUWErZCBbTHzETMfuRMa', 'nchar.陕西省兴安盟市和平乌鲁木齐街w座 905284', 1630000000073)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631110000000, 1560015019, -6729804845934136099, 352, -115, 9316.130184, 220903.824895, 0, 'binary.fWtsEHhFIrXfqBGYlTNJ', 'nchar.海南省济南县白云李街S座 920870', 1630000000074)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000000, 600240137, -4687958607276237783, 31931, 50, 5721.825376, 570753990973.805054, 0, 'binary.utJxZlgPEdcqNAFObuFZ', 'nchar.广东省台北县普陀兴安盟街T座 505320', 1630000000074)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631109999999, 1370148713, 2682283741646434124, 21747, 108, -7336368856593.450195, -86249517.560025, 1, 'binary.ApKvhLsWkpRndmodhPEN', 'nchar.云南省雪梅县安次卢路J座 135754', 1630000000074)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000000, 656300451, 4206774300939189669, 24233, 69, 540899878.718127, 5.252156, 1, 'binary.TRvUgqDMiPmpDbTDQJIO', 'nchar.四川省香港县秀英关岭路Y座 839081', 1630000000074)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000001, -1440742963, -6981670779291616929, -17863, -118, 9339406547236.320312, -80509839.572484, 1, 'binary.nsuhquhIJtXKINhuhbZm', 'nchar.天津市齐齐哈尔县朝阳西宁路L座 393435', 1630000000075)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000001, -1680777424, -3789071286423645612, -29891, -91, -3687858.975654, 28786.604619, 1, 'binary.YfWaoxPFJKJagXhyEOmA', 'nchar.湖北省银川县崇文何路i座 475105', 1630000000075)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000000, -1095049119, -2038760289253362613, -4186, -124, 13304836.627667, 77695031812.673798, 0, 'binary.TEZgbSkvAdOPvsssvtOX', 'nchar.四川省鹏市东丽胡路Q座 963536', 1630000000074)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631125000000, -1618319757, 6350170596406303692, -28807, -17, -1265501669.731500, 757504.607632, 0, 'binary.xQXfGqKJJntmbtHJzqHc', 'nchar.吉林省重庆县南湖郑路E座 472846', 1630000000075)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000000, -2143880375, -2493359647253702127, 6606, 66, 404444.216865, -7014.675537, 0, 'binary.bPjaavfcVrQcVEYxUtAe', 'nchar.安徽省兰英市涪城王路f座 265166', 1630000000075)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631124999999, 1951461498, 4426546683527923406, 26976, 106, 861491.829361, -5937918253.865560, 1, 'binary.hZDumWlAzVpYfXkEaPlW', 'nchar.云南省重庆县清河陈路P座 522865', 1630000000075)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000000, 1219706153, 7536523458446532711, 5155, 120, -675841841.464953, 91755264081.884003, 1, 'binary.KsCtLZBdLUvbbTIKedAw', 'nchar.香港特别行政区永安县高坪南昌街L座 368651', 1630000000075)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000001, -1663211983, -3109525234509445099, -21222, -8, -21298956.340869, -9657.318325, 1, 'binary.wBVWJVLFoOdXTzTtRNuT', 'nchar.广西壮族自治区惠州市高明柳州路b座 545369', 1630000000076)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000001, -1810125590, -8421898795641820385, -4441, -89, -2734964221.741360, -37493460960.576599, 1, 'binary.yxiYtSxCJYuTTjLuCcLI', 'nchar.辽宁省太原市和平侯街i座 586968', 1630000000076)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000000, -1416386308, -7684571277090397009, 22278, -110, -31.162606, -776.531904, 0, 'binary.XYkmkoMHknNtlosmchSh', 'nchar.河北省郑州市花溪周路n座 600734', 1630000000075)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631140000000, 989052773, -5476387551687883714, -11570, 127, -37404372.212454, 42699806.700508, 0, 'binary.SifrNRSsBKcJKDqsnfXN', 'nchar.云南省拉萨县高港张路n座 873322', 1630000000076)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000000, 90148890, -9176843805101255090, 7217, -69, 7747.651553, 246706074.781856, 0, 'binary.iuKZktHzJRwchXDkGhbL', 'nchar.河北省娟县高港汕尾路p座 635670', 1630000000076)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631139999999, 2092906691, 5816259342140952837, 27223, 3, -21145.797856, 39546630288.518501, 1, 'binary.hLAAdJsauemmUBKhTtqW', 'nchar.江西省沈阳市海陵周路O座 413415', 1630000000076)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000000, 1419713973, 818822617965851283, 32245, 47, 92022664.783976, 3311483.287128, 1, 'binary.yfRnxroKprvGvOyoTlEh', 'nchar.广东省辛集县萧山西安路M座 462571', 1630000000076)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000001, -2137737633, -3177008163567761597, -29189, -74, 548693287695.377014, 72371.674202, 1, 'binary.wRfxAxVfEcdfKteGLuaX', 'nchar.内蒙古自治区淮安县普陀杨街A座 734889', 1630000000077)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000001, -1023034969, -7642623044713882631, -13299, -59, 3279504.422480, 6716289645.631150, 1, 'binary.vlQPmKsSiqtoGCixEBsV', 'nchar.广西壮族自治区晶市上街宁德街B座 609891', 1630000000077)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000000, -30379416, 1958421706180608853, 1892, -29, 4674012.774896, -21398530385.866001, 0, 'binary.pxvGQUheUZkqNsxiAZuT', 'nchar.澳门特别行政区倩县房山杨街U座 114062', 1630000000076)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631155000000, -1117272908, 752098947372767902, -2819, -56, -9085630.993944, -6895774866846.309570, 0, 'binary.HlxBvTuGkChJDLzDaxyu', 'nchar.陕西省昆明县龙潭周街D座 817221', 1630000000077)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000000, 2086908228, -5781823409166665769, -3324, 9, -3.671731, 50135208435.527000, 0, 'binary.UWkIRXVdPsZxZFVaWBtS', 'nchar.湖南省郑州县清城古路B座 982490', 1630000000077)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631154999999, 870002160, 4167669984685102889, 30468, 115, 641517032220.147949, 2742.639429, 1, 'binary.JCROwpmJQkPqZkIzrRkU', 'nchar.江西省静市黄浦潜江路B座 249825', 1630000000077)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000000, 1396830896, 8133688472099187160, 22272, 75, -4524332410799.129883, -35663261.321445, 1, 'binary.kOEOFvSdtLEFJlgywaSJ', 'nchar.河南省英市长寿汪街E座 114327', 1630000000077)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000001, -837033747, -5283148083077494740, -1260, -39, 565321.239314, 275.746366, 1, 'binary.YKouegacQvxoSSgTaPrv', 'nchar.安徽省淑兰市新城李路r座 256922', 1630000000078)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000001, -1906954896, -5724786982458123670, -1426, -24, 299922.459639, -1285.219883, 1, 'binary.ZqHGrayEGFBlDHVAObSZ', 'nchar.甘肃省桂芝市金平武街X座 777677', 1630000000078)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000000, 745556057, 516983514584470898, -12904, -49, -716006320.556210, -218.138046, 0, 'binary.ZJBaxSKndLZrHVRppYnT', 'nchar.广西壮族自治区梧州县秀英甘街b座 779502', 1630000000077)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631170000000, 2139488417, 6066602372775042425, -1518, 84, -80581942.592809, -37314203203.592003, 0, 'binary.yymGCDKbqZkixkIjIIGT', 'nchar.湖北省荆门市和平淮安路J座 884655', 1630000000078)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000000, -374714905, -7736740878366341122, -14276, -79, -64248.970229, -68011884269.584396, 0, 'binary.hMgGBmPqKYkzsArGfbxQ', 'nchar.新疆维吾尔自治区沈阳县城东齐齐哈尔街b座 794676', 1630000000078)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631169999999, 1397781824, 6557161155035163362, 11749, 37, -3.906174, -1.651866, 1, 'binary.hwfhcmJDDTvQaCRmlKCd', 'nchar.江西省玉华市长寿梁路o座 261941', 1630000000078)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000000, 1387979869, 2661199544340098486, 9621, 49, 166489205686.515015, -7163639.756925, 1, 'binary.atyzvvxverSTvukiOHRc', 'nchar.澳门特别行政区琳县南长深圳街L座 927560', 1630000000078)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000001, -1573224659, -6074816603000302535, -28617, -101, 26624788159.678699, 62.218691, 1, 'binary.QpcyRVyxqqnHSSLxWCdz', 'nchar.台湾省荆门市和平关岭街w座 554552', 1630000000079)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000001, -613007188, -2265367830140686655, -30242, -74, 132051246084.664993, 9583075.585374, 1, 'binary.ZwGExMXBaZQnYGUqOZnk', 'nchar.贵州省天津市龙潭吴街P座 514026', 1630000000079)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000000, -229811940, -4723474584235949728, -30413, -126, -37.161630, 6566121399.880410, 0, 'binary.QKZaMSaDgNKbuVjVXVZX', 'nchar.湖北省超市友好南宁街b座 387820', 1630000000078)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631185000000, -1462514908, 6815473990049018903, 26765, -60, 8053251416.958930, -94687.447387, 0, 'binary.gMqqCIzQCNGNgbSwolZX', 'nchar.山西省春梅市魏都张街I座 216775', 1630000000079)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000000, -1558957537, -3515355671345392932, 32525, 83, -873729.459053, -4948145879174.500000, 0, 'binary.eHTWpPQVAzoRsZXjDHro', 'nchar.内蒙古自治区雪梅市西夏广州路T座 462974', 1630000000079)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631184999999, 1354974803, 4535068117623812145, 15974, 126, -3641262362.474420, -215837.649412, 1, 'binary.mgwWzOiTRoTHUbvzEMSm', 'nchar.宁夏回族自治区欣县东丽南昌街a座 409781', 1630000000079)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000000, 909020116, 7166005914556535033, 14716, 26, 50294221.576123, 67159744502236.203125, 1, 'binary.aHafHhYbmjwnjfaDKjaV', 'nchar.天津市马鞍山县南溪宜都路W座 812458', 1630000000079)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000001, -1306330996, -7521905733671260635, -1, -23, -651220.365910, 209.745394, 1, 'binary.xazZjdXNjaykPYfDWhos', 'nchar.广西壮族自治区慧县南溪李路n座 595049', 1630000000080)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000001, -829584454, -6819959797009261424, -30794, -119, -2545863021084.839844, 48573662965.169998, 1, 'binary.RQfCFnyRhVGAwoZKbfBg', 'nchar.江西省畅市大兴呼和浩特路N座 966282', 1630000000080)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000000, 159441443, 3829890051273914786, 22074, -46, -0.126559, -59066.623155, 0, 'binary.sCHQwHDxsHrpfheUsPvS', 'nchar.甘肃省婷婷市和平林街X座 967902', 1630000000079)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631200000000, -1984142506, 918572017792917031, -20270, -51, 7172084337794.419922, -67689618090033.000000, 0, 'binary.pfhSySLjKZbOfIPTmqAB', 'nchar.宁夏回族自治区亮县牧野石家庄路L座 408034', 1630000000080)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000000, -1972988665, -3214499273794963694, 3010, 42, -8898.495820, -7139.318526, 0, 'binary.ivdrcXkAeWkscdYzZJEe', 'nchar.浙江省瑞县海港永安街R座 494785', 1630000000080)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631199999999, 1089140558, 5653452583897077783, 8528, 7, -9816158771686.500000, -30.580967, 1, 'binary.tqyfrLsfYAZeSvFCwYXQ', 'nchar.安徽省倩市梁平广州路E座 417291', 1630000000080)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000000, 1752602476, 8379644292871336124, 1479, 55, 0.152144, 8340466.258810, 1, 'binary.CaqLbGdnvyvDGmnqAdwA', 'nchar.宁夏回族自治区兰英县滨城董街m座 612134', 1630000000080)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000001, -2070609011, -3927356551694226099, -14160, -96, -489939465270.245972, -176.619265, 1, 'binary.HtBovhAaClqmUKDVoPoA', 'nchar.西藏自治区兴城市西峰李街O座 294081', 1630000000081)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000001, -507025125, -6769707689103886410, -26670, -62, 7.854748, 91216299872.798492, 1, 'binary.kVTRaSjNPeaJAGYzWqVF', 'nchar.山西省邯郸县六枝特袁街q座 379922', 1630000000081)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000000, -91932554, -8911762384559779952, -12134, 114, 8455.888482, 192830806126.287994, 0, 'binary.UmxEgaxmRlsWpDOOjGns', 'nchar.安徽省秀云县金平亢街Z座 413285', 1630000000080)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631215000000, -2106211575, 4343732691913651727, 30695, -65, -1182138766033.570068, -1420143959702.800049, 0, 'binary.lENnnzItGfhHBhuBSKkg', 'nchar.宁夏回族自治区淮安市大东章街Z座 522024', 1630000000081)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000000, -1514266386, -1557718503233026241, -10740, -93, -3712.656749, 628.936406, 0, 'binary.KCtPSzikgeatarBhSEXT', 'nchar.安徽省莹县淄川石家庄街i座 428331', 1630000000081)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631214999999, 243460896, 1867078685154320423, 13109, 8, 2562.515572, -8164811617493.440430, 1, 'binary.GwEkcVzBVjqKKvBBYCHl', 'nchar.广西壮族自治区邯郸县门头沟兰州街l座 647959', 1630000000081)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000000, 669742703, 3588783546529218834, 10833, 6, -408721127673.909973, 801103747.542088, 1, 'binary.uwFahDnlWanEVobNZkCM', 'nchar.甘肃省张家港县白云罗路f座 137164', 1630000000081)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000001, -442417658, -7549129289634916853, -2159, -58, -98911613476.491501, -874.865816, 1, 'binary.aMVpynzemnksvKTWGcDC', 'nchar.吉林省建国市牧野钟街E座 377779', 1630000000082)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000001, -1409923779, -8427760215446628026, -18353, -47, -50606823244.468002, -345539443425.945007, 1, 'binary.cugznUahvcPVWaAAckbf', 'nchar.海南省宁市合川宜都街o座 305915', 1630000000082)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000000, -1342274642, -8536170080112789400, 30067, 115, 12581450912.783600, -291.972491, 0, 'binary.eOcZzgBgRRIVelvjVeto', 'nchar.澳门特别行政区欢县高坪广州路N座 593765', 1630000000081)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631230000000, -456444500, -653943768841413221, -16654, 115, -74554935958741.203125, 7070430643.419100, 0, 'binary.zrOBefSbOEUgRLtVobMw', 'nchar.北京市璐市东城太原路Z座 165710', 1630000000082)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000000, 1112822860, 8809469361686033607, -22243, 84, 718004818.589884, 836.474427, 0, 'binary.cLnnuHpDQIMfMBODNYpW', 'nchar.青海省广州市房山阜新路h座 898094', 1630000000082)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631229999999, 993462171, 7980976104707598817, 22906, 119, -90532577531185.000000, 2883997.534517, 1, 'binary.akkJQvtKVOUMeEJdtLWQ', 'nchar.辽宁省西安市魏都长沙路q座 830446', 1630000000082)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000000, 659535811, 6648102677976806439, 14934, 106, 8.999744, -78105262.595693, 1, 'binary.RBWgiabXuPgAeanvsJoE', 'nchar.香港特别行政区倩县长寿王路D座 334836', 1630000000082)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000001, -1147877996, -6106212901363852731, -30865, -72, 9390.844553, -7383783838166.849609, 1, 'binary.UsylaHHTjnwUCmWOFRop', 'nchar.新疆维吾尔自治区齐齐哈尔市海港南昌路q座 642772', 1630000000083)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000001, -8588768, -7260337404461154045, -21386, -116, 46305041.132235, 6654257695.256100, 1, 'binary.SneLCpCrEbSFqlWIVLwu', 'nchar.陕西省欢县花溪荆门路T座 249790', 1630000000083)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000000, 1003481306, 6017067765177374344, -16218, 60, 82.649494, -712.838445, 0, 'binary.qLRxDlzDPjVVbRZHOADr', 'nchar.河北省畅县徐汇大冶街D座 822863', 1630000000082)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631245000000, -294434895, 1924629096591118432, 17988, -44, -63587509.905294, -40747153.224679, 0, 'binary.olALLZcgYbqmLLsQAfvv', 'nchar.云南省强市淄川淮安路c座 262889', 1630000000083)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000000, 738129131, 1815388765763244472, -6405, -93, 52.721010, 216.728740, 0, 'binary.yxHFbosrzvHvxaTBUoNe', 'nchar.浙江省福州县梁平嘉禾街i座 170922', 1630000000083)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631244999999, 224419688, 3680471494276801590, 18367, 87, -74383724488933.593750, 0.593016, 1, 'binary.FsYcmhXFIVEwuCmapLFd', 'nchar.青海省合肥市清浦辽阳路I座 165564', 1630000000083)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000000, 54658682, 2220380251657075236, 12017, 72, -2409.191361, 16465604801985.900391, 1, 'binary.WVLQqvEMPTlqXptHGBTA', 'nchar.陕西省桂珍县魏都陆路z座 653467', 1630000000083)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000001, -111362062, -2079998725394443456, -14043, -83, -8050700.333128, -786.595631, 1, 'binary.wugzMLvmLdkxesgmixOH', 'nchar.安徽省南京县清城柳州路Q座 634494', 1630000000084)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000001, -646454407, -7621015329762251852, -32454, -96, 58254987.947866, -86.835965, 1, 'binary.nUZjCcyTPHcAJQjyqiKW', 'nchar.河北省嘉禾市锡山张街F座 809458', 1630000000084)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000000, 1630911956, 9008151774496407995, 3422, 97, 1410480123999.199951, -40614657267267.296875, 0, 'binary.kaWyIWeHVgVeCBWtXjos', 'nchar.青海省婷婷市和平黄街G座 571553', 1630000000083)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631260000000, 1229299947, -3222073200735135026, -25377, -68, 76060893505437.296875, 79056750996157.000000, 0, 'binary.TIeullzMmPeJOEDzERVs', 'nchar.内蒙古自治区长春市普陀通辽路R座 260095', 1630000000084)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000000, -1829114311, 192679604105772908, 25050, 51, 429584494.456619, -7710.519461, 0, 'binary.sxkAVzIUJGdjrEKTWivG', 'nchar.重庆市帅县南湖长沙街T座 169523', 1630000000084)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631259999999, 2133083813, 7400378387863708089, 15500, 29, 483042885.250631, -4018.354623, 1, 'binary.buDeWRmTqpbBhNKoIWjt', 'nchar.天津市婷县新城呼和浩特街Z座 481098', 1630000000084)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000000, 2102189676, 8289210275637280206, 12319, 12, 2360.126260, -0.783536, 1, 'binary.zkocBZqDNaubCdBsYlZK', 'nchar.河南省潜江县吉区邱路R座 988052', 1630000000084)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000001, -88622269, -8452436543600128194, -14877, -107, 2.227830, -896.432470, 1, 'binary.fgqZcQmlErAwLKYvDwkA', 'nchar.福建省嘉禾县城北汕尾街S座 162248', 1630000000085)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000001, -603730496, -5142204606726944282, -6542, -22, -701.644082, -75915023637.720001, 1, 'binary.JtkfvmLGOlQzBtNKysLt', 'nchar.云南省沈阳县高港李路S座 869342', 1630000000085)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000000, 2144837535, 6790333755067852306, 29522, -5, -5292215263549.620117, 9659.226553, 0, 'binary.ZtAHxvlbFZNbmkaMfRDe', 'nchar.台湾省大冶市吉区石家庄街O座 527169', 1630000000084)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 1290141025, -2143848369719800423, 7189, 8, -822375762195.462036, 20283811003.944000, 0, 'binary.loHjtwzgyvJksRhJNiQS', 'nchar.河北省佳县徐汇刘路G座 705107', 1630000000085)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 801182958, -7572521914234103164, 4604, 107, -859019.418204, -261693048307.811005, 0, 'binary.YAcVYbiCpwSqCdWIgbBo', 'nchar.上海市武汉县闵行杨街a座 347736', 1630000000085)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631274999999, 521859506, 3602105093569999375, 21665, 21, 9019367.551508, 532663957703.719971, 1, 'binary.NgxLslBkOvvWWVcDCUlC', 'nchar.海南省哈尔滨市翔安沈阳路r座 486389', 1630000000085)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 1634351470, 1549009549596999035, 26284, 69, -2.961951, -6310787053.197710, 1, 'binary.AERkUPEHGySISfgqulEw', 'nchar.台湾省西安市双滦深圳路R座 706492', 1630000000085)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000001, -1577694201, -8482950364465928222, -19741, -105, 351508461253.127991, -28134084860.892399, 1, 'binary.zgfPMXusJGeFxLLImITl', 'nchar.黑龙江省红梅县吉区嘉禾路Y座 870326', 1630000000086)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000001, -1817845693, -2298814801521952311, -14645, -83, 223713055.105098, -75532242.499559, 1, 'binary.flJqybaXNWGYZTymaTJG', 'nchar.江西省淑珍市平山周街Y座 953199', 1630000000086)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 632609765, 4219748384315739773, -26000, 71, -450862164529.280029, 14560508342304.800781, 0, 'binary.ZHQyoqVmbWNpweggaXDK', 'nchar.宁夏回族自治区辛集市城北辽阳路N座 240842', 1630000000085)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631290000000, -770991939, 5485773724851375125, 23994, -64, 623888353027.609009, -55981854.579338, 0, 'binary.QKhLWpoMPsfwyQYNoPZA', 'nchar.上海市玲县普陀龚街p座 566117', 1630000000086)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000000, -793126068, 2224199903529481270, 6843, 106, 99682310978838.093750, 467505798786.474976, 0, 'binary.HmkxkSqBoJJStxYjyvrz', 'nchar.天津市志强市沙市雷路g座 547769', 1630000000086)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631289999999, 896685945, 4158350015273846866, 26730, 53, -6200015073790.200195, 12566017.333818, 1, 'binary.NEkCzZWDoXmvngPlArSM', 'nchar.天津市海口市魏都黄街O座 679546', 1630000000086)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000000, 832269201, 4123871706026762985, 13927, 88, 499.930604, -70366099857.880005, 1, 'binary.mADUJbHlBrbziiXvrWeZ', 'nchar.云南省惠州市沙市海口路c座 131412', 1630000000086)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000001, -102246541, -3324596924342719960, -3905, -96, -4816.768188, 93915714.748034, 1, 'binary.qiNYdNPnHVKQBpzXATmm', 'nchar.河南省呼和浩特市清浦广州路g座 216441', 1630000000087)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000001, -282159644, -7801886583063959893, -15115, -96, -7.823940, -2620.949488, 1, 'binary.GzTEiirhkGvJXbGkiPrq', 'nchar.香港特别行政区玉珍市朝阳刘街r座 939747', 1630000000087)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000000, -669399368, 5115472553771177504, 12526, 91, -28942186887.971001, -6.435703, 0, 'binary.XIZFOElmYhlMyQRewDCt', 'nchar.甘肃省乌鲁木齐市西夏贵阳路T座 579190', 1630000000086)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 262080824, 8383920960732834455, 13968, -34, -45.211929, -1300.277717, 0, 'binary.hIMCRvrXPAOVpFRmYnUy', 'nchar.江西省北镇市双滦刘街W座 798066', 1630000000087)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 2114811730, -1509702226741249727, -13264, 72, 2.150671, 5261316406.519730, 0, 'binary.FtIdbPhtUPjIuTSbpJQq', 'nchar.新疆维吾尔自治区沈阳县锡山林路M座 892641', 1630000000087)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631304999999, 2143525047, 6899945126249773541, 26738, 102, -292.795385, 138207363422.498993, 1, 'binary.eIPLVCyRogBRyzGbrFic', 'nchar.辽宁省福州县长寿杨路z座 941701', 1630000000087)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 1073200557, 807774567632061607, 29517, 113, 67931.421812, -1651664.861578, 1, 'binary.UyFmxxBiWhvpNXabSZxN', 'nchar.天津市斌市普陀哈尔滨路P座 502633', 1630000000087)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000001, -489200958, -5831038164958816606, -16406, -76, -6392689.485758, 3750666.814934, 1, 'binary.bCLmDBrnkgDcXvcwrBqA', 'nchar.甘肃省哈尔滨市吉区苏街y座 407071', 1630000000088)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000001, -2127347634, -4083644771875265580, -20817, -30, -3.785714, 681029605720.448975, 1, 'binary.GcWganOJXCPvFeMQZTYJ', 'nchar.黑龙江省丽丽县高港长春路v座 665579', 1630000000088)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 1527621467, -7509002110121261571, -26325, 32, 3.577428, 5008201901846.370117, 0, 'binary.mFsrNoKYqMYXhFEIfVXS', 'nchar.山西省梅市南湖合肥路w座 573200', 1630000000087)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631320000000, -493256377, -8751737434302823435, -27869, -96, 330393978255.500000, 94835651689763.000000, 0, 'binary.PqdASxtDLyeIFzBiaFGV', 'nchar.湖南省关岭市双滦武路o座 527508', 1630000000088)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000000, -2087366027, -6303077694275632802, -15261, -89, 43362171018304.000000, -166690.281684, 0, 'binary.zPrdaJdDKwcSHuAxtOlS', 'nchar.澳门特别行政区超市高港刘街N座 420236', 1630000000088)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631319999999, 1129994268, 1552944233564611739, 10242, 108, 562740269.814683, -48475927235174.601562, 1, 'binary.rqJyBwQmuzFVARUJRgKb', 'nchar.山西省巢湖县西夏沈阳街S座 255735', 1630000000088)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000000, 2063639050, 2521461528938336565, 2345, 89, -6038709960145.540039, 24451.395881, 1, 'binary.iSmMBujSmVtayVzDoWgG', 'nchar.内蒙古自治区桂香市吉区潘路v座 620160', 1630000000088)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000001, -1449143866, -6390394742281036218, -100, -33, -120.220087, 109963155461.466003, 1, 'binary.fPxCvZJXReoaPBmALmPQ', 'nchar.内蒙古自治区婷市兴山冯路h座 570428', 1630000000089)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000001, -1895163787, -1867618456195867046, -5071, -105, -1871044419105.310059, 443341008.795331, 1, 'binary.tMibvAJACwmXDYSGDcNH', 'nchar.贵州省兵市静安黄街O座 248304', 1630000000089)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000000, -1870734956, 5919383249914923168, 25989, 91, -1.395899, -450627922362.231995, 0, 'binary.rCKozKCilrDzhrinGzhJ', 'nchar.江西省楠县闵行银川路V座 237404', 1630000000088)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631335000000, 408968903, -8367166343934446562, -19738, 15, 854582448833.431030, -9969.161351, 0, 'binary.GLyIXkgZbApVCOoVSqaO', 'nchar.江苏省香港县黄浦淮安街D座 525365', 1630000000089)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000000, -1122322355, 8412393600271974612, -23315, 95, -68174012.309009, 15387044.711345, 0, 'binary.MGjySGAlYDujClbZejIQ', 'nchar.安徽省邯郸市城东大冶路G座 360663', 1630000000089)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631334999999, 2026186883, 445653452435547622, 18307, 49, 213343.543679, -4.739704, 1, 'binary.fOSZlDCKdxiQaysyscfx', 'nchar.江西省雷市花溪陈街B座 320678', 1630000000089)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000000, 507343304, 7297664243660949047, 12008, 109, -531.925870, 1673114199.854260, 1, 'binary.cTljYtBXIOAsDXqDTlMd', 'nchar.广西壮族自治区帅市崇文王街u座 771522', 1630000000089)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000001, -2001883206, -817341878022425389, -2161, -42, 9.708559, -53706854436.695000, 1, 'binary.IUNzHoyqCMDBQckAVEQz', 'nchar.四川省宇县城东淮安街C座 920078', 1630000000090)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000001, -1408747533, -4778697158136936011, -27, -101, 47621.171490, 3290528001686.430176, 1, 'binary.vyTXYeaTyzhYwNCQiJrW', 'nchar.广西壮族自治区秀芳县大兴天津路H座 858644', 1630000000090)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000000, -1227268662, 4866318703531659868, 8057, -67, 1812966973.800030, 6.738090, 0, 'binary.EMfIIquLTRUJOViCbaXD', 'nchar.河北省长春县翔安禹路f座 740911', 1630000000089)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631350000000, 29364546, 7439453869072957110, 3379, 93, 55692580455.865402, 25451.386688, 0, 'binary.SOQDYnfDtUghMpNrrrvd', 'nchar.吉林省玉梅市清城大冶街w座 657754', 1630000000090)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000000, -1512569467, -2170613746493368276, -9226, 86, 94917216138828.500000, 45.344859, 0, 'binary.osdODKgoqrkMjsUQuBxO', 'nchar.湖南省华县山亭赵街o座 343015', 1630000000090)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631349999999, 341004545, 1678452718654659972, 11982, 53, 647268193.946854, -9.321045, 1, 'binary.PlQgjTLDuHwIfIkGmfIq', 'nchar.江苏省长沙市门头沟秦路m座 511307', 1630000000090)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000000, 1022164581, 8771702396738754711, 1690, 106, -2055.312055, 363.845057, 1, 'binary.QVYMJaQkcoJnLdYFnwsS', 'nchar.台湾省西宁市南长郑州路f座 795021', 1630000000090)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000001, -2139193188, -4423061215457882616, -22771, -31, 492.888005, 22942151260.387100, 1, 'binary.LSzPYUKvvRlNrhoKoYkL', 'nchar.天津市静县浔阳济南路G座 357460', 1630000000091)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000001, -1786702987, -5274362232731441209, -16394, -43, 237512315596.303986, -558.984176, 1, 'binary.onBwaQpiFBImnuhjravU', 'nchar.河南省雪市淄川王街Y座 875679', 1630000000091)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000000, -1431645289, -6529328401317482981, 9944, -97, 279578438.723650, -79899714.177569, 0, 'binary.ZhbLqmODnxwYrimmIigl', 'nchar.北京市大冶市怀柔刘街t座 692168', 1630000000090)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631365000000, 568429328, -9060392884809893816, 28469, 61, 307437180734.507019, -21602647797.441101, 0, 'binary.IGDZBmjwYmOzJaUbkiKN', 'nchar.福建省兴城市兴山巢湖路P座 743092', 1630000000091)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000000, -1550415271, -7558411265476450633, -26998, -58, 1694624.435305, -47865257382.732803, 0, 'binary.JhBLpAPozgqCVUQnONkT', 'nchar.黑龙江省秀云县清城白路q座 555712', 1630000000091)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631364999999, 2050068224, 8869318186483878987, 18135, 56, -324240012.550862, 139208652187.634003, 1, 'binary.fzVzLhgOcjBWiooIbfZy', 'nchar.西藏自治区太原市长寿西宁路h座 862819', 1630000000091)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000000, 5839085, 4176280397163068047, 4608, 4, 683.468225, 4674219497.311910, 1, 'binary.YBbSDgHLgpNnIYBAiMnd', 'nchar.广东省欣县沙市惠州街I座 803450', 1630000000091)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000001, -1606114187, -8492599008143584602, -21024, -58, 977.510976, -2962257.665275, 1, 'binary.DQLAjLojVsSPrXVqoaFU', 'nchar.江苏省建国市涪城兰州路k座 224858', 1630000000092)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000001, -1085786582, -7556940745324501035, -214, 0, 85978773227.734802, 3688136776873.470215, 1, 'binary.LsObIWxTJIHqdNcQniXu', 'nchar.贵州省小红市西夏林路J座 503400', 1630000000092)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000000, -486512987, -1848007965784118332, 20641, 39, 7524.727066, 43002.993255, 0, 'binary.JtdWjkAwXwWmNqghjGgR', 'nchar.江苏省福州县萧山李路l座 332686', 1630000000091)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631380000000, 1015255006, -6233642644171313082, -30770, 103, -52871950.517558, -203.631390, 0, 'binary.dcFQefENHBmSbWfsxkNZ', 'nchar.吉林省凤兰县大兴李路j座 146250', 1630000000092)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000000, -1944800483, 2662387305551873341, -32553, -7, 49980.865995, -377372259.892400, 0, 'binary.EWzwpfuElPwODlQeSUsg', 'nchar.湖北省荆门县闵行永安街F座 378209', 1630000000092)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631379999999, 869226799, 2896504572324576563, 949, 78, 3067118231.817550, 5.678553, 1, 'binary.thrXsOuUUQEwGkXiZqVD', 'nchar.香港特别行政区荆门市高港天津街K座 250023', 1630000000092)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000000, 323027847, 2827349391284089242, 1441, 44, -17278.296831, 78816030.490657, 1, 'binary.YZbYVJvcLQeMTfNdLJhv', 'nchar.贵州省淑珍县永川辽阳街g座 249023', 1630000000092)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000001, -2127572203, -4937514564787173908, -63, -76, -123946739.447527, 698804470.690330, 1, 'binary.MtiGMwxbCoGxBrSCfmnb', 'nchar.广东省齐齐哈尔县梁平关岭路t座 761348', 1630000000093)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000001, -1306426634, -4986879132935813626, -28229, -23, 39146958063046.203125, 87460954188.246506, 1, 'binary.SZAYkmBTuWBkLyHMsNln', 'nchar.辽宁省荣市浔阳马鞍山街h座 139222', 1630000000093)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000000, -24693354, -7179764382339676335, -4810, 42, 49617345.815346, -40955896779.561096, 0, 'binary.AOTdejxaZWZTeWiSQccI', 'nchar.湖南省呼和浩特市南长东莞路Q座 526334', 1630000000092)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631395000000, 110327094, -7171919345203251134, 10385, 50, -88221.924084, -14499963.327697, 0, 'binary.jBWuQXhwybyeWaUeuiCo', 'nchar.河北省深圳县城北昆明路h座 627103', 1630000000093)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000000, 1589122997, 4808726552373126087, 13356, -88, -777.180511, -5649.819038, 0, 'binary.PLvgyyFexDVwuXPcgOUJ', 'nchar.广东省璐市梁平石街p座 625686', 1630000000093)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631394999999, 415752279, 5607734497564153556, 28120, 114, -758865393.966240, 2879.590758, 1, 'binary.pNjKEKLwWZUgNZshphnH', 'nchar.新疆维吾尔自治区海门市萧山潜江路N座 450879', 1630000000093)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000000, 1725928224, 406982977976053694, 31934, 55, 2365333426653.399902, 52689398.325206, 1, 'binary.tODfUdiMrapEBaRDyjTC', 'nchar.甘肃省旭县六枝特陈路k座 228235', 1630000000093)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000001, -1943166726, -461080508996818206, -3563, -103, -984164002.302936, 3328600.852324, 1, 'binary.hSqhMEcJIhZRmIFrQDKl', 'nchar.江苏省桂荣县大东宜都街q座 375062', 1630000000094)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000001, -965688414, -4532230014607129716, -32045, -103, -8.400039, -554153162149.166016, 1, 'binary.ZQVXUVCHEOWxAjlnoSEK', 'nchar.吉林省通辽县璧山龙路l座 482360', 1630000000094)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000000, -306891211, -3703573295039531167, 6006, 86, 226610060352.789001, -47040211.883215, 0, 'binary.BJYBsZjtDafCchXYbpRr', 'nchar.台湾省哈尔滨县翔安惠州街U座 837583', 1630000000093)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 1886325467, -3863586930565866233, 8904, 38, -946832.388950, 55.658536, 0, 'binary.QSJUCkzpJcOiAmsyKmUs', 'nchar.云南省宁德市高港东莞街N座 505827', 1630000000094)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 1857465087, -4382581587636034119, 23552, -18, -13.792084, 829139755.682817, 0, 'binary.ljHNBjHCmNlXXVTnknxH', 'nchar.四川省北京县华龙济南街x座 750613', 1630000000094)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631409999999, 1895012884, 2424275775986822787, 22179, 90, -0.394803, -56.575361, 1, 'binary.KBNSdgumJOCWoMmWtLJU', 'nchar.江苏省静县秀英太原路S座 251913', 1630000000094)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 1569144121, 5640124213375907439, 8815, 5, 257555.261048, 48254141.237573, 1, 'binary.KKozUPJSMbzhEyunifsH', 'nchar.湖南省伟县萧山萧街k座 474899', 1630000000094)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000001, -1384685953, -2320337996509410200, -15795, -10, -98.406889, 42984.674970, 1, 'binary.orjVZeKJsgJsTEqHljkf', 'nchar.海南省建华县沈北新林街g座 586911', 1630000000095)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000001, -1012235418, -8338932088221751208, -8979, -127, -25798805.860955, -48091893253761.101562, 1, 'binary.XDTOObdfDUqcGtXWVONC', 'nchar.浙江省柳市双滦鲍路a座 506391', 1630000000095)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 726812223, 8571870874380055515, 22786, -83, 942970127.407073, 52.995631, 0, 'binary.xgcSGhNrZOWGKZtOlArO', 'nchar.宁夏回族自治区丽华县蓟州深圳路K座 592080', 1630000000094)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631425000000, 2071766507, 1772340392886850115, -24057, 25, 78.445247, -79637.635931, 0, 'binary.sROneWSFNuXBalpsjyEo', 'nchar.安徽省广州市孝南刘路b座 713687', 1630000000095)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000000, 1087816300, 5318228817994763162, -27394, -31, 267905.242469, 8213154732519.320312, 0, 'binary.imZeNtwoLVXCQJPFObQE', 'nchar.山西省沈阳县高港长沙街F座 461428', 1630000000095)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631424999999, 2108909701, 7807744131165483728, 13566, 88, 6.922028, -9.200773, 1, 'binary.vYUalkfScnQyDPeEqCTq', 'nchar.江苏省太原市华龙陈街K座 781219', 1630000000095)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000000, 990358809, 3801390332798973674, 31813, 108, 5.517866, 6845.746002, 1, 'binary.DXVimvDjqwoNARHjTXuI', 'nchar.上海市杰市怀柔天津街N座 936198', 1630000000095)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000001, -52260486, -2710179305466920974, -16431, -119, -958.607117, -38510688978203.898438, 1, 'binary.erVQJAvbzEahBSRwIflK', 'nchar.江西省桂英县六枝特北镇路A座 788549', 1630000000096)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000001, -2093648842, -6938612375617002825, -6697, -12, 4655.180387, 8131192.215618, 1, 'binary.IKRYKZeWgWRTpWFkjzBI', 'nchar.西藏自治区海门市高坪六安路l座 342816', 1630000000096)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000000, -1314836279, -7834501286968314160, 15789, -123, 33900643554.123798, -2082127.625636, 0, 'binary.rDTPIDjxHVnobHXBYtXY', 'nchar.北京市昆明市合川董路B座 463423', 1630000000095)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631440000000, -1084304030, 7788263187088917501, -6031, 103, -857.741582, 8339855538945.950195, 0, 'binary.TyxrsRIKPjtzXgKyuAEH', 'nchar.山西省宜都县锡山李路J座 745663', 1630000000096)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000000, -1295742585, -5131971234132550528, -2973, 42, 52247.313515, 3926177760.319000, 0, 'binary.vXduhvWXmyRcbKfMRWlx', 'nchar.安徽省兵县高明许街p座 922555', 1630000000096)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631439999999, 20091569, 6781601496202385368, 19493, 34, 430582007336.525024, -2.412247, 1, 'binary.kZJLmYOxtxuJZnMBDufv', 'nchar.内蒙古自治区颖市浔阳王路J座 977519', 1630000000096)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000000, 1813973451, 4213442260213870776, 26872, 44, 67809323307135.703125, -88973468.418878, 1, 'binary.LTPEGjxcghSRynZSWwqM', 'nchar.云南省南昌县梁平杨街G座 627457', 1630000000096)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000001, -958070866, -691160751112903120, -20406, -41, 2363414966580.939941, 8820731593.777920, 1, 'binary.RZliiclFrDaNImulqJTo', 'nchar.台湾省梧州县沈北新葛街m座 433410', 1630000000097)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000001, -1829734602, -7898671321317813289, -22642, -75, 4.101330, 40052.692465, 1, 'binary.KqgvcwBhRIxCNTZaTnLf', 'nchar.福建省金凤市海陵武汉街u座 555612', 1630000000097)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000000, 521824259, -8660783264753873829, -29076, -1, 43333588339.556999, -11986.154286, 0, 'binary.GKzBHXETTitGAjMDqHEz', 'nchar.广东省合山县萧山宜都路u座 831011', 1630000000096)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 113309185, -5404115880106386219, 26329, -5, 3883055.927579, -91.272110, 0, 'binary.DJuxhSLmckBxGAZrTrdg', 'nchar.黑龙江省丽丽县海陵张路x座 667710', 1630000000097)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 1249035464, -1549873989524700903, -1552, 12, 30063970786.732201, 11.623060, 0, 'binary.wGOvxPtoGpoLQkqKqHYd', 'nchar.山东省建国县沙湾南昌路c座 673842', 1630000000097)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631454999999, 420485592, 1118062875777571668, 19952, 48, -13933.583298, -2462443202766.899902, 1, 'binary.PUybFnyERTpaOdCfdUeZ', 'nchar.内蒙古自治区海燕县新城郑州街o座 509072', 1630000000097)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 30946503, 7185137291847458233, 19072, 30, -152414.945183, -623547849.652030, 1, 'binary.bPgvDlyyWMQtWdUCTHsf', 'nchar.西藏自治区东莞县上街谢路z座 842631', 1630000000097)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000001, -136337675, -6941068854543647771, -30263, -36, 49955993237.460999, 2059.397798, 1, 'binary.AvuVCfvKjWXieILiINcT', 'nchar.台湾省建国县南长刘街Y座 514218', 1630000000098)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000001, -1639262737, -5524893491321561875, -14837, -81, 464457921385.609985, -381392530568.276978, 1, 'binary.aDgJHFZdhjaRiLJgewyJ', 'nchar.贵州省建县锡山谢路U座 298544', 1630000000098)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 74809487, -2714524097635173095, 20984, 33, 1802605.962684, 77.296856, 0, 'binary.vYEpwfCOmksSKWbrqYDR', 'nchar.香港特别行政区哈尔滨县山亭董街I座 748187', 1630000000097)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631470000000, 222279926, -7912824848487896120, 9941, -30, -29340217214.750000, -19574.321414, 0, 'binary.VsnXIRHAihqVgXYwhHKL', 'nchar.江苏省拉萨县闵行合山街c座 761422', 1630000000098)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000000, -557137010, 2878767942030754357, -31366, -47, -4333332356.734030, -1526389473.865540, 0, 'binary.jcMUSJuZgsPjePUNiAdT', 'nchar.海南省东县锡山澳门街q座 268693', 1630000000098)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631469999999, 447814637, 2176882939455175378, 20639, 104, -1356647372.422460, 6.253297, 1, 'binary.fyooIrohcePtHVwJGMuD', 'nchar.河北省关岭市金平香港路p座 886482', 1630000000098)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000000, 606893531, 4789787682189143102, 14991, 38, 32272292804541.800781, -943.731667, 1, 'binary.VuPeMxNmIrwVmeDRCPTm', 'nchar.黑龙江省兰州市东城陈街O座 771980', 1630000000098)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000001, -994364364, -2126966193042917392, -11261, -99, 7.179842, 9558.331194, 1, 'binary.qpXjZYHYtFFCkEkBnwAb', 'nchar.北京市建国市永川崔路g座 413491', 1630000000099)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000001, -1952105143, -3184538982013952257, -9023, -66, 2300257.628379, -83.900999, 1, 'binary.ufpdchwhzdeEoRvElolr', 'nchar.黑龙江省通辽市高明胡街B座 971162', 1630000000099)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000000, 1789157808, -942637929512454815, -20552, 22, -2222313287.171970, 295235211456.737000, 0, 'binary.VznwmsilndimcCoBZmyp', 'nchar.澳门特别行政区东莞县静安杭州路m座 966043', 1630000000098)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631485000000, -1420187501, 5901473154726700075, -22562, 122, -8503751910.519820, 2716.822481, 0, 'binary.SlMenUlCCEwyXsFKefLW', 'nchar.海南省马鞍山市兴山余路y座 674434', 1630000000099)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000000, 325131812, -7109049890424943791, 905, -37, 431982153775.299011, -415064.781722, 0, 'binary.NdxijvQdCvCbloWQQDtL', 'nchar.台湾省济南市大东郭街V座 658918', 1630000000099)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631484999999, 1572668480, 108340538386194628, 29463, 54, -3679552.122859, -769.652903, 1, 'binary.qWPhdNHKBtjYxVZgdXOh', 'nchar.新疆维吾尔自治区华市翔安赵路R座 753468', 1630000000099)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000000, 1226876580, 7653003049181344524, 5255, 97, 2751345.497375, 35183472041.125603, 1, 'binary.qAhAfHMuKshsMmbgIOYK', 'nchar.上海市邯郸县兴山张街x座 375209', 1630000000099)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000001, -375162227, -4279732710928397934, -19628, -20, 38774493096.818199, 7390201646933.400391, 1, 'binary.yMDiebwbXIHZiaQKPRut', 'nchar.北京市海燕县南长合山街t座 129283', 1630000000100)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000001, -1188106611, -4426272680272146753, -13643, -51, 40149362212590.203125, 438738.291810, 1, 'binary.CbdGAjuBbirCzXoUVXUG', 'nchar.辽宁省宜都市新城吴街d座 246995', 1630000000100)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000000, 698542868, 244085745806715589, -10836, -29, 23705559.480467, 89055463790.105301, 0, 'binary.TCkhaOCjQbElXSecegWh', 'nchar.新疆维吾尔自治区晶县秀英程街a座 168535', 1630000000099)") + + tdLog.debug("insert data ............ [OK]") + return + + def run(self): + tdSql.prepare() + self.create_tables() + self.insert_data() + tdSql.execute(f"flush database nested") + + wstart_res = ['2021-08-01 00:00:00.000', '2021-09-01 00:00:00.000'] + wend_res = ['2021-09-01 00:00:00.000', '2021-10-01 00:00:00.000'] + twa_res = [280745245.341775954, -162181281.012160718] + irate_res = [112899.676866667, 46569.524533333] + + + ## check twa + tdSql.query(f"select _wstart,_wend,twa(q_int) from stable_2_1 interval(1n);") + tdSql.checkCols(3) + tdSql.checkRows(2) + + for i in range (2): + tdSql.checkData(i, 0, wstart_res[i]); + tdSql.checkData(i, 1, wend_res[i]); + tdSql.checkData(i, 2, twa_res[i]); + + tdSql.query(f"select _wstart,_wend,twa(q_int) from (select * from stable_2_1) interval(1n);") + tdSql.checkCols(3) + tdSql.checkRows(2) + + for i in range (2): + tdSql.checkData(i, 0, wstart_res[i]); + tdSql.checkData(i, 1, wend_res[i]); + tdSql.checkData(i, 2, twa_res[i]); + + tdSql.query(f"select _wstart,_wend,twa(q_int) from (select * from stable_2_1 order by ts) interval(1n);") + tdSql.checkCols(3) + tdSql.checkRows(2) + + for i in range (2): + tdSql.checkData(i, 0, wstart_res[i]); + tdSql.checkData(i, 1, wend_res[i]); + tdSql.checkData(i, 2, twa_res[i]); + + ## check irate + tdSql.query(f"select _wstart,_wend,irate(q_int) from stable_2_1 interval(1n);") + tdSql.checkCols(3) + tdSql.checkRows(2) + + for i in range (2): + tdSql.checkData(i, 0, wstart_res[i]); + tdSql.checkData(i, 1, wend_res[i]); + tdSql.checkData(i, 2, irate_res[i]); + + tdSql.query(f"select _wstart,_wend,irate(q_int) from (select * from stable_2_1) interval(1n);") + tdSql.checkCols(3) + tdSql.checkRows(2) + + for i in range (2): + tdSql.checkData(i, 0, wstart_res[i]); + tdSql.checkData(i, 1, wend_res[i]); + tdSql.checkData(i, 2, irate_res[i]); + + tdSql.query(f"select _wstart,_wend,irate(q_int) from (select * from stable_2_1 order by ts) interval(1n);") + tdSql.checkCols(3) + tdSql.checkRows(2) + + for i in range (2): + tdSql.checkData(i, 0, wstart_res[i]); + tdSql.checkData(i, 1, wend_res[i]); + tdSql.checkData(i, 2, irate_res[i]); + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/6-cluster/5dnode1mnode.py b/tests/system-test/6-cluster/5dnode1mnode.py index d0157ec7c7..ce87bced1b 100644 --- a/tests/system-test/6-cluster/5dnode1mnode.py +++ b/tests/system-test/6-cluster/5dnode1mnode.py @@ -137,11 +137,34 @@ class TDTestCase: config_dir = dnode.cfgDir return taos.connect(host=host, port=int(port), config=config_dir) + def check_alive(self): + # check cluster alive + tdLog.printNoPrefix("======== test cluster alive: ") + tdSql.checkDataLoop(0, 0, 1, "show cluster alive;", 20, 0.5) + + tdSql.query("show db.alive;") + tdSql.checkData(0, 0, 1) + + # stop 5 dnode + self.TDDnodes.stoptaosd(5) + tdSql.checkDataLoop(0, 0, 2, "show cluster alive;", 20, 0.5) + + tdSql.query("show db.alive;") + tdSql.checkData(0, 0, 2) + + # stop 2 dnode + self.TDDnodes.stoptaosd(2) + tdSql.checkDataLoop(0, 0, 0, "show cluster alive;", 20, 0.5) + + tdSql.query("show db.alive;") + tdSql.checkData(0, 0, 0) + def run(self): # print(self.master_dnode.cfgDict) self.five_dnode_one_mnode() - + # check cluster and db alive + self.check_alive() def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/clusterCommonCheck.py b/tests/system-test/6-cluster/clusterCommonCheck.py index 2a50e1ee31..149c6d8ded 100644 --- a/tests/system-test/6-cluster/clusterCommonCheck.py +++ b/tests/system-test/6-cluster/clusterCommonCheck.py @@ -174,34 +174,34 @@ class ClusterComCheck: tdLog.exit("mnode number is correct") if offlineDnodeNo == 1: if tdSql.queryResult[0][2]=='offline' : - if tdSql.queryResult[1][2]=='leader' and tdSql.queryResult[1][3]== 'ready' : - if tdSql.queryResult[2][2]=='follower' and tdSql.queryResult[2][3]== 'ready' : + if tdSql.queryResult[1][2]=='leader': + if tdSql.queryResult[2][2]=='follower': tdLog.success("stop mnodes on dnode %d successfully in 10s" %offlineDnodeNo) return True - elif tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' : - if tdSql.queryResult[2][2]=='leader' and tdSql.queryResult[2][3]== 'ready' : + elif tdSql.queryResult[1][2]=='follower': + if tdSql.queryResult[2][2]=='leader': tdLog.debug("stop mnodes on dnode %d successfully in 10s" %offlineDnodeNo) return True count+=1 elif offlineDnodeNo == 2: if tdSql.queryResult[1][2]=='offline' : - if tdSql.queryResult[0][2]=='leader' and tdSql.queryResult[0][3]== 'ready' : - if tdSql.queryResult[2][2]=='follower' and tdSql.queryResult[2][3]== 'ready' : + if tdSql.queryResult[0][2]=='leader': + if tdSql.queryResult[2][2]=='follower': tdLog.debug("stop mnodes on dnode %d successfully in 10s" %offlineDnodeNo) return True - elif tdSql.queryResult[0][2]=='follower' and tdSql.queryResult[0][3]== 'ready' : - if tdSql.queryResult[2][2]=='leader' and tdSql.queryResult[2][3]== 'ready' : + elif tdSql.queryResult[0][2]=='follower': + if tdSql.queryResult[2][2]=='leader': tdLog.debug("stop mnodes on dnode %d successfully in 10s" %offlineDnodeNo) return True count+=1 elif offlineDnodeNo == 3: if tdSql.queryResult[2][2]=='offline' : - if tdSql.queryResult[0][2]=='leader' and tdSql.queryResult[0][3]== 'ready' : - if tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' : + if tdSql.queryResult[0][2]=='leader': + if tdSql.queryResult[1][2]=='follower': tdLog.debug("stop mnodes on dnode %d successfully in 10s" %offlineDnodeNo) return True - elif tdSql.queryResult[0][2]=='follower' and tdSql.queryResult[0][3]== 'ready' : - if tdSql.queryResult[1][2]=='leader' and tdSql.queryResult[1][3]== 'ready' : + elif tdSql.queryResult[0][2]=='follower': + if tdSql.queryResult[1][2]=='leader': tdLog.debug("stop mnodes on dnode %d successfully in 10s" %offlineDnodeNo) return True count+=1 @@ -219,8 +219,8 @@ class ClusterComCheck: else: tdLog.exit("mnode number is correct") if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[1][2]=='offline' and tdSql.queryResult[1][3]== 'ready' : - if tdSql.queryResult[2][2]=='offline' and tdSql.queryResult[2][3]== 'ready' : + if tdSql.queryResult[1][2]=='offline': + if tdSql.queryResult[2][2]=='offline': tdLog.success("stop mnodes of follower on dnode successfully in 10s") return True count+=1 diff --git a/tests/system-test/7-tmq/basic5.py b/tests/system-test/7-tmq/basic5.py index 7d42a3e81f..69cf378da3 100644 --- a/tests/system-test/7-tmq/basic5.py +++ b/tests/system-test/7-tmq/basic5.py @@ -251,28 +251,44 @@ class TDTestCase: # wait db ready while 1: tdSql.query("select * from information_schema.ins_databases") - if tdSql.getRows() == 4: - print ('==================================================') - print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0)) - index = 0 - if tdSql.getData(0,0) == parameterDict['dbName']: - index = 0 - elif tdSql.getData(1,0) == parameterDict['dbName']: - index = 1 - elif tdSql.getData(2,0) == parameterDict['dbName']: - index = 2 - elif tdSql.getData(3,0) == parameterDict['dbName']: - index = 3 - else: - continue - - if tdSql.getData(index,15) == 'ready': - print("******************** index: %d"%index) + nrows = tdSql.getRows() + index = -1 + for i in range(nrows): + if tdSql.getData(i, 0) == parameterDict['dbName']: + index = i break - + + if index == -1: continue - else: - time.sleep(1) + + if tdSql.getData(index,15) == 'ready': + print("******************** index: %d"%index) + break + + time.sleep(1) + + # if tdSql.getRows() == 4: + # print ('==================================================') + # print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0)) + # index = 0 + # if tdSql.getData(0,0) == parameterDict['dbName']: + # index = 0 + # elif tdSql.getData(1,0) == parameterDict['dbName']: + # index = 1 + # elif tdSql.getData(2,0) == parameterDict['dbName']: + # index = 2 + # elif tdSql.getData(3,0) == parameterDict['dbName']: + # index = 3 + # else: + # continue + + # if tdSql.getData(index,15) == 'ready': + # print("******************** index: %d"%index) + # break + + # continue + # else: + # time.sleep(1) tdSql.query("use %s"%parameterDict['dbName']) # wait stb ready @@ -395,30 +411,46 @@ class TDTestCase: # wait db ready while 1: tdSql.query("select * from information_schema.ins_databases") - if tdSql.getRows() == 5: - print ('==================================================dbname: %s'%parameterDict['dbName']) - print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),tdSql.getData(3,0),tdSql.getData(4,0)) - index = 0 - if tdSql.getData(0,0) == parameterDict['dbName']: - index = 0 - elif tdSql.getData(1,0) == parameterDict['dbName']: - index = 1 - elif tdSql.getData(2,0) == parameterDict['dbName']: - index = 2 - elif tdSql.getData(3,0) == parameterDict['dbName']: - index = 3 - elif tdSql.getData(4,0) == parameterDict['dbName']: - index = 4 - else: - continue - - if tdSql.getData(index,15) == 'ready': - print("******************** index: %d"%index) + nrows = tdSql.getRows() + index = -1 + for i in range(nrows): + if tdSql.getData(i, 0) == parameterDict['dbName']: + index = i break - + + if index == -1: continue - else: - time.sleep(1) + + if tdSql.getData(index,15) == 'ready': + print("******************** index: %d"%index) + break + + time.sleep(1) + + # if tdSql.getRows() == 5: + # print ('==================================================dbname: %s'%parameterDict['dbName']) + # print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),tdSql.getData(3,0),tdSql.getData(4,0)) + # index = 0 + # if tdSql.getData(0,0) == parameterDict['dbName']: + # index = 0 + # elif tdSql.getData(1,0) == parameterDict['dbName']: + # index = 1 + # elif tdSql.getData(2,0) == parameterDict['dbName']: + # index = 2 + # elif tdSql.getData(3,0) == parameterDict['dbName']: + # index = 3 + # elif tdSql.getData(4,0) == parameterDict['dbName']: + # index = 4 + # else: + # continue + + # if tdSql.getData(index,15) == 'ready': + # print("******************** index: %d"%index) + # break + + # continue + # else: + # time.sleep(1) tdSql.query("use %s"%parameterDict['dbName']) # wait stb ready diff --git a/tests/system-test/7-tmq/subscribeDb.py b/tests/system-test/7-tmq/subscribeDb.py index fd06eedefd..0fa9bcfbd4 100644 --- a/tests/system-test/7-tmq/subscribeDb.py +++ b/tests/system-test/7-tmq/subscribeDb.py @@ -61,7 +61,7 @@ class TDTestCase: def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): sql = "insert into %s.consumeinfo values "%cdbName - sql += "(now, %d, '%s', '%s', %d, %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) + sql += "(now + %ds, %d, '%s', '%s', %d, %d, %d)"%(consumerId, consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) tdLog.info("consume info sql: %s"%sql) tdSql.query(sql) @@ -174,12 +174,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() @@ -271,12 +272,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() @@ -337,6 +339,7 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath @@ -406,12 +409,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() diff --git a/tests/system-test/7-tmq/subscribeDb0.py b/tests/system-test/7-tmq/subscribeDb0.py index d4c5e2f87f..50ef52cb15 100644 --- a/tests/system-test/7-tmq/subscribeDb0.py +++ b/tests/system-test/7-tmq/subscribeDb0.py @@ -174,12 +174,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() @@ -191,6 +192,7 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath @@ -254,12 +256,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 141d013270..4cda062401 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -60,7 +60,7 @@ class TMQCom: def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): sql = "insert into %s.consumeinfo values "%cdbName - sql += "(now, %d, '%s', '%s', %d, %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) + sql += "(now + %ds, %d, '%s', '%s', %d, %d, %d)"%(consumerId, consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) tdLog.info("consume info sql: %s"%sql) tdSql.query(sql) diff --git a/tests/system-test/compatibilityAllTest.sh b/tests/system-test/compatibilityAllTest.sh new file mode 100755 index 0000000000..8b599afd86 --- /dev/null +++ b/tests/system-test/compatibilityAllTest.sh @@ -0,0 +1,46 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-insert=============== + +python3 ./test.py -f 0-others/taosShell.py +python3 ./test.py -f 0-others/taosShellError.py +python3 ./test.py -f 0-others/taosShellNetChk.py +python3 ./test.py -f 1-insert/alter_database.py +python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py +python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py +python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py +python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py +python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py +python3 ./test.py -f 1-insert/alter_stable.py +python3 ./test.py -f 1-insert/alter_table.py +python3 ./test.py -f 1-insert/boundary.py +python3 ./test.py -f 2-query/top.py +python3 ./test.py -f 2-query/top.py -R +python3 ./test.py -f 2-query/tsbsQuery.py +python3 ./test.py -f 2-query/tsbsQuery.py -R +python3 ./test.py -f 2-query/ttl_comment.py +python3 ./test.py -f 2-query/ttl_comment.py -R +python3 ./test.py -f 2-query/twa.py +python3 ./test.py -f 2-query/twa.py -R +python3 ./test.py -f 2-query/union.py +python3 ./test.py -f 2-query/union.py -R +python3 ./test.py -f 6-cluster/5dnode1mnode.py +python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -i False +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 -i False +python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 -n 3 +python3 ./test.py -f 7-tmq/subscribeStb4.py +python3 ./test.py -f 7-tmq/db.py +python3 ./test.py -f 7-tmq/tmqError.py +python3 ./test.py -f 7-tmq/schema.py +python3 ./test.py -f 7-tmq/stbFilter.py +python3 ./test.py -f 7-tmq/tmqCheckData.py +python3 ./test.py -f 7-tmq/tmqCheckData1.py +python3 ./test.py -f 7-tmq/tmqConsumerGroup.py +python3 ./test.py -f 7-tmq/tmqShow.py +python3 ./test.py -f 7-tmq/tmqAlterSchema.py +python3 ./test.py -f 99-TDcase/TD-20582.py diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index b391d59725..45ff694e72 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -138,6 +138,7 @@ SWords shellCommands[] = { {"show create table \\G;", 0, 0, NULL}, {"show connections;", 0, 0, NULL}, {"show cluster;", 0, 0, NULL}, + {"show cluster alive;", 0, 0, NULL}, {"show databases;", 0, 0, NULL}, {"show dnodes;", 0, 0, NULL}, {"show dnode variables;", 0, 0, NULL}, @@ -425,6 +426,7 @@ void showHelp() { show create table ;\n\ show connections;\n\ show cluster;\n\ + show cluster alive;\n\ show databases;\n\ show dnodes;\n\ show dnode variables;\n\ diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index 172177e32a..69bf52bb1a 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -662,6 +662,7 @@ void initLogFile() { "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":7,\"colName\":\"c3\",\"colType\":8,\"colLength\":64}", "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":1,\"colName\":\"t2\",\"colType\":8,\"colLength\":64}", "{\"type\":\"alter\",\"tableType\":\"child\",\"tableName\":\"ct3\",\"alterType\":4,\"colName\":\"t1\",\"colValue\":\"5000\",\"colValueNull\":false}", + "{\"type\":\"delete\",\"sql\":\"delete from `ct3` where `ts` >= 1626006833600 and `ts` <= 1626006833605\"}", "{\"type\":\"create\",\"tableType\":\"normal\",\"tableName\":\"n1\",\"columns\":[{\"name\":\"ts\",\"type\":9},{\"name\":\"c1\",\"type\":4},{\"name\":\"c2\",\"type\":10,\"length\":4}],\"tags\":[]}", "{\"type\":\"alter\",\"tableType\":\"normal\",\"tableName\":\"n1\",\"alterType\":5,\"colName\":\"c3\",\"colType\":5}", "{\"type\":\"alter\",\"tableType\":\"normal\",\"tableName\":\"n1\",\"alterType\":7,\"colName\":\"c2\",\"colType\":10,\"colLength\":8}",