diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index adefacc6af..c273e9889f 100644
--- a/cmake/taostools_CMakeLists.txt.in
+++ b/cmake/taostools_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
- GIT_TAG 7d5c1c0
+ GIT_TAG 2dba49c
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in
index 15d3764876..04b1262caf 100644
--- a/cmake/taosws_CMakeLists.txt.in
+++ b/cmake/taosws_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosws-rs
ExternalProject_Add(taosws-rs
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
- GIT_TAG 0609b50
+ GIT_TAG e771403
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/04-concept/index.md b/docs/en/04-concept/index.md
index b0a0c25d85..0b1b226c17 100644
--- a/docs/en/04-concept/index.md
+++ b/docs/en/04-concept/index.md
@@ -6,101 +6,100 @@ In order to explain the basic concepts and provide some sample code, the TDengin
-
- Device ID
- Time Stamp
- Collected Metrics
- Tags
+
+
+ Device ID
+ Timestamp
+ Collected Metrics
+ Tags
-
-Device ID
-Time Stamp
-current
-voltage
-phase
-location
-groupId
-
-
-
-
-d1001
-1538548685000
-10.3
-219
-0.31
-California.SanFrancisco
-2
-
-
-d1002
-1538548684000
-10.2
-220
-0.23
-California.SanFrancisco
-3
-
-
-d1003
-1538548686500
-11.5
-221
-0.35
-California.LosAngeles
-3
-
-
-d1004
-1538548685500
-13.4
-223
-0.29
-California.LosAngeles
-2
-
-
-d1001
-1538548695000
-12.6
-218
-0.33
-California.SanFrancisco
-2
-
-
-d1004
-1538548696600
-11.8
-221
-0.28
-California.LosAngeles
-2
-
-
-d1002
-1538548696650
-10.3
-218
-0.25
-California.SanFrancisco
-3
-
-
-d1001
-1538548696800
-12.3
-221
-0.31
-California.SanFrancisco
-2
-
-
+
+ current
+ voltage
+ phase
+ location
+ groupid
+
+
+
+
+ d1001
+ 1538548685000
+ 10.3
+ 219
+ 0.31
+ California.SanFrancisco
+ 2
+
+
+ d1002
+ 1538548684000
+ 10.2
+ 220
+ 0.23
+ California.SanFrancisco
+ 3
+
+
+ d1003
+ 1538548686500
+ 11.5
+ 221
+ 0.35
+ California.LosAngeles
+ 3
+
+
+ d1004
+ 1538548685500
+ 13.4
+ 223
+ 0.29
+ California.LosAngeles
+ 2
+
+
+ d1001
+ 1538548695000
+ 12.6
+ 218
+ 0.33
+ California.SanFrancisco
+ 2
+
+
+ d1004
+ 1538548696600
+ 11.8
+ 221
+ 0.28
+ California.LosAngeles
+ 2
+
+
+ d1002
+ 1538548696650
+ 10.3
+ 218
+ 0.25
+ California.SanFrancisco
+ 3
+
+
+ d1001
+ 1538548696800
+ 12.3
+ 221
+ 0.31
+ California.SanFrancisco
+ 2
+
+
Table 1: Smart meter example data
-Each row contains the device ID, time stamp, collected metrics (current, voltage, phase as above), and static tags (location and groupId in Table 1) associated with the devices. Each smart meter generates a row (measurement) in a pre-defined time interval or triggered by an external event. The device produces a sequence of measurements with associated time stamps.
+Each row contains the device ID, timestamp, collected metrics (`current`, `voltage`, `phase` as above), and static tags (`location` and `groupid` in Table 1) associated with the devices. Each smart meter generates a row (measurement) in a pre-defined time interval or triggered by an external event. The device produces a sequence of measurements with associated timestamps.
## Metric
@@ -112,22 +111,22 @@ Label/Tag refers to the static properties of sensors, equipment or other types o
## Data Collection Point
-Data Collection Point (DCP) refers to hardware or software that collects metrics based on preset time periods or triggered by events. A data collection point can collect one or multiple metrics, but these metrics are collected at the same time and have the same time stamp. For some complex equipment, there are often multiple data collection points, and the sampling rate of each collection point may be different, and fully independent. For example, for a car, there could be a data collection point to collect GPS position metrics, a data collection point to collect engine status metrics, and a data collection point to collect the environment metrics inside the car. So in this example the car would have three data collection points. In the smart meters example, d1001, d1002, d1003, and d1004 are the data collection points.
+Data Collection Point (DCP) refers to hardware or software that collects metrics based on preset time periods or triggered by events. A data collection point can collect one or multiple metrics, but these metrics are collected at the same time and have the same timestamp. For some complex equipment, there are often multiple data collection points, and the sampling rate of each collection point may be different, and fully independent. For example, for a car, there could be a data collection point to collect GPS position metrics, a data collection point to collect engine status metrics, and a data collection point to collect the environment metrics inside the car. So in this example the car would have three data collection points. In the smart meters example, d1001, d1002, d1003, and d1004 are the data collection points.
## Table
Since time-series data is most likely to be structured data, TDengine adopts the traditional relational database model to process them with a short learning curve. You need to create a database, create tables, then insert data points and execute queries to explore the data.
-To make full use of time-series data characteristics, TDengine adopts a strategy of "**One Table for One Data Collection Point**". TDengine requires the user to create a table for each data collection point (DCP) to store collected time-series data. For example, if there are over 10 million smart meters, it means 10 million tables should be created. For the table above, 4 tables should be created for devices D1001, D1002, D1003, and D1004 to store the data collected. This design has several benefits:
+To make full use of time-series data characteristics, TDengine adopts a strategy of "**One Table for One Data Collection Point**". TDengine requires the user to create a table for each data collection point (DCP) to store collected time-series data. For example, if there are over 10 million smart meters, it means 10 million tables should be created. For the table above, 4 tables should be created for devices d1001, d1002, d1003, and d1004 to store the data collected. This design has several benefits:
1. Since the metric data from different DCP are fully independent, the data source of each DCP is unique, and a table has only one writer. In this way, data points can be written in a lock-free manner, and the writing speed can be greatly improved.
2. For a DCP, the metric data generated by DCP is ordered by timestamp, so the write operation can be implemented by simple appending, which further greatly improves the data writing speed.
3. The metric data from a DCP is continuously stored, block by block. If you read data for a period of time, it can greatly reduce random read operations and improve read and query performance by orders of magnitude.
4. Inside a data block for a DCP, columnar storage is used, and different compression algorithms are used for different data types. Metrics generally don't vary as significantly between themselves over a time range as compared to other metrics, which allows for a higher compression rate.
-If the metric data of multiple DCPs are traditionally written into a single table, due to uncontrollable network delays, the timing of the data from different DCPs arriving at the server cannot be guaranteed, write operations must be protected by locks, and metric data from one DCP cannot be guaranteed to be continuously stored together. ** One table for one data collection point can ensure the best performance of insert and query of a single data collection point to the greatest possible extent.**
+If the metric data of multiple DCPs are traditionally written into a single table, due to uncontrollable network delays, the timing of the data from different DCPs arriving at the server cannot be guaranteed, write operations must be protected by locks, and metric data from one DCP cannot be guaranteed to be continuously stored together. **One table for one data collection point can ensure the best performance of insert and query of a single data collection point to the greatest possible extent.**
-TDengine suggests using DCP ID as the table name (like D1001 in the above table). Each DCP may collect one or multiple metrics (like the current, voltage, phase as above). Each metric has a corresponding column in the table. The data type for a column can be int, float, string and others. In addition, the first column in the table must be a timestamp. TDengine uses the time stamp as the index, and won’t build the index on any metrics stored. Column wise storage is used.
+TDengine suggests using DCP ID as the table name (like d1001 in the above table). Each DCP may collect one or multiple metrics (like the `current`, `voltage`, `phase` as above). Each metric has a corresponding column in the table. The data type for a column can be int, float, string and others. In addition, the first column in the table must be a timestamp. TDengine uses the timestamp as the index, and won’t build the index on any metrics stored. Column wise storage is used.
Complex devices, such as connected cars, may have multiple DCPs. In this case, multiple tables are created for a single device, one table per DCP.
@@ -156,9 +155,16 @@ The relationship between a STable and the subtables created based on this STable
Queries can be executed on both a table (subtable) and a STable. For a query on a STable, TDengine will treat the data in all its subtables as a whole data set for processing. TDengine will first find the subtables that meet the tag filter conditions, then scan the time-series data of these subtables to perform aggregation operation, which reduces the number of data sets to be scanned which in turn greatly improves the performance of data aggregation across multiple DCPs. In essence, querying a supertable is a very efficient aggregate query on multiple DCPs of the same type.
-In TDengine, it is recommended to use a subtable instead of a regular table for a DCP. In the smart meters example, we can create subtables like d1001, d1002, d1003, and d1004 under super table meters.
+In TDengine, it is recommended to use a subtable instead of a regular table for a DCP. In the smart meters example, we can create subtables like d1001, d1002, d1003, and d1004 under super table `meters`.
-To better understand the data model using metri, tags, super table and subtable, please refer to the diagram below which demonstrates the data model of the smart meters example. 
+To better understand the data model using metrics, tags, super table and subtable, please refer to the diagram below which demonstrates the data model of the smart meters example.
+
+
+
+
+
+Figure 1. Meters Data Model Diagram
+
## Database
@@ -172,4 +178,4 @@ FQDN (Fully Qualified Domain Name) is the full domain name of a specific compute
Each node of a TDengine cluster is uniquely identified by an End Point, which consists of an FQDN and a Port, such as h1.tdengine.com:6030. In this way, when the IP changes, we can still use the FQDN to dynamically find the node without changing any configuration of the cluster. In addition, FQDN is used to facilitate unified access to the same cluster from the Intranet and the Internet.
-TDengine does not recommend using an IP address to access the cluster. FQDN is recommended for cluster management.
+TDengine does not recommend using an IP address to access the cluster. FQDN is recommended for cluster management.
diff --git a/docs/en/05-get-started/01-docker.md b/docs/en/05-get-started/01-docker.md
index de5b620a77..66f7d5d594 100644
--- a/docs/en/05-get-started/01-docker.md
+++ b/docs/en/05-get-started/01-docker.md
@@ -13,7 +13,7 @@ If Docker is already installed on your computer, run the following command:
docker run -d -p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043-6049/udp tdengine/tdengine
```
-Note that TDengine Server uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connectors. You can open these ports as needed.
+Note that TDengine Server 3.0 uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connectors. You can open these ports as needed.
Run the following command to ensure that your container is running:
@@ -21,7 +21,7 @@ Run the following command to ensure that your container is running:
docker ps
```
-Enter the container and open the bash shell:
+Enter the container and open the `bash` shell:
```shell
docker exec -it bash
@@ -31,68 +31,68 @@ You can now access TDengine or run other Linux commands.
Note: For information about installing docker, see the [official documentation](https://docs.docker.com/get-docker/).
-## Insert Data into TDengine
-
-You can use the `taosBenchmark` tool included with TDengine to write test data into your deployment.
-
-To do so, run the following command:
-
- ```bash
- $ taosBenchmark
-
- ```
-
-This command creates the `meters` supertable in the `test` database. In the `meters` supertable, it then creates 10,000 subtables named `d0` to `d9999`. Each table has 10,000 rows and each row has four columns: `ts`, `current`, `voltage`, and `phase`. The timestamps of the data in these columns range from 2017-07-14 10:40:00 000 to 2017-07-14 10:40:09 999. Each table is randomly assigned a `groupId` tag from 1 to 10 and a `location` tag of either `Campbell`, `Cupertino`, `Los Angeles`, `Mountain View`, `Palo Alto`, `San Diego`, `San Francisco`, `San Jose`, `Santa Clara` or `Sunnyvale`.
-
- The `taosBenchmark` command creates a deployment with 100 million data points that you can use for testing purposes. The time required depends on the hardware specifications of the local system.
-
- You can customize the test deployment that taosBenchmark creates by specifying command-line parameters. For information about command-line parameters, run the `taosBenchmark --help` command. For more information about taosBenchmark, see [taosBenchmark](/reference/taosbenchmark).
-
## Open the TDengine CLI
-On the container, run the following command to open the TDengine CLI:
+On the container, run the following command to open the TDengine CLI:
```
$ taos
-taos>
+taos>
```
-## Query Data in TDengine
+## Test data insert performance
-After using taosBenchmark to create your test deployment, you can run queries in the TDengine CLI to test its performance. For example:
+After your TDengine Server is running normally, you can run the taosBenchmark utility to test its performance:
-From the TDengine CLI query the number of rows in the `meters` supertable:
+Start TDengine service and execute `taosBenchmark` (formerly named `taosdemo`) in a Linux or Windows terminal.
+
+```bash
+taosBenchmark
+```
+
+This command creates the `meters` supertable in the `test` database. In the `meters` supertable, it then creates 10,000 subtables named `d0` to `d9999`. Each table has 10,000 rows and each row has four columns: `ts`, `current`, `voltage`, and `phase`. The timestamps of the data in these columns range from 2017-07-14 10:40:00 000 to 2017-07-14 10:40:09 999. Each table is randomly assigned a `groupId` tag from 1 to 10 and a `location` tag of either `Campbell`, `Cupertino`, `Los Angeles`, `Mountain View`, `Palo Alto`, `San Diego`, `San Francisco`, `San Jose`, `Santa Clara` or `Sunnyvale`.
+
+The `taosBenchmark` command creates a deployment with 100 million data points that you can use for testing purposes. The time required to create the deployment depends on your hardware. On most modern servers, the deployment is created in ten to twenty seconds.
+
+You can customize the test deployment that taosBenchmark creates by specifying command-line parameters. For information about command-line parameters, run the `taosBenchmark --help` command. For more information about taosBenchmark, see [taosBenchmark](../../reference/taosbenchmark).
+
+## Test data query performance
+
+After using `taosBenchmark` to create your test deployment, you can run queries in the TDengine CLI to test its performance:
+
+From the TDengine CLI (taos) query the number of rows in the `meters` supertable:
```sql
-select count(*) from test.meters;
+SELECT COUNT(*) FROM test.meters;
```
Query the average, maximum, and minimum values of all 100 million rows of data:
```sql
-select avg(current), max(voltage), min(phase) from test.meters;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
```
Query the number of rows whose `location` tag is `San Francisco`:
```sql
-select count(*) from test.meters where location="San Francisco";
+SELECT COUNT(*) FROM test.meters WHERE location = "San Francisco";
```
Query the average, maximum, and minimum values of all rows whose `groupId` tag is `10`:
```sql
-select avg(current), max(voltage), min(phase) from test.meters where groupId=10;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
```
-Query the average, maximum, and minimum values for table `d10` in 1 second intervals:
+Query the average, maximum, and minimum values for table `d10` in 10 second intervals:
```sql
-select first(ts), avg(current), max(voltage), min(phase) from test.d10 interval(1s);
+SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
```
-In the query above you are selecting the first timestamp (ts) in the interval, another way of selecting this would be _wstart which will give the start of the time window. For more information about windowed queries, see [Time-Series Extensions](../../taos-sql/distinguished/).
+
+In the query above you are selecting the first timestamp (ts) in the interval, another way of selecting this would be `\_wstart` which will give the start of the time window. For more information about windowed queries, see [Time-Series Extensions](../../taos-sql/distinguished/).
## Additional Information
diff --git a/docs/en/05-get-started/03-package.md b/docs/en/05-get-started/03-package.md
index 88096a759c..7257fccc80 100644
--- a/docs/en/05-get-started/03-package.md
+++ b/docs/en/05-get-started/03-package.md
@@ -9,23 +9,24 @@ import PkgListV3 from "/components/PkgListV3";
For information about installing TDengine on Docker, see [Quick Install on Docker](../../get-started/docker). If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine).
-The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).
+The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).
-The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ connector.
+The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download the Lite package that includes only `taosd` and the C/C++ connector.
-The TDengine Community Edition is released as .deb and .rpm packages. The .deb package can be installed on Debian, Ubuntu, and derivative systems. The .rpm package can be installed on CentOS, RHEL, SUSE, and derivative systems. A .tar.gz package is also provided for enterprise customers, and you can install TDengine over `apt-get` as well. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the .deb or .rpm package, download and install taosTools separately. TDengine can also be installed on 64-bit Windows servers.
+The TDengine Community Edition is released as Deb and RPM packages. The Deb package can be installed on Debian, Ubuntu, and derivative systems. The RPM package can be installed on CentOS, RHEL, SUSE, and derivative systems. A .tar.gz package is also provided for enterprise customers, and you can install TDengine over `apt-get` as well. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the Deb or RPM package, download and install taosTools separately. TDengine can also be installed on 64-bit Windows.
## Installation
-1. Download the .deb installation package.
-
+1. Download the Deb installation package.
+
2. In the directory where the package is located, use `dpkg` to install the package:
+> Please replace `` with the corresponding version of the package downloaded
+
```bash
-# Enter the name of the package that you downloaded.
sudo dpkg -i TDengine-server--Linux-x64.deb
```
@@ -34,11 +35,12 @@ sudo dpkg -i TDengine-server--Linux-x64.deb
1. Download the .rpm installation package.
-
+
2. In the directory where the package is located, use rpm to install the package:
+> Please replace `` with the corresponding version of the package downloaded
+
```bash
-# Enter the name of the package that you downloaded.
sudo rpm -ivh TDengine-server--Linux-x64.rpm
```
@@ -47,11 +49,12 @@ sudo rpm -ivh TDengine-server--Linux-x64.rpm
1. Download the .tar.gz installation package.
-
+
2. In the directory where the package is located, use `tar` to decompress the package:
+> Please replace `` with the corresponding version of the package downloaded
+
```bash
-# Enter the name of the package that you downloaded.
tar -zxvf TDengine-server--Linux-x64.tar.gz
```
@@ -96,23 +99,23 @@ sudo apt-get install tdengine
This installation method is supported only for Debian and Ubuntu.
::::
-
+
-Note: TDengine only supports Windows Server 2016/2019 and windows 10/11 system versions on the windows platform.
+Note: TDengine only supports Windows Server 2016/2019 and Windows 10/11 on the Windows platform.
1. Download the Windows installation package.
-
+
2. Run the downloaded package to install TDengine.
:::info
-For information about TDengine releases, see [Release History](../../releases).
+For information about TDengine releases, see [Release History](../../releases).
:::
:::note
-On the first node in your TDengine cluster, leave the `Enter FQDN:` prompt blank and press **Enter**. On subsequent nodes, you can enter the end point of the first dnode in the cluster. You can also configure this setting after you have finished installing TDengine.
+On the first node in your TDengine cluster, leave the `Enter FQDN:` prompt blank and press **Enter**. On subsequent nodes, you can enter the endpoint of the first dnode in the cluster. You can also configure this setting after you have finished installing TDengine.
:::
@@ -147,7 +150,7 @@ Active: inactive (dead)
After confirming that TDengine is running, run the `taos` command to access the TDengine CLI.
-The following `systemctl` commands can help you manage TDengine:
+The following `systemctl` commands can help you manage TDengine service:
- Start TDengine Server: `systemctl start taosd`
@@ -159,7 +162,7 @@ The following `systemctl` commands can help you manage TDengine:
:::info
-- The `systemctl` command requires _root_ privileges. If you are not logged in as the `root` user, use the `sudo` command.
+- The `systemctl` command requires _root_ privileges. If you are not logged in as the _root_ user, use the `sudo` command.
- The `systemctl stop taosd` command does not instantly stop TDengine Server. The server is stopped only after all data in memory is flushed to disk. The time required depends on the cache size.
- If your system does not include `systemd`, you can run `/usr/local/taos/bin/taosd` to start TDengine manually.
@@ -174,23 +177,9 @@ After the installation is complete, run `C:\TDengine\taosd.exe` to start TDengin
-## Test data insert performance
+## Command Line Interface (CLI)
-After your TDengine Server is running normally, you can run the taosBenchmark utility to test its performance:
-
-```bash
-taosBenchmark
-```
-
-This command creates the `meters` supertable in the `test` database. In the `meters` supertable, it then creates 10,000 subtables named `d0` to `d9999`. Each table has 10,000 rows and each row has four columns: `ts`, `current`, `voltage`, and `phase`. The timestamps of the data in these columns range from 2017-07-14 10:40:00 000 to 2017-07-14 10:40:09 999. Each table is randomly assigned a `groupId` tag from 1 to 10 and a `location` tag of either `Campbell`, `Cupertino`, `Los Angeles`, `Mountain View`, `Palo Alto`, `San Diego`, `San Francisco`, `San Jose`, `Santa Clara` or `Sunnyvale`.
-
-The `taosBenchmark` command creates a deployment with 100 million data points that you can use for testing purposes. The time required to create the deployment depends on your hardware. On most modern servers, the deployment is created in less than a minute.
-
-You can customize the test deployment that taosBenchmark creates by specifying command-line parameters. For information about command-line parameters, run the `taosBenchmark --help` command. For more information about taosBenchmark, see [taosBenchmark](../../reference/taosbenchmark).
-
-## Command Line Interface
-
-You can use the TDengine CLI to monitor your TDengine deployment and execute ad hoc queries. To open the CLI, run the following command:
+You can use the TDengine CLI to monitor your TDengine deployment and execute ad hoc queries. To open the CLI, you can execute `taos` in the Linux terminal where TDengine is installed, or you can run `taos.exe` in the `C:\TDengine` directory of the Windows terminal where TDengine is installed to start the TDengine command line.
```bash
taos
@@ -205,52 +194,71 @@ taos>
For example, you can create and delete databases and tables and run all types of queries. Each SQL command must be end with a semicolon (;). For example:
```sql
-create database demo;
-use demo;
-create table t (ts timestamp, speed int);
-insert into t values ('2019-07-15 00:00:00', 10);
-insert into t values ('2019-07-15 01:00:00', 20);
-select * from t;
+CREATE DATABASE demo;
+USE demo;
+CREATE TABLE t (ts TIMESTAMP, speed INT);
+INSERT INTO t VALUES ('2019-07-15 00:00:00', 10);
+INSERT INTO t VALUES ('2019-07-15 01:00:00', 20);
+SELECT * FROM t;
+
ts | speed |
========================================
2019-07-15 00:00:00.000 | 10 |
2019-07-15 01:00:00.000 | 20 |
+
Query OK, 2 row(s) in set (0.003128s)
```
You can also can monitor the deployment status, add and remove user accounts, and manage running instances. You can run the TDengine CLI on either Linux or Windows machines. For more information, see [TDengine CLI](../../reference/taos-shell/).
-
+
+## Test data insert performance
+
+After your TDengine Server is running normally, you can run the taosBenchmark utility to test its performance:
+
+Start TDengine service and execute `taosBenchmark` (formerly named `taosdemo`) in a Linux or Windows terminal.
+
+```bash
+taosBenchmark
+```
+
+This command creates the `meters` supertable in the `test` database. In the `meters` supertable, it then creates 10,000 subtables named `d0` to `d9999`. Each table has 10,000 rows and each row has four columns: `ts`, `current`, `voltage`, and `phase`. The timestamps of the data in these columns range from 2017-07-14 10:40:00 000 to 2017-07-14 10:40:09 999. Each table is randomly assigned a `groupId` tag from 1 to 10 and a `location` tag of either `Campbell`, `Cupertino`, `Los Angeles`, `Mountain View`, `Palo Alto`, `San Diego`, `San Francisco`, `San Jose`, `Santa Clara` or `Sunnyvale`.
+
+The `taosBenchmark` command creates a deployment with 100 million data points that you can use for testing purposes. The time required to create the deployment depends on your hardware. On most modern servers, the deployment is created in ten to twenty seconds.
+
+You can customize the test deployment that taosBenchmark creates by specifying command-line parameters. For information about command-line parameters, run the `taosBenchmark --help` command. For more information about taosBenchmark, see [taosBenchmark](../../reference/taosbenchmark).
+
## Test data query performance
-After using taosBenchmark to create your test deployment, you can run queries in the TDengine CLI to test its performance:
+After using `taosBenchmark` to create your test deployment, you can run queries in the TDengine CLI to test its performance:
-From the TDengine CLI query the number of rows in the `meters` supertable:
+From the TDengine CLI (taos) query the number of rows in the `meters` supertable:
```sql
-select count(*) from test.meters;
+SELECT COUNT(*) FROM test.meters;
```
Query the average, maximum, and minimum values of all 100 million rows of data:
```sql
-select avg(current), max(voltage), min(phase) from test.meters;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
```
Query the number of rows whose `location` tag is `San Francisco`:
```sql
-select count(*) from test.meters where location="San Francisco";
+SELECT COUNT(*) FROM test.meters WHERE location = "San Francisco";
```
Query the average, maximum, and minimum values of all rows whose `groupId` tag is `10`:
```sql
-select avg(current), max(voltage), min(phase) from test.meters where groupId=10;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
```
-Query the average, maximum, and minimum values for table `d10` in 1 second intervals:
+Query the average, maximum, and minimum values for table `d10` in 10 second intervals:
```sql
-select first(ts), avg(current), max(voltage), min(phase) from test.d10 interval(1s);
+SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
```
-In the query above you are selecting the first timestamp (ts) in the interval, another way of selecting this would be _wstart which will give the start of the time window. For more information about windowed queries, see [Time-Series Extensions](../../taos-sql/distinguished/).
+
+In the query above you are selecting the first timestamp (ts) in the interval, another way of selecting this would be `\_wstart` which will give the start of the time window. For more information about windowed queries, see [Time-Series Extensions](../../taos-sql/distinguished/).
diff --git a/docs/en/12-taos-sql/20-keywords.md b/docs/en/12-taos-sql/20-keywords.md
index 6f166c8034..d7b9c73c4f 100644
--- a/docs/en/12-taos-sql/20-keywords.md
+++ b/docs/en/12-taos-sql/20-keywords.md
@@ -238,6 +238,7 @@ There are about 200 keywords reserved by TDengine, they can't be used as the nam
- TOPICS
- TRIGGER
- TSERIES
+- TTL
### U
@@ -253,6 +254,7 @@ There are about 200 keywords reserved by TDengine, they can't be used as the nam
### V
+- VALUE
- VALUES
- VARIABLE
- VARIABLES
diff --git a/docs/en/14-reference/03-connector/index.mdx b/docs/en/14-reference/03-connector/index.mdx
index 49e2dceec5..5dc54f0934 100644
--- a/docs/en/14-reference/03-connector/index.mdx
+++ b/docs/en/14-reference/03-connector/index.mdx
@@ -39,14 +39,14 @@ Comparing the connector support for TDengine functional features as follows.
### Using the native interface (taosc)
-| **Functional Features** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** |
-| -------------- | -------- | ---------- | ------ | ------ | ----------- | -------- |
-| **Connection Management** | Support | Support | Support | Support | Support | Support |
-| **Regular Query** | Support | Support | Support | Support | Support | Support |
-| **Parameter Binding** | Support | Support | Support | Support | Support | Support |
-| ** TMQ ** | Support | Support | Support | Support | Support | Support |
-| **Schemaless** | Support | Support | Support | Support | Support | Support |
-| **DataFrame** | Not Supported | Support | Not Supported | Not Supported | Not Supported | Not Supported |
+| **Functional Features** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** |
+| ----------------------------- | ------------- | ---------- | ------------- | ------------- | ------------- | ------------- |
+| **Connection Management** | Support | Support | Support | Support | Support | Support |
+| **Regular Query** | Support | Support | Support | Support | Support | Support |
+| **Parameter Binding** | Support | Support | Support | Support | Support | Support |
+| **Subscription (TMQ)** | Support | Support | Support | Support | Support | Support |
+| **Schemaless** | Support | Support | Support | Support | Support | Support |
+| **DataFrame** | Not Supported | Support | Not Supported | Not Supported | Not Supported | Not Supported |
:::info
The different database framework specifications for various programming languages do not mean that all C/C++ interfaces need a wrapper.
@@ -54,16 +54,15 @@ The different database framework specifications for various programming language
### Use HTTP Interfaces (REST or WebSocket)
-| **Functional Features** | **Java** | **Python** | **Go** | **C# (not supported yet)** | **Node.js** | **Rust** |
-| ------------------------------ | -------- | ---------- | -------- | ------------------ | ----------- | -------- |
-| **Connection Management** | Support | Support | Support | N/A | Support | Support |
-| **Regular Query** | Support | Support | Support | N/A | Support | Support |
-| **Continous Query ** | Support | Support | Support | N/A | Support | Support |
-| **Parameter Binding** | Not supported | Not supported | Not supported | N/A | Not supported | Support |
-| ** TMQ ** | Not supported | Not supported | Not supported | N/A | Not supported | Support |
-| **Schemaless** | Not supported | Not supported | Not supported | N/A | Not supported | Not supported |
-| **Bulk Pulling (based on WebSocket) **| Support | Support | Not Supported | N/A | Not Supported | Supported |
-| **DataFrame** | Not supported | Support | Not supported | N/A | Not supported | Not supported |
+| **Functional Features** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** |
+| -------------------------------------- | ------------- | --------------- | ------------- | ------------- | ------------- | ------------- |
+| **Connection Management** | Support | Support | Support | Support | Support | Support |
+| **Regular Query** | Support | Support | Support | Support | Support | Support |
+| **Parameter Binding** | Not supported | Not supported | Not supported | Support | Not supported | Support |
+| **Subscription (TMQ) ** | Not supported | Not supported | Not supported | Not supported | Not supported | Support |
+| **Schemaless** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
+| **Bulk Pulling (based on WebSocket) ** | Support | Support | Not Supported | support | Not Supported | Supported |
+| **DataFrame** | Not supported | Support | Not supported | Not supported | Not supported | Not supported |
:::warning
diff --git a/docs/examples/csharp/SQLInsertExample.cs b/docs/examples/csharp/SQLInsertExample.cs
index 192ea96d57..3ce70fe914 100644
--- a/docs/examples/csharp/SQLInsertExample.cs
+++ b/docs/examples/csharp/SQLInsertExample.cs
@@ -23,6 +23,7 @@ namespace TDengineExample
CheckRes(conn, res, "failed to insert data");
int affectedRows = TDengine.AffectRows(res);
Console.WriteLine("affectedRows " + affectedRows);
+ TDengine.FreeResult(res);
ExitProgram(conn, 0);
}
diff --git a/docs/zh/02-intro.md b/docs/zh/02-intro.md
index 9a0a6fb547..47bfd3f96b 100644
--- a/docs/zh/02-intro.md
+++ b/docs/zh/02-intro.md
@@ -48,7 +48,7 @@ TDengine 的主要功能如下:
- 多种[数据导出](../operation/export)方式
9. 工具
- 提供[交互式命令行程序(CLI)](../reference/taos-shell),便于管理集群,检查系统状态,做即席查询
- - 提供压力测试工具[taosBenchmark](../reference/taosbenchmark),用于测试 TDengine 的性能
+ - 提供压力测试工具 [taosBenchmark](../reference/taosbenchmark),用于测试 TDengine 的性能
10. 编程
- 提供各种语言的[连接器(Connector)](../connector): 如 [C/C++](../connector/cpp)、[Java](../connector/java)、[Go](../connector/go)、[Node.js](../connector/node)、[Rust](../connector/rust)、[Python](../connector/python)、[C#](../connector/csharp) 等
- 支持 [REST 接口](../connector/rest-api/)
diff --git a/docs/zh/04-concept/index.md b/docs/zh/04-concept/index.md
index 89d3df9c97..2cba68edcd 100644
--- a/docs/zh/04-concept/index.md
+++ b/docs/zh/04-concept/index.md
@@ -4,119 +4,118 @@ title: 数据模型和基本概念
description: TDengine 的数据模型和基本概念
---
-为了便于解释基本概念,便于撰写示例程序,整个 TDengine 文档以智能电表作为典型时序数据场景。假设每个智能电表采集电流、电压、相位三个量,有多个智能电表,每个电表有位置 location 和分组 group ID 的静态属性. 其采集的数据类似如下的表格:
+为了便于解释基本概念,便于撰写示例程序,整个 TDengine 文档以智能电表作为典型时序数据场景。假设每个智能电表采集电流、电压、相位三个量,有多个智能电表,每个电表有位置 Location 和分组 Group ID 的静态属性. 其采集的数据类似如下的表格:
-
- Device ID
- Time Stamp
- Collected Metrics
- Tags
+
+
+ Device ID
+ Timestamp
+ Collected Metrics
+ Tags
-
-Device ID
-Time Stamp
-current
-voltage
-phase
-location
-groupId
-
-
-
-
-d1001
-1538548685000
-10.3
-219
-0.31
-California.SanFrancisco
-2
-
-
-d1002
-1538548684000
-10.2
-220
-0.23
-California.SanFrancisco
-3
-
-
-d1003
-1538548686500
-11.5
-221
-0.35
-California.LosAngeles
-3
-
-
-d1004
-1538548685500
-13.4
-223
-0.29
-California.LosAngeles
-2
-
-
-d1001
-1538548695000
-12.6
-218
-0.33
-California.SanFrancisco
-2
-
-
-d1004
-1538548696600
-11.8
-221
-0.28
-California.LosAngeles
-2
-
-
-d1002
-1538548696650
-10.3
-218
-0.25
-California.SanFrancisco
-3
-
-
-d1001
-1538548696800
-12.3
-221
-0.31
-California.SanFrancisco
-2
-
-
+
+ current
+ voltage
+ phase
+ location
+ groupid
+
+
+
+
+ d1001
+ 1538548685000
+ 10.3
+ 219
+ 0.31
+ California.SanFrancisco
+ 2
+
+
+ d1002
+ 1538548684000
+ 10.2
+ 220
+ 0.23
+ California.SanFrancisco
+ 3
+
+
+ d1003
+ 1538548686500
+ 11.5
+ 221
+ 0.35
+ California.LosAngeles
+ 3
+
+
+ d1004
+ 1538548685500
+ 13.4
+ 223
+ 0.29
+ California.LosAngeles
+ 2
+
+
+ d1001
+ 1538548695000
+ 12.6
+ 218
+ 0.33
+ California.SanFrancisco
+ 2
+
+
+ d1004
+ 1538548696600
+ 11.8
+ 221
+ 0.28
+ California.LosAngeles
+ 2
+
+
+ d1002
+ 1538548696650
+ 10.3
+ 218
+ 0.25
+ California.SanFrancisco
+ 3
+
+
+ d1001
+ 1538548696800
+ 12.3
+ 221
+ 0.31
+ California.SanFrancisco
+ 2
+
+
-
表 1:智能电表数据示例
+
表 1. 智能电表数据示例
-每一条记录都有设备 ID,时间戳,采集的物理量以及每个设备相关的静态标签。每个设备是受外界的触发,或按照设定的周期采集数据。采集的数据点是时序的,是一个数据流。
+每一条记录都有设备 ID、时间戳、采集的物理量(如上表中的 `current`、`voltage` 和 `phase`)以及每个设备相关的静态标签(`location` 和 `groupid`)。每个设备是受外界的触发,或按照设定的周期采集数据。采集的数据点是时序的,是一个数据流。
-## 采集量 (Metric)
+## 采集量(Metric)
采集量是指传感器、设备或其他类型采集点采集的物理量,比如电流、电压、温度、压力、GPS 位置等,是随时间变化的,数据类型可以是整型、浮点型、布尔型,也可是字符串。随着时间的推移,存储的采集量的数据量越来越大。智能电表示例中的电流、电压、相位就是采集量。
-## 标签 (Label/Tag)
+## 标签(Label/Tag)
-标签是指传感器、设备或其他类型采集点的静态属性,不是随时间变化的,比如设备型号、颜色、设备的所在地等,数据类型可以是任何类型。虽然是静态的,但 TDengine 容许用户修改、删除或增加标签值。与采集量不一样的是,随时间的推移,存储的标签的数据量不会有什么变化。智能电表示例中的location与groupId就是标签。
+标签是指传感器、设备或其他类型采集点的静态属性,不是随时间变化的,比如设备型号、颜色、设备的所在地等,数据类型可以是任何类型。虽然是静态的,但 TDengine 容许用户修改、删除或增加标签值。与采集量不一样的是,随时间的推移,存储的标签的数据量不会有什么变化。智能电表示例中的 `location` 与 `groupid` 就是标签。
-## 数据采集点 (Data Collection Point)
+## 数据采集点(Data Collection Point)
-数据采集点是指按照预设时间周期或受事件触发采集物理量的硬件或软件。一个数据采集点可以采集一个或多个采集量,**但这些采集量都是同一时刻采集的,具有相同的时间戳**。对于复杂的设备,往往有多个数据采集点,每个数据采集点采集的周期都可能不一样,而且完全独立,不同步。比如对于一台汽车,有数据采集点专门采集 GPS 位置,有数据采集点专门采集发动机状态,有数据采集点专门采集车内的环境,这样一台汽车就有三个数据采集点。智能电表示例中的d1001, d1002, d1003, d1004等就是数据采集点。
+数据采集点是指按照预设时间周期或受事件触发采集物理量的硬件或软件。一个数据采集点可以采集一个或多个采集量,**但这些采集量都是同一时刻采集的,具有相同的时间戳**。对于复杂的设备,往往有多个数据采集点,每个数据采集点采集的周期都可能不一样,而且完全独立,不同步。比如对于一台汽车,有数据采集点专门采集 GPS 位置,有数据采集点专门采集发动机状态,有数据采集点专门采集车内的环境,这样一台汽车就有三个数据采集点。智能电表示例中的 d1001、d1002、d1003、d1004 等就是数据采集点。
-## 表 (Table)
+## 表(Table)
因为采集量一般是结构化数据,同时为降低学习门槛,TDengine 采用传统的关系型数据库模型管理数据。用户需要先创建库,然后创建表,之后才能插入或查询数据。
@@ -129,50 +128,56 @@ description: TDengine 的数据模型和基本概念
如果采用传统的方式,将多个数据采集点的数据写入一张表,由于网络延时不可控,不同数据采集点的数据到达服务器的时序是无法保证的,写入操作是要有锁保护的,而且一个数据采集点的数据是难以保证连续存储在一起的。**采用一个数据采集点一张表的方式,能最大程度的保证单个数据采集点的插入和查询的性能是最优的。**
-TDengine 建议用数据采集点的名字(如上表中的 D1001)来做表名。每个数据采集点可能同时采集多个采集量(如上表中的 current,voltage,phase),每个采集量对应一张表中的一列,数据类型可以是整型、浮点型、字符串等。除此之外,表的第一列必须是时间戳,即数据类型为 timestamp。对采集量,TDengine 将自动按照时间戳建立索引,但对采集量本身不建任何索引。数据用列式存储方式保存。
+TDengine 建议用数据采集点的名字(如上表中的 d1001)来做表名。每个数据采集点可能同时采集多个采集量(如上表中的 `current`、`voltage` 和 `phase`),每个采集量对应一张表中的一列,数据类型可以是整型、浮点型、字符串等。除此之外,表的第一列必须是时间戳,即数据类型为 Timestamp。对采集量,TDengine 将自动按照时间戳建立索引,但对采集量本身不建任何索引。数据用列式存储方式保存。
-对于复杂的设备,比如汽车,它有多个数据采集点,那么就需要为一台汽车建立多张表。
+对于复杂的设备,比如汽车,它有多个数据采集点,那么就需要为一辆汽车建立多张表。
-
-## 超级表 (STable)
+## 超级表(STable)
由于一个数据采集点一张表,导致表的数量巨增,难以管理,而且应用经常需要做采集点之间的聚合操作,聚合的操作也变得复杂起来。为解决这个问题,TDengine 引入超级表(Super Table,简称为 STable)的概念。
-超级表是指某一特定类型的数据采集点的集合。同一类型的数据采集点,其表的结构是完全一样的,但每个表(数据采集点)的静态属性(标签)是不一样的。描述一个超级表(某一特定类型的数据采集点的集合),除需要定义采集量的表结构之外,还需要定义其标签的 schema,标签的数据类型可以是整数、浮点数、字符串,标签可以有多个,可以事后增加、删除或修改。如果整个系统有 N 个不同类型的数据采集点,就需要建立 N 个超级表。
+超级表是指某一特定类型的数据采集点的集合。同一类型的数据采集点,其表的结构是完全一样的,但每个表(数据采集点)的静态属性(标签)是不一样的。描述一个超级表(某一特定类型的数据采集点的集合),除需要定义采集量的表结构之外,还需要定义其标签的 Schema,标签的数据类型可以是整数、浮点数、字符串、JSON,标签可以有多个,可以事后增加、删除或修改。如果整个系统有 N 个不同类型的数据采集点,就需要建立 N 个超级表。
-在 TDengine 的设计里,**表用来代表一个具体的数据采集点,超级表用来代表一组相同类型的数据采集点集合**。智能电表示例中,我们可以创建一个超级表meters.
+在 TDengine 的设计里,**表用来代表一个具体的数据采集点,超级表用来代表一组相同类型的数据采集点集合**。智能电表示例中,我们可以创建一个超级表 `meters`.
-## 子表 (Subtable)
+## 子表(Subtable)
当为某个具体数据采集点创建表时,用户可以使用超级表的定义做模板,同时指定该具体采集点(表)的具体标签值来创建该表。**通过超级表创建的表称之为子表**。正常的表与子表的差异在于:
-1. 子表就是表,因此所有正常表的SQL操作都可以在子表上执行。
+1. 子表就是表,因此所有正常表的 SQL 操作都可以在子表上执行。
2. 子表在正常表的基础上有扩展,它是带有静态标签的,而且这些标签可以事后增加、删除、修改,而正常的表没有。
3. 子表一定属于一张超级表,但普通表不属于任何超级表
4. 普通表无法转为子表,子表也无法转为普通表。
超级表与与基于超级表建立的子表之间的关系表现在:
-1. 一张超级表包含有多张子表,这些子表具有相同的采集量 schema,但带有不同的标签值。
+1. 一张超级表包含有多张子表,这些子表具有相同的采集量 Schema,但带有不同的标签值。
2. 不能通过子表调整数据或标签的模式,对于超级表的数据模式修改立即对所有的子表生效。
3. 超级表只定义一个模板,自身不存储任何数据或标签信息。因此,不能向一个超级表写入数据,只能将数据写入子表中。
查询既可以在表上进行,也可以在超级表上进行。针对超级表的查询,TDengine 将把所有子表中的数据视为一个整体数据集进行处理,会先把满足标签过滤条件的表从超级表中找出来,然后再扫描这些表的时序数据,进行聚合操作,这样需要扫描的数据集会大幅减少,从而显著提高查询的性能。本质上,TDengine 通过对超级表查询的支持,实现了多个同类数据采集点的高效聚合。
-TDengine系统建议给一个数据采集点建表,需要通过超级表建表,而不是建普通表。在智能电表的示例中,我们可以通过超级表meters创建子表d1001, d1002, d1003, d1004等。
+TDengine 系统建议给一个数据采集点建表,需要通过超级表建表,而不是建普通表。在智能电表的示例中,我们可以通过超级表 meters 创建子表 d1001、d1002、d1003、d1004 等。
-为了更好地理解超级与子表的关系,可以参考下面关于智能电表数据模型的示意图。 
+为了更好地理解采集量、标签、超级与子表的关系,可以参考下面关于智能电表数据模型的示意图。
-## 库 (database)
+
+
+
+
+图 1. 智能电表数据模型示意图
+
+
+## 库(Database)
库是指一组表的集合。TDengine 容许一个运行实例有多个库,而且每个库可以配置不同的存储策略。不同类型的数据采集点往往具有不同的数据特征,包括数据采集频率的高低,数据保留时间的长短,副本的数目,数据块的大小,是否允许更新数据等等。为了在各种场景下 TDengine 都能最大效率的工作,TDengine 建议将不同数据特征的超级表创建在不同的库里。
一个库里,可以有一到多个超级表,但一个超级表只属于一个库。一个超级表所拥有的子表全部存在一个库里。
-## FQDN & End Point
+## FQDN & Endpoint
-FQDN (fully qualified domain name, 完全限定域名)是 Internet 上特定计算机或主机的完整域名。FQDN 由两部分组成:主机名和域名。例如,假设邮件服务器的 FQDN 可能是 mail.tdengine.com。主机名是 mail,主机位于域名 tdengine.com 中。DNS(Domain Name System),负责将 FQDN 翻译成 IP,是互联网应用的寻址方式。对于没有 DNS 的系统,可以通过配置 hosts 文件来解决。
+FQDN(Fully Qualified Domain Name,完全限定域名)是 Internet 上特定计算机或主机的完整域名。FQDN 由两部分组成:主机名和域名。例如,假设邮件服务器的 FQDN 可能是 mail.tdengine.com。主机名是 mail,主机位于域名 tdengine.com 中。DNS(Domain Name System),负责将 FQDN 翻译成 IP,是互联网应用的寻址方式。对于没有 DNS 的系统,可以通过配置 hosts 文件来解决。
-TDengine 集群的每个节点是由 End Point 来唯一标识的,End Point 是由 FQDN 外加 Port 组成,比如 h1.tdengine.com:6030。这样当 IP 发生变化的时候,我们依然可以使用 FQDN 来动态找到节点,不需要更改集群的任何配置。而且采用 FQDN,便于内网和外网对同一个集群的统一访问。
+TDengine 集群的每个节点是由 Endpoint 来唯一标识的,Endpoint 是由 FQDN 外加 Port 组成,比如 h1.tdengine.com:6030。这样当 IP 发生变化的时候,我们依然可以使用 FQDN 来动态找到节点,不需要更改集群的任何配置。而且采用 FQDN,便于内网和外网对同一个集群的统一访问。
TDengine 不建议采用直接的 IP 地址访问集群,不利于管理。不了解 FQDN 概念,请看博文[《一篇文章说清楚 TDengine 的 FQDN》](https://www.taosdata.com/blog/2020/09/11/1824.html)。
diff --git a/docs/zh/05-get-started/01-docker.md b/docs/zh/05-get-started/01-docker.md
index e2be419517..e3345fed96 100644
--- a/docs/zh/05-get-started/01-docker.md
+++ b/docs/zh/05-get-started/01-docker.md
@@ -4,11 +4,11 @@ title: 通过 Docker 快速体验 TDengine
description: 使用 Docker 快速体验 TDengine 的高效写入和查询
---
-本节首先介绍如何通过 Docker 快速体验 TDengine,然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。如果你不熟悉 Docker,请使用[安装包的方式快速体验](../../get-started/package/)。如果您希望为 TDengine 贡献代码或对内部技术实现感兴趣,请参考 [TDengine GitHub 主页](https://github.com/taosdata/TDengine) 下载源码构建和安装.
+本节首先介绍如何通过 Docker 快速体验 TDengine,然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。如果你不熟悉 Docker,请使用[安装包的方式快速体验](../../get-started/package/)。如果您希望为 TDengine 贡献代码或对内部技术实现感兴趣,请参考 [TDengine GitHub 主页](https://github.com/taosdata/TDengine)下载源码构建和安装。
## 启动 TDengine
-如果已经安装了 docker, 只需执行下面的命令。
+如果已经安装了 Docker,只需执行下面的命令:
```shell
docker run -d -p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043-6049/udp tdengine/tdengine
@@ -16,84 +16,84 @@ docker run -d -p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043
注意:TDengine 3.0 服务端仅使用 6030 TCP 端口。6041 为 taosAdapter 所使用提供 REST 服务端口。6043-6049 为 taosAdapter 提供第三方应用接入所使用端口,可根据需要选择是否打开。
-确定该容器已经启动并且在正常运行
+确定该容器已经启动并且在正常运行。
```shell
docker ps
```
-进入该容器并执行 bash
+进入该容器并执行 `bash`
```shell
docker exec -it bash
```
-然后就可以执行相关的 Linux 命令操作和访问 TDengine
+然后就可以执行相关的 Linux 命令操作和访问 TDengine。
-注: Docker 工具自身的下载和使用请参考 [Docker 官网文档](https://docs.docker.com/get-docker/)。
+注:Docker 工具自身的下载和使用请参考 [Docker 官网文档](https://docs.docker.com/get-docker/)。
## 运行 TDengine CLI
-进入容器,执行 taos
+进入容器,执行 `taos`:
```
$ taos
-taos>
-
+taos>
```
-## 写入数据
+## 使用 taosBenchmark 体验写入速度
-可以使用 TDengine 的自带工具 taosBenchmark 快速体验 TDengine 的写入。
+可以使用 TDengine 的自带工具 taosBenchmark 快速体验 TDengine 的写入速度。
-进入容器,启动 taosBenchmark:
+启动 TDengine 的服务,在 Linux 或 Windows 终端执行 `taosBenchmark`(曾命名为 `taosdemo`):
- ```bash
- $ taosBenchmark
-
- ```
+```bash
+$ taosBenchmark
+```
- 该命令将在数据库 test 下面自动创建一张超级表 meters,该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupId,groupId 被设置为 1 到 10, location 被设置为 "San Francisco" 或者 "Los Angeles"等城市名称。
+该命令将在数据库 `test` 下面自动创建一张超级表 `meters`,该超级表下有 1 万张表,表名为 `d0` 到 `d9999`,每张表有 1 万条记录,每条记录有 `ts`、`current`、`voltage`、`phase` 四个字段,时间戳从 2017-07-14 10:40:00 000 到 2017-07-14 10:40:09 999,每张表带有标签 `location` 和 `groupId`,groupId 被设置为 1 到 10,location 被设置为 `Campbell`、`Cupertino`、`Los Angeles`、`Mountain View`、`Palo Alto`、`San Diego`、`San Francisco`、`San Jose`、`Santa Clara` 或者 `Sunnyvale`。
- 这条命令很快完成 1 亿条记录的插入。具体时间取决于硬件性能。
+这条命令很快完成 1 亿条记录的插入。具体时间取决于硬件性能,即使在一台普通的 PC 服务器往往也仅需十几秒。
- taosBenchmark 命令本身带有很多选项,配置表的数目、记录条数等等,您可以设置不同参数进行体验,请执行 `taosBenchmark --help` 详细列出。taosBenchmark 详细使用方法请参照 [taosBenchmark 参考手册](../../reference/taosbenchmark)。
+taosBenchmark 命令本身带有很多选项,配置表的数目、记录条数等等,您可以设置不同参数进行体验,请执行 `taosBenchmark --help` 详细列出。taosBenchmark 详细使用方法请参照[如何使用 taosBenchmark 对 TDengine 进行性能测试](https://www.taosdata.com/2021/10/09/3111.html)和 [taosBenchmark 参考手册](../../reference/taosbenchmark)。
-## 体验查询
+## 使用 TDengine CLI 体验查询速度
-使用上述 taosBenchmark 插入数据后,可以在 TDengine CLI 输入查询命令,体验查询速度。。
+使用上述 `taosBenchmark` 插入数据后,可以在 TDengine CLI(taos)输入查询命令,体验查询速度。
-查询超级表下记录总条数:
+查询超级表 `meters` 下的记录总条数:
```sql
-taos> select count(*) from test.meters;
+SELECT COUNT(*) FROM test.meters;
```
查询 1 亿条记录的平均值、最大值、最小值等:
```sql
-taos> select avg(current), max(voltage), min(phase) from test.meters;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
```
-查询 location="San Francisco" 的记录总条数:
+查询 location = "San Francisco" 的记录总条数:
```sql
-taos> select count(*) from test.meters where location="San Francisco";
+SELECT COUNT(*) FROM test.meters WHERE location = "San Francisco";
```
-查询 groupId=10 的所有记录的平均值、最大值、最小值等:
+查询 groupId = 10 的所有记录的平均值、最大值、最小值等:
```sql
-taos> select avg(current), max(voltage), min(phase) from test.meters where groupId=10;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
```
-对表 d10 按 10s 进行平均值、最大值和最小值聚合统计:
+对表 `d10` 按 10 每秒进行平均值、最大值和最小值聚合统计:
```sql
-taos> select avg(current), max(voltage), min(phase) from test.d10 interval(10s);
+SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
```
+在上面的查询中,你选择的是区间内的第一个时间戳(ts),另一种选择方式是 `\_wstart`,它将给出时间窗口的开始。关于窗口查询的更多信息,参见[特色查询](../../taos-sql/distinguished/)。
+
## 其它
-更多关于在 Docker 环境下使用 TDengine 的细节,请参考 [在 Docker 下使用 TDengine](../../reference/docker)
+更多关于在 Docker 环境下使用 TDengine 的细节,请参考 [在 Docker 下使用 TDengine](../../reference/docker)。
diff --git a/docs/zh/05-get-started/03-package.md b/docs/zh/05-get-started/03-package.md
index 3e0fb056a5..cb2553a0bf 100644
--- a/docs/zh/05-get-started/03-package.md
+++ b/docs/zh/05-get-started/03-package.md
@@ -10,23 +10,24 @@ import PkgListV3 from "/components/PkgListV3";
您可以[用 Docker 立即体验](../../get-started/docker/) TDengine。如果您希望对 TDengine 贡献代码或对内部实现感兴趣,请参考我们的 [TDengine GitHub 主页](https://github.com/taosdata/TDengine) 下载源码构建和安装.
-TDengine 完整的软件包包括服务端(taosd)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、应用驱动(taosc)、命令行程序 (CLI,taos) 和一些工具软件。目前 taosAdapter 仅在 Linux 系统上安装和运行,后续将支持 Windows、macOS 等系统。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](../../reference/taosadapter/) 提供 [RESTful 接口](../../connector/rest-api/)。
+TDengine 完整的软件包包括服务端(taosd)、应用驱动(taosc)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、命令行程序(CLI,taos)和一些工具软件。目前 taosAdapter 仅在 Linux 系统上安装和运行,后续将支持 Windows、macOS 等系统。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](../../reference/taosadapter/) 提供 [RESTful 接口](../../connector/rest-api/)。
-为方便使用,标准的服务端安装包包含了 taosd、taosAdapter、taosc、taos、taosdump、taosBenchmark、TDinsight 安装脚本和示例代码;如果您只需要用到服务端程序和客户端连接的 C/C++ 语言支持,也可以仅下载 lite 版本的安装包。
+为方便使用,标准的服务端安装包包含了 taosd、taosAdapter、taosc、taos、taosdump、taosBenchmark、TDinsight 安装脚本和示例代码;如果您只需要用到服务端程序和客户端连接的 C/C++ 语言支持,也可以仅下载 Lite 版本的安装包。
-在 Linux 系统上,TDengine 开源版本提供 deb 和 rpm 格式安装包,用户可以根据自己的运行环境选择合适的安装包。其中 deb 支持 Debian/Ubuntu 及衍生系统,rpm 支持 CentOS/RHEL/SUSE 及衍生系统。同时我们也为企业用户提供 tar.gz 格式安装包,也支持通过 `apt-get` 工具从线上进行安装。需要注意的是,rpm 和 deb 包不含 taosdump 和 TDinsight 安装脚本,这些工具需要通过安装 taosTool 包获得。TDengine 也提供 Windows x64 平台的安装包。
+在 Linux 系统上,TDengine 社区版提供 Deb 和 RPM 格式安装包,用户可以根据自己的运行环境选择合适的安装包。其中 Deb 支持 Debian/Ubuntu 及其衍生系统,RPM 支持 CentOS/RHEL/SUSE 及其衍生系统。同时我们也为企业用户提供 tar.gz 格式安装包,也支持通过 `apt-get` 工具从线上进行安装。需要注意的是,RPM 和 Deb 包不含 `taosdump` 和 TDinsight 安装脚本,这些工具需要通过安装 taosTool 包获得。TDengine 也提供 Windows x64 平台的安装包。
## 安装
-1. 从列表中下载获得 deb 安装包;
-
+1. 从列表中下载获得 Deb 安装包;
+
2. 进入到安装包所在目录,执行如下的安装命令:
+> 请将 `` 替换为下载的安装包版本
+
```bash
-# 替换为下载的安装包版本
sudo dpkg -i TDengine-server--Linux-x64.deb
```
@@ -34,12 +35,13 @@ sudo dpkg -i TDengine-server--Linux-x64.deb
-1. 从列表中下载获得 rpm 安装包;
-
+1. 从列表中下载获得 RPM 安装包;
+
2. 进入到安装包所在目录,执行如下的安装命令:
+> 请将 `` 替换为下载的安装包版本
+
```bash
-# 替换为下载的安装包版本
sudo rpm -ivh TDengine-server--Linux-x64.rpm
```
@@ -48,44 +50,46 @@ sudo rpm -ivh TDengine-server--Linux-x64.rpm
1. 从列表中下载获得 tar.gz 安装包;
-
-2. 进入到安装包所在目录,先解压文件后,进入子目录,执行其中的 install.sh 安装脚本:
+
+2. 进入到安装包所在目录,使用 `tar` 解压安装包;
+3. 进入到安装包所在目录,先解压文件后,进入子目录,执行其中的 install.sh 安装脚本。
+
+> 请将 `` 替换为下载的安装包版本
```bash
-# 替换为下载的安装包版本
tar -zxvf TDengine-server--Linux-x64.tar.gz
```
-解压后进入相应路径,执行
+解压文件后,进入相应子目录,执行其中的 `install.sh` 安装脚本:
```bash
sudo ./install.sh
```
:::info
-install.sh 安装脚本在执行过程中,会通过命令行交互界面询问一些配置信息。如果希望采取无交互安装方式,那么可以用 -e no 参数来执行 install.sh 脚本。运行 `./install.sh -h` 指令可以查看所有参数的详细说明信息。
+install.sh 安装脚本在执行过程中,会通过命令行交互界面询问一些配置信息。如果希望采取无交互安装方式,那么可以运行 `./install.sh -e no`。运行 `./install.sh -h` 指令可以查看所有参数的详细说明信息。
:::
-可以使用 apt-get 工具从官方仓库安装。
+可以使用 `apt-get` 工具从官方仓库安装。
-**安装包仓库**
+**配置包仓库**
```bash
wget -qO - http://repos.taosdata.com/tdengine.key | sudo apt-key add -
echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-stable stable main" | sudo tee /etc/apt/sources.list.d/tdengine-stable.list
```
-如果安装 Beta 版需要安装包仓库
+如果安装 Beta 版需要安装包仓库:
```bash
wget -qO - http://repos.taosdata.com/tdengine.key | sudo apt-key add -
echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-beta beta main" | sudo tee /etc/apt/sources.list.d/tdengine-beta.list
```
-**使用 apt-get 命令安装**
+**使用 `apt-get` 命令安装**
```bash
sudo apt-get update
@@ -94,26 +98,26 @@ sudo apt-get install tdengine
```
:::tip
-apt-get 方式只适用于 Debian 或 Ubuntu 系统
+apt-get 方式只适用于 Debian 或 Ubuntu 系统。
::::
-
+
-注意:目前 TDengine 在 Windows 平台上只支持 Windows server 2016/2019 和 Windows 10/11 系统版本。
+注意:目前 TDengine 在 Windows 平台上只支持 Windows Server 2016/2019 和 Windows 10/11。
1. 从列表中下载获得 exe 安装程序;
-
+
2. 运行可执行程序来安装 TDengine。
:::info
-下载其他组件、最新 Beta 版及之前版本的安装包,请点击[发布历史页面](../../releases/tdengine)
+下载其他组件、最新 Beta 版及之前版本的安装包,请点击[发布历史页面](../../releases/tdengine)。
:::
:::note
-当安装第一个节点时,出现 Enter FQDN:提示的时候,不需要输入任何内容。只有当安装第二个或以后更多的节点时,才需要输入已有集群中任何一个可用节点的 FQDN,支持该新节点加入集群。当然也可以不输入,而是在新节点启动前,配置到新节点的配置文件中。
+当安装第一个节点时,出现 `Enter FQDN:` 提示的时候,不需要输入任何内容。只有当安装第二个或以后更多的节点时,才需要输入已有集群中任何一个可用节点的 FQDN,支持该新节点加入集群。当然也可以不输入,而是在新节点启动前,配置到新节点的配置文件中。
:::
@@ -148,7 +152,7 @@ Active: inactive (dead)
如果 TDengine 服务正常工作,那么您可以通过 TDengine 的命令行程序 `taos` 来访问并体验 TDengine。
-systemctl 命令汇总:
+如下 `systemctl` 命令可以帮助你管理 TDengine 服务:
- 启动服务进程:`systemctl start taosd`
@@ -160,7 +164,7 @@ systemctl 命令汇总:
:::info
-- systemctl 命令需要 _root_ 权限来运行,如果您非 _root_ 用户,请在命令前添加 sudo 。
+- `systemctl` 命令需要 _root_ 权限来运行,如果您非 _root_ 用户,请在命令前添加 `sudo`。
- `systemctl stop taosd` 指令在执行后并不会马上停止 TDengine 服务,而是会等待系统中必要的落盘工作正常完成。在数据量很大的情况下,这可能会消耗较长时间。
- 如果系统中不支持 `systemd`,也可以用手动运行 `/usr/local/taos/bin/taosd` 方式启动 TDengine 服务。
@@ -170,87 +174,93 @@ systemctl 命令汇总:
-安装后,在 C:\TDengine 目录下,运行 taosd.exe 来启动 TDengine 服务进程。
+安装后,在 `C:\TDengine` 目录下,运行 `taosd.exe` 来启动 TDengine 服务进程。
-## TDengine 命令行 (CLI)
+## TDengine 命令行(CLI)
-为便于检查 TDengine 的状态,执行数据库 (Database) 的各种即席(Ad Hoc)查询,TDengine 提供一命令行应用程序(以下简称为 TDengine CLI) taos。要进入 TDengine 命令行,您只要在安装有 TDengine 的 Linux 终端执行 `taos` 即可,也可以在安装有 TDengine 的 Windows 终端的 C:\TDengine 目录下,运行 taos.exe 来启动 TDengine 命令行。
+为便于检查 TDengine 的状态,执行数据库(Database)的各种即席(Ad Hoc)查询,TDengine 提供一命令行应用程序(以下简称为 TDengine CLI)taos。要进入 TDengine 命令行,您只要在安装有 TDengine 的 Linux 终端执行 `taos` 即可,也可以在安装有 TDengine 的 Windows 终端的 C:\TDengine 目录下,运行 taos.exe 来启动 TDengine 命令行。
```bash
taos
```
-如果连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印错误消息出来(请参考 [FAQ](/train-faq/faq) 来解决终端连接服务端失败的问题)。 TDengine CLI 的提示符号如下:
+如果连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印错误消息出来(请参考 [FAQ](/train-faq/faq) 来解决终端连接服务端失败的问题)。TDengine CLI 的提示符号如下:
```cmd
taos>
```
-在 TDengine CLI 中,用户可以通过 SQL 命令来创建/删除数据库、表等,并进行数据库(database)插入查询操作。在终端中运行的 SQL 语句需要以分号结束来运行。示例:
+在 TDengine CLI 中,用户可以通过 SQL 命令来创建/删除数据库、表等,并进行数据库(Database)插入查询操作。在终端中运行的 SQL 语句需要以分号(;)结束来运行。示例:
```sql
-create database demo;
-use demo;
-create table t (ts timestamp, speed int);
-insert into t values ('2019-07-15 00:00:00', 10);
-insert into t values ('2019-07-15 01:00:00', 20);
-select * from t;
+CREATE DATABASE demo;
+USE demo;
+CREATE TABLE t (ts TIMESTAMP, speed INT);
+INSERT INTO t VALUES ('2019-07-15 00:00:00', 10);
+INSERT INTO t VALUES ('2019-07-15 01:00:00', 20);
+SELECT * FROM t;
+
ts | speed |
========================================
2019-07-15 00:00:00.000 | 10 |
2019-07-15 01:00:00.000 | 20 |
+
Query OK, 2 row(s) in set (0.003128s)
```
-除执行 SQL 语句外,系统管理员还可以从 TDengine CLI 进行检查系统运行状态、添加删除用户账号等操作。TDengine CLI 连同应用驱动也可以独立安装在 Linux 或 Windows 机器上运行,更多细节请参考 [这里](../../reference/taos-shell/)
+除执行 SQL 语句外,系统管理员还可以从 TDengine CLI 进行检查系统运行状态、添加删除用户账号等操作。TDengine CLI 连同应用驱动也可以独立安装在 Linux 或 Windows 机器上运行,更多细节请参考 [TDengine 命令行](../../reference/taos-shell/)。
## 使用 taosBenchmark 体验写入速度
-启动 TDengine 的服务,在 Linux 或 windows 终端执行 `taosBenchmark` (曾命名为 `taosdemo`):
+可以使用 TDengine 的自带工具 taosBenchmark 快速体验 TDengine 的写入速度。
+
+启动 TDengine 的服务,在 Linux 或 Windows 终端执行 `taosBenchmark`(曾命名为 `taosdemo`):
```bash
-taosBenchmark
+$ taosBenchmark
```
-该命令将在数据库 test 下面自动创建一张超级表 meters,该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupId,groupId 被设置为 1 到 10, location 被设置为 "California.SanFrancisco" 或者 "California.LosAngeles"。
+该命令将在数据库 `test` 下面自动创建一张超级表 `meters`,该超级表下有 1 万张表,表名为 `d0` 到 `d9999`,每张表有 1 万条记录,每条记录有 `ts`、`current`、`voltage`、`phase` 四个字段,时间戳从 2017-07-14 10:40:00 000 到 2017-07-14 10:40:09 999,每张表带有标签 `location` 和 `groupId`,groupId 被设置为 1 到 10,location 被设置为 `Campbell`、`Cupertino`、`Los Angeles`、`Mountain View`、`Palo Alto`、`San Diego`、`San Francisco`、`San Jose`、`Santa Clara` 或者 `Sunnyvale`。
这条命令很快完成 1 亿条记录的插入。具体时间取决于硬件性能,即使在一台普通的 PC 服务器往往也仅需十几秒。
-taosBenchmark 命令本身带有很多选项,配置表的数目、记录条数等等,您可以设置不同参数进行体验,请执行 `taosBenchmark --help` 详细列出。taosBenchmark 详细使用方法请参照 [如何使用 taosBenchmark 对 TDengine 进行性能测试](https://www.taosdata.com/2021/10/09/3111.html)。
+taosBenchmark 命令本身带有很多选项,配置表的数目、记录条数等等,您可以设置不同参数进行体验,请执行 `taosBenchmark --help` 详细列出。taosBenchmark 详细使用方法请参照[如何使用 taosBenchmark 对 TDengine 进行性能测试](https://www.taosdata.com/2021/10/09/3111.html)和 [taosBenchmark 参考手册](../../reference/taosbenchmark)。
## 使用 TDengine CLI 体验查询速度
-使用上述 taosBenchmark 插入数据后,可以在 TDengine CLI 输入查询命令,体验查询速度。
+使用上述 `taosBenchmark` 插入数据后,可以在 TDengine CLI(taos)输入查询命令,体验查询速度。
-查询超级表下记录总条数:
+查询超级表 `meters` 下的记录总条数:
```sql
-taos> select count(*) from test.meters;
+SELECT COUNT(*) FROM test.meters;
```
查询 1 亿条记录的平均值、最大值、最小值等:
```sql
-taos> select avg(current), max(voltage), min(phase) from test.meters;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters;
```
-查询 location="California.SanFrancisco" 的记录总条数:
+查询 location = "San Francisco" 的记录总条数:
```sql
-taos> select count(*) from test.meters where location="California.SanFrancisco";
+SELECT COUNT(*) FROM test.meters WHERE location = "San Francisco";
```
-查询 groupId=10 的所有记录的平均值、最大值、最小值等:
+查询 groupId = 10 的所有记录的平均值、最大值、最小值等:
```sql
-taos> select avg(current), max(voltage), min(phase) from test.meters where groupId=10;
+SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 10;
```
-对表 d10 按 10s 进行平均值、最大值和最小值聚合统计:
+对表 `d10` 按 10 每秒进行平均值、最大值和最小值聚合统计:
```sql
-taos> select avg(current), max(voltage), min(phase) from test.d10 interval(10s);
+SELECT FIRST(ts), AVG(current), MAX(voltage), MIN(phase) FROM test.d10 INTERVAL(10s);
```
+
+在上面的查询中,你选择的是区间内的第一个时间戳(ts),另一种选择方式是 `\_wstart`,它将给出时间窗口的开始。关于窗口查询的更多信息,参见[特色查询](../../taos-sql/distinguished/)。
diff --git a/docs/zh/07-develop/09-udf.md b/docs/zh/07-develop/09-udf.md
index ef1cd4797a..3239eae49b 100644
--- a/docs/zh/07-develop/09-udf.md
+++ b/docs/zh/07-develop/09-udf.md
@@ -116,7 +116,7 @@ aggfn为函数名的占位符,需要修改为自己的函数名,如l2norm。
参数的具体含义是:
- inputDataBlock: 输入的数据块
- - resultColumn: 输出列。输出列
+ - resultColumn: 输出列
### 聚合接口函数
diff --git a/docs/zh/08-connector/index.md b/docs/zh/08-connector/index.md
index 17de8e926c..f54470f742 100644
--- a/docs/zh/08-connector/index.md
+++ b/docs/zh/08-connector/index.md
@@ -41,14 +41,14 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器
### 使用原生接口(taosc)
-| **功能特性** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** |
-| -------------- | -------- | ---------- | ------ | ------ | ----------- | -------- |
-| **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
-| **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
-| **参数绑定** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
-| ** TMQ ** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
-| **Schemaless** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
-| **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 |
+| **功能特性** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** |
+| ------------------- | -------- | ---------- | ------ | ------ | ----------- | -------- |
+| **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
+| **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
+| **参数绑定** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
+| **数据订阅(TMQ)** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
+| **Schemaless** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
+| **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 |
:::info
由于不同编程语言数据库框架规范不同,并不意味着所有 C/C++ 接口都需要对应封装支持。
@@ -56,16 +56,15 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器
### 使用 http (REST 或 WebSocket) 接口
-| **功能特性** | **Java** | **Python** | **Go** | **C#(暂不支持)** | **Node.js** | **Rust** |
-| ------------------------------ | -------- | ---------- | -------- | ------------------ | ----------- | -------- |
-| **连接管理** | 支持 | 支持 | 支持 | N/A | 支持 | 支持 |
-| **普通查询** | 支持 | 支持 | 支持 | N/A | 支持 | 支持 |
-| **连续查询** | 支持 | 支持 | 支持 | N/A | 支持 | 支持 |
-| **参数绑定** | 不支持 | 暂不支持 | 暂不支持 | N/A | 不支持 | 支持 |
-| ** TMQ ** | 不支持 | 暂不支持 | 暂不支持 | N/A | 不支持 | 支持 |
-| **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | N/A | 不支持 | 暂不支持 |
-| **批量拉取(基于 WebSocket)** | 支持 | 支持 | 暂不支持 | N/A | 不支持 | 支持 |
-| **DataFrame** | 不支持 | 支持 | 不支持 | N/A | 不支持 | 不支持 |
+| **功能特性** | **Java** | **Python** | **Go** | **C# ** | **Node.js** | **Rust** |
+| ------------------------------ | -------- | ---------- | -------- | -------- | ----------- | -------- |
+| **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
+| **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
+| **参数绑定** | 暂不支持 | 暂不支持 | 暂不支持 | 支持 | 暂不支持 | 支持 |
+| **数据订阅(TMQ)** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 支持 |
+| **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 |
+| **批量拉取(基于 WebSocket)** | 支持 | 支持 | 暂不支持 | 支持 | 暂不支持 | 支持 |
+| **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 |
:::warning
diff --git a/docs/zh/12-taos-sql/20-keywords.md b/docs/zh/12-taos-sql/20-keywords.md
index 09fea45b7a..ee36dc44f0 100644
--- a/docs/zh/12-taos-sql/20-keywords.md
+++ b/docs/zh/12-taos-sql/20-keywords.md
@@ -256,6 +256,7 @@ description: TDengine 保留关键字的详细列表
### V
+- VALUE
- VALUES
- VARIABLE
- VARIABLES
diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md
index c8a99cb40f..9e8757cc4e 100644
--- a/docs/zh/28-releases/02-tools.md
+++ b/docs/zh/28-releases/02-tools.md
@@ -9,7 +9,3 @@ import Release from "/components/ReleaseV3";
## 2.1.3
-
-## 2.1.2
-
-
\ No newline at end of file
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index 9f919fa250..dfce7e54d0 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -787,6 +787,7 @@ typedef struct {
int32_t sstTrigger;
int16_t hashPrefix;
int16_t hashSuffix;
+ int32_t tsdbPageSize;
} SCreateDbReq;
int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq);
@@ -1200,6 +1201,7 @@ typedef struct {
int16_t sstTrigger;
int16_t hashPrefix;
int16_t hashSuffix;
+ int32_t tsdbPageSize;
} SCreateVnodeReq;
int32_t tSerializeSCreateVnodeReq(void* buf, int32_t bufLen, SCreateVnodeReq* pReq);
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index c7cce6a183..3e170d5098 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -89,240 +89,241 @@
#define TK_KEEP 71
#define TK_PAGES 72
#define TK_PAGESIZE 73
-#define TK_PRECISION 74
-#define TK_REPLICA 75
-#define TK_STRICT 76
-#define TK_VGROUPS 77
-#define TK_SINGLE_STABLE 78
-#define TK_RETENTIONS 79
-#define TK_SCHEMALESS 80
-#define TK_WAL_LEVEL 81
-#define TK_WAL_FSYNC_PERIOD 82
-#define TK_WAL_RETENTION_PERIOD 83
-#define TK_WAL_RETENTION_SIZE 84
-#define TK_WAL_ROLL_PERIOD 85
-#define TK_WAL_SEGMENT_SIZE 86
-#define TK_SST_TRIGGER 87
-#define TK_TABLE_PREFIX 88
-#define TK_TABLE_SUFFIX 89
-#define TK_NK_COLON 90
-#define TK_TABLE 91
-#define TK_NK_LP 92
-#define TK_NK_RP 93
-#define TK_STABLE 94
-#define TK_ADD 95
-#define TK_COLUMN 96
-#define TK_MODIFY 97
-#define TK_RENAME 98
-#define TK_TAG 99
-#define TK_SET 100
-#define TK_NK_EQ 101
-#define TK_USING 102
-#define TK_TAGS 103
-#define TK_COMMENT 104
-#define TK_BOOL 105
-#define TK_TINYINT 106
-#define TK_SMALLINT 107
-#define TK_INT 108
-#define TK_INTEGER 109
-#define TK_BIGINT 110
-#define TK_FLOAT 111
-#define TK_DOUBLE 112
-#define TK_BINARY 113
-#define TK_TIMESTAMP 114
-#define TK_NCHAR 115
-#define TK_UNSIGNED 116
-#define TK_JSON 117
-#define TK_VARCHAR 118
-#define TK_MEDIUMBLOB 119
-#define TK_BLOB 120
-#define TK_VARBINARY 121
-#define TK_DECIMAL 122
-#define TK_MAX_DELAY 123
-#define TK_WATERMARK 124
-#define TK_ROLLUP 125
-#define TK_TTL 126
-#define TK_SMA 127
-#define TK_FIRST 128
-#define TK_LAST 129
-#define TK_SHOW 130
-#define TK_DATABASES 131
-#define TK_TABLES 132
-#define TK_STABLES 133
-#define TK_MNODES 134
-#define TK_MODULES 135
-#define TK_QNODES 136
-#define TK_FUNCTIONS 137
-#define TK_INDEXES 138
-#define TK_ACCOUNTS 139
-#define TK_APPS 140
-#define TK_CONNECTIONS 141
-#define TK_LICENCES 142
-#define TK_GRANTS 143
-#define TK_QUERIES 144
-#define TK_SCORES 145
-#define TK_TOPICS 146
-#define TK_VARIABLES 147
-#define TK_BNODES 148
-#define TK_SNODES 149
-#define TK_CLUSTER 150
-#define TK_TRANSACTIONS 151
-#define TK_DISTRIBUTED 152
-#define TK_CONSUMERS 153
-#define TK_SUBSCRIPTIONS 154
-#define TK_VNODES 155
-#define TK_LIKE 156
-#define TK_INDEX 157
-#define TK_FUNCTION 158
-#define TK_INTERVAL 159
-#define TK_TOPIC 160
-#define TK_AS 161
-#define TK_WITH 162
-#define TK_META 163
-#define TK_CONSUMER 164
-#define TK_GROUP 165
-#define TK_DESC 166
-#define TK_DESCRIBE 167
-#define TK_RESET 168
-#define TK_QUERY 169
-#define TK_CACHE 170
-#define TK_EXPLAIN 171
-#define TK_ANALYZE 172
-#define TK_VERBOSE 173
-#define TK_NK_BOOL 174
-#define TK_RATIO 175
-#define TK_NK_FLOAT 176
-#define TK_OUTPUTTYPE 177
-#define TK_AGGREGATE 178
-#define TK_BUFSIZE 179
-#define TK_STREAM 180
-#define TK_INTO 181
-#define TK_TRIGGER 182
-#define TK_AT_ONCE 183
-#define TK_WINDOW_CLOSE 184
-#define TK_IGNORE 185
-#define TK_EXPIRED 186
-#define TK_KILL 187
-#define TK_CONNECTION 188
-#define TK_TRANSACTION 189
-#define TK_BALANCE 190
-#define TK_VGROUP 191
-#define TK_MERGE 192
-#define TK_REDISTRIBUTE 193
-#define TK_SPLIT 194
-#define TK_DELETE 195
-#define TK_INSERT 196
-#define TK_NULL 197
-#define TK_NK_QUESTION 198
-#define TK_NK_ARROW 199
-#define TK_ROWTS 200
-#define TK_TBNAME 201
-#define TK_QSTART 202
-#define TK_QEND 203
-#define TK_QDURATION 204
-#define TK_WSTART 205
-#define TK_WEND 206
-#define TK_WDURATION 207
-#define TK_CAST 208
-#define TK_NOW 209
-#define TK_TODAY 210
-#define TK_TIMEZONE 211
-#define TK_CLIENT_VERSION 212
-#define TK_SERVER_VERSION 213
-#define TK_SERVER_STATUS 214
-#define TK_CURRENT_USER 215
-#define TK_COUNT 216
-#define TK_LAST_ROW 217
-#define TK_BETWEEN 218
-#define TK_IS 219
-#define TK_NK_LT 220
-#define TK_NK_GT 221
-#define TK_NK_LE 222
-#define TK_NK_GE 223
-#define TK_NK_NE 224
-#define TK_MATCH 225
-#define TK_NMATCH 226
-#define TK_CONTAINS 227
-#define TK_IN 228
-#define TK_JOIN 229
-#define TK_INNER 230
-#define TK_SELECT 231
-#define TK_DISTINCT 232
-#define TK_WHERE 233
-#define TK_PARTITION 234
-#define TK_BY 235
-#define TK_SESSION 236
-#define TK_STATE_WINDOW 237
-#define TK_SLIDING 238
-#define TK_FILL 239
-#define TK_VALUE 240
-#define TK_NONE 241
-#define TK_PREV 242
-#define TK_LINEAR 243
-#define TK_NEXT 244
-#define TK_HAVING 245
-#define TK_RANGE 246
-#define TK_EVERY 247
-#define TK_ORDER 248
-#define TK_SLIMIT 249
-#define TK_SOFFSET 250
-#define TK_LIMIT 251
-#define TK_OFFSET 252
-#define TK_ASC 253
-#define TK_NULLS 254
-#define TK_ABORT 255
-#define TK_AFTER 256
-#define TK_ATTACH 257
-#define TK_BEFORE 258
-#define TK_BEGIN 259
-#define TK_BITAND 260
-#define TK_BITNOT 261
-#define TK_BITOR 262
-#define TK_BLOCKS 263
-#define TK_CHANGE 264
-#define TK_COMMA 265
-#define TK_COMPACT 266
-#define TK_CONCAT 267
-#define TK_CONFLICT 268
-#define TK_COPY 269
-#define TK_DEFERRED 270
-#define TK_DELIMITERS 271
-#define TK_DETACH 272
-#define TK_DIVIDE 273
-#define TK_DOT 274
-#define TK_EACH 275
-#define TK_END 276
-#define TK_FAIL 277
-#define TK_FILE 278
-#define TK_FOR 279
-#define TK_GLOB 280
-#define TK_ID 281
-#define TK_IMMEDIATE 282
-#define TK_IMPORT 283
-#define TK_INITIALLY 284
-#define TK_INSTEAD 285
-#define TK_ISNULL 286
-#define TK_KEY 287
-#define TK_NK_BITNOT 288
-#define TK_NK_SEMI 289
-#define TK_NOTNULL 290
-#define TK_OF 291
-#define TK_PLUS 292
-#define TK_PRIVILEGE 293
-#define TK_RAISE 294
-#define TK_REPLACE 295
-#define TK_RESTRICT 296
-#define TK_ROW 297
-#define TK_SEMI 298
-#define TK_STAR 299
-#define TK_STATEMENT 300
-#define TK_STRING 301
-#define TK_TIMES 302
-#define TK_UPDATE 303
-#define TK_VALUES 304
-#define TK_VARIABLE 305
-#define TK_VIEW 306
-#define TK_WAL 307
+#define TK_TSDB_PAGESIZE 74
+#define TK_PRECISION 75
+#define TK_REPLICA 76
+#define TK_STRICT 77
+#define TK_VGROUPS 78
+#define TK_SINGLE_STABLE 79
+#define TK_RETENTIONS 80
+#define TK_SCHEMALESS 81
+#define TK_WAL_LEVEL 82
+#define TK_WAL_FSYNC_PERIOD 83
+#define TK_WAL_RETENTION_PERIOD 84
+#define TK_WAL_RETENTION_SIZE 85
+#define TK_WAL_ROLL_PERIOD 86
+#define TK_WAL_SEGMENT_SIZE 87
+#define TK_STT_TRIGGER 88
+#define TK_TABLE_PREFIX 89
+#define TK_TABLE_SUFFIX 90
+#define TK_NK_COLON 91
+#define TK_TABLE 92
+#define TK_NK_LP 93
+#define TK_NK_RP 94
+#define TK_STABLE 95
+#define TK_ADD 96
+#define TK_COLUMN 97
+#define TK_MODIFY 98
+#define TK_RENAME 99
+#define TK_TAG 100
+#define TK_SET 101
+#define TK_NK_EQ 102
+#define TK_USING 103
+#define TK_TAGS 104
+#define TK_COMMENT 105
+#define TK_BOOL 106
+#define TK_TINYINT 107
+#define TK_SMALLINT 108
+#define TK_INT 109
+#define TK_INTEGER 110
+#define TK_BIGINT 111
+#define TK_FLOAT 112
+#define TK_DOUBLE 113
+#define TK_BINARY 114
+#define TK_TIMESTAMP 115
+#define TK_NCHAR 116
+#define TK_UNSIGNED 117
+#define TK_JSON 118
+#define TK_VARCHAR 119
+#define TK_MEDIUMBLOB 120
+#define TK_BLOB 121
+#define TK_VARBINARY 122
+#define TK_DECIMAL 123
+#define TK_MAX_DELAY 124
+#define TK_WATERMARK 125
+#define TK_ROLLUP 126
+#define TK_TTL 127
+#define TK_SMA 128
+#define TK_FIRST 129
+#define TK_LAST 130
+#define TK_SHOW 131
+#define TK_DATABASES 132
+#define TK_TABLES 133
+#define TK_STABLES 134
+#define TK_MNODES 135
+#define TK_MODULES 136
+#define TK_QNODES 137
+#define TK_FUNCTIONS 138
+#define TK_INDEXES 139
+#define TK_ACCOUNTS 140
+#define TK_APPS 141
+#define TK_CONNECTIONS 142
+#define TK_LICENCES 143
+#define TK_GRANTS 144
+#define TK_QUERIES 145
+#define TK_SCORES 146
+#define TK_TOPICS 147
+#define TK_VARIABLES 148
+#define TK_BNODES 149
+#define TK_SNODES 150
+#define TK_CLUSTER 151
+#define TK_TRANSACTIONS 152
+#define TK_DISTRIBUTED 153
+#define TK_CONSUMERS 154
+#define TK_SUBSCRIPTIONS 155
+#define TK_VNODES 156
+#define TK_LIKE 157
+#define TK_INDEX 158
+#define TK_FUNCTION 159
+#define TK_INTERVAL 160
+#define TK_TOPIC 161
+#define TK_AS 162
+#define TK_WITH 163
+#define TK_META 164
+#define TK_CONSUMER 165
+#define TK_GROUP 166
+#define TK_DESC 167
+#define TK_DESCRIBE 168
+#define TK_RESET 169
+#define TK_QUERY 170
+#define TK_CACHE 171
+#define TK_EXPLAIN 172
+#define TK_ANALYZE 173
+#define TK_VERBOSE 174
+#define TK_NK_BOOL 175
+#define TK_RATIO 176
+#define TK_NK_FLOAT 177
+#define TK_OUTPUTTYPE 178
+#define TK_AGGREGATE 179
+#define TK_BUFSIZE 180
+#define TK_STREAM 181
+#define TK_INTO 182
+#define TK_TRIGGER 183
+#define TK_AT_ONCE 184
+#define TK_WINDOW_CLOSE 185
+#define TK_IGNORE 186
+#define TK_EXPIRED 187
+#define TK_KILL 188
+#define TK_CONNECTION 189
+#define TK_TRANSACTION 190
+#define TK_BALANCE 191
+#define TK_VGROUP 192
+#define TK_MERGE 193
+#define TK_REDISTRIBUTE 194
+#define TK_SPLIT 195
+#define TK_DELETE 196
+#define TK_INSERT 197
+#define TK_NULL 198
+#define TK_NK_QUESTION 199
+#define TK_NK_ARROW 200
+#define TK_ROWTS 201
+#define TK_TBNAME 202
+#define TK_QSTART 203
+#define TK_QEND 204
+#define TK_QDURATION 205
+#define TK_WSTART 206
+#define TK_WEND 207
+#define TK_WDURATION 208
+#define TK_CAST 209
+#define TK_NOW 210
+#define TK_TODAY 211
+#define TK_TIMEZONE 212
+#define TK_CLIENT_VERSION 213
+#define TK_SERVER_VERSION 214
+#define TK_SERVER_STATUS 215
+#define TK_CURRENT_USER 216
+#define TK_COUNT 217
+#define TK_LAST_ROW 218
+#define TK_BETWEEN 219
+#define TK_IS 220
+#define TK_NK_LT 221
+#define TK_NK_GT 222
+#define TK_NK_LE 223
+#define TK_NK_GE 224
+#define TK_NK_NE 225
+#define TK_MATCH 226
+#define TK_NMATCH 227
+#define TK_CONTAINS 228
+#define TK_IN 229
+#define TK_JOIN 230
+#define TK_INNER 231
+#define TK_SELECT 232
+#define TK_DISTINCT 233
+#define TK_WHERE 234
+#define TK_PARTITION 235
+#define TK_BY 236
+#define TK_SESSION 237
+#define TK_STATE_WINDOW 238
+#define TK_SLIDING 239
+#define TK_FILL 240
+#define TK_VALUE 241
+#define TK_NONE 242
+#define TK_PREV 243
+#define TK_LINEAR 244
+#define TK_NEXT 245
+#define TK_HAVING 246
+#define TK_RANGE 247
+#define TK_EVERY 248
+#define TK_ORDER 249
+#define TK_SLIMIT 250
+#define TK_SOFFSET 251
+#define TK_LIMIT 252
+#define TK_OFFSET 253
+#define TK_ASC 254
+#define TK_NULLS 255
+#define TK_ABORT 256
+#define TK_AFTER 257
+#define TK_ATTACH 258
+#define TK_BEFORE 259
+#define TK_BEGIN 260
+#define TK_BITAND 261
+#define TK_BITNOT 262
+#define TK_BITOR 263
+#define TK_BLOCKS 264
+#define TK_CHANGE 265
+#define TK_COMMA 266
+#define TK_COMPACT 267
+#define TK_CONCAT 268
+#define TK_CONFLICT 269
+#define TK_COPY 270
+#define TK_DEFERRED 271
+#define TK_DELIMITERS 272
+#define TK_DETACH 273
+#define TK_DIVIDE 274
+#define TK_DOT 275
+#define TK_EACH 276
+#define TK_END 277
+#define TK_FAIL 278
+#define TK_FILE 279
+#define TK_FOR 280
+#define TK_GLOB 281
+#define TK_ID 282
+#define TK_IMMEDIATE 283
+#define TK_IMPORT 284
+#define TK_INITIALLY 285
+#define TK_INSTEAD 286
+#define TK_ISNULL 287
+#define TK_KEY 288
+#define TK_NK_BITNOT 289
+#define TK_NK_SEMI 290
+#define TK_NOTNULL 291
+#define TK_OF 292
+#define TK_PLUS 293
+#define TK_PRIVILEGE 294
+#define TK_RAISE 295
+#define TK_REPLACE 296
+#define TK_RESTRICT 297
+#define TK_ROW 298
+#define TK_SEMI 299
+#define TK_STAR 300
+#define TK_STATEMENT 301
+#define TK_STRING 302
+#define TK_TIMES 303
+#define TK_UPDATE 304
+#define TK_VALUES 305
+#define TK_VARIABLE 306
+#define TK_VIEW 307
+#define TK_WAL 308
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index ea70a42147..22e92b2e80 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -64,6 +64,7 @@ typedef struct SDatabaseOptions {
int64_t keep[3];
int32_t pages;
int32_t pagesize;
+ int32_t tsdbPageSize;
char precisionStr[3];
int8_t precision;
int8_t replica;
diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h
index 9c2fdf587b..6500d3d183 100644
--- a/include/libs/nodes/nodes.h
+++ b/include/libs/nodes/nodes.h
@@ -320,6 +320,9 @@ int32_t nodesStringToNode(const char* pStr, SNode** pNode);
int32_t nodesListToString(const SNodeList* pList, bool format, char** pStr, int32_t* pLen);
int32_t nodesStringToList(const char* pStr, SNodeList** pList);
+int32_t nodesNodeToMsg(const SNode* pNode, char** pMsg, int32_t* pLen);
+int32_t nodesMsgToNode(const char* pStr, int32_t len, SNode** pNode);
+
int32_t nodesNodeToSQL(SNode* pNode, char* buf, int32_t bufSize, int32_t* len);
char* nodesGetNameFromColumnNode(SNode* pNode);
int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots);
diff --git a/include/util/tdef.h b/include/util/tdef.h
index 57fde32bed..840a2671fa 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -300,6 +300,9 @@ typedef enum ELogicConditionType {
#define TSDB_DEFAULT_PAGES_PER_VNODE 256
#define TSDB_MIN_PAGESIZE_PER_VNODE 1 // unit KB
#define TSDB_MAX_PAGESIZE_PER_VNODE 16384
+#define TSDB_DEFAULT_TSDB_PAGESIZE 4
+#define TSDB_MIN_TSDB_PAGESIZE 1 // unit KB
+#define TSDB_MAX_TSDB_PAGESIZE 16384
#define TSDB_DEFAULT_PAGESIZE_PER_VNODE 4
#define TSDB_MIN_DAYS_PER_FILE 60 // unit minute
#define TSDB_MAX_DAYS_PER_FILE (3650 * 1440)
@@ -359,8 +362,8 @@ typedef enum ELogicConditionType {
#define TSDB_DB_SCHEMALESS_ON 1
#define TSDB_DB_SCHEMALESS_OFF 0
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
-#define TSDB_MIN_SST_TRIGGER 1
-#define TSDB_MAX_SST_TRIGGER 128
+#define TSDB_MIN_STT_TRIGGER 1
+#define TSDB_MAX_STT_TRIGGER 16
#define TSDB_DEFAULT_SST_TRIGGER 8
#define TSDB_MIN_HASH_PREFIX 0
#define TSDB_MAX_HASH_PREFIX 128
diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh
index c018a81158..794b3968fe 100755
--- a/packaging/testpackage.sh
+++ b/packaging/testpackage.sh
@@ -7,7 +7,6 @@ originPackageName=$3
originversion=$4
testFile=$5
subFile="taos.tar.gz"
-password=$6
# Color setting
RED='\033[41;30m'
@@ -233,15 +232,15 @@ cd ${installPath}
if [[ ${packgeName} =~ "Lite" ]] || ([[ ${packgeName} =~ "x64" ]] && [[ ${packgeName} =~ "client" ]]) || ([[ ${packgeName} =~ "deb" ]] && [[ ${packgeName} =~ "server" ]]) || ([[ ${packgeName} =~ "rpm" ]] && [[ ${packgeName} =~ "server" ]]) ;then
echoColor G "===== install taos-tools when package is lite or client ====="
cd ${installPath}
- wgetFile taosTools-2.1.2-Linux-x64.tar.gz .
- tar xf taosTools-2.1.2-Linux-x64.tar.gz
- cd taosTools-2.1.2 && bash install-taostools.sh
+ wgetFile taosTools-2.1.3-Linux-x64.tar.gz .
+ tar xf taosTools-2.1.3-Linux-x64.tar.gz
+ cd taosTools-2.1.3 && bash install-taostools.sh
elif ([[ ${packgeName} =~ "arm64" ]] && [[ ${packgeName} =~ "client" ]]);then
echoColor G "===== install taos-tools arm when package is arm64-client ====="
cd ${installPath}
- wgetFile taosTools-2.1.2-Linux-arm64.tar.gz .
- tar xf taosTools-2.1.2-Linux-arm64.tar.gz
- cd taosTools-2.1.2 && bash install-taostools.sh
+ wgetFile taosTools-2.1.3-Linux-arm64.tar.gz .
+ tar xf taosTools-2.1.3-Linux-arm64.tar.gz
+ cd taosTools-2.1.3 && bash install-taostools.sh
fi
echoColor G "===== start TDengine ====="
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index f77320c5ac..496806d877 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -102,9 +102,10 @@ static const SSysDbTableSchema userDBSchema[] = {
{.name = "wal_retention_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
{.name = "wal_roll_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
{.name = "wal_segment_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
- {.name = "sst_trigger", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
+ {.name = "stt_trigger", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
{.name = "table_prefix", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
{.name = "table_suffix", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
+ {.name = "tsdb_pagesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
};
static const SSysDbTableSchema userFuncSchema[] = {
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index ea25094d10..cbd6bc3ed7 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -2038,6 +2038,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
if (tEncodeI8(&encoder, pRetension->freqUnit) < 0) return -1;
if (tEncodeI8(&encoder, pRetension->keepUnit) < 0) return -1;
}
+ if (tEncodeI32(&encoder, pReq->tsdbPageSize) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@@ -2098,6 +2099,8 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
}
}
+ if (tDecodeI32(&decoder, &pReq->tsdbPageSize) < 0) return -1;
+
tEndDecode(&decoder);
tDecoderClear(&decoder);
@@ -3779,6 +3782,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
if (tEncodeI16(&encoder, pReq->sstTrigger) < 0) return -1;
if (tEncodeI16(&encoder, pReq->hashPrefix) < 0) return -1;
if (tEncodeI16(&encoder, pReq->hashSuffix) < 0) return -1;
+ if (tEncodeI32(&encoder, pReq->tsdbPageSize) < 0) return -1;
tEndEncode(&encoder);
@@ -3854,6 +3858,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
if (tDecodeI16(&decoder, &pReq->sstTrigger) < 0) return -1;
if (tDecodeI16(&decoder, &pReq->hashPrefix) < 0) return -1;
if (tDecodeI16(&decoder, &pReq->hashSuffix) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->tsdbPageSize) < 0) return -1;
tEndDecode(&decoder);
tDecoderClear(&decoder);
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
index 830bf9523a..e3ad1b9389 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
@@ -167,12 +167,13 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
pCfg->walCfg.segSize = pCreate->walSegmentSize;
pCfg->walCfg.level = pCreate->walLevel;
- pCfg->sstTrigger = pCreate->sstTrigger;
+ pCfg->sttTrigger = pCreate->sstTrigger;
pCfg->hashBegin = pCreate->hashBegin;
pCfg->hashEnd = pCreate->hashEnd;
pCfg->hashMethod = pCreate->hashMethod;
pCfg->hashPrefix = pCreate->hashPrefix;
pCfg->hashSuffix = pCreate->hashSuffix;
+ pCfg->tsdbPageSize = pCreate->tsdbPageSize * 1024;
pCfg->standby = pCfg->standby;
pCfg->syncCfg.myIndex = pCreate->selfIndex;
@@ -222,11 +223,13 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return -1;
}
- dInfo("vgId:%d, start to create vnode, tsma:%d standby:%d cacheLast:%d cacheLastSize:%d sstTrigger:%d",
- createReq.vgId, createReq.isTsma, createReq.standby, createReq.cacheLast, createReq.cacheLastSize,
- createReq.sstTrigger);
+ dInfo(
+ "vgId:%d, start to create vnode, tsma:%d standby:%d cacheLast:%d cacheLastSize:%d sstTrigger:%d "
+ "tsdbPageSize:%d",
+ createReq.vgId, createReq.isTsma, createReq.standby, createReq.cacheLast, createReq.cacheLastSize,
+ createReq.sstTrigger, createReq.tsdbPageSize);
dInfo("vgId:%d, hashMethod:%d begin:%u end:%u prefix:%d surfix:%d", createReq.vgId, createReq.hashMethod,
- createReq.hashBegin, createReq.hashEnd, createReq.hashPrefix, createReq.hashSuffix);
+ createReq.hashBegin, createReq.hashEnd, createReq.hashPrefix, createReq.hashSuffix);
vmGenerateVnodeCfg(&createReq, &vnodeCfg);
if (vmTsmaAdjustDays(&vnodeCfg, &createReq) < 0) {
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 9632be1b24..cd08ee4ad5 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -308,6 +308,7 @@ typedef struct {
int16_t hashPrefix;
int16_t hashSuffix;
int16_t sstTrigger;
+ int32_t tsdbPageSize;
int32_t numOfRetensions;
SArray* pRetensions;
int32_t walRetentionPeriod;
diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c
index 7e2dd80c7b..d42ba1f7ff 100644
--- a/source/dnode/mnode/impl/src/mndDb.c
+++ b/source/dnode/mnode/impl/src/mndDb.c
@@ -31,7 +31,7 @@
#include "systable.h"
#define DB_VER_NUMBER 1
-#define DB_RESERVE_SIZE 58
+#define DB_RESERVE_SIZE 54
static SSdbRaw *mndDbActionEncode(SDbObj *pDb);
static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw);
@@ -128,6 +128,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
SDB_SET_INT16(pRaw, dataPos, pDb->cfg.sstTrigger, _OVER)
SDB_SET_INT16(pRaw, dataPos, pDb->cfg.hashPrefix, _OVER)
SDB_SET_INT16(pRaw, dataPos, pDb->cfg.hashSuffix, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pDb->cfg.tsdbPageSize, _OVER)
SDB_SET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER)
SDB_SET_DATALEN(pRaw, dataPos, _OVER)
@@ -214,10 +215,20 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT16(pRaw, dataPos, &pDb->cfg.sstTrigger, _OVER)
SDB_GET_INT16(pRaw, dataPos, &pDb->cfg.hashPrefix, _OVER)
SDB_GET_INT16(pRaw, dataPos, &pDb->cfg.hashSuffix, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.tsdbPageSize, _OVER)
SDB_GET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER)
taosInitRWLatch(&pDb->lock);
+ if (pDb->cfg.tsdbPageSize <= TSDB_MIN_TSDB_PAGESIZE) {
+ mInfo("db:%s, tsdbPageSize set from %d to default %d", pDb->name, pDb->cfg.tsdbPageSize,
+ TSDB_DEFAULT_TSDB_PAGESIZE);
+ }
+
+ if (pDb->cfg.sstTrigger <= TSDB_MIN_STT_TRIGGER) {
+ mInfo("db:%s, sstTrigger set from %d to default %d", pDb->name, pDb->cfg.sstTrigger, TSDB_DEFAULT_SST_TRIGGER);
+ }
+
terrno = 0;
_OVER:
@@ -262,6 +273,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
pOld->cfg.cacheLast = pNew->cfg.cacheLast;
pOld->cfg.replications = pNew->cfg.replications;
pOld->cfg.sstTrigger = pNew->cfg.sstTrigger;
+ pOld->cfg.tsdbPageSize = pNew->cfg.tsdbPageSize;
taosWUnLockLatch(&pOld->lock);
return 0;
}
@@ -338,9 +350,10 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
if (pCfg->walRetentionSize < TSDB_DB_MIN_WAL_RETENTION_SIZE) return -1;
if (pCfg->walRollPeriod < TSDB_DB_MIN_WAL_ROLL_PERIOD) return -1;
if (pCfg->walSegmentSize < TSDB_DB_MIN_WAL_SEGMENT_SIZE) return -1;
- if (pCfg->sstTrigger < TSDB_MIN_SST_TRIGGER || pCfg->sstTrigger > TSDB_MAX_SST_TRIGGER) return -1;
+ if (pCfg->sstTrigger < TSDB_MIN_STT_TRIGGER || pCfg->sstTrigger > TSDB_MAX_STT_TRIGGER) return -1;
if (pCfg->hashPrefix < TSDB_MIN_HASH_PREFIX || pCfg->hashPrefix > TSDB_MAX_HASH_PREFIX) return -1;
if (pCfg->hashSuffix < TSDB_MIN_HASH_SUFFIX || pCfg->hashSuffix > TSDB_MAX_HASH_SUFFIX) return -1;
+ if (pCfg->tsdbPageSize < TSDB_MIN_TSDB_PAGESIZE || pCfg->tsdbPageSize > TSDB_MAX_TSDB_PAGESIZE) return -1;
terrno = 0;
return terrno;
@@ -377,6 +390,7 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if (pCfg->sstTrigger <= 0) pCfg->sstTrigger = TSDB_DEFAULT_SST_TRIGGER;
if (pCfg->hashPrefix < 0) pCfg->hashPrefix = TSDB_DEFAULT_HASH_PREFIX;
if (pCfg->hashSuffix < 0) pCfg->hashSuffix = TSDB_DEFAULT_HASH_SUFFIX;
+ if (pCfg->tsdbPageSize <= 0) pCfg->tsdbPageSize = TSDB_DEFAULT_TSDB_PAGESIZE;
}
static int32_t mndSetCreateDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroups) {
@@ -496,6 +510,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
.sstTrigger = pCreate->sstTrigger,
.hashPrefix = pCreate->hashPrefix,
.hashSuffix = pCreate->hashSuffix,
+ .tsdbPageSize = pCreate->tsdbPageSize,
};
dbObj.cfg.numOfRetensions = pCreate->numOfRetensions;
@@ -1726,6 +1741,9 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.hashSuffix, false);
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.tsdbPageSize, false);
}
taosMemoryFree(buf);
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index 3bfd7eb596..511a84290d 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -319,7 +319,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
bool multiTarget = pDbObj->cfg.numOfVgroups > 1;
- if (planTotLevel == 2 || externalTargetDB || multiTarget) {
+ if (planTotLevel == 2 || externalTargetDB || multiTarget || pStream->fixedSinkVgId) {
/*if (true) {*/
SArray* taskOneLevel = taosArrayInit(0, sizeof(void*));
taosArrayPush(pStream->tasks, &taskOneLevel);
diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c
index de29dea511..a95bdef323 100644
--- a/source/dnode/mnode/impl/src/mndVgroup.c
+++ b/source/dnode/mnode/impl/src/mndVgroup.c
@@ -237,6 +237,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
createReq.sstTrigger = pDb->cfg.sstTrigger;
createReq.hashPrefix = pDb->cfg.hashPrefix;
createReq.hashSuffix = pDb->cfg.hashSuffix;
+ createReq.tsdbPageSize = pDb->cfg.tsdbPageSize;
for (int32_t v = 0; v < pVgroup->replica; ++v) {
SReplica *pReplica = &createReq.replicas[v];
diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h
index 8e545eb527..6ba10641f5 100644
--- a/source/dnode/vnode/inc/vnode.h
+++ b/source/dnode/vnode/inc/vnode.h
@@ -125,6 +125,9 @@ int32_t metaTbCursorNext(SMTbCursor *pTbCur);
// typedef struct STsdb STsdb;
typedef struct STsdbReader STsdbReader;
+#define TSDB_DEFAULT_STT_FILE 8
+#define TSDB_DEFAULT_PAGE_SIZE 4096
+
#define TIMEWINDOW_RANGE_CONTAINED 1
#define TIMEWINDOW_RANGE_EXTERNAL 2
@@ -288,9 +291,10 @@ struct SVnodeCfg {
SVnodeStats vndStats;
uint32_t hashBegin;
uint32_t hashEnd;
- int16_t sstTrigger;
+ int16_t sttTrigger;
int16_t hashPrefix;
int16_t hashSuffix;
+ int32_t tsdbPageSize;
};
typedef struct {
diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h
index 165f5da4b6..9931462e5f 100644
--- a/source/dnode/vnode/src/inc/sma.h
+++ b/source/dnode/vnode/src/inc/sma.h
@@ -113,8 +113,9 @@ struct SRSmaStat {
volatile int64_t nBufItems; // number of items in queue buffer
SRWLatch lock; // r/w lock for rsma fs(e.g. qtaskinfo)
volatile int32_t nFetchAll; // active number of fetch all
- int8_t triggerStat; // shared by fetch tasks
- int8_t commitStat; // 0 not in committing, 1 in committing
+ volatile int8_t triggerStat; // shared by fetch tasks
+ volatile int8_t commitStat; // 0 not in committing, 1 in committing
+ volatile int8_t delFlag; // 0 no deleted SRSmaInfo, 1 has deleted SRSmaInfo
SRSmaFS fs; // for recovery/snapshot r/w
SHashObj *infoHash; // key: suid, value: SRSmaInfo
tsem_t notEmpty; // has items in queue buffer
@@ -142,7 +143,7 @@ struct SRSmaInfoItem {
int8_t level : 4;
int8_t fetchLevel : 4;
int8_t triggerStat;
- uint16_t nSkipped;
+ uint16_t nScanned;
int32_t maxDelay; // ms
tmr_h tmrId;
};
@@ -196,16 +197,21 @@ typedef enum {
int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType);
void tdDestroySmaEnv(SSmaEnv *pSmaEnv);
void *tdFreeSmaEnv(SSmaEnv *pSmaEnv);
-int32_t tdRefSmaStat(SSma *pSma, SSmaStat *pStat);
-int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat);
int32_t tdLockSma(SSma *pSma);
int32_t tdUnLockSma(SSma *pSma);
void *tdAcquireSmaRef(int32_t rsetId, int64_t refId);
int32_t tdReleaseSmaRef(int32_t rsetId, int64_t refId);
+static FORCE_INLINE void tdRefSmaStat(SSma *pSma, SSmaStat *pStat) {
+ int32_t ref = T_REF_INC(pStat);
+ smaDebug("vgId:%d, ref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
+}
+static FORCE_INLINE void tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
+ int32_t ref = T_REF_DEC(pStat);
+ smaDebug("vgId:%d, unref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
+}
+
// rsma
-int32_t tdRefRSmaInfo(SSma *pSma, SRSmaInfo *pRSmaInfo);
-int32_t tdUnRefRSmaInfo(SSma *pSma, SRSmaInfo *pRSmaInfo);
void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo, bool isDeepFree);
int32_t tdRSmaFSOpen(SSma *pSma, int64_t version);
void tdRSmaFSClose(SRSmaFS *fs);
@@ -218,9 +224,17 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type);
int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash);
int32_t tdRSmaProcessRestoreImpl(SSma *pSma, int8_t type, int64_t qtaskFileVer);
+void tdRSmaQTaskInfoGetFileName(int32_t vid, int64_t version, char *outputName);
+void tdRSmaQTaskInfoGetFullName(int32_t vid, int64_t version, const char *path, char *outputName);
-void tdRSmaQTaskInfoGetFileName(int32_t vid, int64_t version, char *outputName);
-void tdRSmaQTaskInfoGetFullName(int32_t vid, int64_t version, const char *path, char *outputName);
+static FORCE_INLINE void tdRefRSmaInfo(SSma *pSma, SRSmaInfo *pRSmaInfo) {
+ int32_t ref = T_REF_INC(pRSmaInfo);
+ smaDebug("vgId:%d, ref rsma info:%p, val:%d", SMA_VID(pSma), pRSmaInfo, ref);
+}
+static FORCE_INLINE void tdUnRefRSmaInfo(SSma *pSma, SRSmaInfo *pRSmaInfo) {
+ int32_t ref = T_REF_DEC(pRSmaInfo);
+ smaDebug("vgId:%d, unref rsma info:%p, val:%d", SMA_VID(pSma), pRSmaInfo, ref);
+}
// smaFileUtil ================
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index 8bca22fea1..a836fa2bc5 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -67,12 +67,9 @@ typedef struct SBlockCol SBlockCol;
typedef struct SVersionRange SVersionRange;
typedef struct SLDataIter SLDataIter;
-#define TSDB_FILE_DLMT ((uint32_t)0xF00AFA0F)
-#define TSDB_MAX_SUBBLOCKS 8
-#define TSDB_MAX_STT_FILE 16
-#define TSDB_DEFAULT_STT_FILE 8
-#define TSDB_FHDR_SIZE 512
-#define TSDB_DEFAULT_PAGE_SIZE 4096
+#define TSDB_FILE_DLMT ((uint32_t)0xF00AFA0F)
+#define TSDB_MAX_SUBBLOCKS 8
+#define TSDB_FHDR_SIZE 512
#define HAS_NONE ((int8_t)0x1)
#define HAS_NULL ((int8_t)0x2)
@@ -84,13 +81,26 @@ typedef struct SLDataIter SLDataIter;
#define TSDBKEY_MIN ((TSDBKEY){.ts = TSKEY_MIN, .version = VERSION_MIN})
#define TSDBKEY_MAX ((TSDBKEY){.ts = TSKEY_MAX, .version = VERSION_MAX})
+#define TABLE_SAME_SCHEMA(SUID1, UID1, SUID2, UID2) ((SUID1) ? (SUID1) == (SUID2) : (UID1) == (UID2))
+
#define PAGE_CONTENT_SIZE(PAGE) ((PAGE) - sizeof(TSCKSUM))
#define LOGIC_TO_FILE_OFFSET(LOFFSET, PAGE) \
((LOFFSET) / PAGE_CONTENT_SIZE(PAGE) * (PAGE) + (LOFFSET) % PAGE_CONTENT_SIZE(PAGE))
#define FILE_TO_LOGIC_OFFSET(OFFSET, PAGE) ((OFFSET) / (PAGE)*PAGE_CONTENT_SIZE(PAGE) + (OFFSET) % (PAGE))
#define PAGE_OFFSET(PGNO, PAGE) (((PGNO)-1) * (PAGE))
#define OFFSET_PGNO(OFFSET, PAGE) ((OFFSET) / (PAGE) + 1)
-#define LOGIC_TO_FILE_SIZE(LSIZE, PAGE) OFFSET_PGNO(LOGIC_TO_FILE_OFFSET(LSIZE, PAGE), PAGE) * (PAGE)
+
+static FORCE_INLINE int64_t tsdbLogicToFileSize(int64_t lSize, int32_t szPage) {
+ int64_t fOffSet = LOGIC_TO_FILE_OFFSET(lSize, szPage);
+ int64_t pgno = OFFSET_PGNO(fOffSet, szPage);
+ int32_t szPageCont = PAGE_CONTENT_SIZE(szPage);
+
+ if (fOffSet % szPageCont == 0) {
+ pgno--;
+ }
+
+ return pgno * szPage;
+}
// tsdbUtil.c ==============================================================================================
// TSDBROW
@@ -262,7 +272,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS
int32_t tsdbDataFWriterClose(SDataFWriter **ppWriter, int8_t sync);
int32_t tsdbUpdateDFileSetHeader(SDataFWriter *pWriter);
int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SArray *aBlockIdx);
-int32_t tsdbWriteBlock(SDataFWriter *pWriter, SMapData *pMapData, SBlockIdx *pBlockIdx);
+int32_t tsdbWriteDataBlk(SDataFWriter *pWriter, SMapData *mDataBlk, SBlockIdx *pBlockIdx);
int32_t tsdbWriteSttBlk(SDataFWriter *pWriter, SArray *aSttBlk);
int32_t tsdbWriteBlockData(SDataFWriter *pWriter, SBlockData *pBlockData, SBlockInfo *pBlkInfo, SSmaInfo *pSmaInfo,
int8_t cmprAlg, int8_t toLast);
@@ -272,7 +282,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo);
int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pSet);
int32_t tsdbDataFReaderClose(SDataFReader **ppReader);
int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx);
-int32_t tsdbReadBlock(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *pMapData);
+int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *mDataBlk);
int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk);
int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pBlock, SArray *aColumnDataAgg);
int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pBlock, SBlockData *pBlockData);
@@ -572,7 +582,7 @@ struct SDFileSet {
SDataFile *pDataF;
SSmaFile *pSmaF;
uint8_t nSttF;
- SSttFile *aSttF[TSDB_MAX_STT_FILE];
+ SSttFile *aSttF[TSDB_MAX_STT_TRIGGER];
};
struct SRowIter {
@@ -622,7 +632,7 @@ struct SDataFWriter {
SHeadFile fHead;
SDataFile fData;
SSmaFile fSma;
- SSttFile fStt[TSDB_MAX_STT_FILE];
+ SSttFile fStt[TSDB_MAX_STT_TRIGGER];
uint8_t *aBuf[4];
};
@@ -633,7 +643,7 @@ struct SDataFReader {
STsdbFD *pHeadFD;
STsdbFD *pDataFD;
STsdbFD *pSmaFD;
- STsdbFD *aSttFD[TSDB_MAX_STT_FILE];
+ STsdbFD *aSttFD[TSDB_MAX_STT_TRIGGER];
uint8_t *aBuf[3];
};
@@ -644,31 +654,41 @@ typedef struct {
} SRowInfo;
typedef struct SSttBlockLoadInfo {
- SBlockData blockData[2];
- SArray *aSttBlk;
- int32_t blockIndex[2]; // to denote the loaded block in the corresponding position.
- int32_t currentLoadBlockIndex;
+ SBlockData blockData[2];
+ SArray *aSttBlk;
+ int32_t blockIndex[2]; // to denote the loaded block in the corresponding position.
+ int32_t currentLoadBlockIndex;
+ int32_t loadBlocks;
+ double elapsedTime;
} SSttBlockLoadInfo;
typedef struct SMergeTree {
- int8_t backward;
- SRBTree rbt;
- SArray *pIterList;
- SLDataIter *pIter;
- bool destroyLoadInfo;
- SSttBlockLoadInfo* pLoadInfo;
+ int8_t backward;
+ SRBTree rbt;
+ SArray *pIterList;
+ SLDataIter *pIter;
+ bool destroyLoadInfo;
+ SSttBlockLoadInfo *pLoadInfo;
+ const char *idStr;
} SMergeTree;
+typedef struct {
+ int64_t suid;
+ int64_t uid;
+ STSchema *pTSchema;
+} SSkmInfo;
+
int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFReader, uint64_t suid, uint64_t uid,
- STimeWindow *pTimeWindow, SVersionRange *pVerRange, void* pLoadInfo);
+ STimeWindow *pTimeWindow, SVersionRange *pVerRange, void *pLoadInfo, const char *idStr);
void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter);
bool tMergeTreeNext(SMergeTree *pMTree);
TSDBROW tMergeTreeGetRow(SMergeTree *pMTree);
void tMergeTreeClose(SMergeTree *pMTree);
-SSttBlockLoadInfo* tCreateLastBlockLoadInfo();
-void resetLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo);
-void* destroyLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo);
+SSttBlockLoadInfo *tCreateLastBlockLoadInfo();
+void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo);
+void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double *el);
+void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo);
// ========== inline functions ==========
static FORCE_INLINE int32_t tsdbKeyCmprFn(const void *p1, const void *p2) {
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 62aba649a3..0e85e7bfb6 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -104,7 +104,7 @@ int metaCreateSTable(SMeta* pMeta, int64_t version, SVCreateStbReq*
int metaAlterSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq);
int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq, SArray* tbUidList);
int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq, STableMetaRsp** pMetaRsp);
-int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids, int64_t *tbUid);
+int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids, int64_t* tbUid);
int metaTtlDropTable(SMeta* pMeta, int64_t ttl, SArray* tbUids);
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, bool isinline);
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index 2c11b9bf0f..22ec8118a2 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -244,6 +244,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
// check if super table exists
rc = tdbTbGet(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, &pData, &nData);
if (rc < 0 || *(tb_uid_t *)pData != pReq->suid) {
+ tdbFree(pData);
terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
return -1;
}
@@ -309,7 +310,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
int64_t oversion;
SDecoder dc = {0};
int32_t ret;
- int32_t c;
+ int32_t c = -2;
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, &pMeta->txn);
ret = tdbTbcMoveTo(pUidIdxc, &pReq->suid, sizeof(tb_uid_t), &c);
@@ -416,20 +417,22 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq, STableMe
me.ctbEntry.pTags = pReq->ctb.pTag;
#ifdef TAG_FILTER_DEBUG
- SArray* pTagVals = NULL;
- int32_t code = tTagToValArray((STag*)pReq->ctb.pTag, &pTagVals);
+ SArray *pTagVals = NULL;
+ int32_t code = tTagToValArray((STag *)pReq->ctb.pTag, &pTagVals);
for (int i = 0; i < taosArrayGetSize(pTagVals); i++) {
- STagVal* pTagVal = (STagVal*)taosArrayGet(pTagVals, i);
+ STagVal *pTagVal = (STagVal *)taosArrayGet(pTagVals, i);
if (IS_VAR_DATA_TYPE(pTagVal->type)) {
- char* buf = taosMemoryCalloc(pTagVal->nData + 1, 1);
+ char *buf = taosMemoryCalloc(pTagVal->nData + 1, 1);
memcpy(buf, pTagVal->pData, pTagVal->nData);
- metaDebug("metaTag table:%s varchar index:%d cid:%d type:%d value:%s", pReq->name, i, pTagVal->cid, pTagVal->type, buf);
+ metaDebug("metaTag table:%s varchar index:%d cid:%d type:%d value:%s", pReq->name, i, pTagVal->cid,
+ pTagVal->type, buf);
taosMemoryFree(buf);
} else {
double val = 0;
GET_TYPED_DATA(val, double, pTagVal->type, &pTagVal->i64);
- metaDebug("metaTag table:%s number index:%d cid:%d type:%d value:%f", pReq->name, i, pTagVal->cid, pTagVal->type, val);
+ metaDebug("metaTag table:%s number index:%d cid:%d type:%d value:%f", pReq->name, i, pTagVal->cid,
+ pTagVal->type, val);
}
}
#endif
diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c
index f08cefdb04..07ec7d0694 100644
--- a/source/dnode/vnode/src/sma/smaCommit.c
+++ b/source/dnode/vnode/src/sma/smaCommit.c
@@ -210,15 +210,18 @@ static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pStat) {
}
if (fsMaxVer < committed) {
- SQTaskFile qFile = {.nRef = 1, .padding = 0, .version = committed, .size = 0};
- if (taosArrayPush(pFS->aQTaskInf, &qFile) < 0) {
- taosWUnLockLatch(RSMA_FS_LOCK(pStat));
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return TSDB_CODE_FAILED;
+ tdRSmaQTaskInfoGetFullName(TD_VID(pVnode), committed, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFullName);
+ if (taosCheckExistFile(qTaskInfoFullName)) {
+ SQTaskFile qFile = {.nRef = 1, .padding = 0, .version = committed, .size = 0};
+ if (taosArrayPush(pFS->aQTaskInf, &qFile) < 0) {
+ taosWUnLockLatch(RSMA_FS_LOCK(pStat));
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return TSDB_CODE_FAILED;
+ }
}
} else {
smaDebug("vgId:%d, update qinf, no need as committed %" PRIi64 " not larger than fsMaxVer %" PRIi64, TD_VID(pVnode),
- committed, fsMaxVer);
+ committed, fsMaxVer);
}
taosWUnLockLatch(RSMA_FS_LOCK(pStat));
@@ -314,12 +317,12 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
if (tdRSmaPersistExecImpl(pRSmaStat, RSMA_INFO_HASH(pRSmaStat)) < 0) {
return TSDB_CODE_FAILED;
}
- smaInfo("vgId:%d, rsma commit, operator state commited, TID:%p", SMA_VID(pSma), (void *)taosGetSelfPthreadId());
+ smaInfo("vgId:%d, rsma commit, operator state committed, TID:%p", SMA_VID(pSma), (void *)taosGetSelfPthreadId());
#if 0 // consuming task of qTaskInfo clone
// step 4: swap queue/qall and iQueue/iQall
// lock
- // taosWLockLatch(SMA_ENV_LOCK(pEnv));
+ taosWLockLatch(SMA_ENV_LOCK(pEnv));
ASSERT(RSMA_INFO_HASH(pRSmaStat));
@@ -335,7 +338,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
}
// unlock
- // taosWUnLockLatch(SMA_ENV_LOCK(pEnv));
+ taosWUnLockLatch(SMA_ENV_LOCK(pEnv));
#endif
return TSDB_CODE_SUCCESS;
@@ -380,25 +383,26 @@ static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma) {
// step 1: merge qTaskInfo and iQTaskInfo
// lock
- // taosWLockLatch(SMA_ENV_LOCK(pEnv));
+ if (1 == atomic_val_compare_exchange_8(&pRSmaStat->delFlag, 1, 0)) {
+ taosWLockLatch(SMA_ENV_LOCK(pEnv));
- void *pIter = NULL;
- while ((pIter = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), pIter))) {
- tb_uid_t *pSuid = (tb_uid_t *)taosHashGetKey(pIter, NULL);
- SRSmaInfo *pRSmaInfo = *(SRSmaInfo **)pIter;
- if (RSMA_INFO_IS_DEL(pRSmaInfo)) {
- int32_t refVal = T_REF_VAL_GET(pRSmaInfo);
- if (refVal == 0) {
- taosHashRemove(RSMA_INFO_HASH(pRSmaStat), pSuid, sizeof(*pSuid));
- } else {
- smaDebug(
- "vgId:%d, rsma async post commit, not free rsma info since ref is %d although already deleted for "
- "table:%" PRIi64,
- SMA_VID(pSma), refVal, *pSuid);
+ void *pIter = NULL;
+ while ((pIter = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), pIter))) {
+ tb_uid_t *pSuid = (tb_uid_t *)taosHashGetKey(pIter, NULL);
+ SRSmaInfo *pRSmaInfo = *(SRSmaInfo **)pIter;
+ if (RSMA_INFO_IS_DEL(pRSmaInfo)) {
+ int32_t refVal = T_REF_VAL_GET(pRSmaInfo);
+ if (refVal == 0) {
+ taosHashRemove(RSMA_INFO_HASH(pRSmaStat), pSuid, sizeof(*pSuid));
+ } else {
+ smaDebug(
+ "vgId:%d, rsma async post commit, not free rsma info since ref is %d although already deleted for "
+ "table:%" PRIi64,
+ SMA_VID(pSma), refVal, *pSuid);
+ }
+
+ continue;
}
-
- continue;
- }
#if 0
if (pRSmaInfo->taskInfo[0]) {
if (pRSmaInfo->iTaskInfo[0]) {
@@ -413,10 +417,11 @@ static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma) {
taosHashPut(RSMA_INFO_HASH(pRSmaStat), pSuid, sizeof(tb_uid_t), pIter, sizeof(pIter));
smaDebug("vgId:%d, rsma async post commit, migrated from iRsmaInfoHash for table:%" PRIi64, SMA_VID(pSma), *pSuid);
#endif
- }
+ }
- // unlock
- // taosWUnLockLatch(SMA_ENV_LOCK(pEnv));
+ // unlock
+ taosWUnLockLatch(SMA_ENV_LOCK(pEnv));
+ }
tdUpdateQTaskInfoFiles(pSma, pRSmaStat);
diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c
index 2595a629ba..b870ea1b62 100644
--- a/source/dnode/vnode/src/sma/smaEnv.c
+++ b/source/dnode/vnode/src/sma/smaEnv.c
@@ -177,39 +177,6 @@ void *tdFreeSmaEnv(SSmaEnv *pSmaEnv) {
return NULL;
}
-int32_t tdRefSmaStat(SSma *pSma, SSmaStat *pStat) {
- if (!pStat) return 0;
-
- int ref = T_REF_INC(pStat);
- smaDebug("vgId:%d, ref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
- return 0;
-}
-
-int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
- if (!pStat) return 0;
-
- int ref = T_REF_DEC(pStat);
- smaDebug("vgId:%d, unref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
- return 0;
-}
-
-int32_t tdRefRSmaInfo(SSma *pSma, SRSmaInfo *pRSmaInfo) {
- if (!pRSmaInfo) return 0;
-
- int ref = T_REF_INC(pRSmaInfo);
- smaDebug("vgId:%d, ref rsma info:%p, val:%d", SMA_VID(pSma), pRSmaInfo, ref);
- return 0;
-}
-
-int32_t tdUnRefRSmaInfo(SSma *pSma, SRSmaInfo *pRSmaInfo) {
- if (!pRSmaInfo) return 0;
-
- int ref = T_REF_DEC(pRSmaInfo);
- smaDebug("vgId:%d, unref rsma info:%p, val:%d", SMA_VID(pSma), pRSmaInfo, ref);
-
- return 0;
-}
-
static void tRSmaInfoHashFreeNode(void *data) {
SRSmaInfo *pRSmaInfo = NULL;
SRSmaInfoItem *pItem = NULL;
@@ -492,6 +459,8 @@ static int32_t tdRsmaStopExecutor(const SSma *pSma) {
taosThreadJoin(pthread[i], NULL);
}
}
+
+ smaInfo("vgId:%d, rsma executor stopped, number:%d", SMA_VID(pSma), tsNumOfVnodeRsmaThreads);
}
return 0;
}
\ No newline at end of file
diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c
index 920d04bf6c..ec8fcb2932 100644
--- a/source/dnode/vnode/src/sma/smaRollup.c
+++ b/source/dnode/vnode/src/sma/smaRollup.c
@@ -19,7 +19,7 @@
#define RSMA_QTASKINFO_HEAD_LEN (sizeof(int32_t) + sizeof(int8_t) + sizeof(int64_t)) // len + type + suid
#define RSMA_QTASKEXEC_SMOOTH_SIZE (100) // cnt
#define RSMA_SUBMIT_BATCH_SIZE (1024) // cnt
-#define RSMA_FETCH_DELAY_MAX (900000) // ms
+#define RSMA_FETCH_DELAY_MAX (120000) // ms
#define RSMA_FETCH_ACTIVE_MAX (1000) // ms
#define RSMA_FETCH_INTERVAL (5000) // ms
@@ -302,7 +302,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
return TSDB_CODE_FAILED;
}
SRSmaInfoItem *pItem = &(pRSmaInfo->items[idx]);
- pItem->triggerStat = TASK_TRIGGER_STAT_INACTIVE;
+ pItem->triggerStat = TASK_TRIGGER_STAT_ACTIVE; // fetch the data when reboot
if (param->maxdelay[idx] < TSDB_MIN_ROLLUP_MAX_DELAY) {
int64_t msInterval =
convertTimeFromPrecisionToUnit(pRetention[idx + 1].freq, pTsdbCfg->precision, TIME_UNIT_MILLISECOND);
@@ -320,7 +320,9 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
SRSmaRef rsmaRef = {.refId = pStat->refId, .suid = pRSmaInfo->suid};
taosHashPut(smaMgmt.refHash, &pItem, POINTER_BYTES, &rsmaRef, sizeof(rsmaRef));
- taosTmrReset(tdRSmaFetchTrigger, pItem->maxDelay, pItem, smaMgmt.tmrHandle, &pItem->tmrId);
+ pItem->fetchLevel = pItem->level;
+ taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId);
+
smaInfo("vgId:%d, item:%p table:%" PRIi64 " level:%" PRIi8 " maxdelay:%" PRIi64 " watermark:%" PRIi64
", finally maxdelay:%" PRIi32,
@@ -470,6 +472,7 @@ int32_t tdProcessRSmaDrop(SSma *pSma, SVDropStbReq *pReq) {
}
// set del flag for data in mem
+ atomic_store_8(&pRSmaStat->delFlag, 1);
RSMA_INFO_SET_DEL(pRSmaInfo);
tdUnRefRSmaInfo(pSma, pRSmaInfo);
@@ -939,25 +942,25 @@ static SRSmaInfo *tdAcquireRSmaInfoBySuid(SSma *pSma, int64_t suid) {
return NULL;
}
- // taosRLockLatch(SMA_ENV_LOCK(pEnv));
+ taosRLockLatch(SMA_ENV_LOCK(pEnv));
pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &suid, sizeof(tb_uid_t));
if (pRSmaInfo && (pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) {
if (RSMA_INFO_IS_DEL(pRSmaInfo)) {
- // taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
+ taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
return NULL;
}
if (!pRSmaInfo->taskInfo[0]) {
if (tdRSmaInfoClone(pSma, pRSmaInfo) < 0) {
- // taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
+ taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
return NULL;
}
}
tdRefRSmaInfo(pSma, pRSmaInfo);
- // taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
+ taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
ASSERT(pRSmaInfo->suid == suid);
return pRSmaInfo;
}
- // taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
+ taosRUnLockLatch(SMA_ENV_LOCK(pEnv));
return NULL;
}
@@ -1709,21 +1712,23 @@ static int32_t tdRSmaFetchAllResult(SSma *pSma, SRSmaInfo *pInfo) {
continue;
}
- int64_t curMs = taosGetTimestampMs();
- if ((pItem->nSkipped * pItem->maxDelay) > RSMA_FETCH_DELAY_MAX) {
- smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " nSkipped:%" PRIi8 " maxDelay:%d, fetch executed",
- SMA_VID(pSma), pInfo->suid, i, pItem->nSkipped, pItem->maxDelay);
- } else if (((curMs - pInfo->lastRecv) < RSMA_FETCH_ACTIVE_MAX)) {
- ++pItem->nSkipped;
- smaTrace("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " curMs:%" PRIi64 " lastRecv:%" PRIi64 ", fetch skipped ",
- SMA_VID(pSma), pInfo->suid, i, curMs, pInfo->lastRecv);
- continue;
+ if ((++pItem->nScanned * pItem->maxDelay) > RSMA_FETCH_DELAY_MAX) {
+ smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " nScanned:%" PRIi8 " maxDelay:%d, fetch executed",
+ SMA_VID(pSma), pInfo->suid, i, pItem->nScanned, pItem->maxDelay);
} else {
- smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " curMs:%" PRIi64 " lastRecv:%" PRIi64 ", fetch executed ",
- SMA_VID(pSma), pInfo->suid, i, curMs, pInfo->lastRecv);
+ int64_t curMs = taosGetTimestampMs();
+ if ((curMs - pInfo->lastRecv) < RSMA_FETCH_ACTIVE_MAX) {
+ smaTrace("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " curMs:%" PRIi64 " lastRecv:%" PRIi64 ", fetch skipped ",
+ SMA_VID(pSma), pInfo->suid, i, curMs, pInfo->lastRecv);
+ atomic_store_8(&pItem->triggerStat, TASK_TRIGGER_STAT_ACTIVE); // restore the active stat
+ continue;
+ } else {
+ smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " curMs:%" PRIi64 " lastRecv:%" PRIi64 ", fetch executed ",
+ SMA_VID(pSma), pInfo->suid, i, curMs, pInfo->lastRecv);
+ }
}
- pItem->nSkipped = 0;
+ pItem->nScanned = 0;
if ((terrno = qSetMultiStreamInput(taskInfo, &dataBlock, 1, STREAM_INPUT__DATA_BLOCK)) < 0) {
goto _err;
@@ -1734,12 +1739,12 @@ static int32_t tdRSmaFetchAllResult(SSma *pSma, SRSmaInfo *pInfo) {
}
tdCleanupStreamInputDataBlock(taskInfo);
- smaInfo("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " nSkipped:%" PRIi8 " maxDelay:%d, fetch finished",
- SMA_VID(pSma), pInfo->suid, i, pItem->nSkipped, pItem->maxDelay);
+ smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " nScanned:%" PRIi8 " maxDelay:%d, fetch finished",
+ SMA_VID(pSma), pInfo->suid, i, pItem->nScanned, pItem->maxDelay);
} else {
- smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " nSkipped:%" PRIi8
+ smaDebug("vgId:%d, suid:%" PRIi64 " level:%" PRIi8 " nScanned:%" PRIi8
" maxDelay:%d, fetch not executed as fetch level is %" PRIi8,
- SMA_VID(pSma), pInfo->suid, i, pItem->nSkipped, pItem->maxDelay, pItem->fetchLevel);
+ SMA_VID(pSma), pInfo->suid, i, pItem->nScanned, pItem->maxDelay, pItem->fetchLevel);
}
}
@@ -1829,6 +1834,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
bool occupied = (batchMax <= 1);
if (batchMax > 1) {
batchMax = 100 / batchMax;
+ batchMax = TMAX(batchMax, 4);
}
while (occupied || (++batchCnt < batchMax)) { // greedy mode
taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
@@ -1838,13 +1844,15 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
smaDebug("vgId:%d, batchSize:%d, execType:%" PRIi8, SMA_VID(pSma), qallItemSize, type);
}
- int8_t oldStat = atomic_val_compare_exchange_8(RSMA_COMMIT_STAT(pRSmaStat), 0, 2);
- if (oldStat == 0 ||
- ((oldStat == 2) && atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)) < TASK_TRIGGER_STAT_PAUSED)) {
- atomic_fetch_add_32(&pRSmaStat->nFetchAll, 1);
- tdRSmaFetchAllResult(pSma, pInfo);
- if (0 == atomic_sub_fetch_32(&pRSmaStat->nFetchAll, 1)) {
- atomic_store_8(RSMA_COMMIT_STAT(pRSmaStat), 0);
+ if (RSMA_INFO_ITEM(pInfo, 0)->fetchLevel || RSMA_INFO_ITEM(pInfo, 1)->fetchLevel) {
+ int8_t oldStat = atomic_val_compare_exchange_8(RSMA_COMMIT_STAT(pRSmaStat), 0, 2);
+ if (oldStat == 0 ||
+ ((oldStat == 2) && atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)) < TASK_TRIGGER_STAT_PAUSED)) {
+ atomic_fetch_add_32(&pRSmaStat->nFetchAll, 1);
+ tdRSmaFetchAllResult(pSma, pInfo);
+ if (0 == atomic_sub_fetch_32(&pRSmaStat->nFetchAll, 1)) {
+ atomic_store_8(RSMA_COMMIT_STAT(pRSmaStat), 0);
+ }
}
}
@@ -1917,7 +1925,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
tsem_wait(&pRSmaStat->notEmpty);
if ((pEnv->flag & SMA_ENV_FLG_CLOSE) && (atomic_load_64(&pRSmaStat->nBufItems) <= 0)) {
- smaInfo("vgId:%d, exec task end, flag:%" PRIi8 ", nBufItems:%" PRIi64, SMA_VID(pSma), pEnv->flag,
+ smaDebug("vgId:%d, exec task end, flag:%" PRIi8 ", nBufItems:%" PRIi64, SMA_VID(pSma), pEnv->flag,
atomic_load_64(&pRSmaStat->nBufItems));
break;
}
diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c
index 173391b769..e2cb51f586 100644
--- a/source/dnode/vnode/src/sma/smaTimeRange.c
+++ b/source/dnode/vnode/src/sma/smaTimeRange.c
@@ -178,7 +178,6 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
return TSDB_CODE_FAILED;
}
- tdRefSmaStat(pSma, pStat);
pTsmaStat = SMA_STAT_TSMA(pStat);
if (!pTsmaStat->pTSma) {
@@ -230,9 +229,7 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
goto _err;
}
- tdUnRefSmaStat(pSma, pStat);
return TSDB_CODE_SUCCESS;
_err:
- tdUnRefSmaStat(pSma, pStat);
return TSDB_CODE_FAILED;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index 8af764c4bc..8da783a5bd 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -457,7 +457,7 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) {
tMergeTreeOpen(&state->mergeTree, 1, state->pDataFReader, state->suid, state->uid,
&(STimeWindow){.skey = TSKEY_MIN, .ekey = TSKEY_MAX},
- &(SVersionRange){.minVer = 0, .maxVer = UINT64_MAX}, NULL);
+ &(SVersionRange){.minVer = 0, .maxVer = UINT64_MAX}, NULL, NULL);
bool hasVal = tMergeTreeNext(&state->mergeTree);
if (!hasVal) {
state->state = SFSLASTNEXTROW_FILESET;
@@ -589,7 +589,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
}
tMapDataReset(&state->blockMap);
- code = tsdbReadBlock(state->pDataFReader, state->pBlockIdx, &state->blockMap);
+ code = tsdbReadDataBlk(state->pDataFReader, state->pBlockIdx, &state->blockMap);
if (code) goto _err;
state->nBlock = state->blockMap.nItem;
diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c
index fb06203605..a619b9f2e4 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCommit.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c
@@ -14,13 +14,8 @@
*/
#include "tsdb.h"
-typedef struct {
- int64_t suid;
- int64_t uid;
- STSchema *pTSchema;
-} SSkmInfo;
-typedef enum { MEMORY_DATA_ITER = 0, LAST_DATA_ITER } EDataIterT;
+typedef enum { MEMORY_DATA_ITER = 0, STT_DATA_ITER } EDataIterT;
typedef struct {
SRBTreeNode n;
@@ -50,7 +45,7 @@ typedef struct {
int32_t minRow;
int32_t maxRow;
int8_t cmprAlg;
- int8_t maxLast;
+ int8_t sttTrigger;
SArray *aTbDataP; // memory
STsdbFS fs; // disk
// --------------
@@ -71,7 +66,7 @@ typedef struct {
SDataIter *pIter;
SRBTree rbt;
SDataIter dataIter;
- SDataIter aDataIter[TSDB_MAX_STT_FILE];
+ SDataIter aDataIter[TSDB_MAX_STT_TRIGGER];
int8_t toLastOnly;
};
struct {
@@ -99,7 +94,7 @@ static int32_t tsdbCommitCache(SCommitter *pCommitter);
static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno);
static int32_t tsdbNextCommitRow(SCommitter *pCommitter);
-static int32_t tRowInfoCmprFn(const void *p1, const void *p2) {
+int32_t tRowInfoCmprFn(const void *p1, const void *p2) {
SRowInfo *pInfo1 = (SRowInfo *)p1;
SRowInfo *pInfo2 = (SRowInfo *)p2;
@@ -325,22 +320,22 @@ _err:
return code;
}
-static int32_t tsdbCommitterUpdateTableSchema(SCommitter *pCommitter, int64_t suid, int64_t uid) {
+int32_t tsdbUpdateTableSchema(SMeta *pMeta, int64_t suid, int64_t uid, SSkmInfo *pSkmInfo) {
int32_t code = 0;
if (suid) {
- if (pCommitter->skmTable.suid == suid) {
- pCommitter->skmTable.uid = uid;
+ if (pSkmInfo->suid == suid) {
+ pSkmInfo->uid = uid;
goto _exit;
}
} else {
- if (pCommitter->skmTable.uid == uid) goto _exit;
+ if (pSkmInfo->uid == uid) goto _exit;
}
- pCommitter->skmTable.suid = suid;
- pCommitter->skmTable.uid = uid;
- tTSchemaDestroy(pCommitter->skmTable.pTSchema);
- code = metaGetTbTSchemaEx(pCommitter->pTsdb->pVnode->pMeta, suid, uid, -1, &pCommitter->skmTable.pTSchema);
+ pSkmInfo->suid = suid;
+ pSkmInfo->uid = uid;
+ tTSchemaDestroy(pSkmInfo->pTSchema);
+ code = metaGetTbTSchemaEx(pMeta, suid, uid, -1, &pSkmInfo->pTSchema);
if (code) goto _exit;
_exit:
@@ -382,7 +377,7 @@ static int32_t tsdbCommitterNextTableData(SCommitter *pCommitter) {
pCommitter->dReader.pBlockIdx =
(SBlockIdx *)taosArrayGet(pCommitter->dReader.aBlockIdx, pCommitter->dReader.iBlockIdx);
- code = tsdbReadBlock(pCommitter->dReader.pReader, pCommitter->dReader.pBlockIdx, &pCommitter->dReader.mBlock);
+ code = tsdbReadDataBlk(pCommitter->dReader.pReader, pCommitter->dReader.pBlockIdx, &pCommitter->dReader.mBlock);
if (code) goto _exit;
ASSERT(pCommitter->dReader.mBlock.nItem > 0);
@@ -428,11 +423,11 @@ static int32_t tsdbOpenCommitIter(SCommitter *pCommitter) {
pCommitter->toLastOnly = 0;
SDataFReader *pReader = pCommitter->dReader.pReader;
if (pReader) {
- if (pReader->pSet->nSttF >= pCommitter->maxLast) {
+ if (pReader->pSet->nSttF >= pCommitter->sttTrigger) {
int8_t iIter = 0;
for (int32_t iStt = 0; iStt < pReader->pSet->nSttF; iStt++) {
pIter = &pCommitter->aDataIter[iIter];
- pIter->type = LAST_DATA_ITER;
+ pIter->type = STT_DATA_ITER;
pIter->iStt = iStt;
code = tsdbReadSttBlk(pCommitter->dReader.pReader, iStt, pIter->aSttBlk);
@@ -498,7 +493,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
pCommitter->dReader.iBlockIdx = 0;
if (taosArrayGetSize(pCommitter->dReader.aBlockIdx) > 0) {
pCommitter->dReader.pBlockIdx = (SBlockIdx *)taosArrayGet(pCommitter->dReader.aBlockIdx, 0);
- code = tsdbReadBlock(pCommitter->dReader.pReader, pCommitter->dReader.pBlockIdx, &pCommitter->dReader.mBlock);
+ code = tsdbReadDataBlk(pCommitter->dReader.pReader, pCommitter->dReader.pBlockIdx, &pCommitter->dReader.mBlock);
if (code) goto _err;
} else {
pCommitter->dReader.pBlockIdx = NULL;
@@ -515,11 +510,11 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
SSttFile fStt = {.commitID = pCommitter->commitID};
SDFileSet wSet = {.fid = pCommitter->commitFid, .pHeadF = &fHead, .pDataF = &fData, .pSmaF = &fSma};
if (pRSet) {
- ASSERT(pRSet->nSttF <= pCommitter->maxLast);
+ ASSERT(pRSet->nSttF <= pCommitter->sttTrigger);
fData = *pRSet->pDataF;
fSma = *pRSet->pSmaF;
wSet.diskId = pRSet->diskId;
- if (pRSet->nSttF < pCommitter->maxLast) {
+ if (pRSet->nSttF < pCommitter->sttTrigger) {
for (int32_t iStt = 0; iStt < pRSet->nSttF; iStt++) {
wSet.aSttF[iStt] = pRSet->aSttF[iStt];
}
@@ -556,46 +551,45 @@ _err:
return code;
}
-static int32_t tsdbCommitDataBlock(SCommitter *pCommitter) {
- int32_t code = 0;
- SBlockData *pBlockData = &pCommitter->dWriter.bData;
- SDataBlk block;
+int32_t tsdbWriteDataBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SMapData *mDataBlk, int8_t cmprAlg) {
+ int32_t code = 0;
- ASSERT(pBlockData->nRow > 0);
+ if (pBlockData->nRow == 0) return code;
- tDataBlkReset(&block);
+ SDataBlk dataBlk;
+ tDataBlkReset(&dataBlk);
// info
- block.nRow += pBlockData->nRow;
+ dataBlk.nRow += pBlockData->nRow;
for (int32_t iRow = 0; iRow < pBlockData->nRow; iRow++) {
TSDBKEY key = {.ts = pBlockData->aTSKEY[iRow], .version = pBlockData->aVersion[iRow]};
if (iRow == 0) {
- if (tsdbKeyCmprFn(&block.minKey, &key) > 0) {
- block.minKey = key;
+ if (tsdbKeyCmprFn(&dataBlk.minKey, &key) > 0) {
+ dataBlk.minKey = key;
}
} else {
if (pBlockData->aTSKEY[iRow] == pBlockData->aTSKEY[iRow - 1]) {
- block.hasDup = 1;
+ dataBlk.hasDup = 1;
}
}
- if (iRow == pBlockData->nRow - 1 && tsdbKeyCmprFn(&block.maxKey, &key) < 0) {
- block.maxKey = key;
+ if (iRow == pBlockData->nRow - 1 && tsdbKeyCmprFn(&dataBlk.maxKey, &key) < 0) {
+ dataBlk.maxKey = key;
}
- block.minVer = TMIN(block.minVer, key.version);
- block.maxVer = TMAX(block.maxVer, key.version);
+ dataBlk.minVer = TMIN(dataBlk.minVer, key.version);
+ dataBlk.maxVer = TMAX(dataBlk.maxVer, key.version);
}
// write
- block.nSubBlock++;
- code = tsdbWriteBlockData(pCommitter->dWriter.pWriter, pBlockData, &block.aSubBlock[block.nSubBlock - 1],
- ((block.nSubBlock == 1) && !block.hasDup) ? &block.smaInfo : NULL, pCommitter->cmprAlg, 0);
+ dataBlk.nSubBlock++;
+ code = tsdbWriteBlockData(pWriter, pBlockData, &dataBlk.aSubBlock[dataBlk.nSubBlock - 1],
+ ((dataBlk.nSubBlock == 1) && !dataBlk.hasDup) ? &dataBlk.smaInfo : NULL, cmprAlg, 0);
if (code) goto _err;
// put SDataBlk
- code = tMapDataPutItem(&pCommitter->dWriter.mBlock, &block, tPutDataBlk);
+ code = tMapDataPutItem(mDataBlk, &dataBlk, tPutDataBlk);
if (code) goto _err;
// clear
@@ -604,39 +598,38 @@ static int32_t tsdbCommitDataBlock(SCommitter *pCommitter) {
return code;
_err:
- tsdbError("vgId:%d tsdb commit data block failed since %s", TD_VID(pCommitter->pTsdb->pVnode), tstrerror(code));
+ tsdbError("vgId:%d tsdb commit data block failed since %s", TD_VID(pWriter->pTsdb->pVnode), tstrerror(code));
return code;
}
-static int32_t tsdbCommitLastBlock(SCommitter *pCommitter) {
- int32_t code = 0;
- SSttBlk blockL;
- SBlockData *pBlockData = &pCommitter->dWriter.bDatal;
+int32_t tsdbWriteSttBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SArray *aSttBlk, int8_t cmprAlg) {
+ int32_t code = 0;
+ SSttBlk sstBlk;
- ASSERT(pBlockData->nRow > 0);
+ if (pBlockData->nRow == 0) return code;
// info
- blockL.suid = pBlockData->suid;
- blockL.nRow = pBlockData->nRow;
- blockL.minKey = TSKEY_MAX;
- blockL.maxKey = TSKEY_MIN;
- blockL.minVer = VERSION_MAX;
- blockL.maxVer = VERSION_MIN;
+ sstBlk.suid = pBlockData->suid;
+ sstBlk.nRow = pBlockData->nRow;
+ sstBlk.minKey = TSKEY_MAX;
+ sstBlk.maxKey = TSKEY_MIN;
+ sstBlk.minVer = VERSION_MAX;
+ sstBlk.maxVer = VERSION_MIN;
for (int32_t iRow = 0; iRow < pBlockData->nRow; iRow++) {
- blockL.minKey = TMIN(blockL.minKey, pBlockData->aTSKEY[iRow]);
- blockL.maxKey = TMAX(blockL.maxKey, pBlockData->aTSKEY[iRow]);
- blockL.minVer = TMIN(blockL.minVer, pBlockData->aVersion[iRow]);
- blockL.maxVer = TMAX(blockL.maxVer, pBlockData->aVersion[iRow]);
+ sstBlk.minKey = TMIN(sstBlk.minKey, pBlockData->aTSKEY[iRow]);
+ sstBlk.maxKey = TMAX(sstBlk.maxKey, pBlockData->aTSKEY[iRow]);
+ sstBlk.minVer = TMIN(sstBlk.minVer, pBlockData->aVersion[iRow]);
+ sstBlk.maxVer = TMAX(sstBlk.maxVer, pBlockData->aVersion[iRow]);
}
- blockL.minUid = pBlockData->uid ? pBlockData->uid : pBlockData->aUid[0];
- blockL.maxUid = pBlockData->uid ? pBlockData->uid : pBlockData->aUid[pBlockData->nRow - 1];
+ sstBlk.minUid = pBlockData->uid ? pBlockData->uid : pBlockData->aUid[0];
+ sstBlk.maxUid = pBlockData->uid ? pBlockData->uid : pBlockData->aUid[pBlockData->nRow - 1];
// write
- code = tsdbWriteBlockData(pCommitter->dWriter.pWriter, pBlockData, &blockL.bInfo, NULL, pCommitter->cmprAlg, 1);
+ code = tsdbWriteBlockData(pWriter, pBlockData, &sstBlk.bInfo, NULL, cmprAlg, 1);
if (code) goto _err;
// push SSttBlk
- if (taosArrayPush(pCommitter->dWriter.aSttBlk, &blockL) == NULL) {
+ if (taosArrayPush(aSttBlk, &sstBlk) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
}
@@ -647,7 +640,7 @@ static int32_t tsdbCommitLastBlock(SCommitter *pCommitter) {
return code;
_err:
- tsdbError("vgId:%d tsdb commit last block failed since %s", TD_VID(pCommitter->pTsdb->pVnode), tstrerror(code));
+ tsdbError("vgId:%d tsdb commit last block failed since %s", TD_VID(pWriter->pTsdb->pVnode), tstrerror(code));
return code;
}
@@ -692,7 +685,7 @@ static int32_t tsdbMoveCommitData(SCommitter *pCommitter, TABLEID toTable) {
while (pCommitter->dReader.pBlockIdx && tTABLEIDCmprFn(pCommitter->dReader.pBlockIdx, &toTable) < 0) {
SBlockIdx blockIdx = *pCommitter->dReader.pBlockIdx;
- code = tsdbWriteBlock(pCommitter->dWriter.pWriter, &pCommitter->dReader.mBlock, &blockIdx);
+ code = tsdbWriteDataBlk(pCommitter->dWriter.pWriter, &pCommitter->dReader.mBlock, &blockIdx);
if (code) goto _err;
if (taosArrayPush(pCommitter->dWriter.aBlockIdx, &blockIdx) == NULL) {
@@ -757,7 +750,7 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
pCommitter->minRow = pTsdb->pVnode->config.tsdbCfg.minRows;
pCommitter->maxRow = pTsdb->pVnode->config.tsdbCfg.maxRows;
pCommitter->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression;
- pCommitter->maxLast = TSDB_DEFAULT_STT_FILE; // TODO: make it as a config
+ pCommitter->sttTrigger = pTsdb->pVnode->config.sttTrigger;
pCommitter->aTbDataP = tsdbMemTableGetTbDataArray(pTsdb->imem);
if (pCommitter->aTbDataP == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -787,7 +780,7 @@ static int32_t tsdbCommitDataStart(SCommitter *pCommitter) {
if (code) goto _exit;
// merger
- for (int32_t iStt = 0; iStt < TSDB_MAX_STT_FILE; iStt++) {
+ for (int32_t iStt = 0; iStt < TSDB_MAX_STT_TRIGGER; iStt++) {
SDataIter *pIter = &pCommitter->aDataIter[iStt];
pIter->aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
if (pIter->aSttBlk == NULL) {
@@ -829,7 +822,7 @@ static void tsdbCommitDataEnd(SCommitter *pCommitter) {
tBlockDataDestroy(&pCommitter->dReader.bData, 1);
// merger
- for (int32_t iStt = 0; iStt < TSDB_MAX_STT_FILE; iStt++) {
+ for (int32_t iStt = 0; iStt < TSDB_MAX_STT_TRIGGER; iStt++) {
SDataIter *pIter = &pCommitter->aDataIter[iStt];
taosArrayDestroy(pIter->aSttBlk);
tBlockDataDestroy(&pIter->bData, 1);
@@ -1046,7 +1039,7 @@ static int32_t tsdbNextCommitRow(SCommitter *pCommitter) {
break;
}
}
- } else if (pCommitter->pIter->type == LAST_DATA_ITER) { // last file
+ } else if (pCommitter->pIter->type == STT_DATA_ITER) { // last file
pIter->iRow++;
if (pIter->iRow < pIter->bData.nRow) {
pIter->r.uid = pIter->bData.uid ? pIter->bData.uid : pIter->bData.aUid[pIter->iRow];
@@ -1124,15 +1117,14 @@ static int32_t tsdbCommitAheadBlock(SCommitter *pCommitter, SDataBlk *pDataBlk)
}
if (pBlockData->nRow >= pCommitter->maxRow) {
- code = tsdbCommitDataBlock(pCommitter);
+ code =
+ tsdbWriteDataBlock(pCommitter->dWriter.pWriter, pBlockData, &pCommitter->dWriter.mBlock, pCommitter->cmprAlg);
if (code) goto _err;
}
}
- if (pBlockData->nRow) {
- code = tsdbCommitDataBlock(pCommitter);
- if (code) goto _err;
- }
+ code = tsdbWriteDataBlock(pCommitter->dWriter.pWriter, pBlockData, &pCommitter->dWriter.mBlock, pCommitter->cmprAlg);
+ if (code) goto _err;
return code;
@@ -1193,7 +1185,7 @@ static int32_t tsdbCommitMergeBlock(SCommitter *pCommitter, SDataBlk *pDataBlk)
}
if (pBDataW->nRow >= pCommitter->maxRow) {
- code = tsdbCommitDataBlock(pCommitter);
+ code = tsdbWriteDataBlock(pCommitter->dWriter.pWriter, pBDataW, &pCommitter->dWriter.mBlock, pCommitter->cmprAlg);
if (code) goto _err;
}
}
@@ -1210,15 +1202,13 @@ static int32_t tsdbCommitMergeBlock(SCommitter *pCommitter, SDataBlk *pDataBlk)
}
if (pBDataW->nRow >= pCommitter->maxRow) {
- code = tsdbCommitDataBlock(pCommitter);
+ code = tsdbWriteDataBlock(pCommitter->dWriter.pWriter, pBDataW, &pCommitter->dWriter.mBlock, pCommitter->cmprAlg);
if (code) goto _err;
}
}
- if (pBDataW->nRow) {
- code = tsdbCommitDataBlock(pCommitter);
- if (code) goto _err;
- }
+ code = tsdbWriteDataBlock(pCommitter->dWriter.pWriter, pBDataW, &pCommitter->dWriter.mBlock, pCommitter->cmprAlg);
+ if (code) goto _err;
return code;
@@ -1306,10 +1296,8 @@ static int32_t tsdbInitLastBlockIfNeed(SCommitter *pCommitter, TABLEID id) {
SBlockData *pBDatal = &pCommitter->dWriter.bDatal;
if (pBDatal->suid || pBDatal->uid) {
if ((pBDatal->suid != id.suid) || (id.suid == 0)) {
- if (pBDatal->nRow) {
- code = tsdbCommitLastBlock(pCommitter);
- if (code) goto _exit;
- }
+ code = tsdbWriteSttBlock(pCommitter->dWriter.pWriter, pBDatal, pCommitter->dWriter.aSttBlk, pCommitter->cmprAlg);
+ if (code) goto _exit;
tBlockDataReset(pBDatal);
}
}
@@ -1341,7 +1329,7 @@ static int32_t tsdbAppendLastBlock(SCommitter *pCommitter) {
if (code) goto _err;
if (pBDatal->nRow >= pCommitter->maxRow) {
- code = tsdbCommitLastBlock(pCommitter);
+ code = tsdbWriteSttBlock(pCommitter->dWriter.pWriter, pBDatal, pCommitter->dWriter.aSttBlk, pCommitter->cmprAlg);
if (code) goto _err;
}
}
@@ -1393,10 +1381,11 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
if (pBData->nRow >= pCommitter->maxRow) {
if (pCommitter->toLastOnly) {
- code = tsdbCommitLastBlock(pCommitter);
+ code = tsdbWriteSttBlock(pCommitter->dWriter.pWriter, pBData, pCommitter->dWriter.aSttBlk, pCommitter->cmprAlg);
if (code) goto _err;
} else {
- code = tsdbCommitDataBlock(pCommitter);
+ code =
+ tsdbWriteDataBlock(pCommitter->dWriter.pWriter, pBData, &pCommitter->dWriter.mBlock, pCommitter->cmprAlg);
if (code) goto _err;
}
}
@@ -1404,7 +1393,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
if (!pCommitter->toLastOnly && pBData->nRow) {
if (pBData->nRow > pCommitter->minRow) {
- code = tsdbCommitDataBlock(pCommitter);
+ code = tsdbWriteDataBlock(pCommitter->dWriter.pWriter, pBData, &pCommitter->dWriter.mBlock, pCommitter->cmprAlg);
if (code) goto _err;
} else {
code = tsdbAppendLastBlock(pCommitter);
@@ -1437,7 +1426,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
tMapDataReset(&pCommitter->dWriter.mBlock);
// impl
- code = tsdbCommitterUpdateTableSchema(pCommitter, id.suid, id.uid);
+ code = tsdbUpdateTableSchema(pCommitter->pTsdb->pVnode->pMeta, id.suid, id.uid, &pCommitter->skmTable);
if (code) goto _err;
code = tBlockDataInit(&pCommitter->dReader.bData, id.suid, id.uid, pCommitter->skmTable.pTSchema);
if (code) goto _err;
@@ -1455,7 +1444,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
// end
if (pCommitter->dWriter.mBlock.nItem > 0) {
SBlockIdx blockIdx = {.suid = id.suid, .uid = id.uid};
- code = tsdbWriteBlock(pCommitter->dWriter.pWriter, &pCommitter->dWriter.mBlock, &blockIdx);
+ code = tsdbWriteDataBlk(pCommitter->dWriter.pWriter, &pCommitter->dWriter.mBlock, &blockIdx);
if (code) goto _err;
if (taosArrayPush(pCommitter->dWriter.aBlockIdx, &blockIdx) == NULL) {
@@ -1470,10 +1459,9 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
code = tsdbMoveCommitData(pCommitter, id);
if (code) goto _err;
- if (pCommitter->dWriter.bDatal.nRow > 0) {
- code = tsdbCommitLastBlock(pCommitter);
- if (code) goto _err;
- }
+ code = tsdbWriteSttBlock(pCommitter->dWriter.pWriter, &pCommitter->dWriter.bDatal, pCommitter->dWriter.aSttBlk,
+ pCommitter->cmprAlg);
+ if (code) goto _err;
return code;
diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c
index 8ab733aa56..31bdb784dd 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFS.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFS.c
@@ -279,7 +279,7 @@ static int32_t tsdbScanAndTryFixFS(STsdb *pTsdb) {
goto _err;
}
- if (size != pTsdb->fs.pDelFile->size) {
+ if (size != tsdbLogicToFileSize(pTsdb->fs.pDelFile->size, pTsdb->pVnode->config.tsdbPageSize)) {
code = TSDB_CODE_FILE_CORRUPTED;
goto _err;
}
@@ -295,7 +295,7 @@ static int32_t tsdbScanAndTryFixFS(STsdb *pTsdb) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
- if (size != LOGIC_TO_FILE_SIZE(pSet->pHeadF->size, TSDB_DEFAULT_PAGE_SIZE)) {
+ if (size != tsdbLogicToFileSize(pSet->pHeadF->size, pTsdb->pVnode->config.tsdbPageSize)) {
code = TSDB_CODE_FILE_CORRUPTED;
goto _err;
}
@@ -306,10 +306,10 @@ static int32_t tsdbScanAndTryFixFS(STsdb *pTsdb) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
- if (size < LOGIC_TO_FILE_SIZE(pSet->pDataF->size, TSDB_DEFAULT_PAGE_SIZE)) {
+ if (size < tsdbLogicToFileSize(pSet->pDataF->size, pTsdb->pVnode->config.tsdbPageSize)) {
code = TSDB_CODE_FILE_CORRUPTED;
goto _err;
- } else if (size > LOGIC_TO_FILE_SIZE(pSet->pDataF->size, TSDB_DEFAULT_PAGE_SIZE)) {
+ } else if (size > tsdbLogicToFileSize(pSet->pDataF->size, pTsdb->pVnode->config.tsdbPageSize)) {
code = tsdbDFileRollback(pTsdb, pSet, TSDB_DATA_FILE);
if (code) goto _err;
}
@@ -320,10 +320,10 @@ static int32_t tsdbScanAndTryFixFS(STsdb *pTsdb) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
- if (size < LOGIC_TO_FILE_SIZE(pSet->pSmaF->size, TSDB_DEFAULT_PAGE_SIZE)) {
+ if (size < tsdbLogicToFileSize(pSet->pSmaF->size, pTsdb->pVnode->config.tsdbPageSize)) {
code = TSDB_CODE_FILE_CORRUPTED;
goto _err;
- } else if (size > LOGIC_TO_FILE_SIZE(pSet->pSmaF->size, TSDB_DEFAULT_PAGE_SIZE)) {
+ } else if (size > tsdbLogicToFileSize(pSet->pSmaF->size, pTsdb->pVnode->config.tsdbPageSize)) {
code = tsdbDFileRollback(pTsdb, pSet, TSDB_SMA_FILE);
if (code) goto _err;
}
@@ -335,7 +335,7 @@ static int32_t tsdbScanAndTryFixFS(STsdb *pTsdb) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
- if (size != LOGIC_TO_FILE_SIZE(pSet->aSttF[iStt]->size, TSDB_DEFAULT_PAGE_SIZE)) {
+ if (size != tsdbLogicToFileSize(pSet->aSttF[iStt]->size, pTsdb->pVnode->config.tsdbPageSize)) {
code = TSDB_CODE_FILE_CORRUPTED;
goto _err;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c
index 619fc17f5b..3c944584de 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFile.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFile.c
@@ -148,7 +148,7 @@ int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) {
}
// ftruncate
- if (taosFtruncateFile(pFD, LOGIC_TO_FILE_SIZE(size, TSDB_DEFAULT_PAGE_SIZE)) < 0) {
+ if (taosFtruncateFile(pFD, tsdbLogicToFileSize(size, pTsdb->pVnode->config.tsdbPageSize)) < 0) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
index d660dfa99d..45fe29f0fa 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
@@ -67,6 +67,16 @@ void resetLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo) {
pLoadInfo[i].blockIndex[1] = -1;
taosArrayClear(pLoadInfo[i].aSttBlk);
+
+ pLoadInfo[i].elapsedTime = 0;
+ pLoadInfo[i].loadBlocks = 0;
+ }
+}
+
+void getLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo, int64_t* blocks, double* el) {
+ for(int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
+ *el += pLoadInfo[i].elapsedTime;
+ *blocks += pLoadInfo[i].loadBlocks;
}
}
@@ -86,7 +96,7 @@ void* destroyLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo) {
return NULL;
}
-static SBlockData* loadBlockIfMissing(SLDataIter *pIter) {
+static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
int32_t code = 0;
SSttBlockLoadInfo* pInfo = pIter->pBlockLoadInfo;
@@ -100,8 +110,13 @@ static SBlockData* loadBlockIfMissing(SLDataIter *pIter) {
pInfo->currentLoadBlockIndex ^= 1;
if (pIter->pSttBlk != NULL) { // current block not loaded yet
+ int64_t st = taosGetTimestampUs();
code = tsdbReadSttBlock(pIter->pReader, pIter->iStt, pIter->pSttBlk, &pInfo->blockData[pInfo->currentLoadBlockIndex]);
- tsdbDebug("read last block, index:%d, last file index:%d", pIter->iSttBlk, pIter->iStt);
+ double el = (taosGetTimestampUs() - st)/ 1000.0;
+ pInfo->elapsedTime += el;
+ pInfo->loadBlocks += 1;
+
+ tsdbDebug("read last block, index:%d, last file index:%d, elapsed time:%.2f ms, %s", pIter->iSttBlk, pIter->iStt, el, idStr);
if (code != TSDB_CODE_SUCCESS) {
goto _exit;
}
@@ -245,9 +260,8 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
size_t size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
// find the start block
- int32_t index = binarySearchForStartBlock(pBlockLoadInfo->aSttBlk->pData, size, uid, backward);
- (*pIter)->iSttBlk = index;
- if (index != -1) {
+ (*pIter)->iSttBlk = binarySearchForStartBlock(pBlockLoadInfo->aSttBlk->pData, size, uid, backward);
+ if ((*pIter)->iSttBlk != -1) {
(*pIter)->pSttBlk = taosArrayGet(pBlockLoadInfo->aSttBlk, (*pIter)->iSttBlk);
(*pIter)->iRow = ((*pIter)->backward) ? (*pIter)->pSttBlk->nRow : -1;
}
@@ -265,7 +279,7 @@ void tLDataIterNextBlock(SLDataIter *pIter) {
pIter->iSttBlk += step;
int32_t index = -1;
- size_t size = pIter->pBlockLoadInfo->aSttBlk->size;//taosArrayGetSize(pIter->pBlockLoadInfo->aSttBlk);
+ size_t size = pIter->pBlockLoadInfo->aSttBlk->size;
for (int32_t i = pIter->iSttBlk; i < size && i >= 0; i += step) {
SSttBlk *p = taosArrayGet(pIter->pBlockLoadInfo->aSttBlk, i);
if ((!pIter->backward) && p->minUid > pIter->uid) {
@@ -310,13 +324,13 @@ void tLDataIterNextBlock(SLDataIter *pIter) {
}
}
-static void findNextValidRow(SLDataIter *pIter) {
+static void findNextValidRow(SLDataIter *pIter, const char* idStr) {
int32_t step = pIter->backward ? -1 : 1;
bool hasVal = false;
int32_t i = pIter->iRow;
- SBlockData *pBlockData = loadBlockIfMissing(pIter);
+ SBlockData *pBlockData = loadLastBlock(pIter, idStr);
// mostly we only need to find the start position for a given table
if ((((i == 0) && (!pIter->backward)) || (i == pBlockData->nRow - 1 && pIter->backward)) && pBlockData->aUid != NULL) {
@@ -376,7 +390,7 @@ static void findNextValidRow(SLDataIter *pIter) {
pIter->iRow = (hasVal) ? i : -1;
}
-bool tLDataIterNextRow(SLDataIter *pIter) {
+bool tLDataIterNextRow(SLDataIter *pIter, const char* idStr) {
int32_t code = 0;
int32_t step = pIter->backward ? -1 : 1;
@@ -386,11 +400,11 @@ bool tLDataIterNextRow(SLDataIter *pIter) {
}
int32_t iBlockL = pIter->iSttBlk;
- SBlockData *pBlockData = loadBlockIfMissing(pIter);
+ SBlockData *pBlockData = loadLastBlock(pIter, idStr);
pIter->iRow += step;
while (1) {
- findNextValidRow(pIter);
+ findNextValidRow(pIter, idStr);
if (pIter->iRow >= pBlockData->nRow || pIter->iRow < 0) {
tLDataIterNextBlock(pIter);
@@ -402,7 +416,7 @@ bool tLDataIterNextRow(SLDataIter *pIter) {
}
if (iBlockL != pIter->iSttBlk) {
- pBlockData = loadBlockIfMissing(pIter);
+ pBlockData = loadLastBlock(pIter, idStr);
pIter->iRow += step;
}
}
@@ -445,7 +459,7 @@ static FORCE_INLINE int32_t tLDataIterCmprFn(const void *p1, const void *p2) {
}
int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFReader, uint64_t suid, uint64_t uid,
- STimeWindow *pTimeWindow, SVersionRange *pVerRange, void* pBlockLoadInfo) {
+ STimeWindow *pTimeWindow, SVersionRange *pVerRange, void* pBlockLoadInfo, const char* idStr) {
pMTree->backward = backward;
pMTree->pIter = NULL;
pMTree->pIterList = taosArrayInit(4, POINTER_BYTES);
@@ -453,6 +467,8 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead
return TSDB_CODE_OUT_OF_MEMORY;
}
+ pMTree->idStr = idStr;
+
tRBTreeCreate(&pMTree->rbt, tLDataIterCmprFn);
int32_t code = TSDB_CODE_SUCCESS;
@@ -475,7 +491,7 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead
goto _end;
}
- bool hasVal = tLDataIterNextRow(pIter);
+ bool hasVal = tLDataIterNextRow(pIter, pMTree->idStr);
if (hasVal) {
taosArrayPush(pMTree->pIterList, &pIter);
tMergeTreeAddIter(pMTree, pIter);
@@ -498,7 +514,7 @@ bool tMergeTreeNext(SMergeTree *pMTree) {
if (pMTree->pIter) {
SLDataIter *pIter = pMTree->pIter;
- bool hasVal = tLDataIterNextRow(pIter);
+ bool hasVal = tLDataIterNextRow(pIter, pMTree->idStr);
if (!hasVal) {
pMTree->pIter = NULL;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index 8229751d3c..60d967681b 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -16,7 +16,7 @@
#include "osDef.h"
#include "tsdb.h"
-#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
+#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
typedef enum {
EXTERNAL_ROWS_PREV = 0x1,
@@ -70,6 +70,8 @@ typedef struct SIOCostSummary {
double smaLoadTime;
int64_t lastBlockLoad;
double lastBlockLoadTime;
+ int64_t composedBlocks;
+ double buildComposedBlockTime;
} SIOCostSummary;
typedef struct SBlockLoadSuppInfo {
@@ -81,11 +83,11 @@ typedef struct SBlockLoadSuppInfo {
} SBlockLoadSuppInfo;
typedef struct SLastBlockReader {
- STimeWindow window;
- SVersionRange verRange;
- int32_t order;
- uint64_t uid;
- SMergeTree mergeTree;
+ STimeWindow window;
+ SVersionRange verRange;
+ int32_t order;
+ uint64_t uid;
+ SMergeTree mergeTree;
SSttBlockLoadInfo* pInfo;
} SLastBlockReader;
@@ -190,6 +192,9 @@ static SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond
static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader);
static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader);
static int32_t doBuildDataBlock(STsdbReader* pReader);
+static TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader);
+
+static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); }
static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) {
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
@@ -229,10 +234,10 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
STableBlockScanInfo info = {.lastKey = 0, .uid = idList[j].uid};
if (ASCENDING_TRAVERSE(pTsdbReader->order)) {
int64_t skey = pTsdbReader->window.skey;
- info.lastKey = (skey > INT64_MIN)? (skey - 1):skey;
+ info.lastKey = (skey > INT64_MIN) ? (skey - 1) : skey;
} else {
int64_t ekey = pTsdbReader->window.ekey;
- info.lastKey = (ekey < INT64_MAX)? (ekey + 1):ekey;
+ info.lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey;
}
taosHashPut(pTableMap, &info.uid, sizeof(uint64_t), &info, sizeof(info));
@@ -365,6 +370,9 @@ static bool filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader) {
return false;
}
+ SIOCostSummary* pSum = &pReader->cost;
+ getLastBlockLoadInfo(pIter->pLastBlockReader->pInfo, &pSum->lastBlockLoad, &pReader->cost.lastBlockLoadTime);
+
pIter->pLastBlockReader->uid = 0;
tMergeTreeClose(&pIter->pLastBlockReader->mergeTree);
resetLastBlockLoadInfo(pIter->pLastBlockReader->pInfo);
@@ -596,7 +604,7 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
STableBlockScanInfo* pScanInfo = taosHashGet(pReader->status.pTableMap, &pBlockIdx->uid, sizeof(int64_t));
tMapDataReset(&pScanInfo->mapData);
- tsdbReadBlock(pReader->pFileReader, pBlockIdx, &pScanInfo->mapData);
+ tsdbReadDataBlk(pReader->pFileReader, pBlockIdx, &pScanInfo->mapData);
sizeInDisk += pScanInfo->mapData.nData;
for (int32_t j = 0; j < pScanInfo->mapData.nItem; ++j) {
@@ -677,12 +685,153 @@ 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;
+ s = pos;
+
+ // check
+ assert(pos >=0 && pos < num);
+ assert(num > 0);
+
+ if (order == TSDB_ORDER_ASC) {
+ // find the first position which is smaller than the key
+ e = num - 1;
+ if (key < keyList[pos])
+ return -1;
+ while (1) {
+ // check can return
+ if (key >= keyList[e])
+ return e;
+ if (key <= keyList[s])
+ return s;
+ if (e - s <= 1)
+ return s;
+
+ // change start or end position
+ int mid = s + (e - s + 1)/2;
+ if (keyList[mid] > key)
+ e = mid;
+ else if(keyList[mid] < key)
+ s = mid;
+ else
+ return mid;
+ }
+ } else { // DESC
+ // find the first position which is bigger than the key
+ e = 0;
+ if (key > keyList[pos])
+ return -1;
+ while (1) {
+ // check can return
+ if (key <= keyList[e])
+ return e;
+ if (key >= keyList[s])
+ return s;
+ if (s - e <= 1)
+ return s;
+
+ // change start or end position
+ int mid = s - (s - e + 1)/2;
+ if (keyList[mid] < key)
+ e = mid;
+ else if(keyList[mid] > key)
+ s = mid;
+ else
+ return mid;
+ }
+ }
+}
+
+int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData, SDataBlk* pBlock, int32_t pos) {
+ // NOTE: reverse the order to find the end position in data block
+ int32_t endPos = -1;
+ bool asc = ASCENDING_TRAVERSE(pReader->order);
+
+ if (asc && pReader->window.ekey >= pBlock->maxKey.ts) {
+ endPos = pBlock->nRow - 1;
+ } else if (!asc && pReader->window.skey <= pBlock->minKey.ts) {
+ endPos = 0;
+ } else {
+ endPos = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, pReader->window.ekey, pReader->order);
+ }
+
+ return endPos;
+}
+
static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo) {
SReaderStatus* pStatus = &pReader->status;
SDataBlockIter* pBlockIter = &pStatus->blockIter;
SBlockData* pBlockData = &pStatus->fileBlockData;
- SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(pBlockIter);
+ SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
SDataBlk* pBlock = getCurrentBlock(pBlockIter);
SSDataBlock* pResBlock = pReader->pResBlock;
int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock);
@@ -695,23 +844,42 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
bool asc = ASCENDING_TRAVERSE(pReader->order);
int32_t step = asc ? 1 : -1;
- int32_t rowIndex = 0;
- int32_t remain = asc ? (pBlockData->nRow - pDumpInfo->rowIndex) : (pDumpInfo->rowIndex + 1);
-
- int32_t endIndex = 0;
- if (remain <= pReader->capacity) {
- endIndex = pBlockData->nRow;
+ if (asc && pReader->window.skey <= pBlock->minKey.ts) {
+ pDumpInfo->rowIndex = 0;
+ } else if (!asc && pReader->window.ekey >= pBlock->maxKey.ts) {
+ pDumpInfo->rowIndex = pBlock->nRow - 1;
} else {
- endIndex = pDumpInfo->rowIndex + step * pReader->capacity;
+ int32_t pos = asc? pBlock->nRow-1:0;
+ int32_t order = (pReader->order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC;
+ pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, pReader->window.skey, order);
+ }
+
+ // time window check
+ int32_t endIndex = getEndPosInDataBlock(pReader, pBlockData, pBlock, pDumpInfo->rowIndex);
+ if (endIndex == -1) {
+ setBlockAllDumped(pDumpInfo, pReader->window.ekey, pReader->order);
+ return TSDB_CODE_SUCCESS;
+ }
+
+ endIndex += step;
+ int32_t remain = asc ? (endIndex - pDumpInfo->rowIndex) : (pDumpInfo->rowIndex - endIndex);
+ if (remain > pReader->capacity) { // output buffer check
remain = pReader->capacity;
}
- int32_t i = 0;
+ int32_t rowIndex = 0;
+
+ int32_t i = 0;
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i);
if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
- for (int32_t j = pDumpInfo->rowIndex; j < endIndex && j >= 0; j += step) {
- colDataAppend(pColData, rowIndex++, (const char*)&pBlockData->aTSKEY[j], false);
+ if (asc) {
+ memcpy(pColData->pData, &pBlockData->aTSKEY[pDumpInfo->rowIndex], remain * sizeof(int64_t));
+ } else {
+ for (int32_t j = pDumpInfo->rowIndex; rowIndex < remain; j += step) {
+ colDataAppendInt64(pColData, rowIndex++, &pBlockData->aTSKEY[j]);
+ }
}
+
i += 1;
}
@@ -725,13 +893,32 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
if (pData->cid < pColData->info.colId) {
colIndex += 1;
} else if (pData->cid == pColData->info.colId) {
- for (int32_t j = pDumpInfo->rowIndex; j < endIndex && j >= 0; j += step) {
- tColDataGetValue(pData, j, &cv);
- doCopyColVal(pColData, rowIndex++, i, &cv, pSupInfo);
+ if (pData->flag == HAS_NONE || pData->flag == HAS_NULL) {
+ colDataAppendNNULL(pColData, 0, remain);
+ } else {
+ if (IS_NUMERIC_TYPE(pColData->info.type) && asc) {
+ uint8_t* p = pData->pData + tDataTypes[pData->type].bytes * pDumpInfo->rowIndex;
+ memcpy(pColData->pData, p, remain * tDataTypes[pData->type].bytes);
+
+ // null value exists, check one-by-one
+ if (pData->flag != HAS_VALUE) {
+ for (int32_t j = pDumpInfo->rowIndex; rowIndex < remain; j += step, rowIndex++) {
+ uint8_t v = GET_BIT2(pData->pBitMap, j);
+ if (v == 0 || v == 1) {
+ colDataSetNull_f(pColData->nullbitmap, rowIndex);
+ }
+ }
+ }
+ } else {
+ for (int32_t j = pDumpInfo->rowIndex; rowIndex < remain; j += step) {
+ tColDataGetValue(pData, j, &cv);
+ doCopyColVal(pColData, rowIndex++, i, &cv, pSupInfo);
+ }
+ }
}
+
colIndex += 1;
i += 1;
- ASSERT(rowIndex == remain);
} else { // the specified column does not exist in file block, fill with null data
colDataAppendNNULL(pColData, 0, remain);
i += 1;
@@ -747,7 +934,13 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
pResBlock->info.rows = remain;
pDumpInfo->rowIndex += step * remain;
- setBlockAllDumped(pDumpInfo, pBlock->maxKey.ts, pReader->order);
+ if (pDumpInfo->rowIndex >= 0 && pDumpInfo->rowIndex < pBlock->nRow) {
+ int64_t ts = pBlockData->aTSKEY[pDumpInfo->rowIndex];
+ setBlockAllDumped(pDumpInfo, ts, pReader->order);
+ } else {
+ int64_t k = asc? pBlock->maxKey.ts:pBlock->minKey.ts;
+ setBlockAllDumped(pDumpInfo, k, pReader->order);
+ }
double elapsedTime = (taosGetTimestampUs() - st) / 1000.0;
pReader->cost.blockLoadTime += elapsedTime;
@@ -755,7 +948,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
int32_t unDumpedRows = asc ? pBlock->nRow - pDumpInfo->rowIndex : pDumpInfo->rowIndex + 1;
tsdbDebug("%p copy file block to sdatablock, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s",
- pReader, pBlockIter->index, pFBlock->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, remain, unDumpedRows,
+ pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, remain, unDumpedRows,
pBlock->minVer, pBlock->maxVer, elapsedTime, pReader->idStr);
return TSDB_CODE_SUCCESS;
@@ -1143,26 +1336,31 @@ static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SDa
}
}
-// 1. the version of all rows should be less than the endVersion
-// 2. current block should not overlap with next neighbor block
-// 3. current timestamp should not be overlap with each other
-// 4. output buffer should be large enough to hold all rows in current block
-// 5. delete info should not overlap with current block data
-static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pFBlock, SDataBlk* pBlock,
- STableBlockScanInfo* pScanInfo, TSDBKEY key, SLastBlockReader* pLastBlockReader) {
+typedef struct {
+ bool overlapWithNeighborBlock;
+ bool hasDupTs;
+ bool overlapWithDelInfo;
+ bool overlapWithLastBlock;
+ bool overlapWithKeyInBuf;
+ bool partiallyRequired;
+ bool moreThanCapcity;
+} SDataBlockToLoadInfo;
+
+static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo* pBlockInfo, SDataBlk* pBlock,
+ STableBlockScanInfo* pScanInfo, TSDBKEY keyInBuf, SLastBlockReader* pLastBlockReader,
+ STsdbReader* pReader) {
int32_t neighborIndex = 0;
- SDataBlk* pNeighbor = getNeighborBlockOfSameTable(pFBlock, pScanInfo, &neighborIndex, pReader->order);
+ SDataBlk* pNeighbor = getNeighborBlockOfSameTable(pBlockInfo, pScanInfo, &neighborIndex, pReader->order);
// overlap with neighbor
- bool overlapWithNeighbor = false;
if (pNeighbor) {
- overlapWithNeighbor = overlapWithNeighborBlock(pBlock, pNeighbor, pReader->order);
+ pInfo->overlapWithNeighborBlock = overlapWithNeighborBlock(pBlock, pNeighbor, pReader->order);
taosMemoryFree(pNeighbor);
}
// has duplicated ts of different version in this block
- bool hasDup = (pBlock->nSubBlock == 1) ? pBlock->hasDup : true;
- bool overlapWithDel = overlapWithDelSkyline(pScanInfo, pBlock, pReader->order);
+ pInfo->hasDupTs = (pBlock->nSubBlock == 1) ? pBlock->hasDup : true;
+ pInfo->overlapWithDelInfo = overlapWithDelSkyline(pScanInfo, pBlock, pReader->order);
// todo here we need to each key in the last files to identify if it is really overlapped with last block
// todo
@@ -1174,25 +1372,48 @@ static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pFBloc
}
#endif
- bool moreThanOutputCapacity = pBlock->nRow > pReader->capacity;
- bool partiallyRequired = dataBlockPartiallyRequired(&pReader->window, &pReader->verRange, pBlock);
- bool overlapWithKey = keyOverlapFileBlock(key, pBlock, &pReader->verRange);
+ pInfo->moreThanCapcity = pBlock->nRow > pReader->capacity;
+ pInfo->partiallyRequired = dataBlockPartiallyRequired(&pReader->window, &pReader->verRange, pBlock);
+ pInfo->overlapWithKeyInBuf = keyOverlapFileBlock(keyInBuf, pBlock, &pReader->verRange);
+}
- bool loadDataBlock = (overlapWithNeighbor || hasDup || partiallyRequired || overlapWithKey ||
- moreThanOutputCapacity || overlapWithDel || overlapWithlastBlock);
+// 1. the version of all rows should be less than the endVersion
+// 2. current block should not overlap with next neighbor block
+// 3. current timestamp should not be overlap with each other
+// 4. output buffer should be large enough to hold all rows in current block
+// 5. delete info should not overlap with current block data
+// 6. current block should not contain the duplicated ts
+static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pBlockInfo, SDataBlk* pBlock,
+ STableBlockScanInfo* pScanInfo, TSDBKEY keyInBuf, SLastBlockReader* pLastBlockReader) {
+ SDataBlockToLoadInfo info = {0};
+ getBlockToLoadInfo(&info, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader, pReader);
+
+ bool loadDataBlock =
+ (info.overlapWithNeighborBlock || info.hasDupTs || info.partiallyRequired || info.overlapWithKeyInBuf ||
+ info.moreThanCapcity || info.overlapWithDelInfo || info.overlapWithLastBlock);
// log the reason why load the datablock for profile
if (loadDataBlock) {
tsdbDebug("%p uid:%" PRIu64
" need to load the datablock, overlapwithneighborblock:%d, hasDup:%d, partiallyRequired:%d, "
"overlapWithKey:%d, greaterThanBuf:%d, overlapWithDel:%d, overlapWithlastBlock:%d, %s",
- pReader, pFBlock->uid, overlapWithNeighbor, hasDup, partiallyRequired, overlapWithKey,
- moreThanOutputCapacity, overlapWithDel, overlapWithlastBlock, pReader->idStr);
+ pReader, pBlockInfo->uid, info.overlapWithNeighborBlock, info.hasDupTs, info.partiallyRequired,
+ info.overlapWithKeyInBuf, info.moreThanCapcity, info.overlapWithDelInfo, info.overlapWithLastBlock,
+ pReader->idStr);
}
return loadDataBlock;
}
+static bool isCleanFileDataBlock(STsdbReader* pReader, SFileDataBlockInfo* pBlockInfo, SDataBlk* pBlock,
+ STableBlockScanInfo* pScanInfo, TSDBKEY keyInBuf, SLastBlockReader* pLastBlockReader) {
+ SDataBlockToLoadInfo info = {0};
+ getBlockToLoadInfo(&info, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader, pReader);
+ bool isCleanFileBlock = !(info.overlapWithNeighborBlock || info.hasDupTs || info.overlapWithKeyInBuf ||
+ info.overlapWithDelInfo || info.overlapWithLastBlock);
+ return isCleanFileBlock;
+}
+
static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, int64_t endKey) {
if (!(pBlockScanInfo->iiter.hasVal || pBlockScanInfo->iter.hasVal)) {
return TSDB_CODE_SUCCESS;
@@ -1434,11 +1655,6 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
tRowMerge(&merge, &fRow1);
doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge);
- // merge with block data if ts == key
- if (mergeBlockData && (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex])) {
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
- }
-
int32_t code = tRowMergerGetRow(&merge, &pTSRow);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -1452,9 +1668,10 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
} else { // not merge block data
tRowMergerInit(&merge, &fRow, pReader->pSchema);
doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge);
+ ASSERT(mergeBlockData);
// merge with block data if ts == key
- if (mergeBlockData && (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex])) {
+ if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) {
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
}
@@ -1917,8 +2134,6 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDum
return true;
}
-static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); }
-
static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScanInfo* pScanInfo, STsdbReader* pReader) {
// the last block reader has been initialized for this table.
if (pLBlockReader->uid == pScanInfo->uid) {
@@ -1932,7 +2147,7 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
initMemDataIterator(pScanInfo, pReader);
pLBlockReader->uid = pScanInfo->uid;
- int32_t step = ASCENDING_TRAVERSE(pLBlockReader->order)? 1:-1;
+ int32_t step = ASCENDING_TRAVERSE(pLBlockReader->order) ? 1 : -1;
STimeWindow w = pLBlockReader->window;
if (ASCENDING_TRAVERSE(pLBlockReader->order)) {
w.skey = pScanInfo->lastKey + step;
@@ -1942,7 +2157,7 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
int32_t code =
tMergeTreeOpen(&pLBlockReader->mergeTree, (pLBlockReader->order == TSDB_ORDER_DESC), pReader->pFileReader,
- pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange, pLBlockReader->pInfo);
+ pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange, pLBlockReader->pInfo, pReader->idStr);
if (code != TSDB_CODE_SUCCESS) {
return false;
}
@@ -1960,12 +2175,11 @@ static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLas
int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key,
STsdbReader* pReader) {
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
-
- TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
-
if (tryCopyDistinctRowFromFileBlock(pReader, pBlockData, key, pDumpInfo)) {
return TSDB_CODE_SUCCESS;
} else {
+ TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
+
STSRow* pTSRow = NULL;
SRowMerger merge = {0};
@@ -1982,21 +2196,25 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc
tRowMergerClear(&merge);
return TSDB_CODE_SUCCESS;
}
-
- return TSDB_CODE_SUCCESS;
}
static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo,
SBlockData* pBlockData, SLastBlockReader* pLastBlockReader) {
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
- int64_t key = (pBlockData->nRow > 0) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN;
- TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
- TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
-
+ int64_t key = (pBlockData->nRow > 0) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN;
if (pBlockScanInfo->iter.hasVal && pBlockScanInfo->iiter.hasVal) {
return doMergeMultiLevelRows(pReader, pBlockScanInfo, pBlockData, pLastBlockReader);
} else {
+ TSDBROW *pRow = NULL, *piRow = NULL;
+ if (pBlockScanInfo->iter.hasVal) {
+ pRow = getValidMemRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
+ }
+
+ if (pBlockScanInfo->iiter.hasVal) {
+ piRow = getValidMemRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
+ }
+
// imem + file + last block
if (pBlockScanInfo->iiter.hasVal) {
return doMergeBufAndFileRows(pReader, pBlockScanInfo, piRow, &pBlockScanInfo->iiter, key, pLastBlockReader);
@@ -2016,20 +2234,29 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
SSDataBlock* pResBlock = pReader->pResBlock;
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter);
+ SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
+
+ int64_t st = taosGetTimestampUs();
STableBlockScanInfo* pBlockScanInfo = NULL;
if (pBlockInfo != NULL) {
pBlockScanInfo = taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
- } else {
+ SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter);
+ TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader);
+
+ // it is a clean block, load it directly
+ if (isCleanFileDataBlock(pReader, pBlockInfo, pBlock, pBlockScanInfo, keyInBuf, pLastBlockReader)) {
+ copyBlockDataToSDataBlock(pReader, pBlockScanInfo);
+ goto _end;
+ }
+ } else { // file blocks not exist
pBlockScanInfo = pReader->status.pTableIter;
}
- SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
SBlockData* pBlockData = &pReader->status.fileBlockData;
int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1;
- int64_t st = taosGetTimestampUs();
while (1) {
// todo check the validate of row in file block
@@ -2072,17 +2299,21 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
}
}
+ _end:
pResBlock->info.uid = pBlockScanInfo->uid;
blockDataUpdateTsWindow(pResBlock, 0);
setComposedBlockFlag(pReader, true);
- int64_t et = taosGetTimestampUs();
+ double el = (taosGetTimestampUs() - st)/1000.0;
+
+ pReader->cost.composedBlocks += 1;
+ pReader->cost.buildComposedBlockTime += el;
if (pResBlock->info.rows > 0) {
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
" rows:%d, elapsed time:%.2f ms %s",
pReader, pBlockScanInfo->uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
- pResBlock->info.rows, (et - st) / 1000.0, pReader->idStr);
+ pResBlock->info.rows, el, pReader->idStr);
}
return TSDB_CODE_SUCCESS;
@@ -2172,7 +2403,7 @@ _err:
return code;
}
-static TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader) {
+TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader) {
TSDBKEY key = {.ts = TSKEY_INITIAL_VAL};
TSDBROW* pRow = getValidMemRow(&pScanInfo->iter, pScanInfo->delSkyline, pReader);
if (pRow != NULL) {
@@ -2368,12 +2599,12 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
}
initLastBlockReader(pLastBlockReader, pScanInfo, pReader);
- TSDBKEY key = getCurrentKeyInBuf(pScanInfo, 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, key, pLastBlockReader)) {
+ } else if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) {
tBlockDataReset(&pStatus->fileBlockData);
code = tBlockDataInit(&pStatus->fileBlockData, pReader->suid, pScanInfo->uid, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
@@ -2387,7 +2618,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
// build composed data block
code = buildComposedDataBlock(pReader);
- } else if (bufferDataInFileBlockGap(pReader->order, key, pBlock)) {
+ } else if (bufferDataInFileBlockGap(pReader->order, keyInBuf, pBlock)) {
// data in memory that are earlier than current file block
// todo rows in buffer should be less than the file block in asc, greater than file block in desc
int64_t endKey = (ASCENDING_TRAVERSE(pReader->order)) ? pBlock->minKey.ts : pBlock->maxKey.ts;
@@ -2584,6 +2815,7 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* ret
if (VND_IS_RSMA(pVnode)) {
int8_t level = 0;
int64_t now = taosGetTimestamp(pVnode->config.tsdbCfg.precision);
+ int64_t offset = TSDB_TICK_PER_SECOND(pVnode->config.tsdbCfg.precision);
for (int8_t i = 0; i < TSDB_RETENTION_MAX; ++i) {
SRetention* pRetention = retentions + level;
@@ -2593,7 +2825,7 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* ret
}
break;
}
- if ((now - pRetention->keep) <= winSKey) {
+ if ((now - pRetention->keep) <= (winSKey + offset)) {
break;
}
++level;
@@ -3118,11 +3350,11 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S
}
SColVal cv = {0};
- int32_t numOfInputCols = taosArrayGetSize(pBlockData->aIdx);
- int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock);
+ int32_t numOfInputCols = pBlockData->aIdx->size;
+ int32_t numOfOutputCols = pResBlock->pDataBlock->size;
while (i < numOfOutputCols && j < numOfInputCols) {
- SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i);
+ SColumnInfoData* pCol = TARRAY_GET_ELEM(pResBlock->pDataBlock, i);
SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j);
if (pData->cid < pCol->info.colId) {
@@ -3364,24 +3596,27 @@ void tsdbReaderClose(STsdbReader* pReader) {
tsdbUntakeReadSnap(pReader->pTsdb, pReader->pReadSnap);
taosMemoryFree(pReader->status.uidCheckInfo.tableUidList);
+ SIOCostSummary* pCost = &pReader->cost;
SFilesetIter* pFilesetIter = &pReader->status.fileIter;
if (pFilesetIter->pLastBlockReader != NULL) {
- tMergeTreeClose(&pFilesetIter->pLastBlockReader->mergeTree);
- pFilesetIter->pLastBlockReader->pInfo = destroyLastBlockLoadInfo(pFilesetIter->pLastBlockReader->pInfo);
- taosMemoryFree(pFilesetIter->pLastBlockReader);
+ SLastBlockReader* pLReader = pFilesetIter->pLastBlockReader;
+ tMergeTreeClose(&pLReader->mergeTree);
+
+ getLastBlockLoadInfo(pLReader->pInfo, &pCost->lastBlockLoad, &pCost->lastBlockLoadTime);
+
+ pLReader->pInfo = destroyLastBlockLoadInfo(pLReader->pInfo);
+ taosMemoryFree(pLReader);
}
- SIOCostSummary* pCost = &pReader->cost;
-
- tsdbDebug("%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64
- " SMA-time:%.2f ms, fileBlocks:%" PRId64
- ", fileBlocks-time:%.2f ms, "
- "build in-memory-block-time:%.2f ms, lastBlocks:%" PRId64
- ", lastBlocks-time:%.2f ms, STableBlockScanInfo size:%.2f Kb %s",
- pReader, pCost->headFileLoad, pCost->headFileLoadTime, pCost->smaDataLoad, pCost->smaLoadTime,
- pCost->numOfBlocks, pCost->blockLoadTime, pCost->buildmemBlock, pCost->lastBlockLoad,
- pCost->lastBlockLoadTime, numOfTables * sizeof(STableBlockScanInfo) / 1000.0, pReader->idStr);
+ tsdbDebug(
+ "%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64
+ " SMA-time:%.2f ms, fileBlocks:%" PRId64 ", fileBlocks-load-time:%.2f ms, "
+ "build in-memory-block-time:%.2f ms, lastBlocks:%" PRId64 ", lastBlocks-time:%.2f ms, composed-blocks:%" PRId64
+ ", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb %s",
+ pReader, pCost->headFileLoad, pCost->headFileLoadTime, pCost->smaDataLoad, pCost->smaLoadTime, pCost->numOfBlocks,
+ pCost->blockLoadTime, pCost->buildmemBlock, pCost->lastBlockLoad, pCost->lastBlockLoadTime, pCost->composedBlocks,
+ pCost->buildComposedBlockTime, numOfTables * sizeof(STableBlockScanInfo) / 1000.0, pReader->idStr);
taosMemoryFree(pReader->idStr);
taosMemoryFree(pReader->pSchema);
@@ -3616,7 +3851,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
- int64_t ts = ASCENDING_TRAVERSE(pReader->order)?pReader->window.skey-1:pReader->window.ekey+1;
+ int64_t ts = ASCENDING_TRAVERSE(pReader->order) ? pReader->window.skey - 1 : pReader->window.ekey + 1;
resetDataBlockScanInfo(pReader->status.pTableMap, ts);
int32_t code = 0;
diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
index 128bfe37da..5fe0b408b1 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
@@ -209,7 +209,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS
int32_t code = 0;
int32_t flag;
int64_t n;
- int32_t szPage = TSDB_DEFAULT_PAGE_SIZE;
+ int32_t szPage = pTsdb->pVnode->config.tsdbPageSize;
SDataFWriter *pWriter = NULL;
char fname[TSDB_FILENAME_LEN];
char hdr[TSDB_FHDR_SIZE] = {0};
@@ -418,21 +418,21 @@ _err:
return code;
}
-int32_t tsdbWriteBlock(SDataFWriter *pWriter, SMapData *mBlock, SBlockIdx *pBlockIdx) {
+int32_t tsdbWriteDataBlk(SDataFWriter *pWriter, SMapData *mDataBlk, SBlockIdx *pBlockIdx) {
int32_t code = 0;
SHeadFile *pHeadFile = &pWriter->fHead;
int64_t size;
int64_t n;
- ASSERT(mBlock->nItem > 0);
+ ASSERT(mDataBlk->nItem > 0);
// alloc
- size = tPutMapData(NULL, mBlock);
+ size = tPutMapData(NULL, mDataBlk);
code = tRealloc(&pWriter->aBuf[0], size);
if (code) goto _err;
// build
- n = tPutMapData(pWriter->aBuf[0], mBlock);
+ n = tPutMapData(pWriter->aBuf[0], mDataBlk);
// write
code = tsdbWriteFile(pWriter->pHeadFD, pHeadFile->size, pWriter->aBuf[0], size);
@@ -446,7 +446,7 @@ int32_t tsdbWriteBlock(SDataFWriter *pWriter, SMapData *mBlock, SBlockIdx *pBloc
tsdbTrace("vgId:%d, write block, file ID:%d commit ID:%d suid:%" PRId64 " uid:%" PRId64 " offset:%" PRId64
" size:%" PRId64 " nItem:%d",
TD_VID(pWriter->pTsdb->pVnode), pWriter->wSet.fid, pHeadFile->commitID, pBlockIdx->suid, pBlockIdx->uid,
- pBlockIdx->offset, pBlockIdx->size, mBlock->nItem);
+ pBlockIdx->offset, pBlockIdx->size, mDataBlk->nItem);
return code;
_err:
@@ -611,28 +611,26 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
int32_t code = 0;
int64_t n;
int64_t size;
- TdFilePtr pOutFD = NULL; // TODO
- TdFilePtr PInFD = NULL; // TODO
+ TdFilePtr pOutFD = NULL;
+ TdFilePtr PInFD = NULL;
+ int32_t szPage = pTsdb->pVnode->config.szPage;
char fNameFrom[TSDB_FILENAME_LEN];
char fNameTo[TSDB_FILENAME_LEN];
// head
tsdbHeadFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pHeadF, fNameFrom);
tsdbHeadFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pHeadF, fNameTo);
-
pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
if (pOutFD == NULL) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
-
PInFD = taosOpenFile(fNameFrom, TD_FILE_READ);
if (PInFD == NULL) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
-
- n = taosFSendFile(pOutFD, PInFD, 0, pSetFrom->pHeadF->size);
+ n = taosFSendFile(pOutFD, PInFD, 0, tsdbLogicToFileSize(pSetFrom->pHeadF->size, szPage));
if (n < 0) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
@@ -643,44 +641,17 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
// data
tsdbDataFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pDataF, fNameFrom);
tsdbDataFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pDataF, fNameTo);
-
pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
if (pOutFD == NULL) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
-
PInFD = taosOpenFile(fNameFrom, TD_FILE_READ);
if (PInFD == NULL) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
-
- n = taosFSendFile(pOutFD, PInFD, 0, pSetFrom->pDataF->size);
- if (n < 0) {
- code = TAOS_SYSTEM_ERROR(errno);
- goto _err;
- }
- taosCloseFile(&pOutFD);
- taosCloseFile(&PInFD);
-
- // stt
- tsdbSttFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->aSttF[0], fNameFrom);
- tsdbSttFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->aSttF[0], fNameTo);
-
- pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
- if (pOutFD == NULL) {
- code = TAOS_SYSTEM_ERROR(errno);
- goto _err;
- }
-
- PInFD = taosOpenFile(fNameFrom, TD_FILE_READ);
- if (PInFD == NULL) {
- code = TAOS_SYSTEM_ERROR(errno);
- goto _err;
- }
-
- n = taosFSendFile(pOutFD, PInFD, 0, pSetFrom->aSttF[0]->size);
+ n = taosFSendFile(pOutFD, PInFD, 0, LOGIC_TO_FILE_OFFSET(pSetFrom->pDataF->size, szPage));
if (n < 0) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
@@ -691,20 +662,17 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
// sma
tsdbSmaFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->pSmaF, fNameFrom);
tsdbSmaFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->pSmaF, fNameTo);
-
pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
if (pOutFD == NULL) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
-
PInFD = taosOpenFile(fNameFrom, TD_FILE_READ);
if (PInFD == NULL) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
-
- n = taosFSendFile(pOutFD, PInFD, 0, pSetFrom->pSmaF->size);
+ n = taosFSendFile(pOutFD, PInFD, 0, tsdbLogicToFileSize(pSetFrom->pSmaF->size, szPage));
if (n < 0) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
@@ -712,6 +680,29 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
taosCloseFile(&pOutFD);
taosCloseFile(&PInFD);
+ // stt
+ for (int8_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
+ tsdbSttFileName(pTsdb, pSetFrom->diskId, pSetFrom->fid, pSetFrom->aSttF[iStt], fNameFrom);
+ tsdbSttFileName(pTsdb, pSetTo->diskId, pSetTo->fid, pSetTo->aSttF[iStt], fNameTo);
+ pOutFD = taosOpenFile(fNameTo, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
+ if (pOutFD == NULL) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+ PInFD = taosOpenFile(fNameFrom, TD_FILE_READ);
+ if (PInFD == NULL) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+ n = taosFSendFile(pOutFD, PInFD, 0, tsdbLogicToFileSize(pSetFrom->aSttF[iStt]->size, szPage));
+ if (n < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+ taosCloseFile(&pOutFD);
+ taosCloseFile(&PInFD);
+ }
+
return code;
_err:
@@ -723,7 +714,7 @@ _err:
int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pSet) {
int32_t code = 0;
SDataFReader *pReader;
- int32_t szPage = TSDB_DEFAULT_PAGE_SIZE;
+ int32_t szPage = pTsdb->pVnode->config.tsdbPageSize;
char fname[TSDB_FILENAME_LEN];
// alloc
@@ -780,7 +771,7 @@ int32_t tsdbDataFReaderClose(SDataFReader **ppReader) {
tsdbCloseFile(&(*ppReader)->pSmaFD);
// stt
- for (int32_t iStt = 0; iStt < TSDB_MAX_STT_FILE; iStt++) {
+ for (int32_t iStt = 0; iStt < TSDB_MAX_STT_TRIGGER; iStt++) {
if ((*ppReader)->aSttFD[iStt]) {
tsdbCloseFile(&(*ppReader)->aSttFD[iStt]);
}
@@ -872,7 +863,7 @@ _err:
return code;
}
-int32_t tsdbReadBlock(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *mBlock) {
+int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *mDataBlk) {
int32_t code = 0;
int64_t offset = pBlockIdx->offset;
int64_t size = pBlockIdx->size;
@@ -886,7 +877,7 @@ int32_t tsdbReadBlock(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *mBl
if (code) goto _err;
// decode
- int64_t n = tGetMapData(pReader->aBuf[0], mBlock);
+ int64_t n = tGetMapData(pReader->aBuf[0], mDataBlk);
if (n < 0) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
@@ -1053,6 +1044,29 @@ _err:
return code;
}
+int32_t tsdbReadDataBlockEx(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData *pBlockData) {
+ int32_t code = 0;
+ SBlockInfo *pBlockInfo = &pDataBlk->aSubBlock[0];
+
+ // alloc
+ code = tRealloc(&pReader->aBuf[0], pBlockInfo->szBlock);
+ if (code) goto _err;
+
+ // read
+ code = tsdbReadFile(pReader->pDataFD, pBlockInfo->offset, pReader->aBuf[0], pBlockInfo->szBlock);
+ if (code) goto _err;
+
+ // decmpr
+ code = tDecmprBlockData(pReader->aBuf[0], pBlockInfo->szBlock, pBlockData, &pReader->aBuf[1]);
+ if (code) goto _err;
+
+ return code;
+
+_err:
+ tsdbError("vgId:%d tsdb read data block ex failed since %s", TD_VID(pReader->pTsdb->pVnode), tstrerror(code));
+ return code;
+}
+
int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData *pBlockData) {
int32_t code = 0;
@@ -1147,8 +1161,8 @@ int32_t tsdbDelFWriterOpen(SDelFWriter **ppWriter, SDelFile *pFile, STsdb *pTsdb
pDelFWriter->fDel = *pFile;
tsdbDelFileName(pTsdb, pFile, fname);
- code =
- tsdbOpenFile(fname, TSDB_DEFAULT_PAGE_SIZE, TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE, &pDelFWriter->pWriteH);
+ code = tsdbOpenFile(fname, pTsdb->pVnode->config.tsdbPageSize, TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE,
+ &pDelFWriter->pWriteH);
if (code) goto _err;
// update header
@@ -1315,7 +1329,7 @@ int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb
pDelFReader->fDel = *pFile;
tsdbDelFileName(pTsdb, pFile, fname);
- code = tsdbOpenFile(fname, TSDB_DEFAULT_PAGE_SIZE, TD_FILE_READ, &pDelFReader->pReadH);
+ code = tsdbOpenFile(fname, pTsdb->pVnode->config.tsdbPageSize, TD_FILE_READ, &pDelFReader->pReadH);
if (code) goto _err;
*ppReader = pDelFReader;
diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c
index d10613e719..d99bf2aa5c 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRetention.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c
@@ -82,8 +82,6 @@ int32_t tsdbDoRetention(STsdb *pTsdb, int64_t now) {
code = tsdbFSUpsertFSet(&fs, &fSet);
if (code) goto _err;
}
-
- /* code */
}
// do change fs
diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
index 9fc5639c5e..99e88a442c 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
@@ -16,6 +16,29 @@
#include "tsdb.h"
// STsdbSnapReader ========================================
+typedef enum { SNAP_DATA_FILE_ITER = 0, SNAP_STT_FILE_ITER } EFIterT;
+typedef struct {
+ SRBTreeNode n;
+ SRowInfo rInfo;
+ EFIterT type;
+ union {
+ struct {
+ SArray* aBlockIdx;
+ int32_t iBlockIdx;
+ SBlockIdx* pBlockIdx;
+ SMapData mBlock;
+ int32_t iBlock;
+ }; // .data file
+ struct {
+ int32_t iStt;
+ SArray* aSttBlk;
+ int32_t iSttBlk;
+ }; // .stt file
+ };
+ SBlockData bData;
+ int32_t iRow;
+} SFDataIter;
+
struct STsdbSnapReader {
STsdb* pTsdb;
int64_t sver;
@@ -26,146 +49,301 @@ struct STsdbSnapReader {
int8_t dataDone;
int32_t fid;
SDataFReader* pDataFReader;
- SArray* aBlockIdx; // SArray
- SArray* aSstBlk; // SArray
- SBlockIdx* pBlockIdx;
- SSttBlk* pSstBlk;
-
- int32_t iBlockIdx;
- int32_t iBlockL;
- SMapData mBlock; // SMapData
- int32_t iBlock;
- SBlockData oBlockData;
- SBlockData nBlockData;
+ SFDataIter* pIter;
+ SRBTree rbt;
+ SFDataIter aFDataIter[TSDB_MAX_STT_TRIGGER + 1];
+ SBlockData bData;
+ SSkmInfo skmTable;
// for del file
int8_t delDone;
SDelFReader* pDelFReader;
SArray* aDelIdx; // SArray
int32_t iDelIdx;
SArray* aDelData; // SArray
+ uint8_t* aBuf[5];
};
+extern int32_t tRowInfoCmprFn(const void* p1, const void* p2);
+extern int32_t tsdbReadDataBlockEx(SDataFReader* pReader, SDataBlk* pDataBlk, SBlockData* pBlockData);
+extern int32_t tsdbUpdateTableSchema(SMeta* pMeta, int64_t suid, int64_t uid, SSkmInfo* pSkmInfo);
+
+static int32_t tsdbSnapReadOpenFile(STsdbSnapReader* pReader) {
+ int32_t code = 0;
+
+ SDFileSet dFileSet = {.fid = pReader->fid};
+ SDFileSet* pSet = taosArraySearch(pReader->fs.aDFileSet, &dFileSet, tDFileSetCmprFn, TD_GT);
+ if (pSet == NULL) return code;
+
+ pReader->fid = pSet->fid;
+ code = tsdbDataFReaderOpen(&pReader->pDataFReader, pReader->pTsdb, pSet);
+ if (code) goto _err;
+
+ pReader->pIter = NULL;
+ tRBTreeCreate(&pReader->rbt, tRowInfoCmprFn);
+
+ // .data file
+ SFDataIter* pIter = &pReader->aFDataIter[0];
+ pIter->type = SNAP_DATA_FILE_ITER;
+
+ code = tsdbReadBlockIdx(pReader->pDataFReader, pIter->aBlockIdx);
+ if (code) goto _err;
+
+ for (pIter->iBlockIdx = 0; pIter->iBlockIdx < taosArrayGetSize(pIter->aBlockIdx); pIter->iBlockIdx++) {
+ pIter->pBlockIdx = (SBlockIdx*)taosArrayGet(pIter->aBlockIdx, pIter->iBlockIdx);
+
+ code = tsdbReadDataBlk(pReader->pDataFReader, pIter->pBlockIdx, &pIter->mBlock);
+ if (code) goto _err;
+
+ for (pIter->iBlock = 0; pIter->iBlock < pIter->mBlock.nItem; pIter->iBlock++) {
+ SDataBlk dataBlk;
+ tMapDataGetItemByIdx(&pIter->mBlock, pIter->iBlock, &dataBlk, tGetDataBlk);
+
+ if (dataBlk.minVer > pReader->ever || dataBlk.maxVer < pReader->sver) continue;
+
+ code = tsdbReadDataBlockEx(pReader->pDataFReader, &dataBlk, &pIter->bData);
+ if (code) goto _err;
+
+ ASSERT(pIter->pBlockIdx->suid == pIter->bData.suid);
+ ASSERT(pIter->pBlockIdx->uid == pIter->bData.uid);
+
+ for (pIter->iRow = 0; pIter->iRow < pIter->bData.nRow; pIter->iRow++) {
+ int64_t rowVer = pIter->bData.aVersion[pIter->iRow];
+
+ if (rowVer >= pReader->sver && rowVer <= pReader->ever) {
+ pIter->rInfo.suid = pIter->pBlockIdx->suid;
+ pIter->rInfo.uid = pIter->pBlockIdx->uid;
+ pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow);
+ goto _add_iter_and_break;
+ }
+ }
+ }
+
+ continue;
+
+ _add_iter_and_break:
+ tRBTreePut(&pReader->rbt, (SRBTreeNode*)pIter);
+ break;
+ }
+
+ // .stt file
+ pIter = &pReader->aFDataIter[1];
+ for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
+ pIter->type = SNAP_STT_FILE_ITER;
+ pIter->iStt = iStt;
+
+ code = tsdbReadSttBlk(pReader->pDataFReader, iStt, pIter->aSttBlk);
+ if (code) goto _err;
+
+ for (pIter->iSttBlk = 0; pIter->iSttBlk < taosArrayGetSize(pIter->aSttBlk); pIter->iSttBlk++) {
+ SSttBlk* pSttBlk = (SSttBlk*)taosArrayGet(pIter->aSttBlk, pIter->iSttBlk);
+
+ if (pSttBlk->minVer > pReader->ever) continue;
+ if (pSttBlk->maxVer < pReader->sver) continue;
+
+ code = tsdbReadSttBlock(pReader->pDataFReader, iStt, pSttBlk, &pIter->bData);
+ if (code) goto _err;
+
+ for (pIter->iRow = 0; pIter->iRow < pIter->bData.nRow; pIter->iRow++) {
+ int64_t rowVer = pIter->bData.aVersion[pIter->iRow];
+
+ if (rowVer >= pReader->sver && rowVer <= pReader->ever) {
+ pIter->rInfo.suid = pIter->bData.suid;
+ pIter->rInfo.uid = pIter->bData.uid;
+ pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow);
+ goto _add_iter;
+ }
+ }
+ }
+
+ continue;
+
+ _add_iter:
+ tRBTreePut(&pReader->rbt, (SRBTreeNode*)pIter);
+ pIter++;
+ }
+
+ tsdbInfo("vgId:%d, vnode snapshot tsdb open data file to read for %s, fid:%d", TD_VID(pReader->pTsdb->pVnode),
+ pReader->pTsdb->path, pReader->fid);
+ return code;
+
+_err:
+ tsdbError("vgId:%d vnode snapshot tsdb snap read open file failed since %s", TD_VID(pReader->pTsdb->pVnode),
+ tstrerror(code));
+ return code;
+}
+
+static SRowInfo* tsdbSnapGetRow(STsdbSnapReader* pReader) { return pReader->pIter ? &pReader->pIter->rInfo : NULL; }
+
+static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) {
+ int32_t code = 0;
+
+ if (pReader->pIter) {
+ SFDataIter* pIter = pReader->pIter;
+
+ while (true) {
+ _find_row:
+ for (pIter->iRow++; pIter->iRow < pIter->bData.nRow; pIter->iRow++) {
+ int64_t rowVer = pIter->bData.aVersion[pIter->iRow];
+
+ if (rowVer >= pReader->sver && rowVer <= pReader->ever) {
+ pIter->rInfo.uid = pIter->bData.uid ? pIter->bData.uid : pIter->bData.aUid[pIter->iRow];
+ pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow);
+ goto _out;
+ }
+ }
+
+ if (pIter->type == SNAP_DATA_FILE_ITER) {
+ while (true) {
+ for (pIter->iBlock++; pIter->iBlock < pIter->mBlock.nItem; pIter->iBlock++) {
+ SDataBlk dataBlk;
+ tMapDataGetItemByIdx(&pIter->mBlock, pIter->iBlock, &dataBlk, tGetDataBlk);
+
+ if (dataBlk.minVer > pReader->ever || dataBlk.maxVer < pReader->sver) continue;
+
+ code = tsdbReadDataBlockEx(pReader->pDataFReader, &dataBlk, &pIter->bData);
+ if (code) goto _err;
+
+ pIter->iRow = -1;
+ goto _find_row;
+ }
+
+ pIter->iBlockIdx++;
+ if (pIter->iBlockIdx >= taosArrayGetSize(pIter->aBlockIdx)) break;
+
+ pIter->pBlockIdx = (SBlockIdx*)taosArrayGet(pIter->aBlockIdx, pIter->iBlockIdx);
+ code = tsdbReadDataBlk(pReader->pDataFReader, pIter->pBlockIdx, &pIter->mBlock);
+ if (code) goto _err;
+ pIter->iBlock = -1;
+ }
+
+ pReader->pIter = NULL;
+ } else if (pIter->type == SNAP_STT_FILE_ITER) {
+ for (pIter->iSttBlk++; pIter->iSttBlk < taosArrayGetSize(pIter->aSttBlk); pIter->iSttBlk++) {
+ SSttBlk* pSttBlk = (SSttBlk*)taosArrayGet(pIter->aSttBlk, pIter->iSttBlk);
+
+ if (pSttBlk->minVer > pReader->ever || pSttBlk->maxVer < pReader->sver) continue;
+
+ code = tsdbReadSttBlock(pReader->pDataFReader, pIter->iStt, pSttBlk, &pIter->bData);
+ if (code) goto _err;
+
+ pIter->iRow = -1;
+ goto _find_row;
+ }
+
+ pReader->pIter = NULL;
+ } else {
+ ASSERT(0);
+ }
+ }
+
+ _out:
+ pIter = (SFDataIter*)tRBTreeMin(&pReader->rbt);
+ if (pReader->pIter && pIter) {
+ int32_t c = tRowInfoCmprFn(&pReader->pIter->rInfo, &pIter->rInfo);
+ if (c > 0) {
+ tRBTreePut(&pReader->rbt, (SRBTreeNode*)pReader->pIter);
+ pReader->pIter = NULL;
+ } else {
+ ASSERT(c);
+ }
+ }
+ }
+
+ if (pReader->pIter == NULL) {
+ pReader->pIter = (SFDataIter*)tRBTreeMin(&pReader->rbt);
+ if (pReader->pIter) {
+ tRBTreeDrop(&pReader->rbt, (SRBTreeNode*)pReader->pIter);
+ }
+ }
+
+ return code;
+
+_err:
+ return code;
+}
+
+static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) {
+ int32_t code = 0;
+
+ ASSERT(pReader->bData.nRow);
+
+ int32_t aBufN[5] = {0};
+ code = tCmprBlockData(&pReader->bData, TWO_STAGE_COMP, NULL, NULL, pReader->aBuf, aBufN);
+ if (code) goto _exit;
+
+ int32_t size = aBufN[0] + aBufN[1] + aBufN[2] + aBufN[3];
+ *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
+ if (*ppData == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _exit;
+ }
+
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)*ppData;
+ pHdr->type = SNAP_DATA_TSDB;
+ pHdr->size = size;
+
+ memcpy(pHdr->data, pReader->aBuf[3], aBufN[3]);
+ memcpy(pHdr->data + aBufN[3], pReader->aBuf[2], aBufN[2]);
+ if (aBufN[1]) {
+ memcpy(pHdr->data + aBufN[3] + aBufN[2], pReader->aBuf[1], aBufN[1]);
+ }
+ if (aBufN[0]) {
+ memcpy(pHdr->data + aBufN[3] + aBufN[2] + aBufN[1], pReader->aBuf[0], aBufN[0]);
+ }
+
+_exit:
+ return code;
+}
+
static int32_t tsdbSnapReadData(STsdbSnapReader* pReader, uint8_t** ppData) {
int32_t code = 0;
STsdb* pTsdb = pReader->pTsdb;
while (true) {
if (pReader->pDataFReader == NULL) {
- // next
- SDFileSet dFileSet = {.fid = pReader->fid};
- SDFileSet* pSet = taosArraySearch(pReader->fs.aDFileSet, &dFileSet, tDFileSetCmprFn, TD_GT);
- if (pSet == NULL) goto _exit;
- pReader->fid = pSet->fid;
-
- // load
- code = tsdbDataFReaderOpen(&pReader->pDataFReader, pTsdb, pSet);
+ code = tsdbSnapReadOpenFile(pReader);
if (code) goto _err;
-
- code = tsdbReadBlockIdx(pReader->pDataFReader, pReader->aBlockIdx);
- if (code) goto _err;
-
- code = tsdbReadSttBlk(pReader->pDataFReader, 0, pReader->aSstBlk);
- if (code) goto _err;
-
- // init
- pReader->iBlockIdx = 0;
- if (pReader->iBlockIdx < taosArrayGetSize(pReader->aBlockIdx)) {
- pReader->pBlockIdx = (SBlockIdx*)taosArrayGet(pReader->aBlockIdx, pReader->iBlockIdx);
-
- code = tsdbReadBlock(pReader->pDataFReader, pReader->pBlockIdx, &pReader->mBlock);
- if (code) goto _err;
-
- pReader->iBlock = 0;
- } else {
- pReader->pBlockIdx = NULL;
- }
-
- pReader->iBlockL = 0;
- while (true) {
- if (pReader->iBlockL >= taosArrayGetSize(pReader->aSstBlk)) {
- pReader->pSstBlk = NULL;
- break;
- }
-
- pReader->pSstBlk = (SSttBlk*)taosArrayGet(pReader->aSstBlk, pReader->iBlockL);
- if (pReader->pSstBlk->minVer <= pReader->ever && pReader->pSstBlk->maxVer >= pReader->sver) {
- // TODO
- break;
- }
-
- pReader->iBlockL++;
- }
-
- tsdbInfo("vgId:%d, vnode snapshot tsdb open data file to read for %s, fid:%d", TD_VID(pTsdb->pVnode), pTsdb->path,
- pReader->fid);
}
- while (true) {
- if (pReader->pBlockIdx && pReader->pSstBlk) {
- TABLEID id = {.suid = pReader->pSstBlk->suid, .uid = pReader->pSstBlk->minUid};
+ if (pReader->pDataFReader == NULL) break;
- ASSERT(0);
+ SRowInfo* pRowInfo = tsdbSnapGetRow(pReader);
+ if (pRowInfo == NULL) {
+ tsdbDataFReaderClose(&pReader->pDataFReader);
+ continue;
+ }
- // if (tTABLEIDCmprFn(pReader->pBlockIdx, &minId) < 0) {
- // // TODO
- // } else if (tTABLEIDCmprFn(pReader->pBlockIdx, &maxId) < 0) {
- // // TODO
- // } else {
- // // TODO
- // }
- } else if (pReader->pBlockIdx) {
- while (pReader->iBlock < pReader->mBlock.nItem) {
- SDataBlk block;
- tMapDataGetItemByIdx(&pReader->mBlock, pReader->iBlock, &block, tGetDataBlk);
+ TABLEID id = {.suid = pRowInfo->suid, .uid = pRowInfo->uid};
+ SBlockData* pBlockData = &pReader->bData;
- if (block.minVer <= pReader->ever && block.maxVer >= pReader->sver) {
- // load data (todo)
- }
+ code = tsdbUpdateTableSchema(pTsdb->pVnode->pMeta, id.suid, id.uid, &pReader->skmTable);
+ if (code) goto _err;
- // next
- pReader->iBlock++;
- if (*ppData) break;
- }
+ code = tBlockDataInit(pBlockData, id.suid, id.uid, pReader->skmTable.pTSchema);
+ if (code) goto _err;
- if (pReader->iBlock >= pReader->mBlock.nItem) {
- pReader->iBlockIdx++;
- if (pReader->iBlockIdx < taosArrayGetSize(pReader->aBlockIdx)) {
- pReader->pBlockIdx = (SBlockIdx*)taosArrayGet(pReader->aBlockIdx, pReader->iBlockIdx);
+ while (pRowInfo->suid == id.suid && pRowInfo->uid == id.uid) {
+ code = tBlockDataAppendRow(pBlockData, &pRowInfo->row, NULL, pRowInfo->uid);
+ if (code) goto _err;
- code = tsdbReadBlock(pReader->pDataFReader, pReader->pBlockIdx, &pReader->mBlock);
- if (code) goto _err;
+ code = tsdbSnapNextRow(pReader);
+ if (code) goto _err;
- pReader->iBlock = 0;
- } else {
- pReader->pBlockIdx = NULL;
- }
- }
-
- if (*ppData) goto _exit;
- } else if (pReader->pSstBlk) {
- while (pReader->pSstBlk) {
- if (pReader->pSstBlk->minVer <= pReader->ever && pReader->pSstBlk->maxVer >= pReader->sver) {
- // load data (todo)
- }
-
- // next
- pReader->iBlockL++;
- if (pReader->iBlockL < taosArrayGetSize(pReader->aSstBlk)) {
- pReader->pSstBlk = (SSttBlk*)taosArrayGetSize(pReader->aSstBlk);
- } else {
- pReader->pSstBlk = NULL;
- }
-
- if (*ppData) goto _exit;
- }
- } else {
+ pRowInfo = tsdbSnapGetRow(pReader);
+ if (pRowInfo == NULL) {
tsdbDataFReaderClose(&pReader->pDataFReader);
break;
}
+
+ if (pBlockData->nRow >= 4096) break;
}
+
+ code = tsdbSnapCmprData(pReader, ppData);
+ if (code) goto _err;
+
+ break;
}
-_exit:
return code;
_err:
@@ -216,7 +394,6 @@ static int32_t tsdbSnapReadDel(STsdbSnapReader* pReader, uint8_t** ppData) {
size += tPutDelData(NULL, pDelData);
}
}
-
if (size == 0) continue;
// org data
@@ -292,23 +469,33 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, int8_t type
goto _err;
}
+ // data
pReader->fid = INT32_MIN;
- pReader->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
- if (pReader->aBlockIdx == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
+ for (int32_t iIter = 0; iIter < sizeof(pReader->aFDataIter) / sizeof(pReader->aFDataIter[0]); iIter++) {
+ SFDataIter* pIter = &pReader->aFDataIter[iIter];
+
+ if (iIter == 0) {
+ pIter->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
+ if (pIter->aBlockIdx == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+ } else {
+ pIter->aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
+ if (pIter->aSttBlk == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+ }
+
+ code = tBlockDataCreate(&pIter->bData);
+ if (code) goto _err;
}
- pReader->aSstBlk = taosArrayInit(0, sizeof(SSttBlk));
- if (pReader->aSstBlk == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
- pReader->mBlock = tMapDataInit();
- code = tBlockDataCreate(&pReader->oBlockData);
- if (code) goto _err;
- code = tBlockDataCreate(&pReader->nBlockData);
+
+ code = tBlockDataCreate(&pReader->bData);
if (code) goto _err;
+ // del
pReader->aDelIdx = taosArrayInit(0, sizeof(SDelIdx));
if (pReader->aDelIdx == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -335,18 +522,26 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
int32_t code = 0;
STsdbSnapReader* pReader = *ppReader;
- if (pReader->pDataFReader) {
- tsdbDataFReaderClose(&pReader->pDataFReader);
- }
- taosArrayDestroy(pReader->aSstBlk);
- taosArrayDestroy(pReader->aBlockIdx);
- tMapDataClear(&pReader->mBlock);
- tBlockDataDestroy(&pReader->oBlockData, 1);
- tBlockDataDestroy(&pReader->nBlockData, 1);
+ // data
+ if (pReader->pDataFReader) tsdbDataFReaderClose(&pReader->pDataFReader);
+ for (int32_t iIter = 0; iIter < sizeof(pReader->aFDataIter) / sizeof(pReader->aFDataIter[0]); iIter++) {
+ SFDataIter* pIter = &pReader->aFDataIter[iIter];
- if (pReader->pDelFReader) {
- tsdbDelFReaderClose(&pReader->pDelFReader);
+ if (iIter == 0) {
+ taosArrayDestroy(pIter->aBlockIdx);
+ tMapDataClear(&pIter->mBlock);
+ } else {
+ taosArrayDestroy(pIter->aSttBlk);
+ }
+
+ tBlockDataDestroy(&pIter->bData, 1);
}
+
+ tBlockDataDestroy(&pReader->bData, 1);
+ tTSchemaDestroy(pReader->skmTable.pTSchema);
+
+ // del
+ if (pReader->pDelFReader) tsdbDelFReaderClose(&pReader->pDelFReader);
taosArrayDestroy(pReader->aDelIdx);
taosArrayDestroy(pReader->aDelData);
@@ -354,6 +549,10 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
tsdbInfo("vgId:%d, vnode snapshot tsdb reader closed for %s", TD_VID(pReader->pTsdb->pVnode), pReader->pTsdb->path);
+ for (int32_t iBuf = 0; iBuf < sizeof(pReader->aBuf) / sizeof(pReader->aBuf[0]); iBuf++) {
+ tFree(pReader->aBuf[iBuf]);
+ }
+
taosMemoryFree(pReader);
*ppReader = NULL;
return code;
@@ -410,40 +609,37 @@ struct STsdbSnapWriter {
STsdbFS fs;
// config
- int32_t minutes;
- int8_t precision;
- int32_t minRow;
- int32_t maxRow;
- int8_t cmprAlg;
- int64_t commitID;
-
+ int32_t minutes;
+ int8_t precision;
+ int32_t minRow;
+ int32_t maxRow;
+ int8_t cmprAlg;
+ int64_t commitID;
uint8_t* aBuf[5];
+
// for data file
SBlockData bData;
-
- int32_t fid;
- SDataFReader* pDataFReader;
- SArray* aBlockIdx; // SArray
- int32_t iBlockIdx;
- SBlockIdx* pBlockIdx;
- SMapData mBlock; // SMapData
- int32_t iBlock;
- SBlockData* pBlockData;
- int32_t iRow;
- SBlockData bDataR;
- SArray* aSstBlk; // SArray
- int32_t iBlockL;
- SBlockData lDataR;
-
- SDataFWriter* pDataFWriter;
- SBlockIdx* pBlockIdxW; // NULL when no committing table
- SDataBlk blockW;
- SBlockData bDataW;
- SBlockIdx blockIdxW;
-
- SMapData mBlockW; // SMapData
- SArray* aBlockIdxW; // SArray
- SArray* aBlockLW; // SArray
+ int32_t fid;
+ TABLEID id;
+ SSkmInfo skmTable;
+ struct {
+ SDataFReader* pReader;
+ SArray* aBlockIdx;
+ int32_t iBlockIdx;
+ SBlockIdx* pBlockIdx;
+ SMapData mDataBlk;
+ int32_t iDataBlk;
+ SBlockData bData;
+ int32_t iRow;
+ } dReader;
+ struct {
+ SDataFWriter* pWriter;
+ SArray* aBlockIdx;
+ SMapData mDataBlk;
+ SArray* aSttBlk;
+ SBlockData bData;
+ SBlockData sData;
+ } dWriter;
// for del file
SDelFReader* pDelFReader;
@@ -454,520 +650,447 @@ struct STsdbSnapWriter {
SArray* aDelIdxW;
};
+// SNAP_DATA_TSDB
+extern int32_t tsdbWriteDataBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SMapData* mDataBlk, int8_t cmprAlg);
+extern int32_t tsdbWriteSttBlock(SDataFWriter* pWriter, SBlockData* pBlockData, SArray* aSttBlk, int8_t cmprAlg);
+
+static int32_t tsdbSnapNextTableData(STsdbSnapWriter* pWriter) {
+ int32_t code = 0;
+
+ ASSERT(pWriter->dReader.iRow >= pWriter->dReader.bData.nRow);
+
+ if (pWriter->dReader.iBlockIdx < taosArrayGetSize(pWriter->dReader.aBlockIdx)) {
+ pWriter->dReader.pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->dReader.aBlockIdx, pWriter->dReader.iBlockIdx);
+
+ code = tsdbReadDataBlk(pWriter->dReader.pReader, pWriter->dReader.pBlockIdx, &pWriter->dReader.mDataBlk);
+ if (code) goto _exit;
+
+ pWriter->dReader.iBlockIdx++;
+ } else {
+ pWriter->dReader.pBlockIdx = NULL;
+ tMapDataReset(&pWriter->dReader.mDataBlk);
+ }
+ pWriter->dReader.iDataBlk = 0; // point to the next one
+ tBlockDataReset(&pWriter->dReader.bData);
+ pWriter->dReader.iRow = 0;
+
+_exit:
+ return code;
+}
+
+static int32_t tsdbSnapWriteCopyData(STsdbSnapWriter* pWriter, TABLEID* pId) {
+ int32_t code = 0;
+
+ while (true) {
+ if (pWriter->dReader.pBlockIdx == NULL) break;
+ if (tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, pId) >= 0) break;
+
+ SBlockIdx blkIdx = *pWriter->dReader.pBlockIdx;
+ code = tsdbWriteDataBlk(pWriter->dWriter.pWriter, &pWriter->dReader.mDataBlk, &blkIdx);
+ if (code) goto _exit;
+
+ if (taosArrayPush(pWriter->dWriter.aBlockIdx, &blkIdx) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _exit;
+ }
+
+ code = tsdbSnapNextTableData(pWriter);
+ if (code) goto _exit;
+ }
+
+_exit:
+ return code;
+}
+
+static int32_t tsdbSnapWriteTableDataStart(STsdbSnapWriter* pWriter, TABLEID* pId) {
+ int32_t code = 0;
+
+ code = tsdbSnapWriteCopyData(pWriter, pId);
+ if (code) goto _err;
+
+ pWriter->id.suid = pId->suid;
+ pWriter->id.uid = pId->uid;
+
+ code = tsdbUpdateTableSchema(pWriter->pTsdb->pVnode->pMeta, pId->suid, pId->uid, &pWriter->skmTable);
+ if (code) goto _err;
+
+ tMapDataReset(&pWriter->dWriter.mDataBlk);
+ code = tBlockDataInit(&pWriter->dWriter.bData, pId->suid, pId->uid, pWriter->skmTable.pTSchema);
+ if (code) goto _err;
+
+ return code;
+
+_err:
+ tsdbError("vgId:%d %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
+ return code;
+}
+
static int32_t tsdbSnapWriteTableDataEnd(STsdbSnapWriter* pWriter) {
int32_t code = 0;
- ASSERT(pWriter->pDataFWriter);
+ if (pWriter->id.suid == 0 && pWriter->id.uid == 0) return code;
- if (pWriter->pBlockIdxW == NULL) goto _exit;
+ int32_t c = 1;
+ if (pWriter->dReader.pBlockIdx) {
+ c = tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, &pWriter->id);
+ ASSERT(c >= 0);
+ }
- // consume remain rows
- if (pWriter->pBlockData) {
- ASSERT(pWriter->iRow < pWriter->pBlockData->nRow);
- while (pWriter->iRow < pWriter->pBlockData->nRow) {
- code = tBlockDataAppendRow(&pWriter->bDataW, &tsdbRowFromBlockData(pWriter->pBlockData, pWriter->iRow), NULL,
- 0); // todo
+ if (c == 0) {
+ SBlockData* pBData = &pWriter->dWriter.bData;
+
+ for (; pWriter->dReader.iRow < pWriter->dReader.bData.nRow; pWriter->dReader.iRow++) {
+ TSDBROW row = tsdbRowFromBlockData(&pWriter->dReader.bData, pWriter->dReader.iRow);
+
+ code = tBlockDataAppendRow(pBData, &row, NULL, pWriter->id.uid);
if (code) goto _err;
- if (pWriter->bDataW.nRow >= pWriter->maxRow * 4 / 5) {
- // pWriter->blockW.last = 0;
- // code = tsdbWriteBlockData(pWriter->pDataFWriter, &pWriter->bDataW, NULL, NULL, pWriter->pBlockIdxW,
- // &pWriter->blockW, pWriter->cmprAlg);
+ if (pBData->nRow >= pWriter->maxRow) {
+ code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, pBData, &pWriter->dWriter.mDataBlk, pWriter->cmprAlg);
if (code) goto _err;
-
- code = tMapDataPutItem(&pWriter->mBlockW, &pWriter->blockW, tPutDataBlk);
- if (code) goto _err;
-
- tDataBlkReset(&pWriter->blockW);
- tBlockDataClear(&pWriter->bDataW);
- }
-
- pWriter->iRow++;
- }
- }
-
- // write remain data if has
- if (pWriter->bDataW.nRow > 0) {
- // pWriter->blockW.last = 0;
- if (pWriter->bDataW.nRow < pWriter->minRow) {
- if (pWriter->iBlock > pWriter->mBlock.nItem) {
- // pWriter->blockW.last = 1;
}
}
- // code = tsdbWriteBlockData(pWriter->pDataFWriter, &pWriter->bDataW, NULL, NULL, pWriter->pBlockIdxW,
- // &pWriter->blockW, pWriter->cmprAlg);
- // if (code) goto _err;
-
- code = tMapDataPutItem(&pWriter->mBlockW, &pWriter->blockW, tPutDataBlk);
- if (code) goto _err;
- }
-
- while (true) {
- if (pWriter->iBlock >= pWriter->mBlock.nItem) break;
-
- SDataBlk block;
- tMapDataGetItemByIdx(&pWriter->mBlock, pWriter->iBlock, &block, tGetDataBlk);
-
- // if (block.last) {
- // code = tsdbReadBlockData(pWriter->pDataFReader, pWriter->pBlockIdx, &block, &pWriter->bDataR, NULL, NULL);
- // if (code) goto _err;
-
- // tBlockReset(&block);
- // block.last = 1;
- // code = tsdbWriteBlockData(pWriter->pDataFWriter, &pWriter->bDataR, NULL, NULL, pWriter->pBlockIdxW, &block,
- // pWriter->cmprAlg);
- // if (code) goto _err;
- // }
-
- code = tMapDataPutItem(&pWriter->mBlockW, &block, tPutDataBlk);
+ code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, pBData, &pWriter->dWriter.mDataBlk, pWriter->cmprAlg);
if (code) goto _err;
- pWriter->iBlock++;
- }
+ for (; pWriter->dReader.iDataBlk < pWriter->dReader.mDataBlk.nItem; pWriter->dReader.iDataBlk++) {
+ SDataBlk dataBlk;
+ tMapDataGetItemByIdx(&pWriter->dReader.mDataBlk, pWriter->dReader.iDataBlk, &dataBlk, tGetDataBlk);
- // SDataBlk
- // code = tsdbWriteBlock(pWriter->pDataFWriter, &pWriter->mBlockW, NULL, pWriter->pBlockIdxW);
- // if (code) goto _err;
-
- // SBlockIdx
- if (taosArrayPush(pWriter->aBlockIdxW, pWriter->pBlockIdxW) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
-
-_exit:
- tsdbInfo("vgId:%d, tsdb snapshot write table data end for %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
- return code;
-
-_err:
- tsdbError("vgId:%d, tsdb snapshot write table data end for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
- pWriter->pTsdb->path, tstrerror(code));
- return code;
-}
-
-static int32_t tsdbSnapMoveWriteTableData(STsdbSnapWriter* pWriter, SBlockIdx* pBlockIdx) {
- int32_t code = 0;
-
- code = tsdbReadBlock(pWriter->pDataFReader, pBlockIdx, &pWriter->mBlock);
- if (code) goto _err;
-
- // SBlockData
- SDataBlk block;
- tMapDataReset(&pWriter->mBlockW);
- for (int32_t iBlock = 0; iBlock < pWriter->mBlock.nItem; iBlock++) {
- tMapDataGetItemByIdx(&pWriter->mBlock, iBlock, &block, tGetDataBlk);
-
- // if (block.last) {
- // code = tsdbReadBlockData(pWriter->pDataFReader, pBlockIdx, &block, &pWriter->bDataR, NULL, NULL);
- // if (code) goto _err;
-
- // tBlockReset(&block);
- // block.last = 1;
- // code =
- // tsdbWriteBlockData(pWriter->pDataFWriter, &pWriter->bDataR, NULL, NULL, pBlockIdx, &block,
- // pWriter->cmprAlg);
- // if (code) goto _err;
- // }
-
- code = tMapDataPutItem(&pWriter->mBlockW, &block, tPutDataBlk);
- if (code) goto _err;
- }
-
- // SDataBlk
- SBlockIdx blockIdx = {.suid = pBlockIdx->suid, .uid = pBlockIdx->uid};
- code = tsdbWriteBlock(pWriter->pDataFWriter, &pWriter->mBlockW, &blockIdx);
- if (code) goto _err;
-
- // SBlockIdx
- if (taosArrayPush(pWriter->aBlockIdxW, &blockIdx) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
-
-_exit:
- return code;
-
-_err:
- tsdbError("vgId:%d, tsdb snapshot move write table data for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
- pWriter->pTsdb->path, tstrerror(code));
- return code;
-}
-
-static int32_t tsdbSnapWriteTableDataImpl(STsdbSnapWriter* pWriter) {
- int32_t code = 0;
- SBlockData* pBlockData = &pWriter->bData;
- int32_t iRow = 0;
- TSDBROW row;
- TSDBROW* pRow = &row;
-
- // // correct schema
- // code = tBlockDataCorrectSchema(&pWriter->bDataW, pBlockData);
- // if (code) goto _err;
-
- // loop to merge
- *pRow = tsdbRowFromBlockData(pBlockData, iRow);
- while (true) {
- if (pRow == NULL) break;
-
- if (pWriter->pBlockData) {
- ASSERT(pWriter->iRow < pWriter->pBlockData->nRow);
-
- int32_t c = tsdbRowCmprFn(pRow, &tsdbRowFromBlockData(pWriter->pBlockData, pWriter->iRow));
-
- ASSERT(c);
-
- if (c < 0) {
- // code = tBlockDataAppendRow(&pWriter->bDataW, pRow, NULL);
- // if (code) goto _err;
-
- iRow++;
- if (iRow < pWriter->pBlockData->nRow) {
- *pRow = tsdbRowFromBlockData(pBlockData, iRow);
- } else {
- pRow = NULL;
- }
- } else if (c > 0) {
- // code = tBlockDataAppendRow(&pWriter->bDataW, &tsdbRowFromBlockData(pWriter->pBlockData, pWriter->iRow),
- // NULL); if (code) goto _err;
-
- pWriter->iRow++;
- if (pWriter->iRow >= pWriter->pBlockData->nRow) {
- pWriter->pBlockData = NULL;
- }
- }
- } else {
- TSDBKEY key = TSDBROW_KEY(pRow);
-
- while (true) {
- if (pWriter->iBlock >= pWriter->mBlock.nItem) break;
-
- SDataBlk block;
- int32_t c;
-
- tMapDataGetItemByIdx(&pWriter->mBlock, pWriter->iBlock, &block, tGetDataBlk);
-
- // if (block.last) {
- // pWriter->pBlockData = &pWriter->bDataR;
-
- // code = tsdbReadBlockData(pWriter->pDataFReader, pWriter->pBlockIdx, &block, pWriter->pBlockData, NULL,
- // NULL); if (code) goto _err; pWriter->iRow = 0;
-
- // pWriter->iBlock++;
- // break;
- // }
-
- c = tsdbKeyCmprFn(&block.maxKey, &key);
-
- ASSERT(c);
-
- if (c < 0) {
- if (pWriter->bDataW.nRow) {
- // pWriter->blockW.last = 0;
- // code = tsdbWriteBlockData(pWriter->pDataFWriter, &pWriter->bDataW, NULL, NULL, pWriter->pBlockIdxW,
- // &pWriter->blockW, pWriter->cmprAlg);
- // if (code) goto _err;
-
- code = tMapDataPutItem(&pWriter->mBlockW, &pWriter->blockW, tPutDataBlk);
- if (code) goto _err;
-
- tDataBlkReset(&pWriter->blockW);
- tBlockDataClear(&pWriter->bDataW);
- }
-
- code = tMapDataPutItem(&pWriter->mBlockW, &block, tPutDataBlk);
- if (code) goto _err;
-
- pWriter->iBlock++;
- } else {
- c = tsdbKeyCmprFn(&tBlockDataLastKey(pBlockData), &block.minKey);
-
- ASSERT(c);
-
- if (c > 0) {
- pWriter->pBlockData = &pWriter->bDataR;
- // code =
- // tsdbReadBlockData(pWriter->pDataFReader, pWriter->pBlockIdx, &block, pWriter->pBlockData, NULL,
- // NULL);
- // if (code) goto _err;
- pWriter->iRow = 0;
-
- pWriter->iBlock++;
- }
- break;
- }
- }
-
- if (pWriter->pBlockData) continue;
-
- // code = tBlockDataAppendRow(&pWriter->bDataW, pRow, NULL);
- // if (code) goto _err;
-
- iRow++;
- if (iRow < pBlockData->nRow) {
- *pRow = tsdbRowFromBlockData(pBlockData, iRow);
- } else {
- pRow = NULL;
- }
- }
-
- _check_write:
- if (pWriter->bDataW.nRow < pWriter->maxRow * 4 / 5) continue;
-
- _write_block:
- // code = tsdbWriteBlockData(pWriter->pDataFWriter, &pWriter->bDataW, NULL, NULL, pWriter->pBlockIdxW,
- // &pWriter->blockW, pWriter->cmprAlg);
- // if (code) goto _err;
-
- code = tMapDataPutItem(&pWriter->mBlockW, &pWriter->blockW, tPutDataBlk);
- if (code) goto _err;
-
- tDataBlkReset(&pWriter->blockW);
- tBlockDataClear(&pWriter->bDataW);
- }
-
- return code;
-
-_err:
- tsdbError("vgId:%d, vnode snapshot tsdb write table data impl for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
- pWriter->pTsdb->path, tstrerror(code));
- return code;
-}
-
-static int32_t tsdbSnapWriteTableData(STsdbSnapWriter* pWriter, TABLEID id) {
- int32_t code = 0;
- SBlockData* pBlockData = &pWriter->bData;
- TSDBKEY keyFirst = tBlockDataFirstKey(pBlockData);
- TSDBKEY keyLast = tBlockDataLastKey(pBlockData);
-
- // end last table write if should
- if (pWriter->pBlockIdxW) {
- int32_t c = tTABLEIDCmprFn(pWriter->pBlockIdxW, &id);
- if (c < 0) {
- // end
- code = tsdbSnapWriteTableDataEnd(pWriter);
+ code = tMapDataPutItem(&pWriter->dWriter.mDataBlk, &dataBlk, tPutDataBlk);
if (code) goto _err;
+ }
- // reset
- pWriter->pBlockIdxW = NULL;
- } else if (c > 0) {
- ASSERT(0);
+ code = tsdbSnapNextTableData(pWriter);
+ if (code) goto _err;
+ }
+
+ if (pWriter->dWriter.mDataBlk.nItem) {
+ SBlockIdx blockIdx = {.suid = pWriter->id.suid, .uid = pWriter->id.uid};
+ code = tsdbWriteDataBlk(pWriter->dWriter.pWriter, &pWriter->dWriter.mDataBlk, &blockIdx);
+
+ if (taosArrayPush(pWriter->dWriter.aBlockIdx, &blockIdx) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
}
}
- // start new table data write if need
- if (pWriter->pBlockIdxW == NULL) {
- // write table data ahead
- while (true) {
- if (pWriter->iBlockIdx >= taosArrayGetSize(pWriter->aBlockIdx)) break;
+ pWriter->id.suid = 0;
+ pWriter->id.uid = 0;
- SBlockIdx* pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->aBlockIdx, pWriter->iBlockIdx);
- int32_t c = tTABLEIDCmprFn(pBlockIdx, &id);
-
- if (c >= 0) break;
-
- code = tsdbSnapMoveWriteTableData(pWriter, pBlockIdx);
- if (code) goto _err;
-
- pWriter->iBlockIdx++;
- }
-
- // reader
- pWriter->pBlockIdx = NULL;
- if (pWriter->iBlockIdx < taosArrayGetSize(pWriter->aBlockIdx)) {
- ASSERT(pWriter->pDataFReader);
-
- SBlockIdx* pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->aBlockIdx, pWriter->iBlockIdx);
- int32_t c = tTABLEIDCmprFn(pBlockIdx, &id);
-
- ASSERT(c >= 0);
-
- if (c == 0) {
- pWriter->pBlockIdx = pBlockIdx;
- pWriter->iBlockIdx++;
- }
- }
-
- if (pWriter->pBlockIdx) {
- code = tsdbReadBlock(pWriter->pDataFReader, pWriter->pBlockIdx, &pWriter->mBlock);
- if (code) goto _err;
- } else {
- tMapDataReset(&pWriter->mBlock);
- }
- pWriter->iBlock = 0;
- pWriter->pBlockData = NULL;
- pWriter->iRow = 0;
-
- // writer
- pWriter->pBlockIdxW = &pWriter->blockIdxW;
- pWriter->pBlockIdxW->suid = id.suid;
- pWriter->pBlockIdxW->uid = id.uid;
-
- tDataBlkReset(&pWriter->blockW);
- tBlockDataReset(&pWriter->bDataW);
- tMapDataReset(&pWriter->mBlockW);
- }
-
- ASSERT(pWriter->pBlockIdxW && pWriter->pBlockIdxW->suid == id.suid && pWriter->pBlockIdxW->uid == id.uid);
- ASSERT(pWriter->pBlockIdx == NULL || (pWriter->pBlockIdx->suid == id.suid && pWriter->pBlockIdx->uid == id.uid));
-
- code = tsdbSnapWriteTableDataImpl(pWriter);
- if (code) goto _err;
-
-_exit:
- tsdbDebug("vgId:%d, vnode snapshot tsdb write data impl for %s", TD_VID(pWriter->pTsdb->pVnode),
- pWriter->pTsdb->path);
return code;
_err:
- tsdbError("vgId:%d, vnode snapshot tsdb write data impl for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
- pWriter->pTsdb->path, tstrerror(code));
return code;
}
-static int32_t tsdbSnapWriteDataEnd(STsdbSnapWriter* pWriter) {
+static int32_t tsdbSnapWriteOpenFile(STsdbSnapWriter* pWriter, int32_t fid) {
int32_t code = 0;
STsdb* pTsdb = pWriter->pTsdb;
- if (pWriter->pDataFWriter == NULL) goto _exit;
+ ASSERT(pWriter->dWriter.pWriter == NULL);
+
+ pWriter->fid = fid;
+ pWriter->id = (TABLEID){0};
+ SDFileSet* pSet = taosArraySearch(pWriter->fs.aDFileSet, &(SDFileSet){.fid = fid}, tDFileSetCmprFn, TD_EQ);
+
+ // Reader
+ if (pSet) {
+ code = tsdbDataFReaderOpen(&pWriter->dReader.pReader, pWriter->pTsdb, pSet);
+ if (code) goto _err;
+
+ code = tsdbReadBlockIdx(pWriter->dReader.pReader, pWriter->dReader.aBlockIdx);
+ if (code) goto _err;
+ } else {
+ ASSERT(pWriter->dReader.pReader == NULL);
+ taosArrayClear(pWriter->dReader.aBlockIdx);
+ }
+ pWriter->dReader.iBlockIdx = 0; // point to the next one
+ code = tsdbSnapNextTableData(pWriter);
+ if (code) goto _err;
+
+ // Writer
+ SHeadFile fHead = {.commitID = pWriter->commitID};
+ SDataFile fData = {.commitID = pWriter->commitID};
+ SSmaFile fSma = {.commitID = pWriter->commitID};
+ SSttFile fStt = {.commitID = pWriter->commitID};
+ SDFileSet wSet = {.fid = pWriter->fid, .pHeadF = &fHead, .pDataF = &fData, .pSmaF = &fSma};
+ if (pSet) {
+ wSet.diskId = pSet->diskId;
+ fData = *pSet->pDataF;
+ fSma = *pSet->pSmaF;
+ for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
+ wSet.aSttF[iStt] = pSet->aSttF[iStt];
+ }
+ wSet.nSttF = pSet->nSttF + 1; // TODO: fix pSet->nSttF == pTsdb->maxFile
+ } else {
+ SDiskID did = {0};
+ tfsAllocDisk(pTsdb->pVnode->pTfs, 0, &did);
+ tfsMkdirRecurAt(pTsdb->pVnode->pTfs, pTsdb->path, did);
+ wSet.diskId = did;
+ wSet.nSttF = 1;
+ }
+ wSet.aSttF[wSet.nSttF - 1] = &fStt;
+
+ code = tsdbDataFWriterOpen(&pWriter->dWriter.pWriter, pWriter->pTsdb, &wSet);
+ if (code) goto _err;
+ taosArrayClear(pWriter->dWriter.aBlockIdx);
+ tMapDataReset(&pWriter->dWriter.mDataBlk);
+ taosArrayClear(pWriter->dWriter.aSttBlk);
+ tBlockDataReset(&pWriter->dWriter.bData);
+ tBlockDataReset(&pWriter->dWriter.sData);
+
+ return code;
+
+_err:
+ return code;
+}
+
+static int32_t tsdbSnapWriteCloseFile(STsdbSnapWriter* pWriter) {
+ int32_t code = 0;
+
+ ASSERT(pWriter->dWriter.pWriter);
- // finish current table
code = tsdbSnapWriteTableDataEnd(pWriter);
if (code) goto _err;
- // move remain table
- while (pWriter->iBlockIdx < taosArrayGetSize(pWriter->aBlockIdx)) {
- code = tsdbSnapMoveWriteTableData(pWriter, (SBlockIdx*)taosArrayGet(pWriter->aBlockIdx, pWriter->iBlockIdx));
- if (code) goto _err;
-
- pWriter->iBlockIdx++;
- }
-
- // write remain stuff
- if (taosArrayGetSize(pWriter->aBlockLW) > 0) {
- code = tsdbWriteSttBlk(pWriter->pDataFWriter, pWriter->aBlockIdxW);
- if (code) goto _err;
- }
-
- if (taosArrayGetSize(pWriter->aBlockIdx) > 0) {
- code = tsdbWriteBlockIdx(pWriter->pDataFWriter, pWriter->aBlockIdxW);
- if (code) goto _err;
- }
-
- code = tsdbFSUpsertFSet(&pWriter->fs, &pWriter->pDataFWriter->wSet);
+ // copy remain table data
+ TABLEID id = {.suid = INT64_MAX, .uid = INT64_MAX};
+ code = tsdbSnapWriteCopyData(pWriter, &id);
if (code) goto _err;
- code = tsdbDataFWriterClose(&pWriter->pDataFWriter, 1);
+ code =
+ tsdbWriteSttBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.sData, pWriter->dWriter.aSttBlk, pWriter->cmprAlg);
if (code) goto _err;
- if (pWriter->pDataFReader) {
- code = tsdbDataFReaderClose(&pWriter->pDataFReader);
+ // Indices
+ code = tsdbWriteBlockIdx(pWriter->dWriter.pWriter, pWriter->dWriter.aBlockIdx);
+ if (code) goto _err;
+
+ code = tsdbWriteSttBlk(pWriter->dWriter.pWriter, pWriter->dWriter.aSttBlk);
+ if (code) goto _err;
+
+ code = tsdbUpdateDFileSetHeader(pWriter->dWriter.pWriter);
+ if (code) goto _err;
+
+ code = tsdbFSUpsertFSet(&pWriter->fs, &pWriter->dWriter.pWriter->wSet);
+ if (code) goto _err;
+
+ code = tsdbDataFWriterClose(&pWriter->dWriter.pWriter, 1);
+ if (code) goto _err;
+
+ if (pWriter->dReader.pReader) {
+ code = tsdbDataFReaderClose(&pWriter->dReader.pReader);
if (code) goto _err;
}
_exit:
- tsdbInfo("vgId:%d, vnode snapshot tsdb writer data end for %s", TD_VID(pTsdb->pVnode), pTsdb->path);
return code;
_err:
- tsdbError("vgId:%d, vnode snapshot tsdb writer data end for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
- tstrerror(code));
+ return code;
+}
+
+static int32_t tsdbSnapWriteToDataFile(STsdbSnapWriter* pWriter, int32_t iRow, int8_t* done) {
+ int32_t code = 0;
+
+ SBlockData* pBData = &pWriter->bData;
+ TABLEID id = {.suid = pBData->suid, .uid = pBData->uid ? pBData->uid : pBData->aUid[iRow]};
+ TSDBROW row = tsdbRowFromBlockData(pBData, iRow);
+ TSDBKEY key = TSDBROW_KEY(&row);
+
+ *done = 0;
+ while (pWriter->dReader.iRow < pWriter->dReader.bData.nRow ||
+ pWriter->dReader.iDataBlk < pWriter->dReader.mDataBlk.nItem) {
+ // Merge row by row
+ for (; pWriter->dReader.iRow < pWriter->dReader.bData.nRow; pWriter->dReader.iRow++) {
+ TSDBROW trow = tsdbRowFromBlockData(&pWriter->dReader.bData, pWriter->dReader.iRow);
+ TSDBKEY tKey = TSDBROW_KEY(&trow);
+
+ ASSERT(pWriter->dReader.bData.suid == id.suid && pWriter->dReader.bData.uid == id.uid);
+
+ int32_t c = tsdbKeyCmprFn(&key, &tKey);
+ if (c < 0) {
+ code = tBlockDataAppendRow(&pWriter->dWriter.bData, &row, NULL, id.uid);
+ if (code) goto _err;
+ } else if (c > 0) {
+ code = tBlockDataAppendRow(&pWriter->dWriter.bData, &trow, NULL, id.uid);
+ if (code) goto _err;
+ } else {
+ ASSERT(0);
+ }
+
+ if (pWriter->dWriter.bData.nRow >= pWriter->maxRow) {
+ code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.bData, &pWriter->dWriter.mDataBlk,
+ pWriter->cmprAlg);
+ if (code) goto _err;
+ }
+
+ if (c < 0) {
+ *done = 1;
+ goto _exit;
+ }
+ }
+
+ // Merge row by block
+ SDataBlk tDataBlk = {.minKey = key, .maxKey = key};
+ for (; pWriter->dReader.iDataBlk < pWriter->dReader.mDataBlk.nItem; pWriter->dReader.iDataBlk++) {
+ SDataBlk dataBlk;
+ tMapDataGetItemByIdx(&pWriter->dReader.mDataBlk, pWriter->dReader.iDataBlk, &dataBlk, tGetDataBlk);
+
+ int32_t c = tDataBlkCmprFn(&dataBlk, &tDataBlk);
+ if (c < 0) {
+ code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.bData, &pWriter->dWriter.mDataBlk,
+ pWriter->cmprAlg);
+ if (code) goto _err;
+
+ code = tMapDataPutItem(&pWriter->dWriter.mDataBlk, &dataBlk, tPutDataBlk);
+ if (code) goto _err;
+ } else if (c > 0) {
+ code = tBlockDataAppendRow(&pWriter->dWriter.bData, &row, NULL, id.uid);
+ if (code) goto _err;
+
+ if (pWriter->dWriter.bData.nRow >= pWriter->maxRow) {
+ code = tsdbWriteDataBlock(pWriter->dWriter.pWriter, &pWriter->dWriter.bData, &pWriter->dWriter.mDataBlk,
+ pWriter->cmprAlg);
+ if (code) goto _err;
+ }
+
+ *done = 1;
+ goto _exit;
+ } else {
+ code = tsdbReadDataBlockEx(pWriter->dReader.pReader, &dataBlk, &pWriter->dReader.bData);
+ if (code) goto _err;
+ pWriter->dReader.iRow = 0;
+
+ pWriter->dReader.iDataBlk++;
+ break;
+ }
+ }
+ }
+
+_exit:
+ return code;
+
+_err:
+ tsdbError("vgId:%d %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
+ return code;
+}
+
+static int32_t tsdbSnapWriteToSttFile(STsdbSnapWriter* pWriter, int32_t iRow) {
+ int32_t code = 0;
+
+ TABLEID id = {.suid = pWriter->bData.suid,
+ .uid = pWriter->bData.uid ? pWriter->bData.uid : pWriter->bData.aUid[iRow]};
+ TSDBROW row = tsdbRowFromBlockData(&pWriter->bData, iRow);
+ SBlockData* pBData = &pWriter->dWriter.sData;
+
+ if (pBData->suid || pBData->uid) {
+ if (!TABLE_SAME_SCHEMA(pBData->suid, pBData->uid, id.suid, id.uid)) {
+ code = tsdbWriteSttBlock(pWriter->dWriter.pWriter, pBData, pWriter->dWriter.aSttBlk, pWriter->cmprAlg);
+ if (code) goto _err;
+
+ pBData->suid = 0;
+ pBData->uid = 0;
+ }
+ }
+
+ if (pBData->suid == 0 && pBData->uid == 0) {
+ code = tsdbUpdateTableSchema(pWriter->pTsdb->pVnode->pMeta, pWriter->id.suid, pWriter->id.uid, &pWriter->skmTable);
+ if (code) goto _err;
+
+ code = tBlockDataInit(pBData, pWriter->id.suid, pWriter->id.suid ? 0 : pWriter->id.uid, pWriter->skmTable.pTSchema);
+ if (code) goto _err;
+ }
+
+ code = tBlockDataAppendRow(pBData, &row, NULL, id.uid);
+ if (code) goto _err;
+
+ if (pBData->nRow >= pWriter->maxRow) {
+ code = tsdbWriteSttBlock(pWriter->dWriter.pWriter, pBData, pWriter->dWriter.aSttBlk, pWriter->cmprAlg);
+ if (code) goto _err;
+ }
+
+_exit:
+ return code;
+
+_err:
+ return code;
+}
+
+static int32_t tsdbSnapWriteRowData(STsdbSnapWriter* pWriter, int32_t iRow) {
+ int32_t code = 0;
+
+ SBlockData* pBlockData = &pWriter->bData;
+ TABLEID id = {.suid = pBlockData->suid, .uid = pBlockData->uid ? pBlockData->uid : pBlockData->aUid[iRow]};
+
+ // End last table data write if need
+ if (tTABLEIDCmprFn(&pWriter->id, &id) != 0) {
+ code = tsdbSnapWriteTableDataEnd(pWriter);
+ if (code) goto _err;
+ }
+
+ // Start new table data write if need
+ if (pWriter->id.suid == 0 && pWriter->id.uid == 0) {
+ code = tsdbSnapWriteTableDataStart(pWriter, &id);
+ if (code) goto _err;
+ }
+
+ // Merge with .data file data
+ int8_t done = 0;
+ if (pWriter->dReader.pBlockIdx && tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, &id) == 0) {
+ code = tsdbSnapWriteToDataFile(pWriter, iRow, &done);
+ if (code) goto _err;
+ }
+
+ // Append to the .stt data block (todo: check if need to set/reload sst block)
+ if (!done) {
+ code = tsdbSnapWriteToSttFile(pWriter, iRow);
+ if (code) goto _err;
+ }
+
+_exit:
+ return code;
+
+_err:
+ tsdbError("vgId:%d %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), __func__, tstrerror(code));
return code;
}
static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
- int32_t code = 0;
- STsdb* pTsdb = pWriter->pTsdb;
- SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
- TABLEID id = *(TABLEID*)(pData + sizeof(SSnapDataHdr));
- int64_t n;
-
- // decode
+ int32_t code = 0;
+ STsdb* pTsdb = pWriter->pTsdb;
SBlockData* pBlockData = &pWriter->bData;
- code = tDecmprBlockData(pData + sizeof(SSnapDataHdr) + sizeof(TABLEID), pHdr->size - sizeof(TABLEID), pBlockData,
- pWriter->aBuf);
+
+ // Decode data
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
+ code = tDecmprBlockData(pHdr->data, pHdr->size, pBlockData, pWriter->aBuf);
if (code) goto _err;
- // open file
- TSDBKEY keyFirst = {.version = pBlockData->aVersion[0], .ts = pBlockData->aTSKEY[0]};
- TSDBKEY keyLast = {.version = pBlockData->aVersion[pBlockData->nRow - 1],
- .ts = pBlockData->aTSKEY[pBlockData->nRow - 1]};
+ ASSERT(pBlockData->nRow > 0);
- int32_t fid = tsdbKeyFid(keyFirst.ts, pWriter->minutes, pWriter->precision);
- ASSERT(fid == tsdbKeyFid(keyLast.ts, pWriter->minutes, pWriter->precision));
- if (pWriter->pDataFWriter == NULL || pWriter->fid != fid) {
- // end last file data write if need
- code = tsdbSnapWriteDataEnd(pWriter);
- if (code) goto _err;
+ // Loop to handle each row
+ for (int32_t iRow = 0; iRow < pBlockData->nRow; iRow++) {
+ TSKEY ts = pBlockData->aTSKEY[iRow];
+ int32_t fid = tsdbKeyFid(ts, pWriter->minutes, pWriter->precision);
- pWriter->fid = fid;
+ if (pWriter->dWriter.pWriter == NULL || pWriter->fid != fid) {
+ if (pWriter->dWriter.pWriter) {
+ ASSERT(fid > pWriter->fid);
- // read
- SDFileSet* pSet = taosArraySearch(pWriter->fs.aDFileSet, &(SDFileSet){.fid = fid}, tDFileSetCmprFn, TD_EQ);
- if (pSet) {
- code = tsdbDataFReaderOpen(&pWriter->pDataFReader, pTsdb, pSet);
+ code = tsdbSnapWriteCloseFile(pWriter);
+ if (code) goto _err;
+ }
+
+ code = tsdbSnapWriteOpenFile(pWriter, fid);
if (code) goto _err;
-
- code = tsdbReadBlockIdx(pWriter->pDataFReader, pWriter->aBlockIdx);
- if (code) goto _err;
-
- code = tsdbReadSttBlk(pWriter->pDataFReader, 0, pWriter->aSstBlk);
- if (code) goto _err;
- } else {
- ASSERT(pWriter->pDataFReader == NULL);
- taosArrayClear(pWriter->aBlockIdx);
- taosArrayClear(pWriter->aSstBlk);
- }
- pWriter->iBlockIdx = 0;
- pWriter->pBlockIdx = NULL;
- tMapDataReset(&pWriter->mBlock);
- pWriter->iBlock = 0;
- pWriter->pBlockData = NULL;
- pWriter->iRow = 0;
- pWriter->iBlockL = 0;
- tBlockDataReset(&pWriter->bDataR);
- tBlockDataReset(&pWriter->lDataR);
-
- // write
- SHeadFile fHead;
- SDataFile fData;
- SSttFile fLast;
- SSmaFile fSma;
- SDFileSet wSet = {.pHeadF = &fHead, .pDataF = &fData, .aSttF[0] = &fLast, .pSmaF = &fSma};
-
- if (pSet) {
- wSet.diskId = pSet->diskId;
- wSet.fid = fid;
- wSet.nSttF = 1;
- fHead = (SHeadFile){.commitID = pWriter->commitID, .offset = 0, .size = 0};
- fData = *pSet->pDataF;
- fLast = (SSttFile){.commitID = pWriter->commitID, .size = 0};
- fSma = *pSet->pSmaF;
- } else {
- wSet.diskId = (SDiskID){.level = 0, .id = 0};
- wSet.fid = fid;
- wSet.nSttF = 1;
- fHead = (SHeadFile){.commitID = pWriter->commitID, .offset = 0, .size = 0};
- fData = (SDataFile){.commitID = pWriter->commitID, .size = 0};
- fLast = (SSttFile){.commitID = pWriter->commitID, .size = 0, .offset = 0};
- fSma = (SSmaFile){.commitID = pWriter->commitID, .size = 0};
}
- code = tsdbDataFWriterOpen(&pWriter->pDataFWriter, pTsdb, &wSet);
+ code = tsdbSnapWriteRowData(pWriter, iRow);
if (code) goto _err;
-
- taosArrayClear(pWriter->aBlockIdxW);
- taosArrayClear(pWriter->aBlockLW);
- tMapDataReset(&pWriter->mBlockW);
- pWriter->pBlockIdxW = NULL;
- tBlockDataReset(&pWriter->bDataW);
}
- code = tsdbSnapWriteTableData(pWriter, id);
- if (code) goto _err;
-
- tsdbInfo("vgId:%d, vnode snapshot tsdb write data for %s, fid:%d suid:%" PRId64 " uid:%" PRId64 " nRow:%d",
- TD_VID(pTsdb->pVnode), pTsdb->path, fid, id.suid, id.suid, pBlockData->nRow);
return code;
_err:
@@ -976,10 +1099,41 @@ _err:
return code;
}
+// SNAP_DATA_DEL
+static int32_t tsdbSnapMoveWriteDelData(STsdbSnapWriter* pWriter, TABLEID* pId) {
+ int32_t code = 0;
+
+ while (true) {
+ if (pWriter->iDelIdx >= taosArrayGetSize(pWriter->aDelIdxR)) break;
+
+ SDelIdx* pDelIdx = (SDelIdx*)taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx);
+
+ if (tTABLEIDCmprFn(pDelIdx, pId) >= 0) break;
+
+ code = tsdbReadDelData(pWriter->pDelFReader, pDelIdx, pWriter->aDelData);
+ if (code) goto _exit;
+
+ SDelIdx delIdx = *pDelIdx;
+ code = tsdbWriteDelData(pWriter->pDelFWriter, pWriter->aDelData, &delIdx);
+ if (code) goto _exit;
+
+ if (taosArrayPush(pWriter->aDelIdxW, &delIdx) == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _exit;
+ }
+
+ pWriter->iDelIdx++;
+ }
+
+_exit:
+ return code;
+}
+
static int32_t tsdbSnapWriteDel(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
int32_t code = 0;
STsdb* pTsdb = pWriter->pTsdb;
+ // Open del file if not opened yet
if (pWriter->pDelFWriter == NULL) {
SDelFile* pDelFile = pWriter->fs.pDelFile;
@@ -990,38 +1144,28 @@ static int32_t tsdbSnapWriteDel(STsdbSnapWriter* pWriter, uint8_t* pData, uint32
code = tsdbReadDelIdx(pWriter->pDelFReader, pWriter->aDelIdxR);
if (code) goto _err;
+ } else {
+ taosArrayClear(pWriter->aDelIdxR);
}
+ pWriter->iDelIdx = 0;
// writer
- SDelFile delFile = {.commitID = pWriter->commitID, .offset = 0, .size = 0};
+ SDelFile delFile = {.commitID = pWriter->commitID};
code = tsdbDelFWriterOpen(&pWriter->pDelFWriter, &delFile, pTsdb);
if (code) goto _err;
+ taosArrayClear(pWriter->aDelIdxW);
}
- // process the del data
- TABLEID id = *(TABLEID*)(pData + sizeof(SSnapDataHdr));
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
+ TABLEID id = *(TABLEID*)pHdr->data;
- while (true) {
- if (pWriter->iDelIdx >= taosArrayGetSize(pWriter->aDelIdxR)) break;
- if (tTABLEIDCmprFn(taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx), &id) >= 0) break;
+ ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData);
- SDelIdx* pDelIdx = (SDelIdx*)taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx);
-
- code = tsdbReadDelData(pWriter->pDelFReader, pDelIdx, pWriter->aDelData);
- if (code) goto _err;
-
- SDelIdx delIdx = *pDelIdx;
- code = tsdbWriteDelData(pWriter->pDelFWriter, pWriter->aDelData, &delIdx);
- if (code) goto _err;
-
- if (taosArrayPush(pWriter->aDelIdxW, &delIdx) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
-
- pWriter->iDelIdx++;
- }
+ // Move write data < id
+ code = tsdbSnapMoveWriteDelData(pWriter, &id);
+ if (code) goto _err;
+ // Merge incoming data with current
if (pWriter->iDelIdx < taosArrayGetSize(pWriter->aDelIdxR) &&
tTABLEIDCmprFn(taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx), &id) == 0) {
SDelIdx* pDelIdx = (SDelIdx*)taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx);
@@ -1055,7 +1199,6 @@ static int32_t tsdbSnapWriteDel(STsdbSnapWriter* pWriter, uint8_t* pData, uint32
goto _err;
}
-_exit:
return code;
_err:
@@ -1068,23 +1211,14 @@ static int32_t tsdbSnapWriteDelEnd(STsdbSnapWriter* pWriter) {
int32_t code = 0;
STsdb* pTsdb = pWriter->pTsdb;
- if (pWriter->pDelFWriter == NULL) goto _exit;
+ if (pWriter->pDelFWriter == NULL) return code;
- for (; pWriter->iDelIdx < taosArrayGetSize(pWriter->aDelIdxR); pWriter->iDelIdx++) {
- SDelIdx* pDelIdx = (SDelIdx*)taosArrayGet(pWriter->aDelIdxR, pWriter->iDelIdx);
+ TABLEID id = {.suid = INT64_MAX, .uid = INT64_MAX};
+ code = tsdbSnapMoveWriteDelData(pWriter, &id);
+ if (code) goto _err;
- code = tsdbReadDelData(pWriter->pDelFReader, pDelIdx, pWriter->aDelData);
- if (code) goto _err;
-
- SDelIdx delIdx = *pDelIdx;
- code = tsdbWriteDelData(pWriter->pDelFWriter, pWriter->aDelData, &delIdx);
- if (code) goto _err;
-
- if (taosArrayPush(pWriter->aDelIdxR, &delIdx) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
- }
+ code = tsdbWriteDelIdx(pWriter->pDelFWriter, pWriter->aDelIdxW);
+ if (code) goto _err;
code = tsdbUpdateDelFileHdr(pWriter->pDelFWriter);
if (code) goto _err;
@@ -1100,7 +1234,6 @@ static int32_t tsdbSnapWriteDelEnd(STsdbSnapWriter* pWriter) {
if (code) goto _err;
}
-_exit:
tsdbInfo("vgId:%d, vnode snapshot tsdb write del for %s end", TD_VID(pTsdb->pVnode), pTsdb->path);
return code;
@@ -1110,6 +1243,7 @@ _err:
return code;
}
+// APIs
int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWriter** ppWriter) {
int32_t code = 0;
STsdbSnapWriter* pWriter = NULL;
@@ -1135,39 +1269,38 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWr
pWriter->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression;
pWriter->commitID = pTsdb->pVnode->state.commitID;
- // for data file
+ // SNAP_DATA_TSDB
code = tBlockDataCreate(&pWriter->bData);
-
- if (code) goto _err;
- pWriter->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
- if (pWriter->aBlockIdx == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
- code = tBlockDataCreate(&pWriter->bDataR);
if (code) goto _err;
- pWriter->aSstBlk = taosArrayInit(0, sizeof(SSttBlk));
- if (pWriter->aSstBlk == NULL) {
+ pWriter->fid = INT32_MIN;
+ pWriter->id = (TABLEID){0};
+ // Reader
+ pWriter->dReader.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
+ if (pWriter->dReader.aBlockIdx == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
}
-
- pWriter->aBlockIdxW = taosArrayInit(0, sizeof(SBlockIdx));
- if (pWriter->aBlockIdxW == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
- code = tBlockDataCreate(&pWriter->bDataW);
+ code = tBlockDataCreate(&pWriter->dReader.bData);
if (code) goto _err;
- pWriter->aBlockLW = taosArrayInit(0, sizeof(SSttBlk));
- if (pWriter->aBlockLW == NULL) {
+ // Writer
+ pWriter->dWriter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
+ if (pWriter->dWriter.aBlockIdx == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
}
+ pWriter->dWriter.aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
+ if (pWriter->dWriter.aSttBlk == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+ code = tBlockDataCreate(&pWriter->dWriter.bData);
+ if (code) goto _err;
+ code = tBlockDataCreate(&pWriter->dWriter.sData);
+ if (code) goto _err;
- // for del file
+ // SNAP_DATA_DEL
pWriter->aDelIdxR = taosArrayInit(0, sizeof(SDelIdx));
if (pWriter->aDelIdxR == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -1188,6 +1321,7 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWr
tsdbInfo("vgId:%d, tsdb snapshot writer open for %s succeed", TD_VID(pTsdb->pVnode), pTsdb->path);
return code;
+
_err:
tsdbError("vgId:%d, tsdb snapshot writer open for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
tstrerror(code));
@@ -1198,14 +1332,17 @@ _err:
int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
int32_t code = 0;
STsdbSnapWriter* pWriter = *ppWriter;
+ STsdb* pTsdb = pWriter->pTsdb;
if (rollback) {
ASSERT(0);
// code = tsdbFSRollback(pWriter->pTsdb->pFS);
// if (code) goto _err;
} else {
- code = tsdbSnapWriteDataEnd(pWriter);
- if (code) goto _err;
+ if (pWriter->dWriter.pWriter) {
+ code = tsdbSnapWriteCloseFile(pWriter);
+ if (code) goto _err;
+ }
code = tsdbSnapWriteDelEnd(pWriter);
if (code) goto _err;
@@ -1213,14 +1350,44 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
code = tsdbFSCommit1(pWriter->pTsdb, &pWriter->fs);
if (code) goto _err;
+ // lock
+ taosThreadRwlockWrlock(&pTsdb->rwLock);
+
code = tsdbFSCommit2(pWriter->pTsdb, &pWriter->fs);
- if (code) goto _err;
+ if (code) {
+ taosThreadRwlockUnlock(&pTsdb->rwLock);
+ goto _err;
+ }
+
+ // unlock
+ taosThreadRwlockUnlock(&pTsdb->rwLock);
}
+ // SNAP_DATA_DEL
+ taosArrayDestroy(pWriter->aDelIdxW);
+ taosArrayDestroy(pWriter->aDelData);
+ taosArrayDestroy(pWriter->aDelIdxR);
+
+ // SNAP_DATA_TSDB
+
+ // Writer
+ tBlockDataDestroy(&pWriter->dWriter.sData, 1);
+ tBlockDataDestroy(&pWriter->dWriter.bData, 1);
+ taosArrayDestroy(pWriter->dWriter.aSttBlk);
+ tMapDataClear(&pWriter->dWriter.mDataBlk);
+ taosArrayDestroy(pWriter->dWriter.aBlockIdx);
+
+ // Reader
+ tBlockDataDestroy(&pWriter->dReader.bData, 1);
+ tMapDataClear(&pWriter->dReader.mDataBlk);
+ taosArrayDestroy(pWriter->dReader.aBlockIdx);
+
+ tBlockDataDestroy(&pWriter->bData, 1);
+ tTSchemaDestroy(pWriter->skmTable.pTSchema);
+
for (int32_t iBuf = 0; iBuf < sizeof(pWriter->aBuf) / sizeof(uint8_t*); iBuf++) {
tFree(pWriter->aBuf[iBuf]);
}
-
tsdbInfo("vgId:%d, vnode snapshot tsdb writer close for %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
taosMemoryFree(pWriter);
*ppWriter = NULL;
@@ -1245,8 +1412,8 @@ int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
goto _exit;
} else {
- if (pWriter->pDataFWriter) {
- code = tsdbSnapWriteDataEnd(pWriter);
+ if (pWriter->dWriter.pWriter) {
+ code = tsdbSnapWriteCloseFile(pWriter);
if (code) goto _err;
}
}
@@ -1259,7 +1426,6 @@ int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
_exit:
tsdbDebug("vgId:%d, tsdb snapshot write for %s succeed", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
-
return code;
_err:
diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c
index f379d9f71a..5adb2eb359 100644
--- a/source/dnode/vnode/src/vnd/vnodeCfg.c
+++ b/source/dnode/vnode/src/vnd/vnodeCfg.c
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#include "vnd.h"
#include "tutil.h"
+#include "vnd.h"
const SVnodeCfg vnodeCfgDefault = {.vgId = -1,
.dbname = "",
@@ -48,7 +48,9 @@ const SVnodeCfg vnodeCfgDefault = {.vgId = -1,
},
.hashBegin = 0,
.hashEnd = 0,
- .hashMethod = 0};
+ .hashMethod = 0,
+ .sttTrigger = TSDB_DEFAULT_STT_FILE,
+ .tsdbPageSize = TSDB_DEFAULT_PAGE_SIZE};
int vnodeCheckCfg(const SVnodeCfg *pCfg) {
// TODO
@@ -107,12 +109,13 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
if (tjsonAddIntegerToObject(pJson, "wal.retentionSize", pCfg->walCfg.retentionSize) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "wal.segSize", pCfg->walCfg.segSize) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "wal.level", pCfg->walCfg.level) < 0) return -1;
- if (tjsonAddIntegerToObject(pJson, "sstTrigger", pCfg->sstTrigger) < 0) return -1;
+ if (tjsonAddIntegerToObject(pJson, "sstTrigger", pCfg->sttTrigger) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "hashBegin", pCfg->hashBegin) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "hashEnd", pCfg->hashEnd) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "hashMethod", pCfg->hashMethod) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "hashPrefix", pCfg->hashPrefix) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "hashSuffix", pCfg->hashSuffix) < 0) return -1;
+ if (tjsonAddIntegerToObject(pJson, "tsdbPageSize", pCfg->tsdbPageSize) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "syncCfg.replicaNum", pCfg->syncCfg.replicaNum) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "syncCfg.myIndex", pCfg->syncCfg.myIndex) < 0) return -1;
@@ -132,6 +135,9 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
tjsonAddItemToArray(pNodeInfoArr, pNodeInfo);
}
+ // add tsdb page size config
+ if (tjsonAddIntegerToObject(pJson, "tsdbPageSize", pCfg->tsdbPageSize) < 0) return -1;
+
return 0;
}
@@ -209,8 +215,8 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
if (code < 0) return -1;
tjsonGetNumberValue(pJson, "wal.level", pCfg->walCfg.level, code);
if (code < 0) return -1;
- tjsonGetNumberValue(pJson, "sstTrigger", pCfg->sstTrigger, code);
- if (code < 0) return -1;
+ tjsonGetNumberValue(pJson, "sstTrigger", pCfg->sttTrigger, code);
+ if (code < 0) pCfg->sttTrigger = TSDB_DEFAULT_SST_TRIGGER;
tjsonGetNumberValue(pJson, "hashBegin", pCfg->hashBegin, code);
if (code < 0) return -1;
tjsonGetNumberValue(pJson, "hashEnd", pCfg->hashEnd, code);
@@ -218,9 +224,9 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
tjsonGetNumberValue(pJson, "hashMethod", pCfg->hashMethod, code);
if (code < 0) return -1;
tjsonGetNumberValue(pJson, "hashPrefix", pCfg->hashPrefix, code);
- if (code < 0) return -1;
+ if (code < 0) pCfg->hashPrefix = TSDB_DEFAULT_HASH_PREFIX;
tjsonGetNumberValue(pJson, "hashSuffix", pCfg->hashSuffix, code);
- if (code < 0) return -1;
+ if (code < 0) pCfg->hashSuffix = TSDB_DEFAULT_HASH_SUFFIX;
tjsonGetNumberValue(pJson, "syncCfg.replicaNum", pCfg->syncCfg.replicaNum, code);
if (code < 0) return -1;
@@ -249,6 +255,9 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
tjsonGetStringValue(pNodeInfo, "nodeFqdn", (pCfg->syncCfg.nodeInfo)[i].nodeFqdn);
}
+ tjsonGetNumberValue(pJson, "tsdbPageSize", pCfg->tsdbPageSize, code);
+ if (code < 0) pCfg->tsdbPageSize = TSDB_DEFAULT_TSDB_PAGESIZE * 1024;
+
return 0;
}
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index a4fd984fb7..4ccfea4051 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -60,6 +60,8 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path);
+ info.config = vnodeCfgDefault;
+
// load vnode info
ret = vnodeLoadInfo(dir, &info);
if (ret < 0) {
diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
index 03ab5e8285..08c3a34699 100644
--- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c
+++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
@@ -354,7 +354,8 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) {
code = metaSnapWrite(pWriter->pMetaSnapWriter, pData, nData);
if (code) goto _err;
} break;
- case SNAP_DATA_TSDB: {
+ case SNAP_DATA_TSDB:
+ case SNAP_DATA_DEL: {
// tsdb
if (pWriter->pTsdbSnapWriter == NULL) {
code = tsdbSnapWriterOpen(pVnode->pTsdb, pWriter->sver, pWriter->ever, &pWriter->pTsdbSnapWriter);
diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c
index 6935489ff4..3a774afdcc 100644
--- a/source/libs/catalog/src/ctgCache.c
+++ b/source/libs/catalog/src/ctgCache.c
@@ -13,96 +13,46 @@
* along with this program. If not, see .
*/
-#include "trpc.h"
-#include "query.h"
-#include "tname.h"
#include "catalogInt.h"
+#include "query.h"
#include "systable.h"
+#include "tname.h"
+#include "trpc.h"
-SCtgOperation gCtgCacheOperation[CTG_OP_MAX] = {
- {
- CTG_OP_UPDATE_VGROUP,
- "update vgInfo",
- ctgOpUpdateVgroup
- },
- {
- CTG_OP_UPDATE_TB_META,
- "update tbMeta",
- ctgOpUpdateTbMeta
- },
- {
- CTG_OP_DROP_DB_CACHE,
- "drop DB",
- ctgOpDropDbCache
- },
- {
- CTG_OP_DROP_DB_VGROUP,
- "drop DBVgroup",
- ctgOpDropDbVgroup
- },
- {
- CTG_OP_DROP_STB_META,
- "drop stbMeta",
- ctgOpDropStbMeta
- },
- {
- CTG_OP_DROP_TB_META,
- "drop tbMeta",
- ctgOpDropTbMeta
- },
- {
- CTG_OP_UPDATE_USER,
- "update user",
- ctgOpUpdateUser
- },
- {
- CTG_OP_UPDATE_VG_EPSET,
- "update epset",
- ctgOpUpdateEpset
- },
- {
- CTG_OP_UPDATE_TB_INDEX,
- "update tbIndex",
- ctgOpUpdateTbIndex
- },
- {
- CTG_OP_DROP_TB_INDEX,
- "drop tbIndex",
- ctgOpDropTbIndex
- },
- {
- CTG_OP_CLEAR_CACHE,
- "clear cache",
- ctgOpClearCache
- }
-};
-
-
-
+SCtgOperation gCtgCacheOperation[CTG_OP_MAX] = {{CTG_OP_UPDATE_VGROUP, "update vgInfo", ctgOpUpdateVgroup},
+ {CTG_OP_UPDATE_TB_META, "update tbMeta", ctgOpUpdateTbMeta},
+ {CTG_OP_DROP_DB_CACHE, "drop DB", ctgOpDropDbCache},
+ {CTG_OP_DROP_DB_VGROUP, "drop DBVgroup", ctgOpDropDbVgroup},
+ {CTG_OP_DROP_STB_META, "drop stbMeta", ctgOpDropStbMeta},
+ {CTG_OP_DROP_TB_META, "drop tbMeta", ctgOpDropTbMeta},
+ {CTG_OP_UPDATE_USER, "update user", ctgOpUpdateUser},
+ {CTG_OP_UPDATE_VG_EPSET, "update epset", ctgOpUpdateEpset},
+ {CTG_OP_UPDATE_TB_INDEX, "update tbIndex", ctgOpUpdateTbIndex},
+ {CTG_OP_DROP_TB_INDEX, "drop tbIndex", ctgOpDropTbIndex},
+ {CTG_OP_CLEAR_CACHE, "clear cache", ctgOpClearCache}};
int32_t ctgRLockVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache, bool *inCache) {
CTG_LOCK(CTG_READ, &dbCache->vgCache.vgLock);
-
+
if (dbCache->deleted) {
CTG_UNLOCK(CTG_READ, &dbCache->vgCache.vgLock);
- ctgDebug("db is dropping, dbId:0x%"PRIx64, dbCache->dbId);
-
+ ctgDebug("db is dropping, dbId:0x%" PRIx64, dbCache->dbId);
+
*inCache = false;
return TSDB_CODE_SUCCESS;
}
-
if (NULL == dbCache->vgCache.vgInfo) {
CTG_UNLOCK(CTG_READ, &dbCache->vgCache.vgLock);
*inCache = false;
- ctgDebug("db vgInfo is empty, dbId:0x%"PRIx64, dbCache->dbId);
+ ctgDebug("db vgInfo is empty, dbId:0x%" PRIx64, dbCache->dbId);
return TSDB_CODE_SUCCESS;
}
*inCache = true;
-
+
return TSDB_CODE_SUCCESS;
}
@@ -110,7 +60,7 @@ int32_t ctgWLockVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache) {
CTG_LOCK(CTG_WRITE, &dbCache->vgCache.vgLock);
if (dbCache->deleted) {
- ctgDebug("db is dropping, dbId:0x%"PRIx64, dbCache->dbId);
+ ctgDebug("db is dropping, dbId:0x%" PRIx64, dbCache->dbId);
CTG_UNLOCK(CTG_WRITE, &dbCache->vgCache.vgLock);
CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED);
}
@@ -118,19 +68,13 @@ int32_t ctgWLockVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache) {
return TSDB_CODE_SUCCESS;
}
-void ctgRUnlockVgInfo(SCtgDBCache *dbCache) {
- CTG_UNLOCK(CTG_READ, &dbCache->vgCache.vgLock);
-}
+void ctgRUnlockVgInfo(SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_READ, &dbCache->vgCache.vgLock); }
-void ctgWUnlockVgInfo(SCtgDBCache *dbCache) {
- CTG_UNLOCK(CTG_WRITE, &dbCache->vgCache.vgLock);
-}
+void ctgWUnlockVgInfo(SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_WRITE, &dbCache->vgCache.vgLock); }
-void ctgReleaseDBCache(SCatalog *pCtg, SCtgDBCache *dbCache) {
- CTG_UNLOCK(CTG_READ, &dbCache->dbLock);
-}
+void ctgReleaseDBCache(SCatalog *pCtg, SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_READ, &dbCache->dbLock); }
-int32_t ctgAcquireDBCacheImpl(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache, bool acquire) {
+int32_t ctgAcquireDBCacheImpl(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache, bool acquire) {
char *p = strchr(dbFName, '.');
if (p && IS_SYS_DBNAME(p + 1)) {
dbFName = p + 1;
@@ -150,35 +94,35 @@ int32_t ctgAcquireDBCacheImpl(SCatalog* pCtg, const char *dbFName, SCtgDBCache *
if (dbCache->deleted) {
if (acquire) {
ctgReleaseDBCache(pCtg, dbCache);
- }
-
+ }
+
*pCache = NULL;
ctgDebug("db is removing from cache, dbFName:%s", dbFName);
return TSDB_CODE_SUCCESS;
}
*pCache = dbCache;
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgAcquireDBCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache) {
+int32_t ctgAcquireDBCache(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache) {
CTG_RET(ctgAcquireDBCacheImpl(pCtg, dbFName, pCache, true));
}
-int32_t ctgGetDBCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache) {
+int32_t ctgGetDBCache(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache) {
CTG_RET(ctgAcquireDBCacheImpl(pCtg, dbFName, pCache, false));
}
-void ctgReleaseVgInfoToCache(SCatalog* pCtg, SCtgDBCache *dbCache) {
+void ctgReleaseVgInfoToCache(SCatalog *pCtg, SCtgDBCache *dbCache) {
ctgRUnlockVgInfo(dbCache);
ctgReleaseDBCache(pCtg, dbCache);
}
-void ctgReleaseTbMetaToCache(SCatalog* pCtg, SCtgDBCache *dbCache, SCtgTbCache* pCache) {
+void ctgReleaseTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache) {
if (pCache) {
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
- taosHashRelease(dbCache->tbCache, pCache);
+ taosHashRelease(dbCache->tbCache, pCache);
}
if (dbCache) {
@@ -186,10 +130,10 @@ void ctgReleaseTbMetaToCache(SCatalog* pCtg, SCtgDBCache *dbCache, SCtgTbCache*
}
}
-void ctgReleaseTbIndexToCache(SCatalog* pCtg, SCtgDBCache *dbCache, SCtgTbCache* pCache) {
+void ctgReleaseTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache) {
if (pCache) {
CTG_UNLOCK(CTG_READ, &pCache->indexLock);
- taosHashRelease(dbCache->tbCache, pCache);
+ taosHashRelease(dbCache->tbCache, pCache);
}
if (dbCache) {
@@ -197,10 +141,10 @@ void ctgReleaseTbIndexToCache(SCatalog* pCtg, SCtgDBCache *dbCache, SCtgTbCache*
}
}
-int32_t ctgAcquireVgInfoFromCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache) {
+int32_t ctgAcquireVgInfoFromCache(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache) {
SCtgDBCache *dbCache = NULL;
ctgAcquireDBCache(pCtg, dbFName, &dbCache);
- if (NULL == dbCache) {
+ if (NULL == dbCache) {
ctgDebug("db %s not in cache", dbFName);
goto _return;
}
@@ -217,7 +161,7 @@ int32_t ctgAcquireVgInfoFromCache(SCatalog* pCtg, const char *dbFName, SCtgDBCac
CTG_CACHE_STAT_INC(numOfVgHit, 1);
ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName);
-
+
return TSDB_CODE_SUCCESS;
_return:
@@ -229,19 +173,19 @@ _return:
*pCache = NULL;
CTG_CACHE_STAT_INC(numOfVgMiss, 1);
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgAcquireTbMetaFromCache(SCatalog* pCtg, char *dbFName, char* tbName, SCtgDBCache **pDb, SCtgTbCache** pTb) {
+int32_t ctgAcquireTbMetaFromCache(SCatalog *pCtg, char *dbFName, char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb) {
SCtgDBCache *dbCache = NULL;
- SCtgTbCache* pCache = NULL;
+ SCtgTbCache *pCache = NULL;
ctgAcquireDBCache(pCtg, dbFName, &dbCache);
if (NULL == dbCache) {
ctgDebug("db %s not in cache", dbFName);
goto _return;
}
-
+
pCache = taosHashAcquire(dbCache->tbCache, tbName, strlen(tbName));
if (NULL == pCache) {
ctgDebug("tb %s not in cache, dbFName:%s", tbName, dbFName);
@@ -258,7 +202,7 @@ int32_t ctgAcquireTbMetaFromCache(SCatalog* pCtg, char *dbFName, char* tbName, S
*pTb = pCache;
ctgDebug("tb %s meta got in cache, dbFName:%s", tbName, dbFName);
-
+
CTG_CACHE_STAT_INC(numOfMetaHit, 1);
return TSDB_CODE_SUCCESS;
@@ -268,20 +212,20 @@ _return:
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
CTG_CACHE_STAT_INC(numOfMetaMiss, 1);
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgAcquireStbMetaFromCache(SCatalog* pCtg, char *dbFName, uint64_t suid, SCtgDBCache **pDb, SCtgTbCache** pTb) {
- SCtgDBCache* dbCache = NULL;
- SCtgTbCache* pCache = NULL;
+int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgDBCache **pDb, SCtgTbCache **pTb) {
+ SCtgDBCache *dbCache = NULL;
+ SCtgTbCache *pCache = NULL;
ctgAcquireDBCache(pCtg, dbFName, &dbCache);
if (NULL == dbCache) {
ctgDebug("db %s not in cache", dbFName);
goto _return;
}
-
- char* stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid));
+
+ char *stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid));
if (NULL == stName) {
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", suid, dbFName);
goto _return;
@@ -304,7 +248,7 @@ int32_t ctgAcquireStbMetaFromCache(SCatalog* pCtg, char *dbFName, uint64_t suid,
*pTb = pCache;
ctgDebug("stb 0x%" PRIx64 " meta got in cache, dbFName:%s", suid, dbFName);
-
+
CTG_CACHE_STAT_INC(numOfMetaHit, 1);
return TSDB_CODE_SUCCESS;
@@ -317,20 +261,19 @@ _return:
*pDb = NULL;
*pTb = NULL;
-
+
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgAcquireTbIndexFromCache(SCatalog* pCtg, char *dbFName, char* tbName, SCtgDBCache **pDb, SCtgTbCache** pTb) {
+int32_t ctgAcquireTbIndexFromCache(SCatalog *pCtg, char *dbFName, char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb) {
SCtgDBCache *dbCache = NULL;
- SCtgTbCache* pCache = NULL;
+ SCtgTbCache *pCache = NULL;
ctgAcquireDBCache(pCtg, dbFName, &dbCache);
if (NULL == dbCache) {
ctgDebug("db %s not in cache", dbFName);
goto _return;
}
-
+
int32_t sz = 0;
pCache = taosHashAcquire(dbCache->tbCache, tbName, strlen(tbName));
if (NULL == pCache) {
@@ -348,7 +291,7 @@ int32_t ctgAcquireTbIndexFromCache(SCatalog* pCtg, char *dbFName, char* tbName,
*pTb = pCache;
ctgDebug("tb %s index got in cache, dbFName:%s", tbName, dbFName);
-
+
CTG_CACHE_STAT_INC(numOfIndexHit, 1);
return TSDB_CODE_SUCCESS;
@@ -358,32 +301,31 @@ _return:
ctgReleaseTbIndexToCache(pCtg, dbCache, pCache);
CTG_CACHE_STAT_INC(numOfIndexMiss, 1);
-
+
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgTbMetaExistInCache(SCatalog* pCtg, char *dbFName, char* tbName, int32_t *exist) {
+int32_t ctgTbMetaExistInCache(SCatalog *pCtg, char *dbFName, char *tbName, int32_t *exist) {
SCtgDBCache *dbCache = NULL;
SCtgTbCache *tbCache = NULL;
ctgAcquireTbMetaFromCache(pCtg, dbFName, tbName, &dbCache, &tbCache);
if (NULL == tbCache) {
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
-
+
*exist = 0;
return TSDB_CODE_SUCCESS;
}
*exist = 1;
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta) {
- int32_t code = 0;
+int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) {
+ int32_t code = 0;
SCtgDBCache *dbCache = NULL;
- SCtgTbCache *tbCache = NULL;
+ SCtgTbCache *tbCache = NULL;
*pTableMeta = NULL;
char dbFName[TSDB_DB_FNAME_LEN] = {0};
@@ -399,12 +341,12 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
return TSDB_CODE_SUCCESS;
}
- STableMeta* tbMeta = tbCache->pMeta;
+ STableMeta *tbMeta = tbCache->pMeta;
ctx->tbInfo.inCache = true;
ctx->tbInfo.dbId = dbCache->dbId;
ctx->tbInfo.suid = tbMeta->suid;
ctx->tbInfo.tbType = tbMeta->tableType;
-
+
if (tbMeta->tableType != TSDB_CHILD_TABLE) {
int32_t metaSize = CTG_META_SIZE(tbMeta);
*pTableMeta = taosMemoryCalloc(1, metaSize);
@@ -414,14 +356,14 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
}
memcpy(*pTableMeta, tbMeta, metaSize);
-
+
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", ctx->pName->tname, tbMeta->tableType, dbFName);
return TSDB_CODE_SUCCESS;
}
// PROCESS FOR CHILD TABLE
-
+
int32_t metaSize = sizeof(SCTableMeta);
*pTableMeta = taosMemoryCalloc(1, metaSize);
if (NULL == *pTableMeta) {
@@ -429,10 +371,10 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
}
memcpy(*pTableMeta, tbMeta, metaSize);
-
+
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
- ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s",
- ctx->pName->tname, ctx->tbInfo.tbType, dbFName);
+ ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", ctx->pName->tname,
+ ctx->tbInfo.tbType, dbFName);
ctgAcquireStbMetaFromCache(pCtg, dbFName, ctx->tbInfo.suid, &dbCache, &tbCache);
if (NULL == tbCache) {
@@ -441,17 +383,17 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
ctgDebug("stb 0x%" PRIx64 " meta not in cache", ctx->tbInfo.suid);
return TSDB_CODE_SUCCESS;
}
-
- STableMeta* stbMeta = tbCache->pMeta;
- if (stbMeta->suid != ctx->tbInfo.suid) {
+
+ STableMeta *stbMeta = tbCache->pMeta;
+ if (stbMeta->suid != ctx->tbInfo.suid) {
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
- ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid 0x%"PRIx64 , stbMeta->suid, ctx->tbInfo.suid);
+ ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid 0x%" PRIx64, stbMeta->suid, ctx->tbInfo.suid);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
}
metaSize = CTG_META_SIZE(stbMeta);
*pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize);
- if (NULL == *pTableMeta) {
+ if (NULL == *pTableMeta) {
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
@@ -461,24 +403,24 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
ctgDebug("Got tb %s meta from cache, dbFName:%s", ctx->pName->tname, dbFName);
-
+
return TSDB_CODE_SUCCESS;
_return:
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
taosMemoryFreeClear(*pTableMeta);
-
+
CTG_RET(code);
}
-int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, int32_t *tver, int32_t *tbType, uint64_t *suid,
- char *stbName) {
+int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, int32_t *tver, int32_t *tbType,
+ uint64_t *suid, char *stbName) {
*sver = -1;
*tver = -1;
SCtgDBCache *dbCache = NULL;
- SCtgTbCache *tbCache = NULL;
+ SCtgTbCache *tbCache = NULL;
char dbFName[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pTableName, dbFName);
@@ -488,7 +430,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver,
return TSDB_CODE_SUCCESS;
}
- STableMeta* tbMeta = tbCache->pMeta;
+ STableMeta *tbMeta = tbCache->pMeta;
*tbType = tbMeta->tableType;
*suid = tbMeta->suid;
@@ -496,29 +438,29 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver,
*sver = tbMeta->sversion;
*tver = tbMeta->tversion;
- ctgDebug("Got tb %s ver from cache, dbFName:%s, tbType:%d, sver:%d, tver:%d, suid:0x%" PRIx64,
- pTableName->tname, dbFName, *tbType, *sver, *tver, *suid);
+ ctgDebug("Got tb %s ver from cache, dbFName:%s, tbType:%d, sver:%d, tver:%d, suid:0x%" PRIx64, pTableName->tname,
+ dbFName, *tbType, *sver, *tver, *suid);
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
return TSDB_CODE_SUCCESS;
}
// PROCESS FOR CHILD TABLE
-
+
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
ctgDebug("Got ctb %s ver from cache, will continue to get its stb ver, dbFName:%s", pTableName->tname, dbFName);
-
+
ctgAcquireStbMetaFromCache(pCtg, dbFName, *suid, &dbCache, &tbCache);
if (NULL == tbCache) {
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
ctgDebug("stb 0x%" PRIx64 " meta not in cache", *suid);
return TSDB_CODE_SUCCESS;
}
-
- STableMeta* stbMeta = tbCache->pMeta;
+
+ STableMeta *stbMeta = tbCache->pMeta;
if (stbMeta->suid != *suid) {
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
- ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid:0x%" PRIx64 , stbMeta->suid, *suid);
+ ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid:0x%" PRIx64, stbMeta->suid, *suid);
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
}
@@ -533,15 +475,15 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver,
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
- ctgDebug("Got tb %s sver %d tver %d from cache, type:%d, dbFName:%s", pTableName->tname, *sver, *tver, *tbType, dbFName);
+ ctgDebug("Got tb %s sver %d tver %d from cache, type:%d, dbFName:%s", pTableName->tname, *sver, *tver, *tbType,
+ dbFName);
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgReadTbTypeFromCache(SCatalog* pCtg, char* dbFName, char *tbName, int32_t *tbType) {
+int32_t ctgReadTbTypeFromCache(SCatalog *pCtg, char *dbFName, char *tbName, int32_t *tbType) {
SCtgDBCache *dbCache = NULL;
- SCtgTbCache *tbCache = NULL;
+ SCtgTbCache *tbCache = NULL;
CTG_ERR_RET(ctgAcquireTbMetaFromCache(pCtg, dbFName, tbName, &dbCache, &tbCache));
if (NULL == tbCache) {
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
@@ -551,15 +493,15 @@ int32_t ctgReadTbTypeFromCache(SCatalog* pCtg, char* dbFName, char *tbName, int3
*tbType = tbCache->pMeta->tableType;
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
- ctgDebug("Got tb %s tbType %d from cache, dbFName:%s", tbName, *tbType, dbFName);
-
+ ctgDebug("Got tb %s tbType %d from cache, dbFName:%s", tbName, *tbType, dbFName);
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgReadTbIndexFromCache(SCatalog* pCtg, SName* pTableName, SArray** pRes) {
- int32_t code = 0;
+int32_t ctgReadTbIndexFromCache(SCatalog *pCtg, SName *pTableName, SArray **pRes) {
+ int32_t code = 0;
SCtgDBCache *dbCache = NULL;
- SCtgTbCache *tbCache = NULL;
+ SCtgTbCache *tbCache = NULL;
char dbFName[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pTableName, dbFName);
@@ -580,14 +522,14 @@ _return:
CTG_RET(code);
}
-int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE type, bool *inCache, bool *pass) {
+int32_t ctgChkAuthFromCache(SCatalog *pCtg, char *user, char *dbFName, AUTH_TYPE type, bool *inCache, bool *pass) {
char *p = strchr(dbFName, '.');
if (p) {
++p;
} else {
p = dbFName;
}
-
+
if (IS_SYS_DBNAME(p)) {
*inCache = true;
*pass = true;
@@ -605,7 +547,7 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE
ctgDebug("Got user from cache, user:%s", user);
CTG_CACHE_STAT_INC(numOfUserHit, 1);
-
+
if (pUser->superUser) {
*pass = true;
return TSDB_CODE_SUCCESS;
@@ -617,54 +559,53 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE
CTG_UNLOCK(CTG_READ, &pUser->lock);
return TSDB_CODE_SUCCESS;
}
-
+
if (pUser->readDbs && taosHashGet(pUser->readDbs, dbFName, strlen(dbFName)) && type == AUTH_TYPE_READ) {
*pass = true;
}
-
+
if (pUser->writeDbs && taosHashGet(pUser->writeDbs, dbFName, strlen(dbFName)) && type == AUTH_TYPE_WRITE) {
*pass = true;
}
CTG_UNLOCK(CTG_READ, &pUser->lock);
-
+
return TSDB_CODE_SUCCESS;
_return:
*inCache = false;
CTG_CACHE_STAT_INC(numOfUserMiss, 1);
-
+
return TSDB_CODE_SUCCESS;
}
void ctgDequeue(SCtgCacheOperation **op) {
SCtgQNode *orig = gCtgMgmt.queue.head;
-
+
SCtgQNode *node = gCtgMgmt.queue.head->next;
gCtgMgmt.queue.head = gCtgMgmt.queue.head->next;
CTG_QUEUE_DEC();
-
+
taosMemoryFreeClear(orig);
*op = node->op;
}
-
-int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
+int32_t ctgEnqueue(SCatalog *pCtg, SCtgCacheOperation *operation) {
SCtgQNode *node = taosMemoryCalloc(1, sizeof(SCtgQNode));
if (NULL == node) {
qError("calloc %d failed", (int32_t)sizeof(SCtgQNode));
CTG_RET(TSDB_CODE_OUT_OF_MEMORY);
}
- bool syncOp = operation->syncOp;
- char* opName = gCtgCacheOperation[operation->opId].name;
+ bool syncOp = operation->syncOp;
+ char *opName = gCtgCacheOperation[operation->opId].name;
if (operation->syncOp) {
tsem_init(&operation->rspSem, 0, 0);
}
-
+
node->op = operation;
CTG_LOCK(CTG_WRITE, &gCtgMgmt.queue.qlock);
@@ -699,12 +640,11 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgDropDbCacheEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId) {
- int32_t code = 0;
+int32_t ctgDropDbCacheEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_DROP_DB_CACHE;
-
+
SCtgDropDBMsg *msg = taosMemoryMalloc(sizeof(SCtgDropDBMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg));
@@ -732,12 +672,12 @@ _return:
CTG_RET(code);
}
-int32_t ctgDropDbVgroupEnqueue(SCatalog* pCtg, const char *dbFName, bool syncOp) {
- int32_t code = 0;
+int32_t ctgDropDbVgroupEnqueue(SCatalog *pCtg, const char *dbFName, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_DROP_DB_VGROUP;
op->syncOp = syncOp;
-
+
SCtgDropDbVgroupMsg *msg = taosMemoryMalloc(sizeof(SCtgDropDbVgroupMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDbVgroupMsg));
@@ -764,14 +704,13 @@ _return:
CTG_RET(code);
}
-
-
-int32_t ctgDropStbMetaEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, const char *stbName, uint64_t suid, bool syncOp) {
- int32_t code = 0;
+int32_t ctgDropStbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, const char *stbName, uint64_t suid,
+ bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_DROP_STB_META;
op->syncOp = syncOp;
-
+
SCtgDropStbMetaMsg *msg = taosMemoryMalloc(sizeof(SCtgDropStbMetaMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg));
@@ -796,14 +735,12 @@ _return:
CTG_RET(code);
}
-
-
-int32_t ctgDropTbMetaEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, const char *tbName, bool syncOp) {
- int32_t code = 0;
+int32_t ctgDropTbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, const char *tbName, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_DROP_TB_META;
op->syncOp = syncOp;
-
+
SCtgDropTblMetaMsg *msg = taosMemoryMalloc(sizeof(SCtgDropTblMetaMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg));
@@ -827,12 +764,12 @@ _return:
CTG_RET(code);
}
-int32_t ctgUpdateVgroupEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, SDBVgInfo* dbInfo, bool syncOp) {
- int32_t code = 0;
+int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, SDBVgInfo *dbInfo, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_UPDATE_VGROUP;
op->syncOp = syncOp;
-
+
SCtgUpdateVgMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateVgMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg));
@@ -864,12 +801,12 @@ _return:
CTG_RET(code);
}
-int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool syncOp) {
- int32_t code = 0;
+int32_t ctgUpdateTbMetaEnqueue(SCatalog *pCtg, STableMetaOutput *output, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_UPDATE_TB_META;
op->syncOp = syncOp;
-
+
SCtgUpdateTbMetaMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateTbMetaMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg));
@@ -889,7 +826,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool sy
CTG_ERR_JRET(ctgEnqueue(pCtg, op));
return TSDB_CODE_SUCCESS;
-
+
_return:
if (output) {
@@ -898,15 +835,15 @@ _return:
}
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-int32_t ctgUpdateVgEpsetEnqueue(SCatalog* pCtg, char *dbFName, int32_t vgId, SEpSet* pEpSet) {
- int32_t code = 0;
+int32_t ctgUpdateVgEpsetEnqueue(SCatalog *pCtg, char *dbFName, int32_t vgId, SEpSet *pEpSet) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_UPDATE_VG_EPSET;
-
+
SCtgUpdateEpsetMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateEpsetMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg));
@@ -923,22 +860,20 @@ int32_t ctgUpdateVgEpsetEnqueue(SCatalog* pCtg, char *dbFName, int32_t vgId, SEp
CTG_ERR_JRET(ctgEnqueue(pCtg, op));
return TSDB_CODE_SUCCESS;
-
+
_return:
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-
-
-int32_t ctgUpdateUserEnqueue(SCatalog* pCtg, SGetUserAuthRsp *pAuth, bool syncOp) {
- int32_t code = 0;
+int32_t ctgUpdateUserEnqueue(SCatalog *pCtg, SGetUserAuthRsp *pAuth, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_UPDATE_USER;
op->syncOp = syncOp;
-
+
SCtgUpdateUserMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateUserMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg));
@@ -951,23 +886,23 @@ int32_t ctgUpdateUserEnqueue(SCatalog* pCtg, SGetUserAuthRsp *pAuth, bool syncOp
op->data = msg;
CTG_ERR_JRET(ctgEnqueue(pCtg, op));
-
+
return TSDB_CODE_SUCCESS;
-
+
_return:
tFreeSGetUserAuthRsp(pAuth);
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-int32_t ctgUpdateTbIndexEnqueue(SCatalog* pCtg, STableIndex **pIndex, bool syncOp) {
- int32_t code = 0;
+int32_t ctgUpdateTbIndexEnqueue(SCatalog *pCtg, STableIndex **pIndex, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_UPDATE_TB_INDEX;
op->syncOp = syncOp;
-
+
SCtgUpdateTbIndexMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateTbIndexMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg));
@@ -983,22 +918,22 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog* pCtg, STableIndex **pIndex, bool syncO
*pIndex = NULL;
return TSDB_CODE_SUCCESS;
-
+
_return:
taosArrayDestroyEx((*pIndex)->pIndex, tFreeSTableIndexInfo);
taosMemoryFreeClear(*pIndex);
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-int32_t ctgDropTbIndexEnqueue(SCatalog* pCtg, SName* pName, bool syncOp) {
- int32_t code = 0;
+int32_t ctgDropTbIndexEnqueue(SCatalog *pCtg, SName *pName, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_DROP_TB_INDEX;
op->syncOp = syncOp;
-
+
SCtgDropTbIndexMsg *msg = taosMemoryMalloc(sizeof(SCtgDropTbIndexMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg));
@@ -1012,25 +947,24 @@ int32_t ctgDropTbIndexEnqueue(SCatalog* pCtg, SName* pName, bool syncOp) {
op->data = msg;
CTG_ERR_JRET(ctgEnqueue(pCtg, op));
-
+
return TSDB_CODE_SUCCESS;
-
+
_return:
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-
-int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool freeCtg, bool stopQueue, bool syncOp) {
- int32_t code = 0;
+int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool freeCtg, bool stopQueue, bool syncOp) {
+ int32_t code = 0;
SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation));
op->opId = CTG_OP_CLEAR_CACHE;
op->syncOp = syncOp;
op->stopQueue = stopQueue;
op->unLocked = true;
-
+
SCtgClearCacheMsg *msg = taosMemoryMalloc(sizeof(SCtgClearCacheMsg));
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg));
@@ -1042,24 +976,23 @@ int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool freeCtg, bool stopQueue, bool
op->data = msg;
CTG_ERR_JRET(ctgEnqueue(pCtg, op));
-
+
return TSDB_CODE_SUCCESS;
-
+
_return:
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-
int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) {
mgmt->slotRIdx = 0;
mgmt->slotNum = rentSec / CTG_RENT_SLOT_SECOND;
mgmt->type = type;
size_t msgSize = sizeof(SCtgRentSlot) * mgmt->slotNum;
-
+
mgmt->slots = taosMemoryCalloc(1, msgSize);
if (NULL == mgmt->slots) {
qError("calloc %d failed", (int32_t)msgSize);
@@ -1067,34 +1000,34 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) {
}
qDebug("meta rent initialized, type:%d, slotNum:%d", type, mgmt->slotNum);
-
+
return TSDB_CODE_SUCCESS;
}
-
int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) {
int16_t widx = abs((int)(id % mgmt->slotNum));
SCtgRentSlot *slot = &mgmt->slots[widx];
- int32_t code = 0;
-
+ int32_t code = 0;
+
CTG_LOCK(CTG_WRITE, &slot->lock);
if (NULL == slot->meta) {
slot->meta = taosArrayInit(CTG_DEFAULT_RENT_SLOT_SIZE, size);
if (NULL == slot->meta) {
- qError("taosArrayInit %d failed, id:0x%"PRIx64", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx, mgmt->type);
+ qError("taosArrayInit %d failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx,
+ mgmt->type);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
}
if (NULL == taosArrayPush(slot->meta, meta)) {
- qError("taosArrayPush meta to rent failed, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
+ qError("taosArrayPush meta to rent failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
slot->needSort = true;
- qDebug("add meta to rent, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
+ qDebug("add meta to rent, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
_return:
@@ -1102,20 +1035,22 @@ _return:
CTG_RET(code);
}
-int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size, __compar_fn_t sortCompare, __compar_fn_t searchCompare) {
+int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size, __compar_fn_t sortCompare,
+ __compar_fn_t searchCompare) {
int16_t widx = abs((int)(id % mgmt->slotNum));
SCtgRentSlot *slot = &mgmt->slots[widx];
- int32_t code = 0;
+ int32_t code = 0;
CTG_LOCK(CTG_WRITE, &slot->lock);
if (NULL == slot->meta) {
- qDebug("empty meta slot, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
+ qDebug("empty meta slot, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
}
if (slot->needSort) {
- qDebug("meta slot before sorte, slot idx:%d, type:%d, size:%d", widx, mgmt->type, (int32_t)taosArrayGetSize(slot->meta));
+ qDebug("meta slot before sorte, slot idx:%d, type:%d, size:%d", widx, mgmt->type,
+ (int32_t)taosArrayGetSize(slot->meta));
taosArraySort(slot->meta, sortCompare);
slot->needSort = false;
qDebug("meta slot sorted, slot idx:%d, type:%d, size:%d", widx, mgmt->type, (int32_t)taosArrayGetSize(slot->meta));
@@ -1123,20 +1058,22 @@ int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t si
void *orig = taosArraySearch(slot->meta, &id, searchCompare, TD_EQ);
if (NULL == orig) {
- qDebug("meta not found in slot, id:0x%"PRIx64", slot idx:%d, type:%d, size:%d", id, widx, mgmt->type, (int32_t)taosArrayGetSize(slot->meta));
+ qDebug("meta not found in slot, id:0x%" PRIx64 ", slot idx:%d, type:%d, size:%d", id, widx, mgmt->type,
+ (int32_t)taosArrayGetSize(slot->meta));
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
}
memcpy(orig, meta, size);
- qDebug("meta in rent updated, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
+ qDebug("meta in rent updated, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
_return:
CTG_UNLOCK(CTG_WRITE, &slot->lock);
if (code) {
- qDebug("meta in rent update failed, will try to add it, code:%x, id:0x%"PRIx64", slot idx:%d, type:%d", code, id, widx, mgmt->type);
+ qDebug("meta in rent update failed, will try to add it, code:%x, id:0x%" PRIx64 ", slot idx:%d, type:%d", code, id,
+ widx, mgmt->type);
CTG_RET(ctgMetaRentAdd(mgmt, meta, id, size));
}
@@ -1147,11 +1084,11 @@ int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortComp
int16_t widx = abs((int)(id % mgmt->slotNum));
SCtgRentSlot *slot = &mgmt->slots[widx];
- int32_t code = 0;
-
+ int32_t code = 0;
+
CTG_LOCK(CTG_WRITE, &slot->lock);
if (NULL == slot->meta) {
- qError("empty meta slot, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
+ qError("empty meta slot, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
}
@@ -1163,13 +1100,13 @@ int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortComp
int32_t idx = taosArraySearchIdx(slot->meta, &id, searchCompare, TD_EQ);
if (idx < 0) {
- qError("meta not found in slot, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
+ qError("meta not found in slot, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
}
taosArrayRemove(slot->meta, idx);
- qDebug("meta in rent removed, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type);
+ qDebug("meta in rent removed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
_return:
@@ -1178,7 +1115,6 @@ _return:
CTG_RET(code);
}
-
int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_t size) {
int16_t ridx = atomic_add_fetch_16(&mgmt->slotRIdx, 1);
if (ridx >= mgmt->slotNum) {
@@ -1187,8 +1123,8 @@ int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_
}
SCtgRentSlot *slot = &mgmt->slots[ridx];
- int32_t code = 0;
-
+ int32_t code = 0;
+
CTG_LOCK(CTG_READ, &slot->lock);
if (NULL == slot->meta) {
qDebug("empty meta in slot:%d, type:%d", ridx, mgmt->type);
@@ -1254,13 +1190,15 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
SCtgDBCache newDBCache = {0};
newDBCache.dbId = dbId;
- newDBCache.tbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ newDBCache.tbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
+ true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.tbCache) {
ctgError("taosHashInit %d metaCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
- newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_ENTRY_LOCK);
+ newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT),
+ true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.stbCache) {
ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
@@ -1272,21 +1210,21 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
ctgDebug("db already in cache, dbFName:%s", dbFName);
goto _return;
}
-
+
ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
CTG_CACHE_STAT_INC(numOfDb, 1);
-
+
SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1};
strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName));
- ctgDebug("db added to cache, dbFName:%s, dbId:0x%"PRIx64, dbFName, dbId);
+ ctgDebug("db added to cache, dbFName:%s, dbId:0x%" PRIx64, dbFName, dbId);
CTG_ERR_RET(ctgMetaRentAdd(&pCtg->dbRent, &vgVersion, dbId, sizeof(SDbVgVersion)));
- ctgDebug("db added to rent, dbFName:%s, vgVersion:%d, dbId:0x%"PRIx64, dbFName, vgVersion.vgVersion, dbId);
+ ctgDebug("db added to rent, dbFName:%s, vgVersion:%d, dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, dbId);
return TSDB_CODE_SUCCESS;
@@ -1297,30 +1235,29 @@ _return:
CTG_RET(code);
}
-
-void ctgRemoveStbRent(SCatalog* pCtg, SCtgDBCache *dbCache) {
+void ctgRemoveStbRent(SCatalog *pCtg, SCtgDBCache *dbCache) {
if (NULL == dbCache->stbCache) {
return;
}
-
+
void *pIter = taosHashIterate(dbCache->stbCache, NULL);
while (pIter) {
uint64_t *suid = NULL;
suid = taosHashGetKey(pIter, NULL);
- if (TSDB_CODE_SUCCESS == ctgMetaRentRemove(&pCtg->stbRent, *suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare)) {
- ctgDebug("stb removed from rent, suid:0x%"PRIx64, *suid);
+ if (TSDB_CODE_SUCCESS ==
+ ctgMetaRentRemove(&pCtg->stbRent, *suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare)) {
+ ctgDebug("stb removed from rent, suid:0x%" PRIx64, *suid);
}
-
+
pIter = taosHashIterate(dbCache->stbCache, pIter);
}
}
-
-int32_t ctgRemoveDBFromCache(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) {
+int32_t ctgRemoveDBFromCache(SCatalog *pCtg, SCtgDBCache *dbCache, const char *dbFName) {
uint64_t dbId = dbCache->dbId;
-
- ctgInfo("start to remove db from cache, dbFName:%s, dbId:0x%"PRIx64, dbFName, dbCache->dbId);
+
+ ctgInfo("start to remove db from cache, dbFName:%s, dbId:0x%" PRIx64, dbFName, dbCache->dbId);
CTG_LOCK(CTG_WRITE, &dbCache->dbLock);
@@ -1331,7 +1268,7 @@ int32_t ctgRemoveDBFromCache(SCatalog* pCtg, SCtgDBCache *dbCache, const char* d
CTG_UNLOCK(CTG_WRITE, &dbCache->dbLock);
CTG_ERR_RET(ctgMetaRentRemove(&pCtg->dbRent, dbId, ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
- ctgDebug("db removed from rent, dbFName:%s, dbId:0x%"PRIx64, dbFName, dbId);
+ ctgDebug("db removed from rent, dbFName:%s, dbId:0x%" PRIx64, dbFName, dbId);
if (taosHashRemove(pCtg->dbCache, dbFName, strlen(dbFName))) {
ctgInfo("taosHashRemove from dbCache failed, may be removed, dbFName:%s", dbFName);
@@ -1339,19 +1276,18 @@ int32_t ctgRemoveDBFromCache(SCatalog* pCtg, SCtgDBCache *dbCache, const char* d
}
CTG_CACHE_STAT_DEC(numOfDb, 1);
- ctgInfo("db removed from cache, dbFName:%s, dbId:0x%"PRIx64, dbFName, dbId);
-
+ ctgInfo("db removed from cache, dbFName:%s, dbId:0x%" PRIx64, dbFName, dbId);
+
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgGetAddDBCache(SCatalog* pCtg, const char *dbFName, uint64_t dbId, SCtgDBCache **pCache) {
- int32_t code = 0;
+int32_t ctgGetAddDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId, SCtgDBCache **pCache) {
+ int32_t code = 0;
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, dbFName, &dbCache);
-
+
if (dbCache) {
- // TODO OPEN IT
+ // TODO OPEN IT
#if 0
if (dbCache->dbId == dbId) {
*pCache = dbCache;
@@ -1368,7 +1304,7 @@ int32_t ctgGetAddDBCache(SCatalog* pCtg, const char *dbFName, uint64_t dbId, SCt
*pCache = dbCache;
return TSDB_CODE_SUCCESS;
}
-
+
if (dbCache->dbId == dbId) {
*pCache = dbCache;
return TSDB_CODE_SUCCESS;
@@ -1376,7 +1312,7 @@ int32_t ctgGetAddDBCache(SCatalog* pCtg, const char *dbFName, uint64_t dbId, SCt
#endif
CTG_ERR_RET(ctgRemoveDBFromCache(pCtg, dbCache, dbFName));
}
-
+
CTG_ERR_RET(ctgAddNewDBCache(pCtg, dbFName, dbId));
ctgGetDBCache(pCtg, dbFName, &dbCache);
@@ -1386,7 +1322,8 @@ int32_t ctgGetAddDBCache(SCatalog* pCtg, const char *dbFName, uint64_t dbId, SCt
return TSDB_CODE_SUCCESS;
}
-int32_t ctgUpdateRentStbVersion(SCatalog *pCtg, char* dbFName, char* tbName, uint64_t dbId, uint64_t suid, SCtgTbCache* pCache) {
+int32_t ctgUpdateRentStbVersion(SCatalog *pCtg, char *dbFName, char *tbName, uint64_t dbId, uint64_t suid,
+ SCtgTbCache *pCache) {
SSTableVersion metaRent = {.dbId = dbId, .suid = suid};
if (pCache->pMeta) {
metaRent.sversion = pCache->pMeta->sversion;
@@ -1396,49 +1333,51 @@ int32_t ctgUpdateRentStbVersion(SCatalog *pCtg, char* dbFName, char* tbName, uin
if (pCache->pIndex) {
metaRent.smaVer = pCache->pIndex->version;
}
-
+
strcpy(metaRent.dbFName, dbFName);
strcpy(metaRent.stbName, tbName);
-
- CTG_ERR_RET(ctgMetaRentUpdate(&pCtg->stbRent, &metaRent, metaRent.suid, sizeof(SSTableVersion), ctgStbVersionSortCompare, ctgStbVersionSearchCompare));
- ctgDebug("db %s,0x%" PRIx64 " stb %s,0x%" PRIx64 " sver %d tver %d smaVer %d updated to stbRent",
- dbFName, dbId, tbName, suid, metaRent.sversion, metaRent.tversion, metaRent.smaVer);
+ CTG_ERR_RET(ctgMetaRentUpdate(&pCtg->stbRent, &metaRent, metaRent.suid, sizeof(SSTableVersion),
+ ctgStbVersionSortCompare, ctgStbVersionSearchCompare));
- return TSDB_CODE_SUCCESS;
+ ctgDebug("db %s,0x%" PRIx64 " stb %s,0x%" PRIx64 " sver %d tver %d smaVer %d updated to stbRent", dbFName, dbId,
+ tbName, suid, metaRent.sversion, metaRent.tversion, metaRent.smaVer);
+
+ return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, uint64_t dbId, char *tbName, STableMeta *meta, int32_t metaSize) {
+int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, uint64_t dbId, char *tbName,
+ STableMeta *meta, int32_t metaSize) {
if (NULL == dbCache->tbCache || NULL == dbCache->stbCache) {
taosMemoryFree(meta);
- ctgError("db is dropping, dbId:0x%"PRIx64, dbCache->dbId);
+ ctgError("db is dropping, dbId:0x%" PRIx64, dbCache->dbId);
CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED);
}
- bool isStb = meta->tableType == TSDB_SUPER_TABLE;
- SCtgTbCache* pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName));
- STableMeta *orig = (pCache ? pCache->pMeta : NULL);
- int8_t origType = 0;
- uint64_t origSuid = 0;
-
+ bool isStb = meta->tableType == TSDB_SUPER_TABLE;
+ SCtgTbCache *pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName));
+ STableMeta *orig = (pCache ? pCache->pMeta : NULL);
+ int8_t origType = 0;
+ uint64_t origSuid = 0;
+
if (orig) {
origType = orig->tableType;
- if (origType == meta->tableType && orig->uid == meta->uid && (origType == TSDB_CHILD_TABLE || (orig->sversion >= meta->sversion && orig->tversion >= meta->tversion))) {
+ if (origType == meta->tableType && orig->uid == meta->uid &&
+ (origType == TSDB_CHILD_TABLE || (orig->sversion >= meta->sversion && orig->tversion >= meta->tversion))) {
taosMemoryFree(meta);
ctgDebug("ignore table %s meta update", tbName);
return TSDB_CODE_SUCCESS;
}
-
+
if (origType == TSDB_SUPER_TABLE) {
if (taosHashRemove(dbCache->stbCache, &orig->suid, sizeof(orig->suid))) {
- ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:0x%"PRIx64, dbFName, tbName, orig->suid);
+ ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid);
} else {
CTG_CACHE_STAT_DEC(numOfStb, 1);
- ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:0x%"PRIx64, dbFName, tbName, orig->suid);
+ ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid);
}
-
+
origSuid = orig->suid;
}
}
@@ -1451,7 +1390,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName));
} else {
taosMemoryFree(pCache->pMeta);
@@ -1469,35 +1408,37 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
return TSDB_CODE_SUCCESS;
}
- if (origSuid != meta->suid && taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) {
- ctgError("taosHashPut to stable cache failed, suid:0x%"PRIx64, meta->suid);
+ if (origSuid != meta->suid &&
+ taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) {
+ ctgError("taosHashPut to stable cache failed, suid:0x%" PRIx64, meta->suid);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
CTG_CACHE_STAT_INC(numOfStb, 1);
- ctgDebug("stb 0x%" PRIx64 " updated to cache, dbFName:%s, tbName:%s, tbType:%d", meta->suid, dbFName, tbName, meta->tableType);
+ ctgDebug("stb 0x%" PRIx64 " updated to cache, dbFName:%s, tbName:%s, tbType:%d", meta->suid, dbFName, tbName,
+ meta->tableType);
CTG_ERR_RET(ctgUpdateRentStbVersion(pCtg, dbFName, tbName, dbId, meta->suid, pCache));
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char* dbFName, char *tbName, STableIndex **index) {
+int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, char *tbName, STableIndex **index) {
if (NULL == dbCache->tbCache) {
ctgFreeSTableIndex(*index);
taosMemoryFreeClear(*index);
- ctgError("db is dropping, dbId:0x%"PRIx64, dbCache->dbId);
+ ctgError("db is dropping, dbId:0x%" PRIx64, dbCache->dbId);
CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED);
}
- STableIndex* pIndex = *index;
- uint64_t suid = pIndex->suid;
- SCtgTbCache* pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName));
+ STableIndex *pIndex = *index;
+ uint64_t suid = pIndex->suid;
+ SCtgTbCache *pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName));
if (NULL == pCache) {
SCtgTbCache cache = {0};
cache.pIndex = pIndex;
-
+
if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(cache)) != 0) {
ctgFreeSTableIndex(*index);
taosMemoryFreeClear(*index);
@@ -1506,12 +1447,13 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char* dbFNa
}
*index = NULL;
- ctgDebug("table %s index updated to cache, ver:%d, num:%d", tbName, pIndex->version, (int32_t)taosArrayGetSize(pIndex->pIndex));
+ ctgDebug("table %s index updated to cache, ver:%d, num:%d", tbName, pIndex->version,
+ (int32_t)taosArrayGetSize(pIndex->pIndex));
if (suid) {
CTG_ERR_RET(ctgUpdateRentStbVersion(pCtg, dbFName, tbName, dbCache->dbId, pIndex->suid, &cache));
}
-
+
return TSDB_CODE_SUCCESS;
}
@@ -1526,24 +1468,25 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char* dbFNa
pCache->pIndex = pIndex;
*index = NULL;
- ctgDebug("table %s index updated to cache, ver:%d, num:%d", tbName, pIndex->version, (int32_t)taosArrayGetSize(pIndex->pIndex));
+ ctgDebug("table %s index updated to cache, ver:%d, num:%d", tbName, pIndex->version,
+ (int32_t)taosArrayGetSize(pIndex->pIndex));
if (suid) {
CTG_ERR_RET(ctgUpdateRentStbVersion(pCtg, dbFName, tbName, dbCache->dbId, suid, pCache));
}
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgUpdateTbMetaToCache(SCatalog* pCtg, STableMetaOutput* pOut, bool syncReq) {
- STableMetaOutput* pOutput = NULL;
- int32_t code = 0;
-
+int32_t ctgUpdateTbMetaToCache(SCatalog *pCtg, STableMetaOutput *pOut, bool syncReq) {
+ STableMetaOutput *pOutput = NULL;
+ int32_t code = 0;
+
CTG_ERR_RET(ctgCloneMetaOutput(pOut, &pOutput));
CTG_ERR_JRET(ctgUpdateTbMetaEnqueue(pCtg, pOutput, syncReq));
return TSDB_CODE_SUCCESS;
-
+
_return:
ctgFreeSTableMetaOutput(pOutput);
@@ -1551,11 +1494,11 @@ _return:
}
void ctgClearAllInstance(void) {
- SCatalog* pCtg = NULL;
+ SCatalog *pCtg = NULL;
- void* pIter = taosHashIterate(gCtgMgmt.pCluster, NULL);
+ void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL);
while (pIter) {
- pCtg = *(SCatalog**)pIter;
+ pCtg = *(SCatalog **)pIter;
if (pCtg) {
ctgClearHandle(pCtg);
@@ -1566,11 +1509,11 @@ void ctgClearAllInstance(void) {
}
void ctgFreeAllInstance(void) {
- SCatalog* pCtg = NULL;
+ SCatalog *pCtg = NULL;
- void* pIter = taosHashIterate(gCtgMgmt.pCluster, NULL);
+ void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL);
while (pIter) {
- pCtg = *(SCatalog**)pIter;
+ pCtg = *(SCatalog **)pIter;
if (pCtg) {
ctgFreeHandle(pCtg);
@@ -1582,51 +1525,51 @@ void ctgFreeAllInstance(void) {
taosHashClear(gCtgMgmt.pCluster);
}
-
int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgUpdateVgMsg *msg = operation->data;
- SDBVgInfo* dbInfo = msg->dbInfo;
- char* dbFName = msg->dbFName;
- SCatalog* pCtg = msg->pCtg;
-
+ SDBVgInfo *dbInfo = msg->dbInfo;
+ char *dbFName = msg->dbFName;
+ SCatalog *pCtg = msg->pCtg;
+
if (NULL == dbInfo->vgHash) {
goto _return;
}
-
+
if (dbInfo->vgVersion < 0 || taosHashGetSize(dbInfo->vgHash) <= 0) {
- ctgError("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d",
- dbFName, dbInfo->vgHash, dbInfo->vgVersion, taosHashGetSize(dbInfo->vgHash));
+ ctgError("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d", dbFName, dbInfo->vgHash,
+ dbInfo->vgVersion, taosHashGetSize(dbInfo->vgHash));
CTG_ERR_JRET(TSDB_CODE_APP_ERROR);
}
- bool newAdded = false;
+ bool newAdded = false;
SDbVgVersion vgVersion = {.dbId = msg->dbId, .vgVersion = dbInfo->vgVersion, .numOfTable = dbInfo->numOfTable};
SCtgDBCache *dbCache = NULL;
CTG_ERR_JRET(ctgGetAddDBCache(msg->pCtg, dbFName, msg->dbId, &dbCache));
if (NULL == dbCache) {
- ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:0x%"PRIx64, dbFName, msg->dbId);
+ ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:0x%" PRIx64, dbFName, msg->dbId);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
}
SCtgVgCache *vgCache = &dbCache->vgCache;
CTG_ERR_JRET(ctgWLockVgInfo(msg->pCtg, dbCache));
-
+
if (vgCache->vgInfo) {
SDBVgInfo *vgInfo = vgCache->vgInfo;
-
+
if (dbInfo->vgVersion < vgInfo->vgVersion) {
ctgDebug("db vgVer is old, dbFName:%s, vgVer:%d, curVer:%d", dbFName, dbInfo->vgVersion, vgInfo->vgVersion);
ctgWUnlockVgInfo(dbCache);
-
+
goto _return;
}
if (dbInfo->vgVersion == vgInfo->vgVersion && dbInfo->numOfTable == vgInfo->numOfTable) {
- ctgDebug("no new db vgVer or numOfTable, dbFName:%s, vgVer:%d, numOfTable:%d", dbFName, dbInfo->vgVersion, dbInfo->numOfTable);
+ ctgDebug("no new db vgVer or numOfTable, dbFName:%s, vgVer:%d, numOfTable:%d", dbFName, dbInfo->vgVersion,
+ dbInfo->numOfTable);
ctgWUnlockVgInfo(dbCache);
-
+
goto _return;
}
@@ -1636,61 +1579,63 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
vgCache->vgInfo = dbInfo;
msg->dbInfo = NULL;
- ctgDebug("db vgInfo updated, dbFName:%s, vgVer:%d, dbId:0x%"PRIx64, dbFName, vgVersion.vgVersion, vgVersion.dbId);
+ ctgDebug("db vgInfo updated, dbFName:%s, vgVer:%d, dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, vgVersion.dbId);
ctgWUnlockVgInfo(dbCache);
dbCache = NULL;
strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName));
- CTG_ERR_RET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion), ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
+ CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion),
+ ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
_return:
ctgFreeVgInfo(msg->dbInfo);
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
int32_t ctgOpDropDbCache(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgDropDBMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
+ SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(msg->pCtg, msg->dbFName, &dbCache);
if (NULL == dbCache) {
goto _return;
}
-
+
if (dbCache->dbId != msg->dbId) {
- ctgInfo("dbId already updated, dbFName:%s, dbId:0x%"PRIx64 ", targetId:0x%"PRIx64, msg->dbFName, dbCache->dbId, msg->dbId);
+ ctgInfo("dbId already updated, dbFName:%s, dbId:0x%" PRIx64 ", targetId:0x%" PRIx64, msg->dbFName, dbCache->dbId,
+ msg->dbId);
goto _return;
}
-
+
CTG_ERR_JRET(ctgRemoveDBFromCache(pCtg, dbCache, msg->dbFName));
_return:
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
int32_t ctgOpDropDbVgroup(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgDropDbVgroupMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
+ SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(msg->pCtg, msg->dbFName, &dbCache);
if (NULL == dbCache) {
goto _return;
}
-
- CTG_ERR_RET(ctgWLockVgInfo(pCtg, dbCache));
-
+
+ CTG_ERR_JRET(ctgWLockVgInfo(pCtg, dbCache));
+
ctgFreeVgInfo(dbCache->vgCache.vgInfo);
dbCache->vgCache.vgInfo = NULL;
@@ -1701,17 +1646,16 @@ int32_t ctgOpDropDbVgroup(SCtgCacheOperation *operation) {
_return:
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-
int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgUpdateTbMetaMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
- STableMetaOutput* pMeta = msg->pMeta;
- SCtgDBCache *dbCache = NULL;
+ SCatalog *pCtg = msg->pCtg;
+ STableMetaOutput *pMeta = msg->pMeta;
+ SCtgDBCache *dbCache = NULL;
if ((!CTG_IS_META_CTABLE(pMeta->metaType)) && NULL == pMeta->tbMeta) {
ctgError("no valid tbmeta got from meta rsp, dbFName:%s, tbName:%s", pMeta->dbFName, pMeta->tbName);
@@ -1721,8 +1665,8 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
if (CTG_IS_META_BOTH(pMeta->metaType) && TSDB_SUPER_TABLE != pMeta->tbMeta->tableType) {
ctgError("table type error, expected:%d, actual:%d", TSDB_SUPER_TABLE, pMeta->tbMeta->tableType);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
- }
-
+ }
+
CTG_ERR_JRET(ctgGetAddDBCache(pCtg, pMeta->dbFName, pMeta->dbId, &dbCache));
if (NULL == dbCache) {
ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:0x%" PRIx64, pMeta->dbFName, pMeta->dbId);
@@ -1731,17 +1675,19 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
if (CTG_IS_META_TABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) {
int32_t metaSize = CTG_META_SIZE(pMeta->tbMeta);
- CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->tbName, pMeta->tbMeta, metaSize));
+ CTG_ERR_JRET(
+ ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->tbName, pMeta->tbMeta, metaSize));
pMeta->tbMeta = NULL;
}
if (CTG_IS_META_CTABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) {
- SCTableMeta* ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta));
+ SCTableMeta *ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta));
if (NULL == ctbMeta) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
memcpy(ctbMeta, &pMeta->ctbMeta, sizeof(SCTableMeta));
- CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName, (STableMeta *)ctbMeta, sizeof(SCTableMeta)));
+ CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName,
+ (STableMeta *)ctbMeta, sizeof(SCTableMeta)));
}
_return:
@@ -1750,37 +1696,37 @@ _return:
taosMemoryFreeClear(pMeta->tbMeta);
taosMemoryFreeClear(pMeta);
}
-
+
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-
int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgDropStbMetaMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
+ SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, msg->dbFName, &dbCache);
if (NULL == dbCache) {
- return TSDB_CODE_SUCCESS;
+ goto _return;
}
if (msg->dbId && (dbCache->dbId != msg->dbId)) {
- ctgDebug("dbId already modified, dbFName:%s, current:0x%"PRIx64", dbId:0x%"PRIx64", stb:%s, suid:0x%"PRIx64,
+ ctgDebug("dbId already modified, dbFName:%s, current:0x%" PRIx64 ", dbId:0x%" PRIx64 ", stb:%s, suid:0x%" PRIx64,
msg->dbFName, dbCache->dbId, msg->dbId, msg->stbName, msg->suid);
- return TSDB_CODE_SUCCESS;
+ goto _return;
}
-
+
if (taosHashRemove(dbCache->stbCache, &msg->suid, sizeof(msg->suid))) {
- ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:0x%"PRIx64, msg->dbFName, msg->stbName, msg->suid);
+ ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:0x%" PRIx64, msg->dbFName,
+ msg->stbName, msg->suid);
} else {
CTG_CACHE_STAT_DEC(numOfStb, 1);
}
- SCtgTbCache* pTbCache = taosHashGet(dbCache->tbCache, msg->stbName, strlen(msg->stbName));
+ SCtgTbCache *pTbCache = taosHashGet(dbCache->tbCache, msg->stbName, strlen(msg->stbName));
if (NULL == pTbCache) {
ctgDebug("stb %s already not in cache", msg->stbName);
goto _return;
@@ -1790,29 +1736,29 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) {
ctgFreeTbCacheImpl(pTbCache);
CTG_UNLOCK(CTG_WRITE, &pTbCache->metaLock);
- if (taosHashRemove(dbCache->tbCache, msg->stbName, strlen(msg->stbName))) {
- ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:0x%"PRIx64, msg->dbFName, msg->stbName, msg->suid);
+ if (taosHashRemove(dbCache->tbCache, msg->stbName, strlen(msg->stbName))) {
+ ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid);
} else {
CTG_CACHE_STAT_DEC(numOfTbl, 1);
}
-
- ctgInfo("stb removed from cache, dbFName:%s, stbName:%s, suid:0x%"PRIx64, msg->dbFName, msg->stbName, msg->suid);
+
+ ctgInfo("stb removed from cache, dbFName:%s, stbName:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid);
CTG_ERR_JRET(ctgMetaRentRemove(&msg->pCtg->stbRent, msg->suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare));
-
- ctgDebug("stb removed from rent, dbFName:%s, stbName:%s, suid:0x%"PRIx64, msg->dbFName, msg->stbName, msg->suid);
-
+
+ ctgDebug("stb removed from rent, dbFName:%s, stbName:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid);
+
_return:
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgDropTblMetaMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
+ SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, msg->dbFName, &dbCache);
@@ -1821,11 +1767,12 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) {
}
if (dbCache->dbId != msg->dbId) {
- ctgDebug("dbId 0x%" PRIx64 " not match with curId 0x%"PRIx64", dbFName:%s, tbName:%s", msg->dbId, dbCache->dbId, msg->dbFName, msg->tbName);
+ ctgDebug("dbId 0x%" PRIx64 " not match with curId 0x%" PRIx64 ", dbFName:%s, tbName:%s", msg->dbId, dbCache->dbId,
+ msg->dbFName, msg->tbName);
goto _return;
}
- SCtgTbCache* pTbCache = taosHashGet(dbCache->tbCache, msg->tbName, strlen(msg->tbName));
+ SCtgTbCache *pTbCache = taosHashGet(dbCache->tbCache, msg->tbName, strlen(msg->tbName));
if (NULL == pTbCache) {
ctgDebug("tb %s already not in cache", msg->tbName);
goto _return;
@@ -1834,7 +1781,7 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) {
CTG_LOCK(CTG_WRITE, &pTbCache->metaLock);
ctgFreeTbCacheImpl(pTbCache);
CTG_UNLOCK(CTG_WRITE, &pTbCache->metaLock);
-
+
if (taosHashRemove(dbCache->tbCache, msg->tbName, strlen(msg->tbName))) {
ctgError("tb %s not exist in cache, dbFName:%s", msg->tbName, msg->dbFName);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
@@ -1852,10 +1799,10 @@ _return:
}
int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgUpdateUserMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
-
+ SCatalog *pCtg = msg->pCtg;
+
SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user));
if (NULL == pUser) {
SCtgUserAuth userAuth = {0};
@@ -1899,17 +1846,17 @@ _return:
taosHashCleanup(msg->userAuth.createdDbs);
taosHashCleanup(msg->userAuth.readDbs);
taosHashCleanup(msg->userAuth.writeDbs);
-
+
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
int32_t ctgOpUpdateEpset(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgUpdateEpsetMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
-
+ SCatalog *pCtg = msg->pCtg;
+
SCtgDBCache *dbCache = NULL;
CTG_ERR_JRET(ctgGetDBCache(pCtg, msg->dbFName, &dbCache));
if (NULL == dbCache) {
@@ -1919,23 +1866,23 @@ int32_t ctgOpUpdateEpset(SCtgCacheOperation *operation) {
CTG_ERR_JRET(ctgWLockVgInfo(pCtg, dbCache));
- SDBVgInfo *vgInfo = dbCache->vgCache.vgInfo;
+ SDBVgInfo *vgInfo = dbCache->vgCache.vgInfo;
if (NULL == vgInfo) {
ctgDebug("vgroup in db %s not cached, ignore epset update", msg->dbFName);
goto _return;
}
-
- SVgroupInfo* pInfo = taosHashGet(vgInfo->vgHash, &msg->vgId, sizeof(msg->vgId));
+
+ SVgroupInfo *pInfo = taosHashGet(vgInfo->vgHash, &msg->vgId, sizeof(msg->vgId));
if (NULL == pInfo) {
ctgDebug("no vgroup %d in db %s, ignore epset update", msg->vgId, msg->dbFName);
goto _return;
}
- SEp* pOrigEp = &pInfo->epSet.eps[pInfo->epSet.inUse];
- SEp* pNewEp = &msg->epSet.eps[msg->epSet.inUse];
- ctgDebug("vgroup %d epset updated from %d/%d=>%s:%d to %d/%d=>%s:%d, dbFName:%s in ctg",
- pInfo->vgId, pInfo->epSet.inUse, pInfo->epSet.numOfEps, pOrigEp->fqdn, pOrigEp->port,
- msg->epSet.inUse, msg->epSet.numOfEps, pNewEp->fqdn, pNewEp->port, msg->dbFName);
+ SEp *pOrigEp = &pInfo->epSet.eps[pInfo->epSet.inUse];
+ SEp *pNewEp = &msg->epSet.eps[msg->epSet.inUse];
+ ctgDebug("vgroup %d epset updated from %d/%d=>%s:%d to %d/%d=>%s:%d, dbFName:%s in ctg", pInfo->vgId,
+ pInfo->epSet.inUse, pInfo->epSet.numOfEps, pOrigEp->fqdn, pOrigEp->port, msg->epSet.inUse,
+ msg->epSet.numOfEps, pNewEp->fqdn, pNewEp->port, msg->dbFName);
pInfo->epSet = msg->epSet;
@@ -1946,17 +1893,17 @@ _return:
}
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
int32_t ctgOpUpdateTbIndex(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgUpdateTbIndexMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
- STableIndex* pIndex = msg->pIndex;
- SCtgDBCache *dbCache = NULL;
-
+ SCatalog *pCtg = msg->pCtg;
+ STableIndex *pIndex = msg->pIndex;
+ SCtgDBCache *dbCache = NULL;
+
CTG_ERR_JRET(ctgGetAddDBCache(pCtg, pIndex->dbFName, 0, &dbCache));
CTG_ERR_JRET(ctgWriteTbIndexToCache(pCtg, dbCache, pIndex->dbFName, pIndex->tbName, &pIndex));
@@ -1967,24 +1914,24 @@ _return:
taosArrayDestroyEx(pIndex->pIndex, tFreeSTableIndexInfo);
taosMemoryFreeClear(pIndex);
}
-
+
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
int32_t ctgOpDropTbIndex(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgDropTbIndexMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
- SCtgDBCache *dbCache = NULL;
-
+ SCatalog *pCtg = msg->pCtg;
+ SCtgDBCache *dbCache = NULL;
+
CTG_ERR_JRET(ctgGetDBCache(pCtg, msg->dbFName, &dbCache));
if (NULL == dbCache) {
return TSDB_CODE_SUCCESS;
}
- STableIndex* pIndex = taosMemoryCalloc(1, sizeof(STableIndex));
+ STableIndex *pIndex = taosMemoryCalloc(1, sizeof(STableIndex));
if (NULL == pIndex) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
@@ -2000,17 +1947,16 @@ _return:
taosArrayDestroyEx(pIndex->pIndex, tFreeSTableIndexInfo);
taosMemoryFreeClear(pIndex);
}
-
+
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
-
int32_t ctgOpClearCache(SCtgCacheOperation *operation) {
- int32_t code = 0;
+ int32_t code = 0;
SCtgClearCacheMsg *msg = operation->data;
- SCatalog* pCtg = msg->pCtg;
+ SCatalog *pCtg = msg->pCtg;
CTG_LOCK(CTG_WRITE, &gCtgMgmt.lock);
@@ -2020,7 +1966,7 @@ int32_t ctgOpClearCache(SCtgCacheOperation *operation) {
} else {
ctgClearHandle(pCtg);
}
-
+
goto _return;
}
@@ -2033,17 +1979,17 @@ int32_t ctgOpClearCache(SCtgCacheOperation *operation) {
_return:
CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.lock);
-
+
taosMemoryFreeClear(msg);
-
+
CTG_RET(code);
}
void ctgCleanupCacheQueue(void) {
- SCtgQNode *node = NULL;
- SCtgQNode *nodeNext = NULL;
+ SCtgQNode *node = NULL;
+ SCtgQNode *nodeNext = NULL;
SCtgCacheOperation *op = NULL;
- bool stopQueue = false;
+ bool stopQueue = false;
while (true) {
node = gCtgMgmt.queue.head->next;
@@ -2055,12 +2001,12 @@ void ctgCleanupCacheQueue(void) {
ctgDebug("process [%s] operation", gCtgCacheOperation[op->opId].name);
(*gCtgCacheOperation[op->opId].func)(op);
stopQueue = true;
- CTG_RT_STAT_INC(numOfOpDequeue, 1);
+ CTG_RT_STAT_INC(numOfOpDequeue, 1);
} else {
taosMemoryFree(op->data);
- CTG_RT_STAT_INC(numOfOpAbort, 1);
+ CTG_RT_STAT_INC(numOfOpAbort, 1);
}
-
+
if (op->syncOp) {
tsem_post(&op->rspSem);
} else {
@@ -2070,7 +2016,7 @@ void ctgCleanupCacheQueue(void) {
nodeNext = node->next;
taosMemoryFree(node);
-
+
node = nodeNext;
}
@@ -2085,7 +2031,7 @@ void ctgCleanupCacheQueue(void) {
gCtgMgmt.queue.tail = NULL;
}
-void* ctgUpdateThreadFunc(void* param) {
+void *ctgUpdateThreadFunc(void *param) {
setThreadName("catalog");
qInfo("catalog update thread started");
@@ -2094,8 +2040,8 @@ void* ctgUpdateThreadFunc(void* param) {
if (tsem_wait(&gCtgMgmt.queue.reqSem)) {
qError("ctg tsem_wait failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno)));
}
-
- if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) {
+
+ if (atomic_load_8((int8_t *)&gCtgMgmt.exit)) {
ctgCleanupCacheQueue();
break;
}
@@ -2105,7 +2051,7 @@ void* ctgUpdateThreadFunc(void* param) {
SCatalog *pCtg = ((SCtgUpdateMsgHeader *)operation->data)->pCtg;
ctgDebug("process [%s] operation", gCtgCacheOperation[operation->opId].name);
-
+
(*gCtgCacheOperation[operation->opId].func)(operation);
if (operation->syncOp) {
@@ -2114,18 +2060,17 @@ void* ctgUpdateThreadFunc(void* param) {
taosMemoryFreeClear(operation);
}
- CTG_RT_STAT_INC(numOfOpDequeue, 1);
+ CTG_RT_STAT_INC(numOfOpDequeue, 1);
ctgdShowCacheInfo();
ctgdShowClusterCache(pCtg);
}
qInfo("catalog update thread stopped");
-
+
return NULL;
}
-
int32_t ctgStartUpdateThread() {
TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr);
@@ -2135,13 +2080,12 @@ int32_t ctgStartUpdateThread() {
terrno = TAOS_SYSTEM_ERROR(errno);
CTG_ERR_RET(terrno);
}
-
+
taosThreadAttrDestroy(&thAttr);
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgGetTbMetaFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta) {
+int32_t ctgGetTbMetaFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) {
if (IS_SYS_DBNAME(ctx->pName->dbname)) {
CTG_FLAG_SET_SYS_DB(ctx->flag);
}
@@ -2221,14 +2165,15 @@ int32_t ctgGetTbMetaBFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
}
#endif
-int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMetasCtx* ctx, int32_t dbIdx, int32_t *fetchIdx, int32_t baseResIdx, SArray* pList) {
- int32_t tbNum = taosArrayGetSize(pList);
- SName* pName = taosArrayGet(pList, 0);
- char dbFName[TSDB_DB_FNAME_LEN] = {0};
- int32_t flag = CTG_FLAG_UNKNOWN_STB;
- uint64_t lastSuid = 0;
- STableMeta* lastTableMeta = NULL;
-
+int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMetasCtx *ctx, int32_t dbIdx,
+ int32_t *fetchIdx, int32_t baseResIdx, SArray *pList) {
+ int32_t tbNum = taosArrayGetSize(pList);
+ SName *pName = taosArrayGet(pList, 0);
+ char dbFName[TSDB_DB_FNAME_LEN] = {0};
+ int32_t flag = CTG_FLAG_UNKNOWN_STB;
+ uint64_t lastSuid = 0;
+ STableMeta *lastTableMeta = NULL;
+
if (IS_SYS_DBNAME(pName->dbname)) {
CTG_FLAG_SET_SYS_DB(flag);
strcpy(dbFName, pName->dbname);
@@ -2237,9 +2182,9 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
}
SCtgDBCache *dbCache = NULL;
- SCtgTbCache* pCache = NULL;
+ SCtgTbCache *pCache = NULL;
ctgAcquireDBCache(pCtg, dbFName, &dbCache);
-
+
if (NULL == dbCache) {
ctgDebug("db %s not in cache", dbFName);
for (int32_t i = 0; i < tbNum; ++i) {
@@ -2251,14 +2196,14 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
}
for (int32_t i = 0; i < tbNum; ++i) {
- SName* pName = taosArrayGet(pList, i);
+ SName *pName = taosArrayGet(pList, i);
pCache = taosHashAcquire(dbCache->tbCache, pName->tname, strlen(pName->tname));
if (NULL == pCache) {
ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
-
+
continue;
}
@@ -2267,11 +2212,11 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
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);
-
+
continue;
}
- STableMeta* tbMeta = pCache->pMeta;
+ STableMeta *tbMeta = pCache->pMeta;
SCtgTbMetaCtx nctx = {0};
nctx.flag = flag;
@@ -2280,8 +2225,8 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
nctx.tbInfo.suid = tbMeta->suid;
nctx.tbInfo.tbType = tbMeta->tableType;
- SMetaRes res = {0};
- STableMeta* pTableMeta = NULL;
+ SMetaRes res = {0};
+ STableMeta *pTableMeta = NULL;
if (tbMeta->tableType != TSDB_CHILD_TABLE) {
int32_t metaSize = CTG_META_SIZE(tbMeta);
pTableMeta = taosMemoryCalloc(1, metaSize);
@@ -2289,20 +2234,20 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
memcpy(pTableMeta, tbMeta, metaSize);
-
+
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
- taosHashRelease(dbCache->tbCache, pCache);
-
+ taosHashRelease(dbCache->tbCache, pCache);
+
ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, tbMeta->tableType, dbFName);
-
+
res.pRes = pTableMeta;
taosArrayPush(ctx->pResList, &res);
continue;
}
-
+
// PROCESS FOR CHILD TABLE
if (lastSuid && tbMeta->suid == lastSuid && lastTableMeta) {
@@ -2310,32 +2255,32 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
memcpy(pTableMeta, tbMeta, sizeof(SCTableMeta));
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
- taosHashRelease(dbCache->tbCache, pCache);
-
+ taosHashRelease(dbCache->tbCache, pCache);
+
ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, tbMeta->tableType, dbFName);
-
+
res.pRes = pTableMeta;
taosArrayPush(ctx->pResList, &res);
-
+
continue;
}
-
+
int32_t metaSize = sizeof(SCTableMeta);
pTableMeta = taosMemoryCalloc(1, metaSize);
if (NULL == pTableMeta) {
- ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
+ ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
memcpy(pTableMeta, tbMeta, metaSize);
-
+
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
- taosHashRelease(dbCache->tbCache, pCache);
-
- ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s",
- pName->tname, nctx.tbInfo.tbType, dbFName);
-
- char* stName = taosHashAcquire(dbCache->stbCache, &pTableMeta->suid, sizeof(pTableMeta->suid));
+ taosHashRelease(dbCache->tbCache, pCache);
+
+ ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", pName->tname,
+ nctx.tbInfo.tbType, dbFName);
+
+ char *stName = taosHashAcquire(dbCache->stbCache, &pTableMeta->suid, sizeof(pTableMeta->suid));
if (NULL == stName) {
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
@@ -2349,11 +2294,11 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
if (NULL == pCache) {
ctgDebug("stb 0x%" PRIx64 " name %s not in cache, dbFName:%s", pTableMeta->suid, stName, dbFName);
taosHashRelease(dbCache->stbCache, stName);
-
+
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
- taosMemoryFreeClear(pTableMeta);
+ taosMemoryFreeClear(pTableMeta);
continue;
}
@@ -2363,8 +2308,8 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
if (NULL == pCache->pMeta) {
ctgDebug("stb 0x%" PRIx64 " meta not in cache, dbFName:%s", pTableMeta->suid, dbFName);
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
- taosHashRelease(dbCache->tbCache, pCache);
-
+ taosHashRelease(dbCache->tbCache, pCache);
+
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
@@ -2372,14 +2317,15 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
continue;
}
-
- STableMeta* stbMeta = pCache->pMeta;
- if (stbMeta->suid != nctx.tbInfo.suid) {
+
+ STableMeta *stbMeta = pCache->pMeta;
+ if (stbMeta->suid != nctx.tbInfo.suid) {
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
- taosHashRelease(dbCache->tbCache, pCache);
-
- ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid 0x%"PRIx64 , stbMeta->suid, nctx.tbInfo.suid);
-
+ taosHashRelease(dbCache->tbCache, pCache);
+
+ ctgError("stb suid 0x%" PRIx64 " in stbCache mis-match, expected suid 0x%" PRIx64, stbMeta->suid,
+ nctx.tbInfo.suid);
+
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
@@ -2387,19 +2333,19 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
continue;
}
-
+
metaSize = CTG_META_SIZE(stbMeta);
pTableMeta = taosMemoryRealloc(pTableMeta, metaSize);
- if (NULL == pTableMeta) {
+ if (NULL == pTableMeta) {
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
memcpy(&pTableMeta->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta));
-
+
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
- taosHashRelease(dbCache->tbCache, pCache);
-
+ taosHashRelease(dbCache->tbCache, pCache);
+
res.pRes = pTableMeta;
taosArrayPush(ctx->pResList, &res);
@@ -2408,14 +2354,13 @@ int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMe
}
ctgReleaseDBCache(pCtg, dbCache);
-
+
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgRemoveTbMetaFromCache(SCatalog* pCtg, SName* pTableName, bool syncReq) {
+int32_t ctgRemoveTbMetaFromCache(SCatalog *pCtg, SName *pTableName, bool syncReq) {
int32_t code = 0;
- STableMeta* tblMeta = NULL;
+ STableMeta *tblMeta = NULL;
SCtgTbMetaCtx tbCtx = {0};
tbCtx.flag = CTG_FLAG_UNKNOWN_STB;
tbCtx.pName = pTableName;
@@ -2449,7 +2394,7 @@ int32_t ctgGetTbHashVgroupFromCache(SCatalog *pCtg, const SName *pTableName, SVg
CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT);
}
- SCtgDBCache* dbCache = NULL;
+ SCtgDBCache *dbCache = NULL;
int32_t code = 0;
char dbFName[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pTableName, dbFName);
@@ -2476,5 +2421,3 @@ _return:
CTG_RET(code);
}
-
-
diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h
index 0722c2b306..a26f1c74f8 100644
--- a/source/libs/executor/inc/executil.h
+++ b/source/libs/executor/inc/executil.h
@@ -126,6 +126,7 @@ SArray* extractPartitionColInfo(SNodeList* pNodeList);
SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols,
int32_t type);
+void createExprFromTargetNode(SExprInfo* pExp, STargetNode* pTargetNode);
SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* numOfExprs);
SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput, int32_t** rowEntryInfoOffset);
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index fc8f942015..6516d76830 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -459,10 +459,11 @@ typedef struct SPartitionDataInfo {
SArray* rowIds;
} SPartitionDataInfo;
-typedef struct STimeWindowSupp {
+typedef struct STimeWindowAggSupp {
int8_t calTrigger;
int64_t waterMark;
TSKEY maxTs;
+ TSKEY minTs;
SColumnInfoData timeWindowData; // query time window info for scalar function execution.
} STimeWindowAggSupp;
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index 69951e5e1c..0c1728386b 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -1011,6 +1011,100 @@ static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDa
return pCol;
}
+void createExprFromTargetNode(SExprInfo* pExp, STargetNode* pTargetNode) {
+ pExp->pExpr = taosMemoryCalloc(1, sizeof(tExprNode));
+ pExp->pExpr->_function.num = 1;
+ pExp->pExpr->_function.functionId = -1;
+
+ int32_t type = nodeType(pTargetNode->pExpr);
+ // it is a project query, or group by column
+ if (type == QUERY_NODE_COLUMN) {
+ pExp->pExpr->nodeType = QUERY_NODE_COLUMN;
+ SColumnNode* pColNode = (SColumnNode*)pTargetNode->pExpr;
+
+ pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam));
+ pExp->base.numOfParams = 1;
+
+ SDataType* pType = &pColNode->node.resType;
+ pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
+ pType->precision, pColNode->colName);
+ pExp->base.pParam[0].pCol =
+ createColumn(pColNode->dataBlockId, pColNode->slotId, pColNode->colId, pType, pColNode->colType);
+ pExp->base.pParam[0].type = FUNC_PARAM_TYPE_COLUMN;
+ } else if (type == QUERY_NODE_VALUE) {
+ pExp->pExpr->nodeType = QUERY_NODE_VALUE;
+ SValueNode* pValNode = (SValueNode*)pTargetNode->pExpr;
+
+ pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam));
+ pExp->base.numOfParams = 1;
+
+ SDataType* pType = &pValNode->node.resType;
+ pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
+ pType->precision, pValNode->node.aliasName);
+ pExp->base.pParam[0].type = FUNC_PARAM_TYPE_VALUE;
+ nodesValueNodeToVariant(pValNode, &pExp->base.pParam[0].param);
+ } else if (type == QUERY_NODE_FUNCTION) {
+ pExp->pExpr->nodeType = QUERY_NODE_FUNCTION;
+ SFunctionNode* pFuncNode = (SFunctionNode*)pTargetNode->pExpr;
+
+ SDataType* pType = &pFuncNode->node.resType;
+ pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
+ pType->precision, pFuncNode->node.aliasName);
+
+ pExp->pExpr->_function.functionId = pFuncNode->funcId;
+ pExp->pExpr->_function.pFunctNode = pFuncNode;
+
+ strncpy(pExp->pExpr->_function.functionName, pFuncNode->functionName,
+ tListLen(pExp->pExpr->_function.functionName));
+#if 1
+ // todo refactor: add the parameter for tbname function
+ if (!pFuncNode->pParameterList && (strcmp(pExp->pExpr->_function.functionName, "tbname") == 0)) {
+ pFuncNode->pParameterList = nodesMakeList();
+ ASSERT(LIST_LENGTH(pFuncNode->pParameterList) == 0);
+ SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
+ if (NULL == res) { // todo handle error
+ } else {
+ res->node.resType = (SDataType){.bytes = sizeof(int64_t), .type = TSDB_DATA_TYPE_BIGINT};
+ nodesListAppend(pFuncNode->pParameterList, (SNode*)res);
+ }
+ }
+#endif
+
+ int32_t numOfParam = LIST_LENGTH(pFuncNode->pParameterList);
+
+ pExp->base.pParam = taosMemoryCalloc(numOfParam, sizeof(SFunctParam));
+ pExp->base.numOfParams = numOfParam;
+
+ for (int32_t j = 0; j < numOfParam; ++j) {
+ SNode* p1 = nodesListGetNode(pFuncNode->pParameterList, j);
+ if (p1->type == QUERY_NODE_COLUMN) {
+ SColumnNode* pcn = (SColumnNode*)p1;
+
+ pExp->base.pParam[j].type = FUNC_PARAM_TYPE_COLUMN;
+ pExp->base.pParam[j].pCol =
+ createColumn(pcn->dataBlockId, pcn->slotId, pcn->colId, &pcn->node.resType, pcn->colType);
+ } else if (p1->type == QUERY_NODE_VALUE) {
+ SValueNode* pvn = (SValueNode*)p1;
+ pExp->base.pParam[j].type = FUNC_PARAM_TYPE_VALUE;
+ nodesValueNodeToVariant(pvn, &pExp->base.pParam[j].param);
+ }
+ }
+ } else if (type == QUERY_NODE_OPERATOR) {
+ pExp->pExpr->nodeType = QUERY_NODE_OPERATOR;
+ SOperatorNode* pNode = (SOperatorNode*)pTargetNode->pExpr;
+
+ pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam));
+ pExp->base.numOfParams = 1;
+
+ SDataType* pType = &pNode->node.resType;
+ pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
+ pType->precision, pNode->node.aliasName);
+ pExp->pExpr->_optrRoot.pRootNode = pTargetNode->pExpr;
+ } else {
+ ASSERT(0);
+ }
+}
+
SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* numOfExprs) {
int32_t numOfFuncs = LIST_LENGTH(pNodeList);
int32_t numOfGroupKeys = 0;
@@ -1034,98 +1128,7 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t*
}
SExprInfo* pExp = &pExprs[i];
-
- pExp->pExpr = taosMemoryCalloc(1, sizeof(tExprNode));
- pExp->pExpr->_function.num = 1;
- pExp->pExpr->_function.functionId = -1;
-
- int32_t type = nodeType(pTargetNode->pExpr);
- // it is a project query, or group by column
- if (type == QUERY_NODE_COLUMN) {
- pExp->pExpr->nodeType = QUERY_NODE_COLUMN;
- SColumnNode* pColNode = (SColumnNode*)pTargetNode->pExpr;
-
- pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam));
- pExp->base.numOfParams = 1;
-
- SDataType* pType = &pColNode->node.resType;
- pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
- pType->precision, pColNode->colName);
- pExp->base.pParam[0].pCol =
- createColumn(pColNode->dataBlockId, pColNode->slotId, pColNode->colId, pType, pColNode->colType);
- pExp->base.pParam[0].type = FUNC_PARAM_TYPE_COLUMN;
- } else if (type == QUERY_NODE_VALUE) {
- pExp->pExpr->nodeType = QUERY_NODE_VALUE;
- SValueNode* pValNode = (SValueNode*)pTargetNode->pExpr;
-
- pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam));
- pExp->base.numOfParams = 1;
-
- SDataType* pType = &pValNode->node.resType;
- pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
- pType->precision, pValNode->node.aliasName);
- pExp->base.pParam[0].type = FUNC_PARAM_TYPE_VALUE;
- nodesValueNodeToVariant(pValNode, &pExp->base.pParam[0].param);
- } else if (type == QUERY_NODE_FUNCTION) {
- pExp->pExpr->nodeType = QUERY_NODE_FUNCTION;
- SFunctionNode* pFuncNode = (SFunctionNode*)pTargetNode->pExpr;
-
- SDataType* pType = &pFuncNode->node.resType;
- pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
- pType->precision, pFuncNode->node.aliasName);
-
- pExp->pExpr->_function.functionId = pFuncNode->funcId;
- pExp->pExpr->_function.pFunctNode = pFuncNode;
-
- strncpy(pExp->pExpr->_function.functionName, pFuncNode->functionName,
- tListLen(pExp->pExpr->_function.functionName));
-#if 1
- // todo refactor: add the parameter for tbname function
- if (!pFuncNode->pParameterList && (strcmp(pExp->pExpr->_function.functionName, "tbname") == 0)) {
- pFuncNode->pParameterList = nodesMakeList();
- ASSERT(LIST_LENGTH(pFuncNode->pParameterList) == 0);
- SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
- if (NULL == res) { // todo handle error
- } else {
- res->node.resType = (SDataType){.bytes = sizeof(int64_t), .type = TSDB_DATA_TYPE_BIGINT};
- nodesListAppend(pFuncNode->pParameterList, (SNode*)res);
- }
- }
-#endif
-
- int32_t numOfParam = LIST_LENGTH(pFuncNode->pParameterList);
-
- pExp->base.pParam = taosMemoryCalloc(numOfParam, sizeof(SFunctParam));
- pExp->base.numOfParams = numOfParam;
-
- for (int32_t j = 0; j < numOfParam; ++j) {
- SNode* p1 = nodesListGetNode(pFuncNode->pParameterList, j);
- if (p1->type == QUERY_NODE_COLUMN) {
- SColumnNode* pcn = (SColumnNode*)p1;
-
- pExp->base.pParam[j].type = FUNC_PARAM_TYPE_COLUMN;
- pExp->base.pParam[j].pCol =
- createColumn(pcn->dataBlockId, pcn->slotId, pcn->colId, &pcn->node.resType, pcn->colType);
- } else if (p1->type == QUERY_NODE_VALUE) {
- SValueNode* pvn = (SValueNode*)p1;
- pExp->base.pParam[j].type = FUNC_PARAM_TYPE_VALUE;
- nodesValueNodeToVariant(pvn, &pExp->base.pParam[j].param);
- }
- }
- } else if (type == QUERY_NODE_OPERATOR) {
- pExp->pExpr->nodeType = QUERY_NODE_OPERATOR;
- SOperatorNode* pNode = (SOperatorNode*)pTargetNode->pExpr;
-
- pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam));
- pExp->base.numOfParams = 1;
-
- SDataType* pType = &pNode->node.resType;
- pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale,
- pType->precision, pNode->node.aliasName);
- pExp->pExpr->_optrRoot.pRootNode = pTargetNode->pExpr;
- } else {
- ASSERT(0);
- }
+ createExprFromTargetNode(pExp, pTargetNode);
}
return pExprs;
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index 9862aebdf8..17954178b1 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -3439,6 +3439,44 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t
}
}
+static bool isWstartColumnExist(SFillOperatorInfo* pInfo) {
+ if (pInfo->numOfNotFillExpr == 0) {
+ return false;
+ }
+ for (int32_t i = 0; i < pInfo->numOfNotFillExpr; ++i) {
+ SExprInfo* exprInfo = pInfo->pNotFillExprInfo + i;
+ if (exprInfo->pExpr->nodeType == QUERY_NODE_COLUMN && exprInfo->base.numOfParams == 1 &&
+ exprInfo->base.pParam[0].pCol->colType == COLUMN_TYPE_WINDOW_START) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static int32_t createWStartTsAsNotFillExpr(SFillOperatorInfo* pInfo, SFillPhysiNode* pPhyFillNode) {
+ bool wstartExist = isWstartColumnExist(pInfo);
+ if (wstartExist == false) {
+ if (pPhyFillNode->pWStartTs->type != QUERY_NODE_TARGET) {
+ qError("pWStartTs of fill physical node is not a target node");
+ return TSDB_CODE_QRY_SYS_ERROR;
+ }
+
+ SExprInfo* notFillExprs =
+ taosMemoryRealloc(pInfo->pNotFillExprInfo, (pInfo->numOfNotFillExpr + 1) * sizeof(SExprInfo));
+ if (notFillExprs == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ createExprFromTargetNode(notFillExprs + pInfo->numOfNotFillExpr, (STargetNode*)pPhyFillNode->pWStartTs);
+
+ ++pInfo->numOfNotFillExpr;
+ pInfo->pNotFillExprInfo = notFillExprs;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFillNode,
SExecTaskInfo* pTaskInfo) {
SFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SFillOperatorInfo));
@@ -3450,7 +3488,10 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SSDataBlock* pResBlock = createResDataBlock(pPhyFillNode->node.pOutputDataBlockDesc);
SExprInfo* pExprInfo = createExprInfo(pPhyFillNode->pFillExprs, NULL, &pInfo->numOfExpr);
pInfo->pNotFillExprInfo = createExprInfo(pPhyFillNode->pNotFillExprs, NULL, &pInfo->numOfNotFillExpr);
-
+ int32_t code = createWStartTsAsNotFillExpr(pInfo, pPhyFillNode);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
SInterval* pInterval =
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL == downstream->operatorType
? &((SMergeAlignedIntervalAggOperatorInfo*)downstream->info)->intervalAggOperatorInfo->interval
@@ -3471,9 +3512,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SArray* pColMatchColInfo = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc,
&numOfOutputCols, COL_MATCH_FROM_SLOT_ID);
- int32_t code = initFillInfo(pInfo, pExprInfo, pInfo->numOfExpr, pInfo->pNotFillExprInfo, pInfo->numOfNotFillExpr,
- (SNodeListNode*)pPhyFillNode->pValues, pPhyFillNode->timeRange, pResultInfo->capacity,
- pTaskInfo->id.str, pInterval, type, order);
+ code = initFillInfo(pInfo, pExprInfo, pInfo->numOfExpr, pInfo->pNotFillExprInfo, pInfo->numOfNotFillExpr,
+ (SNodeListNode*)pPhyFillNode->pValues, pPhyFillNode->timeRange, pResultInfo->capacity,
+ pTaskInfo->id.str, pInterval, type, order);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
@@ -4420,6 +4461,9 @@ int32_t setOutputBuf(STimeWindow* win, SResultRow** pResult, int64_t tableGroupI
};
char* value = NULL;
int32_t size = pAggSup->resultRowSize;
+ /*if (streamStateGet(pTaskInfo->streamInfo.pState, &key, (void**)&value, &size) < 0) {*/
+ /*value = taosMemoryCalloc(1, size);*/
+ /*}*/
if (streamStateAddIfNotExist(pTaskInfo->streamInfo.pState, &key, (void**)&value, &size) < 0) {
return TSDB_CODE_QRY_OUT_OF_MEMORY;
}
@@ -4433,6 +4477,7 @@ int32_t setOutputBuf(STimeWindow* win, SResultRow** pResult, int64_t tableGroupI
int32_t releaseOutputBuf(SExecTaskInfo* pTaskInfo, SWinKey* pKey, SResultRow* pResult) {
streamStateReleaseBuf(pTaskInfo->streamInfo.pState, pKey, pResult);
+ /*taosMemoryFree((*(void**)pResult));*/
return TSDB_CODE_SUCCESS;
}
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index 0c35ed5335..5eb6557dbd 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -932,6 +932,7 @@ static SSDataBlock* doStreamHashPartition(SOperatorInfo* pOperator) {
case STREAM_DELETE_DATA: {
copyDataBlock(pInfo->pDelRes, pBlock);
pInfo->pDelRes->info.type = STREAM_DELETE_RESULT;
+ return pInfo->pDelRes;
} break;
default:
return pBlock;
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index f158b24b58..fa559f0692 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -1355,7 +1355,7 @@ static void setInverFunction(SqlFunctionCtx* pCtx, int32_t num, EStreamType type
}
}
-void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprSupp* pSup, int32_t numOfOutput) {
+static void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprSupp* pSup, int32_t numOfOutput) {
SResultRow* pResult = getResultRowByPos(pResultBuf, p1, false);
SqlFunctionCtx* pCtx = pSup->pCtx;
for (int32_t i = 0; i < numOfOutput; ++i) {
@@ -1374,8 +1374,8 @@ void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprS
releaseBufPage(pResultBuf, bufPage);
}
-bool doClearWindow(SAggSupporter* pAggSup, SExprSupp* pSup, char* pData, int16_t bytes, uint64_t groupId,
- int32_t numOfOutput) {
+static bool doClearWindow(SAggSupporter* pAggSup, SExprSupp* pSup, char* pData, int16_t bytes, uint64_t groupId,
+ int32_t numOfOutput) {
SET_RES_WINDOW_KEY(pAggSup->keyBuf, pData, bytes, groupId);
SResultRowPosition* p1 =
(SResultRowPosition*)tSimpleHashGet(pAggSup->pResultRowHashTable, pAggSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
@@ -1402,18 +1402,21 @@ bool doDeleteIntervalWindow(SAggSupporter* pAggSup, TSKEY ts, uint64_t groupId)
return true;
}
-void doDeleteSpecifyIntervalWindow(SAggSupporter* pAggSup, SSDataBlock* pBlock, SArray* pDelWins, SInterval* pInterval,
- SHashObj* pUpdatedMap) {
+static void doDeleteSpecifyIntervalWindow(SAggSupporter* pAggSup, STimeWindowAggSupp* pTwSup, SSDataBlock* pBlock,
+ SArray* pDelWins, SInterval* pInterval, SHashObj* pUpdatedMap) {
SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
TSKEY* tsStarts = (TSKEY*)pStartCol->pData;
SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
TSKEY* tsEnds = (TSKEY*)pEndCol->pData;
SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
uint64_t* groupIds = (uint64_t*)pGroupCol->pData;
+ int64_t numOfWin = tSimpleHashGetSize(pAggSup->pResultRowHashTable);
for (int32_t i = 0; i < pBlock->info.rows; i++) {
+ TSKEY startTs = TMAX(tsStarts[i], pTwSup->minTs);
+ TSKEY endTs = TMIN(tsEnds[i], pTwSup->maxTs);
SResultRowInfo dumyInfo;
dumyInfo.cur.pageId = -1;
- STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsStarts[i], pInterval, TSDB_ORDER_ASC);
+ STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, startTs, pInterval, TSDB_ORDER_ASC);
do {
doDeleteIntervalWindow(pAggSup, win.skey, groupIds[i]);
SWinKey winRes = {.ts = win.skey, .groupId = groupIds[i]};
@@ -1424,7 +1427,7 @@ void doDeleteSpecifyIntervalWindow(SAggSupporter* pAggSup, SSDataBlock* pBlock,
taosHashRemove(pUpdatedMap, &winRes, sizeof(SWinKey));
}
getNextTimeWindow(pInterval, pInterval->precision, TSDB_ORDER_ASC, &win);
- } while (win.skey < tsEnds[i]);
+ } while (win.skey <= endTs);
}
}
@@ -3030,6 +3033,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
TSKEY maxTs = INT64_MIN;
+ TSKEY minTs = INT64_MAX;
SExprSupp* pSup = &pOperator->exprSupp;
@@ -3101,8 +3105,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
break;
}
printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv");
- maxTs = TMAX(maxTs, pBlock->info.window.ekey);
- maxTs = TMAX(maxTs, pBlock->info.watermark);
ASSERT(pBlock->info.type != STREAM_INVERT);
if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) {
@@ -3129,13 +3131,13 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
break;
} else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT) {
SArray* delWins = taosArrayInit(8, sizeof(SWinKey));
- doDeleteSpecifyIntervalWindow(&pInfo->aggSup, pBlock, delWins, &pInfo->interval, pUpdatedMap);
+ doDeleteSpecifyIntervalWindow(&pInfo->aggSup, &pInfo->twAggSup, pBlock, delWins, &pInfo->interval, pUpdatedMap);
if (IS_FINAL_OP(pInfo)) {
int32_t childIndex = getChildIndex(pBlock);
SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, childIndex);
SStreamFinalIntervalOperatorInfo* pChildInfo = pChildOp->info;
SExprSupp* pChildSup = &pChildOp->exprSupp;
- doDeleteSpecifyIntervalWindow(&pChildInfo->aggSup, pBlock, NULL, &pChildInfo->interval, NULL);
+ doDeleteSpecifyIntervalWindow(&pChildInfo->aggSup, &pInfo->twAggSup, pBlock, NULL, &pChildInfo->interval, NULL);
rebuildIntervalWindow(pInfo, pSup, delWins, pInfo->binfo.pRes->info.groupId, pOperator->exprSupp.numOfExprs,
pOperator->pTaskInfo, pUpdatedMap);
addRetriveWindow(delWins, pInfo);
@@ -3189,9 +3191,13 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
setInputDataBlock(pChildOp, pChildOp->exprSupp.pCtx, pBlock, pChInfo->order, MAIN_SCAN, true);
doHashIntervalAgg(pChildOp, pBlock, pBlock->info.groupId, NULL);
}
+ maxTs = TMAX(maxTs, pBlock->info.window.ekey);
+ maxTs = TMAX(maxTs, pBlock->info.watermark);
+ minTs = TMIN(minTs, pBlock->info.window.skey);
}
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs);
+ pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, minTs);
if (IS_FINAL_OP(pInfo)) {
closeIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, pInfo->pPullDataMap,
pUpdatedMap, pInfo->pRecycledPages, pInfo->aggSup.pResultBuf);
@@ -3264,6 +3270,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
.waterMark = pIntervalPhyNode->window.watermark,
.calTrigger = pIntervalPhyNode->window.triggerType,
.maxTs = INT64_MIN,
+ .minTs = INT64_MAX,
};
ASSERT(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY);
pInfo->primaryTsIndex = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId;
@@ -3507,7 +3514,11 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
initDummyFunction(pInfo->pDummyCtx, pSup->pCtx, numOfCols);
pInfo->twAggSup = (STimeWindowAggSupp){
- .waterMark = pSessionNode->window.watermark, .calTrigger = pSessionNode->window.triggerType, .maxTs = INT64_MIN};
+ .waterMark = pSessionNode->window.watermark,
+ .calTrigger = pSessionNode->window.triggerType,
+ .maxTs = INT64_MIN,
+ .minTs = INT64_MAX,
+ };
initResultRowInfo(&pInfo->binfo.resultRowInfo);
initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
@@ -3595,7 +3606,8 @@ SArray* getWinInfos(SStreamAggSupporter* pAggSup, uint64_t groupId) {
// don't add new window
SResultWindowInfo* getCurSessionWindow(SStreamAggSupporter* pAggSup, TSKEY startTs, TSKEY endTs, uint64_t groupId,
int64_t gap, int32_t* pIndex) {
- SArray* pWinInfos = getWinInfos(pAggSup, groupId);
+ STimeWindow searchWin = {.skey = startTs, .ekey = endTs};
+ SArray* pWinInfos = getWinInfos(pAggSup, groupId);
pAggSup->pCurWins = pWinInfos;
int32_t size = taosArrayGetSize(pWinInfos);
@@ -3607,7 +3619,7 @@ SResultWindowInfo* getCurSessionWindow(SStreamAggSupporter* pAggSup, TSKEY start
SResultWindowInfo* pWin = NULL;
if (index >= 0) {
pWin = taosArrayGet(pWinInfos, index);
- if (isInWindow(pWin, startTs, gap)) {
+ if (isInWindow(pWin, startTs, gap) || isInTimeWindow(&searchWin, pWin->win.skey, gap)) {
*pIndex = index;
return pWin;
}
@@ -3615,7 +3627,7 @@ SResultWindowInfo* getCurSessionWindow(SStreamAggSupporter* pAggSup, TSKEY start
if (index + 1 < size) {
pWin = taosArrayGet(pWinInfos, index + 1);
- if (isInWindow(pWin, startTs, gap)) {
+ if (isInWindow(pWin, startTs, gap) || isInTimeWindow(&searchWin, pWin->win.skey, gap)) {
*pIndex = index + 1;
return pWin;
} else if (endTs != INT64_MIN && isInWindow(pWin, endTs, gap)) {
@@ -3793,7 +3805,7 @@ void compactTimeWindow(SStreamSessionAggOperatorInfo* pInfo, int32_t startIndex,
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pCurWin->win, true);
compactFunctions(pSup->pCtx, pInfo->pDummyCtx, numOfOutput, pTaskInfo, &pInfo->twAggSup.timeWindowData);
taosHashRemove(pStUpdated, &pWinInfo->pos, sizeof(SResultRowPosition));
- if (pWinInfo->isOutput) {
+ if (pWinInfo->isOutput && pStDeleted) {
SWinKey res = {.ts = pWinInfo->win.skey, .groupId = groupId};
taosHashPut(pStDeleted, &res, sizeof(SWinKey), &res, sizeof(SWinKey));
pWinInfo->isOutput = false;
@@ -3886,19 +3898,24 @@ static void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBloc
SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
uint64_t* gpDatas = (uint64_t*)pGroupCol->pData;
for (int32_t i = 0; i < pBlock->info.rows; i++) {
- int32_t winIndex = 0;
- while (1) {
- SResultWindowInfo* pCurWin = getCurSessionWindow(pAggSup, startDatas[i], endDatas[i], gpDatas[i], gap, &winIndex);
- if (!pCurWin) {
- break;
- }
+ int32_t winIndex = 0;
+ SResultWindowInfo* pCurWin = getCurSessionWindow(pAggSup, startDatas[i], endDatas[i], gpDatas[i], gap, &winIndex);
+ if (!pCurWin) {
+ continue;
+ }
+
+ do {
SResultWindowInfo delWin = *pCurWin;
deleteWindow(pAggSup->pCurWins, winIndex, fp);
if (result) {
delWin.groupId = gpDatas[i];
taosArrayPush(result, &delWin);
}
- }
+ if (winIndex >= taosArrayGetSize(pAggSup->pCurWins)) {
+ break;
+ }
+ pCurWin = taosArrayGet(pAggSup->pCurWins, winIndex);
+ } while (pCurWin->win.skey <= endDatas[i]);
}
}
@@ -3979,26 +3996,16 @@ void doBuildDeleteDataBlock(SHashObj* pStDeleted, SSDataBlock* pBlock, void** It
}
static void rebuildTimeWindow(SStreamSessionAggOperatorInfo* pInfo, SArray* pWinArray, int32_t numOfOutput,
- SOperatorInfo* pOperator, SHashObj* pStUpdated, bool needCreate) {
+ SOperatorInfo* pOperator, SHashObj* pStUpdated) {
SExprSupp* pSup = &pOperator->exprSupp;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
-
- int32_t size = taosArrayGetSize(pWinArray);
+ int32_t size = taosArrayGetSize(pWinArray);
ASSERT(pInfo->pChildren);
for (int32_t i = 0; i < size; i++) {
SResultWindowInfo* pParentWin = taosArrayGet(pWinArray, i);
- SResultRow* pCurResult = NULL;
uint64_t groupId = pParentWin->groupId;
- int32_t winIndex = 0;
- if (needCreate) {
- pParentWin =
- getSessionTimeWindow(&pInfo->streamAggSup, pParentWin->win.skey, pParentWin->win.ekey, groupId, 0, &winIndex);
- }
- setWindowOutputBuf(pParentWin, &pCurResult, pSup->pCtx, groupId, numOfOutput, pSup->rowEntryInfoOffset,
- &pInfo->streamAggSup, pTaskInfo);
- int32_t numOfChildren = taosArrayGetSize(pInfo->pChildren);
- int32_t num = 0;
+ int32_t numOfChildren = taosArrayGetSize(pInfo->pChildren);
for (int32_t j = 0; j < numOfChildren; j++) {
SOperatorInfo* pChild = taosArrayGetP(pInfo->pChildren, j);
SStreamSessionAggOperatorInfo* pChInfo = pChild->info;
@@ -4011,31 +4018,36 @@ static void rebuildTimeWindow(SStreamSessionAggOperatorInfo* pInfo, SArray* pWin
for (int32_t k = index; k < chWinSize; k++) {
SResultWindowInfo* pChWin = taosArrayGet(pChWins, k);
if (pParentWin->win.skey <= pChWin->win.skey && pChWin->win.ekey <= pParentWin->win.ekey) {
+ int32_t winIndex = 0;
+ SResultWindowInfo* pNewParWin =
+ getSessionTimeWindow(&pInfo->streamAggSup, pChWin->win.skey, pChWin->win.ekey, groupId, 0, &winIndex);
+ SResultRow* pPareResult = NULL;
+ setWindowOutputBuf(pNewParWin, &pPareResult, pSup->pCtx, groupId, numOfOutput, pSup->rowEntryInfoOffset,
+ &pInfo->streamAggSup, pTaskInfo);
SResultRow* pChResult = NULL;
setWindowOutputBuf(pChWin, &pChResult, pChild->exprSupp.pCtx, groupId, numOfOutput,
pChild->exprSupp.rowEntryInfoOffset, &pChInfo->streamAggSup, pTaskInfo);
- updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pChWin->win, true);
+ updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pNewParWin->win, true);
compactFunctions(pSup->pCtx, pChild->exprSupp.pCtx, numOfOutput, pTaskInfo, &pInfo->twAggSup.timeWindowData);
+
+ int32_t winNum = getNumCompactWindow(pInfo->streamAggSup.pCurWins, winIndex, pInfo->gap);
+ if (winNum > 0) {
+ compactTimeWindow(pInfo, winIndex, winNum, groupId, numOfOutput, pStUpdated, NULL, pOperator);
+ }
+
SFilePage* bufPage = getBufPage(pChInfo->streamAggSup.pResultBuf, pChWin->pos.pageId);
releaseBufPage(pChInfo->streamAggSup.pResultBuf, bufPage);
- num++;
- continue;
+
+ bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pNewParWin->pos.pageId);
+ setBufPageDirty(bufPage, true);
+ releaseBufPage(pInfo->streamAggSup.pResultBuf, bufPage);
+ SWinKey value = {.ts = pNewParWin->win.skey, .groupId = groupId};
+ taosHashPut(pStUpdated, &pNewParWin->pos, sizeof(SResultRowPosition), &value, sizeof(SWinKey));
} else if (!pChWin->isClosed) {
break;
}
}
}
- if (num == 0 && needCreate) {
- deleteWindow(pInfo->streamAggSup.pCurWins, winIndex, NULL);
- }
- if (pStUpdated && num > 0) {
- SWinKey value = {.ts = pParentWin->win.skey, .groupId = groupId};
- taosHashPut(pStUpdated, &pParentWin->pos, sizeof(SResultRowPosition), &value, sizeof(SWinKey));
- }
- SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pParentWin->pos.pageId);
- ASSERT(size > 0);
- setBufPageDirty(bufPage, true);
- releaseBufPage(pInfo->streamAggSup.pResultBuf, bufPage);
}
}
@@ -4196,7 +4208,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
SStreamSessionAggOperatorInfo* pChildInfo = pChildOp->info;
doClearSessionWindows(&pChildInfo->streamAggSup, &pChildOp->exprSupp, pBlock, START_TS_COLUMN_INDEX,
pChildOp->exprSupp.numOfExprs, 0, NULL);
- rebuildTimeWindow(pInfo, pWins, pOperator->exprSupp.numOfExprs, pOperator, NULL, false);
+ rebuildTimeWindow(pInfo, pWins, pOperator->exprSupp.numOfExprs, pOperator, pStUpdated);
}
taosArrayDestroy(pWins);
continue;
@@ -4210,7 +4222,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
SStreamSessionAggOperatorInfo* pChildInfo = pChildOp->info;
// gap must be 0
doDeleteTimeWindows(&pChildInfo->streamAggSup, pBlock, 0, NULL, NULL);
- rebuildTimeWindow(pInfo, pWins, pOperator->exprSupp.numOfExprs, pOperator, pStUpdated, true);
+ rebuildTimeWindow(pInfo, pWins, pOperator->exprSupp.numOfExprs, pOperator, pStUpdated);
}
copyDeleteWindowInfo(pWins, pInfo->pStDeleted);
removeSessionResults(pStUpdated, pWins);
@@ -4747,7 +4759,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
if (pBlock->info.type == STREAM_CLEAR) {
doClearStateWindows(&pInfo->streamAggSup, pBlock, pSeUpdated, pInfo->pSeDeleted);
continue;
- } else if (pBlock->info.type == STREAM_DELETE_DATA) {
+ } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT) {
SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo));
doDeleteTimeWindows(&pInfo->streamAggSup, pBlock, 0, pWins, destroyStateWinInfo);
copyDeleteWindowInfo(pWins, pInfo->pSeDeleted);
@@ -4831,6 +4843,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
.waterMark = pStateNode->window.watermark,
.calTrigger = pStateNode->window.triggerType,
.maxTs = INT64_MIN,
+ .minTs = INT64_MAX,
};
initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
@@ -5631,6 +5644,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
int64_t maxTs = INT64_MIN;
+ int64_t minTs = INT64_MAX;
SExprSupp* pSup = &pOperator->exprSupp;
if (pOperator->status == OP_EXEC_DONE) {
@@ -5674,8 +5688,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
NULL);
qDebug("%s clear existed time window results for updates checked", GET_TASKID(pTaskInfo));
continue;
- } else if (pBlock->info.type == STREAM_DELETE_DATA) {
- doDeleteSpecifyIntervalWindow(&pInfo->aggSup, pBlock, pInfo->pDelWins, &pInfo->interval, pUpdatedMap);
+ } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT) {
+ doDeleteSpecifyIntervalWindow(&pInfo->aggSup, &pInfo->twAggSup, pBlock, pInfo->pDelWins, &pInfo->interval,
+ pUpdatedMap);
continue;
} else if (pBlock->info.type == STREAM_GET_ALL) {
getAllIntervalWindow(pInfo->aggSup.pResultRowHashTable, pUpdatedMap);
@@ -5701,11 +5716,13 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
}
maxTs = TMAX(maxTs, pBlock->info.window.ekey);
+ minTs = TMIN(minTs, pBlock->info.window.skey);
doStreamIntervalAggImpl(pOperator, &pInfo->binfo.resultRowInfo, pBlock, MAIN_SCAN, pUpdatedMap);
// new disc buf
- // doStreamIntervalAggImpl2(pOperator, pBlock, pBlock->info.groupId, pUpdatedMap);
+ /*doStreamIntervalAggImpl2(pOperator, pBlock, pBlock->info.groupId, pUpdatedMap);*/
}
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs);
+ pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, minTs);
#if 0
if (pState) {
@@ -5804,6 +5821,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
.waterMark = pIntervalPhyNode->window.watermark,
.calTrigger = pIntervalPhyNode->window.triggerType,
.maxTs = INT64_MIN,
+ .minTs = INT64_MAX,
};
ASSERT(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY);
pOperator->pTaskInfo = pTaskInfo;
diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c
index 84b615af7a..16fd11f97d 100644
--- a/source/libs/executor/src/tsimplehash.c
+++ b/source/libs/executor/src/tsimplehash.c
@@ -247,8 +247,9 @@ void *tSimpleHashGet(SSHashObj *pHashObj, const void *key, size_t keyLen) {
}
int32_t tSimpleHashRemove(SSHashObj *pHashObj, const void *key, size_t keyLen) {
+ int32_t code = TSDB_CODE_FAILED;
if (!pHashObj || !key) {
- return TSDB_CODE_FAILED;
+ return code;
}
uint32_t hashVal = (*pHashObj->hashFp)(key, (uint32_t)keyLen);
@@ -266,13 +267,14 @@ int32_t tSimpleHashRemove(SSHashObj *pHashObj, const void *key, size_t keyLen) {
}
FREE_HASH_NODE(pNode);
atomic_sub_fetch_64(&pHashObj->size, 1);
+ code = TSDB_CODE_SUCCESS;
break;
}
pPrev = pNode;
pNode = pNode->next;
}
- return TSDB_CODE_SUCCESS;
+ return code;
}
int32_t tSimpleHashIterateRemove(SSHashObj *pHashObj, const void *key, size_t keyLen, void **pIter, int32_t *iter) {
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index 648ae5a538..5844784ea4 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -2175,6 +2175,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.type = FUNCTION_TYPE_AVG_PARTIAL,
.classification = FUNC_MGT_AGG_FUNC,
.translateFunc = translateAvgPartial,
+ .dataRequiredFunc = statisDataRequired,
.getEnvFunc = getAvgFuncEnv,
.initFunc = avgFunctionSetup,
.processFunc = avgFunction,
diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c
index d9a6b80f3d..f507e1b3be 100644
--- a/source/libs/index/src/index.c
+++ b/source/libs/index/src/index.c
@@ -303,7 +303,7 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
buf = strndup(INDEX_DATA_NULL_STR, (int32_t)strlen(INDEX_DATA_NULL_STR));
len = (int32_t)strlen(INDEX_DATA_NULL_STR);
} else {
- const char* emptyStr = " ";
+ static const char* emptyStr = " ";
buf = strndup(emptyStr, (int32_t)strlen(emptyStr));
len = (int32_t)strlen(emptyStr);
}
@@ -585,6 +585,12 @@ int idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
idxTRsltDestroy(tr);
int ret = idxGenTFile(sIdx, pCache, result);
+ if (ret != 0) {
+ indexError("failed to merge");
+ } else {
+ int64_t cost = taosGetTimestampUs() - st;
+ indexInfo("success to merge , time cost: %" PRId64 "ms", cost / 1000);
+ }
idxDestroyFinalRslt(result);
idxCacheDestroyImm(pCache);
@@ -595,12 +601,6 @@ int idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
tfileReaderUnRef(pReader);
idxCacheUnRef(pCache);
- int64_t cost = taosGetTimestampUs() - st;
- if (ret != 0) {
- indexError("failed to merge, time cost: %" PRId64 "ms", cost / 1000);
- } else {
- indexInfo("success to merge , time cost: %" PRId64 "ms", cost / 1000);
- }
atomic_store_32(&pCache->merging, 0);
if (quit) {
idxPost(sIdx);
diff --git a/source/libs/index/src/indexFst.c b/source/libs/index/src/indexFst.c
index 15152cef55..2aa8345e03 100644
--- a/source/libs/index/src/indexFst.c
+++ b/source/libs/index/src/indexFst.c
@@ -19,11 +19,12 @@
#include "tchecksum.h"
#include "tcoding.h"
-static void fstPackDeltaIn(IdxFstFile* wrt, CompiledAddr nodeAddr, CompiledAddr transAddr, uint8_t nBytes) {
+static FORCE_INLINE void fstPackDeltaIn(IdxFstFile* wrt, CompiledAddr nodeAddr, CompiledAddr transAddr,
+ uint8_t nBytes) {
CompiledAddr deltaAddr = (transAddr == EMPTY_ADDRESS) ? EMPTY_ADDRESS : nodeAddr - transAddr;
idxFilePackUintIn(wrt, deltaAddr, nBytes);
}
-static uint8_t fstPackDetla(IdxFstFile* wrt, CompiledAddr nodeAddr, CompiledAddr transAddr) {
+static FORCE_INLINE uint8_t fstPackDetla(IdxFstFile* wrt, CompiledAddr nodeAddr, CompiledAddr transAddr) {
uint8_t nBytes = packDeltaSize(nodeAddr, transAddr);
fstPackDeltaIn(wrt, nodeAddr, transAddr, nBytes);
return nBytes;
@@ -39,7 +40,7 @@ FstUnFinishedNodes* fstUnFinishedNodesCreate() {
fstUnFinishedNodesPushEmpty(nodes, false);
return nodes;
}
-static void unFinishedNodeDestroyElem(void* elem) {
+static void FORCE_INLINE unFinishedNodeDestroyElem(void* elem) {
FstBuilderNodeUnfinished* b = (FstBuilderNodeUnfinished*)elem;
fstBuilderNodeDestroy(b->node);
taosMemoryFree(b->last);
diff --git a/source/libs/index/src/indexFstFile.c b/source/libs/index/src/indexFstFile.c
index e6d1edfeda..2a33ddd477 100644
--- a/source/libs/index/src/indexFstFile.c
+++ b/source/libs/index/src/indexFstFile.c
@@ -30,14 +30,14 @@ typedef struct {
static void deleteDataBlockFromLRU(const void* key, size_t keyLen, void* value) { taosMemoryFree(value); }
-static void idxGenLRUKey(char* buf, const char* path, int32_t blockId) {
+static FORCE_INLINE void idxGenLRUKey(char* buf, const char* path, int32_t blockId) {
char* p = buf;
SERIALIZE_STR_VAR_TO_BUF(p, path, strlen(path));
SERIALIZE_VAR_TO_BUF(p, '_', char);
idxInt2str(blockId, p, 0);
return;
}
-static int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len) {
+static FORCE_INLINE int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len) {
if (ctx->type == TFILE) {
int nwr = taosWriteFile(ctx->file.pFile, buf, len);
assert(nwr == len);
@@ -47,7 +47,7 @@ static int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len) {
ctx->offset += len;
return len;
}
-static int idxFileCtxDoRead(IFileCtx* ctx, uint8_t* buf, int len) {
+static FORCE_INLINE int idxFileCtxDoRead(IFileCtx* ctx, uint8_t* buf, int len) {
int nRead = 0;
if (ctx->type == TFILE) {
#ifdef USE_MMAP
@@ -111,7 +111,7 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of
} while (len > 0);
return total;
}
-static int idxFileCtxGetSize(IFileCtx* ctx) {
+static FORCE_INLINE int idxFileCtxGetSize(IFileCtx* ctx) {
if (ctx->type == TFILE) {
int64_t file_size = 0;
taosStatFile(ctx->file.buf, &file_size, NULL);
@@ -119,7 +119,7 @@ static int idxFileCtxGetSize(IFileCtx* ctx) {
}
return 0;
}
-static int idxFileCtxDoFlush(IFileCtx* ctx) {
+static FORCE_INLINE int idxFileCtxDoFlush(IFileCtx* ctx) {
if (ctx->type == TFILE) {
taosFsyncFile(ctx->file.pFile);
} else {
diff --git a/source/libs/index/src/indexFstRegister.c b/source/libs/index/src/indexFstRegister.c
index 34efee0d0d..e0abcadc78 100644
--- a/source/libs/index/src/indexFstRegister.c
+++ b/source/libs/index/src/indexFstRegister.c
@@ -16,7 +16,7 @@
#include "indexFstRegistry.h"
#include "os.h"
-uint64_t fstRegistryHash(FstRegistry* registry, FstBuilderNode* bNode) {
+static FORCE_INLINE uint64_t fstRegistryHash(FstRegistry* registry, FstBuilderNode* bNode) {
// TODO(yihaoDeng): refactor later
const uint64_t FNV_PRIME = 1099511628211;
uint64_t h = 14695981039346656037u;
diff --git a/source/libs/index/src/indexFstSparse.c b/source/libs/index/src/indexFstSparse.c
index ebc0cb3637..8746b04eab 100644
--- a/source/libs/index/src/indexFstSparse.c
+++ b/source/libs/index/src/indexFstSparse.c
@@ -15,7 +15,7 @@
#include "indexFstSparse.h"
-static void sparSetUtil(int32_t *buf, int32_t cap) {
+static FORCE_INLINE void sparSetInitBuf(int32_t *buf, int32_t cap) {
for (int32_t i = 0; i < cap; i++) {
buf[i] = -1;
}
@@ -28,8 +28,8 @@ FstSparseSet *sparSetCreate(int32_t sz) {
ss->dense = (int32_t *)taosMemoryMalloc(sz * sizeof(int32_t));
ss->sparse = (int32_t *)taosMemoryMalloc(sz * sizeof(int32_t));
- sparSetUtil(ss->dense, sz);
- sparSetUtil(ss->sparse, sz);
+ sparSetInitBuf(ss->dense, sz);
+ sparSetInitBuf(ss->sparse, sz);
ss->cap = sz;
@@ -90,7 +90,7 @@ void sparSetClear(FstSparseSet *ss) {
if (ss == NULL) {
return;
}
- sparSetUtil(ss->dense, ss->cap);
- sparSetUtil(ss->sparse, ss->cap);
+ sparSetInitBuf(ss->dense, ss->cap);
+ sparSetInitBuf(ss->sparse, ss->cap);
ss->size = 0;
}
diff --git a/source/libs/index/src/indexTfile.c b/source/libs/index/src/indexTfile.c
index 48a0c631cf..c3be0ea6f5 100644
--- a/source/libs/index/src/indexTfile.c
+++ b/source/libs/index/src/indexTfile.c
@@ -1034,7 +1034,8 @@ static void tfileGenFileName(char* filename, uint64_t suid, const char* col, int
sprintf(filename, "%" PRIu64 "-%s-%" PRId64 ".tindex", suid, col, version);
return;
}
-static void tfileGenFileFullName(char* fullname, const char* path, uint64_t suid, const char* col, int64_t version) {
+static void FORCE_INLINE tfileGenFileFullName(char* fullname, const char* path, uint64_t suid, const char* col,
+ int64_t version) {
char filename[128] = {0};
tfileGenFileName(filename, suid, col, version);
sprintf(fullname, "%s/%s", path, filename);
diff --git a/source/libs/index/src/indexUtil.c b/source/libs/index/src/indexUtil.c
index 3d083c1817..cdfb79016f 100644
--- a/source/libs/index/src/indexUtil.c
+++ b/source/libs/index/src/indexUtil.c
@@ -21,7 +21,7 @@ typedef struct MergeIndex {
int len;
} MergeIndex;
-static int iBinarySearch(SArray *arr, int s, int e, uint64_t k) {
+static FORCE_INLINE int iBinarySearch(SArray *arr, int s, int e, uint64_t k) {
uint64_t v;
int32_t m;
while (s <= e) {
diff --git a/source/libs/index/test/CMakeLists.txt b/source/libs/index/test/CMakeLists.txt
index b3eca28003..2bc7353aa5 100644
--- a/source/libs/index/test/CMakeLists.txt
+++ b/source/libs/index/test/CMakeLists.txt
@@ -80,6 +80,11 @@ IF(NOT TD_DARWIN)
"${TD_SOURCE_DIR}/include/libs/index"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
)
+ target_include_directories (idxJsonUT
+ PUBLIC
+ "${TD_SOURCE_DIR}/include/libs/index"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
+ )
target_link_libraries (idxTest
os
@@ -102,11 +107,7 @@ IF(NOT TD_DARWIN)
gtest_main
index
)
- target_include_directories (idxJsonUT
- PUBLIC
- "${TD_SOURCE_DIR}/include/libs/index"
- "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
- )
+
target_link_libraries (idxTest
os
util
diff --git a/source/libs/index/test/indexBench.cc b/source/libs/index/test/indexBench.cc
new file mode 100644
index 0000000000..b828be0ffe
--- /dev/null
+++ b/source/libs/index/test/indexBench.cc
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3 * or later ("AGPL"), as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+#include
+#include
+#include
+#include
+#include
+#include "index.h"
+#include "indexCache.h"
+#include "indexFst.h"
+#include "indexFstUtil.h"
+#include "indexInt.h"
+#include "indexTfile.h"
+#include "indexUtil.h"
+#include "tskiplist.h"
+#include "tutil.h"
+using namespace std;
+
+static std::string logDir = TD_TMP_DIR_PATH "log";
+
+static void initLog() {
+ const char *defaultLogFileNamePrefix = "taoslog";
+ const int32_t maxLogFileNum = 10;
+
+ tsAsyncLog = 0;
+ idxDebugFlag = 143;
+ strcpy(tsLogDir, logDir.c_str());
+ taosRemoveDir(tsLogDir);
+ taosMkDir(tsLogDir);
+
+ if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
+ printf("failed to open log file in directory:%s\n", tsLogDir);
+ }
+}
+
+struct WriteBatch {
+ SIndexMultiTerm *terms;
+};
+class Idx {
+ public:
+ Idx(int _cacheSize = 1024 * 1024 * 4, const char *_path = "tindex") {
+ opts.cacheSize = _cacheSize;
+ path += TD_TMP_DIR_PATH;
+ path += _path;
+ }
+ int SetUp(bool remove) {
+ initLog();
+
+ if (remove) taosRemoveDir(path.c_str());
+
+ int ret = indexJsonOpen(&opts, path.c_str(), &index);
+ return ret;
+ }
+ int Write(WriteBatch *batch, uint64_t uid) {
+ // write batch
+ indexJsonPut(index, batch->terms, uid);
+ return 0;
+ }
+ int Read(const char *json, void *key, int64_t *id) {
+ // read batch
+ return 0;
+ }
+
+ void TearDown() { indexJsonClose(index); }
+
+ std::string path;
+
+ SIndexOpts opts;
+ SIndex *index;
+};
+
+SIndexTerm *indexTermCreateT(int64_t suid, SIndexOperOnColumn oper, uint8_t colType, const char *colName,
+ int32_t nColName, const char *colVal, int32_t nColVal) {
+ char buf[256] = {0};
+ int16_t sz = nColVal;
+ memcpy(buf, (uint16_t *)&sz, 2);
+ memcpy(buf + 2, colVal, nColVal);
+ if (colType == TSDB_DATA_TYPE_BINARY) {
+ return indexTermCreate(suid, oper, colType, colName, nColName, buf, sizeof(buf));
+ } else {
+ return indexTermCreate(suid, oper, colType, colName, nColName, colVal, nColVal);
+ }
+ return NULL;
+}
+int initWriteBatch(WriteBatch *wb, int batchSize) {
+ SIndexMultiTerm *terms = indexMultiTermCreate();
+
+ std::string colName;
+ std::string colVal;
+
+ for (int i = 0; i < 64; i++) {
+ colName += '0' + i;
+ colVal += '0' + i;
+ }
+
+ for (int i = 0; i < batchSize; i++) {
+ colVal[i % colVal.size()] = '0' + i % 128;
+ colName[i % colName.size()] = '0' + i % 128;
+ SIndexTerm *term = indexTermCreateT(0, ADD_VALUE, TSDB_DATA_TYPE_BINARY, colName.c_str(), colName.size(),
+ colVal.c_str(), colVal.size());
+ indexMultiTermAdd(terms, term);
+ }
+
+ wb->terms = terms;
+ return 0;
+}
+
+int BenchWrite(Idx *idx, int batchSize, int limit) {
+ for (int i = 0; i < limit; i += batchSize) {
+ WriteBatch wb;
+ idx->Write(&wb, i);
+ }
+ return 0;
+}
+
+int BenchRead(Idx *idx) { return 0; }
+
+int main() {
+ // Idx *idx = new Idx;
+ // if (idx->SetUp(true) != 0) {
+ // std::cout << "failed to setup index" << std::endl;
+ // return 0;
+ // } else {
+ // std::cout << "succ to setup index" << std::endl;
+ // }
+ // BenchWrite(idx, 100, 10000);
+ return 1;
+}
diff --git a/source/libs/index/test/indexTests.cc b/source/libs/index/test/indexTests.cc
index 5b76de2ef8..08bf84ff60 100644
--- a/source/libs/index/test/indexTests.cc
+++ b/source/libs/index/test/indexTests.cc
@@ -271,20 +271,20 @@ void validateFst() {
}
delete m;
}
+
static std::string logDir = TD_TMP_DIR_PATH "log";
+static void initLog() {
+ const char* defaultLogFileNamePrefix = "taoslog";
+ const int32_t maxLogFileNum = 10;
-static void initLog() {
- const char* defaultLogFileNamePrefix = "taoslog";
- const int32_t maxLogFileNum = 10;
+ tsAsyncLog = 0;
+ idxDebugFlag = 143;
+ strcpy(tsLogDir, logDir.c_str());
+ taosRemoveDir(tsLogDir);
+ taosMkDir(tsLogDir);
- tsAsyncLog = 0;
- idxDebugFlag = 143;
- strcpy(tsLogDir, logDir.c_str());
- taosRemoveDir(tsLogDir);
- taosMkDir(tsLogDir);
-
- if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
- printf("failed to open log file in directory:%s\n", tsLogDir);
+ if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
+ printf("failed to open log file in directory:%s\n", tsLogDir);
}
}
class IndexEnv : public ::testing::Test {
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index 8976daadbd..a41462e3fd 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -362,18 +362,14 @@ static int32_t jsonToTableComInfo(const SJson* pJson, void* pObj) {
int32_t code;
tjsonGetNumberValue(pJson, jkTableComInfoNumOfTags, pNode->numOfTags, code);
- ;
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableComInfoPrecision, pNode->precision, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableComInfoNumOfColumns, pNode->numOfColumns, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableComInfoRowSize, pNode->rowSize, code);
- ;
}
return code;
@@ -406,14 +402,11 @@ static int32_t jsonToSchema(const SJson* pJson, void* pObj) {
int32_t code;
tjsonGetNumberValue(pJson, jkSchemaType, pNode->type, code);
- ;
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkSchemaColId, pNode->colId, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkSchemaBytes, pNode->bytes, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetStringValue(pJson, jkSchemaName, pNode->name);
@@ -466,26 +459,20 @@ static int32_t jsonToTableMeta(const SJson* pJson, void* pObj) {
int32_t code;
tjsonGetNumberValue(pJson, jkTableMetaVgId, pNode->vgId, code);
- ;
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableMetaTableType, pNode->tableType, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableMetaUid, pNode->uid, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableMetaSuid, pNode->suid, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableMetaSversion, pNode->sversion, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableMetaTversion, pNode->tversion, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonToObject(pJson, jkTableMetaComInfo, jsonToTableComInfo, &pNode->tableInfo);
@@ -926,7 +913,6 @@ static int32_t jsonToLogicFillNode(const SJson* pJson, void* pObj) {
int32_t code = jsonToLogicPlanNode(pJson, pObj);
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkFillLogicPlanMode, pNode->mode, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkFillLogicPlanWStartTs, &pNode->pWStartTs);
@@ -2815,7 +2801,6 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkColumnColType, pNode->colType, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetStringValue(pJson, jkColumnDbName, pNode->dbName);
@@ -3118,7 +3103,6 @@ static int32_t jsonToOperatorNode(const SJson* pJson, void* pObj) {
int32_t code = jsonToExprNode(pJson, pObj);
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkOperatorType, pNode->opType, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkOperatorLeft, &pNode->pLeft);
@@ -3153,7 +3137,6 @@ static int32_t jsonToLogicConditionNode(const SJson* pJson, void* pObj) {
int32_t code = jsonToExprNode(pJson, pObj);
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkLogicCondType, pNode->condType, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkLogicCondParameters, &pNode->pParameterList);
@@ -3442,11 +3425,9 @@ static int32_t jsonToOrderByExprNode(const SJson* pJson, void* pObj) {
int32_t code = jsonToNodeObject(pJson, jkOrderByExprExpr, &pNode->pExpr);
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkOrderByExprOrder, pNode->order, code);
- ;
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkOrderByExprNullOrder, pNode->nullOrder, code);
- ;
}
return code;
@@ -3624,7 +3605,6 @@ static int32_t jsonToFillNode(const SJson* pJson, void* pObj) {
int32_t code;
tjsonGetNumberValue(pJson, jkFillMode, pNode->mode, code);
- ;
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkFillValues, &pNode->pValues);
}
diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c
new file mode 100644
index 0000000000..5fe31ed78e
--- /dev/null
+++ b/source/libs/nodes/src/nodesMsgFuncs.c
@@ -0,0 +1,3108 @@
+/*
+ * 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 "nodesUtil.h"
+#include "plannodes.h"
+#include "tdatablock.h"
+
+#define NODES_MSG_DEFAULT_LEN 1024
+
+#define tlvForEach(pDecoder, pTlv, code) \
+ while (TSDB_CODE_SUCCESS == code && TSDB_CODE_SUCCESS == (code = tlvGetNextTlv(pDecoder, &pTlv)) && NULL != pTlv)
+
+typedef struct STlv {
+ int16_t type;
+ int16_t len;
+ char value[0];
+} STlv;
+
+typedef struct STlvEncoder {
+ int32_t allocSize;
+ int32_t offset;
+ char* pBuf;
+ int32_t tlvCount;
+} STlvEncoder;
+
+typedef struct STlvDecoder {
+ int32_t bufSize;
+ int32_t offset;
+ const char* pBuf;
+} STlvDecoder;
+
+typedef int32_t (*FToMsg)(const void* pObj, STlvEncoder* pEncoder);
+typedef int32_t (*FToObject)(STlvDecoder* pDecoder, void* pObj);
+typedef void* (*FMakeObject)(int16_t type);
+typedef int32_t (*FSetObject)(STlv* pTlv, void* pObj);
+
+static int32_t nodeToMsg(const void* pObj, STlvEncoder* pEncoder);
+static int32_t nodeListToMsg(const void* pObj, STlvEncoder* pEncoder);
+static int32_t msgToNode(STlvDecoder* pDecoder, void** pObj);
+static int32_t msgToNodeFromTlv(STlv* pTlv, void** pObj);
+static int32_t msgToNodeList(STlvDecoder* pDecoder, void** pObj);
+static int32_t msgToNodeListFromTlv(STlv* pTlv, void** pObj);
+
+static int32_t initTlvEncoder(STlvEncoder* pEncoder) {
+ pEncoder->allocSize = NODES_MSG_DEFAULT_LEN;
+ pEncoder->offset = 0;
+ pEncoder->tlvCount = 0;
+ pEncoder->pBuf = taosMemoryMalloc(pEncoder->allocSize);
+ return NULL == pEncoder->pBuf ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS;
+}
+
+static void clearTlvEncoder(STlvEncoder* pEncoder) { taosMemoryFree(pEncoder->pBuf); }
+
+static void endTlvEncode(STlvEncoder* pEncoder, char** pMsg, int32_t* pLen) {
+ *pMsg = pEncoder->pBuf;
+ pEncoder->pBuf = NULL;
+ *pLen = pEncoder->offset;
+ // nodesWarn("encode tlv count = %d, tl size = %d", pEncoder->tlvCount, sizeof(STlv) * pEncoder->tlvCount);
+}
+
+static int32_t tlvEncodeImpl(STlvEncoder* pEncoder, int16_t type, const void* pValue, int16_t len) {
+ int32_t tlvLen = sizeof(STlv) + len;
+ if (pEncoder->offset + tlvLen > pEncoder->allocSize) {
+ void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize * 2);
+ if (NULL == pNewBuf) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ pEncoder->pBuf = pNewBuf;
+ pEncoder->allocSize = pEncoder->allocSize * 2;
+ }
+ STlv* pTlv = (STlv*)(pEncoder->pBuf + pEncoder->offset);
+ pTlv->type = type;
+ pTlv->len = len;
+ memcpy(pTlv->value, pValue, len);
+ pEncoder->offset += tlvLen;
+ ++(pEncoder->tlvCount);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tlvEncodeI8(STlvEncoder* pEncoder, int16_t type, int8_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeI16(STlvEncoder* pEncoder, int16_t type, int16_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeI32(STlvEncoder* pEncoder, int16_t type, int32_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeI64(STlvEncoder* pEncoder, int16_t type, int64_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeU8(STlvEncoder* pEncoder, int16_t type, uint8_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeU16(STlvEncoder* pEncoder, int16_t type, uint16_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeU64(STlvEncoder* pEncoder, int16_t type, uint64_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeDouble(STlvEncoder* pEncoder, int16_t type, double value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeEnum(STlvEncoder* pEncoder, int16_t type, int32_t value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeBool(STlvEncoder* pEncoder, int16_t type, bool value) {
+ return tlvEncodeImpl(pEncoder, type, &value, sizeof(value));
+}
+
+static int32_t tlvEncodeCStr(STlvEncoder* pEncoder, int16_t type, const char* pValue) {
+ return tlvEncodeImpl(pEncoder, type, pValue, strlen(pValue));
+}
+
+static int32_t tlvEncodeBinary(STlvEncoder* pEncoder, int16_t type, const void* pValue, int32_t len) {
+ return tlvEncodeImpl(pEncoder, type, pValue, len);
+}
+
+static int32_t tlvEncodeObj(STlvEncoder* pEncoder, int16_t type, FToMsg func, const void* pObj) {
+ if (NULL == pObj) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ int32_t start = pEncoder->offset;
+ pEncoder->offset += sizeof(STlv);
+ int32_t code = func(pObj, pEncoder);
+ if (TSDB_CODE_SUCCESS == code) {
+ STlv* pTlv = (STlv*)(pEncoder->pBuf + start);
+ pTlv->type = type;
+ pTlv->len = pEncoder->offset - start - sizeof(STlv);
+ }
+ return code;
+}
+
+static int32_t tlvEncodeObjArray(STlvEncoder* pEncoder, int16_t type, FToMsg func, const void* pArray, int32_t itemSize,
+ int32_t num) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ if (num > 0) {
+ int32_t start = pEncoder->offset;
+ pEncoder->offset += sizeof(STlv);
+ for (size_t i = 0; TSDB_CODE_SUCCESS == code && i < num; ++i) {
+ code = tlvEncodeObj(pEncoder, 0, func, (const char*)pArray + i * itemSize);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ STlv* pTlv = (STlv*)(pEncoder->pBuf + start);
+ pTlv->type = type;
+ pTlv->len = pEncoder->offset - start - sizeof(STlv);
+ }
+ }
+ return code;
+}
+
+static int32_t tlvGetNextTlv(STlvDecoder* pDecoder, STlv** pTlv) {
+ if (pDecoder->offset == pDecoder->bufSize) {
+ *pTlv = NULL;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ *pTlv = (STlv*)(pDecoder->pBuf + pDecoder->offset);
+ if ((*pTlv)->len + pDecoder->offset > pDecoder->bufSize) {
+ return TSDB_CODE_FAILED;
+ }
+ pDecoder->offset += sizeof(STlv) + (*pTlv)->len;
+ return TSDB_CODE_SUCCESS;
+}
+
+static bool tlvDecodeEnd(STlvDecoder* pDecoder) { return pDecoder->offset == pDecoder->bufSize; }
+
+static int32_t tlvDecodeImpl(STlv* pTlv, void* pValue, int16_t len) {
+ if (pTlv->len != len) {
+ return TSDB_CODE_FAILED;
+ }
+ memcpy(pValue, pTlv->value, len);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tlvDecodeI8(STlv* pTlv, int8_t* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeI16(STlv* pTlv, int16_t* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeI32(STlv* pTlv, int32_t* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeI64(STlv* pTlv, int64_t* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeU8(STlv* pTlv, uint8_t* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeU16(STlv* pTlv, uint16_t* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeU64(STlv* pTlv, uint64_t* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeDouble(STlv* pTlv, double* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeBool(STlv* pTlv, bool* pValue) { return tlvDecodeImpl(pTlv, pValue, sizeof(*pValue)); }
+
+static int32_t tlvDecodeEnum(STlv* pTlv, void* pValue, int16_t len) {
+ int32_t value = 0;
+ memcpy(&value, pTlv->value, pTlv->len);
+ switch (len) {
+ case 1:
+ *(int8_t*)pValue = value;
+ break;
+ case 2:
+ *(int16_t*)pValue = value;
+ break;
+ case 4:
+ *(int32_t*)pValue = value;
+ break;
+ default:
+ return TSDB_CODE_FAILED;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tlvDecodeCStr(STlv* pTlv, char* pValue) {
+ memcpy(pValue, pTlv->value, pTlv->len);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tlvDecodeDynBinary(STlv* pTlv, void** pValue) {
+ *pValue = taosMemoryMalloc(pTlv->len);
+ if (NULL == *pValue) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ memcpy(*pValue, pTlv->value, pTlv->len);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t tlvDecodeObjFromTlv(STlv* pTlv, FToObject func, void* pObj) {
+ STlvDecoder decoder = {.bufSize = pTlv->len, .offset = 0, .pBuf = pTlv->value};
+ return func(&decoder, pObj);
+}
+
+static int32_t tlvDecodeObj(STlvDecoder* pDecoder, FToObject func, void* pObj) {
+ STlv* pTlv = NULL;
+ int32_t code = tlvGetNextTlv(pDecoder, &pTlv);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvDecodeObjFromTlv(pTlv, func, pObj);
+ }
+ return code;
+}
+
+static int32_t tlvDecodeObjArray(STlvDecoder* pDecoder, FToObject func, void* pArray, int32_t itemSize) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t i = 0;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) { code = tlvDecodeObjFromTlv(pTlv, func, (char*)pArray + itemSize * i++); }
+ return code;
+}
+
+static int32_t tlvDecodeObjArrayFromTlv(STlv* pTlv, FToObject func, void* pArray, int32_t itemSize) {
+ STlvDecoder decoder = {.bufSize = pTlv->len, .offset = 0, .pBuf = pTlv->value};
+ return tlvDecodeObjArray(&decoder, func, pArray, itemSize);
+}
+
+static int32_t tlvDecodeDynObjFromTlv(STlv* pTlv, FMakeObject makeFunc, FToObject toFunc, void** pObj) {
+ *pObj = makeFunc(pTlv->type);
+ if (NULL == *pObj) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ return tlvDecodeObjFromTlv(pTlv, toFunc, *pObj);
+}
+
+static int32_t tlvDecodeDynObj(STlvDecoder* pDecoder, FMakeObject makeFunc, FToObject toFunc, void** pObj) {
+ STlv* pTlv = NULL;
+ int32_t code = tlvGetNextTlv(pDecoder, &pTlv);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvDecodeDynObjFromTlv(pTlv, makeFunc, toFunc, pObj);
+ }
+ return code;
+}
+
+enum { DATA_TYPE_CODE_TYPE = 1, DATA_TYPE_CODE_PRECISION, DATA_TYPE_CODE_SCALE, DATA_TYPE_CODE_BYTES };
+
+static int32_t dataTypeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SDataType* pNode = (const SDataType*)pObj;
+
+ int32_t code = tlvEncodeI8(pEncoder, DATA_TYPE_CODE_TYPE, pNode->type);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU8(pEncoder, DATA_TYPE_CODE_PRECISION, pNode->precision);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU8(pEncoder, DATA_TYPE_CODE_SCALE, pNode->scale);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, DATA_TYPE_CODE_BYTES, pNode->bytes);
+ }
+
+ return code;
+}
+
+static int32_t msgToDataType(STlvDecoder* pDecoder, void* pObj) {
+ SDataType* pNode = (SDataType*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case DATA_TYPE_CODE_TYPE:
+ code = tlvDecodeI8(pTlv, &pNode->type);
+ break;
+ case DATA_TYPE_CODE_PRECISION:
+ code = tlvDecodeU8(pTlv, &pNode->precision);
+ break;
+ case DATA_TYPE_CODE_SCALE:
+ code = tlvDecodeU8(pTlv, &pNode->scale);
+ break;
+ case DATA_TYPE_CODE_BYTES:
+ code = tlvDecodeI32(pTlv, &pNode->bytes);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { EXPR_CODE_RES_TYPE = 1 };
+
+static int32_t exprNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SExprNode* pNode = (const SExprNode*)pObj;
+ return tlvEncodeObj(pEncoder, EXPR_CODE_RES_TYPE, dataTypeToMsg, &pNode->resType);
+}
+
+static int32_t msgToExprNode(STlvDecoder* pDecoder, void* pObj) {
+ SExprNode* pNode = (SExprNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case EXPR_CODE_RES_TYPE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToDataType, &pNode->resType);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ COLUMN_CODE_EXPR_BASE = 1,
+ COLUMN_CODE_TABLE_ID,
+ COLUMN_CODE_TABLE_TYPE,
+ COLUMN_CODE_COLUMN_ID,
+ COLUMN_CODE_COLUMN_TYPE,
+ COLUMN_CODE_DATABLOCK_ID,
+ COLUMN_CODE_SLOT_ID
+};
+
+static int32_t columnNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SColumnNode* pNode = (const SColumnNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, COLUMN_CODE_EXPR_BASE, exprNodeToMsg, pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU64(pEncoder, COLUMN_CODE_TABLE_ID, pNode->tableId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, COLUMN_CODE_TABLE_TYPE, pNode->tableType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI16(pEncoder, COLUMN_CODE_COLUMN_ID, pNode->colId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, COLUMN_CODE_COLUMN_TYPE, pNode->colType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI16(pEncoder, COLUMN_CODE_DATABLOCK_ID, pNode->dataBlockId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI16(pEncoder, COLUMN_CODE_SLOT_ID, pNode->slotId);
+ }
+
+ return code;
+}
+
+static int32_t msgToColumnNode(STlvDecoder* pDecoder, void* pObj) {
+ SColumnNode* pNode = (SColumnNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case COLUMN_CODE_EXPR_BASE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
+ break;
+ case COLUMN_CODE_TABLE_ID:
+ code = tlvDecodeU64(pTlv, &pNode->tableId);
+ break;
+ case COLUMN_CODE_TABLE_TYPE:
+ code = tlvDecodeI8(pTlv, &pNode->tableType);
+ break;
+ case COLUMN_CODE_COLUMN_ID:
+ code = tlvDecodeI16(pTlv, &pNode->colId);
+ break;
+ case COLUMN_CODE_COLUMN_TYPE:
+ code = tlvDecodeEnum(pTlv, &pNode->colType, sizeof(pNode->colType));
+ break;
+ case COLUMN_CODE_DATABLOCK_ID:
+ code = tlvDecodeI16(pTlv, &pNode->dataBlockId);
+ break;
+ case COLUMN_CODE_SLOT_ID:
+ code = tlvDecodeI16(pTlv, &pNode->slotId);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { VALUE_CODE_EXPR_BASE = 1, VALUE_CODE_IS_NULL, VALUE_CODE_DATUM };
+
+static int32_t datumToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SValueNode* pNode = (const SValueNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ switch (pNode->node.resType.type) {
+ case TSDB_DATA_TYPE_NULL:
+ break;
+ case TSDB_DATA_TYPE_BOOL:
+ code = tlvEncodeBool(pEncoder, VALUE_CODE_DATUM, pNode->datum.b);
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ case TSDB_DATA_TYPE_SMALLINT:
+ case TSDB_DATA_TYPE_INT:
+ case TSDB_DATA_TYPE_BIGINT:
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ code = tlvEncodeI64(pEncoder, VALUE_CODE_DATUM, pNode->datum.i);
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ case TSDB_DATA_TYPE_USMALLINT:
+ case TSDB_DATA_TYPE_UINT:
+ case TSDB_DATA_TYPE_UBIGINT:
+ code = tlvEncodeU64(pEncoder, VALUE_CODE_DATUM, pNode->datum.u);
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ case TSDB_DATA_TYPE_DOUBLE:
+ code = tlvEncodeDouble(pEncoder, VALUE_CODE_DATUM, pNode->datum.d);
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_VARBINARY:
+ case TSDB_DATA_TYPE_NCHAR:
+ code = tlvEncodeBinary(pEncoder, VALUE_CODE_DATUM, pNode->datum.p, varDataTLen(pNode->datum.p));
+ break;
+ case TSDB_DATA_TYPE_JSON:
+ code = tlvEncodeBinary(pEncoder, VALUE_CODE_DATUM, pNode->datum.p, getJsonValueLen(pNode->datum.p));
+ break;
+ case TSDB_DATA_TYPE_DECIMAL:
+ case TSDB_DATA_TYPE_BLOB:
+ // todo
+ default:
+ break;
+ }
+
+ return code;
+}
+
+static int32_t valueNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SValueNode* pNode = (const SValueNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, VALUE_CODE_EXPR_BASE, exprNodeToMsg, pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, VALUE_CODE_IS_NULL, pNode->isNull);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = datumToMsg(pNode, pEncoder);
+ }
+
+ return code;
+}
+
+static int32_t msgToDatum(STlv* pTlv, void* pObj) {
+ SValueNode* pNode = (SValueNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ switch (pNode->node.resType.type) {
+ case TSDB_DATA_TYPE_NULL:
+ break;
+ case TSDB_DATA_TYPE_BOOL:
+ code = tlvDecodeBool(pTlv, &pNode->datum.b);
+ *(bool*)&pNode->typeData = pNode->datum.b;
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ code = tlvDecodeI64(pTlv, &pNode->datum.i);
+ *(int8_t*)&pNode->typeData = pNode->datum.i;
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ code = tlvDecodeI64(pTlv, &pNode->datum.i);
+ *(int16_t*)&pNode->typeData = pNode->datum.i;
+ break;
+ case TSDB_DATA_TYPE_INT:
+ code = tlvDecodeI64(pTlv, &pNode->datum.i);
+ *(int32_t*)&pNode->typeData = pNode->datum.i;
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ code = tlvDecodeI64(pTlv, &pNode->datum.i);
+ *(int64_t*)&pNode->typeData = pNode->datum.i;
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ code = tlvDecodeI64(pTlv, &pNode->datum.i);
+ *(int64_t*)&pNode->typeData = pNode->datum.i;
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ code = tlvDecodeU64(pTlv, &pNode->datum.u);
+ *(uint8_t*)&pNode->typeData = pNode->datum.u;
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ code = tlvDecodeU64(pTlv, &pNode->datum.u);
+ *(uint16_t*)&pNode->typeData = pNode->datum.u;
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ code = tlvDecodeU64(pTlv, &pNode->datum.u);
+ *(uint32_t*)&pNode->typeData = pNode->datum.u;
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ code = tlvDecodeU64(pTlv, &pNode->datum.u);
+ *(uint64_t*)&pNode->typeData = pNode->datum.u;
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ code = tlvDecodeDouble(pTlv, &pNode->datum.d);
+ *(float*)&pNode->typeData = pNode->datum.d;
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ code = tlvDecodeDouble(pTlv, &pNode->datum.d);
+ *(double*)&pNode->typeData = pNode->datum.d;
+ break;
+ case TSDB_DATA_TYPE_NCHAR:
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_VARBINARY:
+ code = tlvDecodeDynBinary(pTlv, (void**)&pNode->datum.p);
+ if (TSDB_CODE_SUCCESS == code) {
+ varDataSetLen(pNode->datum.p, pNode->node.resType.bytes - VARSTR_HEADER_SIZE);
+ }
+ break;
+ case TSDB_DATA_TYPE_JSON:
+ code = tlvDecodeDynBinary(pTlv, (void**)&pNode->datum.p);
+ break;
+ case TSDB_DATA_TYPE_DECIMAL:
+ case TSDB_DATA_TYPE_BLOB:
+ // todo
+ default:
+ break;
+ }
+
+ return code;
+}
+
+static int32_t msgToValueNode(STlvDecoder* pDecoder, void* pObj) {
+ SValueNode* pNode = (SValueNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case VALUE_CODE_EXPR_BASE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
+ break;
+ case VALUE_CODE_IS_NULL:
+ code = tlvDecodeBool(pTlv, &pNode->isNull);
+ break;
+ case VALUE_CODE_DATUM:
+ code = msgToDatum(pTlv, pNode);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { OPERATOR_CODE_EXPR_BASE = 1, OPERATOR_CODE_OP_TYPE, OPERATOR_CODE_LEFT, OPERATOR_CODE_RIGHT };
+
+static int32_t operatorNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SOperatorNode* pNode = (const SOperatorNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, OPERATOR_CODE_EXPR_BASE, exprNodeToMsg, pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, OPERATOR_CODE_OP_TYPE, pNode->opType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, OPERATOR_CODE_LEFT, nodeToMsg, pNode->pLeft);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, OPERATOR_CODE_RIGHT, nodeToMsg, pNode->pRight);
+ }
+
+ return code;
+}
+
+static int32_t msgToOperatorNode(STlvDecoder* pDecoder, void* pObj) {
+ SOperatorNode* pNode = (SOperatorNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case OPERATOR_CODE_EXPR_BASE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
+ break;
+ case OPERATOR_CODE_OP_TYPE:
+ code = tlvDecodeEnum(pTlv, &pNode->opType, sizeof(pNode->opType));
+ break;
+ case OPERATOR_CODE_LEFT:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pLeft);
+ break;
+ case OPERATOR_CODE_RIGHT:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pRight);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { LOGIC_COND_CODE_EXPR_BASE = 1, LOGIC_COND_CODE_COND_TYPE, LOGIC_COND_CODE_PARAMETERS };
+
+static int32_t logicConditionNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SLogicConditionNode* pNode = (const SLogicConditionNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, LOGIC_COND_CODE_EXPR_BASE, exprNodeToMsg, pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, LOGIC_COND_CODE_COND_TYPE, pNode->condType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, LOGIC_COND_CODE_PARAMETERS, nodeListToMsg, pNode->pParameterList);
+ }
+
+ return code;
+}
+
+static int32_t msgToLogicConditionNode(STlvDecoder* pDecoder, void* pObj) {
+ SLogicConditionNode* pNode = (SLogicConditionNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case LOGIC_COND_CODE_EXPR_BASE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
+ break;
+ case LOGIC_COND_CODE_COND_TYPE:
+ code = tlvDecodeEnum(pTlv, &pNode->condType, sizeof(pNode->condType));
+ break;
+ case LOGIC_COND_CODE_PARAMETERS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pParameterList);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ FUNCTION_CODE_EXPR_BASE = 1,
+ FUNCTION_CODE_FUNCTION_ID,
+ FUNCTION_CODE_FUNCTION_TYPE,
+ FUNCTION_CODE_PARAMETERS,
+ FUNCTION_CODE_UDF_BUF_SIZE
+};
+
+static int32_t functionNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SFunctionNode* pNode = (const SFunctionNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, FUNCTION_CODE_EXPR_BASE, exprNodeToMsg, pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, FUNCTION_CODE_FUNCTION_ID, pNode->funcId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, FUNCTION_CODE_FUNCTION_TYPE, pNode->funcType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, FUNCTION_CODE_PARAMETERS, nodeListToMsg, pNode->pParameterList);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, FUNCTION_CODE_UDF_BUF_SIZE, pNode->udfBufSize);
+ }
+
+ return code;
+}
+
+static int32_t msgToFunctionNode(STlvDecoder* pDecoder, void* pObj) {
+ SFunctionNode* pNode = (SFunctionNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case FUNCTION_CODE_EXPR_BASE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
+ break;
+ case FUNCTION_CODE_FUNCTION_ID:
+ code = tlvDecodeI32(pTlv, &pNode->funcId);
+ break;
+ case FUNCTION_CODE_FUNCTION_TYPE:
+ code = tlvDecodeI32(pTlv, &pNode->funcType);
+ break;
+ case FUNCTION_CODE_PARAMETERS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pParameterList);
+ break;
+ case FUNCTION_CODE_UDF_BUF_SIZE:
+ code = tlvDecodeI32(pTlv, &pNode->udfBufSize);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { ORDER_BY_EXPR_CODE_EXPR = 1, ORDER_BY_EXPR_CODE_ORDER, ORDER_BY_EXPR_CODE_NULL_ORDER };
+
+static int32_t orderByExprNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SOrderByExprNode* pNode = (const SOrderByExprNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, ORDER_BY_EXPR_CODE_EXPR, nodeToMsg, pNode->pExpr);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, ORDER_BY_EXPR_CODE_ORDER, pNode->order);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, ORDER_BY_EXPR_CODE_NULL_ORDER, pNode->nullOrder);
+ }
+
+ return code;
+}
+
+static int32_t msgToOrderByExprNode(STlvDecoder* pDecoder, void* pObj) {
+ SOrderByExprNode* pNode = (SOrderByExprNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case ORDER_BY_EXPR_CODE_EXPR:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pExpr);
+ break;
+ case ORDER_BY_EXPR_CODE_ORDER:
+ code = tlvDecodeEnum(pTlv, &pNode->order, sizeof(pNode->order));
+ break;
+ case ORDER_BY_EXPR_CODE_NULL_ORDER:
+ code = tlvDecodeEnum(pTlv, &pNode->nullOrder, sizeof(pNode->nullOrder));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { LIMIT_CODE_LIMIT = 1, LIMIT_CODE_OFFSET };
+
+static int32_t limitNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SLimitNode* pNode = (const SLimitNode*)pObj;
+
+ int32_t code = tlvEncodeI64(pEncoder, LIMIT_CODE_LIMIT, pNode->limit);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, LIMIT_CODE_OFFSET, pNode->offset);
+ }
+
+ return code;
+}
+
+static int32_t msgToLimitNode(STlvDecoder* pDecoder, void* pObj) {
+ SLimitNode* pNode = (SLimitNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case LIMIT_CODE_LIMIT:
+ code = tlvDecodeI64(pTlv, &pNode->limit);
+ break;
+ case LIMIT_CODE_OFFSET:
+ code = tlvDecodeI64(pTlv, &pNode->offset);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { NAME_CODE_TYPE = 1, NAME_CODE_ACCT_ID, NAME_CODE_DB_NAME, NAME_CODE_TABLE_NAME };
+
+static int32_t nameToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SName* pNode = (const SName*)pObj;
+
+ int32_t code = tlvEncodeU8(pEncoder, NAME_CODE_TYPE, pNode->type);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, NAME_CODE_ACCT_ID, pNode->acctId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, NAME_CODE_DB_NAME, pNode->dbname);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, NAME_CODE_TABLE_NAME, pNode->tname);
+ }
+
+ return code;
+}
+
+static int32_t msgToName(STlvDecoder* pDecoder, void* pObj) {
+ SName* pNode = (SName*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case NAME_CODE_TYPE:
+ code = tlvDecodeU8(pTlv, &pNode->type);
+ break;
+ case NAME_CODE_ACCT_ID:
+ code = tlvDecodeI32(pTlv, &pNode->acctId);
+ break;
+ case NAME_CODE_DB_NAME:
+ code = tlvDecodeCStr(pTlv, pNode->dbname);
+ break;
+ case NAME_CODE_TABLE_NAME:
+ code = tlvDecodeCStr(pTlv, pNode->tname);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { TIME_WINDOW_CODE_START_KEY = 1, TIME_WINDOW_CODE_END_KEY };
+
+static int32_t timeWindowToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const STimeWindow* pNode = (const STimeWindow*)pObj;
+
+ int32_t code = tlvEncodeI64(pEncoder, TIME_WINDOW_CODE_START_KEY, pNode->skey);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, TIME_WINDOW_CODE_END_KEY, pNode->ekey);
+ }
+
+ return code;
+}
+
+static int32_t msgToTimeWindow(STlvDecoder* pDecoder, void* pObj) {
+ STimeWindow* pNode = (STimeWindow*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case TIME_WINDOW_CODE_START_KEY:
+ code = tlvDecodeI64(pTlv, &pNode->skey);
+ break;
+ case TIME_WINDOW_CODE_END_KEY:
+ code = tlvDecodeI64(pTlv, &pNode->ekey);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+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, dataTypeToMsg, &pNode->dataType);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, NODE_LIST_CODE_NODE_LIST, nodeListToMsg, pNode->pNodeList);
+ }
+
+ return code;
+}
+
+static int32_t msgToNodeListNode(STlvDecoder* pDecoder, void* pObj) {
+ SNodeListNode* pNode = (SNodeListNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case NODE_LIST_CODE_DATA_TYPE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToDataType, &pNode->dataType);
+ break;
+ case NODE_LIST_CODE_NODE_LIST:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pNodeList);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { TARGET_CODE_DATA_BLOCK_ID = 1, TARGET_CODE_SLOT_ID, TARGET_CODE_EXPR };
+
+static int32_t targetNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const STargetNode* pNode = (const STargetNode*)pObj;
+
+ int32_t code = tlvEncodeI16(pEncoder, TARGET_CODE_DATA_BLOCK_ID, pNode->dataBlockId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI16(pEncoder, TARGET_CODE_SLOT_ID, pNode->slotId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, TARGET_CODE_EXPR, nodeToMsg, pNode->pExpr);
+ }
+
+ return code;
+}
+
+static int32_t msgToTargetNode(STlvDecoder* pDecoder, void* pObj) {
+ STargetNode* pNode = (STargetNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case TARGET_CODE_DATA_BLOCK_ID:
+ code = tlvDecodeI16(pTlv, &pNode->dataBlockId);
+ break;
+ case TARGET_CODE_SLOT_ID:
+ code = tlvDecodeI16(pTlv, &pNode->slotId);
+ break;
+ case TARGET_CODE_EXPR:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pExpr);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ DATA_BLOCK_DESC_CODE_DATA_BLOCK_ID = 1,
+ DATA_BLOCK_DESC_CODE_SLOTS,
+ DATA_BLOCK_DESC_CODE_TOTAL_ROW_SIZE,
+ DATA_BLOCK_DESC_CODE_OUTPUT_ROW_SIZE,
+ DATA_BLOCK_DESC_CODE_PRECISION
+};
+
+static int32_t dataBlockDescNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SDataBlockDescNode* pNode = (const SDataBlockDescNode*)pObj;
+
+ int32_t code = tlvEncodeI16(pEncoder, DATA_BLOCK_DESC_CODE_DATA_BLOCK_ID, pNode->dataBlockId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, DATA_BLOCK_DESC_CODE_SLOTS, nodeListToMsg, pNode->pSlots);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, DATA_BLOCK_DESC_CODE_TOTAL_ROW_SIZE, pNode->totalRowSize);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, DATA_BLOCK_DESC_CODE_OUTPUT_ROW_SIZE, pNode->outputRowSize);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU8(pEncoder, DATA_BLOCK_DESC_CODE_PRECISION, pNode->precision);
+ }
+
+ return code;
+}
+
+static int32_t msgToDataBlockDescNode(STlvDecoder* pDecoder, void* pObj) {
+ SDataBlockDescNode* pNode = (SDataBlockDescNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case DATA_BLOCK_DESC_CODE_DATA_BLOCK_ID:
+ code = tlvDecodeI16(pTlv, &pNode->dataBlockId);
+ break;
+ case DATA_BLOCK_DESC_CODE_SLOTS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pSlots);
+ break;
+ case DATA_BLOCK_DESC_CODE_TOTAL_ROW_SIZE:
+ code = tlvDecodeI32(pTlv, &pNode->totalRowSize);
+ break;
+ case DATA_BLOCK_DESC_CODE_OUTPUT_ROW_SIZE:
+ code = tlvDecodeI32(pTlv, &pNode->outputRowSize);
+ break;
+ case DATA_BLOCK_DESC_CODE_PRECISION:
+ code = tlvDecodeU8(pTlv, &pNode->precision);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ SLOT_DESC_CODE_SLOT_ID = 1,
+ SLOT_DESC_CODE_DATA_TYPE,
+ SLOT_DESC_CODE_RESERVE,
+ SLOT_DESC_CODE_OUTPUT,
+ SLOT_DESC_CODE_TAG
+};
+
+static int32_t slotDescNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SSlotDescNode* pNode = (const SSlotDescNode*)pObj;
+
+ int32_t code = tlvEncodeI16(pEncoder, SLOT_DESC_CODE_SLOT_ID, pNode->slotId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, SLOT_DESC_CODE_DATA_TYPE, dataTypeToMsg, &pNode->dataType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, SLOT_DESC_CODE_RESERVE, pNode->reserve);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, SLOT_DESC_CODE_OUTPUT, pNode->output);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, SLOT_DESC_CODE_TAG, pNode->tag);
+ }
+
+ return code;
+}
+
+static int32_t msgToSlotDescNode(STlvDecoder* pDecoder, void* pObj) {
+ SSlotDescNode* pNode = (SSlotDescNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case SLOT_DESC_CODE_SLOT_ID:
+ code = tlvDecodeI16(pTlv, &pNode->slotId);
+ break;
+ case SLOT_DESC_CODE_DATA_TYPE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToDataType, &pNode->dataType);
+ break;
+ case SLOT_DESC_CODE_RESERVE:
+ code = tlvDecodeBool(pTlv, &pNode->reserve);
+ break;
+ case SLOT_DESC_CODE_OUTPUT:
+ code = tlvDecodeBool(pTlv, &pNode->output);
+ break;
+ case SLOT_DESC_CODE_TAG:
+ code = tlvDecodeBool(pTlv, &pNode->tag);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_NODE_CODE_OUTPUT_DESC = 1,
+ PHY_NODE_CODE_CONDITIONS,
+ PHY_NODE_CODE_CHILDREN,
+ PHY_NODE_CODE_LIMIT,
+ PHY_NODE_CODE_SLIMIT
+};
+
+static int32_t physiNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SPhysiNode* pNode = (const SPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_NODE_CODE_OUTPUT_DESC, nodeToMsg, pNode->pOutputDataBlockDesc);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_NODE_CODE_CONDITIONS, nodeToMsg, pNode->pConditions);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_NODE_CODE_CHILDREN, nodeListToMsg, pNode->pChildren);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_NODE_CODE_LIMIT, nodeToMsg, pNode->pLimit);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_NODE_CODE_SLIMIT, nodeToMsg, pNode->pSlimit);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiNode(STlvDecoder* pDecoder, void* pObj) {
+ SPhysiNode* pNode = (SPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_NODE_CODE_OUTPUT_DESC:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pOutputDataBlockDesc);
+ break;
+ case PHY_NODE_CODE_CONDITIONS:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pConditions);
+ break;
+ case PHY_NODE_CODE_CHILDREN:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pChildren);
+ break;
+ case PHY_NODE_CODE_LIMIT:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pLimit);
+ break;
+ case PHY_NODE_CODE_SLIMIT:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pSlimit);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_SCAN_CODE_BASE_NODE = 1,
+ PHY_SCAN_CODE_SCAN_COLS,
+ PHY_SCAN_CODE_SCAN_PSEUDO_COLS,
+ PHY_SCAN_CODE_BASE_UID,
+ PHY_SCAN_CODE_BASE_SUID,
+ PHY_SCAN_CODE_BASE_TABLE_TYPE,
+ PHY_SCAN_CODE_BASE_TABLE_NAME
+};
+
+static int32_t physiScanNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SScanPhysiNode* pNode = (const SScanPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_SCAN_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SCAN_CODE_SCAN_COLS, nodeListToMsg, pNode->pScanCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SCAN_CODE_SCAN_PSEUDO_COLS, nodeListToMsg, pNode->pScanPseudoCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU64(pEncoder, PHY_SCAN_CODE_BASE_UID, pNode->uid);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU64(pEncoder, PHY_SCAN_CODE_BASE_SUID, pNode->suid);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_SCAN_CODE_BASE_TABLE_TYPE, pNode->tableType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SCAN_CODE_BASE_TABLE_NAME, nameToMsg, &pNode->tableName);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiScanNode(STlvDecoder* pDecoder, void* pObj) {
+ SScanPhysiNode* pNode = (SScanPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_SCAN_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_SCAN_CODE_SCAN_COLS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pScanCols);
+ break;
+ case PHY_SCAN_CODE_SCAN_PSEUDO_COLS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pScanPseudoCols);
+ break;
+ case PHY_SCAN_CODE_BASE_UID:
+ code = tlvDecodeU64(pTlv, &pNode->uid);
+ break;
+ case PHY_SCAN_CODE_BASE_SUID:
+ code = tlvDecodeU64(pTlv, &pNode->suid);
+ break;
+ case PHY_SCAN_CODE_BASE_TABLE_TYPE:
+ code = tlvDecodeI8(pTlv, &pNode->tableType);
+ break;
+ case PHY_SCAN_CODE_BASE_TABLE_NAME:
+ code = tlvDecodeObjFromTlv(pTlv, msgToName, &pNode->tableName);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_LAST_ROW_SCAN_CODE_SCAN = 1, PHY_LAST_ROW_SCAN_CODE_GROUP_TAGS, PHY_LAST_ROW_SCAN_CODE_GROUP_SORT };
+
+static int32_t physiLastRowScanNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SLastRowScanPhysiNode* pNode = (const SLastRowScanPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_LAST_ROW_SCAN_CODE_SCAN, physiScanNodeToMsg, &pNode->scan);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_LAST_ROW_SCAN_CODE_GROUP_TAGS, nodeListToMsg, pNode->pGroupTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_LAST_ROW_SCAN_CODE_GROUP_SORT, pNode->groupSort);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiLastRowScanNode(STlvDecoder* pDecoder, void* pObj) {
+ SLastRowScanPhysiNode* pNode = (SLastRowScanPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_LAST_ROW_SCAN_CODE_SCAN:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiScanNode, &pNode->scan);
+ break;
+ case PHY_LAST_ROW_SCAN_CODE_GROUP_TAGS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pGroupTags);
+ break;
+ case PHY_LAST_ROW_SCAN_CODE_GROUP_SORT:
+ code = tlvDecodeBool(pTlv, &pNode->groupSort);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_TABLE_SCAN_CODE_SCAN = 1,
+ PHY_TABLE_SCAN_CODE_SCAN_COUNT,
+ PHY_TABLE_SCAN_CODE_REVERSE_SCAN_COUNT,
+ PHY_TABLE_SCAN_CODE_SCAN_RANGE,
+ PHY_TABLE_SCAN_CODE_RATIO,
+ PHY_TABLE_SCAN_CODE_DATA_REQUIRED,
+ PHY_TABLE_SCAN_CODE_DYN_SCAN_FUNCS,
+ PHY_TABLE_SCAN_CODE_GROUP_TAGS,
+ PHY_TABLE_SCAN_CODE_GROUP_SORT,
+ PHY_TABLE_SCAN_CODE_INTERVAL,
+ PHY_TABLE_SCAN_CODE_OFFSET,
+ PHY_TABLE_SCAN_CODE_SLIDING,
+ PHY_TABLE_SCAN_CODE_INTERVAL_UNIT,
+ PHY_TABLE_SCAN_CODE_SLIDING_UNIT,
+ PHY_TABLE_SCAN_CODE_TRIGGER_TYPE,
+ PHY_TABLE_SCAN_CODE_WATERMARK,
+ PHY_TABLE_SCAN_CODE_IG_EXPIRED,
+ PHY_TABLE_SCAN_CODE_ASSIGN_BLOCK_UID,
+};
+
+static int32_t physiTableScanNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const STableScanPhysiNode* pNode = (const STableScanPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_TABLE_SCAN_CODE_SCAN, physiScanNodeToMsg, &pNode->scan);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU8(pEncoder, PHY_TABLE_SCAN_CODE_SCAN_COUNT, pNode->scanSeq[0]);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU8(pEncoder, PHY_TABLE_SCAN_CODE_REVERSE_SCAN_COUNT, pNode->scanSeq[1]);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_TABLE_SCAN_CODE_SCAN_RANGE, timeWindowToMsg, &pNode->scanRange);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeDouble(pEncoder, PHY_TABLE_SCAN_CODE_RATIO, pNode->ratio);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, PHY_TABLE_SCAN_CODE_DATA_REQUIRED, pNode->dataRequired);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_TABLE_SCAN_CODE_DYN_SCAN_FUNCS, nodeListToMsg, pNode->pDynamicScanFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_TABLE_SCAN_CODE_GROUP_TAGS, nodeListToMsg, pNode->pGroupTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_TABLE_SCAN_CODE_GROUP_SORT, pNode->groupSort);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_TABLE_SCAN_CODE_INTERVAL, pNode->interval);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_TABLE_SCAN_CODE_OFFSET, pNode->offset);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_TABLE_SCAN_CODE_SLIDING, pNode->sliding);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_TABLE_SCAN_CODE_INTERVAL_UNIT, pNode->intervalUnit);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_TABLE_SCAN_CODE_SLIDING_UNIT, pNode->slidingUnit);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_TABLE_SCAN_CODE_TRIGGER_TYPE, pNode->triggerType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_TABLE_SCAN_CODE_WATERMARK, pNode->watermark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_TABLE_SCAN_CODE_IG_EXPIRED, pNode->igExpired);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_TABLE_SCAN_CODE_ASSIGN_BLOCK_UID, pNode->assignBlockUid);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiTableScanNode(STlvDecoder* pDecoder, void* pObj) {
+ STableScanPhysiNode* pNode = (STableScanPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_TABLE_SCAN_CODE_SCAN:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiScanNode, &pNode->scan);
+ break;
+ case PHY_TABLE_SCAN_CODE_SCAN_COUNT:
+ code = tlvDecodeU8(pTlv, pNode->scanSeq);
+ break;
+ case PHY_TABLE_SCAN_CODE_REVERSE_SCAN_COUNT:
+ code = tlvDecodeU8(pTlv, pNode->scanSeq + 1);
+ break;
+ case PHY_TABLE_SCAN_CODE_SCAN_RANGE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, &pNode->scanRange);
+ break;
+ case PHY_TABLE_SCAN_CODE_RATIO:
+ code = tlvDecodeDouble(pTlv, &pNode->ratio);
+ break;
+ case PHY_TABLE_SCAN_CODE_DATA_REQUIRED:
+ code = tlvDecodeI32(pTlv, &pNode->dataRequired);
+ break;
+ case PHY_TABLE_SCAN_CODE_DYN_SCAN_FUNCS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pDynamicScanFuncs);
+ break;
+ case PHY_TABLE_SCAN_CODE_GROUP_TAGS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pGroupTags);
+ break;
+ case PHY_TABLE_SCAN_CODE_GROUP_SORT:
+ code = tlvDecodeBool(pTlv, &pNode->groupSort);
+ break;
+ case PHY_TABLE_SCAN_CODE_INTERVAL:
+ code = tlvDecodeI64(pTlv, &pNode->interval);
+ break;
+ case PHY_TABLE_SCAN_CODE_OFFSET:
+ code = tlvDecodeI64(pTlv, &pNode->offset);
+ break;
+ case PHY_TABLE_SCAN_CODE_SLIDING:
+ code = tlvDecodeI64(pTlv, &pNode->sliding);
+ break;
+ case PHY_TABLE_SCAN_CODE_INTERVAL_UNIT:
+ code = tlvDecodeI8(pTlv, &pNode->intervalUnit);
+ break;
+ case PHY_TABLE_SCAN_CODE_SLIDING_UNIT:
+ code = tlvDecodeI8(pTlv, &pNode->slidingUnit);
+ break;
+ case PHY_TABLE_SCAN_CODE_TRIGGER_TYPE:
+ code = tlvDecodeI8(pTlv, &pNode->triggerType);
+ break;
+ case PHY_TABLE_SCAN_CODE_WATERMARK:
+ code = tlvDecodeI64(pTlv, &pNode->watermark);
+ break;
+ case PHY_TABLE_SCAN_CODE_IG_EXPIRED:
+ code = tlvDecodeI8(pTlv, &pNode->igExpired);
+ break;
+ case PHY_TABLE_SCAN_CODE_ASSIGN_BLOCK_UID:
+ code = tlvDecodeBool(pTlv, &pNode->assignBlockUid);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { EP_CODE_FQDN = 1, EP_CODE_port };
+
+static int32_t epToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SEp* pNode = (const SEp*)pObj;
+
+ int32_t code = tlvEncodeCStr(pEncoder, EP_CODE_FQDN, pNode->fqdn);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU16(pEncoder, EP_CODE_port, pNode->port);
+ }
+
+ return code;
+}
+
+static int32_t msgToEp(STlvDecoder* pDecoder, void* pObj) {
+ SEp* pNode = (SEp*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case EP_CODE_FQDN:
+ code = tlvDecodeCStr(pTlv, pNode->fqdn);
+ break;
+ case EP_CODE_port:
+ code = tlvDecodeU16(pTlv, &pNode->port);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { EP_SET_CODE_IN_USE = 1, EP_SET_CODE_NUM_OF_EPS, EP_SET_CODE_EPS };
+
+static int32_t epSetToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SEpSet* pNode = (const SEpSet*)pObj;
+
+ int32_t code = tlvEncodeI8(pEncoder, EP_SET_CODE_IN_USE, pNode->inUse);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, EP_SET_CODE_NUM_OF_EPS, pNode->numOfEps);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObjArray(pEncoder, EP_SET_CODE_EPS, epToMsg, pNode->eps, sizeof(SEp), pNode->numOfEps);
+ }
+
+ return code;
+}
+
+static int32_t msgToEpSet(STlvDecoder* pDecoder, void* pObj) {
+ SEpSet* pNode = (SEpSet*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case EP_SET_CODE_IN_USE:
+ code = tlvDecodeI8(pTlv, &pNode->inUse);
+ break;
+ case EP_SET_CODE_NUM_OF_EPS:
+ code = tlvDecodeI8(pTlv, &pNode->numOfEps);
+ break;
+ case EP_SET_CODE_EPS:
+ code = tlvDecodeObjArrayFromTlv(pTlv, msgToEp, pNode->eps, sizeof(SEp));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_SYSTABLE_SCAN_CODE_SCAN = 1,
+ PHY_SYSTABLE_SCAN_CODE_MGMT_EP_SET,
+ PHY_SYSTABLE_SCAN_CODE_SHOW_REWRITE,
+ PHY_SYSTABLE_SCAN_CODE_ACCOUNT_ID,
+ PHY_SYSTABLE_SCAN_CODE_SYS_INFO
+};
+
+static int32_t physiSysTableScanNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SSystemTableScanPhysiNode* pNode = (const SSystemTableScanPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_SYSTABLE_SCAN_CODE_SCAN, physiScanNodeToMsg, &pNode->scan);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SYSTABLE_SCAN_CODE_MGMT_EP_SET, epSetToMsg, &pNode->mgmtEpSet);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_SYSTABLE_SCAN_CODE_SHOW_REWRITE, pNode->showRewrite);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, PHY_SYSTABLE_SCAN_CODE_ACCOUNT_ID, pNode->accountId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_SYSTABLE_SCAN_CODE_SYS_INFO, pNode->sysInfo);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiSysTableScanNode(STlvDecoder* pDecoder, void* pObj) {
+ SSystemTableScanPhysiNode* pNode = (SSystemTableScanPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_SYSTABLE_SCAN_CODE_SCAN:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiScanNode, &pNode->scan);
+ break;
+ case PHY_SYSTABLE_SCAN_CODE_MGMT_EP_SET:
+ code = tlvDecodeObjFromTlv(pTlv, msgToEpSet, &pNode->mgmtEpSet);
+ break;
+ case PHY_SYSTABLE_SCAN_CODE_SHOW_REWRITE:
+ code = tlvDecodeBool(pTlv, &pNode->showRewrite);
+ break;
+ case PHY_SYSTABLE_SCAN_CODE_ACCOUNT_ID:
+ code = tlvDecodeI32(pTlv, &pNode->accountId);
+ break;
+ case PHY_SYSTABLE_SCAN_CODE_SYS_INFO:
+ code = tlvDecodeBool(pTlv, &pNode->sysInfo);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_PROJECT_CODE_BASE_NODE = 1,
+ PHY_PROJECT_CODE_PROJECTIONS,
+ PHY_PROJECT_CODE_MERGE_DATA_BLOCK,
+ PHY_PROJECT_CODE_IGNORE_GROUP_ID
+};
+
+static int32_t physiProjectNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SProjectPhysiNode* pNode = (const SProjectPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_PROJECT_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_PROJECT_CODE_PROJECTIONS, nodeListToMsg, pNode->pProjections);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_PROJECT_CODE_MERGE_DATA_BLOCK, pNode->mergeDataBlock);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_PROJECT_CODE_IGNORE_GROUP_ID, pNode->ignoreGroupId);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiProjectNode(STlvDecoder* pDecoder, void* pObj) {
+ SProjectPhysiNode* pNode = (SProjectPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_PROJECT_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_PROJECT_CODE_PROJECTIONS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pProjections);
+ break;
+ case PHY_PROJECT_CODE_MERGE_DATA_BLOCK:
+ code = tlvDecodeBool(pTlv, &pNode->mergeDataBlock);
+ break;
+ case PHY_PROJECT_CODE_IGNORE_GROUP_ID:
+ code = tlvDecodeBool(pTlv, &pNode->ignoreGroupId);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_SORT_MERGE_JOIN_CODE_BASE_NODE = 1,
+ PHY_SORT_MERGE_JOIN_CODE_JOIN_TYPE,
+ PHY_SORT_MERGE_JOIN_CODE_MERGE_CONDITION,
+ PHY_SORT_MERGE_JOIN_CODE_ON_CONDITIONS,
+ PHY_SORT_MERGE_JOIN_CODE_TARGETS,
+ PHY_SORT_MERGE_JOIN_CODE_INPUT_TS_ORDER
+};
+
+static int32_t physiJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SSortMergeJoinPhysiNode* pNode = (const SSortMergeJoinPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, PHY_SORT_MERGE_JOIN_CODE_JOIN_TYPE, pNode->joinType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_MERGE_CONDITION, nodeToMsg, pNode->pMergeCondition);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_ON_CONDITIONS, nodeToMsg, pNode->pOnConditions);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_TARGETS, nodeListToMsg, pNode->pTargets);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, PHY_SORT_MERGE_JOIN_CODE_INPUT_TS_ORDER, pNode->inputTsOrder);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiJoinNode(STlvDecoder* pDecoder, void* pObj) {
+ SSortMergeJoinPhysiNode* pNode = (SSortMergeJoinPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_SORT_MERGE_JOIN_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_SORT_MERGE_JOIN_CODE_JOIN_TYPE:
+ code = tlvDecodeEnum(pTlv, &pNode->joinType, sizeof(pNode->joinType));
+ break;
+ case PHY_SORT_MERGE_JOIN_CODE_MERGE_CONDITION:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pMergeCondition);
+ break;
+ case PHY_SORT_MERGE_JOIN_CODE_ON_CONDITIONS:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pOnConditions);
+ break;
+ case PHY_SORT_MERGE_JOIN_CODE_TARGETS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTargets);
+ break;
+ case PHY_SORT_MERGE_JOIN_CODE_INPUT_TS_ORDER:
+ code = tlvDecodeEnum(pTlv, &pNode->inputTsOrder, sizeof(pNode->inputTsOrder));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_AGG_CODE_BASE_NODE = 1,
+ PHY_AGG_CODE_EXPR,
+ PHY_AGG_CODE_GROUP_KEYS,
+ PHY_AGG_CODE_AGG_FUNCS,
+ PHY_AGG_CODE_MERGE_DATA_BLOCK
+};
+
+static int32_t physiAggNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SAggPhysiNode* pNode = (const SAggPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_AGG_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_AGG_CODE_EXPR, nodeListToMsg, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_AGG_CODE_GROUP_KEYS, nodeListToMsg, pNode->pGroupKeys);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_AGG_CODE_AGG_FUNCS, nodeListToMsg, pNode->pAggFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_AGG_CODE_MERGE_DATA_BLOCK, pNode->mergeDataBlock);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiAggNode(STlvDecoder* pDecoder, void* pObj) {
+ SAggPhysiNode* pNode = (SAggPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_AGG_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_AGG_CODE_EXPR:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pExprs);
+ break;
+ case PHY_AGG_CODE_GROUP_KEYS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pGroupKeys);
+ break;
+ case PHY_AGG_CODE_AGG_FUNCS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pAggFuncs);
+ break;
+ case PHY_AGG_CODE_MERGE_DATA_BLOCK:
+ code = tlvDecodeBool(pTlv, &pNode->mergeDataBlock);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_EXCHANGE_CODE_BASE_NODE = 1,
+ PHY_EXCHANGE_CODE_SRC_GROUP_ID,
+ PHY_EXCHANGE_CODE_SINGLE_CHANNEL,
+ PHY_EXCHANGE_CODE_SRC_ENDPOINTS
+};
+
+static int32_t physiExchangeNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SExchangePhysiNode* pNode = (const SExchangePhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_EXCHANGE_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, PHY_EXCHANGE_CODE_SRC_GROUP_ID, pNode->srcGroupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_EXCHANGE_CODE_SINGLE_CHANNEL, pNode->singleChannel);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_EXCHANGE_CODE_SRC_ENDPOINTS, nodeListToMsg, pNode->pSrcEndPoints);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiExchangeNode(STlvDecoder* pDecoder, void* pObj) {
+ SExchangePhysiNode* pNode = (SExchangePhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_EXCHANGE_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_EXCHANGE_CODE_SRC_GROUP_ID:
+ code = tlvDecodeI32(pTlv, &pNode->srcGroupId);
+ break;
+ case PHY_EXCHANGE_CODE_SINGLE_CHANNEL:
+ code = tlvDecodeBool(pTlv, &pNode->singleChannel);
+ break;
+ case PHY_EXCHANGE_CODE_SRC_ENDPOINTS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pSrcEndPoints);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_MERGE_CODE_BASE_NODE = 1,
+ PHY_MERGE_CODE_MERGE_KEYS,
+ PHY_MERGE_CODE_TARGETS,
+ PHY_MERGE_CODE_NUM_OF_CHANNELS,
+ PHY_MERGE_CODE_SRC_GROUP_ID,
+ PHY_MERGE_CODE_GROUP_SORT
+};
+
+static int32_t physiMergeNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SMergePhysiNode* pNode = (const SMergePhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_MERGE_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_MERGE_CODE_MERGE_KEYS, nodeListToMsg, pNode->pMergeKeys);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_MERGE_CODE_TARGETS, nodeListToMsg, pNode->pTargets);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, PHY_MERGE_CODE_NUM_OF_CHANNELS, pNode->numOfChannels);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, PHY_MERGE_CODE_SRC_GROUP_ID, pNode->srcGroupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_MERGE_CODE_GROUP_SORT, pNode->groupSort);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiMergeNode(STlvDecoder* pDecoder, void* pObj) {
+ SMergePhysiNode* pNode = (SMergePhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_MERGE_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_MERGE_CODE_MERGE_KEYS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pMergeKeys);
+ break;
+ case PHY_MERGE_CODE_TARGETS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTargets);
+ break;
+ case PHY_MERGE_CODE_NUM_OF_CHANNELS:
+ code = tlvDecodeI32(pTlv, &pNode->numOfChannels);
+ break;
+ case PHY_MERGE_CODE_SRC_GROUP_ID:
+ code = tlvDecodeI32(pTlv, &pNode->srcGroupId);
+ break;
+ case PHY_MERGE_CODE_GROUP_SORT:
+ code = tlvDecodeBool(pTlv, &pNode->groupSort);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_SORT_CODE_BASE_NODE = 1, PHY_SORT_CODE_EXPR, PHY_SORT_CODE_SORT_KEYS, PHY_SORT_CODE_TARGETS };
+
+static int32_t physiSortNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SSortPhysiNode* pNode = (const SSortPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_SORT_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SORT_CODE_EXPR, nodeListToMsg, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SORT_CODE_SORT_KEYS, nodeListToMsg, pNode->pSortKeys);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_SORT_CODE_TARGETS, nodeListToMsg, pNode->pTargets);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiSortNode(STlvDecoder* pDecoder, void* pObj) {
+ SSortPhysiNode* pNode = (SSortPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_SORT_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_SORT_CODE_EXPR:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pExprs);
+ break;
+ case PHY_SORT_CODE_SORT_KEYS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pSortKeys);
+ break;
+ case PHY_SORT_CODE_TARGETS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTargets);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_WINDOW_CODE_BASE_NODE = 1,
+ PHY_WINDOW_CODE_EXPR,
+ PHY_WINDOW_CODE_FUNCS,
+ PHY_WINDOW_CODE_TS_PK,
+ PHY_WINDOW_CODE_TS_END,
+ PHY_WINDOW_CODE_TRIGGER_TYPE,
+ PHY_WINDOW_CODE_WATERMARK,
+ PHY_WINDOW_CODE_IG_EXPIRED,
+ PHY_WINDOW_CODE_INPUT_TS_ORDER,
+ PHY_WINDOW_CODE_OUTPUT_TS_ORDER,
+ PHY_WINDOW_CODE_MERGE_DATA_BLOCK
+};
+
+static int32_t physiWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_WINDOW_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_WINDOW_CODE_EXPR, nodeListToMsg, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_WINDOW_CODE_FUNCS, nodeListToMsg, pNode->pFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_WINDOW_CODE_TS_PK, nodeToMsg, pNode->pTspk);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_WINDOW_CODE_TS_END, nodeToMsg, pNode->pTsEnd);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_WINDOW_CODE_TRIGGER_TYPE, pNode->triggerType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_WINDOW_CODE_WATERMARK, pNode->watermark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_WINDOW_CODE_IG_EXPIRED, pNode->igExpired);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, PHY_WINDOW_CODE_INPUT_TS_ORDER, pNode->inputTsOrder);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, PHY_WINDOW_CODE_OUTPUT_TS_ORDER, pNode->outputTsOrder);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeBool(pEncoder, PHY_WINDOW_CODE_MERGE_DATA_BLOCK, pNode->mergeDataBlock);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiWindowNode(STlvDecoder* pDecoder, void* pObj) {
+ SWinodwPhysiNode* pNode = (SWinodwPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_WINDOW_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_WINDOW_CODE_EXPR:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pExprs);
+ break;
+ case PHY_WINDOW_CODE_FUNCS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pFuncs);
+ break;
+ case PHY_WINDOW_CODE_TS_PK:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pTspk);
+ break;
+ case PHY_WINDOW_CODE_TS_END:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pTsEnd);
+ break;
+ case PHY_WINDOW_CODE_TRIGGER_TYPE:
+ code = tlvDecodeI8(pTlv, &pNode->triggerType);
+ break;
+ case PHY_WINDOW_CODE_WATERMARK:
+ code = tlvDecodeI64(pTlv, &pNode->watermark);
+ break;
+ case PHY_WINDOW_CODE_IG_EXPIRED:
+ code = tlvDecodeI8(pTlv, &pNode->igExpired);
+ break;
+ case PHY_WINDOW_CODE_INPUT_TS_ORDER:
+ code = tlvDecodeEnum(pTlv, &pNode->inputTsOrder, sizeof(pNode->inputTsOrder));
+ break;
+ case PHY_WINDOW_CODE_OUTPUT_TS_ORDER:
+ code = tlvDecodeEnum(pTlv, &pNode->outputTsOrder, sizeof(pNode->outputTsOrder));
+ break;
+ case PHY_WINDOW_CODE_MERGE_DATA_BLOCK:
+ code = tlvDecodeBool(pTlv, &pNode->mergeDataBlock);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_INTERVAL_CODE_WINDOW = 1,
+ PHY_INTERVAL_CODE_INTERVAL,
+ PHY_INTERVAL_CODE_OFFSET,
+ PHY_INTERVAL_CODE_SLIDING,
+ PHY_INTERVAL_CODE_INTERVAL_UNIT,
+ PHY_INTERVAL_CODE_SLIDING_UNIT
+};
+
+static int32_t physiIntervalNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SIntervalPhysiNode* pNode = (const SIntervalPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_INTERVAL_CODE_WINDOW, physiWindowNodeToMsg, &pNode->window);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_INTERVAL_CODE_INTERVAL, pNode->interval);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_INTERVAL_CODE_OFFSET, pNode->offset);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_INTERVAL_CODE_SLIDING, pNode->sliding);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_INTERVAL_CODE_INTERVAL_UNIT, pNode->intervalUnit);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_INTERVAL_CODE_SLIDING_UNIT, pNode->slidingUnit);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiIntervalNode(STlvDecoder* pDecoder, void* pObj) {
+ SIntervalPhysiNode* pNode = (SIntervalPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_INTERVAL_CODE_WINDOW:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiWindowNode, &pNode->window);
+ break;
+ case PHY_INTERVAL_CODE_INTERVAL:
+ code = tlvDecodeI64(pTlv, &pNode->interval);
+ break;
+ case PHY_INTERVAL_CODE_OFFSET:
+ code = tlvDecodeI64(pTlv, &pNode->offset);
+ break;
+ case PHY_INTERVAL_CODE_SLIDING:
+ code = tlvDecodeI64(pTlv, &pNode->sliding);
+ break;
+ case PHY_INTERVAL_CODE_INTERVAL_UNIT:
+ code = tlvDecodeI8(pTlv, &pNode->intervalUnit);
+ break;
+ case PHY_INTERVAL_CODE_SLIDING_UNIT:
+ code = tlvDecodeI8(pTlv, &pNode->slidingUnit);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_FILL_CODE_BASE_NODE = 1,
+ PHY_FILL_CODE_MODE,
+ PHY_FILL_CODE_FILL_EXPRS,
+ PHY_FILL_CODE_NOT_FILL_EXPRS,
+ PHY_FILL_CODE_WSTART,
+ PHY_FILL_CODE_VALUES,
+ PHY_FILL_CODE_TIME_RANGE,
+ PHY_FILL_CODE_INPUT_TS_ORDER
+};
+
+static int32_t physiFillNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SFillPhysiNode* pNode = (const SFillPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, PHY_FILL_CODE_MODE, pNode->mode);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_FILL_EXPRS, nodeListToMsg, pNode->pFillExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_NOT_FILL_EXPRS, nodeListToMsg, pNode->pNotFillExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_WSTART, nodeToMsg, pNode->pWStartTs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_VALUES, nodeToMsg, pNode->pValues);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_TIME_RANGE, timeWindowToMsg, &pNode->timeRange);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, PHY_FILL_CODE_INPUT_TS_ORDER, pNode->inputTsOrder);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiFillNode(STlvDecoder* pDecoder, void* pObj) {
+ SFillPhysiNode* pNode = (SFillPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_FILL_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_FILL_CODE_MODE:
+ code = tlvDecodeEnum(pTlv, &pNode->mode, sizeof(pNode->mode));
+ break;
+ case PHY_FILL_CODE_FILL_EXPRS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pFillExprs);
+ break;
+ case PHY_FILL_CODE_NOT_FILL_EXPRS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pNotFillExprs);
+ break;
+ case PHY_FILL_CODE_WSTART:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pWStartTs);
+ break;
+ case PHY_FILL_CODE_VALUES:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pValues);
+ break;
+ case PHY_FILL_CODE_TIME_RANGE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, (void**)&pNode->timeRange);
+ break;
+ case PHY_FILL_CODE_INPUT_TS_ORDER:
+ code = tlvDecodeEnum(pTlv, &pNode->inputTsOrder, sizeof(pNode->inputTsOrder));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_SESSION_CODE_WINDOW = 1, PHY_SESSION_CODE_GAP };
+
+static int32_t physiSessionWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SSessionWinodwPhysiNode* pNode = (const SSessionWinodwPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_SESSION_CODE_WINDOW, physiWindowNodeToMsg, &pNode->window);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_SESSION_CODE_GAP, pNode->gap);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiSessionWindowNode(STlvDecoder* pDecoder, void* pObj) {
+ SSessionWinodwPhysiNode* pNode = (SSessionWinodwPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_SESSION_CODE_WINDOW:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiWindowNode, &pNode->window);
+ break;
+ case PHY_SESSION_CODE_GAP:
+ code = tlvDecodeI64(pTlv, &pNode->gap);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_STATE_CODE_WINDOW = 1, PHY_STATE_CODE_KEY };
+
+static int32_t physiStateWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SStateWinodwPhysiNode* pNode = (const SStateWinodwPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_STATE_CODE_WINDOW, physiWindowNodeToMsg, &pNode->window);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_STATE_CODE_KEY, nodeToMsg, pNode->pStateKey);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiStateWindowNode(STlvDecoder* pDecoder, void* pObj) {
+ SStateWinodwPhysiNode* pNode = (SStateWinodwPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_STATE_CODE_WINDOW:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiWindowNode, &pNode->window);
+ break;
+ case PHY_STATE_CODE_KEY:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pStateKey);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_PARTITION_CODE_BASE_NODE = 1, PHY_PARTITION_CODE_EXPR, PHY_PARTITION_CODE_KEYS, PHY_PARTITION_CODE_TARGETS };
+
+static int32_t physiPartitionNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SPartitionPhysiNode* pNode = (const SPartitionPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_PARTITION_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_PARTITION_CODE_EXPR, nodeListToMsg, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_PARTITION_CODE_KEYS, nodeListToMsg, pNode->pPartitionKeys);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_PARTITION_CODE_TARGETS, nodeListToMsg, pNode->pTargets);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiPartitionNode(STlvDecoder* pDecoder, void* pObj) {
+ SPartitionPhysiNode* pNode = (SPartitionPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_PARTITION_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_PARTITION_CODE_EXPR:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pExprs);
+ break;
+ case PHY_PARTITION_CODE_KEYS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pPartitionKeys);
+ break;
+ case PHY_PARTITION_CODE_TARGETS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTargets);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_INDEF_ROWS_FUNC_CODE_BASE_NODE = 1, PHY_INDEF_ROWS_FUNC_CODE_EXPRS, PHY_INDEF_ROWS_FUNC_CODE_FUNCS };
+
+static int32_t physiIndefRowsFuncNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SIndefRowsFuncPhysiNode* pNode = (const SIndefRowsFuncPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_INDEF_ROWS_FUNC_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_INDEF_ROWS_FUNC_CODE_EXPRS, nodeListToMsg, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_INDEF_ROWS_FUNC_CODE_FUNCS, nodeListToMsg, pNode->pFuncs);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiIndefRowsFuncNode(STlvDecoder* pDecoder, void* pObj) {
+ SIndefRowsFuncPhysiNode* pNode = (SIndefRowsFuncPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_INDEF_ROWS_FUNC_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_INDEF_ROWS_FUNC_CODE_EXPRS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pExprs);
+ break;
+ case PHY_INDEF_ROWS_FUNC_CODE_FUNCS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pFuncs);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_INERP_FUNC_CODE_BASE_NODE = 1,
+ PHY_INERP_FUNC_CODE_EXPR,
+ PHY_INERP_FUNC_CODE_FUNCS,
+ PHY_INERP_FUNC_CODE_TIME_RANGE,
+ PHY_INERP_FUNC_CODE_INTERVAL,
+ PHY_INERP_FUNC_CODE_INTERVAL_UNIT,
+ PHY_INERP_FUNC_CODE_FILL_MODE,
+ PHY_INERP_FUNC_CODE_FILL_VALUES,
+ PHY_INERP_FUNC_CODE_TIME_SERIES
+};
+
+static int32_t physiInterpFuncNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SInterpFuncPhysiNode* pNode = (const SInterpFuncPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_INERP_FUNC_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_INERP_FUNC_CODE_EXPR, nodeListToMsg, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_INERP_FUNC_CODE_FUNCS, nodeListToMsg, pNode->pFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_INERP_FUNC_CODE_TIME_RANGE, timeWindowToMsg, &pNode->timeRange);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_INERP_FUNC_CODE_INTERVAL, pNode->interval);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_INERP_FUNC_CODE_INTERVAL_UNIT, pNode->intervalUnit);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, PHY_INERP_FUNC_CODE_FILL_MODE, pNode->fillMode);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_INERP_FUNC_CODE_FILL_VALUES, nodeToMsg, pNode->pFillValues);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_INERP_FUNC_CODE_TIME_SERIES, nodeToMsg, pNode->pTimeSeries);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiInterpFuncNode(STlvDecoder* pDecoder, void* pObj) {
+ SInterpFuncPhysiNode* pNode = (SInterpFuncPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_INERP_FUNC_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_INERP_FUNC_CODE_EXPR:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pExprs);
+ break;
+ case PHY_INERP_FUNC_CODE_FUNCS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pFuncs);
+ break;
+ case PHY_INERP_FUNC_CODE_TIME_RANGE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, &pNode->timeRange);
+ break;
+ case PHY_INERP_FUNC_CODE_INTERVAL:
+ code = tlvDecodeI64(pTlv, &pNode->interval);
+ break;
+ case PHY_INERP_FUNC_CODE_INTERVAL_UNIT:
+ code = tlvDecodeI8(pTlv, &pNode->intervalUnit);
+ break;
+ case PHY_INERP_FUNC_CODE_FILL_MODE:
+ code = tlvDecodeEnum(pTlv, &pNode->fillMode, sizeof(pNode->fillMode));
+ break;
+ case PHY_INERP_FUNC_CODE_FILL_VALUES:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pFillValues);
+ break;
+ case PHY_INERP_FUNC_CODE_TIME_SERIES:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pTimeSeries);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_DATA_SINK_CODE_INPUT_DESC = 1 };
+
+static int32_t physicDataSinkNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SDataSinkNode* pNode = (const SDataSinkNode*)pObj;
+ return tlvEncodeObj(pEncoder, PHY_DATA_SINK_CODE_INPUT_DESC, nodeToMsg, pNode->pInputDataBlockDesc);
+}
+
+static int32_t msgToPhysicDataSinkNode(STlvDecoder* pDecoder, void* pObj) {
+ SDataSinkNode* pNode = (SDataSinkNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_DATA_SINK_CODE_INPUT_DESC:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pInputDataBlockDesc);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { PHY_DISPATCH_CODE_SINK = 1 };
+
+static int32_t physiDispatchNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SDataDispatcherNode* pNode = (const SDataDispatcherNode*)pObj;
+ return tlvEncodeObj(pEncoder, PHY_DISPATCH_CODE_SINK, physicDataSinkNodeToMsg, &pNode->sink);
+}
+
+static int32_t msgToPhysiDispatchNode(STlvDecoder* pDecoder, void* pObj) {
+ SDataDispatcherNode* pNode = (SDataDispatcherNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_DISPATCH_CODE_SINK:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysicDataSinkNode, &pNode->sink);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_QUERY_INSERT_CODE_SINK = 1,
+ PHY_QUERY_INSERT_CODE_COLS,
+ PHY_QUERY_INSERT_CODE_TABLE_ID,
+ PHY_QUERY_INSERT_CODE_STABLE_ID,
+ PHY_QUERY_INSERT_CODE_TABLE_TYPE,
+ PHY_QUERY_INSERT_CODE_TABLE_NAME,
+ PHY_QUERY_INSERT_CODE_VG_ID,
+ PHY_QUERY_INSERT_CODE_EP_SET
+};
+
+static int32_t physiQueryInsertNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SQueryInserterNode* pNode = (const SQueryInserterNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_QUERY_INSERT_CODE_SINK, physicDataSinkNodeToMsg, &pNode->sink);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_QUERY_INSERT_CODE_COLS, nodeListToMsg, pNode->pCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU64(pEncoder, PHY_QUERY_INSERT_CODE_TABLE_ID, pNode->tableId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU64(pEncoder, PHY_QUERY_INSERT_CODE_STABLE_ID, pNode->stableId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_QUERY_INSERT_CODE_TABLE_TYPE, pNode->tableType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, PHY_QUERY_INSERT_CODE_TABLE_NAME, pNode->tableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, PHY_QUERY_INSERT_CODE_VG_ID, pNode->vgId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_QUERY_INSERT_CODE_EP_SET, epSetToMsg, &pNode->epSet);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiQueryInsertNode(STlvDecoder* pDecoder, void* pObj) {
+ SQueryInserterNode* pNode = (SQueryInserterNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_QUERY_INSERT_CODE_SINK:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysicDataSinkNode, &pNode->sink);
+ break;
+ case PHY_QUERY_INSERT_CODE_COLS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pCols);
+ break;
+ case PHY_QUERY_INSERT_CODE_TABLE_ID:
+ code = tlvDecodeU64(pTlv, &pNode->tableId);
+ break;
+ case PHY_QUERY_INSERT_CODE_STABLE_ID:
+ code = tlvDecodeU64(pTlv, &pNode->stableId);
+ break;
+ case PHY_QUERY_INSERT_CODE_TABLE_TYPE:
+ code = tlvDecodeI8(pTlv, &pNode->tableType);
+ break;
+ case PHY_QUERY_INSERT_CODE_TABLE_NAME:
+ code = tlvDecodeCStr(pTlv, pNode->tableName);
+ break;
+ case PHY_QUERY_INSERT_CODE_VG_ID:
+ code = tlvDecodeI32(pTlv, &pNode->vgId);
+ break;
+ case PHY_QUERY_INSERT_CODE_EP_SET:
+ code = tlvDecodeObjFromTlv(pTlv, msgToEpSet, &pNode->epSet);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ PHY_DELETER_CODE_SINK = 1,
+ PHY_DELETER_CODE_TABLE_ID,
+ PHY_DELETER_CODE_TABLE_TYPE,
+ PHY_DELETER_CODE_TABLE_FNAME,
+ PHY_DELETER_CODE_TS_COL_NAME,
+ PHY_DELETER_CODE_DELETE_TIME_RANGE,
+ PHY_DELETER_CODE_AFFECTED_ROWS
+};
+
+static int32_t physiDeleteNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SDataDeleterNode* pNode = (const SDataDeleterNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_DELETER_CODE_SINK, physicDataSinkNodeToMsg, &pNode->sink);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeU64(pEncoder, PHY_DELETER_CODE_TABLE_ID, pNode->tableId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI8(pEncoder, PHY_DELETER_CODE_TABLE_TYPE, pNode->tableType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, PHY_DELETER_CODE_TABLE_FNAME, pNode->tableFName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, PHY_DELETER_CODE_TS_COL_NAME, pNode->tsColName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_DELETER_CODE_DELETE_TIME_RANGE, timeWindowToMsg, &pNode->deleteTimeRange);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_DELETER_CODE_AFFECTED_ROWS, nodeToMsg, pNode->pAffectedRows);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiDeleteNode(STlvDecoder* pDecoder, void* pObj) {
+ SDataDeleterNode* pNode = (SDataDeleterNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_DELETER_CODE_SINK:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysicDataSinkNode, &pNode->sink);
+ break;
+ case PHY_DELETER_CODE_TABLE_ID:
+ code = tlvDecodeU64(pTlv, &pNode->tableId);
+ break;
+ case PHY_DELETER_CODE_TABLE_TYPE:
+ code = tlvDecodeI8(pTlv, &pNode->tableType);
+ break;
+ case PHY_DELETER_CODE_TABLE_FNAME:
+ code = tlvDecodeCStr(pTlv, pNode->tableFName);
+ break;
+ case PHY_DELETER_CODE_TS_COL_NAME:
+ code = tlvDecodeCStr(pTlv, pNode->tsColName);
+ break;
+ case PHY_DELETER_CODE_DELETE_TIME_RANGE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, &pNode->deleteTimeRange);
+ break;
+ case PHY_DELETER_CODE_AFFECTED_ROWS:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pAffectedRows);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { SUBPLAN_ID_CODE_QUERY_ID = 1, SUBPLAN_ID_CODE_GROUP_ID, SUBPLAN_ID_CODE_SUBPLAN_ID };
+
+static int32_t subplanIdToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SSubplanId* pNode = (const SSubplanId*)pObj;
+
+ int32_t code = tlvEncodeU64(pEncoder, SUBPLAN_ID_CODE_QUERY_ID, pNode->queryId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, SUBPLAN_ID_CODE_GROUP_ID, pNode->groupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, SUBPLAN_ID_CODE_SUBPLAN_ID, pNode->subplanId);
+ }
+
+ return code;
+}
+
+static int32_t msgToSubplanId(STlvDecoder* pDecoder, void* pObj) {
+ SSubplanId* pNode = (SSubplanId*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case SUBPLAN_ID_CODE_QUERY_ID:
+ code = tlvDecodeU64(pTlv, &pNode->queryId);
+ break;
+ case SUBPLAN_ID_CODE_GROUP_ID:
+ code = tlvDecodeI32(pTlv, &pNode->groupId);
+ break;
+ case SUBPLAN_ID_CODE_SUBPLAN_ID:
+ code = tlvDecodeI32(pTlv, &pNode->subplanId);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { QUERY_NODE_ADDR_CODE_NODE_ID = 1, QUERY_NODE_ADDR_CODE_EP_SET };
+
+static int32_t queryNodeAddrToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SQueryNodeAddr* pNode = (const SQueryNodeAddr*)pObj;
+
+ int32_t code = tlvEncodeI32(pEncoder, QUERY_NODE_ADDR_CODE_NODE_ID, pNode->nodeId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, QUERY_NODE_ADDR_CODE_EP_SET, epSetToMsg, &pNode->epSet);
+ }
+
+ return code;
+}
+
+static int32_t msgToQueryNodeAddr(STlvDecoder* pDecoder, void* pObj) {
+ SQueryNodeAddr* pNode = (SQueryNodeAddr*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case QUERY_NODE_ADDR_CODE_NODE_ID:
+ code = tlvDecodeI32(pTlv, &pNode->nodeId);
+ break;
+ case QUERY_NODE_ADDR_CODE_EP_SET:
+ code = tlvDecodeObjFromTlv(pTlv, msgToEpSet, &pNode->epSet);
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum {
+ SUBPLAN_CODE_SUBPLAN_ID = 1,
+ SUBPLAN_CODE_SUBPLAN_TYPE,
+ SUBPLAN_CODE_MSG_TYPE,
+ SUBPLAN_CODE_LEVEL,
+ SUBPLAN_CODE_DBFNAME,
+ SUBPLAN_CODE_USER,
+ SUBPLAN_CODE_EXECNODE,
+ SUBPLAN_CODE_ROOT_NODE,
+ SUBPLAN_CODE_DATA_SINK,
+ SUBPLAN_CODE_TAG_COND,
+ SUBPLAN_CODE_TAG_INDEX_COND
+};
+
+static int32_t subplanToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SSubplan* pNode = (const SSubplan*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, SUBPLAN_CODE_SUBPLAN_ID, subplanIdToMsg, &pNode->id);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeEnum(pEncoder, SUBPLAN_CODE_SUBPLAN_TYPE, pNode->subplanType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, SUBPLAN_CODE_MSG_TYPE, pNode->msgType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, SUBPLAN_CODE_LEVEL, pNode->level);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, SUBPLAN_CODE_DBFNAME, pNode->dbFName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, SUBPLAN_CODE_USER, pNode->user);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, SUBPLAN_CODE_EXECNODE, queryNodeAddrToMsg, &pNode->execNode);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, SUBPLAN_CODE_ROOT_NODE, nodeToMsg, pNode->pNode);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, SUBPLAN_CODE_DATA_SINK, nodeToMsg, pNode->pDataSink);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, SUBPLAN_CODE_TAG_COND, nodeToMsg, pNode->pTagCond);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, SUBPLAN_CODE_TAG_INDEX_COND, nodeToMsg, pNode->pTagIndexCond);
+ }
+
+ return code;
+}
+
+static int32_t msgToSubplan(STlvDecoder* pDecoder, void* pObj) {
+ SSubplan* pNode = (SSubplan*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case SUBPLAN_CODE_SUBPLAN_ID:
+ code = tlvDecodeObjFromTlv(pTlv, msgToSubplanId, &pNode->id);
+ break;
+ case SUBPLAN_CODE_SUBPLAN_TYPE:
+ code = tlvDecodeEnum(pTlv, &pNode->subplanType, sizeof(pNode->subplanType));
+ break;
+ case SUBPLAN_CODE_MSG_TYPE:
+ code = tlvDecodeI32(pTlv, &pNode->msgType);
+ break;
+ case SUBPLAN_CODE_LEVEL:
+ code = tlvDecodeI32(pTlv, &pNode->level);
+ break;
+ case SUBPLAN_CODE_DBFNAME:
+ code = tlvDecodeCStr(pTlv, pNode->dbFName);
+ break;
+ case SUBPLAN_CODE_USER:
+ code = tlvDecodeCStr(pTlv, pNode->user);
+ break;
+ case SUBPLAN_CODE_EXECNODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToQueryNodeAddr, &pNode->execNode);
+ break;
+ case SUBPLAN_CODE_ROOT_NODE:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pNode);
+ break;
+ case SUBPLAN_CODE_DATA_SINK:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pDataSink);
+ break;
+ case SUBPLAN_CODE_TAG_COND:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pTagCond);
+ break;
+ case SUBPLAN_CODE_TAG_INDEX_COND:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pTagIndexCond);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { QUERY_PLAN_CODE_QUERY_ID = 1, QUERY_PLAN_CODE_NUM_OF_SUBPLANS, QUERY_PLAN_CODE_SUBPLANS };
+
+static int32_t queryPlanToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SQueryPlan* pNode = (const SQueryPlan*)pObj;
+
+ int32_t code = tlvEncodeU64(pEncoder, QUERY_PLAN_CODE_QUERY_ID, pNode->queryId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, QUERY_PLAN_CODE_NUM_OF_SUBPLANS, pNode->numOfSubplans);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, QUERY_PLAN_CODE_SUBPLANS, nodeListToMsg, pNode->pSubplans);
+ }
+
+ return code;
+}
+
+static int32_t msgToQueryPlan(STlvDecoder* pDecoder, void* pObj) {
+ SQueryPlan* pNode = (SQueryPlan*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case QUERY_PLAN_CODE_QUERY_ID:
+ code = tlvDecodeU64(pTlv, &pNode->queryId);
+ break;
+ case QUERY_PLAN_CODE_NUM_OF_SUBPLANS:
+ code = tlvDecodeI32(pTlv, &pNode->numOfSubplans);
+ break;
+ case QUERY_PLAN_CODE_SUBPLANS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pSubplans);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ switch (nodeType(pObj)) {
+ case QUERY_NODE_COLUMN:
+ code = columnNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_VALUE:
+ code = valueNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_OPERATOR:
+ code = operatorNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_LOGIC_CONDITION:
+ code = logicConditionNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_FUNCTION:
+ code = functionNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_ORDER_BY_EXPR:
+ code = orderByExprNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_LIMIT:
+ code = limitNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_NODE_LIST:
+ code = nodeListNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_TARGET:
+ code = targetNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_DATABLOCK_DESC:
+ code = dataBlockDescNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_SLOT_DESC:
+ code = slotDescNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_LEFT_VALUE:
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
+ case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN:
+ code = physiScanNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN:
+ code = physiLastRowScanNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:
+ case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN:
+ code = physiTableScanNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN:
+ code = physiSysTableScanNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
+ code = physiProjectNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN:
+ code = physiJoinNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG:
+ code = physiAggNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:
+ code = physiExchangeNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE:
+ code = physiMergeNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_SORT:
+ case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT:
+ code = physiSortNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL:
+ code = physiIntervalNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_FILL:
+ code = physiFillNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION:
+ code = physiSessionWindowNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE:
+ code = physiStateWindowNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION:
+ code = physiPartitionNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC:
+ code = physiIndefRowsFuncNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
+ code = physiInterpFuncNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
+ code = physiDispatchNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT:
+ code = physiQueryInsertNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_DELETE:
+ code = physiDeleteNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_SUBPLAN:
+ code = subplanToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN:
+ code = queryPlanToMsg(pObj, pEncoder);
+ break;
+ default:
+ nodesWarn("specificNodeToMsg unknown node = %s", nodesNodeName(nodeType(pObj)));
+ break;
+ }
+ if (TSDB_CODE_SUCCESS != code) {
+ nodesError("specificNodeToMsg error node = %s", nodesNodeName(nodeType(pObj)));
+ }
+ return code;
+}
+
+static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ switch (nodeType(pObj)) {
+ case QUERY_NODE_COLUMN:
+ code = msgToColumnNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_VALUE:
+ code = msgToValueNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_OPERATOR:
+ code = msgToOperatorNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_LOGIC_CONDITION:
+ code = msgToLogicConditionNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_FUNCTION:
+ code = msgToFunctionNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_ORDER_BY_EXPR:
+ code = msgToOrderByExprNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_LIMIT:
+ code = msgToLimitNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_NODE_LIST:
+ code = msgToNodeListNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_TARGET:
+ code = msgToTargetNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_DATABLOCK_DESC:
+ code = msgToDataBlockDescNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_SLOT_DESC:
+ code = msgToSlotDescNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_LEFT_VALUE:
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
+ case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN:
+ code = msgToPhysiScanNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN:
+ code = msgToPhysiLastRowScanNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:
+ case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN:
+ code = msgToPhysiTableScanNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN:
+ code = msgToPhysiSysTableScanNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
+ code = msgToPhysiProjectNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN:
+ code = msgToPhysiJoinNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG:
+ code = msgToPhysiAggNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:
+ code = msgToPhysiExchangeNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE:
+ code = msgToPhysiMergeNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_SORT:
+ case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT:
+ code = msgToPhysiSortNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL:
+ code = msgToPhysiIntervalNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_FILL:
+ code = msgToPhysiFillNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION:
+ code = msgToPhysiSessionWindowNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE:
+ code = msgToPhysiStateWindowNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION:
+ code = msgToPhysiPartitionNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC:
+ code = msgToPhysiIndefRowsFuncNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
+ code = msgToPhysiInterpFuncNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
+ code = msgToPhysiDispatchNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT:
+ code = msgToPhysiQueryInsertNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN_DELETE:
+ code = msgToPhysiDeleteNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_SUBPLAN:
+ code = msgToSubplan(pDecoder, pObj);
+ break;
+ case QUERY_NODE_PHYSICAL_PLAN:
+ code = msgToQueryPlan(pDecoder, pObj);
+ break;
+ default:
+ nodesWarn("msgToSpecificNode unknown node = %s", nodesNodeName(nodeType(pObj)));
+ break;
+ }
+ if (TSDB_CODE_SUCCESS != code) {
+ nodesError("msgToSpecificNode error node = %s", nodesNodeName(nodeType(pObj)));
+ }
+ return code;
+}
+
+static int32_t nodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ return tlvEncodeObj(pEncoder, nodeType(pObj), specificNodeToMsg, pObj);
+}
+
+static int32_t msgToNode(STlvDecoder* pDecoder, void** pObj) {
+ return tlvDecodeDynObj(pDecoder, (FMakeObject)nodesMakeNode, msgToSpecificNode, pObj);
+}
+
+static int32_t msgToNodeFromTlv(STlv* pTlv, void** pObj) {
+ STlvDecoder decoder = {.bufSize = pTlv->len, .offset = 0, .pBuf = pTlv->value};
+ return msgToNode(&decoder, pObj);
+}
+
+static int32_t nodeListToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SNodeList* pList = (const SNodeList*)pObj;
+
+ SNode* pNode = NULL;
+ FOREACH(pNode, pList) {
+ int32_t code = nodeToMsg(pNode, pEncoder);
+ if (TSDB_CODE_SUCCESS != code) {
+ return code;
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t msgToNodeList(STlvDecoder* pDecoder, void** pObj) {
+ SNodeList* pList = nodesMakeList();
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ while (TSDB_CODE_SUCCESS == code && !tlvDecodeEnd(pDecoder)) {
+ SNode* pNode = NULL;
+ code = msgToNode(pDecoder, (void**)&pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodesListAppend(pList, pNode);
+ }
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ *pObj = pList;
+ } else {
+ nodesDestroyList(pList);
+ }
+ return code;
+}
+
+static int32_t msgToNodeListFromTlv(STlv* pTlv, void** pObj) {
+ STlvDecoder decoder = {.bufSize = pTlv->len, .offset = 0, .pBuf = pTlv->value};
+ return msgToNodeList(&decoder, pObj);
+}
+
+int32_t nodesNodeToMsg(const SNode* pNode, char** pMsg, int32_t* pLen) {
+ if (NULL == pNode || NULL == pMsg || NULL == pLen) {
+ terrno = TSDB_CODE_FAILED;
+ return TSDB_CODE_FAILED;
+ }
+
+ STlvEncoder encoder;
+ int32_t code = initTlvEncoder(&encoder);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeToMsg(pNode, &encoder);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ endTlvEncode(&encoder, pMsg, pLen);
+ }
+ clearTlvEncoder(&encoder);
+
+ terrno = code;
+ return code;
+}
+
+int32_t nodesMsgToNode(const char* pMsg, int32_t len, SNode** pNode) {
+ if (NULL == pMsg || NULL == pNode) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ STlvDecoder decoder = {.bufSize = len, .offset = 0, .pBuf = pMsg};
+ int32_t code = msgToNode(&decoder, (void**)pNode);
+ if (TSDB_CODE_SUCCESS != code) {
+ nodesDestroyNode(*pNode);
+ *pNode = NULL;
+ }
+
+ terrno = code;
+ return code;
+}
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index 0507fe0c66..898e4bf732 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -48,6 +48,7 @@ typedef enum EDatabaseOptionType {
DB_OPTION_KEEP,
DB_OPTION_PAGES,
DB_OPTION_PAGESIZE,
+ DB_OPTION_TSDB_PAGESIZE,
DB_OPTION_PRECISION,
DB_OPTION_REPLICA,
DB_OPTION_STRICT,
@@ -60,7 +61,7 @@ typedef enum EDatabaseOptionType {
DB_OPTION_WAL_RETENTION_SIZE,
DB_OPTION_WAL_ROLL_PERIOD,
DB_OPTION_WAL_SEGMENT_SIZE,
- DB_OPTION_SST_TRIGGER,
+ DB_OPTION_STT_TRIGGER,
DB_OPTION_TABLE_PREFIX,
DB_OPTION_TABLE_SUFFIX
} EDatabaseOptionType;
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index fdd0ec548b..bef2ed98ec 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -184,6 +184,7 @@ db_options(A) ::= db_options(B) KEEP integer_list(C).
db_options(A) ::= db_options(B) KEEP variable_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP, C); }
db_options(A) ::= db_options(B) PAGES NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PAGES, &C); }
db_options(A) ::= db_options(B) PAGESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PAGESIZE, &C); }
+db_options(A) ::= db_options(B) TSDB_PAGESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TSDB_PAGESIZE, &C); }
db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); }
db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); }
db_options(A) ::= db_options(B) STRICT NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STRICT, &C); }
@@ -207,7 +208,7 @@ db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_MINUS(D) NK_INTEGER(C).
}
db_options(A) ::= db_options(B) WAL_ROLL_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_ROLL_PERIOD, &C); }
db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); }
-db_options(A) ::= db_options(B) SST_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SST_TRIGGER, &C); }
+db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_TRIGGER, &C); }
db_options(A) ::= db_options(B) TABLE_PREFIX NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_PREFIX, &C); }
db_options(A) ::= db_options(B) TABLE_SUFFIX NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX, &C); }
@@ -226,7 +227,7 @@ alter_db_option(A) ::= KEEP variable_list(B).
//alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
-alter_db_option(A) ::= SST_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_SST_TRIGGER; A.val = B; }
+alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; }
%type integer_list { SNodeList* }
%destructor integer_list { nodesDestroyList($$); }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 901abf17ee..655bb68206 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -826,6 +826,7 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) {
pOptions->keep[2] = TSDB_DEFAULT_KEEP;
pOptions->pages = TSDB_DEFAULT_PAGES_PER_VNODE;
pOptions->pagesize = TSDB_DEFAULT_PAGESIZE_PER_VNODE;
+ pOptions->tsdbPageSize = TSDB_DEFAULT_TSDB_PAGESIZE;
pOptions->precision = TSDB_DEFAULT_PRECISION;
pOptions->replica = TSDB_DEFAULT_DB_REPLICA;
pOptions->strict = TSDB_DEFAULT_DB_STRICT;
@@ -858,6 +859,7 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) {
pOptions->keep[2] = -1;
pOptions->pages = -1;
pOptions->pagesize = -1;
+ pOptions->tsdbPageSize = -1;
pOptions->precision = -1;
pOptions->replica = -1;
pOptions->strict = -1;
@@ -918,6 +920,9 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti
case DB_OPTION_PAGESIZE:
pDbOptions->pagesize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
break;
+ case DB_OPTION_TSDB_PAGESIZE:
+ pDbOptions->tsdbPageSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
+ break;
case DB_OPTION_PRECISION:
COPY_STRING_FORM_STR_TOKEN(pDbOptions->precisionStr, (SToken*)pVal);
break;
@@ -955,7 +960,7 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti
case DB_OPTION_WAL_SEGMENT_SIZE:
pDbOptions->walSegmentSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
break;
- case DB_OPTION_SST_TRIGGER:
+ case DB_OPTION_STT_TRIGGER:
pDbOptions->sstTrigger = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
break;
case DB_OPTION_TABLE_PREFIX:
diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c
index 162161b67a..06e19b98cd 100644
--- a/source/libs/parser/src/parInsert.c
+++ b/source/libs/parser/src/parInsert.c
@@ -1129,11 +1129,14 @@ static int32_t parseTableOptions(SInsertParseContext* pCxt) {
NEXT_TOKEN_KEEP_SQL(pCxt->pSql, sToken, index);
if (TK_TTL == sToken.type) {
pCxt->pSql += index;
- NEXT_TOKEN(pCxt->pSql, sToken);
+ NEXT_TOKEN_WITH_PREV(pCxt->pSql, sToken);
if (TK_NK_INTEGER != sToken.type) {
return buildSyntaxErrMsg(&pCxt->msg, "Invalid option ttl", sToken.z);
}
pCxt->createTblReq.ttl = taosStr2Int32(sToken.z, NULL, 10);
+ if (pCxt->createTblReq.ttl < 0) {
+ return buildSyntaxErrMsg(&pCxt->msg, "Invalid option ttl", sToken.z);
+ }
} else if (TK_COMMENT == sToken.type) {
pCxt->pSql += index;
NEXT_TOKEN(pCxt->pSql, sToken);
@@ -1742,7 +1745,7 @@ static int32_t skipTableOptions(SInsertParseSyntaxCxt* pCxt) {
NEXT_TOKEN_KEEP_SQL(pCxt->pSql, sToken, index);
if (TK_TTL == sToken.type || TK_COMMENT == sToken.type) {
pCxt->pSql += index;
- NEXT_TOKEN(pCxt->pSql, sToken);
+ NEXT_TOKEN_WITH_PREV(pCxt->pSql, sToken);
} else {
break;
}
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index e0f54530dd..68eb3e6fb1 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -187,7 +187,7 @@ static SKeyword keywordTable[] = {
{"SNODES", TK_SNODES},
{"SOFFSET", TK_SOFFSET},
{"SPLIT", TK_SPLIT},
- {"SST_TRIGGER", TK_SST_TRIGGER},
+ {"STT_TRIGGER", TK_STT_TRIGGER},
{"STABLE", TK_STABLE},
{"STABLES", TK_STABLES},
{"STATE", TK_STATE},
@@ -216,6 +216,7 @@ static SKeyword keywordTable[] = {
{"TRANSACTIONS", TK_TRANSACTIONS},
{"TRIGGER", TK_TRIGGER},
{"TRIM", TK_TRIM},
+ {"TSDB_PAGESIZE", TK_TSDB_PAGESIZE},
{"TSERIES", TK_TSERIES},
{"TTL", TK_TTL},
{"UNION", TK_UNION},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index ad9a467dee..2af4032fd8 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -3485,6 +3485,7 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS
pReq->sstTrigger = pStmt->pOptions->sstTrigger;
pReq->hashPrefix = pStmt->pOptions->tablePrefix;
pReq->hashSuffix = pStmt->pOptions->tableSuffix;
+ pReq->tsdbPageSize = pStmt->pOptions->tsdbPageSize;
pReq->ignoreExist = pStmt->ignoreExists;
return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq);
}
@@ -3729,6 +3730,10 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
code = checkDbRangeOption(pCxt, "pagesize", pOptions->pagesize, TSDB_MIN_PAGESIZE_PER_VNODE,
TSDB_MAX_PAGESIZE_PER_VNODE);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = checkDbRangeOption(pCxt, "tsdbPagesize", pOptions->tsdbPageSize, TSDB_MIN_TSDB_PAGESIZE,
+ TSDB_MAX_TSDB_PAGESIZE);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = checkDbPrecisionOption(pCxt, pOptions);
}
@@ -3770,7 +3775,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
checkDbRangeOption(pCxt, "walSegmentSize", pOptions->walSegmentSize, TSDB_DB_MIN_WAL_SEGMENT_SIZE, INT32_MAX);
}
if (TSDB_CODE_SUCCESS == code) {
- code = checkDbRangeOption(pCxt, "sstTrigger", pOptions->sstTrigger, TSDB_MIN_SST_TRIGGER, TSDB_MAX_SST_TRIGGER);
+ code = checkDbRangeOption(pCxt, "sstTrigger", pOptions->sstTrigger, TSDB_MIN_STT_TRIGGER, TSDB_MAX_STT_TRIGGER);
}
if (TSDB_CODE_SUCCESS == code) {
code = checkDbRangeOption(pCxt, "tablePrefix", pOptions->tablePrefix, TSDB_MIN_HASH_PREFIX, TSDB_MAX_HASH_PREFIX);
@@ -6606,7 +6611,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema);
if (QUERY_NODE_VALUE != pStmt->pVal->node.type) {
- SValueNode *pVal = NULL;
+ SValueNode* pVal = NULL;
pCxt->errCode = createTagValFromExpr(pCxt, targetDt, (SNode*)pStmt->pVal, &pVal);
if (pCxt->errCode) {
return pCxt->errCode;
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 0442d262f1..a2a52aa0e0 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 429
+#define YYNOCODE 430
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- int32_t yy46;
- SNode* yy80;
- int64_t yy129;
- SDataType yy136;
- EOperatorType yy194;
- SToken yy239;
- SAlterOption yy299;
- EOrder yy422;
- EFillMode yy426;
- int8_t yy509;
- SNodeList* yy574;
- EJoinType yy750;
- ENullOrder yy763;
- bool yy845;
+ int64_t yy49;
+ SDataType yy84;
+ EFillMode yy134;
+ SToken yy149;
+ EOrder yy158;
+ int32_t yy160;
+ SNode* yy312;
+ EOperatorType yy320;
+ int8_t yy363;
+ SAlterOption yy405;
+ ENullOrder yy417;
+ bool yy497;
+ SNodeList* yy824;
+ EJoinType yy832;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -139,17 +139,17 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 674
-#define YYNRULE 495
-#define YYNTOKEN 308
-#define YY_MAX_SHIFT 673
-#define YY_MIN_SHIFTREDUCE 983
-#define YY_MAX_SHIFTREDUCE 1477
-#define YY_ERROR_ACTION 1478
-#define YY_ACCEPT_ACTION 1479
-#define YY_NO_ACTION 1480
-#define YY_MIN_REDUCE 1481
-#define YY_MAX_REDUCE 1975
+#define YYNSTATE 675
+#define YYNRULE 496
+#define YYNTOKEN 309
+#define YY_MAX_SHIFT 674
+#define YY_MIN_SHIFTREDUCE 985
+#define YY_MAX_SHIFTREDUCE 1480
+#define YY_ERROR_ACTION 1481
+#define YY_ACCEPT_ACTION 1482
+#define YY_NO_ACTION 1483
+#define YY_MIN_REDUCE 1484
+#define YY_MAX_REDUCE 1979
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,680 +216,690 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2464)
+#define YY_ACTTAB_COUNT (2512)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 436, 379, 437, 1516, 1809, 91, 516, 444, 1616, 437,
- /* 10 */ 1516, 1614, 39, 37, 553, 64, 30, 260, 124, 1793,
- /* 20 */ 340, 1953, 1278, 33, 32, 1016, 1617, 40, 38, 36,
- /* 30 */ 35, 34, 1827, 1354, 1952, 1276, 385, 148, 1950, 1493,
- /* 40 */ 582, 1953, 127, 1789, 1795, 1779, 1953, 581, 40, 38,
- /* 50 */ 36, 35, 34, 556, 164, 575, 1349, 517, 1950, 164,
- /* 60 */ 558, 14, 558, 1950, 326, 1020, 1021, 1725, 1284, 1543,
- /* 70 */ 1841, 1304, 74, 303, 94, 1810, 584, 1812, 1813, 580,
- /* 80 */ 125, 575, 1504, 173, 1887, 122, 217, 345, 306, 1883,
- /* 90 */ 1670, 1672, 1, 556, 1620, 250, 1895, 552, 63, 551,
- /* 100 */ 1953, 107, 1953, 63, 106, 105, 104, 103, 102, 101,
- /* 110 */ 100, 99, 98, 166, 670, 166, 453, 1950, 71, 1950,
- /* 120 */ 1421, 70, 63, 1779, 78, 42, 1303, 1303, 1356, 1357,
- /* 130 */ 11, 10, 647, 646, 645, 644, 350, 1503, 643, 642,
- /* 140 */ 128, 637, 636, 635, 634, 633, 632, 631, 139, 627,
- /* 150 */ 626, 625, 349, 348, 622, 621, 620, 619, 618, 530,
- /* 160 */ 500, 33, 32, 196, 1481, 40, 38, 36, 35, 34,
- /* 170 */ 55, 223, 224, 498, 1279, 496, 1277, 152, 1779, 1175,
- /* 180 */ 1176, 1474, 470, 466, 462, 458, 195, 1625, 116, 115,
- /* 190 */ 114, 113, 112, 111, 110, 109, 108, 1282, 1283, 63,
- /* 200 */ 1331, 1332, 1334, 1335, 1336, 1337, 1338, 1339, 577, 573,
- /* 210 */ 1347, 1348, 1350, 1351, 1352, 1353, 1355, 1358, 39, 37,
- /* 220 */ 1417, 75, 1390, 302, 193, 1301, 340, 84, 1278, 1809,
- /* 230 */ 305, 167, 415, 520, 1953, 427, 353, 167, 530, 1354,
- /* 240 */ 542, 1276, 167, 1677, 1798, 553, 1448, 165, 1618, 169,
- /* 250 */ 328, 1950, 400, 1677, 428, 1793, 402, 1827, 1953, 1675,
- /* 260 */ 344, 167, 1349, 1304, 167, 582, 1625, 14, 1473, 1675,
- /* 270 */ 1779, 1951, 581, 127, 1284, 1950, 1953, 33, 32, 1789,
- /* 280 */ 1795, 40, 38, 36, 35, 34, 1797, 192, 186, 164,
- /* 290 */ 191, 575, 49, 1950, 449, 1841, 393, 1793, 2, 95,
- /* 300 */ 1810, 584, 1812, 1813, 580, 1303, 575, 1333, 389, 1887,
- /* 310 */ 184, 125, 22, 331, 1883, 1966, 556, 548, 543, 158,
- /* 320 */ 670, 1789, 1795, 329, 1921, 555, 160, 1895, 1896, 1724,
- /* 330 */ 1900, 300, 1664, 575, 1356, 1357, 426, 1479, 167, 421,
- /* 340 */ 420, 419, 418, 417, 414, 413, 412, 411, 410, 406,
- /* 350 */ 405, 404, 403, 397, 396, 395, 394, 1522, 391, 390,
- /* 360 */ 314, 1902, 1133, 606, 605, 604, 1137, 603, 1139, 1140,
- /* 370 */ 602, 1142, 599, 530, 1148, 596, 1150, 1151, 593, 590,
- /* 380 */ 1279, 327, 1277, 317, 383, 1899, 33, 32, 43, 146,
- /* 390 */ 40, 38, 36, 35, 34, 150, 355, 547, 1627, 1584,
- /* 400 */ 1033, 1625, 1032, 1282, 1283, 665, 1331, 1332, 1334, 1335,
- /* 410 */ 1336, 1337, 1338, 1339, 577, 573, 1347, 1348, 1350, 1351,
- /* 420 */ 1352, 1353, 1355, 1358, 39, 37, 1809, 491, 1671, 1672,
- /* 430 */ 1034, 167, 340, 1723, 1278, 300, 1953, 1302, 36, 35,
- /* 440 */ 34, 318, 501, 316, 315, 1354, 476, 1276, 1677, 164,
- /* 450 */ 478, 1305, 222, 1950, 1827, 312, 209, 1602, 486, 485,
- /* 460 */ 1364, 1603, 582, 617, 1675, 123, 1303, 1779, 1349, 581,
- /* 470 */ 494, 1428, 477, 14, 488, 481, 484, 26, 343, 208,
- /* 480 */ 1284, 480, 558, 33, 32, 346, 146, 40, 38, 36,
- /* 490 */ 35, 34, 1841, 146, 7, 1627, 94, 1810, 584, 1812,
- /* 500 */ 1813, 580, 1627, 575, 2, 609, 1887, 1378, 553, 530,
- /* 510 */ 306, 1883, 1258, 1259, 58, 435, 1953, 57, 439, 1502,
- /* 520 */ 117, 453, 1953, 147, 1827, 63, 670, 474, 278, 165,
- /* 530 */ 1809, 1501, 546, 1950, 374, 164, 127, 1625, 28, 1950,
- /* 540 */ 1356, 1357, 276, 60, 33, 32, 59, 1284, 40, 38,
- /* 550 */ 36, 35, 34, 376, 372, 337, 336, 1500, 1827, 530,
- /* 560 */ 1779, 615, 180, 432, 430, 1292, 582, 1728, 545, 27,
- /* 570 */ 117, 1779, 1779, 581, 125, 517, 1354, 479, 1285, 1383,
- /* 580 */ 137, 136, 612, 611, 610, 1726, 1279, 1625, 1277, 161,
- /* 590 */ 1895, 1896, 252, 1900, 629, 1499, 1841, 63, 1779, 1349,
- /* 600 */ 149, 1810, 584, 1812, 1813, 580, 378, 575, 377, 1282,
- /* 610 */ 1283, 1284, 1331, 1332, 1334, 1335, 1336, 1337, 1338, 1339,
- /* 620 */ 577, 573, 1347, 1348, 1350, 1351, 1352, 1353, 1355, 1358,
- /* 630 */ 39, 37, 1902, 1278, 1498, 93, 1779, 1497, 340, 630,
- /* 640 */ 1278, 1597, 441, 1601, 559, 1967, 1276, 1333, 1301, 1610,
- /* 650 */ 1033, 1354, 1032, 1276, 33, 32, 1898, 570, 40, 38,
- /* 660 */ 36, 35, 34, 1546, 167, 472, 443, 352, 1612, 439,
- /* 670 */ 1496, 68, 67, 382, 1349, 1779, 171, 1608, 1779, 1284,
- /* 680 */ 1034, 210, 1495, 33, 32, 1410, 1284, 40, 38, 36,
- /* 690 */ 35, 34, 301, 530, 1809, 370, 74, 368, 364, 360,
- /* 700 */ 357, 354, 1492, 617, 384, 1020, 1021, 1953, 33, 32,
- /* 710 */ 8, 1779, 40, 38, 36, 35, 34, 1293, 1621, 1288,
- /* 720 */ 164, 1625, 1827, 1779, 1950, 670, 213, 486, 485, 1491,
- /* 730 */ 557, 1490, 670, 502, 123, 1779, 167, 581, 76, 305,
- /* 740 */ 1296, 1298, 520, 1779, 481, 484, 1356, 1357, 1489, 1095,
- /* 750 */ 480, 1902, 573, 1347, 1348, 1350, 1351, 1352, 1353, 1438,
- /* 760 */ 1841, 307, 1907, 1410, 95, 1810, 584, 1812, 1813, 580,
- /* 770 */ 1779, 575, 1779, 1953, 1887, 1897, 615, 1718, 331, 1883,
- /* 780 */ 159, 1414, 1097, 483, 482, 1279, 164, 1277, 172, 1779,
- /* 790 */ 1950, 478, 1279, 1316, 1277, 137, 136, 612, 611, 610,
- /* 800 */ 1914, 1376, 539, 1436, 1437, 1439, 1440, 145, 1282, 1283,
- /* 810 */ 1488, 1809, 1487, 477, 1486, 1282, 1283, 1306, 1331, 1332,
- /* 820 */ 1334, 1335, 1336, 1337, 1338, 1339, 577, 573, 1347, 1348,
- /* 830 */ 1350, 1351, 1352, 1353, 1355, 1358, 39, 37, 1359, 1827,
- /* 840 */ 1482, 146, 422, 509, 340, 1060, 1278, 582, 1485, 167,
- /* 850 */ 1628, 1779, 1779, 1779, 581, 1779, 1377, 1354, 1484, 1276,
- /* 860 */ 1677, 107, 1718, 61, 106, 105, 104, 103, 102, 101,
- /* 870 */ 100, 99, 98, 175, 641, 639, 1676, 1841, 1061, 1303,
- /* 880 */ 1349, 96, 1810, 584, 1812, 1813, 580, 613, 575, 1779,
- /* 890 */ 1668, 1887, 1284, 44, 4, 1886, 1883, 177, 176, 1779,
- /* 900 */ 614, 33, 32, 1668, 1797, 40, 38, 36, 35, 34,
- /* 910 */ 272, 135, 576, 1655, 1809, 1793, 9, 1766, 29, 338,
- /* 920 */ 1371, 1372, 1373, 1374, 1375, 1379, 1380, 1381, 1382, 33,
- /* 930 */ 32, 1809, 530, 40, 38, 36, 35, 34, 670, 1789,
- /* 940 */ 1795, 335, 1827, 392, 562, 530, 608, 324, 1533, 386,
- /* 950 */ 582, 575, 1356, 1357, 307, 1779, 407, 581, 232, 1827,
- /* 960 */ 1625, 54, 387, 201, 362, 203, 199, 582, 202, 1494,
- /* 970 */ 487, 530, 1779, 1625, 581, 53, 513, 11, 10, 530,
- /* 980 */ 1841, 216, 408, 565, 294, 1810, 584, 1812, 1813, 580,
- /* 990 */ 451, 575, 553, 205, 1376, 1528, 204, 1841, 1279, 1625,
- /* 1000 */ 1277, 96, 1810, 584, 1812, 1813, 580, 1625, 575, 1413,
- /* 1010 */ 207, 1887, 41, 206, 1316, 569, 1883, 489, 255, 77,
- /* 1020 */ 127, 1282, 1283, 1526, 1331, 1332, 1334, 1335, 1336, 1337,
- /* 1030 */ 1338, 1339, 577, 573, 1347, 1348, 1350, 1351, 1352, 1353,
- /* 1040 */ 1355, 1358, 39, 37, 530, 492, 221, 1585, 530, 1377,
- /* 1050 */ 340, 131, 1278, 134, 673, 452, 530, 1287, 125, 1622,
- /* 1060 */ 1333, 471, 1229, 1354, 1809, 1276, 1286, 503, 267, 1476,
- /* 1070 */ 1477, 540, 1625, 162, 1895, 1896, 1625, 1900, 571, 1800,
- /* 1080 */ 623, 135, 156, 51, 1625, 90, 1349, 663, 659, 655,
- /* 1090 */ 651, 265, 1827, 1600, 244, 87, 225, 531, 1284, 530,
- /* 1100 */ 582, 523, 1079, 229, 1809, 1779, 236, 581, 560, 1828,
- /* 1110 */ 510, 29, 338, 1371, 1372, 1373, 1374, 1375, 1379, 1380,
- /* 1120 */ 1381, 1382, 9, 41, 624, 1802, 92, 1625, 351, 230,
- /* 1130 */ 1841, 1126, 1827, 1435, 294, 1810, 584, 1812, 1813, 580,
- /* 1140 */ 557, 575, 1665, 51, 670, 1779, 1077, 581, 1517, 41,
- /* 1150 */ 588, 563, 530, 1917, 530, 530, 239, 530, 1356, 1357,
- /* 1160 */ 554, 134, 527, 514, 249, 227, 526, 254, 528, 257,
- /* 1170 */ 1841, 135, 259, 271, 95, 1810, 584, 1812, 1813, 580,
- /* 1180 */ 1625, 575, 1625, 1625, 1887, 1625, 3, 5, 331, 1883,
- /* 1190 */ 159, 356, 566, 1384, 361, 219, 313, 615, 1290, 1340,
- /* 1200 */ 1154, 530, 163, 119, 1279, 134, 1277, 1289, 1245, 174,
- /* 1210 */ 1913, 1158, 529, 1252, 1368, 212, 137, 136, 612, 611,
- /* 1220 */ 610, 1165, 268, 388, 1301, 409, 1720, 1282, 1283, 1625,
- /* 1230 */ 1331, 1332, 1334, 1335, 1336, 1337, 1338, 1339, 577, 573,
- /* 1240 */ 1347, 1348, 1350, 1351, 1352, 1353, 1355, 1358, 39, 37,
- /* 1250 */ 1809, 530, 530, 1163, 416, 138, 340, 424, 1278, 423,
- /* 1260 */ 425, 429, 261, 347, 431, 433, 1307, 1309, 434, 1354,
- /* 1270 */ 442, 1276, 445, 183, 446, 185, 1308, 447, 1827, 1625,
- /* 1280 */ 1625, 1310, 188, 448, 450, 190, 582, 72, 73, 454,
- /* 1290 */ 194, 1779, 1349, 581, 473, 475, 118, 1615, 304, 198,
- /* 1300 */ 1611, 1759, 200, 269, 1284, 140, 504, 141, 211, 505,
- /* 1310 */ 1809, 1613, 1609, 142, 143, 214, 1841, 511, 218, 515,
- /* 1320 */ 95, 1810, 584, 1812, 1813, 580, 553, 575, 2, 538,
- /* 1330 */ 1887, 524, 508, 81, 331, 1883, 1966, 323, 1827, 83,
- /* 1340 */ 518, 132, 1758, 1730, 521, 1944, 582, 1306, 133, 525,
- /* 1350 */ 670, 1779, 1626, 581, 127, 270, 325, 1928, 534, 541,
- /* 1360 */ 1918, 536, 6, 234, 1356, 1357, 537, 330, 544, 1909,
- /* 1370 */ 550, 535, 533, 238, 558, 532, 1841, 1305, 1410, 126,
- /* 1380 */ 95, 1810, 584, 1812, 1813, 580, 567, 575, 564, 48,
- /* 1390 */ 1887, 332, 125, 246, 331, 1883, 1966, 1927, 243, 248,
- /* 1400 */ 1903, 85, 586, 1669, 1598, 1906, 247, 250, 1895, 552,
- /* 1410 */ 1279, 551, 1277, 1868, 1953, 153, 273, 264, 666, 667,
- /* 1420 */ 52, 669, 299, 286, 275, 245, 1809, 164, 296, 1773,
- /* 1430 */ 277, 1950, 295, 1282, 1283, 65, 1331, 1332, 1334, 1335,
- /* 1440 */ 1336, 1337, 1338, 1339, 577, 573, 1347, 1348, 1350, 1351,
- /* 1450 */ 1352, 1353, 1355, 1358, 1827, 1969, 1772, 1949, 1771, 253,
- /* 1460 */ 1770, 256, 582, 66, 561, 568, 258, 1779, 1767, 581,
- /* 1470 */ 359, 358, 1270, 1271, 170, 363, 1765, 365, 366, 367,
- /* 1480 */ 1764, 369, 558, 1763, 371, 1762, 373, 1809, 1761, 375,
- /* 1490 */ 1248, 1741, 1841, 1247, 1740, 380, 285, 1810, 584, 1812,
- /* 1500 */ 1813, 580, 381, 575, 1739, 1738, 1713, 1217, 1712, 1711,
- /* 1510 */ 1710, 129, 1709, 1708, 69, 1827, 1707, 1706, 1705, 1704,
- /* 1520 */ 1703, 398, 1953, 582, 399, 1702, 401, 1701, 1779, 1700,
- /* 1530 */ 581, 1699, 1698, 1697, 1696, 166, 1695, 1694, 1693, 1950,
- /* 1540 */ 1692, 1691, 1690, 558, 1809, 1689, 1688, 1687, 1686, 130,
- /* 1550 */ 1685, 1684, 1683, 1841, 178, 1547, 179, 285, 1810, 584,
- /* 1560 */ 1812, 1813, 580, 1682, 575, 1219, 1681, 1680, 1679, 1678,
- /* 1570 */ 1809, 1548, 1827, 1545, 1513, 1023, 438, 181, 120, 1022,
- /* 1580 */ 579, 1512, 1754, 1953, 1748, 1779, 1737, 581, 189, 1736,
- /* 1590 */ 1722, 1604, 157, 1544, 1542, 121, 164, 182, 1827, 440,
- /* 1600 */ 1950, 187, 1540, 1538, 1536, 455, 582, 456, 1525, 1524,
- /* 1610 */ 1841, 1779, 459, 581, 293, 1810, 584, 1812, 1813, 580,
- /* 1620 */ 578, 575, 572, 1859, 457, 460, 1053, 461, 1809, 1509,
- /* 1630 */ 463, 465, 467, 1606, 464, 469, 1841, 1168, 1605, 97,
- /* 1640 */ 96, 1810, 584, 1812, 1813, 580, 1809, 575, 468, 1169,
- /* 1650 */ 1887, 1094, 1093, 638, 640, 1884, 1827, 1090, 197, 50,
- /* 1660 */ 1089, 1088, 1534, 319, 582, 1529, 320, 490, 1527, 1779,
- /* 1670 */ 321, 581, 493, 1508, 1827, 1507, 1506, 495, 497, 499,
- /* 1680 */ 1753, 1254, 582, 56, 1747, 506, 215, 1779, 144, 581,
- /* 1690 */ 1735, 1733, 1734, 1732, 1841, 1731, 1809, 15, 289, 1810,
- /* 1700 */ 584, 1812, 1813, 580, 1262, 575, 220, 519, 1729, 1721,
- /* 1710 */ 80, 45, 1841, 226, 87, 41, 149, 1810, 584, 1812,
- /* 1720 */ 1813, 580, 1809, 575, 1827, 231, 79, 82, 23, 47,
- /* 1730 */ 16, 241, 579, 507, 17, 522, 549, 1779, 512, 581,
- /* 1740 */ 322, 1462, 1450, 233, 242, 235, 1809, 1432, 237, 1800,
- /* 1750 */ 1827, 1434, 151, 240, 25, 339, 228, 1427, 582, 24,
- /* 1760 */ 251, 1968, 1841, 1779, 46, 581, 293, 1810, 584, 1812,
- /* 1770 */ 1813, 580, 1799, 575, 1827, 1860, 1407, 86, 154, 341,
- /* 1780 */ 1406, 18, 582, 1461, 333, 1466, 1465, 1779, 1841, 581,
- /* 1790 */ 1467, 334, 294, 1810, 584, 1812, 1813, 580, 1456, 575,
- /* 1800 */ 10, 1294, 19, 1369, 1809, 1844, 155, 168, 1344, 574,
- /* 1810 */ 1324, 1342, 1841, 1341, 31, 13, 294, 1810, 584, 1812,
- /* 1820 */ 1813, 580, 12, 575, 1155, 20, 583, 21, 585, 587,
- /* 1830 */ 342, 589, 1827, 1152, 591, 592, 594, 1149, 595, 597,
- /* 1840 */ 582, 600, 1132, 1147, 598, 1779, 1143, 581, 1141, 601,
- /* 1850 */ 1146, 1164, 1145, 1144, 88, 1809, 89, 62, 607, 1160,
- /* 1860 */ 262, 1085, 1051, 616, 1084, 1809, 1083, 1082, 1081, 1080,
- /* 1870 */ 1841, 1078, 628, 1076, 279, 1810, 584, 1812, 1813, 580,
- /* 1880 */ 1075, 575, 1074, 1827, 1072, 263, 1101, 1071, 1070, 1069,
- /* 1890 */ 1068, 582, 1067, 1827, 1066, 1098, 1779, 1096, 581, 1063,
- /* 1900 */ 1062, 582, 1059, 1057, 1058, 1056, 1779, 1541, 581, 648,
- /* 1910 */ 649, 650, 1539, 652, 654, 1537, 658, 656, 1809, 1535,
- /* 1920 */ 653, 1841, 660, 657, 662, 280, 1810, 584, 1812, 1813,
- /* 1930 */ 580, 1841, 575, 661, 1809, 281, 1810, 584, 1812, 1813,
- /* 1940 */ 580, 1523, 575, 664, 1013, 1505, 1827, 266, 668, 1480,
- /* 1950 */ 1280, 274, 671, 672, 582, 1480, 1480, 1480, 1809, 1779,
- /* 1960 */ 1480, 581, 1827, 1480, 1480, 1480, 1480, 1480, 1480, 1480,
- /* 1970 */ 582, 1480, 1480, 1480, 1480, 1779, 1480, 581, 1480, 1480,
- /* 1980 */ 1480, 1480, 1480, 1480, 1841, 1480, 1827, 1480, 288, 1810,
- /* 1990 */ 584, 1812, 1813, 580, 582, 575, 1480, 1480, 1480, 1779,
- /* 2000 */ 1841, 581, 1480, 1480, 290, 1810, 584, 1812, 1813, 580,
- /* 2010 */ 1809, 575, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480,
- /* 2020 */ 1480, 1480, 1480, 1480, 1841, 1480, 1480, 1480, 282, 1810,
- /* 2030 */ 584, 1812, 1813, 580, 1809, 575, 1480, 1480, 1827, 1480,
- /* 2040 */ 1480, 1480, 1480, 1480, 1480, 1480, 582, 1480, 1480, 1480,
- /* 2050 */ 1480, 1779, 1480, 581, 1480, 1480, 1480, 1480, 1809, 1480,
- /* 2060 */ 1480, 1480, 1827, 1480, 1480, 1480, 1480, 1480, 1480, 1480,
- /* 2070 */ 582, 1480, 1480, 1480, 1809, 1779, 1841, 581, 1480, 1480,
- /* 2080 */ 291, 1810, 584, 1812, 1813, 580, 1827, 575, 1480, 1480,
- /* 2090 */ 1480, 1480, 1480, 1480, 582, 1480, 1480, 1480, 1480, 1779,
- /* 2100 */ 1841, 581, 1827, 1480, 283, 1810, 584, 1812, 1813, 580,
- /* 2110 */ 582, 575, 1480, 1480, 1480, 1779, 1480, 581, 1480, 1480,
- /* 2120 */ 1480, 1480, 1480, 1480, 1841, 1480, 1480, 1480, 292, 1810,
- /* 2130 */ 584, 1812, 1813, 580, 1480, 575, 1480, 1480, 1480, 1480,
- /* 2140 */ 1841, 1480, 1480, 1480, 284, 1810, 584, 1812, 1813, 580,
- /* 2150 */ 1480, 575, 1809, 1480, 1480, 1480, 1480, 1480, 1480, 1480,
- /* 2160 */ 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480,
- /* 2170 */ 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 1480,
- /* 2180 */ 1827, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 582, 1480,
- /* 2190 */ 1480, 1480, 1480, 1779, 1480, 581, 1480, 1480, 1480, 1480,
- /* 2200 */ 1480, 1480, 1480, 1809, 1480, 1480, 1480, 1480, 1480, 1480,
- /* 2210 */ 1480, 1480, 1480, 1809, 1480, 1480, 1480, 1480, 1841, 1480,
- /* 2220 */ 1480, 1480, 297, 1810, 584, 1812, 1813, 580, 1480, 575,
- /* 2230 */ 1480, 1827, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 582,
- /* 2240 */ 1480, 1827, 1480, 1480, 1779, 1480, 581, 1480, 1480, 582,
- /* 2250 */ 1480, 1480, 1480, 1480, 1779, 1480, 581, 1480, 1480, 1480,
- /* 2260 */ 1480, 1480, 1480, 1480, 1480, 1480, 1809, 1480, 1480, 1841,
- /* 2270 */ 1480, 1480, 1480, 298, 1810, 584, 1812, 1813, 580, 1841,
- /* 2280 */ 575, 1480, 1809, 1821, 1810, 584, 1812, 1813, 580, 1480,
- /* 2290 */ 575, 1480, 1480, 1480, 1827, 1480, 1480, 1480, 1480, 1480,
- /* 2300 */ 1480, 1480, 582, 1480, 1480, 1480, 1809, 1779, 1480, 581,
- /* 2310 */ 1827, 1480, 1480, 1480, 1480, 1480, 1480, 1480, 582, 1480,
- /* 2320 */ 1480, 1480, 1809, 1779, 1480, 581, 1480, 1480, 1480, 1480,
- /* 2330 */ 1480, 1480, 1841, 1480, 1827, 1480, 1820, 1810, 584, 1812,
- /* 2340 */ 1813, 580, 582, 575, 1480, 1480, 1809, 1779, 1841, 581,
- /* 2350 */ 1827, 1480, 1819, 1810, 584, 1812, 1813, 580, 582, 575,
- /* 2360 */ 1480, 1480, 1480, 1779, 1480, 581, 1480, 1480, 1480, 1480,
- /* 2370 */ 1809, 1480, 1841, 1480, 1827, 1480, 310, 1810, 584, 1812,
- /* 2380 */ 1813, 580, 582, 575, 1480, 1480, 1809, 1779, 1841, 581,
- /* 2390 */ 1480, 1480, 309, 1810, 584, 1812, 1813, 580, 1827, 575,
- /* 2400 */ 1480, 1480, 1480, 1480, 1480, 1480, 582, 1480, 1480, 1480,
- /* 2410 */ 1480, 1779, 1841, 581, 1827, 1480, 311, 1810, 584, 1812,
- /* 2420 */ 1813, 580, 582, 575, 1480, 1480, 1480, 1779, 1480, 581,
- /* 2430 */ 1480, 1480, 1480, 1480, 1480, 1480, 1841, 1480, 1480, 1480,
- /* 2440 */ 308, 1810, 584, 1812, 1813, 580, 1480, 575, 1480, 1480,
- /* 2450 */ 1480, 1480, 1841, 1480, 1480, 1480, 287, 1810, 584, 1812,
- /* 2460 */ 1813, 580, 1480, 575,
+ /* 0 */ 436, 1813, 437, 1519, 444, 345, 437, 1519, 1674, 1676,
+ /* 10 */ 33, 32, 39, 37, 40, 38, 36, 35, 34, 1620,
+ /* 20 */ 340, 530, 1281, 1801, 40, 38, 36, 35, 34, 1831,
+ /* 30 */ 1797, 1681, 117, 1357, 1797, 1279, 1770, 582, 312, 474,
+ /* 40 */ 30, 260, 1783, 1525, 581, 385, 148, 1679, 1496, 1629,
+ /* 50 */ 1035, 1813, 1034, 1801, 1793, 1799, 1352, 558, 1793, 1799,
+ /* 60 */ 329, 14, 1675, 1676, 1797, 472, 575, 1845, 1287, 1546,
+ /* 70 */ 575, 94, 1814, 584, 1816, 1817, 580, 1485, 575, 1831,
+ /* 80 */ 1036, 1891, 303, 362, 1802, 306, 1887, 582, 1793, 1799,
+ /* 90 */ 335, 666, 1783, 1, 581, 1797, 1451, 1957, 107, 1957,
+ /* 100 */ 575, 106, 105, 104, 103, 102, 101, 100, 99, 98,
+ /* 110 */ 166, 1681, 165, 1307, 1954, 671, 1954, 1845, 328, 1793,
+ /* 120 */ 1799, 149, 1814, 584, 1816, 1817, 580, 1679, 575, 1359,
+ /* 130 */ 1360, 575, 648, 647, 646, 645, 350, 1607, 644, 643,
+ /* 140 */ 128, 638, 637, 636, 635, 634, 633, 632, 631, 139,
+ /* 150 */ 627, 626, 625, 349, 348, 622, 621, 620, 619, 618,
+ /* 160 */ 36, 35, 34, 33, 32, 559, 1971, 40, 38, 36,
+ /* 170 */ 35, 34, 556, 556, 1306, 1282, 556, 1280, 1136, 606,
+ /* 180 */ 605, 604, 1140, 603, 1142, 1143, 602, 1145, 599, 63,
+ /* 190 */ 1151, 596, 1153, 1154, 593, 590, 453, 453, 1285, 1286,
+ /* 200 */ 553, 1334, 1335, 1337, 1338, 1339, 1340, 1341, 1342, 577,
+ /* 210 */ 573, 1350, 1351, 1353, 1354, 1355, 1356, 1358, 1361, 39,
+ /* 220 */ 37, 1420, 1178, 1179, 1307, 1831, 500, 340, 127, 1281,
+ /* 230 */ 33, 32, 167, 546, 40, 38, 36, 35, 34, 498,
+ /* 240 */ 1357, 496, 1279, 486, 485, 43, 42, 63, 558, 107,
+ /* 250 */ 123, 379, 106, 105, 104, 103, 102, 101, 100, 99,
+ /* 260 */ 98, 481, 484, 1352, 491, 22, 125, 480, 14, 545,
+ /* 270 */ 378, 84, 377, 1018, 1813, 1287, 39, 37, 530, 501,
+ /* 280 */ 1417, 250, 1899, 552, 340, 551, 1281, 478, 1957, 117,
+ /* 290 */ 1813, 1957, 1622, 209, 7, 327, 479, 1357, 1507, 1279,
+ /* 300 */ 2, 166, 1831, 146, 164, 1954, 1629, 494, 1954, 477,
+ /* 310 */ 582, 488, 1631, 1022, 1023, 1783, 208, 581, 1831, 150,
+ /* 320 */ 1352, 1957, 671, 1588, 435, 14, 579, 439, 167, 1441,
+ /* 330 */ 558, 1783, 1287, 581, 1956, 422, 1359, 1360, 1954, 1783,
+ /* 340 */ 1845, 135, 173, 517, 94, 1814, 584, 1816, 1817, 580,
+ /* 350 */ 326, 575, 58, 1729, 1891, 57, 1845, 2, 306, 1887,
+ /* 360 */ 293, 1814, 584, 1816, 1817, 580, 578, 575, 572, 1863,
+ /* 370 */ 1957, 1484, 539, 1439, 1440, 1442, 1443, 222, 71, 671,
+ /* 380 */ 146, 70, 1282, 164, 1280, 167, 167, 1954, 1506, 1632,
+ /* 390 */ 177, 176, 54, 1359, 1360, 116, 115, 114, 113, 112,
+ /* 400 */ 111, 110, 109, 108, 63, 1285, 1286, 1098, 1334, 1335,
+ /* 410 */ 1337, 1338, 1339, 1340, 1341, 1342, 577, 573, 1350, 1351,
+ /* 420 */ 1353, 1354, 1355, 1356, 1358, 1361, 33, 32, 1681, 1783,
+ /* 430 */ 40, 38, 36, 35, 34, 344, 26, 1261, 1262, 1282,
+ /* 440 */ 1100, 1280, 33, 32, 1679, 28, 40, 38, 36, 35,
+ /* 450 */ 34, 33, 32, 217, 562, 40, 38, 36, 35, 34,
+ /* 460 */ 1813, 317, 1285, 1286, 542, 1334, 1335, 1337, 1338, 1339,
+ /* 470 */ 1340, 1341, 1342, 577, 573, 1350, 1351, 1353, 1354, 1355,
+ /* 480 */ 1356, 1358, 1361, 39, 37, 302, 1413, 1304, 1831, 530,
+ /* 490 */ 63, 340, 78, 1281, 415, 210, 557, 427, 223, 224,
+ /* 500 */ 55, 1783, 1957, 581, 1357, 1308, 1279, 441, 516, 1416,
+ /* 510 */ 353, 1957, 1431, 1304, 400, 165, 428, 1629, 402, 1954,
+ /* 520 */ 318, 49, 316, 315, 1955, 476, 1845, 1352, 1954, 478,
+ /* 530 */ 95, 1814, 584, 1816, 1817, 580, 1722, 575, 1306, 1287,
+ /* 540 */ 1891, 548, 543, 167, 331, 1887, 159, 172, 1957, 1281,
+ /* 550 */ 1957, 477, 76, 305, 674, 64, 520, 305, 163, 393,
+ /* 560 */ 520, 164, 1279, 164, 8, 1954, 1917, 1954, 267, 553,
+ /* 570 */ 547, 389, 158, 33, 32, 343, 346, 40, 38, 36,
+ /* 580 */ 35, 34, 156, 146, 146, 1668, 671, 664, 660, 656,
+ /* 590 */ 652, 265, 1631, 1631, 1482, 1287, 1035, 127, 1034, 426,
+ /* 600 */ 1359, 1360, 421, 420, 419, 418, 417, 414, 413, 412,
+ /* 610 */ 411, 410, 406, 405, 404, 403, 397, 396, 395, 394,
+ /* 620 */ 1505, 391, 390, 314, 617, 1424, 1036, 92, 1367, 167,
+ /* 630 */ 230, 1306, 33, 32, 1306, 125, 40, 38, 36, 35,
+ /* 640 */ 34, 1305, 671, 1381, 63, 615, 1282, 252, 1280, 555,
+ /* 650 */ 160, 1899, 1900, 355, 1904, 352, 11, 10, 483, 482,
+ /* 660 */ 167, 1783, 563, 527, 137, 136, 612, 611, 610, 1285,
+ /* 670 */ 1286, 1732, 1334, 1335, 1337, 1338, 1339, 1340, 1341, 1342,
+ /* 680 */ 577, 573, 1350, 1351, 1353, 1354, 1355, 1356, 1358, 1361,
+ /* 690 */ 39, 37, 1362, 1957, 1287, 1957, 219, 502, 340, 374,
+ /* 700 */ 1281, 74, 1282, 167, 1280, 27, 164, 74, 164, 91,
+ /* 710 */ 1954, 1357, 1954, 1279, 1255, 1386, 212, 1504, 376, 372,
+ /* 720 */ 122, 1605, 124, 1625, 1813, 1285, 1286, 1722, 1503, 1624,
+ /* 730 */ 1621, 1502, 1477, 530, 1352, 33, 32, 1957, 175, 40,
+ /* 740 */ 38, 36, 35, 34, 169, 530, 1287, 39, 37, 1393,
+ /* 750 */ 164, 530, 1831, 1549, 1954, 340, 383, 1281, 1783, 1501,
+ /* 760 */ 582, 1629, 384, 443, 553, 1783, 439, 581, 1357, 1783,
+ /* 770 */ 1279, 9, 1783, 1629, 530, 642, 640, 517, 530, 1629,
+ /* 780 */ 558, 617, 61, 167, 1306, 392, 145, 1730, 1500, 407,
+ /* 790 */ 1845, 1352, 127, 671, 285, 1814, 584, 1816, 1817, 580,
+ /* 800 */ 1783, 575, 1629, 1287, 337, 336, 1629, 1359, 1360, 609,
+ /* 810 */ 1499, 530, 530, 1336, 1295, 530, 1336, 486, 485, 1476,
+ /* 820 */ 1957, 1319, 408, 451, 123, 1357, 452, 1288, 9, 1783,
+ /* 830 */ 125, 530, 1498, 166, 1495, 481, 484, 1954, 629, 1629,
+ /* 840 */ 1629, 480, 1626, 1629, 1309, 161, 1899, 1900, 1352, 1904,
+ /* 850 */ 671, 1783, 1728, 1282, 300, 1280, 630, 1618, 1601, 1629,
+ /* 860 */ 1287, 90, 33, 32, 1359, 1360, 40, 38, 36, 35,
+ /* 870 */ 34, 87, 1727, 1783, 300, 1783, 1285, 1286, 1494, 1334,
+ /* 880 */ 1335, 1337, 1338, 1339, 1340, 1341, 1342, 577, 573, 1350,
+ /* 890 */ 1351, 1353, 1354, 1355, 1356, 1358, 1361, 530, 530, 553,
+ /* 900 */ 530, 201, 530, 530, 199, 1906, 509, 570, 347, 503,
+ /* 910 */ 1282, 510, 1280, 514, 227, 307, 1614, 1493, 613, 1783,
+ /* 920 */ 1492, 1672, 1491, 1022, 1023, 1629, 1629, 127, 1629, 1903,
+ /* 930 */ 1629, 1629, 1490, 1285, 1286, 1489, 1334, 1335, 1337, 1338,
+ /* 940 */ 1339, 1340, 1341, 1342, 577, 573, 1350, 1351, 1353, 1354,
+ /* 950 */ 1355, 1356, 1358, 1361, 39, 37, 1379, 530, 1783, 530,
+ /* 960 */ 1616, 1783, 340, 1783, 1281, 125, 1336, 1296, 526, 1291,
+ /* 970 */ 528, 1911, 1413, 1783, 196, 1357, 1783, 1279, 1488, 1487,
+ /* 980 */ 162, 1899, 1900, 1606, 1904, 1629, 232, 1629, 152, 1813,
+ /* 990 */ 1299, 1301, 1906, 470, 466, 462, 458, 195, 1352, 1681,
+ /* 1000 */ 44, 4, 573, 1350, 1351, 1353, 1354, 1355, 1356, 1604,
+ /* 1010 */ 1287, 1380, 530, 530, 386, 1680, 1902, 1831, 614, 1783,
+ /* 1020 */ 1783, 1672, 324, 529, 261, 582, 1906, 387, 560, 147,
+ /* 1030 */ 1783, 565, 581, 75, 278, 2, 193, 571, 33, 32,
+ /* 1040 */ 1629, 1629, 40, 38, 36, 35, 34, 41, 276, 60,
+ /* 1050 */ 1901, 272, 59, 203, 1659, 1845, 202, 671, 216, 294,
+ /* 1060 */ 1814, 584, 1816, 1817, 580, 221, 575, 131, 180, 432,
+ /* 1070 */ 430, 1359, 1360, 29, 338, 1374, 1375, 1376, 1377, 1378,
+ /* 1080 */ 1382, 1383, 1384, 1385, 205, 1290, 207, 204, 615, 206,
+ /* 1090 */ 1536, 307, 53, 513, 11, 10, 1289, 77, 1232, 192,
+ /* 1100 */ 186, 1531, 191, 1529, 63, 1589, 449, 137, 136, 612,
+ /* 1110 */ 611, 610, 487, 134, 615, 135, 225, 1282, 523, 1280,
+ /* 1120 */ 51, 236, 184, 489, 1319, 492, 1479, 1480, 1804, 1612,
+ /* 1130 */ 51, 41, 1379, 137, 136, 612, 611, 610, 41, 588,
+ /* 1140 */ 1285, 1286, 93, 1334, 1335, 1337, 1338, 1339, 1340, 1341,
+ /* 1150 */ 1342, 577, 573, 1350, 1351, 1353, 1354, 1355, 1356, 1358,
+ /* 1160 */ 1361, 134, 135, 119, 229, 134, 1129, 1062, 213, 623,
+ /* 1170 */ 624, 1438, 239, 576, 1371, 1806, 608, 1497, 68, 67,
+ /* 1180 */ 382, 1387, 1343, 171, 255, 540, 471, 1380, 244, 271,
+ /* 1190 */ 1157, 1082, 1080, 1832, 1813, 351, 1520, 1669, 1921, 301,
+ /* 1200 */ 1063, 554, 370, 254, 368, 364, 360, 357, 354, 249,
+ /* 1210 */ 3, 257, 1161, 1168, 1166, 259, 138, 356, 5, 361,
+ /* 1220 */ 1248, 313, 1831, 174, 1304, 268, 388, 1293, 409, 1724,
+ /* 1230 */ 557, 416, 424, 423, 425, 1783, 429, 581, 1292, 431,
+ /* 1240 */ 433, 566, 1310, 167, 1312, 434, 442, 1813, 183, 29,
+ /* 1250 */ 338, 1374, 1375, 1376, 1377, 1378, 1382, 1383, 1384, 1385,
+ /* 1260 */ 1845, 445, 446, 185, 95, 1814, 584, 1816, 1817, 580,
+ /* 1270 */ 1311, 575, 447, 1313, 1891, 1831, 188, 450, 331, 1887,
+ /* 1280 */ 159, 448, 473, 582, 190, 72, 73, 1813, 1783, 454,
+ /* 1290 */ 581, 194, 269, 475, 1619, 198, 304, 1615, 118, 200,
+ /* 1300 */ 1918, 1763, 211, 140, 141, 1617, 1613, 504, 214, 505,
+ /* 1310 */ 142, 1813, 143, 1845, 511, 1831, 515, 95, 1814, 584,
+ /* 1320 */ 1816, 1817, 580, 582, 575, 218, 508, 1891, 1783, 524,
+ /* 1330 */ 581, 331, 1887, 1970, 518, 81, 538, 132, 1762, 1831,
+ /* 1340 */ 323, 83, 1925, 1734, 521, 1309, 270, 582, 325, 1630,
+ /* 1350 */ 541, 1813, 1783, 1845, 581, 6, 133, 279, 1814, 584,
+ /* 1360 */ 1816, 1817, 580, 1932, 575, 534, 525, 536, 537, 234,
+ /* 1370 */ 238, 330, 550, 544, 535, 533, 532, 1845, 1413, 1831,
+ /* 1380 */ 126, 95, 1814, 584, 1816, 1817, 580, 582, 575, 1922,
+ /* 1390 */ 245, 1891, 1783, 1931, 581, 331, 1887, 1970, 567, 1308,
+ /* 1400 */ 564, 248, 48, 332, 1813, 85, 1948, 1907, 586, 1673,
+ /* 1410 */ 1602, 273, 667, 52, 668, 1913, 243, 1845, 670, 299,
+ /* 1420 */ 264, 95, 1814, 584, 1816, 1817, 580, 277, 575, 246,
+ /* 1430 */ 153, 1891, 1831, 1872, 247, 331, 1887, 1970, 275, 286,
+ /* 1440 */ 582, 296, 295, 1777, 253, 1783, 1910, 581, 1776, 1775,
+ /* 1450 */ 1953, 65, 1774, 561, 1813, 568, 256, 1973, 258, 66,
+ /* 1460 */ 558, 1771, 358, 359, 1273, 1274, 170, 363, 1769, 365,
+ /* 1470 */ 1845, 1813, 366, 367, 285, 1814, 584, 1816, 1817, 580,
+ /* 1480 */ 1768, 575, 1831, 369, 1767, 371, 1766, 373, 1765, 375,
+ /* 1490 */ 582, 1251, 1250, 1745, 1744, 1783, 381, 581, 380, 1831,
+ /* 1500 */ 1957, 1743, 1742, 1220, 1717, 1716, 1715, 582, 129, 1714,
+ /* 1510 */ 1713, 1712, 1783, 164, 581, 69, 1711, 1954, 1710, 1709,
+ /* 1520 */ 1845, 1813, 398, 1706, 96, 1814, 584, 1816, 1817, 580,
+ /* 1530 */ 1708, 575, 1707, 399, 1891, 401, 1705, 1845, 1890, 1887,
+ /* 1540 */ 1704, 96, 1814, 584, 1816, 1817, 580, 1703, 575, 1831,
+ /* 1550 */ 1702, 1891, 1701, 1700, 1699, 569, 1887, 582, 1698, 1697,
+ /* 1560 */ 1696, 1695, 1783, 1694, 581, 1693, 1692, 130, 1691, 1813,
+ /* 1570 */ 1690, 1689, 1688, 1687, 1686, 1685, 1684, 1222, 1683, 1813,
+ /* 1580 */ 178, 1550, 179, 1548, 1516, 181, 182, 1845, 1682, 1551,
+ /* 1590 */ 120, 96, 1814, 584, 1816, 1817, 580, 1831, 575, 157,
+ /* 1600 */ 1025, 1891, 531, 438, 1024, 582, 1888, 1831, 440, 1515,
+ /* 1610 */ 1783, 1758, 581, 1752, 1741, 582, 121, 189, 187, 1740,
+ /* 1620 */ 1783, 1726, 581, 1608, 1547, 1545, 1055, 1543, 455, 456,
+ /* 1630 */ 1813, 459, 460, 457, 461, 1845, 1541, 463, 464, 294,
+ /* 1640 */ 1814, 584, 1816, 1817, 580, 1845, 575, 465, 1539, 289,
+ /* 1650 */ 1814, 584, 1816, 1817, 580, 467, 575, 468, 1831, 1171,
+ /* 1660 */ 1609, 469, 1528, 1527, 1512, 1610, 582, 1172, 1097, 50,
+ /* 1670 */ 1096, 1783, 639, 581, 641, 1093, 1092, 1091, 1537, 319,
+ /* 1680 */ 1532, 1530, 493, 320, 1511, 495, 1510, 549, 490, 321,
+ /* 1690 */ 1813, 497, 1509, 499, 97, 1757, 1845, 197, 1751, 56,
+ /* 1700 */ 149, 1814, 584, 1816, 1817, 580, 144, 575, 1813, 506,
+ /* 1710 */ 1257, 507, 1739, 1737, 1738, 1736, 1735, 1265, 1831, 15,
+ /* 1720 */ 519, 1733, 220, 226, 1725, 231, 579, 79, 215, 80,
+ /* 1730 */ 45, 1783, 41, 581, 47, 82, 1831, 23, 233, 16,
+ /* 1740 */ 1453, 339, 241, 235, 582, 1972, 87, 522, 1435, 1783,
+ /* 1750 */ 242, 581, 1437, 1804, 25, 1465, 1845, 228, 1813, 237,
+ /* 1760 */ 293, 1814, 584, 1816, 1817, 580, 322, 575, 251, 1864,
+ /* 1770 */ 512, 1430, 46, 1803, 1845, 17, 151, 154, 294, 1814,
+ /* 1780 */ 584, 1816, 1817, 580, 1813, 575, 1831, 240, 18, 24,
+ /* 1790 */ 86, 341, 1464, 333, 582, 1410, 1409, 1470, 1469, 1783,
+ /* 1800 */ 1459, 581, 1468, 334, 10, 1297, 155, 19, 1813, 1327,
+ /* 1810 */ 1372, 1848, 1831, 587, 585, 168, 583, 1347, 574, 31,
+ /* 1820 */ 582, 342, 1345, 12, 1845, 1783, 1344, 581, 294, 1814,
+ /* 1830 */ 584, 1816, 1817, 580, 1813, 575, 1831, 13, 1158, 20,
+ /* 1840 */ 21, 589, 591, 1155, 582, 592, 594, 1152, 595, 1783,
+ /* 1850 */ 1845, 581, 597, 600, 280, 1814, 584, 1816, 1817, 580,
+ /* 1860 */ 1146, 575, 1831, 598, 1135, 1144, 601, 1150, 1149, 88,
+ /* 1870 */ 582, 1148, 1167, 1147, 1845, 1783, 262, 581, 281, 1814,
+ /* 1880 */ 584, 1816, 1817, 580, 607, 575, 89, 62, 1163, 1053,
+ /* 1890 */ 616, 1088, 1813, 1087, 1086, 1085, 1084, 1083, 1081, 1079,
+ /* 1900 */ 1845, 628, 1078, 1077, 288, 1814, 584, 1816, 1817, 580,
+ /* 1910 */ 1813, 575, 553, 1104, 263, 1075, 1074, 1073, 1072, 1071,
+ /* 1920 */ 1831, 1070, 1069, 1068, 1099, 1101, 1065, 1064, 582, 1061,
+ /* 1930 */ 1059, 1060, 1544, 1783, 1058, 581, 649, 650, 1831, 651,
+ /* 1940 */ 127, 1542, 653, 655, 1540, 654, 582, 657, 659, 658,
+ /* 1950 */ 1538, 1783, 661, 581, 663, 1526, 1508, 662, 1845, 665,
+ /* 1960 */ 558, 1015, 290, 1814, 584, 1816, 1817, 580, 266, 575,
+ /* 1970 */ 669, 1813, 1483, 1283, 274, 672, 1845, 673, 125, 1483,
+ /* 1980 */ 282, 1814, 584, 1816, 1817, 580, 1483, 575, 1483, 1483,
+ /* 1990 */ 1483, 1483, 1483, 250, 1899, 552, 1483, 551, 1483, 1831,
+ /* 2000 */ 1957, 1483, 1483, 1483, 1483, 1483, 1483, 582, 1483, 1483,
+ /* 2010 */ 1483, 1483, 1783, 164, 581, 1483, 1483, 1954, 1483, 1483,
+ /* 2020 */ 1483, 1813, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2030 */ 1483, 1813, 1483, 1483, 1483, 1483, 1483, 1845, 1483, 1483,
+ /* 2040 */ 1483, 291, 1814, 584, 1816, 1817, 580, 1483, 575, 1831,
+ /* 2050 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 582, 1483, 1831,
+ /* 2060 */ 1483, 1483, 1783, 1483, 581, 1483, 1483, 582, 1483, 1483,
+ /* 2070 */ 1483, 1813, 1783, 1483, 581, 1483, 1483, 1483, 1483, 1483,
+ /* 2080 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1845, 1483, 1483,
+ /* 2090 */ 1483, 283, 1814, 584, 1816, 1817, 580, 1845, 575, 1831,
+ /* 2100 */ 1483, 292, 1814, 584, 1816, 1817, 580, 582, 575, 1483,
+ /* 2110 */ 1483, 1483, 1783, 1483, 581, 1483, 1483, 1483, 1483, 1483,
+ /* 2120 */ 1483, 1813, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2130 */ 1483, 1483, 1483, 1813, 1483, 1483, 1483, 1845, 1483, 1483,
+ /* 2140 */ 1483, 284, 1814, 584, 1816, 1817, 580, 1813, 575, 1831,
+ /* 2150 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 582, 1483, 1483,
+ /* 2160 */ 1483, 1831, 1783, 1483, 581, 1483, 1483, 1483, 1483, 582,
+ /* 2170 */ 1483, 1483, 1483, 1483, 1783, 1831, 581, 1483, 1483, 1483,
+ /* 2180 */ 1483, 1483, 1483, 582, 1483, 1483, 1483, 1845, 1783, 1483,
+ /* 2190 */ 581, 297, 1814, 584, 1816, 1817, 580, 1483, 575, 1845,
+ /* 2200 */ 1483, 1483, 1483, 298, 1814, 584, 1816, 1817, 580, 1483,
+ /* 2210 */ 575, 1483, 1483, 1845, 1483, 1483, 1483, 1825, 1814, 584,
+ /* 2220 */ 1816, 1817, 580, 1813, 575, 1483, 1483, 1483, 1483, 1483,
+ /* 2230 */ 1483, 1483, 1483, 1813, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2240 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2250 */ 1483, 1831, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 582,
+ /* 2260 */ 1483, 1831, 1483, 1483, 1783, 1483, 581, 1483, 1483, 582,
+ /* 2270 */ 1483, 1483, 1483, 1483, 1783, 1483, 581, 1483, 1483, 1483,
+ /* 2280 */ 1483, 1483, 1483, 1483, 1813, 1483, 1483, 1483, 1483, 1845,
+ /* 2290 */ 1483, 1483, 1483, 1824, 1814, 584, 1816, 1817, 580, 1845,
+ /* 2300 */ 575, 1483, 1483, 1823, 1814, 584, 1816, 1817, 580, 1483,
+ /* 2310 */ 575, 1483, 1831, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2320 */ 582, 1483, 1483, 1483, 1483, 1783, 1483, 581, 1483, 1483,
+ /* 2330 */ 1483, 1483, 1483, 1483, 1813, 1483, 1483, 1483, 1483, 1483,
+ /* 2340 */ 1483, 1483, 1483, 1483, 1813, 1483, 1483, 1483, 1483, 1483,
+ /* 2350 */ 1845, 1483, 1483, 1483, 310, 1814, 584, 1816, 1817, 580,
+ /* 2360 */ 1483, 575, 1831, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2370 */ 582, 1483, 1831, 1483, 1483, 1783, 1483, 581, 1483, 1483,
+ /* 2380 */ 582, 1483, 1483, 1483, 1813, 1783, 1483, 581, 1483, 1483,
+ /* 2390 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2400 */ 1845, 1483, 1483, 1483, 309, 1814, 584, 1816, 1817, 580,
+ /* 2410 */ 1845, 575, 1831, 1483, 311, 1814, 584, 1816, 1817, 580,
+ /* 2420 */ 582, 575, 1483, 1483, 1483, 1783, 1483, 581, 1483, 1483,
+ /* 2430 */ 1483, 1483, 1483, 1483, 1813, 1483, 1483, 1483, 1483, 1483,
+ /* 2440 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2450 */ 1845, 1483, 1483, 1483, 308, 1814, 584, 1816, 1817, 580,
+ /* 2460 */ 1483, 575, 1831, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2470 */ 582, 1483, 1483, 1483, 1483, 1783, 1483, 581, 1483, 1483,
+ /* 2480 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2490 */ 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483,
+ /* 2500 */ 1845, 1483, 1483, 1483, 287, 1814, 584, 1816, 1817, 580,
+ /* 2510 */ 1483, 575,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 315, 367, 317, 318, 311, 321, 367, 315, 341, 317,
- /* 10 */ 318, 340, 12, 13, 319, 4, 392, 393, 334, 352,
- /* 20 */ 20, 407, 22, 8, 9, 4, 342, 12, 13, 14,
- /* 30 */ 15, 16, 339, 33, 420, 35, 319, 310, 424, 312,
- /* 40 */ 347, 407, 347, 376, 377, 352, 407, 354, 12, 13,
- /* 50 */ 14, 15, 16, 20, 420, 388, 56, 354, 424, 420,
- /* 60 */ 367, 61, 367, 424, 361, 44, 45, 364, 68, 0,
- /* 70 */ 377, 20, 323, 356, 381, 382, 383, 384, 385, 386,
- /* 80 */ 385, 388, 311, 56, 391, 336, 56, 350, 395, 396,
- /* 90 */ 353, 354, 92, 20, 345, 400, 401, 402, 92, 404,
- /* 100 */ 407, 21, 407, 92, 24, 25, 26, 27, 28, 29,
- /* 110 */ 30, 31, 32, 420, 114, 420, 60, 424, 91, 424,
- /* 120 */ 14, 94, 92, 352, 94, 92, 20, 20, 128, 129,
- /* 130 */ 1, 2, 63, 64, 65, 66, 67, 311, 69, 70,
+ /* 0 */ 316, 312, 318, 319, 316, 351, 318, 319, 354, 355,
+ /* 10 */ 8, 9, 12, 13, 12, 13, 14, 15, 16, 342,
+ /* 20 */ 20, 320, 22, 342, 12, 13, 14, 15, 16, 340,
+ /* 30 */ 353, 340, 331, 33, 353, 35, 0, 348, 347, 338,
+ /* 40 */ 393, 394, 353, 0, 355, 320, 311, 356, 313, 348,
+ /* 50 */ 20, 312, 22, 342, 377, 378, 56, 368, 377, 378,
+ /* 60 */ 379, 61, 354, 355, 353, 35, 389, 378, 68, 0,
+ /* 70 */ 389, 382, 383, 384, 385, 386, 387, 0, 389, 340,
+ /* 80 */ 50, 392, 357, 47, 342, 396, 397, 348, 377, 378,
+ /* 90 */ 379, 48, 353, 93, 355, 353, 94, 408, 21, 408,
+ /* 100 */ 389, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ /* 110 */ 421, 340, 421, 20, 425, 115, 425, 378, 347, 377,
+ /* 120 */ 378, 382, 383, 384, 385, 386, 387, 356, 389, 129,
+ /* 130 */ 130, 389, 63, 64, 65, 66, 67, 0, 69, 70,
/* 140 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- /* 150 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 319,
- /* 160 */ 21, 8, 9, 33, 0, 12, 13, 14, 15, 16,
- /* 170 */ 330, 123, 124, 34, 174, 36, 176, 47, 352, 128,
- /* 180 */ 129, 166, 52, 53, 54, 55, 56, 347, 24, 25,
- /* 190 */ 26, 27, 28, 29, 30, 31, 32, 197, 198, 92,
- /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 12, 13,
- /* 220 */ 14, 91, 93, 18, 94, 20, 20, 321, 22, 311,
- /* 230 */ 182, 231, 27, 185, 407, 30, 367, 231, 319, 33,
- /* 240 */ 159, 35, 231, 339, 341, 319, 93, 420, 342, 330,
- /* 250 */ 346, 424, 47, 339, 49, 352, 51, 339, 407, 355,
- /* 260 */ 346, 231, 56, 20, 231, 347, 347, 61, 253, 355,
- /* 270 */ 352, 420, 354, 347, 68, 424, 407, 8, 9, 376,
- /* 280 */ 377, 12, 13, 14, 15, 16, 341, 157, 158, 420,
- /* 290 */ 160, 388, 92, 424, 164, 377, 91, 352, 92, 381,
- /* 300 */ 382, 383, 384, 385, 386, 20, 388, 201, 103, 391,
- /* 310 */ 180, 385, 43, 395, 396, 397, 20, 236, 237, 338,
- /* 320 */ 114, 376, 377, 378, 406, 399, 400, 401, 402, 363,
- /* 330 */ 404, 365, 351, 388, 128, 129, 131, 308, 231, 134,
- /* 340 */ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
- /* 350 */ 145, 146, 147, 148, 149, 150, 151, 0, 153, 154,
- /* 360 */ 155, 379, 105, 106, 107, 108, 109, 110, 111, 112,
- /* 370 */ 113, 114, 115, 319, 117, 118, 119, 120, 121, 122,
- /* 380 */ 174, 331, 176, 37, 330, 403, 8, 9, 92, 339,
- /* 390 */ 12, 13, 14, 15, 16, 324, 367, 20, 348, 328,
- /* 400 */ 20, 347, 22, 197, 198, 48, 200, 201, 202, 203,
- /* 410 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
- /* 420 */ 214, 215, 216, 217, 12, 13, 311, 4, 353, 354,
- /* 430 */ 50, 231, 20, 363, 22, 365, 407, 20, 14, 15,
- /* 440 */ 16, 95, 19, 97, 98, 33, 100, 35, 339, 420,
- /* 450 */ 104, 20, 123, 424, 339, 346, 33, 0, 64, 65,
- /* 460 */ 14, 0, 347, 60, 355, 71, 20, 352, 56, 354,
- /* 470 */ 47, 93, 126, 61, 51, 81, 82, 2, 331, 56,
- /* 480 */ 68, 87, 367, 8, 9, 331, 339, 12, 13, 14,
- /* 490 */ 15, 16, 377, 339, 39, 348, 381, 382, 383, 384,
- /* 500 */ 385, 386, 348, 388, 92, 103, 391, 156, 319, 319,
- /* 510 */ 395, 396, 183, 184, 91, 316, 407, 94, 319, 311,
- /* 520 */ 330, 60, 407, 18, 339, 92, 114, 337, 23, 420,
- /* 530 */ 311, 311, 347, 424, 169, 420, 347, 347, 2, 424,
- /* 540 */ 128, 129, 37, 38, 8, 9, 41, 68, 12, 13,
- /* 550 */ 14, 15, 16, 188, 189, 12, 13, 311, 339, 319,
- /* 560 */ 352, 104, 57, 58, 59, 22, 347, 0, 383, 218,
- /* 570 */ 330, 352, 352, 354, 385, 354, 33, 337, 35, 228,
- /* 580 */ 123, 124, 125, 126, 127, 364, 174, 347, 176, 400,
- /* 590 */ 401, 402, 161, 404, 68, 311, 377, 92, 352, 56,
- /* 600 */ 381, 382, 383, 384, 385, 386, 173, 388, 175, 197,
- /* 610 */ 198, 68, 200, 201, 202, 203, 204, 205, 206, 207,
- /* 620 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
- /* 630 */ 12, 13, 379, 22, 311, 130, 352, 311, 20, 327,
- /* 640 */ 22, 329, 14, 0, 425, 426, 35, 201, 20, 340,
- /* 650 */ 20, 33, 22, 35, 8, 9, 403, 114, 12, 13,
- /* 660 */ 14, 15, 16, 0, 231, 35, 316, 367, 340, 319,
- /* 670 */ 311, 166, 167, 168, 56, 352, 171, 340, 352, 68,
- /* 680 */ 50, 124, 311, 8, 9, 230, 68, 12, 13, 14,
- /* 690 */ 15, 16, 187, 319, 311, 190, 323, 192, 193, 194,
- /* 700 */ 195, 196, 311, 60, 330, 44, 45, 407, 8, 9,
- /* 710 */ 92, 352, 12, 13, 14, 15, 16, 174, 345, 176,
- /* 720 */ 420, 347, 339, 352, 424, 114, 340, 64, 65, 311,
- /* 730 */ 347, 311, 114, 367, 71, 352, 231, 354, 181, 182,
- /* 740 */ 197, 198, 185, 352, 81, 82, 128, 129, 311, 35,
- /* 750 */ 87, 379, 209, 210, 211, 212, 213, 214, 215, 197,
- /* 760 */ 377, 61, 229, 230, 381, 382, 383, 384, 385, 386,
- /* 770 */ 352, 388, 352, 407, 391, 403, 104, 347, 395, 396,
- /* 780 */ 397, 4, 68, 325, 326, 174, 420, 176, 358, 352,
- /* 790 */ 424, 104, 174, 93, 176, 123, 124, 125, 126, 127,
- /* 800 */ 417, 101, 240, 241, 242, 243, 244, 161, 197, 198,
- /* 810 */ 311, 311, 311, 126, 311, 197, 198, 20, 200, 201,
- /* 820 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
- /* 830 */ 212, 213, 214, 215, 216, 217, 12, 13, 14, 339,
- /* 840 */ 0, 339, 77, 371, 20, 35, 22, 347, 311, 231,
- /* 850 */ 348, 352, 352, 352, 354, 352, 156, 33, 311, 35,
- /* 860 */ 339, 21, 347, 3, 24, 25, 26, 27, 28, 29,
- /* 870 */ 30, 31, 32, 358, 325, 326, 355, 377, 68, 20,
- /* 880 */ 56, 381, 382, 383, 384, 385, 386, 349, 388, 352,
- /* 890 */ 352, 391, 68, 42, 43, 395, 396, 132, 133, 352,
- /* 900 */ 349, 8, 9, 352, 341, 12, 13, 14, 15, 16,
- /* 910 */ 332, 43, 340, 335, 311, 352, 92, 0, 218, 219,
- /* 920 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 8,
- /* 930 */ 9, 311, 319, 12, 13, 14, 15, 16, 114, 376,
- /* 940 */ 377, 378, 339, 330, 43, 319, 340, 344, 0, 22,
- /* 950 */ 347, 388, 128, 129, 61, 352, 330, 354, 161, 339,
- /* 960 */ 347, 93, 35, 96, 47, 96, 99, 347, 99, 312,
- /* 970 */ 22, 319, 352, 347, 354, 161, 162, 1, 2, 319,
- /* 980 */ 377, 56, 330, 43, 381, 382, 383, 384, 385, 386,
- /* 990 */ 330, 388, 319, 96, 101, 0, 99, 377, 174, 347,
- /* 1000 */ 176, 381, 382, 383, 384, 385, 386, 347, 388, 232,
- /* 1010 */ 96, 391, 43, 99, 93, 395, 396, 22, 427, 94,
- /* 1020 */ 347, 197, 198, 0, 200, 201, 202, 203, 204, 205,
- /* 1030 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
- /* 1040 */ 216, 217, 12, 13, 319, 22, 43, 328, 319, 156,
- /* 1050 */ 20, 43, 22, 43, 19, 330, 319, 35, 385, 330,
- /* 1060 */ 201, 320, 93, 33, 311, 35, 35, 330, 33, 128,
- /* 1070 */ 129, 418, 347, 400, 401, 402, 347, 404, 61, 46,
- /* 1080 */ 13, 43, 47, 43, 347, 92, 56, 52, 53, 54,
- /* 1090 */ 55, 56, 339, 0, 414, 102, 93, 344, 68, 319,
- /* 1100 */ 347, 93, 35, 93, 311, 352, 43, 354, 248, 339,
- /* 1110 */ 330, 218, 219, 220, 221, 222, 223, 224, 225, 226,
- /* 1120 */ 227, 228, 92, 43, 13, 92, 91, 347, 320, 94,
- /* 1130 */ 377, 93, 339, 93, 381, 382, 383, 384, 385, 386,
- /* 1140 */ 347, 388, 351, 43, 114, 352, 35, 354, 318, 43,
- /* 1150 */ 43, 250, 319, 380, 319, 319, 93, 319, 128, 129,
- /* 1160 */ 405, 43, 127, 330, 398, 330, 330, 421, 330, 421,
- /* 1170 */ 377, 43, 421, 93, 381, 382, 383, 384, 385, 386,
- /* 1180 */ 347, 388, 347, 347, 391, 347, 408, 233, 395, 396,
- /* 1190 */ 397, 375, 252, 93, 47, 160, 374, 104, 176, 93,
- /* 1200 */ 93, 319, 409, 43, 174, 43, 176, 176, 172, 42,
- /* 1210 */ 417, 93, 330, 178, 197, 180, 123, 124, 125, 126,
- /* 1220 */ 127, 93, 369, 359, 20, 319, 319, 197, 198, 347,
- /* 1230 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- /* 1240 */ 210, 211, 212, 213, 214, 215, 216, 217, 12, 13,
- /* 1250 */ 311, 319, 319, 93, 359, 93, 20, 156, 22, 357,
- /* 1260 */ 357, 319, 330, 330, 319, 319, 20, 20, 313, 33,
- /* 1270 */ 313, 35, 373, 323, 354, 323, 20, 366, 339, 347,
- /* 1280 */ 347, 20, 323, 368, 366, 323, 347, 323, 323, 319,
- /* 1290 */ 323, 352, 56, 354, 313, 339, 319, 339, 313, 339,
- /* 1300 */ 339, 352, 339, 373, 68, 339, 179, 339, 321, 372,
- /* 1310 */ 311, 339, 339, 339, 339, 321, 377, 319, 321, 319,
- /* 1320 */ 381, 382, 383, 384, 385, 386, 319, 388, 92, 238,
- /* 1330 */ 391, 158, 354, 321, 395, 396, 397, 366, 339, 321,
- /* 1340 */ 352, 362, 352, 352, 352, 406, 347, 20, 362, 360,
- /* 1350 */ 114, 352, 347, 354, 347, 335, 352, 413, 352, 239,
- /* 1360 */ 380, 352, 245, 362, 128, 129, 352, 352, 352, 416,
- /* 1370 */ 165, 247, 246, 362, 367, 234, 377, 20, 230, 347,
- /* 1380 */ 381, 382, 383, 384, 385, 386, 251, 388, 249, 92,
- /* 1390 */ 391, 254, 385, 411, 395, 396, 397, 413, 415, 375,
- /* 1400 */ 379, 92, 343, 352, 329, 406, 410, 400, 401, 402,
- /* 1410 */ 174, 404, 176, 394, 407, 413, 319, 321, 36, 314,
- /* 1420 */ 370, 313, 365, 333, 322, 412, 311, 420, 333, 0,
- /* 1430 */ 309, 424, 333, 197, 198, 181, 200, 201, 202, 203,
- /* 1440 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
- /* 1450 */ 214, 215, 216, 217, 339, 428, 0, 423, 0, 422,
- /* 1460 */ 0, 422, 347, 42, 423, 423, 422, 352, 0, 354,
- /* 1470 */ 191, 35, 35, 35, 35, 191, 0, 35, 35, 191,
- /* 1480 */ 0, 191, 367, 0, 35, 0, 22, 311, 0, 35,
- /* 1490 */ 176, 0, 377, 174, 0, 170, 381, 382, 383, 384,
- /* 1500 */ 385, 386, 169, 388, 0, 0, 0, 46, 0, 0,
- /* 1510 */ 0, 42, 0, 0, 152, 339, 0, 0, 0, 0,
- /* 1520 */ 0, 147, 407, 347, 35, 0, 147, 0, 352, 0,
- /* 1530 */ 354, 0, 0, 0, 0, 420, 0, 0, 0, 424,
- /* 1540 */ 0, 0, 0, 367, 311, 0, 0, 0, 0, 42,
- /* 1550 */ 0, 0, 0, 377, 56, 0, 56, 381, 382, 383,
- /* 1560 */ 384, 385, 386, 0, 388, 22, 0, 0, 0, 0,
- /* 1570 */ 311, 0, 339, 0, 0, 14, 46, 42, 39, 14,
- /* 1580 */ 347, 0, 0, 407, 0, 352, 0, 354, 165, 0,
- /* 1590 */ 0, 0, 43, 0, 0, 39, 420, 40, 339, 46,
- /* 1600 */ 424, 39, 0, 0, 0, 35, 347, 47, 0, 0,
- /* 1610 */ 377, 352, 35, 354, 381, 382, 383, 384, 385, 386,
- /* 1620 */ 387, 388, 389, 390, 39, 47, 62, 39, 311, 0,
- /* 1630 */ 35, 39, 35, 0, 47, 39, 377, 22, 0, 20,
- /* 1640 */ 381, 382, 383, 384, 385, 386, 311, 388, 47, 35,
- /* 1650 */ 391, 35, 35, 43, 43, 396, 339, 35, 99, 101,
- /* 1660 */ 35, 22, 0, 22, 347, 0, 22, 49, 0, 352,
- /* 1670 */ 22, 354, 35, 0, 339, 0, 0, 35, 35, 22,
- /* 1680 */ 0, 35, 347, 161, 0, 22, 158, 352, 177, 354,
- /* 1690 */ 0, 0, 0, 0, 377, 0, 311, 92, 381, 382,
- /* 1700 */ 383, 384, 385, 386, 35, 388, 93, 186, 0, 0,
- /* 1710 */ 39, 229, 377, 92, 102, 43, 381, 382, 383, 384,
- /* 1720 */ 385, 386, 311, 388, 339, 46, 92, 92, 92, 43,
- /* 1730 */ 235, 43, 347, 161, 235, 159, 419, 352, 163, 354,
- /* 1740 */ 161, 35, 93, 92, 46, 93, 311, 93, 92, 46,
- /* 1750 */ 339, 93, 92, 92, 43, 344, 157, 93, 347, 92,
- /* 1760 */ 46, 426, 377, 352, 43, 354, 381, 382, 383, 384,
- /* 1770 */ 385, 386, 46, 388, 339, 390, 93, 92, 46, 344,
- /* 1780 */ 93, 43, 347, 35, 35, 35, 35, 352, 377, 354,
- /* 1790 */ 93, 35, 381, 382, 383, 384, 385, 386, 93, 388,
- /* 1800 */ 2, 22, 43, 197, 311, 92, 46, 46, 93, 92,
- /* 1810 */ 22, 93, 377, 93, 92, 235, 381, 382, 383, 384,
- /* 1820 */ 385, 386, 92, 388, 93, 92, 199, 92, 103, 35,
- /* 1830 */ 35, 92, 339, 93, 35, 92, 35, 93, 92, 35,
- /* 1840 */ 347, 35, 22, 116, 92, 352, 93, 354, 93, 92,
- /* 1850 */ 116, 35, 116, 116, 92, 311, 92, 92, 104, 22,
- /* 1860 */ 43, 35, 62, 61, 35, 311, 35, 35, 35, 35,
- /* 1870 */ 377, 35, 90, 35, 381, 382, 383, 384, 385, 386,
- /* 1880 */ 35, 388, 35, 339, 35, 43, 68, 35, 22, 35,
- /* 1890 */ 22, 347, 35, 339, 35, 68, 352, 35, 354, 35,
- /* 1900 */ 35, 347, 35, 22, 35, 35, 352, 0, 354, 35,
- /* 1910 */ 47, 39, 0, 35, 39, 0, 39, 35, 311, 0,
- /* 1920 */ 47, 377, 35, 47, 39, 381, 382, 383, 384, 385,
- /* 1930 */ 386, 377, 388, 47, 311, 381, 382, 383, 384, 385,
- /* 1940 */ 386, 0, 388, 35, 35, 0, 339, 22, 21, 429,
- /* 1950 */ 22, 22, 21, 20, 347, 429, 429, 429, 311, 352,
- /* 1960 */ 429, 354, 339, 429, 429, 429, 429, 429, 429, 429,
- /* 1970 */ 347, 429, 429, 429, 429, 352, 429, 354, 429, 429,
- /* 1980 */ 429, 429, 429, 429, 377, 429, 339, 429, 381, 382,
- /* 1990 */ 383, 384, 385, 386, 347, 388, 429, 429, 429, 352,
- /* 2000 */ 377, 354, 429, 429, 381, 382, 383, 384, 385, 386,
- /* 2010 */ 311, 388, 429, 429, 429, 429, 429, 429, 429, 429,
- /* 2020 */ 429, 429, 429, 429, 377, 429, 429, 429, 381, 382,
- /* 2030 */ 383, 384, 385, 386, 311, 388, 429, 429, 339, 429,
- /* 2040 */ 429, 429, 429, 429, 429, 429, 347, 429, 429, 429,
- /* 2050 */ 429, 352, 429, 354, 429, 429, 429, 429, 311, 429,
- /* 2060 */ 429, 429, 339, 429, 429, 429, 429, 429, 429, 429,
- /* 2070 */ 347, 429, 429, 429, 311, 352, 377, 354, 429, 429,
- /* 2080 */ 381, 382, 383, 384, 385, 386, 339, 388, 429, 429,
- /* 2090 */ 429, 429, 429, 429, 347, 429, 429, 429, 429, 352,
- /* 2100 */ 377, 354, 339, 429, 381, 382, 383, 384, 385, 386,
- /* 2110 */ 347, 388, 429, 429, 429, 352, 429, 354, 429, 429,
- /* 2120 */ 429, 429, 429, 429, 377, 429, 429, 429, 381, 382,
- /* 2130 */ 383, 384, 385, 386, 429, 388, 429, 429, 429, 429,
- /* 2140 */ 377, 429, 429, 429, 381, 382, 383, 384, 385, 386,
- /* 2150 */ 429, 388, 311, 429, 429, 429, 429, 429, 429, 429,
- /* 2160 */ 429, 429, 429, 429, 429, 429, 429, 429, 429, 429,
- /* 2170 */ 429, 429, 429, 429, 429, 429, 429, 429, 429, 429,
- /* 2180 */ 339, 429, 429, 429, 429, 429, 429, 429, 347, 429,
- /* 2190 */ 429, 429, 429, 352, 429, 354, 429, 429, 429, 429,
- /* 2200 */ 429, 429, 429, 311, 429, 429, 429, 429, 429, 429,
- /* 2210 */ 429, 429, 429, 311, 429, 429, 429, 429, 377, 429,
- /* 2220 */ 429, 429, 381, 382, 383, 384, 385, 386, 429, 388,
- /* 2230 */ 429, 339, 429, 429, 429, 429, 429, 429, 429, 347,
- /* 2240 */ 429, 339, 429, 429, 352, 429, 354, 429, 429, 347,
- /* 2250 */ 429, 429, 429, 429, 352, 429, 354, 429, 429, 429,
- /* 2260 */ 429, 429, 429, 429, 429, 429, 311, 429, 429, 377,
- /* 2270 */ 429, 429, 429, 381, 382, 383, 384, 385, 386, 377,
- /* 2280 */ 388, 429, 311, 381, 382, 383, 384, 385, 386, 429,
- /* 2290 */ 388, 429, 429, 429, 339, 429, 429, 429, 429, 429,
- /* 2300 */ 429, 429, 347, 429, 429, 429, 311, 352, 429, 354,
- /* 2310 */ 339, 429, 429, 429, 429, 429, 429, 429, 347, 429,
- /* 2320 */ 429, 429, 311, 352, 429, 354, 429, 429, 429, 429,
- /* 2330 */ 429, 429, 377, 429, 339, 429, 381, 382, 383, 384,
- /* 2340 */ 385, 386, 347, 388, 429, 429, 311, 352, 377, 354,
- /* 2350 */ 339, 429, 381, 382, 383, 384, 385, 386, 347, 388,
- /* 2360 */ 429, 429, 429, 352, 429, 354, 429, 429, 429, 429,
- /* 2370 */ 311, 429, 377, 429, 339, 429, 381, 382, 383, 384,
- /* 2380 */ 385, 386, 347, 388, 429, 429, 311, 352, 377, 354,
- /* 2390 */ 429, 429, 381, 382, 383, 384, 385, 386, 339, 388,
- /* 2400 */ 429, 429, 429, 429, 429, 429, 347, 429, 429, 429,
- /* 2410 */ 429, 352, 377, 354, 339, 429, 381, 382, 383, 384,
- /* 2420 */ 385, 386, 347, 388, 429, 429, 429, 352, 429, 354,
- /* 2430 */ 429, 429, 429, 429, 429, 429, 377, 429, 429, 429,
- /* 2440 */ 381, 382, 383, 384, 385, 386, 429, 388, 429, 429,
- /* 2450 */ 429, 429, 377, 429, 429, 429, 381, 382, 383, 384,
- /* 2460 */ 385, 386, 429, 388,
+ /* 150 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
+ /* 160 */ 14, 15, 16, 8, 9, 426, 427, 12, 13, 14,
+ /* 170 */ 15, 16, 20, 20, 20, 175, 20, 177, 106, 107,
+ /* 180 */ 108, 109, 110, 111, 112, 113, 114, 115, 116, 93,
+ /* 190 */ 118, 119, 120, 121, 122, 123, 60, 60, 198, 199,
+ /* 200 */ 320, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+ /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 12,
+ /* 220 */ 13, 14, 129, 130, 20, 340, 21, 20, 348, 22,
+ /* 230 */ 8, 9, 232, 348, 12, 13, 14, 15, 16, 34,
+ /* 240 */ 33, 36, 35, 64, 65, 93, 93, 93, 368, 21,
+ /* 250 */ 71, 368, 24, 25, 26, 27, 28, 29, 30, 31,
+ /* 260 */ 32, 82, 83, 56, 4, 43, 386, 88, 61, 384,
+ /* 270 */ 174, 322, 176, 4, 312, 68, 12, 13, 320, 19,
+ /* 280 */ 4, 401, 402, 403, 20, 405, 22, 105, 408, 331,
+ /* 290 */ 312, 408, 343, 33, 39, 332, 338, 33, 312, 35,
+ /* 300 */ 93, 421, 340, 340, 421, 425, 348, 47, 425, 127,
+ /* 310 */ 348, 51, 349, 44, 45, 353, 56, 355, 340, 325,
+ /* 320 */ 56, 408, 115, 329, 317, 61, 348, 320, 232, 198,
+ /* 330 */ 368, 353, 68, 355, 421, 78, 129, 130, 425, 353,
+ /* 340 */ 378, 43, 56, 355, 382, 383, 384, 385, 386, 387,
+ /* 350 */ 362, 389, 92, 365, 392, 95, 378, 93, 396, 397,
+ /* 360 */ 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ /* 370 */ 408, 0, 241, 242, 243, 244, 245, 124, 92, 115,
+ /* 380 */ 340, 95, 175, 421, 177, 232, 232, 425, 312, 349,
+ /* 390 */ 133, 134, 94, 129, 130, 24, 25, 26, 27, 28,
+ /* 400 */ 29, 30, 31, 32, 93, 198, 199, 35, 201, 202,
+ /* 410 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
+ /* 420 */ 213, 214, 215, 216, 217, 218, 8, 9, 340, 353,
+ /* 430 */ 12, 13, 14, 15, 16, 347, 2, 184, 185, 175,
+ /* 440 */ 68, 177, 8, 9, 356, 2, 12, 13, 14, 15,
+ /* 450 */ 16, 8, 9, 56, 43, 12, 13, 14, 15, 16,
+ /* 460 */ 312, 37, 198, 199, 160, 201, 202, 203, 204, 205,
+ /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
+ /* 480 */ 216, 217, 218, 12, 13, 18, 231, 20, 340, 320,
+ /* 490 */ 93, 20, 95, 22, 27, 125, 348, 30, 124, 125,
+ /* 500 */ 331, 353, 408, 355, 33, 20, 35, 14, 368, 233,
+ /* 510 */ 368, 408, 94, 20, 47, 421, 49, 348, 51, 425,
+ /* 520 */ 96, 93, 98, 99, 421, 101, 378, 56, 425, 105,
+ /* 530 */ 382, 383, 384, 385, 386, 387, 348, 389, 20, 68,
+ /* 540 */ 392, 237, 238, 232, 396, 397, 398, 359, 408, 22,
+ /* 550 */ 408, 127, 182, 183, 19, 4, 186, 183, 410, 92,
+ /* 560 */ 186, 421, 35, 421, 93, 425, 418, 425, 33, 320,
+ /* 570 */ 20, 104, 339, 8, 9, 332, 332, 12, 13, 14,
+ /* 580 */ 15, 16, 47, 340, 340, 352, 115, 52, 53, 54,
+ /* 590 */ 55, 56, 349, 349, 309, 68, 20, 348, 22, 132,
+ /* 600 */ 129, 130, 135, 136, 137, 138, 139, 140, 141, 142,
+ /* 610 */ 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ /* 620 */ 312, 154, 155, 156, 60, 14, 50, 92, 14, 232,
+ /* 630 */ 95, 20, 8, 9, 20, 386, 12, 13, 14, 15,
+ /* 640 */ 16, 20, 115, 157, 93, 105, 175, 162, 177, 400,
+ /* 650 */ 401, 402, 403, 368, 405, 368, 1, 2, 326, 327,
+ /* 660 */ 232, 353, 251, 128, 124, 125, 126, 127, 128, 198,
+ /* 670 */ 199, 0, 201, 202, 203, 204, 205, 206, 207, 208,
+ /* 680 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
+ /* 690 */ 12, 13, 14, 408, 68, 408, 161, 368, 20, 170,
+ /* 700 */ 22, 324, 175, 232, 177, 219, 421, 324, 421, 322,
+ /* 710 */ 425, 33, 425, 35, 179, 229, 181, 312, 189, 190,
+ /* 720 */ 337, 0, 335, 346, 312, 198, 199, 348, 312, 346,
+ /* 730 */ 343, 312, 167, 320, 56, 8, 9, 408, 359, 12,
+ /* 740 */ 13, 14, 15, 16, 331, 320, 68, 12, 13, 94,
+ /* 750 */ 421, 320, 340, 0, 425, 20, 331, 22, 353, 312,
+ /* 760 */ 348, 348, 331, 317, 320, 353, 320, 355, 33, 353,
+ /* 770 */ 35, 93, 353, 348, 320, 326, 327, 355, 320, 348,
+ /* 780 */ 368, 60, 3, 232, 20, 331, 162, 365, 312, 331,
+ /* 790 */ 378, 56, 348, 115, 382, 383, 384, 385, 386, 387,
+ /* 800 */ 353, 389, 348, 68, 12, 13, 348, 129, 130, 104,
+ /* 810 */ 312, 320, 320, 202, 22, 320, 202, 64, 65, 254,
+ /* 820 */ 408, 94, 331, 331, 71, 33, 331, 35, 93, 353,
+ /* 830 */ 386, 320, 312, 421, 312, 82, 83, 425, 68, 348,
+ /* 840 */ 348, 88, 331, 348, 20, 401, 402, 403, 56, 405,
+ /* 850 */ 115, 353, 364, 175, 366, 177, 328, 341, 330, 348,
+ /* 860 */ 68, 93, 8, 9, 129, 130, 12, 13, 14, 15,
+ /* 870 */ 16, 103, 364, 353, 366, 353, 198, 199, 312, 201,
+ /* 880 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ /* 890 */ 212, 213, 214, 215, 216, 217, 218, 320, 320, 320,
+ /* 900 */ 320, 97, 320, 320, 100, 380, 372, 115, 331, 331,
+ /* 910 */ 175, 331, 177, 331, 331, 61, 341, 312, 350, 353,
+ /* 920 */ 312, 353, 312, 44, 45, 348, 348, 348, 348, 404,
+ /* 930 */ 348, 348, 312, 198, 199, 312, 201, 202, 203, 204,
+ /* 940 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
+ /* 950 */ 215, 216, 217, 218, 12, 13, 102, 320, 353, 320,
+ /* 960 */ 341, 353, 20, 353, 22, 386, 202, 175, 331, 177,
+ /* 970 */ 331, 230, 231, 353, 33, 33, 353, 35, 312, 312,
+ /* 980 */ 401, 402, 403, 0, 405, 348, 162, 348, 47, 312,
+ /* 990 */ 198, 199, 380, 52, 53, 54, 55, 56, 56, 340,
+ /* 1000 */ 42, 43, 210, 211, 212, 213, 214, 215, 216, 0,
+ /* 1010 */ 68, 157, 320, 320, 22, 356, 404, 340, 350, 353,
+ /* 1020 */ 353, 353, 345, 331, 331, 348, 380, 35, 249, 18,
+ /* 1030 */ 353, 43, 355, 92, 23, 93, 95, 61, 8, 9,
+ /* 1040 */ 348, 348, 12, 13, 14, 15, 16, 43, 37, 38,
+ /* 1050 */ 404, 333, 41, 97, 336, 378, 100, 115, 56, 382,
+ /* 1060 */ 383, 384, 385, 386, 387, 43, 389, 43, 57, 58,
+ /* 1070 */ 59, 129, 130, 219, 220, 221, 222, 223, 224, 225,
+ /* 1080 */ 226, 227, 228, 229, 97, 35, 97, 100, 105, 100,
+ /* 1090 */ 0, 61, 162, 163, 1, 2, 35, 95, 94, 158,
+ /* 1100 */ 159, 0, 161, 0, 93, 329, 165, 124, 125, 126,
+ /* 1110 */ 127, 128, 22, 43, 105, 43, 94, 175, 94, 177,
+ /* 1120 */ 43, 43, 181, 22, 94, 22, 129, 130, 46, 341,
+ /* 1130 */ 43, 43, 102, 124, 125, 126, 127, 128, 43, 43,
+ /* 1140 */ 198, 199, 131, 201, 202, 203, 204, 205, 206, 207,
+ /* 1150 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
+ /* 1160 */ 218, 43, 43, 43, 94, 43, 94, 35, 341, 13,
+ /* 1170 */ 13, 94, 94, 341, 198, 93, 341, 313, 167, 168,
+ /* 1180 */ 169, 94, 94, 172, 428, 419, 321, 157, 415, 94,
+ /* 1190 */ 94, 35, 35, 340, 312, 321, 319, 352, 381, 188,
+ /* 1200 */ 68, 406, 191, 422, 193, 194, 195, 196, 197, 399,
+ /* 1210 */ 409, 422, 94, 94, 94, 422, 94, 376, 234, 47,
+ /* 1220 */ 173, 375, 340, 42, 20, 370, 360, 177, 320, 320,
+ /* 1230 */ 348, 360, 157, 358, 358, 353, 320, 355, 177, 320,
+ /* 1240 */ 320, 253, 20, 232, 20, 314, 314, 312, 324, 219,
+ /* 1250 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
+ /* 1260 */ 378, 374, 355, 324, 382, 383, 384, 385, 386, 387,
+ /* 1270 */ 20, 389, 367, 20, 392, 340, 324, 367, 396, 397,
+ /* 1280 */ 398, 369, 314, 348, 324, 324, 324, 312, 353, 320,
+ /* 1290 */ 355, 324, 374, 340, 340, 340, 314, 340, 320, 340,
+ /* 1300 */ 418, 353, 322, 340, 340, 340, 340, 180, 322, 373,
+ /* 1310 */ 340, 312, 340, 378, 320, 340, 320, 382, 383, 384,
+ /* 1320 */ 385, 386, 387, 348, 389, 322, 355, 392, 353, 159,
+ /* 1330 */ 355, 396, 397, 398, 353, 322, 239, 363, 353, 340,
+ /* 1340 */ 367, 322, 407, 353, 353, 20, 336, 348, 353, 348,
+ /* 1350 */ 240, 312, 353, 378, 355, 246, 363, 382, 383, 384,
+ /* 1360 */ 385, 386, 387, 414, 389, 353, 361, 353, 353, 363,
+ /* 1370 */ 363, 353, 166, 353, 248, 247, 235, 378, 231, 340,
+ /* 1380 */ 348, 382, 383, 384, 385, 386, 387, 348, 389, 381,
+ /* 1390 */ 413, 392, 353, 414, 355, 396, 397, 398, 252, 20,
+ /* 1400 */ 250, 376, 93, 255, 312, 93, 407, 380, 344, 353,
+ /* 1410 */ 330, 320, 36, 371, 315, 417, 416, 378, 314, 366,
+ /* 1420 */ 322, 382, 383, 384, 385, 386, 387, 310, 389, 412,
+ /* 1430 */ 414, 392, 340, 395, 411, 396, 397, 398, 323, 334,
+ /* 1440 */ 348, 334, 334, 0, 423, 353, 407, 355, 0, 0,
+ /* 1450 */ 424, 182, 0, 424, 312, 424, 423, 429, 423, 42,
+ /* 1460 */ 368, 0, 35, 192, 35, 35, 35, 192, 0, 35,
+ /* 1470 */ 378, 312, 35, 192, 382, 383, 384, 385, 386, 387,
+ /* 1480 */ 0, 389, 340, 192, 0, 35, 0, 22, 0, 35,
+ /* 1490 */ 348, 177, 175, 0, 0, 353, 170, 355, 171, 340,
+ /* 1500 */ 408, 0, 0, 46, 0, 0, 0, 348, 42, 0,
+ /* 1510 */ 0, 0, 353, 421, 355, 153, 0, 425, 0, 0,
+ /* 1520 */ 378, 312, 148, 0, 382, 383, 384, 385, 386, 387,
+ /* 1530 */ 0, 389, 0, 35, 392, 148, 0, 378, 396, 397,
+ /* 1540 */ 0, 382, 383, 384, 385, 386, 387, 0, 389, 340,
+ /* 1550 */ 0, 392, 0, 0, 0, 396, 397, 348, 0, 0,
+ /* 1560 */ 0, 0, 353, 0, 355, 0, 0, 42, 0, 312,
+ /* 1570 */ 0, 0, 0, 0, 0, 0, 0, 22, 0, 312,
+ /* 1580 */ 56, 0, 56, 0, 0, 42, 40, 378, 0, 0,
+ /* 1590 */ 39, 382, 383, 384, 385, 386, 387, 340, 389, 43,
+ /* 1600 */ 14, 392, 345, 46, 14, 348, 397, 340, 46, 0,
+ /* 1610 */ 353, 0, 355, 0, 0, 348, 39, 166, 39, 0,
+ /* 1620 */ 353, 0, 355, 0, 0, 0, 62, 0, 35, 47,
+ /* 1630 */ 312, 35, 47, 39, 39, 378, 0, 35, 47, 382,
+ /* 1640 */ 383, 384, 385, 386, 387, 378, 389, 39, 0, 382,
+ /* 1650 */ 383, 384, 385, 386, 387, 35, 389, 47, 340, 22,
+ /* 1660 */ 0, 39, 0, 0, 0, 0, 348, 35, 35, 102,
+ /* 1670 */ 35, 353, 43, 355, 43, 35, 35, 22, 0, 22,
+ /* 1680 */ 0, 0, 35, 22, 0, 35, 0, 420, 49, 22,
+ /* 1690 */ 312, 35, 0, 22, 20, 0, 378, 100, 0, 162,
+ /* 1700 */ 382, 383, 384, 385, 386, 387, 178, 389, 312, 22,
+ /* 1710 */ 35, 162, 0, 0, 0, 0, 0, 35, 340, 93,
+ /* 1720 */ 187, 0, 94, 93, 0, 46, 348, 93, 159, 39,
+ /* 1730 */ 230, 353, 43, 355, 43, 93, 340, 93, 93, 236,
+ /* 1740 */ 94, 345, 43, 94, 348, 427, 103, 160, 94, 353,
+ /* 1750 */ 46, 355, 94, 46, 43, 35, 378, 158, 312, 93,
+ /* 1760 */ 382, 383, 384, 385, 386, 387, 162, 389, 46, 391,
+ /* 1770 */ 164, 94, 43, 46, 378, 236, 93, 46, 382, 383,
+ /* 1780 */ 384, 385, 386, 387, 312, 389, 340, 93, 43, 93,
+ /* 1790 */ 93, 345, 35, 35, 348, 94, 94, 94, 35, 353,
+ /* 1800 */ 94, 355, 35, 35, 2, 22, 46, 43, 312, 22,
+ /* 1810 */ 198, 93, 340, 35, 104, 46, 200, 94, 93, 93,
+ /* 1820 */ 348, 35, 94, 93, 378, 353, 94, 355, 382, 383,
+ /* 1830 */ 384, 385, 386, 387, 312, 389, 340, 236, 94, 93,
+ /* 1840 */ 93, 93, 35, 94, 348, 93, 35, 94, 93, 353,
+ /* 1850 */ 378, 355, 35, 35, 382, 383, 384, 385, 386, 387,
+ /* 1860 */ 94, 389, 340, 93, 22, 94, 93, 117, 117, 93,
+ /* 1870 */ 348, 117, 35, 117, 378, 353, 43, 355, 382, 383,
+ /* 1880 */ 384, 385, 386, 387, 105, 389, 93, 93, 22, 62,
+ /* 1890 */ 61, 35, 312, 35, 35, 35, 35, 35, 35, 35,
+ /* 1900 */ 378, 91, 35, 35, 382, 383, 384, 385, 386, 387,
+ /* 1910 */ 312, 389, 320, 68, 43, 35, 35, 22, 35, 22,
+ /* 1920 */ 340, 35, 35, 35, 35, 68, 35, 35, 348, 35,
+ /* 1930 */ 22, 35, 0, 353, 35, 355, 35, 47, 340, 39,
+ /* 1940 */ 348, 0, 35, 39, 0, 47, 348, 35, 39, 47,
+ /* 1950 */ 0, 353, 35, 355, 39, 0, 0, 47, 378, 35,
+ /* 1960 */ 368, 35, 382, 383, 384, 385, 386, 387, 22, 389,
+ /* 1970 */ 21, 312, 430, 22, 22, 21, 378, 20, 386, 430,
+ /* 1980 */ 382, 383, 384, 385, 386, 387, 430, 389, 430, 430,
+ /* 1990 */ 430, 430, 430, 401, 402, 403, 430, 405, 430, 340,
+ /* 2000 */ 408, 430, 430, 430, 430, 430, 430, 348, 430, 430,
+ /* 2010 */ 430, 430, 353, 421, 355, 430, 430, 425, 430, 430,
+ /* 2020 */ 430, 312, 430, 430, 430, 430, 430, 430, 430, 430,
+ /* 2030 */ 430, 312, 430, 430, 430, 430, 430, 378, 430, 430,
+ /* 2040 */ 430, 382, 383, 384, 385, 386, 387, 430, 389, 340,
+ /* 2050 */ 430, 430, 430, 430, 430, 430, 430, 348, 430, 340,
+ /* 2060 */ 430, 430, 353, 430, 355, 430, 430, 348, 430, 430,
+ /* 2070 */ 430, 312, 353, 430, 355, 430, 430, 430, 430, 430,
+ /* 2080 */ 430, 430, 430, 430, 430, 430, 430, 378, 430, 430,
+ /* 2090 */ 430, 382, 383, 384, 385, 386, 387, 378, 389, 340,
+ /* 2100 */ 430, 382, 383, 384, 385, 386, 387, 348, 389, 430,
+ /* 2110 */ 430, 430, 353, 430, 355, 430, 430, 430, 430, 430,
+ /* 2120 */ 430, 312, 430, 430, 430, 430, 430, 430, 430, 430,
+ /* 2130 */ 430, 430, 430, 312, 430, 430, 430, 378, 430, 430,
+ /* 2140 */ 430, 382, 383, 384, 385, 386, 387, 312, 389, 340,
+ /* 2150 */ 430, 430, 430, 430, 430, 430, 430, 348, 430, 430,
+ /* 2160 */ 430, 340, 353, 430, 355, 430, 430, 430, 430, 348,
+ /* 2170 */ 430, 430, 430, 430, 353, 340, 355, 430, 430, 430,
+ /* 2180 */ 430, 430, 430, 348, 430, 430, 430, 378, 353, 430,
+ /* 2190 */ 355, 382, 383, 384, 385, 386, 387, 430, 389, 378,
+ /* 2200 */ 430, 430, 430, 382, 383, 384, 385, 386, 387, 430,
+ /* 2210 */ 389, 430, 430, 378, 430, 430, 430, 382, 383, 384,
+ /* 2220 */ 385, 386, 387, 312, 389, 430, 430, 430, 430, 430,
+ /* 2230 */ 430, 430, 430, 312, 430, 430, 430, 430, 430, 430,
+ /* 2240 */ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ /* 2250 */ 430, 340, 430, 430, 430, 430, 430, 430, 430, 348,
+ /* 2260 */ 430, 340, 430, 430, 353, 430, 355, 430, 430, 348,
+ /* 2270 */ 430, 430, 430, 430, 353, 430, 355, 430, 430, 430,
+ /* 2280 */ 430, 430, 430, 430, 312, 430, 430, 430, 430, 378,
+ /* 2290 */ 430, 430, 430, 382, 383, 384, 385, 386, 387, 378,
+ /* 2300 */ 389, 430, 430, 382, 383, 384, 385, 386, 387, 430,
+ /* 2310 */ 389, 430, 340, 430, 430, 430, 430, 430, 430, 430,
+ /* 2320 */ 348, 430, 430, 430, 430, 353, 430, 355, 430, 430,
+ /* 2330 */ 430, 430, 430, 430, 312, 430, 430, 430, 430, 430,
+ /* 2340 */ 430, 430, 430, 430, 312, 430, 430, 430, 430, 430,
+ /* 2350 */ 378, 430, 430, 430, 382, 383, 384, 385, 386, 387,
+ /* 2360 */ 430, 389, 340, 430, 430, 430, 430, 430, 430, 430,
+ /* 2370 */ 348, 430, 340, 430, 430, 353, 430, 355, 430, 430,
+ /* 2380 */ 348, 430, 430, 430, 312, 353, 430, 355, 430, 430,
+ /* 2390 */ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ /* 2400 */ 378, 430, 430, 430, 382, 383, 384, 385, 386, 387,
+ /* 2410 */ 378, 389, 340, 430, 382, 383, 384, 385, 386, 387,
+ /* 2420 */ 348, 389, 430, 430, 430, 353, 430, 355, 430, 430,
+ /* 2430 */ 430, 430, 430, 430, 312, 430, 430, 430, 430, 430,
+ /* 2440 */ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ /* 2450 */ 378, 430, 430, 430, 382, 383, 384, 385, 386, 387,
+ /* 2460 */ 430, 389, 340, 430, 430, 430, 430, 430, 430, 430,
+ /* 2470 */ 348, 430, 430, 430, 430, 353, 430, 355, 430, 430,
+ /* 2480 */ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ /* 2490 */ 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
+ /* 2500 */ 378, 430, 430, 430, 382, 383, 384, 385, 386, 387,
+ /* 2510 */ 430, 389,
};
-#define YY_SHIFT_COUNT (673)
+#define YY_SHIFT_COUNT (674)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (1945)
+#define YY_SHIFT_MAX (1957)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 505, 0, 0, 206, 206, 412, 412, 412, 618, 618,
- /* 10 */ 412, 412, 824, 1030, 1236, 1030, 1030, 1030, 1030, 1030,
- /* 20 */ 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030,
- /* 30 */ 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030,
- /* 40 */ 1030, 1030, 33, 33, 296, 296, 296, 543, 543, 107,
- /* 50 */ 543, 543, 433, 30, 6, 200, 6, 73, 73, 21,
- /* 60 */ 21, 11, 51, 6, 6, 73, 73, 73, 73, 73,
- /* 70 */ 73, 73, 73, 73, 73, 56, 73, 73, 73, 243,
- /* 80 */ 73, 73, 285, 73, 73, 285, 377, 73, 285, 285,
- /* 90 */ 285, 73, 403, 205, 700, 893, 893, 80, 611, 611,
- /* 100 */ 611, 611, 611, 611, 611, 611, 611, 611, 611, 611,
- /* 110 */ 611, 611, 611, 611, 611, 611, 611, 346, 394, 51,
- /* 120 */ 628, 628, 461, 714, 643, 431, 431, 431, 714, 417,
- /* 130 */ 417, 243, 567, 567, 285, 285, 479, 479, 402, 526,
- /* 140 */ 257, 257, 257, 257, 257, 257, 257, 1035, 840, 15,
- /* 150 */ 663, 562, 630, 81, 106, 446, 380, 661, 687, 797,
- /* 160 */ 533, 455, 533, 851, 860, 860, 860, 777, 859, 954,
- /* 170 */ 1147, 1036, 1167, 1204, 1204, 1167, 1101, 1101, 1204, 1204,
- /* 180 */ 1204, 1246, 1246, 1247, 56, 243, 56, 1256, 1261, 56,
- /* 190 */ 1256, 56, 56, 56, 1204, 56, 1246, 285, 285, 285,
- /* 200 */ 285, 285, 285, 285, 285, 285, 285, 285, 1204, 1246,
- /* 210 */ 479, 1247, 403, 1127, 243, 403, 1204, 1204, 1256, 403,
- /* 220 */ 1091, 479, 479, 479, 479, 1091, 479, 1173, 403, 402,
- /* 230 */ 403, 417, 1327, 479, 1120, 1091, 479, 479, 1120, 1091,
- /* 240 */ 479, 479, 285, 1117, 1205, 1120, 1124, 1126, 1141, 954,
- /* 250 */ 1148, 417, 1357, 1135, 1139, 1137, 1135, 1139, 1135, 1139,
- /* 260 */ 1297, 1309, 479, 526, 1204, 403, 1382, 1246, 2464, 2464,
- /* 270 */ 2464, 2464, 2464, 2464, 2464, 69, 130, 164, 423, 153,
- /* 280 */ 269, 378, 475, 536, 646, 921, 457, 675, 675, 675,
- /* 290 */ 675, 675, 675, 675, 675, 1093, 672, 36, 36, 557,
- /* 300 */ 48, 365, 27, 765, 139, 329, 129, 351, 424, 424,
- /* 310 */ 424, 424, 868, 917, 927, 867, 869, 897, 914, 948,
- /* 320 */ 995, 1023, 925, 814, 969, 1003, 1008, 1010, 1038, 1040,
- /* 330 */ 1063, 976, 941, 901, 940, 1100, 1022, 1031, 1017, 1106,
- /* 340 */ 1033, 1080, 1107, 1118, 1128, 1160, 1162, 993, 1067, 1111,
- /* 350 */ 810, 357, 1429, 1456, 1254, 1458, 1460, 1421, 1468, 1436,
- /* 360 */ 1279, 1437, 1438, 1439, 1284, 1476, 1442, 1443, 1288, 1480,
- /* 370 */ 1290, 1483, 1449, 1485, 1464, 1488, 1454, 1314, 1319, 1491,
- /* 380 */ 1494, 1325, 1333, 1504, 1505, 1461, 1506, 1508, 1509, 1469,
- /* 390 */ 1510, 1512, 1513, 1362, 1516, 1517, 1518, 1519, 1520, 1374,
- /* 400 */ 1489, 1525, 1379, 1527, 1529, 1531, 1532, 1533, 1534, 1536,
- /* 410 */ 1537, 1538, 1540, 1541, 1542, 1545, 1546, 1507, 1547, 1548,
- /* 420 */ 1550, 1551, 1552, 1563, 1543, 1566, 1567, 1568, 1569, 1571,
- /* 430 */ 1498, 1555, 1500, 1573, 1574, 1535, 1539, 1549, 1561, 1530,
- /* 440 */ 1565, 1553, 1581, 1557, 1556, 1582, 1584, 1586, 1562, 1423,
- /* 450 */ 1589, 1590, 1591, 1564, 1593, 1594, 1570, 1560, 1585, 1602,
- /* 460 */ 1577, 1578, 1588, 1603, 1595, 1587, 1592, 1604, 1597, 1601,
- /* 470 */ 1596, 1608, 1609, 1629, 1633, 1558, 1559, 1614, 1615, 1638,
- /* 480 */ 1616, 1617, 1610, 1611, 1622, 1625, 1639, 1662, 1641, 1665,
- /* 490 */ 1644, 1618, 1668, 1648, 1637, 1673, 1642, 1675, 1643, 1676,
- /* 500 */ 1657, 1619, 1680, 1522, 1646, 1684, 1511, 1663, 1572, 1528,
- /* 510 */ 1690, 1691, 1579, 1575, 1692, 1693, 1695, 1605, 1613, 1669,
- /* 520 */ 1521, 1708, 1621, 1576, 1634, 1709, 1671, 1599, 1635, 1612,
- /* 530 */ 1679, 1672, 1495, 1636, 1649, 1651, 1652, 1654, 1656, 1686,
- /* 540 */ 1658, 1660, 1661, 1667, 1664, 1688, 1698, 1703, 1685, 1711,
- /* 550 */ 1499, 1683, 1687, 1714, 1482, 1721, 1726, 1732, 1697, 1738,
- /* 560 */ 1580, 1705, 1706, 1748, 1749, 1750, 1751, 1756, 1705, 1798,
- /* 570 */ 1779, 1606, 1759, 1713, 1715, 1717, 1718, 1722, 1720, 1760,
- /* 580 */ 1730, 1733, 1761, 1788, 1627, 1735, 1725, 1731, 1794, 1795,
- /* 590 */ 1739, 1740, 1799, 1743, 1744, 1801, 1746, 1753, 1804, 1752,
- /* 600 */ 1755, 1806, 1757, 1727, 1734, 1736, 1737, 1820, 1754, 1762,
- /* 610 */ 1764, 1816, 1765, 1817, 1817, 1837, 1800, 1802, 1826, 1829,
- /* 620 */ 1831, 1832, 1833, 1834, 1836, 1838, 1845, 1847, 1818, 1782,
- /* 630 */ 1842, 1849, 1852, 1866, 1854, 1868, 1857, 1859, 1827, 1610,
- /* 640 */ 1862, 1611, 1864, 1865, 1867, 1869, 1881, 1870, 1907, 1874,
- /* 650 */ 1863, 1872, 1912, 1878, 1873, 1875, 1915, 1882, 1876, 1877,
- /* 660 */ 1919, 1887, 1886, 1885, 1941, 1908, 1909, 1945, 1925, 1927,
- /* 670 */ 1928, 1929, 1931, 1933,
+ /* 0 */ 1011, 0, 0, 207, 207, 264, 264, 264, 471, 471,
+ /* 10 */ 264, 264, 678, 735, 942, 735, 735, 735, 735, 735,
+ /* 20 */ 735, 735, 735, 735, 735, 735, 735, 735, 735, 735,
+ /* 30 */ 735, 735, 735, 735, 735, 735, 735, 735, 735, 735,
+ /* 40 */ 735, 735, 153, 153, 152, 152, 152, 792, 792, 154,
+ /* 50 */ 792, 792, 96, 397, 311, 428, 311, 156, 156, 269,
+ /* 60 */ 269, 551, 93, 311, 311, 156, 156, 156, 156, 156,
+ /* 70 */ 156, 156, 156, 156, 156, 136, 156, 156, 156, 204,
+ /* 80 */ 156, 156, 518, 156, 156, 518, 550, 156, 518, 518,
+ /* 90 */ 518, 156, 564, 467, 1030, 854, 854, 228, 527, 527,
+ /* 100 */ 527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
+ /* 110 */ 527, 527, 527, 527, 527, 527, 527, 424, 179, 93,
+ /* 120 */ 493, 493, 137, 372, 721, 485, 485, 485, 372, 621,
+ /* 130 */ 621, 204, 671, 671, 518, 518, 626, 626, 705, 770,
+ /* 140 */ 72, 72, 72, 72, 72, 72, 72, 535, 77, 565,
+ /* 150 */ 753, 131, 30, 304, 611, 614, 576, 879, 182, 824,
+ /* 160 */ 741, 255, 741, 958, 779, 779, 779, 276, 764, 984,
+ /* 170 */ 1172, 1047, 1181, 1204, 1204, 1181, 1075, 1075, 1204, 1204,
+ /* 180 */ 1204, 1222, 1222, 1224, 136, 204, 136, 1250, 1253, 136,
+ /* 190 */ 1250, 136, 136, 136, 1204, 136, 1222, 518, 518, 518,
+ /* 200 */ 518, 518, 518, 518, 518, 518, 518, 518, 1204, 1222,
+ /* 210 */ 626, 1224, 564, 1127, 204, 564, 1204, 1204, 1250, 564,
+ /* 220 */ 1097, 626, 626, 626, 626, 1097, 626, 1170, 564, 705,
+ /* 230 */ 564, 621, 1325, 626, 1110, 1097, 626, 626, 1110, 1097,
+ /* 240 */ 626, 626, 518, 1109, 1206, 1110, 1126, 1128, 1141, 984,
+ /* 250 */ 1147, 621, 1379, 1146, 1150, 1148, 1146, 1150, 1146, 1150,
+ /* 260 */ 1309, 1312, 626, 770, 1204, 564, 1376, 1222, 2512, 2512,
+ /* 270 */ 2512, 2512, 2512, 2512, 2512, 69, 941, 371, 260, 2,
+ /* 280 */ 222, 418, 434, 443, 624, 727, 983, 155, 155, 155,
+ /* 290 */ 155, 155, 155, 155, 155, 1009, 540, 12, 12, 370,
+ /* 300 */ 374, 529, 286, 257, 205, 253, 655, 486, 146, 146,
+ /* 310 */ 146, 146, 298, 36, 992, 804, 956, 987, 989, 1090,
+ /* 320 */ 1101, 1103, 1002, 930, 1004, 1022, 1024, 1070, 1072, 1077,
+ /* 330 */ 1078, 1093, 997, 411, 988, 1087, 1050, 1061, 976, 1088,
+ /* 340 */ 1082, 1095, 1096, 1118, 1119, 1120, 1122, 768, 1156, 1157,
+ /* 350 */ 1132, 43, 1443, 1448, 1269, 1449, 1452, 1417, 1461, 1427,
+ /* 360 */ 1271, 1429, 1430, 1431, 1275, 1468, 1434, 1437, 1281, 1480,
+ /* 370 */ 1291, 1484, 1450, 1486, 1465, 1488, 1454, 1314, 1317, 1493,
+ /* 380 */ 1494, 1327, 1326, 1501, 1502, 1457, 1504, 1505, 1506, 1466,
+ /* 390 */ 1509, 1510, 1511, 1362, 1516, 1518, 1519, 1530, 1532, 1374,
+ /* 400 */ 1498, 1523, 1387, 1536, 1540, 1547, 1550, 1552, 1553, 1554,
+ /* 410 */ 1558, 1559, 1560, 1561, 1563, 1565, 1566, 1525, 1568, 1570,
+ /* 420 */ 1571, 1572, 1573, 1574, 1555, 1575, 1576, 1578, 1588, 1589,
+ /* 430 */ 1524, 1581, 1526, 1583, 1584, 1543, 1551, 1556, 1586, 1557,
+ /* 440 */ 1590, 1562, 1609, 1546, 1577, 1611, 1613, 1614, 1579, 1451,
+ /* 450 */ 1619, 1621, 1623, 1564, 1624, 1625, 1593, 1582, 1594, 1627,
+ /* 460 */ 1596, 1585, 1595, 1636, 1602, 1591, 1608, 1648, 1620, 1610,
+ /* 470 */ 1622, 1662, 1663, 1664, 1665, 1567, 1597, 1632, 1637, 1660,
+ /* 480 */ 1633, 1635, 1629, 1631, 1640, 1641, 1655, 1678, 1657, 1680,
+ /* 490 */ 1661, 1639, 1681, 1667, 1647, 1684, 1650, 1686, 1656, 1692,
+ /* 500 */ 1671, 1674, 1695, 1537, 1675, 1698, 1528, 1687, 1549, 1569,
+ /* 510 */ 1712, 1713, 1604, 1606, 1714, 1715, 1716, 1626, 1628, 1682,
+ /* 520 */ 1533, 1721, 1630, 1587, 1634, 1724, 1690, 1599, 1642, 1643,
+ /* 530 */ 1679, 1689, 1503, 1644, 1646, 1645, 1649, 1654, 1666, 1691,
+ /* 540 */ 1658, 1683, 1694, 1696, 1677, 1699, 1704, 1707, 1697, 1711,
+ /* 550 */ 1539, 1701, 1702, 1722, 1500, 1729, 1727, 1731, 1703, 1745,
+ /* 560 */ 1601, 1706, 1720, 1757, 1758, 1763, 1767, 1768, 1706, 1802,
+ /* 570 */ 1783, 1612, 1764, 1718, 1723, 1725, 1728, 1726, 1732, 1760,
+ /* 580 */ 1730, 1746, 1769, 1787, 1616, 1747, 1710, 1744, 1778, 1786,
+ /* 590 */ 1748, 1749, 1807, 1752, 1753, 1811, 1755, 1766, 1817, 1770,
+ /* 600 */ 1771, 1818, 1773, 1750, 1751, 1754, 1756, 1842, 1779, 1776,
+ /* 610 */ 1793, 1837, 1794, 1833, 1833, 1866, 1827, 1829, 1856, 1858,
+ /* 620 */ 1859, 1860, 1861, 1862, 1863, 1864, 1867, 1868, 1845, 1810,
+ /* 630 */ 1871, 1880, 1881, 1895, 1883, 1897, 1886, 1887, 1888, 1857,
+ /* 640 */ 1629, 1889, 1631, 1891, 1892, 1894, 1896, 1908, 1899, 1932,
+ /* 650 */ 1901, 1890, 1900, 1941, 1907, 1898, 1904, 1944, 1912, 1902,
+ /* 660 */ 1909, 1950, 1917, 1910, 1915, 1955, 1924, 1926, 1956, 1946,
+ /* 670 */ 1949, 1951, 1952, 1954, 1957,
};
#define YY_REDUCE_COUNT (274)
-#define YY_REDUCE_MIN (-386)
-#define YY_REDUCE_MAX (2075)
+#define YY_REDUCE_MIN (-353)
+#define YY_REDUCE_MAX (2122)
static const short yy_reduce_ofst[] = {
- /* 0 */ 29, -307, 115, 793, 383, -82, 939, 999, 1115, 1176,
- /* 10 */ 500, 620, 1233, 219, 1259, 603, 753, 1317, 1335, 1385,
- /* 20 */ 1411, 1435, 1493, 1544, 1554, 1607, 1623, 1647, 1699, 1723,
- /* 30 */ 1747, 1763, 1841, 1892, 1902, 1955, 1971, 1995, 2011, 2035,
- /* 40 */ 2059, 2075, -305, 1007, -74, 189, 673, -55, 563, 109,
- /* 50 */ -333, -97, -366, -361, -131, 300, 366, 190, 240, -315,
- /* 60 */ -308, -386, -263, -173, -149, -160, -81, 54, 374, 613,
- /* 70 */ 626, 652, 660, 725, 729, -251, 737, 780, 833, -297,
- /* 80 */ 835, 836, 50, 838, 882, -96, 185, 932, 147, -86,
- /* 90 */ 154, 933, -316, -283, -376, -376, -376, -273, -229, -174,
- /* 100 */ 208, 220, 246, 284, 323, 326, 359, 371, 391, 418,
- /* 110 */ 420, 437, 499, 501, 503, 537, 547, -19, 71, 75,
- /* 120 */ 199, 350, 373, 458, -94, -18, 253, 372, 549, 430,
- /* 130 */ 515, 221, -34, 70, 502, 521, 538, 551, 578, 312,
- /* 140 */ -329, 309, 328, 337, 386, 572, 606, 472, 657, 591,
- /* 150 */ 719, 653, 741, 680, 770, 770, 808, 830, 791, 773,
- /* 160 */ 755, 755, 755, 766, 746, 748, 751, 778, 770, 816,
- /* 170 */ 822, 853, 864, 906, 907, 895, 902, 903, 942, 945,
- /* 180 */ 946, 955, 957, 899, 950, 920, 952, 911, 915, 959,
- /* 190 */ 918, 962, 964, 965, 970, 967, 981, 956, 958, 960,
- /* 200 */ 961, 963, 966, 968, 972, 973, 974, 975, 977, 985,
- /* 210 */ 949, 930, 987, 937, 978, 994, 998, 1000, 971, 997,
- /* 220 */ 979, 988, 990, 991, 992, 986, 1004, 989, 1012, 1020,
- /* 230 */ 1018, 1005, 980, 1006, 944, 1001, 1009, 1014, 984, 1011,
- /* 240 */ 1015, 1016, 770, 953, 983, 1002, 1013, 982, 996, 1024,
- /* 250 */ 755, 1032, 1021, 1034, 1037, 1027, 1041, 1039, 1042, 1044,
- /* 260 */ 1019, 1059, 1051, 1075, 1097, 1096, 1105, 1108, 1050, 1057,
- /* 270 */ 1090, 1095, 1099, 1102, 1121,
+ /* 0 */ 285, -311, -38, 148, 882, 935, 999, 1039, 412, 1092,
+ /* 10 */ 1142, 1159, -22, -261, 1209, 677, 1257, 1267, 1318, 1378,
+ /* 20 */ 1396, 1446, 975, 1472, 1496, 1522, 1580, 1598, 1659, 1709,
+ /* 30 */ 1719, 1759, 1809, 1821, 1835, 1911, 1921, 1972, 2022, 2032,
+ /* 40 */ 2072, 2122, -120, 1592, 249, 444, 579, -319, -289, -309,
+ /* 50 */ -323, -258, -117, 140, 142, 287, 329, -299, -42, -316,
+ /* 60 */ -312, -87, -346, 94, 103, 169, 413, 425, 431, 454,
+ /* 70 */ 458, 491, 492, 495, 511, 383, 578, 580, 582, -12,
+ /* 80 */ 583, 637, -37, 639, 692, -229, -115, 693, 243, 88,
+ /* 90 */ 244, 577, 387, -275, -353, -353, -353, -265, -14, 76,
+ /* 100 */ 308, 405, 416, 419, 447, 476, 498, 520, 522, 566,
+ /* 110 */ 605, 608, 610, 620, 623, 666, 667, 233, -6, -292,
+ /* 120 */ 7, 446, 377, 332, -51, 525, 612, 646, 449, 188,
+ /* 130 */ 379, 422, 488, 508, 40, 659, 568, 668, 718, 528,
+ /* 140 */ 516, 575, 619, 788, 827, 832, 835, 534, 864, 756,
+ /* 150 */ 776, 766, 865, 773, 853, 853, 874, 877, 845, 817,
+ /* 160 */ 795, 795, 795, 810, 781, 789, 793, 801, 853, 841,
+ /* 170 */ 846, 855, 866, 908, 909, 871, 875, 876, 916, 919,
+ /* 180 */ 920, 931, 932, 887, 924, 907, 939, 905, 912, 952,
+ /* 190 */ 910, 960, 961, 962, 969, 967, 968, 953, 954, 955,
+ /* 200 */ 957, 959, 963, 964, 965, 966, 970, 972, 978, 982,
+ /* 210 */ 948, 918, 980, 936, 971, 986, 994, 996, 973, 1003,
+ /* 220 */ 974, 981, 985, 990, 991, 993, 995, 1005, 1013, 1010,
+ /* 230 */ 1019, 1001, 1008, 1012, 949, 1006, 1014, 1015, 979, 1007,
+ /* 240 */ 1018, 1020, 853, 998, 1000, 1016, 977, 1017, 1023, 1025,
+ /* 250 */ 795, 1032, 1027, 1026, 1021, 1028, 1029, 1033, 1031, 1035,
+ /* 260 */ 1038, 1064, 1056, 1080, 1091, 1098, 1099, 1104, 1042, 1053,
+ /* 270 */ 1105, 1107, 1108, 1115, 1117,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 10 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 20 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 30 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 40 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 50 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 60 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 70 */ 1478, 1478, 1478, 1478, 1478, 1552, 1478, 1478, 1478, 1478,
- /* 80 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 90 */ 1478, 1478, 1550, 1714, 1478, 1889, 1478, 1478, 1478, 1478,
- /* 100 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 110 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 120 */ 1478, 1478, 1552, 1478, 1550, 1901, 1901, 1901, 1478, 1478,
- /* 130 */ 1478, 1478, 1755, 1755, 1478, 1478, 1478, 1478, 1654, 1478,
- /* 140 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1749, 1478, 1970,
- /* 150 */ 1478, 1478, 1478, 1924, 1478, 1478, 1478, 1478, 1607, 1916,
- /* 160 */ 1893, 1907, 1894, 1891, 1955, 1955, 1955, 1910, 1478, 1920,
- /* 170 */ 1478, 1742, 1719, 1478, 1478, 1719, 1716, 1716, 1478, 1478,
- /* 180 */ 1478, 1478, 1478, 1478, 1552, 1478, 1552, 1478, 1478, 1552,
- /* 190 */ 1478, 1552, 1552, 1552, 1478, 1552, 1478, 1478, 1478, 1478,
- /* 200 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 210 */ 1478, 1478, 1550, 1751, 1478, 1550, 1478, 1478, 1478, 1550,
- /* 220 */ 1929, 1478, 1478, 1478, 1478, 1929, 1478, 1478, 1550, 1478,
- /* 230 */ 1550, 1478, 1478, 1478, 1931, 1929, 1478, 1478, 1931, 1929,
- /* 240 */ 1478, 1478, 1478, 1943, 1939, 1931, 1947, 1945, 1922, 1920,
- /* 250 */ 1907, 1478, 1478, 1961, 1957, 1973, 1961, 1957, 1961, 1957,
- /* 260 */ 1478, 1623, 1478, 1478, 1478, 1550, 1510, 1478, 1744, 1755,
- /* 270 */ 1657, 1657, 1657, 1553, 1483, 1478, 1478, 1478, 1478, 1478,
- /* 280 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1826, 1942, 1941,
- /* 290 */ 1865, 1864, 1863, 1861, 1825, 1478, 1619, 1824, 1823, 1478,
- /* 300 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1817, 1818,
- /* 310 */ 1816, 1815, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 320 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 330 */ 1478, 1890, 1478, 1958, 1962, 1478, 1478, 1478, 1478, 1478,
- /* 340 */ 1801, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 350 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 360 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 370 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 380 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 390 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 400 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 410 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 420 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 430 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1515, 1478, 1478,
- /* 440 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 450 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 460 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 470 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 480 */ 1478, 1478, 1590, 1589, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 490 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 500 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 510 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 520 */ 1478, 1759, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 530 */ 1478, 1923, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 540 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1801, 1478, 1940,
- /* 550 */ 1478, 1900, 1896, 1478, 1478, 1892, 1800, 1478, 1478, 1956,
- /* 560 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1885,
- /* 570 */ 1478, 1478, 1858, 1843, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 580 */ 1478, 1478, 1478, 1478, 1811, 1478, 1478, 1478, 1478, 1478,
- /* 590 */ 1651, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 600 */ 1478, 1478, 1478, 1636, 1634, 1633, 1632, 1478, 1629, 1478,
- /* 610 */ 1478, 1478, 1478, 1660, 1659, 1478, 1478, 1478, 1478, 1478,
- /* 620 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 630 */ 1571, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1563,
- /* 640 */ 1478, 1562, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 650 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 660 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478,
- /* 670 */ 1478, 1478, 1478, 1478,
+ /* 0 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 10 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 20 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 30 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 40 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 50 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 60 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 70 */ 1481, 1481, 1481, 1481, 1481, 1555, 1481, 1481, 1481, 1481,
+ /* 80 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 90 */ 1481, 1481, 1553, 1718, 1481, 1893, 1481, 1481, 1481, 1481,
+ /* 100 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 110 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 120 */ 1481, 1481, 1555, 1481, 1553, 1905, 1905, 1905, 1481, 1481,
+ /* 130 */ 1481, 1481, 1759, 1759, 1481, 1481, 1481, 1481, 1658, 1481,
+ /* 140 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1753, 1481, 1974,
+ /* 150 */ 1481, 1481, 1481, 1928, 1481, 1481, 1481, 1481, 1611, 1920,
+ /* 160 */ 1897, 1911, 1898, 1895, 1959, 1959, 1959, 1914, 1481, 1924,
+ /* 170 */ 1481, 1746, 1723, 1481, 1481, 1723, 1720, 1720, 1481, 1481,
+ /* 180 */ 1481, 1481, 1481, 1481, 1555, 1481, 1555, 1481, 1481, 1555,
+ /* 190 */ 1481, 1555, 1555, 1555, 1481, 1555, 1481, 1481, 1481, 1481,
+ /* 200 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 210 */ 1481, 1481, 1553, 1755, 1481, 1553, 1481, 1481, 1481, 1553,
+ /* 220 */ 1933, 1481, 1481, 1481, 1481, 1933, 1481, 1481, 1553, 1481,
+ /* 230 */ 1553, 1481, 1481, 1481, 1935, 1933, 1481, 1481, 1935, 1933,
+ /* 240 */ 1481, 1481, 1481, 1947, 1943, 1935, 1951, 1949, 1926, 1924,
+ /* 250 */ 1911, 1481, 1481, 1965, 1961, 1977, 1965, 1961, 1965, 1961,
+ /* 260 */ 1481, 1627, 1481, 1481, 1481, 1553, 1513, 1481, 1748, 1759,
+ /* 270 */ 1661, 1661, 1661, 1556, 1486, 1481, 1481, 1481, 1481, 1481,
+ /* 280 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1830, 1946, 1945,
+ /* 290 */ 1869, 1868, 1867, 1865, 1829, 1481, 1623, 1828, 1827, 1481,
+ /* 300 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1821, 1822,
+ /* 310 */ 1820, 1819, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 320 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 330 */ 1481, 1894, 1481, 1962, 1966, 1481, 1481, 1481, 1481, 1481,
+ /* 340 */ 1805, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 350 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 360 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 370 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 380 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 390 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 400 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 410 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 420 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 430 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1518, 1481, 1481,
+ /* 440 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 450 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 460 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 470 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 480 */ 1481, 1481, 1594, 1593, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 490 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 500 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 510 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 520 */ 1481, 1763, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 530 */ 1481, 1927, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 540 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1805, 1481, 1944,
+ /* 550 */ 1481, 1904, 1900, 1481, 1481, 1896, 1804, 1481, 1481, 1960,
+ /* 560 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1889,
+ /* 570 */ 1481, 1481, 1862, 1847, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 580 */ 1481, 1481, 1481, 1481, 1815, 1481, 1481, 1481, 1481, 1481,
+ /* 590 */ 1655, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 600 */ 1481, 1481, 1481, 1640, 1638, 1637, 1636, 1481, 1633, 1481,
+ /* 610 */ 1481, 1481, 1481, 1664, 1663, 1481, 1481, 1481, 1481, 1481,
+ /* 620 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 630 */ 1575, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 640 */ 1566, 1481, 1565, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 650 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 660 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
+ /* 670 */ 1481, 1481, 1481, 1481, 1481,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -983,6 +993,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* KEEP => nothing */
0, /* PAGES => nothing */
0, /* PAGESIZE => nothing */
+ 0, /* TSDB_PAGESIZE => nothing */
0, /* PRECISION => nothing */
0, /* REPLICA => nothing */
0, /* STRICT => nothing */
@@ -996,7 +1007,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* WAL_RETENTION_SIZE => nothing */
0, /* WAL_ROLL_PERIOD => nothing */
0, /* WAL_SEGMENT_SIZE => nothing */
- 0, /* SST_TRIGGER => nothing */
+ 0, /* STT_TRIGGER => nothing */
0, /* TABLE_PREFIX => nothing */
0, /* TABLE_SUFFIX => nothing */
0, /* NK_COLON => nothing */
@@ -1165,58 +1176,58 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 255, /* AFTER => ABORT */
- 255, /* ATTACH => ABORT */
- 255, /* BEFORE => ABORT */
- 255, /* BEGIN => ABORT */
- 255, /* BITAND => ABORT */
- 255, /* BITNOT => ABORT */
- 255, /* BITOR => ABORT */
- 255, /* BLOCKS => ABORT */
- 255, /* CHANGE => ABORT */
- 255, /* COMMA => ABORT */
- 255, /* COMPACT => ABORT */
- 255, /* CONCAT => ABORT */
- 255, /* CONFLICT => ABORT */
- 255, /* COPY => ABORT */
- 255, /* DEFERRED => ABORT */
- 255, /* DELIMITERS => ABORT */
- 255, /* DETACH => ABORT */
- 255, /* DIVIDE => ABORT */
- 255, /* DOT => ABORT */
- 255, /* EACH => ABORT */
- 255, /* END => ABORT */
- 255, /* FAIL => ABORT */
- 255, /* FILE => ABORT */
- 255, /* FOR => ABORT */
- 255, /* GLOB => ABORT */
- 255, /* ID => ABORT */
- 255, /* IMMEDIATE => ABORT */
- 255, /* IMPORT => ABORT */
- 255, /* INITIALLY => ABORT */
- 255, /* INSTEAD => ABORT */
- 255, /* ISNULL => ABORT */
- 255, /* KEY => ABORT */
- 255, /* NK_BITNOT => ABORT */
- 255, /* NK_SEMI => ABORT */
- 255, /* NOTNULL => ABORT */
- 255, /* OF => ABORT */
- 255, /* PLUS => ABORT */
- 255, /* PRIVILEGE => ABORT */
- 255, /* RAISE => ABORT */
- 255, /* REPLACE => ABORT */
- 255, /* RESTRICT => ABORT */
- 255, /* ROW => ABORT */
- 255, /* SEMI => ABORT */
- 255, /* STAR => ABORT */
- 255, /* STATEMENT => ABORT */
- 255, /* STRING => ABORT */
- 255, /* TIMES => ABORT */
- 255, /* UPDATE => ABORT */
- 255, /* VALUES => ABORT */
- 255, /* VARIABLE => ABORT */
- 255, /* VIEW => ABORT */
- 255, /* WAL => ABORT */
+ 256, /* AFTER => ABORT */
+ 256, /* ATTACH => ABORT */
+ 256, /* BEFORE => ABORT */
+ 256, /* BEGIN => ABORT */
+ 256, /* BITAND => ABORT */
+ 256, /* BITNOT => ABORT */
+ 256, /* BITOR => ABORT */
+ 256, /* BLOCKS => ABORT */
+ 256, /* CHANGE => ABORT */
+ 256, /* COMMA => ABORT */
+ 256, /* COMPACT => ABORT */
+ 256, /* CONCAT => ABORT */
+ 256, /* CONFLICT => ABORT */
+ 256, /* COPY => ABORT */
+ 256, /* DEFERRED => ABORT */
+ 256, /* DELIMITERS => ABORT */
+ 256, /* DETACH => ABORT */
+ 256, /* DIVIDE => ABORT */
+ 256, /* DOT => ABORT */
+ 256, /* EACH => ABORT */
+ 256, /* END => ABORT */
+ 256, /* FAIL => ABORT */
+ 256, /* FILE => ABORT */
+ 256, /* FOR => ABORT */
+ 256, /* GLOB => ABORT */
+ 256, /* ID => ABORT */
+ 256, /* IMMEDIATE => ABORT */
+ 256, /* IMPORT => ABORT */
+ 256, /* INITIALLY => ABORT */
+ 256, /* INSTEAD => ABORT */
+ 256, /* ISNULL => ABORT */
+ 256, /* KEY => ABORT */
+ 256, /* NK_BITNOT => ABORT */
+ 256, /* NK_SEMI => ABORT */
+ 256, /* NOTNULL => ABORT */
+ 256, /* OF => ABORT */
+ 256, /* PLUS => ABORT */
+ 256, /* PRIVILEGE => ABORT */
+ 256, /* RAISE => ABORT */
+ 256, /* REPLACE => ABORT */
+ 256, /* RESTRICT => ABORT */
+ 256, /* ROW => ABORT */
+ 256, /* SEMI => ABORT */
+ 256, /* STAR => ABORT */
+ 256, /* STATEMENT => ABORT */
+ 256, /* STRING => ABORT */
+ 256, /* TIMES => ABORT */
+ 256, /* UPDATE => ABORT */
+ 256, /* VALUES => ABORT */
+ 256, /* VARIABLE => ABORT */
+ 256, /* VIEW => ABORT */
+ 256, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -1378,361 +1389,362 @@ static const char *const yyTokenName[] = {
/* 71 */ "KEEP",
/* 72 */ "PAGES",
/* 73 */ "PAGESIZE",
- /* 74 */ "PRECISION",
- /* 75 */ "REPLICA",
- /* 76 */ "STRICT",
- /* 77 */ "VGROUPS",
- /* 78 */ "SINGLE_STABLE",
- /* 79 */ "RETENTIONS",
- /* 80 */ "SCHEMALESS",
- /* 81 */ "WAL_LEVEL",
- /* 82 */ "WAL_FSYNC_PERIOD",
- /* 83 */ "WAL_RETENTION_PERIOD",
- /* 84 */ "WAL_RETENTION_SIZE",
- /* 85 */ "WAL_ROLL_PERIOD",
- /* 86 */ "WAL_SEGMENT_SIZE",
- /* 87 */ "SST_TRIGGER",
- /* 88 */ "TABLE_PREFIX",
- /* 89 */ "TABLE_SUFFIX",
- /* 90 */ "NK_COLON",
- /* 91 */ "TABLE",
- /* 92 */ "NK_LP",
- /* 93 */ "NK_RP",
- /* 94 */ "STABLE",
- /* 95 */ "ADD",
- /* 96 */ "COLUMN",
- /* 97 */ "MODIFY",
- /* 98 */ "RENAME",
- /* 99 */ "TAG",
- /* 100 */ "SET",
- /* 101 */ "NK_EQ",
- /* 102 */ "USING",
- /* 103 */ "TAGS",
- /* 104 */ "COMMENT",
- /* 105 */ "BOOL",
- /* 106 */ "TINYINT",
- /* 107 */ "SMALLINT",
- /* 108 */ "INT",
- /* 109 */ "INTEGER",
- /* 110 */ "BIGINT",
- /* 111 */ "FLOAT",
- /* 112 */ "DOUBLE",
- /* 113 */ "BINARY",
- /* 114 */ "TIMESTAMP",
- /* 115 */ "NCHAR",
- /* 116 */ "UNSIGNED",
- /* 117 */ "JSON",
- /* 118 */ "VARCHAR",
- /* 119 */ "MEDIUMBLOB",
- /* 120 */ "BLOB",
- /* 121 */ "VARBINARY",
- /* 122 */ "DECIMAL",
- /* 123 */ "MAX_DELAY",
- /* 124 */ "WATERMARK",
- /* 125 */ "ROLLUP",
- /* 126 */ "TTL",
- /* 127 */ "SMA",
- /* 128 */ "FIRST",
- /* 129 */ "LAST",
- /* 130 */ "SHOW",
- /* 131 */ "DATABASES",
- /* 132 */ "TABLES",
- /* 133 */ "STABLES",
- /* 134 */ "MNODES",
- /* 135 */ "MODULES",
- /* 136 */ "QNODES",
- /* 137 */ "FUNCTIONS",
- /* 138 */ "INDEXES",
- /* 139 */ "ACCOUNTS",
- /* 140 */ "APPS",
- /* 141 */ "CONNECTIONS",
- /* 142 */ "LICENCES",
- /* 143 */ "GRANTS",
- /* 144 */ "QUERIES",
- /* 145 */ "SCORES",
- /* 146 */ "TOPICS",
- /* 147 */ "VARIABLES",
- /* 148 */ "BNODES",
- /* 149 */ "SNODES",
- /* 150 */ "CLUSTER",
- /* 151 */ "TRANSACTIONS",
- /* 152 */ "DISTRIBUTED",
- /* 153 */ "CONSUMERS",
- /* 154 */ "SUBSCRIPTIONS",
- /* 155 */ "VNODES",
- /* 156 */ "LIKE",
- /* 157 */ "INDEX",
- /* 158 */ "FUNCTION",
- /* 159 */ "INTERVAL",
- /* 160 */ "TOPIC",
- /* 161 */ "AS",
- /* 162 */ "WITH",
- /* 163 */ "META",
- /* 164 */ "CONSUMER",
- /* 165 */ "GROUP",
- /* 166 */ "DESC",
- /* 167 */ "DESCRIBE",
- /* 168 */ "RESET",
- /* 169 */ "QUERY",
- /* 170 */ "CACHE",
- /* 171 */ "EXPLAIN",
- /* 172 */ "ANALYZE",
- /* 173 */ "VERBOSE",
- /* 174 */ "NK_BOOL",
- /* 175 */ "RATIO",
- /* 176 */ "NK_FLOAT",
- /* 177 */ "OUTPUTTYPE",
- /* 178 */ "AGGREGATE",
- /* 179 */ "BUFSIZE",
- /* 180 */ "STREAM",
- /* 181 */ "INTO",
- /* 182 */ "TRIGGER",
- /* 183 */ "AT_ONCE",
- /* 184 */ "WINDOW_CLOSE",
- /* 185 */ "IGNORE",
- /* 186 */ "EXPIRED",
- /* 187 */ "KILL",
- /* 188 */ "CONNECTION",
- /* 189 */ "TRANSACTION",
- /* 190 */ "BALANCE",
- /* 191 */ "VGROUP",
- /* 192 */ "MERGE",
- /* 193 */ "REDISTRIBUTE",
- /* 194 */ "SPLIT",
- /* 195 */ "DELETE",
- /* 196 */ "INSERT",
- /* 197 */ "NULL",
- /* 198 */ "NK_QUESTION",
- /* 199 */ "NK_ARROW",
- /* 200 */ "ROWTS",
- /* 201 */ "TBNAME",
- /* 202 */ "QSTART",
- /* 203 */ "QEND",
- /* 204 */ "QDURATION",
- /* 205 */ "WSTART",
- /* 206 */ "WEND",
- /* 207 */ "WDURATION",
- /* 208 */ "CAST",
- /* 209 */ "NOW",
- /* 210 */ "TODAY",
- /* 211 */ "TIMEZONE",
- /* 212 */ "CLIENT_VERSION",
- /* 213 */ "SERVER_VERSION",
- /* 214 */ "SERVER_STATUS",
- /* 215 */ "CURRENT_USER",
- /* 216 */ "COUNT",
- /* 217 */ "LAST_ROW",
- /* 218 */ "BETWEEN",
- /* 219 */ "IS",
- /* 220 */ "NK_LT",
- /* 221 */ "NK_GT",
- /* 222 */ "NK_LE",
- /* 223 */ "NK_GE",
- /* 224 */ "NK_NE",
- /* 225 */ "MATCH",
- /* 226 */ "NMATCH",
- /* 227 */ "CONTAINS",
- /* 228 */ "IN",
- /* 229 */ "JOIN",
- /* 230 */ "INNER",
- /* 231 */ "SELECT",
- /* 232 */ "DISTINCT",
- /* 233 */ "WHERE",
- /* 234 */ "PARTITION",
- /* 235 */ "BY",
- /* 236 */ "SESSION",
- /* 237 */ "STATE_WINDOW",
- /* 238 */ "SLIDING",
- /* 239 */ "FILL",
- /* 240 */ "VALUE",
- /* 241 */ "NONE",
- /* 242 */ "PREV",
- /* 243 */ "LINEAR",
- /* 244 */ "NEXT",
- /* 245 */ "HAVING",
- /* 246 */ "RANGE",
- /* 247 */ "EVERY",
- /* 248 */ "ORDER",
- /* 249 */ "SLIMIT",
- /* 250 */ "SOFFSET",
- /* 251 */ "LIMIT",
- /* 252 */ "OFFSET",
- /* 253 */ "ASC",
- /* 254 */ "NULLS",
- /* 255 */ "ABORT",
- /* 256 */ "AFTER",
- /* 257 */ "ATTACH",
- /* 258 */ "BEFORE",
- /* 259 */ "BEGIN",
- /* 260 */ "BITAND",
- /* 261 */ "BITNOT",
- /* 262 */ "BITOR",
- /* 263 */ "BLOCKS",
- /* 264 */ "CHANGE",
- /* 265 */ "COMMA",
- /* 266 */ "COMPACT",
- /* 267 */ "CONCAT",
- /* 268 */ "CONFLICT",
- /* 269 */ "COPY",
- /* 270 */ "DEFERRED",
- /* 271 */ "DELIMITERS",
- /* 272 */ "DETACH",
- /* 273 */ "DIVIDE",
- /* 274 */ "DOT",
- /* 275 */ "EACH",
- /* 276 */ "END",
- /* 277 */ "FAIL",
- /* 278 */ "FILE",
- /* 279 */ "FOR",
- /* 280 */ "GLOB",
- /* 281 */ "ID",
- /* 282 */ "IMMEDIATE",
- /* 283 */ "IMPORT",
- /* 284 */ "INITIALLY",
- /* 285 */ "INSTEAD",
- /* 286 */ "ISNULL",
- /* 287 */ "KEY",
- /* 288 */ "NK_BITNOT",
- /* 289 */ "NK_SEMI",
- /* 290 */ "NOTNULL",
- /* 291 */ "OF",
- /* 292 */ "PLUS",
- /* 293 */ "PRIVILEGE",
- /* 294 */ "RAISE",
- /* 295 */ "REPLACE",
- /* 296 */ "RESTRICT",
- /* 297 */ "ROW",
- /* 298 */ "SEMI",
- /* 299 */ "STAR",
- /* 300 */ "STATEMENT",
- /* 301 */ "STRING",
- /* 302 */ "TIMES",
- /* 303 */ "UPDATE",
- /* 304 */ "VALUES",
- /* 305 */ "VARIABLE",
- /* 306 */ "VIEW",
- /* 307 */ "WAL",
- /* 308 */ "cmd",
- /* 309 */ "account_options",
- /* 310 */ "alter_account_options",
- /* 311 */ "literal",
- /* 312 */ "alter_account_option",
- /* 313 */ "user_name",
- /* 314 */ "sysinfo_opt",
- /* 315 */ "privileges",
- /* 316 */ "priv_level",
- /* 317 */ "priv_type_list",
- /* 318 */ "priv_type",
- /* 319 */ "db_name",
- /* 320 */ "dnode_endpoint",
- /* 321 */ "not_exists_opt",
- /* 322 */ "db_options",
- /* 323 */ "exists_opt",
- /* 324 */ "alter_db_options",
- /* 325 */ "integer_list",
- /* 326 */ "variable_list",
- /* 327 */ "retention_list",
- /* 328 */ "alter_db_option",
- /* 329 */ "retention",
- /* 330 */ "full_table_name",
- /* 331 */ "column_def_list",
- /* 332 */ "tags_def_opt",
- /* 333 */ "table_options",
- /* 334 */ "multi_create_clause",
- /* 335 */ "tags_def",
- /* 336 */ "multi_drop_clause",
- /* 337 */ "alter_table_clause",
- /* 338 */ "alter_table_options",
- /* 339 */ "column_name",
- /* 340 */ "type_name",
- /* 341 */ "signed_literal",
- /* 342 */ "create_subtable_clause",
- /* 343 */ "specific_cols_opt",
- /* 344 */ "expression_list",
- /* 345 */ "drop_table_clause",
- /* 346 */ "col_name_list",
- /* 347 */ "table_name",
- /* 348 */ "column_def",
- /* 349 */ "duration_list",
- /* 350 */ "rollup_func_list",
- /* 351 */ "alter_table_option",
- /* 352 */ "duration_literal",
- /* 353 */ "rollup_func_name",
- /* 354 */ "function_name",
- /* 355 */ "col_name",
- /* 356 */ "db_name_cond_opt",
- /* 357 */ "like_pattern_opt",
- /* 358 */ "table_name_cond",
- /* 359 */ "from_db_opt",
- /* 360 */ "index_options",
- /* 361 */ "func_list",
- /* 362 */ "sliding_opt",
- /* 363 */ "sma_stream_opt",
- /* 364 */ "func",
- /* 365 */ "stream_options",
- /* 366 */ "topic_name",
- /* 367 */ "query_expression",
- /* 368 */ "cgroup_name",
- /* 369 */ "analyze_opt",
- /* 370 */ "explain_options",
- /* 371 */ "agg_func_opt",
- /* 372 */ "bufsize_opt",
- /* 373 */ "stream_name",
- /* 374 */ "dnode_list",
- /* 375 */ "where_clause_opt",
- /* 376 */ "signed",
- /* 377 */ "literal_func",
- /* 378 */ "literal_list",
- /* 379 */ "table_alias",
- /* 380 */ "column_alias",
- /* 381 */ "expression",
- /* 382 */ "pseudo_column",
- /* 383 */ "column_reference",
- /* 384 */ "function_expression",
- /* 385 */ "subquery",
- /* 386 */ "star_func",
- /* 387 */ "star_func_para_list",
- /* 388 */ "noarg_func",
- /* 389 */ "other_para_list",
- /* 390 */ "star_func_para",
- /* 391 */ "predicate",
- /* 392 */ "compare_op",
- /* 393 */ "in_op",
- /* 394 */ "in_predicate_value",
- /* 395 */ "boolean_value_expression",
- /* 396 */ "boolean_primary",
- /* 397 */ "common_expression",
- /* 398 */ "from_clause_opt",
- /* 399 */ "table_reference_list",
- /* 400 */ "table_reference",
- /* 401 */ "table_primary",
- /* 402 */ "joined_table",
- /* 403 */ "alias_opt",
- /* 404 */ "parenthesized_joined_table",
- /* 405 */ "join_type",
- /* 406 */ "search_condition",
- /* 407 */ "query_specification",
- /* 408 */ "set_quantifier_opt",
- /* 409 */ "select_list",
- /* 410 */ "partition_by_clause_opt",
- /* 411 */ "range_opt",
- /* 412 */ "every_opt",
- /* 413 */ "fill_opt",
- /* 414 */ "twindow_clause_opt",
- /* 415 */ "group_by_clause_opt",
- /* 416 */ "having_clause_opt",
- /* 417 */ "select_item",
- /* 418 */ "fill_mode",
- /* 419 */ "group_by_list",
- /* 420 */ "query_expression_body",
- /* 421 */ "order_by_clause_opt",
- /* 422 */ "slimit_clause_opt",
- /* 423 */ "limit_clause_opt",
- /* 424 */ "query_primary",
- /* 425 */ "sort_specification_list",
- /* 426 */ "sort_specification",
- /* 427 */ "ordering_specification_opt",
- /* 428 */ "null_ordering_opt",
+ /* 74 */ "TSDB_PAGESIZE",
+ /* 75 */ "PRECISION",
+ /* 76 */ "REPLICA",
+ /* 77 */ "STRICT",
+ /* 78 */ "VGROUPS",
+ /* 79 */ "SINGLE_STABLE",
+ /* 80 */ "RETENTIONS",
+ /* 81 */ "SCHEMALESS",
+ /* 82 */ "WAL_LEVEL",
+ /* 83 */ "WAL_FSYNC_PERIOD",
+ /* 84 */ "WAL_RETENTION_PERIOD",
+ /* 85 */ "WAL_RETENTION_SIZE",
+ /* 86 */ "WAL_ROLL_PERIOD",
+ /* 87 */ "WAL_SEGMENT_SIZE",
+ /* 88 */ "STT_TRIGGER",
+ /* 89 */ "TABLE_PREFIX",
+ /* 90 */ "TABLE_SUFFIX",
+ /* 91 */ "NK_COLON",
+ /* 92 */ "TABLE",
+ /* 93 */ "NK_LP",
+ /* 94 */ "NK_RP",
+ /* 95 */ "STABLE",
+ /* 96 */ "ADD",
+ /* 97 */ "COLUMN",
+ /* 98 */ "MODIFY",
+ /* 99 */ "RENAME",
+ /* 100 */ "TAG",
+ /* 101 */ "SET",
+ /* 102 */ "NK_EQ",
+ /* 103 */ "USING",
+ /* 104 */ "TAGS",
+ /* 105 */ "COMMENT",
+ /* 106 */ "BOOL",
+ /* 107 */ "TINYINT",
+ /* 108 */ "SMALLINT",
+ /* 109 */ "INT",
+ /* 110 */ "INTEGER",
+ /* 111 */ "BIGINT",
+ /* 112 */ "FLOAT",
+ /* 113 */ "DOUBLE",
+ /* 114 */ "BINARY",
+ /* 115 */ "TIMESTAMP",
+ /* 116 */ "NCHAR",
+ /* 117 */ "UNSIGNED",
+ /* 118 */ "JSON",
+ /* 119 */ "VARCHAR",
+ /* 120 */ "MEDIUMBLOB",
+ /* 121 */ "BLOB",
+ /* 122 */ "VARBINARY",
+ /* 123 */ "DECIMAL",
+ /* 124 */ "MAX_DELAY",
+ /* 125 */ "WATERMARK",
+ /* 126 */ "ROLLUP",
+ /* 127 */ "TTL",
+ /* 128 */ "SMA",
+ /* 129 */ "FIRST",
+ /* 130 */ "LAST",
+ /* 131 */ "SHOW",
+ /* 132 */ "DATABASES",
+ /* 133 */ "TABLES",
+ /* 134 */ "STABLES",
+ /* 135 */ "MNODES",
+ /* 136 */ "MODULES",
+ /* 137 */ "QNODES",
+ /* 138 */ "FUNCTIONS",
+ /* 139 */ "INDEXES",
+ /* 140 */ "ACCOUNTS",
+ /* 141 */ "APPS",
+ /* 142 */ "CONNECTIONS",
+ /* 143 */ "LICENCES",
+ /* 144 */ "GRANTS",
+ /* 145 */ "QUERIES",
+ /* 146 */ "SCORES",
+ /* 147 */ "TOPICS",
+ /* 148 */ "VARIABLES",
+ /* 149 */ "BNODES",
+ /* 150 */ "SNODES",
+ /* 151 */ "CLUSTER",
+ /* 152 */ "TRANSACTIONS",
+ /* 153 */ "DISTRIBUTED",
+ /* 154 */ "CONSUMERS",
+ /* 155 */ "SUBSCRIPTIONS",
+ /* 156 */ "VNODES",
+ /* 157 */ "LIKE",
+ /* 158 */ "INDEX",
+ /* 159 */ "FUNCTION",
+ /* 160 */ "INTERVAL",
+ /* 161 */ "TOPIC",
+ /* 162 */ "AS",
+ /* 163 */ "WITH",
+ /* 164 */ "META",
+ /* 165 */ "CONSUMER",
+ /* 166 */ "GROUP",
+ /* 167 */ "DESC",
+ /* 168 */ "DESCRIBE",
+ /* 169 */ "RESET",
+ /* 170 */ "QUERY",
+ /* 171 */ "CACHE",
+ /* 172 */ "EXPLAIN",
+ /* 173 */ "ANALYZE",
+ /* 174 */ "VERBOSE",
+ /* 175 */ "NK_BOOL",
+ /* 176 */ "RATIO",
+ /* 177 */ "NK_FLOAT",
+ /* 178 */ "OUTPUTTYPE",
+ /* 179 */ "AGGREGATE",
+ /* 180 */ "BUFSIZE",
+ /* 181 */ "STREAM",
+ /* 182 */ "INTO",
+ /* 183 */ "TRIGGER",
+ /* 184 */ "AT_ONCE",
+ /* 185 */ "WINDOW_CLOSE",
+ /* 186 */ "IGNORE",
+ /* 187 */ "EXPIRED",
+ /* 188 */ "KILL",
+ /* 189 */ "CONNECTION",
+ /* 190 */ "TRANSACTION",
+ /* 191 */ "BALANCE",
+ /* 192 */ "VGROUP",
+ /* 193 */ "MERGE",
+ /* 194 */ "REDISTRIBUTE",
+ /* 195 */ "SPLIT",
+ /* 196 */ "DELETE",
+ /* 197 */ "INSERT",
+ /* 198 */ "NULL",
+ /* 199 */ "NK_QUESTION",
+ /* 200 */ "NK_ARROW",
+ /* 201 */ "ROWTS",
+ /* 202 */ "TBNAME",
+ /* 203 */ "QSTART",
+ /* 204 */ "QEND",
+ /* 205 */ "QDURATION",
+ /* 206 */ "WSTART",
+ /* 207 */ "WEND",
+ /* 208 */ "WDURATION",
+ /* 209 */ "CAST",
+ /* 210 */ "NOW",
+ /* 211 */ "TODAY",
+ /* 212 */ "TIMEZONE",
+ /* 213 */ "CLIENT_VERSION",
+ /* 214 */ "SERVER_VERSION",
+ /* 215 */ "SERVER_STATUS",
+ /* 216 */ "CURRENT_USER",
+ /* 217 */ "COUNT",
+ /* 218 */ "LAST_ROW",
+ /* 219 */ "BETWEEN",
+ /* 220 */ "IS",
+ /* 221 */ "NK_LT",
+ /* 222 */ "NK_GT",
+ /* 223 */ "NK_LE",
+ /* 224 */ "NK_GE",
+ /* 225 */ "NK_NE",
+ /* 226 */ "MATCH",
+ /* 227 */ "NMATCH",
+ /* 228 */ "CONTAINS",
+ /* 229 */ "IN",
+ /* 230 */ "JOIN",
+ /* 231 */ "INNER",
+ /* 232 */ "SELECT",
+ /* 233 */ "DISTINCT",
+ /* 234 */ "WHERE",
+ /* 235 */ "PARTITION",
+ /* 236 */ "BY",
+ /* 237 */ "SESSION",
+ /* 238 */ "STATE_WINDOW",
+ /* 239 */ "SLIDING",
+ /* 240 */ "FILL",
+ /* 241 */ "VALUE",
+ /* 242 */ "NONE",
+ /* 243 */ "PREV",
+ /* 244 */ "LINEAR",
+ /* 245 */ "NEXT",
+ /* 246 */ "HAVING",
+ /* 247 */ "RANGE",
+ /* 248 */ "EVERY",
+ /* 249 */ "ORDER",
+ /* 250 */ "SLIMIT",
+ /* 251 */ "SOFFSET",
+ /* 252 */ "LIMIT",
+ /* 253 */ "OFFSET",
+ /* 254 */ "ASC",
+ /* 255 */ "NULLS",
+ /* 256 */ "ABORT",
+ /* 257 */ "AFTER",
+ /* 258 */ "ATTACH",
+ /* 259 */ "BEFORE",
+ /* 260 */ "BEGIN",
+ /* 261 */ "BITAND",
+ /* 262 */ "BITNOT",
+ /* 263 */ "BITOR",
+ /* 264 */ "BLOCKS",
+ /* 265 */ "CHANGE",
+ /* 266 */ "COMMA",
+ /* 267 */ "COMPACT",
+ /* 268 */ "CONCAT",
+ /* 269 */ "CONFLICT",
+ /* 270 */ "COPY",
+ /* 271 */ "DEFERRED",
+ /* 272 */ "DELIMITERS",
+ /* 273 */ "DETACH",
+ /* 274 */ "DIVIDE",
+ /* 275 */ "DOT",
+ /* 276 */ "EACH",
+ /* 277 */ "END",
+ /* 278 */ "FAIL",
+ /* 279 */ "FILE",
+ /* 280 */ "FOR",
+ /* 281 */ "GLOB",
+ /* 282 */ "ID",
+ /* 283 */ "IMMEDIATE",
+ /* 284 */ "IMPORT",
+ /* 285 */ "INITIALLY",
+ /* 286 */ "INSTEAD",
+ /* 287 */ "ISNULL",
+ /* 288 */ "KEY",
+ /* 289 */ "NK_BITNOT",
+ /* 290 */ "NK_SEMI",
+ /* 291 */ "NOTNULL",
+ /* 292 */ "OF",
+ /* 293 */ "PLUS",
+ /* 294 */ "PRIVILEGE",
+ /* 295 */ "RAISE",
+ /* 296 */ "REPLACE",
+ /* 297 */ "RESTRICT",
+ /* 298 */ "ROW",
+ /* 299 */ "SEMI",
+ /* 300 */ "STAR",
+ /* 301 */ "STATEMENT",
+ /* 302 */ "STRING",
+ /* 303 */ "TIMES",
+ /* 304 */ "UPDATE",
+ /* 305 */ "VALUES",
+ /* 306 */ "VARIABLE",
+ /* 307 */ "VIEW",
+ /* 308 */ "WAL",
+ /* 309 */ "cmd",
+ /* 310 */ "account_options",
+ /* 311 */ "alter_account_options",
+ /* 312 */ "literal",
+ /* 313 */ "alter_account_option",
+ /* 314 */ "user_name",
+ /* 315 */ "sysinfo_opt",
+ /* 316 */ "privileges",
+ /* 317 */ "priv_level",
+ /* 318 */ "priv_type_list",
+ /* 319 */ "priv_type",
+ /* 320 */ "db_name",
+ /* 321 */ "dnode_endpoint",
+ /* 322 */ "not_exists_opt",
+ /* 323 */ "db_options",
+ /* 324 */ "exists_opt",
+ /* 325 */ "alter_db_options",
+ /* 326 */ "integer_list",
+ /* 327 */ "variable_list",
+ /* 328 */ "retention_list",
+ /* 329 */ "alter_db_option",
+ /* 330 */ "retention",
+ /* 331 */ "full_table_name",
+ /* 332 */ "column_def_list",
+ /* 333 */ "tags_def_opt",
+ /* 334 */ "table_options",
+ /* 335 */ "multi_create_clause",
+ /* 336 */ "tags_def",
+ /* 337 */ "multi_drop_clause",
+ /* 338 */ "alter_table_clause",
+ /* 339 */ "alter_table_options",
+ /* 340 */ "column_name",
+ /* 341 */ "type_name",
+ /* 342 */ "signed_literal",
+ /* 343 */ "create_subtable_clause",
+ /* 344 */ "specific_cols_opt",
+ /* 345 */ "expression_list",
+ /* 346 */ "drop_table_clause",
+ /* 347 */ "col_name_list",
+ /* 348 */ "table_name",
+ /* 349 */ "column_def",
+ /* 350 */ "duration_list",
+ /* 351 */ "rollup_func_list",
+ /* 352 */ "alter_table_option",
+ /* 353 */ "duration_literal",
+ /* 354 */ "rollup_func_name",
+ /* 355 */ "function_name",
+ /* 356 */ "col_name",
+ /* 357 */ "db_name_cond_opt",
+ /* 358 */ "like_pattern_opt",
+ /* 359 */ "table_name_cond",
+ /* 360 */ "from_db_opt",
+ /* 361 */ "index_options",
+ /* 362 */ "func_list",
+ /* 363 */ "sliding_opt",
+ /* 364 */ "sma_stream_opt",
+ /* 365 */ "func",
+ /* 366 */ "stream_options",
+ /* 367 */ "topic_name",
+ /* 368 */ "query_expression",
+ /* 369 */ "cgroup_name",
+ /* 370 */ "analyze_opt",
+ /* 371 */ "explain_options",
+ /* 372 */ "agg_func_opt",
+ /* 373 */ "bufsize_opt",
+ /* 374 */ "stream_name",
+ /* 375 */ "dnode_list",
+ /* 376 */ "where_clause_opt",
+ /* 377 */ "signed",
+ /* 378 */ "literal_func",
+ /* 379 */ "literal_list",
+ /* 380 */ "table_alias",
+ /* 381 */ "column_alias",
+ /* 382 */ "expression",
+ /* 383 */ "pseudo_column",
+ /* 384 */ "column_reference",
+ /* 385 */ "function_expression",
+ /* 386 */ "subquery",
+ /* 387 */ "star_func",
+ /* 388 */ "star_func_para_list",
+ /* 389 */ "noarg_func",
+ /* 390 */ "other_para_list",
+ /* 391 */ "star_func_para",
+ /* 392 */ "predicate",
+ /* 393 */ "compare_op",
+ /* 394 */ "in_op",
+ /* 395 */ "in_predicate_value",
+ /* 396 */ "boolean_value_expression",
+ /* 397 */ "boolean_primary",
+ /* 398 */ "common_expression",
+ /* 399 */ "from_clause_opt",
+ /* 400 */ "table_reference_list",
+ /* 401 */ "table_reference",
+ /* 402 */ "table_primary",
+ /* 403 */ "joined_table",
+ /* 404 */ "alias_opt",
+ /* 405 */ "parenthesized_joined_table",
+ /* 406 */ "join_type",
+ /* 407 */ "search_condition",
+ /* 408 */ "query_specification",
+ /* 409 */ "set_quantifier_opt",
+ /* 410 */ "select_list",
+ /* 411 */ "partition_by_clause_opt",
+ /* 412 */ "range_opt",
+ /* 413 */ "every_opt",
+ /* 414 */ "fill_opt",
+ /* 415 */ "twindow_clause_opt",
+ /* 416 */ "group_by_clause_opt",
+ /* 417 */ "having_clause_opt",
+ /* 418 */ "select_item",
+ /* 419 */ "fill_mode",
+ /* 420 */ "group_by_list",
+ /* 421 */ "query_expression_body",
+ /* 422 */ "order_by_clause_opt",
+ /* 423 */ "slimit_clause_opt",
+ /* 424 */ "limit_clause_opt",
+ /* 425 */ "query_primary",
+ /* 426 */ "sort_specification_list",
+ /* 427 */ "sort_specification",
+ /* 428 */ "ordering_specification_opt",
+ /* 429 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -1825,416 +1837,417 @@ static const char *const yyRuleName[] = {
/* 82 */ "db_options ::= db_options KEEP variable_list",
/* 83 */ "db_options ::= db_options PAGES NK_INTEGER",
/* 84 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
- /* 85 */ "db_options ::= db_options PRECISION NK_STRING",
- /* 86 */ "db_options ::= db_options REPLICA NK_INTEGER",
- /* 87 */ "db_options ::= db_options STRICT NK_STRING",
- /* 88 */ "db_options ::= db_options VGROUPS NK_INTEGER",
- /* 89 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
- /* 90 */ "db_options ::= db_options RETENTIONS retention_list",
- /* 91 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
- /* 92 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
- /* 93 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
- /* 94 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
- /* 95 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 96 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
- /* 97 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 98 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
- /* 99 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
- /* 100 */ "db_options ::= db_options SST_TRIGGER NK_INTEGER",
- /* 101 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER",
- /* 102 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER",
- /* 103 */ "alter_db_options ::= alter_db_option",
- /* 104 */ "alter_db_options ::= alter_db_options alter_db_option",
- /* 105 */ "alter_db_option ::= CACHEMODEL NK_STRING",
- /* 106 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
- /* 107 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
- /* 108 */ "alter_db_option ::= KEEP integer_list",
- /* 109 */ "alter_db_option ::= KEEP variable_list",
- /* 110 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
- /* 111 */ "alter_db_option ::= SST_TRIGGER NK_INTEGER",
- /* 112 */ "integer_list ::= NK_INTEGER",
- /* 113 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
- /* 114 */ "variable_list ::= NK_VARIABLE",
- /* 115 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
- /* 116 */ "retention_list ::= retention",
- /* 117 */ "retention_list ::= retention_list NK_COMMA retention",
- /* 118 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
- /* 119 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
- /* 120 */ "cmd ::= CREATE TABLE multi_create_clause",
- /* 121 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
- /* 122 */ "cmd ::= DROP TABLE multi_drop_clause",
- /* 123 */ "cmd ::= DROP STABLE exists_opt full_table_name",
- /* 124 */ "cmd ::= ALTER TABLE alter_table_clause",
- /* 125 */ "cmd ::= ALTER STABLE alter_table_clause",
- /* 126 */ "alter_table_clause ::= full_table_name alter_table_options",
- /* 127 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
- /* 128 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
- /* 129 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
- /* 130 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
- /* 131 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
- /* 132 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
- /* 133 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
- /* 134 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
- /* 135 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
- /* 136 */ "multi_create_clause ::= create_subtable_clause",
- /* 137 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
- /* 138 */ "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",
- /* 139 */ "multi_drop_clause ::= drop_table_clause",
- /* 140 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause",
- /* 141 */ "drop_table_clause ::= exists_opt full_table_name",
- /* 142 */ "specific_cols_opt ::=",
- /* 143 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
- /* 144 */ "full_table_name ::= table_name",
- /* 145 */ "full_table_name ::= db_name NK_DOT table_name",
- /* 146 */ "column_def_list ::= column_def",
- /* 147 */ "column_def_list ::= column_def_list NK_COMMA column_def",
- /* 148 */ "column_def ::= column_name type_name",
- /* 149 */ "column_def ::= column_name type_name COMMENT NK_STRING",
- /* 150 */ "type_name ::= BOOL",
- /* 151 */ "type_name ::= TINYINT",
- /* 152 */ "type_name ::= SMALLINT",
- /* 153 */ "type_name ::= INT",
- /* 154 */ "type_name ::= INTEGER",
- /* 155 */ "type_name ::= BIGINT",
- /* 156 */ "type_name ::= FLOAT",
- /* 157 */ "type_name ::= DOUBLE",
- /* 158 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
- /* 159 */ "type_name ::= TIMESTAMP",
- /* 160 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
- /* 161 */ "type_name ::= TINYINT UNSIGNED",
- /* 162 */ "type_name ::= SMALLINT UNSIGNED",
- /* 163 */ "type_name ::= INT UNSIGNED",
- /* 164 */ "type_name ::= BIGINT UNSIGNED",
- /* 165 */ "type_name ::= JSON",
- /* 166 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
- /* 167 */ "type_name ::= MEDIUMBLOB",
- /* 168 */ "type_name ::= BLOB",
- /* 169 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
- /* 170 */ "type_name ::= DECIMAL",
- /* 171 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
- /* 172 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 173 */ "tags_def_opt ::=",
- /* 174 */ "tags_def_opt ::= tags_def",
- /* 175 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
- /* 176 */ "table_options ::=",
- /* 177 */ "table_options ::= table_options COMMENT NK_STRING",
- /* 178 */ "table_options ::= table_options MAX_DELAY duration_list",
- /* 179 */ "table_options ::= table_options WATERMARK duration_list",
- /* 180 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
- /* 181 */ "table_options ::= table_options TTL NK_INTEGER",
- /* 182 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
- /* 183 */ "alter_table_options ::= alter_table_option",
- /* 184 */ "alter_table_options ::= alter_table_options alter_table_option",
- /* 185 */ "alter_table_option ::= COMMENT NK_STRING",
- /* 186 */ "alter_table_option ::= TTL NK_INTEGER",
- /* 187 */ "duration_list ::= duration_literal",
- /* 188 */ "duration_list ::= duration_list NK_COMMA duration_literal",
- /* 189 */ "rollup_func_list ::= rollup_func_name",
- /* 190 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
- /* 191 */ "rollup_func_name ::= function_name",
- /* 192 */ "rollup_func_name ::= FIRST",
- /* 193 */ "rollup_func_name ::= LAST",
- /* 194 */ "col_name_list ::= col_name",
- /* 195 */ "col_name_list ::= col_name_list NK_COMMA col_name",
- /* 196 */ "col_name ::= column_name",
- /* 197 */ "cmd ::= SHOW DNODES",
- /* 198 */ "cmd ::= SHOW USERS",
- /* 199 */ "cmd ::= SHOW DATABASES",
- /* 200 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
- /* 201 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
- /* 202 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
- /* 203 */ "cmd ::= SHOW MNODES",
- /* 204 */ "cmd ::= SHOW MODULES",
- /* 205 */ "cmd ::= SHOW QNODES",
- /* 206 */ "cmd ::= SHOW FUNCTIONS",
- /* 207 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
- /* 208 */ "cmd ::= SHOW STREAMS",
- /* 209 */ "cmd ::= SHOW ACCOUNTS",
- /* 210 */ "cmd ::= SHOW APPS",
- /* 211 */ "cmd ::= SHOW CONNECTIONS",
- /* 212 */ "cmd ::= SHOW LICENCES",
- /* 213 */ "cmd ::= SHOW GRANTS",
- /* 214 */ "cmd ::= SHOW CREATE DATABASE db_name",
- /* 215 */ "cmd ::= SHOW CREATE TABLE full_table_name",
- /* 216 */ "cmd ::= SHOW CREATE STABLE full_table_name",
- /* 217 */ "cmd ::= SHOW QUERIES",
- /* 218 */ "cmd ::= SHOW SCORES",
- /* 219 */ "cmd ::= SHOW TOPICS",
- /* 220 */ "cmd ::= SHOW VARIABLES",
- /* 221 */ "cmd ::= SHOW LOCAL VARIABLES",
- /* 222 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES",
- /* 223 */ "cmd ::= SHOW BNODES",
- /* 224 */ "cmd ::= SHOW SNODES",
- /* 225 */ "cmd ::= SHOW CLUSTER",
- /* 226 */ "cmd ::= SHOW TRANSACTIONS",
- /* 227 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
- /* 228 */ "cmd ::= SHOW CONSUMERS",
- /* 229 */ "cmd ::= SHOW SUBSCRIPTIONS",
- /* 230 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
- /* 231 */ "cmd ::= SHOW VNODES NK_INTEGER",
- /* 232 */ "cmd ::= SHOW VNODES NK_STRING",
- /* 233 */ "db_name_cond_opt ::=",
- /* 234 */ "db_name_cond_opt ::= db_name NK_DOT",
- /* 235 */ "like_pattern_opt ::=",
- /* 236 */ "like_pattern_opt ::= LIKE NK_STRING",
- /* 237 */ "table_name_cond ::= table_name",
- /* 238 */ "from_db_opt ::=",
- /* 239 */ "from_db_opt ::= FROM db_name",
- /* 240 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options",
- /* 241 */ "cmd ::= DROP INDEX exists_opt full_table_name",
- /* 242 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 243 */ "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",
- /* 244 */ "func_list ::= func",
- /* 245 */ "func_list ::= func_list NK_COMMA func",
- /* 246 */ "func ::= function_name NK_LP expression_list NK_RP",
- /* 247 */ "sma_stream_opt ::=",
- /* 248 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal",
- /* 249 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal",
- /* 250 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression",
- /* 251 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name",
- /* 252 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name",
- /* 253 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name",
- /* 254 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name",
- /* 255 */ "cmd ::= DROP TOPIC exists_opt topic_name",
- /* 256 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
- /* 257 */ "cmd ::= DESC full_table_name",
- /* 258 */ "cmd ::= DESCRIBE full_table_name",
- /* 259 */ "cmd ::= RESET QUERY CACHE",
- /* 260 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression",
- /* 261 */ "analyze_opt ::=",
- /* 262 */ "analyze_opt ::= ANALYZE",
- /* 263 */ "explain_options ::=",
- /* 264 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 265 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 266 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
- /* 267 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 268 */ "agg_func_opt ::=",
- /* 269 */ "agg_func_opt ::= AGGREGATE",
- /* 270 */ "bufsize_opt ::=",
- /* 271 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 272 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression",
- /* 273 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 274 */ "stream_options ::=",
- /* 275 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 276 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 277 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 278 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 279 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 280 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 281 */ "cmd ::= KILL QUERY NK_STRING",
- /* 282 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 283 */ "cmd ::= BALANCE VGROUP",
- /* 284 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 285 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 286 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 287 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 288 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 289 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 290 */ "cmd ::= query_expression",
- /* 291 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression",
- /* 292 */ "cmd ::= INSERT INTO full_table_name query_expression",
- /* 293 */ "literal ::= NK_INTEGER",
- /* 294 */ "literal ::= NK_FLOAT",
- /* 295 */ "literal ::= NK_STRING",
- /* 296 */ "literal ::= NK_BOOL",
- /* 297 */ "literal ::= TIMESTAMP NK_STRING",
- /* 298 */ "literal ::= duration_literal",
- /* 299 */ "literal ::= NULL",
- /* 300 */ "literal ::= NK_QUESTION",
- /* 301 */ "duration_literal ::= NK_VARIABLE",
- /* 302 */ "signed ::= NK_INTEGER",
- /* 303 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 304 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 305 */ "signed ::= NK_FLOAT",
- /* 306 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 307 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 308 */ "signed_literal ::= signed",
- /* 309 */ "signed_literal ::= NK_STRING",
- /* 310 */ "signed_literal ::= NK_BOOL",
- /* 311 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 312 */ "signed_literal ::= duration_literal",
- /* 313 */ "signed_literal ::= NULL",
- /* 314 */ "signed_literal ::= literal_func",
- /* 315 */ "signed_literal ::= NK_QUESTION",
- /* 316 */ "literal_list ::= signed_literal",
- /* 317 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 318 */ "db_name ::= NK_ID",
- /* 319 */ "table_name ::= NK_ID",
- /* 320 */ "column_name ::= NK_ID",
- /* 321 */ "function_name ::= NK_ID",
- /* 322 */ "table_alias ::= NK_ID",
- /* 323 */ "column_alias ::= NK_ID",
- /* 324 */ "user_name ::= NK_ID",
- /* 325 */ "topic_name ::= NK_ID",
- /* 326 */ "stream_name ::= NK_ID",
- /* 327 */ "cgroup_name ::= NK_ID",
- /* 328 */ "expression ::= literal",
- /* 329 */ "expression ::= pseudo_column",
- /* 330 */ "expression ::= column_reference",
- /* 331 */ "expression ::= function_expression",
- /* 332 */ "expression ::= subquery",
- /* 333 */ "expression ::= NK_LP expression NK_RP",
- /* 334 */ "expression ::= NK_PLUS expression",
- /* 335 */ "expression ::= NK_MINUS expression",
- /* 336 */ "expression ::= expression NK_PLUS expression",
- /* 337 */ "expression ::= expression NK_MINUS expression",
- /* 338 */ "expression ::= expression NK_STAR expression",
- /* 339 */ "expression ::= expression NK_SLASH expression",
- /* 340 */ "expression ::= expression NK_REM expression",
- /* 341 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 342 */ "expression ::= expression NK_BITAND expression",
- /* 343 */ "expression ::= expression NK_BITOR expression",
- /* 344 */ "expression_list ::= expression",
- /* 345 */ "expression_list ::= expression_list NK_COMMA expression",
- /* 346 */ "column_reference ::= column_name",
- /* 347 */ "column_reference ::= table_name NK_DOT column_name",
- /* 348 */ "pseudo_column ::= ROWTS",
- /* 349 */ "pseudo_column ::= TBNAME",
- /* 350 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 351 */ "pseudo_column ::= QSTART",
- /* 352 */ "pseudo_column ::= QEND",
- /* 353 */ "pseudo_column ::= QDURATION",
- /* 354 */ "pseudo_column ::= WSTART",
- /* 355 */ "pseudo_column ::= WEND",
- /* 356 */ "pseudo_column ::= WDURATION",
- /* 357 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 358 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 359 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
- /* 360 */ "function_expression ::= literal_func",
- /* 361 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 362 */ "literal_func ::= NOW",
- /* 363 */ "noarg_func ::= NOW",
- /* 364 */ "noarg_func ::= TODAY",
- /* 365 */ "noarg_func ::= TIMEZONE",
- /* 366 */ "noarg_func ::= DATABASE",
- /* 367 */ "noarg_func ::= CLIENT_VERSION",
- /* 368 */ "noarg_func ::= SERVER_VERSION",
- /* 369 */ "noarg_func ::= SERVER_STATUS",
- /* 370 */ "noarg_func ::= CURRENT_USER",
- /* 371 */ "noarg_func ::= USER",
- /* 372 */ "star_func ::= COUNT",
- /* 373 */ "star_func ::= FIRST",
- /* 374 */ "star_func ::= LAST",
- /* 375 */ "star_func ::= LAST_ROW",
- /* 376 */ "star_func_para_list ::= NK_STAR",
- /* 377 */ "star_func_para_list ::= other_para_list",
- /* 378 */ "other_para_list ::= star_func_para",
- /* 379 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 380 */ "star_func_para ::= expression",
- /* 381 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 382 */ "predicate ::= expression compare_op expression",
- /* 383 */ "predicate ::= expression BETWEEN expression AND expression",
- /* 384 */ "predicate ::= expression NOT BETWEEN expression AND expression",
- /* 385 */ "predicate ::= expression IS NULL",
- /* 386 */ "predicate ::= expression IS NOT NULL",
- /* 387 */ "predicate ::= expression in_op in_predicate_value",
- /* 388 */ "compare_op ::= NK_LT",
- /* 389 */ "compare_op ::= NK_GT",
- /* 390 */ "compare_op ::= NK_LE",
- /* 391 */ "compare_op ::= NK_GE",
- /* 392 */ "compare_op ::= NK_NE",
- /* 393 */ "compare_op ::= NK_EQ",
- /* 394 */ "compare_op ::= LIKE",
- /* 395 */ "compare_op ::= NOT LIKE",
- /* 396 */ "compare_op ::= MATCH",
- /* 397 */ "compare_op ::= NMATCH",
- /* 398 */ "compare_op ::= CONTAINS",
- /* 399 */ "in_op ::= IN",
- /* 400 */ "in_op ::= NOT IN",
- /* 401 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 402 */ "boolean_value_expression ::= boolean_primary",
- /* 403 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 404 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 405 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 406 */ "boolean_primary ::= predicate",
- /* 407 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 408 */ "common_expression ::= expression",
- /* 409 */ "common_expression ::= boolean_value_expression",
- /* 410 */ "from_clause_opt ::=",
- /* 411 */ "from_clause_opt ::= FROM table_reference_list",
- /* 412 */ "table_reference_list ::= table_reference",
- /* 413 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 414 */ "table_reference ::= table_primary",
- /* 415 */ "table_reference ::= joined_table",
- /* 416 */ "table_primary ::= table_name alias_opt",
- /* 417 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 418 */ "table_primary ::= subquery alias_opt",
- /* 419 */ "table_primary ::= parenthesized_joined_table",
- /* 420 */ "alias_opt ::=",
- /* 421 */ "alias_opt ::= table_alias",
- /* 422 */ "alias_opt ::= AS table_alias",
- /* 423 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 424 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 425 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 426 */ "join_type ::=",
- /* 427 */ "join_type ::= INNER",
- /* 428 */ "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",
- /* 429 */ "set_quantifier_opt ::=",
- /* 430 */ "set_quantifier_opt ::= DISTINCT",
- /* 431 */ "set_quantifier_opt ::= ALL",
- /* 432 */ "select_list ::= select_item",
- /* 433 */ "select_list ::= select_list NK_COMMA select_item",
- /* 434 */ "select_item ::= NK_STAR",
- /* 435 */ "select_item ::= common_expression",
- /* 436 */ "select_item ::= common_expression column_alias",
- /* 437 */ "select_item ::= common_expression AS column_alias",
- /* 438 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 439 */ "where_clause_opt ::=",
- /* 440 */ "where_clause_opt ::= WHERE search_condition",
- /* 441 */ "partition_by_clause_opt ::=",
- /* 442 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
- /* 443 */ "twindow_clause_opt ::=",
- /* 444 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 445 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
- /* 446 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 447 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 448 */ "sliding_opt ::=",
- /* 449 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 450 */ "fill_opt ::=",
- /* 451 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 452 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 453 */ "fill_mode ::= NONE",
- /* 454 */ "fill_mode ::= PREV",
- /* 455 */ "fill_mode ::= NULL",
- /* 456 */ "fill_mode ::= LINEAR",
- /* 457 */ "fill_mode ::= NEXT",
- /* 458 */ "group_by_clause_opt ::=",
- /* 459 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 460 */ "group_by_list ::= expression",
- /* 461 */ "group_by_list ::= group_by_list NK_COMMA expression",
- /* 462 */ "having_clause_opt ::=",
- /* 463 */ "having_clause_opt ::= HAVING search_condition",
- /* 464 */ "range_opt ::=",
- /* 465 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP",
- /* 466 */ "every_opt ::=",
- /* 467 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 468 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 469 */ "query_expression_body ::= query_primary",
- /* 470 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
- /* 471 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
- /* 472 */ "query_primary ::= query_specification",
- /* 473 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
- /* 474 */ "order_by_clause_opt ::=",
- /* 475 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 476 */ "slimit_clause_opt ::=",
- /* 477 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 478 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 479 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 480 */ "limit_clause_opt ::=",
- /* 481 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 482 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 483 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 484 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 485 */ "search_condition ::= common_expression",
- /* 486 */ "sort_specification_list ::= sort_specification",
- /* 487 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 488 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
- /* 489 */ "ordering_specification_opt ::=",
- /* 490 */ "ordering_specification_opt ::= ASC",
- /* 491 */ "ordering_specification_opt ::= DESC",
- /* 492 */ "null_ordering_opt ::=",
- /* 493 */ "null_ordering_opt ::= NULLS FIRST",
- /* 494 */ "null_ordering_opt ::= NULLS LAST",
+ /* 85 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
+ /* 86 */ "db_options ::= db_options PRECISION NK_STRING",
+ /* 87 */ "db_options ::= db_options REPLICA NK_INTEGER",
+ /* 88 */ "db_options ::= db_options STRICT NK_STRING",
+ /* 89 */ "db_options ::= db_options VGROUPS NK_INTEGER",
+ /* 90 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
+ /* 91 */ "db_options ::= db_options RETENTIONS retention_list",
+ /* 92 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
+ /* 93 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
+ /* 94 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 95 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 96 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 97 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
+ /* 98 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 99 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
+ /* 100 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
+ /* 101 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
+ /* 102 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER",
+ /* 103 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER",
+ /* 104 */ "alter_db_options ::= alter_db_option",
+ /* 105 */ "alter_db_options ::= alter_db_options alter_db_option",
+ /* 106 */ "alter_db_option ::= CACHEMODEL NK_STRING",
+ /* 107 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
+ /* 108 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 109 */ "alter_db_option ::= KEEP integer_list",
+ /* 110 */ "alter_db_option ::= KEEP variable_list",
+ /* 111 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
+ /* 112 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
+ /* 113 */ "integer_list ::= NK_INTEGER",
+ /* 114 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
+ /* 115 */ "variable_list ::= NK_VARIABLE",
+ /* 116 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
+ /* 117 */ "retention_list ::= retention",
+ /* 118 */ "retention_list ::= retention_list NK_COMMA retention",
+ /* 119 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
+ /* 120 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
+ /* 121 */ "cmd ::= CREATE TABLE multi_create_clause",
+ /* 122 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
+ /* 123 */ "cmd ::= DROP TABLE multi_drop_clause",
+ /* 124 */ "cmd ::= DROP STABLE exists_opt full_table_name",
+ /* 125 */ "cmd ::= ALTER TABLE alter_table_clause",
+ /* 126 */ "cmd ::= ALTER STABLE alter_table_clause",
+ /* 127 */ "alter_table_clause ::= full_table_name alter_table_options",
+ /* 128 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
+ /* 129 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
+ /* 130 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
+ /* 131 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
+ /* 132 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
+ /* 133 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
+ /* 134 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
+ /* 135 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
+ /* 136 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
+ /* 137 */ "multi_create_clause ::= create_subtable_clause",
+ /* 138 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
+ /* 139 */ "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",
+ /* 140 */ "multi_drop_clause ::= drop_table_clause",
+ /* 141 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause",
+ /* 142 */ "drop_table_clause ::= exists_opt full_table_name",
+ /* 143 */ "specific_cols_opt ::=",
+ /* 144 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
+ /* 145 */ "full_table_name ::= table_name",
+ /* 146 */ "full_table_name ::= db_name NK_DOT table_name",
+ /* 147 */ "column_def_list ::= column_def",
+ /* 148 */ "column_def_list ::= column_def_list NK_COMMA column_def",
+ /* 149 */ "column_def ::= column_name type_name",
+ /* 150 */ "column_def ::= column_name type_name COMMENT NK_STRING",
+ /* 151 */ "type_name ::= BOOL",
+ /* 152 */ "type_name ::= TINYINT",
+ /* 153 */ "type_name ::= SMALLINT",
+ /* 154 */ "type_name ::= INT",
+ /* 155 */ "type_name ::= INTEGER",
+ /* 156 */ "type_name ::= BIGINT",
+ /* 157 */ "type_name ::= FLOAT",
+ /* 158 */ "type_name ::= DOUBLE",
+ /* 159 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
+ /* 160 */ "type_name ::= TIMESTAMP",
+ /* 161 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
+ /* 162 */ "type_name ::= TINYINT UNSIGNED",
+ /* 163 */ "type_name ::= SMALLINT UNSIGNED",
+ /* 164 */ "type_name ::= INT UNSIGNED",
+ /* 165 */ "type_name ::= BIGINT UNSIGNED",
+ /* 166 */ "type_name ::= JSON",
+ /* 167 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
+ /* 168 */ "type_name ::= MEDIUMBLOB",
+ /* 169 */ "type_name ::= BLOB",
+ /* 170 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
+ /* 171 */ "type_name ::= DECIMAL",
+ /* 172 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
+ /* 173 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 174 */ "tags_def_opt ::=",
+ /* 175 */ "tags_def_opt ::= tags_def",
+ /* 176 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
+ /* 177 */ "table_options ::=",
+ /* 178 */ "table_options ::= table_options COMMENT NK_STRING",
+ /* 179 */ "table_options ::= table_options MAX_DELAY duration_list",
+ /* 180 */ "table_options ::= table_options WATERMARK duration_list",
+ /* 181 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
+ /* 182 */ "table_options ::= table_options TTL NK_INTEGER",
+ /* 183 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
+ /* 184 */ "alter_table_options ::= alter_table_option",
+ /* 185 */ "alter_table_options ::= alter_table_options alter_table_option",
+ /* 186 */ "alter_table_option ::= COMMENT NK_STRING",
+ /* 187 */ "alter_table_option ::= TTL NK_INTEGER",
+ /* 188 */ "duration_list ::= duration_literal",
+ /* 189 */ "duration_list ::= duration_list NK_COMMA duration_literal",
+ /* 190 */ "rollup_func_list ::= rollup_func_name",
+ /* 191 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
+ /* 192 */ "rollup_func_name ::= function_name",
+ /* 193 */ "rollup_func_name ::= FIRST",
+ /* 194 */ "rollup_func_name ::= LAST",
+ /* 195 */ "col_name_list ::= col_name",
+ /* 196 */ "col_name_list ::= col_name_list NK_COMMA col_name",
+ /* 197 */ "col_name ::= column_name",
+ /* 198 */ "cmd ::= SHOW DNODES",
+ /* 199 */ "cmd ::= SHOW USERS",
+ /* 200 */ "cmd ::= SHOW DATABASES",
+ /* 201 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
+ /* 202 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
+ /* 203 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
+ /* 204 */ "cmd ::= SHOW MNODES",
+ /* 205 */ "cmd ::= SHOW MODULES",
+ /* 206 */ "cmd ::= SHOW QNODES",
+ /* 207 */ "cmd ::= SHOW FUNCTIONS",
+ /* 208 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
+ /* 209 */ "cmd ::= SHOW STREAMS",
+ /* 210 */ "cmd ::= SHOW ACCOUNTS",
+ /* 211 */ "cmd ::= SHOW APPS",
+ /* 212 */ "cmd ::= SHOW CONNECTIONS",
+ /* 213 */ "cmd ::= SHOW LICENCES",
+ /* 214 */ "cmd ::= SHOW GRANTS",
+ /* 215 */ "cmd ::= SHOW CREATE DATABASE db_name",
+ /* 216 */ "cmd ::= SHOW CREATE TABLE full_table_name",
+ /* 217 */ "cmd ::= SHOW CREATE STABLE full_table_name",
+ /* 218 */ "cmd ::= SHOW QUERIES",
+ /* 219 */ "cmd ::= SHOW SCORES",
+ /* 220 */ "cmd ::= SHOW TOPICS",
+ /* 221 */ "cmd ::= SHOW VARIABLES",
+ /* 222 */ "cmd ::= SHOW LOCAL VARIABLES",
+ /* 223 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES",
+ /* 224 */ "cmd ::= SHOW BNODES",
+ /* 225 */ "cmd ::= SHOW SNODES",
+ /* 226 */ "cmd ::= SHOW CLUSTER",
+ /* 227 */ "cmd ::= SHOW TRANSACTIONS",
+ /* 228 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
+ /* 229 */ "cmd ::= SHOW CONSUMERS",
+ /* 230 */ "cmd ::= SHOW SUBSCRIPTIONS",
+ /* 231 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
+ /* 232 */ "cmd ::= SHOW VNODES NK_INTEGER",
+ /* 233 */ "cmd ::= SHOW VNODES NK_STRING",
+ /* 234 */ "db_name_cond_opt ::=",
+ /* 235 */ "db_name_cond_opt ::= db_name NK_DOT",
+ /* 236 */ "like_pattern_opt ::=",
+ /* 237 */ "like_pattern_opt ::= LIKE NK_STRING",
+ /* 238 */ "table_name_cond ::= table_name",
+ /* 239 */ "from_db_opt ::=",
+ /* 240 */ "from_db_opt ::= FROM db_name",
+ /* 241 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options",
+ /* 242 */ "cmd ::= DROP INDEX exists_opt full_table_name",
+ /* 243 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 244 */ "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",
+ /* 245 */ "func_list ::= func",
+ /* 246 */ "func_list ::= func_list NK_COMMA func",
+ /* 247 */ "func ::= function_name NK_LP expression_list NK_RP",
+ /* 248 */ "sma_stream_opt ::=",
+ /* 249 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal",
+ /* 250 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal",
+ /* 251 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression",
+ /* 252 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name",
+ /* 253 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name",
+ /* 254 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name",
+ /* 255 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name",
+ /* 256 */ "cmd ::= DROP TOPIC exists_opt topic_name",
+ /* 257 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
+ /* 258 */ "cmd ::= DESC full_table_name",
+ /* 259 */ "cmd ::= DESCRIBE full_table_name",
+ /* 260 */ "cmd ::= RESET QUERY CACHE",
+ /* 261 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression",
+ /* 262 */ "analyze_opt ::=",
+ /* 263 */ "analyze_opt ::= ANALYZE",
+ /* 264 */ "explain_options ::=",
+ /* 265 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 266 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 267 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
+ /* 268 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 269 */ "agg_func_opt ::=",
+ /* 270 */ "agg_func_opt ::= AGGREGATE",
+ /* 271 */ "bufsize_opt ::=",
+ /* 272 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 273 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression",
+ /* 274 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 275 */ "stream_options ::=",
+ /* 276 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 277 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 278 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 279 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 280 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 281 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 282 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 283 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 284 */ "cmd ::= BALANCE VGROUP",
+ /* 285 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 286 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 287 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 288 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 289 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 290 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 291 */ "cmd ::= query_expression",
+ /* 292 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression",
+ /* 293 */ "cmd ::= INSERT INTO full_table_name query_expression",
+ /* 294 */ "literal ::= NK_INTEGER",
+ /* 295 */ "literal ::= NK_FLOAT",
+ /* 296 */ "literal ::= NK_STRING",
+ /* 297 */ "literal ::= NK_BOOL",
+ /* 298 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 299 */ "literal ::= duration_literal",
+ /* 300 */ "literal ::= NULL",
+ /* 301 */ "literal ::= NK_QUESTION",
+ /* 302 */ "duration_literal ::= NK_VARIABLE",
+ /* 303 */ "signed ::= NK_INTEGER",
+ /* 304 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 305 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 306 */ "signed ::= NK_FLOAT",
+ /* 307 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 308 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 309 */ "signed_literal ::= signed",
+ /* 310 */ "signed_literal ::= NK_STRING",
+ /* 311 */ "signed_literal ::= NK_BOOL",
+ /* 312 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 313 */ "signed_literal ::= duration_literal",
+ /* 314 */ "signed_literal ::= NULL",
+ /* 315 */ "signed_literal ::= literal_func",
+ /* 316 */ "signed_literal ::= NK_QUESTION",
+ /* 317 */ "literal_list ::= signed_literal",
+ /* 318 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 319 */ "db_name ::= NK_ID",
+ /* 320 */ "table_name ::= NK_ID",
+ /* 321 */ "column_name ::= NK_ID",
+ /* 322 */ "function_name ::= NK_ID",
+ /* 323 */ "table_alias ::= NK_ID",
+ /* 324 */ "column_alias ::= NK_ID",
+ /* 325 */ "user_name ::= NK_ID",
+ /* 326 */ "topic_name ::= NK_ID",
+ /* 327 */ "stream_name ::= NK_ID",
+ /* 328 */ "cgroup_name ::= NK_ID",
+ /* 329 */ "expression ::= literal",
+ /* 330 */ "expression ::= pseudo_column",
+ /* 331 */ "expression ::= column_reference",
+ /* 332 */ "expression ::= function_expression",
+ /* 333 */ "expression ::= subquery",
+ /* 334 */ "expression ::= NK_LP expression NK_RP",
+ /* 335 */ "expression ::= NK_PLUS expression",
+ /* 336 */ "expression ::= NK_MINUS expression",
+ /* 337 */ "expression ::= expression NK_PLUS expression",
+ /* 338 */ "expression ::= expression NK_MINUS expression",
+ /* 339 */ "expression ::= expression NK_STAR expression",
+ /* 340 */ "expression ::= expression NK_SLASH expression",
+ /* 341 */ "expression ::= expression NK_REM expression",
+ /* 342 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 343 */ "expression ::= expression NK_BITAND expression",
+ /* 344 */ "expression ::= expression NK_BITOR expression",
+ /* 345 */ "expression_list ::= expression",
+ /* 346 */ "expression_list ::= expression_list NK_COMMA expression",
+ /* 347 */ "column_reference ::= column_name",
+ /* 348 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 349 */ "pseudo_column ::= ROWTS",
+ /* 350 */ "pseudo_column ::= TBNAME",
+ /* 351 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 352 */ "pseudo_column ::= QSTART",
+ /* 353 */ "pseudo_column ::= QEND",
+ /* 354 */ "pseudo_column ::= QDURATION",
+ /* 355 */ "pseudo_column ::= WSTART",
+ /* 356 */ "pseudo_column ::= WEND",
+ /* 357 */ "pseudo_column ::= WDURATION",
+ /* 358 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 359 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 360 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
+ /* 361 */ "function_expression ::= literal_func",
+ /* 362 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 363 */ "literal_func ::= NOW",
+ /* 364 */ "noarg_func ::= NOW",
+ /* 365 */ "noarg_func ::= TODAY",
+ /* 366 */ "noarg_func ::= TIMEZONE",
+ /* 367 */ "noarg_func ::= DATABASE",
+ /* 368 */ "noarg_func ::= CLIENT_VERSION",
+ /* 369 */ "noarg_func ::= SERVER_VERSION",
+ /* 370 */ "noarg_func ::= SERVER_STATUS",
+ /* 371 */ "noarg_func ::= CURRENT_USER",
+ /* 372 */ "noarg_func ::= USER",
+ /* 373 */ "star_func ::= COUNT",
+ /* 374 */ "star_func ::= FIRST",
+ /* 375 */ "star_func ::= LAST",
+ /* 376 */ "star_func ::= LAST_ROW",
+ /* 377 */ "star_func_para_list ::= NK_STAR",
+ /* 378 */ "star_func_para_list ::= other_para_list",
+ /* 379 */ "other_para_list ::= star_func_para",
+ /* 380 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 381 */ "star_func_para ::= expression",
+ /* 382 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 383 */ "predicate ::= expression compare_op expression",
+ /* 384 */ "predicate ::= expression BETWEEN expression AND expression",
+ /* 385 */ "predicate ::= expression NOT BETWEEN expression AND expression",
+ /* 386 */ "predicate ::= expression IS NULL",
+ /* 387 */ "predicate ::= expression IS NOT NULL",
+ /* 388 */ "predicate ::= expression in_op in_predicate_value",
+ /* 389 */ "compare_op ::= NK_LT",
+ /* 390 */ "compare_op ::= NK_GT",
+ /* 391 */ "compare_op ::= NK_LE",
+ /* 392 */ "compare_op ::= NK_GE",
+ /* 393 */ "compare_op ::= NK_NE",
+ /* 394 */ "compare_op ::= NK_EQ",
+ /* 395 */ "compare_op ::= LIKE",
+ /* 396 */ "compare_op ::= NOT LIKE",
+ /* 397 */ "compare_op ::= MATCH",
+ /* 398 */ "compare_op ::= NMATCH",
+ /* 399 */ "compare_op ::= CONTAINS",
+ /* 400 */ "in_op ::= IN",
+ /* 401 */ "in_op ::= NOT IN",
+ /* 402 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 403 */ "boolean_value_expression ::= boolean_primary",
+ /* 404 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 405 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 406 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 407 */ "boolean_primary ::= predicate",
+ /* 408 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 409 */ "common_expression ::= expression",
+ /* 410 */ "common_expression ::= boolean_value_expression",
+ /* 411 */ "from_clause_opt ::=",
+ /* 412 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 413 */ "table_reference_list ::= table_reference",
+ /* 414 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 415 */ "table_reference ::= table_primary",
+ /* 416 */ "table_reference ::= joined_table",
+ /* 417 */ "table_primary ::= table_name alias_opt",
+ /* 418 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 419 */ "table_primary ::= subquery alias_opt",
+ /* 420 */ "table_primary ::= parenthesized_joined_table",
+ /* 421 */ "alias_opt ::=",
+ /* 422 */ "alias_opt ::= table_alias",
+ /* 423 */ "alias_opt ::= AS table_alias",
+ /* 424 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 425 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 426 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 427 */ "join_type ::=",
+ /* 428 */ "join_type ::= INNER",
+ /* 429 */ "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",
+ /* 430 */ "set_quantifier_opt ::=",
+ /* 431 */ "set_quantifier_opt ::= DISTINCT",
+ /* 432 */ "set_quantifier_opt ::= ALL",
+ /* 433 */ "select_list ::= select_item",
+ /* 434 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 435 */ "select_item ::= NK_STAR",
+ /* 436 */ "select_item ::= common_expression",
+ /* 437 */ "select_item ::= common_expression column_alias",
+ /* 438 */ "select_item ::= common_expression AS column_alias",
+ /* 439 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 440 */ "where_clause_opt ::=",
+ /* 441 */ "where_clause_opt ::= WHERE search_condition",
+ /* 442 */ "partition_by_clause_opt ::=",
+ /* 443 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
+ /* 444 */ "twindow_clause_opt ::=",
+ /* 445 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 446 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
+ /* 447 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 448 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 449 */ "sliding_opt ::=",
+ /* 450 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 451 */ "fill_opt ::=",
+ /* 452 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 453 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 454 */ "fill_mode ::= NONE",
+ /* 455 */ "fill_mode ::= PREV",
+ /* 456 */ "fill_mode ::= NULL",
+ /* 457 */ "fill_mode ::= LINEAR",
+ /* 458 */ "fill_mode ::= NEXT",
+ /* 459 */ "group_by_clause_opt ::=",
+ /* 460 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 461 */ "group_by_list ::= expression",
+ /* 462 */ "group_by_list ::= group_by_list NK_COMMA expression",
+ /* 463 */ "having_clause_opt ::=",
+ /* 464 */ "having_clause_opt ::= HAVING search_condition",
+ /* 465 */ "range_opt ::=",
+ /* 466 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP",
+ /* 467 */ "every_opt ::=",
+ /* 468 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 469 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 470 */ "query_expression_body ::= query_primary",
+ /* 471 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
+ /* 472 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
+ /* 473 */ "query_primary ::= query_specification",
+ /* 474 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
+ /* 475 */ "order_by_clause_opt ::=",
+ /* 476 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 477 */ "slimit_clause_opt ::=",
+ /* 478 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 479 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 480 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 481 */ "limit_clause_opt ::=",
+ /* 482 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 483 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 484 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 485 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 486 */ "search_condition ::= common_expression",
+ /* 487 */ "sort_specification_list ::= sort_specification",
+ /* 488 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 489 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
+ /* 490 */ "ordering_specification_opt ::=",
+ /* 491 */ "ordering_specification_opt ::= ASC",
+ /* 492 */ "ordering_specification_opt ::= DESC",
+ /* 493 */ "null_ordering_opt ::=",
+ /* 494 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 495 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2361,179 +2374,179 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 308: /* cmd */
- case 311: /* literal */
- case 322: /* db_options */
- case 324: /* alter_db_options */
- case 329: /* retention */
- case 330: /* full_table_name */
- case 333: /* table_options */
- case 337: /* alter_table_clause */
- case 338: /* alter_table_options */
- case 341: /* signed_literal */
- case 342: /* create_subtable_clause */
- case 345: /* drop_table_clause */
- case 348: /* column_def */
- case 352: /* duration_literal */
- case 353: /* rollup_func_name */
- case 355: /* col_name */
- case 356: /* db_name_cond_opt */
- case 357: /* like_pattern_opt */
- case 358: /* table_name_cond */
- case 359: /* from_db_opt */
- case 360: /* index_options */
- case 362: /* sliding_opt */
- case 363: /* sma_stream_opt */
- case 364: /* func */
- case 365: /* stream_options */
- case 367: /* query_expression */
- case 370: /* explain_options */
- case 375: /* where_clause_opt */
- case 376: /* signed */
- case 377: /* literal_func */
- case 381: /* expression */
- case 382: /* pseudo_column */
- case 383: /* column_reference */
- case 384: /* function_expression */
- case 385: /* subquery */
- case 390: /* star_func_para */
- case 391: /* predicate */
- case 394: /* in_predicate_value */
- case 395: /* boolean_value_expression */
- case 396: /* boolean_primary */
- case 397: /* common_expression */
- case 398: /* from_clause_opt */
- case 399: /* table_reference_list */
- case 400: /* table_reference */
- case 401: /* table_primary */
- case 402: /* joined_table */
- case 404: /* parenthesized_joined_table */
- case 406: /* search_condition */
- case 407: /* query_specification */
- case 411: /* range_opt */
- case 412: /* every_opt */
- case 413: /* fill_opt */
- case 414: /* twindow_clause_opt */
- case 416: /* having_clause_opt */
- case 417: /* select_item */
- case 420: /* query_expression_body */
- case 422: /* slimit_clause_opt */
- case 423: /* limit_clause_opt */
- case 424: /* query_primary */
- case 426: /* sort_specification */
+ case 309: /* cmd */
+ case 312: /* literal */
+ case 323: /* db_options */
+ case 325: /* alter_db_options */
+ case 330: /* retention */
+ case 331: /* full_table_name */
+ case 334: /* table_options */
+ case 338: /* alter_table_clause */
+ case 339: /* alter_table_options */
+ case 342: /* signed_literal */
+ case 343: /* create_subtable_clause */
+ case 346: /* drop_table_clause */
+ case 349: /* column_def */
+ case 353: /* duration_literal */
+ case 354: /* rollup_func_name */
+ case 356: /* col_name */
+ case 357: /* db_name_cond_opt */
+ case 358: /* like_pattern_opt */
+ case 359: /* table_name_cond */
+ case 360: /* from_db_opt */
+ case 361: /* index_options */
+ case 363: /* sliding_opt */
+ case 364: /* sma_stream_opt */
+ case 365: /* func */
+ case 366: /* stream_options */
+ case 368: /* query_expression */
+ case 371: /* explain_options */
+ case 376: /* where_clause_opt */
+ case 377: /* signed */
+ case 378: /* literal_func */
+ case 382: /* expression */
+ case 383: /* pseudo_column */
+ case 384: /* column_reference */
+ case 385: /* function_expression */
+ case 386: /* subquery */
+ case 391: /* star_func_para */
+ case 392: /* predicate */
+ case 395: /* in_predicate_value */
+ case 396: /* boolean_value_expression */
+ case 397: /* boolean_primary */
+ case 398: /* common_expression */
+ case 399: /* from_clause_opt */
+ case 400: /* table_reference_list */
+ case 401: /* table_reference */
+ case 402: /* table_primary */
+ case 403: /* joined_table */
+ case 405: /* parenthesized_joined_table */
+ case 407: /* search_condition */
+ case 408: /* query_specification */
+ case 412: /* range_opt */
+ case 413: /* every_opt */
+ case 414: /* fill_opt */
+ case 415: /* twindow_clause_opt */
+ case 417: /* having_clause_opt */
+ case 418: /* select_item */
+ case 421: /* query_expression_body */
+ case 423: /* slimit_clause_opt */
+ case 424: /* limit_clause_opt */
+ case 425: /* query_primary */
+ case 427: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy80));
+ nodesDestroyNode((yypminor->yy312));
}
break;
- case 309: /* account_options */
- case 310: /* alter_account_options */
- case 312: /* alter_account_option */
- case 372: /* bufsize_opt */
+ case 310: /* account_options */
+ case 311: /* alter_account_options */
+ case 313: /* alter_account_option */
+ case 373: /* bufsize_opt */
{
}
break;
- case 313: /* user_name */
- case 316: /* priv_level */
- case 319: /* db_name */
- case 320: /* dnode_endpoint */
- case 339: /* column_name */
- case 347: /* table_name */
- case 354: /* function_name */
- case 366: /* topic_name */
- case 368: /* cgroup_name */
- case 373: /* stream_name */
- case 379: /* table_alias */
- case 380: /* column_alias */
- case 386: /* star_func */
- case 388: /* noarg_func */
- case 403: /* alias_opt */
+ case 314: /* user_name */
+ case 317: /* priv_level */
+ case 320: /* db_name */
+ case 321: /* dnode_endpoint */
+ case 340: /* column_name */
+ case 348: /* table_name */
+ case 355: /* function_name */
+ case 367: /* topic_name */
+ case 369: /* cgroup_name */
+ case 374: /* stream_name */
+ case 380: /* table_alias */
+ case 381: /* column_alias */
+ case 387: /* star_func */
+ case 389: /* noarg_func */
+ case 404: /* alias_opt */
{
}
break;
- case 314: /* sysinfo_opt */
+ case 315: /* sysinfo_opt */
{
}
break;
- case 315: /* privileges */
- case 317: /* priv_type_list */
- case 318: /* priv_type */
+ case 316: /* privileges */
+ case 318: /* priv_type_list */
+ case 319: /* priv_type */
{
}
break;
- case 321: /* not_exists_opt */
- case 323: /* exists_opt */
- case 369: /* analyze_opt */
- case 371: /* agg_func_opt */
- case 408: /* set_quantifier_opt */
+ case 322: /* not_exists_opt */
+ case 324: /* exists_opt */
+ case 370: /* analyze_opt */
+ case 372: /* agg_func_opt */
+ case 409: /* set_quantifier_opt */
{
}
break;
- case 325: /* integer_list */
- case 326: /* variable_list */
- case 327: /* retention_list */
- case 331: /* column_def_list */
- case 332: /* tags_def_opt */
- case 334: /* multi_create_clause */
- case 335: /* tags_def */
- case 336: /* multi_drop_clause */
- case 343: /* specific_cols_opt */
- case 344: /* expression_list */
- case 346: /* col_name_list */
- case 349: /* duration_list */
- case 350: /* rollup_func_list */
- case 361: /* func_list */
- case 374: /* dnode_list */
- case 378: /* literal_list */
- case 387: /* star_func_para_list */
- case 389: /* other_para_list */
- case 409: /* select_list */
- case 410: /* partition_by_clause_opt */
- case 415: /* group_by_clause_opt */
- case 419: /* group_by_list */
- case 421: /* order_by_clause_opt */
- case 425: /* sort_specification_list */
+ case 326: /* integer_list */
+ case 327: /* variable_list */
+ case 328: /* retention_list */
+ case 332: /* column_def_list */
+ case 333: /* tags_def_opt */
+ case 335: /* multi_create_clause */
+ case 336: /* tags_def */
+ case 337: /* multi_drop_clause */
+ case 344: /* specific_cols_opt */
+ case 345: /* expression_list */
+ case 347: /* col_name_list */
+ case 350: /* duration_list */
+ case 351: /* rollup_func_list */
+ case 362: /* func_list */
+ case 375: /* dnode_list */
+ case 379: /* literal_list */
+ case 388: /* star_func_para_list */
+ case 390: /* other_para_list */
+ case 410: /* select_list */
+ case 411: /* partition_by_clause_opt */
+ case 416: /* group_by_clause_opt */
+ case 420: /* group_by_list */
+ case 422: /* order_by_clause_opt */
+ case 426: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy574));
+ nodesDestroyList((yypminor->yy824));
}
break;
- case 328: /* alter_db_option */
- case 351: /* alter_table_option */
+ case 329: /* alter_db_option */
+ case 352: /* alter_table_option */
{
}
break;
- case 340: /* type_name */
+ case 341: /* type_name */
{
}
break;
- case 392: /* compare_op */
- case 393: /* in_op */
+ case 393: /* compare_op */
+ case 394: /* in_op */
{
}
break;
- case 405: /* join_type */
+ case 406: /* join_type */
{
}
break;
- case 418: /* fill_mode */
+ case 419: /* fill_mode */
{
}
break;
- case 427: /* ordering_specification_opt */
+ case 428: /* ordering_specification_opt */
{
}
break;
- case 428: /* null_ordering_opt */
+ case 429: /* null_ordering_opt */
{
}
@@ -2832,501 +2845,502 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
- { 308, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- { 308, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- { 309, 0 }, /* (2) account_options ::= */
- { 309, -3 }, /* (3) account_options ::= account_options PPS literal */
- { 309, -3 }, /* (4) account_options ::= account_options TSERIES literal */
- { 309, -3 }, /* (5) account_options ::= account_options STORAGE literal */
- { 309, -3 }, /* (6) account_options ::= account_options STREAMS literal */
- { 309, -3 }, /* (7) account_options ::= account_options QTIME literal */
- { 309, -3 }, /* (8) account_options ::= account_options DBS literal */
- { 309, -3 }, /* (9) account_options ::= account_options USERS literal */
- { 309, -3 }, /* (10) account_options ::= account_options CONNS literal */
- { 309, -3 }, /* (11) account_options ::= account_options STATE literal */
- { 310, -1 }, /* (12) alter_account_options ::= alter_account_option */
- { 310, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- { 312, -2 }, /* (14) alter_account_option ::= PASS literal */
- { 312, -2 }, /* (15) alter_account_option ::= PPS literal */
- { 312, -2 }, /* (16) alter_account_option ::= TSERIES literal */
- { 312, -2 }, /* (17) alter_account_option ::= STORAGE literal */
- { 312, -2 }, /* (18) alter_account_option ::= STREAMS literal */
- { 312, -2 }, /* (19) alter_account_option ::= QTIME literal */
- { 312, -2 }, /* (20) alter_account_option ::= DBS literal */
- { 312, -2 }, /* (21) alter_account_option ::= USERS literal */
- { 312, -2 }, /* (22) alter_account_option ::= CONNS literal */
- { 312, -2 }, /* (23) alter_account_option ::= STATE literal */
- { 308, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
- { 308, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
- { 308, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- { 308, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- { 308, -3 }, /* (28) cmd ::= DROP USER user_name */
- { 314, 0 }, /* (29) sysinfo_opt ::= */
- { 314, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
- { 308, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
- { 308, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
- { 315, -1 }, /* (33) privileges ::= ALL */
- { 315, -1 }, /* (34) privileges ::= priv_type_list */
- { 317, -1 }, /* (35) priv_type_list ::= priv_type */
- { 317, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- { 318, -1 }, /* (37) priv_type ::= READ */
- { 318, -1 }, /* (38) priv_type ::= WRITE */
- { 316, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */
- { 316, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */
- { 308, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */
- { 308, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- { 308, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */
- { 308, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */
- { 308, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- { 308, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- { 308, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */
- { 308, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- { 320, -1 }, /* (49) dnode_endpoint ::= NK_STRING */
- { 320, -1 }, /* (50) dnode_endpoint ::= NK_ID */
- { 320, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */
- { 308, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */
- { 308, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- { 308, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- { 308, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- { 308, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */
- { 308, -2 }, /* (64) cmd ::= USE db_name */
- { 308, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */
- { 308, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */
- { 308, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */
- { 321, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */
- { 321, 0 }, /* (69) not_exists_opt ::= */
- { 323, -2 }, /* (70) exists_opt ::= IF EXISTS */
- { 323, 0 }, /* (71) exists_opt ::= */
- { 322, 0 }, /* (72) db_options ::= */
- { 322, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */
- { 322, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */
- { 322, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */
- { 322, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */
- { 322, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */
- { 322, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */
- { 322, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */
- { 322, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */
- { 322, -3 }, /* (81) db_options ::= db_options KEEP integer_list */
- { 322, -3 }, /* (82) db_options ::= db_options KEEP variable_list */
- { 322, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */
- { 322, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */
- { 322, -3 }, /* (85) db_options ::= db_options PRECISION NK_STRING */
- { 322, -3 }, /* (86) db_options ::= db_options REPLICA NK_INTEGER */
- { 322, -3 }, /* (87) db_options ::= db_options STRICT NK_STRING */
- { 322, -3 }, /* (88) db_options ::= db_options VGROUPS NK_INTEGER */
- { 322, -3 }, /* (89) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- { 322, -3 }, /* (90) db_options ::= db_options RETENTIONS retention_list */
- { 322, -3 }, /* (91) db_options ::= db_options SCHEMALESS NK_INTEGER */
- { 322, -3 }, /* (92) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- { 322, -3 }, /* (93) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- { 322, -3 }, /* (94) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- { 322, -4 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- { 322, -3 }, /* (96) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- { 322, -4 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- { 322, -3 }, /* (98) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- { 322, -3 }, /* (99) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- { 322, -3 }, /* (100) db_options ::= db_options SST_TRIGGER NK_INTEGER */
- { 322, -3 }, /* (101) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
- { 322, -3 }, /* (102) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
- { 324, -1 }, /* (103) alter_db_options ::= alter_db_option */
- { 324, -2 }, /* (104) alter_db_options ::= alter_db_options alter_db_option */
- { 328, -2 }, /* (105) alter_db_option ::= CACHEMODEL NK_STRING */
- { 328, -2 }, /* (106) alter_db_option ::= CACHESIZE NK_INTEGER */
- { 328, -2 }, /* (107) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- { 328, -2 }, /* (108) alter_db_option ::= KEEP integer_list */
- { 328, -2 }, /* (109) alter_db_option ::= KEEP variable_list */
- { 328, -2 }, /* (110) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- { 328, -2 }, /* (111) alter_db_option ::= SST_TRIGGER NK_INTEGER */
- { 325, -1 }, /* (112) integer_list ::= NK_INTEGER */
- { 325, -3 }, /* (113) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- { 326, -1 }, /* (114) variable_list ::= NK_VARIABLE */
- { 326, -3 }, /* (115) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- { 327, -1 }, /* (116) retention_list ::= retention */
- { 327, -3 }, /* (117) retention_list ::= retention_list NK_COMMA retention */
- { 329, -3 }, /* (118) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- { 308, -9 }, /* (119) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- { 308, -3 }, /* (120) cmd ::= CREATE TABLE multi_create_clause */
- { 308, -9 }, /* (121) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- { 308, -3 }, /* (122) cmd ::= DROP TABLE multi_drop_clause */
- { 308, -4 }, /* (123) cmd ::= DROP STABLE exists_opt full_table_name */
- { 308, -3 }, /* (124) cmd ::= ALTER TABLE alter_table_clause */
- { 308, -3 }, /* (125) cmd ::= ALTER STABLE alter_table_clause */
- { 337, -2 }, /* (126) alter_table_clause ::= full_table_name alter_table_options */
- { 337, -5 }, /* (127) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
- { 337, -4 }, /* (128) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- { 337, -5 }, /* (129) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- { 337, -5 }, /* (130) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- { 337, -5 }, /* (131) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- { 337, -4 }, /* (132) alter_table_clause ::= full_table_name DROP TAG column_name */
- { 337, -5 }, /* (133) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- { 337, -5 }, /* (134) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- { 337, -6 }, /* (135) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- { 334, -1 }, /* (136) multi_create_clause ::= create_subtable_clause */
- { 334, -2 }, /* (137) multi_create_clause ::= multi_create_clause create_subtable_clause */
- { 342, -10 }, /* (138) 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 */
- { 336, -1 }, /* (139) multi_drop_clause ::= drop_table_clause */
- { 336, -2 }, /* (140) multi_drop_clause ::= multi_drop_clause drop_table_clause */
- { 345, -2 }, /* (141) drop_table_clause ::= exists_opt full_table_name */
- { 343, 0 }, /* (142) specific_cols_opt ::= */
- { 343, -3 }, /* (143) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- { 330, -1 }, /* (144) full_table_name ::= table_name */
- { 330, -3 }, /* (145) full_table_name ::= db_name NK_DOT table_name */
- { 331, -1 }, /* (146) column_def_list ::= column_def */
- { 331, -3 }, /* (147) column_def_list ::= column_def_list NK_COMMA column_def */
- { 348, -2 }, /* (148) column_def ::= column_name type_name */
- { 348, -4 }, /* (149) column_def ::= column_name type_name COMMENT NK_STRING */
- { 340, -1 }, /* (150) type_name ::= BOOL */
- { 340, -1 }, /* (151) type_name ::= TINYINT */
- { 340, -1 }, /* (152) type_name ::= SMALLINT */
- { 340, -1 }, /* (153) type_name ::= INT */
- { 340, -1 }, /* (154) type_name ::= INTEGER */
- { 340, -1 }, /* (155) type_name ::= BIGINT */
- { 340, -1 }, /* (156) type_name ::= FLOAT */
- { 340, -1 }, /* (157) type_name ::= DOUBLE */
- { 340, -4 }, /* (158) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- { 340, -1 }, /* (159) type_name ::= TIMESTAMP */
- { 340, -4 }, /* (160) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- { 340, -2 }, /* (161) type_name ::= TINYINT UNSIGNED */
- { 340, -2 }, /* (162) type_name ::= SMALLINT UNSIGNED */
- { 340, -2 }, /* (163) type_name ::= INT UNSIGNED */
- { 340, -2 }, /* (164) type_name ::= BIGINT UNSIGNED */
- { 340, -1 }, /* (165) type_name ::= JSON */
- { 340, -4 }, /* (166) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- { 340, -1 }, /* (167) type_name ::= MEDIUMBLOB */
- { 340, -1 }, /* (168) type_name ::= BLOB */
- { 340, -4 }, /* (169) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- { 340, -1 }, /* (170) type_name ::= DECIMAL */
- { 340, -4 }, /* (171) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- { 340, -6 }, /* (172) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { 332, 0 }, /* (173) tags_def_opt ::= */
- { 332, -1 }, /* (174) tags_def_opt ::= tags_def */
- { 335, -4 }, /* (175) tags_def ::= TAGS NK_LP column_def_list NK_RP */
- { 333, 0 }, /* (176) table_options ::= */
- { 333, -3 }, /* (177) table_options ::= table_options COMMENT NK_STRING */
- { 333, -3 }, /* (178) table_options ::= table_options MAX_DELAY duration_list */
- { 333, -3 }, /* (179) table_options ::= table_options WATERMARK duration_list */
- { 333, -5 }, /* (180) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- { 333, -3 }, /* (181) table_options ::= table_options TTL NK_INTEGER */
- { 333, -5 }, /* (182) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- { 338, -1 }, /* (183) alter_table_options ::= alter_table_option */
- { 338, -2 }, /* (184) alter_table_options ::= alter_table_options alter_table_option */
- { 351, -2 }, /* (185) alter_table_option ::= COMMENT NK_STRING */
- { 351, -2 }, /* (186) alter_table_option ::= TTL NK_INTEGER */
- { 349, -1 }, /* (187) duration_list ::= duration_literal */
- { 349, -3 }, /* (188) duration_list ::= duration_list NK_COMMA duration_literal */
- { 350, -1 }, /* (189) rollup_func_list ::= rollup_func_name */
- { 350, -3 }, /* (190) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- { 353, -1 }, /* (191) rollup_func_name ::= function_name */
- { 353, -1 }, /* (192) rollup_func_name ::= FIRST */
- { 353, -1 }, /* (193) rollup_func_name ::= LAST */
- { 346, -1 }, /* (194) col_name_list ::= col_name */
- { 346, -3 }, /* (195) col_name_list ::= col_name_list NK_COMMA col_name */
- { 355, -1 }, /* (196) col_name ::= column_name */
- { 308, -2 }, /* (197) cmd ::= SHOW DNODES */
- { 308, -2 }, /* (198) cmd ::= SHOW USERS */
- { 308, -2 }, /* (199) cmd ::= SHOW DATABASES */
- { 308, -4 }, /* (200) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
- { 308, -4 }, /* (201) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- { 308, -3 }, /* (202) cmd ::= SHOW db_name_cond_opt VGROUPS */
- { 308, -2 }, /* (203) cmd ::= SHOW MNODES */
- { 308, -2 }, /* (204) cmd ::= SHOW MODULES */
- { 308, -2 }, /* (205) cmd ::= SHOW QNODES */
- { 308, -2 }, /* (206) cmd ::= SHOW FUNCTIONS */
- { 308, -5 }, /* (207) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- { 308, -2 }, /* (208) cmd ::= SHOW STREAMS */
- { 308, -2 }, /* (209) cmd ::= SHOW ACCOUNTS */
- { 308, -2 }, /* (210) cmd ::= SHOW APPS */
- { 308, -2 }, /* (211) cmd ::= SHOW CONNECTIONS */
- { 308, -2 }, /* (212) cmd ::= SHOW LICENCES */
- { 308, -2 }, /* (213) cmd ::= SHOW GRANTS */
- { 308, -4 }, /* (214) cmd ::= SHOW CREATE DATABASE db_name */
- { 308, -4 }, /* (215) cmd ::= SHOW CREATE TABLE full_table_name */
- { 308, -4 }, /* (216) cmd ::= SHOW CREATE STABLE full_table_name */
- { 308, -2 }, /* (217) cmd ::= SHOW QUERIES */
- { 308, -2 }, /* (218) cmd ::= SHOW SCORES */
- { 308, -2 }, /* (219) cmd ::= SHOW TOPICS */
- { 308, -2 }, /* (220) cmd ::= SHOW VARIABLES */
- { 308, -3 }, /* (221) cmd ::= SHOW LOCAL VARIABLES */
- { 308, -4 }, /* (222) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */
- { 308, -2 }, /* (223) cmd ::= SHOW BNODES */
- { 308, -2 }, /* (224) cmd ::= SHOW SNODES */
- { 308, -2 }, /* (225) cmd ::= SHOW CLUSTER */
- { 308, -2 }, /* (226) cmd ::= SHOW TRANSACTIONS */
- { 308, -4 }, /* (227) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- { 308, -2 }, /* (228) cmd ::= SHOW CONSUMERS */
- { 308, -2 }, /* (229) cmd ::= SHOW SUBSCRIPTIONS */
- { 308, -5 }, /* (230) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- { 308, -3 }, /* (231) cmd ::= SHOW VNODES NK_INTEGER */
- { 308, -3 }, /* (232) cmd ::= SHOW VNODES NK_STRING */
- { 356, 0 }, /* (233) db_name_cond_opt ::= */
- { 356, -2 }, /* (234) db_name_cond_opt ::= db_name NK_DOT */
- { 357, 0 }, /* (235) like_pattern_opt ::= */
- { 357, -2 }, /* (236) like_pattern_opt ::= LIKE NK_STRING */
- { 358, -1 }, /* (237) table_name_cond ::= table_name */
- { 359, 0 }, /* (238) from_db_opt ::= */
- { 359, -2 }, /* (239) from_db_opt ::= FROM db_name */
- { 308, -8 }, /* (240) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
- { 308, -4 }, /* (241) cmd ::= DROP INDEX exists_opt full_table_name */
- { 360, -10 }, /* (242) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- { 360, -12 }, /* (243) 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 */
- { 361, -1 }, /* (244) func_list ::= func */
- { 361, -3 }, /* (245) func_list ::= func_list NK_COMMA func */
- { 364, -4 }, /* (246) func ::= function_name NK_LP expression_list NK_RP */
- { 363, 0 }, /* (247) sma_stream_opt ::= */
- { 363, -3 }, /* (248) sma_stream_opt ::= stream_options WATERMARK duration_literal */
- { 363, -3 }, /* (249) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
- { 308, -6 }, /* (250) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
- { 308, -7 }, /* (251) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
- { 308, -9 }, /* (252) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
- { 308, -7 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
- { 308, -9 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
- { 308, -4 }, /* (255) cmd ::= DROP TOPIC exists_opt topic_name */
- { 308, -7 }, /* (256) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- { 308, -2 }, /* (257) cmd ::= DESC full_table_name */
- { 308, -2 }, /* (258) cmd ::= DESCRIBE full_table_name */
- { 308, -3 }, /* (259) cmd ::= RESET QUERY CACHE */
- { 308, -4 }, /* (260) cmd ::= EXPLAIN analyze_opt explain_options query_expression */
- { 369, 0 }, /* (261) analyze_opt ::= */
- { 369, -1 }, /* (262) analyze_opt ::= ANALYZE */
- { 370, 0 }, /* (263) explain_options ::= */
- { 370, -3 }, /* (264) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 370, -3 }, /* (265) explain_options ::= explain_options RATIO NK_FLOAT */
- { 308, -10 }, /* (266) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
- { 308, -4 }, /* (267) cmd ::= DROP FUNCTION exists_opt function_name */
- { 371, 0 }, /* (268) agg_func_opt ::= */
- { 371, -1 }, /* (269) agg_func_opt ::= AGGREGATE */
- { 372, 0 }, /* (270) bufsize_opt ::= */
- { 372, -2 }, /* (271) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 308, -9 }, /* (272) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression */
- { 308, -4 }, /* (273) cmd ::= DROP STREAM exists_opt stream_name */
- { 365, 0 }, /* (274) stream_options ::= */
- { 365, -3 }, /* (275) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 365, -3 }, /* (276) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 365, -4 }, /* (277) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 365, -3 }, /* (278) stream_options ::= stream_options WATERMARK duration_literal */
- { 365, -4 }, /* (279) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { 308, -3 }, /* (280) cmd ::= KILL CONNECTION NK_INTEGER */
- { 308, -3 }, /* (281) cmd ::= KILL QUERY NK_STRING */
- { 308, -3 }, /* (282) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 308, -2 }, /* (283) cmd ::= BALANCE VGROUP */
- { 308, -4 }, /* (284) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 308, -4 }, /* (285) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 308, -3 }, /* (286) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 374, -2 }, /* (287) dnode_list ::= DNODE NK_INTEGER */
- { 374, -3 }, /* (288) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 308, -4 }, /* (289) cmd ::= DELETE FROM full_table_name where_clause_opt */
- { 308, -1 }, /* (290) cmd ::= query_expression */
- { 308, -7 }, /* (291) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
- { 308, -4 }, /* (292) cmd ::= INSERT INTO full_table_name query_expression */
- { 311, -1 }, /* (293) literal ::= NK_INTEGER */
- { 311, -1 }, /* (294) literal ::= NK_FLOAT */
- { 311, -1 }, /* (295) literal ::= NK_STRING */
- { 311, -1 }, /* (296) literal ::= NK_BOOL */
- { 311, -2 }, /* (297) literal ::= TIMESTAMP NK_STRING */
- { 311, -1 }, /* (298) literal ::= duration_literal */
- { 311, -1 }, /* (299) literal ::= NULL */
- { 311, -1 }, /* (300) literal ::= NK_QUESTION */
- { 352, -1 }, /* (301) duration_literal ::= NK_VARIABLE */
- { 376, -1 }, /* (302) signed ::= NK_INTEGER */
- { 376, -2 }, /* (303) signed ::= NK_PLUS NK_INTEGER */
- { 376, -2 }, /* (304) signed ::= NK_MINUS NK_INTEGER */
- { 376, -1 }, /* (305) signed ::= NK_FLOAT */
- { 376, -2 }, /* (306) signed ::= NK_PLUS NK_FLOAT */
- { 376, -2 }, /* (307) signed ::= NK_MINUS NK_FLOAT */
- { 341, -1 }, /* (308) signed_literal ::= signed */
- { 341, -1 }, /* (309) signed_literal ::= NK_STRING */
- { 341, -1 }, /* (310) signed_literal ::= NK_BOOL */
- { 341, -2 }, /* (311) signed_literal ::= TIMESTAMP NK_STRING */
- { 341, -1 }, /* (312) signed_literal ::= duration_literal */
- { 341, -1 }, /* (313) signed_literal ::= NULL */
- { 341, -1 }, /* (314) signed_literal ::= literal_func */
- { 341, -1 }, /* (315) signed_literal ::= NK_QUESTION */
- { 378, -1 }, /* (316) literal_list ::= signed_literal */
- { 378, -3 }, /* (317) literal_list ::= literal_list NK_COMMA signed_literal */
- { 319, -1 }, /* (318) db_name ::= NK_ID */
- { 347, -1 }, /* (319) table_name ::= NK_ID */
- { 339, -1 }, /* (320) column_name ::= NK_ID */
- { 354, -1 }, /* (321) function_name ::= NK_ID */
- { 379, -1 }, /* (322) table_alias ::= NK_ID */
- { 380, -1 }, /* (323) column_alias ::= NK_ID */
- { 313, -1 }, /* (324) user_name ::= NK_ID */
- { 366, -1 }, /* (325) topic_name ::= NK_ID */
- { 373, -1 }, /* (326) stream_name ::= NK_ID */
- { 368, -1 }, /* (327) cgroup_name ::= NK_ID */
- { 381, -1 }, /* (328) expression ::= literal */
- { 381, -1 }, /* (329) expression ::= pseudo_column */
- { 381, -1 }, /* (330) expression ::= column_reference */
- { 381, -1 }, /* (331) expression ::= function_expression */
- { 381, -1 }, /* (332) expression ::= subquery */
- { 381, -3 }, /* (333) expression ::= NK_LP expression NK_RP */
- { 381, -2 }, /* (334) expression ::= NK_PLUS expression */
- { 381, -2 }, /* (335) expression ::= NK_MINUS expression */
- { 381, -3 }, /* (336) expression ::= expression NK_PLUS expression */
- { 381, -3 }, /* (337) expression ::= expression NK_MINUS expression */
- { 381, -3 }, /* (338) expression ::= expression NK_STAR expression */
- { 381, -3 }, /* (339) expression ::= expression NK_SLASH expression */
- { 381, -3 }, /* (340) expression ::= expression NK_REM expression */
- { 381, -3 }, /* (341) expression ::= column_reference NK_ARROW NK_STRING */
- { 381, -3 }, /* (342) expression ::= expression NK_BITAND expression */
- { 381, -3 }, /* (343) expression ::= expression NK_BITOR expression */
- { 344, -1 }, /* (344) expression_list ::= expression */
- { 344, -3 }, /* (345) expression_list ::= expression_list NK_COMMA expression */
- { 383, -1 }, /* (346) column_reference ::= column_name */
- { 383, -3 }, /* (347) column_reference ::= table_name NK_DOT column_name */
- { 382, -1 }, /* (348) pseudo_column ::= ROWTS */
- { 382, -1 }, /* (349) pseudo_column ::= TBNAME */
- { 382, -3 }, /* (350) pseudo_column ::= table_name NK_DOT TBNAME */
- { 382, -1 }, /* (351) pseudo_column ::= QSTART */
- { 382, -1 }, /* (352) pseudo_column ::= QEND */
- { 382, -1 }, /* (353) pseudo_column ::= QDURATION */
- { 382, -1 }, /* (354) pseudo_column ::= WSTART */
- { 382, -1 }, /* (355) pseudo_column ::= WEND */
- { 382, -1 }, /* (356) pseudo_column ::= WDURATION */
- { 384, -4 }, /* (357) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 384, -4 }, /* (358) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 384, -6 }, /* (359) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
- { 384, -1 }, /* (360) function_expression ::= literal_func */
- { 377, -3 }, /* (361) literal_func ::= noarg_func NK_LP NK_RP */
- { 377, -1 }, /* (362) literal_func ::= NOW */
- { 388, -1 }, /* (363) noarg_func ::= NOW */
- { 388, -1 }, /* (364) noarg_func ::= TODAY */
- { 388, -1 }, /* (365) noarg_func ::= TIMEZONE */
- { 388, -1 }, /* (366) noarg_func ::= DATABASE */
- { 388, -1 }, /* (367) noarg_func ::= CLIENT_VERSION */
- { 388, -1 }, /* (368) noarg_func ::= SERVER_VERSION */
- { 388, -1 }, /* (369) noarg_func ::= SERVER_STATUS */
- { 388, -1 }, /* (370) noarg_func ::= CURRENT_USER */
- { 388, -1 }, /* (371) noarg_func ::= USER */
- { 386, -1 }, /* (372) star_func ::= COUNT */
- { 386, -1 }, /* (373) star_func ::= FIRST */
- { 386, -1 }, /* (374) star_func ::= LAST */
- { 386, -1 }, /* (375) star_func ::= LAST_ROW */
- { 387, -1 }, /* (376) star_func_para_list ::= NK_STAR */
- { 387, -1 }, /* (377) star_func_para_list ::= other_para_list */
- { 389, -1 }, /* (378) other_para_list ::= star_func_para */
- { 389, -3 }, /* (379) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 390, -1 }, /* (380) star_func_para ::= expression */
- { 390, -3 }, /* (381) star_func_para ::= table_name NK_DOT NK_STAR */
- { 391, -3 }, /* (382) predicate ::= expression compare_op expression */
- { 391, -5 }, /* (383) predicate ::= expression BETWEEN expression AND expression */
- { 391, -6 }, /* (384) predicate ::= expression NOT BETWEEN expression AND expression */
- { 391, -3 }, /* (385) predicate ::= expression IS NULL */
- { 391, -4 }, /* (386) predicate ::= expression IS NOT NULL */
- { 391, -3 }, /* (387) predicate ::= expression in_op in_predicate_value */
- { 392, -1 }, /* (388) compare_op ::= NK_LT */
- { 392, -1 }, /* (389) compare_op ::= NK_GT */
- { 392, -1 }, /* (390) compare_op ::= NK_LE */
- { 392, -1 }, /* (391) compare_op ::= NK_GE */
- { 392, -1 }, /* (392) compare_op ::= NK_NE */
- { 392, -1 }, /* (393) compare_op ::= NK_EQ */
- { 392, -1 }, /* (394) compare_op ::= LIKE */
- { 392, -2 }, /* (395) compare_op ::= NOT LIKE */
- { 392, -1 }, /* (396) compare_op ::= MATCH */
- { 392, -1 }, /* (397) compare_op ::= NMATCH */
- { 392, -1 }, /* (398) compare_op ::= CONTAINS */
- { 393, -1 }, /* (399) in_op ::= IN */
- { 393, -2 }, /* (400) in_op ::= NOT IN */
- { 394, -3 }, /* (401) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 395, -1 }, /* (402) boolean_value_expression ::= boolean_primary */
- { 395, -2 }, /* (403) boolean_value_expression ::= NOT boolean_primary */
- { 395, -3 }, /* (404) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 395, -3 }, /* (405) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 396, -1 }, /* (406) boolean_primary ::= predicate */
- { 396, -3 }, /* (407) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 397, -1 }, /* (408) common_expression ::= expression */
- { 397, -1 }, /* (409) common_expression ::= boolean_value_expression */
- { 398, 0 }, /* (410) from_clause_opt ::= */
- { 398, -2 }, /* (411) from_clause_opt ::= FROM table_reference_list */
- { 399, -1 }, /* (412) table_reference_list ::= table_reference */
- { 399, -3 }, /* (413) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 400, -1 }, /* (414) table_reference ::= table_primary */
- { 400, -1 }, /* (415) table_reference ::= joined_table */
- { 401, -2 }, /* (416) table_primary ::= table_name alias_opt */
- { 401, -4 }, /* (417) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 401, -2 }, /* (418) table_primary ::= subquery alias_opt */
- { 401, -1 }, /* (419) table_primary ::= parenthesized_joined_table */
- { 403, 0 }, /* (420) alias_opt ::= */
- { 403, -1 }, /* (421) alias_opt ::= table_alias */
- { 403, -2 }, /* (422) alias_opt ::= AS table_alias */
- { 404, -3 }, /* (423) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 404, -3 }, /* (424) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 402, -6 }, /* (425) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 405, 0 }, /* (426) join_type ::= */
- { 405, -1 }, /* (427) join_type ::= INNER */
- { 407, -12 }, /* (428) 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 */
- { 408, 0 }, /* (429) set_quantifier_opt ::= */
- { 408, -1 }, /* (430) set_quantifier_opt ::= DISTINCT */
- { 408, -1 }, /* (431) set_quantifier_opt ::= ALL */
- { 409, -1 }, /* (432) select_list ::= select_item */
- { 409, -3 }, /* (433) select_list ::= select_list NK_COMMA select_item */
- { 417, -1 }, /* (434) select_item ::= NK_STAR */
- { 417, -1 }, /* (435) select_item ::= common_expression */
- { 417, -2 }, /* (436) select_item ::= common_expression column_alias */
- { 417, -3 }, /* (437) select_item ::= common_expression AS column_alias */
- { 417, -3 }, /* (438) select_item ::= table_name NK_DOT NK_STAR */
- { 375, 0 }, /* (439) where_clause_opt ::= */
- { 375, -2 }, /* (440) where_clause_opt ::= WHERE search_condition */
- { 410, 0 }, /* (441) partition_by_clause_opt ::= */
- { 410, -3 }, /* (442) partition_by_clause_opt ::= PARTITION BY expression_list */
- { 414, 0 }, /* (443) twindow_clause_opt ::= */
- { 414, -6 }, /* (444) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 414, -4 }, /* (445) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
- { 414, -6 }, /* (446) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 414, -8 }, /* (447) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 362, 0 }, /* (448) sliding_opt ::= */
- { 362, -4 }, /* (449) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 413, 0 }, /* (450) fill_opt ::= */
- { 413, -4 }, /* (451) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 413, -6 }, /* (452) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 418, -1 }, /* (453) fill_mode ::= NONE */
- { 418, -1 }, /* (454) fill_mode ::= PREV */
- { 418, -1 }, /* (455) fill_mode ::= NULL */
- { 418, -1 }, /* (456) fill_mode ::= LINEAR */
- { 418, -1 }, /* (457) fill_mode ::= NEXT */
- { 415, 0 }, /* (458) group_by_clause_opt ::= */
- { 415, -3 }, /* (459) group_by_clause_opt ::= GROUP BY group_by_list */
- { 419, -1 }, /* (460) group_by_list ::= expression */
- { 419, -3 }, /* (461) group_by_list ::= group_by_list NK_COMMA expression */
- { 416, 0 }, /* (462) having_clause_opt ::= */
- { 416, -2 }, /* (463) having_clause_opt ::= HAVING search_condition */
- { 411, 0 }, /* (464) range_opt ::= */
- { 411, -6 }, /* (465) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
- { 412, 0 }, /* (466) every_opt ::= */
- { 412, -4 }, /* (467) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 367, -4 }, /* (468) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 420, -1 }, /* (469) query_expression_body ::= query_primary */
- { 420, -4 }, /* (470) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
- { 420, -3 }, /* (471) query_expression_body ::= query_expression_body UNION query_expression_body */
- { 424, -1 }, /* (472) query_primary ::= query_specification */
- { 424, -6 }, /* (473) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
- { 421, 0 }, /* (474) order_by_clause_opt ::= */
- { 421, -3 }, /* (475) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 422, 0 }, /* (476) slimit_clause_opt ::= */
- { 422, -2 }, /* (477) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 422, -4 }, /* (478) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 422, -4 }, /* (479) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 423, 0 }, /* (480) limit_clause_opt ::= */
- { 423, -2 }, /* (481) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 423, -4 }, /* (482) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 423, -4 }, /* (483) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 385, -3 }, /* (484) subquery ::= NK_LP query_expression NK_RP */
- { 406, -1 }, /* (485) search_condition ::= common_expression */
- { 425, -1 }, /* (486) sort_specification_list ::= sort_specification */
- { 425, -3 }, /* (487) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 426, -3 }, /* (488) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
- { 427, 0 }, /* (489) ordering_specification_opt ::= */
- { 427, -1 }, /* (490) ordering_specification_opt ::= ASC */
- { 427, -1 }, /* (491) ordering_specification_opt ::= DESC */
- { 428, 0 }, /* (492) null_ordering_opt ::= */
- { 428, -2 }, /* (493) null_ordering_opt ::= NULLS FIRST */
- { 428, -2 }, /* (494) null_ordering_opt ::= NULLS LAST */
+ { 309, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ { 309, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ { 310, 0 }, /* (2) account_options ::= */
+ { 310, -3 }, /* (3) account_options ::= account_options PPS literal */
+ { 310, -3 }, /* (4) account_options ::= account_options TSERIES literal */
+ { 310, -3 }, /* (5) account_options ::= account_options STORAGE literal */
+ { 310, -3 }, /* (6) account_options ::= account_options STREAMS literal */
+ { 310, -3 }, /* (7) account_options ::= account_options QTIME literal */
+ { 310, -3 }, /* (8) account_options ::= account_options DBS literal */
+ { 310, -3 }, /* (9) account_options ::= account_options USERS literal */
+ { 310, -3 }, /* (10) account_options ::= account_options CONNS literal */
+ { 310, -3 }, /* (11) account_options ::= account_options STATE literal */
+ { 311, -1 }, /* (12) alter_account_options ::= alter_account_option */
+ { 311, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ { 313, -2 }, /* (14) alter_account_option ::= PASS literal */
+ { 313, -2 }, /* (15) alter_account_option ::= PPS literal */
+ { 313, -2 }, /* (16) alter_account_option ::= TSERIES literal */
+ { 313, -2 }, /* (17) alter_account_option ::= STORAGE literal */
+ { 313, -2 }, /* (18) alter_account_option ::= STREAMS literal */
+ { 313, -2 }, /* (19) alter_account_option ::= QTIME literal */
+ { 313, -2 }, /* (20) alter_account_option ::= DBS literal */
+ { 313, -2 }, /* (21) alter_account_option ::= USERS literal */
+ { 313, -2 }, /* (22) alter_account_option ::= CONNS literal */
+ { 313, -2 }, /* (23) alter_account_option ::= STATE literal */
+ { 309, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
+ { 309, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
+ { 309, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ { 309, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ { 309, -3 }, /* (28) cmd ::= DROP USER user_name */
+ { 315, 0 }, /* (29) sysinfo_opt ::= */
+ { 315, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ { 309, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
+ { 309, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
+ { 316, -1 }, /* (33) privileges ::= ALL */
+ { 316, -1 }, /* (34) privileges ::= priv_type_list */
+ { 318, -1 }, /* (35) priv_type_list ::= priv_type */
+ { 318, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ { 319, -1 }, /* (37) priv_type ::= READ */
+ { 319, -1 }, /* (38) priv_type ::= WRITE */
+ { 317, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ { 317, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */
+ { 309, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */
+ { 309, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ { 309, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */
+ { 309, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */
+ { 309, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ { 309, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ { 309, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */
+ { 309, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ { 321, -1 }, /* (49) dnode_endpoint ::= NK_STRING */
+ { 321, -1 }, /* (50) dnode_endpoint ::= NK_ID */
+ { 321, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */
+ { 309, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */
+ { 309, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ { 309, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ { 309, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ { 309, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */
+ { 309, -2 }, /* (64) cmd ::= USE db_name */
+ { 309, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */
+ { 309, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */
+ { 309, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */
+ { 322, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */
+ { 322, 0 }, /* (69) not_exists_opt ::= */
+ { 324, -2 }, /* (70) exists_opt ::= IF EXISTS */
+ { 324, 0 }, /* (71) exists_opt ::= */
+ { 323, 0 }, /* (72) db_options ::= */
+ { 323, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */
+ { 323, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */
+ { 323, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */
+ { 323, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */
+ { 323, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */
+ { 323, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */
+ { 323, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */
+ { 323, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */
+ { 323, -3 }, /* (81) db_options ::= db_options KEEP integer_list */
+ { 323, -3 }, /* (82) db_options ::= db_options KEEP variable_list */
+ { 323, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */
+ { 323, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */
+ { 323, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ { 323, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */
+ { 323, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */
+ { 323, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */
+ { 323, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */
+ { 323, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ { 323, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */
+ { 323, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ { 323, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ { 323, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ { 323, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ { 323, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ { 323, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ { 323, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ { 323, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ { 323, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ { 323, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ { 323, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+ { 323, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+ { 325, -1 }, /* (104) alter_db_options ::= alter_db_option */
+ { 325, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */
+ { 329, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */
+ { 329, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */
+ { 329, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ { 329, -2 }, /* (109) alter_db_option ::= KEEP integer_list */
+ { 329, -2 }, /* (110) alter_db_option ::= KEEP variable_list */
+ { 329, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ { 329, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ { 326, -1 }, /* (113) integer_list ::= NK_INTEGER */
+ { 326, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ { 327, -1 }, /* (115) variable_list ::= NK_VARIABLE */
+ { 327, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ { 328, -1 }, /* (117) retention_list ::= retention */
+ { 328, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */
+ { 330, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ { 309, -9 }, /* (120) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ { 309, -3 }, /* (121) cmd ::= CREATE TABLE multi_create_clause */
+ { 309, -9 }, /* (122) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ { 309, -3 }, /* (123) cmd ::= DROP TABLE multi_drop_clause */
+ { 309, -4 }, /* (124) cmd ::= DROP STABLE exists_opt full_table_name */
+ { 309, -3 }, /* (125) cmd ::= ALTER TABLE alter_table_clause */
+ { 309, -3 }, /* (126) cmd ::= ALTER STABLE alter_table_clause */
+ { 338, -2 }, /* (127) alter_table_clause ::= full_table_name alter_table_options */
+ { 338, -5 }, /* (128) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ { 338, -4 }, /* (129) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ { 338, -5 }, /* (130) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ { 338, -5 }, /* (131) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ { 338, -5 }, /* (132) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ { 338, -4 }, /* (133) alter_table_clause ::= full_table_name DROP TAG column_name */
+ { 338, -5 }, /* (134) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ { 338, -5 }, /* (135) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ { 338, -6 }, /* (136) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ { 335, -1 }, /* (137) multi_create_clause ::= create_subtable_clause */
+ { 335, -2 }, /* (138) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ { 343, -10 }, /* (139) 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 */
+ { 337, -1 }, /* (140) multi_drop_clause ::= drop_table_clause */
+ { 337, -2 }, /* (141) multi_drop_clause ::= multi_drop_clause drop_table_clause */
+ { 346, -2 }, /* (142) drop_table_clause ::= exists_opt full_table_name */
+ { 344, 0 }, /* (143) specific_cols_opt ::= */
+ { 344, -3 }, /* (144) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ { 331, -1 }, /* (145) full_table_name ::= table_name */
+ { 331, -3 }, /* (146) full_table_name ::= db_name NK_DOT table_name */
+ { 332, -1 }, /* (147) column_def_list ::= column_def */
+ { 332, -3 }, /* (148) column_def_list ::= column_def_list NK_COMMA column_def */
+ { 349, -2 }, /* (149) column_def ::= column_name type_name */
+ { 349, -4 }, /* (150) column_def ::= column_name type_name COMMENT NK_STRING */
+ { 341, -1 }, /* (151) type_name ::= BOOL */
+ { 341, -1 }, /* (152) type_name ::= TINYINT */
+ { 341, -1 }, /* (153) type_name ::= SMALLINT */
+ { 341, -1 }, /* (154) type_name ::= INT */
+ { 341, -1 }, /* (155) type_name ::= INTEGER */
+ { 341, -1 }, /* (156) type_name ::= BIGINT */
+ { 341, -1 }, /* (157) type_name ::= FLOAT */
+ { 341, -1 }, /* (158) type_name ::= DOUBLE */
+ { 341, -4 }, /* (159) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ { 341, -1 }, /* (160) type_name ::= TIMESTAMP */
+ { 341, -4 }, /* (161) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ { 341, -2 }, /* (162) type_name ::= TINYINT UNSIGNED */
+ { 341, -2 }, /* (163) type_name ::= SMALLINT UNSIGNED */
+ { 341, -2 }, /* (164) type_name ::= INT UNSIGNED */
+ { 341, -2 }, /* (165) type_name ::= BIGINT UNSIGNED */
+ { 341, -1 }, /* (166) type_name ::= JSON */
+ { 341, -4 }, /* (167) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ { 341, -1 }, /* (168) type_name ::= MEDIUMBLOB */
+ { 341, -1 }, /* (169) type_name ::= BLOB */
+ { 341, -4 }, /* (170) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ { 341, -1 }, /* (171) type_name ::= DECIMAL */
+ { 341, -4 }, /* (172) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ { 341, -6 }, /* (173) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ { 333, 0 }, /* (174) tags_def_opt ::= */
+ { 333, -1 }, /* (175) tags_def_opt ::= tags_def */
+ { 336, -4 }, /* (176) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ { 334, 0 }, /* (177) table_options ::= */
+ { 334, -3 }, /* (178) table_options ::= table_options COMMENT NK_STRING */
+ { 334, -3 }, /* (179) table_options ::= table_options MAX_DELAY duration_list */
+ { 334, -3 }, /* (180) table_options ::= table_options WATERMARK duration_list */
+ { 334, -5 }, /* (181) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ { 334, -3 }, /* (182) table_options ::= table_options TTL NK_INTEGER */
+ { 334, -5 }, /* (183) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ { 339, -1 }, /* (184) alter_table_options ::= alter_table_option */
+ { 339, -2 }, /* (185) alter_table_options ::= alter_table_options alter_table_option */
+ { 352, -2 }, /* (186) alter_table_option ::= COMMENT NK_STRING */
+ { 352, -2 }, /* (187) alter_table_option ::= TTL NK_INTEGER */
+ { 350, -1 }, /* (188) duration_list ::= duration_literal */
+ { 350, -3 }, /* (189) duration_list ::= duration_list NK_COMMA duration_literal */
+ { 351, -1 }, /* (190) rollup_func_list ::= rollup_func_name */
+ { 351, -3 }, /* (191) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ { 354, -1 }, /* (192) rollup_func_name ::= function_name */
+ { 354, -1 }, /* (193) rollup_func_name ::= FIRST */
+ { 354, -1 }, /* (194) rollup_func_name ::= LAST */
+ { 347, -1 }, /* (195) col_name_list ::= col_name */
+ { 347, -3 }, /* (196) col_name_list ::= col_name_list NK_COMMA col_name */
+ { 356, -1 }, /* (197) col_name ::= column_name */
+ { 309, -2 }, /* (198) cmd ::= SHOW DNODES */
+ { 309, -2 }, /* (199) cmd ::= SHOW USERS */
+ { 309, -2 }, /* (200) cmd ::= SHOW DATABASES */
+ { 309, -4 }, /* (201) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+ { 309, -4 }, /* (202) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ { 309, -3 }, /* (203) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ { 309, -2 }, /* (204) cmd ::= SHOW MNODES */
+ { 309, -2 }, /* (205) cmd ::= SHOW MODULES */
+ { 309, -2 }, /* (206) cmd ::= SHOW QNODES */
+ { 309, -2 }, /* (207) cmd ::= SHOW FUNCTIONS */
+ { 309, -5 }, /* (208) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ { 309, -2 }, /* (209) cmd ::= SHOW STREAMS */
+ { 309, -2 }, /* (210) cmd ::= SHOW ACCOUNTS */
+ { 309, -2 }, /* (211) cmd ::= SHOW APPS */
+ { 309, -2 }, /* (212) cmd ::= SHOW CONNECTIONS */
+ { 309, -2 }, /* (213) cmd ::= SHOW LICENCES */
+ { 309, -2 }, /* (214) cmd ::= SHOW GRANTS */
+ { 309, -4 }, /* (215) cmd ::= SHOW CREATE DATABASE db_name */
+ { 309, -4 }, /* (216) cmd ::= SHOW CREATE TABLE full_table_name */
+ { 309, -4 }, /* (217) cmd ::= SHOW CREATE STABLE full_table_name */
+ { 309, -2 }, /* (218) cmd ::= SHOW QUERIES */
+ { 309, -2 }, /* (219) cmd ::= SHOW SCORES */
+ { 309, -2 }, /* (220) cmd ::= SHOW TOPICS */
+ { 309, -2 }, /* (221) cmd ::= SHOW VARIABLES */
+ { 309, -3 }, /* (222) cmd ::= SHOW LOCAL VARIABLES */
+ { 309, -4 }, /* (223) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */
+ { 309, -2 }, /* (224) cmd ::= SHOW BNODES */
+ { 309, -2 }, /* (225) cmd ::= SHOW SNODES */
+ { 309, -2 }, /* (226) cmd ::= SHOW CLUSTER */
+ { 309, -2 }, /* (227) cmd ::= SHOW TRANSACTIONS */
+ { 309, -4 }, /* (228) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ { 309, -2 }, /* (229) cmd ::= SHOW CONSUMERS */
+ { 309, -2 }, /* (230) cmd ::= SHOW SUBSCRIPTIONS */
+ { 309, -5 }, /* (231) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ { 309, -3 }, /* (232) cmd ::= SHOW VNODES NK_INTEGER */
+ { 309, -3 }, /* (233) cmd ::= SHOW VNODES NK_STRING */
+ { 357, 0 }, /* (234) db_name_cond_opt ::= */
+ { 357, -2 }, /* (235) db_name_cond_opt ::= db_name NK_DOT */
+ { 358, 0 }, /* (236) like_pattern_opt ::= */
+ { 358, -2 }, /* (237) like_pattern_opt ::= LIKE NK_STRING */
+ { 359, -1 }, /* (238) table_name_cond ::= table_name */
+ { 360, 0 }, /* (239) from_db_opt ::= */
+ { 360, -2 }, /* (240) from_db_opt ::= FROM db_name */
+ { 309, -8 }, /* (241) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
+ { 309, -4 }, /* (242) cmd ::= DROP INDEX exists_opt full_table_name */
+ { 361, -10 }, /* (243) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 361, -12 }, /* (244) 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 */
+ { 362, -1 }, /* (245) func_list ::= func */
+ { 362, -3 }, /* (246) func_list ::= func_list NK_COMMA func */
+ { 365, -4 }, /* (247) func ::= function_name NK_LP expression_list NK_RP */
+ { 364, 0 }, /* (248) sma_stream_opt ::= */
+ { 364, -3 }, /* (249) sma_stream_opt ::= stream_options WATERMARK duration_literal */
+ { 364, -3 }, /* (250) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
+ { 309, -6 }, /* (251) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
+ { 309, -7 }, /* (252) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+ { 309, -9 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+ { 309, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+ { 309, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+ { 309, -4 }, /* (256) cmd ::= DROP TOPIC exists_opt topic_name */
+ { 309, -7 }, /* (257) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ { 309, -2 }, /* (258) cmd ::= DESC full_table_name */
+ { 309, -2 }, /* (259) cmd ::= DESCRIBE full_table_name */
+ { 309, -3 }, /* (260) cmd ::= RESET QUERY CACHE */
+ { 309, -4 }, /* (261) cmd ::= EXPLAIN analyze_opt explain_options query_expression */
+ { 370, 0 }, /* (262) analyze_opt ::= */
+ { 370, -1 }, /* (263) analyze_opt ::= ANALYZE */
+ { 371, 0 }, /* (264) explain_options ::= */
+ { 371, -3 }, /* (265) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 371, -3 }, /* (266) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 309, -10 }, /* (267) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+ { 309, -4 }, /* (268) cmd ::= DROP FUNCTION exists_opt function_name */
+ { 372, 0 }, /* (269) agg_func_opt ::= */
+ { 372, -1 }, /* (270) agg_func_opt ::= AGGREGATE */
+ { 373, 0 }, /* (271) bufsize_opt ::= */
+ { 373, -2 }, /* (272) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 309, -9 }, /* (273) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression */
+ { 309, -4 }, /* (274) cmd ::= DROP STREAM exists_opt stream_name */
+ { 366, 0 }, /* (275) stream_options ::= */
+ { 366, -3 }, /* (276) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 366, -3 }, /* (277) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 366, -4 }, /* (278) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 366, -3 }, /* (279) stream_options ::= stream_options WATERMARK duration_literal */
+ { 366, -4 }, /* (280) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ { 309, -3 }, /* (281) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 309, -3 }, /* (282) cmd ::= KILL QUERY NK_STRING */
+ { 309, -3 }, /* (283) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 309, -2 }, /* (284) cmd ::= BALANCE VGROUP */
+ { 309, -4 }, /* (285) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 309, -4 }, /* (286) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 309, -3 }, /* (287) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 375, -2 }, /* (288) dnode_list ::= DNODE NK_INTEGER */
+ { 375, -3 }, /* (289) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 309, -4 }, /* (290) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ { 309, -1 }, /* (291) cmd ::= query_expression */
+ { 309, -7 }, /* (292) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
+ { 309, -4 }, /* (293) cmd ::= INSERT INTO full_table_name query_expression */
+ { 312, -1 }, /* (294) literal ::= NK_INTEGER */
+ { 312, -1 }, /* (295) literal ::= NK_FLOAT */
+ { 312, -1 }, /* (296) literal ::= NK_STRING */
+ { 312, -1 }, /* (297) literal ::= NK_BOOL */
+ { 312, -2 }, /* (298) literal ::= TIMESTAMP NK_STRING */
+ { 312, -1 }, /* (299) literal ::= duration_literal */
+ { 312, -1 }, /* (300) literal ::= NULL */
+ { 312, -1 }, /* (301) literal ::= NK_QUESTION */
+ { 353, -1 }, /* (302) duration_literal ::= NK_VARIABLE */
+ { 377, -1 }, /* (303) signed ::= NK_INTEGER */
+ { 377, -2 }, /* (304) signed ::= NK_PLUS NK_INTEGER */
+ { 377, -2 }, /* (305) signed ::= NK_MINUS NK_INTEGER */
+ { 377, -1 }, /* (306) signed ::= NK_FLOAT */
+ { 377, -2 }, /* (307) signed ::= NK_PLUS NK_FLOAT */
+ { 377, -2 }, /* (308) signed ::= NK_MINUS NK_FLOAT */
+ { 342, -1 }, /* (309) signed_literal ::= signed */
+ { 342, -1 }, /* (310) signed_literal ::= NK_STRING */
+ { 342, -1 }, /* (311) signed_literal ::= NK_BOOL */
+ { 342, -2 }, /* (312) signed_literal ::= TIMESTAMP NK_STRING */
+ { 342, -1 }, /* (313) signed_literal ::= duration_literal */
+ { 342, -1 }, /* (314) signed_literal ::= NULL */
+ { 342, -1 }, /* (315) signed_literal ::= literal_func */
+ { 342, -1 }, /* (316) signed_literal ::= NK_QUESTION */
+ { 379, -1 }, /* (317) literal_list ::= signed_literal */
+ { 379, -3 }, /* (318) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 320, -1 }, /* (319) db_name ::= NK_ID */
+ { 348, -1 }, /* (320) table_name ::= NK_ID */
+ { 340, -1 }, /* (321) column_name ::= NK_ID */
+ { 355, -1 }, /* (322) function_name ::= NK_ID */
+ { 380, -1 }, /* (323) table_alias ::= NK_ID */
+ { 381, -1 }, /* (324) column_alias ::= NK_ID */
+ { 314, -1 }, /* (325) user_name ::= NK_ID */
+ { 367, -1 }, /* (326) topic_name ::= NK_ID */
+ { 374, -1 }, /* (327) stream_name ::= NK_ID */
+ { 369, -1 }, /* (328) cgroup_name ::= NK_ID */
+ { 382, -1 }, /* (329) expression ::= literal */
+ { 382, -1 }, /* (330) expression ::= pseudo_column */
+ { 382, -1 }, /* (331) expression ::= column_reference */
+ { 382, -1 }, /* (332) expression ::= function_expression */
+ { 382, -1 }, /* (333) expression ::= subquery */
+ { 382, -3 }, /* (334) expression ::= NK_LP expression NK_RP */
+ { 382, -2 }, /* (335) expression ::= NK_PLUS expression */
+ { 382, -2 }, /* (336) expression ::= NK_MINUS expression */
+ { 382, -3 }, /* (337) expression ::= expression NK_PLUS expression */
+ { 382, -3 }, /* (338) expression ::= expression NK_MINUS expression */
+ { 382, -3 }, /* (339) expression ::= expression NK_STAR expression */
+ { 382, -3 }, /* (340) expression ::= expression NK_SLASH expression */
+ { 382, -3 }, /* (341) expression ::= expression NK_REM expression */
+ { 382, -3 }, /* (342) expression ::= column_reference NK_ARROW NK_STRING */
+ { 382, -3 }, /* (343) expression ::= expression NK_BITAND expression */
+ { 382, -3 }, /* (344) expression ::= expression NK_BITOR expression */
+ { 345, -1 }, /* (345) expression_list ::= expression */
+ { 345, -3 }, /* (346) expression_list ::= expression_list NK_COMMA expression */
+ { 384, -1 }, /* (347) column_reference ::= column_name */
+ { 384, -3 }, /* (348) column_reference ::= table_name NK_DOT column_name */
+ { 383, -1 }, /* (349) pseudo_column ::= ROWTS */
+ { 383, -1 }, /* (350) pseudo_column ::= TBNAME */
+ { 383, -3 }, /* (351) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 383, -1 }, /* (352) pseudo_column ::= QSTART */
+ { 383, -1 }, /* (353) pseudo_column ::= QEND */
+ { 383, -1 }, /* (354) pseudo_column ::= QDURATION */
+ { 383, -1 }, /* (355) pseudo_column ::= WSTART */
+ { 383, -1 }, /* (356) pseudo_column ::= WEND */
+ { 383, -1 }, /* (357) pseudo_column ::= WDURATION */
+ { 385, -4 }, /* (358) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 385, -4 }, /* (359) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 385, -6 }, /* (360) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+ { 385, -1 }, /* (361) function_expression ::= literal_func */
+ { 378, -3 }, /* (362) literal_func ::= noarg_func NK_LP NK_RP */
+ { 378, -1 }, /* (363) literal_func ::= NOW */
+ { 389, -1 }, /* (364) noarg_func ::= NOW */
+ { 389, -1 }, /* (365) noarg_func ::= TODAY */
+ { 389, -1 }, /* (366) noarg_func ::= TIMEZONE */
+ { 389, -1 }, /* (367) noarg_func ::= DATABASE */
+ { 389, -1 }, /* (368) noarg_func ::= CLIENT_VERSION */
+ { 389, -1 }, /* (369) noarg_func ::= SERVER_VERSION */
+ { 389, -1 }, /* (370) noarg_func ::= SERVER_STATUS */
+ { 389, -1 }, /* (371) noarg_func ::= CURRENT_USER */
+ { 389, -1 }, /* (372) noarg_func ::= USER */
+ { 387, -1 }, /* (373) star_func ::= COUNT */
+ { 387, -1 }, /* (374) star_func ::= FIRST */
+ { 387, -1 }, /* (375) star_func ::= LAST */
+ { 387, -1 }, /* (376) star_func ::= LAST_ROW */
+ { 388, -1 }, /* (377) star_func_para_list ::= NK_STAR */
+ { 388, -1 }, /* (378) star_func_para_list ::= other_para_list */
+ { 390, -1 }, /* (379) other_para_list ::= star_func_para */
+ { 390, -3 }, /* (380) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 391, -1 }, /* (381) star_func_para ::= expression */
+ { 391, -3 }, /* (382) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 392, -3 }, /* (383) predicate ::= expression compare_op expression */
+ { 392, -5 }, /* (384) predicate ::= expression BETWEEN expression AND expression */
+ { 392, -6 }, /* (385) predicate ::= expression NOT BETWEEN expression AND expression */
+ { 392, -3 }, /* (386) predicate ::= expression IS NULL */
+ { 392, -4 }, /* (387) predicate ::= expression IS NOT NULL */
+ { 392, -3 }, /* (388) predicate ::= expression in_op in_predicate_value */
+ { 393, -1 }, /* (389) compare_op ::= NK_LT */
+ { 393, -1 }, /* (390) compare_op ::= NK_GT */
+ { 393, -1 }, /* (391) compare_op ::= NK_LE */
+ { 393, -1 }, /* (392) compare_op ::= NK_GE */
+ { 393, -1 }, /* (393) compare_op ::= NK_NE */
+ { 393, -1 }, /* (394) compare_op ::= NK_EQ */
+ { 393, -1 }, /* (395) compare_op ::= LIKE */
+ { 393, -2 }, /* (396) compare_op ::= NOT LIKE */
+ { 393, -1 }, /* (397) compare_op ::= MATCH */
+ { 393, -1 }, /* (398) compare_op ::= NMATCH */
+ { 393, -1 }, /* (399) compare_op ::= CONTAINS */
+ { 394, -1 }, /* (400) in_op ::= IN */
+ { 394, -2 }, /* (401) in_op ::= NOT IN */
+ { 395, -3 }, /* (402) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 396, -1 }, /* (403) boolean_value_expression ::= boolean_primary */
+ { 396, -2 }, /* (404) boolean_value_expression ::= NOT boolean_primary */
+ { 396, -3 }, /* (405) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 396, -3 }, /* (406) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 397, -1 }, /* (407) boolean_primary ::= predicate */
+ { 397, -3 }, /* (408) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 398, -1 }, /* (409) common_expression ::= expression */
+ { 398, -1 }, /* (410) common_expression ::= boolean_value_expression */
+ { 399, 0 }, /* (411) from_clause_opt ::= */
+ { 399, -2 }, /* (412) from_clause_opt ::= FROM table_reference_list */
+ { 400, -1 }, /* (413) table_reference_list ::= table_reference */
+ { 400, -3 }, /* (414) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 401, -1 }, /* (415) table_reference ::= table_primary */
+ { 401, -1 }, /* (416) table_reference ::= joined_table */
+ { 402, -2 }, /* (417) table_primary ::= table_name alias_opt */
+ { 402, -4 }, /* (418) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 402, -2 }, /* (419) table_primary ::= subquery alias_opt */
+ { 402, -1 }, /* (420) table_primary ::= parenthesized_joined_table */
+ { 404, 0 }, /* (421) alias_opt ::= */
+ { 404, -1 }, /* (422) alias_opt ::= table_alias */
+ { 404, -2 }, /* (423) alias_opt ::= AS table_alias */
+ { 405, -3 }, /* (424) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 405, -3 }, /* (425) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 403, -6 }, /* (426) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 406, 0 }, /* (427) join_type ::= */
+ { 406, -1 }, /* (428) join_type ::= INNER */
+ { 408, -12 }, /* (429) 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 */
+ { 409, 0 }, /* (430) set_quantifier_opt ::= */
+ { 409, -1 }, /* (431) set_quantifier_opt ::= DISTINCT */
+ { 409, -1 }, /* (432) set_quantifier_opt ::= ALL */
+ { 410, -1 }, /* (433) select_list ::= select_item */
+ { 410, -3 }, /* (434) select_list ::= select_list NK_COMMA select_item */
+ { 418, -1 }, /* (435) select_item ::= NK_STAR */
+ { 418, -1 }, /* (436) select_item ::= common_expression */
+ { 418, -2 }, /* (437) select_item ::= common_expression column_alias */
+ { 418, -3 }, /* (438) select_item ::= common_expression AS column_alias */
+ { 418, -3 }, /* (439) select_item ::= table_name NK_DOT NK_STAR */
+ { 376, 0 }, /* (440) where_clause_opt ::= */
+ { 376, -2 }, /* (441) where_clause_opt ::= WHERE search_condition */
+ { 411, 0 }, /* (442) partition_by_clause_opt ::= */
+ { 411, -3 }, /* (443) partition_by_clause_opt ::= PARTITION BY expression_list */
+ { 415, 0 }, /* (444) twindow_clause_opt ::= */
+ { 415, -6 }, /* (445) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 415, -4 }, /* (446) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+ { 415, -6 }, /* (447) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 415, -8 }, /* (448) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 363, 0 }, /* (449) sliding_opt ::= */
+ { 363, -4 }, /* (450) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 414, 0 }, /* (451) fill_opt ::= */
+ { 414, -4 }, /* (452) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 414, -6 }, /* (453) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 419, -1 }, /* (454) fill_mode ::= NONE */
+ { 419, -1 }, /* (455) fill_mode ::= PREV */
+ { 419, -1 }, /* (456) fill_mode ::= NULL */
+ { 419, -1 }, /* (457) fill_mode ::= LINEAR */
+ { 419, -1 }, /* (458) fill_mode ::= NEXT */
+ { 416, 0 }, /* (459) group_by_clause_opt ::= */
+ { 416, -3 }, /* (460) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 420, -1 }, /* (461) group_by_list ::= expression */
+ { 420, -3 }, /* (462) group_by_list ::= group_by_list NK_COMMA expression */
+ { 417, 0 }, /* (463) having_clause_opt ::= */
+ { 417, -2 }, /* (464) having_clause_opt ::= HAVING search_condition */
+ { 412, 0 }, /* (465) range_opt ::= */
+ { 412, -6 }, /* (466) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
+ { 413, 0 }, /* (467) every_opt ::= */
+ { 413, -4 }, /* (468) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 368, -4 }, /* (469) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 421, -1 }, /* (470) query_expression_body ::= query_primary */
+ { 421, -4 }, /* (471) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+ { 421, -3 }, /* (472) query_expression_body ::= query_expression_body UNION query_expression_body */
+ { 425, -1 }, /* (473) query_primary ::= query_specification */
+ { 425, -6 }, /* (474) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+ { 422, 0 }, /* (475) order_by_clause_opt ::= */
+ { 422, -3 }, /* (476) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 423, 0 }, /* (477) slimit_clause_opt ::= */
+ { 423, -2 }, /* (478) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 423, -4 }, /* (479) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 423, -4 }, /* (480) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 424, 0 }, /* (481) limit_clause_opt ::= */
+ { 424, -2 }, /* (482) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 424, -4 }, /* (483) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 424, -4 }, /* (484) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 386, -3 }, /* (485) subquery ::= NK_LP query_expression NK_RP */
+ { 407, -1 }, /* (486) search_condition ::= common_expression */
+ { 426, -1 }, /* (487) sort_specification_list ::= sort_specification */
+ { 426, -3 }, /* (488) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 427, -3 }, /* (489) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+ { 428, 0 }, /* (490) ordering_specification_opt ::= */
+ { 428, -1 }, /* (491) ordering_specification_opt ::= ASC */
+ { 428, -1 }, /* (492) ordering_specification_opt ::= DESC */
+ { 429, 0 }, /* (493) null_ordering_opt ::= */
+ { 429, -2 }, /* (494) null_ordering_opt ::= NULLS FIRST */
+ { 429, -2 }, /* (495) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3415,11 +3429,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,309,&yymsp[0].minor);
+ yy_destructor(yypParser,310,&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,310,&yymsp[0].minor);
+ yy_destructor(yypParser,311,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -3433,20 +3447,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,309,&yymsp[-2].minor);
+{ yy_destructor(yypParser,310,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,311,&yymsp[0].minor);
+ yy_destructor(yypParser,312,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,312,&yymsp[0].minor);
+{ yy_destructor(yypParser,313,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,310,&yymsp[-1].minor);
+{ yy_destructor(yypParser,311,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,312,&yymsp[0].minor);
+ yy_destructor(yypParser,313,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -3460,72 +3474,72 @@ 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,311,&yymsp[0].minor);
+ yy_destructor(yypParser,312,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy239, &yymsp[-1].minor.yy0, yymsp[0].minor.yy509); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy149, &yymsp[-1].minor.yy0, yymsp[0].minor.yy363); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy239, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy149, 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.yy239, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy149, 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.yy239, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy149, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy149); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy509 = 1; }
+{ yymsp[1].minor.yy363 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy509 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy363 = 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.yy129, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy49, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy149); }
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy129, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy49, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy149); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy129 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy49 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35);
-{ yylhsminor.yy129 = yymsp[0].minor.yy129; }
- yymsp[0].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy49 = yymsp[0].minor.yy49; }
+ yymsp[0].minor.yy49 = yylhsminor.yy49;
break;
case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy129 = yymsp[-2].minor.yy129 | yymsp[0].minor.yy129; }
- yymsp[-2].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy49 = yymsp[-2].minor.yy49 | yymsp[0].minor.yy49; }
+ yymsp[-2].minor.yy49 = yylhsminor.yy49;
break;
case 37: /* priv_type ::= READ */
-{ yymsp[0].minor.yy129 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy49 = PRIVILEGE_TYPE_READ; }
break;
case 38: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy129 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy49 = PRIVILEGE_TYPE_WRITE; }
break;
case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy239 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy239 = yylhsminor.yy239;
+{ yylhsminor.yy149 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy149 = yylhsminor.yy149;
break;
case 40: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy239 = yymsp[-2].minor.yy239; }
- yymsp[-2].minor.yy239 = yylhsminor.yy239;
+{ yylhsminor.yy149 = yymsp[-2].minor.yy149; }
+ yymsp[-2].minor.yy149 = yylhsminor.yy149;
break;
case 41: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy239, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy149, NULL); }
break;
case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy0); }
break;
case 43: /* cmd ::= DROP DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 44: /* cmd ::= DROP DNODE dnode_endpoint */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy149); }
break;
case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3542,31 +3556,31 @@ static YYACTIONTYPE yy_reduce(
case 49: /* dnode_endpoint ::= NK_STRING */
case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50);
case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51);
- case 318: /* db_name ::= NK_ID */ yytestcase(yyruleno==318);
- case 319: /* table_name ::= NK_ID */ yytestcase(yyruleno==319);
- case 320: /* column_name ::= NK_ID */ yytestcase(yyruleno==320);
- case 321: /* function_name ::= NK_ID */ yytestcase(yyruleno==321);
- case 322: /* table_alias ::= NK_ID */ yytestcase(yyruleno==322);
- case 323: /* column_alias ::= NK_ID */ yytestcase(yyruleno==323);
- case 324: /* user_name ::= NK_ID */ yytestcase(yyruleno==324);
- case 325: /* topic_name ::= NK_ID */ yytestcase(yyruleno==325);
- case 326: /* stream_name ::= NK_ID */ yytestcase(yyruleno==326);
- case 327: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==327);
- case 363: /* noarg_func ::= NOW */ yytestcase(yyruleno==363);
- case 364: /* noarg_func ::= TODAY */ yytestcase(yyruleno==364);
- case 365: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==365);
- case 366: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==366);
- case 367: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==367);
- case 368: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==368);
- case 369: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==369);
- case 370: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==370);
- case 371: /* noarg_func ::= USER */ yytestcase(yyruleno==371);
- case 372: /* star_func ::= COUNT */ yytestcase(yyruleno==372);
- case 373: /* star_func ::= FIRST */ yytestcase(yyruleno==373);
- case 374: /* star_func ::= LAST */ yytestcase(yyruleno==374);
- case 375: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==375);
-{ yylhsminor.yy239 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy239 = yylhsminor.yy239;
+ case 319: /* db_name ::= NK_ID */ yytestcase(yyruleno==319);
+ case 320: /* table_name ::= NK_ID */ yytestcase(yyruleno==320);
+ case 321: /* column_name ::= NK_ID */ yytestcase(yyruleno==321);
+ case 322: /* function_name ::= NK_ID */ yytestcase(yyruleno==322);
+ case 323: /* table_alias ::= NK_ID */ yytestcase(yyruleno==323);
+ case 324: /* column_alias ::= NK_ID */ yytestcase(yyruleno==324);
+ case 325: /* user_name ::= NK_ID */ yytestcase(yyruleno==325);
+ case 326: /* topic_name ::= NK_ID */ yytestcase(yyruleno==326);
+ case 327: /* stream_name ::= NK_ID */ yytestcase(yyruleno==327);
+ case 328: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==328);
+ case 364: /* noarg_func ::= NOW */ yytestcase(yyruleno==364);
+ case 365: /* noarg_func ::= TODAY */ yytestcase(yyruleno==365);
+ case 366: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==366);
+ case 367: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==367);
+ case 368: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==368);
+ case 369: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==369);
+ case 370: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==370);
+ case 371: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==371);
+ case 372: /* noarg_func ::= USER */ yytestcase(yyruleno==372);
+ case 373: /* star_func ::= COUNT */ yytestcase(yyruleno==373);
+ case 374: /* star_func ::= FIRST */ yytestcase(yyruleno==374);
+ case 375: /* star_func ::= LAST */ yytestcase(yyruleno==375);
+ case 376: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==376);
+{ yylhsminor.yy149 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy149 = yylhsminor.yy149;
break;
case 52: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -3599,1282 +3613,1286 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy845, &yymsp[-1].minor.yy239, yymsp[0].minor.yy80); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy497, &yymsp[-1].minor.yy149, yymsp[0].minor.yy312); }
break;
case 63: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy497, &yymsp[0].minor.yy149); }
break;
case 64: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy149); }
break;
case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy239, yymsp[0].minor.yy80); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy149, yymsp[0].minor.yy312); }
break;
case 66: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy149); }
break;
case 67: /* cmd ::= TRIM DATABASE db_name */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy239); }
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy149); }
break;
case 68: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy845 = true; }
+{ yymsp[-2].minor.yy497 = true; }
break;
case 69: /* not_exists_opt ::= */
case 71: /* exists_opt ::= */ yytestcase(yyruleno==71);
- case 261: /* analyze_opt ::= */ yytestcase(yyruleno==261);
- case 268: /* agg_func_opt ::= */ yytestcase(yyruleno==268);
- case 429: /* set_quantifier_opt ::= */ yytestcase(yyruleno==429);
-{ yymsp[1].minor.yy845 = false; }
+ case 262: /* analyze_opt ::= */ yytestcase(yyruleno==262);
+ case 269: /* agg_func_opt ::= */ yytestcase(yyruleno==269);
+ case 430: /* set_quantifier_opt ::= */ yytestcase(yyruleno==430);
+{ yymsp[1].minor.yy497 = false; }
break;
case 70: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy845 = true; }
+{ yymsp[-1].minor.yy497 = true; }
break;
case 72: /* db_options ::= */
-{ yymsp[1].minor.yy80 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy312 = createDefaultDatabaseOptions(pCxt); }
break;
case 73: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 76: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 77: /* db_options ::= db_options DURATION NK_INTEGER */
case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78);
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 80: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 81: /* db_options ::= db_options KEEP integer_list */
case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82);
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_KEEP, yymsp[0].minor.yy574); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_KEEP, yymsp[0].minor.yy824); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 83: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 85: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 85: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 86: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 86: /* db_options ::= db_options PRECISION NK_STRING */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 87: /* db_options ::= db_options STRICT NK_STRING */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 87: /* db_options ::= db_options REPLICA NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 88: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 88: /* db_options ::= db_options STRICT NK_STRING */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 89: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 89: /* db_options ::= db_options VGROUPS NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 90: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_RETENTIONS, yymsp[0].minor.yy574); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 90: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 91: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 91: /* db_options ::= db_options RETENTIONS retention_list */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_RETENTIONS, yymsp[0].minor.yy824); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 92: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 92: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 93: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 93: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 94: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 94: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 96: /* 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.yy80 = setDatabaseOption(pCxt, yymsp[-3].minor.yy80, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-3].minor.yy312, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 96: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ case 98: /* 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.yy80 = setDatabaseOption(pCxt, yymsp[-3].minor.yy80, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-3].minor.yy312, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
- break;
- case 98: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
- break;
- case 99: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
- break;
- case 100: /* db_options ::= db_options SST_TRIGGER NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_SST_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
- break;
- case 101: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
- break;
- case 102: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
-{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
- break;
- case 103: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy80 = createAlterDatabaseOptions(pCxt); yylhsminor.yy80 = setAlterDatabaseOption(pCxt, yylhsminor.yy80, &yymsp[0].minor.yy299); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
- break;
- case 104: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy80 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy80, &yymsp[0].minor.yy299); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
- break;
- case 105: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy299.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy299.val = yymsp[0].minor.yy0; }
- break;
- case 106: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy299.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy299.val = yymsp[0].minor.yy0; }
- break;
- case 107: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy299.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy299.val = yymsp[0].minor.yy0; }
- break;
- case 108: /* alter_db_option ::= KEEP integer_list */
- case 109: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==109);
-{ yymsp[-1].minor.yy299.type = DB_OPTION_KEEP; yymsp[-1].minor.yy299.pList = yymsp[0].minor.yy574; }
- break;
- case 110: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy299.type = DB_OPTION_WAL; yymsp[-1].minor.yy299.val = yymsp[0].minor.yy0; }
- break;
- case 111: /* alter_db_option ::= SST_TRIGGER NK_INTEGER */
-{ yymsp[-1].minor.yy299.type = DB_OPTION_SST_TRIGGER; yymsp[-1].minor.yy299.val = yymsp[0].minor.yy0; }
- break;
- case 112: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy574 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy574 = yylhsminor.yy574;
- break;
- case 113: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 288: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==288);
-{ yylhsminor.yy574 = addNodeToList(pCxt, yymsp[-2].minor.yy574, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy574 = yylhsminor.yy574;
- break;
- case 114: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy574 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy574 = yylhsminor.yy574;
- break;
- case 115: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy574 = addNodeToList(pCxt, yymsp[-2].minor.yy574, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy574 = yylhsminor.yy574;
- break;
- case 116: /* retention_list ::= retention */
- case 136: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==136);
- case 139: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==139);
- case 146: /* column_def_list ::= column_def */ yytestcase(yyruleno==146);
- case 189: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==189);
- case 194: /* col_name_list ::= col_name */ yytestcase(yyruleno==194);
- case 244: /* func_list ::= func */ yytestcase(yyruleno==244);
- case 316: /* literal_list ::= signed_literal */ yytestcase(yyruleno==316);
- case 378: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==378);
- case 432: /* select_list ::= select_item */ yytestcase(yyruleno==432);
- case 486: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==486);
-{ yylhsminor.yy574 = createNodeList(pCxt, yymsp[0].minor.yy80); }
- yymsp[0].minor.yy574 = yylhsminor.yy574;
- break;
- case 117: /* retention_list ::= retention_list NK_COMMA retention */
- case 147: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==147);
- case 190: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==190);
- case 195: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==195);
- case 245: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==245);
- case 317: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==317);
- case 379: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==379);
- case 433: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==433);
- case 487: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==487);
-{ yylhsminor.yy574 = addNodeToList(pCxt, yymsp[-2].minor.yy574, yymsp[0].minor.yy80); }
- yymsp[-2].minor.yy574 = yylhsminor.yy574;
- break;
- case 118: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy80 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
- break;
- case 119: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- case 121: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==121);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy845, yymsp[-5].minor.yy80, yymsp[-3].minor.yy574, yymsp[-1].minor.yy574, yymsp[0].minor.yy80); }
- break;
- case 120: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy574); }
- break;
- case 122: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy574); }
- break;
- case 123: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy845, yymsp[0].minor.yy80); }
- break;
- case 124: /* cmd ::= ALTER TABLE alter_table_clause */
- case 290: /* cmd ::= query_expression */ yytestcase(yyruleno==290);
-{ pCxt->pRootNode = yymsp[0].minor.yy80; }
- break;
- case 125: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy80); }
- break;
- case 126: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy80 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
- break;
- case 127: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy239, yymsp[0].minor.yy136); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
- break;
- case 128: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy80 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy80, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy239); }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
- break;
- case 129: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy239, yymsp[0].minor.yy136); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 99: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 100: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 101: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 102: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 103: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+{ yylhsminor.yy312 = setDatabaseOption(pCxt, yymsp[-2].minor.yy312, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 104: /* alter_db_options ::= alter_db_option */
+{ yylhsminor.yy312 = createAlterDatabaseOptions(pCxt); yylhsminor.yy312 = setAlterDatabaseOption(pCxt, yylhsminor.yy312, &yymsp[0].minor.yy405); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 105: /* alter_db_options ::= alter_db_options alter_db_option */
+{ yylhsminor.yy312 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy312, &yymsp[0].minor.yy405); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 106: /* alter_db_option ::= CACHEMODEL NK_STRING */
+{ yymsp[-1].minor.yy405.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+ break;
+ case 107: /* alter_db_option ::= CACHESIZE NK_INTEGER */
+{ yymsp[-1].minor.yy405.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+ break;
+ case 108: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy405.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+ break;
+ case 109: /* alter_db_option ::= KEEP integer_list */
+ case 110: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==110);
+{ yymsp[-1].minor.yy405.type = DB_OPTION_KEEP; yymsp[-1].minor.yy405.pList = yymsp[0].minor.yy824; }
+ break;
+ case 111: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
+{ yymsp[-1].minor.yy405.type = DB_OPTION_WAL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+ break;
+ case 112: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
+{ yymsp[-1].minor.yy405.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+ break;
+ case 113: /* integer_list ::= NK_INTEGER */
+{ yylhsminor.yy824 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy824 = yylhsminor.yy824;
+ break;
+ case 114: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ case 289: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==289);
+{ yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy824 = yylhsminor.yy824;
+ break;
+ case 115: /* variable_list ::= NK_VARIABLE */
+{ yylhsminor.yy824 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy824 = yylhsminor.yy824;
+ break;
+ case 116: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+{ yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy824 = yylhsminor.yy824;
+ break;
+ case 117: /* retention_list ::= retention */
+ case 137: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==137);
+ case 140: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==140);
+ case 147: /* column_def_list ::= column_def */ yytestcase(yyruleno==147);
+ case 190: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==190);
+ case 195: /* col_name_list ::= col_name */ yytestcase(yyruleno==195);
+ case 245: /* func_list ::= func */ yytestcase(yyruleno==245);
+ case 317: /* literal_list ::= signed_literal */ yytestcase(yyruleno==317);
+ case 379: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==379);
+ case 433: /* select_list ::= select_item */ yytestcase(yyruleno==433);
+ case 487: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==487);
+{ yylhsminor.yy824 = createNodeList(pCxt, yymsp[0].minor.yy312); }
+ yymsp[0].minor.yy824 = yylhsminor.yy824;
+ break;
+ case 118: /* retention_list ::= retention_list NK_COMMA retention */
+ case 148: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==148);
+ case 191: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==191);
+ case 196: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==196);
+ case 246: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==246);
+ case 318: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==318);
+ case 380: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==380);
+ case 434: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==434);
+ case 488: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==488);
+{ yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, yymsp[0].minor.yy312); }
+ yymsp[-2].minor.yy824 = yylhsminor.yy824;
+ break;
+ case 119: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+{ yylhsminor.yy312 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 120: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ case 122: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==122);
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy497, yymsp[-5].minor.yy312, yymsp[-3].minor.yy824, yymsp[-1].minor.yy824, yymsp[0].minor.yy312); }
+ break;
+ case 121: /* cmd ::= CREATE TABLE multi_create_clause */
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy824); }
+ break;
+ case 123: /* cmd ::= DROP TABLE multi_drop_clause */
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy824); }
+ break;
+ case 124: /* cmd ::= DROP STABLE exists_opt full_table_name */
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy497, yymsp[0].minor.yy312); }
+ break;
+ case 125: /* cmd ::= ALTER TABLE alter_table_clause */
+ case 291: /* cmd ::= query_expression */ yytestcase(yyruleno==291);
+{ pCxt->pRootNode = yymsp[0].minor.yy312; }
+ break;
+ case 126: /* cmd ::= ALTER STABLE alter_table_clause */
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy312); }
+ break;
+ case 127: /* alter_table_clause ::= full_table_name alter_table_options */
+{ yylhsminor.yy312 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy312, yymsp[0].minor.yy312); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 128: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+{ yylhsminor.yy312 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy312, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy149, yymsp[0].minor.yy84); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 129: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
+{ yylhsminor.yy312 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy312, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy149); }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 130: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+{ yylhsminor.yy312 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy312, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy149, yymsp[0].minor.yy84); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
break;
- case 130: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy80 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy239, &yymsp[0].minor.yy239); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
+ case 131: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+{ yylhsminor.yy312 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy312, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy149, &yymsp[0].minor.yy149); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
break;
- case 131: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy239, yymsp[0].minor.yy136); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
- break;
- case 132: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy80 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy80, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy239); }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 132: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+{ yylhsminor.yy312 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy312, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy149, yymsp[0].minor.yy84); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
+ break;
+ case 133: /* alter_table_clause ::= full_table_name DROP TAG column_name */
+{ yylhsminor.yy312 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy312, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy149); }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 133: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy239, yymsp[0].minor.yy136); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
+ case 134: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+{ yylhsminor.yy312 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy312, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy149, yymsp[0].minor.yy84); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
break;
- case 134: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy80 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy239, &yymsp[0].minor.yy239); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
+ case 135: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+{ yylhsminor.yy312 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy312, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy149, &yymsp[0].minor.yy149); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
break;
- case 135: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy80 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy80, &yymsp[-2].minor.yy239, yymsp[0].minor.yy80); }
- yymsp[-5].minor.yy80 = yylhsminor.yy80;
+ case 136: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+{ yylhsminor.yy312 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy312, &yymsp[-2].minor.yy149, yymsp[0].minor.yy312); }
+ yymsp[-5].minor.yy312 = yylhsminor.yy312;
break;
- case 137: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
- case 140: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==140);
-{ yylhsminor.yy574 = addNodeToList(pCxt, yymsp[-1].minor.yy574, yymsp[0].minor.yy80); }
- yymsp[-1].minor.yy574 = yylhsminor.yy574;
+ case 138: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
+ case 141: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==141);
+{ yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-1].minor.yy824, yymsp[0].minor.yy312); }
+ yymsp[-1].minor.yy824 = yylhsminor.yy824;
break;
- case 138: /* 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.yy80 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy845, yymsp[-8].minor.yy80, yymsp[-6].minor.yy80, yymsp[-5].minor.yy574, yymsp[-2].minor.yy574, yymsp[0].minor.yy80); }
- yymsp[-9].minor.yy80 = yylhsminor.yy80;
+ case 139: /* 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.yy312 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy497, yymsp[-8].minor.yy312, yymsp[-6].minor.yy312, yymsp[-5].minor.yy824, yymsp[-2].minor.yy824, yymsp[0].minor.yy312); }
+ yymsp[-9].minor.yy312 = yylhsminor.yy312;
break;
- case 141: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy80 = createDropTableClause(pCxt, yymsp[-1].minor.yy845, yymsp[0].minor.yy80); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 142: /* drop_table_clause ::= exists_opt full_table_name */
+{ yylhsminor.yy312 = createDropTableClause(pCxt, yymsp[-1].minor.yy497, yymsp[0].minor.yy312); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 142: /* specific_cols_opt ::= */
- case 173: /* tags_def_opt ::= */ yytestcase(yyruleno==173);
- case 441: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==441);
- case 458: /* group_by_clause_opt ::= */ yytestcase(yyruleno==458);
- case 474: /* order_by_clause_opt ::= */ yytestcase(yyruleno==474);
-{ yymsp[1].minor.yy574 = NULL; }
+ case 143: /* specific_cols_opt ::= */
+ case 174: /* tags_def_opt ::= */ yytestcase(yyruleno==174);
+ case 442: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==442);
+ case 459: /* group_by_clause_opt ::= */ yytestcase(yyruleno==459);
+ case 475: /* order_by_clause_opt ::= */ yytestcase(yyruleno==475);
+{ yymsp[1].minor.yy824 = NULL; }
break;
- case 143: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
-{ yymsp[-2].minor.yy574 = yymsp[-1].minor.yy574; }
+ case 144: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
+{ yymsp[-2].minor.yy824 = yymsp[-1].minor.yy824; }
break;
- case 144: /* full_table_name ::= table_name */
-{ yylhsminor.yy80 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy239, NULL); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 145: /* full_table_name ::= table_name */
+{ yylhsminor.yy312 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy149, NULL); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 145: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy80 = createRealTableNode(pCxt, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy239, NULL); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 146: /* full_table_name ::= db_name NK_DOT table_name */
+{ yylhsminor.yy312 = createRealTableNode(pCxt, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy149, NULL); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 148: /* column_def ::= column_name type_name */
-{ yylhsminor.yy80 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy239, yymsp[0].minor.yy136, NULL); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 149: /* column_def ::= column_name type_name */
+{ yylhsminor.yy312 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy149, yymsp[0].minor.yy84, NULL); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 149: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy80 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy239, yymsp[-2].minor.yy136, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 150: /* column_def ::= column_name type_name COMMENT NK_STRING */
+{ yylhsminor.yy312 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy149, yymsp[-2].minor.yy84, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 150: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_BOOL); }
+ case 151: /* type_name ::= BOOL */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
- case 151: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+ case 152: /* type_name ::= TINYINT */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
- case 152: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+ case 153: /* type_name ::= SMALLINT */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
- case 153: /* type_name ::= INT */
- case 154: /* type_name ::= INTEGER */ yytestcase(yyruleno==154);
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_INT); }
+ case 154: /* type_name ::= INT */
+ case 155: /* type_name ::= INTEGER */ yytestcase(yyruleno==155);
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_INT); }
break;
- case 155: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+ case 156: /* type_name ::= BIGINT */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
- case 156: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+ case 157: /* type_name ::= FLOAT */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
- case 157: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+ case 158: /* type_name ::= DOUBLE */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
- case 158: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy136 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+ case 159: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
- case 159: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+ case 160: /* type_name ::= TIMESTAMP */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
- case 160: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy136 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+ case 161: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
- case 161: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy136 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+ case 162: /* type_name ::= TINYINT UNSIGNED */
+{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
- case 162: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy136 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+ case 163: /* type_name ::= SMALLINT UNSIGNED */
+{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
- case 163: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy136 = createDataType(TSDB_DATA_TYPE_UINT); }
+ case 164: /* type_name ::= INT UNSIGNED */
+{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
- case 164: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy136 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+ case 165: /* type_name ::= BIGINT UNSIGNED */
+{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
- case 165: /* type_name ::= JSON */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_JSON); }
+ case 166: /* type_name ::= JSON */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
- case 166: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy136 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+ case 167: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
- case 167: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+ case 168: /* type_name ::= MEDIUMBLOB */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
- case 168: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_BLOB); }
+ case 169: /* type_name ::= BLOB */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
- case 169: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy136 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+ case 170: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
- case 170: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy136 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 171: /* type_name ::= DECIMAL */
+{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 171: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy136 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 172: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 172: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy136 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 173: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 174: /* tags_def_opt ::= tags_def */
- case 377: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==377);
-{ yylhsminor.yy574 = yymsp[0].minor.yy574; }
- yymsp[0].minor.yy574 = yylhsminor.yy574;
+ case 175: /* tags_def_opt ::= tags_def */
+ case 378: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==378);
+{ yylhsminor.yy824 = yymsp[0].minor.yy824; }
+ yymsp[0].minor.yy824 = yylhsminor.yy824;
break;
- case 175: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
-{ yymsp[-3].minor.yy574 = yymsp[-1].minor.yy574; }
+ case 176: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
+{ yymsp[-3].minor.yy824 = yymsp[-1].minor.yy824; }
break;
- case 176: /* table_options ::= */
-{ yymsp[1].minor.yy80 = createDefaultTableOptions(pCxt); }
+ case 177: /* table_options ::= */
+{ yymsp[1].minor.yy312 = createDefaultTableOptions(pCxt); }
break;
- case 177: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 178: /* table_options ::= table_options COMMENT NK_STRING */
+{ yylhsminor.yy312 = setTableOption(pCxt, yymsp[-2].minor.yy312, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 178: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy574); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 179: /* table_options ::= table_options MAX_DELAY duration_list */
+{ yylhsminor.yy312 = setTableOption(pCxt, yymsp[-2].minor.yy312, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy824); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 179: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy574); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 180: /* table_options ::= table_options WATERMARK duration_list */
+{ yylhsminor.yy312 = setTableOption(pCxt, yymsp[-2].minor.yy312, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy824); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 180: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-4].minor.yy80, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy574); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
+ case 181: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+{ yylhsminor.yy312 = setTableOption(pCxt, yymsp[-4].minor.yy312, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy824); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
break;
- case 181: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 182: /* table_options ::= table_options TTL NK_INTEGER */
+{ yylhsminor.yy312 = setTableOption(pCxt, yymsp[-2].minor.yy312, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 182: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-4].minor.yy80, TABLE_OPTION_SMA, yymsp[-1].minor.yy574); }
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
+ case 183: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+{ yylhsminor.yy312 = setTableOption(pCxt, yymsp[-4].minor.yy312, TABLE_OPTION_SMA, yymsp[-1].minor.yy824); }
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
break;
- case 183: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy80 = createAlterTableOptions(pCxt); yylhsminor.yy80 = setTableOption(pCxt, yylhsminor.yy80, yymsp[0].minor.yy299.type, &yymsp[0].minor.yy299.val); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 184: /* alter_table_options ::= alter_table_option */
+{ yylhsminor.yy312 = createAlterTableOptions(pCxt); yylhsminor.yy312 = setTableOption(pCxt, yylhsminor.yy312, yymsp[0].minor.yy405.type, &yymsp[0].minor.yy405.val); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 184: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy299.type, &yymsp[0].minor.yy299.val); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 185: /* alter_table_options ::= alter_table_options alter_table_option */
+{ yylhsminor.yy312 = setTableOption(pCxt, yymsp[-1].minor.yy312, yymsp[0].minor.yy405.type, &yymsp[0].minor.yy405.val); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 185: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy299.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy299.val = yymsp[0].minor.yy0; }
+ case 186: /* alter_table_option ::= COMMENT NK_STRING */
+{ yymsp[-1].minor.yy405.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
break;
- case 186: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy299.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy299.val = yymsp[0].minor.yy0; }
+ case 187: /* alter_table_option ::= TTL NK_INTEGER */
+{ yymsp[-1].minor.yy405.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
break;
- case 187: /* duration_list ::= duration_literal */
- case 344: /* expression_list ::= expression */ yytestcase(yyruleno==344);
-{ yylhsminor.yy574 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); }
- yymsp[0].minor.yy574 = yylhsminor.yy574;
+ case 188: /* duration_list ::= duration_literal */
+ case 345: /* expression_list ::= expression */ yytestcase(yyruleno==345);
+{ yylhsminor.yy824 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy312)); }
+ yymsp[0].minor.yy824 = yylhsminor.yy824;
break;
- case 188: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 345: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==345);
-{ yylhsminor.yy574 = addNodeToList(pCxt, yymsp[-2].minor.yy574, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); }
- yymsp[-2].minor.yy574 = yylhsminor.yy574;
+ case 189: /* duration_list ::= duration_list NK_COMMA duration_literal */
+ case 346: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==346);
+{ yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, releaseRawExprNode(pCxt, yymsp[0].minor.yy312)); }
+ yymsp[-2].minor.yy824 = yylhsminor.yy824;
break;
- case 191: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[0].minor.yy239, NULL); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 192: /* rollup_func_name ::= function_name */
+{ yylhsminor.yy312 = createFunctionNode(pCxt, &yymsp[0].minor.yy149, NULL); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 192: /* rollup_func_name ::= FIRST */
- case 193: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==193);
-{ yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 193: /* rollup_func_name ::= FIRST */
+ case 194: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==194);
+{ yylhsminor.yy312 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 196: /* col_name ::= column_name */
-{ yylhsminor.yy80 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy239); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 197: /* col_name ::= column_name */
+{ yylhsminor.yy312 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy149); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 197: /* cmd ::= SHOW DNODES */
+ case 198: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
break;
- case 198: /* cmd ::= SHOW USERS */
+ case 199: /* cmd ::= SHOW USERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
break;
- case 199: /* cmd ::= SHOW DATABASES */
+ case 200: /* cmd ::= SHOW DATABASES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
- case 200: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, OP_TYPE_LIKE); }
+ case 201: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy312, yymsp[0].minor.yy312, OP_TYPE_LIKE); }
break;
- case 201: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, OP_TYPE_LIKE); }
+ case 202: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy312, yymsp[0].minor.yy312, OP_TYPE_LIKE); }
break;
- case 202: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy80, NULL, OP_TYPE_LIKE); }
+ case 203: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy312, NULL, OP_TYPE_LIKE); }
break;
- case 203: /* cmd ::= SHOW MNODES */
+ case 204: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
break;
- case 204: /* cmd ::= SHOW MODULES */
+ case 205: /* cmd ::= SHOW MODULES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT); }
break;
- case 205: /* cmd ::= SHOW QNODES */
+ case 206: /* cmd ::= SHOW QNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
break;
- case 206: /* cmd ::= SHOW FUNCTIONS */
+ case 207: /* cmd ::= SHOW FUNCTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
- case 207: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy80, yymsp[-1].minor.yy80, OP_TYPE_EQUAL); }
+ case 208: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy312, yymsp[-1].minor.yy312, OP_TYPE_EQUAL); }
break;
- case 208: /* cmd ::= SHOW STREAMS */
+ case 209: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
break;
- case 209: /* cmd ::= SHOW ACCOUNTS */
+ case 210: /* cmd ::= SHOW ACCOUNTS */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
break;
- case 210: /* cmd ::= SHOW APPS */
+ case 211: /* cmd ::= SHOW APPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
break;
- case 211: /* cmd ::= SHOW CONNECTIONS */
+ case 212: /* cmd ::= SHOW CONNECTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
break;
- case 212: /* cmd ::= SHOW LICENCES */
- case 213: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==213);
+ case 213: /* cmd ::= SHOW LICENCES */
+ case 214: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==214);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
- case 214: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy239); }
+ case 215: /* cmd ::= SHOW CREATE DATABASE db_name */
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy149); }
break;
- case 215: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy80); }
+ case 216: /* cmd ::= SHOW CREATE TABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy312); }
break;
- case 216: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy80); }
+ case 217: /* cmd ::= SHOW CREATE STABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy312); }
break;
- case 217: /* cmd ::= SHOW QUERIES */
+ case 218: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
break;
- case 218: /* cmd ::= SHOW SCORES */
+ case 219: /* cmd ::= SHOW SCORES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
break;
- case 219: /* cmd ::= SHOW TOPICS */
+ case 220: /* cmd ::= SHOW TOPICS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
break;
- case 220: /* cmd ::= SHOW VARIABLES */
+ case 221: /* cmd ::= SHOW VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
break;
- case 221: /* cmd ::= SHOW LOCAL VARIABLES */
+ case 222: /* cmd ::= SHOW LOCAL VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
- case 222: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */
+ case 223: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */
{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-1].minor.yy0)); }
break;
- case 223: /* cmd ::= SHOW BNODES */
+ case 224: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
break;
- case 224: /* cmd ::= SHOW SNODES */
+ case 225: /* cmd ::= SHOW SNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
break;
- case 225: /* cmd ::= SHOW CLUSTER */
+ case 226: /* cmd ::= SHOW CLUSTER */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
break;
- case 226: /* cmd ::= SHOW TRANSACTIONS */
+ case 227: /* cmd ::= SHOW TRANSACTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
- case 227: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy80); }
+ case 228: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy312); }
break;
- case 228: /* cmd ::= SHOW CONSUMERS */
+ case 229: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
break;
- case 229: /* cmd ::= SHOW SUBSCRIPTIONS */
+ case 230: /* cmd ::= SHOW SUBSCRIPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
- case 230: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy80, yymsp[-1].minor.yy80, OP_TYPE_EQUAL); }
+ case 231: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy312, yymsp[-1].minor.yy312, OP_TYPE_EQUAL); }
break;
- case 231: /* cmd ::= SHOW VNODES NK_INTEGER */
+ case 232: /* cmd ::= SHOW VNODES NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
break;
- case 232: /* cmd ::= SHOW VNODES NK_STRING */
+ case 233: /* cmd ::= SHOW VNODES NK_STRING */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); }
break;
- case 233: /* db_name_cond_opt ::= */
- case 238: /* from_db_opt ::= */ yytestcase(yyruleno==238);
-{ yymsp[1].minor.yy80 = createDefaultDatabaseCondValue(pCxt); }
+ case 234: /* db_name_cond_opt ::= */
+ case 239: /* from_db_opt ::= */ yytestcase(yyruleno==239);
+{ yymsp[1].minor.yy312 = createDefaultDatabaseCondValue(pCxt); }
break;
- case 234: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy239); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 235: /* db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy149); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 235: /* like_pattern_opt ::= */
- case 410: /* from_clause_opt ::= */ yytestcase(yyruleno==410);
- case 439: /* where_clause_opt ::= */ yytestcase(yyruleno==439);
- case 443: /* twindow_clause_opt ::= */ yytestcase(yyruleno==443);
- case 448: /* sliding_opt ::= */ yytestcase(yyruleno==448);
- case 450: /* fill_opt ::= */ yytestcase(yyruleno==450);
- case 462: /* having_clause_opt ::= */ yytestcase(yyruleno==462);
- case 464: /* range_opt ::= */ yytestcase(yyruleno==464);
- case 466: /* every_opt ::= */ yytestcase(yyruleno==466);
- case 476: /* slimit_clause_opt ::= */ yytestcase(yyruleno==476);
- case 480: /* limit_clause_opt ::= */ yytestcase(yyruleno==480);
-{ yymsp[1].minor.yy80 = NULL; }
+ case 236: /* like_pattern_opt ::= */
+ case 411: /* from_clause_opt ::= */ yytestcase(yyruleno==411);
+ case 440: /* where_clause_opt ::= */ yytestcase(yyruleno==440);
+ case 444: /* twindow_clause_opt ::= */ yytestcase(yyruleno==444);
+ case 449: /* sliding_opt ::= */ yytestcase(yyruleno==449);
+ case 451: /* fill_opt ::= */ yytestcase(yyruleno==451);
+ case 463: /* having_clause_opt ::= */ yytestcase(yyruleno==463);
+ case 465: /* range_opt ::= */ yytestcase(yyruleno==465);
+ case 467: /* every_opt ::= */ yytestcase(yyruleno==467);
+ case 477: /* slimit_clause_opt ::= */ yytestcase(yyruleno==477);
+ case 481: /* limit_clause_opt ::= */ yytestcase(yyruleno==481);
+{ yymsp[1].minor.yy312 = NULL; }
break;
- case 236: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ case 237: /* like_pattern_opt ::= LIKE NK_STRING */
+{ yymsp[-1].minor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
- case 237: /* table_name_cond ::= table_name */
-{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy239); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 238: /* table_name_cond ::= table_name */
+{ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy149); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 239: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy239); }
+ case 240: /* from_db_opt ::= FROM db_name */
+{ yymsp[-1].minor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy149); }
break;
- case 240: /* 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.yy845, yymsp[-3].minor.yy80, yymsp[-1].minor.yy80, NULL, yymsp[0].minor.yy80); }
+ case 241: /* 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.yy497, yymsp[-3].minor.yy312, yymsp[-1].minor.yy312, NULL, yymsp[0].minor.yy312); }
break;
- case 241: /* cmd ::= DROP INDEX exists_opt full_table_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy845, yymsp[0].minor.yy80); }
+ case 242: /* cmd ::= DROP INDEX exists_opt full_table_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy497, yymsp[0].minor.yy312); }
break;
- case 242: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy80 = createIndexOption(pCxt, yymsp[-7].minor.yy574, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); }
+ case 243: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-9].minor.yy312 = createIndexOption(pCxt, yymsp[-7].minor.yy824, releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), NULL, yymsp[-1].minor.yy312, yymsp[0].minor.yy312); }
break;
- case 243: /* 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.yy80 = createIndexOption(pCxt, yymsp[-9].minor.yy574, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy80, yymsp[0].minor.yy80); }
+ case 244: /* 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.yy312 = createIndexOption(pCxt, yymsp[-9].minor.yy824, releaseRawExprNode(pCxt, yymsp[-5].minor.yy312), releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), yymsp[-1].minor.yy312, yymsp[0].minor.yy312); }
break;
- case 246: /* func ::= function_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[-3].minor.yy239, yymsp[-1].minor.yy574); }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 247: /* func ::= function_name NK_LP expression_list NK_RP */
+{ yylhsminor.yy312 = createFunctionNode(pCxt, &yymsp[-3].minor.yy149, yymsp[-1].minor.yy824); }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 247: /* sma_stream_opt ::= */
- case 274: /* stream_options ::= */ yytestcase(yyruleno==274);
-{ yymsp[1].minor.yy80 = createStreamOptions(pCxt); }
+ case 248: /* sma_stream_opt ::= */
+ case 275: /* stream_options ::= */ yytestcase(yyruleno==275);
+{ yymsp[1].minor.yy312 = createStreamOptions(pCxt); }
break;
- case 248: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */
- case 278: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==278);
-{ ((SStreamOptions*)yymsp[-2].minor.yy80)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 249: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */
+ case 279: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==279);
+{ ((SStreamOptions*)yymsp[-2].minor.yy312)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy312); yylhsminor.yy312 = yymsp[-2].minor.yy312; }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 249: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy80)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 250: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy312)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy312); yylhsminor.yy312 = yymsp[-2].minor.yy312; }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 250: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy845, &yymsp[-2].minor.yy239, yymsp[0].minor.yy80); }
+ case 251: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy497, &yymsp[-2].minor.yy149, yymsp[0].minor.yy312); }
break;
- case 251: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy845, &yymsp[-3].minor.yy239, &yymsp[0].minor.yy239, false); }
+ case 252: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy497, &yymsp[-3].minor.yy149, &yymsp[0].minor.yy149, false); }
break;
- case 252: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy845, &yymsp[-5].minor.yy239, &yymsp[0].minor.yy239, true); }
+ case 253: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy497, &yymsp[-5].minor.yy149, &yymsp[0].minor.yy149, true); }
break;
- case 253: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy845, &yymsp[-3].minor.yy239, yymsp[0].minor.yy80, false); }
+ case 254: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy497, &yymsp[-3].minor.yy149, yymsp[0].minor.yy312, false); }
break;
- case 254: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy845, &yymsp[-5].minor.yy239, yymsp[0].minor.yy80, true); }
+ case 255: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy497, &yymsp[-5].minor.yy149, yymsp[0].minor.yy312, true); }
break;
- case 255: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy239); }
+ case 256: /* cmd ::= DROP TOPIC exists_opt topic_name */
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy497, &yymsp[0].minor.yy149); }
break;
- case 256: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy845, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy239); }
+ case 257: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy497, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy149); }
break;
- case 257: /* cmd ::= DESC full_table_name */
- case 258: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==258);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy80); }
+ case 258: /* cmd ::= DESC full_table_name */
+ case 259: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==259);
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy312); }
break;
- case 259: /* cmd ::= RESET QUERY CACHE */
+ case 260: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
- case 260: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy845, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); }
+ case 261: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy497, yymsp[-1].minor.yy312, yymsp[0].minor.yy312); }
break;
- case 262: /* analyze_opt ::= ANALYZE */
- case 269: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==269);
- case 430: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==430);
-{ yymsp[0].minor.yy845 = true; }
+ case 263: /* analyze_opt ::= ANALYZE */
+ case 270: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==270);
+ case 431: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==431);
+{ yymsp[0].minor.yy497 = true; }
break;
- case 263: /* explain_options ::= */
-{ yymsp[1].minor.yy80 = createDefaultExplainOptions(pCxt); }
+ case 264: /* explain_options ::= */
+{ yymsp[1].minor.yy312 = createDefaultExplainOptions(pCxt); }
break;
- case 264: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy80 = setExplainVerbose(pCxt, yymsp[-2].minor.yy80, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 265: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy312 = setExplainVerbose(pCxt, yymsp[-2].minor.yy312, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 265: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy80 = setExplainRatio(pCxt, yymsp[-2].minor.yy80, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 266: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy312 = setExplainRatio(pCxt, yymsp[-2].minor.yy312, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 266: /* 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.yy845, yymsp[-8].minor.yy845, &yymsp[-5].minor.yy239, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy136, yymsp[0].minor.yy46); }
+ case 267: /* 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.yy497, yymsp[-8].minor.yy497, &yymsp[-5].minor.yy149, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy84, yymsp[0].minor.yy160); }
break;
- case 267: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy239); }
+ case 268: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy497, &yymsp[0].minor.yy149); }
break;
- case 270: /* bufsize_opt ::= */
-{ yymsp[1].minor.yy46 = 0; }
+ case 271: /* bufsize_opt ::= */
+{ yymsp[1].minor.yy160 = 0; }
break;
- case 271: /* bufsize_opt ::= BUFSIZE NK_INTEGER */
-{ yymsp[-1].minor.yy46 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+ case 272: /* bufsize_opt ::= BUFSIZE NK_INTEGER */
+{ yymsp[-1].minor.yy160 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
- case 272: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-6].minor.yy845, &yymsp[-5].minor.yy239, yymsp[-2].minor.yy80, yymsp[-4].minor.yy80, yymsp[0].minor.yy80); }
+ case 273: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-6].minor.yy497, &yymsp[-5].minor.yy149, yymsp[-2].minor.yy312, yymsp[-4].minor.yy312, yymsp[0].minor.yy312); }
break;
- case 273: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy845, &yymsp[0].minor.yy239); }
+ case 274: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy497, &yymsp[0].minor.yy149); }
break;
- case 275: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy80)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy80 = yymsp[-2].minor.yy80; }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 276: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy312)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy312 = yymsp[-2].minor.yy312; }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 276: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy80)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy80 = yymsp[-2].minor.yy80; }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 277: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy312)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy312 = yymsp[-2].minor.yy312; }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 277: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-3].minor.yy80)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy80)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-3].minor.yy80; }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 278: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-3].minor.yy312)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy312)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy312); yylhsminor.yy312 = yymsp[-3].minor.yy312; }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 279: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-3].minor.yy80)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy80 = yymsp[-3].minor.yy80; }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 280: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ ((SStreamOptions*)yymsp[-3].minor.yy312)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy312 = yymsp[-3].minor.yy312; }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 280: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 281: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 281: /* cmd ::= KILL QUERY NK_STRING */
+ case 282: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 282: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 283: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 283: /* cmd ::= BALANCE VGROUP */
+ case 284: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
- case 284: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 285: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 285: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy574); }
+ case 286: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy824); }
break;
- case 286: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 287: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 287: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy574 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ case 288: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy824 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 289: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); }
+ case 290: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy312, yymsp[0].minor.yy312); }
break;
- case 291: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy80, yymsp[-2].minor.yy574, yymsp[0].minor.yy80); }
+ case 292: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy312, yymsp[-2].minor.yy824, yymsp[0].minor.yy312); }
break;
- case 292: /* cmd ::= INSERT INTO full_table_name query_expression */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy80, NULL, yymsp[0].minor.yy80); }
+ case 293: /* cmd ::= INSERT INTO full_table_name query_expression */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy312, NULL, yymsp[0].minor.yy312); }
break;
- case 293: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 294: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 294: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 295: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 295: /* literal ::= NK_STRING */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 296: /* literal ::= NK_STRING */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 296: /* literal ::= NK_BOOL */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 297: /* literal ::= NK_BOOL */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 297: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 298: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 298: /* literal ::= duration_literal */
- case 308: /* signed_literal ::= signed */ yytestcase(yyruleno==308);
- case 328: /* expression ::= literal */ yytestcase(yyruleno==328);
- case 329: /* expression ::= pseudo_column */ yytestcase(yyruleno==329);
- case 330: /* expression ::= column_reference */ yytestcase(yyruleno==330);
- case 331: /* expression ::= function_expression */ yytestcase(yyruleno==331);
- case 332: /* expression ::= subquery */ yytestcase(yyruleno==332);
- case 360: /* function_expression ::= literal_func */ yytestcase(yyruleno==360);
- case 402: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==402);
- case 406: /* boolean_primary ::= predicate */ yytestcase(yyruleno==406);
- case 408: /* common_expression ::= expression */ yytestcase(yyruleno==408);
- case 409: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==409);
- case 412: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==412);
- case 414: /* table_reference ::= table_primary */ yytestcase(yyruleno==414);
- case 415: /* table_reference ::= joined_table */ yytestcase(yyruleno==415);
- case 419: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==419);
- case 469: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==469);
- case 472: /* query_primary ::= query_specification */ yytestcase(yyruleno==472);
-{ yylhsminor.yy80 = yymsp[0].minor.yy80; }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 299: /* literal ::= duration_literal */
+ case 309: /* signed_literal ::= signed */ yytestcase(yyruleno==309);
+ case 329: /* expression ::= literal */ yytestcase(yyruleno==329);
+ case 330: /* expression ::= pseudo_column */ yytestcase(yyruleno==330);
+ case 331: /* expression ::= column_reference */ yytestcase(yyruleno==331);
+ case 332: /* expression ::= function_expression */ yytestcase(yyruleno==332);
+ case 333: /* expression ::= subquery */ yytestcase(yyruleno==333);
+ case 361: /* function_expression ::= literal_func */ yytestcase(yyruleno==361);
+ case 403: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==403);
+ case 407: /* boolean_primary ::= predicate */ yytestcase(yyruleno==407);
+ case 409: /* common_expression ::= expression */ yytestcase(yyruleno==409);
+ case 410: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==410);
+ case 413: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==413);
+ case 415: /* table_reference ::= table_primary */ yytestcase(yyruleno==415);
+ case 416: /* table_reference ::= joined_table */ yytestcase(yyruleno==416);
+ case 420: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==420);
+ case 470: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==470);
+ case 473: /* query_primary ::= query_specification */ yytestcase(yyruleno==473);
+{ yylhsminor.yy312 = yymsp[0].minor.yy312; }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 299: /* literal ::= NULL */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 300: /* literal ::= NULL */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 300: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 301: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 301: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 302: /* duration_literal ::= NK_VARIABLE */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 302: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 303: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 303: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ case 304: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
- case 304: /* signed ::= NK_MINUS NK_INTEGER */
+ case 305: /* 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.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 305: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 306: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 306: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 307: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 307: /* signed ::= NK_MINUS NK_FLOAT */
+ case 308: /* 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.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 309: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 310: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 310: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 311: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 311: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ case 312: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 312: /* signed_literal ::= duration_literal */
- case 314: /* signed_literal ::= literal_func */ yytestcase(yyruleno==314);
- case 380: /* star_func_para ::= expression */ yytestcase(yyruleno==380);
- case 435: /* select_item ::= common_expression */ yytestcase(yyruleno==435);
- case 485: /* search_condition ::= common_expression */ yytestcase(yyruleno==485);
-{ yylhsminor.yy80 = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 313: /* signed_literal ::= duration_literal */
+ case 315: /* signed_literal ::= literal_func */ yytestcase(yyruleno==315);
+ case 381: /* star_func_para ::= expression */ yytestcase(yyruleno==381);
+ case 436: /* select_item ::= common_expression */ yytestcase(yyruleno==436);
+ case 486: /* search_condition ::= common_expression */ yytestcase(yyruleno==486);
+{ yylhsminor.yy312 = releaseRawExprNode(pCxt, yymsp[0].minor.yy312); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 313: /* signed_literal ::= NULL */
-{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 314: /* signed_literal ::= NULL */
+{ yylhsminor.yy312 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 315: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy80 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 316: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy312 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 333: /* expression ::= NK_LP expression NK_RP */
- case 407: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==407);
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 334: /* expression ::= NK_LP expression NK_RP */
+ case 408: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==408);
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy312)); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 334: /* expression ::= NK_PLUS expression */
+ case 335: /* expression ::= NK_PLUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy80));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy312));
}
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 335: /* expression ::= NK_MINUS expression */
+ case 336: /* expression ::= NK_MINUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy80), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy312), NULL));
}
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 336: /* expression ::= expression NK_PLUS expression */
+ case 337: /* expression ::= expression NK_PLUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 337: /* expression ::= expression NK_MINUS expression */
+ case 338: /* expression ::= expression NK_MINUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 338: /* expression ::= expression NK_STAR expression */
+ case 339: /* expression ::= expression NK_STAR expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 339: /* expression ::= expression NK_SLASH expression */
+ case 340: /* expression ::= expression NK_SLASH expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 340: /* expression ::= expression NK_REM expression */
+ case 341: /* expression ::= expression NK_REM expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 341: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 342: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 342: /* expression ::= expression NK_BITAND expression */
+ case 343: /* expression ::= expression NK_BITAND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 343: /* expression ::= expression NK_BITOR expression */
+ case 344: /* expression ::= expression NK_BITOR expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 346: /* column_reference ::= column_name */
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy239, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy239)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 347: /* column_reference ::= column_name */
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy149, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy149)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 347: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy239, createColumnNode(pCxt, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy239)); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 348: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy149, createColumnNode(pCxt, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy149)); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 348: /* pseudo_column ::= ROWTS */
- case 349: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==349);
- case 351: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==351);
- case 352: /* pseudo_column ::= QEND */ yytestcase(yyruleno==352);
- case 353: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==353);
- case 354: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==354);
- case 355: /* pseudo_column ::= WEND */ yytestcase(yyruleno==355);
- case 356: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==356);
- case 362: /* literal_func ::= NOW */ yytestcase(yyruleno==362);
-{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 349: /* pseudo_column ::= ROWTS */
+ case 350: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==350);
+ case 352: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==352);
+ case 353: /* pseudo_column ::= QEND */ yytestcase(yyruleno==353);
+ case 354: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==354);
+ case 355: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==355);
+ case 356: /* pseudo_column ::= WEND */ yytestcase(yyruleno==356);
+ case 357: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==357);
+ case 363: /* literal_func ::= NOW */ yytestcase(yyruleno==363);
+{ yylhsminor.yy312 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 350: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy239)))); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 351: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy149)))); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 357: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 358: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==358);
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy239, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy239, yymsp[-1].minor.yy574)); }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 358: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 359: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==359);
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy149, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy149, yymsp[-1].minor.yy824)); }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 359: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy136)); }
- yymsp[-5].minor.yy80 = yylhsminor.yy80;
+ case 360: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), yymsp[-1].minor.yy84)); }
+ yymsp[-5].minor.yy312 = yylhsminor.yy312;
break;
- case 361: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy239, NULL)); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 362: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy149, NULL)); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 376: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy574 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy574 = yylhsminor.yy574;
+ case 377: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy824 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy824 = yylhsminor.yy824;
break;
- case 381: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 438: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==438);
-{ yylhsminor.yy80 = createColumnNode(pCxt, &yymsp[-2].minor.yy239, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 382: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 439: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==439);
+{ yylhsminor.yy312 = createColumnNode(pCxt, &yymsp[-2].minor.yy149, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 382: /* predicate ::= expression compare_op expression */
- case 387: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==387);
+ case 383: /* predicate ::= expression compare_op expression */
+ case 388: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==388);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy194, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy320, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 383: /* predicate ::= expression BETWEEN expression AND expression */
+ case 384: /* predicate ::= expression BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy80), releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy312), releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-4].minor.yy80 = yylhsminor.yy80;
+ yymsp[-4].minor.yy312 = yylhsminor.yy312;
break;
- case 384: /* predicate ::= expression NOT BETWEEN expression AND expression */
+ case 385: /* predicate ::= expression NOT BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy312), releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-5].minor.yy80 = yylhsminor.yy80;
+ yymsp[-5].minor.yy312 = yylhsminor.yy312;
break;
- case 385: /* predicate ::= expression IS NULL */
+ case 386: /* predicate ::= expression IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), NULL));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 386: /* predicate ::= expression IS NOT NULL */
+ case 387: /* predicate ::= expression IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), NULL));
}
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 388: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy194 = OP_TYPE_LOWER_THAN; }
+ case 389: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy320 = OP_TYPE_LOWER_THAN; }
break;
- case 389: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy194 = OP_TYPE_GREATER_THAN; }
+ case 390: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy320 = OP_TYPE_GREATER_THAN; }
break;
- case 390: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy194 = OP_TYPE_LOWER_EQUAL; }
+ case 391: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy320 = OP_TYPE_LOWER_EQUAL; }
break;
- case 391: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy194 = OP_TYPE_GREATER_EQUAL; }
+ case 392: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy320 = OP_TYPE_GREATER_EQUAL; }
break;
- case 392: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy194 = OP_TYPE_NOT_EQUAL; }
+ case 393: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy320 = OP_TYPE_NOT_EQUAL; }
break;
- case 393: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy194 = OP_TYPE_EQUAL; }
+ case 394: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy320 = OP_TYPE_EQUAL; }
break;
- case 394: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy194 = OP_TYPE_LIKE; }
+ case 395: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy320 = OP_TYPE_LIKE; }
break;
- case 395: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy194 = OP_TYPE_NOT_LIKE; }
+ case 396: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy320 = OP_TYPE_NOT_LIKE; }
break;
- case 396: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy194 = OP_TYPE_MATCH; }
+ case 397: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy320 = OP_TYPE_MATCH; }
break;
- case 397: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy194 = OP_TYPE_NMATCH; }
+ case 398: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy320 = OP_TYPE_NMATCH; }
break;
- case 398: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy194 = OP_TYPE_JSON_CONTAINS; }
+ case 399: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy320 = OP_TYPE_JSON_CONTAINS; }
break;
- case 399: /* in_op ::= IN */
-{ yymsp[0].minor.yy194 = OP_TYPE_IN; }
+ case 400: /* in_op ::= IN */
+{ yymsp[0].minor.yy320 = OP_TYPE_IN; }
break;
- case 400: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy194 = OP_TYPE_NOT_IN; }
+ case 401: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy320 = OP_TYPE_NOT_IN; }
break;
- case 401: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy574)); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 402: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 403: /* boolean_value_expression ::= NOT boolean_primary */
+ case 404: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy80), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy312), NULL));
}
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 404: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 405: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 405: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 406: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80);
- yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy312);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy312);
+ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), releaseRawExprNode(pCxt, yymsp[0].minor.yy312)));
}
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 411: /* from_clause_opt ::= FROM table_reference_list */
- case 440: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==440);
- case 463: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==463);
-{ yymsp[-1].minor.yy80 = yymsp[0].minor.yy80; }
+ case 412: /* from_clause_opt ::= FROM table_reference_list */
+ case 441: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==441);
+ case 464: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==464);
+{ yymsp[-1].minor.yy312 = yymsp[0].minor.yy312; }
break;
- case 413: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy80 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, NULL); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 414: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy312 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy312, yymsp[0].minor.yy312, NULL); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 416: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy80 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy239, &yymsp[0].minor.yy239); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 417: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy312 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy149, &yymsp[0].minor.yy149); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 417: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy80 = createRealTableNode(pCxt, &yymsp[-3].minor.yy239, &yymsp[-1].minor.yy239, &yymsp[0].minor.yy239); }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 418: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy312 = createRealTableNode(pCxt, &yymsp[-3].minor.yy149, &yymsp[-1].minor.yy149, &yymsp[0].minor.yy149); }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 418: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy80 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80), &yymsp[0].minor.yy239); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 419: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy312 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy312), &yymsp[0].minor.yy149); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 420: /* alias_opt ::= */
-{ yymsp[1].minor.yy239 = nil_token; }
+ case 421: /* alias_opt ::= */
+{ yymsp[1].minor.yy149 = nil_token; }
break;
- case 421: /* alias_opt ::= table_alias */
-{ yylhsminor.yy239 = yymsp[0].minor.yy239; }
- yymsp[0].minor.yy239 = yylhsminor.yy239;
+ case 422: /* alias_opt ::= table_alias */
+{ yylhsminor.yy149 = yymsp[0].minor.yy149; }
+ yymsp[0].minor.yy149 = yylhsminor.yy149;
break;
- case 422: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy239 = yymsp[0].minor.yy239; }
+ case 423: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy149 = yymsp[0].minor.yy149; }
break;
- case 423: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 424: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==424);
-{ yymsp[-2].minor.yy80 = yymsp[-1].minor.yy80; }
+ case 424: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 425: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==425);
+{ yymsp[-2].minor.yy312 = yymsp[-1].minor.yy312; }
break;
- case 425: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy80 = createJoinTableNode(pCxt, yymsp[-4].minor.yy750, yymsp[-5].minor.yy80, yymsp[-2].minor.yy80, yymsp[0].minor.yy80); }
- yymsp[-5].minor.yy80 = yylhsminor.yy80;
+ case 426: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy312 = createJoinTableNode(pCxt, yymsp[-4].minor.yy832, yymsp[-5].minor.yy312, yymsp[-2].minor.yy312, yymsp[0].minor.yy312); }
+ yymsp[-5].minor.yy312 = yylhsminor.yy312;
break;
- case 426: /* join_type ::= */
-{ yymsp[1].minor.yy750 = JOIN_TYPE_INNER; }
+ case 427: /* join_type ::= */
+{ yymsp[1].minor.yy832 = JOIN_TYPE_INNER; }
break;
- case 427: /* join_type ::= INNER */
-{ yymsp[0].minor.yy750 = JOIN_TYPE_INNER; }
+ case 428: /* join_type ::= INNER */
+{ yymsp[0].minor.yy832 = JOIN_TYPE_INNER; }
break;
- case 428: /* 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 429: /* 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.yy80 = createSelectStmt(pCxt, yymsp[-10].minor.yy845, yymsp[-9].minor.yy574, yymsp[-8].minor.yy80);
- yymsp[-11].minor.yy80 = addWhereClause(pCxt, yymsp[-11].minor.yy80, yymsp[-7].minor.yy80);
- yymsp[-11].minor.yy80 = addPartitionByClause(pCxt, yymsp[-11].minor.yy80, yymsp[-6].minor.yy574);
- yymsp[-11].minor.yy80 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy80, yymsp[-2].minor.yy80);
- yymsp[-11].minor.yy80 = addGroupByClause(pCxt, yymsp[-11].minor.yy80, yymsp[-1].minor.yy574);
- yymsp[-11].minor.yy80 = addHavingClause(pCxt, yymsp[-11].minor.yy80, yymsp[0].minor.yy80);
- yymsp[-11].minor.yy80 = addRangeClause(pCxt, yymsp[-11].minor.yy80, yymsp[-5].minor.yy80);
- yymsp[-11].minor.yy80 = addEveryClause(pCxt, yymsp[-11].minor.yy80, yymsp[-4].minor.yy80);
- yymsp[-11].minor.yy80 = addFillClause(pCxt, yymsp[-11].minor.yy80, yymsp[-3].minor.yy80);
+ yymsp[-11].minor.yy312 = createSelectStmt(pCxt, yymsp[-10].minor.yy497, yymsp[-9].minor.yy824, yymsp[-8].minor.yy312);
+ yymsp[-11].minor.yy312 = addWhereClause(pCxt, yymsp[-11].minor.yy312, yymsp[-7].minor.yy312);
+ yymsp[-11].minor.yy312 = addPartitionByClause(pCxt, yymsp[-11].minor.yy312, yymsp[-6].minor.yy824);
+ yymsp[-11].minor.yy312 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy312, yymsp[-2].minor.yy312);
+ yymsp[-11].minor.yy312 = addGroupByClause(pCxt, yymsp[-11].minor.yy312, yymsp[-1].minor.yy824);
+ yymsp[-11].minor.yy312 = addHavingClause(pCxt, yymsp[-11].minor.yy312, yymsp[0].minor.yy312);
+ yymsp[-11].minor.yy312 = addRangeClause(pCxt, yymsp[-11].minor.yy312, yymsp[-5].minor.yy312);
+ yymsp[-11].minor.yy312 = addEveryClause(pCxt, yymsp[-11].minor.yy312, yymsp[-4].minor.yy312);
+ yymsp[-11].minor.yy312 = addFillClause(pCxt, yymsp[-11].minor.yy312, yymsp[-3].minor.yy312);
}
break;
- case 431: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy845 = false; }
+ case 432: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy497 = false; }
break;
- case 434: /* select_item ::= NK_STAR */
-{ yylhsminor.yy80 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy80 = yylhsminor.yy80;
+ case 435: /* select_item ::= NK_STAR */
+{ yylhsminor.yy312 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy312 = yylhsminor.yy312;
break;
- case 436: /* select_item ::= common_expression column_alias */
-{ yylhsminor.yy80 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80), &yymsp[0].minor.yy239); }
- yymsp[-1].minor.yy80 = yylhsminor.yy80;
+ case 437: /* select_item ::= common_expression column_alias */
+{ yylhsminor.yy312 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy312), &yymsp[0].minor.yy149); }
+ yymsp[-1].minor.yy312 = yylhsminor.yy312;
break;
- case 437: /* select_item ::= common_expression AS column_alias */
-{ yylhsminor.yy80 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), &yymsp[0].minor.yy239); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 438: /* select_item ::= common_expression AS column_alias */
+{ yylhsminor.yy312 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), &yymsp[0].minor.yy149); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 442: /* partition_by_clause_opt ::= PARTITION BY expression_list */
- case 459: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==459);
- case 475: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==475);
-{ yymsp[-2].minor.yy574 = yymsp[0].minor.yy574; }
+ case 443: /* partition_by_clause_opt ::= PARTITION BY expression_list */
+ case 460: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==460);
+ case 476: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==476);
+{ yymsp[-2].minor.yy824 = yymsp[0].minor.yy824; }
break;
- case 444: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy80 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); }
+ case 445: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy312 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), releaseRawExprNode(pCxt, yymsp[-1].minor.yy312)); }
break;
- case 445: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
-{ yymsp[-3].minor.yy80 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); }
+ case 446: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+{ yymsp[-3].minor.yy312 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy312)); }
break;
- case 446: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy80 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); }
+ case 447: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy312 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), NULL, yymsp[-1].minor.yy312, yymsp[0].minor.yy312); }
break;
- case 447: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy80 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy80, yymsp[0].minor.yy80); }
+ case 448: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy312 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy312), releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), yymsp[-1].minor.yy312, yymsp[0].minor.yy312); }
break;
- case 449: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- case 467: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==467);
-{ yymsp[-3].minor.yy80 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy80); }
+ case 450: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ case 468: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==468);
+{ yymsp[-3].minor.yy312 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy312); }
break;
- case 451: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy80 = createFillNode(pCxt, yymsp[-1].minor.yy426, NULL); }
+ case 452: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy312 = createFillNode(pCxt, yymsp[-1].minor.yy134, NULL); }
break;
- case 452: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy80 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy574)); }
+ case 453: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy312 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy824)); }
break;
- case 453: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy426 = FILL_MODE_NONE; }
+ case 454: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy134 = FILL_MODE_NONE; }
break;
- case 454: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy426 = FILL_MODE_PREV; }
+ case 455: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy134 = FILL_MODE_PREV; }
break;
- case 455: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy426 = FILL_MODE_NULL; }
+ case 456: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy134 = FILL_MODE_NULL; }
break;
- case 456: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy426 = FILL_MODE_LINEAR; }
+ case 457: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy134 = FILL_MODE_LINEAR; }
break;
- case 457: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy426 = FILL_MODE_NEXT; }
+ case 458: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy134 = FILL_MODE_NEXT; }
break;
- case 460: /* group_by_list ::= expression */
-{ yylhsminor.yy574 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); }
- yymsp[0].minor.yy574 = yylhsminor.yy574;
+ case 461: /* group_by_list ::= expression */
+{ yylhsminor.yy824 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy312))); }
+ yymsp[0].minor.yy824 = yylhsminor.yy824;
break;
- case 461: /* group_by_list ::= group_by_list NK_COMMA expression */
-{ yylhsminor.yy574 = addNodeToList(pCxt, yymsp[-2].minor.yy574, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); }
- yymsp[-2].minor.yy574 = yylhsminor.yy574;
+ case 462: /* group_by_list ::= group_by_list NK_COMMA expression */
+{ yylhsminor.yy824 = addNodeToList(pCxt, yymsp[-2].minor.yy824, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy312))); }
+ yymsp[-2].minor.yy824 = yylhsminor.yy824;
break;
- case 465: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
-{ yymsp[-5].minor.yy80 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); }
+ case 466: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
+{ yymsp[-5].minor.yy312 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy312), releaseRawExprNode(pCxt, yymsp[-1].minor.yy312)); }
break;
- case 468: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 469: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy80 = addOrderByClause(pCxt, yymsp[-3].minor.yy80, yymsp[-2].minor.yy574);
- yylhsminor.yy80 = addSlimitClause(pCxt, yylhsminor.yy80, yymsp[-1].minor.yy80);
- yylhsminor.yy80 = addLimitClause(pCxt, yylhsminor.yy80, yymsp[0].minor.yy80);
+ yylhsminor.yy312 = addOrderByClause(pCxt, yymsp[-3].minor.yy312, yymsp[-2].minor.yy824);
+ yylhsminor.yy312 = addSlimitClause(pCxt, yylhsminor.yy312, yymsp[-1].minor.yy312);
+ yylhsminor.yy312 = addLimitClause(pCxt, yylhsminor.yy312, yymsp[0].minor.yy312);
}
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 470: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
-{ yylhsminor.yy80 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy80, yymsp[0].minor.yy80); }
- yymsp[-3].minor.yy80 = yylhsminor.yy80;
+ case 471: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+{ yylhsminor.yy312 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy312, yymsp[0].minor.yy312); }
+ yymsp[-3].minor.yy312 = yylhsminor.yy312;
break;
- case 471: /* query_expression_body ::= query_expression_body UNION query_expression_body */
-{ yylhsminor.yy80 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy80, yymsp[0].minor.yy80); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 472: /* query_expression_body ::= query_expression_body UNION query_expression_body */
+{ yylhsminor.yy312 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy312, yymsp[0].minor.yy312); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 473: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+ case 474: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
{
- yymsp[-5].minor.yy80 = addOrderByClause(pCxt, yymsp[-4].minor.yy80, yymsp[-3].minor.yy574);
- yymsp[-5].minor.yy80 = addSlimitClause(pCxt, yymsp[-5].minor.yy80, yymsp[-2].minor.yy80);
- yymsp[-5].minor.yy80 = addLimitClause(pCxt, yymsp[-5].minor.yy80, yymsp[-1].minor.yy80);
+ yymsp[-5].minor.yy312 = addOrderByClause(pCxt, yymsp[-4].minor.yy312, yymsp[-3].minor.yy824);
+ yymsp[-5].minor.yy312 = addSlimitClause(pCxt, yymsp[-5].minor.yy312, yymsp[-2].minor.yy312);
+ yymsp[-5].minor.yy312 = addLimitClause(pCxt, yymsp[-5].minor.yy312, yymsp[-1].minor.yy312);
}
break;
- case 477: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 481: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==481);
-{ yymsp[-1].minor.yy80 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 478: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 482: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==482);
+{ yymsp[-1].minor.yy312 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 478: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 482: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==482);
-{ yymsp[-3].minor.yy80 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 479: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 483: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==483);
+{ yymsp[-3].minor.yy312 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 479: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 483: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==483);
-{ yymsp[-3].minor.yy80 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 480: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 484: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==484);
+{ yymsp[-3].minor.yy312 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 484: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy80); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 485: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy312 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy312); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 488: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy80 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), yymsp[-1].minor.yy422, yymsp[0].minor.yy763); }
- yymsp[-2].minor.yy80 = yylhsminor.yy80;
+ case 489: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy312 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy312), yymsp[-1].minor.yy158, yymsp[0].minor.yy417); }
+ yymsp[-2].minor.yy312 = yylhsminor.yy312;
break;
- case 489: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy422 = ORDER_ASC; }
+ case 490: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy158 = ORDER_ASC; }
break;
- case 490: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy422 = ORDER_ASC; }
+ case 491: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy158 = ORDER_ASC; }
break;
- case 491: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy422 = ORDER_DESC; }
+ case 492: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy158 = ORDER_DESC; }
break;
- case 492: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy763 = NULL_ORDER_DEFAULT; }
+ case 493: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy417 = NULL_ORDER_DEFAULT; }
break;
- case 493: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy763 = NULL_ORDER_FIRST; }
+ case 494: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy417 = NULL_ORDER_FIRST; }
break;
- case 494: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy763 = NULL_ORDER_LAST; }
+ case 495: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy417 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/parAlterToBalanceTest.cpp b/source/libs/parser/test/parAlterToBalanceTest.cpp
index 8eb64719b2..3a08ef9756 100644
--- a/source/libs/parser/test/parAlterToBalanceTest.cpp
+++ b/source/libs/parser/test/parAlterToBalanceTest.cpp
@@ -88,7 +88,7 @@ TEST_F(ParserInitialATest, alterDnode) {
* | 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, 128], default 8
+ * | SST_TRIGGER int_value -- rang [1, 16], default 8
* }
*/
TEST_F(ParserInitialATest, alterDatabase) {
@@ -161,8 +161,8 @@ TEST_F(ParserInitialATest, alterDatabase) {
setAlterDbFsync(200);
setAlterDbWal(1);
setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW);
- setAlterDbSstTrigger(20);
- run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1 SST_TRIGGER 20");
+ setAlterDbSstTrigger(16);
+ run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1 STT_TRIGGER 16");
clearAlterDbReq();
initAlterDb("test");
@@ -236,8 +236,8 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
run("ALTER DATABASE test KEEP 1w", 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 SST_TRIGGER 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
- run("ALTER DATABASE test SST_TRIGGER 129", 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
run("ALTER DATABASE db WAL_LEVEL 0 # td-14436", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
}
diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp
index 28bcae53ef..a159d797fa 100644
--- a/source/libs/parser/test/parInitialCTest.cpp
+++ b/source/libs/parser/test/parInitialCTest.cpp
@@ -118,6 +118,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
expect.sstTrigger = TSDB_DEFAULT_SST_TRIGGER;
expect.hashPrefix = TSDB_DEFAULT_HASH_PREFIX;
expect.hashSuffix = TSDB_DEFAULT_HASH_SUFFIX;
+ expect.tsdbPageSize = TSDB_DEFAULT_TSDB_PAGESIZE;
};
auto setDbBufferFunc = [&](int32_t buffer) { expect.buffer = buffer; };
@@ -161,6 +162,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
auto setDbSstTrigger = [&](int32_t sstTrigger) { expect.sstTrigger = sstTrigger; };
auto setDbHashPrefix = [&](int32_t hashPrefix) { expect.hashPrefix = hashPrefix; };
auto setDbHashSuffix = [&](int32_t hashSuffix) { expect.hashSuffix = hashSuffix; };
+ auto setDbTsdbPageSize = [&](int32_t tsdbPageSize) { expect.tsdbPageSize = tsdbPageSize; };
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_DATABASE_STMT);
@@ -194,6 +196,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
ASSERT_EQ(req.sstTrigger, expect.sstTrigger);
ASSERT_EQ(req.hashPrefix, expect.hashPrefix);
ASSERT_EQ(req.hashSuffix, expect.hashSuffix);
+ ASSERT_EQ(req.tsdbPageSize, expect.tsdbPageSize);
ASSERT_EQ(req.ignoreExist, expect.ignoreExist);
ASSERT_EQ(req.numOfRetensions, expect.numOfRetensions);
if (expect.numOfRetensions > 0) {
@@ -244,6 +247,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
setDbSstTrigger(16);
setDbHashPrefix(3);
setDbHashSuffix(4);
+ setDbTsdbPageSize(32);
run("CREATE DATABASE IF NOT EXISTS wxy_db "
"BUFFER 64 "
"CACHEMODEL 'last_value' "
@@ -268,9 +272,10 @@ TEST_F(ParserInitialCTest, createDatabase) {
"WAL_RETENTION_SIZE -1 "
"WAL_ROLL_PERIOD 10 "
"WAL_SEGMENT_SIZE 20 "
- "SST_TRIGGER 16 "
- "TABLE_PREFIX 3"
- "TABLE_SUFFIX 4");
+ "STT_TRIGGER 16 "
+ "TABLE_PREFIX 3 "
+ "TABLE_SUFFIX 4 "
+ "TSDB_PAGESIZE 32");
clearCreateDbReq();
setCreateDbReqFunc("wxy_db", 1);
diff --git a/source/libs/planner/test/planTestUtil.cpp b/source/libs/planner/test/planTestUtil.cpp
index 96f7d29230..b280b32a94 100644
--- a/source/libs/planner/test/planTestUtil.cpp
+++ b/source/libs/planner/test/planTestUtil.cpp
@@ -19,6 +19,7 @@
#include
#include
+#include
#include "cmdnodes.h"
#include "mockCatalogService.h"
@@ -251,6 +252,7 @@ class PlannerTestBaseImpl {
string splitLogicPlan_;
string scaledLogicPlan_;
string physiPlan_;
+ string physiPlanMsg_;
vector physiSubplans_;
};
@@ -274,6 +276,7 @@ class PlannerTestBaseImpl {
res_.splitLogicPlan_.clear();
res_.scaledLogicPlan_.clear();
res_.physiPlan_.clear();
+ res_.physiPlanMsg_.clear();
res_.physiSubplans_.clear();
}
@@ -408,6 +411,8 @@ class PlannerTestBaseImpl {
SNode* pSubplan;
FOREACH(pSubplan, ((SNodeListNode*)pNode)->pNodeList) { res_.physiSubplans_.push_back(toString(pSubplan)); }
}
+ res_.physiPlanMsg_ = toMsg((SNode*)(*pPlan));
+ cout << "json len: " << res_.physiPlan_.length() << ", msg len: " << res_.physiPlanMsg_.length() << endl;
}
void setPlanContext(SQuery* pQuery, SPlanContext* pCxt) {
@@ -446,12 +451,45 @@ class PlannerTestBaseImpl {
string toString(const SNode* pRoot) {
char* pStr = NULL;
int32_t len = 0;
+
+ auto start = chrono::steady_clock::now();
DO_WITH_THROW(nodesNodeToString, pRoot, false, &pStr, &len)
+ if (QUERY_NODE_PHYSICAL_PLAN == nodeType(pRoot)) {
+ cout << "nodesNodeToString: "
+ << chrono::duration_cast(chrono::steady_clock::now() - start).count() << "us" << endl;
+ }
+
string str(pStr);
taosMemoryFreeClear(pStr);
return str;
}
+ string toMsg(const SNode* pRoot) {
+ char* pStr = NULL;
+ int32_t len = 0;
+
+ auto start = chrono::steady_clock::now();
+ DO_WITH_THROW(nodesNodeToMsg, pRoot, &pStr, &len)
+ cout << "nodesNodeToMsg: "
+ << chrono::duration_cast(chrono::steady_clock::now() - start).count() << "us" << endl;
+
+ SNode* pNode = NULL;
+ char* pNewStr = NULL;
+ int32_t newlen = 0;
+ DO_WITH_THROW(nodesMsgToNode, pStr, len, &pNode)
+ DO_WITH_THROW(nodesNodeToMsg, pNode, &pNewStr, &newlen)
+ if (newlen != len || 0 != memcmp(pStr, pNewStr, len)) {
+ cout << "nodesNodeToMsg error!!!!!!!!!!!!!! len = " << len << ", newlen = " << newlen << endl;
+ DO_WITH_THROW(nodesNodeToString, pNode, false, &pNewStr, &newlen)
+ cout << "nodesNodeToString " << pNewStr << endl;
+ }
+ taosMemoryFreeClear(pNewStr);
+
+ string str(pStr, len);
+ taosMemoryFreeClear(pStr);
+ return str;
+ }
+
caseEnv caseEnv_;
stmtEnv stmtEnv_;
stmtRes res_;
diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c
index 9cab39c301..c5f161b66a 100644
--- a/source/libs/scheduler/src/schTask.c
+++ b/source/libs/scheduler/src/schTask.c
@@ -52,7 +52,7 @@ void schInitTaskRetryTimes(SSchJob *pJob, SSchTask *pTask, SSchLevel *pLevel) {
int32_t nodeNum = taosArrayGetSize(pJob->nodeList);
pTask->maxRetryTimes = TMAX(nodeNum, SCH_DEFAULT_MAX_RETRY_NUM);
}
-
+
pTask->maxExecTimes = pTask->maxRetryTimes * (pLevel->level + 1);
}
@@ -139,13 +139,15 @@ int32_t schUpdateTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int3
}
if ((execId != pTask->execId) || pTask->waitRetry) { // ignore it
- SCH_TASK_DLOG("handle not updated since execId %d is already not current execId %d, waitRetry %d", execId, pTask->execId, pTask->waitRetry);
+ SCH_TASK_DLOG("handle not updated since execId %d is already not current execId %d, waitRetry %d", execId,
+ pTask->execId, pTask->waitRetry);
return TSDB_CODE_SUCCESS;
}
SSchNodeInfo *nodeInfo = taosHashGet(pTask->execNodes, &execId, sizeof(execId));
if (NULL == nodeInfo) { // ignore it
- SCH_TASK_DLOG("handle not updated since execId %d already not exist, current execId %d, waitRetry %d", execId, pTask->execId, pTask->waitRetry);
+ SCH_TASK_DLOG("handle not updated since execId %d already not exist, current execId %d, waitRetry %d", execId,
+ pTask->execId, pTask->waitRetry);
return TSDB_CODE_SUCCESS;
}
@@ -314,7 +316,7 @@ int32_t schRescheduleTask(SSchJob *pJob, SSchTask *pTask) {
if (!schMgmt.cfg.enableReSchedule) {
return TSDB_CODE_SUCCESS;
}
-
+
if (SCH_IS_DATA_BIND_TASK(pTask)) {
return TSDB_CODE_SUCCESS;
}
@@ -341,7 +343,8 @@ int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, int32
}
if (((pTask->execId + 1) >= pTask->maxExecTimes) || ((pTask->retryTimes + 1) > pTask->maxRetryTimes)) {
- SCH_TASK_DLOG("task no more retry since reach max times %d:%d, execId %d", pTask->maxRetryTimes, pTask->maxExecTimes, pTask->execId);
+ SCH_TASK_DLOG("task no more retry since reach max times %d:%d, execId %d", pTask->maxRetryTimes,
+ pTask->maxExecTimes, pTask->execId);
schHandleJobFailure(pJob, rspCode);
return TSDB_CODE_SUCCESS;
}
@@ -548,7 +551,8 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo
if ((pTask->retryTimes + 1) > pTask->maxRetryTimes) {
*needRetry = false;
- SCH_TASK_DLOG("task no more retry since reach max retry times, retryTimes:%d/%d", pTask->retryTimes, pTask->maxRetryTimes);
+ SCH_TASK_DLOG("task no more retry since reach max retry times, retryTimes:%d/%d", pTask->retryTimes,
+ pTask->maxRetryTimes);
return TSDB_CODE_SUCCESS;
}
@@ -564,25 +568,25 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo
return TSDB_CODE_SUCCESS;
}
-/*
- if (SCH_IS_DATA_BIND_TASK(pTask)) {
- if ((pTask->execId + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) {
- *needRetry = false;
- SCH_TASK_DLOG("task no more retry since all ep tried, execId:%d, epNum:%d", pTask->execId,
- SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode));
- return TSDB_CODE_SUCCESS;
- }
- } else {
- int32_t candidateNum = taosArrayGetSize(pTask->candidateAddrs);
+ /*
+ if (SCH_IS_DATA_BIND_TASK(pTask)) {
+ if ((pTask->execId + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) {
+ *needRetry = false;
+ SCH_TASK_DLOG("task no more retry since all ep tried, execId:%d, epNum:%d", pTask->execId,
+ SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode));
+ return TSDB_CODE_SUCCESS;
+ }
+ } else {
+ int32_t candidateNum = taosArrayGetSize(pTask->candidateAddrs);
- if ((pTask->candidateIdx + 1) >= candidateNum && (TSDB_CODE_SCH_TIMEOUT_ERROR != errCode)) {
- *needRetry = false;
- SCH_TASK_DLOG("task no more retry since all candiates tried, candidateIdx:%d, candidateNum:%d",
- pTask->candidateIdx, candidateNum);
- return TSDB_CODE_SUCCESS;
+ if ((pTask->candidateIdx + 1) >= candidateNum && (TSDB_CODE_SCH_TIMEOUT_ERROR != errCode)) {
+ *needRetry = false;
+ SCH_TASK_DLOG("task no more retry since all candiates tried, candidateIdx:%d, candidateNum:%d",
+ pTask->candidateIdx, candidateNum);
+ return TSDB_CODE_SUCCESS;
+ }
}
- }
-*/
+ */
*needRetry = true;
SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execId + 1, errCode, tstrerror(errCode));
@@ -630,8 +634,9 @@ int32_t schSetAddrsFromNodeList(SSchJob *pJob, SSchTask *pTask) {
SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
}
- SCH_TASK_TLOG("set %dth candidate addr, id %d, inUse:%d/%d, fqdn:%s, port:%d", i, naddr->nodeId, naddr->epSet.inUse, naddr->epSet.numOfEps,
- SCH_GET_CUR_EP(naddr)->fqdn, SCH_GET_CUR_EP(naddr)->port);
+ SCH_TASK_TLOG("set %dth candidate addr, id %d, inUse:%d/%d, fqdn:%s, port:%d", i, naddr->nodeId,
+ naddr->epSet.inUse, naddr->epSet.numOfEps, SCH_GET_CUR_EP(naddr)->fqdn,
+ SCH_GET_CUR_EP(naddr)->port);
++addNum;
}
@@ -711,10 +716,10 @@ int32_t schSwitchTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask) {
if (candidateNum <= 1) {
goto _return;
}
-
+
switch (schMgmt.cfg.schPolicy) {
case SCH_LOAD_SEQ:
- case SCH_ALL:
+ case SCH_ALL:
default:
if (++pTask->candidateIdx >= candidateNum) {
pTask->candidateIdx = 0;
@@ -732,7 +737,7 @@ int32_t schSwitchTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask) {
_return:
SCH_TASK_DLOG("switch task candiateIdx to %d/%d", pTask->candidateIdx, candidateNum);
-
+
return TSDB_CODE_SUCCESS;
}
@@ -759,7 +764,7 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) {
return;
}
- int32_t i = 0;
+ int32_t i = 0;
SSchNodeInfo *nodeInfo = taosHashIterate(pTask->execNodes, NULL);
while (nodeInfo) {
if (nodeInfo->handle) {
@@ -821,16 +826,16 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) {
int32_t schLaunchTaskImpl(void *param) {
SSchTaskCtx *pCtx = (SSchTaskCtx *)param;
- SSchJob *pJob = schAcquireJob(pCtx->jobRid);
+ SSchJob *pJob = schAcquireJob(pCtx->jobRid);
if (NULL == pJob) {
- taosMemoryFree(param);
qDebug("job refId 0x%" PRIx64 " already not exist", pCtx->jobRid);
+ taosMemoryFree(param);
SCH_RET(TSDB_CODE_SCH_JOB_IS_DROPPING);
}
-
+
SSchTask *pTask = pCtx->pTask;
- int8_t status = 0;
- int32_t code = 0;
+ int8_t status = 0;
+ int32_t code = 0;
atomic_add_fetch_32(&pTask->level->taskLaunchedNum, 1);
pTask->execId++;
@@ -891,13 +896,12 @@ _return:
SCH_RET(code);
}
-int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) {
-
+int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) {
SSchTaskCtx *param = taosMemoryCalloc(1, sizeof(SSchTaskCtx));
if (NULL == param) {
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
param->jobRid = pJob->refId;
param->pTask = pTask;
@@ -906,7 +910,7 @@ int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) {
} else {
SCH_ERR_RET(schLaunchTaskImpl(param));
}
-
+
return TSDB_CODE_SUCCESS;
}
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index a2a45938e4..7cdb7c0db9 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -248,9 +248,12 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S
char* ctbName = buildCtbNameByGroupId(pTask->shuffleDispatcher.stbFullName, groupId);
SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
- // TODO: get hash function by hashMethod
- uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName));
+ /*uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName));*/
+ SUseDbRsp* pDbInfo = &pTask->shuffleDispatcher.dbInfo;
+ uint32_t hashValue =
+ taosGetTbHashVal(ctbName, strlen(ctbName), pDbInfo->hashMethod, pDbInfo->hashPrefix, pDbInfo->hashSuffix);
taosMemoryFree(ctbName);
+
bool found = false;
// TODO: optimize search
int32_t j;
diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c
index bec07b935e..bb2151ed9d 100644
--- a/source/libs/tdb/src/db/tdbPager.c
+++ b/source/libs/tdb/src/db/tdbPager.c
@@ -34,6 +34,22 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage
static int tdbPagerWritePageToJournal(SPager *pPager, SPage *pPage);
static int tdbPagerWritePageToDB(SPager *pPager, SPage *pPage);
+static FORCE_INLINE int32_t pageCmpFn(const void *lhs, const void *rhs) {
+ SPage *pPageL = (SPage *)(((uint8_t *)lhs) - sizeof(SRBTreeNode));
+ SPage *pPageR = (SPage *)(((uint8_t *)rhs) - sizeof(SRBTreeNode));
+
+ SPgno pgnoL = TDB_PAGE_PGNO(pPageL);
+ SPgno pgnoR = TDB_PAGE_PGNO(pPageR);
+
+ if (pgnoL < pgnoR) {
+ return -1;
+ } else if (pgnoL > pgnoR) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
uint8_t *pPtr;
SPager *pPager;
@@ -83,6 +99,8 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
ret = tdbGetFileSize(pPager->fd, pPager->pageSize, &(pPager->dbOrigSize));
pPager->dbFileSize = pPager->dbOrigSize;
+ tRBTreeCreate(&pPager->rbt, pageCmpFn);
+
*ppPager = pPager;
return 0;
}
@@ -167,7 +185,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
// ref page one more time so the page will not be release
tdbRefPage(pPage);
tdbDebug("pcache/mdirty page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
-
+ /*
// Set page as dirty
pPage->isDirty = 1;
@@ -185,6 +203,8 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
ASSERT(*ppPage == NULL || TDB_PAGE_PGNO(*ppPage) > TDB_PAGE_PGNO(pPage));
pPage->pDirtyNext = *ppPage;
*ppPage = pPage;
+ */
+ tRBTreePut(&pPager->rbt, (SRBTreeNode *)pPage);
// Write page to journal if neccessary
if (TDB_PAGE_PGNO(pPage) <= pPager->dbOrigSize) {
@@ -228,6 +248,23 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
return 0;
}
+ SRBTreeIter iter = tRBTreeIterCreate(&pPager->rbt, 1);
+ SRBTreeNode *pNode = NULL;
+ while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
+ pPage = (SPage *)pNode;
+ ret = tdbPagerWritePageToDB(pPager, pPage);
+ if (ret < 0) {
+ ASSERT(0);
+ return -1;
+ }
+
+ pPage->isDirty = 0;
+
+ tdbPCacheRelease(pPager->pCache, pPage, pTxn);
+ }
+
+ tRBTreeCreate(&pPager->rbt, pageCmpFn);
+ /*
// loop to write the dirty pages to file
for (pPage = pPager->pDirty; pPage; pPage = pPage->pDirtyNext) {
// TODO: update the page footer
@@ -238,9 +275,6 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
}
}
- tdbTrace("tdbttl commit:%p, %d", pPager, pPager->dbOrigSize);
- pPager->dbOrigSize = pPager->dbFileSize;
-
// release the page
for (pPage = pPager->pDirty; pPage; pPage = pPager->pDirty) {
pPager->pDirty = pPage->pDirtyNext;
@@ -250,6 +284,9 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
}
+ */
+ tdbTrace("tdbttl commit:%p, %d", pPager, pPager->dbOrigSize);
+ pPager->dbOrigSize = pPager->dbFileSize;
// sync the db file
tdbOsFSync(pPager->fd);
@@ -497,7 +534,14 @@ static int tdbPagerWritePageToJournal(SPager *pPager, SPage *pPage) {
return 0;
}
-
+/*
+struct TdFile {
+ TdThreadRwlock rwlock;
+ int refId;
+ int fd;
+ FILE *fp;
+} TdFile;
+*/
static int tdbPagerWritePageToDB(SPager *pPager, SPage *pPage) {
i64 offset;
int ret;
@@ -514,6 +558,7 @@ static int tdbPagerWritePageToDB(SPager *pPager, SPage *pPage) {
return -1;
}
+ // pwrite(pPager->fd->fd, pPage->pData, pPage->pageSize, offset);
return 0;
}
diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h
index 6a694cf8f1..df6ba8b35f 100644
--- a/source/libs/tdb/src/inc/tdbInt.h
+++ b/source/libs/tdb/src/inc/tdbInt.h
@@ -19,6 +19,7 @@
#include "tdb.h"
#include "tlog.h"
+#include "trbtree.h"
#ifdef __cplusplus
extern "C" {
@@ -256,6 +257,7 @@ typedef struct {
#pragma pack(pop)
struct SPage {
+ SRBTreeNode node; // must be the first field for pageCmpFn to work
tdb_spinlock_t lock;
int pageSize;
u8 *pData;
@@ -280,13 +282,13 @@ struct SPage {
static inline i32 tdbRefPage(SPage *pPage) {
i32 nRef = atomic_add_fetch_32(&((pPage)->nRef), 1);
- tdbTrace("ref page %p/%d, nRef %d", pPage, pPage->id, nRef);
+ // tdbTrace("ref page %p/%d, nRef %d", pPage, pPage->id, nRef);
return nRef;
}
static inline i32 tdbUnrefPage(SPage *pPage) {
i32 nRef = atomic_sub_fetch_32(&((pPage)->nRef), 1);
- tdbTrace("unref page %p/%d, nRef %d", pPage, pPage->id, nRef);
+ // tdbTrace("unref page %p/%d, nRef %d", pPage, pPage->id, nRef);
return nRef;
}
@@ -389,6 +391,7 @@ struct SPager {
SPgno dbFileSize;
SPgno dbOrigSize;
SPage *pDirty;
+ SRBTree rbt;
u8 inTran;
SPager *pNext; // used by TDB
SPager *pHashNext; // used by TDB
diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c
index 62cdf4e784..4a0008b5ff 100644
--- a/source/libs/transport/src/transCli.c
+++ b/source/libs/transport/src/transCli.c
@@ -162,7 +162,7 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
static void cliReleaseUnfinishedMsg(SCliConn* conn) {
for (int i = 0; i < transQueueSize(&conn->cliMsgs); i++) {
SCliMsg* msg = transQueueGet(&conn->cliMsgs, i);
- if (msg != NULL && msg->ctx != NULL) {
+ if (msg != NULL && msg->ctx != NULL && msg->ctx->ahandle != (void*)0x9527) {
if (conn->ctx.freeFunc != NULL && msg->ctx->ahandle != NULL) {
conn->ctx.freeFunc(msg->ctx->ahandle);
}
@@ -196,22 +196,22 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
#define CONN_GET_HOST_THREAD(conn) (conn ? ((SCliConn*)conn)->hostThrd : NULL)
#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label)
-#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
- do { \
- int i = 0, sz = transQueueSize(&conn->cliMsgs); \
- for (; i < sz; i++) { \
- pMsg = transQueueGet(&conn->cliMsgs, i); \
- if (pMsg != NULL && pMsg->ctx != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \
- break; \
- } \
- } \
- if (i == sz) { \
- pMsg = NULL; \
- tDebug("msg not found, %" PRIu64 "", ahandle); \
- } else { \
- pMsg = transQueueRm(&conn->cliMsgs, i); \
- tDebug("msg found, %" PRIu64 "", ahandle); \
- } \
+#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
+ do { \
+ int i = 0, sz = transQueueSize(&conn->cliMsgs); \
+ for (; i < sz; i++) { \
+ pMsg = transQueueGet(&conn->cliMsgs, i); \
+ if (pMsg->ctx != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \
+ break; \
+ } \
+ } \
+ if (i == sz) { \
+ pMsg = NULL; \
+ tDebug("msg not found, %" PRIu64 "", ahandle); \
+ } else { \
+ pMsg = transQueueRm(&conn->cliMsgs, i); \
+ tDebug("msg found, %" PRIu64 "", ahandle); \
+ } \
} while (0)
#define CONN_GET_NEXT_SENDMSG(conn) \
do { \
@@ -289,7 +289,12 @@ bool cliMaySendCachedMsg(SCliConn* conn) {
if (!transQueueEmpty(&conn->cliMsgs)) {
SCliMsg* pCliMsg = NULL;
CONN_GET_NEXT_SENDMSG(conn);
- cliSend(conn);
+ if (pCliMsg == NULL)
+ return false;
+ else {
+ cliSend(conn);
+ return true;
+ }
}
return false;
_RETURN:
@@ -376,8 +381,10 @@ void cliHandleResp(SCliConn* conn) {
return;
}
- if (cliAppCb(conn, &transMsg, pMsg) != 0) {
- return;
+ if (pMsg == NULL || (pMsg && pMsg->type != Release)) {
+ if (cliAppCb(conn, &transMsg, pMsg) != 0) {
+ return;
+ }
}
destroyCmsg(pMsg);
@@ -425,18 +432,20 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) {
transMsg.info.ahandle);
}
} else {
- transMsg.info.ahandle = pCtx ? pCtx->ahandle : NULL;
+ transMsg.info.ahandle = (pMsg->type != Release && pCtx) ? pCtx->ahandle : NULL;
}
if (pCtx == NULL || pCtx->pSem == NULL) {
if (transMsg.info.ahandle == NULL) {
- if (REQUEST_NO_RESP(&pMsg->msg)) destroyCmsg(pMsg);
+ if (REQUEST_NO_RESP(&pMsg->msg) || pMsg->type == Release) destroyCmsg(pMsg);
once = true;
continue;
}
}
- if (cliAppCb(pConn, &transMsg, pMsg) != 0) {
- return;
+ if (pMsg == NULL || (pMsg && pMsg->type != Release)) {
+ if (cliAppCb(pConn, &transMsg, pMsg) != 0) {
+ return;
+ }
}
destroyCmsg(pMsg);
tTrace("%s conn %p start to destroy, ref:%d", CONN_GET_INST_LABEL(pConn), pConn, T_REF_VAL_GET(pConn));
@@ -702,6 +711,9 @@ static bool cliHandleNoResp(SCliConn* conn) {
if (cliMaySendCachedMsg(conn) == false) {
SCliThrd* thrd = conn->hostThrd;
addConnToPool(thrd->pool, conn);
+ res = false;
+ } else {
+ res = true;
}
}
}
@@ -779,7 +791,13 @@ void cliSend(SCliConn* pConn) {
uv_buf_t wb = uv_buf_init((char*)pHead, msgLen);
uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
- uv_write(req, (uv_stream_t*)pConn->stream, &wb, 1, cliSendCb);
+
+ int status = uv_write(req, (uv_stream_t*)pConn->stream, &wb, 1, cliSendCb);
+ if (status != 0) {
+ tGError("%s conn %p failed to sent msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType),
+ uv_err_name(status));
+ cliHandleExcept(pConn);
+ }
return;
_RETURN:
return;
@@ -928,7 +946,9 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
// persist conn already release by server
STransMsg resp;
cliBuildExceptResp(pMsg, &resp);
- pTransInst->cfp(pTransInst->parent, &resp, NULL);
+ if (pMsg->type != Release) {
+ pTransInst->cfp(pTransInst->parent, &resp, NULL);
+ }
destroyCmsg(pMsg);
return;
}
@@ -1399,53 +1419,57 @@ void transUnrefCliHandle(void* handle) {
cliDestroyConn((SCliConn*)handle, true);
}
}
-static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(int64_t handle, bool* validHandle) {
+static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t handle) {
SCliThrd* pThrd = NULL;
SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle);
if (exh == NULL) {
return NULL;
}
- *validHandle = true;
+ if (exh->pThrd == NULL && trans != NULL) {
+ int idx = cliRBChoseIdx(trans);
+ if (idx < 0) return NULL;
+ exh->pThrd = ((SCliObj*)trans->tcphandle)->pThreadObj[idx];
+ }
+
pThrd = exh->pThrd;
transReleaseExHandle(transGetRefMgt(), handle);
return pThrd;
}
-SCliThrd* transGetWorkThrd(STrans* trans, int64_t handle, bool* validHandle) {
+SCliThrd* transGetWorkThrd(STrans* trans, int64_t handle) {
if (handle == 0) {
int idx = cliRBChoseIdx(trans);
if (idx < 0) return NULL;
return ((SCliObj*)trans->tcphandle)->pThreadObj[idx];
}
- SCliThrd* pThrd = transGetWorkThrdFromHandle(handle, validHandle);
- if (*validHandle == true && pThrd == NULL) {
- int idx = cliRBChoseIdx(trans);
- if (idx < 0) return NULL;
- pThrd = ((SCliObj*)trans->tcphandle)->pThreadObj[idx];
- }
+ SCliThrd* pThrd = transGetWorkThrdFromHandle(trans, handle);
return pThrd;
}
int transReleaseCliHandle(void* handle) {
int idx = -1;
bool valid = false;
- SCliThrd* pThrd = transGetWorkThrdFromHandle((int64_t)handle, &valid);
+ SCliThrd* pThrd = transGetWorkThrdFromHandle(NULL, (int64_t)handle);
if (pThrd == NULL) {
return -1;
}
- STransMsg tmsg = {.info.handle = handle};
+ STransMsg tmsg = {.info.handle = handle, .info.ahandle = (void*)0x9527};
TRACE_SET_MSGID(&tmsg.info.traceId, tGenIdPI64());
+ STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
+ pCtx->ahandle = tmsg.info.ahandle;
+
SCliMsg* cmsg = taosMemoryCalloc(1, sizeof(SCliMsg));
cmsg->msg = tmsg;
cmsg->type = Release;
+ cmsg->ctx = pCtx;
STraceId* trace = &tmsg.info.traceId;
tGDebug("send release request at thread:%08" PRId64 "", pThrd->pid);
if (0 != transAsyncSend(pThrd->asyncPool, &cmsg->q)) {
- taosMemoryFree(cmsg);
+ destroyCmsg(cmsg);
return -1;
}
return 0;
@@ -1458,9 +1482,8 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
return -1;
}
- bool valid = false;
- SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle, &valid);
- if (pThrd == NULL && valid == false) {
+ SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
+ if (pThrd == NULL) {
transFreeMsg(pReq->pCont);
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
return TSDB_CODE_RPC_BROKEN_LINK;
@@ -1503,9 +1526,8 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
return -1;
}
- bool valid = false;
- SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle, &valid);
- if (pThrd == NULL && valid == false) {
+ SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
+ if (pThrd == NULL) {
transFreeMsg(pReq->pCont);
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
return TSDB_CODE_RPC_BROKEN_LINK;
@@ -1589,6 +1611,7 @@ int64_t transAllocHandle() {
SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle));
exh->refId = transAddExHandle(transGetRefMgt(), exh);
tDebug("pre alloc refId %" PRId64 "", exh->refId);
+
return exh->refId;
}
#endif
diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c
index c00cafb708..d3277d1cc1 100644
--- a/source/libs/transport/src/transSvr.c
+++ b/source/libs/transport/src/transSvr.c
@@ -907,7 +907,7 @@ static void uvDestroyConn(uv_handle_t* handle) {
}
static void uvPipeListenCb(uv_stream_t* handle, int status) {
if (status != 0) {
- tError("server failed to init pipe");
+ tError("server failed to init pipe, errmsg: %s", uv_err_name(status));
return;
}
@@ -945,7 +945,10 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
uv_loop_init(srv->loop);
int ret = uv_pipe_init(srv->loop, &srv->pipeListen, 0);
- assert(ret == 0);
+ if (ret != 0) {
+ tError("failed to init pipe, errmsg: %s", uv_err_name(ret));
+ goto End;
+ }
#ifdef WINDOWS
char pipeName[64];
@@ -956,10 +959,16 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
taosGetSelfPthreadId());
#endif
ret = uv_pipe_bind(&srv->pipeListen, pipeName);
- assert(ret == 0);
+ if (ret != 0) {
+ tError("failed to bind pipe, errmsg: %s", uv_err_name(ret));
+ goto End;
+ }
ret = uv_listen((uv_stream_t*)&srv->pipeListen, SOMAXCONN, uvPipeListenCb);
- assert(ret == 0);
+ if (ret != 0) {
+ tError("failed to listen pipe, errmsg: %s", uv_err_name(ret));
+ goto End;
+ }
for (int i = 0; i < srv->numOfThreads; i++) {
SWorkThrd* thrd = (SWorkThrd*)taosMemoryCalloc(1, sizeof(SWorkThrd));
@@ -1082,12 +1091,12 @@ void transCloseServer(void* arg) {
if (srv->inited) {
uv_async_send(srv->pAcceptAsync);
taosThreadJoin(srv->thread, NULL);
- }
- SRV_RELEASE_UV(srv->loop);
+ SRV_RELEASE_UV(srv->loop);
- for (int i = 0; i < srv->numOfThreads; i++) {
- sendQuitToWorkThrd(srv->pThreadObj[i]);
- destroyWorkThrd(srv->pThreadObj[i]);
+ for (int i = 0; i < srv->numOfThreads; i++) {
+ sendQuitToWorkThrd(srv->pThreadObj[i]);
+ destroyWorkThrd(srv->pThreadObj[i]);
+ }
}
taosMemoryFree(srv->pThreadObj);
diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c
index 9db7d6c455..5c437e6f7a 100644
--- a/source/libs/wal/src/walRead.c
+++ b/source/libs/wal/src/walRead.c
@@ -168,6 +168,9 @@ static int32_t walReadChangeFile(SWalReader *pReader, int64_t fileFirstVer) {
}
pReader->pIdxFile = pIdxFile;
+
+ pReader->curFileFirstVer = fileFirstVer;
+
return 0;
}
@@ -372,7 +375,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) {
int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) {
int64_t code;
-// ASSERT(pRead->curVersion == pHead->head.version);
+ // ASSERT(pRead->curVersion == pHead->head.version);
code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR);
if (code < 0) {
@@ -415,7 +418,8 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
}
if (walValidBodyCksum(*ppHead) != 0) {
- wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver);
+ wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId,
+ ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
return -1;
diff --git a/source/util/src/tuuid.c b/source/util/src/tuuid.c
index 9101aec949..7460ccbc82 100644
--- a/source/util/src/tuuid.c
+++ b/source/util/src/tuuid.c
@@ -51,11 +51,11 @@ int64_t tGenIdPI64(void) {
int64_t id;
while (true) {
- int64_t ts = taosGetTimestampMs();
+ int64_t ts = taosGetTimestampMs() >> 8;
uint64_t pid = taosGetPId();
int32_t val = atomic_add_fetch_32(&tUUIDSerialNo, 1);
- id = ((tUUIDHashId & 0x07FF) << 52) | ((pid & 0x0FFF) << 40) | ((ts & 0xFFFFFF) << 16) | (val & 0xFFFF);
+ id = ((tUUIDHashId & 0x07FF) << 52) | ((pid & 0x0F) << 48) | ((ts & 0x3FFFFFF) << 20) | (val & 0xFFFFF);
if (id) {
break;
}
diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt
index c06535fc36..161c878440 100644
--- a/tests/script/jenkins/basic.txt
+++ b/tests/script/jenkins/basic.txt
@@ -249,6 +249,12 @@
./test.sh -f tsim/stream/windowClose.sim
./test.sh -f tsim/stream/ignoreExpiredData.sim
./test.sh -f tsim/stream/sliding.sim
+#./test.sh -f tsim/stream/partitionbyColumnInterval.sim
+#./test.sh -f tsim/stream/partitionbyColumnSession.sim
+#./test.sh -f tsim/stream/partitionbyColumnState.sim
+#./test.sh -f tsim/stream/deleteInterval.sim
+#./test.sh -f tsim/stream/deleteSession.sim
+#./test.sh -f tsim/stream/deleteState.sim
# ---- transaction ----
./test.sh -f tsim/trans/lossdata1.sim
diff --git a/tests/script/sh/abs_max.c b/tests/script/sh/abs_max.c
deleted file mode 100644
index d623adacf9..0000000000
--- a/tests/script/sh/abs_max.c
+++ /dev/null
@@ -1,88 +0,0 @@
-#include
-#include
-#include
-
-typedef struct SUdfInit{
- int maybe_null; /* 1 if function can return NULL */
- int decimals; /* for real functions */
- long long length; /* For string functions */
- char *ptr; /* free pointer for function data */
- int const_item; /* 0 if result is independent of arguments */
-} SUdfInit;
-
-
-#define TSDB_DATA_INT_NULL 0x80000000LL
-#define TSDB_DATA_BIGINT_NULL 0x8000000000000000LL
-
-void abs_max(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput,
- int* numOfOutput, short otype, short obytes, SUdfInit* buf) {
- int i;
- int r = 0;
- printf("abs_max input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
- if (itype == 5) {
- r=*(long *)dataOutput;
- *numOfOutput=0;
-
- for(i=0;i r) {
- r = v;
- }
- }
-
- *(long *)dataOutput=r;
-
- printf("abs_max out, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput);
- }
-}
-
-
-
-void abs_max_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* buf) {
- int i;
- int r = 0;
- printf("abs_max_finalize dataoutput:%p:%d, numOfOutput:%d, buf:%p\n", dataOutput, *dataOutput, *numOfOutput, buf);
- *numOfOutput=1;
- printf("abs_max finalize, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput);
-}
-
-void abs_max_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf) {
- int r = 0;
-
- if (numOfRows > 0) {
- r = *((long *)data);
- }
- printf("abs_max_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf);
- for (int i = 1; i < numOfRows; ++i) {
- printf("abs_max_merge %d - %ld\n", i, *((long *)data + i));
- if (*((long*)data + i) > r) {
- r= *((long*)data + i);
- }
- }
-
- *(long*)dataOutput=r;
- if (numOfRows > 0) {
- *numOfOutput=1;
- } else {
- *numOfOutput=0;
- }
-
- printf("abs_max_merge, dataoutput:%ld, numOfOutput:%d\n", *(long *)dataOutput, *numOfOutput);
-}
-
-
-int abs_max_init(SUdfInit* buf) {
- printf("abs_max init\n");
- return 0;
-}
-
-
-void abs_max_destroy(SUdfInit* buf) {
- printf("abs_max destroy\n");
-}
-
diff --git a/tests/script/sh/add_one.c b/tests/script/sh/add_one.c
deleted file mode 100644
index e12cf8f26f..0000000000
--- a/tests/script/sh/add_one.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include
-#include
-#include
-
-typedef struct SUdfInit{
- int maybe_null; /* 1 if function can return NULL */
- int decimals; /* for real functions */
- long long length; /* For string functions */
- char *ptr; /* free pointer for function data */
- int const_item; /* 0 if result is independent of arguments */
-} SUdfInit;
-
-void add_one(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBUf, char* tsOutput,
- int* numOfOutput, short otype, short obytes, SUdfInit* buf) {
- int i;
- int r = 0;
- printf("add_one input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
- if (itype == 4) {
- for(i=0;i
-#include
-#include
-
-typedef struct SUdfInit{
- int maybe_null; /* 1 if function can return NULL */
- int decimals; /* for real functions */
- long long length; /* For string functions */
- char *ptr; /* free pointer for function data */
- int const_item; /* 0 if result is independent of arguments */
-} SUdfInit;
-
-typedef struct SDemo{
- double sum;
- int num;
- short otype;
-}SDemo;
-
-#define FLOAT_NULL 0x7FF00000 // it is an NAN
-#define DOUBLE_NULL 0x7FFFFF0000000000LL // it is an NAN
-
-
-void demo(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput,
- int* numOfOutput, short otype, short obytes, SUdfInit* buf) {
- int i;
- double r = 0;
- SDemo *p = (SDemo *)interBuf;
- SDemo *q = (SDemo *)dataOutput;
- printf("demo input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, interBUf:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, interBuf, tsOutput, numOfOutput, buf);
-
- for(i=0;isum += r*r;
- }
-
- p->otype = otype;
- p->num += numOfRows;
-
- q->sum = p->sum;
- q->num = p->num;
- q->otype = p->otype;
-
- *numOfOutput=1;
-
- printf("demo out, sum:%f, num:%d, numOfOutput:%d\n", p->sum, p->num, *numOfOutput);
-}
-
-
-void demo_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf) {
- int i;
- SDemo *p = (SDemo *)data;
- SDemo res = {0};
- printf("demo_merge input data:%p, rows:%d, dataoutput:%p, numOfOutput:%p, buf:%p\n", data, numOfRows, dataOutput, numOfOutput, buf);
-
- for(i=0;isum * p->sum;
- res.num += p->num;
- p++;
- }
-
- p->sum = res.sum;
- p->num = res.num;
-
- *numOfOutput=1;
-
- printf("demo out, sum:%f, num:%d, numOfOutput:%d\n", p->sum, p->num, *numOfOutput);
-}
-
-
-
-void demo_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* buf) {
- SDemo *p = (SDemo *)interBuf;
- printf("demo_finalize interbuf:%p, numOfOutput:%p, buf:%p, sum:%f, num:%d\n", interBuf, numOfOutput, buf, p->sum, p->num);
- if (p->otype == 6) {
- if (p->num != 30000) {
- *(unsigned int *)dataOutput = FLOAT_NULL;
- } else {
- *(float *)dataOutput = (float)(p->sum / p->num);
- }
- printf("finalize values:%f\n", *(float *)dataOutput);
- } else if (p->otype == 7) {
- if (p->num != 30000) {
- *(unsigned long long *)dataOutput = DOUBLE_NULL;
- } else {
- *(double *)dataOutput = (double)(p->sum / p->num);
- }
- printf("finalize values:%f\n", *(double *)dataOutput);
- }
-
- *numOfOutput=1;
-
- printf("demo finalize, numOfOutput:%d\n", *numOfOutput);
-}
-
-
-int demo_init(SUdfInit* buf) {
- printf("demo init\n");
- return 0;
-}
-
-
-void demo_destroy(SUdfInit* buf) {
- printf("demo destroy\n");
-}
-
diff --git a/tests/script/sh/demo.lua b/tests/script/sh/demo.lua
deleted file mode 100644
index c5e5582fc3..0000000000
--- a/tests/script/sh/demo.lua
+++ /dev/null
@@ -1,43 +0,0 @@
-funcName = "test"
-
-global = {}
-
-function test_init()
- return global
-end
-
-function test_add(rows, ans, key)
- t = {}
- t["sum"] = 0.0
- t["num"] = 0
- for i=1, #rows do
- t["sum"] = t["sum"] + rows[i] * rows[i]
- end
- t["num"] = #rows
-
-
- if (ans[key] ~= nil)
- then
- ans[key]["sum"] = ans[key]["sum"] + t["sum"]
- ans[key]["num"] = ans[key]["num"] + t["num"]
- else
- ans[key] = t
- end
-
- return ans;
-end
-
-function test_finalize(ans, key)
- local ret = 0.0
-
- if (ans[key] ~= nil and ans[key]["num"] == 30000)
- then
- ret = ans[key]["sum"]/ans[key]["num"]
- ans[key]["sum"] = 0.0
- ans[key]["num"] = 0
- else
- ret = inf
- end
-
- return ret, ans
-end
diff --git a/tests/script/sh/sum_double.c b/tests/script/sh/sum_double.c
deleted file mode 100644
index d6eea5d291..0000000000
--- a/tests/script/sh/sum_double.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include
-#include
-#include
-
-typedef struct SUdfInit{
- int maybe_null; /* 1 if function can return NULL */
- int decimals; /* for real functions */
- long long length; /* For string functions */
- char *ptr; /* free pointer for function data */
- int const_item; /* 0 if result is independent of arguments */
-} SUdfInit;
-
-#define TSDB_DATA_INT_NULL 0x80000000LL
-
-
-void sum_double(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput,
- int* numOfOutput, short otype, short obytes, SUdfInit* buf) {
- int i;
- int r = 0;
- printf("sum_double input data:%p, type:%d, rows:%d, ts:%p,%lld, dataoutput:%p, tsOutput:%p, numOfOutput:%p, buf:%p\n", data, itype, numOfRows, ts, *ts, dataOutput, tsOutput, numOfOutput, buf);
- if (itype == 4) {
- r=*(int *)dataOutput;
- *numOfOutput=0;
-
- for(i=0;iptr)=*(int*)dataOutput*2;
- *(int*)dataOutput=*(int*)(buf->ptr);
- printf("sum_double finalize, dataoutput:%d, numOfOutput:%d\n", *(int *)dataOutput, *numOfOutput);
-}
-
-void sum_double_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf) {
- int r = 0;
- int sum = 0;
-
- printf("sum_double_merge numOfRows:%d, dataoutput:%p, buf:%p\n", numOfRows, dataOutput, buf);
- for (int i = 0; i < numOfRows; ++i) {
- printf("sum_double_merge %d - %d\n", i, *((int*)data + i));
- sum +=*((int*)data + i);
- }
-
- *(int*)dataOutput+=sum;
- if (numOfRows > 0) {
- *numOfOutput=1;
- } else {
- *numOfOutput=0;
- }
-
- printf("sum_double_merge, dataoutput:%d, numOfOutput:%d\n", *(int *)dataOutput, *numOfOutput);
-}
-
-
-int sum_double_init(SUdfInit* buf) {
- buf->maybe_null=1;
- buf->ptr = taosMemoryMalloc(sizeof(int));
- printf("sum_double init\n");
- return 0;
-}
-
-
-void sum_double_destroy(SUdfInit* buf) {
- taosMemoryFree(buf->ptr);
- printf("sum_double destroy\n");
-}
-
diff --git a/tests/script/tsim/column/table.sim b/tests/script/tsim/column/table.sim
index 4f1d32c373..03c4799681 100644
--- a/tests/script/tsim/column/table.sim
+++ b/tests/script/tsim/column/table.sim
@@ -159,6 +159,7 @@ if $data01 != 10 then
return -1
endi
if $data02 != 4.500000000 then
+ print expect 4.500000000, actual: $data02
return -1
endi
if $data03 != 4.500000000 then
diff --git a/tests/script/tsim/stream/deleteInterval.sim b/tests/script/tsim/stream/deleteInterval.sim
index dfd0ddc9d3..00d10afad9 100644
--- a/tests/script/tsim/stream/deleteInterval.sim
+++ b/tests/script/tsim/stream/deleteInterval.sim
@@ -186,7 +186,9 @@ endi
sql drop stream if exists streams2;
sql drop database if exists test2;
+sql drop database if exists test;
sql create database test2 vgroups 4;
+sql create database test vgroups 1;
sql use test2;
sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
@@ -411,6 +413,80 @@ if $data12 != 3 then
goto loop14
endi
+return 1
+
+sql drop stream if exists streams3;
+sql drop database if exists test3;
+sql drop database if exists test;
+sql create database test3 vgroups 4;
+sql create database test vgroups 1;
+sql use test3;
+sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s);
+
+sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL);
+sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL);
+
+$loop_count = 0
+
+sql delete from t1;
+
+loop15:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 1 then
+ print =====rows=$rows
+ goto loop15
+endi
+
+$loop_count = 0
+
+sql delete from t1 where ts > 100;
+
+loop16:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 1 then
+ print =====rows=$rows
+ goto loop16
+endi
+
+$loop_count = 0
+
+sql delete from st;
+
+loop17:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 0 then
+ print =====rows=$rows
+ goto loop17
+endi
+
+
+
+
+
$loop_all = $loop_all + 1
print ============loop_all=$loop_all
diff --git a/tests/script/tsim/stream/deleteSession.sim b/tests/script/tsim/stream/deleteSession.sim
new file mode 100644
index 0000000000..541609633b
--- /dev/null
+++ b/tests/script/tsim/stream/deleteSession.sim
@@ -0,0 +1,532 @@
+$loop_all = 0
+looptest:
+
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 200
+sql connect
+
+sql drop stream if exists streams0;
+sql drop stream if exists streams1;
+sql drop stream if exists streams2;
+sql drop stream if exists streams3;
+sql drop stream if exists streams4;
+sql drop database if exists test;
+sql create database test vgroups 1;
+sql use test;
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 session(ts, 5s);
+
+sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL);
+sleep 200
+sql delete from t1 where ts = 1648791213000;
+
+$loop_count = 0
+
+loop0:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 0 then
+ print =====rows=$rows
+ goto loop0
+endi
+
+sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL);
+
+$loop_count = 0
+
+loop1:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop1
+endi
+
+sql insert into t1 values(1648791213000,1,1,1,1.0);
+sql insert into t1 values(1648791213001,2,2,2,2.0);
+sql insert into t1 values(1648791213002,3,3,3,3.0);
+sql insert into t1 values(1648791213003,4,4,4,4.0);
+
+sleep 200
+sql delete from t1 where ts >= 1648791213001 and ts <= 1648791213002;
+
+$loop_count = 0
+
+loop3:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop3
+endi
+
+if $data02 != 4 then
+ print =====data02=$data02
+ goto loop3
+endi
+
+sql insert into t1 values(1648791223000,1,2,3,1.0);
+sql insert into t1 values(1648791223001,1,2,3,1.0);
+sql insert into t1 values(1648791223002,3,2,3,1.0);
+sql insert into t1 values(1648791223003,3,2,3,1.0);
+
+$loop_count = 0
+
+loop4:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print =====rows=$rows
+ goto loop4
+endi
+
+sleep 200
+
+sql delete from t1 where ts >= 1648791223000 and ts <= 1648791223003;
+
+$loop_count = 0
+
+loop5:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop5
+endi
+
+if $data02 != 4 then
+ print =====data02=$data02
+ goto loop5
+endi
+
+sql insert into t1 values(1648791213000,1,1,1,1.0);
+sql insert into t1 values(1648791213005,2,2,2,2.0);
+sql insert into t1 values(1648791213006,3,3,3,3.0);
+sql insert into t1 values(1648791213007,4,4,4,4.0);
+
+sql insert into t1 values(1648791223000,1,1,1,1.0);
+sql insert into t1 values(1648791223001,2,2,2,2.0);
+sql insert into t1 values(1648791223002,3,3,3,3.0);
+sql insert into t1 values(1648791223003,4,4,4,4.0);
+
+sql insert into t1 values(1648791233000,1,1,1,1.0);
+sql insert into t1 values(1648791233001,2,2,2,2.0);
+sql insert into t1 values(1648791233008,3,3,3,3.0);
+sql insert into t1 values(1648791233009,4,4,4,4.0);
+
+sql delete from t1 where ts >= 1648791213001 and ts <= 1648791233005;
+
+$loop_count = 0
+
+loop6:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop6
+endi
+
+if $data02 != 1 then
+ print =====data02=$data02
+ goto loop6
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop6
+endi
+
+if $data12 != 4 then
+ print =====data12=$data12
+ goto loop6
+endi
+
+sql drop stream if exists streams2;
+sql drop database if exists test2;
+sql create database test2 vgroups 4;
+sql use test2;
+sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s);
+
+sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL);
+sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL);
+
+$loop_count = 0
+
+loop7:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 1 then
+ print =====rows=$rows
+ goto loop7
+endi
+
+sleep 200
+
+sql delete from t1 where ts = 1648791213000;
+
+$loop_count = 0
+
+loop8:
+sleep 200
+
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop8
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop8
+endi
+
+sql insert into t1 values(1648791223000,1,2,3,1.0);
+sql insert into t1 values(1648791223001,1,2,3,1.0);
+sql insert into t1 values(1648791223002,3,2,3,1.0);
+sql insert into t1 values(1648791223003,3,2,3,1.0);
+sql insert into t2 values(1648791223000,1,2,3,1.0);
+sql insert into t2 values(1648791223001,1,2,3,1.0);
+sql insert into t2 values(1648791223002,3,2,3,1.0);
+sql insert into t2 values(1648791223003,3,2,3,1.0);
+
+sleep 200
+
+sql delete from t2 where ts >= 1648791223000 and ts <= 1648791223001;
+
+$loop_count = 0
+
+loop11:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop11
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop11
+endi
+
+if $data11 != 6 then
+ print =====data11=$data11
+ goto loop11
+endi
+
+if $data12 != 3 then
+ print =====data12=$data12
+ goto loop11
+endi
+
+sleep 200
+
+sql delete from st where ts >= 1648791223000 and ts <= 1648791223003;
+
+$loop_count = 0
+
+loop12:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 1 then
+ print =====rows=$rows
+ goto loop12
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop12
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop12
+endi
+
+sql insert into t1 values(1648791213004,3,2,3,1.0);
+sql insert into t1 values(1648791213005,3,2,3,1.0);
+sql insert into t1 values(1648791213006,3,2,3,1.0);
+sql insert into t1 values(1648791223004,1,2,3,1.0);
+sql insert into t2 values(1648791213004,3,2,3,1.0);
+sql insert into t2 values(1648791213005,3,2,3,1.0);
+sql insert into t2 values(1648791213006,3,2,3,1.0);
+sql insert into t2 values(1648791223004,1,2,3,1.0);
+
+sleep 200
+
+sql delete from t2 where ts >= 1648791213004 and ts <= 1648791213006;
+
+$loop_count = 0
+
+loop13:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print =====rows=$rows
+ goto loop13
+endi
+
+if $data01 != 4 then
+ print =====data01=$data01
+ goto loop13
+endi
+
+if $data02 != 3 then
+ print =====data02=$data02
+ goto loop13
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop13
+endi
+
+if $data12 != 1 then
+ print =====data12=$data12
+ goto loop13
+endi
+
+sql insert into t1 values(1648791223005,1,2,3,1.0);
+sql insert into t1 values(1648791223006,1,2,3,1.0);
+sql insert into t2 values(1648791223005,1,2,3,1.0);
+sql insert into t2 values(1648791223006,1,2,3,1.0);
+
+sql insert into t1 values(1648791233005,4,2,3,1.0);
+sql insert into t1 values(1648791233006,2,2,3,1.0);
+sql insert into t2 values(1648791233005,5,2,3,1.0);
+sql insert into t2 values(1648791233006,3,2,3,1.0);
+
+sleep 200
+
+sql delete from st where ts >= 1648791213001 and ts <= 1648791233005;
+
+$loop_count = 0
+
+loop14:
+sleep 200
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print =====rows=$rows
+ goto loop14
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop14
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop14
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop14
+endi
+
+if $data12 != 3 then
+ print =====data12=$data12
+ goto loop14
+endi
+
+sql drop stream if exists streams1;
+sql drop stream if exists streams2;
+sql drop stream if exists streams3;
+sql drop database if exists test3;
+sql drop database if exists test;
+sql create database test3 vgroups 4;
+sql create database test vgroups 1;
+sql use test3;
+sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s);
+
+sql insert into t1 values(1648791210000,1,1,1,NULL);
+sql insert into t1 values(1648791210001,2,2,2,NULL);
+sql insert into t2 values(1648791213001,3,3,3,NULL);
+sql insert into t2 values(1648791213003,4,4,4,NULL);
+sql insert into t1 values(1648791216000,5,5,5,NULL);
+sql insert into t1 values(1648791216002,6,6,6,NULL);
+sql insert into t1 values(1648791216004,7,7,7,NULL);
+sql insert into t2 values(1648791218001,8,8,8,NULL);
+sql insert into t2 values(1648791218003,9,9,9,NULL);
+sql insert into t1 values(1648791222000,10,10,10,NULL);
+sql insert into t1 values(1648791222003,11,11,11,NULL);
+sql insert into t1 values(1648791222005,12,12,12,NULL);
+
+sql insert into t1 values(1648791232005,13,13,13,NULL);
+sql insert into t2 values(1648791242005,14,14,14,NULL);
+
+$loop_count = 0
+
+loop19:
+sleep 200
+sql select * from test.streamt3 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 3 then
+ print =====rows=$rows
+ goto loop19
+endi
+
+sql delete from t2 where ts >= 1648791213001 and ts <= 1648791218003;
+
+$loop_count = 0
+
+loop20:
+sleep 200
+sql select * from test.streamt3 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 5 then
+ print =====rows=$rows
+ goto loop20
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop20
+endi
+
+if $data02 != 2 then
+ print =====data02=$data02
+ goto loop20
+endi
+
+if $data11 != 3 then
+ print =====data11=$data11
+ goto loop20
+endi
+
+if $data12 != 7 then
+ print =====data12=$data12
+ goto loop20
+endi
+
+if $data21 != 3 then
+ print =====data21=$data21
+ goto loop20
+endi
+
+if $data22 != 12 then
+ print =====data22=$data22
+ goto loop20
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop20
+endi
+
+if $data32 != 13 then
+ print =====data32=$data32
+ goto loop20
+endi
+
+if $data41 != 1 then
+ print =====data41=$data41
+ goto loop20
+endi
+
+if $data42 != 14 then
+ print =====data42=$data42
+ goto loop20
+endi
+
+$loop_all = $loop_all + 1
+print ============loop_all=$loop_all
+
+system sh/stop_dnodes.sh
+
+#goto looptest
\ No newline at end of file
diff --git a/tests/script/tsim/stream/deleteState.sim b/tests/script/tsim/stream/deleteState.sim
new file mode 100644
index 0000000000..ecd9f55340
--- /dev/null
+++ b/tests/script/tsim/stream/deleteState.sim
@@ -0,0 +1,198 @@
+$loop_all = 0
+looptest:
+
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 200
+sql connect
+
+sql drop stream if exists streams0;
+sql drop stream if exists streams1;
+sql drop stream if exists streams2;
+sql drop stream if exists streams3;
+sql drop stream if exists streams4;
+sql drop database if exists test;
+sql create database test vgroups 1;
+sql use test;
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(a);
+
+sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL);
+sleep 200
+sql delete from t1 where ts = 1648791213000;
+
+$loop_count = 0
+
+loop0:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 0 then
+ print =====rows=$rows
+ goto loop0
+endi
+
+sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL);
+
+$loop_count = 0
+
+loop1:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop1
+endi
+
+sql insert into t1 values(1648791213000,1,1,1,1.0);
+sql insert into t1 values(1648791213001,1,2,2,2.0);
+sql insert into t1 values(1648791213002,1,3,3,3.0);
+sql insert into t1 values(1648791213003,1,4,4,4.0);
+
+sleep 200
+sql delete from t1 where ts >= 1648791213001 and ts <= 1648791213002;
+
+$loop_count = 0
+
+loop3:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop3
+endi
+
+if $data02 != 4 then
+ print =====data02=$data02
+ goto loop3
+endi
+
+sql insert into t1 values(1648791223000,2,2,3,1.0);
+sql insert into t1 values(1648791223001,2,2,3,1.0);
+sql insert into t1 values(1648791223002,2,2,3,1.0);
+sql insert into t1 values(1648791223003,2,2,3,1.0);
+
+$loop_count = 0
+
+loop4:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print =====rows=$rows
+ goto loop4
+endi
+
+sleep 200
+
+sql delete from t1 where ts >= 1648791223000 and ts <= 1648791223003;
+
+$loop_count = 0
+
+loop5:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop5
+endi
+
+if $data02 != 4 then
+ print =====data02=$data02
+ goto loop5
+endi
+
+sql insert into t1 values(1648791213000,1,1,1,1.0);
+sql insert into t1 values(1648791213005,1,2,2,2.0);
+sql insert into t1 values(1648791213006,1,3,3,3.0);
+sql insert into t1 values(1648791213007,1,4,4,4.0);
+
+sql insert into t1 values(1648791223000,2,1,1,1.0);
+sql insert into t1 values(1648791223001,2,2,2,2.0);
+sql insert into t1 values(1648791223002,2,3,3,3.0);
+sql insert into t1 values(1648791223003,2,4,4,4.0);
+
+sql insert into t1 values(1648791233000,3,1,1,1.0);
+sql insert into t1 values(1648791233001,3,2,2,2.0);
+sql insert into t1 values(1648791233008,3,3,3,3.0);
+sql insert into t1 values(1648791233009,3,4,4,4.0);
+
+sql delete from t1 where ts >= 1648791213001 and ts <= 1648791233005;
+
+$loop_count = 0
+
+loop6:
+sleep 200
+sql select * from streamt order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print =====rows=$rows
+ goto loop6
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop6
+endi
+
+if $data02 != 1 then
+ print =====data02=$data02
+ goto loop6
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop6
+endi
+
+if $data12 != 4 then
+ print =====data12=$data12
+ goto loop6
+endi
+
+
+$loop_all = $loop_all + 1
+print ============loop_all=$loop_all
+
+system sh/stop_dnodes.sh
+
+#goto looptest
\ No newline at end of file
diff --git a/tests/script/tsim/stream/partitionbyColumn0.sim b/tests/script/tsim/stream/partitionbyColumnInterval.sim
similarity index 100%
rename from tests/script/tsim/stream/partitionbyColumn0.sim
rename to tests/script/tsim/stream/partitionbyColumnInterval.sim
diff --git a/tests/script/tsim/stream/partitionbyColumn1.sim b/tests/script/tsim/stream/partitionbyColumnSession.sim
similarity index 100%
rename from tests/script/tsim/stream/partitionbyColumn1.sim
rename to tests/script/tsim/stream/partitionbyColumnSession.sim
diff --git a/tests/script/tsim/stream/partitionbyColumn2.sim b/tests/script/tsim/stream/partitionbyColumnState.sim
similarity index 100%
rename from tests/script/tsim/stream/partitionbyColumn2.sim
rename to tests/script/tsim/stream/partitionbyColumnState.sim
diff --git a/tests/system-test/2-query/ttl_comment.py b/tests/system-test/2-query/ttl_comment.py
index c26393158c..187df2e2d3 100644
--- a/tests/system-test/2-query/ttl_comment.py
+++ b/tests/system-test/2-query/ttl_comment.py
@@ -137,7 +137,8 @@ class TDTestCase:
tdSql.execute(f"create table {dbname}.child_table2 using {dbname}.super_table1 tags(1) comment ''")
tdSql.execute(f"create table {dbname}.child_table3 using {dbname}.super_table1 tags(1) comment 'child'")
tdSql.execute(f"insert into {dbname}.child_table4 using {dbname}.super_table1 tags(1) values(now, 1)")
-
+ tdSql.execute(f"insert into {dbname}.child_table5 using {dbname}.super_table1 tags(1) ttl 23 comment '' values(now, 1)")
+ tdSql.error(f"insert into {dbname}.child_table6 using {dbname}.super_table1 tags(1) ttl -23 comment '' values(now, 1)")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
tdSql.checkData(0, 0, 'child_table1')
@@ -160,6 +161,11 @@ class TDTestCase:
tdSql.checkData(0, 7, 0)
tdSql.checkData(0, 8, None)
+ tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table5'")
+ tdSql.checkData(0, 0, 'child_table5')
+ tdSql.checkData(0, 7, 23)
+ tdSql.checkData(0, 8, '')
+
tdSql.execute(f"alter table {dbname}.child_table1 comment 'nihao'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh
index 8987ba3bbd..0b45b24258 100755
--- a/tests/system-test/fulltest.sh
+++ b/tests/system-test/fulltest.sh
@@ -2,7 +2,7 @@
set -e
set -x
-python3 ./test.py -f 0-others/taosShell.py
+#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 0-others/telemetry.py