diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index 1751549680e2f4daa0be4b4c5e0bc51ccd151334..9547323acf0caa39de2ba3a58cd625b052ae6508 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 d237772
+ GIT_TAG e8bfca6
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/01-index.md b/docs/en/01-index.md
index 363fa1101ccb0509805977154c04aaef8e052468..22e62bc5e05fe83065b0e101644b01dbba2b5874 100644
--- a/docs/en/01-index.md
+++ b/docs/en/01-index.md
@@ -5,7 +5,7 @@ slug: /
---
-TDengine is an open source, cloud native time-series database optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. It enables efficient, real-time data ingestion, processing, and monitoring of TB and even PB scale data per day, generated by billions of sensors and data collectors. This document is the TDengine user manual. It introduces the basic, as well as novel concepts, in TDengine, and also talks in detail about installation, features, SQL, APIs, operation, maintenance, kernel design and other topics. It’s written mainly for architects, developers and system administrators.
+TDengine is an [open source](https://tdengine.com/tdengine/open-source-time-series-database/), [cloud native](https://tdengine.com/tdengine/cloud-native-time-series-database/) time-series database optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. It enables efficient, real-time data ingestion, processing, and monitoring of TB and even PB scale data per day, generated by billions of sensors and data collectors. This document is the TDengine user manual. It introduces the basic, as well as novel concepts, in TDengine, and also talks in detail about installation, features, SQL, APIs, operation, maintenance, kernel design and other topics. It’s written mainly for architects, developers and system administrators.
To get an overview of TDengine, such as a feature list, benchmarks, and competitive advantages, please browse through the [Introduction](./intro) section.
diff --git a/docs/en/02-intro/index.md b/docs/en/02-intro/index.md
index 8aa40aed091d0dd28348600fd8e56eb0af510fb9..5d21fbaf90622d5da7303e63c4d4cd6b622fd1a4 100644
--- a/docs/en/02-intro/index.md
+++ b/docs/en/02-intro/index.md
@@ -3,7 +3,7 @@ title: Introduction
toc_max_heading_level: 2
---
-TDengine is an open source, high-performance, cloud native time-series database optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. Its code, including its cluster feature is open source under GNU AGPL v3.0. Besides the database engine, it provides [caching](../develop/cache), [stream processing](../develop/stream), [data subscription](../develop/tmq) and other functionalities to reduce the system complexity and cost of development and operation.
+TDengine is an open source, high-performance, cloud native [time-series database](https://tdengine.com/tsdb/) optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. Its code, including its cluster feature is open source under GNU AGPL v3.0. Besides the database engine, it provides [caching](/develop/cache), [stream processing](/develop/stream), [data subscription](/develop/tmq) and other functionalities to reduce the system complexity and cost of development and operation.
This section introduces the major features, competitive advantages, typical use-cases and benchmarks to help you get a high level overview of TDengine.
@@ -11,21 +11,33 @@ This section introduces the major features, competitive advantages, typical use-
The major features are listed below:
-1. While TDengine supports [using SQL to insert](/develop/insert-data/sql-writing), it also supports [Schemaless writing](/reference/schemaless/) just like NoSQL databases. TDengine also supports standard protocols like [InfluxDB LINE](/develop/insert-data/influxdb-line),[OpenTSDB Telnet](/develop/insert-data/opentsdb-telnet), [OpenTSDB JSON ](/develop/insert-data/opentsdb-json) among others.
-2. TDengine supports seamless integration with third-party data collection agents like [Telegraf](/third-party/telegraf),[Prometheus](/third-party/prometheus),[StatsD](/third-party/statsd),[collectd](/third-party/collectd),[icinga2](/third-party/icinga2), [TCollector](/third-party/tcollector), [EMQX](/third-party/emq-broker), [HiveMQ](/third-party/hive-mq-broker). These agents can write data into TDengine with simple configuration and without a single line of code.
-3. Support for [all kinds of queries](/develop/query-data), including aggregation, nested query, downsampling, interpolation and others.
-4. Support for [user defined functions](/develop/udf).
-5. Support for [caching](/develop/cache). TDengine always saves the last data point in cache, so Redis is not needed in some scenarios.
-6. Support for [continuous query](../develop/stream).
-7. Support for [data subscription](../develop/tmq with the capability to specify filter conditions.
-8. Support for [cluster](../deployment/), with the capability of increasing processing power by adding more nodes. High availability is supported by replication.
-9. Provides an interactive [command-line interface](/reference/taos-shell) for management, maintenance and ad-hoc queries.
-10. Provides many ways to [import](/operation/import) and [export](/operation/export) data.
-11. Provides [monitoring](/operation/monitor) on running instances of TDengine.
-12. Provides [connectors](/reference/connector/) for [C/C++](/reference/connector/cpp), [Java](/reference/connector/java), [Python](/reference/connector/python), [Go](/reference/connector/go), [Rust](/reference/connector/rust), [Node.js](/reference/connector/node) and other programming languages.
-13. Provides a [REST API](/reference/rest-api/).
-14. Supports seamless integration with [Grafana](/third-party/grafana) for visualization.
-15. Supports seamless integration with Google Data Studio.
+1. Insert data
+ * supports [using SQL to insert](/develop/insert-data/sql-writing).
+ * supports [schemaless writing](/reference/schemaless/) just like NoSQL databases. It also supports standard protocols like [InfluxDB LINE](/develop/insert-data/influxdb-line),[OpenTSDB Telnet](/develop/insert-data/opentsdb-telnet), [OpenTSDB JSON ](/develop/insert-data/opentsdb-json) among others.
+ * supports seamless integration with third-party tools like [Telegraf](/third-party/telegraf/), [Prometheus](/third-party/prometheus/), [collectd](/third-party/collectd/), [StatsD](/third-party/statsd/), [TCollector](/third-party/tcollector/) and [icinga2/](/third-party/icinga2/), they can write data into TDengine with simple configuration and without a single line of code.
+2. Query data
+ * supports standard [SQL](/taos-sql/), including nested query.
+ * supports [time series specific functions](/taos-sql/function/#time-series-extensions) and [time series specific queries](/taos-sql/distinguished), like downsampling, interpolation, cumulated sum, time weighted average, state window, session window and many others.
+ * supports [user defined functions](/taos-sql/udf).
+3. [Caching](/develop/cache/): TDengine always saves the last data point in cache, so Redis is not needed for time-series data processing.
+4. [Stream Processing](/develop/stream/): not only is the continuous query is supported, but TDengine also supports even driven stream processing, so Flink or spark is not needed for time-series daata processing.
+5. [Data Dubscription](/develop/tmq/): application can subscribe a table or a set of tables. API is the same as Kafka, but you can specify filter conditions.
+6. Visualization
+ * supports seamless integration with [Grafana](/third-party/grafana/) for visualization.
+ * supports seamless integration with Google Data Studio.
+7. Cluster
+ * supports [cluster](/deployment/) with the capability of increasing processing power by adding more nodes.
+ * supports [deployment on Kubernetes](/deployment/k8s/)
+ * supports high availability via data replication.
+8. Administration
+ * provides [monitoring](/operation/monitor) on running instances of TDengine.
+ * provides many ways to [import](/operation/import) and [export](/operation/export) data.
+9. Tools
+ * provides an interactive [command-line interface](/reference/taos-shell) for management, maintenance and ad-hoc queries.
+ * provides a tool [taosBenchmark](/reference/taosbenchmark/) for testing the performance of TDengine.
+10. Programming
+ * provides [connectors](/reference/connector/) for [C/C++](/reference/connector/cpp), [Java](/reference/connector/java), [Python](/reference/connector/python), [Go](/reference/connector/go), [Rust](/reference/connector/rust), [Node.js](/reference/connector/node) and other programming languages.
+ * provides a [REST API](/reference/rest-api/).
For more details on features, please read through the entire documentation.
@@ -33,17 +45,18 @@ For more details on features, please read through the entire documentation.
By making full use of [characteristics of time series data](https://tdengine.com/tsdb/characteristics-of-time-series-data/), TDengine differentiates itself from other time series databases, with the following advantages.
-- **High-Performance**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression.
+- **[High-Performance](https://tdengine.com/tdengine/high-performance-time-series-database/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression.
-- **Simplified Solution**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly.
+- **[Simplified Solution](https://tdengine.com/tdengine/simplified-time-series-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly.
-- **Cloud Native**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for kubernetes deployment and full observability, TDengine is a cloud native Time-Series Database and can be deployed on public, private or hybrid clouds.
+- **[Cloud Native](https://tdengine.com/tdengine/cloud-native-time-series-database/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for kubernetes deployment and full observability, TDengine is a cloud native Time-Series Database and can be deployed on public, private or hybrid clouds.
-- **Ease of Use**: For administrators, TDengine significantly reduces the effort to deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access.
+- **[Ease of Use](https://tdengine.com/tdengine/easy-time-series-data-platform/)**: For administrators, TDengine significantly reduces the effort to[
+](https://tdengine.com/tdengine/easy-time-series-data-platform/) deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access.
-- **Easy Data Analytics**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
+- **[Easy Data Analytics](https://tdengine.com/tdengine/time-series-data-analytics-made-easy/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
-- **Open Source**: TDengine’s core modules, including cluster feature, are all available under open source licenses. It has gathered 18.8k stars on GitHub. There is an active developer community, and over 139k running instances worldwide.
+- **[Open Source](https://tdengine.com/tdengine/open-source-time-series-database/)**: TDengine’s core modules, including cluster feature, are all available under open source licenses. It has gathered over 19k stars on GitHub. There is an active developer community, and over 140k running instances worldwide.
With TDengine, the total cost of ownership of your time-series data platform can be greatly reduced. 1: With its superior performance, the computing and storage resources are reduced significantly;2: With SQL support, it can be seamlessly integrated with many third party tools, and learning costs/migration costs are reduced significantly;3: With its simplified solution and nearly zero management, the operation and maintenance costs are reduced significantly.
@@ -96,14 +109,13 @@ As a high-performance, scalable and SQL supported time-series database, TDengine
| **System Maintenance Requirements** | **Not Applicable** | **Might Be Applicable** | **Very Applicable** | **Description** |
| ------------------------------------------------- | ------------------ | ----------------------- | ------------------- | ------------------------------------------------------------ |
| Native high-reliability | | | √ | TDengine has a very robust, reliable and easily configurable system architecture to simplify routine operation. Human errors and accidents are eliminated to the greatest extent, with a streamlined experience for operators. |
-| Minimize learning and maintenance costs | | | √ | In addition to being easily configurable, standard SQL support and the Taos shell for ad hoc queries makes maintenance simpler, allows reuse and reduces learning costs.|
+| Minimize learning and maintenance costs | | | √ | In addition to being easily configurable, standard SQL support and the TDengine CLI for ad hoc queries makes maintenance simpler, allows reuse and reduces learning costs.|
| Abundant talent supply | √ | | | Given the above, and given the extensive training and professional services provided by TDengine, it is easy to migrate from existing solutions or create a new and lasting solution based on TDengine.|
## Comparison with other databases
- [Writing Performance Comparison of TDengine and InfluxDB ](https://tdengine.com/2022/02/23/4975.html)
- [Query Performance Comparison of TDengine and InfluxDB](https://tdengine.com/2022/02/24/5120.html)
-- [TDengine vs InfluxDB、OpenTSDB、Cassandra、MySQL、ClickHouse](https://www.tdengine.com/downloads/TDengine_Testing_Report_en.pdf)
- [TDengine vs OpenTSDB](https://tdengine.com/2019/09/12/710.html)
- [TDengine vs Cassandra](https://tdengine.com/2019/09/12/708.html)
- [TDengine vs InfluxDB](https://tdengine.com/2019/09/12/706.html)
diff --git a/docs/en/04-concept/index.md b/docs/en/04-concept/index.md
index 44dcad82fc8e77bdb63ed3f8d5a36b9542c72aea..5a9c55fdd68d7c2f36fd9a718efa07c4388d55a7 100644
--- a/docs/en/04-concept/index.md
+++ b/docs/en/04-concept/index.md
@@ -104,15 +104,15 @@ Each row contains the device ID, time stamp, collected metrics (current, voltage
## Metric
-Metric refers to the physical quantity collected by sensors, equipment or other types of data collection devices, such as current, voltage, temperature, pressure, GPS position, etc., which change with time, and the data type can be integer, float, Boolean, or strings. As time goes by, the amount of collected metric data stored increases.
+Metric refers to the physical quantity collected by sensors, equipment or other types of data collection devices, such as current, voltage, temperature, pressure, GPS position, etc., which change with time, and the data type can be integer, float, Boolean, or strings. As time goes by, the amount of collected metric data stored increases. In the smart meters example, current, voltage and phase are the metrics.
## Label/Tag
-Label/Tag refers to the static properties of sensors, equipment or other types of data collection devices, which do not change with time, such as device model, color, fixed location of the device, etc. The data type can be any type. Although static, TDengine allows users to add, delete or update tag values at any time. Unlike the collected metric data, the amount of tag data stored does not change over time.
+Label/Tag refers to the static properties of sensors, equipment or other types of data collection devices, which do not change with time, such as device model, color, fixed location of the device, etc. The data type can be any type. Although static, TDengine allows users to add, delete or update tag values at any time. Unlike the collected metric data, the amount of tag data stored does not change over time. In the meters example, `location` and `groupid` are the tags.
## 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.
+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.
## Table
@@ -137,7 +137,7 @@ The design of one table for one data collection point will require a huge number
STable is a template for a type of data collection point. A STable contains a set of data collection points (tables) that have the same schema or data structure, but with different static attributes (tags). To describe a STable, in addition to defining the table structure of the metrics, it is also necessary to define the schema of its tags. The data type of tags can be int, float, string, and there can be multiple tags, which can be added, deleted, or modified afterward. If the whole system has N different types of data collection points, N STables need to be established.
-In the design of TDengine, **a table is used to represent a specific data collection point, and STable is used to represent a set of data collection points of the same type**.
+In the design of TDengine, **a table is used to represent a specific data collection point, and STable is used to represent a set of data collection points of the same type**. In the smart meters example, we can create a super table named `meters`.
## Subtable
@@ -156,7 +156,9 @@ 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 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. ![Meters Data Model Diagram](./supertable.webp)
## Database
diff --git a/docs/en/04-concept/supertable.webp b/docs/en/04-concept/supertable.webp
new file mode 100644
index 0000000000000000000000000000000000000000..764b8f3de7ee92a103b2fcd0e75c03773af5ee37
Binary files /dev/null and b/docs/en/04-concept/supertable.webp differ
diff --git a/docs/en/05-get-started/01-docker.md b/docs/en/05-get-started/01-docker.md
index 869390cd6c30e8ddc4f0b11ef2402bd7ffb6cf7d..de5b620a779557a8a3b8422a14caf67b354d1e7a 100644
--- a/docs/en/05-get-started/01-docker.md
+++ b/docs/en/05-get-started/01-docker.md
@@ -31,17 +31,6 @@ 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/).
-## Open the TDengine CLI
-
-On the container, run the following command to open the TDengine CLI:
-
-```
-$ taos
-
-taos>
-
-```
-
## Insert Data into TDengine
You can use the `taosBenchmark` tool included with TDengine to write test data into your deployment.
@@ -53,45 +42,57 @@ To do so, run the following command:
```
- 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 ten and a `location` tag of either `California.SanFrancisco` or `California.SanDiego`.
+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:
+
+```
+$ taos
+
+taos>
+
+```
+
## Query Data in TDengine
After using taosBenchmark to create your test deployment, you can run queries in the TDengine CLI to test its performance. For example:
-Query the number of rows in the `meters` supertable:
+From the TDengine CLI query the number of rows in the `meters` supertable:
```sql
-taos> 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
-taos> 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 `California.SanFrancisco`:
+Query the number of rows whose `location` tag is `San Francisco`:
```sql
-taos> 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
-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;
```
-Query the average, maximum, and minimum values for table `d10` in 10 second intervals:
+Query the average, maximum, and minimum values for table `d10` in 1 second intervals:
```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(1s);
```
+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 6f6a5087fa7e73f49ed97c5ea5f7db1668cebe9f..88096a759c58529d4150c0a750a4354a88da988f 100644
--- a/docs/en/05-get-started/03-package.md
+++ b/docs/en/05-get-started/03-package.md
@@ -67,13 +67,6 @@ Users will be prompted to enter some configuration information when install.sh i
-
-
-1. Download the Windows installation package.
-
-2. Run the downloaded package to install TDengine.
-
-
You can use `apt-get` to install TDengine from the official package repository.
@@ -102,6 +95,15 @@ sudo apt-get install tdengine
:::tip
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.
+
+1. Download the Windows installation package.
+
+2. Run the downloaded package to install TDengine.
+
@@ -172,6 +174,20 @@ After the installation is complete, run `C:\TDengine\taosd.exe` to start TDengin
+## Test data insert performance
+
+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:
@@ -203,51 +219,38 @@ 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:
-
-```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 ten and a `location` tag of either `California.SanFrancisco` or `California.LosAngeles`.
-
-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).
-
+
## Test data query performance
After using taosBenchmark to create your test deployment, you can run queries in the TDengine CLI to test its performance:
-Query the number of rows in the `meters` supertable:
+From the TDengine CLI query the number of rows in the `meters` supertable:
```sql
-taos> 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
-taos> 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 `California.SanFrancisco`:
+Query the number of rows whose `location` tag is `San Francisco`:
```sql
-taos> select count(*) from test.meters where location="California.SanFrancisco";
+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
-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;
```
-Query the average, maximum, and minimum values for table `d10` in 10 second intervals:
+Query the average, maximum, and minimum values for table `d10` in 1 second intervals:
```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(1s);
```
+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/07-develop/03-insert-data/05-high-volume.md b/docs/en/07-develop/03-insert-data/05-high-volume.md
new file mode 100644
index 0000000000000000000000000000000000000000..8163ae03b2ab8ea515ae339e2881047a095aed23
--- /dev/null
+++ b/docs/en/07-develop/03-insert-data/05-high-volume.md
@@ -0,0 +1,444 @@
+---
+sidebar_label: High Performance Writing
+title: High Performance Writing
+---
+
+import Tabs from "@theme/Tabs";
+import TabItem from "@theme/TabItem";
+
+This chapter introduces how to write data into TDengine with high throughput.
+
+## How to achieve high performance data writing
+
+To achieve high performance writing, there are a few aspects to consider. In the following sections we will describe these important factors in achieving high performance writing.
+
+### Application Program
+
+From the perspective of application program, you need to consider:
+
+1. The data size of each single write, also known as batch size. Generally speaking, higher batch size generates better writing performance. However, once the batch size is over a specific value, you will not get any additional benefit anymore. When using SQL to write into TDengine, it's better to put as much as possible data in single SQL. The maximum SQL length supported by TDengine is 1,048,576 bytes, i.e. 1 MB. It can be configured by parameter `maxSQLLength` on client side, and the default value is 65,480.
+
+2. The number of concurrent connections. Normally more connections can get better result. However, once the number of connections exceeds the processing ability of the server side, the performance may downgrade.
+
+3. The distribution of data to be written across tables or sub-tables. Writing to single table in one batch is more efficient than writing to multiple tables in one batch.
+
+4. Data Writing Protocol.
+ - Prameter binding mode is more efficient than SQL because it doesn't have the cost of parsing SQL.
+ - Writing to known existing tables is more efficient than wirting to uncertain tables in automatic creating mode because the later needs to check whether the table exists or not before actually writing data into it
+ - Writing in SQL is more efficient than writing in schemaless mode because schemaless writing creats table automatically and may alter table schema
+
+Application programs need to take care of the above factors and try to take advantage of them. The application progam should write to single table in each write batch. The batch size needs to be tuned to a proper value on a specific system. The number of concurrent connections needs to be tuned to a proper value too to achieve the best writing throughput.
+
+### Data Source
+
+Application programs need to read data from data source then write into TDengine. If you meet one or more of below situations, you need to setup message queues between the threads for reading from data source and the threads for writing into TDengine.
+
+1. There are multiple data sources, the data generation speed of each data source is much slower than the speed of single writing thread. In this case, the purpose of message queues is to consolidate the data from multiple data sources together to increase the batch size of single write.
+2. The speed of data generation from single data source is much higher than the speed of single writing thread. The purpose of message queue in this case is to provide buffer so that data is not lost and multiple writing threads can get data from the buffer.
+3. The data for single table are from multiple data source. In this case the purpose of message queues is to combine the data for single table together to improve the write efficiency.
+
+If the data source is Kafka, then the appication program is a consumer of Kafka, you can benefit from some kafka features to achieve high performance writing:
+
+1. Put the data for a table in single partition of single topic so that it's easier to put the data for each table together and write in batch
+2. Subscribe multiple topics to accumulate data together.
+3. Add more consumers to gain more concurrency and throughput.
+4. Incrase the size of single fetch to increase the size of write batch.
+
+### Tune TDengine
+
+TDengine is a distributed and high performance time series database, there are also some ways to tune TDengine to get better writing performance.
+
+1. Set proper number of `vgroups` according to available CPU cores. Normally, we recommend 2 \* number_of_cores as a starting point. If the verification result shows this is not enough to utilize CPU resources, you can use a higher value.
+2. Set proper `minTablesPerVnode`, `tableIncStepPerVnode`, and `maxVgroupsPerDb` according to the number of tables so that tables are distributed even across vgroups. The purpose is to balance the workload among all vnodes so that system resources can be utilized better to get higher performance.
+
+For more performance tuning parameters, please refer to [Configuration Parameters](../../../reference/config).
+
+## Sample Programs
+
+This section will introduce the sample programs to demonstrate how to write into TDengine with high performance.
+
+### Scenario
+
+Below are the scenario for the sample programs of high performance wrting.
+
+- Application program reads data from data source, the sample program simulates a data source by generating data
+- The speed of single writing thread is much slower than the speed of generating data, so the program starts multiple writing threads while each thread establish a connection to TDengine and each thread has a message queue of fixed size.
+- Application program maps the received data to different writing threads based on table name to make sure all the data for each table is always processed by a specific writing thread.
+- Each writing thread writes the received data into TDengine once the message queue becomes empty or the read data meets a threshold.
+
+![Thread Model of High Performance Writing into TDengine](highvolume.webp)
+
+### Sample Programs
+
+The sample programs listed in this section are based on the scenario described previously. If your scenarios is different, please try to adjust the code based on the principles described in this chapter.
+
+The sample programs assume the source data is for all the different sub tables in same super table (meters). The super table has been created before the sample program starts to writing data. Sub tables are created automatically according to received data. If there are multiple super tables in your case, please try to adjust the part of creating table automatically.
+
+
+
+
+**Program Inventory**
+
+| Class | Description |
+| ---------------- | ----------------------------------------------------------------------------------------------------- |
+| FastWriteExample | Main Program |
+| ReadTask | Read data from simulated data source and put into a queue according to the hash value of table name |
+| WriteTask | Read data from Queue, compose a wirte batch and write into TDengine |
+| MockDataSource | Generate data for some sub tables of super table meters |
+| SQLWriter | WriteTask uses this class to compose SQL, create table automatically, check SQL length and write data |
+| StmtWriter | Write in Parameter binding mode (Not finished yet) |
+| DataBaseMonitor | Calculate the writing speed and output on console every 10 seconds |
+
+Below is the list of complete code of the classes in above table and more detailed description.
+
+
+FastWriteExample
+The main Program is responsible for:
+
+1. Create message queues
+2. Start writing threads
+3. Start reading threads
+4. Otuput writing speed every 10 seconds
+
+The main program provides 4 parameters for tuning:
+
+1. The number of reading threads, default value is 1
+2. The number of writing threads, default alue is 2
+3. The total number of tables in the generated data, default value is 1000. These tables are distributed evenly across all writing threads. If the number of tables is very big, it will cost much time to firstly create these tables.
+4. The batch size of single write, default value is 3,000
+
+The capacity of message queue also impacts performance and can be tuned by modifying program. Normally it's always better to have a larger message queue. A larger message queue means lower possibility of being blocked when enqueueing and higher throughput. But a larger message queue consumes more memory space. The default value used in the sample programs is already big enoug.
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/FastWriteExample.java}}
+```
+
+
+
+
+ReadTask
+
+ReadTask reads data from data source. Each ReadTask is associated with a simulated data source, each data source generates data for a group of specific tables, and the data of any table is only generated from a single specific data source.
+
+ReadTask puts data in message queue in blocking mode. That means, the putting operation is blocked if the message queue is full.
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/ReadTask.java}}
+```
+
+
+
+
+WriteTask
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/WriteTask.java}}
+```
+
+
+
+
+
+MockDataSource
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/MockDataSource.java}}
+```
+
+
+
+
+
+SQLWriter
+
+SQLWriter class encapsulates the logic of composing SQL and writing data. Please be noted that the tables have not been created before writing, but are created automatically when catching the exception of table doesn't exist. For other exceptions caught, the SQL which caused the exception are logged for you to debug.
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java}}
+```
+
+
+
+
+
+DataBaseMonitor
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java}}
+```
+
+
+
+**Steps to Launch**
+
+
+Launch Java Sample Program
+
+You need to set environment variable `TDENGINE_JDBC_URL` before launching the program. If TDengine Server is setup on localhost, then the default value for user name, password and port can be used, like below:
+
+```
+TDENGINE_JDBC_URL="jdbc:TAOS://localhost:6030?user=root&password=taosdata"
+```
+
+**Launch in IDE**
+
+1. Clone TDengine repolitory
+ ```
+ git clone git@github.com:taosdata/TDengine.git --depth 1
+ ```
+2. Use IDE to open `docs/examples/java` directory
+3. Configure environment variable `TDENGINE_JDBC_URL`, you can also configure it before launching the IDE, if so you can skip this step.
+4. Run class `com.taos.example.highvolume.FastWriteExample`
+
+**Launch on server**
+
+If you want to launch the sample program on a remote server, please follow below steps:
+
+1. Package the sample programs. Execute below command under directory `TDengine/docs/examples/java` :
+ ```
+ mvn package
+ ```
+2. Create `examples/java` directory on the server
+ ```
+ mkdir -p examples/java
+ ```
+3. Copy dependencies (below commands assume you are working on a local Windows host and try to launch on a remote Linux host)
+ - Copy dependent packages
+ ```
+ scp -r .\target\lib @:~/examples/java
+ ```
+ - Copy the jar of sample programs
+ ```
+ scp -r .\target\javaexample-1.0.jar @:~/examples/java
+ ```
+4. Configure environment variable
+ Edit `~/.bash_profile` or `~/.bashrc` and add below:
+
+ ```
+ export TDENGINE_JDBC_URL="jdbc:TAOS://localhost:6030?user=root&password=taosdata"
+ ```
+
+ If your TDengine server is not deployed on localhost or doesn't use default port, you need to change the above URL to correct value in your environment.
+
+5. Launch the sample program
+
+ ```
+ java -classpath lib/*:javaexample-1.0.jar com.taos.example.highvolume.FastWriteExample
+ ```
+
+6. The sample program doesn't exit unless you press CTRL + C to terminate it.
+ Below is the output of running on a server of 16 cores, 64GB memory and SSD hard disk.
+
+ ```
+ root@vm85$ java -classpath lib/*:javaexample-1.0.jar com.taos.example.highvolume.FastWriteExample 2 12
+ 18:56:35.896 [main] INFO c.t.e.highvolume.FastWriteExample - readTaskCount=2, writeTaskCount=12 tableCount=1000 maxBatchSize=3000
+ 18:56:36.011 [WriteThread-0] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.015 [WriteThread-0] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.021 [WriteThread-1] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.022 [WriteThread-1] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.031 [WriteThread-2] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.032 [WriteThread-2] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.041 [WriteThread-3] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.042 [WriteThread-3] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.093 [WriteThread-4] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.094 [WriteThread-4] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.099 [WriteThread-5] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.100 [WriteThread-5] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.100 [WriteThread-6] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.101 [WriteThread-6] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.103 [WriteThread-7] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.104 [WriteThread-7] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.105 [WriteThread-8] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.107 [WriteThread-8] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.108 [WriteThread-9] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.109 [WriteThread-9] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.156 [WriteThread-10] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.157 [WriteThread-11] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.158 [WriteThread-10] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.158 [ReadThread-0] INFO com.taos.example.highvolume.ReadTask - started
+ 18:56:36.158 [ReadThread-1] INFO com.taos.example.highvolume.ReadTask - started
+ 18:56:36.158 [WriteThread-11] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:46.369 [main] INFO c.t.e.highvolume.FastWriteExample - count=18554448 speed=1855444
+ 18:56:56.946 [main] INFO c.t.e.highvolume.FastWriteExample - count=39059660 speed=2050521
+ 18:57:07.322 [main] INFO c.t.e.highvolume.FastWriteExample - count=59403604 speed=2034394
+ 18:57:18.032 [main] INFO c.t.e.highvolume.FastWriteExample - count=80262938 speed=2085933
+ 18:57:28.432 [main] INFO c.t.e.highvolume.FastWriteExample - count=101139906 speed=2087696
+ 18:57:38.921 [main] INFO c.t.e.highvolume.FastWriteExample - count=121807202 speed=2066729
+ 18:57:49.375 [main] INFO c.t.e.highvolume.FastWriteExample - count=142952417 speed=2114521
+ 18:58:00.689 [main] INFO c.t.e.highvolume.FastWriteExample - count=163650306 speed=2069788
+ 18:58:11.646 [main] INFO c.t.e.highvolume.FastWriteExample - count=185019808 speed=2136950
+ ```
+
+
+
+
+
+
+**Program Inventory**
+
+Sample programs in Python uses multi-process and cross-process message queues.
+
+| Function/CLass | Description |
+| ---------------------------- | --------------------------------------------------------------------------- |
+| main Function | Program entry point, create child processes and message queues |
+| run_monitor_process Function | Create database, super table, calculate writing speed and output to console |
+| run_read_task Function | Read data and distribute to message queues |
+| MockDataSource Class | Simulate data source, return next 1,000 rows of each table |
+| run_write_task Function | Read as much as possible data from message queue and write in batch |
+| SQLWriter Class | Write in SQL and create table utomatically |
+| StmtWriter Class | Write in parameter binding mode (not finished yet) |
+
+
+main function
+
+`main` function is responsible for creating message queues and fork child processes, there are 3 kinds of child processes:
+
+1. Monitoring process, initializes database and calculating writing speed
+2. Reading process (n), reads data from data source
+3. Writing process (m), wirtes data into TDengine
+
+`main` function provides 5 parameters:
+
+1. The number of reading tasks, default value is 1
+2. The number of writing tasks, default value is 1
+3. The number of tables, default value is 1,000
+4. The capacity of message queue, default value is 1,000,000 bytes
+5. The batch size in single write, default value is 3000
+
+```python
+{{#include docs/examples/python/fast_write_example.py:main}}
+```
+
+
+
+
+run_monitor_process
+
+Monitoring process initilizes database and monitoring writing speed.
+
+```python
+{{#include docs/examples/python/fast_write_example.py:monitor}}
+```
+
+
+
+
+
+run_read_task function
+
+Reading process reads data from other data system and distributes to the message queue allocated for it.
+
+```python
+{{#include docs/examples/python/fast_write_example.py:read}}
+```
+
+
+
+
+
+MockDataSource
+
+Below is the simulated data source, we assume table name exists in each generated data.
+
+```python
+{{#include docs/examples/python/mockdatasource.py}}
+```
+
+
+
+
+run_write_task function
+
+Writing process tries to read as much as possible data from message queue and writes in batch.
+
+```python
+{{#include docs/examples/python/fast_write_example.py:write}}
+```
+
+
+
+
+
+SQLWriter class encapsulates the logic of composing SQL and writing data. Please be noted that the tables have not been created before writing, but are created automatically when catching the exception of table doesn't exist. For other exceptions caught, the SQL which caused the exception are logged for you to debug. This class also checks the SQL length, if the SQL length is closed to `maxSQLLength` the SQL will be executed immediately. To improve writing efficiency, it's better to increase `maxSQLLength` properly.
+
+SQLWriter
+
+```python
+{{#include docs/examples/python/sql_writer.py}}
+```
+
+
+
+**Steps to Launch**
+
+
+
+Launch Sample Program in Python
+
+1. Prerequisities
+
+ - TDengine client driver has been installed
+ - Python3 has been installed, the the version >= 3.8
+ - TDengine Python connector `taospy` has been installed
+
+2. Install faster-fifo to replace python builtin multiprocessing.Queue
+
+ ```
+ pip3 install faster-fifo
+ ```
+
+3. Click the "Copy" in the above sample programs to copy `fast_write_example.py` 、 `sql_writer.py` and `mockdatasource.py`.
+
+4. Execute the program
+
+ ```
+ python3 fast_write_example.py
+ ```
+
+ Below is the output of running on a server of 16 cores, 64GB memory and SSD hard disk.
+
+ ```
+ root@vm85$ python3 fast_write_example.py 8 8
+ 2022-07-14 19:13:45,869 [root] - READ_TASK_COUNT=8, WRITE_TASK_COUNT=8, TABLE_COUNT=1000, QUEUE_SIZE=1000000, MAX_BATCH_SIZE=3000
+ 2022-07-14 19:13:48,882 [root] - WriteTask-0 started with pid 718347
+ 2022-07-14 19:13:48,883 [root] - WriteTask-1 started with pid 718348
+ 2022-07-14 19:13:48,884 [root] - WriteTask-2 started with pid 718349
+ 2022-07-14 19:13:48,884 [root] - WriteTask-3 started with pid 718350
+ 2022-07-14 19:13:48,885 [root] - WriteTask-4 started with pid 718351
+ 2022-07-14 19:13:48,885 [root] - WriteTask-5 started with pid 718352
+ 2022-07-14 19:13:48,886 [root] - WriteTask-6 started with pid 718353
+ 2022-07-14 19:13:48,886 [root] - WriteTask-7 started with pid 718354
+ 2022-07-14 19:13:48,887 [root] - ReadTask-0 started with pid 718355
+ 2022-07-14 19:13:48,888 [root] - ReadTask-1 started with pid 718356
+ 2022-07-14 19:13:48,889 [root] - ReadTask-2 started with pid 718357
+ 2022-07-14 19:13:48,889 [root] - ReadTask-3 started with pid 718358
+ 2022-07-14 19:13:48,890 [root] - ReadTask-4 started with pid 718359
+ 2022-07-14 19:13:48,891 [root] - ReadTask-5 started with pid 718361
+ 2022-07-14 19:13:48,892 [root] - ReadTask-6 started with pid 718364
+ 2022-07-14 19:13:48,893 [root] - ReadTask-7 started with pid 718365
+ 2022-07-14 19:13:56,042 [DataBaseMonitor] - count=6676310 speed=667631.0
+ 2022-07-14 19:14:06,196 [DataBaseMonitor] - count=20004310 speed=1332800.0
+ 2022-07-14 19:14:16,366 [DataBaseMonitor] - count=32290310 speed=1228600.0
+ 2022-07-14 19:14:26,527 [DataBaseMonitor] - count=44438310 speed=1214800.0
+ 2022-07-14 19:14:36,673 [DataBaseMonitor] - count=56608310 speed=1217000.0
+ 2022-07-14 19:14:46,834 [DataBaseMonitor] - count=68757310 speed=1214900.0
+ 2022-07-14 19:14:57,280 [DataBaseMonitor] - count=80992310 speed=1223500.0
+ 2022-07-14 19:15:07,689 [DataBaseMonitor] - count=93805310 speed=1281300.0
+ 2022-07-14 19:15:18,020 [DataBaseMonitor] - count=106111310 speed=1230600.0
+ 2022-07-14 19:15:28,356 [DataBaseMonitor] - count=118394310 speed=1228300.0
+ 2022-07-14 19:15:38,690 [DataBaseMonitor] - count=130742310 speed=1234800.0
+ 2022-07-14 19:15:49,000 [DataBaseMonitor] - count=143051310 speed=1230900.0
+ 2022-07-14 19:15:59,323 [DataBaseMonitor] - count=155276310 speed=1222500.0
+ 2022-07-14 19:16:09,649 [DataBaseMonitor] - count=167603310 speed=1232700.0
+ 2022-07-14 19:16:19,995 [DataBaseMonitor] - count=179976310 speed=1237300.0
+ ```
+
+
+
+:::note
+Don't establish connection to TDengine in the parent process if using Python connector in multi-process way, otherwise all the connections in child processes are blocked always. This is a known issue.
+
+:::
+
+
+
diff --git a/docs/en/07-develop/03-insert-data/highvolume.webp b/docs/en/07-develop/03-insert-data/highvolume.webp
new file mode 100644
index 0000000000000000000000000000000000000000..46dfc74ae3b0043c591ff930c62251da49cae7ad
Binary files /dev/null and b/docs/en/07-develop/03-insert-data/highvolume.webp differ
diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx
index ceeea64fca91473ea62de404fb9e92c179f7e6d4..17b3f5caa062eaacb4216b7153e899040e702cc1 100644
--- a/docs/en/07-develop/07-tmq.mdx
+++ b/docs/en/07-develop/07-tmq.mdx
@@ -16,7 +16,7 @@ import CDemo from "./_sub_c.mdx";
TDengine provides data subscription and consumption interfaces similar to message queue products. These interfaces make it easier for applications to obtain data written to TDengine either in real time and to process data in the order that events occurred. This simplifies your time-series data processing systems and reduces your costs because it is no longer necessary to deploy a message queue product such as Kafka.
-To use TDengine data subscription, you define topics like in Kafka. However, a topic in TDengine is based on query conditions for an existing supertable, standard table, or subtable - in other words, a SELECT statement. You can use SQL to filter data by tag, table name, column, or expression and then perform a scalar function or user-defined function on the data. Aggregate functions are not supported. This gives TDengine data subscription more flexibility than similar products. The granularity of data can be controlled on demand by applications, while filtering and preprocessing are handled by TDengine instead of the application layer. This implementation reduces the amount of data transmitted and the complexity of applications.
+To use TDengine data subscription, you define topics like in Kafka. However, a topic in TDengine is based on query conditions for an existing supertable, table, or subtable - in other words, a SELECT statement. You can use SQL to filter data by tag, table name, column, or expression and then perform a scalar function or user-defined function on the data. Aggregate functions are not supported. This gives TDengine data subscription more flexibility than similar products. The granularity of data can be controlled on demand by applications, while filtering and preprocessing are handled by TDengine instead of the application layer. This implementation reduces the amount of data transmitted and the complexity of applications.
By subscribing to a topic, a consumer can obtain the latest data in that topic in real time. Multiple consumers can be formed into a consumer group that consumes messages together. Consumer groups enable faster speed through multi-threaded, distributed data consumption. Note that consumers in different groups that are subscribed to the same topic do not consume messages together. A single consumer can subscribe to multiple topics. If the data in a supertable is sharded across multiple vnodes, consumer groups can consume it much more efficiently than single consumers. TDengine also includes an acknowledgement mechanism that ensures at-least-once delivery in complicated environments where machines may crash or restart.
diff --git a/docs/en/07-develop/08-cache.md b/docs/en/07-develop/08-cache.md
index 4892c21c9ddb97b3f967053ee64be24f8cb78c85..82a4787016f608f8e32e89b1747443b7cd164551 100644
--- a/docs/en/07-develop/08-cache.md
+++ b/docs/en/07-develop/08-cache.md
@@ -20,11 +20,11 @@ In theory, larger cache sizes are always better. However, at a certain point, it
## Read Cache
-When you create a database, you can configure whether the latest data from every subtable is cached. To do so, set the *cachelast* parameter as follows:
-- 0: Caching is disabled.
-- 1: The latest row of data in each subtable is cached. This option significantly improves the performance of the `LAST_ROW` function
-- 2: The latest non-null value in each column of each subtable is cached. This option significantly improves the performance of the `LAST` function in normal situations, such as WHERE, ORDER BY, GROUP BY, and INTERVAL statements.
-- 3: Rows and columns are both cached. This option is equivalent to simultaneously enabling options 1 and 2.
+When you create a database, you can configure whether the latest data from every subtable is cached. To do so, set the *cachemodel* parameter as follows:
+- none: Caching is disabled.
+- last_row: The latest row of data in each subtable is cached. This option significantly improves the performance of the `LAST_ROW` function
+- last_value: The latest non-null value in each column of each subtable is cached. This option significantly improves the performance of the `LAST` function in normal situations, such as WHERE, ORDER BY, GROUP BY, and INTERVAL statements.
+- both: Rows and columns are both cached. This option is equivalent to simultaneously enabling option last_row and last_value.
## Metadata Cache
diff --git a/docs/en/10-deployment/01-deploy.md b/docs/en/10-deployment/01-deploy.md
index bfbb547bd4177cba369ec9d3d2541bceed853ef0..a445b684dc4c1b65be2a82c66a7dcdc970e51e5b 100644
--- a/docs/en/10-deployment/01-deploy.md
+++ b/docs/en/10-deployment/01-deploy.md
@@ -114,7 +114,9 @@ The above process can be repeated to add more dnodes in the cluster.
Any node that is in the cluster and online can be the firstEp of new nodes.
Nodes use the firstEp parameter only when joining a cluster for the first time. After a node has joined the cluster, it stores the latest mnode in its end point list and no longer makes use of firstEp.
-However, firstEp is used by clients that connect to the cluster. For example, if you run `taos shell` without arguments, it connects to the firstEp by default.
+
+However, firstEp is used by clients that connect to the cluster. For example, if you run TDengine CLI `taos` without arguments, it connects to the firstEp by default.
+
Two dnodes that are launched without a firstEp value operate independently of each other. It is not possible to add one dnode to the other dnode and form a cluster. It is also not possible to form two independent clusters into a new cluster.
:::
diff --git a/docs/en/10-deployment/03-k8s.md b/docs/en/10-deployment/03-k8s.md
index b3f71ed5bd0e0dbaf3108cc40be6b18bdf5fb7e8..b0aa6777130864404e97dc332cf0e5ce830bf8ed 100644
--- a/docs/en/10-deployment/03-k8s.md
+++ b/docs/en/10-deployment/03-k8s.md
@@ -9,6 +9,7 @@ TDengine is a cloud-native time-series database that can be deployed on Kubernet
Before deploying TDengine on Kubernetes, perform the following:
+* Current steps are compatible with Kubernetes v1.5 and later version.
* Install and configure minikube, kubectl, and helm.
* Install and deploy Kubernetes and ensure that it can be accessed and used normally. Update any container registries or other services as necessary.
@@ -100,7 +101,7 @@ spec:
# Must set if you want a cluster.
- name: TAOS_FIRST_EP
value: "$(STS_NAME)-0.$(SERVICE_NAME).$(STS_NAMESPACE).svc.cluster.local:$(TAOS_SERVER_PORT)"
- # TAOS_FQND should always be setted in k8s env.
+ # TAOS_FQDN should always be set in k8s env.
- name: TAOS_FQDN
value: "$(POD_NAME).$(SERVICE_NAME).$(STS_NAMESPACE).svc.cluster.local"
volumeMounts:
diff --git a/docs/en/10-deployment/05-helm.md b/docs/en/10-deployment/05-helm.md
index 48cd9df32c16d346ceece01f01ee3880231427e7..302730f1b571ef12a2d523f22c418f2b9f5f99cd 100644
--- a/docs/en/10-deployment/05-helm.md
+++ b/docs/en/10-deployment/05-helm.md
@@ -170,71 +170,21 @@ taoscfg:
# number of replications, for cluster only
TAOS_REPLICA: "1"
-
- # number of days per DB file
- # TAOS_DAYS: "10"
-
- # number of days to keep DB file, default is 10 years.
- #TAOS_KEEP: "3650"
-
- # cache block size (Mbyte)
- #TAOS_CACHE: "16"
-
- # number of cache blocks per vnode
- #TAOS_BLOCKS: "6"
-
- # minimum rows of records in file block
- #TAOS_MIN_ROWS: "100"
-
- # maximum rows of records in file block
- #TAOS_MAX_ROWS: "4096"
-
#
- # TAOS_NUM_OF_THREADS_PER_CORE: number of threads per CPU core
- #TAOS_NUM_OF_THREADS_PER_CORE: "1.0"
+ # TAOS_NUM_OF_RPC_THREADS: number of threads for RPC
+ #TAOS_NUM_OF_RPC_THREADS: "2"
+
#
# TAOS_NUM_OF_COMMIT_THREADS: number of threads to commit cache data
#TAOS_NUM_OF_COMMIT_THREADS: "4"
- #
- # TAOS_RATIO_OF_QUERY_CORES:
- # the proportion of total CPU cores available for query processing
- # 2.0: the query threads will be set to double of the CPU cores.
- # 1.0: all CPU cores are available for query processing [default].
- # 0.5: only half of the CPU cores are available for query.
- # 0.0: only one core available.
- #TAOS_RATIO_OF_QUERY_CORES: "1.0"
-
- #
- # TAOS_KEEP_COLUMN_NAME:
- # the last_row/first/last aggregator will not change the original column name in the result fields
- #TAOS_KEEP_COLUMN_NAME: "0"
-
- # enable/disable backuping vnode directory when removing vnode
- #TAOS_VNODE_BAK: "1"
-
# enable/disable installation / usage report
#TAOS_TELEMETRY_REPORTING: "1"
- # enable/disable load balancing
- #TAOS_BALANCE: "1"
-
- # max timer control blocks
- #TAOS_MAX_TMR_CTRL: "512"
-
# time interval of system monitor, seconds
#TAOS_MONITOR_INTERVAL: "30"
- # number of seconds allowed for a dnode to be offline, for cluster only
- #TAOS_OFFLINE_THRESHOLD: "8640000"
-
- # RPC re-try timer, millisecond
- #TAOS_RPC_TIMER: "1000"
-
- # RPC maximum time for ack, seconds.
- #TAOS_RPC_MAX_TIME: "600"
-
# time interval of dnode status reporting to mnode, seconds, for cluster only
#TAOS_STATUS_INTERVAL: "1"
@@ -245,37 +195,7 @@ taoscfg:
#TAOS_MIN_SLIDING_TIME: "10"
# minimum time window, milli-second
- #TAOS_MIN_INTERVAL_TIME: "10"
-
- # maximum delay before launching a stream computation, milli-second
- #TAOS_MAX_STREAM_COMP_DELAY: "20000"
-
- # maximum delay before launching a stream computation for the first time, milli-second
- #TAOS_MAX_FIRST_STREAM_COMP_DELAY: "10000"
-
- # retry delay when a stream computation fails, milli-second
- #TAOS_RETRY_STREAM_COMP_DELAY: "10"
-
- # the delayed time for launching a stream computation, from 0.1(default, 10% of whole computing time window) to 0.9
- #TAOS_STREAM_COMP_DELAY_RATIO: "0.1"
-
- # max number of vgroups per db, 0 means configured automatically
- #TAOS_MAX_VGROUPS_PER_DB: "0"
-
- # max number of tables per vnode
- #TAOS_MAX_TABLES_PER_VNODE: "1000000"
-
- # the number of acknowledgments required for successful data writing
- #TAOS_QUORUM: "1"
-
- # enable/disable compression
- #TAOS_COMP: "2"
-
- # write ahead log (WAL) level, 0: no wal; 1: write wal, but no fysnc; 2: write wal, and call fsync
- #TAOS_WAL_LEVEL: "1"
-
- # if walLevel is set to 2, the cycle of fsync being executed, if set to 0, fsync is called right away
- #TAOS_FSYNC: "3000"
+ #TAOS_MIN_INTERVAL_TIME: "1"
# the compressed rpc message, option:
# -1 (no compression)
@@ -283,17 +203,8 @@ taoscfg:
# > 0 (rpc message body which larger than this value will be compressed)
#TAOS_COMPRESS_MSG_SIZE: "-1"
- # max length of an SQL
- #TAOS_MAX_SQL_LENGTH: "1048576"
-
- # the maximum number of records allowed for super table time sorting
- #TAOS_MAX_NUM_OF_ORDERED_RES: "100000"
-
# max number of connections allowed in dnode
- #TAOS_MAX_SHELL_CONNS: "5000"
-
- # max number of connections allowed in client
- #TAOS_MAX_CONNECTIONS: "5000"
+ #TAOS_MAX_SHELL_CONNS: "50000"
# stop writing logs when the disk size of the log folder is less than this value
#TAOS_MINIMAL_LOG_DIR_G_B: "0.1"
@@ -313,21 +224,8 @@ taoscfg:
# enable/disable system monitor
#TAOS_MONITOR: "1"
- # enable/disable recording the SQL statements via restful interface
- #TAOS_HTTP_ENABLE_RECORD_SQL: "0"
-
- # number of threads used to process http requests
- #TAOS_HTTP_MAX_THREADS: "2"
-
- # maximum number of rows returned by the restful interface
- #TAOS_RESTFUL_ROW_LIMIT: "10240"
-
- # The following parameter is used to limit the maximum number of lines in log files.
- # max number of lines per log filters
- # numOfLogLines 10000000
-
# enable/disable async log
- #TAOS_ASYNC_LOG: "0"
+ #TAOS_ASYNC_LOG: "1"
#
# time of keeping log files, days
@@ -344,25 +242,8 @@ taoscfg:
# debug flag for all log type, take effect when non-zero value\
#TAOS_DEBUG_FLAG: "143"
- # enable/disable recording the SQL in taos client
- #TAOS_ENABLE_RECORD_SQL: "0"
-
# generate core file when service crash
#TAOS_ENABLE_CORE_FILE: "1"
-
- # maximum display width of binary and nchar fields in the shell. The parts exceeding this limit will be hidden
- #TAOS_MAX_BINARY_DISPLAY_WIDTH: "30"
-
- # enable/disable stream (continuous query)
- #TAOS_STREAM: "1"
-
- # in retrieve blocking model, only in 50% query threads will be used in query processing in dnode
- #TAOS_RETRIEVE_BLOCKING_MODEL: "0"
-
- # the maximum allowed query buffer size in MB during query processing for each data node
- # -1 no limit (default)
- # 0 no query allowed, queries are disabled
- #TAOS_QUERY_BUFFER_SIZE: "-1"
```
## Scaling Out
diff --git a/docs/en/12-taos-sql/01-data-type.md b/docs/en/12-taos-sql/01-data-type.md
index b830994ac9323f85d9ca68a40366edd9f2da1432..876de50f35ee3ba533bd7d5916632de853a84c0e 100644
--- a/docs/en/12-taos-sql/01-data-type.md
+++ b/docs/en/12-taos-sql/01-data-type.md
@@ -11,7 +11,7 @@ When using TDengine to store and query data, the most important part of the data
- The format must be `YYYY-MM-DD HH:mm:ss.MS`, the default time precision is millisecond (ms), for example `2017-08-12 18:25:58.128`
- Internal function `now` can be used to get the current timestamp on the client side
- The current timestamp of the client side is applied when `now` is used to insert data
-- Epoch Time:timestamp can also be a long integer number, which means the number of seconds, milliseconds or nanoseconds, depending on the time precision, from 1970-01-01 00:00:00.000 (UTC/GMT)
+- Epoch Time:timestamp can also be a long integer number, which means the number of seconds, milliseconds or nanoseconds, depending on the time precision, from UTC 1970-01-01 00:00:00.
- Add/subtract operations can be carried out on timestamps. For example `now-2h` means 2 hours prior to the time at which query is executed. The units of time in operations can be b(nanosecond), u(microsecond), a(millisecond), s(second), m(minute), h(hour), d(day), or w(week). So `select * from t1 where ts > now-2w and ts <= now-1w` means the data between two weeks ago and one week ago. The time unit can also be n (calendar month) or y (calendar year) when specifying the time window for down sampling operations.
Time precision in TDengine can be set by the `PRECISION` parameter when executing `CREATE DATABASE`. The default time precision is millisecond. In the statement below, the precision is set to nanonseconds.
diff --git a/docs/en/12-taos-sql/03-table.md b/docs/en/12-taos-sql/03-table.md
index bf32cf171bbeea23ada946d5011a73dd70ddd6ca..5a2c8ed6ee4a5ea129023fec68fa97d577832f60 100644
--- a/docs/en/12-taos-sql/03-table.md
+++ b/docs/en/12-taos-sql/03-table.md
@@ -57,7 +57,7 @@ table_option: {
3. MAX_DELAY: specifies the maximum latency for pushing computation results. The default value is 15 minutes or the value of the INTERVAL parameter, whichever is smaller. Enter a value between 0 and 15 minutes in milliseconds, seconds, or minutes. You can enter multiple values separated by commas (,). Note: Retain the default value if possible. Configuring a small MAX_DELAY may cause results to be frequently pushed, affecting storage and query performance. This parameter applies only to supertables and takes effect only when the RETENTIONS parameter has been specified for the database.
4. ROLLUP: specifies aggregate functions to roll up. Rolling up a function provides downsampled results based on multiple axes. This parameter applies only to supertables and takes effect only when the RETENTIONS parameter has been specified for the database. You can specify only one function to roll up. The rollup takes effect on all columns except TS. Enter one of the following values: avg, sum, min, max, last, or first.
5. SMA: specifies functions on which to enable small materialized aggregates (SMA). SMA is user-defined precomputation of aggregates based on data blocks. Enter one of the following values: max, min, or sum This parameter can be used with supertables and standard tables.
-6. TTL: specifies the time to live (TTL) for the table. If the period specified by the TTL parameter elapses without any data being written to the table, TDengine will automatically delete the table. Note: The system may not delete the table at the exact moment that the TTL expires. Enter a value in days. The default value is 0. Note: The TTL parameter has a higher priority than the KEEP parameter. If a table is marked for deletion because the TTL has expired, it will be deleted even if the time specified by the KEEP parameter has not elapsed. This parameter can be used with standard tables and subtables.
+6. TTL: specifies the time to live (TTL) for the table. If TTL is specified when creatinga table, after the time period for which the table has been existing is over TTL, TDengine will automatically delete the table. Please be noted that the system may not delete the table at the exact moment that the TTL expires but guarantee there is such a system and finally the table will be deleted. The unit of TTL is in days. The default value is 0, i.e. never expire.
## Create Subtables
diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md
index 439205696b3012c17865898d50635ee0fed580ab..1dd0caed38235d3d10813b2cd74fec6446c5ec24 100644
--- a/docs/en/12-taos-sql/06-select.md
+++ b/docs/en/12-taos-sql/06-select.md
@@ -171,8 +171,8 @@ The \_QSTART and \_QEND pseudocolumns contain the beginning and end of the time
The \_QSTART and \_QEND pseudocolumns cannot be used in a WHERE clause.
-**\_WSTART, \_WEND, and \_DURATION**
-\_WSTART, \_WEND, and \_WDURATION pseudocolumns
+**\_WSTART, \_WEND, and \_WDURATION**
+
The \_WSTART, \_WEND, and \_WDURATION pseudocolumns indicate the beginning, end, and duration of a window.
These pseudocolumns can be used only in time window-based aggregations and must occur after the aggregation clause.
diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md
index 36043e745664f6871fae7a4bb4a58d0f3fb010a4..d6905c84a11ecf1f827ad239076ad5d4c93f8e3e 100644
--- a/docs/en/12-taos-sql/10-function.md
+++ b/docs/en/12-taos-sql/10-function.md
@@ -846,7 +846,7 @@ SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause];
### INTERP
```sql
-SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] [ RANGE(timestamp1,timestamp2) ] [EVERY(interval)] [FILL ({ VALUE | PREV | NULL | LINEAR | NEXT})];
+SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] RANGE(timestamp1,timestamp2) EVERY(interval) FILL({ VALUE | PREV | NULL | LINEAR | NEXT});
```
**Description**: The value that matches the specified timestamp range is returned, if existing; or an interpolation value is returned.
@@ -861,11 +861,10 @@ SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] [
- `INTERP` is used to get the value that matches the specified time slice from a column. If no such value exists an interpolation value will be returned based on `FILL` parameter.
- The input data of `INTERP` is the value of the specified column and a `where` clause can be used to filter the original data. If no `where` condition is specified then all original data is the input.
-- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1<=timestamp2. timestamp1 is the starting point of the output time range and must be specified. timestamp2 is the ending point of the output time range and must be specified. If `RANGE` is not specified, then the timestamp of the first row that matches the filter condition is treated as timestamp1, the timestamp of the last row that matches the filter condition is treated as timestamp2.
-- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY`. Starting from timestamp1, one interpolation is performed for every time interval specified `EVERY` parameter. If `EVERY` parameter is not used, the time windows will be considered as no ending timestamp, i.e. there is only one time window from timestamp1.
-- Interpolation is performed based on `FILL` parameter. No interpolation is performed if `FILL` is not used, that means either the original data that matches is returned or nothing is returned.
-- `INTERP` can only be used to interpolate in single timeline. So it must be used with `group by tbname` when it's used on a STable. It can't be used with `GROUP BY` when it's used in the inner query of a nested query.
-- The result of `INTERP` is not influenced by `ORDER BY TIMESTAMP`, which impacts the output order only..
+- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1<=timestamp2. timestamp1 is the starting point of the output time range and must be specified. timestamp2 is the ending point of the output time range and must be specified.
+- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY`. Starting from timestamp1, one interpolation is performed for every time interval specified `EVERY` parameter.
+- Interpolation is performed based on `FILL` parameter.
+- `INTERP` can only be used to interpolate in single timeline. So it must be used with `partition by tbname` when it's used on a STable.
### LAST
@@ -1140,7 +1139,7 @@ SELECT STATECOUNT(field_name, oper, val) FROM { tb_name | stb_name } [WHERE clau
**Applicable parameter values**:
-- oper : Can be one of `LT` (lower than), `GT` (greater than), `LE` (lower than or equal to), `GE` (greater than or equal to), `NE` (not equal to), `EQ` (equal to), the value is case insensitive
+- oper : Can be one of `'LT'` (lower than), `'GT'` (greater than), `'LE'` (lower than or equal to), `'GE'` (greater than or equal to), `'NE'` (not equal to), `'EQ'` (equal to), the value is case insensitive, the value must be in quotes.
- val : Numeric types
**Return value type**: Integer
@@ -1167,7 +1166,7 @@ SELECT stateDuration(field_name, oper, val, unit) FROM { tb_name | stb_name } [W
**Applicable parameter values**:
-- oper : Can be one of `LT` (lower than), `GT` (greater than), `LE` (lower than or equal to), `GE` (greater than or equal to), `NE` (not equal to), `EQ` (equal to), the value is case insensitive
+- oper : Can be one of `'LT'` (lower than), `'GT'` (greater than), `'LE'` (lower than or equal to), `'GE'` (greater than or equal to), `'NE'` (not equal to), `'EQ'` (equal to), the value is case insensitive, the value must be in quotes.
- val : Numeric types
- unit: The unit of time interval. Enter one of the following options: 1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks) If you do not enter a unit of time, the precision of the current database is used by default.
@@ -1232,7 +1231,7 @@ SELECT SERVER_VERSION();
### SERVER_STATUS
```sql
-SELECT SERVER_VERSION();
+SELECT SERVER_STATUS();
```
**Description**: The server status.
diff --git a/docs/en/12-taos-sql/12-distinguished.md b/docs/en/12-taos-sql/12-distinguished.md
index 7390fe983f0dff7476f606f9989aae8f73c52c0e..707089abe54fc12bb09de47c1c51af1a32b8cbcd 100644
--- a/docs/en/12-taos-sql/12-distinguished.md
+++ b/docs/en/12-taos-sql/12-distinguished.md
@@ -58,6 +58,15 @@ The following restrictions apply:
- The window clause cannot be used with a GROUP BY clause.
- `WHERE` clause can be used to specify the starting and ending time and other filter conditions
+
+### Window Pseudocolumns
+
+**\_WSTART, \_WEND, and \_WDURATION**
+
+The \_WSTART, \_WEND, and \_WDURATION pseudocolumns indicate the beginning, end, and duration of a window.
+
+These pseudocolumns occur after the aggregation clause.
+
### FILL Clause
`FILL` clause is used to specify how to fill when there is data missing in any window, including:
diff --git a/docs/en/12-taos-sql/19-limit.md b/docs/en/12-taos-sql/19-limit.md
index 0486ea30940cdcb5d034bb730d12c0c120a59cd1..678c38a22ea763187cd0c87dceae3bf6ca03957c 100644
--- a/docs/en/12-taos-sql/19-limit.md
+++ b/docs/en/12-taos-sql/19-limit.md
@@ -30,7 +30,7 @@ The following characters cannot occur in a password: single quotation marks ('),
- Maximum number of columns is 4096. There must be at least 2 columns, and the first column must be timestamp.
- The maximum length of a tag name is 64 bytes
- Maximum number of tags is 128. There must be at least 1 tag. The total length of tag values cannot exceed 16 KB.
-- Maximum length of single SQL statement is 1 MB (1048576 bytes). It can be configured in the parameter `maxSQLLength` in the client side, the applicable range is [65480, 1048576].
+- Maximum length of single SQL statement is 1 MB (1048576 bytes).
- At most 4096 columns can be returned by `SELECT`. Functions in the query statement constitute columns. An error is returned if the limit is exceeded.
- Maximum numbers of databases, STables, tables are dependent only on the system resources.
- The number of replicas can only be 1 or 3.
diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md
index 96503c95989b4ae2e99fa0c38181a74232e6dc23..c9adb0cf782d1da63a8f9654f6c89b02a60a7cb7 100644
--- a/docs/en/12-taos-sql/24-show.md
+++ b/docs/en/12-taos-sql/24-show.md
@@ -3,7 +3,7 @@ sidebar_label: SHOW Statement
title: SHOW Statement for Metadata
---
-In addition to running SELECT statements on INFORMATION_SCHEMA, you can also use SHOW to obtain system metadata, information, and status.
+`SHOW` command can be used to get brief system information. To get details about metatadata, information, and status in the system, please use `select` to query the tables in database `INFORMATION_SCHEMA`.
## SHOW ACCOUNTS
@@ -194,7 +194,7 @@ Shows information about streams in the system.
SHOW SUBSCRIPTIONS;
```
-Shows all subscriptions in the current database.
+Shows all subscriptions in the system.
## SHOW TABLES
diff --git a/docs/en/13-operation/01-pkg-install.md b/docs/en/13-operation/01-pkg-install.md
index 24ef518f5c5b087567c7801b3cd6f8d34257eb1f..d7713b943f5fe8fbd5e685b8ba03ff8cc8ed4e53 100644
--- a/docs/en/13-operation/01-pkg-install.md
+++ b/docs/en/13-operation/01-pkg-install.md
@@ -15,9 +15,41 @@ About details of installing TDenine, please refer to [Installation Guide](../../
## Uninstall
-
+
+
+Apt-get package of TDengine can be uninstalled as below:
+
+```bash
+$ sudo apt-get remove tdengine
+Reading package lists... Done
+Building dependency tree
+Reading state information... Done
+The following packages will be REMOVED:
+ tdengine
+0 upgraded, 0 newly installed, 1 to remove and 18 not upgraded.
+After this operation, 68.3 MB disk space will be freed.
+Do you want to continue? [Y/n] y
+(Reading database ... 135625 files and directories currently installed.)
+Removing tdengine (3.0.0.0) ...
+TDengine is removed successfully!
+
+```
+
+Apt-get package of taosTools can be uninstalled as below:
-TBD
+```
+$ sudo apt remove taostools
+Reading package lists... Done
+Building dependency tree
+Reading state information... Done
+The following packages will be REMOVED:
+ taostools
+0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+After this operation, 68.3 MB disk space will be freed.
+Do you want to continue? [Y/n]
+(Reading database ... 147973 files and directories currently installed.)
+Removing taostools (2.1.2) ...
+```
@@ -32,6 +64,14 @@ TDengine is removed successfully!
```
+Deb package of taosTools can be uninstalled as below:
+
+```
+$ sudo dpkg -r taostools
+(Reading database ... 147973 files and directories currently installed.)
+Removing taostools (2.1.2) ...
+```
+
@@ -43,6 +83,13 @@ $ sudo rpm -e tdengine
TDengine is removed successfully!
```
+RPM package of taosTools can be uninstalled as below:
+
+```
+sudo rpm -e taostools
+taosToole is removed successfully!
+```
+
@@ -54,6 +101,15 @@ $ rmtaos
TDengine is removed successfully!
```
+tar.gz package of taosTools can be uninstalled as below:
+
+```
+$ rmtaostools
+Start to uninstall taos tools ...
+
+taos tools is uninstalled successfully!
+```
+
Run C:\TDengine\unins000.exe to uninstall TDengine on a Windows system.
diff --git a/docs/en/13-operation/03-tolerance.md b/docs/en/13-operation/03-tolerance.md
index ba9d5d75e3415ba0a7a4e1c579327b9f73e2a48f..21a5a902822d7b85f555114a112686d4e35c64aa 100644
--- a/docs/en/13-operation/03-tolerance.md
+++ b/docs/en/13-operation/03-tolerance.md
@@ -27,4 +27,4 @@ The number of dnodes in a TDengine cluster must NOT be lower than the number of
As long as the dnodes of a TDengine cluster are deployed on different physical machines and the replica number is higher than 1, high availability can be achieved without any other assistance. For disaster recovery, dnodes of a TDengine cluster should be deployed in geographically different data centers.
-Alternatively, you can use taosX to synchronize the data from one TDengine cluster to another cluster in a remote location. For more information, see [taosX](../../reference/taosX).
+Alternatively, you can use taosX to synchronize the data from one TDengine cluster to another cluster in a remote location. However, taosX is only available in TDengine enterprise version, for more information please contact tdengine.com.
diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx
index 8d4186a36bb983e688ae2824f13c71f4461bebf2..74ba78b7fc1115f074ae6d8c3aa7723bce984f86 100644
--- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx
+++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx
@@ -10,7 +10,7 @@ One difference from the native connector is that the REST interface is stateless
## Installation
-The REST interface does not rely on any TDengine native library, so the client application does not need to install any TDengine libraries. The client application's development language only needs to support the HTTP protocol.
+The REST interface does not rely on any TDengine native library, so the client application does not need to install any TDengine libraries. The client application's development language only needs to support the HTTP protocol. The REST interface is provided by [taosAdapter](../taosadapter), to use REST interface you need to make sure `taosAdapter` is running properly.
## Verification
diff --git a/docs/en/14-reference/03-connector/cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/cpp.mdx
rename to docs/en/14-reference/03-connector/03-cpp.mdx
index 5839ed4af89723dcee5e80c186af25a90ae59972..02d7df48db540a3eb44379ada7332b2838924212 100644
--- a/docs/en/14-reference/03-connector/cpp.mdx
+++ b/docs/en/14-reference/03-connector/03-cpp.mdx
@@ -1,5 +1,4 @@
---
-sidebar_position: 1
sidebar_label: C/C++
title: C/C++ Connector
---
diff --git a/docs/en/14-reference/03-connector/java.mdx b/docs/en/14-reference/03-connector/04-java.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/java.mdx
rename to docs/en/14-reference/03-connector/04-java.mdx
index 39514c37ebf45974ad90b1b7b1e548c8cd4ea672..0f977393f123ba90451924ca280b30316fc84dc0 100644
--- a/docs/en/14-reference/03-connector/java.mdx
+++ b/docs/en/14-reference/03-connector/04-java.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 2
sidebar_label: Java
title: TDengine Java Connector
description: The TDengine Java Connector is implemented on the standard JDBC API and provides native and REST connectors.
diff --git a/docs/en/14-reference/03-connector/go.mdx b/docs/en/14-reference/03-connector/05-go.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/go.mdx
rename to docs/en/14-reference/03-connector/05-go.mdx
index 29263550403e71614296e52285c956040b04387f..00e3bc1bc38bb7433e823642202957abbdf5566c 100644
--- a/docs/en/14-reference/03-connector/go.mdx
+++ b/docs/en/14-reference/03-connector/05-go.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 4
sidebar_label: Go
title: TDengine Go Connector
---
diff --git a/docs/en/14-reference/03-connector/rust.mdx b/docs/en/14-reference/03-connector/06-rust.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/rust.mdx
rename to docs/en/14-reference/03-connector/06-rust.mdx
index e9b16ba94d1db27d0571aad24d04492aeea32fb8..1184c98a287cac8a214aff67ace01f7a836940e5 100644
--- a/docs/en/14-reference/03-connector/rust.mdx
+++ b/docs/en/14-reference/03-connector/06-rust.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 5
sidebar_label: Rust
title: TDengine Rust Connector
---
diff --git a/docs/en/14-reference/03-connector/python.mdx b/docs/en/14-reference/03-connector/07-python.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/python.mdx
rename to docs/en/14-reference/03-connector/07-python.mdx
index 1a15da62d6cd94a95b62208cdf76ab6b5df1230a..fc95033baada48e7f322a06d00cede16fb827c51 100644
--- a/docs/en/14-reference/03-connector/python.mdx
+++ b/docs/en/14-reference/03-connector/07-python.mdx
@@ -1,5 +1,4 @@
---
-sidebar_position: 3
sidebar_label: Python
title: TDengine Python Connector
description: "taospy is the official Python connector for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. tasopy wraps both the native and REST interfaces of TDengine, corresponding to the two submodules of tasopy: taos and taosrest. In addition to wrapping the native and REST interfaces, taospy also provides a programming interface that conforms to the Python Data Access Specification (PEP 249), making it easy to integrate taospy with many third-party tools, such as SQLAlchemy and pandas."
@@ -150,10 +149,19 @@ If the test is successful, it will output the server version information, e.g.
```json
{
- "status": "succ",
- "head": ["server_version()"],
- "column_meta": [["server_version()", 8, 8]],
- "data": [["2.4.0.16"]],
+ "code": 0,
+ "column_meta": [
+ [
+ "server_version()",
+ "VARCHAR",
+ 7
+ ]
+ ],
+ "data": [
+ [
+ "3.0.0.0"
+ ]
+ ],
"rows": 1
}
```
diff --git a/docs/en/14-reference/03-connector/node.mdx b/docs/en/14-reference/03-connector/08-node.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/node.mdx
rename to docs/en/14-reference/03-connector/08-node.mdx
index d1700444351d6f54f799a1c84674735800959c3c..f93632b4171a0b563a17f80533d3ede4c76e4425 100644
--- a/docs/en/14-reference/03-connector/node.mdx
+++ b/docs/en/14-reference/03-connector/08-node.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 6
sidebar_label: Node.js
title: TDengine Node.js Connector
---
diff --git a/docs/en/14-reference/03-connector/csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/csharp.mdx
rename to docs/en/14-reference/03-connector/09-csharp.mdx
index 388ae49d09e1ee8a7e0f012432d9bbb98da3fc45..c745b8dd1ad829171a667eef653d5dfc7490241a 100644
--- a/docs/en/14-reference/03-connector/csharp.mdx
+++ b/docs/en/14-reference/03-connector/09-csharp.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 7
sidebar_label: C#
title: C# Connector
---
diff --git a/docs/en/14-reference/03-connector/php.mdx b/docs/en/14-reference/03-connector/10-php.mdx
similarity index 99%
rename from docs/en/14-reference/03-connector/php.mdx
rename to docs/en/14-reference/03-connector/10-php.mdx
index 9ee89d468a2fd86381b3521796886813c0fe6b06..820f70375982eb54cdd87602b891e5f04756c0e5 100644
--- a/docs/en/14-reference/03-connector/php.mdx
+++ b/docs/en/14-reference/03-connector/10-php.mdx
@@ -1,5 +1,4 @@
---
-sidebar_position: 1
sidebar_label: PHP
title: PHP Connector
---
diff --git a/docs/en/14-reference/03-connector/03-connector.mdx b/docs/en/14-reference/03-connector/index.mdx
similarity index 100%
rename from docs/en/14-reference/03-connector/03-connector.mdx
rename to docs/en/14-reference/03-connector/index.mdx
diff --git a/docs/en/14-reference/04-taosadapter.md b/docs/en/14-reference/04-taosadapter.md
index 31310b0f3e4f6fae7e65328baf4f9ad5d8b7b22f..e7ea620d0bed3aee3ff0acf8063120acca33c335 100644
--- a/docs/en/14-reference/04-taosadapter.md
+++ b/docs/en/14-reference/04-taosadapter.md
@@ -329,4 +329,4 @@ In TDengine server 2.2.x.x or earlier, the TDengine server process (taosd) conta
| 3 | telegrafUseFieldNum | See the taosAdapter telegraf configuration method | |
| 4 | restfulRowLimit | restfulRowLimit | Embedded httpd outputs 10240 rows of data by default, the maximum allowed is 102400. taosAdapter also provides restfulRowLimit but it is not limited by default. You can configure it according to the actual scenario.
| 5 | httpDebugFlag | Not applicable | httpdDebugFlag does not work for taosAdapter |
-| 6 | httpDBNameMandatory | N/A | taosAdapter requires the database name to be specified in the URL |
\ No newline at end of file
+| 6 | httpDBNameMandatory | N/A | taosAdapter requires the database name to be specified in the URL |
diff --git a/docs/en/14-reference/11-docker/index.md b/docs/en/14-reference/11-docker/index.md
index 3528fd194b0dd40b2bf67dd3e05a42d93a47ab05..be1d72ff9c7aeb729bbc3f58e4d622c8cdd358b4 100644
--- a/docs/en/14-reference/11-docker/index.md
+++ b/docs/en/14-reference/11-docker/index.md
@@ -72,7 +72,7 @@ Next, ensure the hostname "tdengine" is resolvable in `/etc/hosts`.
echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts
```
-Finally, the TDengine service can be accessed from the taos shell or any connector with "tdengine" as the server address.
+Finally, the TDengine service can be accessed from the TDengine CLI or any connector with "tdengine" as the server address.
```shell
taos -h tdengine -P 6030
@@ -115,7 +115,7 @@ If you want to start your application in a container, you need to add the corres
```docker
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y wget
-ENV TDENGINE_VERSION=2.4.0.0
+ENV TDENGINE_VERSION=3.0.0.0
RUN wget -c https://www.taosdata.com/assets-download/TDengine-client-${TDENGINE_VERSION}-Linux-x64.tar.gz \
&& tar xvf TDengine-client-${TDENGINE_VERSION}-Linux-x64.tar.gz \
&& cd TDengine-client-${TDENGINE_VERSION} \
@@ -216,7 +216,7 @@ Here is the full Dockerfile:
```docker
FROM golang:1.17.6-buster as builder
-ENV TDENGINE_VERSION=2.4.0.0
+ENV TDENGINE_VERSION=3.0.0.0
RUN wget -c https://www.taosdata.com/assets-download/TDengine-client-${TDENGINE_VERSION}-Linux-x64.tar.gz \
&& tar xvf TDengine-client-${TDENGINE_VERSION}-Linux-x64.tar.gz \
&& cd TDengine-client-${TDENGINE_VERSION} \
@@ -232,7 +232,7 @@ RUN go build
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y wget
-ENV TDENGINE_VERSION=2.4.0.0
+ENV TDENGINE_VERSION=3.0.0.0
RUN wget -c https://www.taosdata.com/assets-download/TDengine-client-${TDENGINE_VERSION}-Linux-x64.tar.gz \
&& tar xvf TDengine-client-${TDENGINE_VERSION}-Linux-x64.tar.gz \
&& cd TDengine-client-${TDENGINE_VERSION} \
@@ -320,7 +320,7 @@ password: taosdata
2. Start the cluster
```shell
- $ VERSION=2.4.0.0 docker-compose up -d
+ $ VERSION=3.0.0.0 docker-compose up -d
Creating network "test_default" with the default driver
Creating volume "test_taosdata-td1" with default driver
Creating volume "test_taoslog-td1" with default driver
@@ -457,7 +457,7 @@ If you want to deploy a container-based TDengine cluster on multiple hosts, you
The docker-compose file can refer to the previous section. Here is the command to start TDengine with docker swarm:
```shell
-$ VERSION=2.4.0 docker stack deploy -c docker-compose.yml taos
+$ VERSION=3.0.0.0 docker stack deploy -c docker-compose.yml taos
Creating network taos_inter
Creating network taos_api
Creating service taos_arbitrator
@@ -473,20 +473,20 @@ Checking status:
$ docker stack ps taos
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
79ni8temw59n taos_nginx.1 nginx:latest TM1701 Running Running about a minute ago
-3e94u72msiyg taos_adapter.1 tdengine/tdengine:2.4.0 TM1702 Running Running 56 seconds ago
-100amjkwzsc6 taos_td-2.1 tdengine/tdengine:2.4.0 TM1703 Running Running about a minute ago
-pkjehr2vvaaa taos_td-1.1 tdengine/tdengine:2.4.0 TM1704 Running Running 2 minutes ago
-tpzvgpsr1qkt taos_arbitrator.1 tdengine/tdengine:2.4.0 TM1705 Running Running 2 minutes ago
-rvss3g5yg6fa taos_adapter.2 tdengine/tdengine:2.4.0 TM1706 Running Running 56 seconds ago
-i2augxamfllf taos_adapter.3 tdengine/tdengine:2.4.0 TM1707 Running Running 56 seconds ago
-lmjyhzccpvpg taos_adapter.4 tdengine/tdengine:2.4.0 TM1708 Running Running 56 seconds ago
+3e94u72msiyg taos_adapter.1 tdengine/tdengine:3.0.0.0 TM1702 Running Running 56 seconds ago
+100amjkwzsc6 taos_td-2.1 tdengine/tdengine:3.0.0.0 TM1703 Running Running about a minute ago
+pkjehr2vvaaa taos_td-1.1 tdengine/tdengine:3.0.0.0 TM1704 Running Running 2 minutes ago
+tpzvgpsr1qkt taos_arbitrator.1 tdengine/tdengine:3.0.0.0 TM1705 Running Running 2 minutes ago
+rvss3g5yg6fa taos_adapter.2 tdengine/tdengine:3.0.0.0 TM1706 Running Running 56 seconds ago
+i2augxamfllf taos_adapter.3 tdengine/tdengine:3.0.0.0 TM1707 Running Running 56 seconds ago
+lmjyhzccpvpg taos_adapter.4 tdengine/tdengine:3.0.0.0 TM1708 Running Running 56 seconds ago
$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
-561t4lu6nfw6 taos_adapter replicated 4/4 tdengine/tdengine:2.4.0
-3hk5ct3q90sm taos_arbitrator replicated 1/1 tdengine/tdengine:2.4.0
+561t4lu6nfw6 taos_adapter replicated 4/4 tdengine/tdengine:3.0.0.0
+3hk5ct3q90sm taos_arbitrator replicated 1/1 tdengine/tdengine:3.0.0.0
d8qr52envqzu taos_nginx replicated 1/1 nginx:latest *:6041->6041/tcp, *:6044->6044/udp
-2isssfvjk747 taos_td-1 replicated 1/1 tdengine/tdengine:2.4.0
-9pzw7u02ichv taos_td-2 replicated 1/1 tdengine/tdengine:2.4.0
+2isssfvjk747 taos_td-1 replicated 1/1 tdengine/tdengine:3.0.0.0
+9pzw7u02ichv taos_td-2 replicated 1/1 tdengine/tdengine:3.0.0.0
```
From the above output, you can see two dnodes, two taosAdapters, and one Nginx reverse proxy service.
@@ -502,5 +502,5 @@ verify: Service converged
$ docker service ls -f name=taos_adapter
ID NAME MODE REPLICAS IMAGE PORTS
-561t4lu6nfw6 taos_adapter replicated 1/1 tdengine/tdengine:2.4.0
+561t4lu6nfw6 taos_adapter replicated 1/1 tdengine/tdengine:3.0.0.0
```
diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md
index 88a4aa2d81a1a3462a93f61ad919e0fe530b92e8..02921c3f6a4ce21175504c3c07bd51bb4a3dcf60 100644
--- a/docs/en/14-reference/12-config/index.md
+++ b/docs/en/14-reference/12-config/index.md
@@ -82,13 +82,12 @@ The parameters described in this document by the effect that they have on the sy
| Protocol | Default Port | Description | How to configure |
| :------- | :----------- | :----------------------------------------------- | :--------------------------------------------------------------------------------------------- |
| TCP | 6030 | Communication between client and server. In a multi-node cluster, communication between nodes. serverPort |
-| TCP | 6041 | REST connection between client and server | refer to [taosAdapter](../taosadapter/) |
+| TCP | 6041 | REST connection between client and server | Prior to 2.4.0.0: serverPort+11; After 2.4.0.0 refer to [taosAdapter](/reference/taosadapter/) |
| TCP | 6043 | Service Port of TaosKeeper | The parameter of TaosKeeper |
| TCP | 6044 | Data access port for StatsD | Configurable through taosAdapter parameters.
| UDP | 6045 | Data access for statsd | Configurable through taosAdapter parameters.
| TCP | 6060 | Port of Monitoring Service in Enterprise version | |
-
### maxShellConns
| Attribute | Description |
@@ -345,7 +344,7 @@ The charset that takes effect is UTF-8.
| Attribute | Description |
| -------- | --------------------------------- |
| Applicable | Server and Client |
-| Meaning | The interval for taos shell to send heartbeat to mnode |
+| Meaning | The interval for TDengine CLI to send heartbeat to mnode |
| Unit | second |
| Value Range | 1-120 |
| Default Value | 3 |
diff --git a/docs/en/20-third-party/emqx/client-num.webp b/docs/en/20-third-party/emqx/client-num.webp
index a151b184843607d67b649babb3145bfb3e329cda..a8ac6fb4c036b1db697d537472732ca854e583c8 100644
Binary files a/docs/en/20-third-party/emqx/client-num.webp and b/docs/en/20-third-party/emqx/client-num.webp differ
diff --git a/docs/en/20-third-party/import_dashboard.webp b/docs/en/20-third-party/import_dashboard.webp
new file mode 100644
index 0000000000000000000000000000000000000000..164e3f4690a5a55f937a3c29e1e8ca026648e6b1
Binary files /dev/null and b/docs/en/20-third-party/import_dashboard.webp differ
diff --git a/docs/en/20-third-party/import_dashboard1.webp b/docs/en/20-third-party/import_dashboard1.webp
new file mode 100644
index 0000000000000000000000000000000000000000..d4fb374ce8bb75c8a0fbdbb9cab5b30eb29ab06d
Binary files /dev/null and b/docs/en/20-third-party/import_dashboard1.webp differ
diff --git a/docs/en/20-third-party/import_dashboard2.webp b/docs/en/20-third-party/import_dashboard2.webp
new file mode 100644
index 0000000000000000000000000000000000000000..9f74dc96be20ab64b5fb555aaccdaa1c1139b35c
Binary files /dev/null and b/docs/en/20-third-party/import_dashboard2.webp differ
diff --git a/docs/en/25-application/01-telegraf.md b/docs/en/25-application/01-telegraf.md
index d30a23fe1b942e1411e8b5f1320e1c54ae2b407f..59491152bcda3e26ec12aaa59ac1041ef23c4e7e 100644
--- a/docs/en/25-application/01-telegraf.md
+++ b/docs/en/25-application/01-telegraf.md
@@ -34,7 +34,7 @@ Please refer to the [official documentation](https://grafana.com/grafana/downloa
### TDengine
-Download the latest TDengine-server 2.4.0.x or above from the [Downloads](http://taosdata.com/cn/all-downloads/) page on the TAOSData website and install it.
+Download the latest TDengine-server from the [Downloads](http://tdengine.com/en/all-downloads/) page on the TAOSData website and install it.
## Data Connection Setup
@@ -79,5 +79,5 @@ Click on the plus icon on the left and select `Import` to get the data from `htt
## Wrap-up
-The above demonstrates how to quickly build a IT DevOps visualization system. Thanks to the new schemaless protocol parsing feature in TDengine version 2.4.0.0 and ability to integrate easily with a large software ecosystem, users can build an efficient and easy-to-use IT DevOps visualization system in just a few minutes.
+The above demonstrates how to quickly build a IT DevOps visualization system. Thanks to the schemaless protocol parsing feature in TDengine and ability to integrate easily with a large software ecosystem, users can build an efficient and easy-to-use IT DevOps visualization system in just a few minutes.
Please refer to the official documentation and product implementation cases for other features.
diff --git a/docs/en/25-application/02-collectd.md b/docs/en/25-application/02-collectd.md
index 1733ed1b1af8c9375c3773d1ca86831396499a78..692cd8d929f04a03e4433bd0b71f84101bc362cb 100644
--- a/docs/en/25-application/02-collectd.md
+++ b/docs/en/25-application/02-collectd.md
@@ -37,7 +37,7 @@ Please refer to the [official documentation](https://grafana.com/grafana/downloa
### Install TDengine
-Download the latest TDengine-server 2.4.0.x or above from the [Downloads](http://taosdata.com/cn/all-downloads/) page on the TAOSData website and install it.
+Download the latest TDengine-server from the [Downloads](http://tdengine.com/en/all-downloads/) page on the TAOSData website and install it.
## Data Connection Setup
@@ -99,6 +99,6 @@ Download the dashboard json from `https://github.com/taosdata/grafanaplugin/blob
## Wrap-up
-TDengine, as an emerging time-series big data platform, has the advantages of high performance, high reliability, easy management and easy maintenance. Thanks to the new schemaless protocol parsing feature in TDengine version 2.4.0.0 and ability to integrate easily with a large software ecosystem, users can build an efficient and easy-to-use IT DevOps visualization system, or adapt an existing system, in just a few minutes.
+TDengine, as an emerging time-series big data platform, has the advantages of high performance, high reliability, easy management and easy maintenance. Thanks to the new schemaless protocol parsing feature in TDengine and ability to integrate easily with a large software ecosystem, users can build an efficient and easy-to-use IT DevOps visualization system, or adapt an existing system, in just a few minutes.
For TDengine's powerful data writing and querying performance and other features, please refer to the official documentation and successful product implementation cases.
diff --git a/docs/en/25-application/IT-DevOps-Solutions-Collectd-StatsD.webp b/docs/en/25-application/IT-DevOps-Solutions-Collectd-StatsD.webp
index 147a65b17bff2aa0e44faa206618bdce5664e1ca..a8b52f3b2d6efe2b83c087d81b98c89fa941f263 100644
Binary files a/docs/en/25-application/IT-DevOps-Solutions-Collectd-StatsD.webp and b/docs/en/25-application/IT-DevOps-Solutions-Collectd-StatsD.webp differ
diff --git a/docs/en/25-application/IT-DevOps-Solutions-Telegraf.webp b/docs/en/25-application/IT-DevOps-Solutions-Telegraf.webp
index fd5461ec9b37be66cac4c17fb1f81fec76158330..fac96f4eb63232c405bfb5e09eda7ed00901a7b5 100644
Binary files a/docs/en/25-application/IT-DevOps-Solutions-Telegraf.webp and b/docs/en/25-application/IT-DevOps-Solutions-Telegraf.webp differ
diff --git a/docs/en/25-application/IT-DevOps-Solutions-telegraf-dashboard.webp b/docs/en/25-application/IT-DevOps-Solutions-telegraf-dashboard.webp
index 105afcdb8312b23675f62ff6339d5e737b5cd958..fac96f4eb63232c405bfb5e09eda7ed00901a7b5 100644
Binary files a/docs/en/25-application/IT-DevOps-Solutions-telegraf-dashboard.webp and b/docs/en/25-application/IT-DevOps-Solutions-telegraf-dashboard.webp differ
diff --git a/docs/examples/java/src/main/java/com/taos/example/RestInsertExample.java b/docs/examples/java/src/main/java/com/taos/example/RestInsertExample.java
index af97fe4373ca964260e5614f133f359e229b0e15..9d85bf2a94abda71bcdab89d46008b70e52ce437 100644
--- a/docs/examples/java/src/main/java/com/taos/example/RestInsertExample.java
+++ b/docs/examples/java/src/main/java/com/taos/example/RestInsertExample.java
@@ -16,14 +16,14 @@ public class RestInsertExample {
private static List getRawData() {
return Arrays.asList(
- "d1001,2018-10-03 14:38:05.000,10.30000,219,0.31000,California.SanFrancisco,2",
- "d1001,2018-10-03 14:38:15.000,12.60000,218,0.33000,California.SanFrancisco,2",
- "d1001,2018-10-03 14:38:16.800,12.30000,221,0.31000,California.SanFrancisco,2",
- "d1002,2018-10-03 14:38:16.650,10.30000,218,0.25000,California.SanFrancisco,3",
- "d1003,2018-10-03 14:38:05.500,11.80000,221,0.28000,California.LosAngeles,2",
- "d1003,2018-10-03 14:38:16.600,13.40000,223,0.29000,California.LosAngeles,2",
- "d1004,2018-10-03 14:38:05.000,10.80000,223,0.29000,California.LosAngeles,3",
- "d1004,2018-10-03 14:38:06.500,11.50000,221,0.35000,California.LosAngeles,3"
+ "d1001,2018-10-03 14:38:05.000,10.30000,219,0.31000,'California.SanFrancisco',2",
+ "d1001,2018-10-03 14:38:15.000,12.60000,218,0.33000,'California.SanFrancisco',2",
+ "d1001,2018-10-03 14:38:16.800,12.30000,221,0.31000,'California.SanFrancisco',2",
+ "d1002,2018-10-03 14:38:16.650,10.30000,218,0.25000,'California.SanFrancisco',3",
+ "d1003,2018-10-03 14:38:05.500,11.80000,221,0.28000,'California.LosAngeles',2",
+ "d1003,2018-10-03 14:38:16.600,13.40000,223,0.29000,'California.LosAngeles',2",
+ "d1004,2018-10-03 14:38:05.000,10.80000,223,0.29000,'California.LosAngeles',3",
+ "d1004,2018-10-03 14:38:06.500,11.50000,221,0.35000,'California.LosAngeles',3"
);
}
diff --git a/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java b/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java
index 50e8b357719fc6d1f4707e474afdf58fb4531970..179e6e6911185631901b79e34a343967e73c4936 100644
--- a/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java
+++ b/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java
@@ -57,7 +57,7 @@ public class SubscribeDemo {
properties.setProperty(TMQConstants.ENABLE_AUTO_COMMIT, "true");
properties.setProperty(TMQConstants.GROUP_ID, "test");
properties.setProperty(TMQConstants.VALUE_DESERIALIZER,
- "com.taosdata.jdbc.MetersDeserializer");
+ "com.taos.example.MetersDeserializer");
// poll data
try (TaosConsumer consumer = new TaosConsumer<>(properties)) {
diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java
new file mode 100644
index 0000000000000000000000000000000000000000..04b149a4b96441ecfd1b0bdde54c9ed71349cab2
--- /dev/null
+++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java
@@ -0,0 +1,63 @@
+package com.taos.example.highvolume;
+
+import java.sql.*;
+
+/**
+ * Prepare target database.
+ * Count total records in database periodically so that we can estimate the writing speed.
+ */
+public class DataBaseMonitor {
+ private Connection conn;
+ private Statement stmt;
+
+ public DataBaseMonitor init() throws SQLException {
+ if (conn == null) {
+ String jdbcURL = System.getenv("TDENGINE_JDBC_URL");
+ conn = DriverManager.getConnection(jdbcURL);
+ stmt = conn.createStatement();
+ }
+ return this;
+ }
+
+ public void close() {
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ }
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ }
+ }
+
+ public void prepareDatabase() throws SQLException {
+ stmt.execute("DROP DATABASE IF EXISTS test");
+ stmt.execute("CREATE DATABASE test");
+ stmt.execute("CREATE STABLE test.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
+ }
+
+ public Long count() throws SQLException {
+ if (!stmt.isClosed()) {
+ ResultSet result = stmt.executeQuery("SELECT count(*) from test.meters");
+ result.next();
+ return result.getLong(1);
+ }
+ return null;
+ }
+
+ /**
+ * show test.stables;
+ *
+ * name | created_time | columns | tags | tables |
+ * ============================================================================================
+ * meters | 2022-07-20 08:39:30.902 | 4 | 2 | 620000 |
+ */
+ public Long getTableCount() throws SQLException {
+ if (!stmt.isClosed()) {
+ ResultSet result = stmt.executeQuery("show test.stables");
+ result.next();
+ return result.getLong(5);
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/FastWriteExample.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/FastWriteExample.java
new file mode 100644
index 0000000000000000000000000000000000000000..41b59551ca69a4056c2f2b572d169bd08dc4fcfe
--- /dev/null
+++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/FastWriteExample.java
@@ -0,0 +1,70 @@
+package com.taos.example.highvolume;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+
+
+public class FastWriteExample {
+ final static Logger logger = LoggerFactory.getLogger(FastWriteExample.class);
+
+ final static int taskQueueCapacity = 1000000;
+ final static List> taskQueues = new ArrayList<>();
+ final static List readTasks = new ArrayList<>();
+ final static List writeTasks = new ArrayList<>();
+ final static DataBaseMonitor databaseMonitor = new DataBaseMonitor();
+
+ public static void stopAll() {
+ logger.info("shutting down");
+ readTasks.forEach(task -> task.stop());
+ writeTasks.forEach(task -> task.stop());
+ databaseMonitor.close();
+ }
+
+ public static void main(String[] args) throws InterruptedException, SQLException {
+ int readTaskCount = args.length > 0 ? Integer.parseInt(args[0]) : 1;
+ int writeTaskCount = args.length > 1 ? Integer.parseInt(args[1]) : 3;
+ int tableCount = args.length > 2 ? Integer.parseInt(args[2]) : 1000;
+ int maxBatchSize = args.length > 3 ? Integer.parseInt(args[3]) : 3000;
+
+ logger.info("readTaskCount={}, writeTaskCount={} tableCount={} maxBatchSize={}",
+ readTaskCount, writeTaskCount, tableCount, maxBatchSize);
+
+ databaseMonitor.init().prepareDatabase();
+
+ // Create task queues, whiting tasks and start writing threads.
+ for (int i = 0; i < writeTaskCount; ++i) {
+ BlockingQueue queue = new ArrayBlockingQueue<>(taskQueueCapacity);
+ taskQueues.add(queue);
+ WriteTask task = new WriteTask(queue, maxBatchSize);
+ Thread t = new Thread(task);
+ t.setName("WriteThread-" + i);
+ t.start();
+ }
+
+ // create reading tasks and start reading threads
+ int tableCountPerTask = tableCount / readTaskCount;
+ for (int i = 0; i < readTaskCount; ++i) {
+ ReadTask task = new ReadTask(i, taskQueues, tableCountPerTask);
+ Thread t = new Thread(task);
+ t.setName("ReadThread-" + i);
+ t.start();
+ }
+
+ Runtime.getRuntime().addShutdownHook(new Thread(FastWriteExample::stopAll));
+
+ long lastCount = 0;
+ while (true) {
+ Thread.sleep(10000);
+ long numberOfTable = databaseMonitor.getTableCount();
+ long count = databaseMonitor.count();
+ logger.info("numberOfTable={} count={} speed={}", numberOfTable, count, (count - lastCount) / 10);
+ lastCount = count;
+ }
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/MockDataSource.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/MockDataSource.java
new file mode 100644
index 0000000000000000000000000000000000000000..6fe83f002ebcb9d82e026e9a32886fd22bfefbe9
--- /dev/null
+++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/MockDataSource.java
@@ -0,0 +1,53 @@
+package com.taos.example.highvolume;
+
+import java.util.Iterator;
+
+/**
+ * Generate test data
+ */
+class MockDataSource implements Iterator {
+ private String tbNamePrefix;
+ private int tableCount;
+ private long maxRowsPerTable = 1000000000L;
+
+ // 100 milliseconds between two neighbouring rows.
+ long startMs = System.currentTimeMillis() - maxRowsPerTable * 100;
+ private int currentRow = 0;
+ private int currentTbId = -1;
+
+ // mock values
+ String[] location = {"LosAngeles", "SanDiego", "Hollywood", "Compton", "San Francisco"};
+ float[] current = {8.8f, 10.7f, 9.9f, 8.9f, 9.4f};
+ int[] voltage = {119, 116, 111, 113, 118};
+ float[] phase = {0.32f, 0.34f, 0.33f, 0.329f, 0.141f};
+
+ public MockDataSource(String tbNamePrefix, int tableCount) {
+ this.tbNamePrefix = tbNamePrefix;
+ this.tableCount = tableCount;
+ }
+
+ @Override
+ public boolean hasNext() {
+ currentTbId += 1;
+ if (currentTbId == tableCount) {
+ currentTbId = 0;
+ currentRow += 1;
+ }
+ return currentRow < maxRowsPerTable;
+ }
+
+ @Override
+ public String next() {
+ long ts = startMs + 100 * currentRow;
+ int groupId = currentTbId % 5 == 0 ? currentTbId / 5 : currentTbId / 5 + 1;
+ StringBuilder sb = new StringBuilder(tbNamePrefix + "_" + currentTbId + ","); // tbName
+ sb.append(ts).append(','); // ts
+ sb.append(current[currentRow % 5]).append(','); // current
+ sb.append(voltage[currentRow % 5]).append(','); // voltage
+ sb.append(phase[currentRow % 5]).append(','); // phase
+ sb.append(location[currentRow % 5]).append(','); // location
+ sb.append(groupId); // groupID
+
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/ReadTask.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/ReadTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..a6fcfed1d28281d46aff493ef9783972858ebe62
--- /dev/null
+++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/ReadTask.java
@@ -0,0 +1,58 @@
+package com.taos.example.highvolume;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+
+class ReadTask implements Runnable {
+ private final static Logger logger = LoggerFactory.getLogger(ReadTask.class);
+ private final int taskId;
+ private final List> taskQueues;
+ private final int queueCount;
+ private final int tableCount;
+ private boolean active = true;
+
+ public ReadTask(int readTaskId, List> queues, int tableCount) {
+ this.taskId = readTaskId;
+ this.taskQueues = queues;
+ this.queueCount = queues.size();
+ this.tableCount = tableCount;
+ }
+
+ /**
+ * Assign data received to different queues.
+ * Here we use the suffix number in table name.
+ * You are expected to define your own rule in practice.
+ *
+ * @param line record received
+ * @return which queue to use
+ */
+ public int getQueueId(String line) {
+ String tbName = line.substring(0, line.indexOf(',')); // For example: tb1_101
+ String suffixNumber = tbName.split("_")[1];
+ return Integer.parseInt(suffixNumber) % this.queueCount;
+ }
+
+ @Override
+ public void run() {
+ logger.info("started");
+ Iterator it = new MockDataSource("tb" + this.taskId, tableCount);
+ try {
+ while (it.hasNext() && active) {
+ String line = it.next();
+ int queueId = getQueueId(line);
+ taskQueues.get(queueId).put(line);
+ }
+ } catch (Exception e) {
+ logger.error("Read Task Error", e);
+ }
+ }
+
+ public void stop() {
+ logger.info("stop");
+ this.active = false;
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java
new file mode 100644
index 0000000000000000000000000000000000000000..c2989acdbe3d0f56d7451ac86051a55955ce14de
--- /dev/null
+++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java
@@ -0,0 +1,205 @@
+package com.taos.example.highvolume;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A helper class encapsulate the logic of writing using SQL.
+ *
+ * The main interfaces are two methods:
+ *
+ * - {@link SQLWriter#processLine}, which receive raw lines from WriteTask and group them by table names.
+ * - {@link SQLWriter#flush}, which assemble INSERT statement and execute it.
+ *
+ *
+ * There is a technical skill worth mentioning: we create table as needed when "table does not exist" error occur instead of creating table automatically using syntax "INSET INTO tb USING stb".
+ * This ensure that checking table existence is a one-time-only operation.
+ *
+ *
+ *
+ */
+public class SQLWriter {
+ final static Logger logger = LoggerFactory.getLogger(SQLWriter.class);
+
+ private Connection conn;
+ private Statement stmt;
+
+ /**
+ * current number of buffered records
+ */
+ private int bufferedCount = 0;
+ /**
+ * Maximum number of buffered records.
+ * Flush action will be triggered if bufferedCount reached this value,
+ */
+ private int maxBatchSize;
+
+
+ /**
+ * Maximum SQL length.
+ */
+ private int maxSQLLength;
+
+ /**
+ * Map from table name to column values. For example:
+ * "tb001" -> "(1648432611249,2.1,114,0.09) (1648432611250,2.2,135,0.2)"
+ */
+ private Map tbValues = new HashMap<>();
+
+ /**
+ * Map from table name to tag values in the same order as creating stable.
+ * Used for creating table.
+ */
+ private Map tbTags = new HashMap<>();
+
+ public SQLWriter(int maxBatchSize) {
+ this.maxBatchSize = maxBatchSize;
+ }
+
+
+ /**
+ * Get Database Connection
+ *
+ * @return Connection
+ * @throws SQLException
+ */
+ private static Connection getConnection() throws SQLException {
+ String jdbcURL = System.getenv("TDENGINE_JDBC_URL");
+ return DriverManager.getConnection(jdbcURL);
+ }
+
+ /**
+ * Create Connection and Statement
+ *
+ * @throws SQLException
+ */
+ public void init() throws SQLException {
+ conn = getConnection();
+ stmt = conn.createStatement();
+ stmt.execute("use test");
+ ResultSet rs = stmt.executeQuery("show variables");
+ while (rs.next()) {
+ String configName = rs.getString(1);
+ if ("maxSQLLength".equals(configName)) {
+ maxSQLLength = Integer.parseInt(rs.getString(2));
+ logger.info("maxSQLLength={}", maxSQLLength);
+ }
+ }
+ }
+
+ /**
+ * Convert raw data to SQL fragments, group them by table name and cache them in a HashMap.
+ * Trigger writing when number of buffered records reached maxBachSize.
+ *
+ * @param line raw data get from task queue in format: tbName,ts,current,voltage,phase,location,groupId
+ */
+ public void processLine(String line) throws SQLException {
+ bufferedCount += 1;
+ int firstComma = line.indexOf(',');
+ String tbName = line.substring(0, firstComma);
+ int lastComma = line.lastIndexOf(',');
+ int secondLastComma = line.lastIndexOf(',', lastComma - 1);
+ String value = "(" + line.substring(firstComma + 1, secondLastComma) + ") ";
+ if (tbValues.containsKey(tbName)) {
+ tbValues.put(tbName, tbValues.get(tbName) + value);
+ } else {
+ tbValues.put(tbName, value);
+ }
+ if (!tbTags.containsKey(tbName)) {
+ String location = line.substring(secondLastComma + 1, lastComma);
+ String groupId = line.substring(lastComma + 1);
+ String tagValues = "('" + location + "'," + groupId + ')';
+ tbTags.put(tbName, tagValues);
+ }
+ if (bufferedCount == maxBatchSize) {
+ flush();
+ }
+ }
+
+
+ /**
+ * Assemble INSERT statement using buffered SQL fragments in Map {@link SQLWriter#tbValues} and execute it.
+ * In case of "Table does not exit" exception, create all tables in the sql and retry the sql.
+ */
+ public void flush() throws SQLException {
+ StringBuilder sb = new StringBuilder("INSERT INTO ");
+ for (Map.Entry entry : tbValues.entrySet()) {
+ String tableName = entry.getKey();
+ String values = entry.getValue();
+ String q = tableName + " values " + values + " ";
+ if (sb.length() + q.length() > maxSQLLength) {
+ executeSQL(sb.toString());
+ logger.warn("increase maxSQLLength or decrease maxBatchSize to gain better performance");
+ sb = new StringBuilder("INSERT INTO ");
+ }
+ sb.append(q);
+ }
+ executeSQL(sb.toString());
+ tbValues.clear();
+ bufferedCount = 0;
+ }
+
+ private void executeSQL(String sql) throws SQLException {
+ try {
+ stmt.executeUpdate(sql);
+ } catch (SQLException e) {
+ // convert to error code defined in taoserror.h
+ int errorCode = e.getErrorCode() & 0xffff;
+ if (errorCode == 0x362 || errorCode == 0x218) {
+ // Table does not exist
+ createTables();
+ executeSQL(sql);
+ } else {
+ logger.error("Execute SQL: {}", sql);
+ throw e;
+ }
+ } catch (Throwable throwable) {
+ logger.error("Execute SQL: {}", sql);
+ throw throwable;
+ }
+ }
+
+ /**
+ * Create tables in batch using syntax:
+ *
+ * CREATE TABLE [IF NOT EXISTS] tb_name1 USING stb_name TAGS (tag_value1, ...) [IF NOT EXISTS] tb_name2 USING stb_name TAGS (tag_value2, ...) ...;
+ *
+ */
+ private void createTables() throws SQLException {
+ StringBuilder sb = new StringBuilder("CREATE TABLE ");
+ for (String tbName : tbValues.keySet()) {
+ String tagValues = tbTags.get(tbName);
+ sb.append("IF NOT EXISTS ").append(tbName).append(" USING meters TAGS ").append(tagValues).append(" ");
+ }
+ String sql = sb.toString();
+ try {
+ stmt.executeUpdate(sql);
+ } catch (Throwable throwable) {
+ logger.error("Execute SQL: {}", sql);
+ throw throwable;
+ }
+ }
+
+ public boolean hasBufferedValues() {
+ return bufferedCount > 0;
+ }
+
+ public int getBufferedCount() {
+ return bufferedCount;
+ }
+
+ public void close() {
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ }
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ }
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/StmtWriter.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/StmtWriter.java
new file mode 100644
index 0000000000000000000000000000000000000000..8ade06625d708a112c85d5657aa00bcd0e605ff4
--- /dev/null
+++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/StmtWriter.java
@@ -0,0 +1,4 @@
+package com.taos.example.highvolume;
+
+public class StmtWriter {
+}
diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/WriteTask.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/WriteTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..de9e5463d7dc59478f991e4783aacaae527b4c4b
--- /dev/null
+++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/WriteTask.java
@@ -0,0 +1,58 @@
+package com.taos.example.highvolume;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.BlockingQueue;
+
+class WriteTask implements Runnable {
+ private final static Logger logger = LoggerFactory.getLogger(WriteTask.class);
+ private final int maxBatchSize;
+
+ // the queue from which this writing task get raw data.
+ private final BlockingQueue queue;
+
+ // A flag indicate whether to continue.
+ private boolean active = true;
+
+ public WriteTask(BlockingQueue taskQueue, int maxBatchSize) {
+ this.queue = taskQueue;
+ this.maxBatchSize = maxBatchSize;
+ }
+
+ @Override
+ public void run() {
+ logger.info("started");
+ String line = null; // data getting from the queue just now.
+ SQLWriter writer = new SQLWriter(maxBatchSize);
+ try {
+ writer.init();
+ while (active) {
+ line = queue.poll();
+ if (line != null) {
+ // parse raw data and buffer the data.
+ writer.processLine(line);
+ } else if (writer.hasBufferedValues()) {
+ // write data immediately if no more data in the queue
+ writer.flush();
+ } else {
+ // sleep a while to avoid high CPU usage if no more data in the queue and no buffered records, .
+ Thread.sleep(100);
+ }
+ }
+ if (writer.hasBufferedValues()) {
+ writer.flush();
+ }
+ } catch (Exception e) {
+ String msg = String.format("line=%s, bufferedCount=%s", line, writer.getBufferedCount());
+ logger.error(msg, e);
+ } finally {
+ writer.close();
+ }
+ }
+
+ public void stop() {
+ logger.info("stop");
+ this.active = false;
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/java/src/test/java/com/taos/test/TestAll.java b/docs/examples/java/src/test/java/com/taos/test/TestAll.java
index 42db24485afec05298159f7b0c3a4e15835d98ed..8d201da0745e1d2d36220c9d78383fc37d4a813a 100644
--- a/docs/examples/java/src/test/java/com/taos/test/TestAll.java
+++ b/docs/examples/java/src/test/java/com/taos/test/TestAll.java
@@ -23,16 +23,16 @@ public class TestAll {
String jdbcUrl = "jdbc:TAOS://localhost:6030?user=root&password=taosdata";
try (Connection conn = DriverManager.getConnection(jdbcUrl)) {
try (Statement stmt = conn.createStatement()) {
- String sql = "INSERT INTO power.d1001 USING power.meters TAGS(California.SanFrancisco, 2) VALUES('2018-10-03 14:38:05.000',10.30000,219,0.31000)\n" +
- " power.d1001 USING power.meters TAGS(California.SanFrancisco, 2) VALUES('2018-10-03 15:38:15.000',12.60000,218,0.33000)\n" +
- " power.d1001 USING power.meters TAGS(California.SanFrancisco, 2) VALUES('2018-10-03 15:38:16.800',12.30000,221,0.31000)\n" +
- " power.d1002 USING power.meters TAGS(California.SanFrancisco, 3) VALUES('2018-10-03 15:38:16.650',10.30000,218,0.25000)\n" +
- " power.d1003 USING power.meters TAGS(California.LosAngeles, 2) VALUES('2018-10-03 15:38:05.500',11.80000,221,0.28000)\n" +
- " power.d1003 USING power.meters TAGS(California.LosAngeles, 2) VALUES('2018-10-03 15:38:16.600',13.40000,223,0.29000)\n" +
- " power.d1004 USING power.meters TAGS(California.LosAngeles, 3) VALUES('2018-10-03 15:38:05.000',10.80000,223,0.29000)\n" +
- " power.d1004 USING power.meters TAGS(California.LosAngeles, 3) VALUES('2018-10-03 15:38:06.000',10.80000,223,0.29000)\n" +
- " power.d1004 USING power.meters TAGS(California.LosAngeles, 3) VALUES('2018-10-03 15:38:07.000',10.80000,223,0.29000)\n" +
- " power.d1004 USING power.meters TAGS(California.LosAngeles, 3) VALUES('2018-10-03 15:38:08.500',11.50000,221,0.35000)";
+ String sql = "INSERT INTO power.d1001 USING power.meters TAGS('California.SanFrancisco', 2) VALUES('2018-10-03 14:38:05.000',10.30000,219,0.31000)\n" +
+ " power.d1001 USING power.meters TAGS('California.SanFrancisco', 2) VALUES('2018-10-03 15:38:15.000',12.60000,218,0.33000)\n" +
+ " power.d1001 USING power.meters TAGS('California.SanFrancisco', 2) VALUES('2018-10-03 15:38:16.800',12.30000,221,0.31000)\n" +
+ " power.d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 15:38:16.650',10.30000,218,0.25000)\n" +
+ " power.d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 15:38:05.500',11.80000,221,0.28000)\n" +
+ " power.d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 15:38:16.600',13.40000,223,0.29000)\n" +
+ " power.d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 15:38:05.000',10.80000,223,0.29000)\n" +
+ " power.d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 15:38:06.000',10.80000,223,0.29000)\n" +
+ " power.d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 15:38:07.000',10.80000,223,0.29000)\n" +
+ " power.d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 15:38:08.500',11.50000,221,0.35000)";
stmt.execute(sql);
}
diff --git a/docs/examples/python/connect_native_reference.py b/docs/examples/python/connect_native_reference.py
index c17e9795b58724f6646b8d7c0f84047098a93d69..09b0685acef8c68b30153da5a1761d36b1cf9aae 100644
--- a/docs/examples/python/connect_native_reference.py
+++ b/docs/examples/python/connect_native_reference.py
@@ -11,10 +11,10 @@ conn: taos.TaosConnection = taos.connect(host="localhost",
server_version = conn.server_info
print("server_version", server_version)
client_version = conn.client_info
-print("client_version", client_version) # 2.4.0.16
+print("client_version", client_version) # 3.0.0.0
conn.close()
# possible output:
-# 2.4.0.16
-# 2.4.0.16
+# 3.0.0.0
+# 3.0.0.0
diff --git a/docs/examples/python/fast_write_example.py b/docs/examples/python/fast_write_example.py
new file mode 100644
index 0000000000000000000000000000000000000000..c9d606388fdecd85f1468f24cc497ecc5941f035
--- /dev/null
+++ b/docs/examples/python/fast_write_example.py
@@ -0,0 +1,180 @@
+# install dependencies:
+# recommend python >= 3.8
+# pip3 install faster-fifo
+#
+
+import logging
+import math
+import sys
+import time
+import os
+from multiprocessing import Process
+from faster_fifo import Queue
+from mockdatasource import MockDataSource
+from queue import Empty
+from typing import List
+
+logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format="%(asctime)s [%(name)s] - %(message)s")
+
+READ_TASK_COUNT = 1
+WRITE_TASK_COUNT = 1
+TABLE_COUNT = 1000
+QUEUE_SIZE = 1000000
+MAX_BATCH_SIZE = 3000
+
+read_processes = []
+write_processes = []
+
+
+def get_connection():
+ """
+ If variable TDENGINE_FIRST_EP is provided then it will be used. If not, firstEP in /etc/taos/taos.cfg will be used.
+ You can also override the default username and password by supply variable TDENGINE_USER and TDENGINE_PASSWORD
+ """
+ import taos
+ firstEP = os.environ.get("TDENGINE_FIRST_EP")
+ if firstEP:
+ host, port = firstEP.split(":")
+ else:
+ host, port = None, 0
+ user = os.environ.get("TDENGINE_USER", "root")
+ password = os.environ.get("TDENGINE_PASSWORD", "taosdata")
+ return taos.connect(host=host, port=int(port), user=user, password=password)
+
+
+# ANCHOR: read
+
+def run_read_task(task_id: int, task_queues: List[Queue]):
+ table_count_per_task = TABLE_COUNT // READ_TASK_COUNT
+ data_source = MockDataSource(f"tb{task_id}", table_count_per_task)
+ try:
+ for batch in data_source:
+ for table_id, rows in batch:
+ # hash data to different queue
+ i = table_id % len(task_queues)
+ # block putting forever when the queue is full
+ task_queues[i].put_many(rows, block=True, timeout=-1)
+ except KeyboardInterrupt:
+ pass
+
+
+# ANCHOR_END: read
+
+# ANCHOR: write
+def run_write_task(task_id: int, queue: Queue):
+ from sql_writer import SQLWriter
+ log = logging.getLogger(f"WriteTask-{task_id}")
+ writer = SQLWriter(get_connection)
+ lines = None
+ try:
+ while True:
+ try:
+ # get as many as possible
+ lines = queue.get_many(block=False, max_messages_to_get=MAX_BATCH_SIZE)
+ writer.process_lines(lines)
+ except Empty:
+ time.sleep(0.01)
+ except KeyboardInterrupt:
+ pass
+ except BaseException as e:
+ log.debug(f"lines={lines}")
+ raise e
+
+
+# ANCHOR_END: write
+
+def set_global_config():
+ argc = len(sys.argv)
+ if argc > 1:
+ global READ_TASK_COUNT
+ READ_TASK_COUNT = int(sys.argv[1])
+ if argc > 2:
+ global WRITE_TASK_COUNT
+ WRITE_TASK_COUNT = int(sys.argv[2])
+ if argc > 3:
+ global TABLE_COUNT
+ TABLE_COUNT = int(sys.argv[3])
+ if argc > 4:
+ global QUEUE_SIZE
+ QUEUE_SIZE = int(sys.argv[4])
+ if argc > 5:
+ global MAX_BATCH_SIZE
+ MAX_BATCH_SIZE = int(sys.argv[5])
+
+
+# ANCHOR: monitor
+def run_monitor_process():
+ log = logging.getLogger("DataBaseMonitor")
+ conn = get_connection()
+ conn.execute("DROP DATABASE IF EXISTS test")
+ conn.execute("CREATE DATABASE test")
+ conn.execute("CREATE STABLE test.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) "
+ "TAGS (location BINARY(64), groupId INT)")
+
+ def get_count():
+ res = conn.query("SELECT count(*) FROM test.meters")
+ rows = res.fetch_all()
+ return rows[0][0] if rows else 0
+
+ last_count = 0
+ while True:
+ time.sleep(10)
+ count = get_count()
+ log.info(f"count={count} speed={(count - last_count) / 10}")
+ last_count = count
+
+
+# ANCHOR_END: monitor
+# ANCHOR: main
+def main():
+ set_global_config()
+ logging.info(f"READ_TASK_COUNT={READ_TASK_COUNT}, WRITE_TASK_COUNT={WRITE_TASK_COUNT}, "
+ f"TABLE_COUNT={TABLE_COUNT}, QUEUE_SIZE={QUEUE_SIZE}, MAX_BATCH_SIZE={MAX_BATCH_SIZE}")
+
+ monitor_process = Process(target=run_monitor_process)
+ monitor_process.start()
+ time.sleep(3) # waiting for database ready.
+
+ task_queues: List[Queue] = []
+ # create task queues
+ for i in range(WRITE_TASK_COUNT):
+ queue = Queue(max_size_bytes=QUEUE_SIZE)
+ task_queues.append(queue)
+
+ # create write processes
+ for i in range(WRITE_TASK_COUNT):
+ p = Process(target=run_write_task, args=(i, task_queues[i]))
+ p.start()
+ logging.debug(f"WriteTask-{i} started with pid {p.pid}")
+ write_processes.append(p)
+
+ # create read processes
+ for i in range(READ_TASK_COUNT):
+ queues = assign_queues(i, task_queues)
+ p = Process(target=run_read_task, args=(i, queues))
+ p.start()
+ logging.debug(f"ReadTask-{i} started with pid {p.pid}")
+ read_processes.append(p)
+
+ try:
+ monitor_process.join()
+ except KeyboardInterrupt:
+ monitor_process.terminate()
+ [p.terminate() for p in read_processes]
+ [p.terminate() for p in write_processes]
+ [q.close() for q in task_queues]
+
+
+def assign_queues(read_task_id, task_queues):
+ """
+ Compute target queues for a specific read task.
+ """
+ ratio = WRITE_TASK_COUNT / READ_TASK_COUNT
+ from_index = math.floor(read_task_id * ratio)
+ end_index = math.ceil((read_task_id + 1) * ratio)
+ return task_queues[from_index:end_index]
+
+
+if __name__ == '__main__':
+ main()
+# ANCHOR_END: main
diff --git a/docs/examples/python/mockdatasource.py b/docs/examples/python/mockdatasource.py
new file mode 100644
index 0000000000000000000000000000000000000000..852860aec0adc8f9b043c9dcd5deb0bf00239201
--- /dev/null
+++ b/docs/examples/python/mockdatasource.py
@@ -0,0 +1,49 @@
+import time
+
+
+class MockDataSource:
+ samples = [
+ "8.8,119,0.32,LosAngeles,0",
+ "10.7,116,0.34,SanDiego,1",
+ "9.9,111,0.33,Hollywood,2",
+ "8.9,113,0.329,Compton,3",
+ "9.4,118,0.141,San Francisco,4"
+ ]
+
+ def __init__(self, tb_name_prefix, table_count):
+ self.table_name_prefix = tb_name_prefix + "_"
+ self.table_count = table_count
+ self.max_rows = 10000000
+ self.current_ts = round(time.time() * 1000) - self.max_rows * 100
+ # [(tableId, tableName, values),]
+ self.data = self._init_data()
+
+ def _init_data(self):
+ lines = self.samples * (self.table_count // 5 + 1)
+ data = []
+ for i in range(self.table_count):
+ table_name = self.table_name_prefix + str(i)
+ data.append((i, table_name, lines[i])) # tableId, row
+ return data
+
+ def __iter__(self):
+ self.row = 0
+ return self
+
+ def __next__(self):
+ """
+ next 1000 rows for each table.
+ return: {tableId:[row,...]}
+ """
+ # generate 1000 timestamps
+ ts = []
+ for _ in range(1000):
+ self.current_ts += 100
+ ts.append(str(self.current_ts))
+ # add timestamp to each row
+ # [(tableId, ["tableName,ts,current,voltage,phase,location,groupId"])]
+ result = []
+ for table_id, table_name, values in self.data:
+ rows = [table_name + ',' + t + ',' + values for t in ts]
+ result.append((table_id, rows))
+ return result
diff --git a/docs/examples/python/sql_writer.py b/docs/examples/python/sql_writer.py
new file mode 100644
index 0000000000000000000000000000000000000000..758167376b009f21afc701be7d89c1bfbabdeb9f
--- /dev/null
+++ b/docs/examples/python/sql_writer.py
@@ -0,0 +1,90 @@
+import logging
+import taos
+
+
+class SQLWriter:
+ log = logging.getLogger("SQLWriter")
+
+ def __init__(self, get_connection_func):
+ self._tb_values = {}
+ self._tb_tags = {}
+ self._conn = get_connection_func()
+ self._max_sql_length = self.get_max_sql_length()
+ self._conn.execute("USE test")
+
+ def get_max_sql_length(self):
+ rows = self._conn.query("SHOW variables").fetch_all()
+ for r in rows:
+ name = r[0]
+ if name == "maxSQLLength":
+ return int(r[1])
+ return 1024 * 1024
+
+ def process_lines(self, lines: str):
+ """
+ :param lines: [[tbName,ts,current,voltage,phase,location,groupId]]
+ """
+ for line in lines:
+ ps = line.split(",")
+ table_name = ps[0]
+ value = '(' + ",".join(ps[1:-2]) + ') '
+ if table_name in self._tb_values:
+ self._tb_values[table_name] += value
+ else:
+ self._tb_values[table_name] = value
+
+ if table_name not in self._tb_tags:
+ location = ps[-2]
+ group_id = ps[-1]
+ tag_value = f"('{location}',{group_id})"
+ self._tb_tags[table_name] = tag_value
+ self.flush()
+
+ def flush(self):
+ """
+ Assemble INSERT statement and execute it.
+ When the sql length grows close to MAX_SQL_LENGTH, the sql will be executed immediately, and a new INSERT statement will be created.
+ In case of "Table does not exit" exception, tables in the sql will be created and the sql will be re-executed.
+ """
+ sql = "INSERT INTO "
+ sql_len = len(sql)
+ buf = []
+ for tb_name, values in self._tb_values.items():
+ q = tb_name + " VALUES " + values
+ if sql_len + len(q) >= self._max_sql_length:
+ sql += " ".join(buf)
+ self.execute_sql(sql)
+ sql = "INSERT INTO "
+ sql_len = len(sql)
+ buf = []
+ buf.append(q)
+ sql_len += len(q)
+ sql += " ".join(buf)
+ self.execute_sql(sql)
+ self._tb_values.clear()
+
+ def execute_sql(self, sql):
+ try:
+ self._conn.execute(sql)
+ except taos.Error as e:
+ error_code = e.errno & 0xffff
+ # Table does not exit
+ if error_code == 9731:
+ self.create_tables()
+ else:
+ self.log.error("Execute SQL: %s", sql)
+ raise e
+ except BaseException as baseException:
+ self.log.error("Execute SQL: %s", sql)
+ raise baseException
+
+ def create_tables(self):
+ sql = "CREATE TABLE "
+ for tb in self._tb_values.keys():
+ tag_values = self._tb_tags[tb]
+ sql += "IF NOT EXISTS " + tb + " USING meters TAGS " + tag_values + " "
+ try:
+ self._conn.execute(sql)
+ except BaseException as e:
+ self.log.error("Execute SQL: %s", sql)
+ raise e
diff --git a/docs/zh/02-intro.md b/docs/zh/02-intro.md
index a6ef2b94b6c0b030e967c498a36fd8ae4655f724..f6779b8776af308d4cf14168c528ddc60c47ac13 100644
--- a/docs/zh/02-intro.md
+++ b/docs/zh/02-intro.md
@@ -1,5 +1,6 @@
---
title: 产品简介
+description: 简要介绍 TDengine 的主要功能
toc_max_heading_level: 2
---
@@ -22,8 +23,8 @@ TDengine的主要功能如下:
9. 提供[命令行程序](../reference/taos-shell),便于管理集群,检查系统状态,做即席查询
10. 提供多种数据的[导入](../operation/import)、[导出](../operation/export)
11. 支持对[TDengine 集群本身的监控](../operation/monitor)
-12. 提供 [C/C++](../reference/connector/cpp), [Java](../reference/connector/java), [Python](../reference/connector/python), [Go](../reference/connector/go), [Rust](../reference/connector/rust), [Node.js](../reference/connector/node) 等多种编程语言的[连接器](../reference/connector/)
-13. 支持 [REST 接口](../reference/rest-api/)
+12. 提供各种语言的[连接器](../connector): 如 C/C++, Java, Go, Node.JS, Rust, Python, C# 等
+13. 支持 [REST 接口](../connector/rest-api/)
14. 支持与[ Grafana 无缝集成](../third-party/grafana)
15. 支持与 Google Data Studio 无缝集成
16. 支持 [Kubernetes 部署](../deployment/k8s)
diff --git a/docs/zh/04-concept/index.md b/docs/zh/04-concept/index.md
index 8e97d4a2f43537c1229c8e8ea092ddfc1257dde7..89d3df9c973d9a319397285599e6b2e6be3785de 100644
--- a/docs/zh/04-concept/index.md
+++ b/docs/zh/04-concept/index.md
@@ -1,5 +1,7 @@
---
+sidebar_label: 基本概念
title: 数据模型和基本概念
+description: TDengine 的数据模型和基本概念
---
为了便于解释基本概念,便于撰写示例程序,整个 TDengine 文档以智能电表作为典型时序数据场景。假设每个智能电表采集电流、电压、相位三个量,有多个智能电表,每个电表有位置 location 和分组 group ID 的静态属性. 其采集的数据类似如下的表格:
@@ -104,15 +106,15 @@ title: 数据模型和基本概念
## 采集量 (Metric)
-采集量是指传感器、设备或其他类型采集点采集的物理量,比如电流、电压、温度、压力、GPS 位置等,是随时间变化的,数据类型可以是整型、浮点型、布尔型,也可是字符串。随着时间的推移,存储的采集量的数据量越来越大。
+采集量是指传感器、设备或其他类型采集点采集的物理量,比如电流、电压、温度、压力、GPS 位置等,是随时间变化的,数据类型可以是整型、浮点型、布尔型,也可是字符串。随着时间的推移,存储的采集量的数据量越来越大。智能电表示例中的电流、电压、相位就是采集量。
## 标签 (Label/Tag)
-标签是指传感器、设备或其他类型采集点的静态属性,不是随时间变化的,比如设备型号、颜色、设备的所在地等,数据类型可以是任何类型。虽然是静态的,但 TDengine 容许用户修改、删除或增加标签值。与采集量不一样的是,随时间的推移,存储的标签的数据量不会有什么变化。
+标签是指传感器、设备或其他类型采集点的静态属性,不是随时间变化的,比如设备型号、颜色、设备的所在地等,数据类型可以是任何类型。虽然是静态的,但 TDengine 容许用户修改、删除或增加标签值。与采集量不一样的是,随时间的推移,存储的标签的数据量不会有什么变化。智能电表示例中的location与groupId就是标签。
## 数据采集点 (Data Collection Point)
-数据采集点是指按照预设时间周期或受事件触发采集物理量的硬件或软件。一个数据采集点可以采集一个或多个采集量,**但这些采集量都是同一时刻采集的,具有相同的时间戳**。对于复杂的设备,往往有多个数据采集点,每个数据采集点采集的周期都可能不一样,而且完全独立,不同步。比如对于一台汽车,有数据采集点专门采集 GPS 位置,有数据采集点专门采集发动机状态,有数据采集点专门采集车内的环境,这样一台汽车就有三个数据采集点。
+数据采集点是指按照预设时间周期或受事件触发采集物理量的硬件或软件。一个数据采集点可以采集一个或多个采集量,**但这些采集量都是同一时刻采集的,具有相同的时间戳**。对于复杂的设备,往往有多个数据采集点,每个数据采集点采集的周期都可能不一样,而且完全独立,不同步。比如对于一台汽车,有数据采集点专门采集 GPS 位置,有数据采集点专门采集发动机状态,有数据采集点专门采集车内的环境,这样一台汽车就有三个数据采集点。智能电表示例中的d1001, d1002, d1003, d1004等就是数据采集点。
## 表 (Table)
@@ -131,13 +133,14 @@ TDengine 建议用数据采集点的名字(如上表中的 D1001)来做表
对于复杂的设备,比如汽车,它有多个数据采集点,那么就需要为一台汽车建立多张表。
+
## 超级表 (STable)
由于一个数据采集点一张表,导致表的数量巨增,难以管理,而且应用经常需要做采集点之间的聚合操作,聚合的操作也变得复杂起来。为解决这个问题,TDengine 引入超级表(Super Table,简称为 STable)的概念。
超级表是指某一特定类型的数据采集点的集合。同一类型的数据采集点,其表的结构是完全一样的,但每个表(数据采集点)的静态属性(标签)是不一样的。描述一个超级表(某一特定类型的数据采集点的集合),除需要定义采集量的表结构之外,还需要定义其标签的 schema,标签的数据类型可以是整数、浮点数、字符串,标签可以有多个,可以事后增加、删除或修改。如果整个系统有 N 个不同类型的数据采集点,就需要建立 N 个超级表。
-在 TDengine 的设计里,**表用来代表一个具体的数据采集点,超级表用来代表一组相同类型的数据采集点集合**。
+在 TDengine 的设计里,**表用来代表一个具体的数据采集点,超级表用来代表一组相同类型的数据采集点集合**。智能电表示例中,我们可以创建一个超级表meters.
## 子表 (Subtable)
@@ -156,7 +159,9 @@ TDengine 建议用数据采集点的名字(如上表中的 D1001)来做表
查询既可以在表上进行,也可以在超级表上进行。针对超级表的查询,TDengine 将把所有子表中的数据视为一个整体数据集进行处理,会先把满足标签过滤条件的表从超级表中找出来,然后再扫描这些表的时序数据,进行聚合操作,这样需要扫描的数据集会大幅减少,从而显著提高查询的性能。本质上,TDengine 通过对超级表查询的支持,实现了多个同类数据采集点的高效聚合。
-TDengine系统建议给一个数据采集点建表,需要通过超级表建表,而不是建普通表。
+TDengine系统建议给一个数据采集点建表,需要通过超级表建表,而不是建普通表。在智能电表的示例中,我们可以通过超级表meters创建子表d1001, d1002, d1003, d1004等。
+
+为了更好地理解超级与子表的关系,可以参考下面关于智能电表数据模型的示意图。 ![智能电表数据模型示意图](./supertable.webp)
## 库 (database)
diff --git a/docs/zh/04-concept/supertable.webp b/docs/zh/04-concept/supertable.webp
new file mode 100644
index 0000000000000000000000000000000000000000..764b8f3de7ee92a103b2fcd0e75c03773af5ee37
Binary files /dev/null and b/docs/zh/04-concept/supertable.webp differ
diff --git a/docs/zh/05-get-started/01-docker.md b/docs/zh/05-get-started/01-docker.md
index f0f09d4c7eeb9e5669008c4c95be5eade58b2090..e2be4195176a3f1ac7712a036d04b60b2fb77718 100644
--- a/docs/zh/05-get-started/01-docker.md
+++ b/docs/zh/05-get-started/01-docker.md
@@ -1,6 +1,7 @@
---
sidebar_label: Docker
title: 通过 Docker 快速体验 TDengine
+description: 使用 Docker 快速体验 TDengine 的高效写入和查询
---
本节首先介绍如何通过 Docker 快速体验 TDengine,然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。如果你不熟悉 Docker,请使用[安装包的方式快速体验](../../get-started/package/)。如果您希望为 TDengine 贡献代码或对内部技术实现感兴趣,请参考 [TDengine GitHub 主页](https://github.com/taosdata/TDengine) 下载源码构建和安装.
diff --git a/docs/zh/05-get-started/03-package.md b/docs/zh/05-get-started/03-package.md
index c1a67f018253fa31c732d246814eb612608cc355..3e0fb056a5913d3a82a473bf879a79e398176075 100644
--- a/docs/zh/05-get-started/03-package.md
+++ b/docs/zh/05-get-started/03-package.md
@@ -1,6 +1,7 @@
---
sidebar_label: 安装包
title: 使用安装包立即开始
+description: 使用安装包快速体验 TDengine
---
import Tabs from "@theme/Tabs";
@@ -9,7 +10,7 @@ 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 接口](../../reference/rest-api/)。
+TDengine 完整的软件包包括服务端(taosd)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、应用驱动(taosc)、命令行程序 (CLI,taos) 和一些工具软件。目前 taosAdapter 仅在 Linux 系统上安装和运行,后续将支持 Windows、macOS 等系统。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](../../reference/taosadapter/) 提供 [RESTful 接口](../../connector/rest-api/)。
为方便使用,标准的服务端安装包包含了 taosd、taosAdapter、taosc、taos、taosdump、taosBenchmark、TDinsight 安装脚本和示例代码;如果您只需要用到服务端程序和客户端连接的 C/C++ 语言支持,也可以仅下载 lite 版本的安装包。
@@ -67,13 +68,6 @@ install.sh 安装脚本在执行过程中,会通过命令行交互界面询问
-
-
-1. 从列表中下载获得 exe 安装程序;
-
-2. 运行可执行程序来安装 TDengine。
-
-
可以使用 apt-get 工具从官方仓库安装。
@@ -102,11 +96,20 @@ sudo apt-get install tdengine
:::tip
apt-get 方式只适用于 Debian 或 Ubuntu 系统
::::
+
+
+
+注意:目前 TDengine 在 Windows 平台上只支持 Windows server 2016/2019 和 Windows 10/11 系统版本。
+
+1. 从列表中下载获得 exe 安装程序;
+
+2. 运行可执行程序来安装 TDengine。
+
:::info
-下载其他组件、最新 Beta 版及之前版本的安装包,请点击[发布历史页面](../../releases)
+下载其他组件、最新 Beta 版及之前版本的安装包,请点击[发布历史页面](../../releases/tdengine)
:::
:::note
diff --git a/docs/zh/05-get-started/_pkg_install.mdx b/docs/zh/05-get-started/_pkg_install.mdx
deleted file mode 100644
index 83c987af8bcf24a9593105b680d32a0421344d5f..0000000000000000000000000000000000000000
--- a/docs/zh/05-get-started/_pkg_install.mdx
+++ /dev/null
@@ -1,17 +0,0 @@
-import PkgList from "/components/PkgList";
-
-TDengine 的安装非常简单,从下载到安装成功仅仅只要几秒钟。
-
-为方便使用,从 2.4.0.10 开始,标准的服务端安装包包含了 taos、taosd、taosAdapter、taosdump、taosBenchmark、TDinsight 安装脚本和示例代码;如果您只需要用到服务端程序和客户端连接的 C/C++ 语言支持,也可以仅下载 lite 版本的安装包。
-
-在安装包格式上,我们提供 tar.gz, rpm 和 deb 格式,为企业客户提供 tar.gz 格式安装包,以方便在特定操作系统上使用。需要注意的是,rpm 和 deb 包不含 taosdump、taosBenchmark 和 TDinsight 安装脚本,这些工具需要通过安装 taosTool 包获得。
-
-发布版本包括稳定版和 Beta 版,Beta 版含有更多新功能。正式上线或测试建议安装稳定版。您可以根据需要选择下载:
-
-
-
-具体的安装方法,请参见[安装包的安装和卸载](/operation/pkg-install)。
-
-下载其他组件、最新 Beta 版及之前版本的安装包,请点击[这里](https://www.taosdata.com/all-downloads)
-
-查看 Release Notes, 请点击[这里](https://github.com/taosdata/TDengine/releases)
diff --git a/docs/zh/05-get-started/index.md b/docs/zh/05-get-started/index.md
index 794081b4e4c438dee2d8cbe125de4094056f190f..20f8235d87426f7a98ded2f7be431289ea00a045 100644
--- a/docs/zh/05-get-started/index.md
+++ b/docs/zh/05-get-started/index.md
@@ -3,7 +3,7 @@ title: 立即开始
description: '快速设置 TDengine 环境并体验其高效写入和查询'
---
-TDengine 完整的软件包包括服务端(taosd)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、应用驱动(taosc)、命令行程序 (CLI,taos) 和一些工具软件。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](/reference/taosadapter) 提供 [RESTful 接口](/reference/rest-api)。
+TDengine 完整的软件包包括服务端(taosd)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、应用驱动(taosc)、命令行程序 (CLI,taos) 和一些工具软件。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](../reference/taosadapter) 提供 [RESTful 接口](../connector/rest-api)。
本章主要介绍如何利用 Docker 或者安装包快速设置 TDengine 环境并体验其高效写入和查询。
diff --git a/docs/zh/07-develop/01-connect/_connect_java.mdx b/docs/zh/07-develop/01-connect/_connect_java.mdx
index f5b8ea1cc2bf309bbb182be6ae06100102328a16..86c70ef7dc9a84d61fa36502f83e0be6a0836214 100644
--- a/docs/zh/07-develop/01-connect/_connect_java.mdx
+++ b/docs/zh/07-develop/01-connect/_connect_java.mdx
@@ -12,4 +12,4 @@
{{#include docs/examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}}
```
-更多连接参数配置,参考[Java 连接器](/reference/connector/java)
+更多连接参数配置,参考[Java 连接器](../../connector/java)
diff --git a/docs/zh/07-develop/01-connect/index.md b/docs/zh/07-develop/01-connect/index.md
index 89faf812fffa281cc1c9df2371d3470252231ce2..075d99cfee78b01b66ebc527892e90b9291dd422 100644
--- a/docs/zh/07-develop/01-connect/index.md
+++ b/docs/zh/07-develop/01-connect/index.md
@@ -1,6 +1,6 @@
---
title: 建立连接
-description: "本节介绍如何使用连接器建立与 TDengine 的连接,给出连接器安装、连接的简单说明。"
+description: 使用连接器建立与 TDengine 的连接,以及连接器的安装和连接
---
import Tabs from "@theme/Tabs";
@@ -14,10 +14,10 @@ import ConnCSNative from "./_connect_cs.mdx";
import ConnC from "./_connect_c.mdx";
import ConnR from "./_connect_r.mdx";
import ConnPHP from "./_connect_php.mdx";
-import InstallOnWindows from "../../14-reference/03-connector/_linux_install.mdx";
-import InstallOnLinux from "../../14-reference/03-connector/_windows_install.mdx";
-import VerifyLinux from "../../14-reference/03-connector/_verify_linux.mdx";
-import VerifyWindows from "../../14-reference/03-connector/_verify_windows.mdx";
+import InstallOnWindows from "../../08-connector/_linux_install.mdx";
+import InstallOnLinux from "../../08-connector/_windows_install.mdx";
+import VerifyLinux from "../../08-connector/_verify_linux.mdx";
+import VerifyWindows from "../../08-connector/_verify_windows.mdx";
TDengine 提供了丰富的应用程序开发接口,为了便于用户快速开发自己的应用,TDengine 支持了多种编程语言的连接器,其中官方连接器包括支持 C/C++、Java、Python、Go、Node.js、C#、Rust、Lua(社区贡献)和 PHP (社区贡献)的连接器。这些连接器支持使用原生接口(taosc)和 REST 接口(部分语言暂不支持)连接 TDengine 集群。社区开发者也贡献了多个非官方连接器,例如 ADO.NET 连接器、Lua 连接器和 PHP 连接器。
@@ -33,7 +33,7 @@ TDengine 提供了丰富的应用程序开发接口,为了便于用户快速
关键不同点在于:
1. 使用 REST 连接,用户无需安装客户端驱动程序 taosc,具有跨平台易用的优势,但性能要下降 30%左右。
-2. 使用原生连接可以体验 TDengine 的全部功能,如[参数绑定接口](/reference/connector/cpp#参数绑定-api)、[订阅](/reference/connector/cpp#订阅和消费-api)等等。
+2. 使用原生连接可以体验 TDengine 的全部功能,如[参数绑定接口](../../connector/cpp/#参数绑定-api)、[订阅](../../connector/cpp/#订阅和消费-api)等等。
## 安装客户端驱动 taosc
@@ -223,7 +223,7 @@ phpize && ./configure && make -j && make install
**手动指定 TDengine 目录:**
```shell
-phpize && ./configure --with-tdengine-dir=/usr/local/Cellar/tdengine/2.4.0.0 && make -j && make install
+phpize && ./configure --with-tdengine-dir=/usr/local/Cellar/tdengine/3.0.0.0 && make -j && make install
```
> `--with-tdengine-dir=` 后跟上 TDengine 目录。
diff --git a/docs/zh/07-develop/02-model/index.mdx b/docs/zh/07-develop/02-model/index.mdx
index 1609eb5362cf40e7d134b0987968f7cc9bd31c92..634c8a98d4756253fbb39ffacb6f20888b66721d 100644
--- a/docs/zh/07-develop/02-model/index.mdx
+++ b/docs/zh/07-develop/02-model/index.mdx
@@ -1,5 +1,7 @@
---
+sidebar_label: 数据建模
title: TDengine 数据建模
+description: TDengine 中如何建立数据模型
---
TDengine 采用类关系型数据模型,需要建库、建表。因此对于一个具体的应用场景,需要考虑库、超级表和普通表的设计。本节不讨论细致的语法规则,只介绍概念。
diff --git a/docs/zh/07-develop/03-insert-data/01-sql-writing.mdx b/docs/zh/07-develop/03-insert-data/01-sql-writing.mdx
index 214cbdaa96d02e0cd1251eeda97c6a897887cc7e..2920fa35a447861fd5c34a84c1950b22407b214d 100644
--- a/docs/zh/07-develop/03-insert-data/01-sql-writing.mdx
+++ b/docs/zh/07-develop/03-insert-data/01-sql-writing.mdx
@@ -23,7 +23,7 @@ import PhpStmt from "./_php_stmt.mdx";
## SQL 写入简介
-应用通过连接器执行 INSERT 语句来插入数据,用户还可以通过 TAOS Shell,手动输入 INSERT 语句插入数据。
+应用通过连接器执行 INSERT 语句来插入数据,用户还可以通过 TDengine CLI,手动输入 INSERT 语句插入数据。
### 一次写入一条
下面这条 INSERT 就将一条记录写入到表 d1001 中:
diff --git a/docs/zh/07-develop/03-insert-data/05-high-volume.md b/docs/zh/07-develop/03-insert-data/05-high-volume.md
new file mode 100644
index 0000000000000000000000000000000000000000..32be8cb8903493f6b5290928a36507ae225a37df
--- /dev/null
+++ b/docs/zh/07-develop/03-insert-data/05-high-volume.md
@@ -0,0 +1,440 @@
+import Tabs from "@theme/Tabs";
+import TabItem from "@theme/TabItem";
+
+# 高效写入
+
+本节介绍如何高效地向 TDengine 写入数据。
+
+## 高效写入原理 {#principle}
+
+### 客户端程序的角度 {#application-view}
+
+从客户端程序的角度来说,高效写入数据要考虑以下几个因素:
+
+1. 单次写入的数据量。一般来讲,每批次写入的数据量越大越高效(但超过一定阈值其优势会消失)。使用 SQL 写入 TDengine 时,尽量在一条 SQL 中拼接更多数据。目前,TDengine 支持的一条 SQL 的最大长度为 1,048,576(1M)个字符。可通过配置客户端参数 maxSQLLength(默认值为 65480)进行修改。
+2. 并发连接数。一般来讲,同时写入数据的并发连接数越多写入越高效(但超过一定阈值反而会下降,取决于服务端处理能力)。
+3. 数据在不同表(或子表)之间的分布,即要写入数据的相邻性。一般来说,每批次只向同一张表(或子表)写入数据比向多张表(或子表)写入数据要更高效;
+4. 写入方式。一般来讲:
+ - 参数绑定写入比 SQL 写入更高效。因参数绑定方式避免了 SQL 解析。(但增加了 C 接口的调用次数,对于连接器也有性能损耗)。
+ - SQL 写入不自动建表比自动建表更高效。因自动建表要频繁检查表是否存在
+ - SQL 写入比无模式写入更高效。因无模式写入会自动建表且支持动态更改表结构
+
+客户端程序要充分且恰当地利用以上几个因素。在单次写入中尽量只向同一张表(或子表)写入数据,每批次写入的数据量经过测试和调优设定为一个最适合当前系统处理能力的数值,并发写入的连接数同样经过测试和调优后设定为一个最适合当前系统处理能力的数值,以实现在当前系统中的最佳写入速度。
+
+### 数据源的角度 {#datasource-view}
+
+客户端程序通常需要从数据源读数据再写入 TDengine。从数据源角度来说,以下几种情况需要在读线程和写线程之间增加队列:
+
+1. 有多个数据源,单个数据源生成数据的速度远小于单线程写入的速度,但数据量整体比较大。此时队列的作用是把多个数据源的数据汇聚到一起,增加单次写入的数据量。
+2. 单个数据源生成数据的速度远大于单线程写入的速度。此时队列的作用是增加写入的并发度。
+3. 单张表的数据分散在多个数据源。此时队列的作用是将同一张表的数据提前汇聚到一起,提高写入时数据的相邻性。
+
+如果写应用的数据源是 Kafka, 写应用本身即 Kafka 的消费者,则可利用 Kafka 的特性实现高效写入。比如:
+
+1. 将同一张表的数据写到同一个 Topic 的同一个 Partition,增加数据的相邻性
+2. 通过订阅多个 Topic 实现数据汇聚
+3. 通过增加 Consumer 线程数增加写入的并发度
+4. 通过增加每次 fetch 的最大数据量来增加单次写入的最大数据量
+
+### 服务器配置的角度 {#setting-view}
+
+从服务器配置的角度来说,也有很多优化写入性能的方法。
+
+如果总表数不多(远小于核数乘以1000), 且无论怎么调节客户端程序,taosd 进程的 CPU 使用率都很低,那么很可能是因为表在各个 vgroup 分布不均。比如:数据库总表数是 1000 且 minTablesPerVnode 设置的也是 1000,那么所有的表都会分布在 1 个 vgroup 上。此时如果将 minTablesPerVnode 和 tablelncStepPerVnode 都设置成 100, 则可将表分布至 10 个 vgroup。(假设 maxVgroupsPerDb 大于等于 10)。
+
+如果总表数比较大(比如大于500万),适当增加 maxVgroupsPerDb 也能显著提高建表的速度。maxVgroupsPerDb 默认值为 0, 自动配置为 CPU 的核数。 如果表的数量巨大,也建议调节 maxTablesPerVnode 参数,以免超过单个 vnode 建表的上限。
+
+更多调优参数,请参考 [配置参考](../../../reference/config)部分。
+
+## 高效写入示例 {#sample-code}
+
+### 场景设计 {#scenario}
+
+下面的示例程序展示了如何高效写入数据,场景设计如下:
+
+- TDengine 客户端程序从其它数据源不断读入数据,在示例程序中采用生成模拟数据的方式来模拟读取数据源
+- 单个连接向 TDengine 写入的速度无法与读数据的速度相匹配,因此客户端程序启动多个线程,每个线程都建立了与 TDengine 的连接,每个线程都有一个独占的固定大小的消息队列
+- 客户端程序将接收到的数据根据所属的表名(或子表名)HASH 到不同的线程,即写入该线程所对应的消息队列,以此确保属于某个表(或子表)的数据一定会被一个固定的线程处理
+- 各个子线程在将所关联的消息队列中的数据读空后或者读取数据量达到一个预定的阈值后将该批数据写入 TDengine,并继续处理后面接收到的数据
+
+![TDengine 高效写入示例场景的线程模型](highvolume.webp)
+
+### 示例代码 {#code}
+
+这一部分是针对以上场景的示例代码。对于其它场景高效写入原理相同,不过代码需要适当修改。
+
+本示例代码假设源数据属于同一张超级表(meters)的不同子表。程序在开始写入数据之前已经在 test 库创建了这个超级表。对于子表,将根据收到的数据,由应用程序自动创建。如果实际场景是多个超级表,只需修改写任务自动建表的代码。
+
+
+
+
+**程序清单**
+
+| 类名 | 功能说明 |
+| ---------------- | --------------------------------------------------------------------------- |
+| FastWriteExample | 主程序 |
+| ReadTask | 从模拟源中读取数据,将表名经过 hash 后得到 Queue 的 index,写入对应的 Queue |
+| WriteTask | 从 Queue 中获取数据,组成一个 Batch,写入 TDengine |
+| MockDataSource | 模拟生成一定数量 meters 子表的数据 |
+| SQLWriter | WriteTask 依赖这个类完成 SQL 拼接、自动建表、 SQL 写入、SQL 长度检查 |
+| StmtWriter | 实现参数绑定方式批量写入(暂未完成) |
+| DataBaseMonitor | 统计写入速度,并每隔 10 秒把当前写入速度打印到控制台 |
+
+
+以下是各类的完整代码和更详细的功能说明。
+
+
+FastWriteExample
+主程序负责:
+
+1. 创建消息队列
+2. 启动写线程
+3. 启动读线程
+4. 每隔 10 秒统计一次写入速度
+
+主程序默认暴露了 4 个参数,每次启动程序都可调节,用于测试和调优:
+
+1. 读线程个数。默认为 1。
+2. 写线程个数。默认为 3。
+3. 模拟生成的总表数。默认为 1000。将会平分给各个读线程。如果总表数较大,建表需要花费较长,开始统计的写入速度可能较慢。
+4. 每批最多写入记录数量。默认为 3000。
+
+队列容量(taskQueueCapacity)也是与性能有关的参数,可通过修改程序调节。一般来讲,队列容量越大,入队被阻塞的概率越小,队列的吞吐量越大,但是内存占用也会越大。 示例程序默认值已经设置地足够大。
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/FastWriteExample.java}}
+```
+
+
+
+
+ReadTask
+
+读任务负责从数据源读数据。每个读任务都关联了一个模拟数据源。每个模拟数据源可生成一点数量表的数据。不同的模拟数据源生成不同表的数据。
+
+读任务采用阻塞的方式写消息队列。也就是说,一旦队列满了,写操作就会阻塞。
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/ReadTask.java}}
+```
+
+
+
+
+WriteTask
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/WriteTask.java}}
+```
+
+
+
+
+
+MockDataSource
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/MockDataSource.java}}
+```
+
+
+
+
+
+SQLWriter
+
+SQLWriter 类封装了拼 SQL 和写数据的逻辑。注意,所有的表都没有提前创建,而是在 catch 到表不存在异常的时候,再以超级表为模板批量建表,然后重新执行 INSERT 语句。对于其它异常,这里简单地记录当时执行的 SQL 语句到日志中,你也可以记录更多线索到日志,已便排查错误和故障恢复。
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java}}
+```
+
+
+
+
+
+DataBaseMonitor
+
+```java
+{{#include docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java}}
+```
+
+
+
+**执行步骤**
+
+
+执行 Java 示例程序
+
+执行程序前需配置环境变量 `TDENGINE_JDBC_URL`。如果 TDengine Server 部署在本机,且用户名、密码和端口都是默认值,那么可配置:
+
+```
+TDENGINE_JDBC_URL="jdbc:TAOS://localhost:6030?user=root&password=taosdata"
+```
+
+**本地集成开发环境执行示例程序**
+
+1. clone TDengine 仓库
+ ```
+ git clone git@github.com:taosdata/TDengine.git --depth 1
+ ```
+2. 用集成开发环境打开 `docs/examples/java` 目录。
+3. 在开发环境中配置环境变量 `TDENGINE_JDBC_URL`。如果已配置了全局的环境变量 `TDENGINE_JDBC_URL` 可跳过这一步。
+4. 运行类 `com.taos.example.highvolume.FastWriteExample`。
+
+**远程服务器上执行示例程序**
+
+若要在服务器上执行示例程序,可按照下面的步骤操作:
+
+1. 打包示例代码。在目录 TDengine/docs/examples/java 下执行:
+ ```
+ mvn package
+ ```
+2. 远程服务器上创建 examples 目录:
+ ```
+ mkdir -p examples/java
+ ```
+3. 复制依赖到服务器指定目录:
+ - 复制依赖包,只用复制一次
+ ```
+ scp -r .\target\lib @:~/examples/java
+ ```
+ - 复制本程序的 jar 包,每次更新代码都需要复制
+ ```
+ scp -r .\target\javaexample-1.0.jar @:~/examples/java
+ ```
+4. 配置环境变量。
+ 编辑 `~/.bash_profile` 或 `~/.bashrc` 添加如下内容例如:
+
+ ```
+ export TDENGINE_JDBC_URL="jdbc:TAOS://localhost:6030?user=root&password=taosdata"
+ ```
+
+ 以上使用的是本地部署 TDengine Server 时默认的 JDBC URL。你需要根据自己的实际情况更改。
+
+5. 用 java 命令启动示例程序,命令模板:
+
+ ```
+ java -classpath lib/*:javaexample-1.0.jar com.taos.example.highvolume.FastWriteExample
+ ```
+
+6. 结束测试程序。测试程序不会自动结束,在获取到当前配置下稳定的写入速度后,按 CTRL + C 结束程序。
+ 下面是一次实际运行的日志输出,机器配置 16核 + 64G + 固态硬盘。
+
+ ```
+ root@vm85$ java -classpath lib/*:javaexample-1.0.jar com.taos.example.highvolume.FastWriteExample 2 12
+ 18:56:35.896 [main] INFO c.t.e.highvolume.FastWriteExample - readTaskCount=2, writeTaskCount=12 tableCount=1000 maxBatchSize=3000
+ 18:56:36.011 [WriteThread-0] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.015 [WriteThread-0] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.021 [WriteThread-1] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.022 [WriteThread-1] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.031 [WriteThread-2] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.032 [WriteThread-2] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.041 [WriteThread-3] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.042 [WriteThread-3] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.093 [WriteThread-4] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.094 [WriteThread-4] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.099 [WriteThread-5] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.100 [WriteThread-5] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.100 [WriteThread-6] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.101 [WriteThread-6] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.103 [WriteThread-7] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.104 [WriteThread-7] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.105 [WriteThread-8] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.107 [WriteThread-8] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.108 [WriteThread-9] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.109 [WriteThread-9] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.156 [WriteThread-10] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.157 [WriteThread-11] INFO c.taos.example.highvolume.WriteTask - started
+ 18:56:36.158 [WriteThread-10] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:36.158 [ReadThread-0] INFO com.taos.example.highvolume.ReadTask - started
+ 18:56:36.158 [ReadThread-1] INFO com.taos.example.highvolume.ReadTask - started
+ 18:56:36.158 [WriteThread-11] INFO c.taos.example.highvolume.SQLWriter - maxSQLLength=1048576
+ 18:56:46.369 [main] INFO c.t.e.highvolume.FastWriteExample - count=18554448 speed=1855444
+ 18:56:56.946 [main] INFO c.t.e.highvolume.FastWriteExample - count=39059660 speed=2050521
+ 18:57:07.322 [main] INFO c.t.e.highvolume.FastWriteExample - count=59403604 speed=2034394
+ 18:57:18.032 [main] INFO c.t.e.highvolume.FastWriteExample - count=80262938 speed=2085933
+ 18:57:28.432 [main] INFO c.t.e.highvolume.FastWriteExample - count=101139906 speed=2087696
+ 18:57:38.921 [main] INFO c.t.e.highvolume.FastWriteExample - count=121807202 speed=2066729
+ 18:57:49.375 [main] INFO c.t.e.highvolume.FastWriteExample - count=142952417 speed=2114521
+ 18:58:00.689 [main] INFO c.t.e.highvolume.FastWriteExample - count=163650306 speed=2069788
+ 18:58:11.646 [main] INFO c.t.e.highvolume.FastWriteExample - count=185019808 speed=2136950
+ ```
+
+
+
+
+
+
+**程序清单**
+
+Python 示例程序中采用了多进程的架构,并使用了跨进程的消息队列。
+
+| 函数或类 | 功能说明 |
+| ------------------------ | -------------------------------------------------------------------- |
+| main 函数 | 程序入口, 创建各个子进程和消息队列 |
+| run_monitor_process 函数 | 创建数据库,超级表,统计写入速度并定时打印到控制台 |
+| run_read_task 函数 | 读进程主要逻辑,负责从其它数据系统读数据,并分发数据到为之分配的队列 |
+| MockDataSource 类 | 模拟数据源, 实现迭代器接口,每次批量返回每张表的接下来 1000 条数据 |
+| run_write_task 函数 | 写进程主要逻辑。每次从队列中取出尽量多的数据,并批量写入 |
+| SQLWriter类 | SQL 写入和自动建表 |
+| StmtWriter 类 | 实现参数绑定方式批量写入(暂未完成) |
+
+
+
+main 函数
+
+main 函数负责创建消息队列和启动子进程,子进程有 3 类:
+
+1. 1 个监控进程,负责数据库初始化和统计写入速度
+2. n 个读进程,负责从其它数据系统读数据
+3. m 个写进程,负责写数据库
+
+main 函数可以接收 5 个启动参数,依次是:
+
+1. 读任务(进程)数, 默认为 1
+2. 写任务(进程)数, 默认为 1
+3. 模拟生成的总表数,默认为 1000
+4. 队列大小(单位字节),默认为 1000000
+5. 每批最多写入记录数量, 默认为 3000
+
+```python
+{{#include docs/examples/python/fast_write_example.py:main}}
+```
+
+
+
+
+run_monitor_process
+
+监控进程负责初始化数据库,并监控当前的写入速度。
+
+```python
+{{#include docs/examples/python/fast_write_example.py:monitor}}
+```
+
+
+
+
+
+run_read_task 函数
+
+读进程,负责从其它数据系统读数据,并分发数据到为之分配的队列。
+
+```python
+{{#include docs/examples/python/fast_write_example.py:read}}
+```
+
+
+
+
+
+MockDataSource
+
+以下是模拟数据源的实现,我们假设数据源生成的每一条数据都带有目标表名信息。实际中你可能需要一定的规则确定目标表名。
+
+```python
+{{#include docs/examples/python/mockdatasource.py}}
+```
+
+
+
+
+run_write_task 函数
+
+写进程每次从队列中取出尽量多的数据,并批量写入。
+
+```python
+{{#include docs/examples/python/fast_write_example.py:write}}
+```
+
+
+
+
+
+SQLWriter 类封装了拼 SQL 和写数据的逻辑。所有的表都没有提前创建,而是在发生表不存在错误的时候,再以超级表为模板批量建表,然后重新执行 INSERT 语句。对于其它错误会记录当时执行的 SQL, 以便排查错误和故障恢复。这个类也对 SQL 是否超过最大长度限制做了检查,如果接近 SQL 最大长度限制(maxSQLLength),将会立即执行 SQL。为了减少 SQL 此时,建议将 maxSQLLength 适当调大。
+
+SQLWriter
+
+```python
+{{#include docs/examples/python/sql_writer.py}}
+```
+
+
+
+**执行步骤**
+
+
+
+执行 Python 示例程序
+
+1. 前提条件
+
+ - 已安装 TDengine 客户端驱动
+ - 已安装 Python3, 推荐版本 >= 3.8
+ - 已安装 taospy
+
+2. 安装 faster-fifo 代替 python 内置的 multiprocessing.Queue
+
+ ```
+ pip3 install faster-fifo
+ ```
+
+3. 点击上面的“查看源码”链接复制 `fast_write_example.py` 、 `sql_writer.py` 和 `mockdatasource.py` 三个文件。
+
+4. 执行示例程序
+
+ ```
+ python3 fast_write_example.py
+ ```
+
+ 下面是一次实际运行的输出, 机器配置 16核 + 64G + 固态硬盘。
+
+ ```
+ root@vm85$ python3 fast_write_example.py 8 8
+ 2022-07-14 19:13:45,869 [root] - READ_TASK_COUNT=8, WRITE_TASK_COUNT=8, TABLE_COUNT=1000, QUEUE_SIZE=1000000, MAX_BATCH_SIZE=3000
+ 2022-07-14 19:13:48,882 [root] - WriteTask-0 started with pid 718347
+ 2022-07-14 19:13:48,883 [root] - WriteTask-1 started with pid 718348
+ 2022-07-14 19:13:48,884 [root] - WriteTask-2 started with pid 718349
+ 2022-07-14 19:13:48,884 [root] - WriteTask-3 started with pid 718350
+ 2022-07-14 19:13:48,885 [root] - WriteTask-4 started with pid 718351
+ 2022-07-14 19:13:48,885 [root] - WriteTask-5 started with pid 718352
+ 2022-07-14 19:13:48,886 [root] - WriteTask-6 started with pid 718353
+ 2022-07-14 19:13:48,886 [root] - WriteTask-7 started with pid 718354
+ 2022-07-14 19:13:48,887 [root] - ReadTask-0 started with pid 718355
+ 2022-07-14 19:13:48,888 [root] - ReadTask-1 started with pid 718356
+ 2022-07-14 19:13:48,889 [root] - ReadTask-2 started with pid 718357
+ 2022-07-14 19:13:48,889 [root] - ReadTask-3 started with pid 718358
+ 2022-07-14 19:13:48,890 [root] - ReadTask-4 started with pid 718359
+ 2022-07-14 19:13:48,891 [root] - ReadTask-5 started with pid 718361
+ 2022-07-14 19:13:48,892 [root] - ReadTask-6 started with pid 718364
+ 2022-07-14 19:13:48,893 [root] - ReadTask-7 started with pid 718365
+ 2022-07-14 19:13:56,042 [DataBaseMonitor] - count=6676310 speed=667631.0
+ 2022-07-14 19:14:06,196 [DataBaseMonitor] - count=20004310 speed=1332800.0
+ 2022-07-14 19:14:16,366 [DataBaseMonitor] - count=32290310 speed=1228600.0
+ 2022-07-14 19:14:26,527 [DataBaseMonitor] - count=44438310 speed=1214800.0
+ 2022-07-14 19:14:36,673 [DataBaseMonitor] - count=56608310 speed=1217000.0
+ 2022-07-14 19:14:46,834 [DataBaseMonitor] - count=68757310 speed=1214900.0
+ 2022-07-14 19:14:57,280 [DataBaseMonitor] - count=80992310 speed=1223500.0
+ 2022-07-14 19:15:07,689 [DataBaseMonitor] - count=93805310 speed=1281300.0
+ 2022-07-14 19:15:18,020 [DataBaseMonitor] - count=106111310 speed=1230600.0
+ 2022-07-14 19:15:28,356 [DataBaseMonitor] - count=118394310 speed=1228300.0
+ 2022-07-14 19:15:38,690 [DataBaseMonitor] - count=130742310 speed=1234800.0
+ 2022-07-14 19:15:49,000 [DataBaseMonitor] - count=143051310 speed=1230900.0
+ 2022-07-14 19:15:59,323 [DataBaseMonitor] - count=155276310 speed=1222500.0
+ 2022-07-14 19:16:09,649 [DataBaseMonitor] - count=167603310 speed=1232700.0
+ 2022-07-14 19:16:19,995 [DataBaseMonitor] - count=179976310 speed=1237300.0
+ ```
+
+
+
+:::note
+使用 Python 连接器多进程连接 TDengine 的时候,有一个限制:不能在父进程中建立连接,所有连接只能在子进程中创建。
+如果在父进程中创建连接,子进程再创建连接就会一直阻塞。这是个已知问题。
+
+:::
+
+
+
+
+
diff --git a/docs/zh/07-develop/03-insert-data/highvolume.webp b/docs/zh/07-develop/03-insert-data/highvolume.webp
new file mode 100644
index 0000000000000000000000000000000000000000..46dfc74ae3b0043c591ff930c62251da49cae7ad
Binary files /dev/null and b/docs/zh/07-develop/03-insert-data/highvolume.webp differ
diff --git a/docs/zh/07-develop/03-insert-data/index.md b/docs/zh/07-develop/03-insert-data/index.md
index 55a28e4a8ba13501e2f481c9aba67b7300da98d0..f1e5ada4dfd350e982fa0ae57412af07ac43e03a 100644
--- a/docs/zh/07-develop/03-insert-data/index.md
+++ b/docs/zh/07-develop/03-insert-data/index.md
@@ -1,5 +1,7 @@
---
+sidebar_label: 写入数据
title: 写入数据
+description: TDengine 的各种写入方式
---
TDengine 支持多种写入协议,包括 SQL,InfluxDB Line 协议, OpenTSDB Telnet 协议,OpenTSDB JSON 格式协议。数据可以单条插入,也可以批量插入,可以插入一个数据采集点的数据,也可以同时插入多个数据采集点的数据。同时,TDengine 支持多线程插入,支持时间乱序数据插入,也支持历史数据插入。InfluxDB Line 协议、OpenTSDB Telnet 协议和 OpenTSDB JSON 格式协议是 TDengine 支持的三种无模式写入协议。使用无模式方式写入无需提前创建超级表和子表,并且引擎能自适用数据对表结构做调整。
diff --git a/docs/zh/07-develop/04-query-data/index.mdx b/docs/zh/07-develop/04-query-data/index.mdx
index 2631d147a5f3e968e7153de8576e96f2c07c57cd..92cb1906d9530238b156856b0b6b0dcc9719111f 100644
--- a/docs/zh/07-develop/04-query-data/index.mdx
+++ b/docs/zh/07-develop/04-query-data/index.mdx
@@ -1,4 +1,5 @@
---
+sidebar_label: 查询数据
title: 查询数据
description: "主要查询功能,通过连接器执行同步查询和异步查询"
---
@@ -51,7 +52,7 @@ Query OK, 2 row(s) in set (0.001100s)
### 示例一
-在 TAOS Shell,查找加利福尼亚州所有智能电表采集的电压平均值,并按照 location 分组。
+在 TDengine CLI,查找加利福尼亚州所有智能电表采集的电压平均值,并按照 location 分组。
```
taos> SELECT AVG(voltage), location FROM meters GROUP BY location;
@@ -64,7 +65,7 @@ Query OK, 2 rows in database (0.005995s)
### 示例二
-在 TAOS shell, 查找 groupId 为 2 的所有智能电表的记录条数,电流的最大值。
+在 TDengine CLI, 查找 groupId 为 2 的所有智能电表的记录条数,电流的最大值。
```
taos> SELECT count(*), max(current) FROM meters where groupId = 2;
diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx
index da8bf5e20ed9d230419150dd10ee6739d85a37e9..2f5c13d9b0bc0e3940fb99b45c693e2ae80c8f47 100644
--- a/docs/zh/07-develop/07-tmq.mdx
+++ b/docs/zh/07-develop/07-tmq.mdx
@@ -64,7 +64,7 @@ DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
```
-这些 API 的文档请见 [C/C++ Connector](/reference/connector/cpp),下面介绍一下它们的具体用法(超级表和子表结构请参考“数据建模”一节),完整的示例代码请见下面 C 语言的示例代码。
+这些 API 的文档请见 [C/C++ Connector](../../connector/cpp),下面介绍一下它们的具体用法(超级表和子表结构请参考“数据建模”一节),完整的示例代码请见下面 C 语言的示例代码。
diff --git a/docs/zh/07-develop/08-cache.md b/docs/zh/07-develop/08-cache.md
index bd9da6062d3cc1a21be418079f0fee40520f4460..29e28e3dde0816d9e5a08f74abd2382854d336da 100644
--- a/docs/zh/07-develop/08-cache.md
+++ b/docs/zh/07-develop/08-cache.md
@@ -20,11 +20,11 @@ create database db0 vgroups 100 buffer 16MB
## 读缓存
-在创建数据库时可以选择是否缓存该数据库中每个子表的最新数据。由参数 cachelast 设置,分为三种情况:
-- 0: 不缓存
-- 1: 缓存子表最近一行数据,这将显著改善 last_row 函数的性能
-- 2: 缓存子表每一列最近的非 NULL 值,这将显著改善无特殊影响(比如 WHERE, ORDER BY, GROUP BY, INTERVAL)时的 last 函数的性能
-- 3: 同时缓存行和列,即等同于上述 cachelast 值为 1 或 2 时的行为同时生效
+在创建数据库时可以选择是否缓存该数据库中每个子表的最新数据。由参数 cachemodel 设置,分为四种情况:
+- none: 不缓存
+- last_row: 缓存子表最近一行数据,这将显著改善 last_row 函数的性能
+- last_value: 缓存子表每一列最近的非 NULL 值,这将显著改善无特殊影响(比如 WHERE, ORDER BY, GROUP BY, INTERVAL)时的 last 函数的性能
+- both: 同时缓存最近的行和列,即等同于上述 cachemodel 值为 last_row 和 last_value 的行为同时生效
## 元数据缓存
diff --git a/docs/zh/07-develop/index.md b/docs/zh/07-develop/index.md
index 4d0f3c3cea3da3d70051dd07f835c34b4f47c3cd..efaffaea71ce68ee0a8ddbf5634c4150adc94bfb 100644
--- a/docs/zh/07-develop/index.md
+++ b/docs/zh/07-develop/index.md
@@ -1,5 +1,7 @@
---
title: 开发指南
+sidebar_label: 开发指南
+description: 让开发者能够快速上手的指南
---
开发一个应用,如果你准备采用TDengine作为时序数据处理的工具,那么有如下几个事情要做:
@@ -12,7 +14,7 @@ title: 开发指南
7. 在很多场景下(如车辆管理),应用需要获取每个数据采集点的最新状态,那么建议你采用TDengine的cache功能,而不用单独部署Redis等缓存软件。
8. 如果你发现TDengine的函数无法满足你的要求,那么你可以使用用户自定义函数来解决问题。
-本部分内容就是按照上述的顺序组织的。为便于理解,TDengine为每个功能为每个支持的编程语言都提供了示例代码。如果你希望深入了解SQL的使用,需要查看[SQL手册](/taos-sql/)。如果想更深入地了解各连接器的使用,请阅读[连接器参考指南](/reference/connector/)。如果还希望想将TDengine与第三方系统集成起来,比如Grafana, 请参考[第三方工具](/third-party/)。
+本部分内容就是按照上述的顺序组织的。为便于理解,TDengine为每个功能为每个支持的编程语言都提供了示例代码。如果你希望深入了解SQL的使用,需要查看[SQL手册](/taos-sql/)。如果想更深入地了解各连接器的使用,请阅读[连接器参考指南](../connector/)。如果还希望想将TDengine与第三方系统集成起来,比如Grafana, 请参考[第三方工具](../third-party/)。
如果在开发过程中遇到任何问题,请点击每个页面下方的["反馈问题"](https://github.com/taosdata/TDengine/issues/new/choose), 在GitHub上直接递交issue。
diff --git a/docs/zh/14-reference/02-rest-api/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx
similarity index 96%
rename from docs/zh/14-reference/02-rest-api/02-rest-api.mdx
rename to docs/zh/08-connector/02-rest-api.mdx
index 4b9171c07d165bfa10aea14871da2697cae4b54d..e254244657b457e10bc2daab020b230c9a8bb2cc 100644
--- a/docs/zh/14-reference/02-rest-api/02-rest-api.mdx
+++ b/docs/zh/08-connector/02-rest-api.mdx
@@ -1,5 +1,7 @@
---
title: REST API
+sidebar_label: REST API
+description: 详细介绍 TDengine 提供的 RESTful API.
---
为支持各种不同类型平台的开发,TDengine 提供符合 REST 设计标准的 API,即 REST API。为最大程度降低学习成本,不同于其他数据库 REST API 的设计方法,TDengine 直接通过 HTTP POST 请求 BODY 中包含的 SQL 语句来操作数据库,仅需要一个 URL。REST 连接器的使用参见 [视频教程](https://www.taosdata.com/blog/2020/11/11/1965.html)。
@@ -10,7 +12,7 @@ title: REST API
## 安装
-RESTful 接口不依赖于任何 TDengine 的库,因此客户端不需要安装任何 TDengine 的库,只要客户端的开发语言支持 HTTP 协议即可。
+RESTful 接口不依赖于任何 TDengine 的库,因此客户端不需要安装任何 TDengine 的库,只要客户端的开发语言支持 HTTP 协议即可。TDengine 的 RESTful API 由 [taosAdapter](../../reference/taosadapter) 提供,在使用 RESTful API 之前需要确保 `taosAdapter` 正常运行。
## 验证
diff --git a/docs/zh/14-reference/03-connector/cpp.mdx b/docs/zh/08-connector/03-cpp.mdx
similarity index 99%
rename from docs/zh/14-reference/03-connector/cpp.mdx
rename to docs/zh/08-connector/03-cpp.mdx
index bd5776d035b0228637f7ed2255c502ed73d6a654..c0bd33f12964537699849e35644a8c04e0f716f0 100644
--- a/docs/zh/14-reference/03-connector/cpp.mdx
+++ b/docs/zh/08-connector/03-cpp.mdx
@@ -1,5 +1,4 @@
---
-sidebar_position: 1
sidebar_label: C/C++
title: C/C++ Connector
---
@@ -22,7 +21,7 @@ TDengine 客户端驱动的动态库位于:
## 支持的平台
-请参考[支持的平台列表](/reference/connector#支持的平台)
+请参考[支持的平台列表](../#支持的平台)
## 支持的版本
@@ -30,7 +29,7 @@ TDengine 客户端驱动的版本号与 TDengine 服务端的版本号是一一
## 安装步骤
-TDengine 客户端驱动的安装请参考 [安装指南](/reference/connector#安装步骤)
+TDengine 客户端驱动的安装请参考 [安装指南](../#安装步骤)
## 建立连接
diff --git a/docs/zh/14-reference/03-connector/java.mdx b/docs/zh/08-connector/04-java.mdx
similarity index 99%
rename from docs/zh/14-reference/03-connector/java.mdx
rename to docs/zh/08-connector/04-java.mdx
index 183994313e205bbaf13f30d534fa151a23216708..6b1715f8c6a2f949fca552885ea3920f43e8a849 100644
--- a/docs/zh/14-reference/03-connector/java.mdx
+++ b/docs/zh/08-connector/04-java.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 2
sidebar_label: Java
title: TDengine Java Connector
description: TDengine Java 连接器基于标准 JDBC API 实现, 并提供原生连接与 REST连接两种连接器。
@@ -35,7 +34,7 @@ REST 连接支持所有能运行 Java 的平台。
## 版本支持
-请参考[版本支持列表](/reference/connector#版本支持)
+请参考[版本支持列表](../#版本支持)
## TDengine DataType 和 Java DataType
@@ -64,7 +63,7 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Java 对
使用 Java Connector 连接数据库前,需要具备以下条件:
- 已安装 Java 1.8 或以上版本运行时环境和 Maven 3.6 或以上版本
-- 已安装 TDengine 客户端驱动(使用原生连接必须安装,使用 REST 连接无需安装),具体步骤请参考[安装客户端驱动](/reference/connector#安装客户端驱动)
+- 已安装 TDengine 客户端驱动(使用原生连接必须安装,使用 REST 连接无需安装),具体步骤请参考[安装客户端驱动](../#安装客户端驱动)
### 安装连接器
@@ -630,7 +629,7 @@ public void setNString(int columnIndex, ArrayList list, int size) throws
### 无模式写入
-TDengine 支持无模式写入功能。无模式写入兼容 InfluxDB 的 行协议(Line Protocol)、OpenTSDB 的 telnet 行协议和 OpenTSDB 的 JSON 格式协议。详情请参见[无模式写入](../../schemaless)。
+TDengine 支持无模式写入功能。无模式写入兼容 InfluxDB 的 行协议(Line Protocol)、OpenTSDB 的 telnet 行协议和 OpenTSDB 的 JSON 格式协议。详情请参见[无模式写入](../../reference/schemaless/)。
**注意**:
diff --git a/docs/zh/14-reference/03-connector/go.mdx b/docs/zh/08-connector/05-go.mdx
similarity index 95%
rename from docs/zh/14-reference/03-connector/go.mdx
rename to docs/zh/08-connector/05-go.mdx
index a87c948d4a3c0e0764e6c4823608bf7d8b171f24..9d30f75190cddbb17c40e97655002a158cd6aae6 100644
--- a/docs/zh/14-reference/03-connector/go.mdx
+++ b/docs/zh/08-connector/05-go.mdx
@@ -9,11 +9,11 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Preparition from "./_preparition.mdx"
-import GoInsert from "../../07-develop/03-insert-data/_go_sql.mdx"
-import GoInfluxLine from "../../07-develop/03-insert-data/_go_line.mdx"
-import GoOpenTSDBTelnet from "../../07-develop/03-insert-data/_go_opts_telnet.mdx"
-import GoOpenTSDBJson from "../../07-develop/03-insert-data/_go_opts_json.mdx"
-import GoQuery from "../../07-develop/04-query-data/_go.mdx"
+import GoInsert from "../07-develop/03-insert-data/_go_sql.mdx"
+import GoInfluxLine from "../07-develop/03-insert-data/_go_line.mdx"
+import GoOpenTSDBTelnet from "../07-develop/03-insert-data/_go_opts_telnet.mdx"
+import GoOpenTSDBJson from "../07-develop/03-insert-data/_go_opts_json.mdx"
+import GoQuery from "../07-develop/04-query-data/_go.mdx"
`driver-go` 是 TDengine 的官方 Go 语言连接器,实现了 Go 语言[ database/sql ](https://golang.org/pkg/database/sql/) 包的接口。Go 开发人员可以通过它开发存取 TDengine 集群数据的应用软件。
@@ -30,7 +30,7 @@ REST 连接支持所有能运行 Go 的平台。
## 版本支持
-请参考[版本支持列表](/reference/connector#版本支持)
+请参考[版本支持列表](../#版本支持)
## 支持的功能特性
@@ -56,7 +56,7 @@ REST 连接支持所有能运行 Go 的平台。
### 安装前准备
* 安装 Go 开发环境(Go 1.14 及以上,GCC 4.8.5 及以上)
-* 如果使用原生连接器,请安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](/reference/connector#安装客户端驱动)
+* 如果使用原生连接器,请安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](../#安装客户端驱动)
配置好环境变量,检查命令:
diff --git a/docs/zh/14-reference/03-connector/rust.mdx b/docs/zh/08-connector/06-rust.mdx
similarity index 97%
rename from docs/zh/14-reference/03-connector/rust.mdx
rename to docs/zh/08-connector/06-rust.mdx
index ae644e191166e244ae42373aeef2cbbacbe9e0e1..26f53c82d630fda168dd98b4c8ec993afc5e3a1d 100644
--- a/docs/zh/14-reference/03-connector/rust.mdx
+++ b/docs/zh/08-connector/06-rust.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 5
sidebar_label: Rust
title: TDengine Rust Connector
---
@@ -9,9 +8,9 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Preparition from "./_preparition.mdx"
-import RustInsert from "../../07-develop/03-insert-data/_rust_sql.mdx"
-import RustBind from "../../07-develop/03-insert-data/_rust_stmt.mdx"
-import RustQuery from "../../07-develop/04-query-data/_rust.mdx"
+import RustInsert from "../07-develop/03-insert-data/_rust_sql.mdx"
+import RustBind from "../07-develop/03-insert-data/_rust_stmt.mdx"
+import RustQuery from "../07-develop/04-query-data/_rust.mdx"
[![Crates.io](https://img.shields.io/crates/v/taos)](https://crates.io/crates/taos) ![Crates.io](https://img.shields.io/crates/d/taos) [![docs.rs](https://img.shields.io/docsrs/taos)](https://docs.rs/taos)
@@ -28,7 +27,7 @@ Websocket 连接支持所有能运行 Rust 的平台。
## 版本支持
-请参考[版本支持列表](/reference/connector#版本支持)
+请参考[版本支持列表](../#版本支持)
Rust 连接器仍然在快速开发中,1.0 之前无法保证其向后兼容。建议使用 3.0 版本以上的 TDengine,以避免已知问题。
@@ -37,7 +36,7 @@ Rust 连接器仍然在快速开发中,1.0 之前无法保证其向后兼容
### 安装前准备
* 安装 Rust 开发工具链
-* 如果使用原生连接,请安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](/reference/connector#安装客户端驱动)
+* 如果使用原生连接,请安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](../#安装客户端驱动)
### 添加 taos 依赖
diff --git a/docs/zh/14-reference/03-connector/python.mdx b/docs/zh/08-connector/07-python.mdx
similarity index 95%
rename from docs/zh/14-reference/03-connector/python.mdx
rename to docs/zh/08-connector/07-python.mdx
index d7b17dc74a6d62da3adfd1a10d8d62a9570226a1..0242486d3b8820ac38301d38ccbaf8bb9fc7e1c3 100644
--- a/docs/zh/14-reference/03-connector/python.mdx
+++ b/docs/zh/08-connector/07-python.mdx
@@ -1,5 +1,4 @@
---
-sidebar_position: 3
sidebar_label: Python
title: TDengine Python Connector
description: "taospy 是 TDengine 的官方 Python 连接器。taospy 提供了丰富的 API, 使得 Python 应用可以很方便地使用 TDengine。tasopy 对 TDengine 的原生接口和 REST 接口都进行了封装, 分别对应 tasopy 的两个子模块:tasos 和 taosrest。除了对原生接口和 REST 接口的封装,taospy 还提供了符合 Python 数据访问规范(PEP 249)的编程接口。这使得 taospy 和很多第三方工具集成变得简单,比如 SQLAlchemy 和 pandas"
@@ -8,7 +7,7 @@ description: "taospy 是 TDengine 的官方 Python 连接器。taospy 提供了
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
-`taospy` 是 TDengine 的官方 Python 连接器。`taospy` 提供了丰富的 API, 使得 Python 应用可以很方便地使用 TDengine。`taospy` 对 TDengine 的[原生接口](/reference/connector/cpp)和 [REST 接口](/reference/rest-api)都进行了封装, 分别对应 `taospy` 包的 `taos` 模块 和 `taosrest` 模块。
+`taospy` 是 TDengine 的官方 Python 连接器。`taospy` 提供了丰富的 API, 使得 Python 应用可以很方便地使用 TDengine。`taospy` 对 TDengine 的[原生接口](../cpp)和 [REST 接口](../rest-api)都进行了封装, 分别对应 `taospy` 包的 `taos` 模块 和 `taosrest` 模块。
除了对原生接口和 REST 接口的封装,`taospy` 还提供了符合 [Python 数据访问规范(PEP 249)](https://peps.python.org/pep-0249/) 的编程接口。这使得 `taospy` 和很多第三方工具集成变得简单,比如 [SQLAlchemy](https://www.sqlalchemy.org/) 和 [pandas](https://pandas.pydata.org/)。
使用客户端驱动提供的原生接口直接与服务端建立的连接的方式下文中称为“原生连接”;使用 taosAdapter 提供的 REST 接口与服务端建立的连接的方式下文中称为“REST 连接”。
@@ -17,7 +16,7 @@ Python 连接器的源码托管在 [GitHub](https://github.com/taosdata/taos-con
## 支持的平台
-- 原生连接[支持的平台](/reference/connector/#支持的平台)和 TDengine 客户端支持的平台一致。
+- 原生连接[支持的平台](../#支持的平台)和 TDengine 客户端支持的平台一致。
- REST 连接支持所有能运行 Python 的平台。
## 版本选择
@@ -150,10 +149,19 @@ curl -u root:taosdata http://:/rest/sql -d "select server_version()"
```json
{
- "status": "succ",
- "head": ["server_version()"],
- "column_meta": [["server_version()", 8, 8]],
- "data": [["2.4.0.16"]],
+ "code": 0,
+ "column_meta": [
+ [
+ "server_version()",
+ "VARCHAR",
+ 7
+ ]
+ ],
+ "data": [
+ [
+ "3.0.0.0"
+ ]
+ ],
"rows": 1
}
```
@@ -266,7 +274,7 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
##### RestClient 类的使用
-`RestClient` 类是对于 [REST API](/reference/rest-api) 的直接封装。它只包含一个 `sql()` 方法用于执行任意 SQL 语句, 并返回执行结果。
+`RestClient` 类是对于 [REST API](../rest-api) 的直接封装。它只包含一个 `sql()` 方法用于执行任意 SQL 语句, 并返回执行结果。
```python title="RestClient 的使用"
{{#include docs/examples/python/rest_client_example.py}}
diff --git a/docs/zh/14-reference/03-connector/node.mdx b/docs/zh/08-connector/08-node.mdx
similarity index 92%
rename from docs/zh/14-reference/03-connector/node.mdx
rename to docs/zh/08-connector/08-node.mdx
index b089da99d26d0d671641fd0b50119853a04000a9..167ae069d6175873679e8c7cc4ecbb16dafe2ad8 100644
--- a/docs/zh/14-reference/03-connector/node.mdx
+++ b/docs/zh/08-connector/08-node.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 6
sidebar_label: Node.js
title: TDengine Node.js Connector
---
@@ -9,11 +8,11 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Preparition from "./_preparition.mdx";
-import NodeInsert from "../../07-develop/03-insert-data/_js_sql.mdx";
-import NodeInfluxLine from "../../07-develop/03-insert-data/_js_line.mdx";
-import NodeOpenTSDBTelnet from "../../07-develop/03-insert-data/_js_opts_telnet.mdx";
-import NodeOpenTSDBJson from "../../07-develop/03-insert-data/_js_opts_json.mdx";
-import NodeQuery from "../../07-develop/04-query-data/_js.mdx";
+import NodeInsert from "../07-develop/03-insert-data/_js_sql.mdx";
+import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx";
+import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx";
+import NodeOpenTSDBJson from "../07-develop/03-insert-data/_js_opts_json.mdx";
+import NodeQuery from "../07-develop/04-query-data/_js.mdx";
`@tdengine/client` 和 `@tdengine/rest` 是 TDengine 的官方 Node.js 语言连接器。 Node.js 开发人员可以通过它开发可以存取 TDengine 集群数据的应用软件。注意:从 TDengine 3.0 开始 Node.js 原生连接器的包名由 `td2.0-connector` 改名为 `@tdengine/client` 而 rest 连接器的包名由 `td2.0-rest-connector` 改为 `@tdengine/rest`。并且不与 TDengine 2.x 兼容。
@@ -28,7 +27,7 @@ REST 连接器支持所有能运行 Node.js 的平台。
## 版本支持
-请参考[版本支持列表](/reference/connector#版本支持)
+请参考[版本支持列表](../#版本支持)
## 支持的功能特性
@@ -52,7 +51,7 @@ REST 连接器支持所有能运行 Node.js 的平台。
### 安装前准备
- 安装 Node.js 开发环境
-- 如果使用 REST 连接器,跳过此步。但如果使用原生连接器,请安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](/reference/connector#安装客户端驱动)。我们使用 [node-gyp](https://github.com/nodejs/node-gyp) 和 TDengine 实例进行交互,还需要根据具体操作系统来安装下文提到的一些依赖工具。
+- 如果使用 REST 连接器,跳过此步。但如果使用原生连接器,请安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](../#安装客户端驱动)。我们使用 [node-gyp](https://github.com/nodejs/node-gyp) 和 TDengine 实例进行交互,还需要根据具体操作系统来安装下文提到的一些依赖工具。
diff --git a/docs/zh/14-reference/03-connector/csharp.mdx b/docs/zh/08-connector/09-csharp.mdx
similarity index 90%
rename from docs/zh/14-reference/03-connector/csharp.mdx
rename to docs/zh/08-connector/09-csharp.mdx
index 723c12932b410e9f85a0f35cd0c0b8273f4f7723..be27bfb685d5890813aa65199813f021f7e92066 100644
--- a/docs/zh/14-reference/03-connector/csharp.mdx
+++ b/docs/zh/08-connector/09-csharp.mdx
@@ -1,6 +1,5 @@
---
toc_max_heading_level: 4
-sidebar_position: 7
sidebar_label: C#
title: C# Connector
---
@@ -9,16 +8,16 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Preparition from "./_preparition.mdx"
-import CSInsert from "../../07-develop/03-insert-data/_cs_sql.mdx"
-import CSInfluxLine from "../../07-develop/03-insert-data/_cs_line.mdx"
-import CSOpenTSDBTelnet from "../../07-develop/03-insert-data/_cs_opts_telnet.mdx"
-import CSOpenTSDBJson from "../../07-develop/03-insert-data/_cs_opts_json.mdx"
-import CSQuery from "../../07-develop/04-query-data/_cs.mdx"
-import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx"
+import CSInsert from "../07-develop/03-insert-data/_cs_sql.mdx"
+import CSInfluxLine from "../07-develop/03-insert-data/_cs_line.mdx"
+import CSOpenTSDBTelnet from "../07-develop/03-insert-data/_cs_opts_telnet.mdx"
+import CSOpenTSDBJson from "../07-develop/03-insert-data/_cs_opts_json.mdx"
+import CSQuery from "../07-develop/04-query-data/_cs.mdx"
+import CSAsyncQuery from "../07-develop/04-query-data/_cs_async.mdx"
`TDengine.Connector` 是 TDengine 提供的 C# 语言连接器。C# 开发人员可以通过它开发存取 TDengine 集群数据的 C# 应用软件。
-`TDengine.Connector` 连接器支持通过 TDengine 客户端驱动(taosc)建立与 TDengine 运行实例的连接,提供数据写入、查询、订阅、schemaless 数据写入、参数绑定接口数据写入等功能 `TDengine.Connector` 目前暂未提供 REST 连接方式,用户可以参考 [REST API](/reference/rest-api/) 文档自行编写。
+`TDengine.Connector` 连接器支持通过 TDengine 客户端驱动(taosc)建立与 TDengine 运行实例的连接,提供数据写入、查询、订阅、schemaless 数据写入、参数绑定接口数据写入等功能 `TDengine.Connector` 目前暂未提供 REST 连接方式,用户可以参考 [REST API](../rest-api/) 文档自行编写。
本文介绍如何在 Linux 或 Windows 环境中安装 `TDengine.Connector`,并通过 `TDengine.Connector` 连接 TDengine 集群,进行数据写入、查询等基本操作。
@@ -32,7 +31,7 @@ import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx"
## 版本支持
-请参考[版本支持列表](/reference/connector#版本支持)
+请参考[版本支持列表](../#版本支持)
## 支持的功能特性
@@ -49,7 +48,7 @@ import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx"
* 安装 [.NET SDK](https://dotnet.microsoft.com/download)
* [Nuget 客户端](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools) (可选安装)
-* 安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](/reference/connector#安装客户端驱动)
+* 安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](../#安装客户端驱动)
### 使用 dotnet CLI 安装
diff --git a/docs/zh/14-reference/03-connector/php.mdx b/docs/zh/08-connector/10-php.mdx
similarity index 95%
rename from docs/zh/14-reference/03-connector/php.mdx
rename to docs/zh/08-connector/10-php.mdx
index 2b7ff2a6febd162fe34ebb737d2f33fbd9fc58a2..5e32c709de89d69b8602b506a9c774cb0a0244f0 100644
--- a/docs/zh/14-reference/03-connector/php.mdx
+++ b/docs/zh/08-connector/10-php.mdx
@@ -1,5 +1,4 @@
---
-sidebar_position: 1
sidebar_label: PHP
title: PHP Connector
---
@@ -38,7 +37,7 @@ TDengine 客户端驱动的版本号与 TDengine 服务端的版本号是一一
### 安装 TDengine 客户端驱动
-TDengine 客户端驱动的安装请参考 [安装指南](/reference/connector#安装步骤)
+TDengine 客户端驱动的安装请参考 [安装指南](../#安装步骤)
### 编译安装 php-tdengine
@@ -61,7 +60,7 @@ phpize && ./configure && make -j && make install
**手动指定 tdengine 目录:**
```shell
-phpize && ./configure --with-tdengine-dir=/usr/local/Cellar/tdengine/2.4.0.0 && make -j && make install
+phpize && ./configure --with-tdengine-dir=/usr/local/Cellar/tdengine/3.0.0.0 && make -j && make install
```
> `--with-tdengine-dir=` 后跟上 tdengine 目录。
diff --git a/docs/zh/14-reference/03-connector/_01-error-code.md b/docs/zh/08-connector/_01-error-code.md
similarity index 99%
rename from docs/zh/14-reference/03-connector/_01-error-code.md
rename to docs/zh/08-connector/_01-error-code.md
index 53e006e108543805232c8195474f2afd793e7332..3111d4bbf8a071500052309f2e3643f494c1be9a 100644
--- a/docs/zh/14-reference/03-connector/_01-error-code.md
+++ b/docs/zh/08-connector/_01-error-code.md
@@ -1,6 +1,7 @@
---
sidebar_label: 错误码
title: TDengine C/C++ 连接器错误码
+description: C/C++ 连接器的错误码列表和详细说明
---
本文中详细列举了在使用 TDengine C/C++ 连接器时客户端可能得到的错误码以及所要采取的相应动作。其它语言的连接器在使用原生连接方式时也会所得到的返回码返回给连接器的调用者。
diff --git a/docs/zh/14-reference/03-connector/_category_.yml b/docs/zh/08-connector/_category_.yml
similarity index 100%
rename from docs/zh/14-reference/03-connector/_category_.yml
rename to docs/zh/08-connector/_category_.yml
diff --git a/docs/zh/14-reference/03-connector/_linux_install.mdx b/docs/zh/08-connector/_linux_install.mdx
similarity index 96%
rename from docs/zh/14-reference/03-connector/_linux_install.mdx
rename to docs/zh/08-connector/_linux_install.mdx
index c3ddff53cd907b74c02cf3e7b5d5e8da33211fe1..0b1f415f54d28e65a519d35ab94a84b3aa8338ba 100644
--- a/docs/zh/14-reference/03-connector/_linux_install.mdx
+++ b/docs/zh/08-connector/_linux_install.mdx
@@ -4,7 +4,7 @@ import PkgListV3 from "/components/PkgListV3";
- [所有下载](../../releases)
+ [所有下载](../../releases/tdengine)
2. 解压缩软件包
diff --git a/docs/zh/14-reference/03-connector/_preparition.mdx b/docs/zh/08-connector/_preparition.mdx
similarity index 100%
rename from docs/zh/14-reference/03-connector/_preparition.mdx
rename to docs/zh/08-connector/_preparition.mdx
diff --git a/docs/zh/14-reference/03-connector/_verify_linux.mdx b/docs/zh/08-connector/_verify_linux.mdx
similarity index 100%
rename from docs/zh/14-reference/03-connector/_verify_linux.mdx
rename to docs/zh/08-connector/_verify_linux.mdx
diff --git a/docs/zh/14-reference/03-connector/_verify_windows.mdx b/docs/zh/08-connector/_verify_windows.mdx
similarity index 100%
rename from docs/zh/14-reference/03-connector/_verify_windows.mdx
rename to docs/zh/08-connector/_verify_windows.mdx
diff --git a/docs/zh/14-reference/03-connector/_windows_install.mdx b/docs/zh/08-connector/_windows_install.mdx
similarity index 95%
rename from docs/zh/14-reference/03-connector/_windows_install.mdx
rename to docs/zh/08-connector/_windows_install.mdx
index 9fdefa04c04412100f2b0b763a95698e5187608e..3cd688e615fe8bcf1aa472506754366f3a6db011 100644
--- a/docs/zh/14-reference/03-connector/_windows_install.mdx
+++ b/docs/zh/08-connector/_windows_install.mdx
@@ -4,7 +4,8 @@ import PkgListV3 from "/components/PkgListV3";
- [所有下载](../../releases)
+ [所有下载](../../releases/tdengine)
+
2. 执行安装程序,按提示选择默认值,完成安装
3. 安装路径
diff --git a/docs/zh/14-reference/03-connector/connector.webp b/docs/zh/08-connector/connector.webp
similarity index 100%
rename from docs/zh/14-reference/03-connector/connector.webp
rename to docs/zh/08-connector/connector.webp
diff --git a/docs/zh/14-reference/03-connector/03-connector.mdx b/docs/zh/08-connector/index.md
similarity index 98%
rename from docs/zh/14-reference/03-connector/03-connector.mdx
rename to docs/zh/08-connector/index.md
index bdad0b7e25a3a94fa34b14bf47403ba2afd7db8d..17de8e926cd9a3633dc8746b0fb49c38ff8ca61f 100644
--- a/docs/zh/14-reference/03-connector/03-connector.mdx
+++ b/docs/zh/08-connector/index.md
@@ -1,5 +1,7 @@
---
+sidebar_label: 连接器
title: 连接器
+description: 详细介绍各种语言的连接器及 REST API
---
TDengine 提供了丰富的应用程序开发接口,为了便于用户快速开发自己的应用,TDengine 支持了多种编程语言的连接器,其中官方连接器包括支持 C/C++、Java、Python、Go、Node.js、C# 和 Rust 的连接器。这些连接器支持使用原生接口(taosc)和 REST 接口(部分语言暂不支持)连接 TDengine 集群。社区开发者也贡献了多个非官方连接器,例如 ADO.NET 连接器、Lua 连接器和 PHP 连接器。
diff --git a/docs/zh/14-reference/03-connector/tdengine-jdbc-connector.webp b/docs/zh/08-connector/tdengine-jdbc-connector.webp
similarity index 100%
rename from docs/zh/14-reference/03-connector/tdengine-jdbc-connector.webp
rename to docs/zh/08-connector/tdengine-jdbc-connector.webp
diff --git a/docs/zh/10-deployment/01-deploy.md b/docs/zh/10-deployment/01-deploy.md
index 22a9c2ff8e68880ce5b0be2e01924eca12707a37..03b4ce30f980cd77e9845076ce9bb35c4474f948 100644
--- a/docs/zh/10-deployment/01-deploy.md
+++ b/docs/zh/10-deployment/01-deploy.md
@@ -1,6 +1,7 @@
---
sidebar_label: 手动部署
title: 集群部署和管理
+description: 使用命令行工具手动部署 TDengine 集群
---
## 准备工作
@@ -70,7 +71,7 @@ serverPort 6030
## 启动集群
-按照《立即开始》里的步骤,启动第一个数据节点,例如 h1.taosdata.com,然后执行 taos,启动 taos shell,从 shell 里执行命令“SHOW DNODES”,如下所示:
+按照《立即开始》里的步骤,启动第一个数据节点,例如 h1.taosdata.com,然后执行 taos,启动 TDengine CLI,在其中执行命令 “SHOW DNODES”,如下所示:
```
taos> show dnodes;
@@ -114,7 +115,7 @@ SHOW DNODES;
任何已经加入集群在线的数据节点,都可以作为后续待加入节点的 firstEp。
firstEp 这个参数仅仅在该数据节点首次加入集群时有作用,加入集群后,该数据节点会保存最新的 mnode 的 End Point 列表,不再依赖这个参数。
-接下来,配置文件中的 firstEp 参数就主要在客户端连接的时候使用了,例如 taos shell 如果不加参数,会默认连接由 firstEp 指定的节点。
+接下来,配置文件中的 firstEp 参数就主要在客户端连接的时候使用了,例如 TDengine CLI 如果不加参数,会默认连接由 firstEp 指定的节点。
两个没有配置 firstEp 参数的数据节点 dnode 启动后,会独立运行起来。这个时候,无法将其中一个数据节点加入到另外一个数据节点,形成集群。无法将两个独立的集群合并成为新的集群。
:::
diff --git a/docs/zh/10-deployment/03-k8s.md b/docs/zh/10-deployment/03-k8s.md
index 396b8343243ba824dd87b83fd5f94c14c2059730..0cae59657c2a0199d3452bc37d36f2c537944d21 100644
--- a/docs/zh/10-deployment/03-k8s.md
+++ b/docs/zh/10-deployment/03-k8s.md
@@ -1,6 +1,7 @@
---
sidebar_label: Kubernetes
title: 在 Kubernetes 上部署 TDengine 集群
+description: 利用 Kubernetes 部署 TDengine 集群的详细指南
---
作为面向云原生架构设计的时序数据库,TDengine 支持 Kubernetes 部署。这里介绍如何使用 YAML 文件一步一步从头创建一个 TDengine 集群,并重点介绍 Kubernetes 环境下 TDengine 的常用操作。
@@ -9,6 +10,7 @@ title: 在 Kubernetes 上部署 TDengine 集群
要使用 Kubernetes 部署管理 TDengine 集群,需要做好如下准备工作。
+* 本文适用 Kubernetes v1.5 以上版本
* 本文和下一章使用 minikube、kubectl 和 helm 等工具进行安装部署,请提前安装好相应软件
* Kubernetes 已经安装部署并能正常访问使用或更新必要的容器仓库或其他服务
@@ -365,7 +367,7 @@ kubectl scale statefulsets tdengine --replicas=1
```
-在 taos shell 中的所有数据库操作将无法成功。
+在 TDengine CLI 中的所有数据库操作将无法成功。
```
taos> show dnodes;
diff --git a/docs/zh/10-deployment/05-helm.md b/docs/zh/10-deployment/05-helm.md
index 9a723ff62f23da4906ee268becef1d812c29d797..9a3b21f09296e6f5a8dbd089225b6580b9567586 100644
--- a/docs/zh/10-deployment/05-helm.md
+++ b/docs/zh/10-deployment/05-helm.md
@@ -1,6 +1,7 @@
---
sidebar_label: Helm
title: 使用 Helm 部署 TDengine 集群
+description: 使用 Helm 部署 TDengine 集群的详细指南
---
Helm 是 Kubernetes 的包管理器,上一节使用 Kubernets 部署 TDengine 集群的操作已经足够简单,但 Helm 依然可以提供更强大的能力。
@@ -171,70 +172,19 @@ taoscfg:
TAOS_REPLICA: "1"
- # number of days per DB file
- # TAOS_DAYS: "10"
-
- # number of days to keep DB file, default is 10 years.
- #TAOS_KEEP: "3650"
-
- # cache block size (Mbyte)
- #TAOS_CACHE: "16"
-
- # number of cache blocks per vnode
- #TAOS_BLOCKS: "6"
-
- # minimum rows of records in file block
- #TAOS_MIN_ROWS: "100"
-
- # maximum rows of records in file block
- #TAOS_MAX_ROWS: "4096"
-
- #
- # TAOS_NUM_OF_THREADS_PER_CORE: number of threads per CPU core
- #TAOS_NUM_OF_THREADS_PER_CORE: "1.0"
+ # TAOS_NUM_OF_RPC_THREADS: number of threads for RPC
+ #TAOS_NUM_OF_RPC_THREADS: "2"
#
# TAOS_NUM_OF_COMMIT_THREADS: number of threads to commit cache data
#TAOS_NUM_OF_COMMIT_THREADS: "4"
- #
- # TAOS_RATIO_OF_QUERY_CORES:
- # the proportion of total CPU cores available for query processing
- # 2.0: the query threads will be set to double of the CPU cores.
- # 1.0: all CPU cores are available for query processing [default].
- # 0.5: only half of the CPU cores are available for query.
- # 0.0: only one core available.
- #TAOS_RATIO_OF_QUERY_CORES: "1.0"
-
- #
- # TAOS_KEEP_COLUMN_NAME:
- # the last_row/first/last aggregator will not change the original column name in the result fields
- #TAOS_KEEP_COLUMN_NAME: "0"
-
- # enable/disable backuping vnode directory when removing vnode
- #TAOS_VNODE_BAK: "1"
-
# enable/disable installation / usage report
#TAOS_TELEMETRY_REPORTING: "1"
- # enable/disable load balancing
- #TAOS_BALANCE: "1"
-
- # max timer control blocks
- #TAOS_MAX_TMR_CTRL: "512"
-
# time interval of system monitor, seconds
#TAOS_MONITOR_INTERVAL: "30"
- # number of seconds allowed for a dnode to be offline, for cluster only
- #TAOS_OFFLINE_THRESHOLD: "8640000"
-
- # RPC re-try timer, millisecond
- #TAOS_RPC_TIMER: "1000"
-
- # RPC maximum time for ack, seconds.
- #TAOS_RPC_MAX_TIME: "600"
-
# time interval of dnode status reporting to mnode, seconds, for cluster only
#TAOS_STATUS_INTERVAL: "1"
@@ -245,37 +195,7 @@ taoscfg:
#TAOS_MIN_SLIDING_TIME: "10"
# minimum time window, milli-second
- #TAOS_MIN_INTERVAL_TIME: "10"
-
- # maximum delay before launching a stream computation, milli-second
- #TAOS_MAX_STREAM_COMP_DELAY: "20000"
-
- # maximum delay before launching a stream computation for the first time, milli-second
- #TAOS_MAX_FIRST_STREAM_COMP_DELAY: "10000"
-
- # retry delay when a stream computation fails, milli-second
- #TAOS_RETRY_STREAM_COMP_DELAY: "10"
-
- # the delayed time for launching a stream computation, from 0.1(default, 10% of whole computing time window) to 0.9
- #TAOS_STREAM_COMP_DELAY_RATIO: "0.1"
-
- # max number of vgroups per db, 0 means configured automatically
- #TAOS_MAX_VGROUPS_PER_DB: "0"
-
- # max number of tables per vnode
- #TAOS_MAX_TABLES_PER_VNODE: "1000000"
-
- # the number of acknowledgments required for successful data writing
- #TAOS_QUORUM: "1"
-
- # enable/disable compression
- #TAOS_COMP: "2"
-
- # write ahead log (WAL) level, 0: no wal; 1: write wal, but no fysnc; 2: write wal, and call fsync
- #TAOS_WAL_LEVEL: "1"
-
- # if walLevel is set to 2, the cycle of fsync being executed, if set to 0, fsync is called right away
- #TAOS_FSYNC: "3000"
+ #TAOS_MIN_INTERVAL_TIME: "1"
# the compressed rpc message, option:
# -1 (no compression)
@@ -283,17 +203,8 @@ taoscfg:
# > 0 (rpc message body which larger than this value will be compressed)
#TAOS_COMPRESS_MSG_SIZE: "-1"
- # max length of an SQL
- #TAOS_MAX_SQL_LENGTH: "1048576"
-
- # the maximum number of records allowed for super table time sorting
- #TAOS_MAX_NUM_OF_ORDERED_RES: "100000"
-
# max number of connections allowed in dnode
- #TAOS_MAX_SHELL_CONNS: "5000"
-
- # max number of connections allowed in client
- #TAOS_MAX_CONNECTIONS: "5000"
+ #TAOS_MAX_SHELL_CONNS: "50000"
# stop writing logs when the disk size of the log folder is less than this value
#TAOS_MINIMAL_LOG_DIR_G_B: "0.1"
@@ -313,21 +224,8 @@ taoscfg:
# enable/disable system monitor
#TAOS_MONITOR: "1"
- # enable/disable recording the SQL statements via restful interface
- #TAOS_HTTP_ENABLE_RECORD_SQL: "0"
-
- # number of threads used to process http requests
- #TAOS_HTTP_MAX_THREADS: "2"
-
- # maximum number of rows returned by the restful interface
- #TAOS_RESTFUL_ROW_LIMIT: "10240"
-
- # The following parameter is used to limit the maximum number of lines in log files.
- # max number of lines per log filters
- # numOfLogLines 10000000
-
# enable/disable async log
- #TAOS_ASYNC_LOG: "0"
+ #TAOS_ASYNC_LOG: "1"
#
# time of keeping log files, days
@@ -344,25 +242,8 @@ taoscfg:
# debug flag for all log type, take effect when non-zero value\
#TAOS_DEBUG_FLAG: "143"
- # enable/disable recording the SQL in taos client
- #TAOS_ENABLE_RECORD_SQL: "0"
-
# generate core file when service crash
#TAOS_ENABLE_CORE_FILE: "1"
-
- # maximum display width of binary and nchar fields in the shell. The parts exceeding this limit will be hidden
- #TAOS_MAX_BINARY_DISPLAY_WIDTH: "30"
-
- # enable/disable stream (continuous query)
- #TAOS_STREAM: "1"
-
- # in retrieve blocking model, only in 50% query threads will be used in query processing in dnode
- #TAOS_RETRIEVE_BLOCKING_MODEL: "0"
-
- # the maximum allowed query buffer size in MB during query processing for each data node
- # -1 no limit (default)
- # 0 no query allowed, queries are disabled
- #TAOS_QUERY_BUFFER_SIZE: "-1"
```
## 扩容
diff --git a/docs/zh/10-deployment/index.md b/docs/zh/10-deployment/index.md
index 96ac7b176d1125df6cf4763a485c4edba520a48c..4ff1add779c68a7098002dd95dcf28c9dc1acf72 100644
--- a/docs/zh/10-deployment/index.md
+++ b/docs/zh/10-deployment/index.md
@@ -1,5 +1,7 @@
---
+sidebar_label: 部署集群
title: 部署集群
+description: 部署 TDengine 集群的多种方式
---
TDengine 支持集群,提供水平扩展的能力。如果需要获得更高的处理能力,只需要多增加节点即可。TDengine 采用虚拟节点技术,将一个节点虚拟化为多个虚拟节点,以实现负载均衡。同时,TDengine可以将多个节点上的虚拟节点组成虚拟节点组,通过多副本机制,以保证供系统的高可用。TDengine的集群功能完全开源。
diff --git a/docs/zh/12-taos-sql/01-data-type.md b/docs/zh/12-taos-sql/01-data-type.md
index 628086f5a9f31d15fccdae107b8bd997a6ba1c0b..b8ef050fb79fce5e5d2d65753480a6b156cfbc40 100644
--- a/docs/zh/12-taos-sql/01-data-type.md
+++ b/docs/zh/12-taos-sql/01-data-type.md
@@ -11,7 +11,7 @@ description: "TDengine 支持的数据类型: 时间戳、浮点型、JSON 类
- 时间格式为 `YYYY-MM-DD HH:mm:ss.MS`,默认时间分辨率为毫秒。比如:`2017-08-12 18:25:58.128`
- 内部函数 now 是客户端的当前时间
- 插入记录时,如果时间戳为 now,插入数据时使用提交这条记录的客户端的当前时间
-- Epoch Time:时间戳也可以是一个长整数,表示从格林威治时间 1970-01-01 00:00:00.000 (UTC/GMT) 开始的毫秒数(相应地,如果所在 Database 的时间精度设置为“微秒”,则长整型格式的时间戳含义也就对应于从格林威治时间 1970-01-01 00:00:00.000 (UTC/GMT) 开始的微秒数;纳秒精度逻辑类似。)
+- Epoch Time:时间戳也可以是一个长整数,表示从 UTC 时间 1970-01-01 00:00:00 开始的毫秒数。相应地,如果所在 Database 的时间精度设置为“微秒”,则长整型格式的时间戳含义也就对应于从 UTC 时间 1970-01-01 00:00:00 开始的微秒数;纳秒精度逻辑类似。
- 时间可以加减,比如 now-2h,表明查询时刻向前推 2 个小时(最近 2 小时)。数字后面的时间单位可以是 b(纳秒)、u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 比如 `select * from t1 where ts > now-2w and ts <= now-1w`,表示查询两周前整整一周的数据。在指定降采样操作(down sampling)的时间窗口(interval)时,时间单位还可以使用 n (自然月) 和 y (自然年)。
TDengine 缺省的时间戳精度是毫秒,但通过在 `CREATE DATABASE` 时传递的 PRECISION 参数也可以支持微秒和纳秒。
diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md
index 0e104bb7b6f09e886ab3c6cb55b1ecd68dfaf1ce..9c33c45efcf006344ba5d84a0cbce7bc683f8559 100644
--- a/docs/zh/12-taos-sql/03-table.md
+++ b/docs/zh/12-taos-sql/03-table.md
@@ -1,5 +1,7 @@
---
title: 表管理
+sidebar_label: 表
+description: 对表的各种管理操作
---
## 创建表
@@ -8,27 +10,27 @@ title: 表管理
```sql
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options]
-
+
CREATE TABLE create_subtable_clause
-
+
CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...)
[TAGS (create_definition [, create_definitionn] ...)]
[table_options]
-
+
create_subtable_clause: {
create_subtable_clause [create_subtable_clause] ...
| [IF NOT EXISTS] [db_name.]tb_name USING [db_name.]stb_name [(tag_name [, tag_name] ...)] TAGS (tag_value [, tag_value] ...)
}
-
+
create_definition:
col_name column_definition
-
+
column_definition:
type_name [comment 'string_value']
-
+
table_options:
table_option ...
-
+
table_option: {
COMMENT 'string_value'
| WATERMARK duration[,duration]
@@ -52,12 +54,13 @@ table_option: {
需要注意的是转义字符中的内容必须是可打印字符。
**参数说明**
+
1. COMMENT:表注释。可用于超级表、子表和普通表。
-2. WATERMARK:指定窗口的关闭时间,默认值为 5 秒,最小单位毫秒,范围为0到15分钟,多个以逗号分隔。只可用于超级表,且只有当数据库使用了RETENTIONS参数时,才可以使用此表参数。
-3. MAX_DELAY:用于控制推送计算结果的最大延迟,默认值为 interval 的值(但不能超过最大值),最小单位毫秒,范围为1毫秒到15分钟,多个以逗号分隔。注:不建议 MAX_DELAY 设置太小,否则会过于频繁的推送结果,影响存储和查询性能,如无特殊需求,取默认值即可。只可用于超级表,且只有当数据库使用了RETENTIONS参数时,才可以使用此表参数。
-4. ROLLUP:Rollup 指定的聚合函数,提供基于多层级的降采样聚合结果。只可用于超级表。只有当数据库使用了RETENTIONS参数时,才可以使用此表参数。作用于超级表除TS列外的其它所有列,但是只能定义一个聚合函数。 聚合函数支持 avg, sum, min, max, last, first。
-5. SMA:Small Materialized Aggregates,提供基于数据块的自定义预计算功能。预计算类型包括MAX、MIN和SUM。可用于超级表/普通表。
-6. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果在持续的TTL时间内,都没有数据写入该表,则TDengine系统会自动删除该表。这个TTL的时间只是一个大概时间,我们系统不保证到了时间一定会将其删除,而只保证存在这样一个机制。TTL单位是天,默认为0,表示不限制。用户需要注意,TTL优先级高于KEEP,即TTL时间满足删除机制时,即使当前数据的存在时间小于KEEP,此表也会被删除。只可用于子表和普通表。
+2. WATERMARK:指定窗口的关闭时间,默认值为 5 秒,最小单位毫秒,范围为 0 到 15 分钟,多个以逗号分隔。只可用于超级表,且只有当数据库使用了 RETENTIONS 参数时,才可以使用此表参数。
+3. MAX_DELAY:用于控制推送计算结果的最大延迟,默认值为 interval 的值(但不能超过最大值),最小单位毫秒,范围为 1 毫秒到 15 分钟,多个以逗号分隔。注:不建议 MAX_DELAY 设置太小,否则会过于频繁的推送结果,影响存储和查询性能,如无特殊需求,取默认值即可。只可用于超级表,且只有当数据库使用了 RETENTIONS 参数时,才可以使用此表参数。
+4. ROLLUP:Rollup 指定的聚合函数,提供基于多层级的降采样聚合结果。只可用于超级表。只有当数据库使用了 RETENTIONS 参数时,才可以使用此表参数。作用于超级表除 TS 列外的其它所有列,但是只能定义一个聚合函数。 聚合函数支持 avg, sum, min, max, last, first。
+5. SMA:Small Materialized Aggregates,提供基于数据块的自定义预计算功能。预计算类型包括 MAX、MIN 和 SUM。可用于超级表/普通表。
+6. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果创建表时指定了这个参数,当该表的存在时间超过 TTL 指定的时间后,TDengine 自动删除该表。这个 TTL 的时间只是一个大概时间,系统不保证到了时间一定会将其删除,而只保证存在这样一个机制且最终一定会删除。TTL 单位是天,默认为 0,表示不限制,到期时间为表创建时间加上 TTL 时间。
## 创建子表
@@ -87,7 +90,7 @@ CREATE TABLE [IF NOT EXISTS] tb_name1 USING stb_name TAGS (tag_value1, ...) [IF
```sql
ALTER TABLE [db_name.]tb_name alter_table_clause
-
+
alter_table_clause: {
alter_table_options
| ADD COLUMN col_name column_type
@@ -95,10 +98,10 @@ alter_table_clause: {
| MODIFY COLUMN col_name column_type
| RENAME COLUMN old_col_name new_col_name
}
-
+
alter_table_options:
alter_table_option ...
-
+
alter_table_option: {
TTL value
| COMMENT 'string_value'
@@ -108,6 +111,7 @@ alter_table_option: {
**使用说明**
对普通表可以进行如下修改操作
+
1. ADD COLUMN:添加列。
2. DROP COLUMN:删除列。
3. MODIFY COLUMN:修改列定义,如果数据列的类型是可变长类型,那么可以使用此指令修改其宽度,只能改大,不能改小。
@@ -141,15 +145,15 @@ ALTER TABLE tb_name RENAME COLUMN old_col_name new_col_name
```sql
ALTER TABLE [db_name.]tb_name alter_table_clause
-
+
alter_table_clause: {
alter_table_options
| SET TAG tag_name = new_tag_value
}
-
+
alter_table_options:
alter_table_option ...
-
+
alter_table_option: {
TTL value
| COMMENT 'string_value'
@@ -157,6 +161,7 @@ alter_table_option: {
```
**使用说明**
+
1. 对子表的列和标签的修改,除了更改标签值以外,都要通过超级表才能进行。
### 修改子表标签值
@@ -167,7 +172,7 @@ ALTER TABLE tb_name SET TAG tag_name=new_tag_value;
## 删除表
-可以在一条SQL语句中删除一个或多个普通表或子表。
+可以在一条 SQL 语句中删除一个或多个普通表或子表。
```sql
DROP TABLE [IF EXISTS] [db_name.]tb_name [, [IF EXISTS] [db_name.]tb_name] ...
@@ -177,7 +182,7 @@ DROP TABLE [IF EXISTS] [db_name.]tb_name [, [IF EXISTS] [db_name.]tb_name] ...
### 显示所有表
-如下SQL语句可以列出当前数据库中的所有表名。
+如下 SQL 语句可以列出当前数据库中的所有表名。
```sql
SHOW TABLES [LIKE tb_name_wildchar];
diff --git a/docs/zh/12-taos-sql/04-stable.md b/docs/zh/12-taos-sql/04-stable.md
index 59d9657694340ae263fb23b8c2b17ede8984426d..450ff07fd8eb636b3ee185e5594d77d645195c56 100644
--- a/docs/zh/12-taos-sql/04-stable.md
+++ b/docs/zh/12-taos-sql/04-stable.md
@@ -1,6 +1,7 @@
---
sidebar_label: 超级表管理
title: 超级表 STable 管理
+description: 对超级表的各种管理操作
---
## 创建超级表
diff --git a/docs/zh/12-taos-sql/05-insert.md b/docs/zh/12-taos-sql/05-insert.md
index c91e70c481055b804d88c8911fb454a3dd15b799..59af9c55ed076fb23814a24a5d2429e51d5fc051 100644
--- a/docs/zh/12-taos-sql/05-insert.md
+++ b/docs/zh/12-taos-sql/05-insert.md
@@ -1,6 +1,7 @@
---
sidebar_label: 数据写入
title: 数据写入
+description: 写入数据的详细语法
---
## 写入语法
diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md
index 5312d7d2f3597ca63d9d3c43bc2264ca75877fb7..0c305231e03e3a4fa4ea9ce51f95ea241e43d20a 100644
--- a/docs/zh/12-taos-sql/06-select.md
+++ b/docs/zh/12-taos-sql/06-select.md
@@ -1,6 +1,7 @@
---
sidebar_label: 数据查询
title: 数据查询
+description: 查询数据的详细语法
---
## 查询语法
diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md
index bbf6b52eb985bef2decebcacd27d777bd1999b1f..9f999181c40c4f51e1499f9189fe63bacf2222df 100644
--- a/docs/zh/12-taos-sql/10-function.md
+++ b/docs/zh/12-taos-sql/10-function.md
@@ -1,6 +1,7 @@
---
sidebar_label: 函数
title: 函数
+description: TDengine 支持的函数列表
toc_max_heading_level: 4
---
@@ -846,7 +847,7 @@ SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause];
### INTERP
```sql
-SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] [ RANGE(timestamp1,timestamp2) ] [EVERY(interval)] [FILL ({ VALUE | PREV | NULL | LINEAR | NEXT})];
+SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] RANGE(timestamp1,timestamp2) EVERY(interval) FILL({ VALUE | PREV | NULL | LINEAR | NEXT});
```
**功能说明**:返回指定时间截面指定列的记录值或插值。
@@ -855,17 +856,16 @@ SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] [
**适用数据类型**:数值类型。
-**适用于**:表、超级表。
+**适用于**:表和超级表。
**使用说明**
- INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。
- INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。
-- INTERP 的输出时间范围根据 RANGE(timestamp1,timestamp2)字段来指定,需满足 timestamp1<=timestamp2。其中 timestamp1(必选值)为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2(必选值)为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。如果没有指定 RANGE,那么满足过滤条件的输入数据中第一条记录的 timestamp 即为 timestamp1,最后一条记录的 timestamp 即为 timestamp2,同样也满足 timestamp1 <= timestamp2。
+- INTERP 的输出时间范围根据 RANGE(timestamp1,timestamp2)字段来指定,需满足 timestamp1<=timestamp2。其中 timestamp1(必选值)为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2(必选值)为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。
- INTERP 根据 EVERY 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(EVERY 值)进行插值。如果没有指定 EVERY,则默认窗口大小为无穷大,即从 timestamp1 开始只有一个窗口。
-- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值,如果没有 FILL 字段则默认不插值,即输出为原始记录值或不输出(原始记录不存在)。
-- INTERP 只能在一个时间序列内进行插值,因此当作用于超级表时必须跟 group by tbname 一起使用,当作用嵌套查询外层时内层子查询不能含 GROUP BY 信息。
-- INTERP 的插值结果不受 ORDER BY timestamp 的影响,ORDER BY timestamp 只影响输出结果的排序。
+- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。
+- INTERP 只能在一个时间序列内进行插值,因此当作用于超级表时必须跟 partition by tbname 一起使用。
### LAST
@@ -1167,7 +1167,7 @@ SELECT stateDuration(field_name, oper, val, unit) FROM { tb_name | stb_name } [W
**参数范围**:
-- oper : "LT" (小于)、"GT"(大于)、"LE"(小于等于)、"GE"(大于等于)、"NE"(不等于)、"EQ"(等于),不区分大小写。
+- oper : `'LT'` (小于)、`'GT'`(大于)、`'LE'`(小于等于)、`'GE'`(大于等于)、`'NE'`(不等于)、`'EQ'`(等于),不区分大小写,但需要用`''`包括。
- val : 数值型
- unit : 时间长度的单位,可取值时间单位: 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。如果省略,默认为当前数据库精度。
diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md
index 2dad49ece942d0530c12afa145c2e11682c23fe3..b9e06033d6ae26daef8f30e21f341315d9e5edb2 100644
--- a/docs/zh/12-taos-sql/12-distinguished.md
+++ b/docs/zh/12-taos-sql/12-distinguished.md
@@ -1,6 +1,7 @@
---
sidebar_label: 时序数据特色查询
title: 时序数据特色查询
+description: TDengine 提供的时序数据特有的查询功能
---
TDengine 是专为时序数据而研发的大数据平台,存储和计算都针对时序数据的特定进行了量身定制,在支持标准 SQL 的基础之上,还提供了一系列贴合时序业务场景的特色查询语法,极大的方便时序场景的应用开发。
diff --git a/docs/zh/12-taos-sql/13-tmq.md b/docs/zh/12-taos-sql/13-tmq.md
index b05d2bf680e2db5db08b2e86d98e2e3018078ddf..571300ad8cbfb031e38f330c0773ec6ee6f11e32 100644
--- a/docs/zh/12-taos-sql/13-tmq.md
+++ b/docs/zh/12-taos-sql/13-tmq.md
@@ -1,6 +1,7 @@
---
sidebar_label: 数据订阅
title: 数据订阅
+description: TDengine 消息队列提供的数据订阅功能
---
TDengine 3.0.0.0 开始对消息队列做了大幅的优化和增强以简化用户的解决方案。
diff --git a/docs/zh/12-taos-sql/14-stream.md b/docs/zh/12-taos-sql/14-stream.md
index a967299e4093a4a8654d7aaf1b8c3914726aeadf..70b062a6ca28549347f78f8eea21c54b1e3bcb81 100644
--- a/docs/zh/12-taos-sql/14-stream.md
+++ b/docs/zh/12-taos-sql/14-stream.md
@@ -1,6 +1,7 @@
---
sidebar_label: 流式计算
title: 流式计算
+description: 流式计算的相关 SQL 的详细语法
---
@@ -18,7 +19,7 @@ stream_options: {
其中 subquery 是 select 普通查询语法的子集:
```sql
-subquery: SELECT [DISTINCT] select_list
+subquery: SELECT select_list
from_clause
[WHERE condition]
[PARTITION BY tag_list]
@@ -37,7 +38,7 @@ window_clause: {
其中,SESSION 是会话窗口,tol_val 是时间间隔的最大范围。在 tol_val 时间间隔范围内的数据都属于同一个窗口,如果连续的两条数据的时间超过 tol_val,则自动开启下一个窗口。
-窗口的定义与时序数据特色查询中的定义完全相同。
+窗口的定义与时序数据特色查询中的定义完全相同,详见 [TDengine 特色查询](../distinguished)
例如,如下语句创建流式计算,同时自动创建名为 avg_vol 的超级表,此流计算以一分钟为时间窗口、30 秒为前向增量统计这些电表的平均电压,并将来自 meters 表的数据的计算结果写入 avg_vol 表,不同 partition 的数据会分别创建子表并写入不同子表。
diff --git a/docs/zh/12-taos-sql/16-operators.md b/docs/zh/12-taos-sql/16-operators.md
index 22b78455fb35e9ebe5978b30505819e1a2b678c8..48e9991799abf99ca868fc30e34f0435054afa0b 100644
--- a/docs/zh/12-taos-sql/16-operators.md
+++ b/docs/zh/12-taos-sql/16-operators.md
@@ -1,6 +1,7 @@
---
sidebar_label: 运算符
title: 运算符
+description: TDengine 支持的所有运算符
---
## 算术运算符
diff --git a/docs/zh/12-taos-sql/17-json.md b/docs/zh/12-taos-sql/17-json.md
index 4a4a8cca732ac433ba5ada1ec3805ebfa663edb3..4cbd8eef364b1ea4e4285a34bb419a8ab3c7fc1d 100644
--- a/docs/zh/12-taos-sql/17-json.md
+++ b/docs/zh/12-taos-sql/17-json.md
@@ -1,6 +1,7 @@
---
sidebar_label: JSON 类型使用说明
title: JSON 类型使用说明
+description: 对 JSON 类型如何使用的详细说明
---
diff --git a/docs/zh/12-taos-sql/18-escape.md b/docs/zh/12-taos-sql/18-escape.md
index 756e5c81591e7414827fdc65e228cfafc96214ad..7e543743a30aeaa125375b14ad8baf49b634d248 100644
--- a/docs/zh/12-taos-sql/18-escape.md
+++ b/docs/zh/12-taos-sql/18-escape.md
@@ -1,5 +1,7 @@
---
title: 转义字符说明
+sidebar_label: 转义字符
+description: TDengine 中使用转义字符的详细规则
---
## 转义字符表
@@ -15,9 +17,6 @@ title: 转义字符说明
| `\%` | % 规则见下 |
| `\_` | \_ 规则见下 |
-:::note
-转义符的功能从 2.4.0.4 版本开始
-
:::
## 转义字符使用规则
diff --git a/docs/zh/12-taos-sql/19-limit.md b/docs/zh/12-taos-sql/19-limit.md
index ff552fc9771f5b428554acc62e9aeac03a305ecc..0dbe00f80063bbc62cae38c540e3e7b6627d53d3 100644
--- a/docs/zh/12-taos-sql/19-limit.md
+++ b/docs/zh/12-taos-sql/19-limit.md
@@ -1,6 +1,7 @@
---
sidebar_label: 命名与边界限制
title: 命名与边界限制
+description: 合法字符集和命名中的限制规则
---
## 名称命名规则
@@ -30,7 +31,7 @@ title: 命名与边界限制
- 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。
- 标签名最大长度为 64
- 最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB
-- SQL 语句最大长度 1048576 个字符,也可通过客户端配置参数 maxSQLLength 修改,取值范围 65480 ~ 1048576
+- SQL 语句最大长度 1048576 个字符
- SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错
- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制
- 数据库的副本数只能设置为 1 或 3
diff --git a/docs/zh/12-taos-sql/20-keywords.md b/docs/zh/12-taos-sql/20-keywords.md
index cac29d7863ff77a6ec15bb9bddedd006317b719c..047c6b08c9646927fc8ec16a2fd390569e4404fb 100644
--- a/docs/zh/12-taos-sql/20-keywords.md
+++ b/docs/zh/12-taos-sql/20-keywords.md
@@ -1,6 +1,7 @@
---
sidebar_label: 保留关键字
title: TDengine 保留关键字
+description: TDengine 保留关键字的详细列表
---
## 保留关键字
diff --git a/docs/zh/12-taos-sql/21-node.md b/docs/zh/12-taos-sql/21-node.md
index 4816daf42042c0607aebf37c8b57961e5b1927fe..d47dc8198f41e7ee6e90624b0928c6bd215bb26d 100644
--- a/docs/zh/12-taos-sql/21-node.md
+++ b/docs/zh/12-taos-sql/21-node.md
@@ -1,6 +1,7 @@
---
sidebar_label: 集群管理
title: 集群管理
+description: 管理集群的 SQL 命令的详细解析
---
组成 TDengine 集群的物理实体是 dnode (data node 的缩写),它是一个运行在操作系统之上的进程。在 dnode 中可以建立负责时序数据存储的 vnode (virtual node),在多节点集群环境下当某个数据库的 replica 为 3 时,该数据库中的每个 vgroup 由 3 个 vnode 组成;当数据库的 replica 为 1 时,该数据库中的每个 vgroup 由 1 个 vnode 组成。如果要想配置某个数据库为多副本,则集群中的 dnode 数量至少为 3。在 dnode 还可以创建 mnode (management node),单个集群中最多可以创建三个 mnode。在 TDengine 3.0.0.0 中为了支持存算分离,引入了一种新的逻辑节点 qnode (query node),qnode 和 vnode 既可以共存在一个 dnode 中,也可以完全分离在不同的 dnode 上。
diff --git a/docs/zh/12-taos-sql/22-meta.md b/docs/zh/12-taos-sql/22-meta.md
index 8139b2fc55d420edfb766aab6ed06477fbd3621f..e9cda45b0fa85319234572b236c936d907311796 100644
--- a/docs/zh/12-taos-sql/22-meta.md
+++ b/docs/zh/12-taos-sql/22-meta.md
@@ -1,6 +1,7 @@
---
sidebar_label: 元数据
title: 存储元数据的 Information_Schema 数据库
+description: Information_Schema 数据库中存储了系统中所有的元数据信息
---
TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数据库元数据、数据库系统信息和状态的访问,例如数据库或表的名称,当前执行的 SQL 语句等。该数据库存储有关 TDengine 维护的所有其他数据库的信息。它包含多个只读表。实际上,这些表都是视图,而不是基表,因此没有与它们关联的文件。所以对这些表只能查询,不能进行 INSERT 等写入操作。`INFORMATION_SCHEMA` 数据库旨在以一种更一致的方式来提供对 TDengine 支持的各种 SHOW 语句(如 SHOW TABLES、SHOW DATABASES)所提供的信息的访问。与 SHOW 语句相比,使用 SELECT ... FROM INFORMATION_SCHEMA.tablename 具有以下优点:
diff --git a/docs/zh/12-taos-sql/23-perf.md b/docs/zh/12-taos-sql/23-perf.md
index ac852ee1506ce8da24c036c61ce96fa4eecaf1cb..e6ff4960a7c0148eb7b65d06dc37a6355a6e289c 100644
--- a/docs/zh/12-taos-sql/23-perf.md
+++ b/docs/zh/12-taos-sql/23-perf.md
@@ -1,6 +1,7 @@
---
sidebar_label: 统计数据
title: 存储统计数据的 Performance_Schema 数据库
+description: Performance_Schema 数据库中存储了系统中的各种统计信息
---
TDengine 3.0 版本开始提供一个内置数据库 `performance_schema`,其中存储了与性能有关的统计数据。本节详细介绍其中的表和表结构。
diff --git a/docs/zh/12-taos-sql/24-show.md b/docs/zh/12-taos-sql/24-show.md
index 781f94324c78e7975abde33803cffdb914da020c..b4aafdaa0af644e05e47106b76e0c7ab074a61b8 100644
--- a/docs/zh/12-taos-sql/24-show.md
+++ b/docs/zh/12-taos-sql/24-show.md
@@ -1,9 +1,10 @@
---
sidebar_label: SHOW 命令
title: 使用 SHOW 命令查看系统元数据
+description: SHOW 命令的完整列表
---
-除了使用 `select` 语句查询 `INFORMATION_SCHEMA` 数据库中的表获得系统中的各种元数据、系统信息和状态之外,也可以用 `SHOW` 命令来实现同样的目的。
+SHOW 命令可以用来获取简要的系统信息。若想获取系统中详细的各种元数据、系统信息和状态,请使用 select 语句查询 INFORMATION_SCHEMA 数据库中的表。
## SHOW ACCOUNTS
@@ -194,7 +195,7 @@ SHOW STREAMS;
SHOW SUBSCRIPTIONS;
```
-显示当前数据库下的所有的订阅关系
+显示当前系统内所有的订阅关系
## SHOW TABLES
diff --git a/docs/zh/12-taos-sql/25-grant.md b/docs/zh/12-taos-sql/25-grant.md
index c41a3fcfc9ee42e56e48082da5b6420073d92cdf..6f7024d32eb6514d8025aa7c50b6bd5b1c5603ee 100644
--- a/docs/zh/12-taos-sql/25-grant.md
+++ b/docs/zh/12-taos-sql/25-grant.md
@@ -1,6 +1,7 @@
---
sidebar_label: 权限管理
title: 权限管理
+description: 企业版中才具有的权限管理功能
---
本节讲述如何在 TDengine 中进行权限管理的相关操作。
diff --git a/docs/zh/12-taos-sql/26-udf.md b/docs/zh/12-taos-sql/26-udf.md
index 7ddcad298b4b9eb4191abded0663055620b741c3..764fde6e1f2e8aa38b90b4b8bc0131c9eaf44da6 100644
--- a/docs/zh/12-taos-sql/26-udf.md
+++ b/docs/zh/12-taos-sql/26-udf.md
@@ -1,6 +1,7 @@
---
sidebar_label: 自定义函数
title: 用户自定义函数
+description: 使用 UDF 的详细指南
---
除了 TDengine 的内置函数以外,用户还可以编写自己的函数逻辑并加入TDengine系统中。
diff --git a/docs/zh/12-taos-sql/27-index.md b/docs/zh/12-taos-sql/27-index.md
index 2c0907723e76f304566e6a19bdef2d63225f903f..f88c6cf4ffe53ae19926e09c760bedd2997a952d 100644
--- a/docs/zh/12-taos-sql/27-index.md
+++ b/docs/zh/12-taos-sql/27-index.md
@@ -1,6 +1,7 @@
---
sidebar_label: 索引
title: 使用索引
+description: 索引功能的使用细节
---
TDengine 从 3.0.0.0 版本开始引入了索引功能,支持 SMA 索引和 FULLTEXT 索引。
diff --git a/docs/zh/12-taos-sql/28-recovery.md b/docs/zh/12-taos-sql/28-recovery.md
index 72b220b8ff44917831ac16301237702c991b9b15..582c3739073513df4ceb212080805136947e62d4 100644
--- a/docs/zh/12-taos-sql/28-recovery.md
+++ b/docs/zh/12-taos-sql/28-recovery.md
@@ -1,6 +1,7 @@
---
sidebar_label: 异常恢复
title: 异常恢复
+description: 如何终止出现问题的连接、查询和事务以使系统恢复正常
---
在一个复杂的应用场景中,连接和查询任务等有可能进入一种错误状态或者耗时过长迟迟无法结束,此时需要有能够终止这些连接或任务的方法。
diff --git a/docs/zh/14-reference/02-rest-api/_category_.yml b/docs/zh/14-reference/02-rest-api/_category_.yml
deleted file mode 100644
index 57a20d8458e937f60c41806be4392ebb2d13e0f7..0000000000000000000000000000000000000000
--- a/docs/zh/14-reference/02-rest-api/_category_.yml
+++ /dev/null
@@ -1 +0,0 @@
-label: REST API
diff --git a/docs/zh/14-reference/04-taosadapter.md b/docs/zh/14-reference/04-taosadapter.md
index 9baafb9b9582445280d5c73c891694e2134d15fb..71bf5f4223ae97cf2c1153aaea3b8f946e213522 100644
--- a/docs/zh/14-reference/04-taosadapter.md
+++ b/docs/zh/14-reference/04-taosadapter.md
@@ -30,7 +30,7 @@ taosAdapter 提供以下功能:
### 安装 taosAdapter
-taosAdapter 从 TDengine v2.4.0.0 版本开始成为 TDengine 服务端软件 的一部分,如果您使用 TDengine server 您不需要任何额外的步骤来安装 taosAdapter。您可以从[涛思数据官方网站](https://taosdata.com/cn/all-downloads/)下载 TDengine server(taosAdapter 包含在 v2.4.0.0 及以上版本)安装包。如果需要将 taosAdapter 分离部署在 TDengine server 之外的服务器上,则应该在该服务器上安装完整的 TDengine 来安装 taosAdapter。如果您需要使用源代码编译生成 taosAdapter,您可以参考[构建 taosAdapter](https://github.com/taosdata/taosadapter/blob/3.0/BUILD-CN.md)文档。
+taosAdapter 是 TDengine 服务端软件 的一部分,如果您使用 TDengine server 您不需要任何额外的步骤来安装 taosAdapter。您可以从[涛思数据官方网站](https://taosdata.com/cn/all-downloads/)下载 TDengine server 安装包。如果需要将 taosAdapter 分离部署在 TDengine server 之外的服务器上,则应该在该服务器上安装完整的 TDengine 来安装 taosAdapter。如果您需要使用源代码编译生成 taosAdapter,您可以参考[构建 taosAdapter](https://github.com/taosdata/taosadapter/blob/3.0/BUILD-CN.md)文档。
### start/stop taosAdapter
@@ -156,7 +156,7 @@ AllowWebSockets
## 功能列表
- RESTful 接口
- [https://docs.taosdata.com/reference/rest-api/](https://docs.taosdata.com/reference/rest-api/)
+ [RESTful API](../../connector/rest-api)
- 兼容 InfluxDB v1 写接口
[https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/](https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/)
- 兼容 OpenTSDB JSON 和 telnet 格式写入
@@ -179,7 +179,7 @@ AllowWebSockets
### TDengine RESTful 接口
-您可以使用任何支持 http 协议的客户端通过访问 RESTful 接口地址 `http://:6041/rest/sql` 来写入数据到 TDengine 或从 TDengine 中查询数据。细节请参考[官方文档](/reference/rest-api/)。
+您可以使用任何支持 http 协议的客户端通过访问 RESTful 接口地址 `http://:6041/rest/sql` 来写入数据到 TDengine 或从 TDengine 中查询数据。细节请参考[官方文档](../../connector/rest-api/)。
### InfluxDB
@@ -329,4 +329,4 @@ taosAdapter 通过参数 `restfulRowLimit` 来控制结果的返回条数,-1
| 3 | telegrafUseFieldNum | 请参考 taosAdapter telegraf 配置方法 |
| 4 | restfulRowLimit | restfulRowLimit | 内嵌 httpd 默认输出 10240 行数据,最大允许值为 102400。taosAdapter 也提供 restfulRowLimit 但是默认不做限制。您可以根据实际场景需求进行配置 |
| 5 | httpDebugFlag | 不适用 | httpdDebugFlag 对 taosAdapter 不起作用 |
-| 6 | httpDBNameMandatory | 不适用 | taosAdapter 要求 URL 中必须指定数据库名 |
\ No newline at end of file
+| 6 | httpDBNameMandatory | 不适用 | taosAdapter 要求 URL 中必须指定数据库名 |
diff --git a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-1-cluster-status.webp b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-1-cluster-status.webp
index a78e18028a94c2f6a783b08d992a25c791527407..3bc0d960f1db45ee8d2adcee26de89334e681956 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-1-cluster-status.webp and b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-1-cluster-status.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-2-dnodes.webp b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-2-dnodes.webp
index b152418d0902b8ebdf62ebce6705c10dd5ab4fbf..f5a602d3f9dcecb64ded5e1f463ba460daab0024 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-2-dnodes.webp and b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-2-dnodes.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-3-mnodes.webp b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-3-mnodes.webp
index f58f48b7f17375cb8e62e7c0126ca3aea56a13f6..f155fa42a0fb5df71ee48c8c65a8c7d8851ddc3e 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-3-mnodes.webp and b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-3-mnodes.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-4-requests.webp b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-4-requests.webp
index 00afcce013602dce0da17bfd033f65aaa8e43bb7..dc0b85e262bd4340e986a42105e0ff9838d12fa6 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-4-requests.webp and b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-4-requests.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-5-database.webp b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-5-database.webp
index 567e5694f9d7a035a3eb354493d3df8ed64db251..342c8cfc0a8e852e7cd092aff453ed1fd2ec85a2 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-5-database.webp and b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-5-database.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp
index 8666193f59497180574fd2786266e5baabbe9761..942130d4fabf7944c7add10acb3bb42ca7f51e0f 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp and b/docs/zh/14-reference/07-tdinsight/assets/TDinsight-8-taosadapter.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/howto-add-datasource.webp b/docs/zh/14-reference/07-tdinsight/assets/howto-add-datasource.webp
index 06d0ff6ed50091a6340508bc5b2b3f78b65dcb18..d7fc9e233acd1a4b1bbb940b13bc4296c261a33a 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/howto-add-datasource.webp and b/docs/zh/14-reference/07-tdinsight/assets/howto-add-datasource.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/import_dashboard.webp b/docs/zh/14-reference/07-tdinsight/assets/import_dashboard.webp
index fb7958f1b9fbd43c8f63136024842790e711c490..ae2a1e8e9b7b63a68d56dfcd2187eca614da9a3d 100644
Binary files a/docs/zh/14-reference/07-tdinsight/assets/import_dashboard.webp and b/docs/zh/14-reference/07-tdinsight/assets/import_dashboard.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/import_dashboard_view.webp b/docs/zh/14-reference/07-tdinsight/assets/import_dashboard_view.webp
new file mode 100644
index 0000000000000000000000000000000000000000..1b10e41c75fbbb9a30bce4aa8d1adb8216fbe127
Binary files /dev/null and b/docs/zh/14-reference/07-tdinsight/assets/import_dashboard_view.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/assets/select_dashboard_db.webp b/docs/zh/14-reference/07-tdinsight/assets/select_dashboard_db.webp
new file mode 100644
index 0000000000000000000000000000000000000000..956132e37e9df255d3ff82654fd357bec001e695
Binary files /dev/null and b/docs/zh/14-reference/07-tdinsight/assets/select_dashboard_db.webp differ
diff --git a/docs/zh/14-reference/07-tdinsight/index.md b/docs/zh/14-reference/07-tdinsight/index.mdx
similarity index 67%
rename from docs/zh/14-reference/07-tdinsight/index.md
rename to docs/zh/14-reference/07-tdinsight/index.mdx
index 5990a831b8bc1788deaddfb38f717f2723969362..ecd63621432794e27fd80b88e864590c83e9b333 100644
--- a/docs/zh/14-reference/07-tdinsight/index.md
+++ b/docs/zh/14-reference/07-tdinsight/index.mdx
@@ -1,21 +1,31 @@
---
-title: TDinsight - 基于Grafana的TDengine零依赖监控解决方案
+title: TDinsight
sidebar_label: TDinsight
+description: 基于Grafana的TDengine零依赖监控解决方案
---
-TDinsight 是使用内置监控数据库和 [Grafana] 对 TDengine 进行监控的解决方案。
+TDinsight 是使用监控数据库和 [Grafana] 对 TDengine 进行监控的解决方案。
-TDengine 启动后,会自动创建一个监测数据库 `log`,并自动将服务器的 CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度、慢查询等信息定时写入该数据库,并对重要的系统操作(比如登录、创建、删除数据库等)以及各种错误报警信息进行记录。通过 [Grafana] 和 [TDengine 数据源插件](https://github.com/taosdata/grafanaplugin/releases),TDinsight 将集群状态、节点信息、插入及查询请求、资源使用情况等进行可视化展示,同时还支持 vnode、dnode、mnode 节点状态异常告警,为开发者实时监控 TDengine 集群运行状态提供了便利。本文将指导用户安装 Grafana 服务器并通过 `TDinsight.sh` 安装脚本自动安装 TDengine 数据源插件及部署 TDinsight 可视化面板。
+TDengine 通过 [taosKeeper](../taosKeeper) 将服务器的 CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度、慢查询等信息定时写入指定数据库,并对重要的系统操作(比如登录、创建、删除数据库等)以及各种错误报警信息进行记录。通过 [Grafana] 和 [TDengine 数据源插件](https://github.com/taosdata/grafanaplugin/releases),TDinsight 将集群状态、节点信息、插入及查询请求、资源使用情况等进行可视化展示,同时还支持 vnode、dnode、mnode 节点状态异常告警,为开发者实时监控 TDengine 集群运行状态提供了便利。本文将指导用户安装 Grafana 服务器并通过 `TDinsight.sh` 安装脚本自动安装 TDengine 数据源插件及部署 TDinsight 可视化面板。
## 系统要求
-要部署 TDinsight,需要一个单节点的 TDengine 服务器或一个多节点的 [TDengine] 集群,以及一个[Grafana]服务器。此仪表盘需要 TDengine 2.3.3.0 及以上,并启用 `log` 数据库(`monitor = 1`)。
+- 单节点的 TDengine 服务器或多节点的 [TDengine] 集群,以及一个[Grafana]服务器。此仪表盘需要 TDengine 3.0.0.0 及以上,并开启监控服务,具体配置请参考:[TDengine 监控配置](../config/#监控相关)。
+- taosAdapter 已经安装并正常运行。具体细节请参考:[taosAdapter 使用手册](../taosadapter)
+- taosKeeper 已安装并正常运行。具体细节请参考:[taosKeeper 使用手册](../taosKeeper)
+
+记录以下信息:
+
+- taosAdapter 集群 REST API 地址,如:`http://tdengine.local:6041`。
+- taosAdapter 集群认证信息,可使用用户名及密码。
+- taosKeeper 记录监控指标的数据库名称。
## 安装 Grafana
-我们建议在此处使用最新的[Grafana] 7 或 8 版本。您可以在任何[支持的操作系统](https://grafana.com/docs/grafana/latest/installation/requirements/#supported-operating-systems)中,按照 [Grafana 官方文档安装说明](https://grafana.com/docs/grafana/latest/installation/) 安装 [Grafana]。
+我们建议在此处使用最新的[Grafana] 8 或 9 版本。您可以在任何[支持的操作系统](https://grafana.com/docs/grafana/latest/installation/requirements/#supported-operating-systems)中,按照 [Grafana 官方文档安装说明](https://grafana.com/docs/grafana/latest/installation/) 安装 [Grafana]。
-### 在 Debian 或 Ubuntu 上安装 Grafana
+
+
对于 Debian 或 Ubuntu 操作系统,建议使用 Grafana 镜像仓库。使用如下命令从零开始安装:
@@ -31,6 +41,8 @@ sudo apt-get install grafana
```
### 在 CentOS / RHEL 上安装 Grafana
+
+
您可以从官方 YUM 镜像仓库安装。
@@ -59,7 +71,12 @@ sudo yum install \
https://dl.grafana.com/oss/release/grafana-7.5.11-1.x86_64.rpm
```
-## 自动部署 TDinsight
+
+
+
+
+
+
我们提供了一个自动化安装脚本 [`TDinsight.sh`](https://github.com/taosdata/grafanaplugin/releases/latest/download/TDinsight.sh) 脚本以便用户快速进行安装配置。
@@ -71,7 +88,7 @@ chmod +x TDinsight.sh
./TDinsight.sh
```
-这个脚本会自动下载最新的[Grafana TDengine 数据源插件](https://github.com/taosdata/grafanaplugin/releases/latest) 和 [TDinsight 仪表盘](https://grafana.com/grafana/dashboards/15167) ,将命令行选项中的可配置参数转为 [Grafana Provisioning](https://grafana.com/docs/grafana/latest/administration/provisioning/) 配置文件,以进行自动化部署及更新等操作。利用该脚本提供的告警设置选项,你还可以获得内置的阿里云短信告警通知支持。
+这个脚本会自动下载最新的[Grafana TDengine 数据源插件](https://github.com/taosdata/grafanaplugin/releases/latest) 和 [TDinsight 仪表盘](https://github.com/taosdata/grafanaplugin/blob/master/dashboards/TDinsightV3.json) ,将命令行选项中的可配置参数转为 [Grafana Provisioning](https://grafana.com/docs/grafana/latest/administration/provisioning/) 配置文件,以进行自动化部署及更新等操作。利用该脚本提供的告警设置选项,你还可以获得内置的阿里云短信告警通知支持。
假设您在同一台主机上使用 TDengine 和 Grafana 的默认服务。运行 `./TDinsight.sh` 并打开 Grafana 浏览器窗口就可以看到 TDinsight 仪表盘了。
@@ -106,18 +123,6 @@ Install and configure TDinsight dashboard in Grafana on Ubuntu 18.04/20.04 syste
-E, --external-notifier Apply external notifier uid to TDinsight dashboard.
-Aliyun SMS as Notifier:
--s, --sms-enabled To enable tdengine-datasource plugin builtin Aliyun SMS webhook.
--N, --sms-notifier-name Provisioning notifier name.[default: TDinsight Builtin SMS]
--U, --sms-notifier-uid Provisioning notifier uid, use lowercase notifier name by default.
--D, --sms-notifier-is-default Set notifier as default.
--I, --sms-access-key-id Aliyun SMS access key id
--K, --sms-access-key-secret Aliyun SMS access key secret
--S, --sms-sign-name Sign name
--C, --sms-template-code Template code
--T, --sms-template-param Template param, a escaped JSON string like '{"alarm_level":"%s","time":"%s","name":"%s","content":"%s"}'
--B, --sms-phone-numbers Comma-separated numbers list, eg "189xxxxxxxx,132xxxxxxxx"
--L, --sms-listen-addr [default: 127.0.0.1:9100]
```
大多数命令行选项都可以通过环境变量获得同样的效果。
@@ -136,17 +141,6 @@ Aliyun SMS as Notifier:
| -t | --tdinsight-title | TDINSIGHT_DASHBOARD_TITLE | TDinsight 仪表盘标题。 [默认:TDinsight] |
| -e | --tdinsight-可编辑 | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] |
| -E | --external-notifier | EXTERNAL_NOTIFIER | 将外部通知程序 uid 应用于 TDinsight 仪表盘。 |
-| -s | --sms-enabled | SMS_ENABLED | 启用阿里云短信 webhook 内置的 tdengine-datasource 插件。 |
-| -N | --sms-notifier-name | SMS_NOTIFIER_NAME | 供应通知程序名称。[默认:`TDinsight Builtin SMS`] |
-| -U | --sms-notifier-uid | SMS_NOTIFIER_UID | "Notification Channel" `uid`,默认使用程序名称的小写,其他字符用 “-” 代替。 |
-| -D | --sms-notifier-is-default | SMS_NOTIFIER_IS_DEFAULT | 将内置短信通知设置为默认值。 |
-| -I | --sms-access-key-id | SMS_ACCESS_KEY_ID | 阿里云短信访问密钥 id |
-| -K | --sms-access-key-secret | SMS_ACCESS_KEY_SECRET | 阿里云短信访问秘钥 |
-| -S | --sms-sign-name | SMS_SIGN_NAME | 签名 |
-| -C | --sms-template-code | SMS_TEMPLATE_CODE | 模板代码 |
-| -T | --sms-template-param | SMS_TEMPLATE_PARAM | 模板参数的 JSON 模板 |
-| -B | --sms-phone-numbers | SMS_PHONE_NUMBERS | 逗号分隔的手机号列表,例如`"189xxxxxxxx,132xxxxxxxx"` |
-| -L | --sms-listen-addr | SMS_LISTEN_ADDR | 内置 SMS webhook 监听地址,默认为`127.0.0.1:9100` |
假设您在主机 `tdengine` 上启动 TDengine 数据库,HTTP API 端口为 `6041`,用户为 `root1`,密码为 `pass5ord`。执行脚本:
@@ -166,31 +160,18 @@ curl --no-progress-meter -u admin:admin http://localhost:3000/api/alert-notifica
sudo ./TDinsight.sh -a http://tdengine:6041 -u root1 -p pass5ord -E existing-notifier
```
-如果你想使用[阿里云短信](https://www.aliyun.com/product/sms)服务作为通知渠道,你应该使用`-s`标志启用并添加以下参数:
-
-- `-N`:Notification Channel 名,默认为`TDinsight Builtin SMS`。
-- `-U`:Channel uid,默认是 `name` 的小写,任何其他字符都替换为 - ,对于默认的 `-N`,其 uid 为 `tdinsight-builtin-sms`。
-- `-I`:阿里云短信访问密钥 id。
-- `-K`:阿里云短信访问秘钥。
-- `-S`:阿里云短信签名。
-- `-C`:阿里云短信模板 ID。
-- `-T`:阿里云短信模板参数,为 JSON 格式模板,示例如下 `'{"alarm_level":"%s","time":"%s","name":"%s","content":"%s "}'`。有四个参数:告警级别、时间、名称和告警内容。
-- `-B`:电话号码列表,以逗号`,`分隔。
-
如果要监控多个 TDengine 集群,则需要设置多个 TDinsight 仪表盘。设置非默认 TDinsight 需要进行一些更改: `-n` `-i` `-t` 选项需要更改为非默认名称,如果使用 内置短信告警功能,`-N` 和 `-L` 也应该改变。
```bash
sudo ./TDengine.sh -n TDengine-Env1 -a http://another:6041 -u root -p taosdata -i tdinsight-env1 -t 'TDinsight Env1'
-# 如果使用内置短信通知
-sudo ./TDengine.sh -n TDengine-Env1 -a http://another:6041 -u root -p taosdata -i tdinsight-env1 -t 'TDinsight Env1' \
- -s -N 'Env1 SMS' -I xx -K xx -S xx -C SMS_XX -T '' -B 00000000000 -L 127.0.0.01:10611
```
请注意,配置数据源、通知 Channel 和仪表盘在前端是不可更改的。您应该再次通过此脚本更新配置或手动更改 `/etc/grafana/provisioning` 目录(这是 Grafana 的默认目录,根据需要使用`-P`选项更改)中的配置文件。
特别地,当您使用 Grafana Cloud 或其他组织时,`-O` 可用于设置组织 ID。 `-G` 可指定 Grafana 插件安装目录。 `-e` 参数将仪表盘设置为可编辑。
-## 手动设置 TDinsight
+
+
### 安装 TDengine 数据源插件
@@ -247,23 +228,30 @@ sudo systemctl enable grafana-server
![TDengine Database TDinsight 数据源测试](./assets/howto-add-datasource-test.webp)
+
+
+
### 导入仪表盘
-指向 **+** / **Create** - **import**(或 `/dashboard/import` url)。
+在配置 TDengine 数据源界面,点击 **Dashboards** tab。
![TDengine Database TDinsight 导入仪表盘和配置](./assets/import_dashboard.webp)
-在 **Import via grafana.com** 位置键入仪表盘 ID `15167` 并 **Load**。
+选择 `TDengine for 3.x`,并点击 `import`。
+
+导入完成后,在搜索界面已经出现了 **TDinsight for 3.x** dashboard。
+
+![TDengine Database TDinsight 查看导入结果](./assets/import_dashboard_view.webp)
-![通过 grafana.com 导入](./assets/import-dashboard-15167.webp)
+进入 TDinsight for 3.x dashboard 后,选择 taosKeeper 中设置的记录监控指标的数据库。
-导入完成后,TDinsight 的完整页面视图如下所示。
+![TDengine Database TDinsight 选择数据库](./assets/select_dashboard_db.webp)
-![TDengine Database TDinsight 显示](./assets/TDinsight-full.webp)
+然后可以看到监控结果。
## TDinsight 仪表盘详细信息
-TDinsight 仪表盘旨在提供 TDengine 相关资源使用情况[dnodes, mnodes, vnodes](https://www.taosdata.com/cn/documentation/architecture#cluster)或数据库的使用情况和状态。
+TDinsight 仪表盘旨在提供 TDengine 相关资源的使用情况和状态,比如 dnodes、 mnodes、 vnodes 和数据库等。
指标详情如下:
@@ -285,7 +273,6 @@ TDinsight 仪表盘旨在提供 TDengine 相关资源使用情况[dnodes, mnodes
- **Measuring Points Used**:启用告警规则的测点数用量(社区版无数据,默认情况下是健康的)。
- **Grants Expire Time**:启用告警规则的企业版过期时间(社区版无数据,默认情况是健康的)。
- **Error Rate**:启用警报的集群总合错误率(每秒平均错误数)。
-- **Variables**:`show variables` 表格展示。
### DNodes 状态
@@ -294,7 +281,6 @@ TDinsight 仪表盘旨在提供 TDengine 相关资源使用情况[dnodes, mnodes
- **DNodes Status**:`show dnodes` 的简单表格视图。
- **DNodes Lifetime**:从创建 dnode 开始经过的时间。
- **DNodes Number**:DNodes 数量变化。
-- **Offline Reason**:如果有任何 dnode 状态为离线,则以饼图形式展示离线原因。
### MNode 概述
@@ -309,7 +295,6 @@ TDinsight 仪表盘旨在提供 TDengine 相关资源使用情况[dnodes, mnodes
1. **Requests Rate(Inserts per Second)**:平均每秒插入次数。
2. **Requests (Selects)**:查询请求数及变化率(count of second)。
-3. **Requests (HTTP)**:HTTP 请求数和请求速率(count of second)。
### 数据库
@@ -319,9 +304,8 @@ TDinsight 仪表盘旨在提供 TDengine 相关资源使用情况[dnodes, mnodes
1. **STables**:超级表数量。
2. **Total Tables**:所有表数量。
-3. **Sub Tables**:所有超级表子表的数量。
-4. **Tables**:所有普通表数量随时间变化图。
-5. **Tables Number Foreach VGroups**:每个 VGroups 包含的表数量。
+3. **Tables**:所有普通表数量随时间变化图。
+4. **Tables Number Foreach VGroups**:每个 VGroups 包含的表数量。
### DNode 资源使用情况
@@ -356,12 +340,11 @@ TDinsight 仪表盘旨在提供 TDengine 相关资源使用情况[dnodes, mnodes
支持监控 taosAdapter 请求统计和状态详情。包括:
-1. **http_request**: 包含总请求数,请求失败数以及正在处理的请求数
-2. **top 3 request endpoint**: 按终端分组,请求排名前三的数据
-3. **Memory Used**: taosAdapter 内存使用情况
-4. **latency_quantile(ms)**: (1, 2, 5, 9, 99)阶段的分位数
-5. **top 3 failed request endpoint**: 按终端分组,请求失败排名前三的数据
-6. **CPU Used**: taosAdapter CPU 使用情况
+1. **http_request_inflight**: 即时处理请求数
+2. **http_request_total**: 请求总数。
+3. **http_request_fail**: 请求总数。
+4. **CPU Used**: taosAdapter CPU 使用情况。
+5. **Memory Used**: taosAdapter 内存使用情况。
## 升级
@@ -403,13 +386,6 @@ services:
TDENGINE_API: ${TDENGINE_API}
TDENGINE_USER: ${TDENGINE_USER}
TDENGINE_PASS: ${TDENGINE_PASS}
- SMS_ACCESS_KEY_ID: ${SMS_ACCESS_KEY_ID}
- SMS_ACCESS_KEY_SECRET: ${SMS_ACCESS_KEY_SECRET}
- SMS_SIGN_NAME: ${SMS_SIGN_NAME}
- SMS_TEMPLATE_CODE: ${SMS_TEMPLATE_CODE}
- SMS_TEMPLATE_PARAM: '${SMS_TEMPLATE_PARAM}'
- SMS_PHONE_NUMBERS: $SMS_PHONE_NUMBERS
- SMS_LISTEN_ADDR: ${SMS_LISTEN_ADDR}
ports:
- 3000:3000
volumes:
diff --git a/docs/zh/14-reference/08-taos-shell.md b/docs/zh/14-reference/08-taos-shell.md
index 2f3b551502c8b9da789220b1b20e701e038dc5e7..580454987840b61a5efff4acd545443ebca9904b 100644
--- a/docs/zh/14-reference/08-taos-shell.md
+++ b/docs/zh/14-reference/08-taos-shell.md
@@ -8,7 +8,7 @@ TDengine 命令行程序(以下简称 TDengine CLI)是用户操作 TDengine
## 安装
-如果在 TDengine 服务器端执行,无需任何安装,已经自动安装好 TDengine CLI。如果要在非 TDengine 服务器端运行,需要安装 TDengine 客户端驱动安装包,具体安装,请参考 [连接器](/reference/connector/)。
+如果在 TDengine 服务器端执行,无需任何安装,已经自动安装好 TDengine CLI。如果要在非 TDengine 服务器端运行,需要安装 TDengine 客户端驱动安装包,具体安装,请参考 [连接器](../../connector/)。
## 执行
@@ -18,7 +18,7 @@ TDengine 命令行程序(以下简称 TDengine CLI)是用户操作 TDengine
taos
```
-如果连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印错误消息。(请参考 [FAQ](/train-faq/faq) 来解决终端连接服务端失败的问题)。TDengine CLI 的提示符号如下:
+如果连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印错误消息。(请参考 [FAQ](../../train-faq/faq) 来解决终端连接服务端失败的问题)。TDengine CLI 的提示符号如下:
```cmd
taos>
diff --git a/docs/zh/14-reference/11-docker/index.md b/docs/zh/14-reference/11-docker/index.md
index 743fc2d32f82778fb97e7879972cd23db1159c8e..d712e9aba8bf5d79c98abbe65222722497c66dee 100644
--- a/docs/zh/14-reference/11-docker/index.md
+++ b/docs/zh/14-reference/11-docker/index.md
@@ -32,7 +32,7 @@ taos> show databases;
Query OK, 2 rows in database (0.033802s)
```
-因为运行在容器中的 TDengine 服务端使用容器的 hostname 建立连接,使用 taos shell 或者各种连接器(例如 JDBC-JNI)从容器外访问容器内的 TDengine 比较复杂,所以上述方式是访问容器中 TDengine 服务的最简单的方法,适用于一些简单场景。如果在一些复杂场景下想要从容器化使用 taos shell 或者各种连接器访问容器中的 TDengine 服务,请参考下一节。
+因为运行在容器中的 TDengine 服务端使用容器的 hostname 建立连接,使用 TDengine CLI 或者各种连接器(例如 JDBC-JNI)从容器外访问容器内的 TDengine 比较复杂,所以上述方式是访问容器中 TDengine 服务的最简单的方法,适用于一些简单场景。如果在一些复杂场景下想要从容器化使用 TDengine CLI 或者各种连接器访问容器中的 TDengine 服务,请参考下一节。
## 在 host 网络上启动 TDengine
@@ -75,7 +75,7 @@ docker run -d \
echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts
```
-最后,可以从 taos shell 或者任意连接器以 "tdengine" 为服务端地址访问 TDengine 服务。
+最后,可以从 TDengine CLI 或者任意连接器以 "tdengine" 为服务端地址访问 TDengine 服务。
```shell
taos -h tdengine -P 6030
@@ -354,7 +354,7 @@ test-docker_td-2_1 /tini -- /usr/bin/entrypoi ... Up
test-docker_td-3_1 /tini -- /usr/bin/entrypoi ... Up
```
-4. 用 taos shell 查看 dnodes
+4. 用 TDengine CLI 查看 dnodes
```shell
diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md
index d2efc5baf381d7631533f9b80fa2994dc16a221e..7b31e10572c4a6bafd088e7b7c14853ee0d32df1 100644
--- a/docs/zh/14-reference/12-config/index.md
+++ b/docs/zh/14-reference/12-config/index.md
@@ -698,122 +698,123 @@ charset 的有效值是 UTF-8。
| 45 | numOfVnodeFetchThreads | 否 | 是 |
| 46 | numOfVnodeWriteThreads | 否 | 是 |
| 47 | numOfVnodeSyncThreads | 否 | 是 |
-| 48 | numOfQnodeQueryThreads | 否 | 是 |
-| 49 | numOfQnodeFetchThreads | 否 | 是 |
-| 50 | numOfSnodeSharedThreads | 否 | 是 |
-| 51 | numOfSnodeUniqueThreads | 否 | 是 |
-| 52 | rpcQueueMemoryAllowed | 否 | 是 |
-| 53 | logDir | 是 | 是 |
-| 54 | minimalLogDirGB | 是 | 是 |
-| 55 | numOfLogLines | 是 | 是 |
-| 56 | asyncLog | 是 | 是 |
-| 57 | logKeepDays | 是 | 是 |
-| 58 | debugFlag | 是 | 是 |
-| 59 | tmrDebugFlag | 是 | 是 |
-| 60 | uDebugFlag | 是 | 是 |
-| 61 | rpcDebugFlag | 是 | 是 |
-| 62 | jniDebugFlag | 是 | 是 |
-| 63 | qDebugFlag | 是 | 是 |
-| 64 | cDebugFlag | 是 | 是 |
-| 65 | dDebugFlag | 是 | 是 |
-| 66 | vDebugFlag | 是 | 是 |
-| 67 | mDebugFlag | 是 | 是 |
-| 68 | wDebugFlag | 是 | 是 |
-| 69 | sDebugFlag | 是 | 是 |
-| 70 | tsdbDebugFlag | 是 | 是 |
-| 71 | tqDebugFlag | 否 | 是 |
-| 72 | fsDebugFlag | 是 | 是 |
-| 73 | udfDebugFlag | 否 | 是 |
-| 74 | smaDebugFlag | 否 | 是 |
-| 75 | idxDebugFlag | 否 | 是 |
-| 76 | tdbDebugFlag | 否 | 是 |
-| 77 | metaDebugFlag | 否 | 是 |
-| 78 | timezone | 是 | 是 |
-| 79 | locale | 是 | 是 |
-| 80 | charset | 是 | 是 |
-| 81 | udf | 是 | 是 |
-| 82 | enableCoreFile | 是 | 是 |
-| 83 | arbitrator | 是 | 否 |
-| 84 | numOfThreadsPerCore | 是 | 否 |
-| 85 | numOfMnodes | 是 | 否 |
-| 86 | vnodeBak | 是 | 否 |
-| 87 | balance | 是 | 否 |
-| 88 | balanceInterval | 是 | 否 |
-| 89 | offlineThreshold | 是 | 否 |
-| 90 | role | 是 | 否 |
-| 91 | dnodeNopLoop | 是 | 否 |
-| 92 | keepTimeOffset | 是 | 否 |
-| 93 | rpcTimer | 是 | 否 |
-| 94 | rpcMaxTime | 是 | 否 |
-| 95 | rpcForceTcp | 是 | 否 |
-| 96 | tcpConnTimeout | 是 | 否 |
-| 97 | syncCheckInterval | 是 | 否 |
-| 98 | maxTmrCtrl | 是 | 否 |
-| 99 | monitorReplica | 是 | 否 |
-| 100 | smlTagNullName | 是 | 否 |
-| 101 | keepColumnName | 是 | 否 |
-| 102 | ratioOfQueryCores | 是 | 否 |
-| 103 | maxStreamCompDelay | 是 | 否 |
-| 104 | maxFirstStreamCompDelay | 是 | 否 |
-| 105 | retryStreamCompDelay | 是 | 否 |
-| 106 | streamCompDelayRatio | 是 | 否 |
-| 107 | maxVgroupsPerDb | 是 | 否 |
-| 108 | maxTablesPerVnode | 是 | 否 |
-| 109 | minTablesPerVnode | 是 | 否 |
-| 110 | tableIncStepPerVnode | 是 | 否 |
-| 111 | cache | 是 | 否 |
-| 112 | blocks | 是 | 否 |
-| 113 | days | 是 | 否 |
-| 114 | keep | 是 | 否 |
-| 115 | minRows | 是 | 否 |
-| 116 | maxRows | 是 | 否 |
-| 117 | quorum | 是 | 否 |
-| 118 | comp | 是 | 否 |
-| 119 | walLevel | 是 | 否 |
-| 120 | fsync | 是 | 否 |
-| 121 | replica | 是 | 否 |
-| 122 | partitions | 是 | 否 |
-| 123 | quorum | 是 | 否 |
-| 124 | update | 是 | 否 |
-| 125 | cachelast | 是 | 否 |
-| 126 | maxSQLLength | 是 | 否 |
-| 127 | maxWildCardsLength | 是 | 否 |
-| 128 | maxRegexStringLen | 是 | 否 |
-| 129 | maxNumOfOrderedRes | 是 | 否 |
-| 130 | maxConnections | 是 | 否 |
-| 131 | mnodeEqualVnodeNum | 是 | 否 |
-| 132 | http | 是 | 否 |
-| 133 | httpEnableRecordSql | 是 | 否 |
-| 134 | httpMaxThreads | 是 | 否 |
-| 135 | restfulRowLimit | 是 | 否 |
-| 136 | httpDbNameMandatory | 是 | 否 |
-| 137 | httpKeepAlive | 是 | 否 |
-| 138 | enableRecordSql | 是 | 否 |
-| 139 | maxBinaryDisplayWidth | 是 | 否 |
-| 140 | stream | 是 | 否 |
-| 141 | retrieveBlockingModel | 是 | 否 |
-| 142 | tsdbMetaCompactRatio | 是 | 否 |
-| 143 | defaultJSONStrType | 是 | 否 |
-| 144 | walFlushSize | 是 | 否 |
-| 145 | keepTimeOffset | 是 | 否 |
-| 146 | flowctrl | 是 | 否 |
-| 147 | slaveQuery | 是 | 否 |
-| 148 | adjustMaster | 是 | 否 |
-| 149 | topicBinaryLen | 是 | 否 |
-| 150 | telegrafUseFieldNum | 是 | 否 |
-| 151 | deadLockKillQuery | 是 | 否 |
-| 152 | clientMerge | 是 | 否 |
-| 153 | sdbDebugFlag | 是 | 否 |
-| 154 | odbcDebugFlag | 是 | 否 |
-| 155 | httpDebugFlag | 是 | 否 |
-| 156 | monDebugFlag | 是 | 否 |
-| 157 | cqDebugFlag | 是 | 否 |
-| 158 | shortcutFlag | 是 | 否 |
-| 159 | probeSeconds | 是 | 否 |
-| 160 | probeKillSeconds | 是 | 否 |
-| 161 | probeInterval | 是 | 否 |
-| 162 | lossyColumns | 是 | 否 |
-| 163 | fPrecision | 是 | 否 |
-| 164 | dPrecision | 是 | 否 |
-| 165 | maxRange | 是 | 否 |
-| 166 | range | 是 | 否 |
+| 48 | numOfVnodeRsmaThreads | 否 | 是 |
+| 49 | numOfQnodeQueryThreads | 否 | 是 |
+| 50 | numOfQnodeFetchThreads | 否 | 是 |
+| 51 | numOfSnodeSharedThreads | 否 | 是 |
+| 52 | numOfSnodeUniqueThreads | 否 | 是 |
+| 53 | rpcQueueMemoryAllowed | 否 | 是 |
+| 54 | logDir | 是 | 是 |
+| 55 | minimalLogDirGB | 是 | 是 |
+| 56 | numOfLogLines | 是 | 是 |
+| 57 | asyncLog | 是 | 是 |
+| 58 | logKeepDays | 是 | 是 |
+| 59 | debugFlag | 是 | 是 |
+| 60 | tmrDebugFlag | 是 | 是 |
+| 61 | uDebugFlag | 是 | 是 |
+| 62 | rpcDebugFlag | 是 | 是 |
+| 63 | jniDebugFlag | 是 | 是 |
+| 64 | qDebugFlag | 是 | 是 |
+| 65 | cDebugFlag | 是 | 是 |
+| 66 | dDebugFlag | 是 | 是 |
+| 67 | vDebugFlag | 是 | 是 |
+| 68 | mDebugFlag | 是 | 是 |
+| 69 | wDebugFlag | 是 | 是 |
+| 70 | sDebugFlag | 是 | 是 |
+| 71 | tsdbDebugFlag | 是 | 是 |
+| 72 | tqDebugFlag | 否 | 是 |
+| 73 | fsDebugFlag | 是 | 是 |
+| 74 | udfDebugFlag | 否 | 是 |
+| 75 | smaDebugFlag | 否 | 是 |
+| 76 | idxDebugFlag | 否 | 是 |
+| 77 | tdbDebugFlag | 否 | 是 |
+| 78 | metaDebugFlag | 否 | 是 |
+| 79 | timezone | 是 | 是 |
+| 80 | locale | 是 | 是 |
+| 81 | charset | 是 | 是 |
+| 82 | udf | 是 | 是 |
+| 83 | enableCoreFile | 是 | 是 |
+| 84 | arbitrator | 是 | 否 |
+| 85 | numOfThreadsPerCore | 是 | 否 |
+| 86 | numOfMnodes | 是 | 否 |
+| 87 | vnodeBak | 是 | 否 |
+| 88 | balance | 是 | 否 |
+| 89 | balanceInterval | 是 | 否 |
+| 90 | offlineThreshold | 是 | 否 |
+| 91 | role | 是 | 否 |
+| 92 | dnodeNopLoop | 是 | 否 |
+| 93 | keepTimeOffset | 是 | 否 |
+| 94 | rpcTimer | 是 | 否 |
+| 95 | rpcMaxTime | 是 | 否 |
+| 96 | rpcForceTcp | 是 | 否 |
+| 97 | tcpConnTimeout | 是 | 否 |
+| 98 | syncCheckInterval | 是 | 否 |
+| 99 | maxTmrCtrl | 是 | 否 |
+| 100 | monitorReplica | 是 | 否 |
+| 101 | smlTagNullName | 是 | 否 |
+| 102 | keepColumnName | 是 | 否 |
+| 103 | ratioOfQueryCores | 是 | 否 |
+| 104 | maxStreamCompDelay | 是 | 否 |
+| 105 | maxFirstStreamCompDelay | 是 | 否 |
+| 106 | retryStreamCompDelay | 是 | 否 |
+| 107 | streamCompDelayRatio | 是 | 否 |
+| 108 | maxVgroupsPerDb | 是 | 否 |
+| 109 | maxTablesPerVnode | 是 | 否 |
+| 110 | minTablesPerVnode | 是 | 否 |
+| 111 | tableIncStepPerVnode | 是 | 否 |
+| 112 | cache | 是 | 否 |
+| 113 | blocks | 是 | 否 |
+| 114 | days | 是 | 否 |
+| 115 | keep | 是 | 否 |
+| 116 | minRows | 是 | 否 |
+| 117 | maxRows | 是 | 否 |
+| 118 | quorum | 是 | 否 |
+| 119 | comp | 是 | 否 |
+| 120 | walLevel | 是 | 否 |
+| 121 | fsync | 是 | 否 |
+| 122 | replica | 是 | 否 |
+| 123 | partitions | 是 | 否 |
+| 124 | quorum | 是 | 否 |
+| 125 | update | 是 | 否 |
+| 126 | cachelast | 是 | 否 |
+| 127 | maxSQLLength | 是 | 否 |
+| 128 | maxWildCardsLength | 是 | 否 |
+| 129 | maxRegexStringLen | 是 | 否 |
+| 130 | maxNumOfOrderedRes | 是 | 否 |
+| 131 | maxConnections | 是 | 否 |
+| 132 | mnodeEqualVnodeNum | 是 | 否 |
+| 133 | http | 是 | 否 |
+| 134 | httpEnableRecordSql | 是 | 否 |
+| 135 | httpMaxThreads | 是 | 否 |
+| 136 | restfulRowLimit | 是 | 否 |
+| 137 | httpDbNameMandatory | 是 | 否 |
+| 138 | httpKeepAlive | 是 | 否 |
+| 139 | enableRecordSql | 是 | 否 |
+| 140 | maxBinaryDisplayWidth | 是 | 否 |
+| 141 | stream | 是 | 否 |
+| 142 | retrieveBlockingModel | 是 | 否 |
+| 143 | tsdbMetaCompactRatio | 是 | 否 |
+| 144 | defaultJSONStrType | 是 | 否 |
+| 145 | walFlushSize | 是 | 否 |
+| 146 | keepTimeOffset | 是 | 否 |
+| 147 | flowctrl | 是 | 否 |
+| 148 | slaveQuery | 是 | 否 |
+| 149 | adjustMaster | 是 | 否 |
+| 150 | topicBinaryLen | 是 | 否 |
+| 151 | telegrafUseFieldNum | 是 | 否 |
+| 152 | deadLockKillQuery | 是 | 否 |
+| 153 | clientMerge | 是 | 否 |
+| 154 | sdbDebugFlag | 是 | 否 |
+| 155 | odbcDebugFlag | 是 | 否 |
+| 156 | httpDebugFlag | 是 | 否 |
+| 157 | monDebugFlag | 是 | 否 |
+| 158 | cqDebugFlag | 是 | 否 |
+| 159 | shortcutFlag | 是 | 否 |
+| 160 | probeSeconds | 是 | 否 |
+| 161 | probeKillSeconds | 是 | 否 |
+| 162 | probeInterval | 是 | 否 |
+| 163 | lossyColumns | 是 | 否 |
+| 164 | fPrecision | 是 | 否 |
+| 165 | dPrecision | 是 | 否 |
+| 166 | maxRange | 是 | 否 |
+| 167 | range | 是 | 否 |
diff --git a/docs/zh/14-reference/12-directory.md b/docs/zh/14-reference/12-directory.md
index 262eb99fa5cc012d22b917479bc3d16442d06ddf..04aa6e72c9b2c0a04e35ef1f67f1138cf7d00ce2 100644
--- a/docs/zh/14-reference/12-directory.md
+++ b/docs/zh/14-reference/12-directory.md
@@ -30,7 +30,7 @@ TDengine 的所有可执行文件默认存放在 _/usr/local/taos/bin_ 目录下
- _taosd-dump-cfg.gdb_:用于方便调试 taosd 的 gdb 执行脚本。
:::note
-2.4.0.0 版本之后的 taosBenchmark 和 taosdump 需要安装独立安装包 taosTools。
+taosdump 需要安装独立安装包 taosTools。
:::
diff --git a/docs/zh/14-reference/index.md b/docs/zh/14-reference/index.md
index e9c0c4fe236b8eefec1275a447c1dd1188921ee0..9d0a44af577beba67c445dac1cfcac0475e0ce3f 100644
--- a/docs/zh/14-reference/index.md
+++ b/docs/zh/14-reference/index.md
@@ -1,5 +1,6 @@
---
title: 参考手册
+description: TDengine 中的各种组件的详细说明
---
参考手册是对 TDengine 本身、 TDengine 各语言连接器及自带的工具最详细的介绍。
diff --git a/docs/zh/17-operation/01-pkg-install.md b/docs/zh/17-operation/01-pkg-install.md
index 5e4cc931309ea8bf45b1840a7da04e336434bdab..6d93c1697b1e0936b3f6539d3b1fb95db0baa956 100644
--- a/docs/zh/17-operation/01-pkg-install.md
+++ b/docs/zh/17-operation/01-pkg-install.md
@@ -47,43 +47,99 @@ lrwxrwxrwx 1 root root 13 Feb 22 09:34 log -> /var/log/taos/
-内容 TBD
+TDengine 卸载命令如下:
+
+```
+$ sudo apt-get remove tdengine
+Reading package lists... Done
+Building dependency tree
+Reading state information... Done
+The following packages will be REMOVED:
+ tdengine
+0 upgraded, 0 newly installed, 1 to remove and 18 not upgraded.
+After this operation, 68.3 MB disk space will be freed.
+Do you want to continue? [Y/n] y
+(Reading database ... 135625 files and directories currently installed.)
+Removing tdengine (3.0.0.0) ...
+TDengine is removed successfully!
+
+```
+
+taosTools 卸载命令如下:
+
+```
+$ sudo apt remove taostools
+Reading package lists... Done
+Building dependency tree
+Reading state information... Done
+The following packages will be REMOVED:
+ taostools
+0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+After this operation, 68.3 MB disk space will be freed.
+Do you want to continue? [Y/n]
+(Reading database ... 147973 files and directories currently installed.)
+Removing taostools (2.1.2) ...
+```
-卸载命令如下:
+TDengine 卸载命令如下:
```
$ sudo dpkg -r tdengine
(Reading database ... 120119 files and directories currently installed.)
-Removing tdengine (3.0.0.10002) ...
+Removing tdengine (3.0.0.0) ...
TDengine is removed successfully!
```
+taosTools 卸载命令如下:
+
+```
+$ sudo dpkg -r taostools
+(Reading database ... 147973 files and directories currently installed.)
+Removing taostools (2.1.2) ...
+```
+
-卸载命令如下:
+卸载 TDengine 命令如下:
```
$ sudo rpm -e tdengine
TDengine is removed successfully!
```
+卸载 taosTools 命令如下:
+
+```
+sudo rpm -e taostools
+taosToole is removed successfully!
+```
+
-卸载命令如下:
+卸载 TDengine 命令如下:
```
$ rmtaos
TDengine is removed successfully!
```
+卸载 taosTools 命令如下:
+
+```
+$ rmtaostools
+Start to uninstall taos tools ...
+
+taos tools is uninstalled successfully!
+```
+
在 C:\TDengine 目录下,通过运行 unins000.exe 卸载程序来卸载 TDengine。
diff --git a/docs/zh/17-operation/02-planning.mdx b/docs/zh/17-operation/02-planning.mdx
index 0d63c4eaf365036cbba1d838ba6ee860a894724d..28e3f54020632e84721c20a9f63ee2a6117e6a03 100644
--- a/docs/zh/17-operation/02-planning.mdx
+++ b/docs/zh/17-operation/02-planning.mdx
@@ -1,6 +1,7 @@
---
sidebar_label: 容量规划
title: 容量规划
+description: 如何规划一个 TDengine 集群所需的物理资源
---
使用 TDengine 来搭建一个物联网大数据平台,计算资源、存储资源需要根据业务场景进行规划。下面分别讨论系统运行所需要的内存、CPU 以及硬盘空间。
diff --git a/docs/zh/17-operation/03-tolerance.md b/docs/zh/17-operation/03-tolerance.md
index 1ce485b042d6900ccc1c1bc3bcb6779e14b776ff..79cf10c39a7028e04e7c1ebbea54738dcdc528af 100644
--- a/docs/zh/17-operation/03-tolerance.md
+++ b/docs/zh/17-operation/03-tolerance.md
@@ -1,5 +1,7 @@
---
title: 容错和灾备
+sidebar_label: 容错和灾备
+description: TDengine 的容错和灾备功能
---
## 容错
diff --git a/docs/zh/17-operation/07-import.md b/docs/zh/17-operation/07-import.md
index 7dee05720d4c3446181e8e0d81a5c27e35300ba8..17945be595f9176a528e52d2344b5cd0545c3426 100644
--- a/docs/zh/17-operation/07-import.md
+++ b/docs/zh/17-operation/07-import.md
@@ -1,5 +1,6 @@
---
title: 数据导入
+description: 如何导入外部数据到 TDengine
---
TDengine 提供多种方便的数据导入功能,一种按脚本文件导入,一种按数据文件导入,一种是 taosdump 工具导入本身导出的文件。
diff --git a/docs/zh/17-operation/08-export.md b/docs/zh/17-operation/08-export.md
index 042ecc7ba29f976d50bbca1e3155bd03b2ae7ccc..44247e28bdf5ec48ccd05ab6f7e4d3558cf23103 100644
--- a/docs/zh/17-operation/08-export.md
+++ b/docs/zh/17-operation/08-export.md
@@ -1,12 +1,13 @@
---
title: 数据导出
+description: 如何导出 TDengine 中的数据
---
为方便数据导出,TDengine 提供了两种导出方式,分别是按表导出和用 taosdump 导出。
## 按表导出 CSV 文件
-如果用户需要导出一个表或一个 STable 中的数据,可在 taos shell 中运行:
+如果用户需要导出一个表或一个 STable 中的数据,可在 TDengine CLI 中运行:
```sql
select * from >> data.csv;
diff --git a/docs/zh/17-operation/10-monitor.md b/docs/zh/17-operation/10-monitor.md
index e30be775fb5c337b2a621bea92d3af31a2cb5cc0..e936f35dcac544ad94035b5e5c9716c4aa50562e 100644
--- a/docs/zh/17-operation/10-monitor.md
+++ b/docs/zh/17-operation/10-monitor.md
@@ -1,14 +1,15 @@
---
title: 系统监控
+description: 监控 TDengine 的运行状态
---
-TDengine 启动后,会自动创建一个监测数据库 log,并自动将服务器的 CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度、慢查询等信息定时写入该数据库。TDengine 还将重要的系统操作(比如登录、创建、删除数据库等)日志以及各种错误报警信息记录下来存放在 log 库里。系统管理员可以从 CLI 直接查看这个数据库,也可以在 WEB 通过图形化界面查看这些监测信息。
+TDengine 通过 [taosKeeper](/reference/taosKeeper/) 将服务器的 CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度等信息定时写入指定数据库。TDengine 还将重要的系统操作(比如登录、创建、删除数据库等)日志以及各种错误报警信息进行记录。系统管理员可以从 CLI 直接查看这个数据库,也可以在 WEB 通过图形化界面查看这些监测信息。
这些监测信息的采集缺省是打开的,但可以修改配置文件里的选项 monitor 将其关闭或打开。
## TDinsight - 使用监控数据库 + Grafana 对 TDengine 进行监控的解决方案
-从 2.3.3.0 开始,监控数据库将提供更多的监控项,您可以从 [TDinsight Grafana Dashboard](https://grafana.com/grafana/dashboards/15167) 了解如何使用 TDinsight 方案对 TDengine 进行监控。
+监控数据库将提供更多的监控项,您可以从 [TDinsight Grafana Dashboard](/reference/tdinsight/) 了解如何使用 TDinsight 方案对 TDengine 进行监控。
我们提供了一个自动化脚本 `TDinsight.sh` 对 TDinsight 进行部署。
@@ -34,21 +35,6 @@ chmod +x TDinsight.sh
sudo ./TDinsight.sh -a http://localhost:6041 -u root -p taosdata -E
```
- - 使用 TDengine 数据源插件内置的阿里云短信告警通知,使用 `-s` 启用之,并设置如下参数:
-
- 1. 阿里云短信服务 Key ID,参数 `-I`
- 2. 阿里云短信服务 Key Secret,参数 `K`
- 3. 阿里云短信服务签名,参数 `-S`
- 4. 短信通知模板号,参数 `-C`
- 5. 短信通知模板输入参数,JSON 格式,参数 `-T`,如 `{"alarm_level":"%s","time":"%s","name":"%s","content":"%s"}`
- 6. 逗号分隔的通知手机列表,参数 `-B`
-
- ```bash
- sudo ./TDinsight.sh -a http://localhost:6041 -u root -p taosdata -s \
- -I XXXXXXX -K XXXXXXXX -S taosdata -C SMS_1111111 -B 18900000000 \
- -T '{"alarm_level":"%s","time":"%s","name":"%s","content":"%s"}'
- ```
-
运行程序并重启 Grafana 服务,打开面板:`http://localhost:3000/d/tdinsight`。
更多使用场景和限制请参考[TDinsight](/reference/tdinsight/) 文档。
diff --git a/docs/zh/17-operation/17-diagnose.md b/docs/zh/17-operation/17-diagnose.md
index e6e9be7153dee855867c4ba4fcd1d3258c9d788f..ec529096a7513bd625131939d67c61279721b961 100644
--- a/docs/zh/17-operation/17-diagnose.md
+++ b/docs/zh/17-operation/17-diagnose.md
@@ -1,5 +1,6 @@
---
title: 诊断及其他
+description: 一些常见问题的诊断技巧
---
## 网络连接诊断
diff --git a/docs/zh/20-third-party/01-grafana.mdx b/docs/zh/20-third-party/01-grafana.mdx
index becb1a70a908ad27a93a763ac46343b0ec46769d..83f3f8bb25de4b99a345bafab7e8a43c3d35f14e 100644
--- a/docs/zh/20-third-party/01-grafana.mdx
+++ b/docs/zh/20-third-party/01-grafana.mdx
@@ -1,6 +1,7 @@
---
sidebar_label: Grafana
title: Grafana
+description: 使用 Grafana 与 TDengine 的详细说明
---
import Tabs from "@theme/Tabs";
diff --git a/docs/zh/20-third-party/02-prometheus.md b/docs/zh/20-third-party/02-prometheus.md
index 0fe534b8df263064e5269e1732b69893efd7a79a..eb6c3bf1d0b5f6e5d8146566969df41dbad5bf99 100644
--- a/docs/zh/20-third-party/02-prometheus.md
+++ b/docs/zh/20-third-party/02-prometheus.md
@@ -1,6 +1,7 @@
---
sidebar_label: Prometheus
title: Prometheus
+description: 使用 Prometheus 访问 TDengine
---
import Prometheus from "../14-reference/_prometheus.mdx"
diff --git a/docs/zh/20-third-party/03-telegraf.md b/docs/zh/20-third-party/03-telegraf.md
index 88a69211c0592940d7f75d34c03bcc0593cd74d6..84883e665a84db89d564314a0e47f9caab04d6ff 100644
--- a/docs/zh/20-third-party/03-telegraf.md
+++ b/docs/zh/20-third-party/03-telegraf.md
@@ -1,6 +1,7 @@
---
sidebar_label: Telegraf
title: Telegraf 写入
+description: 使用 Telegraf 向 TDengine 写入数据
---
import Telegraf from "../14-reference/_telegraf.mdx"
diff --git a/docs/zh/20-third-party/05-collectd.md b/docs/zh/20-third-party/05-collectd.md
index 04892fd42e92e962fcccadf626f67c432e78d286..cc2235f2600ec44425a2f22f39dc3c58a4ccdd5a 100644
--- a/docs/zh/20-third-party/05-collectd.md
+++ b/docs/zh/20-third-party/05-collectd.md
@@ -1,6 +1,7 @@
---
sidebar_label: collectd
title: collectd 写入
+description: 使用 collected 向 TDengine 写入数据
---
import CollectD from "../14-reference/_collectd.mdx"
diff --git a/docs/zh/20-third-party/06-statsd.md b/docs/zh/20-third-party/06-statsd.md
index 260d01183598826e1c887164d0b1b146c5e80c95..122c9fd94c57ef4979d432e2a45cc5136b1644b2 100644
--- a/docs/zh/20-third-party/06-statsd.md
+++ b/docs/zh/20-third-party/06-statsd.md
@@ -1,6 +1,7 @@
---
sidebar_label: StatsD
title: StatsD 直接写入
+description: 使用 StatsD 向 TDengine 写入
---
import StatsD from "../14-reference/_statsd.mdx"
diff --git a/docs/zh/20-third-party/07-icinga2.md b/docs/zh/20-third-party/07-icinga2.md
index ed1f1404a730eca5f51e2ff9bbcd54949018f8ea..06ead57655cfad7bcf88945780dbed52e9c58e16 100644
--- a/docs/zh/20-third-party/07-icinga2.md
+++ b/docs/zh/20-third-party/07-icinga2.md
@@ -1,6 +1,7 @@
---
sidebar_label: icinga2
title: icinga2 写入
+description: 使用 icinga2 写入 TDengine
---
import Icinga2 from "../14-reference/_icinga2.mdx"
diff --git a/docs/zh/20-third-party/08-tcollector.md b/docs/zh/20-third-party/08-tcollector.md
index a1245e8c27f302d56f88fa382b5f38f9bd49a0aa..78d0b4a5dfda0c1a18908f5a0f5f9314e82e3737 100644
--- a/docs/zh/20-third-party/08-tcollector.md
+++ b/docs/zh/20-third-party/08-tcollector.md
@@ -1,6 +1,7 @@
---
sidebar_label: TCollector
title: TCollector 写入
+description: 使用 TCollector 写入 TDengine
---
import TCollector from "../14-reference/_tcollector.mdx"
diff --git a/docs/zh/20-third-party/09-emq-broker.md b/docs/zh/20-third-party/09-emq-broker.md
index dd98374558080a0ea11cbc22ede58b66a3984191..782a139e223456d0f3484d282d641075be1a3f81 100644
--- a/docs/zh/20-third-party/09-emq-broker.md
+++ b/docs/zh/20-third-party/09-emq-broker.md
@@ -1,6 +1,7 @@
---
sidebar_label: EMQX Broker
title: EMQX Broker 写入
+description: 使用 EMQX Broker 写入 TDengine
---
MQTT 是流行的物联网数据传输协议,[EMQX](https://github.com/emqx/emqx)是一开源的 MQTT Broker 软件,无需任何代码,只需要在 EMQX Dashboard 里使用“规则”做简单配置,即可将 MQTT 的数据直接写入 TDengine。EMQX 支持通过 发送到 Web 服务的方式保存数据到 TDengine,也在企业版上提供原生的 TDengine 驱动实现直接保存。
@@ -90,7 +91,7 @@ http://127.0.0.1:6041/rest/sql
```
Basic cm9vdDp0YW9zZGF0YQ==
```
-相关文档请参考[ TDengine REST API 文档](/reference/rest-api/)。
+相关文档请参考[ TDengine REST API 文档](../../connector/rest-api/)。
在消息体中输入规则引擎替换模板:
diff --git a/docs/zh/20-third-party/10-hive-mq-broker.md b/docs/zh/20-third-party/10-hive-mq-broker.md
index f75ed793d6272ae27f92676e2096ef455f638aa6..a388ff6daff41aa6f74af646f6121a360da56f36 100644
--- a/docs/zh/20-third-party/10-hive-mq-broker.md
+++ b/docs/zh/20-third-party/10-hive-mq-broker.md
@@ -1,6 +1,7 @@
---
sidebar_label: HiveMQ Broker
title: HiveMQ Broker 写入
+description: 使用 HivMQ Broker 写入 TDengine
---
[HiveMQ](https://www.hivemq.com/) 是一个提供免费个人版和企业版的 MQTT 代理,主要用于企业和新兴的机器到机器 M2M 通讯和内部传输,满足可伸缩性、易管理和安全特性。HiveMQ 提供了开源的插件开发包。可以通过 HiveMQ extension - TDengine 保存数据到 TDengine。详细使用方法请参考 [HiveMQ extension - TDengine 说明文档](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README.md)。
diff --git a/docs/zh/20-third-party/11-kafka.md b/docs/zh/20-third-party/11-kafka.md
index 8369806adcfe1b195348e7d60160609cde9150e8..1172f4fbc5bcd9f240bd5e2a47108a8791810e76 100644
--- a/docs/zh/20-third-party/11-kafka.md
+++ b/docs/zh/20-third-party/11-kafka.md
@@ -1,6 +1,7 @@
---
sidebar_label: Kafka
-title: TDengine Kafka Connector 使用教程
+title: TDengine Kafka Connector
+description: 使用 TDengine Kafka Connector 的详细指南
---
TDengine Kafka Connector 包含两个插件: TDengine Source Connector 和 TDengine Sink Connector。用户只需提供简单的配置文件,就可以将 Kafka 中指定 topic 的数据(批量或实时)同步到 TDengine, 或将 TDengine 中指定数据库的数据(批量或实时)同步到 Kafka。
@@ -184,7 +185,7 @@ echo `cat /tmp/confluent.current`/connect/connect.stdout
TDengine Sink Connector 的作用是同步指定 topic 的数据到 TDengine。用户无需提前创建数据库和超级表。可手动指定目标数据库的名字(见配置参数 connection.database), 也可按一定规则生成(见配置参数 connection.database.prefix)。
-TDengine Sink Connector 内部使用 TDengine [无模式写入接口](/reference/connector/cpp#无模式写入-api)写数据到 TDengine,目前支持三种格式的数据:[InfluxDB 行协议格式](/develop/insert-data/influxdb-line)、 [OpenTSDB Telnet 协议格式](/develop/insert-data/opentsdb-telnet) 和 [OpenTSDB JSON 协议格式](/develop/insert-data/opentsdb-json)。
+TDengine Sink Connector 内部使用 TDengine [无模式写入接口](../../connector/cpp#无模式写入-api)写数据到 TDengine,目前支持三种格式的数据:[InfluxDB 行协议格式](/develop/insert-data/influxdb-line)、 [OpenTSDB Telnet 协议格式](/develop/insert-data/opentsdb-telnet) 和 [OpenTSDB JSON 协议格式](/develop/insert-data/opentsdb-json)。
下面的示例将主题 meters 的数据,同步到目标数据库 power。数据格式为 InfluxDB Line 协议格式。
diff --git a/docs/zh/21-tdinternal/01-arch.md b/docs/zh/21-tdinternal/01-arch.md
index a910c584d6ba47844d51e45e5010581075a72fb6..d74366d129d2c8fd69f2e44e1868a382b3b236c0 100644
--- a/docs/zh/21-tdinternal/01-arch.md
+++ b/docs/zh/21-tdinternal/01-arch.md
@@ -1,6 +1,7 @@
---
sidebar_label: 整体架构
title: 整体架构
+description: TDengine 架构设计,包括:集群、存储、缓存与持久化、数据备份、多级存储等
---
## 集群与基本逻辑单元
diff --git a/docs/zh/21-tdinternal/03-high-availability.md b/docs/zh/21-tdinternal/03-high-availability.md
index ba056b6f162df90fcb271fe536a2b24d0745f75a..4cdf04f6d14d73a819f90bc2317a713c90fa9b91 100644
--- a/docs/zh/21-tdinternal/03-high-availability.md
+++ b/docs/zh/21-tdinternal/03-high-availability.md
@@ -1,5 +1,6 @@
---
title: 高可用
+description: TDengine 的高可用设计
---
## Vnode 的高可用性
diff --git a/docs/zh/21-tdinternal/05-load-balance.md b/docs/zh/21-tdinternal/05-load-balance.md
index 2376dd3e612a00006eaf2fc7b1782da3901908bc..07af2328d52573343fb28c045b25785f6822191f 100644
--- a/docs/zh/21-tdinternal/05-load-balance.md
+++ b/docs/zh/21-tdinternal/05-load-balance.md
@@ -1,5 +1,6 @@
---
title: 负载均衡
+description: TDengine 的负载均衡设计
---
TDengine 中的负载均衡主要指对时序数据的处理的负载均衡。TDengine 采用 Hash 一致性算法将一个数据库中的所有表和子表的数据均衡分散在属于该数据库的所有 vgroup 中,每张表或子表只能由一个 vgroup 处理,一个 vgroup 可能负责处理多个表或子表。
@@ -7,7 +8,7 @@ TDengine 中的负载均衡主要指对时序数据的处理的负载均衡。TD
创建数据库时可以指定其中的 vgroup 的数量:
```sql
-create database db0 vgroups 100;
+create database db0 vgroups 20;
```
如何指定合适的 vgroup 的数量,这取决于系统资源。假定系统中只计划建立一个数据库,则 vgroup 数量由集群中所有 dnode 所能使用的资源决定。原则上可用的 CPU 和 Memory 越多,可建立的 vgroup 也越多。但也要考虑到磁盘性能,过多的 vgroup 在磁盘性能达到上限后反而会拖累整个系统的性能。假如系统中会建立多个数据库,则多个数据库的 vgroup 之和取决于系统中可用资源的数量。要综合考虑多个数据库之间表的数量、写入频率、数据量等多个因素在多个数据库之间分配 vgroup。实际中建议首先根据系统资源配置选择一个初始的 vgroup 数量,比如 CPU 总核数的 2 倍,以此为起点通过测试找到最佳的 vgroup 数量配置,此为系统中的 vgroup 总数。如果有多个数据库的话,再根据各个数据库的表数和数据量对 vgroup 进行分配。
diff --git a/docs/zh/21-tdinternal/index.md b/docs/zh/21-tdinternal/index.md
index 63a746623e0dd955f61ba887a76f8ecf7eb16972..21f106edc999972f9e1cc4b04bc8308878cee56a 100644
--- a/docs/zh/21-tdinternal/index.md
+++ b/docs/zh/21-tdinternal/index.md
@@ -1,5 +1,6 @@
---
title: 技术内幕
+description: TDengine 的内部设计
---
```mdx-code-block
diff --git a/docs/zh/25-application/01-telegraf.md b/docs/zh/25-application/01-telegraf.md
index 95df8699ef85b02d6e9dba398c787644fc9089b2..4e9597f96454730ebcdee5adeebf55439923e8e7 100644
--- a/docs/zh/25-application/01-telegraf.md
+++ b/docs/zh/25-application/01-telegraf.md
@@ -1,6 +1,7 @@
---
sidebar_label: TDengine + Telegraf + Grafana
-title: 使用 TDengine + Telegraf + Grafana 快速搭建 IT 运维展示系统
+title: TDengine + Telegraf + Grafana
+description: 使用 TDengine + Telegraf + Grafana 快速搭建 IT 运维展示系统
---
## 背景介绍
@@ -34,7 +35,7 @@ IT 运维监测数据通常都是对时间特性比较敏感的数据,例如
### TDengine
-从涛思数据官网[下载](http://taosdata.com/cn/all-downloads/)页面下载最新 TDengine-server 2.4.0.x 或以上版本安装。
+从涛思数据官网[下载](http://taosdata.com/cn/all-downloads/)页面下载最新 TDengine-server 版本安装。
## 数据链路设置
@@ -79,4 +80,4 @@ sudo systemctl start telegraf
## 总结
-以上演示如何快速搭建一个完整的 IT 运维展示系统。得力于 TDengine 2.4.0.0 版本中新增的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统。TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品落地案例。
+以上演示如何快速搭建一个完整的 IT 运维展示系统。得力于 TDengine 的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统。TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品落地案例。
diff --git a/docs/zh/25-application/02-collectd.md b/docs/zh/25-application/02-collectd.md
index 78c61bb969092d7040ddcb3d02ce7bd29a784858..c6230f48abb545e3064f406d9005a4a3ba8ea5ba 100644
--- a/docs/zh/25-application/02-collectd.md
+++ b/docs/zh/25-application/02-collectd.md
@@ -1,6 +1,7 @@
---
sidebar_label: TDengine + collectd/StatsD + Grafana
-title: 使用 TDengine + collectd/StatsD + Grafana 快速搭建 IT 运维监控系统
+title: TDengine + collectd/StatsD + Grafana
+description: 使用 TDengine + collectd/StatsD + Grafana 快速搭建 IT 运维监控系统
---
## 背景介绍
@@ -36,7 +37,7 @@ IT 运维监测数据通常都是对时间特性比较敏感的数据,例如
### 安装 TDengine
-从涛思数据官网[下载](http://taosdata.com/cn/all-downloads/)页面下载最新 TDengine-server 2.4.0.x 或以上版本安装。
+从涛思数据官网[下载](http://taosdata.com/cn/all-downloads/)页面下载最新 TDengine-server 版本安装。
## 数据链路设置
@@ -90,6 +91,6 @@ repeater 部分添加 { host:'', port:
diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md
new file mode 100644
index 0000000000000000000000000000000000000000..e3e146313115fee12e539a161792234c2df671a5
--- /dev/null
+++ b/docs/zh/28-releases/01-tdengine.md
@@ -0,0 +1,16 @@
+---
+sidebar_label: TDengine 发布历史
+title: TDengine 发布历史
+description: TDengine 发布历史、Release Notes 及下载链接
+---
+
+import Release from "/components/ReleaseV3";
+
+## 3.0.0.1
+
+
+
+
+
diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md
new file mode 100644
index 0000000000000000000000000000000000000000..61129d74e57504286660a178f757cb816b75dbb5
--- /dev/null
+++ b/docs/zh/28-releases/02-tools.md
@@ -0,0 +1,11 @@
+---
+sidebar_label: taosTools 发布历史
+title: taosTools 发布历史
+description: taosTools 的发布历史、Release Notes 和下载链接
+---
+
+import Release from "/components/ReleaseV3";
+
+## 2.1.2
+
+
\ No newline at end of file
diff --git a/docs/zh/28-releases/_category_.yml b/docs/zh/28-releases/_category_.yml
new file mode 100644
index 0000000000000000000000000000000000000000..dcd57247d7629e0bd46a22394c79182fccb22ede
--- /dev/null
+++ b/docs/zh/28-releases/_category_.yml
@@ -0,0 +1 @@
+label: 发布历史
\ No newline at end of file
diff --git a/examples/JDBC/JDBCDemo/README-jdbc-windows.md b/examples/JDBC/JDBCDemo/README-jdbc-windows.md
index 17c5c8df00ab8727d1adfe493d3fbbd32891a676..5a781f40f730218286edb9f6a7f184ee79e7a5fc 100644
--- a/examples/JDBC/JDBCDemo/README-jdbc-windows.md
+++ b/examples/JDBC/JDBCDemo/README-jdbc-windows.md
@@ -129,7 +129,7 @@ https://www.taosdata.com/cn/all-downloads/
192.168.236.136 td01
```
-配置完成后,在命令行内使用taos shell连接server端
+配置完成后,在命令行内使用TDengine CLI连接server端
```shell
C:\TDengine>taos -h td01
diff --git a/examples/c/stream_demo.c b/examples/c/stream_demo.c
index 2fcf4dd62c1e0a2f5aabda4ce5eb9fae6aa72be8..1c9d11b755f77bf259e45d77c6e5983c3747835a 100644
--- a/examples/c/stream_demo.c
+++ b/examples/c/stream_demo.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+// clang-format off
#include
#include
#include
@@ -94,13 +95,8 @@ int32_t create_stream() {
}
taos_free_result(pRes);
- /*const char* sql = "select min(k), max(k), sum(k) from tu1";*/
- /*const char* sql = "select min(k), max(k), sum(k) as sum_of_k from st1";*/
- /*const char* sql = "select sum(k) from tu1 interval(10m)";*/
- /*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/
pRes = taos_query(pConn,
- "create stream stream1 trigger max_delay 10s watermark 10s into outstb as select _wstart start, "
- "count(k) from st1 partition by tbname interval(20s) ");
+ "create stream stream1 trigger at_once watermark 10s into outstb as select _wstart start, avg(k) from st1 partition by tbname interval(10s)");
if (taos_errno(pRes) != 0) {
printf("failed to create stream stream1, reason:%s\n", taos_errstr(pRes));
return -1;
diff --git a/examples/nodejs/README-win.md b/examples/nodejs/README-win.md
index 75fec69413af2bb49498118ec7235c9947e2f89e..e496be2f87e3ff0fcc01359f23888734669b0c22 100644
--- a/examples/nodejs/README-win.md
+++ b/examples/nodejs/README-win.md
@@ -35,7 +35,7 @@ Python 2.7.18
下载地址:https://www.taosdata.com/cn/all-downloads/,选择一个合适的windows-client下载(client应该尽量与server端的版本保持一致)
-使用client的taos shell连接server
+使用client的TDengine CLI连接server
```shell
>taos -h node5
diff --git a/include/common/systable.h b/include/common/systable.h
index ed2e6a46c35006f8f9ffc189a98f3df5e2ac9ade..01c9807627c9e0ead401ffe873a4e7f7f08b8282 100644
--- a/include/common/systable.h
+++ b/include/common/systable.h
@@ -22,27 +22,27 @@ extern "C" {
#ifndef TDENGINE_SYSTABLE_H
#define TDENGINE_SYSTABLE_H
-#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
-#define TSDB_INS_TABLE_DNODES "ins_dnodes"
-#define TSDB_INS_TABLE_MNODES "ins_mnodes"
-#define TSDB_INS_TABLE_MODULES "ins_modules"
-#define TSDB_INS_TABLE_QNODES "ins_qnodes"
-#define TSDB_INS_TABLE_BNODES "ins_bnodes"
-#define TSDB_INS_TABLE_SNODES "ins_snodes"
-#define TSDB_INS_TABLE_CLUSTER "ins_cluster"
-#define TSDB_INS_TABLE_DATABASES "ins_databases"
-#define TSDB_INS_TABLE_FUNCTIONS "ins_functions"
-#define TSDB_INS_TABLE_INDEXES "ins_indexes"
-#define TSDB_INS_TABLE_STABLES "ins_stables"
-#define TSDB_INS_TABLE_TABLES "ins_tables"
-#define TSDB_INS_TABLE_TAGS "ins_tags"
-#define TSDB_INS_TABLE_TABLE_DISTRIBUTED "ins_table_distributed"
-#define TSDB_INS_TABLE_USERS "ins_users"
-#define TSDB_INS_TABLE_LICENCES "ins_grants"
-#define TSDB_INS_TABLE_VGROUPS "ins_vgroups"
-#define TSDB_INS_TABLE_VNODES "ins_vnodes"
-#define TSDB_INS_TABLE_CONFIGS "ins_configs"
-#define TSDB_INS_TABLE_DNODE_VARIABLES "ins_dnode_variables"
+#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
+#define TSDB_INS_TABLE_DNODES "ins_dnodes"
+#define TSDB_INS_TABLE_MNODES "ins_mnodes"
+#define TSDB_INS_TABLE_MODULES "ins_modules"
+#define TSDB_INS_TABLE_QNODES "ins_qnodes"
+#define TSDB_INS_TABLE_BNODES "ins_bnodes"
+#define TSDB_INS_TABLE_SNODES "ins_snodes"
+#define TSDB_INS_TABLE_CLUSTER "ins_cluster"
+#define TSDB_INS_TABLE_DATABASES "ins_databases"
+#define TSDB_INS_TABLE_FUNCTIONS "ins_functions"
+#define TSDB_INS_TABLE_INDEXES "ins_indexes"
+#define TSDB_INS_TABLE_STABLES "ins_stables"
+#define TSDB_INS_TABLE_TABLES "ins_tables"
+#define TSDB_INS_TABLE_TAGS "ins_tags"
+#define TSDB_INS_TABLE_TABLE_DISTRIBUTED "ins_table_distributed"
+#define TSDB_INS_TABLE_USERS "ins_users"
+#define TSDB_INS_TABLE_LICENCES "ins_grants"
+#define TSDB_INS_TABLE_VGROUPS "ins_vgroups"
+#define TSDB_INS_TABLE_VNODES "ins_vnodes"
+#define TSDB_INS_TABLE_CONFIGS "ins_configs"
+#define TSDB_INS_TABLE_DNODE_VARIABLES "ins_dnode_variables"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
@@ -60,16 +60,20 @@ typedef struct SSysDbTableSchema {
const char* name;
const int32_t type;
const int32_t bytes;
+ const bool sysInfo;
} SSysDbTableSchema;
typedef struct SSysTableMeta {
const char* name;
const SSysDbTableSchema* schema;
const int32_t colNum;
+ const bool sysInfo;
} SSysTableMeta;
void getInfosDbMeta(const SSysTableMeta** pInfosTableMeta, size_t* size);
void getPerfDbMeta(const SSysTableMeta** pPerfsTableMeta, size_t* size);
+void getVisibleInfosTablesNum(bool sysInfo, size_t* size);
+bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags);
#ifdef __cplusplus
}
diff --git a/include/common/tcommon.h b/include/common/tcommon.h
index dbe020f7ecaf869f2e3fdb99fb86e33c5f873ecb..a071516fbfc2e647e78ae00c57842ac92253dea6 100644
--- a/include/common/tcommon.h
+++ b/include/common/tcommon.h
@@ -44,6 +44,30 @@ enum {
)
// clang-format on
+typedef struct {
+ TSKEY ts;
+ uint64_t groupId;
+} SWinKey;
+
+static inline int SWinKeyCmpr(const void* pKey1, int kLen1, const void* pKey2, int kLen2) {
+ SWinKey* pWin1 = (SWinKey*)pKey1;
+ SWinKey* pWin2 = (SWinKey*)pKey2;
+
+ if (pWin1->groupId > pWin2->groupId) {
+ return 1;
+ } else if (pWin1->groupId < pWin2->groupId) {
+ return -1;
+ }
+
+ if (pWin1->ts > pWin2->ts) {
+ return 1;
+ } else if (pWin1->ts < pWin2->ts) {
+ return -1;
+ }
+
+ return 0;
+}
+
enum {
TMQ_MSG_TYPE__DUMMY = 0,
TMQ_MSG_TYPE__POLL_RSP,
@@ -181,7 +205,7 @@ typedef struct SColumn {
int16_t slotId;
char name[TSDB_COL_NAME_LEN];
- int8_t flag; // column type: normal column, tag, or user-input column (integer/float/string)
+ int16_t colType; // column type: normal column, tag, or window column
int16_t type;
int32_t bytes;
uint8_t precision;
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index cd74ffd47764fab78f224c2f373e0c93e8117d12..03e15ed8e705c598c444847c94741d0c6b56fdfe 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -66,6 +66,7 @@ extern int32_t tsNumOfVnodeStreamThreads;
extern int32_t tsNumOfVnodeFetchThreads;
extern int32_t tsNumOfVnodeWriteThreads;
extern int32_t tsNumOfVnodeSyncThreads;
+extern int32_t tsNumOfVnodeRsmaThreads;
extern int32_t tsNumOfQnodeQueryThreads;
extern int32_t tsNumOfQnodeFetchThreads;
extern int32_t tsNumOfSnodeSharedThreads;
@@ -130,6 +131,7 @@ extern int32_t tsMqRebalanceInterval;
extern int32_t tsTtlUnit;
extern int32_t tsTtlPushInterval;
extern int32_t tsGrantHBInterval;
+extern int32_t tsUptimeInterval;
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index 8f199c72f7284e5a1a5192fad4f0fdd7a292bab2..c0ea5e79c75fc248ef1a4e1da2819cbf1cf1384d 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -268,6 +268,35 @@ STSRow* tGetSubmitBlkNext(SSubmitBlkIter* pIter);
// for debug
int32_t tPrintFixedSchemaSubmitReq(SSubmitReq* pReq, STSchema* pSchema);
+struct SSchema {
+ int8_t type;
+ int8_t flags;
+ col_id_t colId;
+ int32_t bytes;
+ char name[TSDB_COL_NAME_LEN];
+};
+
+
+typedef struct {
+ char tbName[TSDB_TABLE_NAME_LEN];
+ char stbName[TSDB_TABLE_NAME_LEN];
+ char dbFName[TSDB_DB_FNAME_LEN];
+ int64_t dbId;
+ int32_t numOfTags;
+ int32_t numOfColumns;
+ int8_t precision;
+ int8_t tableType;
+ int32_t sversion;
+ int32_t tversion;
+ uint64_t suid;
+ uint64_t tuid;
+ int32_t vgId;
+ int8_t sysInfo;
+ SSchema* pSchemas;
+} STableMetaRsp;
+
+
+
typedef struct {
int32_t code;
int8_t hashMeta;
@@ -276,6 +305,7 @@ typedef struct {
int32_t numOfRows;
int32_t affectedRows;
int64_t sver;
+ STableMetaRsp* pMeta;
} SSubmitBlkRsp;
typedef struct {
@@ -290,19 +320,14 @@ typedef struct {
int32_t tEncodeSSubmitRsp(SEncoder* pEncoder, const SSubmitRsp* pRsp);
int32_t tDecodeSSubmitRsp(SDecoder* pDecoder, SSubmitRsp* pRsp);
+void tFreeSSubmitBlkRsp(void* param);
void tFreeSSubmitRsp(SSubmitRsp* pRsp);
-#define COL_SMA_ON ((int8_t)0x1)
-#define COL_IDX_ON ((int8_t)0x2)
-#define COL_SET_NULL ((int8_t)0x10)
-#define COL_SET_VAL ((int8_t)0x20)
-struct SSchema {
- int8_t type;
- int8_t flags;
- col_id_t colId;
- int32_t bytes;
- char name[TSDB_COL_NAME_LEN];
-};
+#define COL_SMA_ON ((int8_t)0x1)
+#define COL_IDX_ON ((int8_t)0x2)
+#define COL_SET_NULL ((int8_t)0x10)
+#define COL_SET_VAL ((int8_t)0x20)
+#define COL_IS_SYSINFO ((int8_t)0x40)
#define COL_IS_SET(FLG) (((FLG) & (COL_SET_VAL | COL_SET_NULL)) != 0)
#define COL_CLR_SET(FLG) ((FLG) &= (~(COL_SET_VAL | COL_SET_NULL)))
@@ -472,6 +497,14 @@ int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq
int32_t tDeserializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq);
void tFreeSMCreateStbReq(SMCreateStbReq* pReq);
+typedef struct {
+ STableMetaRsp* pMeta;
+} SMCreateStbRsp;
+
+int32_t tEncodeSMCreateStbRsp(SEncoder* pEncoder, const SMCreateStbRsp* pRsp);
+int32_t tDecodeSMCreateStbRsp(SDecoder* pDecoder, SMCreateStbRsp* pRsp);
+void tFreeSMCreateStbRsp(SMCreateStbRsp* pRsp);
+
typedef struct {
char name[TSDB_TABLE_FNAME_LEN];
int8_t igNotExists;
@@ -530,6 +563,7 @@ typedef struct {
uint32_t connId;
int32_t dnodeNum;
int8_t superUser;
+ int8_t sysInfo;
int8_t connType;
SEpSet epSet;
int32_t svrTimestamp;
@@ -1239,23 +1273,6 @@ typedef struct {
SVgroupInfo vgroups[];
} SVgroupsInfo;
-typedef struct {
- char tbName[TSDB_TABLE_NAME_LEN];
- char stbName[TSDB_TABLE_NAME_LEN];
- char dbFName[TSDB_DB_FNAME_LEN];
- int64_t dbId;
- int32_t numOfTags;
- int32_t numOfColumns;
- int8_t precision;
- int8_t tableType;
- int32_t sversion;
- int32_t tversion;
- uint64_t suid;
- uint64_t tuid;
- int32_t vgId;
- SSchema* pSchemas;
-} STableMetaRsp;
-
typedef struct {
STableMetaRsp* pMeta;
} SMAlterStbRsp;
@@ -1266,7 +1283,7 @@ void tFreeSMAlterStbRsp(SMAlterStbRsp* pRsp);
int32_t tSerializeSTableMetaRsp(void* buf, int32_t bufLen, STableMetaRsp* pRsp);
int32_t tDeserializeSTableMetaRsp(void* buf, int32_t bufLen, STableMetaRsp* pRsp);
-void tFreeSTableMetaRsp(STableMetaRsp* pRsp);
+void tFreeSTableMetaRsp(void* pRsp);
void tFreeSTableIndexRsp(void* info);
typedef struct {
@@ -2028,11 +2045,13 @@ int tEncodeSVCreateTbBatchReq(SEncoder* pCoder, const SVCreateTbBatchReq* pReq);
int tDecodeSVCreateTbBatchReq(SDecoder* pCoder, SVCreateTbBatchReq* pReq);
typedef struct {
- int32_t code;
+ int32_t code;
+ STableMetaRsp* pMeta;
} SVCreateTbRsp, SVUpdateTbRsp;
int tEncodeSVCreateTbRsp(SEncoder* pCoder, const SVCreateTbRsp* pRsp);
int tDecodeSVCreateTbRsp(SDecoder* pCoder, SVCreateTbRsp* pRsp);
+void tFreeSVCreateTbRsp(void* param);
int32_t tSerializeSVCreateTbReq(void** buf, SVCreateTbReq* pReq);
void* tDeserializeSVCreateTbReq(void* buf, SVCreateTbReq* pReq);
@@ -2658,15 +2677,6 @@ typedef struct {
int32_t tSerializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
int32_t tDeserializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
-typedef struct {
- int32_t vgId;
- SEpSet epSet;
-} SVgEpSet;
-
-typedef struct {
- int32_t padding;
-} SRSmaExecMsg;
-
typedef struct {
int8_t version; // for compatibility(default 0)
int8_t intervalUnit; // MACRO: TIME_UNIT_XXX
diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h
index e2bb3e2ae16921b822c275fb1d9be7afcae29685..006ba7f21bf0177c2b0104a51ef7908785cced2d 100644
--- a/include/common/tmsgdef.h
+++ b/include/common/tmsgdef.h
@@ -170,6 +170,7 @@ enum {
TD_DEF_MSG_TYPE(TDMT_MND_SPLIT_VGROUP, "split-vgroup", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_SHOW_VARIABLES, "show-variables", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_SERVER_VERSION, "server-version", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_UPTIME_TIMER, "uptime-timer", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
TD_NEW_MSG_SEG(TDMT_VND_MSG)
diff --git a/include/libs/command/command.h b/include/libs/command/command.h
index 8a4ecad37da3089c32ff0e3fca7473dcc334971c..b3339a417ba463212c3abc163b57519194953c10 100644
--- a/include/libs/command/command.h
+++ b/include/libs/command/command.h
@@ -17,12 +17,12 @@
#define TDENGINE_COMMAND_H
#include "cmdnodes.h"
-#include "tmsg.h"
#include "plannodes.h"
+#include "tmsg.h"
typedef struct SExplainCtx SExplainCtx;
-int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp);
+int32_t qExecCommand(bool sysInfoUser, SNode *pStmt, SRetrieveTableRsp **pRsp);
int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp);
int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs);
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index a64815f14fe0a0dbe5b85ffd0969a68d43f50d8e..1ce88905c23e8e6b9db35694ea0a9aa3197d5ba9 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -29,7 +29,7 @@ typedef void* DataSinkHandle;
struct SRpcMsg;
struct SSubplan;
-typedef struct SReadHandle {
+typedef struct {
void* tqReader;
void* meta;
void* config;
@@ -41,6 +41,7 @@ typedef struct SReadHandle {
bool initTableReader;
bool initTqReader;
int32_t numOfVgroups;
+ void* pStateBackend;
} SReadHandle;
// in queue mode, data streams are seperated by msg
@@ -78,8 +79,8 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO
/**
* @brief Cleanup SSDataBlock for StreamScanInfo
- *
- * @param tinfo
+ *
+ * @param tinfo
*/
void tdCleanupStreamInputDataBlock(qTaskInfo_t tinfo);
@@ -163,7 +164,7 @@ int32_t qGetQualifiedTableIdList(void* pTableList, const char* tagCond, int32_t
void qProcessRspMsg(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
-int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, SArray* pExecInfoList/*,int32_t* resNum, SExplainExecInfo** pRes*/);
+int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, SArray* pExecInfoList /*,int32_t* resNum, SExplainExecInfo** pRes*/);
int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len);
diff --git a/include/libs/function/function.h b/include/libs/function/function.h
index d5da306fd297dd49f4753aa01c6423cb9dd82e9c..c8db01625e4697117d0343c3acddbf9d6daac374 100644
--- a/include/libs/function/function.h
+++ b/include/libs/function/function.h
@@ -139,9 +139,8 @@ typedef struct SqlFunctionCtx {
struct SExprInfo *pExpr;
struct SDiskbasedBuf *pBuf;
struct SSDataBlock *pSrcBlock;
- struct SSDataBlock *pDstBlock; // used by indifinite rows function to set selectivity
+ struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity
int32_t curBufPage;
- bool increase;
bool isStream;
char udfName[TSDB_FUNC_NAME_LEN];
diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h
index 5e84b87a81ec1808dfc368ac285f4dabd2e1d57e..2b2063e3f61e575cd59de099feee3b83ad87ff9c 100644
--- a/include/libs/function/taosudf.h
+++ b/include/libs/function/taosudf.h
@@ -256,8 +256,9 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentR
typedef int32_t (*TUdfScalarProcFunc)(SUdfDataBlock* block, SUdfColumn *resultCol);
typedef int32_t (*TUdfAggStartFunc)(SUdfInterBuf *buf);
-typedef int32_t (*TUdfAggProcessFunc)(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf);
-typedef int32_t (*TUdfAggFinishFunc)(SUdfInterBuf* buf, SUdfInterBuf *resultData);
+typedef int32_t (*TUdfAggProcessFunc)(SUdfDataBlock *block, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf);
+typedef int32_t (*TUdfAggMergeFunc)(SUdfInterBuf *inputBuf1, SUdfInterBuf *inputBuf2, SUdfInterBuf *outputBuf);
+typedef int32_t (*TUdfAggFinishFunc)(SUdfInterBuf *buf, SUdfInterBuf *resultData);
#ifdef __cplusplus
}
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index 8661baceb2dc426e69e459aec33c6c730b419e7e..6fd6a316ebd1bd6b0dcdb9b0b222716cfa33203e 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -317,6 +317,7 @@ typedef struct SSystemTableScanPhysiNode {
SEpSet mgmtEpSet;
bool showRewrite;
int32_t accountId;
+ bool sysInfo;
} SSystemTableScanPhysiNode;
typedef struct STableScanPhysiNode {
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index cec6f1a6919ab66ad3928254d47a0943f60936b5..3a1eaf289e4ba245544b985e893f746845c37c88 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -57,7 +57,9 @@ typedef enum EColumnType {
COLUMN_TYPE_COLUMN = 1,
COLUMN_TYPE_TAG,
COLUMN_TYPE_TBNAME,
- COLUMN_TYPE_WINDOW_PC,
+ COLUMN_TYPE_WINDOW_START,
+ COLUMN_TYPE_WINDOW_END,
+ COLUMN_TYPE_WINDOW_DURATION,
COLUMN_TYPE_GROUP_KEY
} EColumnType;
diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h
index 717278d51d1b252dc3f2bada18a61bbb65739b6e..95bde858640b3d4cd5df616bc1d0a5a65795d8f3 100644
--- a/include/libs/parser/parser.h
+++ b/include/libs/parser/parser.h
@@ -49,6 +49,7 @@ typedef struct SParseContext {
SStmtCallback* pStmtCb;
const char* pUser;
bool isSuperUser;
+ bool enableSysInfo;
bool async;
int8_t schemalessType;
const char* svrVer;
diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h
index d1a5c5db103d940c9e36dd9ad637461b2e3361b5..05caa7a7bb56617ef34c03e3646f85ac98f65a56 100644
--- a/include/libs/planner/planner.h
+++ b/include/libs/planner/planner.h
@@ -38,6 +38,7 @@ typedef struct SPlanContext {
char* pMsg;
int32_t msgLen;
const char* pUser;
+ bool sysInfo;
} SPlanContext;
// Create the physical plan for the query, according to the AST.
diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h
index 34d870397f953e9a85a9a5b44b6a4fc57c0594c9..1fa7dca7dc6ad975e87e18570c8a9a35d990bb7e 100644
--- a/include/libs/qcom/query.h
+++ b/include/libs/qcom/query.h
@@ -215,6 +215,7 @@ void initQueryModuleMsgHandle();
const SSchema* tGetTbnameColumnSchema();
bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags);
+int32_t queryCreateCTableMetaFromMsg(STableMetaRsp *msg, SCTableMeta *pMeta);
int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta);
char* jobTaskStatusStr(int32_t status);
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 384c6a289f304e4c59a097663bb4224e979bd226..2c275090080f73577cd28b3e10b3f1e102b4556e 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -263,6 +263,14 @@ typedef struct {
SArray* checkpointVer;
} SStreamRecoveringState;
+// incremental state storage
+typedef struct {
+ SStreamTask* pOwner;
+ TDB* db;
+ TTB* pStateDb;
+ TXN txn;
+} SStreamState;
+
typedef struct SStreamTask {
int64_t streamId;
int32_t taskId;
@@ -312,6 +320,10 @@ typedef struct SStreamTask {
// msg handle
SMsgCb* pMsgCb;
+
+ // state backend
+ SStreamState* pState;
+
} SStreamTask;
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo);
@@ -507,7 +519,7 @@ typedef struct SStreamMeta {
char* path;
TDB* db;
TTB* pTaskDb;
- TTB* pStateDb;
+ TTB* pCheckpointDb;
SHashObj* pTasks;
SHashObj* pRecoverStatus;
void* ahandle;
@@ -528,6 +540,37 @@ int32_t streamMetaCommit(SStreamMeta* pMeta);
int32_t streamMetaRollBack(SStreamMeta* pMeta);
int32_t streamLoadTasks(SStreamMeta* pMeta);
+SStreamState* streamStateOpen(char* path, SStreamTask* pTask);
+void streamStateClose(SStreamState* pState);
+int32_t streamStateBegin(SStreamState* pState);
+int32_t streamStateCommit(SStreamState* pState);
+int32_t streamStateAbort(SStreamState* pState);
+
+typedef struct {
+ TBC* pCur;
+} SStreamStateCur;
+
+#if 1
+int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen);
+int32_t streamStateGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
+int32_t streamStateDel(SStreamState* pState, const SWinKey* key);
+void streamFreeVal(void* val);
+
+SStreamStateCur* streamStateGetCur(SStreamState* pState, const SWinKey* key);
+SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key);
+SStreamStateCur* streamStateSeekKeyPrev(SStreamState* pState, const SWinKey* key);
+void streamStateFreeCur(SStreamStateCur* pCur);
+
+int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen);
+
+int32_t streamStateSeekFirst(SStreamState* pState, SStreamStateCur* pCur);
+int32_t streamStateSeekLast(SStreamState* pState, SStreamStateCur* pCur);
+
+int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur);
+int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
+
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index 12d6127165008e8b9e3b554ca8d1944dcef94e4e..e39172d74e52e852f0fa1812634e494d61ac6213 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -49,7 +49,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019)
//common & util
-#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0013)
+#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0013)
#define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0014)
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
@@ -222,7 +222,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0382)
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0383)
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0385)
-#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
+#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389)
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A)
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B)
@@ -433,7 +433,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TQ_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0A03)
#define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
#define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
-#define TSDB_CODE_TQ_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0A06)
+#define TSDB_CODE_TQ_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0A06)
#define TSDB_CODE_TQ_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0A07)
#define TSDB_CODE_TQ_META_NO_SUCH_KEY TAOS_DEF_ERROR_CODE(0, 0x0A08)
#define TSDB_CODE_TQ_META_KEY_NOT_IN_TXN TAOS_DEF_ERROR_CODE(0, 0x0A09)
@@ -490,7 +490,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT TAOS_DEF_ERROR_CODE(0, 0x2609)
#define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A)
#define TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260B)
-#define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C)
+#define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C)
#define TSDB_CODE_PAR_TAGS_NOT_MATCHED TAOS_DEF_ERROR_CODE(0, 0x260D)
#define TSDB_CODE_PAR_INVALID_TAG_NAME TAOS_DEF_ERROR_CODE(0, 0x260E)
#define TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2610)
diff --git a/include/util/thash.h b/include/util/thash.h
index 781c22a56aaba0d449d1f711b32fe4bd75a39003..f4d09eb0906b04bfd40d97c39ec66feb3b1967a1 100644
--- a/include/util/thash.h
+++ b/include/util/thash.h
@@ -210,6 +210,8 @@ void taosHashSetEqualFp(SHashObj *pHashObj, _equal_fn_t fp);
*/
void taosHashSetFreeFp(SHashObj *pHashObj, _hash_free_fn_t fp);
+int64_t taosHashGetCompTimes(SHashObj *pHashObj);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/util/tpagedbuf.h b/include/util/tpagedbuf.h
index ef266068cbaff046ec6ebcf0bf02d0b44ee9d3a2..57a489c0dd269e065005fd359cde32b979913b75 100644
--- a/include/util/tpagedbuf.h
+++ b/include/util/tpagedbuf.h
@@ -67,10 +67,9 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t groupId, int32_t* pageId);
/**
*
* @param pBuf
- * @param groupId
* @return
*/
-SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf, int32_t groupId);
+SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf);
/**
* get the specified buffer page by id
@@ -101,13 +100,6 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, struct SPageInfo* pi);
*/
size_t getTotalBufSize(const SDiskbasedBuf* pBuf);
-/**
- * get the number of groups in the result buffer
- * @param pBuf
- * @return
- */
-size_t getNumOfBufGroupId(const SDiskbasedBuf* pBuf);
-
/**
* destroy result buffer
* @param pBuf
diff --git a/packaging/MPtestJenkinsfile b/packaging/MPtestJenkinsfile
new file mode 100644
index 0000000000000000000000000000000000000000..1e2e69a977c0daa229c0b2d6a5681cf94e60c022
--- /dev/null
+++ b/packaging/MPtestJenkinsfile
@@ -0,0 +1,200 @@
+def sync_source(branch_name) {
+ sh '''
+ hostname
+ env
+ echo ''' + branch_name + '''
+ '''
+ sh '''
+ cd ${TDINTERNAL_ROOT_DIR}
+ git reset --hard
+ git fetch || git fetch
+ git checkout ''' + branch_name + ''' -f
+ git branch
+ git pull || git pull
+ git log | head -n 20
+ cd ${TDENGINE_ROOT_DIR}
+ git reset --hard
+ git fetch || git fetch
+ git checkout ''' + branch_name + ''' -f
+ git branch
+ git pull || git pull
+ git log | head -n 20
+ git submodule update --init --recursive
+ '''
+ return 1
+}
+def run_test() {
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+
+ '''
+ sh '''
+ export LD_LIBRARY_PATH=${TDINTERNAL_ROOT_DIR}/debug/build/lib
+ ./fulltest.sh
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/tests
+ ./test-all.sh b1fq
+ '''
+}
+def build_run() {
+ sync_source("${BRANCH_NAME}")
+}
+pipeline {
+ agent none
+ parameters {
+ string (
+ name:'version',
+ defaultValue:'3.0.0.1',
+ description: 'release version number,eg: 3.0.0.1 or 3.0.0.'
+ )
+ string (
+ name:'baseVersion',
+ defaultValue:'3.0.0.1',
+ description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1'
+ )
+ }
+ environment{
+ WORK_DIR = '/var/lib/jenkins/workspace'
+ TDINTERNAL_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal'
+ TDENGINE_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal/community'
+ BRANCH_NAME = '3.0'
+
+ TD_SERVER_TAR = "TDengine-server-${version}-Linux-x64.tar.gz"
+ BASE_TD_SERVER_TAR = "TDengine-server-${baseVersion}-arm64-x64.tar.gz"
+
+ TD_SERVER_ARM_TAR = "TDengine-server-${version}-Linux-arm64.tar.gz"
+ BASE_TD_SERVER_ARM_TAR = "TDengine-server-${baseVersion}-Linux-arm64.tar.gz"
+
+ TD_SERVER_LITE_TAR = "TDengine-server-${version}-Linux-x64-Lite.tar.gz"
+ BASE_TD_SERVER_LITE_TAR = "TDengine-server-${baseVersion}-Linux-x64-Lite.tar.gz"
+
+ TD_CLIENT_TAR = "TDengine-client-${version}-Linux-x64.tar.gz"
+ BASE_TD_CLIENT_TAR = "TDengine-client-${baseVersion}-arm64-x64.tar.gz"
+
+ TD_CLIENT_ARM_TAR = "TDengine-client-${version}-Linux-arm64.tar.gz"
+ BASE_TD_CLIENT_ARM_TAR = "TDengine-client-${baseVersion}-Linux-arm64.tar.gz"
+
+ TD_CLIENT_LITE_TAR = "TDengine-client-${version}-Linux-x64-Lite.tar.gz"
+ BASE_TD_CLIENT_LITE_TAR = "TDengine-client-${baseVersion}-Linux-x64-Lite.tar.gz"
+
+ TD_SERVER_RPM = "TDengine-server-${version}-Linux-x64.rpm"
+
+ TD_SERVER_DEB = "TDengine-server-${version}-Linux-x64.deb"
+
+ TD_SERVER_EXE = "TDengine-server-${version}-Windows-x64.exe"
+
+ TD_CLIENT_EXE = "TDengine-client-${version}-Windows-x64.exe"
+
+
+ }
+ stages {
+ stage ('RUN') {
+ stage('get check package scritps'){
+ agent{label 'ubuntu18'}
+ steps {
+ catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
+ script{
+ sync_source("${BRANCH_NAME}")
+ }
+
+ }
+ }
+ }
+ parallel {
+ stage('ubuntu16') {
+ agent{label " ubuntu16 "}
+ steps {
+ timeout(time: 3, unit: 'MINUTES'){
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ rmtaos
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ }
+ }
+ }
+ stage('ubuntu18') {
+ agent{label " ubuntu18 "}
+ steps {
+ timeout(time: 3, unit: 'MINUTES'){
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ rmtaos
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_DEB} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ }
+ }
+ }
+ stage('centos7') {
+ agent{label " centos7_9 "}
+ steps {
+ timeout(time: 240, unit: 'MINUTES'){
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ rmtaos
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ }
+ }
+ }
+ stage('centos8') {
+ agent{label " centos8_3 "}
+ steps {
+ timeout(time: 240, unit: 'MINUTES'){
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ rmtaos
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging
+ bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server
+ python3 checkPackageRuning.py
+ '''
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg
index aae2e7c856ac7ce4747d798acf5852d6cdf21535..87f465fdb93ddbff8973430b11ecadc13878069d 100644
--- a/packaging/cfg/taos.cfg
+++ b/packaging/cfg/taos.cfg
@@ -38,7 +38,7 @@
# The interval of dnode reporting status to mnode
# statusInterval 1
-# The interval for taos shell to send heartbeat to mnode
+# The interval for TDengine CLI to send heartbeat to mnode
# shellActivityTimer 3
# The minimum sliding window time, milli-second
diff --git a/packaging/checkPackageRuning.py b/packaging/checkPackageRuning.py
new file mode 100755
index 0000000000000000000000000000000000000000..e53cc3bdbcc1aa0993f43ac6cdf3de53e0a4af29
--- /dev/null
+++ b/packaging/checkPackageRuning.py
@@ -0,0 +1,101 @@
+#!/usr/bin/python
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+# install pip
+# pip install src/connector/python/
+
+# -*- coding: utf-8 -*-
+import sys , os
+import getopt
+import subprocess
+# from this import d
+import time
+
+# install taospy
+
+out = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
+print(out)
+if (out == "" ):
+ os.system("pip install git+https://github.com/taosdata/taos-connector-python.git")
+ print("install taos python connector")
+
+
+
+# start taosd prepare
+os.system("rm -rf /var/lib/taos/*")
+os.system("systemctl restart taosd ")
+
+# wait a moment ,at least 5 seconds
+time.sleep(5)
+
+# prepare data by taosBenchmark
+
+os.system("taosBenchmark -y -n 100 -t 100")
+
+import taos
+
+conn = taos.connect(host="localhost",
+ user="root",
+ password="taosdata",
+ database="test",
+ port=6030,
+ config="/etc/taos", # for windows the default value is C:\TDengine\cfg
+ timezone="Asia/Shanghai") # default your host's timezone
+
+server_version = conn.server_info
+print("server_version", server_version)
+client_version = conn.client_info
+print("client_version", client_version) # 3.0.0.0
+
+# Execute a sql and get its result set. It's useful for SELECT statement
+result: taos.TaosResult = conn.query("SELECT count(*) from test.meters")
+
+data = result.fetch_all()
+
+if data[0][0] !=10000:
+ print(" taosBenchmark work not as expected ")
+ sys.exit(1)
+else:
+ print(" taosBenchmark work as expected ")
+
+# test taosdump dump out data and dump in data
+
+# dump out datas
+os.system("taosdump --version")
+os.system("mkdir -p /tmp/dumpdata")
+os.system("rm -rf /tmp/dumpdata/*")
+
+
+
+# dump data out
+print("taosdump dump out data")
+
+os.system("taosdump -o /tmp/dumpdata -D test -y ")
+
+# drop database of test
+print("drop database test")
+os.system(" taos -s ' drop database test ;' ")
+
+# dump data in
+print("taosdump dump data in")
+os.system("taosdump -i /tmp/dumpdata -y ")
+
+result = conn.query("SELECT count(*) from test.meters")
+
+data = result.fetch_all()
+
+if data[0][0] !=10000:
+ print(" taosdump work not as expected ")
+ sys.exit(1)
+else:
+ print(" taosdump work as expected ")
+
+conn.close()
\ No newline at end of file
diff --git a/packaging/docker/README.md b/packaging/docker/README.md
index e41182f471050af6b4d47b696eb237e319b2dd80..cb27d3bca69ff3b9f6919cb7a47ac076008b29c1 100644
--- a/packaging/docker/README.md
+++ b/packaging/docker/README.md
@@ -47,7 +47,7 @@ taos> show databases;
Query OK, 1 row(s) in set (0.002843s)
```
-Since TDengine use container hostname to establish connections, it's a bit more complex to use taos shell and native connectors(such as JDBC-JNI) with TDengine container instance. This is the recommended way to expose ports and use TDengine with docker in simple cases. If you want to use taos shell or taosc/connectors smoothly outside the `tdengine` container, see next use cases that match you need.
+Since TDengine use container hostname to establish connections, it's a bit more complex to use TDengine CLI and native connectors(such as JDBC-JNI) with TDengine container instance. This is the recommended way to expose ports and use TDengine with docker in simple cases. If you want to use TDengine CLI or taosc/connectors smoothly outside the `tdengine` container, see next use cases that match you need.
### Start with host network
@@ -87,7 +87,7 @@ docker run -d \
This command starts a docker container with TDengine server running and maps the container's TCP ports from 6030 to 6049 to the host's ports from 6030 to 6049 with TCP protocol and UDP ports range 6030-6039 to the host's UDP ports 6030-6039. If the host is already running TDengine server and occupying the same port(s), you need to map the container's port to a different unused port segment. (Please see TDengine 2.0 Port Description for details). In order to support TDengine clients accessing TDengine server services, both TCP and UDP ports need to be exposed by default(unless `rpcForceTcp` is set to `1`).
-If you want to use taos shell or native connectors([JDBC-JNI](https://www.taosdata.com/cn/documentation/connector/java), or [driver-go](https://github.com/taosdata/driver-go)), you need to make sure the `TAOS_FQDN` is resolvable at `/etc/hosts` or with custom DNS service.
+If you want to use TDengine CLI or native connectors([JDBC-JNI](https://www.taosdata.com/cn/documentation/connector/java), or [driver-go](https://github.com/taosdata/driver-go)), you need to make sure the `TAOS_FQDN` is resolvable at `/etc/hosts` or with custom DNS service.
If you set the `TAOS_FQDN` to host's hostname, it will works as using `hosts` network like previous use case. Otherwise, like in `-e TAOS_FQDN=tdengine`, you can add the hostname record `tdengine` into `/etc/hosts` (use `127.0.0.1` here in host path, if use TDengine client/application in other hosts, you should set the right ip to the host eg. `192.168.10.1`(check the real ip in host with `hostname -i` or `ip route list default`) to make the TDengine endpoint resolvable):
@@ -391,7 +391,7 @@ test_td-1_1 /usr/bin/entrypoint.sh taosd Up 6030/tcp, 6031/tcp,
test_td-2_1 /usr/bin/entrypoint.sh taosd Up 6030/tcp, 6031/tcp, 6032/tcp, 6033/tcp, 6034/tcp, 6035/tcp, 6036/tcp, 6037/tcp, 6038/tcp, 6039/tcp, 6040/tcp, 6041/tcp, 6042/tcp
```
-Check dnodes with taos shell:
+Check dnodes with TDengine CLI:
```bash
$ docker-compose exec td-1 taos -s "show dnodes"
diff --git a/packaging/release.bat b/packaging/release.bat
index 14534c8d7efd8cc923e3978d2b087847fc70dedf..591227382f9cec4a2fa1308a9b827994430f7236 100644
--- a/packaging/release.bat
+++ b/packaging/release.bat
@@ -40,7 +40,7 @@ if not exist %work_dir%\debug\ver-%2-x86 (
)
cd %work_dir%\debug\ver-%2-x64
call vcvarsall.bat x64
-cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DBUILD_HTTP=false -BUILD_TEST=false -DVERNUMBER=%2 -DCPUTYPE=x64
+cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DBUILD_HTTP=false -DBUILD_TEST=false -DVERNUMBER=%2 -DCPUTYPE=x64
cmake --build .
rd /s /Q C:\TDengine
cmake --install .
diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh
new file mode 100755
index 0000000000000000000000000000000000000000..173fa3a3c3a310359fafcf54806228823b9cabc6
--- /dev/null
+++ b/packaging/testpackage.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+# function installPkgAndCheckFile{
+
+echo "Download package"
+
+packgeName=$1
+version=$2
+originPackageName=$3
+originversion=$4
+testFile=$5
+subFile="taos.tar.gz"
+
+if [ ${testFile} = "server" ];then
+ tdPath="TDengine-server-${version}"
+ originTdpPath="TDengine-server-${originversion}"
+ installCmd="install.sh"
+elif [ ${testFile} = "client" ];then
+ tdPath="TDengine-client-${version}"
+ originTdpPath="TDengine-client-${originversion}"
+ installCmd="install_client.sh"
+elif [ ${testFile} = "tools" ];then
+ tdPath="taosTools-${version}"
+ originTdpPath="taosTools-${originversion}"
+ installCmd="install-taostools.sh"
+fi
+
+echo "Uninstall all components of TDeingne"
+
+if command -v rmtaos ;then
+ echo "uninstall all components of TDeingne:rmtaos"
+ echo " "
+else
+ echo "os doesn't include TDengine "
+fi
+
+if command -v rmtaostools ;then
+ echo "uninstall all components of TDeingne:rmtaostools"
+ echo " "
+else
+ echo "os doesn't include rmtaostools "
+fi
+
+echo "new workroom path"
+installPath="/usr/local/src/packageTest"
+oriInstallPath="/usr/local/src/packageTest/3.1"
+
+if [ ! -d ${installPath} ] ;then
+ mkdir -p ${installPath}
+else
+ echo "${installPath} already exists"
+fi
+
+
+if [ ! -d ${oriInstallPath} ] ;then
+ mkdir -p ${oriInstallPath}
+else
+ echo "${oriInstallPath} already exists"
+fi
+
+echo "decompress installPackage"
+
+cd ${installPath}
+wget https://www.taosdata.com/assets-download/3.0/${packgeName}
+cd ${oriInstallPath}
+wget https://www.taosdata.com/assets-download/3.0/${originPackageName}
+
+
+if [[ ${packgeName} =~ "deb" ]];then
+ echo "dpkg ${packgeName}" && dpkg -i ${packgeName}
+elif [[ ${packgeName} =~ "rpm" ]];then
+ echo "rpm ${packgeName}" && rpm -ivh ${packgeName}
+elif [[ ${packgeName} =~ "tar" ]];then
+ echo "tar ${packgeName}" && tar -xvf ${packgeName}
+ cd ${oriInstallPath}
+ echo "tar -xvf ${originPackageName}" && tar -xvf ${originPackageName}
+ cd ${installPath}
+ echo "tar -xvf ${packgeName}" && tar -xvf ${packgeName}
+
+
+ if [ ${testFile} != "tools" ] ;then
+ cd ${installPath}/${tdPath} && tar vxf ${subFile}
+ cd ${oriInstallPath}/${originTdpPath} && tar vxf ${subFile}
+ fi
+
+ echo "check installPackage File"
+
+ cd ${installPath}
+
+ tree ${oriInstallPath}/${originTdpPath} > ${originPackageName}_checkfile
+ tree ${installPath}/${tdPath} > ${packgeName}_checkfile
+
+ diff ${packgeName}_checkfile ${originPackageName}_checkfile > ${installPath}/diffFile.log
+ diffNumbers=`cat ${installPath}/diffFile.log |wc -l `
+ if [ ${diffNumbers} != 0 ];then
+ echo "The number and names of files have changed from the previous installation package"
+ echo `cat ${installPath}/diffFile.log`
+ exit -1
+ fi
+
+ cd ${installPath}/${tdPath}
+ if [ ${testFile} = "server" ];then
+ bash ${installCmd} -e no
+ else
+ bash ${installCmd}
+ fi
+
+fi
+# }
+
+# installPkgAndCheckFile
+
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index f275ae0885f10663b3c0ae853ecf1298fac25777..07e5f75e87904e8b7998717224214d2f15dccce0 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -95,10 +95,15 @@ typedef struct {
} SClientHbMgr;
typedef struct SQueryExecMetric {
- int64_t start; // start timestamp, us
- int64_t parsed; // start to parse, us
- int64_t send; // start to send to server, us
- int64_t rsp; // receive response from server, us
+ int64_t start; // start timestamp, us
+ int64_t syntaxStart; // start to parse, us
+ int64_t syntaxEnd; // end to parse, us
+ int64_t ctgStart; // start to parse, us
+ int64_t ctgEnd; // end to parse, us
+ int64_t semanticEnd;
+ int64_t execEnd;
+ int64_t send; // start to send to server, us
+ int64_t rsp; // receive response from server, us
} SQueryExecMetric;
struct SAppInstInfo {
@@ -132,6 +137,7 @@ typedef struct STscObj {
char db[TSDB_DB_FNAME_LEN];
char sVer[TSDB_VERSION_LEN];
char sDetailVer[128];
+ int8_t sysInfo;
int8_t connType;
int32_t acctId;
uint32_t connId;
@@ -252,7 +258,7 @@ SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool valida
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly);
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
-int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
+int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
static FORCE_INLINE SReqResultInfo* tmqGetCurResInfo(TAOS_RES* res) {
SMqRspObj* msg = (SMqRspObj*)res;
@@ -363,8 +369,9 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData*
int32_t refreshMeta(STscObj* pTscObj, SRequestObj* pRequest);
int32_t updateQnodeList(SAppInstInfo* pInfo, SArray* pNodeList);
void doAsyncQuery(SRequestObj* pRequest, bool forceUpdateMeta);
-int32_t removeMeta(STscObj* pTscObj, SArray* tbList); // todo move to clientImpl.c and become a static function
-int32_t handleAlterTbExecRes(void* res, struct SCatalog* pCatalog); // todo move to xxx
+int32_t removeMeta(STscObj* pTscObj, SArray* tbList);
+int32_t handleAlterTbExecRes(void* res, struct SCatalog* pCatalog);
+int32_t handleCreateTbExecRes(void* res, SCatalog* pCatalog);
bool qnodeRequired(SRequestObj* pRequest);
#ifdef __cplusplus
diff --git a/source/client/inc/clientLog.h b/source/client/inc/clientLog.h
index d47edcd79535a3c8fc5d94aabd3bd8b08d0448f7..ec0a41a68f9515bc7ea2c54e96b0235c0a9683eb 100644
--- a/source/client/inc/clientLog.h
+++ b/source/client/inc/clientLog.h
@@ -29,6 +29,7 @@ extern "C" {
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0)
#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
+#define tscPerf(...) do { taosPrintLog("TSC ", 0, cDebugFlag, __VA_ARGS__); } while(0)
#ifdef __cplusplus
}
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 99ecab9642b6fd164572957c50f409172c5dc654..1342e89b523ac0a2ae2fc1eca7584aff2a340f1d 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -69,14 +69,25 @@ static void deregisterRequest(SRequestObj *pRequest) {
int32_t currentInst = atomic_sub_fetch_64((int64_t *)&pActivity->currentRequests, 1);
int32_t num = atomic_sub_fetch_32(&pTscObj->numOfReqs, 1);
- int64_t duration = taosGetTimestampUs() - pRequest->metric.start;
+ int64_t nowUs = taosGetTimestampUs();
+ int64_t duration = nowUs - pRequest->metric.start;
tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ", reqId:0x%" PRIx64 " elapsed:%" PRIu64
" ms, current:%d, app current:%d",
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000, num, currentInst);
if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) {
+ tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64 "us, exec:%" PRId64 "us",
+ duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
+ pRequest->metric.ctgEnd - pRequest->metric.ctgStart,
+ pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
+ pRequest->metric.execEnd - pRequest->metric.semanticEnd);
atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
} else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
+ tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64 "us, exec:%" PRId64 "us",
+ duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
+ pRequest->metric.ctgEnd - pRequest->metric.ctgStart,
+ pRequest->metric.semanticEnd - pRequest->metric.ctgEnd,
+ pRequest->metric.execEnd - pRequest->metric.semanticEnd);
atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
}
@@ -330,7 +341,6 @@ void doDestroyRequest(void *p) {
schedulerFreeJob(&pRequest->body.queryJob, 0);
taosMemoryFreeClear(pRequest->msgBuf);
- taosMemoryFreeClear(pRequest->sqlstr);
taosMemoryFreeClear(pRequest->pDb);
doFreeReqResultInfo(&pRequest->body.resInfo);
@@ -349,6 +359,7 @@ void doDestroyRequest(void *p) {
taosMemoryFree(pRequest->body.param);
}
+ taosMemoryFreeClear(pRequest->sqlstr);
taosMemoryFree(pRequest);
tscTrace("end to destroy request %" PRIx64 " p:%p", reqId, pRequest);
}
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index 5f0af55d13c3e3c79f796f5f34f31dff121f1281..2baca1288fe086388cc3e5a424ab289586a864f5 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -215,6 +215,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
.pUser = pTscObj->user,
.schemalessType = pTscObj->schemalessType,
.isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)),
+ .enableSysInfo = pTscObj->sysInfo,
.svrVer = pTscObj->sVer,
.nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes)};
@@ -246,7 +247,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
SRetrieveTableRsp* pRsp = NULL;
- int32_t code = qExecCommand(pQuery->pRoot, &pRsp);
+ int32_t code = qExecCommand(pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp);
if (TSDB_CODE_SUCCESS == code && NULL != pRsp) {
code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true);
}
@@ -284,7 +285,7 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
return;
}
- int32_t code = qExecCommand(pQuery->pRoot, &pRsp);
+ int32_t code = qExecCommand(pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp);
if (TSDB_CODE_SUCCESS == code && NULL != pRsp) {
code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true);
}
@@ -419,7 +420,8 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra
.showRewrite = pQuery->showRewrite,
.pMsg = pRequest->msgBuf,
.msgLen = ERROR_MSG_BUF_DEFAULT_SIZE,
- .pUser = pRequest->pTscObj->user};
+ .pUser = pRequest->pTscObj->user,
+ .sysInfo = pRequest->pTscObj->sysInfo};
return qCreateQueryPlan(&cxt, pPlan, pNodeList);
}
@@ -721,6 +723,12 @@ int32_t handleSubmitExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog
for (int32_t i = 0; i < pRsp->nBlocks; ++i) {
SSubmitBlkRsp* blk = pRsp->pBlocks + i;
+ if (blk->pMeta) {
+ handleCreateTbExecRes(blk->pMeta, pCatalog);
+ tFreeSTableMetaRsp(blk->pMeta);
+ taosMemoryFreeClear(blk->pMeta);
+ }
+
if (NULL == blk->tblFName || 0 == blk->tblFName[0]) {
continue;
}
@@ -780,6 +788,10 @@ int32_t handleAlterTbExecRes(void* res, SCatalog* pCatalog) {
return catalogUpdateTableMeta(pCatalog, (STableMetaRsp*)res);
}
+int32_t handleCreateTbExecRes(void* res, SCatalog* pCatalog) {
+ return catalogUpdateTableMeta(pCatalog, (STableMetaRsp*)res);
+}
+
int32_t handleQueryExecRsp(SRequestObj* pRequest) {
if (NULL == pRequest->body.resInfo.execRes.res) {
return TSDB_CODE_SUCCESS;
@@ -802,6 +814,19 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
code = handleAlterTbExecRes(pRes->res, pCatalog);
break;
}
+ case TDMT_VND_CREATE_TABLE: {
+ SArray* pList = (SArray*)pRes->res;
+ int32_t num = taosArrayGetSize(pList);
+ for (int32_t i = 0; i < num; ++i) {
+ void* res = taosArrayGetP(pList, i);
+ code = handleCreateTbExecRes(res, pCatalog);
+ }
+ break;
+ }
+ case TDMT_MND_CREATE_STB: {
+ code = handleCreateTbExecRes(pRes->res, pCatalog);
+ break;
+ }
case TDMT_VND_SUBMIT: {
atomic_add_fetch_64((int64_t*)&pAppInfo->summary.insertBytes, pRes->numOfBytes);
@@ -842,6 +867,8 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
}
schedulerFreeJob(&pRequest->body.queryJob, 0);
+
+ pRequest->metric.execEnd = taosGetTimestampUs();
}
taosMemoryFree(pResult);
@@ -859,17 +886,13 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
return;
}
- if (code == TSDB_CODE_SUCCESS) {
- code = handleQueryExecRsp(pRequest);
- ASSERT(pRequest->code == TSDB_CODE_SUCCESS);
- pRequest->code = code;
- }
-
tscDebug("schedulerExecCb request type %s", TMSG_INFO(pRequest->type));
- if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) {
+ if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) {
removeMeta(pTscObj, pRequest->targetTableList);
}
+ handleQueryExecRsp(pRequest);
+
// return to client
pRequest->body.queryFp(pRequest->body.param, pRequest, code);
}
@@ -930,6 +953,10 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue
qDestroyQuery(pQuery);
}
+ if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type) && NULL == pRequest->body.resInfo.execRes.res) {
+ removeMeta(pRequest->pTscObj, pRequest->targetTableList);
+ }
+
handleQueryExecRsp(pRequest);
if (NULL != pRequest && TSDB_CODE_SUCCESS != code) {
@@ -990,7 +1017,8 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
.showRewrite = pQuery->showRewrite,
.pMsg = pRequest->msgBuf,
.msgLen = ERROR_MSG_BUF_DEFAULT_SIZE,
- .pUser = pRequest->pTscObj->user};
+ .pUser = pRequest->pTscObj->user,
+ .sysInfo = pRequest->pTscObj->sysInfo};
SAppInstInfo* pAppInfo = getAppInfo(pRequest);
SQueryPlan* pDag = NULL;
@@ -1127,10 +1155,6 @@ SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool valida
inRetry = true;
} while (retryNum++ < REQUEST_TOTAL_EXEC_TIMES);
- if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) {
- removeMeta(pRequest->pTscObj, pRequest->targetTableList);
- }
-
return pRequest;
}
@@ -1575,10 +1599,11 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
}
int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols) {
- int32_t cols = *(int32_t*) (p + sizeof(int32_t) * 3);
+ int32_t cols = *(int32_t*)(p + sizeof(int32_t) * 3);
ASSERT(numOfCols == cols);
- return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t)*3 + sizeof(uint64_t) + numOfCols * (sizeof(int8_t) + sizeof(int32_t));
+ return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) * 3 + sizeof(uint64_t) +
+ numOfCols * (sizeof(int8_t) + sizeof(int32_t));
}
static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, int32_t numOfRows) {
@@ -1950,7 +1975,7 @@ _OVER:
int32_t appendTbToReq(SHashObj* pHash, int32_t pos1, int32_t len1, int32_t pos2, int32_t len2, const char* str,
int32_t acctId, char* db) {
- SName name;
+ SName name = {0};
if (len1 <= 0) {
return -1;
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index f449641f1008e79a58e02786a855711dbaeb6b9c..9ceb6e068375a67cb1230200e28aad6a74395661 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -685,6 +685,8 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
SQuery *pQuery = pWrapper->pQuery;
SRequestObj *pRequest = pWrapper->pRequest;
+ pRequest->metric.ctgEnd = taosGetTimestampUs();
+
if (code == TSDB_CODE_SUCCESS) {
code = qAnalyseSqlSemantic(pWrapper->pCtx, &pWrapper->catalogReq, pResultMeta, pQuery);
pRequest->stableQuery = pQuery->stableQuery;
@@ -693,6 +695,8 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
}
}
+ pRequest->metric.semanticEnd = taosGetTimestampUs();
+
if (code == TSDB_CODE_SUCCESS) {
if (pQuery->haveResultSet) {
setResSchemaInfo(&pRequest->body.resInfo, pQuery->pResSchema, pQuery->numOfResCols);
@@ -755,6 +759,7 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
.pUser = pTscObj->user,
.schemalessType = pTscObj->schemalessType,
.isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)),
+ .enableSysInfo = pTscObj->sysInfo,
.async = true,
.svrVer = pTscObj->sVer,
.nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes)};
@@ -784,12 +789,16 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
SQuery *pQuery = NULL;
+ pRequest->metric.syntaxStart = taosGetTimestampUs();
+
SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)};
code = qParseSqlSyntax(pCxt, &pQuery, &catalogReq);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
+ pRequest->metric.syntaxEnd = taosGetTimestampUs();
+
if (!updateMetaForce) {
STscObj *pTscObj = pRequest->pTscObj;
SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
@@ -816,6 +825,8 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
.requestObjRefId = pCxt->requestRid,
.mgmtEps = pCxt->mgmtEpSet};
+ pRequest->metric.ctgStart = taosGetTimestampUs();
+
code = catalogAsyncGetAllMeta(pCxt->pCatalog, &conn, &catalogReq, retrieveMetaCallback, pWrapper,
&pRequest->body.queryJob);
pCxt = NULL;
diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c
index 0c4cf23c4e1708f4479a1b744dea37752513670d..a7a16d484ca10a8baa65419105f42e46dc3814f3 100644
--- a/source/client/src/clientMsgHandler.c
+++ b/source/client/src/clientMsgHandler.c
@@ -96,6 +96,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
connectRsp.epSet.eps[i].fqdn, connectRsp.epSet.eps[i].port, pTscObj->id);
}
+ pTscObj->sysInfo = connectRsp.sysInfo;
pTscObj->connId = connectRsp.connId;
pTscObj->acctId = connectRsp.acctId;
tstrncpy(pTscObj->sVer, connectRsp.sVer, tListLen(pTscObj->sVer));
@@ -232,13 +233,36 @@ int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) {
assert(pMsg != NULL && param != NULL);
SRequestObj* pRequest = param;
- taosMemoryFree(pMsg->pData);
if (code != TSDB_CODE_SUCCESS) {
setErrno(pRequest, code);
+ } else {
+ SMCreateStbRsp createRsp = {0};
+ SDecoder coder = {0};
+ tDecoderInit(&coder, pMsg->pData, pMsg->len);
+ tDecodeSMCreateStbRsp(&coder, &createRsp);
+ tDecoderClear(&coder);
+
+ pRequest->body.resInfo.execRes.msgType = TDMT_MND_CREATE_STB;
+ pRequest->body.resInfo.execRes.res = createRsp.pMeta;
}
+ taosMemoryFree(pMsg->pData);
+
if (pRequest->body.queryFp != NULL) {
- removeMeta(pRequest->pTscObj, pRequest->tableList);
+ SExecResult* pRes = &pRequest->body.resInfo.execRes;
+
+ if (code == TSDB_CODE_SUCCESS) {
+ SCatalog* pCatalog = NULL;
+ int32_t ret = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
+ if (pRes->res != NULL) {
+ ret = handleCreateTbExecRes(pRes->res, pCatalog);
+ }
+
+ if (ret != TSDB_CODE_SUCCESS) {
+ code = ret;
+ }
+ }
+
pRequest->body.queryFp(pRequest->body.param, pRequest, code);
} else {
tsem_post(&pRequest->body.rspSem);
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index 65041e1f129d6d73f9a5a13678bd1dcd5efe733b..9ca896c9ee624740b0602f35544219425db74779 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -15,342 +15,345 @@
#include "systable.h"
#include "taos.h"
+#include "taosdef.h"
#include "tdef.h"
#include "tgrant.h"
+#include "tmsg.h"
#include "types.h"
#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
+// clang-format off
static const SSysDbTableSchema dnodesSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
- {.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
- {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
+ {.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
+ {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
+ {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
static const SSysDbTableSchema mnodesSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
};
static const SSysDbTableSchema modulesSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "endpoint", .bytes = 134 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "module", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "endpoint", .bytes = 134 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "module", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
static const SSysDbTableSchema qnodesSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
};
static const SSysDbTableSchema snodesSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
};
static const SSysDbTableSchema bnodesSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
};
static const SSysDbTableSchema clusterSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
+ {.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "uptime", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
};
static const SSysDbTableSchema userDBSchema[] = {
- {.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "vgroups", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "replica", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
- {.name = "strict", .bytes = TSDB_DB_STRICT_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "duration", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "keep", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "buffer", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "pagesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "pages", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
- {.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "retentions", .bytes = 60 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "single_stable", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL},
- {.name = "cachemodel", .bytes = TSDB_CACHE_MODEL_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "cachesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "wal_level", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
- {.name = "wal_fsync_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "wal_retention_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "wal_retention_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "wal_roll_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "wal_segment_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
+ {.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "vgroups", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "replica", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
+ {.name = "strict", .bytes = TSDB_DB_STRICT_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "duration", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "keep", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "buffer", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "pagesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "pages", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
+ {.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "retentions", .bytes = 60 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "single_stable", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL, .sysInfo = true},
+ {.name = "cachemodel", .bytes = TSDB_CACHE_MODEL_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "cachesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "wal_level", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
+ {.name = "wal_fsync_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "wal_retention_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.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},
};
static const SSysDbTableSchema userFuncSchema[] = {
- {.name = "name", .bytes = TSDB_FUNC_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "comment", .bytes = PATH_MAX - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "aggregate", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "output_type", .bytes = TSDB_TYPE_STR_MAX_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "code_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "bufsize", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
+ {.name = "name", .bytes = TSDB_FUNC_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "comment", .bytes = PATH_MAX - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "aggregate", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "output_type", .bytes = TSDB_TYPE_STR_MAX_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "code_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "bufsize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
};
static const SSysDbTableSchema userIdxSchema[] = {
- {.name = "index_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "index_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
};
static const SSysDbTableSchema userStbsSchema[] = {
- {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "tags", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "table_comment", .bytes = TSDB_TB_COMMENT_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "watermark", .bytes = 64 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "max_delay", .bytes = 64 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "rollup", .bytes = 128 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "tags", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "table_comment", .bytes = TSDB_TB_COMMENT_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "watermark", .bytes = 64 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "max_delay", .bytes = 64 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "rollup", .bytes = 128 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
};
static const SSysDbTableSchema streamSchema[] = {
- {.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "source_db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "target_db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "target_table", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "watermark", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "trigger", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "source_db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "target_db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "target_table", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "watermark", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "trigger", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
};
static const SSysDbTableSchema userTblsSchema[] = {
- {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "uid", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "table_comment", .bytes = TSDB_TB_COMMENT_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "type", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "uid", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "table_comment", .bytes = TSDB_TB_COMMENT_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "type", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
};
static const SSysDbTableSchema userTagsSchema[] = {
- {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "tag_name", .bytes = TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "tag_type", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "tag_value", .bytes = TSDB_MAX_TAGS_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "tag_name", .bytes = TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "tag_type", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "tag_value", .bytes = TSDB_MAX_TAGS_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
};
static const SSysDbTableSchema userTblDistSchema[] = {
- {.name = "db_name", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "distributed_histogram", .bytes = 500 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "max_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "avg_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "stddev_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "rows", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "storage_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "compression_ratio", .bytes = 8, .type = TSDB_DATA_TYPE_DOUBLE},
- {.name = "rows_in_mem", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
+ {.name = "db_name", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "distributed_histogram", .bytes = 500 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "max_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "avg_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "stddev_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "rows", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
+ {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "storage_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
+ {.name = "compression_ratio", .bytes = 8, .type = TSDB_DATA_TYPE_DOUBLE, .sysInfo = true},
+ {.name = "rows_in_mem", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
};
static const SSysDbTableSchema userUsersSchema[] = {
- {.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "super", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
- {.name = "enable", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
- {.name = "sysinfo", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "super", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = false},
+ {.name = "enable", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = false},
+ {.name = "sysinfo", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
};
GRANTS_SCHEMA;
static const SSysDbTableSchema vgroupsSchema[] = {
- {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "v1_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "v1_status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "v2_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "v2_status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "v3_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "v3_status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "nfiles", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "tsma", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
+ {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "v1_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "v1_status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "v2_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "v2_status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "v3_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "v3_status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "nfiles", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
+ {.name = "tsma", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
};
static const SSysDbTableSchema smaSchema[] = {
- {.name = "sma_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
+ {.name = "sma_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
};
static const SSysDbTableSchema transSchema[] = {
- {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "stage", .bytes = TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "db1", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "db2", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "failed_times", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "last_exec_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "last_action_info",
- .bytes = (TSDB_TRANS_ERROR_LEN - 1) + VARSTR_HEADER_SIZE,
- .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "stage", .bytes = TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "db1", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "db2", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "failed_times", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "last_exec_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "last_action_info", .bytes = (TSDB_TRANS_ERROR_LEN - 1) + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
};
static const SSysDbTableSchema configSchema[] = {
- {.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
static const SSysDbTableSchema variablesSchema[] = {
{.name = "dnode_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
static const SSysTableMeta infosMeta[] = {
- {TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema)},
- {TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)},
- {TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
- {TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
+ {TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
+ {TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
+ {TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema), true},
+ {TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema), true},
// {TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
// {TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)},
- {TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema)},
- {TSDB_INS_TABLE_DATABASES, userDBSchema, tListLen(userDBSchema)},
- {TSDB_INS_TABLE_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
- {TSDB_INS_TABLE_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
- {TSDB_INS_TABLE_STABLES, userStbsSchema, tListLen(userStbsSchema)},
- {TSDB_INS_TABLE_TABLES, userTblsSchema, tListLen(userTblsSchema)},
- {TSDB_INS_TABLE_TAGS, userTagsSchema, tListLen(userTagsSchema)},
+ {TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema), true},
+ {TSDB_INS_TABLE_DATABASES, userDBSchema, tListLen(userDBSchema), false},
+ {TSDB_INS_TABLE_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema), false},
+ {TSDB_INS_TABLE_INDEXES, userIdxSchema, tListLen(userIdxSchema), false},
+ {TSDB_INS_TABLE_STABLES, userStbsSchema, tListLen(userStbsSchema), false},
+ {TSDB_INS_TABLE_TABLES, userTblsSchema, tListLen(userTblsSchema), false},
+ {TSDB_INS_TABLE_TAGS, userTagsSchema, tListLen(userTagsSchema), false},
// {TSDB_INS_TABLE_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
- {TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema)},
- {TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema)},
- {TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema)},
- {TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema)},
- {TSDB_INS_TABLE_DNODE_VARIABLES, variablesSchema, tListLen(variablesSchema)},
+ {TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), false},
+ {TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true},
+ {TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true},
+ {TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), true},
+ {TSDB_INS_TABLE_DNODE_VARIABLES, variablesSchema, tListLen(variablesSchema), true},
};
static const SSysDbTableSchema connectionsSchema[] = {
- {.name = "conn_id", .bytes = 4, .type = TSDB_DATA_TYPE_UINT},
- {.name = "user", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "app", .bytes = TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_UINT},
- {.name = "end_point", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "login_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "last_access", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "conn_id", .bytes = 4, .type = TSDB_DATA_TYPE_UINT, .sysInfo = false},
+ {.name = "user", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "app", .bytes = TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_UINT, .sysInfo = false},
+ {.name = "end_point", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "login_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "last_access", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
};
static const SSysDbTableSchema topicSchema[] = {
- {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
+ {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
// TODO config
};
static const SSysDbTableSchema consumerSchema[] = {
- {.name = "consumer_id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "consumer_group", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "topics", .bytes = TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
- /*{.name = "end_point", .bytes = TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},*/
- {.name = "up_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "subscribe_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "rebalance_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "consumer_id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "consumer_group", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "topics", .bytes = TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ /*{.name = "end_point", .bytes = TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},*/
+ {.name = "up_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "subscribe_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "rebalance_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
};
static const SSysDbTableSchema subscriptionSchema[] = {
- {.name = "topic_name", .bytes = TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "consumer_group", .bytes = TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "consumer_id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
+ {.name = "topic_name", .bytes = TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "consumer_group", .bytes = TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "consumer_id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
};
static const SSysDbTableSchema offsetSchema[] = {
- {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
- {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "committed_offset", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "current_offset", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "skip_log_cnt", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
+ {.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
+ {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "committed_offset", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "current_offset", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "skip_log_cnt", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
};
static const SSysDbTableSchema querySchema[] = {
- {.name = "kill_id", .bytes = TSDB_QUERY_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "query_id", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "conn_id", .bytes = 4, .type = TSDB_DATA_TYPE_UINT},
- {.name = "app", .bytes = TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "user", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "end_point", .bytes = TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "exec_usec", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
- {.name = "stable_query", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL},
- {.name = "sub_num", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "sub_status", .bytes = TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
+ {.name = "kill_id", .bytes = TSDB_QUERY_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "query_id", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "conn_id", .bytes = 4, .type = TSDB_DATA_TYPE_UINT, .sysInfo = false},
+ {.name = "app", .bytes = TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "user", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "end_point", .bytes = TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "exec_usec", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
+ {.name = "stable_query", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL, .sysInfo = false},
+ {.name = "sub_num", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "sub_status", .bytes = TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
};
static const SSysDbTableSchema appSchema[] = {
- {.name = "app_id", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "ip", .bytes = TSDB_IPv4ADDR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
- {.name = "name", .bytes = TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
- {.name = "start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
- {.name = "insert_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "insert_row", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "insert_time", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "insert_bytes", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "fetch_bytes", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "query_time", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "slow_query", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "total_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "current_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "last_access", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
+ {.name = "app_id", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "ip", .bytes = TSDB_IPv4ADDR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "name", .bytes = TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
+ {.name = "insert_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "insert_row", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "insert_time", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "insert_bytes", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "fetch_bytes", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "query_time", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "slow_query", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "total_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "current_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT, .sysInfo = false},
+ {.name = "last_access", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
};
static const SSysTableMeta perfsMeta[] = {
- {TSDB_PERFS_TABLE_CONNECTIONS, connectionsSchema, tListLen(connectionsSchema)},
- {TSDB_PERFS_TABLE_QUERIES, querySchema, tListLen(querySchema)},
- {TSDB_PERFS_TABLE_TOPICS, topicSchema, tListLen(topicSchema)},
- {TSDB_PERFS_TABLE_CONSUMERS, consumerSchema, tListLen(consumerSchema)},
- {TSDB_PERFS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema)},
+ {TSDB_PERFS_TABLE_CONNECTIONS, connectionsSchema, tListLen(connectionsSchema), false},
+ {TSDB_PERFS_TABLE_QUERIES, querySchema, tListLen(querySchema), false},
+ {TSDB_PERFS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false},
+ {TSDB_PERFS_TABLE_CONSUMERS, consumerSchema, tListLen(consumerSchema), false},
+ {TSDB_PERFS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false},
// {TSDB_PERFS_TABLE_OFFSETS, offsetSchema, tListLen(offsetSchema)},
- {TSDB_PERFS_TABLE_TRANS, transSchema, tListLen(transSchema)},
- {TSDB_PERFS_TABLE_SMAS, smaSchema, tListLen(smaSchema)},
- {TSDB_PERFS_TABLE_STREAMS, streamSchema, tListLen(streamSchema)},
- {TSDB_PERFS_TABLE_APPS, appSchema, tListLen(appSchema)}};
+ {TSDB_PERFS_TABLE_TRANS, transSchema, tListLen(transSchema), false},
+ // {TSDB_PERFS_TABLE_SMAS, smaSchema, tListLen(smaSchema), false},
+ {TSDB_PERFS_TABLE_STREAMS, streamSchema, tListLen(streamSchema), false},
+ {TSDB_PERFS_TABLE_APPS, appSchema, tListLen(appSchema), false}};
+// clang-format on
void getInfosDbMeta(const SSysTableMeta** pInfosTableMeta, size_t* size) {
if (pInfosTableMeta) {
@@ -369,3 +372,26 @@ void getPerfDbMeta(const SSysTableMeta** pPerfsTableMeta, size_t* size) {
*size = tListLen(perfsMeta);
}
}
+
+void getVisibleInfosTablesNum(bool sysInfo, size_t* size) {
+ if (sysInfo) {
+ getInfosDbMeta(NULL, size);
+ return;
+ }
+ *size = 0;
+ const SSysTableMeta* pMeta = NULL;
+ size_t totalNum = 0;
+ getInfosDbMeta(&pMeta, &totalNum);
+ for (size_t i = 0; i < totalNum; ++i) {
+ if (!pMeta[i].sysInfo) {
+ ++(*size);
+ }
+ }
+}
+
+bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags) {
+ if (sysInfo || TSDB_SYSTEM_TABLE != tableType) {
+ return false;
+ }
+ return 0 != (flags & COL_IS_SYSINFO);
+}
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index c65e966046912edb6f8c0ca77db3f55d24710785..c748260918aef3af03dca13afe65840f835c0027 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -1706,8 +1706,8 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
}
void blockDebugShowDataBlock(SSDataBlock* pBlock, const char* flag) {
- SArray* dataBlocks = taosArrayInit(1, sizeof(SSDataBlock));
- taosArrayPush(dataBlocks, pBlock);
+ SArray* dataBlocks = taosArrayInit(1, sizeof(SSDataBlock*));
+ taosArrayPush(dataBlocks, &pBlock);
blockDebugShowDataBlocks(dataBlocks, flag);
taosArrayDestroy(dataBlocks);
}
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index adc5af1a17cf7a66c673c61e031a35ea3a968d38..ee9d75155563a9892ce952e50032b47e5b5c1eb5 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -61,6 +61,7 @@ int32_t tsNumOfVnodeStreamThreads = 2;
int32_t tsNumOfVnodeFetchThreads = 4;
int32_t tsNumOfVnodeWriteThreads = 2;
int32_t tsNumOfVnodeSyncThreads = 2;
+int32_t tsNumOfVnodeRsmaThreads = 2;
int32_t tsNumOfQnodeQueryThreads = 4;
int32_t tsNumOfQnodeFetchThreads = 4;
int32_t tsNumOfSnodeSharedThreads = 2;
@@ -76,7 +77,7 @@ bool tsMonitorComp = false;
// telem
bool tsEnableTelem = true;
-int32_t tsTelemInterval = 86400;
+int32_t tsTelemInterval = 43200;
char tsTelemServer[TSDB_FQDN_LEN] = "telemetry.taosdata.com";
uint16_t tsTelemPort = 80;
@@ -164,6 +165,7 @@ int32_t tsMqRebalanceInterval = 2;
int32_t tsTtlUnit = 86400;
int32_t tsTtlPushInterval = 86400;
int32_t tsGrantHBInterval = 60;
+int32_t tsUptimeInterval = 300; // seconds
#ifndef _STORAGE
int32_t taosSetTfsCfg(SConfig *pCfg) {
@@ -377,6 +379,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
tsNumOfVnodeSyncThreads = TMAX(tsNumOfVnodeSyncThreads, 16);
if (cfgAddInt32(pCfg, "numOfVnodeSyncThreads", tsNumOfVnodeSyncThreads, 1, 1024, 0) != 0) return -1;
+ tsNumOfVnodeRsmaThreads = tsNumOfCores;
+ tsNumOfVnodeRsmaThreads = TMAX(tsNumOfVnodeRsmaThreads, 4);
+ if (cfgAddInt32(pCfg, "numOfVnodeRsmaThreads", tsNumOfVnodeRsmaThreads, 1, 1024, 0) != 0) return -1;
+
tsNumOfQnodeQueryThreads = tsNumOfCores * 2;
tsNumOfQnodeQueryThreads = TMAX(tsNumOfQnodeQueryThreads, 4);
if (cfgAddInt32(pCfg, "numOfQnodeQueryThreads", tsNumOfQnodeQueryThreads, 1, 1024, 0) != 0) return -1;
@@ -414,6 +420,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "mqRebalanceInterval", tsMqRebalanceInterval, 1, 10000, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400 * 365, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushInterval, 1, 100000, 1) != 0) return -1;
+ if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1;
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
GRANT_CFG_ADD;
@@ -538,6 +545,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsNumOfVnodeFetchThreads = cfgGetItem(pCfg, "numOfVnodeFetchThreads")->i32;
tsNumOfVnodeWriteThreads = cfgGetItem(pCfg, "numOfVnodeWriteThreads")->i32;
tsNumOfVnodeSyncThreads = cfgGetItem(pCfg, "numOfVnodeSyncThreads")->i32;
+ tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32;
tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
tsNumOfSnodeSharedThreads = cfgGetItem(pCfg, "numOfSnodeSharedThreads")->i32;
@@ -560,6 +568,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32;
tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32;
tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32;
+ tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32;
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
@@ -782,6 +791,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
tsNumOfVnodeWriteThreads = cfgGetItem(pCfg, "numOfVnodeWriteThreads")->i32;
} else if (strcasecmp("numOfVnodeSyncThreads", name) == 0) {
tsNumOfVnodeSyncThreads = cfgGetItem(pCfg, "numOfVnodeSyncThreads")->i32;
+ } else if (strcasecmp("numOfVnodeRsmaThreads", name) == 0) {
+ tsNumOfVnodeRsmaThreads = cfgGetItem(pCfg, "numOfVnodeRsmaThreads")->i32;
} else if (strcasecmp("numOfQnodeQueryThreads", name) == 0) {
tsNumOfQnodeQueryThreads = cfgGetItem(pCfg, "numOfQnodeQueryThreads")->i32;
} else if (strcasecmp("numOfQnodeFetchThreads", name) == 0) {
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 533d924546eb553045fea97e6b50cdb42489d714..058f26d1454a20af7fe5ee480e9b9240ade999af 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -3196,12 +3196,16 @@ static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) {
if (tDecodeI32(pDecoder, &pRsp->vgId) < 0) return -1;
int32_t totalCols = pRsp->numOfTags + pRsp->numOfColumns;
- pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols);
- if (pRsp->pSchemas == NULL) return -1;
+ if (totalCols > 0) {
+ pRsp->pSchemas = taosMemoryMalloc(sizeof(SSchema) * totalCols);
+ if (pRsp->pSchemas == NULL) return -1;
- for (int32_t i = 0; i < totalCols; ++i) {
- SSchema *pSchema = &pRsp->pSchemas[i];
- if (tDecodeSSchema(pDecoder, pSchema) < 0) return -1;
+ for (int32_t i = 0; i < totalCols; ++i) {
+ SSchema *pSchema = &pRsp->pSchemas[i];
+ if (tDecodeSSchema(pDecoder, pSchema) < 0) return -1;
+ }
+ } else {
+ pRsp->pSchemas = NULL;
}
return 0;
@@ -3326,7 +3330,7 @@ int32_t tDeserializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) {
return 0;
}
-void tFreeSTableMetaRsp(STableMetaRsp *pRsp) { taosMemoryFreeClear(pRsp->pSchemas); }
+void tFreeSTableMetaRsp(void *pRsp) { taosMemoryFreeClear(((STableMetaRsp*)pRsp)->pSchemas); }
void tFreeSTableIndexRsp(void *info) {
if (NULL == info) {
@@ -3630,6 +3634,7 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
if (tEncodeU32(&encoder, pRsp->connId) < 0) return -1;
if (tEncodeI32(&encoder, pRsp->dnodeNum) < 0) return -1;
if (tEncodeI8(&encoder, pRsp->superUser) < 0) return -1;
+ if (tEncodeI8(&encoder, pRsp->sysInfo) < 0) return -1;
if (tEncodeI8(&encoder, pRsp->connType) < 0) return -1;
if (tEncodeSEpSet(&encoder, &pRsp->epSet) < 0) return -1;
if (tEncodeI32(&encoder, pRsp->svrTimestamp) < 0) return -1;
@@ -3652,6 +3657,7 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
if (tDecodeU32(&decoder, &pRsp->connId) < 0) return -1;
if (tDecodeI32(&decoder, &pRsp->dnodeNum) < 0) return -1;
if (tDecodeI8(&decoder, &pRsp->superUser) < 0) return -1;
+ if (tDecodeI8(&decoder, &pRsp->sysInfo) < 0) return -1;
if (tDecodeI8(&decoder, &pRsp->connType) < 0) return -1;
if (tDecodeSEpSet(&decoder, &pRsp->epSet) < 0) return -1;
if (tDecodeI32(&decoder, &pRsp->svrTimestamp) < 0) return -1;
@@ -5090,6 +5096,10 @@ int tEncodeSVCreateTbRsp(SEncoder *pCoder, const SVCreateTbRsp *pRsp) {
if (tStartEncode(pCoder) < 0) return -1;
if (tEncodeI32(pCoder, pRsp->code) < 0) return -1;
+ if (tEncodeI32(pCoder, pRsp->pMeta ? 1 : 0) < 0) return -1;
+ if (pRsp->pMeta) {
+ if (tEncodeSTableMetaRsp(pCoder, pRsp->pMeta) < 0) return -1;
+ }
tEndEncode(pCoder);
return 0;
@@ -5100,10 +5110,32 @@ int tDecodeSVCreateTbRsp(SDecoder *pCoder, SVCreateTbRsp *pRsp) {
if (tDecodeI32(pCoder, &pRsp->code) < 0) return -1;
+ int32_t meta = 0;
+ if (tDecodeI32(pCoder, &meta) < 0) return -1;
+ if (meta) {
+ pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
+ if (NULL == pRsp->pMeta) return -1;
+ if (tDecodeSTableMetaRsp(pCoder, pRsp->pMeta) < 0) return -1;
+ } else {
+ pRsp->pMeta = NULL;
+ }
+
tEndDecode(pCoder);
return 0;
}
+void tFreeSVCreateTbRsp(void* param) {
+ if (NULL == param) {
+ return;
+ }
+
+ SVCreateTbRsp* pRsp = (SVCreateTbRsp*)param;
+ if (pRsp->pMeta) {
+ taosMemoryFree(pRsp->pMeta->pSchemas);
+ taosMemoryFree(pRsp->pMeta);
+ }
+}
+
// TDMT_VND_DROP_TABLE =================
static int32_t tEncodeSVDropTbReq(SEncoder *pCoder, const SVDropTbReq *pReq) {
if (tStartEncode(pCoder) < 0) return -1;
@@ -5292,6 +5324,10 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl
if (tEncodeI32v(pEncoder, pBlock->numOfRows) < 0) return -1;
if (tEncodeI32v(pEncoder, pBlock->affectedRows) < 0) return -1;
if (tEncodeI64v(pEncoder, pBlock->sver) < 0) return -1;
+ if (tEncodeI32(pEncoder, pBlock->pMeta ? 1 : 0) < 0) return -1;
+ if (pBlock->pMeta) {
+ if (tEncodeSTableMetaRsp(pEncoder, pBlock->pMeta) < 0) return -1;
+ }
tEndEncode(pEncoder);
return 0;
@@ -5309,6 +5345,16 @@ static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
if (tDecodeI32v(pDecoder, &pBlock->numOfRows) < 0) return -1;
if (tDecodeI32v(pDecoder, &pBlock->affectedRows) < 0) return -1;
if (tDecodeI64v(pDecoder, &pBlock->sver) < 0) return -1;
+
+ int32_t meta = 0;
+ if (tDecodeI32(pDecoder, &meta) < 0) return -1;
+ if (meta) {
+ pBlock->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
+ if (NULL == pBlock->pMeta) return -1;
+ if (tDecodeSTableMetaRsp(pDecoder, pBlock->pMeta) < 0) return -1;
+ } else {
+ pBlock->pMeta = NULL;
+ }
tEndDecode(pDecoder);
return 0;
@@ -5347,6 +5393,21 @@ int32_t tDecodeSSubmitRsp(SDecoder *pDecoder, SSubmitRsp *pRsp) {
return 0;
}
+void tFreeSSubmitBlkRsp(void* param) {
+ if (NULL == param) {
+ return;
+ }
+
+ SSubmitBlkRsp* pRsp = (SSubmitBlkRsp*)param;
+
+ taosMemoryFree(pRsp->tblFName);
+ if (pRsp->pMeta) {
+ taosMemoryFree(pRsp->pMeta->pSchemas);
+ taosMemoryFree(pRsp->pMeta);
+ }
+}
+
+
void tFreeSSubmitRsp(SSubmitRsp *pRsp) {
if (NULL == pRsp) return;
@@ -5558,6 +5619,60 @@ void tFreeSMAlterStbRsp(SMAlterStbRsp *pRsp) {
}
}
+
+int32_t tEncodeSMCreateStbRsp(SEncoder *pEncoder, const SMCreateStbRsp *pRsp) {
+ if (tStartEncode(pEncoder) < 0) return -1;
+ if (tEncodeI32(pEncoder, pRsp->pMeta->pSchemas ? 1 : 0) < 0) return -1;
+ if (pRsp->pMeta->pSchemas) {
+ if (tEncodeSTableMetaRsp(pEncoder, pRsp->pMeta) < 0) return -1;
+ }
+ tEndEncode(pEncoder);
+ return 0;
+}
+
+int32_t tDecodeSMCreateStbRsp(SDecoder *pDecoder, SMCreateStbRsp *pRsp) {
+ int32_t meta = 0;
+ if (tStartDecode(pDecoder) < 0) return -1;
+ if (tDecodeI32(pDecoder, &meta) < 0) return -1;
+ if (meta) {
+ pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
+ if (NULL == pRsp->pMeta) return -1;
+ if (tDecodeSTableMetaRsp(pDecoder, pRsp->pMeta) < 0) return -1;
+ }
+ tEndDecode(pDecoder);
+ return 0;
+}
+
+int32_t tDeserializeSMCreateStbRsp(void *buf, int32_t bufLen, SMCreateStbRsp *pRsp) {
+ int32_t meta = 0;
+ SDecoder decoder = {0};
+ tDecoderInit(&decoder, buf, bufLen);
+
+ if (tStartDecode(&decoder) < 0) return -1;
+ if (tDecodeI32(&decoder, &meta) < 0) return -1;
+ if (meta) {
+ pRsp->pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
+ if (NULL == pRsp->pMeta) return -1;
+ if (tDecodeSTableMetaRsp(&decoder, pRsp->pMeta) < 0) return -1;
+ }
+ tEndDecode(&decoder);
+ tDecoderClear(&decoder);
+ return 0;
+}
+
+void tFreeSMCreateStbRsp(SMCreateStbRsp *pRsp) {
+ if (NULL == pRsp) {
+ return;
+ }
+
+ if (pRsp->pMeta) {
+ taosMemoryFree(pRsp->pMeta->pSchemas);
+ taosMemoryFree(pRsp->pMeta);
+ }
+}
+
+
+
int32_t tEncodeSTqOffsetVal(SEncoder *pEncoder, const STqOffsetVal *pOffsetVal) {
if (tEncodeI8(pEncoder, pOffsetVal->type) < 0) return -1;
if (pOffsetVal->type == TMQ_OFFSET__SNAPSHOT_DATA) {
diff --git a/source/dnode/mnode/impl/inc/mndCluster.h b/source/dnode/mnode/impl/inc/mndCluster.h
index 0de253fb6adebf053eb1eb6afc68693f1fbc6747..2cb41edd7c1d37c8dab6f0e276259e9cc530fea8 100644
--- a/source/dnode/mnode/impl/inc/mndCluster.h
+++ b/source/dnode/mnode/impl/inc/mndCluster.h
@@ -27,6 +27,7 @@ void mndCleanupCluster(SMnode *pMnode);
int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len);
int64_t mndGetClusterId(SMnode *pMnode);
int64_t mndGetClusterCreateTime(SMnode *pMnode);
+float mndGetClusterUpTime(SMnode *pMnode);
#ifdef __cplusplus
}
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 8cff7fe48e0d9a2c25b0fda797a098d9e370d506..ea05215fe90d30708013fe4b1c8fc08d2be8d3d6 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -179,6 +179,7 @@ typedef struct {
char name[TSDB_CLUSTER_ID_LEN];
int64_t createdTime;
int64_t updateTime;
+ int32_t upTime;
} SClusterObj;
typedef struct {
diff --git a/source/dnode/mnode/impl/inc/mndInfoSchema.h b/source/dnode/mnode/impl/inc/mndInfoSchema.h
index b10d92ee3de1a0e06d801c9a8840751a9f52f37c..4f98465cd170280d8c9f5e9356c37cebf26f9bd0 100644
--- a/source/dnode/mnode/impl/inc/mndInfoSchema.h
+++ b/source/dnode/mnode/impl/inc/mndInfoSchema.h
@@ -24,7 +24,8 @@ extern "C" {
int32_t mndInitInfos(SMnode *pMnode);
void mndCleanupInfos(SMnode *pMnode);
-int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp);
+int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, bool sysinfo,
+ STableMetaRsp *pRsp);
int32_t mndBuildInsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp);
#ifdef __cplusplus
diff --git a/source/dnode/mnode/impl/inc/mndStb.h b/source/dnode/mnode/impl/inc/mndStb.h
index 010199a89fcf28131371b589f344a5053e891620..8f0d55e10061ce4517c4305ae7450a7439b91cfd 100644
--- a/source/dnode/mnode/impl/inc/mndStb.h
+++ b/source/dnode/mnode/impl/inc/mndStb.h
@@ -35,6 +35,7 @@ SDbObj *mndAcquireDbByStb(SMnode *pMnode, const char *stbName);
int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreate, SDbObj *pDb);
int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb);
void mndFreeStb(SStbObj *pStb);
+int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char* dbFName, char* stbFName, void **pCont, int32_t *pLen);
void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst);
void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize);
diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c
index a82bf739f5feae48e444a7100f45aef19f7c6803..7d633f90bd937c24b82094bdc0fa6d30c30bc250 100644
--- a/source/dnode/mnode/impl/src/mndCluster.c
+++ b/source/dnode/mnode/impl/src/mndCluster.c
@@ -19,7 +19,7 @@
#include "mndTrans.h"
#define CLUSTER_VER_NUMBE 1
-#define CLUSTER_RESERVE_SIZE 64
+#define CLUSTER_RESERVE_SIZE 60
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster);
static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw);
@@ -29,6 +29,7 @@ static int32_t mndClusterActionUpdate(SSdb *pSdb, SClusterObj *pOldCluster, SCl
static int32_t mndCreateDefaultCluster(SMnode *pMnode);
static int32_t mndRetrieveClusters(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter);
+static int32_t mndProcessUptimeTimer(SRpcMsg *pReq);
int32_t mndInitCluster(SMnode *pMnode) {
SSdbTable table = {
@@ -42,8 +43,10 @@ int32_t mndInitCluster(SMnode *pMnode) {
.deleteFp = (SdbDeleteFp)mndClusterActionDelete,
};
+ mndSetMsgHandle(pMnode, TDMT_MND_UPTIME_TIMER, mndProcessUptimeTimer);
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndRetrieveClusters);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndCancelGetNextCluster);
+
return sdbSetTable(pMnode->pSdb, table);
}
@@ -62,40 +65,69 @@ int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len) {
return 0;
}
-int64_t mndGetClusterId(SMnode *pMnode) {
- SSdb *pSdb = pMnode->pSdb;
- void *pIter = NULL;
- int64_t clusterId = -1;
+static SClusterObj *mndAcquireCluster(SMnode *pMnode) {
+ SSdb *pSdb = pMnode->pSdb;
+ void *pIter = NULL;
while (1) {
SClusterObj *pCluster = NULL;
pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster);
if (pIter == NULL) break;
+ return pCluster;
+ }
+
+ return NULL;
+}
+
+static void mndReleaseCluster(SMnode *pMnode, SClusterObj *pCluster) {
+ SSdb *pSdb = pMnode->pSdb;
+ sdbRelease(pSdb, pCluster);
+}
+
+int64_t mndGetClusterId(SMnode *pMnode) {
+ int64_t clusterId = 0;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ if (pCluster != NULL) {
clusterId = pCluster->id;
- sdbRelease(pSdb, pCluster);
+ mndReleaseCluster(pMnode, pCluster);
}
return clusterId;
}
int64_t mndGetClusterCreateTime(SMnode *pMnode) {
- SSdb *pSdb = pMnode->pSdb;
- void *pIter = NULL;
- int64_t createTime = INT64_MAX;
-
- while (1) {
- SClusterObj *pCluster = NULL;
- pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster);
- if (pIter == NULL) break;
-
+ int64_t createTime = 0;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ if (pCluster != NULL) {
createTime = pCluster->createdTime;
- sdbRelease(pSdb, pCluster);
+ mndReleaseCluster(pMnode, pCluster);
}
return createTime;
}
+static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
+#if 0
+ int32_t upTime = taosGetTimestampSec() - pCluster->updateTime / 1000;
+ upTime = upTime + pCluster->upTime;
+ return upTime;
+#else
+ return pCluster->upTime;
+#endif
+}
+
+float mndGetClusterUpTime(SMnode *pMnode) {
+ int64_t upTime = 0;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ if (pCluster != NULL) {
+ upTime = mndGetClusterUpTimeImp(pCluster);
+ mndReleaseCluster(pMnode, pCluster);
+ }
+
+ return upTime / 86400.0f;
+}
+
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -107,6 +139,7 @@ static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
SDB_SET_INT64(pRaw, dataPos, pCluster->createdTime, _OVER)
SDB_SET_INT64(pRaw, dataPos, pCluster->updateTime, _OVER)
SDB_SET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pCluster->upTime, _OVER)
SDB_SET_RESERVE(pRaw, dataPos, CLUSTER_RESERVE_SIZE, _OVER)
terrno = 0;
@@ -144,6 +177,7 @@ static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64(pRaw, dataPos, &pCluster->createdTime, _OVER)
SDB_GET_INT64(pRaw, dataPos, &pCluster->updateTime, _OVER)
SDB_GET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &pCluster->upTime, _OVER)
SDB_GET_RESERVE(pRaw, dataPos, CLUSTER_RESERVE_SIZE, _OVER)
terrno = 0;
@@ -162,6 +196,7 @@ _OVER:
static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster) {
mTrace("cluster:%" PRId64 ", perform insert action, row:%p", pCluster->id, pCluster);
pSdb->pMnode->clusterId = pCluster->id;
+ pCluster->updateTime = taosGetTimestampMs();
return 0;
}
@@ -171,7 +206,10 @@ static int32_t mndClusterActionDelete(SSdb *pSdb, SClusterObj *pCluster) {
}
static int32_t mndClusterActionUpdate(SSdb *pSdb, SClusterObj *pOld, SClusterObj *pNew) {
- mTrace("cluster:%" PRId64 ", perform update action, old row:%p new row:%p", pOld->id, pOld, pNew);
+ mTrace("cluster:%" PRId64 ", perform update action, old row:%p new row:%p, uptime from %d to %d", pOld->id, pOld,
+ pNew, pOld->upTime, pNew->upTime);
+ pOld->upTime = pNew->upTime;
+ pOld->updateTime = taosGetTimestampMs();
return 0;
}
@@ -242,6 +280,10 @@ static int32_t mndRetrieveClusters(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, numOfRows, buf, false);
+ int32_t upTime = mndGetClusterUpTimeImp(pCluster);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataAppend(pColInfo, numOfRows, (const char *)&upTime, false);
+
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, numOfRows, (const char *)&pCluster->createdTime, false);
@@ -257,3 +299,40 @@ static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter) {
SSdb *pSdb = pMnode->pSdb;
sdbCancelFetch(pSdb, pIter);
}
+
+static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
+ SMnode *pMnode = pReq->info.node;
+ SClusterObj clusterObj = {0};
+ SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ if (pCluster != NULL) {
+ memcpy(&clusterObj, pCluster, sizeof(SClusterObj));
+ clusterObj.upTime += tsUptimeInterval;
+ mndReleaseCluster(pMnode, pCluster);
+ }
+
+ if (clusterObj.id <= 0) {
+ mError("can't get cluster info while update uptime");
+ return 0;
+ }
+
+ mTrace("update cluster uptime to %" PRId64, clusterObj.upTime);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ if (pTrans == NULL) return -1;
+
+ SSdbRaw *pCommitRaw = mndClusterActionEncode(&clusterObj);
+ if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
+ mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
+ mndTransDrop(pTrans);
+ return -1;
+ }
+ sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
+
+ if (mndTransPrepare(pMnode, pTrans) != 0) {
+ mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
+ mndTransDrop(pTrans);
+ return -1;
+ }
+
+ mndTransDrop(pTrans);
+ return 0;
+}
diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c
index 853ace79fd79bd2c30684446d0c12f5640eb881c..8c1c3ba8735f21684b5f9577b9fad20beec110a7 100644
--- a/source/dnode/mnode/impl/src/mndDb.c
+++ b/source/dnode/mnode/impl/src/mndDb.c
@@ -1731,7 +1731,7 @@ static int32_t mndRetrieveDbs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
SDbObj infoschemaDb = {0};
setInformationSchemaDbCfg(&infoschemaDb);
size_t numOfTables = 0;
- getInfosDbMeta(NULL, &numOfTables);
+ getVisibleInfosTablesNum(sysinfo, &numOfTables);
mndDumpDbInfoData(pMnode, pBlock, &infoschemaDb, pShow, numOfRows, numOfTables, true, 0, 1);
numOfRows += 1;
diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c
index bf33cf603f68ccedfdf69c972441021bdbcb0a53..09172115f8502e392c1d37ae1d256761afb02126 100644
--- a/source/dnode/mnode/impl/src/mndInfoSchema.c
+++ b/source/dnode/mnode/impl/src/mndInfoSchema.c
@@ -14,8 +14,8 @@
*/
#define _DEFAULT_SOURCE
-#include "systable.h"
#include "mndInt.h"
+#include "systable.h"
static int32_t mndInitInfosTableSchema(const SSysDbTableSchema *pSrc, int32_t colNum, SSchema **pDst) {
SSchema *schema = taosMemoryCalloc(colNum, sizeof(SSchema));
@@ -29,6 +29,9 @@ static int32_t mndInitInfosTableSchema(const SSysDbTableSchema *pSrc, int32_t co
schema[i].type = pSrc[i].type;
schema[i].colId = i + 1;
schema[i].bytes = pSrc[i].bytes;
+ if (pSrc[i].sysInfo) {
+ schema[i].flags |= COL_IS_SYSINFO;
+ }
}
*pDst = schema;
@@ -43,13 +46,14 @@ static int32_t mndInsInitMeta(SHashObj *hash) {
meta.sversion = 1;
meta.tversion = 1;
- size_t size = 0;
- const SSysTableMeta* pInfosTableMeta = NULL;
+ size_t size = 0;
+ const SSysTableMeta *pInfosTableMeta = NULL;
getInfosDbMeta(&pInfosTableMeta, &size);
for (int32_t i = 0; i < size; ++i) {
tstrncpy(meta.tbName, pInfosTableMeta[i].name, sizeof(meta.tbName));
meta.numOfColumns = pInfosTableMeta[i].colNum;
+ meta.sysInfo = pInfosTableMeta[i].sysInfo;
if (mndInitInfosTableSchema(pInfosTableMeta[i].schema, pInfosTableMeta[i].colNum, &meta.pSchemas)) {
return -1;
@@ -64,14 +68,15 @@ static int32_t mndInsInitMeta(SHashObj *hash) {
return 0;
}
-int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp) {
+int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, bool sysinfo,
+ STableMetaRsp *pRsp) {
if (NULL == pMnode->infosMeta) {
terrno = TSDB_CODE_APP_NOT_READY;
return -1;
}
STableMetaRsp *pMeta = taosHashGet(pMnode->infosMeta, tbName, strlen(tbName));
- if (NULL == pMeta) {
+ if (NULL == pMeta || (!sysinfo && pMeta->sysInfo)) {
mError("invalid information schema table name:%s", tbName);
terrno = TSDB_CODE_MND_INVALID_SYS_TABLENAME;
return -1;
@@ -121,7 +126,6 @@ int32_t mndBuildInsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbN
return 0;
}
-
int32_t mndInitInfos(SMnode *pMnode) {
pMnode->infosMeta = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK);
if (pMnode->infosMeta == NULL) {
diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c
index 1693ef7d6502d753595ad6af9596b0eb775829bc..2221718023c8d080059736fd811c946618fd948d 100644
--- a/source/dnode/mnode/impl/src/mndMain.c
+++ b/source/dnode/mnode/impl/src/mndMain.c
@@ -100,6 +100,16 @@ static void mndGrantHeartBeat(SMnode *pMnode) {
}
}
+static void mndIncreaseUpTime(SMnode *pMnode) {
+ int32_t contLen = 0;
+ void *pReq = mndBuildTimerMsg(&contLen);
+ if (pReq != NULL) {
+ SRpcMsg rpcMsg = {
+ .msgType = TDMT_MND_UPTIME_TIMER, .pCont = pReq, .contLen = contLen, .info.ahandle = (void *)0x9528};
+ tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
+ }
+}
+
static void *mndThreadFp(void *param) {
SMnode *pMnode = param;
int64_t lastTime = 0;
@@ -122,13 +132,17 @@ static void *mndThreadFp(void *param) {
mndCalMqRebalance(pMnode);
}
- if (lastTime % (tsTelemInterval * 10) == 1) {
+ if (lastTime % (tsTelemInterval * 10) == ((tsTelemInterval - 1) * 10)) {
mndPullupTelem(pMnode);
}
if (lastTime % (tsGrantHBInterval * 10) == 0) {
mndGrantHeartBeat(pMnode);
}
+
+ if ((lastTime % (tsUptimeInterval * 10)) == ((tsUptimeInterval - 1) * 10)) {
+ mndIncreaseUpTime(pMnode);
+ }
}
return NULL;
@@ -556,7 +570,8 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
}
if (mndAcquireRpcRef(pMsg->info.node) == 0) return 0;
if (pMsg->msgType == TDMT_MND_MQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER ||
- pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER) {
+ pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER ||
+ pMsg->msgType == TDMT_MND_UPTIME_TIMER) {
return -1;
}
@@ -705,7 +720,8 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
if (pObj->id == pMnode->selfDnodeId) {
pClusterInfo->first_ep_dnode_id = pObj->id;
tstrncpy(pClusterInfo->first_ep, pObj->pDnode->ep, sizeof(pClusterInfo->first_ep));
- pClusterInfo->master_uptime = (ms - pObj->stateStartTime) / (86400000.0f);
+ pClusterInfo->master_uptime = mndGetClusterUpTime(pMnode);
+ // pClusterInfo->master_uptime = (ms - pObj->stateStartTime) / (86400000.0f);
tstrncpy(desc.role, syncStr(TAOS_SYNC_STATE_LEADER), sizeof(desc.role));
} else {
tstrncpy(desc.role, syncStr(pObj->state), sizeof(desc.role));
diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c
index 4f07d9e0143f52da057c40d2e655044da01a6b72..71bda4d4f34213a7b3240f6634b26579fb66c1ee 100644
--- a/source/dnode/mnode/impl/src/mndMnode.c
+++ b/source/dnode/mnode/impl/src/mndMnode.c
@@ -89,14 +89,14 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
if (pRaw == NULL) return -1;
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- mDebug("mnode:%d, will be created when deploying, raw:%p", mnodeObj.id, pRaw);
+ mInfo("mnode:%d, will be created when deploying, raw:%p", mnodeObj.id, pRaw);
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL);
if (pTrans == NULL) {
mError("mnode:%d, failed to create since %s", mnodeObj.id, terrstr());
return -1;
}
- mDebug("trans:%d, used to create mnode:%d", pTrans->id, mnodeObj.id);
+ mInfo("trans:%d, used to create mnode:%d", pTrans->id, mnodeObj.id);
if (mndTransAppendCommitlog(pTrans, pRaw) != 0) {
mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr());
@@ -365,7 +365,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
- mDebug("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId);
+ mInfo("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId);
if (mndSetCreateMnodeRedoLogs(pMnode, pTrans, &mnodeObj) != 0) goto _OVER;
if (mndSetCreateMnodeCommitLogs(pMnode, pTrans, &mnodeObj) != 0) goto _OVER;
@@ -392,7 +392,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("mnode:%d, start to create", createReq.dnodeId);
+ mInfo("mnode:%d, start to create", createReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_MNODE) != 0) {
goto _OVER;
}
@@ -574,7 +574,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
- mDebug("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
+ mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
@@ -597,7 +597,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("mnode:%d, start to drop", dropReq.dnodeId);
+ mInfo("mnode:%d, start to drop", dropReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_MNODE) != 0) {
goto _OVER;
}
@@ -732,7 +732,7 @@ static int32_t mndProcessAlterMnodeReq(SRpcMsg *pReq) {
}
}
- mTrace("trans:-1, sync reconfig will be proposed");
+ mInfo("trans:-1, sync reconfig will be proposed");
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
pMgmt->standby = 0;
diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c
index e55c562e38c207600956cd1eafbb88d744750f7d..e8737e30c9817bd71d1b3a47f245ef0004603dc3 100644
--- a/source/dnode/mnode/impl/src/mndProfile.c
+++ b/source/dnode/mnode/impl/src/mndProfile.c
@@ -270,6 +270,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
SConnectRsp connectRsp = {0};
connectRsp.acctId = pUser->acctId;
connectRsp.superUser = pUser->superUser;
+ connectRsp.sysInfo = pUser->sysInfo;
connectRsp.clusterId = pMnode->clusterId;
connectRsp.connId = pConn->id;
connectRsp.connType = connReq.connType;
diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c
index 2fb934aaad735240e1a249447b5d041853819d82..8638cc511890066f45367253313aec8f626ceb8e 100644
--- a/source/dnode/mnode/impl/src/mndSma.c
+++ b/source/dnode/mnode/impl/src/mndSma.c
@@ -38,7 +38,6 @@ static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw);
static int32_t mndSmaActionInsert(SSdb *pSdb, SSmaObj *pSma);
static int32_t mndSmaActionDelete(SSdb *pSdb, SSmaObj *pSpSmatb);
static int32_t mndSmaActionUpdate(SSdb *pSdb, SSmaObj *pOld, SSmaObj *pNew);
-static int32_t mndSmaGetVgEpSet(SMnode *pMnode, SDbObj *pDb, SVgEpSet **ppVgEpSet, int32_t *numOfVgroups);
static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq);
static int32_t mndProcessDropSmaReq(SRpcMsg *pReq);
static int32_t mndProcessGetSmaReq(SRpcMsg *pReq);
@@ -841,6 +840,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
_OVER:
mndTransDrop(pTrans);
+ mndReleaseStream(pMnode, pStream);
mndReleaseVgroup(pMnode, pVgroup);
mndReleaseStb(pMnode, pStb);
return code;
@@ -961,6 +961,7 @@ _OVER:
mError("sma:%s, failed to drop since %s", dropReq.name, terrstr());
}
+ mndReleaseSma(pMnode, pSma);
mndReleaseDb(pMnode, pDb);
return code;
}
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index ebec3d5ea686c3a976adf5d4890f2a7eb7d8be82..81ede6de90305d6b825e52fb1b1977079b455a7b 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -1774,6 +1774,67 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i
return 0;
}
+int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char* dbFName, char* stbFName, void **pCont, int32_t *pLen) {
+ int32_t ret = -1;
+ SDbObj *pDb = mndAcquireDb(pMnode, dbFName);
+ if (NULL == pDb) {
+ return -1;
+ }
+
+ SStbObj *pObj = mndAcquireStb(pMnode, stbFName);
+ if (NULL == pObj) {
+ goto _OVER;
+ }
+
+ SEncoder ec = {0};
+ uint32_t contLen = 0;
+ SMCreateStbRsp stbRsp = {0};
+ SName name = {0};
+ tNameFromString(&name, pObj->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
+
+ stbRsp.pMeta = taosMemoryCalloc(1, sizeof(STableMetaRsp));
+ if (NULL == stbRsp.pMeta) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ goto _OVER;
+ }
+
+ ret = mndBuildStbSchemaImp(pDb, pObj, name.tname, stbRsp.pMeta);
+ if (ret) {
+ tFreeSMCreateStbRsp(&stbRsp);
+ goto _OVER;
+ }
+
+ tEncodeSize(tEncodeSMCreateStbRsp, &stbRsp, contLen, ret);
+ if (ret) {
+ tFreeSMCreateStbRsp(&stbRsp);
+ goto _OVER;
+ }
+
+ void *cont = taosMemoryMalloc(contLen);
+ tEncoderInit(&ec, cont, contLen);
+ tEncodeSMCreateStbRsp(&ec, &stbRsp);
+ tEncoderClear(&ec);
+
+ tFreeSMCreateStbRsp(&stbRsp);
+
+ *pCont = cont;
+ *pLen = contLen;
+
+ ret = 0;
+
+_OVER:
+ if (pObj) {
+ mndReleaseStb(pMnode, pObj);
+ }
+
+ if (pDb) {
+ mndReleaseDb(pMnode, pDb);
+ }
+
+ return ret;
+}
+
+
static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp,
void *alterOriData, int32_t alterOriDataLen) {
int32_t code = -1;
@@ -2157,6 +2218,10 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq) {
STableInfoReq infoReq = {0};
STableMetaRsp metaRsp = {0};
+ SUserObj *pUser = mndAcquireUser(pMnode, pReq->info.conn.user);
+ if (pUser == NULL) return 0;
+ bool sysinfo = pUser->sysInfo;
+
if (tDeserializeSTableInfoReq(pReq->pCont, pReq->contLen, &infoReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
goto _OVER;
@@ -2164,7 +2229,7 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq) {
if (0 == strcmp(infoReq.dbFName, TSDB_INFORMATION_SCHEMA_DB)) {
mDebug("information_schema table:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName);
- if (mndBuildInsTableSchema(pMnode, infoReq.dbFName, infoReq.tbName, &metaRsp) != 0) {
+ if (mndBuildInsTableSchema(pMnode, infoReq.dbFName, infoReq.tbName, sysinfo, &metaRsp) != 0) {
goto _OVER;
}
} else if (0 == strcmp(infoReq.dbFName, TSDB_PERFORMANCE_SCHEMA_DB)) {
@@ -2203,6 +2268,7 @@ _OVER:
mError("stb:%s.%s, failed to retrieve meta since %s", infoReq.dbFName, infoReq.tbName, terrstr());
}
+ mndReleaseUser(pMnode, pUser);
tFreeSTableMetaRsp(&metaRsp);
return code;
}
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 6dc8e2072b71df78aa88aecdd924a98db658ab05..dd7a9e71eaa634a5bda506b318c6c4472a48726b 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -631,6 +631,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
SStreamObj *pStream = NULL;
SDbObj *pDb = NULL;
SCMCreateStreamReq createStreamReq = {0};
+ SStreamObj streamObj = {0};
if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createStreamReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
@@ -659,7 +660,6 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
}
// build stream obj from request
- SStreamObj streamObj = {0};
if (mndBuildStreamObjFromCreateReq(pMnode, &streamObj, &createStreamReq) < 0) {
/*ASSERT(0);*/
mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr());
diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c
index 8e8cff853c7504ffeaced773db99d22fa44a3568..e8b75e6a94e1089b037be9ec42a4fdc9deef3b3c 100644
--- a/source/dnode/mnode/impl/src/mndSync.c
+++ b/source/dnode/mnode/impl/src/mndSync.c
@@ -50,7 +50,7 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
int32_t transId = sdbGetIdFromRaw(pMnode->pSdb, pRaw);
pMgmt->errCode = cbMeta.code;
- mDebug("trans:%d, is proposed, saved:%d code:0x%x, apply index:%" PRId64 " term:%" PRIu64 " config:%" PRId64
+ mInfo("trans:%d, is proposed, saved:%d code:0x%x, apply index:%" PRId64 " term:%" PRIu64 " config:%" PRId64
" role:%s raw:%p",
transId, pMgmt->transId, cbMeta.code, cbMeta.index, cbMeta.term, cbMeta.lastConfigIndex, syncStr(cbMeta.state),
pRaw);
@@ -88,7 +88,7 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
}
int32_t mndSyncGetSnapshot(struct SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pReaderParam, void **ppReader) {
- mDebug("start to read snapshot from sdb in atomic way");
+ mInfo("start to read snapshot from sdb in atomic way");
SMnode *pMnode = pFsm->data;
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, &pSnapshot->lastApplyIndex, &pSnapshot->lastApplyTerm,
&pSnapshot->lastConfigIndex);
@@ -136,13 +136,13 @@ void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta cbM
}
int32_t mndSnapshotStartRead(struct SSyncFSM *pFsm, void *pParam, void **ppReader) {
- mDebug("start to read snapshot from sdb");
+ mInfo("start to read snapshot from sdb");
SMnode *pMnode = pFsm->data;
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, NULL, NULL, NULL);
}
int32_t mndSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) {
- mDebug("stop to read snapshot from sdb");
+ mInfo("stop to read snapshot from sdb");
SMnode *pMnode = pFsm->data;
return sdbStopRead(pMnode->pSdb, pReader);
}
@@ -174,12 +174,12 @@ int32_t mndSnapshotDoWrite(struct SSyncFSM *pFsm, void *pWriter, void *pBuf, int
void mndLeaderTransfer(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
SMnode *pMnode = pFsm->data;
atomic_store_8(&(pMnode->syncMgmt.leaderTransferFinish), 1);
- mDebug("vgId:1, mnode leader transfer finish");
+ mInfo("vgId:1, mnode leader transfer finish");
}
static void mndBecomeFollower(struct SSyncFSM *pFsm) {
SMnode *pMnode = pFsm->data;
- mDebug("vgId:1, become follower and post sem");
+ mInfo("vgId:1, become follower and post sem");
taosWLockLatch(&pMnode->syncMgmt.lock);
if (pMnode->syncMgmt.transId != 0) {
@@ -190,7 +190,7 @@ static void mndBecomeFollower(struct SSyncFSM *pFsm) {
}
static void mndBecomeLeader(struct SSyncFSM *pFsm) {
- mDebug("vgId:1, become leader");
+ mInfo("vgId:1, become leader");
SMnode *pMnode = pFsm->data;
}
@@ -284,7 +284,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
return -1;
} else {
pMgmt->transId = transId;
- mDebug("trans:%d, will be proposed", pMgmt->transId);
+ mInfo("trans:%d, will be proposed", pMgmt->transId);
taosWUnLockLatch(&pMgmt->lock);
}
@@ -314,7 +314,7 @@ void mndSyncStart(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
syncSetMsgCb(pMgmt->sync, &pMnode->msgCb);
syncStart(pMgmt->sync);
- mDebug("mnode sync started, id:%" PRId64 " standby:%d", pMgmt->sync, pMgmt->standby);
+ mInfo("mnode sync started, id:%" PRId64 " standby:%d", pMgmt->sync, pMgmt->standby);
}
void mndSyncStop(SMnode *pMnode) {
diff --git a/source/dnode/mnode/impl/src/mndTelem.c b/source/dnode/mnode/impl/src/mndTelem.c
index 27814fe5bea155c54fa32789efbaf2ae30cdb29b..93f7531a272860d63351ff1a008fa11f48b5a17c 100644
--- a/source/dnode/mnode/impl/src/mndTelem.c
+++ b/source/dnode/mnode/impl/src/mndTelem.c
@@ -131,7 +131,9 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) {
char* pCont = mndBuildTelemetryReport(pMnode);
if (pCont != NULL) {
if (taosSendHttpReport(tsTelemServer, tsTelemPort, pCont, strlen(pCont), HTTP_FLAT) != 0) {
- mError("failed to send telemetry msg");
+ mError("failed to send telemetry report");
+ } else {
+ mTrace("succeed to send telemetry report");
}
taosMemoryFree(pCont);
}
diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c
index 17b4336465c23c49e71adde85a8b5291124c4f43..9c4a5afb032e6677997b7a84e919451b238b2068 100644
--- a/source/dnode/mnode/impl/src/mndTrans.c
+++ b/source/dnode/mnode/impl/src/mndTrans.c
@@ -17,6 +17,7 @@
#include "mndTrans.h"
#include "mndConsumer.h"
#include "mndDb.h"
+#include "mndStb.h"
#include "mndPrivilege.h"
#include "mndShow.h"
#include "mndSync.h"
@@ -455,11 +456,11 @@ static const char *mndTransStr(ETrnStage stage) {
}
static void mndTransTestStartFunc(SMnode *pMnode, void *param, int32_t paramLen) {
- mDebug("test trans start, param:%s, len:%d", (char *)param, paramLen);
+ mInfo("test trans start, param:%s, len:%d", (char *)param, paramLen);
}
static void mndTransTestStopFunc(SMnode *pMnode, void *param, int32_t paramLen) {
- mDebug("test trans stop, param:%s, len:%d", (char *)param, paramLen);
+ mInfo("test trans stop, param:%s, len:%d", (char *)param, paramLen);
}
static TransCbFp mndTransGetCbFp(ETrnFunc ftype) {
@@ -706,7 +707,7 @@ int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, c
if (pTrans->oper == oper) {
if (strcasecmp(dbname, pTrans->dbname1) == 0) {
- mDebug("trans:%d, db:%s oper:%d matched with input", pTrans->id, dbname, oper);
+ mInfo("trans:%d, db:%s oper:%d matched with input", pTrans->id, dbname, oper);
if (pTrans->pRpcArray == NULL) {
pTrans->pRpcArray = taosArrayInit(1, sizeof(SRpcHandleInfo));
}
@@ -745,7 +746,7 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
}
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- mDebug("trans:%d, sync to other mnodes, stage:%s", pTrans->id, mndTransStr(pTrans->stage));
+ mInfo("trans:%d, sync to other mnodes, stage:%s", pTrans->id, mndTransStr(pTrans->stage));
int32_t code = mndSyncPropose(pMnode, pRaw, pTrans->id);
if (code != 0) {
mError("trans:%d, failed to sync since %s", pTrans->id, terrstr());
@@ -754,7 +755,7 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
}
sdbFreeRaw(pRaw);
- mDebug("trans:%d, sync finished", pTrans->id);
+ mInfo("trans:%d, sync finished", pTrans->id);
return 0;
}
@@ -820,12 +821,12 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
return -1;
}
- mDebug("trans:%d, prepare transaction", pTrans->id);
+ mInfo("trans:%d, prepare transaction", pTrans->id);
if (mndTransSync(pMnode, pTrans) != 0) {
mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
return -1;
}
- mDebug("trans:%d, prepare finished", pTrans->id);
+ mInfo("trans:%d, prepare finished", pTrans->id);
STrans *pNew = mndAcquireTrans(pMnode, pTrans->id);
if (pNew == NULL) {
@@ -846,22 +847,22 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
}
static int32_t mndTransCommit(SMnode *pMnode, STrans *pTrans) {
- mDebug("trans:%d, commit transaction", pTrans->id);
+ mInfo("trans:%d, commit transaction", pTrans->id);
if (mndTransSync(pMnode, pTrans) != 0) {
mError("trans:%d, failed to commit since %s", pTrans->id, terrstr());
return -1;
}
- mDebug("trans:%d, commit finished", pTrans->id);
+ mInfo("trans:%d, commit finished", pTrans->id);
return 0;
}
static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) {
- mDebug("trans:%d, rollback transaction", pTrans->id);
+ mInfo("trans:%d, rollback transaction", pTrans->id);
if (mndTransSync(pMnode, pTrans) != 0) {
mError("trans:%d, failed to rollback since %s", pTrans->id, terrstr());
return -1;
}
- mDebug("trans:%d, rollback finished", pTrans->id);
+ mInfo("trans:%d, rollback finished", pTrans->id);
return 0;
}
@@ -893,30 +894,21 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
for (int32_t i = 0; i < size; ++i) {
SRpcHandleInfo *pInfo = taosArrayGet(pTrans->pRpcArray, i);
if (pInfo->handle != NULL) {
- mDebug("trans:%d, send rsp, code:0x%x stage:%s app:%p", pTrans->id, code, mndTransStr(pTrans->stage),
+ mInfo("trans:%d, send rsp, code:0x%x stage:%s app:%p", pTrans->id, code, mndTransStr(pTrans->stage),
pInfo->ahandle);
if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL;
}
SRpcMsg rspMsg = {.code = code, .info = *pInfo};
- if (pTrans->rpcRspLen != 0) {
- void *rpcCont = rpcMallocCont(pTrans->rpcRspLen);
- if (rpcCont != NULL) {
- memcpy(rpcCont, pTrans->rpcRsp, pTrans->rpcRspLen);
- rspMsg.pCont = rpcCont;
- rspMsg.contLen = pTrans->rpcRspLen;
- }
- }
-
if (pTrans->originRpcType == TDMT_MND_CREATE_DB) {
- mDebug("trans:%d, origin msgtype:%s", pTrans->id, TMSG_INFO(pTrans->originRpcType));
+ mInfo("trans:%d, origin msgtype:%s", pTrans->id, TMSG_INFO(pTrans->originRpcType));
SDbObj *pDb = mndAcquireDb(pMnode, pTrans->dbname1);
if (pDb != NULL) {
for (int32_t j = 0; j < 12; j++) {
bool ready = mndIsDbReady(pMnode, pDb);
if (!ready) {
- mDebug("trans:%d, db:%s not ready yet, wait %d times", pTrans->id, pTrans->dbname1, j);
+ mInfo("trans:%d, db:%s not ready yet, wait %d times", pTrans->id, pTrans->dbname1, j);
taosMsleep(1000);
} else {
break;
@@ -924,6 +916,21 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
}
}
mndReleaseDb(pMnode, pDb);
+ } else if (pTrans->originRpcType == TDMT_MND_CREATE_STB) {
+ void *pCont = NULL;
+ int32_t contLen = 0;
+ if (0 == mndBuildSMCreateStbRsp(pMnode, pTrans->dbname1, pTrans->dbname2, &pCont, &contLen) != 0) {
+ mndTransSetRpcRsp(pTrans, pCont, contLen);
+ }
+ }
+
+ if (pTrans->rpcRspLen != 0) {
+ void *rpcCont = rpcMallocCont(pTrans->rpcRspLen);
+ if (rpcCont != NULL) {
+ memcpy(rpcCont, pTrans->rpcRsp, pTrans->rpcRspLen);
+ rspMsg.pCont = rpcCont;
+ rspMsg.contLen = pTrans->rpcRspLen;
+ }
}
tmsgSendRsp(&rspMsg);
@@ -971,7 +978,7 @@ int32_t mndTransProcessRsp(SRpcMsg *pRsp) {
pAction->errCode = pRsp->code;
}
- mDebug("trans:%d, %s:%d response is received, code:0x%x, accept:0x%x retry:0x%x", transId,
+ mInfo("trans:%d, %s:%d response is received, code:0x%x, accept:0x%x retry:0x%x", transId,
mndTransStr(pAction->stage), action, pRsp->code, pAction->acceptableCode, pAction->retryCode);
mndTransExecute(pMnode, pTrans);
@@ -987,10 +994,10 @@ static void mndTransResetAction(SMnode *pMnode, STrans *pTrans, STransAction *pA
if (pAction->errCode == TSDB_CODE_RPC_REDIRECT || pAction->errCode == TSDB_CODE_SYN_NEW_CONFIG_ERROR ||
pAction->errCode == TSDB_CODE_SYN_INTERNAL_ERROR || pAction->errCode == TSDB_CODE_SYN_NOT_LEADER) {
pAction->epSet.inUse = (pAction->epSet.inUse + 1) % pAction->epSet.numOfEps;
- mDebug("trans:%d, %s:%d execute status is reset and set epset inuse:%d", pTrans->id, mndTransStr(pAction->stage),
+ mInfo("trans:%d, %s:%d execute status is reset and set epset inuse:%d", pTrans->id, mndTransStr(pAction->stage),
pAction->id, pAction->epSet.inUse);
} else {
- mDebug("trans:%d, %s:%d execute status is reset", pTrans->id, mndTransStr(pAction->stage), pAction->id);
+ mInfo("trans:%d, %s:%d execute status is reset", pTrans->id, mndTransStr(pAction->stage), pAction->id);
}
pAction->errCode = 0;
}
@@ -1017,7 +1024,7 @@ static int32_t mndTransWriteSingleLog(SMnode *pMnode, STrans *pTrans, STransActi
pAction->rawWritten = true;
pAction->errCode = 0;
code = 0;
- mDebug("trans:%d, %s:%d write to sdb, type:%s status:%s", pTrans->id, mndTransStr(pAction->stage), pAction->id,
+ mInfo("trans:%d, %s:%d write to sdb, type:%s status:%s", pTrans->id, mndTransStr(pAction->stage), pAction->id,
sdbTableName(pAction->pRaw->type), sdbStatusName(pAction->pRaw->status));
pTrans->lastAction = pAction->id;
@@ -1066,7 +1073,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
pAction->msgSent = 1;
pAction->msgReceived = 0;
pAction->errCode = 0;
- mDebug("trans:%d, %s:%d is sent, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, detail);
+ mInfo("trans:%d, %s:%d is sent, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, detail);
pTrans->lastAction = pAction->id;
pTrans->lastMsgType = pAction->msgType;
@@ -1093,7 +1100,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
static int32_t mndTransExecNullMsg(SMnode *pMnode, STrans *pTrans, STransAction *pAction) {
pAction->rawWritten = 0;
pAction->errCode = 0;
- mDebug("trans:%d, %s:%d confirm action executed", pTrans->id, mndTransStr(pAction->stage), pAction->id);
+ mInfo("trans:%d, %s:%d confirm action executed", pTrans->id, mndTransStr(pAction->stage), pAction->id);
pTrans->lastAction = pAction->id;
pTrans->lastMsgType = pAction->msgType;
@@ -1153,7 +1160,7 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
pTrans->lastMsgType = 0;
memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset));
pTrans->lastErrorNo = 0;
- mDebug("trans:%d, all %d actions execute successfully", pTrans->id, numOfActions);
+ mInfo("trans:%d, all %d actions execute successfully", pTrans->id, numOfActions);
return 0;
} else {
mError("trans:%d, all %d actions executed, code:0x%x", pTrans->id, numOfActions, errCode & 0XFFFF);
@@ -1168,7 +1175,7 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
return errCode;
}
} else {
- mDebug("trans:%d, %d of %d actions executed", pTrans->id, numOfExecuted, numOfActions);
+ mInfo("trans:%d, %d of %d actions executed", pTrans->id, numOfExecuted, numOfActions);
return TSDB_CODE_ACTION_IN_PROGRESS;
}
}
@@ -1214,7 +1221,7 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
code = pAction->errCode;
mndTransResetAction(pMnode, pTrans, pAction);
} else {
- mDebug("trans:%d, %s:%d execute successfully", pTrans->id, mndTransStr(pAction->stage), action);
+ mInfo("trans:%d, %s:%d execute successfully", pTrans->id, mndTransStr(pAction->stage), action);
}
} else {
code = TSDB_CODE_ACTION_IN_PROGRESS;
@@ -1223,7 +1230,7 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
if (pAction->errCode != 0 && pAction->errCode != pAction->acceptableCode) {
code = pAction->errCode;
} else {
- mDebug("trans:%d, %s:%d write successfully", pTrans->id, mndTransStr(pAction->stage), action);
+ mInfo("trans:%d, %s:%d write successfully", pTrans->id, mndTransStr(pAction->stage), action);
}
} else {
}
@@ -1247,7 +1254,7 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
if (code == 0) {
pTrans->code = 0;
pTrans->redoActionPos++;
- mDebug("trans:%d, %s:%d is executed and need sync to other mnodes", pTrans->id, mndTransStr(pAction->stage),
+ mInfo("trans:%d, %s:%d is executed and need sync to other mnodes", pTrans->id, mndTransStr(pAction->stage),
pAction->id);
code = mndTransSync(pMnode, pTrans);
if (code != 0) {
@@ -1256,17 +1263,17 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
mndTransStr(pAction->stage), pAction->id, terrstr());
}
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) {
- mDebug("trans:%d, %s:%d is in progress and wait it finish", pTrans->id, mndTransStr(pAction->stage), pAction->id);
+ mInfo("trans:%d, %s:%d is in progress and wait it finish", pTrans->id, mndTransStr(pAction->stage), pAction->id);
break;
} else if (code == pAction->retryCode) {
- mDebug("trans:%d, %s:%d receive code:0x%x and retry", pTrans->id, mndTransStr(pAction->stage), pAction->id, code);
+ mInfo("trans:%d, %s:%d receive code:0x%x and retry", pTrans->id, mndTransStr(pAction->stage), pAction->id, code);
taosMsleep(300);
action--;
continue;
} else {
terrno = code;
pTrans->code = code;
- mDebug("trans:%d, %s:%d receive code:0x%x and wait another schedule, failedTimes:%d", pTrans->id,
+ mInfo("trans:%d, %s:%d receive code:0x%x and wait another schedule, failedTimes:%d", pTrans->id,
mndTransStr(pAction->stage), pAction->id, code, pTrans->failedTimes);
break;
}
@@ -1278,7 +1285,7 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
static bool mndTransPerformPrepareStage(SMnode *pMnode, STrans *pTrans) {
bool continueExec = true;
pTrans->stage = TRN_STAGE_REDO_ACTION;
- mDebug("trans:%d, stage from prepare to redoAction", pTrans->id);
+ mInfo("trans:%d, stage from prepare to redoAction", pTrans->id);
return continueExec;
}
@@ -1297,10 +1304,10 @@ static bool mndTransPerformRedoActionStage(SMnode *pMnode, STrans *pTrans) {
if (code == 0) {
pTrans->code = 0;
pTrans->stage = TRN_STAGE_COMMIT;
- mDebug("trans:%d, stage from redoAction to commit", pTrans->id);
+ mInfo("trans:%d, stage from redoAction to commit", pTrans->id);
continueExec = true;
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) {
- mDebug("trans:%d, stage keep on redoAction since %s", pTrans->id, tstrerror(code));
+ mInfo("trans:%d, stage keep on redoAction since %s", pTrans->id, tstrerror(code));
continueExec = false;
} else {
pTrans->failedTimes++;
@@ -1308,7 +1315,7 @@ static bool mndTransPerformRedoActionStage(SMnode *pMnode, STrans *pTrans) {
if (pTrans->policy == TRN_POLICY_ROLLBACK) {
if (pTrans->lastAction != 0) {
STransAction *pAction = taosArrayGet(pTrans->redoActions, pTrans->lastAction);
- if (pAction->retryCode != 0 && pAction->retryCode != pAction->errCode) {
+ if (pAction->retryCode != 0 && pAction->retryCode == pAction->errCode) {
if (pTrans->failedTimes < 6) {
mError("trans:%d, stage keep on redoAction since action:%d code:0x%x not 0x%x, failedTimes:%d", pTrans->id,
pTrans->lastAction, pTrans->code, pAction->retryCode, pTrans->failedTimes);
@@ -1340,7 +1347,7 @@ static bool mndTransPerformCommitStage(SMnode *pMnode, STrans *pTrans) {
if (code == 0) {
pTrans->code = 0;
pTrans->stage = TRN_STAGE_COMMIT_ACTION;
- mDebug("trans:%d, stage from commit to commitAction", pTrans->id);
+ mInfo("trans:%d, stage from commit to commitAction", pTrans->id);
continueExec = true;
} else {
pTrans->code = terrno;
@@ -1359,7 +1366,7 @@ static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans) {
if (code == 0) {
pTrans->code = 0;
pTrans->stage = TRN_STAGE_FINISHED;
- mDebug("trans:%d, stage from commitAction to finished", pTrans->id);
+ mInfo("trans:%d, stage from commitAction to finished", pTrans->id);
continueExec = true;
} else {
pTrans->code = terrno;
@@ -1377,10 +1384,10 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) {
if (code == 0) {
pTrans->stage = TRN_STAGE_FINISHED;
- mDebug("trans:%d, stage from undoAction to finished", pTrans->id);
+ mInfo("trans:%d, stage from undoAction to finished", pTrans->id);
continueExec = true;
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) {
- mDebug("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code));
+ mInfo("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code));
continueExec = false;
} else {
pTrans->failedTimes++;
@@ -1399,7 +1406,7 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) {
if (code == 0) {
pTrans->stage = TRN_STAGE_UNDO_ACTION;
- mDebug("trans:%d, stage from rollback to undoAction", pTrans->id);
+ mInfo("trans:%d, stage from rollback to undoAction", pTrans->id);
continueExec = true;
} else {
pTrans->failedTimes++;
@@ -1424,7 +1431,7 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
mError("trans:%d, failed to write sdb since %s", pTrans->id, terrstr());
}
- mDebug("trans:%d, execute finished, code:0x%x, failedTimes:%d", pTrans->id, pTrans->code, pTrans->failedTimes);
+ mInfo("trans:%d, execute finished, code:0x%x, failedTimes:%d", pTrans->id, pTrans->code, pTrans->failedTimes);
return continueExec;
}
@@ -1432,7 +1439,7 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
bool continueExec = true;
while (continueExec) {
- mDebug("trans:%d, continue to execute, stage:%s", pTrans->id, mndTransStr(pTrans->stage));
+ mInfo("trans:%d, continue to execute, stage:%s", pTrans->id, mndTransStr(pTrans->stage));
pTrans->lastExecTime = taosGetTimestampMs();
switch (pTrans->stage) {
case TRN_STAGE_PREPARE:
diff --git a/source/dnode/mnode/impl/test/sma/CMakeLists.txt b/source/dnode/mnode/impl/test/sma/CMakeLists.txt
index 3f9ec123a80e88371a98fa54c99342726831372d..a55b45ca11d32f4aa0baa2462007f06e970ae3d6 100644
--- a/source/dnode/mnode/impl/test/sma/CMakeLists.txt
+++ b/source/dnode/mnode/impl/test/sma/CMakeLists.txt
@@ -5,7 +5,9 @@ target_link_libraries(
PUBLIC sut
)
-add_test(
- NAME smaTest
- COMMAND smaTest
-)
+if(NOT ${TD_WINDOWS})
+ add_test(
+ NAME smaTest
+ COMMAND smaTest
+ )
+endif(NOT ${TD_WINDOWS})
diff --git a/source/dnode/mnode/impl/test/stb/CMakeLists.txt b/source/dnode/mnode/impl/test/stb/CMakeLists.txt
index dcfbe658fcca82f928400b1e9eed2efcfb09a052..e3a3fc2e793fa84a5da05519ae727bb572edaa27 100644
--- a/source/dnode/mnode/impl/test/stb/CMakeLists.txt
+++ b/source/dnode/mnode/impl/test/stb/CMakeLists.txt
@@ -5,7 +5,9 @@ target_link_libraries(
PUBLIC sut
)
-add_test(
- NAME stbTest
- COMMAND stbTest
-)
\ No newline at end of file
+if(NOT ${TD_WINDOWS})
+ add_test(
+ NAME stbTest
+ COMMAND stbTest
+ )
+endif(NOT ${TD_WINDOWS})
\ No newline at end of file
diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h
index ec27ba8ce659e454b768945aca50fb071d4e7b4f..7c58734b35421b17459568db849f34b7cc656d50 100644
--- a/source/dnode/vnode/inc/vnode.h
+++ b/source/dnode/vnode/inc/vnode.h
@@ -63,7 +63,7 @@ void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId);
int32_t vnodeProcessCreateTSma(SVnode *pVnode, void *pCont, uint32_t contLen);
int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list);
int32_t vnodeGetCtbIdList(SVnode *pVnode, int64_t suid, SArray *list);
-int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray* list);
+int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list);
void *vnodeGetIdx(SVnode *pVnode);
void *vnodeGetIvtIdx(SVnode *pVnode);
@@ -96,7 +96,7 @@ int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SHash
int32_t metaReadNext(SMetaReader *pReader);
const void *metaGetTableTagVal(void *tag, int16_t type, STagVal *tagVal);
int metaGetTableNameByUid(void *meta, uint64_t uid, char *tbName);
-bool metaIsTableExist(SMeta *pMeta, tb_uid_t uid);
+bool metaIsTableExist(SMeta *pMeta, tb_uid_t uid);
typedef struct SMetaFltParam {
tb_uid_t suid;
@@ -128,8 +128,10 @@ typedef struct STsdbReader STsdbReader;
#define TIMEWINDOW_RANGE_CONTAINED 1
#define TIMEWINDOW_RANGE_EXTERNAL 2
-#define LASTROW_RETRIEVE_TYPE_ALL 0x1
-#define LASTROW_RETRIEVE_TYPE_SINGLE 0x2
+#define CACHESCAN_RETRIEVE_TYPE_ALL 0x1
+#define CACHESCAN_RETRIEVE_TYPE_SINGLE 0x2
+#define CACHESCAN_RETRIEVE_LAST_ROW 0x4
+#define CACHESCAN_RETRIEVE_LAST 0x8
int32_t tsdbSetTableId(STsdbReader *pReader, int64_t uid);
int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, SArray *pTableList, STsdbReader **ppReader,
@@ -146,9 +148,9 @@ void *tsdbGetIdx(SMeta *pMeta);
void *tsdbGetIvtIdx(SMeta *pMeta);
uint64_t getReaderMaxVersion(STsdbReader *pReader);
-int32_t tsdbLastRowReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t numOfCols, void **pReader);
-int32_t tsdbRetrieveLastRow(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray *pTableUids);
-int32_t tsdbLastrowReaderClose(void *pReader);
+int32_t tsdbCacherowsReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t numOfCols, void **pReader);
+int32_t tsdbRetrieveCacheRows(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray *pTableUids);
+int32_t tsdbCacherowsReaderClose(void *pReader);
int32_t tsdbGetTableSchema(SVnode *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid);
void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity);
@@ -224,6 +226,7 @@ typedef struct {
int64_t numOfSTables;
int64_t numOfCTables;
int64_t numOfNTables;
+ int64_t numOfNTimeSeries;
int64_t numOfTimeSeries;
int64_t pointsWritten;
int64_t totalStorage;
diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h
index ca77042bb26d72f87471e4ac80329efc92449427..abfffc045f3ba5abeac1d171e0751bfeeadcb1cb 100644
--- a/source/dnode/vnode/src/inc/sma.h
+++ b/source/dnode/vnode/src/inc/sma.h
@@ -33,7 +33,6 @@ extern "C" {
// clang-format on
#define RSMA_TASK_INFO_HASH_SLOT (8)
-#define RSMA_EXECUTOR_MAX (1)
typedef struct SSmaEnv SSmaEnv;
typedef struct SSmaStat SSmaStat;
@@ -49,9 +48,12 @@ typedef struct SQTaskFWriter SQTaskFWriter;
struct SSmaEnv {
SRWLatch lock;
int8_t type;
+ int8_t flag; // 0x01 inClose
SSmaStat *pStat;
};
+#define SMA_ENV_FLG_CLOSE ((int8_t)0x1)
+
typedef struct {
int8_t inited;
int32_t rsetId;
@@ -93,7 +95,6 @@ struct SRSmaStat {
int64_t refId; // shared by fetch tasks
volatile int64_t nBufItems; // number of items in queue buffer
SRWLatch lock; // r/w lock for rsma fs(e.g. qtaskinfo)
- volatile int8_t nExecutor; // [1, max(half of query threads, 4)]
int8_t triggerStat; // shared by fetch tasks
int8_t commitStat; // 0 not in committing, 1 in committing
SArray *aTaskFile; // qTaskFiles committed recently(for recovery/snapshot r/w)
@@ -107,6 +108,7 @@ struct SSmaStat {
SRSmaStat rsmaStat; // rollup sma
};
T_REF_DECLARE()
+ char data[];
};
#define SMA_STAT_TSMA(s) (&(s)->tsmaStat)
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 39c5f3873ed9884109c0dc28f66d314b12b83a99..9b252df58b2a87c4baf8453ad597d62e50b61a33 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -102,7 +102,7 @@ int metaCommit(SMeta* pMeta);
int metaCreateSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq);
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);
+int metaCreateTable(SMeta* pMeta, int64_t version, SVCreateTbReq* pReq, STableMetaRsp **pMetaRsp);
int metaDropTable(SMeta* pMeta, int64_t version, SVDropTbReq* pReq, SArray* tbUids);
int metaTtlDropTable(SMeta* pMeta, int64_t ttl, SArray* tbUids);
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
@@ -189,7 +189,6 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
int32_t smaInit();
void smaCleanUp();
int32_t smaOpen(SVnode* pVnode);
-int32_t smaPreClose(SSma* pSma);
int32_t smaClose(SSma* pSma);
int32_t smaBegin(SSma* pSma);
int32_t smaSyncPreCommit(SSma* pSma);
@@ -199,7 +198,6 @@ int32_t smaAsyncPreCommit(SSma* pSma);
int32_t smaAsyncCommit(SSma* pSma);
int32_t smaAsyncPostCommit(SSma* pSma);
int32_t smaDoRetention(SSma* pSma, int64_t now);
-int32_t smaProcessExec(SSma* pSma, void* pMsg);
int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg);
int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg);
@@ -323,7 +321,6 @@ struct SVnode {
TdThreadMutex lock;
bool blocked;
bool restored;
- bool inClose;
tsem_t syncSem;
SQHandle* pQuery;
};
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index 805bc24d8c2824cb8e5e95df03c8b4b65ce25d6d..04e4c52c49d00df4c076b7488a09ff4ed83094ca 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -619,7 +619,7 @@ int64_t metaGetTimeSeriesNum(SMeta *pMeta) {
vnodeGetTimeSeriesNum(pMeta->pVnode, &num);
pMeta->pVnode->config.vndStats.numOfTimeSeries = num;
- return pMeta->pVnode->config.vndStats.numOfTimeSeries;
+ return pMeta->pVnode->config.vndStats.numOfTimeSeries + pMeta->pVnode->config.vndStats.numOfNTimeSeries;
}
typedef struct {
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index aa107ab2532b83b40abe8b1abdc60e059ab1de34..fef0ff49ac88adf1ea6452a53308cd33258c15e8 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -367,7 +367,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
return 0;
}
-int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
+int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq, STableMetaRsp **pMetaRsp) {
SMetaEntry me = {0};
SMetaReader mr = {0};
@@ -423,10 +423,26 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
me.ntbEntry.ncid = me.ntbEntry.schemaRow.pSchema[me.ntbEntry.schemaRow.nCols - 1].colId + 1;
++pMeta->pVnode->config.vndStats.numOfNTables;
+ pMeta->pVnode->config.vndStats.numOfNTimeSeries += me.ntbEntry.schemaRow.nCols - 1;
}
if (metaHandleEntry(pMeta, &me) < 0) goto _err;
+ if (pMetaRsp) {
+ *pMetaRsp = taosMemoryCalloc(1, sizeof(STableMetaRsp));
+
+ if (*pMetaRsp) {
+ if (me.type == TSDB_CHILD_TABLE) {
+ (*pMetaRsp)->tableType = TSDB_CHILD_TABLE;
+ (*pMetaRsp)->tuid = pReq->uid;
+ (*pMetaRsp)->suid = pReq->ctb.suid;
+ strcpy((*pMetaRsp)->tbName, pReq->name);
+ } else {
+ metaUpdateMetaRsp(pReq->uid, pReq->name, &pReq->ntb.schemaRow, *pMetaRsp);
+ }
+ }
+ }
+
metaDebug("vgId:%d, table:%s uid %" PRId64 " is created, type:%" PRId8, TD_VID(pMeta->pVnode), pReq->name, pReq->uid,
pReq->type);
return 0;
@@ -516,6 +532,9 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
SDecoder dc = {0};
rc = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData);
+ if (rc < 0) {
+ return -1;
+ }
int64_t version = ((SUidIdxVal *)pData)[0].version;
tdbTbGet(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pData, &nData);
@@ -562,6 +581,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
// drop schema.db (todo)
--pMeta->pVnode->config.vndStats.numOfNTables;
+ pMeta->pVnode->config.vndStats.numOfNTimeSeries -= e.ntbEntry.schemaRow.nCols - 1;
} else if (e.type == TSDB_SUPER_TABLE) {
tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), &pMeta->txn);
// drop schema.db (todo)
@@ -664,6 +684,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1].flags = pAlterTbReq->flags;
pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1].colId = entry.ntbEntry.ncid++;
strcpy(pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1].name, pAlterTbReq->colName);
+
+ ++pMeta->pVnode->config.vndStats.numOfNTimeSeries;
break;
case TSDB_ALTER_TABLE_DROP_COLUMN:
if (pColumn == NULL) {
@@ -684,6 +706,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
memmove(pColumn, pColumn + 1, tlen);
}
pSchema->nCols--;
+
+ --pMeta->pVnode->config.vndStats.numOfNTimeSeries;
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
if (pColumn == NULL) {
diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c
index e3b83f9955faf7a8000d18974cb6ec3639948c47..32a419022a312f9ab21681b9bc6f819c7792f51e 100644
--- a/source/dnode/vnode/src/sma/smaEnv.c
+++ b/source/dnode/vnode/src/sma/smaEnv.c
@@ -23,11 +23,13 @@ extern SSmaMgmt smaMgmt;
// declaration of static functions
-static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pSma);
-static SSmaEnv *tdNewSmaEnv(const SSma *pSma, int8_t smaType, const char *path);
-static int32_t tdInitSmaEnv(SSma *pSma, int8_t smaType, const char *path, SSmaEnv **pEnv);
-static void *tdFreeTSmaStat(STSmaStat *pStat);
-static void tdDestroyRSmaStat(void *pRSmaStat);
+static int32_t tdNewSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv);
+static int32_t tdInitSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv);
+static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pSma);
+static int32_t tdRsmaStartExecutor(const SSma *pSma);
+static int32_t tdRsmaStopExecutor(const SSma *pSma);
+static void *tdFreeTSmaStat(STSmaStat *pStat);
+static void tdDestroyRSmaStat(void *pRSmaStat);
/**
* @brief rsma init
@@ -97,35 +99,42 @@ void smaCleanUp() {
}
}
-static SSmaEnv *tdNewSmaEnv(const SSma *pSma, int8_t smaType, const char *path) {
+static int32_t tdNewSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv) {
SSmaEnv *pEnv = NULL;
pEnv = (SSmaEnv *)taosMemoryCalloc(1, sizeof(SSmaEnv));
+ *ppEnv = pEnv;
if (!pEnv) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- return NULL;
+ return TSDB_CODE_FAILED;
}
SMA_ENV_TYPE(pEnv) = smaType;
taosInitRWLatch(&(pEnv->lock));
+ (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_store_ptr(&SMA_TSMA_ENV(pSma), *ppEnv)
+ : atomic_store_ptr(&SMA_RSMA_ENV(pSma), *ppEnv);
+
if (tdInitSmaStat(&SMA_ENV_STAT(pEnv), smaType, pSma) != TSDB_CODE_SUCCESS) {
tdFreeSmaEnv(pEnv);
- return NULL;
+ *ppEnv = NULL;
+ (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_store_ptr(&SMA_TSMA_ENV(pSma), NULL)
+ : atomic_store_ptr(&SMA_RSMA_ENV(pSma), NULL);
+ return TSDB_CODE_FAILED;
}
- return pEnv;
+ return TSDB_CODE_SUCCESS;
}
-static int32_t tdInitSmaEnv(SSma *pSma, int8_t smaType, const char *path, SSmaEnv **pEnv) {
- if (!pEnv) {
+static int32_t tdInitSmaEnv(SSma *pSma, int8_t smaType, SSmaEnv **ppEnv) {
+ if (!ppEnv) {
terrno = TSDB_CODE_INVALID_PTR;
return TSDB_CODE_FAILED;
}
- if (!(*pEnv)) {
- if (!(*pEnv = tdNewSmaEnv(pSma, smaType, path))) {
+ if (!(*ppEnv)) {
+ if (tdNewSmaEnv(pSma, smaType, ppEnv) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_FAILED;
}
}
@@ -199,7 +208,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
* tdInitSmaStat invoked in other multithread environment later.
*/
if (!(*pSmaStat)) {
- *pSmaStat = (SSmaStat *)taosMemoryCalloc(1, sizeof(SSmaStat));
+ *pSmaStat = (SSmaStat *)taosMemoryCalloc(1, sizeof(SSmaStat) + sizeof(TdThread) * tsNumOfVnodeRsmaThreads);
if (!(*pSmaStat)) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return TSDB_CODE_FAILED;
@@ -231,6 +240,10 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
if (!RSMA_INFO_HASH(pRSmaStat)) {
return TSDB_CODE_FAILED;
}
+
+ if (tdRsmaStartExecutor(pSma) < 0) {
+ return TSDB_CODE_FAILED;
+ }
} else if (smaType == TSDB_SMA_TYPE_TIME_RANGE) {
// TODO
} else {
@@ -291,6 +304,9 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
}
}
+ // step 4:
+ tdRsmaStopExecutor(pSma);
+
// step 5: free pStat
taosMemoryFreeClear(pStat);
}
@@ -381,17 +397,70 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) {
pEnv = (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_load_ptr(&SMA_TSMA_ENV(pSma))
: atomic_load_ptr(&SMA_RSMA_ENV(pSma));
if (!pEnv) {
- char rname[TSDB_FILENAME_LEN] = {0};
-
- if (tdInitSmaEnv(pSma, smaType, rname, &pEnv) < 0) {
+ if (tdInitSmaEnv(pSma, smaType, &pEnv) < 0) {
tdUnLockSma(pSma);
return TSDB_CODE_FAILED;
}
-
- (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_store_ptr(&SMA_TSMA_ENV(pSma), pEnv)
- : atomic_store_ptr(&SMA_RSMA_ENV(pSma), pEnv);
}
tdUnLockSma(pSma);
return TSDB_CODE_SUCCESS;
};
+
+void *tdRSmaExecutorFunc(void *param) {
+ setThreadName("vnode-rsma");
+
+ tdRSmaProcessExecImpl((SSma *)param, RSMA_EXEC_OVERFLOW);
+ return NULL;
+}
+
+static int32_t tdRsmaStartExecutor(const SSma *pSma) {
+ TdThreadAttr thAttr = {0};
+ taosThreadAttrInit(&thAttr);
+ taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
+
+ SSmaEnv *pEnv = SMA_RSMA_ENV(pSma);
+ SSmaStat *pStat = SMA_ENV_STAT(pEnv);
+ TdThread *pthread = (TdThread *)&pStat->data;
+
+ for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) {
+ if (taosThreadCreate(&pthread[i], &thAttr, tdRSmaExecutorFunc, (void *)pSma) != 0) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ smaError("vgId:%d, failed to create pthread for rsma since %s", SMA_VID(pSma), terrstr());
+ return -1;
+ }
+ smaDebug("vgId:%d, success to create pthread for rsma", SMA_VID(pSma));
+ }
+
+ taosThreadAttrDestroy(&thAttr);
+ return 0;
+}
+
+static int32_t tdRsmaStopExecutor(const SSma *pSma) {
+ if (pSma && VND_IS_RSMA(pSma->pVnode)) {
+ SSmaEnv *pEnv = NULL;
+ SSmaStat *pStat = NULL;
+ SRSmaStat *pRSmaStat = NULL;
+ TdThread *pthread = NULL;
+
+ if (!(pEnv = SMA_RSMA_ENV(pSma)) || !(pStat = SMA_ENV_STAT(pEnv))) {
+ return 0;
+ }
+
+ pEnv->flag |= SMA_ENV_FLG_CLOSE;
+ pRSmaStat = (SRSmaStat *)pStat;
+ pthread = (TdThread *)&pStat->data;
+
+ for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) {
+ tsem_post(&(pRSmaStat->notEmpty));
+ }
+
+ for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) {
+ if (taosCheckPthreadValid(pthread[i])) {
+ smaDebug("vgId:%d, start to join pthread for rsma:%" PRId64, SMA_VID(pSma), pthread[i]);
+ taosThreadJoin(pthread[i], NULL);
+ }
+ }
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c
index e2710b26e3d3672aac1b8053b019aa0addd37920..235fb1f94161256721dcb1f87ad3a2cc6a3e98f8 100644
--- a/source/dnode/vnode/src/sma/smaOpen.c
+++ b/source/dnode/vnode/src/sma/smaOpen.c
@@ -146,20 +146,6 @@ int32_t smaClose(SSma *pSma) {
return 0;
}
-int32_t smaPreClose(SSma *pSma) {
- if (pSma && VND_IS_RSMA(pSma->pVnode)) {
- SSmaEnv *pEnv = NULL;
- SRSmaStat *pStat = NULL;
- if (!(pEnv = SMA_RSMA_ENV(pSma)) || !(pStat = (SRSmaStat *)SMA_ENV_STAT(pEnv))) {
- return 0;
- }
- for (int32_t i = 0; i < RSMA_EXECUTOR_MAX; ++i) {
- tsem_post(&(pStat->notEmpty));
- }
- }
- return 0;
-}
-
/**
* @brief rsma env restore
*
diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c
index 448b8ab50862cea44390b7b0c8cbc4d27d96c20c..426ab521fdd16e3d0907fd1c056da15d7d6937cc 100644
--- a/source/dnode/vnode/src/sma/smaRollup.c
+++ b/source/dnode/vnode/src/sma/smaRollup.c
@@ -621,7 +621,7 @@ static int32_t tdFetchSubmitReqSuids(SSubmitReq *pMsg, STbUidStore *pStore) {
*/
int32_t smaDoRetention(SSma *pSma, int64_t now) {
int32_t code = TSDB_CODE_SUCCESS;
- if (VND_IS_RSMA(pSma->pVnode)) {
+ if (!VND_IS_RSMA(pSma->pVnode)) {
return code;
}
@@ -734,10 +734,12 @@ static int32_t tdExecuteRSmaImplAsync(SSma *pSma, const void *pMsg, int32_t inpu
SRSmaStat *pRSmaStat = SMA_RSMA_STAT(pSma);
- tsem_post(&(pRSmaStat->notEmpty));
-
int64_t nItems = atomic_fetch_add_64(&pRSmaStat->nBufItems, 1);
+ if (atomic_load_8(&pInfo->assigned) == 0) {
+ tsem_post(&(pRSmaStat->notEmpty));
+ }
+
// smoothing consume
int32_t n = nItems / RSMA_QTASKEXEC_SMOOTH_SIZE;
if (n > 1) {
@@ -911,39 +913,6 @@ static int32_t tdExecuteRSmaAsync(SSma *pSma, const void *pMsg, int32_t inputTyp
return TSDB_CODE_SUCCESS;
}
-static int32_t tdRSmaExecCheck(SSma *pSma) {
- SRSmaStat *pRSmaStat = SMA_RSMA_STAT(pSma);
-
- if (atomic_load_8(&pRSmaStat->nExecutor) >= TMIN(RSMA_EXECUTOR_MAX, tsNumOfVnodeQueryThreads / 2)) {
- return TSDB_CODE_SUCCESS;
- }
-
- SRSmaExecMsg fetchMsg;
- int32_t contLen = sizeof(SMsgHead);
- void *pBuf = rpcMallocCont(0 + contLen);
-
- ((SMsgHead *)pBuf)->vgId = SMA_VID(pSma);
- ((SMsgHead *)pBuf)->contLen = sizeof(SMsgHead);
-
- SRpcMsg rpcMsg = {
- .code = 0,
- .msgType = TDMT_VND_EXEC_RSMA,
- .pCont = pBuf,
- .contLen = contLen,
- };
-
- if ((terrno = tmsgPutToQueue(&pSma->pVnode->msgCb, QUERY_QUEUE, &rpcMsg)) != 0) {
- smaError("vgId:%d, failed to put rsma exec msg into query-queue since %s", SMA_VID(pSma), terrstr());
- goto _err;
- }
-
- smaDebug("vgId:%d, success to put rsma fetch msg into query-queue", SMA_VID(pSma));
-
- return TSDB_CODE_SUCCESS;
-_err:
- return TSDB_CODE_FAILED;
-}
-
int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) {
SSmaEnv *pEnv = SMA_RSMA_ENV(pSma);
if (!pEnv) {
@@ -974,10 +943,6 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) {
goto _err;
}
}
-
- if (tdRSmaExecCheck(pSma) < 0) {
- goto _err;
- }
}
}
tdUidStoreDestory(&uidStore);
@@ -1563,7 +1528,9 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
ASSERT(qItem->level == pItem->level);
ASSERT(qItem->fetchLevel == pItem->fetchLevel);
#endif
- tsem_post(&(pStat->notEmpty));
+ if (atomic_load_8(&pRSmaInfo->assigned) == 0) {
+ tsem_post(&(pStat->notEmpty));
+ }
smaInfo("vgId:%d, rsma fetch task planned for level:%" PRIi8 " suid:%" PRIi64, SMA_VID(pSma), pItem->level,
pRSmaInfo->suid);
} break;
@@ -1591,9 +1558,11 @@ _end:
}
static void tdFreeRSmaSubmitItems(SArray *pItems) {
+ ASSERT(taosArrayGetSize(pItems) > 0);
for (int32_t i = 0; i < taosArrayGetSize(pItems); ++i) {
taosFreeQitem(*(void **)taosArrayGet(pItems, i));
}
+ taosArrayClear(pItems);
}
/**
@@ -1703,6 +1672,7 @@ _err:
* @param type
* @return int32_t
*/
+
int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
SVnode *pVnode = pSma->pVnode;
SSmaEnv *pEnv = SMA_RSMA_ENV(pSma);
@@ -1722,41 +1692,53 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
goto _err;
}
- bool isBusy = false;
while (true) {
- isBusy = false;
// step 1: rsma exec - consume data in buffer queue for all suids
if (type == RSMA_EXEC_OVERFLOW || type == RSMA_EXEC_COMMIT) {
- void *pIter = taosHashIterate(infoHash, NULL); // infoHash has r/w lock
- while (pIter) {
+ void *pIter = NULL;
+ while ((pIter = taosHashIterate(infoHash, pIter))) {
SRSmaInfo *pInfo = *(SRSmaInfo **)pIter;
- int64_t itemSize = 0;
- if ((itemSize = taosQueueItemSize(pInfo->queue)) || RSMA_INFO_ITEM(pInfo, 0)->fetchLevel ||
- RSMA_INFO_ITEM(pInfo, 1)->fetchLevel) {
- smaDebug("vgId:%d, queueItemSize is %" PRIi64 " execType:%" PRIi8, SMA_VID(pSma), itemSize, type);
- if (atomic_val_compare_exchange_8(&pInfo->assigned, 0, 1) == 0) {
- taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
- int32_t qallItemSize = taosQallItemSize(pInfo->qall);
- if (qallItemSize > 0) {
- tdRSmaBatchExec(pSma, pInfo, pInfo->qall, pSubmitArr, type);
- }
-
- if (type == RSMA_EXEC_OVERFLOW) {
- tdRSmaFetchAllResult(pSma, pInfo, pSubmitArr);
+ if (atomic_val_compare_exchange_8(&pInfo->assigned, 0, 1) == 0) {
+ if ((taosQueueItemSize(pInfo->queue) > 0) || RSMA_INFO_ITEM(pInfo, 0)->fetchLevel ||
+ RSMA_INFO_ITEM(pInfo, 1)->fetchLevel) {
+ int32_t batchCnt = -1;
+ int32_t batchMax = taosHashGetSize(infoHash) / tsNumOfVnodeRsmaThreads;
+ bool occupied = (batchMax <= 1);
+ if (batchMax > 1) {
+ batchMax = 100 / batchMax;
}
-
- if (qallItemSize > 0) {
- // subtract the item size after the task finished, commit should wait for all items be consumed
- atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize);
- isBusy = true;
+ while (occupied || (++batchCnt < batchMax)) { // greedy mode
+ taosReadAllQitems(pInfo->queue, pInfo->qall); // queue has mutex lock
+ int32_t qallItemSize = taosQallItemSize(pInfo->qall);
+ if (qallItemSize > 0) {
+ tdRSmaBatchExec(pSma, pInfo, pInfo->qall, pSubmitArr, type);
+ smaDebug("vgId:%d, batchSize:%d, execType:%" PRIi8, SMA_VID(pSma), qallItemSize, type);
+ }
+
+ if (type == RSMA_EXEC_OVERFLOW) {
+ tdRSmaFetchAllResult(pSma, pInfo, pSubmitArr);
+ }
+
+ if (qallItemSize > 0) {
+ atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize);
+ continue;
+ } else if (RSMA_INFO_ITEM(pInfo, 0)->fetchLevel || RSMA_INFO_ITEM(pInfo, 1)->fetchLevel) {
+ continue;
+ }
+
+ break;
}
- ASSERT(1 == atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0));
}
+ ASSERT(1 == atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0));
}
- pIter = taosHashIterate(infoHash, pIter);
}
if (type == RSMA_EXEC_COMMIT) {
- break;
+ if (atomic_load_64(&pRSmaStat->nBufItems) <= 0) {
+ break;
+ } else {
+ // commit should wait for all items be consumed
+ continue;
+ }
}
}
#if 0
@@ -1790,16 +1772,19 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
}
if (atomic_load_64(&pRSmaStat->nBufItems) <= 0) {
- if (pVnode->inClose) {
+ if (pEnv->flag & SMA_ENV_FLG_CLOSE) {
break;
}
+
tsem_wait(&pRSmaStat->notEmpty);
- if (pVnode->inClose && (atomic_load_64(&pRSmaStat->nBufItems) <= 0)) {
- smaInfo("vgId:%d, exec task end, inClose:%d, nBufItems:%" PRIi64, SMA_VID(pSma), pVnode->inClose,
+
+ 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,
atomic_load_64(&pRSmaStat->nBufItems));
break;
}
}
+
} // end of while(true)
_end:
@@ -1809,39 +1794,3 @@ _err:
taosArrayDestroy(pSubmitArr);
return TSDB_CODE_FAILED;
}
-
-/**
- * @brief exec rsma level 1data, fetch result of level 2/3 and submit
- *
- * @param pSma
- * @param pMsg
- * @return int32_t
- */
-int32_t smaProcessExec(SSma *pSma, void *pMsg) {
- SRpcMsg *pRpcMsg = (SRpcMsg *)pMsg;
- SRSmaStat *pRSmaStat = SMA_RSMA_STAT(pSma);
-
- if (!pRpcMsg || pRpcMsg->contLen < sizeof(SMsgHead)) {
- terrno = TSDB_CODE_RSMA_FETCH_MSG_MSSED_UP;
- goto _err;
- }
- smaDebug("vgId:%d, begin to process rsma exec msg by TID:%p", SMA_VID(pSma), (void *)taosGetSelfPthreadId());
-
- int8_t nOld = atomic_fetch_add_8(&pRSmaStat->nExecutor, 1);
-
- if (nOld < TMIN(RSMA_EXECUTOR_MAX, tsNumOfVnodeQueryThreads / 2)) {
- if (tdRSmaProcessExecImpl(pSma, RSMA_EXEC_OVERFLOW) < 0) {
- goto _err;
- }
- } else {
- atomic_fetch_sub_8(&pRSmaStat->nExecutor, 1);
- }
-
- smaDebug("vgId:%d, success to process rsma exec msg by TID:%p", SMA_VID(pSma), (void *)taosGetSelfPthreadId());
- return TSDB_CODE_SUCCESS;
-_err:
- atomic_fetch_sub_8(&pRSmaStat->nExecutor, 1);
- smaError("vgId:%d, failed to process rsma exec msg by TID:%p since %s", SMA_VID(pSma), (void *)taosGetSelfPthreadId(),
- terrstr());
- return TSDB_CODE_FAILED;
-}
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index c6bc8e6e598507ea820bb109e84fbb41a0ed099b..3ff59ac2c01953fbbbd1c88a5c253bcac3c9d045 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -79,6 +79,10 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
ASSERT(0);
}
+ if (streamLoadTasks(pTq->pStreamMeta) < 0) {
+ ASSERT(0);
+ }
+
return pTq;
}
@@ -648,17 +652,28 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask) {
// expand executor
if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
+ pTask->pState = streamStateOpen(pTq->pStreamMeta->path, pTask);
+ if (pTask->pState == NULL) {
+ return -1;
+ }
+
SReadHandle handle = {
.meta = pTq->pVnode->pMeta,
.vnode = pTq->pVnode,
.initTqReader = 1,
+ .pStateBackend = pTask->pState,
};
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle);
ASSERT(pTask->exec.executor);
} else if (pTask->taskLevel == TASK_LEVEL__AGG) {
+ pTask->pState = streamStateOpen(pTq->pStreamMeta->path, pTask);
+ if (pTask->pState == NULL) {
+ return -1;
+ }
SReadHandle mgHandle = {
.vnode = NULL,
.numOfVgroups = (int32_t)taosArrayGetSize(pTask->childEpInfo),
+ .pStateBackend = pTask->pState,
};
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle);
ASSERT(pTask->exec.executor);
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index b9f38976747f7e73f6bc6b40fe9dd968a3b8cabe..61c68775559ebcbaca1853fdadecaaa1456c170c 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -476,7 +476,7 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) {
if (code) goto _err;
if (!state->aBlockL) {
- state->aBlockL = taosArrayInit(0, sizeof(SBlockIdx));
+ state->aBlockL = taosArrayInit(0, sizeof(SBlockL));
} else {
taosArrayClear(state->aBlockL);
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
index 66843d9a2844c44e77e798ab47032ef75370a544..ea9a7ec7d9b3df80edbb1e5f93db5b2420f908e5 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
@@ -18,7 +18,7 @@
#include "tcommon.h"
#include "tsdb.h"
-typedef struct SLastrowReader {
+typedef struct SCacheRowsReader {
SVnode* pVnode;
STSchema* pSchema;
uint64_t uid;
@@ -27,9 +27,9 @@ typedef struct SLastrowReader {
int32_t type;
int32_t tableIndex; // currently returned result tables
SArray* pTableList; // table id list
-} SLastrowReader;
+} SCacheRowsReader;
-static void saveOneRow(STSRow* pRow, SSDataBlock* pBlock, SLastrowReader* pReader, const int32_t* slotIds) {
+static void saveOneRow(STSRow* pRow, SSDataBlock* pBlock, SCacheRowsReader* pReader, const int32_t* slotIds) {
ASSERT(pReader->numOfCols <= taosArrayGetSize(pBlock->pDataBlock));
int32_t numOfRows = pBlock->info.rows;
@@ -61,8 +61,10 @@ static void saveOneRow(STSRow* pRow, SSDataBlock* pBlock, SLastrowReader* pReade
pBlock->info.rows += 1;
}
-int32_t tsdbLastRowReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList, int32_t numOfCols, void** pReader) {
- SLastrowReader* p = taosMemoryCalloc(1, sizeof(SLastrowReader));
+int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList, int32_t numOfCols, void** pReader) {
+ *pReader = NULL;
+
+ SCacheRowsReader* p = taosMemoryCalloc(1, sizeof(SCacheRowsReader));
if (p == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
@@ -81,9 +83,17 @@ int32_t tsdbLastRowReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList,
p->pTableList = pTableIdList;
p->transferBuf = taosMemoryCalloc(p->pSchema->numOfCols, POINTER_BYTES);
+ if (p->transferBuf == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) {
if (IS_VAR_DATA_TYPE(p->pSchema->columns[i].type)) {
p->transferBuf[i] = taosMemoryMalloc(p->pSchema->columns[i].bytes);
+ if (p->transferBuf[i] == NULL) {
+ tsdbCacherowsReaderClose(p);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
}
}
@@ -91,8 +101,8 @@ int32_t tsdbLastRowReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList,
return TSDB_CODE_SUCCESS;
}
-int32_t tsdbLastrowReaderClose(void* pReader) {
- SLastrowReader* p = pReader;
+int32_t tsdbCacherowsReaderClose(void* pReader) {
+ SCacheRowsReader* p = pReader;
if (p->pSchema != NULL) {
for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) {
@@ -107,28 +117,56 @@ int32_t tsdbLastrowReaderClose(void* pReader) {
return TSDB_CODE_SUCCESS;
}
-int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t* slotIds, SArray* pTableUidList) {
+static int32_t doExtractCacheRow(SCacheRowsReader* pr, SLRUCache* lruCache, uint64_t uid, STSRow** pRow, LRUHandle** h) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ if ((pr->type & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW) {
+ code = tsdbCacheGetLastrowH(lruCache, uid, pr->pVnode->pTsdb, h);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+
+ // no data in the table of Uid
+ if (*h != NULL) {
+ *pRow = (STSRow*)taosLRUCacheValue(lruCache, *h);
+ }
+ } else {
+ code = tsdbCacheGetLastH(lruCache, uid, pr->pVnode->pTsdb, h);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+
+ // no data in the table of Uid
+ if (*h != NULL) {
+ SArray* pLast = (SArray*)taosLRUCacheValue(lruCache, *h);
+ tsdbCacheLastArray2Row(pLast, pRow, pr->pSchema);
+ }
+ }
+
+ return code;
+}
+
+int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32_t* slotIds, SArray* pTableUidList) {
if (pReader == NULL || pResBlock == NULL) {
return TSDB_CODE_INVALID_PARA;
}
- SLastrowReader* pr = pReader;
+ SCacheRowsReader* pr = pReader;
+ int32_t code = TSDB_CODE_SUCCESS;
SLRUCache* lruCache = pr->pVnode->pTsdb->lruCache;
LRUHandle* h = NULL;
STSRow* pRow = NULL;
size_t numOfTables = taosArrayGetSize(pr->pTableList);
// retrieve the only one last row of all tables in the uid list.
- if (pr->type == LASTROW_RETRIEVE_TYPE_SINGLE) {
+ if ((pr->type & CACHESCAN_RETRIEVE_TYPE_SINGLE) == CACHESCAN_RETRIEVE_TYPE_SINGLE) {
int64_t lastKey = INT64_MIN;
bool internalResult = false;
for (int32_t i = 0; i < numOfTables; ++i) {
STableKeyInfo* pKeyInfo = taosArrayGet(pr->pTableList, i);
- int32_t code = tsdbCacheGetLastrowH(lruCache, pKeyInfo->uid, pr->pVnode->pTsdb, &h);
- // int32_t code = tsdbCacheGetLastH(lruCache, pKeyInfo->uid, pr->pVnode->pTsdb, &h);
- if (code != TSDB_CODE_SUCCESS) {
+ code = doExtractCacheRow(pr, lruCache, pKeyInfo->uid, &pRow, &h);
+ if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -136,9 +174,6 @@ int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t
continue;
}
- pRow = (STSRow*)taosLRUCacheValue(lruCache, h);
- // SArray* pLast = (SArray*)taosLRUCacheValue(lruCache, h);
- // tsdbCacheLastArray2Row(pLast, &pRow, pr->pSchema);
if (pRow->ts > lastKey) {
// Set result row into the same rowIndex repeatly, so we need to check if the internal result row has already
// appended or not.
@@ -155,25 +190,18 @@ int32_t tsdbRetrieveLastRow(void* pReader, SSDataBlock* pResBlock, const int32_t
tsdbCacheRelease(lruCache, h);
}
- } else if (pr->type == LASTROW_RETRIEVE_TYPE_ALL) {
+ } else if ((pr->type & CACHESCAN_RETRIEVE_TYPE_ALL) == CACHESCAN_RETRIEVE_TYPE_ALL) {
for (int32_t i = pr->tableIndex; i < numOfTables; ++i) {
STableKeyInfo* pKeyInfo = taosArrayGet(pr->pTableList, i);
-
- int32_t code = tsdbCacheGetLastrowH(lruCache, pKeyInfo->uid, pr->pVnode->pTsdb, &h);
- // int32_t code = tsdbCacheGetLastH(lruCache, pKeyInfo->uid, pr->pVnode->pTsdb, &h);
- if (code != TSDB_CODE_SUCCESS) {
+ code = doExtractCacheRow(pr, lruCache, pKeyInfo->uid, &pRow, &h);
+ if (code != TSDB_CODE_SUCCESS) {
return code;
}
- // no data in the table of Uid
if (h == NULL) {
continue;
}
- pRow = (STSRow*)taosLRUCacheValue(lruCache, h);
- // SArray* pLast = (SArray*)taosLRUCacheValue(lruCache, h);
- // tsdbCacheLastArray2Row(pLast, &pRow, pr->pSchema);
-
saveOneRow(pRow, pResBlock, pr, slotIds);
taosArrayPush(pTableUidList, &pKeyInfo->uid);
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index 4a5d8d11f910017bed16c318db2b01bfe44a3180..be8e809a727c72226d53c537c362e9da6f0bf0d2 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -16,9 +16,9 @@
#include "osDef.h"
#include "tsdb.h"
-#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
+#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
#define ALL_ROWS_CHECKED_INDEX (INT16_MIN)
-#define DEFAULT_ROW_INDEX_VAL (-1)
+#define INITIAL_ROW_INDEX_VAL (-1)
typedef enum {
EXTERNAL_ROWS_PREV = 0x1,
@@ -129,16 +129,22 @@ typedef struct SFileBlockDumpInfo {
bool allDumped;
} SFileBlockDumpInfo;
+typedef struct SUidOrderCheckInfo {
+ uint64_t* tableUidList; // access table uid list in uid ascending order list
+ int32_t currentIndex; // index in table uid list
+} SUidOrderCheckInfo;
+
typedef struct SReaderStatus {
- bool loadFromFile; // check file stage
- SHashObj* pTableMap; // SHash
- STableBlockScanInfo* pTableIter; // table iterator used in building in-memory buffer data blocks.
+ bool loadFromFile; // check file stage
+ bool composedDataBlock; // the returned data block is a composed block or not
+ SHashObj* pTableMap; // SHash
+ STableBlockScanInfo* pTableIter; // table iterator used in building in-memory buffer data blocks.
+ SUidOrderCheckInfo uidCheckInfo; // check all table in uid order
SFileBlockDumpInfo fBlockDumpInfo;
- SDFileSet* pCurrentFileset; // current opened file set
+ SDFileSet* pCurrentFileset; // current opened file set
SBlockData fileBlockData;
SFilesetIter fileIter;
SDataBlockIter blockIter;
- bool composedDataBlock; // the returned data block is a composed block or not
} SReaderStatus;
struct STsdbReader {
@@ -166,7 +172,7 @@ struct STsdbReader {
static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter);
static int buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
STsdbReader* pReader);
-static TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader);
+static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader);
static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader,
SRowMerger* pMerger);
static int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, SRowMerger* pMerger);
@@ -178,10 +184,12 @@ static int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pR
static void setComposedBlockFlag(STsdbReader* pReader, bool composed);
static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order);
-static void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList, STSRow** pTSRow,
+static void doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList, STSRow** pTSRow,
STsdbReader* pReader, bool* freeTSRow);
static void doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader,
STSRow** pTSRow);
+static int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key, STsdbReader* pReader);
+
static int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STbData* pMemTbData,
STbData* piMemTbData);
static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* retentions, const char* idstr,
@@ -226,7 +234,7 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
}
for (int32_t j = 0; j < numOfTables; ++j) {
- STableBlockScanInfo info = {.lastKey = 0, .uid = idList[j].uid, .indexInBlockL = DEFAULT_ROW_INDEX_VAL};
+ STableBlockScanInfo info = {.lastKey = 0, .uid = idList[j].uid, .indexInBlockL = INITIAL_ROW_INDEX_VAL};
if (ASCENDING_TRAVERSE(pTsdbReader->order)) {
if (info.lastKey == INT64_MIN || info.lastKey < pTsdbReader->window.skey) {
info.lastKey = pTsdbReader->window.skey;
@@ -258,7 +266,9 @@ static void resetDataBlockScanInfo(SHashObj* pTableMap) {
p->iter.iter = tsdbTbDataIterDestroy(p->iter.iter);
}
- p->delSkyline = taosArrayDestroy(p->delSkyline);
+ p->fileDelIndex = -1;
+ p->delSkyline = taosArrayDestroy(p->delSkyline);
+ p->lastBlockDelIndex = INITIAL_ROW_INDEX_VAL;
}
}
@@ -406,7 +416,7 @@ _err:
return false;
}
-static void resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, SHashObj* pTableMap) {
+static void resetDataBlockIterator(SDataBlockIter* pIter, int32_t order) {
pIter->order = order;
pIter->index = -1;
pIter->numOfBlocks = 0;
@@ -415,7 +425,6 @@ static void resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, SHashOb
} else {
taosArrayClear(pIter->blockList);
}
- pIter->pTableMap = pTableMap;
}
static void cleanupDataBlockIterator(SDataBlockIter* pIter) { taosArrayDestroy(pIter->blockList); }
@@ -511,86 +520,6 @@ _end:
return code;
}
-// void tsdbResetQueryHandleForNewTable(STsdbReader* queryHandle, SQueryTableDataCond* pCond, STableListInfo* tableList,
-// int32_t tWinIdx) {
-// STsdbReader* pTsdbReadHandle = queryHandle;
-
-// pTsdbReadHandle->order = pCond->order;
-// pTsdbReadHandle->window = pCond->twindows[tWinIdx];
-// pTsdbReadHandle->type = TSDB_QUERY_TYPE_ALL;
-// pTsdbReadHandle->cur.fid = -1;
-// pTsdbReadHandle->cur.win = TSWINDOW_INITIALIZER;
-// pTsdbReadHandle->checkFiles = true;
-// pTsdbReadHandle->activeIndex = 0; // current active table index
-// pTsdbReadHandle->locateStart = false;
-// pTsdbReadHandle->loadExternalRow = pCond->loadExternalRows;
-
-// if (ASCENDING_TRAVERSE(pCond->order)) {
-// assert(pTsdbReadHandle->window.skey <= pTsdbReadHandle->window.ekey);
-// } else {
-// assert(pTsdbReadHandle->window.skey >= pTsdbReadHandle->window.ekey);
-// }
-
-// // allocate buffer in order to load data blocks from file
-// memset(pTsdbReadHandle->suppInfo.pstatis, 0, sizeof(SColumnDataAgg));
-// memset(pTsdbReadHandle->suppInfo.plist, 0, POINTER_BYTES);
-
-// tsdbInitDataBlockLoadInfo(&pTsdbReadHandle->dataBlockLoadInfo);
-// tsdbInitCompBlockLoadInfo(&pTsdbReadHandle->compBlockLoadInfo);
-
-// SArray* pTable = NULL;
-// // STsdbMeta* pMeta = tsdbGetMeta(pTsdbReadHandle->pTsdb);
-
-// // pTsdbReadHandle->pTableCheckInfo = destroyTableCheckInfo(pTsdbReadHandle->pTableCheckInfo);
-
-// pTsdbReadHandle->pTableCheckInfo = NULL; // createDataBlockScanInfo(pTsdbReadHandle, groupList, pMeta,
-// // &pTable);
-// if (pTsdbReadHandle->pTableCheckInfo == NULL) {
-// // tsdbReaderClose(pTsdbReadHandle);
-// terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
-// }
-
-// // pTsdbReadHandle->prev = doFreeColumnInfoData(pTsdbReadHandle->prev);
-// // pTsdbReadHandle->next = doFreeColumnInfoData(pTsdbReadHandle->next);
-// }
-
-// SArray* tsdbGetQueriedTableList(STsdbReader** pHandle) {
-// assert(pHandle != NULL);
-
-// STsdbReader* pTsdbReadHandle = (STsdbReader*)pHandle;
-
-// size_t size = taosArrayGetSize(pTsdbReadHandle->pTableCheckInfo);
-// SArray* res = taosArrayInit(size, POINTER_BYTES);
-// return res;
-// }
-
-// static int32_t binarySearchForBlock(SBlock* pBlock, int32_t numOfBlocks, TSKEY skey, int32_t order) {
-// int32_t firstSlot = 0;
-// int32_t lastSlot = numOfBlocks - 1;
-
-// int32_t midSlot = firstSlot;
-
-// while (1) {
-// numOfBlocks = lastSlot - firstSlot + 1;
-// midSlot = (firstSlot + (numOfBlocks >> 1));
-
-// if (numOfBlocks == 1) break;
-
-// if (skey > pBlock[midSlot].maxKey.ts) {
-// if (numOfBlocks == 2) break;
-// if ((order == TSDB_ORDER_DESC) && (skey < pBlock[midSlot + 1].minKey.ts)) break;
-// firstSlot = midSlot + 1;
-// } else if (skey < pBlock[midSlot].minKey.ts) {
-// if ((order == TSDB_ORDER_ASC) && (skey > pBlock[midSlot - 1].maxKey.ts)) break;
-// lastSlot = midSlot - 1;
-// } else {
-// break; // got the slot
-// }
-// }
-
-// return midSlot;
-// }
-
static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader, SArray* pIndexList) {
SArray* aBlockIdx = taosArrayInit(8, sizeof(SBlockIdx));
@@ -651,7 +580,7 @@ static void cleanupTableScanInfo(SHashObj* pTableMap) {
}
// reset the index in last block when handing a new file
- px->indexInBlockL = -1;
+ px->indexInBlockL = INITIAL_ROW_INDEX_VAL;
tMapDataClear(&px->mapData);
taosArrayClear(px->pBlockList);
}
@@ -729,9 +658,11 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SArray*
int32_t total = pBlockNum->numOfLastBlocks + pBlockNum->numOfBlocks;
double el = (taosGetTimestampUs() - st) / 1000.0;
- tsdbDebug("load block of %d tables completed, blocks:%d in %d tables, lastBlock:%d, size:%.2f Kb, elapsed time:%.2f ms %s",
- numOfTables, pBlockNum->numOfBlocks, numOfQTable, pBlockNum->numOfLastBlocks, sizeInDisk
- / 1000.0, el, pReader->idStr);
+ tsdbDebug(
+ "load block of %d tables completed, blocks:%d in %d tables, lastBlock:%d, block-info-size:%.2f Kb, elapsed "
+ "time:%.2f ms %s",
+ numOfTables, pBlockNum->numOfBlocks, numOfQTable, pBlockNum->numOfLastBlocks, sizeInDisk / 1000.0, el,
+ pReader->idStr);
pReader->cost.numOfBlocks += total;
pReader->cost.headFileLoadTime += el;
@@ -859,71 +790,32 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockIter, SBlockData* pBlockData) {
int64_t st = taosGetTimestampUs();
- double elapsedTime = 0;
- int32_t code = 0;
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
+ ASSERT(pBlockInfo != NULL);
- if (pBlockInfo != NULL) {
- SBlock* pBlock = getCurrentBlock(pBlockIter);
- code = tsdbReadDataBlock(pReader->pFileReader, pBlock, pBlockData);
- if (code != TSDB_CODE_SUCCESS) {
- tsdbError("%p error occurs in loading file block, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
- ", rows:%d, code:%s %s",
- pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, pBlock->nRow,
- tstrerror(code), pReader->idStr);
- goto _error;
- }
-
- elapsedTime = (taosGetTimestampUs() - st) / 1000.0;
-
- tsdbDebug("%p load file block into buffer, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
- ", rows:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s",
+ SBlock* pBlock = getCurrentBlock(pBlockIter);
+ int32_t code = tsdbReadDataBlock(pReader->pFileReader, pBlock, pBlockData);
+ if (code != TSDB_CODE_SUCCESS) {
+ tsdbError("%p error occurs in loading file block, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
+ ", rows:%d, code:%s %s",
pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, pBlock->nRow,
- pBlock->minVer, pBlock->maxVer, elapsedTime, pReader->idStr);
- } else {
-#if 0
- SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
-
- uint64_t uid = pBlockInfo->uid;
- SArray* pBlocks = pLastBlockReader->pBlockL;
-
- pLastBlockReader->currentBlockIndex = -1;
-
- // find the correct SBlockL
- for(int32_t i = 0; i < taosArrayGetSize(pBlocks); ++i) {
- SBlockL* pBlock = taosArrayGet(pBlocks, i);
- if (pBlock->minUid >= uid && pBlock->maxUid <= uid) {
- pLastBlockReader->currentBlockIndex = i;
- break;
- }
- }
+ tstrerror(code), pReader->idStr);
+ return code;
+ }
-// SBlockL* pBlockL = taosArrayGet(pLastBlockReader->pBlockL, *index);
- code = tsdbReadLastBlock(pReader->pFileReader, pBlockL, pBlockData);
- if (code != TSDB_CODE_SUCCESS) {
- tsdbDebug("%p error occurs in loading last block into buffer, last block index:%d, total:%d brange:%" PRId64 "-%" PRId64
- ", rows:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", code:%s %s",
- pReader, *index, pBlockIter->numOfBlocks.numOfLastBlocks, 0, 0, pBlockL->nRow,
- pBlockL->minVer, pBlockL->maxVer, tstrerror(code), pReader->idStr);
- goto _error;
- }
+ double elapsedTime = (taosGetTimestampUs() - st) / 1000.0;
- tsdbDebug("%p load last file block into buffer, last block index:%d, total:%d brange:%" PRId64 "-%" PRId64
- ", rows:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s",
- pReader, *index, pBlockIter->numOfBlocks.numOfLastBlocks, 0, 0, pBlockL->nRow,
- pBlockL->minVer, pBlockL->maxVer, elapsedTime, pReader->idStr);
-#endif
- }
+ tsdbDebug("%p load file block into buffer, global index:%d, index in table block list:%d, brange:%" PRId64 "-%" PRId64
+ ", rows:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s",
+ pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, pBlock->nRow,
+ pBlock->minVer, pBlock->maxVer, elapsedTime, pReader->idStr);
pReader->cost.blockLoadTime += elapsedTime;
pDumpInfo->allDumped = false;
return TSDB_CODE_SUCCESS;
-
-_error:
- return code;
}
static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) {
@@ -977,10 +869,10 @@ static int32_t fileDataBlockOrderCompar(const void* pLeft, const void* pRight, v
}
static int32_t doSetCurrentBlock(SDataBlockIter* pBlockIter) {
- SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(pBlockIter);
- if (pFBlock != NULL) {
- STableBlockScanInfo* pScanInfo = taosHashGet(pBlockIter->pTableMap, &pFBlock->uid, sizeof(pFBlock->uid));
- int32_t* mapDataIndex = taosArrayGet(pScanInfo->pBlockList, pFBlock->tbBlockIdx);
+ SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
+ if (pBlockInfo != NULL) {
+ STableBlockScanInfo* pScanInfo = taosHashGet(pBlockIter->pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
+ int32_t* mapDataIndex = taosArrayGet(pScanInfo->pBlockList, pBlockInfo->tbBlockIdx);
tMapDataGetItemByIdx(&pScanInfo->mapData, *mapDataIndex, &pBlockIter->block, tGetBlock);
}
@@ -996,6 +888,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
pBlockIter->numOfBlocks = numOfBlocks;
taosArrayClear(pBlockIter->blockList);
+ pBlockIter->pTableMap = pReader->status.pTableMap;
// access data blocks according to the offset of each block in asc/desc order.
int32_t numOfTables = (int32_t)taosHashGetSize(pReader->status.pTableMap);
@@ -1394,7 +1287,7 @@ static FORCE_INLINE STSchema* doGetSchemaForTSRow(int32_t sversion, STsdbReader*
return pReader->pMemSchema;
}
-static int32_t doMergeBufAndFileRows_Rv(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, TSDBROW* pRow,
+static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, TSDBROW* pRow,
SIterInfo* pIter, int64_t key, SLastBlockReader* pLastBlockReader) {
SRowMerger merge = {0};
STSRow* pTSRow = NULL;
@@ -1510,88 +1403,87 @@ static int32_t doMergeBufAndFileRows_Rv(STsdbReader* pReader, STableBlockScanInf
return TSDB_CODE_SUCCESS;
}
-static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, TSDBROW* pRow,
- SIterInfo* pIter, int64_t key, SLastBlockReader* pLastBlockReader) {
- SRowMerger merge = {0};
- STSRow* pTSRow = NULL;
- SBlockData* pBlockData = &pReader->status.fileBlockData;
+static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, STsdbReader* pReader,
+ STableBlockScanInfo* pBlockScanInfo, SBlockData* pBlockData,
+ bool mergeBlockData) {
+ SBlockData* pLastBlockData = &pLastBlockReader->lastBlockData;
+ int64_t tsLastBlock = getCurrentKeyInLastBlock(pLastBlockReader);
+
+ STSRow* pTSRow = NULL;
+ SRowMerger merge = {0};
+
+ TSDBROW fRow = tsdbRowFromBlockData(pLastBlockData, *pLastBlockReader->rowIndex);
+
+ tRowMergerInit(&merge, &fRow, pReader->pSchema);
+ doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge);
+
+ // merge with block data if ts == key
+ if (mergeBlockData) {
+ doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
+ }
+
+ tRowMergerGetRow(&merge, &pTSRow);
+ doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
+
+ taosMemoryFree(pTSRow);
+ tRowMergerClear(&merge);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader* pLastBlockReader, int64_t key,
+ STableBlockScanInfo* pBlockScanInfo, SBlockData* pBlockData) {
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
- TSDBKEY k = TSDBROW_KEY(pRow);
- TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
- SArray* pDelList = pBlockScanInfo->delSkyline;
- bool freeTSRow = false;
- uint64_t uid = pBlockScanInfo->uid;
+ if (pBlockData->nRow > 0) {
+ // no last block available, only data block exists
+ if (pLastBlockReader->lastBlockData.nRow == 0 || (!hasDataInLastBlock(pLastBlockReader))) {
+ return mergeRowsInFileBlocks(pBlockData, pBlockScanInfo, key, pReader);
+ }
+
+ // row in last file block
+ TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
+ int64_t ts = getCurrentKeyInLastBlock(pLastBlockReader);
+ ASSERT(ts >= key);
+
+ if (ASCENDING_TRAVERSE(pReader->order)) {
+ if (key < ts) { // imem, mem are all empty, file blocks (data blocks and last block) exist
+ return mergeRowsInFileBlocks(pBlockData, pBlockScanInfo, key, pReader);
+ } else if (key == ts) {
+ STSRow* pTSRow = NULL;
+ SRowMerger merge = {0};
- // ascending order traverse
- if (ASCENDING_TRAVERSE(pReader->order)) {
- if (key < k.ts) {
- // imem & mem are all empty, only file exist
- if (tryCopyDistinctRowFromFileBlock(pReader, pBlockData, key, pDumpInfo)) {
- return TSDB_CODE_SUCCESS;
- } else {
tRowMergerInit(&merge, &fRow, pReader->pSchema);
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
- tRowMergerGetRow(&merge, &pTSRow);
- freeTSRow = true;
- }
- } else if (k.ts < key) { // k.ts < key
- doMergeMultiRows(pRow, pBlockScanInfo->uid, pIter, pDelList, &pTSRow, pReader, &freeTSRow);
- } else { // k.ts == key, ascending order: file block ----> imem rows -----> mem rows
- tRowMergerInit(&merge, &fRow, pReader->pSchema);
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
+ doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge);
- tRowMerge(&merge, pRow);
- doMergeRowsInBuf(pIter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, &merge, pReader);
+ tRowMergerGetRow(&merge, &pTSRow);
+ doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
- tRowMergerGetRow(&merge, &pTSRow);
- freeTSRow = true;
- }
- } else { // descending order scan
- if (key < k.ts) {
- doMergeMultiRows(pRow, pBlockScanInfo->uid, pIter, pDelList, &pTSRow, pReader, &freeTSRow);
- } else if (k.ts < key) {
- if (tryCopyDistinctRowFromFileBlock(pReader, pBlockData, key, pDumpInfo)) {
+ taosMemoryFree(pTSRow);
+ tRowMergerClear(&merge);
return TSDB_CODE_SUCCESS;
} else {
- tRowMergerInit(&merge, &fRow, pReader->pSchema);
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
- tRowMergerGetRow(&merge, &pTSRow);
- freeTSRow = true;
+ ASSERT(0);
+ return TSDB_CODE_SUCCESS;
}
- } else { // descending order: mem rows -----> imem rows ------> file block
- STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
-
- tRowMergerInit(&merge, pRow, pSchema);
- doMergeRowsInBuf(pIter, pBlockScanInfo->uid, k.ts, pBlockScanInfo->delSkyline, &merge, pReader);
-
- tRowMerge(&merge, &fRow);
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
-
- tRowMergerGetRow(&merge, &pTSRow);
- freeTSRow = true;
+ } else { // desc order
+ return doMergeFileBlockAndLastBlock(pLastBlockReader, pReader, pBlockScanInfo, pBlockData, true);
}
+ } else { // only last block exists
+ return doMergeFileBlockAndLastBlock(pLastBlockReader, pReader, pBlockScanInfo, NULL, false);
}
-
- tRowMergerClear(&merge);
- doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, uid);
-
- if (freeTSRow) {
- taosMemoryFree(pTSRow);
- }
-
- return TSDB_CODE_SUCCESS;
}
-static int32_t doMergeMultiLevelRowsRv(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, SBlockData* pBlockData, SLastBlockReader* pLastBlockReader) {
+static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, SBlockData* pBlockData,
+ SLastBlockReader* pLastBlockReader) {
SRowMerger merge = {0};
STSRow* pTSRow = NULL;
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
SArray* pDelList = pBlockScanInfo->delSkyline;
- TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pDelList, pReader);
- TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pDelList, pReader);
+ TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader);
+ TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader);
ASSERT(pRow != NULL && piRow != NULL);
SBlockData* pLastBlockData = &pLastBlockReader->lastBlockData;
@@ -1605,7 +1497,7 @@ static int32_t doMergeMultiLevelRowsRv(STsdbReader* pReader, STableBlockScanInfo
TSDBKEY k = TSDBROW_KEY(pRow);
TSDBKEY ik = TSDBROW_KEY(piRow);
- int64_t minKey = 0;//INT64_MAX;
+ int64_t minKey = 0;
if (ASCENDING_TRAVERSE(pReader->order)) {
minKey = INT64_MAX; // let's find the minimum
if (minKey > k.ts) {
@@ -1734,6 +1626,7 @@ static int32_t doMergeMultiLevelRowsRv(STsdbReader* pReader, STableBlockScanInfo
return TSDB_CODE_SUCCESS;
}
+#if 0
static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, SBlockData* pBlockData) {
SRowMerger merge = {0};
STSRow* pTSRow = NULL;
@@ -1741,8 +1634,8 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
SArray* pDelList = pBlockScanInfo->delSkyline;
- TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pDelList, pReader);
- TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pDelList, pReader);
+ TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader);
+ TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader);
ASSERT(pRow != NULL && piRow != NULL);
int64_t key = pBlockData->aTSKEY[pDumpInfo->rowIndex];
@@ -1779,7 +1672,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
// [3] ik.ts < key <= k.ts
// [4] ik.ts < k.ts <= key
if (ik.ts < k.ts) {
- doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader, &freeTSRow);
+ doMergeMemTableMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader, &freeTSRow);
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, uid);
if (freeTSRow) {
taosMemoryFree(pTSRow);
@@ -1790,7 +1683,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
// [5] k.ts < key <= ik.ts
// [6] k.ts < ik.ts <= key
if (k.ts < ik.ts) {
- doMergeMultiRows(pRow, uid, &pBlockScanInfo->iter, pDelList, &pTSRow, pReader, &freeTSRow);
+ doMergeMemTableMultiRows(pRow, uid, &pBlockScanInfo->iter, pDelList, &pTSRow, pReader, &freeTSRow);
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, uid);
if (freeTSRow) {
taosMemoryFree(pTSRow);
@@ -1836,7 +1729,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
// [3] ik.ts > k.ts >= Key
// [4] ik.ts > key >= k.ts
if (ik.ts > key) {
- doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader, &freeTSRow);
+ doMergeMemTableMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader, &freeTSRow);
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, uid);
if (freeTSRow) {
taosMemoryFree(pTSRow);
@@ -1859,7 +1752,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
//[7] key = ik.ts > k.ts
if (key == ik.ts) {
- doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader, &freeTSRow);
+ doMergeMemTableMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader, &freeTSRow);
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
tRowMerge(&merge, &fRow);
@@ -1876,6 +1769,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
ASSERT(0);
return -1;
}
+#endif
static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDumpInfo,
STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) {
@@ -1926,7 +1820,8 @@ static void setAllRowsChecked(SLastBlockReader *pLastBlockReader) {
}
static bool nextRowInLastBlock(SLastBlockReader *pLastBlockReader, STableBlockScanInfo* pBlockScanInfo) {
- int32_t step = (pLastBlockReader->order == TSDB_ORDER_ASC) ? 1 : -1;
+ bool asc = ASCENDING_TRAVERSE(pLastBlockReader->order);
+ int32_t step = (asc) ? 1 : -1;
if (*pLastBlockReader->rowIndex == ALL_ROWS_CHECKED_INDEX) {
return false;
}
@@ -1935,8 +1830,20 @@ static bool nextRowInLastBlock(SLastBlockReader *pLastBlockReader, STableBlockSc
SBlockData* pBlockData = &pLastBlockReader->lastBlockData;
for(int32_t i = *(pLastBlockReader->rowIndex); i < pBlockData->nRow && i >= 0; i += step) {
- if (pBlockData->aUid != NULL && pBlockData->aUid[i] != pLastBlockReader->uid) {
- continue;
+ if (pBlockData->aUid != NULL) {
+ if (asc) {
+ if (pBlockData->aUid[i] < pLastBlockReader->uid) {
+ continue;
+ } else if (pBlockData->aUid[i] > pLastBlockReader->uid) {
+ break;
+ }
+ } else {
+ if (pBlockData->aUid[i] > pLastBlockReader->uid) {
+ continue;
+ } else if (pBlockData->aUid[i] < pLastBlockReader->uid) {
+ break;
+ }
+ }
}
int64_t ts = pBlockData->aTSKEY[i];
@@ -1982,132 +1889,58 @@ static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) {
if (*pLastBlockReader->rowIndex == ALL_ROWS_CHECKED_INDEX) {
return false;
}
+
+ ASSERT(pLastBlockReader->lastBlockData.nRow > 0);
return true;
}
-// todo refactor
+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 {
+ STSRow* pTSRow = NULL;
+ SRowMerger merge = {0};
+
+ tRowMergerInit(&merge, &fRow, pReader->pSchema);
+ doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
+ tRowMergerGetRow(&merge, &pTSRow);
+ doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
+
+ taosMemoryFree(pTSRow);
+ 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 = getValidRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
- TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
+ TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
+ TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
if (pBlockScanInfo->iter.hasVal && pBlockScanInfo->iiter.hasVal) {
- return doMergeMultiLevelRowsRv(pReader, pBlockScanInfo, pBlockData, pLastBlockReader);
+ return doMergeMultiLevelRows(pReader, pBlockScanInfo, pBlockData, pLastBlockReader);
} else {
// imem + file + last block
if (pBlockScanInfo->iiter.hasVal) {
- return doMergeBufAndFileRows_Rv(pReader, pBlockScanInfo, piRow, &pBlockScanInfo->iiter, key, pLastBlockReader);
+ return doMergeBufAndFileRows(pReader, pBlockScanInfo, piRow, &pBlockScanInfo->iiter, key, pLastBlockReader);
}
- // mem + file
+ // mem + file + last block
if (pBlockScanInfo->iter.hasVal) {
- return doMergeBufAndFileRows_Rv(pReader, pBlockScanInfo, pRow, &pBlockScanInfo->iter, key, pLastBlockReader);
+ return doMergeBufAndFileRows(pReader, pBlockScanInfo, pRow, &pBlockScanInfo->iter, key, pLastBlockReader);
}
- if (pBlockData->nRow > 0) {
- TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
-
- // no last block available, only data block exists
- if (pLastBlockReader->lastBlockData.nRow == 0 || (!hasDataInLastBlock(pLastBlockReader))) {
- if (tryCopyDistinctRowFromFileBlock(pReader, pBlockData, key, pDumpInfo)) {
- return TSDB_CODE_SUCCESS;
- } else {
- STSRow* pTSRow = NULL;
- SRowMerger merge = {0};
-
- tRowMergerInit(&merge, &fRow, pReader->pSchema);
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
- tRowMergerGetRow(&merge, &pTSRow);
- doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
-
- taosMemoryFree(pTSRow);
- tRowMergerClear(&merge);
- return TSDB_CODE_SUCCESS;
- }
- }
-
- // row in last file block
- int64_t ts = getCurrentKeyInLastBlock(pLastBlockReader);
- ASSERT(ts >= key);
-
- if (ASCENDING_TRAVERSE(pReader->order)) {
- if (key < ts) {
- // imem & mem are all empty, only file exist
- if (tryCopyDistinctRowFromFileBlock(pReader, pBlockData, key, pDumpInfo)) {
- return TSDB_CODE_SUCCESS;
- } else {
- STSRow* pTSRow = NULL;
- SRowMerger merge = {0};
-
- tRowMergerInit(&merge, &fRow, pReader->pSchema);
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
- tRowMergerGetRow(&merge, &pTSRow);
- doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
-
- taosMemoryFree(pTSRow);
- tRowMergerClear(&merge);
- return TSDB_CODE_SUCCESS;
- }
- } else if (key == ts) {
- STSRow* pTSRow = NULL;
- SRowMerger merge = {0};
-
- tRowMergerInit(&merge, &fRow, pReader->pSchema);
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
- doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge);
-
- tRowMergerGetRow(&merge, &pTSRow);
- doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
-
- taosMemoryFree(pTSRow);
- tRowMergerClear(&merge);
- return TSDB_CODE_SUCCESS;
- } else {
- ASSERT(0);
- return TSDB_CODE_SUCCESS;
- }
- } else { // desc order
- SBlockData* pLastBlockData = &pLastBlockReader->lastBlockData;
- TSDBROW fRow1 = tsdbRowFromBlockData(pLastBlockData, *pLastBlockReader->rowIndex);
-
- STSRow* pTSRow = NULL;
- SRowMerger merge = {0};
- tRowMergerInit(&merge, &fRow1, pReader->pSchema);
- doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge);
-
- if (ts == key) {
- doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
- }
-
- tRowMergerGetRow(&merge, &pTSRow);
- doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
-
- taosMemoryFree(pTSRow);
- tRowMergerClear(&merge);
- return TSDB_CODE_SUCCESS;
- }
- } else { // only last block exists
- SBlockData* pLastBlockData = &pLastBlockReader->lastBlockData;
- int64_t tsLastBlock = getCurrentKeyInLastBlock(pLastBlockReader);
-
- STSRow* pTSRow = NULL;
- SRowMerger merge = {0};
-
- TSDBROW fRow = tsdbRowFromBlockData(pLastBlockData, *pLastBlockReader->rowIndex);
-
- tRowMergerInit(&merge, &fRow, pReader->pSchema);
- doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge);
- tRowMergerGetRow(&merge, &pTSRow);
-
- doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow, pBlockScanInfo->uid);
-
- taosMemoryFree(pTSRow);
- tRowMergerClear(&merge);
- return TSDB_CODE_SUCCESS;
- }
+ // files data blocks + last block
+ return mergeFileBlockAndLastBlock(pReader, pLastBlockReader, key, pBlockScanInfo, pBlockData);
}
}
@@ -2132,9 +1965,8 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
while (1) {
// todo check the validate of row in file block
+ bool hasBlockData = false;
{
- bool hasBlockData = false;
-
while (pBlockData->nRow > 0) { // find the first qualified row in data block
if (isValidFileBlockRow(pBlockData, pDumpInfo, pBlockScanInfo, pReader)) {
hasBlockData = true;
@@ -2149,13 +1981,13 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
break;
}
}
+ }
- bool hasBlockLData = hasDataInLastBlock(pLastBlockReader);
+ bool hasBlockLData = hasDataInLastBlock(pLastBlockReader);
- // no data in last block and block, no need to proceed.
- if ((hasBlockData == false) && (hasBlockLData == false)) {
- break;
- }
+ // no data in last block and block, no need to proceed.
+ if ((hasBlockData == false) && (hasBlockLData == false)) {
+ break;
}
buildComposedDataBlockImpl(pReader, pBlockScanInfo, pBlockData, pLastBlockReader);
@@ -2178,9 +2010,12 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
setComposedBlockFlag(pReader, true);
int64_t et = taosGetTimestampUs();
- 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);
+ 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);
+ }
return TSDB_CODE_SUCCESS;
}
@@ -2337,12 +2172,12 @@ static TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* p
TSDBKEY key = {.ts = TSKEY_INITIAL_VAL};
initMemDataIterator(pScanInfo, pReader);
- TSDBROW* pRow = getValidRow(&pScanInfo->iter, pScanInfo->delSkyline, pReader);
+ TSDBROW* pRow = getValidMemRow(&pScanInfo->iter, pScanInfo->delSkyline, pReader);
if (pRow != NULL) {
key = TSDBROW_KEY(pRow);
}
- pRow = getValidRow(&pScanInfo->iiter, pScanInfo->delSkyline, pReader);
+ pRow = getValidMemRow(&pScanInfo->iiter, pScanInfo->delSkyline, pReader);
if (pRow != NULL) {
TSDBKEY k = TSDBROW_KEY(pRow);
if (key.ts > k.ts) {
@@ -2470,22 +2305,98 @@ static int32_t doLoadRelatedLastBlock(SLastBlockReader* pLastBlockReader, STable
return TSDB_CODE_SUCCESS;
}
-static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
- SReaderStatus* pStatus = &pReader->status;
- SLastBlockReader* pLastBlockReader = pStatus->fileIter.pLastBlockReader;
+static int32_t uidComparFunc(const void* p1, const void* p2) {
+ uint64_t pu1 = *(uint64_t*) p1;
+ uint64_t pu2 = *(uint64_t*) p2;
+ if (pu1 == pu2) {
+ return 0;
+ } else {
+ return (pu1 < pu2)? -1:1;
+ }
+}
- while(1) {
- if (pStatus->pTableIter == NULL) {
- pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, NULL);
+static void extractOrderedTableUidList(SUidOrderCheckInfo *pOrderCheckInfo, SReaderStatus* pStatus) {
+ int32_t index = 0;
+ int32_t total = taosHashGetSize(pStatus->pTableMap);
+
+ void* p = taosHashIterate(pStatus->pTableMap, NULL);
+ while(p != NULL) {
+ STableBlockScanInfo* pScanInfo = p;
+ pOrderCheckInfo->tableUidList[index++] = pScanInfo->uid;
+ p = taosHashIterate(pStatus->pTableMap, p);
+ }
+
+ taosSort(pOrderCheckInfo->tableUidList, total, sizeof(uint64_t), uidComparFunc);
+}
+
+static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, SReaderStatus* pStatus) {
+ if (pOrderCheckInfo->tableUidList == NULL) {
+ int32_t total = taosHashGetSize(pStatus->pTableMap);
+
+ pOrderCheckInfo->currentIndex = 0;
+ pOrderCheckInfo->tableUidList = taosMemoryMalloc(total * sizeof(uint64_t));
+ if (pOrderCheckInfo->tableUidList == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ extractOrderedTableUidList(pOrderCheckInfo, pStatus);
+
+ uint64_t uid = pOrderCheckInfo->tableUidList[0];
+ pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
+ } else {
+ if (pStatus->pTableIter == NULL) { // it is the last block of a new file
+// ASSERT(pOrderCheckInfo->currentIndex == taosHashGetSize(pStatus->pTableMap));
+
+ pOrderCheckInfo->currentIndex = 0;
+ uint64_t uid = pOrderCheckInfo->tableUidList[pOrderCheckInfo->currentIndex];
+ pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
+
+ // the tableMap has already updated
if (pStatus->pTableIter == NULL) {
- return TSDB_CODE_SUCCESS;
+ void* p = taosMemoryRealloc(pOrderCheckInfo->tableUidList, taosHashGetSize(pStatus->pTableMap)*sizeof(uint64_t));
+ if (p == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pOrderCheckInfo->tableUidList = p;
+ extractOrderedTableUidList(pOrderCheckInfo, pStatus);
+
+ uid = pOrderCheckInfo->tableUidList[0];
+ pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
}
}
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static bool moveToNextTable(SUidOrderCheckInfo *pOrderedCheckInfo, SReaderStatus* pStatus) {
+ pOrderedCheckInfo->currentIndex += 1;
+ if (pOrderedCheckInfo->currentIndex >= taosHashGetSize(pStatus->pTableMap)) {
+ pStatus->pTableIter = NULL;
+ return false;
+ }
+ uint64_t uid = pOrderedCheckInfo->tableUidList[pOrderedCheckInfo->currentIndex];
+ pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
+ ASSERT(pStatus->pTableIter != NULL);
+ return true;
+}
+
+static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
+ SReaderStatus* pStatus = &pReader->status;
+ SLastBlockReader* pLastBlockReader = pStatus->fileIter.pLastBlockReader;
+
+ SUidOrderCheckInfo *pOrderedCheckInfo = &pStatus->uidCheckInfo;
+ int32_t code = initOrderCheckInfo(pOrderedCheckInfo, pStatus);
+ if (code != TSDB_CODE_SUCCESS || (taosHashGetSize(pStatus->pTableMap) == 0)) {
+ return code;
+ }
+
+ while(1) {
// load the last data block of current table
- // todo opt perf by avoiding load last block repeatly
STableBlockScanInfo* pScanInfo = pStatus->pTableIter;
- int32_t code = doLoadRelatedLastBlock(pLastBlockReader, pScanInfo, pReader);
+ code = doLoadRelatedLastBlock(pLastBlockReader, pScanInfo, pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2493,19 +2404,20 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
if (pLastBlockReader->currentBlockIndex != -1) {
initLastBlockReader(pLastBlockReader, pScanInfo->uid, &pScanInfo->indexInBlockL);
int32_t index = pScanInfo->indexInBlockL;
- if (index == DEFAULT_ROW_INDEX_VAL || index == pLastBlockReader->lastBlockData.nRow) {
+
+ if (index == INITIAL_ROW_INDEX_VAL || index == pLastBlockReader->lastBlockData.nRow) {
bool hasData = nextRowInLastBlock(pLastBlockReader, pScanInfo);
if (!hasData) { // current table does not have rows in last block, try next table
- pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, pStatus->pTableIter);
- if (pStatus->pTableIter == NULL) {
+ bool hasNexTable = moveToNextTable(pOrderedCheckInfo, pStatus);
+ if (!hasNexTable) {
return TSDB_CODE_SUCCESS;
}
continue;
}
}
} else { // no data in last block, try next table
- pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, pStatus->pTableIter);
- if (pStatus->pTableIter == NULL) {
+ bool hasNexTable = moveToNextTable(pOrderedCheckInfo, pStatus);
+ if (!hasNexTable) {
return TSDB_CODE_SUCCESS;
}
continue;
@@ -2521,8 +2433,8 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
}
// current table is exhausted, let's try next table
- pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, pStatus->pTableIter);
- if (pStatus->pTableIter == NULL) {
+ bool hasNexTable = moveToNextTable(pOrderedCheckInfo, pStatus);
+ if (!hasNexTable) {
return TSDB_CODE_SUCCESS;
}
}
@@ -2560,7 +2472,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
// note: the lastblock may be null here
initLastBlockReader(pLastBlockReader, pScanInfo->uid, &pScanInfo->indexInBlockL);
- if (pScanInfo->indexInBlockL == DEFAULT_ROW_INDEX_VAL || pScanInfo->indexInBlockL == pLastBlockReader->lastBlockData.nRow) {
+ if (pScanInfo->indexInBlockL == INITIAL_ROW_INDEX_VAL || pScanInfo->indexInBlockL == pLastBlockReader->lastBlockData.nRow) {
bool hasData = nextRowInLastBlock(pLastBlockReader, pScanInfo);
}
}
@@ -2672,7 +2584,7 @@ static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBl
code = initBlockIterator(pReader, pBlockIter, num.numOfBlocks);
} else { // no block data, only last block exists
tBlockDataReset(&pReader->status.fileBlockData);
- resetDataBlockIterator(pBlockIter, pReader->order, pReader->status.pTableMap);
+ resetDataBlockIterator(pBlockIter, pReader->order);
}
SLastBlockReader* pLReader = pReader->status.fileIter.pLastBlockReader;
@@ -2744,7 +2656,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
initBlockDumpInfo(pReader, pBlockIter);
} else if (taosArrayGetSize(pReader->status.fileIter.pLastBlockReader->pBlockL) > 0) { // data blocks in current file are exhausted, let's try the next file now
tBlockDataReset(&pReader->status.fileBlockData);
- resetDataBlockIterator(pBlockIter, pReader->order, pReader->status.pTableMap);
+ resetDataBlockIterator(pBlockIter, pReader->order);
goto _begin;
} else {
code = initForFirstBlockInFile(pReader, pBlockIter);
@@ -2928,7 +2840,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32
return false;
}
-TSDBROW* getValidRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader) {
+TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader) {
if (!pIter->hasVal) {
return NULL;
}
@@ -2976,7 +2888,7 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDe
}
// data exists but not valid
- TSDBROW* pRow = getValidRow(pIter, pDelList, pReader);
+ TSDBROW* pRow = getValidMemRow(pIter, pDelList, pReader);
if (pRow == NULL) {
break;
}
@@ -3100,7 +3012,6 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc
return TSDB_CODE_SUCCESS;
}
-// todo check if the rows are dropped or not
int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, SRowMerger* pMerger) {
while(nextRowInLastBlock(pLastBlockReader, pScanInfo)) {
int64_t next1 = getCurrentKeyInLastBlock(pLastBlockReader);
@@ -3115,7 +3026,7 @@ int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockSc
return TSDB_CODE_SUCCESS;
}
-void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList, STSRow** pTSRow,
+void doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDelList, STSRow** pTSRow,
STsdbReader* pReader, bool* freeTSRow) {
TSDBROW* pNextRow = NULL;
TSDBROW current = *pRow;
@@ -3128,7 +3039,7 @@ void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDe
*freeTSRow = false;
return;
} else { // has next point in mem/imem
- pNextRow = getValidRow(pIter, pDelList, pReader);
+ pNextRow = getValidMemRow(pIter, pDelList, pReader);
if (pNextRow == NULL) {
*pTSRow = current.pTSRow;
*freeTSRow = false;
@@ -3194,9 +3105,10 @@ void doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* pBlo
int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader, STSRow** pTSRow, int64_t endKey,
bool* freeTSRow) {
- TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
- TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
+ TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader);
+ TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader);
SArray* pDelList = pBlockScanInfo->delSkyline;
+ uint64_t uid = pBlockScanInfo->uid;
// todo refactor
bool asc = ASCENDING_TRAVERSE(pReader->order);
@@ -3218,10 +3130,12 @@ int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pR
TSDBKEY k = TSDBROW_KEY(pRow);
TSDBKEY ik = TSDBROW_KEY(piRow);
- if (ik.ts < k.ts) { // ik.ts < k.ts
- doMergeMultiRows(piRow, pBlockScanInfo->uid, &pBlockScanInfo->iiter, pDelList, pTSRow, pReader, freeTSRow);
- } else if (k.ts < ik.ts) {
- doMergeMultiRows(pRow, pBlockScanInfo->uid, &pBlockScanInfo->iter, pDelList, pTSRow, pReader, freeTSRow);
+ if (ik.ts != k.ts) {
+ if (((ik.ts < k.ts) && asc) || ((ik.ts > k.ts) && (!asc))) { // ik.ts < k.ts
+ doMergeMemTableMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, pTSRow, pReader, freeTSRow);
+ } else if (((k.ts < ik.ts) && asc) || ((k.ts > ik.ts) && (!asc))) {
+ doMergeMemTableMultiRows(pRow, uid, &pBlockScanInfo->iter, pDelList, pTSRow, pReader, freeTSRow);
+ }
} else { // ik.ts == k.ts
doMergeMemIMemRows(pRow, piRow, pBlockScanInfo, pReader, pTSRow);
*freeTSRow = true;
@@ -3231,12 +3145,12 @@ int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pR
}
if (pBlockScanInfo->iter.hasVal && pRow != NULL) {
- doMergeMultiRows(pRow, pBlockScanInfo->uid, &pBlockScanInfo->iter, pDelList, pTSRow, pReader, freeTSRow);
+ doMergeMemTableMultiRows(pRow, pBlockScanInfo->uid, &pBlockScanInfo->iter, pDelList, pTSRow, pReader, freeTSRow);
return TSDB_CODE_SUCCESS;
}
if (pBlockScanInfo->iiter.hasVal && piRow != NULL) {
- doMergeMultiRows(piRow, pBlockScanInfo->uid, &pBlockScanInfo->iiter, pDelList, pTSRow, pReader, freeTSRow);
+ doMergeMemTableMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, pTSRow, pReader, freeTSRow);
return TSDB_CODE_SUCCESS;
}
@@ -3364,7 +3278,7 @@ int32_t tsdbSetTableId(STsdbReader* pReader, int64_t uid) {
ASSERT(pReader != NULL);
taosHashClear(pReader->status.pTableMap);
- STableBlockScanInfo info = {.lastKey = 0, .uid = uid, .indexInBlockL = DEFAULT_ROW_INDEX_VAL};
+ STableBlockScanInfo info = {.lastKey = 0, .uid = uid, .indexInBlockL = INITIAL_ROW_INDEX_VAL};
taosHashPut(pReader->status.pTableMap, &info.uid, sizeof(uint64_t), &info, sizeof(info));
return TDB_CODE_SUCCESS;
}
@@ -3460,7 +3374,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
SDataBlockIter* pBlockIter = &pReader->status.blockIter;
initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
- resetDataBlockIterator(&pReader->status.blockIter, pReader->order, pReader->status.pTableMap);
+ resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
// no data in files, let's try buffer in memory
if (pReader->status.fileIter.numOfFiles == 0) {
@@ -3481,7 +3395,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
}
initFilesetIterator(&pPrevReader->status.fileIter, pPrevReader->pReadSnap->fs.aDFileSet, pPrevReader);
- resetDataBlockIterator(&pPrevReader->status.blockIter, pPrevReader->order, pReader->status.pTableMap);
+ resetDataBlockIterator(&pPrevReader->status.blockIter, pPrevReader->order);
// no data in files, let's try buffer in memory
if (pPrevReader->status.fileIter.numOfFiles == 0) {
@@ -3532,6 +3446,8 @@ void tsdbReaderClose(STsdbReader* pReader) {
tsdbDataFReaderClose(&pReader->pFileReader);
}
+ taosMemoryFree(pReader->status.uidCheckInfo.tableUidList);
+
SFilesetIter* pFilesetIter = &pReader->status.fileIter;
if (pFilesetIter->pLastBlockReader != NULL) {
tBlockDataDestroy(&pFilesetIter->pLastBlockReader->lastBlockData, true);
@@ -3782,7 +3698,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
tsdbDataFReaderClose(&pReader->pFileReader);
initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
- resetDataBlockIterator(&pReader->status.blockIter, pReader->order, pReader->status.pTableMap);
+ resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
resetDataBlockScanInfo(pReader->status.pTableMap);
int32_t code = 0;
diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c
index 4418ce20e88b8c461e55fbe0d7b4a8348e032379..580ab8bc93cac3a5057821f238cf85fc1011fa38 100644
--- a/source/dnode/vnode/src/vnd/vnodeCfg.c
+++ b/source/dnode/vnode/src/vnd/vnodeCfg.c
@@ -117,6 +117,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
if (tjsonAddIntegerToObject(pJson, "vndStats.ctables", pCfg->vndStats.numOfCTables) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "vndStats.ntables", pCfg->vndStats.numOfNTables) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "vndStats.timeseries", pCfg->vndStats.numOfTimeSeries) < 0) return -1;
+ if (tjsonAddIntegerToObject(pJson, "vndStats.ntimeseries", pCfg->vndStats.numOfNTimeSeries) < 0) return -1;
SJson *pNodeInfoArr = tjsonCreateArray();
tjsonAddItemToObject(pJson, "syncCfg.nodeInfo", pNodeInfoArr);
@@ -224,6 +225,8 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
if (code < 0) return -1;
tjsonGetNumberValue(pJson, "vndStats.timeseries", pCfg->vndStats.numOfTimeSeries, code);
if (code < 0) return -1;
+ tjsonGetNumberValue(pJson, "vndStats.ntimeseries", pCfg->vndStats.numOfNTimeSeries, code);
+ if (code < 0) return -1;
SJson *pNodeInfoArr = tjsonGetObjectItem(pJson, "syncCfg.nodeInfo");
int arraySize = tjsonGetArraySize(pNodeInfoArr);
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index dcfbd33b903c9fcd55e216bd1b24c73f2845af7b..a4fd984fb762a934b48489da254b3af1aa4dc908 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -87,7 +87,6 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
pVnode->msgCb = msgCb;
taosThreadMutexInit(&pVnode->lock, NULL);
pVnode->blocked = false;
- pVnode->inClose = false;
tsem_init(&pVnode->syncSem, 0, 0);
tsem_init(&(pVnode->canCommit), 0, 1);
@@ -182,8 +181,6 @@ _err:
void vnodePreClose(SVnode *pVnode) {
if (pVnode) {
syncLeaderTransfer(pVnode->sync);
- pVnode->inClose = true;
- smaPreClose(pVnode->pSma);
}
}
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 7a8d168f4f1a2cb4b1379e9d5794ff58e83841bf..85feecff1a0247790eec14b503b7dda6247a6c87 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -301,8 +301,6 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
return qWorkerProcessQueryMsg(&handle, pVnode->pQuery, pMsg, 0);
case TDMT_SCH_QUERY_CONTINUE:
return qWorkerProcessCQueryMsg(&handle, pVnode->pQuery, pMsg, 0);
- case TDMT_VND_EXEC_RSMA:
- return smaProcessExec(pVnode->pSma, pMsg);
default:
vError("unknown msg type:%d in query queue", pMsg->msgType);
return TSDB_CODE_VND_APP_ERROR;
@@ -370,6 +368,10 @@ void smaHandleRes(void *pVnode, int64_t smaId, const SArray *data) {
}
void vnodeUpdateMetaRsp(SVnode *pVnode, STableMetaRsp *pMetaRsp) {
+ if (NULL == pMetaRsp) {
+ return;
+ }
+
strcpy(pMetaRsp->dbFName, pVnode->config.dbname);
pMetaRsp->dbId = pVnode->config.dbId;
pMetaRsp->vgId = TD_VID(pVnode);
@@ -380,14 +382,14 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq,
int32_t code = 0;
SVTrimDbReq trimReq = {0};
- vInfo("vgId:%d, trim vnode request will be processed, time:%d", pVnode->config.vgId, trimReq.timestamp);
-
// decode
if (tDeserializeSVTrimDbReq(pReq, len, &trimReq) != 0) {
code = TSDB_CODE_INVALID_MSG;
goto _exit;
}
+ vInfo("vgId:%d, trim vnode request will be processed, time:%d", pVnode->config.vgId, trimReq.timestamp);
+
// process
code = tsdbDoRetention(pVnode->pTsdb, trimReq.timestamp);
if (code) goto _exit;
@@ -514,7 +516,7 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR
}
// do create table
- if (metaCreateTable(pVnode->pMeta, version, pCreateReq) < 0) {
+ if (metaCreateTable(pVnode->pMeta, version, pCreateReq, &cRsp.pMeta) < 0) {
if (pCreateReq->flags & TD_CREATE_IF_NOT_EXISTS && terrno == TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
cRsp.code = TSDB_CODE_SUCCESS;
} else {
@@ -524,6 +526,7 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR
cRsp.code = TSDB_CODE_SUCCESS;
tdFetchTbUidList(pVnode->pSma, &pStore, pCreateReq->ctb.suid, pCreateReq->uid);
taosArrayPush(tbUids, &pCreateReq->uid);
+ vnodeUpdateMetaRsp(pVnode, cRsp.pMeta);
}
taosArrayPush(rsp.pArray, &cRsp);
@@ -552,7 +555,7 @@ _exit:
pCreateReq = req.pReqs + iReq;
taosArrayDestroy(pCreateReq->ctb.tagName);
}
- taosArrayDestroy(rsp.pArray);
+ taosArrayDestroyEx(rsp.pArray, tFreeSVCreateTbRsp);
taosArrayDestroy(tbUids);
tDecoderClear(&decoder);
tEncoderClear(&encoder);
@@ -864,7 +867,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
goto _exit;
}
- if (metaCreateTable(pVnode->pMeta, version, &createTbReq) < 0) {
+ if (metaCreateTable(pVnode->pMeta, version, &createTbReq, &submitBlkRsp.pMeta) < 0) {
if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
submitBlkRsp.code = terrno;
pRsp->code = terrno;
@@ -872,6 +875,10 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
taosArrayDestroy(createTbReq.ctb.tagName);
goto _exit;
}
+ } else {
+ if (NULL != submitBlkRsp.pMeta) {
+ vnodeUpdateMetaRsp(pVnode, submitBlkRsp.pMeta);
+ }
}
taosArrayPush(newTbUids, &createTbReq.uid);
@@ -915,11 +922,7 @@ _exit:
tEncodeSSubmitRsp(&encoder, &submitRsp);
tEncoderClear(&encoder);
- for (int32_t i = 0; i < taosArrayGetSize(submitRsp.pArray); i++) {
- taosMemoryFree(((SSubmitBlkRsp *)taosArrayGet(submitRsp.pArray, i))[0].tblFName);
- }
-
- taosArrayDestroy(submitRsp.pArray);
+ taosArrayDestroyEx(submitRsp.pArray, tFreeSSubmitBlkRsp);
// TODO: the partial success scenario and the error case
// => If partial success, extract the success submitted rows and reconstruct a new submit msg, and push to level
diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h
index 777dcd0592ae69de003d5df0d1d9d2592302d195..9b62581051daac9c232409c0cb30d379e3a4d596 100644
--- a/source/libs/catalog/inc/catalogInt.h
+++ b/source/libs/catalog/inc/catalogInt.h
@@ -188,7 +188,7 @@ typedef struct SCtgTbCache {
typedef struct SCtgVgCache {
SRWLatch vgLock;
- SDBVgInfo *vgInfo;
+ SDBVgInfo *vgInfo;
} SCtgVgCache;
typedef struct SCtgDBCache {
@@ -224,7 +224,7 @@ typedef struct SCtgUserAuth {
} SCtgUserAuth;
typedef struct SCatalog {
- uint64_t clusterId;
+ uint64_t clusterId;
SHashObj *userCache; //key:user, value:SCtgUserAuth
SHashObj *dbCache; //key:dbname, value:SCtgDBCache
SCtgRentMgmt dbRent;
@@ -253,9 +253,9 @@ typedef struct SCtgJob {
int32_t jobResCode;
int32_t taskIdx;
SRWLatch taskLock;
-
+
uint64_t queryId;
- SCatalog* pCtg;
+ SCatalog* pCtg;
SRequestConnInfo conn;
void* userParam;
catalogCallback userFp;
@@ -279,7 +279,7 @@ typedef struct SCtgMsgCtx {
void* lastOut;
void* out;
char* target;
- SHashObj* pBatchs;
+ SHashObj* pBatchs;
} SCtgMsgCtx;
@@ -364,7 +364,7 @@ typedef struct SCtgCacheStat {
uint64_t numOfMetaHit;
uint64_t numOfMetaMiss;
uint64_t numOfIndexHit;
- uint64_t numOfIndexMiss;
+ uint64_t numOfIndexMiss;
uint64_t numOfUserHit;
uint64_t numOfUserMiss;
uint64_t numOfClear;
@@ -451,7 +451,7 @@ typedef struct SCtgCacheOperation {
int32_t opId;
void *data;
bool syncOp;
- tsem_t rspSem;
+ tsem_t rspSem;
bool stopQueue;
bool unLocked;
} SCtgCacheOperation;
@@ -466,7 +466,7 @@ typedef struct SCtgQueue {
bool stopQueue;
SCtgQNode *head;
SCtgQNode *tail;
- tsem_t reqSem;
+ tsem_t reqSem;
uint64_t qRemainNum;
} SCtgQueue;
@@ -475,7 +475,7 @@ typedef struct SCatalogMgmt {
int32_t jobPool;
SRWLatch lock;
SCtgQueue queue;
- TdThread updateThread;
+ TdThread updateThread;
SHashObj *pCluster; //key: clusterId, value: SCatalog*
SCatalogStat stat;
SCatalogCfg cfg;
@@ -528,8 +528,8 @@ typedef struct SCtgOperation {
#define CTG_META_SIZE(pMeta) (sizeof(STableMeta) + ((pMeta)->tableInfo.numOfTags + (pMeta)->tableInfo.numOfColumns) * sizeof(SSchema))
-#define CTG_TABLE_NOT_EXIST(code) (code == CTG_ERR_CODE_TABLE_NOT_EXIST)
-#define CTG_DB_NOT_EXIST(code) (code == TSDB_CODE_MND_DB_NOT_EXIST)
+#define CTG_TABLE_NOT_EXIST(code) (code == CTG_ERR_CODE_TABLE_NOT_EXIST)
+#define CTG_DB_NOT_EXIST(code) (code == TSDB_CODE_MND_DB_NOT_EXIST)
#define ctgFatal(param, ...) qFatal("CTG:%p " param, pCtg, __VA_ARGS__)
#define ctgError(param, ...) qError("CTG:%p " param, pCtg, __VA_ARGS__)
@@ -576,7 +576,7 @@ typedef struct SCtgOperation {
} \
} while (0)
-
+
#define CTG_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define CTG_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define CTG_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c
index b6e958e1929cc71dfa43ad018728e1f1844cb472..7b32eadcd415116f67db8526449c8a6759f45bcd 100644
--- a/source/libs/catalog/src/catalog.c
+++ b/source/libs/catalog/src/catalog.c
@@ -270,13 +270,22 @@ int32_t ctgUpdateTbMeta(SCatalog* pCtg, STableMetaRsp* rspMsg, bool syncOp) {
int32_t code = 0;
strcpy(output->dbFName, rspMsg->dbFName);
- strcpy(output->tbName, rspMsg->tbName);
output->dbId = rspMsg->dbId;
- SET_META_TYPE_TABLE(output->metaType);
+ if (TSDB_CHILD_TABLE == rspMsg->tableType && NULL == rspMsg->pSchemas) {
+ strcpy(output->ctbName, rspMsg->tbName);
- CTG_ERR_JRET(queryCreateTableMetaFromMsg(rspMsg, rspMsg->tableType == TSDB_SUPER_TABLE, &output->tbMeta));
+ SET_META_TYPE_CTABLE(output->metaType);
+
+ CTG_ERR_JRET(queryCreateCTableMetaFromMsg(rspMsg, &output->ctbMeta));
+ } else {
+ strcpy(output->tbName, rspMsg->tbName);
+
+ SET_META_TYPE_TABLE(output->metaType);
+
+ CTG_ERR_JRET(queryCreateTableMetaFromMsg(rspMsg, rspMsg->tableType == TSDB_SUPER_TABLE, &output->tbMeta));
+ }
CTG_ERR_JRET(ctgUpdateTbMetaEnqueue(pCtg, output, syncOp));
diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c
index 64ca85edf45ac515bd7728883c171b04c399d148..585b33930c2cae0332ee77a3933d5a86288c77bc 100644
--- a/source/libs/catalog/src/ctgAsync.c
+++ b/source/libs/catalog/src/ctgAsync.c
@@ -39,7 +39,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
memcpy(ctx->pName, name, sizeof(*name));
ctx->flag = CTG_FLAG_UNKNOWN_STB;
@@ -69,7 +69,7 @@ int32_t ctgInitGetTbMetasTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
taosArrayPush(pJob->pTasks, &task);
- qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%d, tbNum:%d",
+ qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%d, tbNum:%d",
pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), taosArrayGetSize(ctx->pNames), pJob->tbMetaNum);
return TSDB_CODE_SUCCESS;
@@ -89,7 +89,7 @@ int32_t ctgInitGetDbVgTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
}
SCtgDbVgCtx* ctx = task.taskCtx;
-
+
memcpy(ctx->dbFName, dbFName, sizeof(ctx->dbFName));
taosArrayPush(pJob->pTasks, &task);
@@ -113,7 +113,7 @@ int32_t ctgInitGetDbCfgTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
}
SCtgDbCfgCtx* ctx = task.taskCtx;
-
+
memcpy(ctx->dbFName, dbFName, sizeof(ctx->dbFName));
taosArrayPush(pJob->pTasks, &task);
@@ -137,7 +137,7 @@ int32_t ctgInitGetDbInfoTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
}
SCtgDbInfoCtx* ctx = task.taskCtx;
-
+
memcpy(ctx->dbFName, dbFName, sizeof(ctx->dbFName));
taosArrayPush(pJob->pTasks, &task);
@@ -167,7 +167,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
memcpy(ctx->pName, name, sizeof(*name));
tNameGetFullDbName(ctx->pName, ctx->dbFName);
@@ -197,7 +197,7 @@ int32_t ctgInitGetTbHashsTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
taosArrayPush(pJob->pTasks, &task);
- qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%d, tbNum:%d",
+ qDebug("QID:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%d, tbNum:%d",
pJob->queryId, taskIdx, ctgTaskTypeStr(task.type), taosArrayGetSize(ctx->pNames), pJob->tbHashNum);
return TSDB_CODE_SUCCESS;
@@ -248,7 +248,7 @@ int32_t ctgInitGetIndexTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
}
SCtgIndexCtx* ctx = task.taskCtx;
-
+
strcpy(ctx->indexFName, name);
taosArrayPush(pJob->pTasks, &task);
@@ -272,7 +272,7 @@ int32_t ctgInitGetUdfTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
}
SCtgUdfCtx* ctx = task.taskCtx;
-
+
strcpy(ctx->udfName, name);
taosArrayPush(pJob->pTasks, &task);
@@ -296,7 +296,7 @@ int32_t ctgInitGetUserTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
}
SCtgUserCtx* ctx = task.taskCtx;
-
+
memcpy(&ctx->user, user, sizeof(*user));
taosArrayPush(pJob->pTasks, &task);
@@ -339,7 +339,7 @@ int32_t ctgInitGetTbIndexTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
memcpy(ctx->pName, name, sizeof(*name));
taosArrayPush(pJob->pTasks, &task);
@@ -368,7 +368,7 @@ int32_t ctgInitGetTbCfgTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
memcpy(ctx->pName, name, sizeof(*name));
taosArrayPush(pJob->pTasks, &task);
@@ -387,7 +387,7 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob *pJob, con
taosHashCleanup(pTb);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
for (int32_t i = 0; i < pJob->dbVgNum; ++i) {
char* dbFName = taosArrayGet(pReq->pDbVgroup, i);
taosHashPut(pDb, dbFName, strlen(dbFName), dbFName, TSDB_DB_FNAME_LEN);
@@ -474,7 +474,7 @@ int32_t ctgInitTask(SCtgJob *pJob, CTG_TASK_TYPE type, void* param, int32_t *tas
if (taskId) {
*taskId = tid;
}
-
+
return TSDB_CODE_SUCCESS;
}
@@ -510,7 +510,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const
pJob->pCtg = pCtg;
pJob->conn = *pConn;
pJob->userParam = param;
-
+
pJob->tbMetaNum = tbMetaNum;
pJob->tbHashNum = tbHashNum;
pJob->qnodeNum = qnodeNum;
@@ -844,20 +844,20 @@ int32_t ctgDumpSvrVer(SCtgTask* pTask) {
pJob->jobRes.pSvrVer->code = pTask->code;
pJob->jobRes.pSvrVer->pRes = pTask->res;
-
+
return TSDB_CODE_SUCCESS;
}
int32_t ctgCallSubCb(SCtgTask *pTask) {
int32_t code = 0;
-
+
CTG_LOCK(CTG_WRITE, &pTask->lock);
-
+
int32_t parentNum = taosArrayGetSize(pTask->pParents);
for (int32_t i = 0; i < parentNum; ++i) {
SCtgMsgCtx *pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
SCtgTask* pParent = taosArrayGetP(pTask->pParents, i);
-
+
pParent->subRes.code = pTask->code;
if (TSDB_CODE_SUCCESS == pTask->code) {
code = (*gCtgAsyncFps[pTask->type].cloneFp)(pTask, &pParent->subRes.res);
@@ -868,22 +868,22 @@ int32_t ctgCallSubCb(SCtgTask *pTask) {
SCtgMsgCtx *pParMsgCtx = CTG_GET_TASK_MSGCTX(pParent, -1);
- pParMsgCtx->pBatchs = pMsgCtx->pBatchs;
+ pParMsgCtx->pBatchs = pMsgCtx->pBatchs;
CTG_ERR_JRET(pParent->subRes.fp(pParent));
}
-
+
_return:
CTG_UNLOCK(CTG_WRITE, &pTask->lock);
- CTG_RET(code);
+ CTG_RET(code);
}
int32_t ctgCallUserCb(void* param) {
SCtgJob* pJob = (SCtgJob*)param;
qDebug("QID:0x%" PRIx64 " ctg start to call user cb with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode));
-
+
(*pJob->userFp)(&pJob->jobRes, pJob->userParam, pJob->jobResCode);
qDebug("QID:0x%" PRIx64 " ctg end to call user cb", pJob->queryId);
@@ -922,9 +922,9 @@ _return:
//taosSsleep(2);
//qDebug("QID:0x%" PRIx64 " ctg after sleep", pJob->queryId);
-
+
taosAsyncExec(ctgCallUserCb, pJob, NULL);
-
+
CTG_RET(code);
}
@@ -932,7 +932,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
int32_t code = 0;
SCtgDBCache *dbCache = NULL;
SCtgTask* pTask = tReq->pTask;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgMsgCtx* pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx);
SCtgTbMetaCtx* ctx = (SCtgTbMetaCtx*)pTask->taskCtx;
@@ -958,38 +958,38 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
}
case TDMT_MND_TABLE_META: {
STableMetaOutput* pOut = (STableMetaOutput*)pMsgCtx->out;
-
+
if (CTG_IS_META_NULL(pOut->metaType)) {
if (CTG_FLAG_IS_STB(flag)) {
char dbFName[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pName, dbFName);
-
+
CTG_ERR_RET(ctgAcquireVgInfoFromCache(pCtg, dbFName, &dbCache));
if (NULL != dbCache) {
SVgroupInfo vgInfo = {0};
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, dbCache->vgCache.vgInfo, pName, &vgInfo));
-
+
ctgDebug("will refresh tbmeta, supposed to be stb, tbName:%s, flag:%d", tNameGetTableName(pName), flag);
- *vgId = vgInfo.vgId;
+ *vgId = vgInfo.vgId;
CTG_ERR_JRET(ctgGetTbMetaFromVnode(pCtg, pConn, pName, &vgInfo, NULL, tReq));
ctgReleaseVgInfoToCache(pCtg, dbCache);
} else {
SBuildUseDBInput input = {0};
-
+
tstrncpy(input.db, dbFName, tListLen(input.db));
input.vgVersion = CTG_DEFAULT_INVALID_VERSION;
-
+
CTG_ERR_JRET(ctgGetDBVgInfoFromMnode(pCtg, pConn, &input, NULL, tReq));
}
return TSDB_CODE_SUCCESS;
}
-
+
ctgError("no tbmeta got, tbName:%s", tNameGetTableName(pName));
ctgRemoveTbMetaFromCache(pCtg, pName, false);
-
+
CTG_ERR_JRET(CTG_ERR_CODE_TABLE_NOT_EXIST);
}
@@ -998,12 +998,12 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
STableMetaOutput* pLastOut = (STableMetaOutput*)pMsgCtx->out;
TSWAP(pLastOut->tbMeta, pOut->tbMeta);
}
-
+
break;
}
case TDMT_VND_TABLE_META: {
STableMetaOutput* pOut = (STableMetaOutput*)pMsgCtx->out;
-
+
if (CTG_IS_META_NULL(pOut->metaType)) {
ctgError("no tbmeta got, tbNmae:%s", tNameGetTableName(pName));
ctgRemoveTbMetaFromCache(pCtg, pName, false);
@@ -1013,12 +1013,12 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
if (CTG_FLAG_IS_STB(flag)) {
break;
}
-
+
if (CTG_IS_META_TABLE(pOut->metaType) && TSDB_SUPER_TABLE == pOut->tbMeta->tableType) {
ctgDebug("will continue to refresh tbmeta since got stb, tbName:%s", tNameGetTableName(pName));
-
+
taosMemoryFreeClear(pOut->tbMeta);
-
+
CTG_RET(ctgGetTbMetaFromMnode(pCtg, pConn, pName, NULL, tReq));
} else if (CTG_IS_META_BOTH(pOut->metaType)) {
int32_t exist = 0;
@@ -1029,13 +1029,13 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
stbCtx.flag = flag;
stbCtx.pName = &stbName;
- taosMemoryFreeClear(pOut->tbMeta);
+ taosMemoryFreeClear(pOut->tbMeta);
CTG_ERR_JRET(ctgReadTbMetaFromCache(pCtg, &stbCtx, &pOut->tbMeta));
if (pOut->tbMeta) {
exist = 1;
}
}
-
+
if (0 == exist) {
TSWAP(pMsgCtx->lastOut, pMsgCtx->out);
CTG_RET(ctgGetTbMetaFromMnodeImpl(pCtg, pConn, pOut->dbFName, pOut->tbName, NULL, tReq));
@@ -1056,7 +1056,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
if (CTG_IS_META_BOTH(pOut->metaType)) {
memcpy(pOut->tbMeta, &pOut->ctbMeta, sizeof(pOut->ctbMeta));
}
-
+
/*
else if (CTG_IS_META_CTABLE(pOut->metaType)) {
SName stbName = *pName;
@@ -1064,7 +1064,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
SCtgTbMetaCtx stbCtx = {0};
stbCtx.flag = flag;
stbCtx.pName = &stbName;
-
+
CTG_ERR_JRET(ctgReadTbMetaFromCache(pCtg, &stbCtx, &pOut->tbMeta));
if (NULL == pOut->tbMeta) {
ctgDebug("stb no longer exist, stbName:%s", stbName.tname);
@@ -1088,7 +1088,7 @@ _return:
if (pTask->res || code) {
ctgHandleTaskEnd(pTask, code);
}
-
+
CTG_RET(code);
}
@@ -1097,7 +1097,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
int32_t code = 0;
SCtgDBCache *dbCache = NULL;
SCtgTask* pTask = tReq->pTask;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgMsgCtx* pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx);
SCtgTbMetasCtx* ctx = (SCtgTbMetasCtx*)pTask->taskCtx;
@@ -1125,38 +1125,38 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
}
case TDMT_MND_TABLE_META: {
STableMetaOutput* pOut = (STableMetaOutput*)pMsgCtx->out;
-
+
if (CTG_IS_META_NULL(pOut->metaType)) {
if (CTG_FLAG_IS_STB(flag)) {
char dbFName[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pName, dbFName);
-
+
CTG_ERR_RET(ctgAcquireVgInfoFromCache(pCtg, dbFName, &dbCache));
if (NULL != dbCache) {
SVgroupInfo vgInfo = {0};
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, dbCache->vgCache.vgInfo, pName, &vgInfo));
-
+
ctgDebug("will refresh tbmeta, supposed to be stb, tbName:%s, flag:%d", tNameGetTableName(pName), flag);
- *vgId = vgInfo.vgId;
+ *vgId = vgInfo.vgId;
CTG_ERR_JRET(ctgGetTbMetaFromVnode(pCtg, pConn, pName, &vgInfo, NULL, tReq));
ctgReleaseVgInfoToCache(pCtg, dbCache);
} else {
SBuildUseDBInput input = {0};
-
+
tstrncpy(input.db, dbFName, tListLen(input.db));
input.vgVersion = CTG_DEFAULT_INVALID_VERSION;
-
+
CTG_ERR_JRET(ctgGetDBVgInfoFromMnode(pCtg, pConn, &input, NULL, tReq));
}
return TSDB_CODE_SUCCESS;
}
-
+
ctgError("no tbmeta got, tbName:%s", tNameGetTableName(pName));
ctgRemoveTbMetaFromCache(pCtg, pName, false);
-
+
CTG_ERR_JRET(CTG_ERR_CODE_TABLE_NOT_EXIST);
}
@@ -1165,12 +1165,12 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
STableMetaOutput* pLastOut = (STableMetaOutput*)pMsgCtx->out;
TSWAP(pLastOut->tbMeta, pOut->tbMeta);
}
-
+
break;
}
case TDMT_VND_TABLE_META: {
STableMetaOutput* pOut = (STableMetaOutput*)pMsgCtx->out;
-
+
if (CTG_IS_META_NULL(pOut->metaType)) {
ctgError("no tbmeta got, tbNmae:%s", tNameGetTableName(pName));
ctgRemoveTbMetaFromCache(pCtg, pName, false);
@@ -1180,12 +1180,12 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
if (CTG_FLAG_IS_STB(flag)) {
break;
}
-
+
if (CTG_IS_META_TABLE(pOut->metaType) && TSDB_SUPER_TABLE == pOut->tbMeta->tableType) {
ctgDebug("will continue to refresh tbmeta since got stb, tbName:%s", tNameGetTableName(pName));
-
+
taosMemoryFreeClear(pOut->tbMeta);
-
+
CTG_RET(ctgGetTbMetaFromMnode(pCtg, pConn, pName, NULL, tReq));
} else if (CTG_IS_META_BOTH(pOut->metaType)) {
int32_t exist = 0;
@@ -1196,14 +1196,14 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
stbCtx.flag = flag;
stbCtx.pName = &stbName;
- taosMemoryFreeClear(pOut->tbMeta);
+ taosMemoryFreeClear(pOut->tbMeta);
CTG_ERR_JRET(ctgReadTbMetaFromCache(pCtg, &stbCtx, &pOut->tbMeta));
if (pOut->tbMeta) {
ctgDebug("use cached stb meta, tbName:%s", tNameGetTableName(pName));
exist = 1;
}
}
-
+
if (0 == exist) {
TSWAP(pMsgCtx->lastOut, pMsgCtx->out);
CTG_RET(ctgGetTbMetaFromMnodeImpl(pCtg, pConn, pOut->dbFName, pOut->tbName, NULL, tReq));
@@ -1224,7 +1224,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
if (CTG_IS_META_BOTH(pOut->metaType)) {
memcpy(pOut->tbMeta, &pOut->ctbMeta, sizeof(pOut->ctbMeta));
}
-
+
/*
else if (CTG_IS_META_CTABLE(pOut->metaType)) {
SName stbName = *pName;
@@ -1232,7 +1232,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
SCtgTbMetaCtx stbCtx = {0};
stbCtx.flag = flag;
stbCtx.pName = &stbName;
-
+
CTG_ERR_JRET(ctgReadTbMetaFromCache(pCtg, &stbCtx, &pOut->tbMeta));
if (NULL == pOut->tbMeta) {
ctgDebug("stb no longer exist, stbName:%s", stbName.tname);
@@ -1273,7 +1273,7 @@ _return:
if (pTask->res && taskDone) {
ctgHandleTaskEnd(pTask, code);
}
-
+
CTG_RET(code);
}
@@ -1282,7 +1282,7 @@ int32_t ctgHandleGetDbVgRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf *
int32_t code = 0;
SCtgTask* pTask = tReq->pTask;
SCtgDbVgCtx* ctx = (SCtgDbVgCtx*)pTask->taskCtx;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
@@ -1290,7 +1290,7 @@ int32_t ctgHandleGetDbVgRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf *
case TDMT_MND_USE_DB: {
SUseDbOutput* pOut = (SUseDbOutput*)pTask->msgCtx.out;
SDBVgInfo* pDb = NULL;
-
+
CTG_ERR_JRET(ctgGenerateVgList(pCtg, pOut->dbVgroup->vgHash, (SArray**)&pTask->res));
CTG_ERR_JRET(cloneDbVgInfo(pOut->dbVgroup, &pDb));
@@ -1316,7 +1316,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
int32_t code = 0;
SCtgTask* pTask = tReq->pTask;
SCtgTbHashCtx* ctx = (SCtgTbHashCtx*)pTask->taskCtx;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
@@ -1330,7 +1330,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
}
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, pOut->dbVgroup, ctx->pName, (SVgroupInfo*)pTask->res));
-
+
CTG_ERR_JRET(ctgUpdateVgroupEnqueue(pCtg, ctx->dbFName, pOut->dbId, pOut->dbVgroup, false));
pOut->dbVgroup = NULL;
@@ -1354,7 +1354,7 @@ int32_t ctgHandleGetTbHashsRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
int32_t code = 0;
SCtgTask* pTask = tReq->pTask;
SCtgTbHashsCtx* ctx = (SCtgTbHashsCtx*)pTask->taskCtx;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SCtgMsgCtx* pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, tReq->msgIdx);
SCtgFetch* pFetch = taosArrayGet(ctx->pFetchs, tReq->msgIdx);
bool taskDone = false;
@@ -1367,7 +1367,7 @@ int32_t ctgHandleGetTbHashsRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
STablesReq* pReq = taosArrayGet(ctx->pNames, pFetch->dbIdx);
CTG_ERR_JRET(ctgGetVgInfosFromHashValue(pCtg, tReq, pOut->dbVgroup, ctx, pMsgCtx->target, pReq->pTables, true));
-
+
CTG_ERR_JRET(ctgUpdateVgroupEnqueue(pCtg, pMsgCtx->target, pOut->dbId, pOut->dbVgroup, false));
pOut->dbVgroup = NULL;
@@ -1394,7 +1394,7 @@ _return:
pRes->code = code;
pRes->pRes = NULL;
}
-
+
if (0 == atomic_sub_fetch_32(&ctx->fetchNum, 1)) {
TSWAP(pTask->res, ctx->pResList);
taskDone = true;
@@ -1419,9 +1419,9 @@ int32_t ctgHandleGetTbIndexRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
CTG_ERR_JRET(ctgCloneTableIndex(pOut->pIndex, &pInfo));
pTask->res = pInfo;
- SCtgTbIndexCtx* ctx = pTask->taskCtx;
+ SCtgTbIndexCtx* ctx = pTask->taskCtx;
CTG_ERR_JRET(ctgUpdateTbIndexEnqueue(pTask->pJob->pCtg, (STableIndex**)&pTask->msgCtx.out, false));
-
+
_return:
if (TSDB_CODE_MND_DB_INDEX_NOT_EXIST == code) {
@@ -1438,7 +1438,7 @@ int32_t ctgHandleGetTbCfgRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_JRET(ctgProcessRspMsg(&pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
TSWAP(pTask->res, pTask->msgCtx.out);
-
+
_return:
ctgHandleTaskEnd(pTask, code);
@@ -1452,7 +1452,7 @@ int32_t ctgHandleGetDbCfgRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
TSWAP(pTask->res, pTask->msgCtx.out);
-
+
_return:
ctgHandleTaskEnd(pTask, code);
@@ -1471,7 +1471,7 @@ int32_t ctgHandleGetQnodeRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
TSWAP(pTask->res, pTask->msgCtx.out);
-
+
_return:
ctgHandleTaskEnd(pTask, code);
@@ -1485,7 +1485,7 @@ int32_t ctgHandleGetDnodeRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_JRET(ctgProcessRspMsg(&pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
TSWAP(pTask->res, pTask->msgCtx.out);
-
+
_return:
ctgHandleTaskEnd(pTask, code);
@@ -1499,7 +1499,7 @@ int32_t ctgHandleGetIndexRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
TSWAP(pTask->res, pTask->msgCtx.out);
-
+
_return:
ctgHandleTaskEnd(pTask, code);
@@ -1513,7 +1513,7 @@ int32_t ctgHandleGetUdfRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf *p
CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
TSWAP(pTask->res, pTask->msgCtx.out);
-
+
_return:
ctgHandleTaskEnd(pTask, code);
@@ -1525,7 +1525,7 @@ int32_t ctgHandleGetUserRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf *
int32_t code = 0;
SCtgTask* pTask = tReq->pTask;
SCtgUserCtx* ctx = (SCtgUserCtx*)pTask->taskCtx;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
bool pass = false;
SGetUserAuthRsp* pOut = (SGetUserAuthRsp*)pTask->msgCtx.out;
@@ -1573,7 +1573,7 @@ int32_t ctgHandleGetSvrVerRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
CTG_ERR_JRET(ctgProcessRspMsg(&pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
TSWAP(pTask->res, pTask->msgCtx.out);
-
+
_return:
ctgHandleTaskEnd(pTask, code);
@@ -1583,7 +1583,7 @@ _return:
int32_t ctgAsyncRefreshTbMeta(SCtgTaskReq *tReq, int32_t flag, SName* pName, int32_t* vgId) {
SCtgTask* pTask = tReq->pTask;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
int32_t code = 0;
@@ -1603,7 +1603,7 @@ int32_t ctgAsyncRefreshTbMeta(SCtgTaskReq *tReq, int32_t flag, SName* pName, int
SCtgDBCache *dbCache = NULL;
char dbFName[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pName, dbFName);
-
+
CTG_ERR_RET(ctgAcquireVgInfoFromCache(pCtg, dbFName, &dbCache));
if (dbCache) {
SVgroupInfo vgInfo = {0};
@@ -1632,7 +1632,7 @@ _return:
}
int32_t ctgLaunchGetTbMetaTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgJob* pJob = pTask->pJob;
SCtgMsgCtx *pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
@@ -1649,14 +1649,14 @@ int32_t ctgLaunchGetTbMetaTask(SCtgTask *pTask) {
SCtgTbMetaCtx* pCtx = (SCtgTbMetaCtx*)pTask->taskCtx;
SCtgTaskReq tReq;
tReq.pTask = pTask;
- tReq.msgIdx = -1;
+ tReq.msgIdx = -1;
CTG_ERR_RET(ctgAsyncRefreshTbMeta(&tReq, pCtx->flag, pCtx->pName, &pCtx->vgId));
return TSDB_CODE_SUCCESS;
}
int32_t ctgLaunchGetTbMetasTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgTbMetasCtx* pCtx = (SCtgTbMetasCtx*)pTask->taskCtx;
SCtgJob* pJob = pTask->pJob;
@@ -1670,18 +1670,18 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask *pTask) {
CTG_ERR_RET(ctgGetTbMetasFromCache(pCtg, pConn, pCtx, i, &fetchIdx, baseResIdx, pReq->pTables));
baseResIdx += taosArrayGetSize(pReq->pTables);
}
-
+
pCtx->fetchNum = taosArrayGetSize(pCtx->pFetchs);
if (pCtx->fetchNum <= 0) {
TSWAP(pTask->res, pCtx->pResList);
-
+
CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0));
return TSDB_CODE_SUCCESS;
}
-
+
pTask->msgCtxs = taosArrayInit(pCtx->fetchNum, sizeof(SCtgMsgCtx));
taosArraySetSize(pTask->msgCtxs, pCtx->fetchNum);
-
+
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
SCtgFetch* pFetch = taosArrayGet(pCtx->pFetchs, i);
SName* pName = ctgGetFetchName(pCtx->pNames, pFetch);
@@ -1689,19 +1689,19 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask *pTask) {
if (NULL == pMsgCtx->pBatchs) {
pMsgCtx->pBatchs = pJob->pBatchs;
}
-
+
SCtgTaskReq tReq;
tReq.pTask = pTask;
- tReq.msgIdx = pFetch->fetchIdx;
+ tReq.msgIdx = pFetch->fetchIdx;
CTG_ERR_RET(ctgAsyncRefreshTbMeta(&tReq, pFetch->flag, pName, &pFetch->vgId));
}
-
+
return TSDB_CODE_SUCCESS;
}
int32_t ctgLaunchGetDbVgTask(SCtgTask *pTask) {
int32_t code = 0;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgDBCache *dbCache = NULL;
SCtgDbVgCtx* pCtx = (SCtgDbVgCtx*)pTask->taskCtx;
@@ -1710,18 +1710,18 @@ int32_t ctgLaunchGetDbVgTask(SCtgTask *pTask) {
if (NULL == pMsgCtx->pBatchs) {
pMsgCtx->pBatchs = pJob->pBatchs;
}
-
+
CTG_ERR_RET(ctgAcquireVgInfoFromCache(pCtg, pCtx->dbFName, &dbCache));
if (NULL != dbCache) {
CTG_ERR_JRET(ctgGenerateVgList(pCtg, dbCache->vgCache.vgInfo->vgHash, (SArray**)&pTask->res));
ctgReleaseVgInfoToCache(pCtg, dbCache);
dbCache = NULL;
-
+
CTG_ERR_JRET(ctgHandleTaskEnd(pTask, 0));
} else {
SBuildUseDBInput input = {0};
-
+
tstrncpy(input.db, pCtx->dbFName, tListLen(input.db));
input.vgVersion = CTG_DEFAULT_INVALID_VERSION;
@@ -1742,7 +1742,7 @@ _return:
int32_t ctgLaunchGetTbHashTask(SCtgTask *pTask) {
int32_t code = 0;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgDBCache *dbCache = NULL;
SCtgTbHashCtx* pCtx = (SCtgTbHashCtx*)pTask->taskCtx;
@@ -1751,7 +1751,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask *pTask) {
if (NULL == pMsgCtx->pBatchs) {
pMsgCtx->pBatchs = pJob->pBatchs;
}
-
+
CTG_ERR_RET(ctgAcquireVgInfoFromCache(pCtg, pCtx->dbFName, &dbCache));
if (NULL != dbCache) {
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
@@ -1762,17 +1762,17 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask *pTask) {
ctgReleaseVgInfoToCache(pCtg, dbCache);
dbCache = NULL;
-
+
CTG_ERR_JRET(ctgHandleTaskEnd(pTask, 0));
} else {
SBuildUseDBInput input = {0};
-
+
tstrncpy(input.db, pCtx->dbFName, tListLen(input.db));
input.vgVersion = CTG_DEFAULT_INVALID_VERSION;
SCtgTaskReq tReq;
tReq.pTask = pTask;
- tReq.msgIdx = -1;
+ tReq.msgIdx = -1;
CTG_ERR_RET(ctgGetDBVgInfoFromMnode(pCtg, pConn, &input, NULL, &tReq));
}
@@ -1786,16 +1786,16 @@ _return:
}
int32_t ctgLaunchGetTbHashsTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgTbHashsCtx* pCtx = (SCtgTbHashsCtx*)pTask->taskCtx;
SCtgDBCache *dbCache = NULL;
- SCtgJob* pJob = pTask->pJob;
+ SCtgJob* pJob = pTask->pJob;
int32_t dbNum = taosArrayGetSize(pCtx->pNames);
int32_t fetchIdx = 0;
int32_t baseResIdx = 0;
int32_t code = 0;
-
+
for (int32_t i = 0; i < dbNum; ++i) {
STablesReq* pReq = taosArrayGet(pCtx->pNames, i);
@@ -1804,7 +1804,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask *pTask) {
if (NULL != dbCache) {
SCtgTaskReq tReq;
tReq.pTask = pTask;
- tReq.msgIdx = -1;
+ tReq.msgIdx = -1;
CTG_ERR_JRET(ctgGetVgInfosFromHashValue(pCtg, &tReq, dbCache->vgCache.vgInfo, pCtx, pReq->dbFName, pReq->pTables, false));
ctgReleaseVgInfoToCache(pCtg, dbCache);
@@ -1815,21 +1815,21 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask *pTask) {
ctgAddFetch(&pCtx->pFetchs, i, -1, &fetchIdx, baseResIdx, 0);
baseResIdx += taosArrayGetSize(pReq->pTables);
- taosArraySetSize(pCtx->pResList, baseResIdx);
+ taosArraySetSize(pCtx->pResList, baseResIdx);
}
}
pCtx->fetchNum = taosArrayGetSize(pCtx->pFetchs);
if (pCtx->fetchNum <= 0) {
TSWAP(pTask->res, pCtx->pResList);
-
+
CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0));
return TSDB_CODE_SUCCESS;
}
-
+
pTask->msgCtxs = taosArrayInit(pCtx->fetchNum, sizeof(SCtgMsgCtx));
taosArraySetSize(pTask->msgCtxs, pCtx->fetchNum);
-
+
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
SCtgFetch* pFetch = taosArrayGet(pCtx->pFetchs, i);
STablesReq* pReq = taosArrayGet(pCtx->pNames, pFetch->dbIdx);
@@ -1837,10 +1837,10 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask *pTask) {
if (NULL == pMsgCtx->pBatchs) {
pMsgCtx->pBatchs = pJob->pBatchs;
}
-
+
SBuildUseDBInput input = {0};
strcpy(input.db, pReq->dbFName);
-
+
input.vgVersion = CTG_DEFAULT_INVALID_VERSION;
SCtgTaskReq tReq;
@@ -1854,14 +1854,14 @@ _return:
if (dbCache) {
ctgReleaseVgInfoToCache(pCtg, dbCache);
}
-
+
return code;
}
int32_t ctgLaunchGetTbIndexTask(SCtgTask *pTask) {
int32_t code = 0;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgTbIndexCtx* pCtx = (SCtgTbIndexCtx*)pTask->taskCtx;
SArray* pRes = NULL;
@@ -1874,18 +1874,18 @@ int32_t ctgLaunchGetTbIndexTask(SCtgTask *pTask) {
CTG_ERR_RET(ctgReadTbIndexFromCache(pCtg, pCtx->pName, &pRes));
if (pRes) {
pTask->res = pRes;
-
+
CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0));
return TSDB_CODE_SUCCESS;
}
-
+
CTG_ERR_RET(ctgGetTbIndexFromMnode(pCtg, pConn, pCtx->pName, NULL, pTask));
return TSDB_CODE_SUCCESS;
}
int32_t ctgLaunchGetTbCfgTask(SCtgTask *pTask) {
int32_t code = 0;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgTbCfgCtx* pCtx = (SCtgTbCfgCtx*)pTask->taskCtx;
SArray* pRes = NULL;
@@ -1915,7 +1915,7 @@ int32_t ctgLaunchGetTbCfgTask(SCtgTask *pTask) {
return TSDB_CODE_SUCCESS;
}
}
-
+
CTG_ERR_JRET(ctgGetTableCfgFromVnode(pCtg, pConn, pCtx->pName, pCtx->pVgInfo, NULL, pTask));
}
@@ -1926,13 +1926,13 @@ _return:
if (CTG_TASK_LAUNCHED == pTask->status) {
ctgHandleTaskEnd(pTask, code);
}
-
+
CTG_RET(code);
}
int32_t ctgLaunchGetQnodeTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgJob* pJob = pTask->pJob;
SCtgMsgCtx *pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
@@ -1945,7 +1945,7 @@ int32_t ctgLaunchGetQnodeTask(SCtgTask *pTask) {
}
int32_t ctgLaunchGetDnodeTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgJob* pJob = pTask->pJob;
SCtgMsgCtx *pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
@@ -1959,7 +1959,7 @@ int32_t ctgLaunchGetDnodeTask(SCtgTask *pTask) {
int32_t ctgLaunchGetDbCfgTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgDbCfgCtx* pCtx = (SCtgDbCfgCtx*)pTask->taskCtx;
SCtgJob* pJob = pTask->pJob;
@@ -1975,7 +1975,7 @@ int32_t ctgLaunchGetDbCfgTask(SCtgTask *pTask) {
int32_t ctgLaunchGetDbInfoTask(SCtgTask *pTask) {
int32_t code = 0;
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SCtgDBCache *dbCache = NULL;
SCtgDbInfoCtx* pCtx = (SCtgDbInfoCtx*)pTask->taskCtx;
SCtgJob* pJob = pTask->pJob;
@@ -2014,7 +2014,7 @@ _return:
}
int32_t ctgLaunchGetIndexTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgIndexCtx* pCtx = (SCtgIndexCtx*)pTask->taskCtx;
SCtgJob* pJob = pTask->pJob;
@@ -2029,7 +2029,7 @@ int32_t ctgLaunchGetIndexTask(SCtgTask *pTask) {
}
int32_t ctgLaunchGetUdfTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgUdfCtx* pCtx = (SCtgUdfCtx*)pTask->taskCtx;
SCtgJob* pJob = pTask->pJob;
@@ -2044,7 +2044,7 @@ int32_t ctgLaunchGetUdfTask(SCtgTask *pTask) {
}
int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgUserCtx* pCtx = (SCtgUserCtx*)pTask->taskCtx;
bool inCache = false;
@@ -2054,7 +2054,7 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
if (NULL == pMsgCtx->pBatchs) {
pMsgCtx->pBatchs = pJob->pBatchs;
}
-
+
CTG_ERR_RET(ctgChkAuthFromCache(pCtg, pCtx->user.user, pCtx->user.dbFName, pCtx->user.type, &inCache, &pass));
if (inCache) {
pTask->res = taosMemoryCalloc(1, sizeof(bool));
@@ -2062,7 +2062,7 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
*(bool*)pTask->res = pass;
-
+
CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0));
return TSDB_CODE_SUCCESS;
}
@@ -2073,7 +2073,7 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
}
int32_t ctgLaunchGetSvrVerTask(SCtgTask *pTask) {
- SCatalog* pCtg = pTask->pJob->pCtg;
+ SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgJob* pJob = pTask->pJob;
SCtgMsgCtx *pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
@@ -2096,7 +2096,7 @@ int32_t ctgRelaunchGetTbMetaTask(SCtgTask *pTask) {
int32_t ctgGetTbCfgCb(SCtgTask *pTask) {
int32_t code = 0;
-
+
CTG_ERR_JRET(pTask->subRes.code);
SCtgTbCfgCtx* pCtx = (SCtgTbCfgCtx*)pTask->taskCtx;
@@ -2104,7 +2104,7 @@ int32_t ctgGetTbCfgCb(SCtgTask *pTask) {
pCtx->tbType = ((STableMeta*)pTask->subRes.res)->tableType;
} else if (CTG_TASK_GET_DB_VGROUP == pTask->subRes.type) {
SDBVgInfo* pDb = (SDBVgInfo*)pTask->subRes.res;
-
+
pCtx->pVgInfo = taosMemoryCalloc(1, sizeof(SVgroupInfo));
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pTask->pJob->pCtg, pDb, pCtx->pName, pCtx->pVgInfo));
}
@@ -2167,7 +2167,7 @@ SCtgAsyncFps gCtgAsyncFps[] = {
int32_t ctgMakeAsyncRes(SCtgJob *pJob) {
int32_t code = 0;
int32_t taskNum = taosArrayGetSize(pJob->pTasks);
-
+
for (int32_t i = 0; i < taskNum; ++i) {
SCtgTask *pTask = taosArrayGet(pJob->pTasks, i);
CTG_ERR_RET((*gCtgAsyncFps[pTask->type].dumpResFp)(pTask));
@@ -2180,16 +2180,16 @@ int32_t ctgSearchExistingTask(SCtgJob *pJob, CTG_TASK_TYPE type, void* param, in
bool equal = false;
SCtgTask* pTask = NULL;
int32_t code = 0;
-
+
CTG_LOCK(CTG_READ, &pJob->taskLock);
-
+
int32_t taskNum = taosArrayGetSize(pJob->pTasks);
for (int32_t i = 0; i < taskNum; ++i) {
pTask = taosArrayGet(pJob->pTasks, i);
if (type != pTask->type) {
continue;
}
-
+
CTG_ERR_JRET((*gCtgAsyncFps[type].compFp)(pTask, param, &equal));
if (equal) {
break;
@@ -2208,7 +2208,7 @@ _return:
int32_t ctgSetSubTaskCb(SCtgTask *pSub, SCtgTask *pTask) {
int32_t code = 0;
-
+
CTG_LOCK(CTG_WRITE, &pSub->lock);
if (CTG_TASK_DONE == pSub->status) {
pTask->subRes.code = pSub->code;
@@ -2216,7 +2216,7 @@ int32_t ctgSetSubTaskCb(SCtgTask *pSub, SCtgTask *pTask) {
SCtgMsgCtx *pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
SCtgMsgCtx *pSubMsgCtx = CTG_GET_TASK_MSGCTX(pSub, -1);
pMsgCtx->pBatchs = pSubMsgCtx->pBatchs;
-
+
CTG_ERR_JRET(pTask->subRes.fp(pTask));
} else {
if (NULL == pSub->pParents) {
@@ -2230,7 +2230,7 @@ _return:
CTG_UNLOCK(CTG_WRITE, &pSub->lock);
- CTG_RET(code);
+ CTG_RET(code);
}
@@ -2242,13 +2242,13 @@ int32_t ctgLaunchSubTask(SCtgTask *pTask, CTG_TASK_TYPE type, ctgSubTaskCbFp fp,
ctgClearSubTaskRes(&pTask->subRes);
pTask->subRes.type = type;
pTask->subRes.fp = fp;
-
+
CTG_ERR_RET(ctgSearchExistingTask(pJob, type, param, &subTaskId));
if (subTaskId < 0) {
CTG_ERR_RET(ctgInitTask(pJob, type, param, &subTaskId));
newTask = true;
}
-
+
SCtgTask* pSub = taosArrayGet(pJob->pTasks, subTaskId);
CTG_ERR_RET(ctgSetSubTaskCb(pSub, pTask));
@@ -2267,21 +2267,21 @@ int32_t ctgLaunchSubTask(SCtgTask *pTask, CTG_TASK_TYPE type, ctgSubTaskCbFp fp,
int32_t ctgLaunchJob(SCtgJob *pJob) {
int32_t taskNum = taosArrayGetSize(pJob->pTasks);
-
+
for (int32_t i = 0; i < taskNum; ++i) {
SCtgTask *pTask = taosArrayGet(pJob->pTasks, i);
qDebug("QID:0x%" PRIx64 " ctg launch [%dth] task", pJob->queryId, pTask->taskId);
CTG_ERR_RET((*gCtgAsyncFps[pTask->type].launchFp)(pTask));
-
+
pTask->status = CTG_TASK_LAUNCHED;
}
if (taskNum <= 0) {
qDebug("QID:0x%" PRIx64 " ctg call user callback with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode));
-
+
taosAsyncExec(ctgCallUserCb, pJob, NULL);
-#if CTG_BATCH_FETCH
+#if CTG_BATCH_FETCH
} else {
ctgLaunchBatchs(pJob->pCtg, pJob, pJob->pBatchs);
#endif
diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c
index 1b2489acd62bec88eac5bd5aca54a6d2f00ff1ab..7d259fe06c26bfdd82b595ba49d3fefb7a181598 100644
--- a/source/libs/command/src/command.c
+++ b/source/libs/command/src/command.c
@@ -17,6 +17,7 @@
#include "catalog.h"
#include "commandInt.h"
#include "scheduler.h"
+#include "systable.h"
#include "tdatablock.h"
#include "tglobal.h"
#include "tgrant.h"
@@ -75,46 +76,41 @@ static SSDataBlock* buildDescResultDataBlock() {
return pBlock;
}
-static void setDescResultIntoDataBlock(SSDataBlock* pBlock, int32_t numOfRows, STableMeta* pMeta) {
+static void setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, int32_t numOfRows, STableMeta* pMeta) {
blockDataEnsureCapacity(pBlock, numOfRows);
- pBlock->info.rows = numOfRows;
+ pBlock->info.rows = 0;
// field
SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0);
- char buf[DESCRIBE_RESULT_FIELD_LEN] = {0};
- for (int32_t i = 0; i < numOfRows; ++i) {
- STR_TO_VARSTR(buf, pMeta->schema[i].name);
- colDataAppend(pCol1, i, buf, false);
- }
-
// Type
SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1);
- for (int32_t i = 0; i < numOfRows; ++i) {
- STR_TO_VARSTR(buf, tDataTypes[pMeta->schema[i].type].name);
- colDataAppend(pCol2, i, buf, false);
- }
-
// Length
SColumnInfoData* pCol3 = taosArrayGet(pBlock->pDataBlock, 2);
- for (int32_t i = 0; i < numOfRows; ++i) {
- int32_t bytes = getSchemaBytes(pMeta->schema + i);
- colDataAppend(pCol3, i, (const char*)&bytes, false);
- }
-
// Note
SColumnInfoData* pCol4 = taosArrayGet(pBlock->pDataBlock, 3);
+ char buf[DESCRIBE_RESULT_FIELD_LEN] = {0};
for (int32_t i = 0; i < numOfRows; ++i) {
+ if (invisibleColumn(sysInfoUser, pMeta->tableType, pMeta->schema[i].flags)) {
+ continue;
+ }
+ STR_TO_VARSTR(buf, pMeta->schema[i].name);
+ colDataAppend(pCol1, pBlock->info.rows, buf, false);
+ STR_TO_VARSTR(buf, tDataTypes[pMeta->schema[i].type].name);
+ colDataAppend(pCol2, pBlock->info.rows, buf, false);
+ int32_t bytes = getSchemaBytes(pMeta->schema + i);
+ colDataAppend(pCol3, pBlock->info.rows, (const char*)&bytes, false);
STR_TO_VARSTR(buf, i >= pMeta->tableInfo.numOfColumns ? "TAG" : "");
- colDataAppend(pCol4, i, buf, false);
+ colDataAppend(pCol4, pBlock->info.rows, buf, false);
+ ++(pBlock->info.rows);
}
}
-static int32_t execDescribe(SNode* pStmt, SRetrieveTableRsp** pRsp) {
+static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) {
SDescribeStmt* pDesc = (SDescribeStmt*)pStmt;
int32_t numOfRows = TABLE_TOTAL_COL_NUM(pDesc->pMeta);
SSDataBlock* pBlock = buildDescResultDataBlock();
- setDescResultIntoDataBlock(pBlock, numOfRows, pDesc->pMeta);
+ setDescResultIntoDataBlock(sysInfoUser, pBlock, numOfRows, pDesc->pMeta);
return buildRetrieveTableRsp(pBlock, DESCRIBE_RESULT_COLS, pRsp);
}
@@ -665,10 +661,10 @@ static int32_t execSelectWithoutFrom(SSelectStmt* pSelect, SRetrieveTableRsp** p
return code;
}
-int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
+int32_t qExecCommand(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) {
switch (nodeType(pStmt)) {
case QUERY_NODE_DESCRIBE_STMT:
- return execDescribe(pStmt, pRsp);
+ return execDescribe(sysInfoUser, pStmt, pRsp);
case QUERY_NODE_RESET_QUERY_CACHE_STMT:
return execResetQueryCache();
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c
index afc09262de377bd6515a03d75e9a8c97f6b61882..967c682b0bb701502dff90081fba8973a34bd22a 100644
--- a/source/libs/command/src/explain.c
+++ b/source/libs/command/src/explain.c
@@ -1570,12 +1570,9 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
SColumnInfoData *pInfoData = taosArrayGet(pBlock->pDataBlock, 0);
- char buf[1024] = {0};
for (int32_t i = 0; i < rowNum; ++i) {
SQueryExplainRowInfo *row = taosArrayGet(pCtx->rows, i);
- varDataCopy(buf, row->buf);
- ASSERT(varDataTLen(row->buf) == row->len);
- colDataAppend(pInfoData, i, buf, false);
+ colDataAppend(pInfoData, i, row->buf, false);
}
pBlock->info.rows = rowNum;
diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h
index 4da4747108d5b459eac03546d6f2cc661c3760a1..9e7fcc222788e16f60252727ba7ca7c911366e9b 100644
--- a/source/libs/executor/inc/executil.h
+++ b/source/libs/executor/inc/executil.h
@@ -22,6 +22,13 @@
#include "tbuffer.h"
#include "tcommon.h"
#include "tpagedbuf.h"
+#include "tsimplehash.h"
+
+#define T_LONG_JMP(_obj, _c) \
+ do { \
+ ASSERT((_c) != -1); \
+ longjmp((_obj), (_c)); \
+ } while (0);
#define SET_RES_WINDOW_KEY(_k, _ori, _len, _uid) \
do { \
@@ -80,11 +87,9 @@ struct SqlFunctionCtx;
size_t getResultRowSize(struct SqlFunctionCtx* pCtx, int32_t numOfOutput);
void initResultRowInfo(SResultRowInfo* pResultRowInfo);
-void cleanupResultRowInfo(SResultRowInfo* pResultRowInfo);
void initResultRow(SResultRow* pResultRow);
void closeResultRow(SResultRow* pResultRow);
-bool isResultRowClosed(SResultRow* pResultRow);
struct SResultRowEntryInfo* getResultEntryInfo(const SResultRow* pRow, int32_t index, const int32_t* offset);
@@ -102,7 +107,7 @@ static FORCE_INLINE void setResultBufPageDirty(SDiskbasedBuf* pBuf, SResultRowPo
setBufPageDirty(pPage, true);
}
-void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int32_t order);
+void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, int32_t order);
void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo);
void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList);
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index fb4eac991f4d64e2c5477e3b102395ad6c83550b..ba48ec751927ecf11d881ab7e4c534ffe937d469 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -122,7 +122,7 @@ typedef int32_t (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, char* res
typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr);
typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* pOptr);
-typedef void (*__optr_close_fn_t)(void* param, int32_t num);
+typedef void (*__optr_close_fn_t)(void* param);
typedef int32_t (*__optr_explain_fn_t)(struct SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len);
typedef struct STaskIdInfo {
@@ -150,6 +150,7 @@ typedef struct {
SQueryTableDataCond tableCond;
int64_t recoverStartVer;
int64_t recoverEndVer;
+ SStreamState* pState;
} SStreamTaskInfo;
typedef struct {
@@ -206,6 +207,7 @@ typedef struct SExprSupp {
typedef struct SOperatorInfo {
uint16_t operatorType;
+ int16_t resultDataBlockId;
bool blocking; // block operator or not
uint8_t status; // denote if current operator is completed
char* name; // name, for debug purpose
@@ -217,7 +219,6 @@ typedef struct SOperatorInfo {
struct SOperatorInfo** pDownstream; // downstram pointer list
int32_t numOfDownstream; // number of downstream. The value is always ONE expect for join operator
SOperatorFpSet fpSet;
- int16_t resultDataBlockId;
} SOperatorInfo;
typedef enum {
@@ -296,10 +297,10 @@ enum {
};
typedef struct SAggSupporter {
- SHashObj* pResultRowHashTable; // quick locate the window object for each result
- char* keyBuf; // window key buffer
- SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file
- int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row
+ SSHashObj* pResultRowHashTable; // quick locate the window object for each result
+ char* keyBuf; // window key buffer
+ SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file
+ int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row
} SAggSupporter;
typedef struct {
@@ -496,6 +497,7 @@ typedef struct SSysTableScanInfo {
SReadHandle readHandle;
int32_t accountId;
const char* pUser;
+ bool sysInfo;
bool showRewrite;
SNode* pCondition; // db_name filter condition, to discard data that are not in current database
SMTbCursor* pCur; // cursor for iterate the local table meta store.
@@ -907,21 +909,15 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode* pProjPhyNode, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortNode, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** dowStreams, size_t numStreams, SMergePhysiNode* pMergePhysiNode, SExecTaskInfo* pTaskInfo);
-SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t numOfDownstream, SExprInfo* pExprInfo, int32_t num, SArray* pSortInfo, SArray* pGroupInfo, SExecTaskInfo* pTaskInfo);
-SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pTableScanNode, SReadHandle* readHandle, SExecTaskInfo* pTaskInfo);
+SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pTableScanNode, SReadHandle* readHandle, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
STimeWindowAggSupp* pTwAggSupp, SIntervalPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, bool isStream);
-
-SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
- SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
- bool mergeResultBlock, SExecTaskInfo* pTaskInfo);
-
-SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
- SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
- SNode* pCondition, bool mergeResultBlocks, SExecTaskInfo* pTaskInfo);
-
+SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeIntervalPhysiNode* pIntervalPhyNode,
+ SExecTaskInfo* pTaskInfo);
+SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMergeAlignedIntervalPhysiNode* pNode,
+ SExecTaskInfo* pTaskInfo);
SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode,
SExecTaskInfo* pTaskInfo, int32_t numOfChild);
SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPhysiNode* pSessionNode,
@@ -929,22 +925,16 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionW
SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResultBlock, SArray* pGroupColList, SNode* pCondition,
SExprInfo* pScalarExprInfo, int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo);
-SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SReadHandle* readHandle, uint64_t uid, SBlockDistScanPhysiNode* pBlockScanNode,
- SExecTaskInfo* pTaskInfo);
+SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SReadHandle* readHandle, uint64_t uid,
+ SBlockDistScanPhysiNode* pBlockScanNode, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond,
SExecTaskInfo* pTaskInfo);
SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFillNode, SExecTaskInfo* pTaskInfo);
-
-SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols,
- SSDataBlock* pResBlock, STimeWindowAggSupp *pTwAggSupp, int32_t tsSlotId,
- SColumn* pStateKeyCol, SNode* pCondition, SExecTaskInfo* pTaskInfo);
-
+SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhysiNode* pStateNode, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNode* pPartNode, SExecTaskInfo* pTaskInfo);
-
SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, SExecTaskInfo* pTaskInfo);
-
SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SSortMergeJoinPhysiNode* pJoinNode,
SExecTaskInfo* pTaskInfo);
@@ -955,10 +945,6 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream
SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo);
-#if 0
-SOperatorInfo* createTableSeqScanOperatorInfo(void* pTsdbReadHandle, STaskRuntimeEnv* pRuntimeEnv);
-#endif
-
int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx,
int32_t numOfOutput, SArray* pPseudoList);
@@ -1016,7 +1002,7 @@ bool functionNeedToExecute(SqlFunctionCtx* pCtx);
bool isOverdue(TSKEY ts, STimeWindowAggSupp* pSup);
bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup);
bool isDeletedWindow(STimeWindow* pWin, uint64_t groupId, SAggSupporter* pSup);
-void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid);
+void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, int32_t uidCol, uint64_t* pID);
void printDataBlock(SSDataBlock* pBlock, const char* flag);
int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPosition,
diff --git a/source/libs/executor/inc/tsimplehash.h b/source/libs/executor/inc/tsimplehash.h
index 4c5a80e2f1954812a81665954d3dc448467f6ffc..27191e3b7e674df4dcec9dabc7b8cc6fbb35f9f2 100644
--- a/source/libs/executor/inc/tsimplehash.h
+++ b/source/libs/executor/inc/tsimplehash.h
@@ -28,7 +28,7 @@ typedef void (*_hash_free_fn_t)(void *);
/**
* @brief single thread hash
- *
+ *
*/
typedef struct SSHashObj SSHashObj;
@@ -52,13 +52,13 @@ int32_t tSimpleHashPrint(const SSHashObj *pHashObj);
/**
* @brief put element into hash table, if the element with the same key exists, update it
- *
- * @param pHashObj
- * @param key
- * @param keyLen
- * @param data
- * @param dataLen
- * @return int32_t
+ *
+ * @param pHashObj
+ * @param key
+ * @param keyLen
+ * @param data
+ * @param dataLen
+ * @return int32_t
*/
int32_t tSimpleHashPut(SSHashObj *pHashObj, const void *key, size_t keyLen, const void *data, size_t dataLen);
@@ -80,6 +80,18 @@ void *tSimpleHashGet(SSHashObj *pHashObj, const void *key, size_t keyLen);
*/
int32_t tSimpleHashRemove(SSHashObj *pHashObj, const void *key, size_t keyLen);
+/**
+ * remove item with the specified key during hash iterate
+ *
+ * @param pHashObj
+ * @param key
+ * @param keyLen
+ * @param pIter
+ * @param iter
+ * @return int32_t
+ */
+int32_t tSimpleHashIterateRemove(SSHashObj *pHashObj, const void *key, size_t keyLen, void **pIter, int32_t *iter);
+
/**
* Clear the hash table.
* @param pHashObj
@@ -99,13 +111,27 @@ void tSimpleHashCleanup(SSHashObj *pHashObj);
*/
size_t tSimpleHashGetMemSize(const SSHashObj *pHashObj);
+#pragma pack(push, 4)
+typedef struct SHNode{
+ struct SHNode *next;
+ uint32_t keyLen : 20;
+ uint32_t dataLen : 12;
+ char data[];
+} SHNode;
+#pragma pack(pop)
+
/**
* Get the corresponding key information for a given data in hash table
* @param data
* @param keyLen
* @return
*/
-void *tSimpleHashGetKey(void *data, size_t* keyLen);
+static FORCE_INLINE void *tSimpleHashGetKey(void *data, size_t *keyLen) {
+ SHNode *node = (SHNode *)((char *)data - offsetof(SHNode, data));
+ if (keyLen) *keyLen = node->keyLen;
+
+ return POINTER_SHIFT(data, node->dataLen);
+}
/**
* Create the hash table iterator
@@ -116,17 +142,6 @@ void *tSimpleHashGetKey(void *data, size_t* keyLen);
*/
void *tSimpleHashIterate(const SSHashObj *pHashObj, void *data, int32_t *iter);
-/**
- * Create the hash table iterator
- *
- * @param pHashObj
- * @param data
- * @param key
- * @param iter
- * @return void*
- */
-void *tSimpleHashIterateKV(const SSHashObj *pHashObj, void *data, void **key, int32_t *iter);
-
#ifdef __cplusplus
}
#endif
diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c
index 94e4384b3025f0d2ecbbaafd9f92ad10aa84b926..94d9d0cadbd1cf21ac8303a4bee7b86da9695f3c 100644
--- a/source/libs/executor/src/cachescanoperator.c
+++ b/source/libs/executor/src/cachescanoperator.c
@@ -24,26 +24,28 @@
#include "tcompare.h"
#include "thash.h"
#include "ttypes.h"
-#include "executorInt.h"
-static SSDataBlock* doScanLastrow(SOperatorInfo* pOperator);
-static void destroyLastrowScanOperator(void* param, int32_t numOfOutput);
+static SSDataBlock* doScanCache(SOperatorInfo* pOperator);
+static void destroyLastrowScanOperator(void* param);
static int32_t extractTargetSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds);
-SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandle* readHandle, SExecTaskInfo* pTaskInfo) {
+SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandle* readHandle,
+ SExecTaskInfo* pTaskInfo) {
+ int32_t code = TSDB_CODE_SUCCESS;
SLastrowScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SLastrowScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
goto _error;
}
pInfo->readHandle = *readHandle;
- pInfo->pRes = createResDataBlock(pScanNode->scan.node.pOutputDataBlockDesc);
+ pInfo->pRes = createResDataBlock(pScanNode->scan.node.pOutputDataBlockDesc);
int32_t numOfCols = 0;
pInfo->pColMatchInfo = extractColMatchInfo(pScanNode->scan.pScanCols, pScanNode->scan.node.pOutputDataBlockDesc, &numOfCols,
COL_MATCH_FROM_COL_ID);
- int32_t code = extractTargetSlotId(pInfo->pColMatchInfo, pTaskInfo, &pInfo->pSlotIds);
+ code = extractTargetSlotId(pInfo->pColMatchInfo, pTaskInfo, &pInfo->pSlotIds);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
@@ -56,13 +58,17 @@ SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pScanNode, SRead
// partition by tbname
if (taosArrayGetSize(pTableList->pGroupList) == taosArrayGetSize(pTableList->pTableList)) {
- pInfo->retrieveType = LASTROW_RETRIEVE_TYPE_ALL;
- tsdbLastRowReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pTableList->pTableList,
- taosArrayGetSize(pInfo->pColMatchInfo), &pInfo->pLastrowReader);
+ pInfo->retrieveType = CACHESCAN_RETRIEVE_TYPE_ALL|CACHESCAN_RETRIEVE_LAST_ROW;
+ code = tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pTableList->pTableList,
+ taosArrayGetSize(pInfo->pColMatchInfo), &pInfo->pLastrowReader);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
pInfo->pBufferredRes = createOneDataBlock(pInfo->pRes, false);
blockDataEnsureCapacity(pInfo->pBufferredRes, pOperator->resultInfo.capacity);
} else { // by tags
- pInfo->retrieveType = LASTROW_RETRIEVE_TYPE_SINGLE;
+ pInfo->retrieveType = CACHESCAN_RETRIEVE_TYPE_SINGLE|CACHESCAN_RETRIEVE_LAST_ROW;
}
if (pScanNode->scan.pScanPseudoCols != NULL) {
@@ -81,19 +87,19 @@ SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pScanNode, SRead
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
pOperator->fpSet =
- createOperatorFpSet(operatorDummyOpenFn, doScanLastrow, NULL, NULL, destroyLastrowScanOperator, NULL, NULL, NULL);
+ createOperatorFpSet(operatorDummyOpenFn, doScanCache, NULL, NULL, destroyLastrowScanOperator, NULL, NULL, NULL);
pOperator->cost.openCost = 0;
return pOperator;
_error:
- pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
- taosMemoryFree(pInfo);
+ pTaskInfo->code = code;
+ destroyLastrowScanOperator(pInfo);
taosMemoryFree(pOperator);
return NULL;
}
-SSDataBlock* doScanLastrow(SOperatorInfo* pOperator) {
+SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
if (pOperator->status == OP_EXEC_DONE) {
return NULL;
}
@@ -110,14 +116,14 @@ SSDataBlock* doScanLastrow(SOperatorInfo* pOperator) {
blockDataCleanup(pInfo->pRes);
// check if it is a group by tbname
- if (pInfo->retrieveType == LASTROW_RETRIEVE_TYPE_ALL) {
+ if ((pInfo->retrieveType & CACHESCAN_RETRIEVE_TYPE_ALL) == CACHESCAN_RETRIEVE_TYPE_ALL) {
if (pInfo->indexOfBufferedRes >= pInfo->pBufferredRes->info.rows) {
blockDataCleanup(pInfo->pBufferredRes);
taosArrayClear(pInfo->pUidList);
- int32_t code = tsdbRetrieveLastRow(pInfo->pLastrowReader, pInfo->pBufferredRes, pInfo->pSlotIds, pInfo->pUidList);
+ int32_t code = tsdbRetrieveCacheRows(pInfo->pLastrowReader, pInfo->pBufferredRes, pInfo->pSlotIds, pInfo->pUidList);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
// check for tag values
@@ -173,11 +179,11 @@ SSDataBlock* doScanLastrow(SOperatorInfo* pOperator) {
while (pInfo->currentGroupIndex < totalGroups) {
SArray* pGroupTableList = taosArrayGetP(pTableList->pGroupList, pInfo->currentGroupIndex);
- tsdbLastRowReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pGroupTableList,
+ tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pGroupTableList,
taosArrayGetSize(pInfo->pColMatchInfo), &pInfo->pLastrowReader);
taosArrayClear(pInfo->pUidList);
- int32_t code = tsdbRetrieveLastRow(pInfo->pLastrowReader, pInfo->pRes, pInfo->pSlotIds, pInfo->pUidList);
+ int32_t code = tsdbRetrieveCacheRows(pInfo->pLastrowReader, pInfo->pRes, pInfo->pSlotIds, pInfo->pUidList);
if (code != TSDB_CODE_SUCCESS) {
longjmp(pTaskInfo->env, code);
}
@@ -201,7 +207,7 @@ SSDataBlock* doScanLastrow(SOperatorInfo* pOperator) {
}
}
- tsdbLastrowReaderClose(pInfo->pLastrowReader);
+ tsdbCacherowsReaderClose(pInfo->pLastrowReader);
return pInfo->pRes;
}
}
@@ -211,7 +217,7 @@ SSDataBlock* doScanLastrow(SOperatorInfo* pOperator) {
}
}
-void destroyLastrowScanOperator(void* param, int32_t numOfOutput) {
+void destroyLastrowScanOperator(void* param) {
SLastrowScanInfo* pInfo = (SLastrowScanInfo*)param;
blockDataDestroy(pInfo->pRes);
taosMemoryFreeClear(param);
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index 2781fee9565c278db6f9173ba596fbbc6abaf9c8..7f7e7c0e1cc80a4c6fa44006ca01261dc6e94516 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -31,20 +31,6 @@ void initResultRowInfo(SResultRowInfo* pResultRowInfo) {
pResultRowInfo->cur.pageId = -1;
}
-void cleanupResultRowInfo(SResultRowInfo* pResultRowInfo) {
- if (pResultRowInfo == NULL) {
- return;
- }
-
- for (int32_t i = 0; i < pResultRowInfo->size; ++i) {
- // if (pResultRowInfo->pResult[i]) {
- // taosMemoryFreeClear(pResultRowInfo->pResult[i]->key);
- // }
- }
-}
-
-bool isResultRowClosed(SResultRow* pRow) { return (pRow->closed == true); }
-
void closeResultRow(SResultRow* pResultRow) { pResultRow->closed = true; }
// TODO refactor: use macro
@@ -97,7 +83,7 @@ int32_t resultrowComparAsc(const void* p1, const void* p2) {
static int32_t resultrowComparDesc(const void* p1, const void* p2) { return resultrowComparAsc(p2, p1); }
-void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int32_t order) {
+void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, int32_t order) {
if (pGroupResInfo->pRows != NULL) {
taosArrayDestroy(pGroupResInfo->pRows);
}
@@ -106,9 +92,10 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int
void* pData = NULL;
pGroupResInfo->pRows = taosArrayInit(10, POINTER_BYTES);
- size_t keyLen = 0;
- while ((pData = taosHashIterate(pHashmap, pData)) != NULL) {
- void* key = taosHashGetKey(pData, &keyLen);
+ size_t keyLen = 0;
+ int32_t iter = 0;
+ while ((pData = tSimpleHashIterate(pHashmap, pData, &iter)) != NULL) {
+ void* key = tSimpleHashGetKey(pData, &keyLen);
SResKeyPos* p = taosMemoryMalloc(keyLen + sizeof(SResultRowPosition));
@@ -298,17 +285,17 @@ int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle,
return TSDB_CODE_SUCCESS;
}
-typedef struct tagFilterAssist{
- SHashObj *colHash;
+typedef struct tagFilterAssist {
+ SHashObj* colHash;
int32_t index;
- SArray *cInfoList;
-}tagFilterAssist;
+ SArray* cInfoList;
+} tagFilterAssist;
static EDealRes getColumn(SNode** pNode, void* pContext) {
SColumnNode* pSColumnNode = NULL;
if (QUERY_NODE_COLUMN == nodeType((*pNode))) {
pSColumnNode = *(SColumnNode**)pNode;
- }else if(QUERY_NODE_FUNCTION == nodeType((*pNode))){
+ } else if (QUERY_NODE_FUNCTION == nodeType((*pNode))) {
SFunctionNode* pFuncNode = *(SFunctionNode**)(pNode);
if (pFuncNode->funcType == FUNCTION_TYPE_TBNAME) {
pSColumnNode = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
@@ -321,24 +308,26 @@ static EDealRes getColumn(SNode** pNode, void* pContext) {
pSColumnNode->node.resType.bytes = TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE;
nodesDestroyNode(*pNode);
*pNode = (SNode*)pSColumnNode;
- }else{
+ } else {
return DEAL_RES_CONTINUE;
}
- }else{
+ } else {
return DEAL_RES_CONTINUE;
}
- tagFilterAssist *pData = (tagFilterAssist *)pContext;
- void *data = taosHashGet(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId));
- if(!data){
+ tagFilterAssist* pData = (tagFilterAssist*)pContext;
+ void* data = taosHashGet(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId));
+ if (!data) {
taosHashPut(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId), pNode, sizeof((*pNode)));
pSColumnNode->slotId = pData->index++;
- SColumnInfo cInfo = {.colId = pSColumnNode->colId, .type = pSColumnNode->node.resType.type, .bytes = pSColumnNode->node.resType.bytes};
+ SColumnInfo cInfo = {.colId = pSColumnNode->colId,
+ .type = pSColumnNode->node.resType.type,
+ .bytes = pSColumnNode->node.resType.bytes};
#if TAG_FILTER_DEBUG
qDebug("tagfilter build column info, slotId:%d, colId:%d, type:%d", pSColumnNode->slotId, cInfo.colId, cInfo.type);
#endif
taosArrayPush(pData->cInfoList, &cInfo);
- }else{
+ } else {
SColumnNode* col = *(SColumnNode**)data;
pSColumnNode->slotId = col->slotId;
}
@@ -353,9 +342,9 @@ static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarPara
return terrno;
}
- pColumnData->info.type = pType->type;
- pColumnData->info.bytes = pType->bytes;
- pColumnData->info.scale = pType->scale;
+ pColumnData->info.type = pType->type;
+ pColumnData->info.bytes = pType->bytes;
+ pColumnData->info.scale = pType->scale;
pColumnData->info.precision = pType->precision;
int32_t code = colInfoDataEnsureCapacity(pColumnData, numOfRows);
@@ -370,27 +359,27 @@ static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarPara
return TSDB_CODE_SUCCESS;
}
-static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray* uidList, SNode* pTagCond){
- int32_t code = TSDB_CODE_SUCCESS;
- SArray* pBlockList = NULL;
+static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray* uidList, SNode* pTagCond) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ SArray* pBlockList = NULL;
SSDataBlock* pResBlock = NULL;
- SHashObj * tags = NULL;
+ SHashObj* tags = NULL;
SScalarParam output = {0};
tagFilterAssist ctx = {0};
ctx.colHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
- if(ctx.colHash == NULL){
+ if (ctx.colHash == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
ctx.index = 0;
ctx.cInfoList = taosArrayInit(4, sizeof(SColumnInfo));
- if(ctx.cInfoList == NULL){
+ if (ctx.cInfoList == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
- nodesRewriteExprPostOrder(&pTagCond, getColumn, (void *)&ctx);
+ nodesRewriteExprPostOrder(&pTagCond, getColumn, (void*)&ctx);
pResBlock = createDataBlock();
if (pResBlock == NULL) {
@@ -404,7 +393,7 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
blockDataAppendColInfo(pResBlock, &colInfo);
}
-// int64_t stt = taosGetTimestampUs();
+ // int64_t stt = taosGetTimestampUs();
tags = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
code = metaGetTableTags(metaHandle, suid, uidList, tags);
if (code != TSDB_CODE_SUCCESS) {
@@ -414,11 +403,11 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
}
int32_t rows = taosArrayGetSize(uidList);
- if(rows == 0){
+ if (rows == 0) {
goto end;
}
-// int64_t stt1 = taosGetTimestampUs();
-// qDebug("generate tag meta rows:%d, cost:%ld us", rows, stt1-stt);
+ // int64_t stt1 = taosGetTimestampUs();
+ // qDebug("generate tag meta rows:%d, cost:%ld us", rows, stt1-stt);
code = blockDataEnsureCapacity(pResBlock, rows);
if (code != TSDB_CODE_SUCCESS) {
@@ -426,46 +415,46 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
goto end;
}
-// int64_t st = taosGetTimestampUs();
+ // int64_t st = taosGetTimestampUs();
for (int32_t i = 0; i < rows; i++) {
int64_t* uid = taosArrayGet(uidList, i);
- for(int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++){
+ for (int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++) {
SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, j);
- if(pColInfo->info.colId == -1){ // tbname
+ if (pColInfo->info.colId == -1) { // tbname
char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
metaGetTableNameByUid(metaHandle, *uid, str);
colDataAppend(pColInfo, i, str, false);
#if TAG_FILTER_DEBUG
- qDebug("tagfilter uid:%ld, tbname:%s", *uid, str+2);
+ qDebug("tagfilter uid:%ld, tbname:%s", *uid, str + 2);
#endif
- }else{
+ } else {
void* tag = taosHashGet(tags, uid, sizeof(int64_t));
ASSERT(tag);
STagVal tagVal = {0};
tagVal.cid = pColInfo->info.colId;
const char* p = metaGetTableTagVal(tag, pColInfo->info.type, &tagVal);
- if (p == NULL || (pColInfo->info.type == TSDB_DATA_TYPE_JSON && ((STag*)p)->nTag == 0)){
+ if (p == NULL || (pColInfo->info.type == TSDB_DATA_TYPE_JSON && ((STag*)p)->nTag == 0)) {
colDataAppend(pColInfo, i, p, true);
} else if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) {
colDataAppend(pColInfo, i, p, false);
} else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
- char *tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE + 1, 1);
+ char* tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE + 1, 1);
varDataSetLen(tmp, tagVal.nData);
memcpy(tmp + VARSTR_HEADER_SIZE, tagVal.pData, tagVal.nData);
colDataAppend(pColInfo, i, tmp, false);
#if TAG_FILTER_DEBUG
- qDebug("tagfilter varch:%s", tmp+2);
+ qDebug("tagfilter varch:%s", tmp + 2);
#endif
taosMemoryFree(tmp);
} else {
colDataAppend(pColInfo, i, (const char*)&tagVal.i64, false);
#if TAG_FILTER_DEBUG
- if(pColInfo->info.type == TSDB_DATA_TYPE_INT){
+ if (pColInfo->info.type == TSDB_DATA_TYPE_INT) {
qDebug("tagfilter int:%d", *(int*)(&tagVal.i64));
- }else if(pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE){
- qDebug("tagfilter double:%f", *(double *)(&tagVal.i64));
+ } else if (pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE) {
+ qDebug("tagfilter double:%f", *(double*)(&tagVal.i64));
}
#endif
}
@@ -474,8 +463,8 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
}
pResBlock->info.rows = rows;
-// int64_t st1 = taosGetTimestampUs();
-// qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
+ // int64_t st1 = taosGetTimestampUs();
+ // qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
pBlockList = taosArrayInit(2, POINTER_BYTES);
taosArrayPush(pBlockList, &pResBlock);
@@ -483,17 +472,19 @@ static SColumnInfoData* getColInfoResult(void* metaHandle, uint64_t suid, SArray
SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)};
code = createResultData(&type, rows, &output);
if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
qError("failed to create result, reason:%s", tstrerror(code));
goto end;
}
code = scalarCalculate(pTagCond, pBlockList, &output);
- if(code != TSDB_CODE_SUCCESS){
+ if (code != TSDB_CODE_SUCCESS) {
qError("failed to calculate scalar, reason:%s", tstrerror(code));
terrno = code;
+ goto end;
}
-// int64_t st2 = taosGetTimestampUs();
-// qDebug("calculate tag block rows:%d, cost:%ld us", rows, st2-st1);
+ // int64_t st2 = taosGetTimestampUs();
+ // qDebug("calculate tag block rows:%d, cost:%ld us", rows, st2-st1);
end:
taosHashCleanup(tags);
@@ -505,43 +496,43 @@ end:
}
static void releaseColInfoData(void* pCol) {
- if(pCol){
- SColumnInfoData* col = (SColumnInfoData*) pCol;
+ if (pCol) {
+ SColumnInfoData* col = (SColumnInfoData*)pCol;
colDataDestroy(col);
taosMemoryFree(col);
}
}
-int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableListInfo* pTableListInfo){
- int32_t code = TSDB_CODE_SUCCESS;
- SArray *pBlockList = NULL;
- SSDataBlock *pResBlock = NULL;
- SHashObj *tags = NULL;
- SArray *uidList = NULL;
- void *keyBuf = NULL;
- SArray *groupData = NULL;
+int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableListInfo* pTableListInfo) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ SArray* pBlockList = NULL;
+ SSDataBlock* pResBlock = NULL;
+ SHashObj* tags = NULL;
+ SArray* uidList = NULL;
+ void* keyBuf = NULL;
+ SArray* groupData = NULL;
int32_t rows = taosArrayGetSize(pTableListInfo->pTableList);
- if(rows == 0){
+ if (rows == 0) {
return TDB_CODE_SUCCESS;
}
tagFilterAssist ctx = {0};
ctx.colHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
- if(ctx.colHash == NULL){
+ if (ctx.colHash == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
ctx.index = 0;
ctx.cInfoList = taosArrayInit(4, sizeof(SColumnInfo));
- if(ctx.cInfoList == NULL){
+ if (ctx.cInfoList == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
- SNode* pNode = NULL;
+ SNode* pNode = NULL;
FOREACH(pNode, group) {
- nodesRewriteExprPostOrder(&pNode, getColumn, (void *)&ctx);
+ nodesRewriteExprPostOrder(&pNode, getColumn, (void*)&ctx);
REPLACE_NODE(pNode);
}
@@ -563,61 +554,61 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
taosArrayPush(uidList, &pkeyInfo->uid);
}
-// int64_t stt = taosGetTimestampUs();
+ // int64_t stt = taosGetTimestampUs();
tags = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
code = metaGetTableTags(metaHandle, pTableListInfo->suid, uidList, tags);
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
-// int64_t stt1 = taosGetTimestampUs();
-// qDebug("generate tag meta rows:%d, cost:%ld us", rows, stt1-stt);
+ // int64_t stt1 = taosGetTimestampUs();
+ // qDebug("generate tag meta rows:%d, cost:%ld us", rows, stt1-stt);
code = blockDataEnsureCapacity(pResBlock, rows);
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
-// int64_t st = taosGetTimestampUs();
+ // int64_t st = taosGetTimestampUs();
for (int32_t i = 0; i < rows; i++) {
int64_t* uid = taosArrayGet(uidList, i);
- for(int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++){
+ for (int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++) {
SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, j);
- if(pColInfo->info.colId == -1){ // tbname
+ if (pColInfo->info.colId == -1) { // tbname
char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
metaGetTableNameByUid(metaHandle, *uid, str);
colDataAppend(pColInfo, i, str, false);
#if TAG_FILTER_DEBUG
- qDebug("tagfilter uid:%ld, tbname:%s", *uid, str+2);
+ qDebug("tagfilter uid:%ld, tbname:%s", *uid, str + 2);
#endif
- }else{
+ } else {
void* tag = taosHashGet(tags, uid, sizeof(int64_t));
ASSERT(tag);
STagVal tagVal = {0};
tagVal.cid = pColInfo->info.colId;
const char* p = metaGetTableTagVal(tag, pColInfo->info.type, &tagVal);
- if (p == NULL || (pColInfo->info.type == TSDB_DATA_TYPE_JSON && ((STag*)p)->nTag == 0)){
+ if (p == NULL || (pColInfo->info.type == TSDB_DATA_TYPE_JSON && ((STag*)p)->nTag == 0)) {
colDataAppend(pColInfo, i, p, true);
} else if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) {
colDataAppend(pColInfo, i, p, false);
} else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
- char *tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE + 1, 1);
+ char* tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE + 1, 1);
varDataSetLen(tmp, tagVal.nData);
memcpy(tmp + VARSTR_HEADER_SIZE, tagVal.pData, tagVal.nData);
colDataAppend(pColInfo, i, tmp, false);
#if TAG_FILTER_DEBUG
- qDebug("tagfilter varch:%s", tmp+2);
+ qDebug("tagfilter varch:%s", tmp + 2);
#endif
taosMemoryFree(tmp);
} else {
colDataAppend(pColInfo, i, (const char*)&tagVal.i64, false);
#if TAG_FILTER_DEBUG
- if(pColInfo->info.type == TSDB_DATA_TYPE_INT){
+ if (pColInfo->info.type == TSDB_DATA_TYPE_INT) {
qDebug("tagfilter int:%d", *(int*)(&tagVal.i64));
- }else if(pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE){
- qDebug("tagfilter double:%f", *(double *)(&tagVal.i64));
+ } else if (pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE) {
+ qDebug("tagfilter double:%f", *(double*)(&tagVal.i64));
}
#endif
}
@@ -626,8 +617,8 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
}
pResBlock->info.rows = rows;
-// int64_t st1 = taosGetTimestampUs();
-// qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
+ // int64_t st1 = taosGetTimestampUs();
+ // qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
pBlockList = taosArrayInit(2, POINTER_BYTES);
taosArrayPush(pBlockList, &pResBlock);
@@ -641,7 +632,7 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
break;
case QUERY_NODE_COLUMN:
case QUERY_NODE_OPERATOR:
- case QUERY_NODE_FUNCTION:{
+ case QUERY_NODE_FUNCTION: {
SExprNode* expNode = (SExprNode*)pNode;
code = createResultData(&expNode->resType, rows, &output);
if (code != TSDB_CODE_SUCCESS) {
@@ -653,16 +644,16 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
code = TSDB_CODE_OPS_NOT_SUPPORT;
goto end;
}
- if(nodeType(pNode) == QUERY_NODE_COLUMN){
- SColumnNode* pSColumnNode = (SColumnNode*)pNode;
+ if (nodeType(pNode) == QUERY_NODE_COLUMN) {
+ SColumnNode* pSColumnNode = (SColumnNode*)pNode;
SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, pSColumnNode->slotId);
code = colDataAssign(output.columnData, pColInfo, rows, NULL);
- }else if(nodeType(pNode) == QUERY_NODE_VALUE){
+ } else if (nodeType(pNode) == QUERY_NODE_VALUE) {
continue;
- }else{
+ } else {
code = scalarCalculate(pNode, pBlockList, &output);
}
- if(code != TSDB_CODE_SUCCESS){
+ if (code != TSDB_CODE_SUCCESS) {
releaseColInfoData(output.columnData);
goto end;
}
@@ -670,7 +661,7 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
}
int32_t keyLen = 0;
- SNode* node;
+ SNode* node;
FOREACH(node, group) {
SExprNode* pExpr = (SExprNode*)node;
keyLen += pExpr->resType.bytes;
@@ -684,12 +675,12 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
code = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
- for(int i = 0; i < rows; i++){
+ for (int i = 0; i < rows; i++) {
STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i);
char* isNull = (char*)keyBuf;
char* pStart = (char*)keyBuf + sizeof(int8_t) * LIST_LENGTH(group);
- for(int j = 0; j < taosArrayGetSize(groupData); j++){
+ for (int j = 0; j < taosArrayGetSize(groupData); j++) {
SColumnInfoData* pValue = (SColumnInfoData*)taosArrayGetP(groupData, j);
if (colDataIsNull_s(pValue, i)) {
@@ -702,7 +693,7 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
code = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR;
goto end;
}
- if(tTagIsJsonNull(data)){
+ if (tTagIsJsonNull(data)) {
isNull[j] = 1;
continue;
}
@@ -724,10 +715,10 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
taosHashPut(pTableListInfo->map, &(info->uid), sizeof(uint64_t), &info->groupId, sizeof(uint64_t));
}
-// int64_t st2 = taosGetTimestampUs();
-// qDebug("calculate tag block rows:%d, cost:%ld us", rows, st2-st1);
+ // int64_t st2 = taosGetTimestampUs();
+ // qDebug("calculate tag block rows:%d, cost:%ld us", rows, st2-st1);
- end:
+end:
taosMemoryFreeClear(keyBuf);
taosHashCleanup(tags);
taosHashCleanup(ctx.colHash);
@@ -757,7 +748,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
SIndexMetaArg metaArg = {
.metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = tsdbGetIvtIdx(metaHandle), .suid = tableUid};
-// int64_t stt = taosGetTimestampUs();
+ // int64_t stt = taosGetTimestampUs();
SIdxFltStatus status = SFLT_NOT_INDEX;
code = doFilterTag(pTagIndexCond, &metaArg, res, &status);
if (code != 0 || status == SFLT_NOT_INDEX) {
@@ -765,23 +756,25 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
code = TDB_CODE_SUCCESS;
}
-// int64_t stt1 = taosGetTimestampUs();
-// qDebug("generate table list, cost:%ld us", stt1-stt);
- }else if(!pTagCond){
+ // int64_t stt1 = taosGetTimestampUs();
+ // qDebug("generate table list, cost:%ld us", stt1-stt);
+ } else if (!pTagCond) {
vnodeGetCtbIdList(pVnode, pScanNode->suid, res);
}
} else { // Create one table group.
- if(metaIsTableExist(metaHandle, tableUid)){
+ if (metaIsTableExist(metaHandle, tableUid)) {
taosArrayPush(res, &tableUid);
}
}
if (pTagCond) {
+ terrno = TDB_CODE_SUCCESS;
SColumnInfoData* pColInfoData = getColInfoResult(metaHandle, pListInfo->suid, res, pTagCond);
- if(terrno != TDB_CODE_SUCCESS){
+ if (terrno != TDB_CODE_SUCCESS) {
colDataDestroy(pColInfoData);
taosMemoryFreeClear(pColInfoData);
taosArrayDestroy(res);
+ qError("failed to getColInfoResult, code: %s", tstrerror(terrno));
return terrno;
}
@@ -839,7 +832,7 @@ size_t getTableTagsBufLen(const SNodeList* pGroups) {
int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, char* keyBuf, uint64_t* pGroupId) {
SMetaReader mr = {0};
metaReaderInit(&mr, pMeta, 0);
- if(metaGetTableEntryByUid(&mr, uid) != 0){ // table not exist
+ if (metaGetTableEntryByUid(&mr, uid) != 0) { // table not exist
metaReaderClear(&mr);
return TSDB_CODE_PAR_TABLE_NOT_EXIST;
}
@@ -997,7 +990,7 @@ static SResSchema createResSchema(int32_t type, int32_t bytes, int32_t slotId, i
return s;
}
-static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDataType* pType) {
+static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDataType* pType, EColumnType colType) {
SColumn* pCol = taosMemoryCalloc(1, sizeof(SColumn));
if (pCol == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -1011,7 +1004,7 @@ static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDa
pCol->scale = pType->scale;
pCol->precision = pType->precision;
pCol->dataBlockId = blockId;
-
+ pCol->colType = colType;
return pCol;
}
@@ -1055,7 +1048,8 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t*
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);
+ 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;
@@ -1107,7 +1101,8 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t*
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);
+ 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;
@@ -1222,7 +1217,6 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
pCtx->start.key = INT64_MIN;
pCtx->end.key = INT64_MIN;
pCtx->numOfParams = pExpr->base.numOfParams;
- pCtx->increase = false;
pCtx->isStream = false;
pCtx->param = pFunct->pParam;
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index d8f63cb0082f4822a7b025adf1733510e2cf91a5..fe1f4911cae75aa4f972670126b9e94735dd1a56 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -352,12 +352,14 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
int32_t code = createExecTaskInfoImpl(pSubplan, pTask, readHandle, taskId, sql, model);
if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to createExecTaskInfoImpl, code: %s", tstrerror(code));
goto _error;
}
SDataSinkMgtCfg cfg = {.maxDataBlockNum = 10000, .maxDataBlockNumPerQuery = 5000};
code = dsDataSinkMgtInit(&cfg);
if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to dsDataSinkMgtInit, code: %s", tstrerror(code));
goto _error;
}
@@ -365,6 +367,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
void* pSinkParam = NULL;
code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, pTaskInfo, readHandle);
if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to createDataSinkParam, code: %s", tstrerror(code));
goto _error;
}
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index 2d72bc813f6b767891bce7d45570eb8db2e2be93..62bf5e20f2705619e8ffc70f9b6fe5979fca39e5 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -76,12 +76,6 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) {
#define realloc u_realloc
#endif
-#define T_LONG_JMP(_obj, _c) \
- do { \
- assert((_c) != -1); \
- longjmp((_obj), (_c)); \
- } while (0);
-
#define CLEAR_QUERY_STATUS(q, st) ((q)->status &= (~(st)))
#define QUERY_IS_INTERVAL_QUERY(_q) ((_q)->interval.interval > 0)
@@ -92,19 +86,17 @@ static int32_t getExprFunctionId(SExprInfo* pExprInfo) {
return 0;
}
-static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type, int16_t bytes);
-
-static void setBlockSMAInfo(SqlFunctionCtx* pCtx, SExprInfo* pExpr, SSDataBlock* pSDataBlock);
+static void setBlockSMAInfo(SqlFunctionCtx* pCtx, SExprInfo* pExpr, SSDataBlock* pBlock);
static void releaseQueryBuf(size_t numOfTables);
-static void destroyFillOperatorInfo(void* param, int32_t numOfOutput);
-static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput);
-static void destroyOrderOperatorInfo(void* param, int32_t numOfOutput);
-static void destroyAggOperatorInfo(void* param, int32_t numOfOutput);
+static void destroyFillOperatorInfo(void* param);
+static void destroyProjectOperatorInfo(void* param);
+static void destroyOrderOperatorInfo(void* param);
+static void destroyAggOperatorInfo(void* param);
-static void destroyIntervalOperatorInfo(void* param, int32_t numOfOutput);
-static void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput);
+static void destroyIntervalOperatorInfo(void* param);
+static void destroyExchangeOperatorInfo(void* param);
static void destroyOperatorInfo(SOperatorInfo* pOperator);
@@ -148,20 +140,6 @@ static int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock,
static void initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size);
static void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
-// setup the output buffer for each operator
-static bool hasNull(SColumn* pColumn, SColumnDataAgg* pStatis) {
- if (TSDB_COL_IS_TAG(pColumn->flag) || TSDB_COL_IS_UD_COL(pColumn->flag) ||
- pColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
- return false;
- }
-
- if (pStatis != NULL && pStatis->numOfNull == 0) {
- return false;
- }
-
- return true;
-}
-
#if 0
static bool chkResultRowFromKey(STaskRuntimeEnv* pRuntimeEnv, SResultRowInfo* pResultRowInfo, char* pData,
int16_t bytes, bool masterscan, uint64_t uid) {
@@ -206,7 +184,7 @@ SResultRow* getNewResultRow(SDiskbasedBuf* pResultBuf, int64_t tableGroupId, int
// in the first scan, new space needed for results
int32_t pageId = -1;
- SIDList list = getDataBufPagesIdList(pResultBuf, tableGroupId);
+ SIDList list = getDataBufPagesIdList(pResultBuf);
if (taosArrayGetSize(list) == 0) {
pData = getNewBufPage(pResultBuf, tableGroupId, &pageId);
@@ -256,7 +234,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
SET_RES_WINDOW_KEY(pSup->keyBuf, pData, bytes, groupId);
SResultRowPosition* p1 =
- (SResultRowPosition*)taosHashGet(pSup->pResultRowHashTable, pSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
+ (SResultRowPosition*)tSimpleHashGet(pSup->pResultRowHashTable, pSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
SResultRow* pResult = NULL;
@@ -278,9 +256,6 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// 1. close current opened time window
if (pResultRowInfo->cur.pageId != -1 && ((pResult == NULL) || (pResult->pageId != pResultRowInfo->cur.pageId))) {
-#ifdef BUF_PAGE_DEBUG
- qDebug("page_1");
-#endif
SResultRowPosition pos = pResultRowInfo->cur;
SFilePage* pPage = getBufPage(pResultBuf, pos.pageId);
releaseBufPage(pResultBuf, pPage);
@@ -298,7 +273,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// add a new result set for a new group
SResultRowPosition pos = {.pageId = pResult->pageId, .offset = pResult->offset};
- taosHashPut(pSup->pResultRowHashTable, pSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes), &pos,
+ tSimpleHashPut(pSup->pResultRowHashTable, pSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes), &pos,
sizeof(SResultRowPosition));
}
@@ -307,8 +282,8 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// too many time window in query
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_BATCH &&
- taosHashGetSize(pSup->pResultRowHashTable) > MAX_INTERVAL_TIME_WINDOW) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
+ tSimpleHashGetSize(pSup->pResultRowHashTable) > MAX_INTERVAL_TIME_WINDOW) {
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
}
return pResult;
@@ -324,7 +299,7 @@ static int32_t addNewWindowResultBuf(SResultRow* pWindowRes, SDiskbasedBuf* pRes
// in the first scan, new space needed for results
int32_t pageId = -1;
- SIDList list = getDataBufPagesIdList(pResultBuf, tid);
+ SIDList list = getDataBufPagesIdList(pResultBuf);
if (taosArrayGetSize(list) == 0) {
pData = getNewBufPage(pResultBuf, tid, &pageId);
@@ -392,7 +367,7 @@ static void functionCtxSave(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus) {
static void functionCtxRestore(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus) {
pCtx->input.colDataAggIsSet = pStatus->hasAgg;
- pCtx->input.numOfRows = pStatus->numOfRows;
+ pCtx->input.numOfRows = pStatus->numOfRows;
pCtx->input.startRowIndex = pStatus->startOffset;
}
@@ -434,7 +409,7 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, SColumnInfo
if (code != TSDB_CODE_SUCCESS) {
qError("%s apply functions error, code: %s", GET_TASKID(taskInfo), tstrerror(code));
taskInfo->code = code;
- longjmp(taskInfo->env, code);
+ T_LONG_JMP(taskInfo->env, code);
}
}
@@ -625,7 +600,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
if (pExpr[k].pExpr->nodeType == QUERY_NODE_COLUMN) { // it is a project query
SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId);
if (pResult->info.rows > 0 && !createNewColModel) {
- colDataMergeCol(pColInfoData, pResult->info.rows, &pResult->info.capacity, pInputData->pData[0],
+ colDataMergeCol(pColInfoData, pResult->info.rows, (int32_t*)&pResult->info.capacity, pInputData->pData[0],
pInputData->numOfRows);
} else {
colDataAssign(pColInfoData, pInputData->pData[0], pInputData->numOfRows, &pResult->info);
@@ -663,7 +638,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
ASSERT(pResult->info.capacity > 0);
- colDataMergeCol(pResColData, startOffset, &pResult->info.capacity, &idata, dest.numOfRows);
+ colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows);
colDataDestroy(&idata);
numOfRows = dest.numOfRows;
@@ -728,7 +703,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
ASSERT(pResult->info.capacity > 0);
- colDataMergeCol(pResColData, startOffset, &pResult->info.capacity, &idata, dest.numOfRows);
+ colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows);
colDataDestroy(&idata);
numOfRows = dest.numOfRows;
@@ -1152,7 +1127,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.uid, &win, masterScan, &pResult, groupId,
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
pTableScanInfo->rowEntryInfoOffset) != TSDB_CODE_SUCCESS) {
- longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
}
} else if (pQueryAttr->stableQuery && (!pQueryAttr->tsCompQuery) && (!pQueryAttr->diffQuery)) { // stable aggregate, not interval aggregate or normal column aggregate
@@ -1203,7 +1178,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.uid, &win, masterScan, &pResult, groupId,
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
pTableScanInfo->rowEntryInfoOffset) != TSDB_CODE_SUCCESS) {
- longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
}
}
@@ -1495,7 +1470,7 @@ int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosi
if (TAOS_FAILED(code)) {
releaseBufPage(pBuf, page);
qError("%s ensure result data capacity failed, code %s", GET_TASKID(pTaskInfo), tstrerror(code));
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
@@ -1507,7 +1482,7 @@ int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosi
int32_t code = pCtx[j].fpSet.finalize(&pCtx[j], pBlock);
if (TAOS_FAILED(code)) {
qError("%s build result data block error, code %s", GET_TASKID(pTaskInfo), tstrerror(code));
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
} else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) {
// do nothing, todo refactor
@@ -1581,7 +1556,7 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
int32_t code = pCtx[j].fpSet.finalize(&pCtx[j], pBlock);
if (TAOS_FAILED(code)) {
qError("%s build result data block error, code %s", GET_TASKID(pTaskInfo), tstrerror(code));
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
} else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) {
// do nothing, todo refactor
@@ -1590,16 +1565,8 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
// the _wstart needs to copy to 20 following rows, since the results of top-k expands to 20 different rows.
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, slotId);
char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo);
- if (pCtx[j].increase) {
- int64_t ts = *(int64_t*)in;
- for (int32_t k = 0; k < pRow->numOfRows; ++k) {
- colDataAppend(pColInfoData, pBlock->info.rows + k, (const char*)&ts, pCtx[j].resultInfo->isNullRes);
- ts++;
- }
- } else {
- for (int32_t k = 0; k < pRow->numOfRows; ++k) {
- colDataAppend(pColInfoData, pBlock->info.rows + k, in, pCtx[j].resultInfo->isNullRes);
- }
+ for (int32_t k = 0; k < pRow->numOfRows; ++k) {
+ colDataAppend(pColInfoData, pBlock->info.rows + k, in, pCtx[j].resultInfo->isNullRes);
}
}
}
@@ -1736,7 +1703,7 @@ void queryCostStatis(SExecTaskInfo* pTaskInfo) {
// SDataBlockInfo blockInfo = SDATA_BLOCK_INITIALIZER;
// while (tsdbNextDataBlock(pTsdbReadHandle)) {
// if (isTaskKilled(pRuntimeEnv->qinfo)) {
-// longjmp(pRuntimeEnv->env, TSDB_CODE_TSC_QUERY_CANCELLED);
+// T_LONG_JMP(pRuntimeEnv->env, TSDB_CODE_TSC_QUERY_CANCELLED);
// }
//
// tsdbRetrieveDataBlockInfo(pTsdbReadHandle, &blockInfo);
@@ -1755,7 +1722,7 @@ void queryCostStatis(SExecTaskInfo* pTaskInfo) {
// }
//
// if (terrno != TSDB_CODE_SUCCESS) {
-// longjmp(pRuntimeEnv->env, terrno);
+// T_LONG_JMP(pRuntimeEnv->env, terrno);
// }
// }
@@ -1919,7 +1886,7 @@ void queryCostStatis(SExecTaskInfo* pTaskInfo) {
//
// // check for error
// if (terrno != TSDB_CODE_SUCCESS) {
-// longjmp(pRuntimeEnv->env, terrno);
+// T_LONG_JMP(pRuntimeEnv->env, terrno);
// }
//
// return true;
@@ -2771,7 +2738,7 @@ static SSDataBlock* doSortedMerge(SOperatorInfo* pOperator) {
int32_t code = tsortOpen(pInfo->pSortHandle);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
pOperator->status = OP_RES_TO_RETURN;
@@ -2966,7 +2933,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
int32_t code = getTableScanInfo(pOperator, &order, &scanFlag);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
// there is an scalar expression that needs to be calculated before apply the group aggregation.
@@ -2974,7 +2941,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
SExprSupp* pSup1 = &pAggInfo->scalarExprSup;
code = projectApplyFunctions(pSup1->pExprInfo, pBlock, pBlock, pSup1->pCtx, pSup1->numOfExprs, NULL);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
@@ -2983,7 +2950,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, true);
code = doAggregateImpl(pOperator, pSup->pCtx);
if (code != 0) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
@@ -3036,7 +3003,7 @@ int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* len
}
SOptrBasicInfo* pInfo = (SOptrBasicInfo*)(pOperator->info);
SAggSupporter* pSup = (SAggSupporter*)POINTER_SHIFT(pOperator->info, sizeof(SOptrBasicInfo));
- int32_t size = taosHashGetSize(pSup->pResultRowHashTable);
+ int32_t size = tSimpleHashGetSize(pSup->pResultRowHashTable);
size_t keyLen = sizeof(uint64_t) * 2; // estimate the key length
int32_t totalSize =
sizeof(int32_t) + sizeof(int32_t) + size * (sizeof(int32_t) + keyLen + sizeof(int32_t) + pSup->resultRowSize);
@@ -3063,10 +3030,11 @@ int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* len
SResultRow* pRow = (SResultRow*)((char*)pPage + pos->offset);
setBufPageDirty(pPage, true);
releaseBufPage(pSup->pResultBuf, pPage);
-
- void* pIter = taosHashIterate(pSup->pResultRowHashTable, NULL);
- while (pIter) {
- void* key = taosHashGetKey(pIter, &keyLen);
+
+ int32_t iter = 0;
+ void* pIter = NULL;
+ while ((pIter = tSimpleHashIterate(pSup->pResultRowHashTable, pIter, &iter))) {
+ void* key = tSimpleHashGetKey(pIter, &keyLen);
SResultRowPosition* p1 = (SResultRowPosition*)pIter;
pPage = (SFilePage*)getBufPage(pSup->pResultBuf, p1->pageId);
@@ -3097,8 +3065,6 @@ int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* len
offset += sizeof(int32_t);
memcpy(*result + offset, pRow, pSup->resultRowSize);
offset += pSup->resultRowSize;
-
- pIter = taosHashIterate(pSup->pResultRowHashTable, pIter);
}
*(int32_t*)(*result) = offset;
@@ -3133,7 +3099,7 @@ int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) {
// add a new result set for a new group
SResultRowPosition pos = {.pageId = resultRow->pageId, .offset = resultRow->offset};
- taosHashPut(pSup->pResultRowHashTable, result + offset, keyLen, &pos, sizeof(SResultRowPosition));
+ tSimpleHashPut(pSup->pResultRowHashTable, result + offset, keyLen, &pos, sizeof(SResultRowPosition));
offset += keyLen;
int32_t valueLen = *(int32_t*)(result + offset);
@@ -3250,6 +3216,7 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp
Q_STATUS_EQUAL(pTaskInfo->status, TASK_COMPLETED) ? pInfo->win.ekey : pInfo->existNewGroupBlock->info.window.ekey;
taosResetFillInfo(pInfo->pFillInfo, getFillInfoStart(pInfo->pFillInfo));
+ blockDataCleanup(pInfo->pRes);
doApplyScalarCalculation(pOperator, pInfo->existNewGroupBlock, order, scanFlag);
taosFillSetStartInfo(pInfo->pFillInfo, pInfo->pRes->info.rows, ekey);
@@ -3312,7 +3279,6 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
SSDataBlock* pResBlock = pInfo->pFinalRes;
blockDataCleanup(pResBlock);
- blockDataCleanup(pInfo->pRes);
int32_t order = TSDB_ORDER_ASC;
int32_t scanFlag = MAIN_SCAN;
@@ -3336,6 +3302,8 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey);
} else {
blockDataUpdateTsWindow(pBlock, pInfo->primarySrcSlotId);
+
+ blockDataCleanup(pInfo->pRes);
doApplyScalarCalculation(pOperator, pBlock, order, scanFlag);
if (pInfo->curGroupId == 0 || pInfo->curGroupId == pInfo->pRes->info.groupId) {
@@ -3378,7 +3346,6 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
assert(pBlock != NULL);
blockDataCleanup(pResBlock);
- blockDataCleanup(pInfo->pRes);
doHandleRemainBlockForNewGroupImpl(pOperator, pInfo, pResultInfo, pTaskInfo);
if (pResBlock->info.rows > pResultInfo->threshold) {
@@ -3440,7 +3407,7 @@ static void destroyOperatorInfo(SOperatorInfo* pOperator) {
}
if (pOperator->fpSet.closeFn != NULL) {
- pOperator->fpSet.closeFn(pOperator->info, pOperator->exprSupp.numOfExprs);
+ pOperator->fpSet.closeFn(pOperator->info);
}
if (pOperator->pDownstream != NULL) {
@@ -3477,7 +3444,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
pAggSup->resultRowSize = getResultRowSize(pCtx, numOfOutput);
pAggSup->keyBuf = taosMemoryCalloc(1, keyBufSize + POINTER_BYTES + sizeof(int64_t));
- pAggSup->pResultRowHashTable = taosHashInit(10, hashFn, true, HASH_NO_LOCK);
+ pAggSup->pResultRowHashTable = tSimpleHashInit(10, hashFn);
if (pAggSup->keyBuf == NULL || pAggSup->pResultRowHashTable == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
@@ -3492,6 +3459,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
qError("Init stream agg supporter failed since %s", terrstr(terrno));
return terrno;
}
+
int32_t code = createDiskbasedBuf(&pAggSup->pResultBuf, defaultPgsz, defaultBufsz, pKey, tsTempDir);
if (code != TSDB_CODE_SUCCESS) {
qError("Create agg result buf failed since %s", tstrerror(code));
@@ -3503,7 +3471,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
void cleanupAggSup(SAggSupporter* pAggSup) {
taosMemoryFreeClear(pAggSup->keyBuf);
- taosHashCleanup(pAggSup->pResultRowHashTable);
+ tSimpleHashCleanup(pAggSup->pResultRowHashTable);
destroyDiskbasedBuf(pAggSup->pResultBuf);
}
@@ -3631,7 +3599,7 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo*
return pOperator;
_error:
- destroyAggOperatorInfo(pInfo, numOfCols);
+ destroyAggOperatorInfo(pInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
@@ -3639,7 +3607,6 @@ _error:
void cleanupBasicInfo(SOptrBasicInfo* pInfo) {
assert(pInfo != NULL);
- cleanupResultRowInfo(&pInfo->resultRowInfo);
pInfo->pRes = blockDataDestroy(pInfo->pRes);
}
@@ -3657,7 +3624,7 @@ static void freeItem(void* pItem) {
}
}
-void destroyAggOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyAggOperatorInfo(void* param) {
SAggOperatorInfo* pInfo = (SAggOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
@@ -3667,7 +3634,7 @@ void destroyAggOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear(param);
}
-void destroyFillOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyFillOperatorInfo(void* param) {
SFillOperatorInfo* pInfo = (SFillOperatorInfo*)param;
pInfo->pFillInfo = taosDestroyFillInfo(pInfo->pFillInfo);
pInfo->pRes = blockDataDestroy(pInfo->pRes);
@@ -3683,7 +3650,7 @@ void destroyFillOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear(param);
}
-void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyExchangeOperatorInfo(void* param) {
SExchangeInfo* pExInfo = (SExchangeInfo*)param;
taosRemoveRef(exchangeObjRefPool, pExInfo->self);
}
@@ -3715,7 +3682,7 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t
const char* id, SInterval* pInterval, int32_t fillType, int32_t order) {
SFillColInfo* pColInfo = createFillColInfo(pExpr, numOfCols, pNotFillExpr, numOfNotFillCols, pValNode);
- int64_t startKey = (order == TSDB_ORDER_ASC) ? win.skey : win.ekey;
+ int64_t startKey = (order == TSDB_ORDER_ASC) ? win.skey : win.ekey;
STimeWindow w = getAlignQueryTimeWindow(pInterval, pInterval->precision, startKey);
w = getFirstQualifiedTimeWindow(startKey, &w, pInterval, order);
@@ -3988,15 +3955,15 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
bool assignUid = groupbyTbname(group);
- size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
+ size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
- if(assignUid){
+ if (assignUid) {
for (int32_t i = 0; i < numOfTables; i++) {
STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i);
info->groupId = info->uid;
taosHashPut(pTableListInfo->map, &(info->uid), sizeof(uint64_t), &info->groupId, sizeof(uint64_t));
}
- }else{
+ } else {
int32_t code = getColInfoResultForGroupby(pHandle->meta, group, pTableListInfo);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -4049,6 +4016,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTableListInfo, pTagCond, pTagIndexCond, GET_TASKID(pTaskInfo));
if (code) {
pTaskInfo->code = code;
+ qError("failed to createScanTableListInfo, code:%s, %s", tstrerror(code), GET_TASKID(pTaskInfo));
return NULL;
}
@@ -4068,6 +4036,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTableListInfo, pTagCond, pTagIndexCond, GET_TASKID(pTaskInfo));
if (code) {
pTaskInfo->code = code;
+ qError("failed to createScanTableListInfo, code: %s", tstrerror(code));
return NULL;
}
@@ -4091,6 +4060,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pHandle, pTableListInfo, pTagCond, pTagIndexCond, GET_TASKID(pTaskInfo));
if (code) {
pTaskInfo->code = code;
+ qError("failed to createScanTableListInfo, code: %s", tstrerror(code));
return NULL;
}
@@ -4113,6 +4083,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanPhyNode, pTagCond, pTagIndexCond, pTableListInfo);
if (code != TSDB_CODE_SUCCESS) {
pTaskInfo->code = terrno;
+ qError("failed to getTableList, code: %s", tstrerror(code));
return NULL;
}
@@ -4159,7 +4130,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return NULL;
}
- pOperator = createLastrowScanOperator(pScanNode, pHandle, pTaskInfo);
+ pOperator = createCacherowsScanOperator(pScanNode, pHandle, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) {
pOperator = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pPhyNode, pTaskInfo);
} else {
@@ -4183,9 +4154,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
if (ops[i] == NULL) {
taosMemoryFree(ops);
return NULL;
- } else {
- ops[i]->resultDataBlockId = pChildNode->pOutputDataBlockDesc->dataBlockId;
}
+
+ ops[i]->resultDataBlockId = pChildNode->pOutputDataBlockDesc->dataBlockId;
}
SOperatorInfo* pOptr = NULL;
@@ -4237,37 +4208,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL == type) {
SMergeAlignedIntervalPhysiNode* pIntervalPhyNode = (SMergeAlignedIntervalPhysiNode*)pPhyNode;
-
- SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &num);
- SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
-
- SInterval interval = {.interval = pIntervalPhyNode->interval,
- .sliding = pIntervalPhyNode->sliding,
- .intervalUnit = pIntervalPhyNode->intervalUnit,
- .slidingUnit = pIntervalPhyNode->slidingUnit,
- .offset = pIntervalPhyNode->offset,
- .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision};
-
- int32_t tsSlotId = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId;
- pOptr = createMergeAlignedIntervalOperatorInfo(ops[0], pExprInfo, num, pResBlock, &interval, tsSlotId,
- pPhyNode->pConditions, pIntervalPhyNode->window.mergeDataBlock,
- pTaskInfo);
+ pOptr = createMergeAlignedIntervalOperatorInfo(ops[0], pIntervalPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL == type) {
SMergeIntervalPhysiNode* pIntervalPhyNode = (SMergeIntervalPhysiNode*)pPhyNode;
-
- SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &num);
- SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
-
- SInterval interval = {.interval = pIntervalPhyNode->interval,
- .sliding = pIntervalPhyNode->sliding,
- .intervalUnit = pIntervalPhyNode->intervalUnit,
- .slidingUnit = pIntervalPhyNode->slidingUnit,
- .offset = pIntervalPhyNode->offset,
- .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision};
-
- int32_t tsSlotId = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId;
- pOptr = createMergeIntervalOperatorInfo(ops[0], pExprInfo, num, pResBlock, &interval, tsSlotId,
- pIntervalPhyNode->window.mergeDataBlock, pTaskInfo);
+ pOptr = createMergeIntervalOperatorInfo(ops[0], pIntervalPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL == type) {
int32_t children = 0;
pOptr = createStreamFinalIntervalOperatorInfo(ops[0], pPhyNode, pTaskInfo, children);
@@ -4296,17 +4240,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pOptr = createPartitionOperatorInfo(ops[0], (SPartitionPhysiNode*)pPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE == type) {
SStateWinodwPhysiNode* pStateNode = (SStateWinodwPhysiNode*)pPhyNode;
-
- STimeWindowAggSupp as = {.waterMark = pStateNode->window.watermark, .calTrigger = pStateNode->window.triggerType};
-
- SExprInfo* pExprInfo = createExprInfo(pStateNode->window.pFuncs, NULL, &num);
- SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
- int32_t tsSlotId = ((SColumnNode*)pStateNode->window.pTspk)->slotId;
-
- SColumnNode* pColNode = (SColumnNode*)((STargetNode*)pStateNode->pStateKey)->pExpr;
- SColumn col = extractColumnFromColumnNode(pColNode);
- pOptr = createStatewindowOperatorInfo(ops[0], pExprInfo, num, pResBlock, &as, tsSlotId, &col, pPhyNode->pConditions,
- pTaskInfo);
+ pOptr = createStatewindowOperatorInfo(ops[0], pStateNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE == type) {
pOptr = createStreamStateAggOperatorInfo(ops[0], pPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN == type) {
@@ -4320,8 +4254,12 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else {
ASSERT(0);
}
+
taosMemoryFree(ops);
- if (pOptr) pOptr->resultDataBlockId = pPhyNode->pOutputDataBlockDesc->dataBlockId;
+ if (pOptr) {
+ pOptr->resultDataBlockId = pPhyNode->pOutputDataBlockDesc->dataBlockId;
+ }
+
return pOptr;
}
@@ -4611,6 +4549,10 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
goto _complete;
}
+ if (pHandle && pHandle->pStateBackend) {
+ (*pTaskInfo)->streamInfo.pState = pHandle->pStateBackend;
+ }
+
(*pTaskInfo)->sql = sql;
sql = NULL;
(*pTaskInfo)->pSubplan = pPlan;
@@ -4663,27 +4605,6 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) {
taosMemoryFreeClear(pTaskInfo);
}
-static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type, int16_t bytes) {
- if (val == NULL) {
- setNull(output, type, bytes);
- return;
- }
-
- if (IS_VAR_DATA_TYPE(type)) {
- // Binary data overflows for sort of unknown reasons. Let trim the overflow data
- if (varDataTLen(val) > bytes) {
- int32_t maxLen = bytes - VARSTR_HEADER_SIZE;
- int32_t len = (varDataLen(val) > maxLen) ? maxLen : varDataLen(val);
- memcpy(varDataVal(output), varDataVal(val), len);
- varDataSetLen(output, len);
- } else {
- varDataCopy(output, val);
- }
- } else {
- memcpy(output, val, bytes);
- }
-}
-
static int64_t getQuerySupportBufSize(size_t numOfTables) {
size_t s1 = sizeof(STableQueryInfo);
// size_t s3 = sizeof(STableCheckInfo); buffer consumption in tsdb
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index 05dffc658b29bb5eb6675edae62d04bb6442cc48..9d7e833b19c05ebdf3bb72d9a28cdb28a28104cd 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -36,8 +36,12 @@ static void freeGroupKey(void* param) {
taosMemoryFree(pKey->pData);
}
-static void destroyGroupOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyGroupOperatorInfo(void* param) {
SGroupbyOperatorInfo* pInfo = (SGroupbyOperatorInfo*)param;
+ if (pInfo == NULL) {
+ return;
+ }
+
cleanupBasicInfo(&pInfo->binfo);
taosMemoryFreeClear(pInfo->keyBuf);
taosArrayDestroy(pInfo->pGroupCols);
@@ -247,7 +251,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
if (!pInfo->isInit) {
recordNewGroupKeys(pInfo->pGroupCols, pInfo->pGroupColVals, pBlock, j);
if (terrno != TSDB_CODE_SUCCESS) { // group by json error
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
pInfo->isInit = true;
num++;
@@ -265,7 +269,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
num++;
recordNewGroupKeys(pInfo->pGroupCols, pInfo->pGroupColVals, pBlock, j);
if (terrno != TSDB_CODE_SUCCESS) { // group by json error
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
continue;
}
@@ -273,7 +277,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
int32_t ret = setGroupResultOutputBuf(pOperator, &(pInfo->binfo), pOperator->exprSupp.numOfExprs, pInfo->keyBuf, len, pBlock->info.groupId, pInfo->aggSup.pResultBuf, &pInfo->aggSup);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
}
int32_t rowIndex = j - num;
@@ -291,7 +295,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
setGroupResultOutputBuf(pOperator, &(pInfo->binfo), pOperator->exprSupp.numOfExprs, pInfo->keyBuf, len,
pBlock->info.groupId, pInfo->aggSup.pResultBuf, &pInfo->aggSup);
if (ret != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
}
int32_t rowIndex = pBlock->info.rows - num;
@@ -350,7 +354,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
int32_t code = getTableScanInfo(pOperator, &order, &scanFlag);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
// the pDataBlock are always the same one, no need to call this again
@@ -360,7 +364,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
if (pInfo->scalarSup.pExprInfo != NULL) {
pTaskInfo->code = projectApplyFunctions(pInfo->scalarSup.pExprInfo, pBlock, pBlock, pInfo->scalarSup.pCtx, pInfo->scalarSup.numOfExprs, NULL);
if (pTaskInfo->code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, pTaskInfo->code);
+ T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
}
}
@@ -413,7 +417,11 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
}
initResultSizeInfo(&pOperator->resultInfo, 4096);
- initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, pInfo->groupKeyLen, pTaskInfo->id.str);
+ code = initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, pInfo->groupKeyLen, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
initBasicInfo(&pInfo->binfo, pResultBlock);
initResultRowInfo(&pInfo->binfo.resultRowInfo);
@@ -426,11 +434,15 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, hashGroupbyAggregate, NULL, NULL, destroyGroupOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL);
code = appendDownstream(pOperator, &downstream, 1);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
return pOperator;
_error:
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
- taosMemoryFreeClear(pInfo);
+ destroyGroupOperatorInfo(pInfo);
taosMemoryFreeClear(pOperator);
return NULL;
}
@@ -678,20 +690,20 @@ static SSDataBlock* hashPartition(SOperatorInfo* pOperator) {
if (pInfo->scalarSup.pExprInfo != NULL) {
pTaskInfo->code = projectApplyFunctions(pInfo->scalarSup.pExprInfo, pBlock, pBlock, pInfo->scalarSup.pCtx, pInfo->scalarSup.numOfExprs, NULL);
if (pTaskInfo->code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, pTaskInfo->code);
+ T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
}
}
terrno = TSDB_CODE_SUCCESS;
doHashPartition(pOperator, pBlock);
if (terrno != TSDB_CODE_SUCCESS) { // group by json error
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
}
SArray* groupArray = taosArrayInit(taosHashGetSize(pInfo->pGroupSet), sizeof(SDataGroupInfo));
- void* pGroupIter = NULL;
- pGroupIter = taosHashIterate(pInfo->pGroupSet, NULL);
+
+ void* pGroupIter = taosHashIterate(pInfo->pGroupSet, NULL);
while (pGroupIter != NULL) {
SDataGroupInfo* pGroupInfo = pGroupIter;
taosArrayPush(groupArray, pGroupInfo);
@@ -710,7 +722,7 @@ static SSDataBlock* hashPartition(SOperatorInfo* pOperator) {
return buildPartitionResult(pOperator);
}
-static void destroyPartitionOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyPartitionOperatorInfo(void* param) {
SPartitionOperatorInfo* pInfo = (SPartitionOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
taosArrayDestroy(pInfo->pGroupCols);
diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c
index 7d2b84d0f053a7c8c6e3f63db719f67b3d9e99f3..1bc7d458e0ee16decabea988a16713996d2468ce 100644
--- a/source/libs/executor/src/joinoperator.c
+++ b/source/libs/executor/src/joinoperator.c
@@ -25,7 +25,7 @@
static void setJoinColumnInfo(SColumnInfo* pColumn, const SColumnNode* pColumnNode);
static SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator);
-static void destroyMergeJoinOperator(void* param, int32_t numOfOutput);
+static void destroyMergeJoinOperator(void* param);
static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t numOfDownstream,
SSortMergeJoinPhysiNode* pJoinNode);
@@ -128,12 +128,11 @@ void setJoinColumnInfo(SColumnInfo* pColumn, const SColumnNode* pColumnNode) {
pColumn->scale = pColumnNode->node.resType.scale;
}
-void destroyMergeJoinOperator(void* param, int32_t numOfOutput) {
+void destroyMergeJoinOperator(void* param) {
SJoinOperatorInfo* pJoinOperator = (SJoinOperatorInfo*)param;
nodesDestroyNode(pJoinOperator->pCondAfterMerge);
pJoinOperator->pRes = blockDataDestroy(pJoinOperator->pRes);
-
taosMemoryFreeClear(param);
}
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index f2b79bf703343a8365b832b23dcd514e5ecc0574..0661ccd3902bc0ba653e988cf6a03f91d2c6c68f 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -23,7 +23,7 @@ static SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOf
static void setFunctionResultOutput(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, SAggSupporter* pSup, int32_t stage,
int32_t numOfExprs);
-static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyProjectOperatorInfo(void* param) {
if (NULL == param) {
return;
}
@@ -37,10 +37,13 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear(param);
}
-static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyIndefinitOperatorInfo(void* param) {
SIndefOperatorInfo* pInfo = (SIndefOperatorInfo*)param;
- cleanupBasicInfo(&pInfo->binfo);
+ if (pInfo == NULL) {
+ return;
+ }
+ cleanupBasicInfo(&pInfo->binfo);
taosArrayDestroy(pInfo->pPseudoColInfo);
cleanupAggSup(&pInfo->aggSup);
cleanupExprSupp(&pInfo->scalarSup);
@@ -50,9 +53,11 @@ static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) {
SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode* pProjPhyNode,
SExecTaskInfo* pTaskInfo) {
+ int32_t code = TSDB_CODE_SUCCESS;
SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
goto _error;
}
@@ -67,12 +72,11 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
pInfo->binfo.pRes = pResBlock;
pInfo->pFinalRes = createOneDataBlock(pResBlock, false);
pInfo->pFilterNode = pProjPhyNode->node.pConditions;
- pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock;
-
- // todo remove it soon
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) {
pInfo->mergeDataBlocks = false;
+ } else {
+ pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock;
}
int32_t numOfRows = 4096;
@@ -83,9 +87,13 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
if (numOfRows * pResBlock->info.rowSize > TWOMB) {
numOfRows = TWOMB / pResBlock->info.rowSize;
}
+
initResultSizeInfo(&pOperator->resultInfo, numOfRows);
+ code = initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
- initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str);
initBasicInfo(&pInfo->binfo, pResBlock);
setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, numOfCols);
@@ -99,7 +107,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doProjectOperation, NULL, NULL,
destroyProjectOperatorInfo, NULL, NULL, NULL);
- int32_t code = appendDownstream(pOperator, &downstream, 1);
+ code = appendDownstream(pOperator, &downstream, 1);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
@@ -107,7 +115,9 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
return pOperator;
_error:
- pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
+ destroyProjectOperatorInfo(pInfo);
+ taosMemoryFree(pOperator);
+ pTaskInfo->code = code;
return NULL;
}
@@ -175,7 +185,8 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
int32_t keepRows = (int32_t)(pLimitInfo->limit.limit - pLimitInfo->numOfOutputRows);
blockDataKeepFirstNRows(pBlock, keepRows);
//TODO: optimize it later when partition by + limit
- if ((pLimitInfo->slimit.limit == -1 && pLimitInfo->currentGroupId == 0) || pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups) {
+ if ((pLimitInfo->slimit.limit == -1 && pLimitInfo->currentGroupId == 0) ||
+ (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
doSetOperatorCompleted(pOperator);
}
}
@@ -260,7 +271,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
// the pDataBlock are always the same one, no need to call this again
int32_t code = getTableScanInfo(downstream, &order, &scanFlag);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false);
@@ -269,7 +280,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs,
pProjectInfo->pPseudoColInfo);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
status = doIngroupLimitOffset(pLimitInfo, pBlock->info.groupId, pInfo->pRes, pOperator);
@@ -363,9 +374,12 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
initResultSizeInfo(&pOperator->resultInfo, numOfRows);
- initAggInfo(pSup, &pInfo->aggSup, pExprInfo, numOfExpr, keyBufSize, pTaskInfo->id.str);
- initBasicInfo(&pInfo->binfo, pResBlock);
+ int32_t code = initAggInfo(pSup, &pInfo->aggSup, pExprInfo, numOfExpr, keyBufSize, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ initBasicInfo(&pInfo->binfo, pResBlock);
setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, numOfExpr);
pInfo->binfo.pRes = pResBlock;
@@ -381,7 +395,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doApplyIndefinitFunction, NULL, NULL,
destroyIndefinitOperatorInfo, NULL, NULL, NULL);
- int32_t code = appendDownstream(pOperator, &downstream, 1);
+ code = appendDownstream(pOperator, &downstream, 1);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
@@ -389,7 +403,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
return pOperator;
_error:
- taosMemoryFree(pInfo);
+ destroyIndefinitOperatorInfo(pInfo);
taosMemoryFree(pOperator);
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
@@ -407,7 +421,7 @@ static void doHandleDataBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, SOp
// the pDataBlock are always the same one, no need to call this again
int32_t code = getTableScanInfo(downstream, &order, &scanFlag);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
// there is an scalar expression that needs to be calculated before apply the group aggregation.
@@ -416,7 +430,7 @@ static void doHandleDataBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, SOp
code = projectApplyFunctions(pScalarSup->pExprInfo, pBlock, pBlock, pScalarSup->pCtx, pScalarSup->numOfExprs,
pIndefInfo->pPseudoColInfo);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
@@ -426,7 +440,7 @@ static void doHandleDataBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, SOp
code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs,
pIndefInfo->pPseudoColInfo);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index 7b13aa8ad8fe5f33a8427d5a4d1e49e2ef1690ff..ca140718da2356f8e8c61f5bbddd011bb0576977 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -36,8 +36,8 @@
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity);
-static int32_t buildDbTableInfoBlock(const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size,
- const char* dbName);
+static int32_t buildDbTableInfoBlock(bool sysInfo, const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta,
+ size_t size, const char* dbName);
static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
@@ -178,8 +178,8 @@ static SResultRow* getTableGroupOutputBuf(SOperatorInfo* pOperator, uint64_t gro
STableScanInfo* pTableScanInfo = pOperator->info;
- SResultRowPosition* p1 = (SResultRowPosition*)taosHashGet(pTableScanInfo->pdInfo.pAggSup->pResultRowHashTable, buf,
- GET_RES_WINDOW_KEY_LEN(sizeof(groupId)));
+ SResultRowPosition* p1 = (SResultRowPosition*)tSimpleHashGet(pTableScanInfo->pdInfo.pAggSup->pResultRowHashTable, buf,
+ GET_RES_WINDOW_KEY_LEN(sizeof(groupId)));
if (p1 == NULL) {
return NULL;
@@ -250,7 +250,7 @@ static bool doLoadBlockSMA(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
int32_t code = tsdbRetrieveDatablockSMA(pTableScanInfo->dataReader, &pColAgg, &allColumnsHaveAgg);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
if (!allColumnsHaveAgg) {
@@ -264,7 +264,7 @@ static bool doLoadBlockSMA(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
if (pBlock->pBlockAgg == NULL) {
pBlock->pBlockAgg = taosMemoryCalloc(numOfCols, POINTER_BYTES);
if (pBlock->pBlockAgg == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
}
}
@@ -374,7 +374,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pBlock,
GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
@@ -495,7 +495,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
while (tsdbNextDataBlock(pTableScanInfo->dataReader)) {
if (isTaskKilled(pTaskInfo)) {
- longjmp(pTaskInfo->env, TSDB_CODE_TSC_QUERY_CANCELLED);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_TSC_QUERY_CANCELLED);
}
// process this data block based on the probabilities
@@ -523,7 +523,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
int32_t code = loadDataBlock(pOperator, pTableScanInfo, pBlock, &status);
// int32_t code = loadDataBlockOnDemand(pOperator->pRuntimeEnv, pTableScanInfo, pBlock, &status);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pOperator->pTaskInfo->env, code);
+ T_LONG_JMP(pOperator->pTaskInfo->env, code);
}
// current block is filter out according to filter condition, continue load the next block
@@ -649,7 +649,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
int32_t code = tsdbReaderOpen(pInfo->readHandle.vnode, &pInfo->cond, tableList, (STsdbReader**)&pInfo->dataReader,
GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
return NULL;
}
}
@@ -689,7 +689,7 @@ static int32_t getTableScannerExecInfo(struct SOperatorInfo* pOptr, void** pOptr
return 0;
}
-static void destroyTableScanOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyTableScanOperatorInfo(void* param) {
STableScanInfo* pTableScanInfo = (STableScanInfo*)param;
blockDataDestroy(pTableScanInfo->pResBlock);
cleanupQueryTableDataCond(&pTableScanInfo->cond);
@@ -837,7 +837,7 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) {
int32_t code = doGetTableRowSize(pBlockScanInfo->readHandle.meta, pBlockScanInfo->uid, &blockDistInfo.rowSize,
GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
tsdbGetFileBlocksDistInfo(pBlockScanInfo->pHandle, &blockDistInfo);
@@ -863,7 +863,7 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) {
return pBlock;
}
-static void destroyBlockDistScanOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyBlockDistScanOperatorInfo(void* param) {
SBlockDistInfo* pDistInfo = (SBlockDistInfo*)param;
blockDataDestroy(pDistInfo->pResBlock);
tsdbReaderClose(pDistInfo->pHandle);
@@ -1086,7 +1086,10 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr
SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX);
SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX);
+ SColumnInfoData* pDestUidCol = taosArrayGet(pDestBlock->pDataBlock, UID_COLUMN_INDEX);
SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
+ SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
int32_t dummy = 0;
for (int32_t i = 0; i < pSrcBlock->info.rows; i++) {
uint64_t groupId = getGroupId(pInfo->pTableScanOp, uidCol[i]);
@@ -1100,9 +1103,13 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr
SResultWindowInfo* pEndWin =
getCurSessionWindow(pInfo->sessionSup.pStreamAggSup, endData[i], endData[i], groupId, 0, &dummy);
ASSERT(pEndWin);
+ TSKEY ts = INT64_MIN;
colDataAppend(pDestStartCol, i, (const char*)&pStartWin->win.skey, false);
colDataAppend(pDestEndCol, i, (const char*)&pEndWin->win.ekey, false);
+ colDataAppendNULL(pDestUidCol, i);
colDataAppend(pDestGpCol, i, (const char*)&groupId, false);
+ colDataAppendNULL(pDestCalStartTsCol, i);
+ colDataAppendNULL(pDestCalEndTsCol, i);
pDestBlock->info.rows++;
}
return TSDB_CODE_SUCCESS;
@@ -1157,13 +1164,13 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock,
return code;
}
-void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid) {
+void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, int32_t uidCol, uint64_t* pID) {
SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
- SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX);
+ SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, uidCol);
colDataAppend(pStartTsCol, pBlock->info.rows, (const char*)pStartTs, false);
colDataAppend(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false);
- colDataAppend(pUidCol, pBlock->info.rows, (const char*)pUid, false);
+ colDataAppend(pUidCol, pBlock->info.rows, (const char*)pID, false);
pBlock->info.rows++;
}
@@ -1190,7 +1197,7 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
bool closedWin = isClosed && isSignleIntervalWindow(pInfo) &&
isDeletedWindow(&win, pBlock->info.groupId, pInfo->sessionSup.pIntervalAggSup);
if ((update || closedWin) && out) {
- appendOneRow(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.uid);
+ appendOneRow(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, UID_COLUMN_INDEX, &pBlock->info.uid);
}
}
if (out) {
@@ -1259,7 +1266,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
blockDataFreeRes((SSDataBlock*)pBlock);
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
@@ -1274,6 +1281,42 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SStreamScanInfo* pInfo = pOperator->info;
+#if 0
+ SStreamState* pState = pTaskInfo->streamInfo.pState;
+ if (pState) {
+ printf(">>>>>>>> stream write backend\n");
+ SWinKey key = {
+ .ts = 1,
+ .groupId = 2,
+ };
+ char tmp[100] = "abcdefg1";
+ if (streamStatePut(pState, &key, &tmp, strlen(tmp) + 1) < 0) {
+ ASSERT(0);
+ }
+
+ key.ts = 2;
+ char tmp2[100] = "abcdefg2";
+ if (streamStatePut(pState, &key, &tmp2, strlen(tmp2) + 1) < 0) {
+ ASSERT(0);
+ }
+
+ key.groupId = 5;
+ key.ts = 1;
+ char tmp3[100] = "abcdefg3";
+ if (streamStatePut(pState, &key, &tmp3, strlen(tmp3) + 1) < 0) {
+ ASSERT(0);
+ }
+
+ char* val2 = NULL;
+ int32_t sz;
+ if (streamStateGet(pState, &key, (void**)&val2, &sz) < 0) {
+ ASSERT(0);
+ }
+ printf("stream read %s %d\n", val2, sz);
+ streamFreeVal(val2);
+ }
+#endif
+
qDebug("stream scan called");
if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__LOG) {
while (1) {
@@ -1532,11 +1575,11 @@ SOperatorInfo* createRawScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNo
return NULL;
}
-static void destroyStreamScanOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyStreamScanOperatorInfo(void* param) {
SStreamScanInfo* pStreamScan = (SStreamScanInfo*)param;
if (pStreamScan->pTableScanOp && pStreamScan->pTableScanOp->info) {
STableScanInfo* pTableScanInfo = pStreamScan->pTableScanOp->info;
- destroyTableScanOperatorInfo(pTableScanInfo, numOfOutput);
+ destroyTableScanOperatorInfo(pTableScanInfo);
taosMemoryFreeClear(pStreamScan->pTableScanOp);
}
if (pStreamScan->tqReader) {
@@ -1692,7 +1735,7 @@ _error:
return NULL;
}
-static void destroySysScanOperator(void* param, int32_t numOfOutput) {
+static void destroySysScanOperator(void* param) {
SSysTableScanInfo* pInfo = (SSysTableScanInfo*)param;
tsem_destroy(&pInfo->ready);
blockDataDestroy(pInfo->pRes);
@@ -1950,7 +1993,7 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
metaReaderClear(&smr);
metaCloseTbCursor(pInfo->pCur);
pInfo->pCur = NULL;
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
char stableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
@@ -2153,7 +2196,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
metaReaderClear(&mr);
metaCloseTbCursor(pInfo->pCur);
pInfo->pCur = NULL;
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
// number of columns
@@ -2385,10 +2428,10 @@ int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity) {
const SSysTableMeta* pSysDbTableMeta = NULL;
getInfosDbMeta(&pSysDbTableMeta, &size);
- p->info.rows = buildDbTableInfoBlock(p, pSysDbTableMeta, size, TSDB_INFORMATION_SCHEMA_DB);
+ p->info.rows = buildDbTableInfoBlock(pInfo->sysInfo, p, pSysDbTableMeta, size, TSDB_INFORMATION_SCHEMA_DB);
getPerfDbMeta(&pSysDbTableMeta, &size);
- p->info.rows = buildDbTableInfoBlock(p, pSysDbTableMeta, size, TSDB_PERFORMANCE_SCHEMA_DB);
+ p->info.rows = buildDbTableInfoBlock(pInfo->sysInfo, p, pSysDbTableMeta, size, TSDB_PERFORMANCE_SCHEMA_DB);
pInfo->pRes->info.rows = p->info.rows;
relocateColumnData(pInfo->pRes, pInfo->scanCols, p->pDataBlock, false);
@@ -2397,13 +2440,16 @@ int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity) {
return pInfo->pRes->info.rows;
}
-int32_t buildDbTableInfoBlock(const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size,
+int32_t buildDbTableInfoBlock(bool sysInfo, const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size,
const char* dbName) {
char n[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
int32_t numOfRows = p->info.rows;
for (int32_t i = 0; i < size; ++i) {
const SSysTableMeta* pm = &pSysDbTableMeta[i];
+ if (!sysInfo && pm->sysInfo) {
+ continue;
+ }
SColumnInfoData* pColInfoData = taosArrayGet(p->pDataBlock, 0);
@@ -2457,6 +2503,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
pInfo->accountId = pScanPhyNode->accountId;
pInfo->pUser = taosMemoryStrDup((void*)pUser);
+ pInfo->sysInfo = pScanPhyNode->sysInfo;
pInfo->showRewrite = pScanPhyNode->showRewrite;
pInfo->pRes = pResBlock;
pInfo->pCondition = pScanNode->node.pConditions;
@@ -2527,7 +2574,7 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", item->uid, tstrerror(terrno),
GET_TASKID(pTaskInfo));
metaReaderClear(&mr);
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
for (int32_t j = 0; j < pOperator->exprSupp.numOfExprs; ++j) {
@@ -2577,12 +2624,10 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
return (pRes->info.rows == 0) ? NULL : pInfo->pRes;
}
-static void destroyTagScanOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyTagScanOperatorInfo(void* param) {
STagScanInfo* pInfo = (STagScanInfo*)param;
pInfo->pRes = blockDataDestroy(pInfo->pRes);
-
taosArrayDestroy(pInfo->pColMatchInfo);
-
taosMemoryFreeClear(param);
}
@@ -2642,6 +2687,7 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanNode, pTagCond, pTagIndexCond, pTableListInfo);
if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to getTableList, code: %s", tstrerror(code));
return code;
}
@@ -2777,7 +2823,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pTableScanInfo->pseudoSup.pExprInfo,
pTableScanInfo->pseudoSup.numOfExprs, pBlock, GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
@@ -2820,7 +2866,7 @@ static SSDataBlock* getTableDataBlock(void* param) {
STsdbReader* reader = taosArrayGetP(pTableScanInfo->dataReaders, readerIdx);
while (tsdbNextDataBlock(reader)) {
if (isTaskKilled(pOperator->pTaskInfo)) {
- longjmp(pOperator->pTaskInfo->env, TSDB_CODE_TSC_QUERY_CANCELLED);
+ T_LONG_JMP(pOperator->pTaskInfo->env, TSDB_CODE_TSC_QUERY_CANCELLED);
}
// process this data block based on the probabilities
@@ -2843,7 +2889,7 @@ static SSDataBlock* getTableDataBlock(void* param) {
int32_t code = loadDataBlockFromOneTable(pOperator, pTableScanInfo, readerIdx, pBlock, &status);
// int32_t code = loadDataBlockOnDemand(pOperator->pRuntimeEnv, pTableScanInfo, pBlock, &status);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pOperator->pTaskInfo->env, code);
+ T_LONG_JMP(pOperator->pTaskInfo->env, code);
}
// current block is filter out according to filter condition, continue load the next block
@@ -2936,7 +2982,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
int32_t code = tsortOpen(pInfo->pSortHandle);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
return TSDB_CODE_SUCCESS;
@@ -3006,7 +3052,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
int32_t code = pOperator->fpSet._openFn(pOperator);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
size_t tableListSize = taosArrayGetSize(pInfo->tableListInfo->pTableList);
if (!pInfo->hasGroupId) {
@@ -3044,7 +3090,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
return pBlock;
}
-void destroyTableMergeScanOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyTableMergeScanOperatorInfo(void* param) {
STableMergeScanInfo* pTableScanInfo = (STableMergeScanInfo*)param;
cleanupQueryTableDataCond(&pTableScanInfo->cond);
taosArrayDestroy(pTableScanInfo->sortSourceParams);
diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c
index 4dd5e4ec15e9521b6c2cdc39562313592242773c..e2014ec97320c863a6857e94c538bd8d8319c2a1 100644
--- a/source/libs/executor/src/sortoperator.c
+++ b/source/libs/executor/src/sortoperator.c
@@ -20,7 +20,7 @@ static SSDataBlock* doSort(SOperatorInfo* pOperator);
static int32_t doOpenSortOperator(SOperatorInfo* pOperator);
static int32_t getExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len);
-static void destroyOrderOperatorInfo(void* param, int32_t numOfOutput);
+static void destroyOrderOperatorInfo(void* param);
// todo add limit/offset impl
SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortNode, SExecTaskInfo* pTaskInfo) {
@@ -156,7 +156,7 @@ void applyScalarFunction(SSDataBlock* pBlock, void* param) {
int32_t code = projectApplyFunctions(pOperator->exprSupp.pExprInfo, pBlock, pBlock, pOperator->exprSupp.pCtx,
pOperator->exprSupp.numOfExprs, NULL);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pOperator->pTaskInfo->env, code);
+ T_LONG_JMP(pOperator->pTaskInfo->env, code);
}
}
}
@@ -184,7 +184,7 @@ int32_t doOpenSortOperator(SOperatorInfo* pOperator) {
taosMemoryFreeClear(ps);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
pOperator->cost.openCost = (taosGetTimestampUs() - pInfo->startTs) / 1000.0;
@@ -204,7 +204,7 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
int32_t code = pOperator->fpSet._openFn(pOperator);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
SSDataBlock* pBlock = NULL;
@@ -250,7 +250,7 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
return blockDataGetNumOfRows(pBlock) > 0 ? pBlock : NULL;
}
-void destroyOrderOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyOrderOperatorInfo(void* param) {
SSortOperatorInfo* pInfo = (SSortOperatorInfo*)param;
pInfo->binfo.pRes = blockDataDestroy(pInfo->binfo.pRes);
@@ -388,7 +388,7 @@ int32_t beginSortGroup(SOperatorInfo* pOperator) {
taosMemoryFreeClear(ps);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
return TSDB_CODE_SUCCESS;
@@ -420,7 +420,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
int32_t code = pOperator->fpSet._openFn(pOperator);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
if (!pInfo->hasGroupId) {
@@ -468,7 +468,7 @@ int32_t getGroupSortExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, u
return TSDB_CODE_SUCCESS;
}
-void destroyGroupSortOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyGroupSortOperatorInfo(void* param) {
SGroupSortOperatorInfo* pInfo = (SGroupSortOperatorInfo*)param;
pInfo->binfo.pRes = blockDataDestroy(pInfo->binfo.pRes);
@@ -575,7 +575,7 @@ int32_t doOpenMultiwayMergeOperator(SOperatorInfo* pOperator) {
int32_t code = tsortOpen(pInfo->pSortHandle);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, terrno);
+ T_LONG_JMP(pTaskInfo->env, terrno);
}
pOperator->cost.openCost = (taosGetTimestampUs() - pInfo->startTs) / 1000.0;
@@ -672,7 +672,7 @@ SSDataBlock* doMultiwayMerge(SOperatorInfo* pOperator) {
int32_t code = pOperator->fpSet._openFn(pOperator);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
SSDataBlock* pBlock = getMultiwaySortedBlockData(pInfo->pSortHandle, pInfo->binfo.pRes,
@@ -685,7 +685,7 @@ SSDataBlock* doMultiwayMerge(SOperatorInfo* pOperator) {
return pBlock;
}
-void destroyMultiwayMergeOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyMultiwayMergeOperatorInfo(void* param) {
SMultiwayMergeOperatorInfo* pInfo = (SMultiwayMergeOperatorInfo*)param;
pInfo->binfo.pRes = blockDataDestroy(pInfo->binfo.pRes);
pInfo->pInputBlock = blockDataDestroy(pInfo->pInputBlock);
diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c
index 59dd58070d1b96fa5003c0162957d6e8adedb061..f23552c5a7b82207ffc368dbae7c1894cb6a8edd 100644
--- a/source/libs/executor/src/tfill.c
+++ b/source/libs/executor/src/tfill.c
@@ -36,6 +36,7 @@
#define GET_DEST_SLOT_ID(_p) ((_p)->pExpr->base.resSchema.slotId)
static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey);
+static bool fillIfWindowPseudoColumn(SFillInfo* pFillInfo, SFillColInfo* pCol, SColumnInfoData* pDstColInfoData, int32_t rowIndex);
static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowIndex) {
for(int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
@@ -43,9 +44,8 @@ static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowInd
int32_t dstSlotId = GET_DEST_SLOT_ID(pCol);
SColumnInfoData* pDstColInfo = taosArrayGet(pBlock->pDataBlock, dstSlotId);
if (pCol->notFillCol) {
- if (pDstColInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
- colDataAppend(pDstColInfo, rowIndex, (const char*)&pFillInfo->currentKey, false);
- } else {
+ bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfo, rowIndex);
+ if (!filled) {
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
SGroupKeys* pKey = taosArrayGet(p, i);
doSetVal(pDstColInfo, rowIndex, pKey);
@@ -76,6 +76,35 @@ static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32
}
}
+//fill windows pseudo column, _wstart, _wend, _wduration and return true, otherwise return false
+static bool fillIfWindowPseudoColumn(SFillInfo* pFillInfo, SFillColInfo* pCol, SColumnInfoData* pDstColInfoData, int32_t rowIndex) {
+ if (!pCol->notFillCol) {
+ return false;
+ }
+ if (pCol->pExpr->pExpr->nodeType == QUERY_NODE_COLUMN) {
+ if (pCol->pExpr->base.numOfParams != 1) {
+ return false;
+ }
+ if (pCol->pExpr->base.pParam[0].pCol->colType == COLUMN_TYPE_WINDOW_START) {
+ colDataAppend(pDstColInfoData, rowIndex, (const char*)&pFillInfo->currentKey, false);
+ return true;
+ } else if (pCol->pExpr->base.pParam[0].pCol->colType == COLUMN_TYPE_WINDOW_END) {
+ //TODO: include endpoint
+ SInterval* pInterval = &pFillInfo->interval;
+ int32_t step = (pFillInfo->order == TSDB_ORDER_ASC) ? 1 : -1;
+ int64_t windowEnd =
+ taosTimeAdd(pFillInfo->currentKey, pInterval->sliding * step, pInterval->slidingUnit, pInterval->precision);
+ colDataAppend(pDstColInfoData, rowIndex, (const char*)&windowEnd, false);
+ return true;
+ } else if (pCol->pExpr->base.pParam[0].pCol->colType == COLUMN_TYPE_WINDOW_DURATION) {
+ //TODO: include endpoint
+ colDataAppend(pDstColInfoData, rowIndex, (const char*)&pFillInfo->interval.sliding, false);
+ return true;
+ }
+ }
+ return false;
+}
+
static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* pSrcBlock, int64_t ts,
bool outOfBound) {
SPoint point1, point2, point;
@@ -92,10 +121,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol));
-
- if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
- colDataAppend(pDstColInfoData, index, (const char*)&pFillInfo->currentKey, false);
- } else {
+ bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index);
+ if (!filled) {
SGroupKeys* pKey = taosArrayGet(p, i);
doSetVal(pDstColInfoData, index, pKey);
}
@@ -106,10 +133,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol));
-
- if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
- colDataAppend(pDstColInfoData, index, (const char*)&pFillInfo->currentKey, false);
- } else {
+ bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index);
+ if (!filled) {
SGroupKeys* pKey = taosArrayGet(p, i);
doSetVal(pDstColInfoData, index, pKey);
}
@@ -127,9 +152,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
int16_t type = pDstCol->info.type;
if (pCol->notFillCol) {
- if (type == TSDB_DATA_TYPE_TIMESTAMP) {
- colDataAppend(pDstCol, index, (const char*)&pFillInfo->currentKey, false);
- } else {
+ bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstCol, index);
+ if (!filled) {
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
SGroupKeys* pKey = taosArrayGet(p, i);
doSetVal(pDstCol, index, pKey);
@@ -170,9 +194,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, slotId);
if (pCol->notFillCol) {
- if (pDst->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
- colDataAppend(pDst, index, (const char*)&pFillInfo->currentKey, false);
- } else {
+ bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDst, index);
+ if (!filled) {
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
SGroupKeys* pKey = taosArrayGet(p, i);
doSetVal(pDst, index, pKey);
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index 0594a727fcaaf8f41a55703e64d7247a2dca6d15..b97970aeefe6a6db97ba024817cb7268dea9b429 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -15,6 +15,7 @@
#include "executorimpl.h"
#include "function.h"
#include "functionMgt.h"
+#include "tcommon.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "tfill.h"
@@ -27,21 +28,21 @@ typedef enum SResultTsInterpType {
#define IS_FINAL_OP(op) ((op)->isFinal)
-typedef struct SWinRes {
- TSKEY ts;
- uint64_t groupId;
-} SWinRes;
-
typedef struct SPullWindowInfo {
STimeWindow window;
uint64_t groupId;
} SPullWindowInfo;
+typedef struct SOpenWindowInfo {
+ SResultRowPosition pos;
+ uint64_t groupId;
+} SOpenWindowInfo;
+
static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator);
static int64_t* extractTsCol(SSDataBlock* pBlock, const SIntervalAggOperatorInfo* pInfo);
-static SResultRowPosition addToOpenWindowList(SResultRowInfo* pResultRowInfo, const SResultRow* pResult);
+static SResultRowPosition addToOpenWindowList(SResultRowInfo* pResultRowInfo, const SResultRow* pResult, uint64_t groupId);
static void doCloseWindow(SResultRowInfo* pResultRowInfo, const SIntervalAggOperatorInfo* pInfo, SResultRow* pResult);
///*
@@ -602,14 +603,14 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
int32_t startPos = 0;
int32_t numOfOutput = pSup->numOfExprs;
- uint64_t groupId = pBlock->info.groupId;
SResultRow* pResult = NULL;
while (1) {
SListNode* pn = tdListGetHead(pResultRowInfo->openWindow);
-
- SResultRowPosition* p1 = (SResultRowPosition*)pn->data;
+ SOpenWindowInfo* pOpenWin = (SOpenWindowInfo *)pn->data;
+ uint64_t groupId = pOpenWin->groupId;
+ SResultRowPosition* p1 = &pOpenWin->pos;
if (p->pageId == p1->pageId && p->offset == p1->offset) {
break;
}
@@ -628,20 +629,24 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
int32_t ret = setTimeWindowOutputBuf(pResultRowInfo, &w, (scanFlag == MAIN_SCAN), &pResult, groupId, pSup->pCtx,
numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
ASSERT(!isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP));
SGroupKeys* pTsKey = taosArrayGet(pInfo->pPrevValues, 0);
int64_t prevTs = *(int64_t*)pTsKey->pData;
- doTimeWindowInterpolation(pInfo->pPrevValues, pBlock->pDataBlock, prevTs, -1, tsCols[startPos], startPos, w.ekey,
- RESULT_ROW_END_INTERP, pSup);
+ if (groupId == pBlock->info.groupId) {
+ doTimeWindowInterpolation(pInfo->pPrevValues, pBlock->pDataBlock, prevTs, -1, tsCols[startPos], startPos, w.ekey,
+ RESULT_ROW_END_INTERP, pSup);
+ }
setResultRowInterpo(pResult, RESULT_ROW_END_INTERP);
setNotInterpoWindowKey(pSup->pCtx, numOfExprs, RESULT_ROW_START_INTERP);
- doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, 0, pBlock->info.rows, numOfExprs);
+ updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &w, true);
+ doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, 0, pBlock->info.rows,
+ numOfExprs);
if (isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)) {
closeResultRow(pr);
@@ -812,7 +817,7 @@ static int32_t savePullWindow(SPullWindowInfo* pPullInfo, SArray* pPullWins) {
int32_t compareResKey(void* pKey, void* data, int32_t index) {
SArray* res = (SArray*)data;
SResKeyPos* pos = taosArrayGetP(res, index);
- SWinRes* pData = (SWinRes*)pKey;
+ SWinKey* pData = (SWinKey*)pKey;
if (pData->ts == *(int64_t*)pos->key) {
if (pData->groupId > pos->groupId) {
return 1;
@@ -828,7 +833,7 @@ int32_t compareResKey(void* pKey, void* data, int32_t index) {
static int32_t saveResult(int64_t ts, int32_t pageId, int32_t offset, uint64_t groupId, SArray* pUpdated) {
int32_t size = taosArrayGetSize(pUpdated);
- SWinRes data = {.ts = ts, .groupId = groupId};
+ SWinKey data = {.ts = ts, .groupId = groupId};
int32_t index = binarySearchCom(pUpdated, size, &data, TSDB_ORDER_DESC, compareResKey);
if (index == -1) {
index = 0;
@@ -861,8 +866,8 @@ static int32_t saveWinResult(int64_t ts, int32_t pageId, int32_t offset, uint64_
newPos->groupId = groupId;
newPos->pos = (SResultRowPosition){.pageId = pageId, .offset = offset};
*(int64_t*)newPos->key = ts;
- SWinRes key = {.ts = ts, .groupId = groupId};
- if (taosHashPut(pUpdatedMap, &key, sizeof(SWinRes), &newPos, sizeof(void*)) != TSDB_CODE_SUCCESS) {
+ SWinKey key = {.ts = ts, .groupId = groupId};
+ if (taosHashPut(pUpdatedMap, &key, sizeof(SWinKey), &newPos, sizeof(void*)) != TSDB_CODE_SUCCESS) {
taosMemoryFree(newPos);
}
return TSDB_CODE_SUCCESS;
@@ -879,20 +884,20 @@ static int32_t saveResultRow(SResultRow* result, uint64_t groupId, SArray* pUpda
static void removeResults(SArray* pWins, SHashObj* pUpdatedMap) {
int32_t size = taosArrayGetSize(pWins);
for (int32_t i = 0; i < size; i++) {
- SWinRes* pW = taosArrayGet(pWins, i);
- taosHashRemove(pUpdatedMap, pW, sizeof(SWinRes));
+ SWinKey* pW = taosArrayGet(pWins, i);
+ taosHashRemove(pUpdatedMap, pW, sizeof(SWinKey));
}
}
int64_t getWinReskey(void* data, int32_t index) {
SArray* res = (SArray*)data;
- SWinRes* pos = taosArrayGet(res, index);
+ SWinKey* pos = taosArrayGet(res, index);
return pos->ts;
}
int32_t compareWinRes(void* pKey, void* data, int32_t index) {
SArray* res = (SArray*)data;
- SWinRes* pos = taosArrayGetP(res, index);
+ SWinKey* pos = taosArrayGetP(res, index);
SResKeyPos* pData = (SResKeyPos*)pKey;
if (*(int64_t*)pData->key == pos->ts) {
if (pData->groupId > pos->groupId) {
@@ -952,7 +957,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pSup->pCtx,
numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM && pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) {
@@ -968,14 +973,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
// prev time window not interpolation yet.
if (pInfo->timeWindowInterpo) {
- SResultRowPosition pos = addToOpenWindowList(pResultRowInfo, pResult);
+ SResultRowPosition pos = addToOpenWindowList(pResultRowInfo, pResult, tableGroupId);
doInterpUnclosedTimeWindow(pOperatorInfo, numOfOutput, pResultRowInfo, pBlock, scanFlag, tsCols, &pos);
// restore current time window
ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pSup->pCtx,
numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
// window start key interpolation
@@ -985,8 +990,8 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
if ((!pInfo->ignoreExpiredData || !isCloseWindow(&win, &pInfo->twAggSup)) &&
inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) {
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &win, true);
- doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, forwardRows,
- pBlock->info.rows, numOfOutput);
+ doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, pBlock->info.rows,
+ numOfOutput);
}
doCloseWindow(pResultRowInfo, pInfo, pResult);
@@ -1009,7 +1014,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
int32_t code = setTimeWindowOutputBuf(pResultRowInfo, &nextWin, (scanFlag == MAIN_SCAN), &pResult, tableGroupId,
pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM && pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) {
@@ -1020,13 +1025,21 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
ekey = ascScan ? nextWin.ekey : nextWin.skey;
forwardRows =
getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder);
-
// window start(end) key interpolation
doWindowBorderInterpolation(pInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pSup);
-
+ //TODO: add to open window? how to close the open windows after input blocks exhausted?
+#if 0
+ if ((ascScan && ekey <= pBlock->info.window.ekey) ||
+ (!ascScan && ekey >= pBlock->info.window.skey)) {
+ // window start(end) key interpolation
+ doWindowBorderInterpolation(pInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pSup);
+ } else if (pInfo->timeWindowInterpo) {
+ addToOpenWindowList(pResultRowInfo, pResult, tableGroupId);
+ }
+#endif
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &nextWin, true);
- doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, forwardRows,
- pBlock->info.rows, numOfOutput);
+ doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, pBlock->info.rows,
+ numOfOutput);
doCloseWindow(pResultRowInfo, pInfo, pResult);
}
@@ -1043,20 +1056,23 @@ void doCloseWindow(SResultRowInfo* pResultRowInfo, const SIntervalAggOperatorInf
}
}
-SResultRowPosition addToOpenWindowList(SResultRowInfo* pResultRowInfo, const SResultRow* pResult) {
- SResultRowPosition pos = (SResultRowPosition){.pageId = pResult->pageId, .offset = pResult->offset};
+SResultRowPosition addToOpenWindowList(SResultRowInfo* pResultRowInfo, const SResultRow* pResult, uint64_t groupId) {
+ SOpenWindowInfo openWin = {0};
+ openWin.pos.pageId = pResult->pageId;
+ openWin.pos.offset = pResult->offset;
+ openWin.groupId = groupId;
SListNode* pn = tdListGetTail(pResultRowInfo->openWindow);
if (pn == NULL) {
- tdListAppend(pResultRowInfo->openWindow, &pos);
- return pos;
+ tdListAppend(pResultRowInfo->openWindow, &openWin);
+ return openWin.pos;
}
- SResultRowPosition* px = (SResultRowPosition*)pn->data;
- if (px->pageId != pos.pageId || px->offset != pos.offset) {
- tdListAppend(pResultRowInfo->openWindow, &pos);
+ SOpenWindowInfo * px = (SOpenWindowInfo *)pn->data;
+ if (px->pos.pageId != openWin.pos.pageId || px->pos.offset != openWin.pos.offset || px->groupId != openWin.groupId) {
+ tdListAppend(pResultRowInfo->openWindow, &openWin);
}
- return pos;
+ return openWin.pos;
}
int64_t* extractTsCol(SSDataBlock* pBlock, const SIntervalAggOperatorInfo* pInfo) {
@@ -1185,7 +1201,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
int32_t ret = setTimeWindowOutputBuf(&pInfo->binfo.resultRowInfo, &window, masterScan, &pResult, gid, pSup->pCtx,
numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
}
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &window, false);
@@ -1210,12 +1226,12 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
int32_t ret = setTimeWindowOutputBuf(&pInfo->binfo.resultRowInfo, &pRowSup->win, masterScan, &pResult, gid,
pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
}
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pRowSup->win, false);
- doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, pRowSup->startRowIndex,
- pRowSup->numOfRows, pBlock->info.rows, numOfOutput);
+ doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, pRowSup->startRowIndex, pRowSup->numOfRows,
+ pBlock->info.rows, numOfOutput);
}
static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) {
@@ -1383,7 +1399,7 @@ bool doClearWindow(SAggSupporter* pAggSup, SExprSupp* pSup, char* pData, int16_t
int32_t numOfOutput) {
SET_RES_WINDOW_KEY(pAggSup->keyBuf, pData, bytes, groupId);
SResultRowPosition* p1 =
- (SResultRowPosition*)taosHashGet(pAggSup->pResultRowHashTable, pAggSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
+ (SResultRowPosition*)tSimpleHashGet(pAggSup->pResultRowHashTable, pAggSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
if (!p1) {
// window has been closed
return false;
@@ -1396,14 +1412,14 @@ bool doDeleteIntervalWindow(SAggSupporter* pAggSup, TSKEY ts, uint64_t groupId)
size_t bytes = sizeof(TSKEY);
SET_RES_WINDOW_KEY(pAggSup->keyBuf, &ts, bytes, groupId);
SResultRowPosition* p1 =
- (SResultRowPosition*)taosHashGet(pAggSup->pResultRowHashTable, pAggSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
+ (SResultRowPosition*)tSimpleHashGet(pAggSup->pResultRowHashTable, pAggSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
if (!p1) {
// window has been closed
return false;
}
// SFilePage* bufPage = getBufPage(pAggSup->pResultBuf, p1->pageId);
// dBufSetBufPageRecycled(pAggSup->pResultBuf, bufPage);
- taosHashRemove(pAggSup->pResultRowHashTable, pAggSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
+ tSimpleHashRemove(pAggSup->pResultRowHashTable, pAggSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
return true;
}
@@ -1418,7 +1434,7 @@ void doDeleteSpecifyIntervalWindow(SAggSupporter* pAggSup, SSDataBlock* pBlock,
STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsStarts[i], pInterval, TSDB_ORDER_ASC);
doDeleteIntervalWindow(pAggSup, win.skey, groupIds[i]);
if (pUpWins) {
- SWinRes winRes = {.ts = win.skey, .groupId = groupIds[i]};
+ SWinKey winRes = {.ts = win.skey, .groupId = groupIds[i]};
taosArrayPush(pUpWins, &winRes);
}
}
@@ -1445,7 +1461,7 @@ static void doClearWindows(SAggSupporter* pAggSup, SExprSupp* pSup1, SInterval*
uint64_t winGpId = pGpDatas ? pGpDatas[startPos] : pBlock->info.groupId;
bool res = doClearWindow(pAggSup, pSup1, (char*)&win.skey, sizeof(TSKEY), winGpId, numOfOutput);
if (pUpWins && res) {
- SWinRes winRes = {.ts = win.skey, .groupId = winGpId};
+ SWinKey winRes = {.ts = win.skey, .groupId = winGpId};
taosArrayPush(pUpWins, &winRes);
}
getNextTimeWindow(pInterval, pInterval->precision, TSDB_ORDER_ASC, &win);
@@ -1453,11 +1469,13 @@ static void doClearWindows(SAggSupporter* pAggSup, SExprSupp* pSup1, SInterval*
}
}
-static int32_t getAllIntervalWindow(SHashObj* pHashMap, SHashObj* resWins) {
- void* pIte = NULL;
- size_t keyLen = 0;
- while ((pIte = taosHashIterate(pHashMap, pIte)) != NULL) {
- void* key = taosHashGetKey(pIte, &keyLen);
+static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) {
+
+ void* pIte = NULL;
+ size_t keyLen = 0;
+ int32_t iter = 0;
+ while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) {
+ void* key = tSimpleHashGetKey(pIte, &keyLen);
uint64_t groupId = *(uint64_t*)key;
ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY)));
TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t));
@@ -1470,25 +1488,26 @@ static int32_t getAllIntervalWindow(SHashObj* pHashMap, SHashObj* resWins) {
return TSDB_CODE_SUCCESS;
}
-static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup, SInterval* pInterval,
+static int32_t closeIntervalWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pSup, SInterval* pInterval,
SHashObj* pPullDataMap, SHashObj* closeWins, SArray* pRecyPages,
SDiskbasedBuf* pDiscBuf) {
qDebug("===stream===close interval window");
- void* pIte = NULL;
- size_t keyLen = 0;
- while ((pIte = taosHashIterate(pHashMap, pIte)) != NULL) {
- void* key = taosHashGetKey(pIte, &keyLen);
+ void* pIte = NULL;
+ size_t keyLen = 0;
+ int32_t iter = 0;
+ while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) {
+ void* key = tSimpleHashGetKey(pIte, &keyLen);
uint64_t groupId = *(uint64_t*)key;
ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY)));
TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t));
STimeWindow win;
win.skey = ts;
win.ekey = taosTimeAdd(win.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1;
- SWinRes winRe = {
+ SWinKey winRe = {
.ts = win.skey,
.groupId = groupId,
};
- void* chIds = taosHashGet(pPullDataMap, &winRe, sizeof(SWinRes));
+ void* chIds = taosHashGet(pPullDataMap, &winRe, sizeof(SWinKey));
if (isCloseWindow(&win, pSup)) {
if (chIds && pPullDataMap) {
SArray* chAy = *(SArray**)chIds;
@@ -1515,7 +1534,7 @@ static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup,
}
char keyBuf[GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))];
SET_RES_WINDOW_KEY(keyBuf, &ts, sizeof(TSKEY), groupId);
- taosHashRemove(pHashMap, keyBuf, keyLen);
+ tSimpleHashIterateRemove(pHashMap, keyBuf, keyLen, &pIte, &iter);
}
}
return TSDB_CODE_SUCCESS;
@@ -1555,7 +1574,7 @@ static void doBuildDeleteResult(SArray* pWins, int32_t* index, SSDataBlock* pBlo
SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
for (int32_t i = *index; i < size; i++) {
- SWinRes* pWin = taosArrayGet(pWins, i);
+ SWinKey* pWin = taosArrayGet(pWins, i);
colDataAppend(pTsCol, pBlock->info.rows, (const char*)&pWin->ts, false);
colDataAppend(pGroupCol, pBlock->info.rows, (const char*)&pWin->groupId, false);
pBlock->info.rows++;
@@ -1595,6 +1614,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
SArray* pUpdated = taosArrayInit(4, POINTER_BYTES); // SResKeyPos
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
+
+ SStreamState* pState = pTaskInfo->streamInfo.pState;
+
while (1) {
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
if (pBlock == NULL) {
@@ -1639,6 +1661,35 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, MAIN_SCAN, pUpdatedMap);
}
+#if 0
+ if (pState) {
+ printf(">>>>>>>> stream read backend\n");
+ SWinKey key = {
+ .ts = 1,
+ .groupId = 2,
+ };
+ char* val = NULL;
+ int32_t sz;
+ if (streamStateGet(pState, &key, (void**)&val, &sz) < 0) {
+ ASSERT(0);
+ }
+ printf("stream read %s %d\n", val, sz);
+ streamFreeVal(val);
+
+ SStreamStateCur* pCur = streamStateGetCur(pState, &key);
+ ASSERT(pCur);
+ while (streamStateCurNext(pState, pCur) == 0) {
+ SWinKey key1;
+ const void* val1;
+ if (streamStateGetKVByCur(pCur, &key1, &val1, &sz) < 0) {
+ break;
+ }
+ printf("stream iter key groupId:%d ts:%d, value %s %d\n", key1.groupId, key1.ts, val1, sz);
+ }
+ streamStateFreeCur(pCur);
+ }
+#endif
+
pOperator->status = OP_RES_TO_RETURN;
closeIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pUpdatedMap,
pInfo->pRecycledPages, pInfo->aggSup.pResultBuf);
@@ -1664,7 +1715,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes;
}
-static void destroyStateWindowOperatorInfo(void* param, int32_t numOfOutput) {
+static void destroyStateWindowOperatorInfo(void* param) {
SStateWindowOperatorInfo* pInfo = (SStateWindowOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
taosMemoryFreeClear(pInfo->stateKey.pData);
@@ -1677,7 +1728,7 @@ static void freeItem(void* param) {
taosMemoryFree(pKey->pData);
}
-void destroyIntervalOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyIntervalOperatorInfo(void* param) {
SIntervalAggOperatorInfo* pInfo = (SIntervalAggOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
cleanupAggSup(&pInfo->aggSup);
@@ -1694,7 +1745,7 @@ void destroyIntervalOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear(param);
}
-void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyStreamFinalIntervalOperatorInfo(void* param) {
SStreamFinalIntervalOperatorInfo* pInfo = (SStreamFinalIntervalOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
cleanupAggSup(&pInfo->aggSup);
@@ -1711,7 +1762,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) {
int32_t size = taosArrayGetSize(pInfo->pChildren);
for (int32_t i = 0; i < size; i++) {
SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, i);
- destroyStreamFinalIntervalOperatorInfo(pChildOp->info, numOfOutput);
+ destroyStreamFinalIntervalOperatorInfo(pChildOp->info);
taosMemoryFree(pChildOp->pDownstream);
cleanupExprSupp(&pChildOp->exprSupp);
taosMemoryFreeClear(pChildOp);
@@ -1779,7 +1830,7 @@ static bool timeWindowinterpNeeded(SqlFunctionCtx* pCtx, int32_t numOfCols, SInt
void increaseTs(SqlFunctionCtx* pCtx) {
if (pCtx[0].pExpr->pExpr->_function.pFunctNode->funcType == FUNCTION_TYPE_WSTART) {
- pCtx[0].increase = true;
+// pCtx[0].increase = true;
}
}
@@ -1836,6 +1887,10 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
initResultSizeInfo(&pOperator->resultInfo, 4096);
int32_t code = initAggInfo(pSup, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
initBasicInfo(&pInfo->binfo, pResBlock);
if (isStream) {
@@ -1851,13 +1906,14 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
pInfo->timeWindowInterpo = timeWindowinterpNeeded(pSup->pCtx, numOfCols, pInfo);
if (pInfo->timeWindowInterpo) {
- pInfo->binfo.resultRowInfo.openWindow = tdListNew(sizeof(SResultRowPosition));
+ pInfo->binfo.resultRowInfo.openWindow = tdListNew(sizeof(SOpenWindowInfo));
if (pInfo->binfo.resultRowInfo.openWindow == NULL) {
goto _error;
}
}
+
pInfo->pRecycledPages = taosArrayInit(4, sizeof(int32_t));
- pInfo->pDelWins = taosArrayInit(4, sizeof(SWinRes));
+ pInfo->pDelWins = taosArrayInit(4, sizeof(SWinKey));
pInfo->delIndex = 0;
pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT);
initResultRowInfo(&pInfo->binfo.resultRowInfo);
@@ -1866,8 +1922,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL;
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->info = pInfo;
pOperator->fpSet = createOperatorFpSet(doOpenIntervalAgg, doBuildIntervalResult, doStreamIntervalAgg, NULL,
@@ -1885,7 +1939,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
return pOperator;
_error:
- destroyIntervalOperatorInfo(pInfo, numOfCols);
+ destroyIntervalOperatorInfo(pInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = code;
return NULL;
@@ -1918,8 +1972,8 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSessionAggOperator
if (gid != pRowSup->groupId || pInfo->winSup.prevTs == INT64_MIN) {
doKeepNewWindowStartInfo(pRowSup, tsList, j, gid);
doKeepTuple(pRowSup, tsList[j], gid);
- } else if ((tsList[j] - pRowSup->prevTs >= 0) && tsList[j] - pRowSup->prevTs <= gap ||
- (pRowSup->prevTs - tsList[j] >= 0) && (pRowSup->prevTs - tsList[j] <= gap)) {
+ } else if (((tsList[j] - pRowSup->prevTs >= 0) && (tsList[j] - pRowSup->prevTs <= gap)) ||
+ ((pRowSup->prevTs - tsList[j] >= 0) && (pRowSup->prevTs - tsList[j] <= gap))) {
// The gap is less than the threshold, so it belongs to current session window that has been opened already.
doKeepTuple(pRowSup, tsList[j], gid);
if (j == 0 && pRowSup->startRowIndex != 0) {
@@ -1935,7 +1989,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSessionAggOperator
int32_t ret = setTimeWindowOutputBuf(&pInfo->binfo.resultRowInfo, &window, masterScan, &pResult, gid, pSup->pCtx,
numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
}
// pInfo->numOfRows data belong to the current session window
@@ -1954,12 +2008,12 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSessionAggOperator
int32_t ret = setTimeWindowOutputBuf(&pInfo->binfo.resultRowInfo, &pRowSup->win, masterScan, &pResult, gid,
pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
}
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pRowSup->win, false);
- doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, pRowSup->startRowIndex,
- pRowSup->numOfRows, pBlock->info.rows, numOfOutput);
+ doApplyFunctions(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, pRowSup->startRowIndex, pRowSup->numOfRows,
+ pBlock->info.rows, numOfOutput);
}
static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
@@ -2112,6 +2166,7 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
// todo set the correct primary timestamp column
// output the result
+ bool hasInterp = true;
for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) {
SExprInfo* pExprInfo = &pExprSup->pExprInfo[j];
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
@@ -2123,7 +2178,6 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
switch (pSliceInfo->fillType) {
case TSDB_FILL_NULL: {
colDataAppendNULL(pDst, rows);
- pResBlock->info.rows += 1;
break;
}
@@ -2143,7 +2197,6 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i);
colDataAppend(pDst, rows, (char*)&v, false);
}
- pResBlock->info.rows += 1;
break;
}
@@ -2157,6 +2210,7 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
// before interp range, do not fill
if (start.key == INT64_MIN || end.key == INT64_MAX) {
+ hasInterp = false;
break;
}
@@ -2168,28 +2222,27 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
taosMemoryFree(current.val);
- pResBlock->info.rows += 1;
break;
}
case TSDB_FILL_PREV: {
if (!pSliceInfo->isPrevRowSet) {
+ hasInterp = false;
break;
}
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pPrevRow, srcSlot);
colDataAppend(pDst, rows, pkey->pData, false);
- pResBlock->info.rows += 1;
break;
}
case TSDB_FILL_NEXT: {
if (!pSliceInfo->isNextRowSet) {
+ hasInterp = false;
break;
}
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pNextRow, srcSlot);
colDataAppend(pDst, rows, pkey->pData, false);
- pResBlock->info.rows += 1;
break;
}
@@ -2198,6 +2251,11 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
break;
}
}
+
+ if (hasInterp) {
+ pResBlock->info.rows += 1;
+ }
+
}
static int32_t initPrevRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pBlock) {
@@ -2342,7 +2400,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
int32_t code = initKeeperInfo(pSliceInfo, pBlock);
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
// the pDataBlock are always the same one, no need to call this again
@@ -2378,6 +2436,11 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
SColumnInfoData* pSrc = taosArrayGet(pBlock->pDataBlock, srcSlot);
SColumnInfoData* pDst = taosArrayGet(pResBlock->pDataBlock, dstSlot);
+ if (colDataIsNull_s(pSrc, i)) {
+ colDataAppendNULL(pDst, pResBlock->info.rows);
+ continue;
+ }
+
char* v = colDataGetData(pSrc, i);
colDataAppend(pDst, pResBlock->info.rows, v, false);
}
@@ -2570,7 +2633,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
return pResBlock->info.rows == 0 ? NULL : pResBlock;
}
-void destroyTimeSliceOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyTimeSliceOperatorInfo(void* param) {
STimeSliceOperatorInfo* pInfo = (STimeSliceOperatorInfo*)param;
pInfo->pRes = blockDataDestroy(pInfo->pRes);
@@ -2657,20 +2720,26 @@ _error:
return NULL;
}
-SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols,
- SSDataBlock* pResBlock, STimeWindowAggSupp* pTwAggSup, int32_t tsSlotId,
- SColumn* pStateKeyCol, SNode* pCondition, SExecTaskInfo* pTaskInfo) {
+SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhysiNode* pStateNode,
+ SExecTaskInfo* pTaskInfo) {
SStateWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStateWindowOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
goto _error;
}
- pInfo->stateCol = *pStateKeyCol;
+ int32_t num = 0;
+ SExprInfo* pExprInfo = createExprInfo(pStateNode->window.pFuncs, NULL, &num);
+ SSDataBlock* pResBlock = createResDataBlock(pStateNode->window.node.pOutputDataBlockDesc);
+ int32_t tsSlotId = ((SColumnNode*)pStateNode->window.pTspk)->slotId;
+
+ SColumnNode* pColNode = (SColumnNode*)((STargetNode*)pStateNode->pStateKey)->pExpr;
+
+ pInfo->stateCol = extractColumnFromColumnNode(pColNode);
pInfo->stateKey.type = pInfo->stateCol.type;
pInfo->stateKey.bytes = pInfo->stateCol.bytes;
pInfo->stateKey.pData = taosMemoryCalloc(1, pInfo->stateCol.bytes);
- pInfo->pCondition = pCondition;
+ pInfo->pCondition = pStateNode->window.node.pConditions;
if (pInfo->stateKey.pData == NULL) {
goto _error;
}
@@ -2678,12 +2747,15 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInf
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
initResultSizeInfo(&pOperator->resultInfo, 4096);
- initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExpr, numOfCols, keyBufSize, pTaskInfo->id.str);
- initBasicInfo(&pInfo->binfo, pResBlock);
+ int32_t code = initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, num, keyBufSize, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ initBasicInfo(&pInfo->binfo, pResBlock);
initResultRowInfo(&pInfo->binfo.resultRowInfo);
- pInfo->twAggSup = *pTwAggSup;
+ pInfo->twAggSup = (STimeWindowAggSupp){.waterMark = pStateNode->window.watermark, .calTrigger = pStateNode->window.triggerType};;
initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
pInfo->tsSlotId = tsSlotId;
@@ -2691,26 +2763,33 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInf
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE;
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.pExprInfo = pExpr;
- pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->pTaskInfo = pTaskInfo;
pOperator->info = pInfo;
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStateWindowAgg, NULL, NULL,
destroyStateWindowOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL);
- int32_t code = appendDownstream(pOperator, &downstream, 1);
+ code = appendDownstream(pOperator, &downstream, 1);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
return pOperator;
_error:
- pTaskInfo->code = TSDB_CODE_SUCCESS;
+ destroyStateWindowOperatorInfo(pInfo);
+ taosMemoryFreeClear(pOperator);
+ pTaskInfo->code = code;
return NULL;
}
-void destroySWindowOperatorInfo(void* param, int32_t numOfOutput) {
+void destroySWindowOperatorInfo(void* param) {
SSessionAggOperatorInfo* pInfo = (SSessionAggOperatorInfo*)param;
- cleanupBasicInfo(&pInfo->binfo);
+ if (pInfo == NULL) {
+ return;
+ }
+ cleanupBasicInfo(&pInfo->binfo);
colDataDestroy(&pInfo->twAggSup.timeWindowData);
cleanupAggSup(&pInfo->aggSup);
@@ -2757,22 +2836,20 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionW
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION;
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->info = pInfo;
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doSessionWindowAgg, NULL, NULL,
destroySWindowOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL);
pOperator->pTaskInfo = pTaskInfo;
-
code = appendDownstream(pOperator, &downstream, 1);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
return pOperator;
_error:
- if (pInfo != NULL) {
- destroySWindowOperatorInfo(pInfo, numOfCols);
- }
-
+ destroySWindowOperatorInfo(pInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = code;
return NULL;
@@ -2790,7 +2867,7 @@ void compactFunctions(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx, int3
if (code != TSDB_CODE_SUCCESS) {
qError("%s apply functions error, code: %s", GET_TASKID(pTaskInfo), tstrerror(code));
pTaskInfo->code = code;
- longjmp(pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
}
}
@@ -2800,7 +2877,7 @@ bool hasIntervalWindow(SAggSupporter* pSup, TSKEY ts, uint64_t groupId) {
int32_t bytes = sizeof(TSKEY);
SET_RES_WINDOW_KEY(pSup->keyBuf, &ts, bytes, groupId);
SResultRowPosition* p1 =
- (SResultRowPosition*)taosHashGet(pSup->pResultRowHashTable, pSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
+ (SResultRowPosition*)tSimpleHashGet(pSup->pResultRowHashTable, pSup->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
return p1 != NULL;
}
@@ -2811,7 +2888,7 @@ static void rebuildIntervalWindow(SStreamFinalIntervalOperatorInfo* pInfo, SExpr
return;
}
for (int32_t i = 0; i < size; i++) {
- SWinRes* pWinRes = taosArrayGet(pWinArray, i);
+ SWinKey* pWinRes = taosArrayGet(pWinArray, i);
SResultRow* pCurResult = NULL;
STimeWindow ParentWin = {.skey = pWinRes->ts, .ekey = pWinRes->ts + 1};
setTimeWindowOutputBuf(&pInfo->binfo.resultRowInfo, &ParentWin, true, &pCurResult, pWinRes->groupId, pSup->pCtx,
@@ -2841,7 +2918,7 @@ static void rebuildIntervalWindow(SStreamFinalIntervalOperatorInfo* pInfo, SExpr
bool isDeletedWindow(STimeWindow* pWin, uint64_t groupId, SAggSupporter* pSup) {
SET_RES_WINDOW_KEY(pSup->keyBuf, &pWin->skey, sizeof(int64_t), groupId);
- SResultRowPosition* p1 = (SResultRowPosition*)taosHashGet(pSup->pResultRowHashTable, pSup->keyBuf,
+ SResultRowPosition* p1 = (SResultRowPosition*)tSimpleHashGet(pSup->pResultRowHashTable, pSup->keyBuf,
GET_RES_WINDOW_KEY_LEN(sizeof(int64_t)));
return p1 == NULL;
}
@@ -2854,12 +2931,12 @@ int32_t getNexWindowPos(SInterval* pInterval, SDataBlockInfo* pBlockInfo, TSKEY*
return getNextQualifiedWindow(pInterval, pNextWin, pBlockInfo, tsCols, prevEndPos, TSDB_ORDER_ASC);
}
-void addPullWindow(SHashObj* pMap, SWinRes* pWinRes, int32_t size) {
+void addPullWindow(SHashObj* pMap, SWinKey* pWinRes, int32_t size) {
SArray* childIds = taosArrayInit(8, sizeof(int32_t));
for (int32_t i = 0; i < size; i++) {
taosArrayPush(childIds, &i);
}
- taosHashPut(pMap, pWinRes, sizeof(SWinRes), &childIds, sizeof(void*));
+ taosHashPut(pMap, pWinRes, sizeof(SWinKey), &childIds, sizeof(void*));
}
static int32_t getChildIndex(SSDataBlock* pBlock) { return pBlock->info.childId; }
@@ -2906,11 +2983,11 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc
}
if (IS_FINAL_OP(pInfo) && isClosed && pInfo->pChildren) {
bool ignore = true;
- SWinRes winRes = {
+ SWinKey winRes = {
.ts = nextWin.skey,
.groupId = tableGroupId,
};
- void* chIds = taosHashGet(pInfo->pPullDataMap, &winRes, sizeof(SWinRes));
+ void* chIds = taosHashGet(pInfo->pPullDataMap, &winRes, sizeof(SWinKey));
if (isDeletedWindow(&nextWin, tableGroupId, &pInfo->aggSup) && !chIds) {
SPullWindowInfo pull = {.window = nextWin, .groupId = tableGroupId};
// add pull data request
@@ -2944,7 +3021,7 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc
int32_t code = setTimeWindowOutputBuf(pResultRowInfo, &nextWin, true, &pResult, tableGroupId, pSup->pCtx,
numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo);
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
if (IS_FINAL_OP(pInfo)) {
@@ -2970,9 +3047,8 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc
}
static void clearStreamIntervalOperator(SStreamFinalIntervalOperatorInfo* pInfo) {
- taosHashClear(pInfo->aggSup.pResultRowHashTable);
+ tSimpleHashClear(pInfo->aggSup.pResultRowHashTable);
clearDiskbasedBuf(pInfo->aggSup.pResultBuf);
- cleanupResultRowInfo(&pInfo->binfo.resultRowInfo);
initResultRowInfo(&pInfo->binfo.resultRowInfo);
}
@@ -3039,8 +3115,8 @@ void processPullOver(SSDataBlock* pBlock, SHashObj* pMap) {
uint64_t* groupIdData = (uint64_t*)pGroupCol->pData;
int32_t chId = getChildIndex(pBlock);
for (int32_t i = 0; i < pBlock->info.rows; i++) {
- SWinRes winRes = {.ts = tsData[i], .groupId = groupIdData[i]};
- void* chIds = taosHashGet(pMap, &winRes, sizeof(SWinRes));
+ SWinKey winRes = {.ts = tsData[i], .groupId = groupIdData[i]};
+ void* chIds = taosHashGet(pMap, &winRes, sizeof(SWinKey));
if (chIds) {
SArray* chArray = *(SArray**)chIds;
int32_t index = taosArraySearchIdx(chArray, &chId, compareInt32Val, TD_EQ);
@@ -3049,7 +3125,7 @@ void processPullOver(SSDataBlock* pBlock, SHashObj* pMap) {
taosArrayRemove(chArray, index);
if (taosArrayGetSize(chArray) == 0) {
// pull data is over
- taosHashRemove(pMap, &winRes, sizeof(SWinRes));
+ taosHashRemove(pMap, &winRes, sizeof(SWinKey));
}
}
}
@@ -3129,11 +3205,11 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
maxTs = TMAX(maxTs, pBlock->info.window.ekey);
maxTs = TMAX(maxTs, pBlock->info.watermark);
- if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA ||
- pBlock->info.type == STREAM_INVALID) {
+ ASSERT(pBlock->info.type != STREAM_INVERT);
+ if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) {
pInfo->binfo.pRes->info.type = pBlock->info.type;
} else if (pBlock->info.type == STREAM_CLEAR) {
- SArray* pUpWins = taosArrayInit(8, sizeof(SWinRes));
+ SArray* pUpWins = taosArrayInit(8, sizeof(SWinKey));
doClearWindows(&pInfo->aggSup, pSup, &pInfo->interval, pOperator->exprSupp.numOfExprs, pBlock, pUpWins);
if (IS_FINAL_OP(pInfo)) {
int32_t childIndex = getChildIndex(pBlock);
@@ -3171,7 +3247,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
getAllIntervalWindow(pInfo->aggSup.pResultRowHashTable, pUpdatedMap);
continue;
} else if (pBlock->info.type == STREAM_RETRIEVE && !IS_FINAL_OP(pInfo)) {
- SArray* pUpWins = taosArrayInit(8, sizeof(SWinRes));
+ SArray* pUpWins = taosArrayInit(8, sizeof(SWinKey));
doClearWindows(&pInfo->aggSup, pSup, &pInfo->interval, pOperator->exprSupp.numOfExprs, pBlock, pUpWins);
removeResults(pUpWins, pUpdatedMap);
taosArrayDestroy(pUpWins);
@@ -3197,7 +3273,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
for (int32_t i = 0; i < chIndex + 1 - size; i++) {
SOperatorInfo* pChildOp = createStreamFinalIntervalOperatorInfo(NULL, pInfo->pPhyNode, pOperator->pTaskInfo, 0);
if (!pChildOp) {
- longjmp(pOperator->pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pOperator->pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
SStreamFinalIntervalOperatorInfo* pTmpInfo = pChildOp->info;
pTmpInfo->twAggSup.calTrigger = STREAM_TRIGGER_AT_ONCE;
@@ -3336,15 +3412,17 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
int32_t code = initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
initStreamFunciton(pOperator->exprSupp.pCtx, pOperator->exprSupp.numOfExprs);
initBasicInfo(&pInfo->binfo, pResBlock);
ASSERT(numOfCols > 0);
increaseTs(pOperator->exprSupp.pCtx);
initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
- if (code != TSDB_CODE_SUCCESS) {
- goto _error;
- }
+
initResultRowInfo(&pInfo->binfo.resultRowInfo);
pInfo->pChildren = NULL;
if (numOfChild > 0) {
@@ -3386,14 +3464,12 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
pInfo->ignoreExpiredData = pIntervalPhyNode->window.igExpired;
pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT);
pInfo->delIndex = 0;
- pInfo->pDelWins = taosArrayInit(4, sizeof(SWinRes));
+ pInfo->pDelWins = taosArrayInit(4, sizeof(SWinKey));
pInfo->pRecycledPages = taosArrayInit(4, sizeof(int32_t));
pOperator->operatorType = pPhyNode->type;
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->info = pInfo;
pOperator->fpSet =
@@ -3410,7 +3486,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
return pOperator;
_error:
- destroyStreamFinalIntervalOperatorInfo(pInfo, numOfCols);
+ destroyStreamFinalIntervalOperatorInfo(pInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = code;
return NULL;
@@ -3448,7 +3524,7 @@ void destroyStateStreamAggSupporter(SStreamAggSupporter* pSup) {
blockDataDestroy(pSup->pScanBlock);
}
-void destroyStreamSessionAggOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyStreamSessionAggOperatorInfo(void* param) {
SStreamSessionAggOperatorInfo* pInfo = (SStreamSessionAggOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
destroyStreamAggSupporter(&pInfo->streamAggSup);
@@ -3458,7 +3534,7 @@ void destroyStreamSessionAggOperatorInfo(void* param, int32_t numOfOutput) {
for (int32_t i = 0; i < size; i++) {
SOperatorInfo* pChild = taosArrayGetP(pInfo->pChildren, i);
SStreamSessionAggOperatorInfo* pChInfo = pChild->info;
- destroyStreamSessionAggOperatorInfo(pChInfo, numOfOutput);
+ destroyStreamSessionAggOperatorInfo(pChInfo);
taosMemoryFreeClear(pChild);
}
}
@@ -3529,7 +3605,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
if (pSessionNode->window.pExprs != NULL) {
int32_t numOfScalar = 0;
SExprInfo* pScalarExprInfo = createExprInfo(pSessionNode->window.pExprs, NULL, &numOfScalar);
- int32_t code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar);
+ code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
@@ -3579,8 +3655,6 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION;
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->info = pInfo;
pOperator->fpSet =
createOperatorFpSet(operatorDummyOpenFn, doStreamSessionAgg, NULL, NULL, destroyStreamSessionAggOperatorInfo,
@@ -3593,7 +3667,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
_error:
if (pInfo != NULL) {
- destroyStreamSessionAggOperatorInfo(pInfo, numOfCols);
+ destroyStreamSessionAggOperatorInfo(pInfo);
}
taosMemoryFreeClear(pOperator);
@@ -3721,8 +3795,8 @@ int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pStartTs, TS
}
if (pWinInfo->win.skey > pStartTs[i]) {
if (pStDeleted && pWinInfo->isOutput) {
- SWinRes res = {.ts = pWinInfo->win.skey, .groupId = groupId};
- taosHashPut(pStDeleted, &pWinInfo->pos, sizeof(SResultRowPosition), &res, sizeof(SWinRes));
+ SWinKey res = {.ts = pWinInfo->win.skey, .groupId = groupId};
+ taosHashPut(pStDeleted, &pWinInfo->pos, sizeof(SResultRowPosition), &res, sizeof(SWinKey));
pWinInfo->isOutput = false;
}
pWinInfo->win.skey = pStartTs[i];
@@ -3742,7 +3816,7 @@ static int32_t setWindowOutputBuf(SResultWindowInfo* pWinInfo, SResultRow** pRes
// too many time window in query
int32_t size = taosArrayGetSize(pAggSup->pCurWins);
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_BATCH && size > MAX_INTERVAL_TIME_WINDOW) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
}
if (pWinInfo->pos.pageId == -1) {
@@ -3840,8 +3914,8 @@ void compactTimeWindow(SStreamSessionAggOperatorInfo* pInfo, int32_t startIndex,
compactFunctions(pSup->pCtx, pInfo->pDummyCtx, numOfOutput, pTaskInfo);
taosHashRemove(pStUpdated, &pWinInfo->pos, sizeof(SResultRowPosition));
if (pWinInfo->isOutput) {
- SWinRes res = {.ts = pWinInfo->win.skey, .groupId = groupId};
- taosHashPut(pStDeleted, &pWinInfo->pos, sizeof(SResultRowPosition), &res, sizeof(SWinRes));
+ SWinKey res = {.ts = pWinInfo->win.skey, .groupId = groupId};
+ taosHashPut(pStDeleted, &pWinInfo->pos, sizeof(SResultRowPosition), &res, sizeof(SWinKey));
pWinInfo->isOutput = false;
}
taosArrayRemove(pInfo->streamAggSup.pCurWins, i);
@@ -3894,7 +3968,7 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData
pStDeleted);
code = doOneWindowAgg(pInfo, pSDataBlock, pCurWin, &pResult, i, winRows, numOfOutput, pOperator);
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
int32_t winNum = getNumCompactWindow(pAggSup->pCurWins, winIndex, gap);
@@ -3903,10 +3977,10 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData
}
pCurWin->isClosed = false;
if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pStUpdated) {
- SWinRes value = {.ts = pCurWin->win.skey, .groupId = groupId};
- code = taosHashPut(pStUpdated, &pCurWin->pos, sizeof(SResultRowPosition), &value, sizeof(SWinRes));
+ SWinKey value = {.ts = pCurWin->win.skey, .groupId = groupId};
+ code = taosHashPut(pStUpdated, &pCurWin->pos, sizeof(SResultRowPosition), &value, sizeof(SWinKey));
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
pCurWin->isOutput = true;
}
@@ -3951,11 +4025,12 @@ static void doClearSessionWindows(SStreamAggSupporter* pAggSup, SExprSupp* pSup,
int32_t numOfOutput, int64_t gap, SArray* result) {
SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, tsIndex);
TSKEY* tsCols = (TSKEY*)pColDataInfo->pData;
+ SColumnInfoData* pGpDataInfo = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ uint64_t* gpCols = (uint64_t*)pGpDataInfo->pData;
int32_t step = 0;
for (int32_t i = 0; i < pBlock->info.rows; i += step) {
int32_t winIndex = 0;
- SResultWindowInfo* pCurWin =
- getCurSessionWindow(pAggSup, tsCols[i], INT64_MIN, pBlock->info.groupId, gap, &winIndex);
+ SResultWindowInfo* pCurWin = getCurSessionWindow(pAggSup, tsCols[i], INT64_MIN, gpCols[i], gap, &winIndex);
if (!pCurWin || pCurWin->pos.pageId == -1) {
// window has been closed.
step = 1;
@@ -3980,9 +4055,9 @@ static int32_t copyUpdateResult(SHashObj* pStUpdated, SArray* pUpdated) {
if (pos == NULL) {
return TSDB_CODE_QRY_OUT_OF_MEMORY;
}
- pos->groupId = ((SWinRes*)pData)->groupId;
+ pos->groupId = ((SWinKey*)pData)->groupId;
pos->pos = *(SResultRowPosition*)key;
- *(int64_t*)pos->key = ((SWinRes*)pData)->ts;
+ *(int64_t*)pos->key = ((SWinKey*)pData)->ts;
taosArrayPush(pUpdated, &pos);
}
taosArraySort(pUpdated, resultrowComparAsc);
@@ -3998,7 +4073,7 @@ void doBuildDeleteDataBlock(SHashObj* pStDeleted, SSDataBlock* pBlock, void** It
blockDataEnsureCapacity(pBlock, size);
size_t keyLen = 0;
while (((*Ite) = taosHashIterate(pStDeleted, *Ite)) != NULL) {
- SWinRes* res = *Ite;
+ SWinKey* res = *Ite;
SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
colDataAppend(pTsCol, pBlock->info.rows, (const char*)&res->ts, false);
SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
@@ -4129,8 +4204,8 @@ static void copyDeleteWindowInfo(SArray* pResWins, SHashObj* pStDeleted) {
int32_t size = taosArrayGetSize(pResWins);
for (int32_t i = 0; i < size; i++) {
SResultWindowInfo* pWinInfo = taosArrayGet(pResWins, i);
- SWinRes res = {.ts = pWinInfo->win.skey, .groupId = pWinInfo->groupId};
- taosHashPut(pStDeleted, &pWinInfo->pos, sizeof(SResultRowPosition), &res, sizeof(SWinRes));
+ SWinKey res = {.ts = pWinInfo->win.skey, .groupId = pWinInfo->groupId};
+ taosHashPut(pStDeleted, &pWinInfo->pos, sizeof(SResultRowPosition), &res, sizeof(SWinKey));
}
}
@@ -4168,14 +4243,14 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
if (pBlock->info.type == STREAM_CLEAR) {
SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo));
- doClearSessionWindows(&pInfo->streamAggSup, &pOperator->exprSupp, pBlock, 0, pOperator->exprSupp.numOfExprs, 0,
- pWins);
+ doClearSessionWindows(&pInfo->streamAggSup, &pOperator->exprSupp, pBlock, START_TS_COLUMN_INDEX,
+ pOperator->exprSupp.numOfExprs, 0, pWins);
if (IS_FINAL_OP(pInfo)) {
int32_t childIndex = getChildIndex(pBlock);
SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, childIndex);
SStreamSessionAggOperatorInfo* pChildInfo = pChildOp->info;
- doClearSessionWindows(&pChildInfo->streamAggSup, &pChildOp->exprSupp, pBlock, 0, pChildOp->exprSupp.numOfExprs,
- 0, NULL);
+ doClearSessionWindows(&pChildInfo->streamAggSup, &pChildOp->exprSupp, pBlock, START_TS_COLUMN_INDEX,
+ pChildOp->exprSupp.numOfExprs, 0, NULL);
rebuildTimeWindow(pInfo, pWins, pBlock->info.groupId, pOperator->exprSupp.numOfExprs, pOperator);
}
taosArrayDestroy(pWins);
@@ -4215,7 +4290,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
SOperatorInfo* pChildOp =
createStreamFinalSessionAggOperatorInfo(NULL, pInfo->pPhyNode, pOperator->pTaskInfo, 0);
if (!pChildOp) {
- longjmp(pOperator->pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pOperator->pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
taosArrayPush(pInfo->pChildren, &pChildOp);
}
@@ -4262,8 +4337,6 @@ static void clearStreamSessionOperator(SStreamSessionAggOperatorInfo* pInfo) {
}
}
clearDiskbasedBuf(pInfo->streamAggSup.pResultBuf);
- cleanupResultRowInfo(&pInfo->binfo.resultRowInfo);
- initResultRowInfo(&pInfo->binfo.resultRowInfo);
}
static void removeSessionResults(SHashObj* pHashMap, SArray* pWins) {
@@ -4285,21 +4358,21 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
} else if (pOperator->status == OP_RES_TO_RETURN) {
doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf);
if (pBInfo->pRes->info.rows > 0) {
- printDataBlock(pBInfo->pRes, "sems session");
+ printDataBlock(pBInfo->pRes, "semi session");
return pBInfo->pRes;
}
// doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator);
if (pInfo->pDelRes->info.rows > 0 && !pInfo->returnDelete) {
pInfo->returnDelete = true;
- printDataBlock(pInfo->pDelRes, "sems session");
+ printDataBlock(pInfo->pDelRes, "semi session");
return pInfo->pDelRes;
}
if (pInfo->pUpdateRes->info.rows > 0) {
// process the rest of the data
pOperator->status = OP_OPENED;
- printDataBlock(pInfo->pUpdateRes, "sems session");
+ printDataBlock(pInfo->pUpdateRes, "semi session");
return pInfo->pUpdateRes;
}
// semi interval operator clear disk buffer
@@ -4318,13 +4391,14 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
clearSpecialDataBlock(pInfo->pUpdateRes);
break;
}
+ printDataBlock(pBlock, "semi session recv");
if (pBlock->info.type == STREAM_CLEAR) {
SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo));
- doClearSessionWindows(&pInfo->streamAggSup, pSup, pBlock, 0, pSup->numOfExprs, 0, pWins);
+ doClearSessionWindows(&pInfo->streamAggSup, pSup, pBlock, START_TS_COLUMN_INDEX, pSup->numOfExprs, 0, pWins);
removeSessionResults(pStUpdated, pWins);
taosArrayDestroy(pWins);
- copyUpdateDataBlock(pInfo->pUpdateRes, pBlock, pInfo->primaryTsIndex);
+ copyDataBlock(pInfo->pUpdateRes, pBlock);
break;
} else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT) {
// gap must be 0
@@ -4364,21 +4438,21 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf);
if (pBInfo->pRes->info.rows > 0) {
- printDataBlock(pBInfo->pRes, "sems session");
+ printDataBlock(pBInfo->pRes, "semi session");
return pBInfo->pRes;
}
// doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator);
if (pInfo->pDelRes->info.rows > 0 && !pInfo->returnDelete) {
pInfo->returnDelete = true;
- printDataBlock(pInfo->pDelRes, "sems session");
+ printDataBlock(pInfo->pDelRes, "semi session");
return pInfo->pDelRes;
}
if (pInfo->pUpdateRes->info.rows > 0) {
// process the rest of the data
pOperator->status = OP_OPENED;
- printDataBlock(pInfo->pUpdateRes, "sems session");
+ printDataBlock(pInfo->pUpdateRes, "semi session");
return pInfo->pUpdateRes;
}
@@ -4400,8 +4474,7 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream
pOperator->name = "StreamSessionFinalAggOperator";
} else {
pInfo->isFinal = false;
- pInfo->pUpdateRes = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
- pInfo->pUpdateRes->info.type = STREAM_CLEAR;
+ pInfo->pUpdateRes = createSpecialDataBlock(STREAM_CLEAR);
blockDataEnsureCapacity(pInfo->pUpdateRes, 128);
pOperator->name = "StreamSessionSemiAggOperator";
pOperator->fpSet =
@@ -4423,7 +4496,7 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream
_error:
if (pInfo != NULL) {
- destroyStreamSessionAggOperatorInfo(pInfo, pOperator->exprSupp.numOfExprs);
+ destroyStreamSessionAggOperatorInfo(pInfo);
}
taosMemoryFreeClear(pOperator);
@@ -4431,7 +4504,7 @@ _error:
return NULL;
}
-void destroyStreamStateOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyStreamStateOperatorInfo(void* param) {
SStreamStateAggOperatorInfo* pInfo = (SStreamStateAggOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
destroyStateStreamAggSupporter(&pInfo->streamAggSup);
@@ -4441,7 +4514,7 @@ void destroyStreamStateOperatorInfo(void* param, int32_t numOfOutput) {
for (int32_t i = 0; i < size; i++) {
SOperatorInfo* pChild = taosArrayGetP(pInfo->pChildren, i);
SStreamSessionAggOperatorInfo* pChInfo = pChild->info;
- destroyStreamSessionAggOperatorInfo(pChInfo, numOfOutput);
+ destroyStreamSessionAggOperatorInfo(pChInfo);
taosMemoryFreeClear(pChild);
taosMemoryFreeClear(pChInfo);
}
@@ -4579,7 +4652,8 @@ SStateWindowInfo* getStateWindow(SStreamAggSupporter* pAggSup, TSKEY ts, uint64_
}
int32_t updateStateWindowInfo(SArray* pWinInfos, int32_t winIndex, TSKEY* pTs, uint64_t groupId,
- SColumnInfoData* pKeyCol, int32_t rows, int32_t start, bool* allEqual, SHashObj* pSeDeleted) {
+ SColumnInfoData* pKeyCol, int32_t rows, int32_t start, bool* allEqual,
+ SHashObj* pSeDeleted) {
*allEqual = true;
SStateWindowInfo* pWinInfo = taosArrayGet(pWinInfos, winIndex);
for (int32_t i = start; i < rows; ++i) {
@@ -4600,9 +4674,8 @@ int32_t updateStateWindowInfo(SArray* pWinInfos, int32_t winIndex, TSKEY* pTs, u
}
if (pWinInfo->winInfo.win.skey > pTs[i]) {
if (pSeDeleted && pWinInfo->winInfo.isOutput) {
- SWinRes res = {.ts = pWinInfo->winInfo.win.skey, .groupId = groupId};
- taosHashPut(pSeDeleted, &pWinInfo->winInfo.pos, sizeof(SResultRowPosition), &res,
- sizeof(SWinRes));
+ SWinKey res = {.ts = pWinInfo->winInfo.win.skey, .groupId = groupId};
+ taosHashPut(pSeDeleted, &pWinInfo->winInfo.pos, sizeof(SResultRowPosition), &res, sizeof(SWinKey));
pWinInfo->winInfo.isOutput = false;
}
pWinInfo->winInfo.win.skey = pTs[i];
@@ -4615,24 +4688,21 @@ int32_t updateStateWindowInfo(SArray* pWinInfos, int32_t winIndex, TSKEY* pTs, u
return rows - start;
}
-static void doClearStateWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock,
- int32_t tsIndex, SColumn* pCol, int32_t keyIndex, SHashObj* pSeUpdated, SHashObj* pSeDeleted) {
- SColumnInfoData* pTsColInfo = taosArrayGet(pBlock->pDataBlock, tsIndex);
- SColumnInfoData* pKeyColInfo = taosArrayGet(pBlock->pDataBlock, keyIndex);
+static void doClearStateWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SHashObj* pSeUpdated,
+ SHashObj* pSeDeleted) {
+ SColumnInfoData* pTsColInfo = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ SColumnInfoData* pGroupColInfo = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
TSKEY* tsCol = (TSKEY*)pTsColInfo->pData;
bool allEqual = false;
int32_t step = 1;
- uint64_t groupId = pBlock->info.groupId;
+ uint64_t* gpCol = (uint64_t*)pGroupColInfo->pData;
for (int32_t i = 0; i < pBlock->info.rows; i += step) {
- char* pKeyData = colDataGetData(pKeyColInfo, i);
int32_t winIndex = 0;
- SStateWindowInfo* pCurWin = getStateWindowByTs(pAggSup, tsCol[i], groupId, &winIndex);
+ SStateWindowInfo* pCurWin = getStateWindowByTs(pAggSup, tsCol[i], gpCol[i], &winIndex);
if (!pCurWin) {
continue;
}
- step = updateStateWindowInfo(pAggSup->pCurWins, winIndex, tsCol, groupId, pKeyColInfo,
- pBlock->info.rows, i, &allEqual, pSeDeleted);
- ASSERT(isTsInWindow(pCurWin, tsCol[i]) || isEqualStateKey(pCurWin, pKeyData));
+ updateSessionWindowInfo(&pCurWin->winInfo, tsCol, NULL, 0, pBlock->info.rows, i, 0, NULL);
taosHashRemove(pSeUpdated, &pCurWin->winInfo.pos, sizeof(SResultRowPosition));
deleteWindow(pAggSup->pCurWins, winIndex, destroyStateWinInfo);
}
@@ -4669,12 +4739,11 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl
char* pKeyData = colDataGetData(pKeyColInfo, i);
int32_t winIndex = 0;
bool allEqual = true;
- SStateWindowInfo* pCurWin =
- getStateWindow(pAggSup, tsCols[i], groupId, pKeyData, &pInfo->stateCol, &winIndex);
- winRows = updateStateWindowInfo(pAggSup->pCurWins, winIndex, tsCols, groupId, pKeyColInfo,
- pSDataBlock->info.rows, i, &allEqual, pStDeleted);
+ SStateWindowInfo* pCurWin = getStateWindow(pAggSup, tsCols[i], groupId, pKeyData, &pInfo->stateCol, &winIndex);
+ winRows = updateStateWindowInfo(pAggSup->pCurWins, winIndex, tsCols, groupId, pKeyColInfo, pSDataBlock->info.rows,
+ i, &allEqual, pStDeleted);
if (!allEqual) {
- appendOneRow(pAggSup->pScanBlock, &pCurWin->winInfo.win.skey, &pCurWin->winInfo.win.ekey,
+ appendOneRow(pAggSup->pScanBlock, &pCurWin->winInfo.win.skey, &pCurWin->winInfo.win.ekey, GROUPID_COLUMN_INDEX,
&groupId);
taosHashRemove(pSeUpdated, &pCurWin->winInfo.pos, sizeof(SResultRowPosition));
deleteWindow(pAggSup->pCurWins, winIndex, destroyStateWinInfo);
@@ -4682,14 +4751,14 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl
}
code = doOneStateWindowAgg(pInfo, pSDataBlock, &pCurWin->winInfo, &pResult, i, winRows, numOfOutput, pOperator);
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
pCurWin->winInfo.isClosed = false;
if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) {
- SWinRes value = {.ts = pCurWin->winInfo.win.skey, .groupId = groupId};
- code = taosHashPut(pSeUpdated, &pCurWin->winInfo.pos, sizeof(SResultRowPosition), &value, sizeof(SWinRes));
+ SWinKey value = {.ts = pCurWin->winInfo.win.skey, .groupId = groupId};
+ code = taosHashPut(pSeUpdated, &pCurWin->winInfo.pos, sizeof(SResultRowPosition), &value, sizeof(SWinKey));
if (code != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
pCurWin->winInfo.isOutput = true;
}
@@ -4730,8 +4799,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
printDataBlock(pBlock, "single state recv");
if (pBlock->info.type == STREAM_CLEAR) {
- doClearStateWindows(&pInfo->streamAggSup, pBlock, pInfo->primaryTsIndex, &pInfo->stateCol, pInfo->stateCol.slotId,
- pSeUpdated, pInfo->pSeDeleted);
+ doClearStateWindows(&pInfo->streamAggSup, pBlock, pSeUpdated, pInfo->pSeDeleted);
continue;
} else if (pBlock->info.type == STREAM_DELETE_DATA) {
SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo));
@@ -4847,8 +4915,6 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE;
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.numOfExprs = numOfCols;
- pOperator->exprSupp.pExprInfo = pExprInfo;
pOperator->pTaskInfo = pTaskInfo;
pOperator->info = pInfo;
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamStateAgg, NULL, NULL,
@@ -4861,16 +4927,15 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
return pOperator;
_error:
- destroyStreamStateOperatorInfo(pInfo, numOfCols);
+ destroyStreamStateOperatorInfo(pInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = code;
return NULL;
}
-void destroyMergeAlignedIntervalOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyMergeAlignedIntervalOperatorInfo(void* param) {
SMergeAlignedIntervalAggOperatorInfo* miaInfo = (SMergeAlignedIntervalAggOperatorInfo*)param;
- destroyIntervalOperatorInfo(miaInfo->intervalAggOperatorInfo, numOfOutput);
-
+ destroyIntervalOperatorInfo(miaInfo->intervalAggOperatorInfo);
taosMemoryFreeClear(param);
}
@@ -4883,14 +4948,14 @@ static int32_t outputMergeAlignedIntervalResult(SOperatorInfo* pOperatorInfo, ui
SExprSupp* pSup = &pOperatorInfo->exprSupp;
SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &wstartTs, TSDB_KEYSIZE, tableGroupId);
- SResultRowPosition* p1 = (SResultRowPosition*)taosHashGet(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf,
+ SResultRowPosition* p1 = (SResultRowPosition*)tSimpleHashGet(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf,
GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE));
ASSERT(p1 != NULL);
finalizeResultRowIntoResultDataBlock(iaInfo->aggSup.pResultBuf, p1, pSup->pCtx, pSup->pExprInfo, pSup->numOfExprs,
pSup->rowEntryInfoOffset, pResultBlock, pTaskInfo);
- taosHashRemove(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE));
- ASSERT(taosHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 0);
+ tSimpleHashRemove(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE));
+ ASSERT(tSimpleHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 0);
return TSDB_CODE_SUCCESS;
}
@@ -4913,7 +4978,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
// there is an result exists
if (miaInfo->curTs != INT64_MIN) {
- ASSERT(taosHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 1);
+ ASSERT(tSimpleHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 1);
if (ts != miaInfo->curTs) {
outputMergeAlignedIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, miaInfo->curTs);
@@ -4921,7 +4986,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
}
} else {
miaInfo->curTs = ts;
- ASSERT(taosHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 0);
+ ASSERT(tSimpleHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 0);
}
STimeWindow win = {0};
@@ -4933,7 +4998,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
int32_t ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId,
pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &iaInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
int32_t currPos = startPos;
@@ -4960,7 +5025,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
ret = setTimeWindowOutputBuf(pResultRowInfo, &currWin, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pSup->pCtx,
numOfOutput, pSup->rowEntryInfoOffset, &iaInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
miaInfo->curTs = currWin.skey;
@@ -4997,7 +5062,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
if (pBlock == NULL) {
// close last unfinalized time window
if (miaInfo->curTs != INT64_MIN) {
- ASSERT(taosHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 1);
+ ASSERT(tSimpleHashGetSize(iaInfo->aggSup.pResultRowHashTable) == 1);
outputMergeAlignedIntervalResult(pOperator, miaInfo->groupId, pRes, miaInfo->curTs);
miaInfo->curTs = INT64_MIN;
}
@@ -5065,9 +5130,7 @@ static SSDataBlock* mergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
return (rows == 0) ? NULL : pRes;
}
-SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo,
- int32_t numOfCols, SSDataBlock* pResBlock, SInterval* pInterval,
- int32_t primaryTsSlotId, SNode* pCondition, bool mergeResultBlock,
+SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMergeAlignedIntervalPhysiNode* pNode,
SExecTaskInfo* pTaskInfo) {
SMergeAlignedIntervalAggOperatorInfo* miaInfo = taosMemoryCalloc(1, sizeof(SMergeAlignedIntervalAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
@@ -5080,48 +5143,54 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream,
goto _error;
}
+ int32_t num = 0;
+ SExprInfo* pExprInfo = createExprInfo(pNode->window.pFuncs, NULL, &num);
+ SSDataBlock* pResBlock = createResDataBlock(pNode->window.node.pOutputDataBlockDesc);
+
+ SInterval interval = {.interval = pNode->interval,
+ .sliding = pNode->sliding,
+ .intervalUnit = pNode->intervalUnit,
+ .slidingUnit = pNode->slidingUnit,
+ .offset = pNode->offset,
+ .precision = ((SColumnNode*)pNode->window.pTspk)->node.resType.precision};
+
SIntervalAggOperatorInfo* iaInfo = miaInfo->intervalAggOperatorInfo;
SExprSupp* pSup = &pOperator->exprSupp;
- miaInfo->pCondition = pCondition;
- miaInfo->curTs = INT64_MIN;
-
- iaInfo->win = pTaskInfo->window;
- iaInfo->inputOrder = TSDB_ORDER_ASC;
- iaInfo->interval = *pInterval;
- iaInfo->execModel = pTaskInfo->execModel;
- iaInfo->primaryTsIndex = primaryTsSlotId;
- iaInfo->binfo.mergeResultBlock = mergeResultBlock;
+ miaInfo->pCondition = pNode->window.node.pConditions;
+ miaInfo->curTs = INT64_MIN;
+ iaInfo->win = pTaskInfo->window;
+ iaInfo->inputOrder = TSDB_ORDER_ASC;
+ iaInfo->interval = interval;
+ iaInfo->execModel = pTaskInfo->execModel;
+ iaInfo->primaryTsIndex = ((SColumnNode*)pNode->window.pTspk)->slotId;
+ iaInfo->binfo.mergeResultBlock = pNode->window.mergeDataBlock;
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
initResultSizeInfo(&pOperator->resultInfo, 4096);
- int32_t code =
- initAggInfo(&pOperator->exprSupp, &iaInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str);
- initBasicInfo(&iaInfo->binfo, pResBlock);
+ int32_t code = initAggInfo(&pOperator->exprSupp, &iaInfo->aggSup, pExprInfo, num, keyBufSize, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ initBasicInfo(&iaInfo->binfo, pResBlock);
initExecTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &iaInfo->win);
- iaInfo->timeWindowInterpo = timeWindowinterpNeeded(pSup->pCtx, numOfCols, iaInfo);
+ iaInfo->timeWindowInterpo = timeWindowinterpNeeded(pSup->pCtx, num, iaInfo);
if (iaInfo->timeWindowInterpo) {
- iaInfo->binfo.resultRowInfo.openWindow = tdListNew(sizeof(SResultRowPosition));
- }
-
- if (code != TSDB_CODE_SUCCESS) {
- goto _error;
+ iaInfo->binfo.resultRowInfo.openWindow = tdListNew(sizeof(SOpenWindowInfo));
}
initResultRowInfo(&iaInfo->binfo.resultRowInfo);
blockDataEnsureCapacity(iaInfo->binfo.pRes, pOperator->resultInfo.capacity);
- pOperator->name = "TimeMergeAlignedIntervalAggOperator";
+ pOperator->name = "TimeMergeAlignedIntervalAggOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL;
- pOperator->blocking = false;
- pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->pTaskInfo = pTaskInfo;
- pOperator->exprSupp.numOfExprs = numOfCols;
- pOperator->info = miaInfo;
+ pOperator->blocking = false;
+ pOperator->status = OP_NOT_OPENED;
+ pOperator->pTaskInfo = pTaskInfo;
+ pOperator->info = miaInfo;
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, mergeAlignedIntervalAgg, NULL, NULL,
destroyMergeAlignedIntervalOperatorInfo, NULL, NULL, NULL);
@@ -5134,7 +5203,7 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream,
return pOperator;
_error:
- destroyMergeAlignedIntervalOperatorInfo(miaInfo, numOfCols);
+ destroyMergeAlignedIntervalOperatorInfo(miaInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = code;
return NULL;
@@ -5157,10 +5226,10 @@ typedef struct SGroupTimeWindow {
STimeWindow window;
} SGroupTimeWindow;
-void destroyMergeIntervalOperatorInfo(void* param, int32_t numOfOutput) {
+void destroyMergeIntervalOperatorInfo(void* param) {
SMergeIntervalAggOperatorInfo* miaInfo = (SMergeIntervalAggOperatorInfo*)param;
tdListFree(miaInfo->groupIntervals);
- destroyIntervalOperatorInfo(&miaInfo->intervalAggOperatorInfo, numOfOutput);
+ destroyIntervalOperatorInfo(&miaInfo->intervalAggOperatorInfo);
taosMemoryFreeClear(param);
}
@@ -5174,12 +5243,12 @@ static int32_t finalizeWindowResult(SOperatorInfo* pOperatorInfo, uint64_t table
SExprSupp* pExprSup = &pOperatorInfo->exprSupp;
SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &win->skey, TSDB_KEYSIZE, tableGroupId);
- SResultRowPosition* p1 = (SResultRowPosition*)taosHashGet(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf,
+ SResultRowPosition* p1 = (SResultRowPosition*)tSimpleHashGet(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf,
GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE));
ASSERT(p1 != NULL);
finalizeResultRowIntoResultDataBlock(iaInfo->aggSup.pResultBuf, p1, pExprSup->pCtx, pExprSup->pExprInfo,
pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset, pResultBlock, pTaskInfo);
- taosHashRemove(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE));
+ tSimpleHashRemove(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE));
return TSDB_CODE_SUCCESS;
}
@@ -5235,7 +5304,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pExprSup->pCtx,
numOfOutput, pExprSup->rowEntryInfoOffset, &iaInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
TSKEY ekey = ascScan ? win.ekey : win.skey;
@@ -5245,14 +5314,14 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
// prev time window not interpolation yet.
if (iaInfo->timeWindowInterpo) {
- SResultRowPosition pos = addToOpenWindowList(pResultRowInfo, pResult);
+ SResultRowPosition pos = addToOpenWindowList(pResultRowInfo, pResult, tableGroupId);
doInterpUnclosedTimeWindow(pOperatorInfo, numOfOutput, pResultRowInfo, pBlock, scanFlag, tsCols, &pos);
// restore current time window
ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pExprSup->pCtx,
numOfOutput, pExprSup->rowEntryInfoOffset, &iaInfo->aggSup, pTaskInfo);
if (ret != TSDB_CODE_SUCCESS) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
// window start key interpolation
@@ -5281,7 +5350,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
setTimeWindowOutputBuf(pResultRowInfo, &nextWin, (scanFlag == MAIN_SCAN), &pResult, tableGroupId,
pExprSup->pCtx, numOfOutput, pExprSup->rowEntryInfoOffset, &iaInfo->aggSup, pTaskInfo);
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
- longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
ekey = ascScan ? nextWin.ekey : nextWin.skey;
@@ -5378,54 +5447,65 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
return (rows == 0) ? NULL : pRes;
}
-SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
- SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
- bool mergeBlock, SExecTaskInfo* pTaskInfo) {
- SMergeIntervalAggOperatorInfo* miaInfo = taosMemoryCalloc(1, sizeof(SMergeIntervalAggOperatorInfo));
+SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeIntervalPhysiNode* pIntervalPhyNode,
+ SExecTaskInfo* pTaskInfo) {
+ SMergeIntervalAggOperatorInfo* pMergeIntervalInfo = taosMemoryCalloc(1, sizeof(SMergeIntervalAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
- if (miaInfo == NULL || pOperator == NULL) {
+ if (pMergeIntervalInfo == NULL || pOperator == NULL) {
goto _error;
}
- miaInfo->groupIntervals = tdListNew(sizeof(SGroupTimeWindow));
+ int32_t num = 0;
+ SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &num);
+ SSDataBlock* pResBlock = createResDataBlock(pIntervalPhyNode->window.node.pOutputDataBlockDesc);
- SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo;
- iaInfo->win = pTaskInfo->window;
- iaInfo->inputOrder = TSDB_ORDER_ASC;
- iaInfo->interval = *pInterval;
- iaInfo->execModel = pTaskInfo->execModel;
- iaInfo->binfo.mergeResultBlock = mergeBlock;
+ SInterval interval = {.interval = pIntervalPhyNode->interval,
+ .sliding = pIntervalPhyNode->sliding,
+ .intervalUnit = pIntervalPhyNode->intervalUnit,
+ .slidingUnit = pIntervalPhyNode->slidingUnit,
+ .offset = pIntervalPhyNode->offset,
+ .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision};
- iaInfo->primaryTsIndex = primaryTsSlotId;
+ pMergeIntervalInfo->groupIntervals = tdListNew(sizeof(SGroupTimeWindow));
+
+ SIntervalAggOperatorInfo* pIntervalInfo = &pMergeIntervalInfo->intervalAggOperatorInfo;
+ pIntervalInfo->win = pTaskInfo->window;
+ pIntervalInfo->inputOrder = TSDB_ORDER_ASC;
+ pIntervalInfo->interval = interval;
+ pIntervalInfo->execModel = pTaskInfo->execModel;
+ pIntervalInfo->binfo.mergeResultBlock = pIntervalPhyNode->window.mergeDataBlock;
+ pIntervalInfo->primaryTsIndex = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId;
SExprSupp* pExprSupp = &pOperator->exprSupp;
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
initResultSizeInfo(&pOperator->resultInfo, 4096);
- int32_t code = initAggInfo(pExprSupp, &iaInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str);
- initBasicInfo(&iaInfo->binfo, pResBlock);
+ int32_t code = initAggInfo(pExprSupp, &pIntervalInfo->aggSup, pExprInfo, num, keyBufSize, pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
- initExecTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &iaInfo->win);
+ initBasicInfo(&pIntervalInfo->binfo, pResBlock);
+ initExecTimeWindowInfo(&pIntervalInfo->twAggSup.timeWindowData, &pIntervalInfo->win);
- iaInfo->timeWindowInterpo = timeWindowinterpNeeded(pExprSupp->pCtx, numOfCols, iaInfo);
- if (iaInfo->timeWindowInterpo) {
- iaInfo->binfo.resultRowInfo.openWindow = tdListNew(sizeof(SResultRowPosition));
- if (iaInfo->binfo.resultRowInfo.openWindow == NULL) {
+
+ pIntervalInfo->timeWindowInterpo = timeWindowinterpNeeded(pExprSupp->pCtx, num, pIntervalInfo);
+ if (pIntervalInfo->timeWindowInterpo) {
+ pIntervalInfo->binfo.resultRowInfo.openWindow = tdListNew(sizeof(SOpenWindowInfo));
+ if (pIntervalInfo->binfo.resultRowInfo.openWindow == NULL) {
goto _error;
}
}
- initResultRowInfo(&iaInfo->binfo.resultRowInfo);
+ initResultRowInfo(&pIntervalInfo->binfo.resultRowInfo);
- pOperator->name = "TimeMergeIntervalAggOperator";
+ pOperator->name = "TimeMergeIntervalAggOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL;
- pOperator->blocking = false;
- pOperator->status = OP_NOT_OPENED;
- pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->pTaskInfo = pTaskInfo;
- pOperator->exprSupp.numOfExprs = numOfCols;
- pOperator->info = miaInfo;
+ pOperator->blocking = false;
+ pOperator->status = OP_NOT_OPENED;
+ pOperator->pTaskInfo = pTaskInfo;
+ pOperator->info = pMergeIntervalInfo;
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doMergeIntervalAgg, NULL, NULL,
destroyMergeIntervalOperatorInfo, NULL, NULL, NULL);
@@ -5438,7 +5518,7 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprI
return pOperator;
_error:
- destroyMergeIntervalOperatorInfo(miaInfo, numOfCols);
+ destroyMergeIntervalOperatorInfo(pMergeIntervalInfo);
taosMemoryFreeClear(pOperator);
pTaskInfo->code = code;
return NULL;
diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c
index ad97d79f7e7ad28da3cf51aab33010303e11f509..e0752840db07052e056063b5789003cf9b6507e0 100644
--- a/source/libs/executor/src/tlinearhash.c
+++ b/source/libs/executor/src/tlinearhash.c
@@ -26,7 +26,7 @@ typedef struct SLHashBucket {
int32_t size; // the number of element in this entry
} SLHashBucket;
-typedef struct SLHashObj {
+struct SLHashObj {
SDiskbasedBuf *pBuf;
_hash_fn_t hashFn;
SLHashBucket **pBucket; // entry list
@@ -35,7 +35,7 @@ typedef struct SLHashObj {
int32_t bits; // the number of bits used in hash
int32_t numOfBuckets; // the number of buckets
int64_t size; // the number of total items
-} SLHashObj;
+};
/**
* the data struct for each hash node
@@ -99,7 +99,7 @@ static int32_t doAddToBucket(SLHashObj* pHashObj, SLHashBucket* pBucket, int32_t
int32_t newPageId = -1;
SFilePage* pNewPage = getNewBufPage(pHashObj->pBuf, 0, &newPageId);
if (pNewPage == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
+ return terrno;
}
taosArrayPush(pBucket->pPageIdList, &newPageId);
@@ -138,7 +138,6 @@ static void doRemoveFromBucket(SFilePage* pPage, SLHashNode* pNode, SLHashBucket
}
setBufPageDirty(pPage, true);
-
pBucket->size -= 1;
}
@@ -229,6 +228,10 @@ static int32_t doAddNewBucket(SLHashObj* pHashObj) {
int32_t pageId = -1;
SFilePage* p = getNewBufPage(pHashObj->pBuf, 0, &pageId);
+ if (p == NULL) {
+ return terrno;
+ }
+
p->num = sizeof(SFilePage);
setBufPageDirty(p, true);
@@ -252,7 +255,8 @@ SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_
printf("tHash Init failed since %s", terrstr(terrno));
return NULL;
}
- int32_t code = createDiskbasedBuf(&pHashObj->pBuf, pageSize, inMemPages * pageSize, 0, tsTempDir);
+
+ int32_t code = createDiskbasedBuf(&pHashObj->pBuf, pageSize, inMemPages * pageSize, "", tsTempDir);
if (code != 0) {
terrno = code;
return NULL;
@@ -389,7 +393,9 @@ char* tHashGet(SLHashObj* pHashObj, const void *key, size_t keyLen) {
}
SLHashBucket* pBucket = pHashObj->pBucket[bucketId];
- for (int32_t i = 0; i < taosArrayGetSize(pBucket->pPageIdList); ++i) {
+ int32_t num = taosArrayGetSize(pBucket->pPageIdList);
+
+ for (int32_t i = 0; i < num; ++i) {
int32_t pageId = *(int32_t*)taosArrayGet(pBucket->pPageIdList, i);
SFilePage* p = getBufPage(pHashObj->pBuf, pageId);
diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c
index 6b2edf0d5e6e1f41b5d354d110fb23892a864b33..8cd376e0920c2c1e4bfaf89a2d3a087c7cf0ac5a 100644
--- a/source/libs/executor/src/tsimplehash.c
+++ b/source/libs/executor/src/tsimplehash.c
@@ -31,21 +31,12 @@
taosMemoryFreeClear(_n); \
} while (0);
-#pragma pack(push, 4)
-typedef struct SHNode {
- struct SHNode *next;
- uint32_t keyLen : 20;
- uint32_t dataLen : 12;
- char data[];
-} SHNode;
-#pragma pack(pop)
-
struct SSHashObj {
SHNode **hashList;
size_t capacity; // number of slots
- int64_t size; // number of elements in hash table
- _hash_fn_t hashFp; // hash function
- _equal_fn_t equalFp; // equal function
+ int64_t size; // number of elements in hash table
+ _hash_fn_t hashFp; // hash function
+ _equal_fn_t equalFp; // equal function
};
static FORCE_INLINE int32_t taosHashCapacity(int32_t length) {
@@ -76,7 +67,6 @@ SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) {
pHashObj->hashFp = fn;
ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0);
-
pHashObj->hashList = (SHNode **)taosMemoryCalloc(pHashObj->capacity, sizeof(void *));
if (!pHashObj->hashList) {
taosMemoryFree(pHashObj);
@@ -285,6 +275,44 @@ int32_t tSimpleHashRemove(SSHashObj *pHashObj, const void *key, size_t keyLen) {
return TSDB_CODE_SUCCESS;
}
+int32_t tSimpleHashIterateRemove(SSHashObj *pHashObj, const void *key, size_t keyLen, void **pIter, int32_t *iter) {
+ if (!pHashObj || !key) {
+ return TSDB_CODE_FAILED;
+ }
+
+ uint32_t hashVal = (*pHashObj->hashFp)(key, (uint32_t)keyLen);
+
+ int32_t slot = HASH_INDEX(hashVal, pHashObj->capacity);
+
+ SHNode *pNode = pHashObj->hashList[slot];
+ SHNode *pPrev = NULL;
+ while (pNode) {
+ if ((*(pHashObj->equalFp))(GET_SHASH_NODE_KEY(pNode, pNode->dataLen), key, keyLen) == 0) {
+ if (!pPrev) {
+ pHashObj->hashList[slot] = pNode->next;
+ } else {
+ pPrev->next = pNode->next;
+ }
+
+ if (*pIter == (void *)GET_SHASH_NODE_DATA(pNode)) {
+ if (!pPrev) {
+ *pIter = NULL;
+ } else {
+ *pIter = GET_SHASH_NODE_DATA(pPrev);
+ }
+ }
+
+ FREE_HASH_NODE(pNode);
+ atomic_sub_fetch_64(&pHashObj->size, 1);
+ break;
+ }
+ pPrev = pNode;
+ pNode = pNode->next;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
void tSimpleHashClear(SSHashObj *pHashObj) {
if (!pHashObj || taosHashTableEmpty(pHashObj)) {
return;
@@ -302,6 +330,7 @@ void tSimpleHashClear(SSHashObj *pHashObj) {
FREE_HASH_NODE(pNode);
pNode = pNext;
}
+ pHashObj->hashList[i] = NULL;
}
atomic_store_64(&pHashObj->size, 0);
}
@@ -324,15 +353,6 @@ size_t tSimpleHashGetMemSize(const SSHashObj *pHashObj) {
return (pHashObj->capacity * sizeof(void *)) + sizeof(SHNode) * tSimpleHashGetSize(pHashObj) + sizeof(SSHashObj);
}
-void *tSimpleHashGetKey(void *data, size_t *keyLen) {
- SHNode *node = (SHNode *)((char *)data - offsetof(SHNode, data));
- if (keyLen) {
- *keyLen = node->keyLen;
- }
-
- return POINTER_SHIFT(data, node->dataLen);
-}
-
void *tSimpleHashIterate(const SSHashObj *pHashObj, void *data, int32_t *iter) {
if (!pHashObj) {
return NULL;
@@ -341,7 +361,7 @@ void *tSimpleHashIterate(const SSHashObj *pHashObj, void *data, int32_t *iter) {
SHNode *pNode = NULL;
if (!data) {
- for (int32_t i = 0; i < pHashObj->capacity; ++i) {
+ for (int32_t i = *iter; i < pHashObj->capacity; ++i) {
pNode = pHashObj->hashList[i];
if (!pNode) {
continue;
@@ -368,52 +388,5 @@ void *tSimpleHashIterate(const SSHashObj *pHashObj, void *data, int32_t *iter) {
return GET_SHASH_NODE_DATA(pNode);
}
- return NULL;
-}
-
-void *tSimpleHashIterateKV(const SSHashObj *pHashObj, void *data, void **key, int32_t *iter) {
- if (!pHashObj) {
- return NULL;
- }
-
- SHNode *pNode = NULL;
-
- if (!data) {
- for (int32_t i = 0; i < pHashObj->capacity; ++i) {
- pNode = pHashObj->hashList[i];
- if (!pNode) {
- continue;
- }
- *iter = i;
- if (key) {
- *key = GET_SHASH_NODE_KEY(pNode, pNode->dataLen);
- }
- return GET_SHASH_NODE_DATA(pNode);
- }
- return NULL;
- }
-
- pNode = (SHNode *)((char *)data - offsetof(SHNode, data));
-
- if (pNode->next) {
- if (key) {
- *key = GET_SHASH_NODE_KEY(pNode->next, pNode->next->dataLen);
- }
- return GET_SHASH_NODE_DATA(pNode->next);
- }
-
- ++(*iter);
- for (int32_t i = *iter; i < pHashObj->capacity; ++i) {
- pNode = pHashObj->hashList[i];
- if (!pNode) {
- continue;
- }
- *iter = i;
- if (key) {
- *key = GET_SHASH_NODE_KEY(pNode, pNode->dataLen);
- }
- return GET_SHASH_NODE_DATA(pNode);
- }
-
return NULL;
}
\ No newline at end of file
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index 48af951773814d9979eb6d349670753ad4b036eb..fc411e850a814fdf1ace8d1e27c3245871278a92 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -97,7 +97,7 @@ SSortHandle* tsortCreateSortHandle(SArray* pSortInfo, int32_t type, int32_t page
return pSortHandle;
}
-static int32_t sortComparClearup(SMsortComparParam* cmpParam) {
+static int32_t sortComparCleanup(SMsortComparParam* cmpParam) {
for(int32_t i = 0; i < cmpParam->numOfSources; ++i) {
SSortSource* pSource = cmpParam->pSources[i]; // NOTICE: pSource may be SGenericSource *, if it is SORT_MULTISOURCE_MERGE
blockDataDestroy(pSource->src.pBlock);
@@ -134,15 +134,14 @@ int32_t tsortAddSource(SSortHandle* pSortHandle, void* pSource) {
return TSDB_CODE_SUCCESS;
}
-static int32_t doAddNewExternalMemSource(SDiskbasedBuf *pBuf, SArray* pAllSources, SSDataBlock* pBlock, int32_t* sourceId) {
+static int32_t doAddNewExternalMemSource(SDiskbasedBuf *pBuf, SArray* pAllSources, SSDataBlock* pBlock, int32_t* sourceId, SArray* pPageIdList) {
SSortSource* pSource = taosMemoryCalloc(1, sizeof(SSortSource));
if (pSource == NULL) {
return TSDB_CODE_QRY_OUT_OF_MEMORY;
}
- pSource->pageIdList = getDataBufPagesIdList(pBuf, (*sourceId));
pSource->src.pBlock = pBlock;
-
+ pSource->pageIdList = pPageIdList;
taosArrayPush(pAllSources, &pSource);
(*sourceId) += 1;
@@ -171,6 +170,7 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
}
}
+ SArray* pPageIdList = taosArrayInit(4, sizeof(int32_t));
while(start < pDataBlock->info.rows) {
int32_t stop = 0;
blockDataSplitRows(pDataBlock, pDataBlock->info.hasVarCol, start, &stop, pHandle->pageSize);
@@ -186,6 +186,8 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
return terrno;
}
+ taosArrayPush(pPageIdList, &pageId);
+
int32_t size = blockDataGetSize(p) + sizeof(int32_t) + taosArrayGetSize(p->pDataBlock) * sizeof(int32_t);
assert(size <= getBufPageSize(pHandle->pBuf));
@@ -201,7 +203,7 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
blockDataCleanup(pDataBlock);
SSDataBlock* pBlock = createOneDataBlock(pDataBlock, false);
- return doAddNewExternalMemSource(pHandle->pBuf, pHandle->pOrderedSource, pBlock, &pHandle->sourceId);
+ return doAddNewExternalMemSource(pHandle->pBuf, pHandle->pOrderedSource, pBlock, &pHandle->sourceId, pPageIdList);
}
static void setCurrentSourceIsDone(SSortSource* pSource, SSortHandle* pHandle) {
@@ -502,6 +504,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
return code;
}
+ SArray* pPageIdList = taosArrayInit(4, sizeof(int32_t));
while (1) {
SSDataBlock* pDataBlock = getSortedBlockDataInner(pHandle, &pHandle->cmpParam, numOfRows);
if (pDataBlock == NULL) {
@@ -514,6 +517,8 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
return terrno;
}
+ taosArrayPush(pPageIdList, &pageId);
+
int32_t size = blockDataGetSize(pDataBlock) + sizeof(int32_t) + taosArrayGetSize(pDataBlock->pDataBlock) * sizeof(int32_t);
assert(size <= getBufPageSize(pHandle->pBuf));
@@ -525,12 +530,12 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
blockDataCleanup(pDataBlock);
}
- sortComparClearup(&pHandle->cmpParam);
+ sortComparCleanup(&pHandle->cmpParam);
tMergeTreeDestroy(pHandle->pMergeTree);
pHandle->numOfCompletedSources = 0;
SSDataBlock* pBlock = createOneDataBlock(pHandle->pDataBlock, false);
- code = doAddNewExternalMemSource(pHandle->pBuf, pResList, pBlock, &pHandle->sourceId);
+ code = doAddNewExternalMemSource(pHandle->pBuf, pResList, pBlock, &pHandle->sourceId, pPageIdList);
if (code != 0) {
return code;
}
diff --git a/source/libs/executor/test/executorTests.cpp b/source/libs/executor/test/executorTests.cpp
index bba4b254c5d56f2c72988897273d363a3fec3c0c..1c4216334945c0b682e313a975e558390fbd7049 100644
--- a/source/libs/executor/test/executorTests.cpp
+++ b/source/libs/executor/test/executorTests.cpp
@@ -26,7 +26,6 @@
#include "executor.h"
#include "executorimpl.h"
#include "function.h"
-#include "stub.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
diff --git a/source/libs/executor/test/lhashTests.cpp b/source/libs/executor/test/lhashTests.cpp
index 695552faa0f353cc631b87cf03f51003c7b66aed..c9b75395bce345802ff0e563762758601aca0a18 100644
--- a/source/libs/executor/test/lhashTests.cpp
+++ b/source/libs/executor/test/lhashTests.cpp
@@ -26,40 +26,47 @@
TEST(testCase, linear_hash_Tests) {
taosSeedRand(taosGetTimestampSec());
+ strcpy(tsTempDir, "/tmp/");
_hash_fn_t fn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT);
-#if 0
- SLHashObj* pHashObj = tHashInit(256, 4096, fn, 320);
- for(int32_t i = 0; i < 5000000; ++i) {
+
+ int64_t st = taosGetTimestampUs();
+
+ SLHashObj* pHashObj = tHashInit(4098*4*2, 512, fn, 40);
+ for(int32_t i = 0; i < 1000000; ++i) {
int32_t code = tHashPut(pHashObj, &i, sizeof(i), &i, sizeof(i));
assert(code == 0);
}
// tHashPrint(pHashObj, LINEAR_HASH_STATIS);
+ int64_t et = taosGetTimestampUs();
-// for(int32_t i = 0; i < 10000; ++i) {
-// char* v = tHashGet(pHashObj, &i, sizeof(i));
-// if (v != NULL) {
-//// printf("find value: %d, key:%d\n", *(int32_t*) v, i);
-// } else {
+ for(int32_t i = 0; i < 1000000; ++i) {
+ if (i == 950000) {
+ printf("kf\n");
+ }
+ char* v = tHashGet(pHashObj, &i, sizeof(i));
+ if (v != NULL) {
+// printf("find value: %d, key:%d\n", *(int32_t*) v, i);
+ } else {
// printf("failed to found key:%d in hash\n", i);
-// }
-// }
+ }
+ }
- tHashPrint(pHashObj, LINEAR_HASH_STATIS);
+// tHashPrint(pHashObj, LINEAR_HASH_STATIS);
tHashCleanup(pHashObj);
-#endif
+ int64_t et1 = taosGetTimestampUs();
-#if 0
- SHashObj* pHashObj = taosHashInit(1000, fn, false, HASH_NO_LOCK);
+ SHashObj* pHashObj1 = taosHashInit(1000, fn, false, HASH_NO_LOCK);
for(int32_t i = 0; i < 1000000; ++i) {
- taosHashPut(pHashObj, &i, sizeof(i), &i, sizeof(i));
+ taosHashPut(pHashObj1, &i, sizeof(i), &i, sizeof(i));
}
- for(int32_t i = 0; i < 10000; ++i) {
- void* v = taosHashGet(pHashObj, &i, sizeof(i));
+ for(int32_t i = 0; i < 1000000; ++i) {
+ void* v = taosHashGet(pHashObj1, &i, sizeof(i));
}
- taosHashCleanup(pHashObj);
-#endif
+ taosHashCleanup(pHashObj1);
+ int64_t et2 = taosGetTimestampUs();
+ printf("linear hash time:%.2f ms, buildHash:%.2f ms, hash:%.2f\n", (et1-st)/1000.0, (et-st)/1000.0, (et2-et1)/1000.0);
}
\ No newline at end of file
diff --git a/source/libs/executor/test/sortTests.cpp b/source/libs/executor/test/sortTests.cpp
index 6e244152f20e0d4b914b21fcb871a5bbec871fce..4ac15670ac5dca547572df102f7267de08c0306d 100644
--- a/source/libs/executor/test/sortTests.cpp
+++ b/source/libs/executor/test/sortTests.cpp
@@ -27,7 +27,6 @@
#include "executorimpl.h"
#include "executor.h"
-#include "stub.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
@@ -196,7 +195,7 @@ int32_t docomp(const void* p1, const void* p2, void* param) {
}
} // namespace
-#if 1
+#if 0
TEST(testCase, inMem_sort_Test) {
SBlockOrderInfo oi = {0};
oi.order = TSDB_ORDER_ASC;
@@ -382,7 +381,7 @@ TEST(testCase, ordered_merge_sort_Test) {
}
void* v = tsortGetValue(pTupleHandle, 0);
- printf("%d: %d\n", row, *(int32_t*) v);
+// printf("%d: %d\n", row, *(int32_t*) v);
ASSERT_EQ(row++, *(int32_t*) v);
}
diff --git a/source/libs/executor/test/tSimpleHashTests.cpp b/source/libs/executor/test/tSimpleHashTests.cpp
index acb6d434b484057196067954df13eeb4bcd602b3..3bf339ef9040879c0978f9bedffb2b23bd8ec806 100644
--- a/source/libs/executor/test/tSimpleHashTests.cpp
+++ b/source/libs/executor/test/tSimpleHashTests.cpp
@@ -30,7 +30,7 @@
// return RUN_ALL_TESTS();
// }
-TEST(testCase, tSimpleHashTest) {
+TEST(testCase, tSimpleHashTest_intKey) {
SSHashObj *pHashObj =
tSimpleHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT));
@@ -57,12 +57,14 @@ TEST(testCase, tSimpleHashTest) {
int32_t iter = 0;
int64_t keySum = 0;
int64_t dataSum = 0;
+ size_t kLen = 0;
while ((data = tSimpleHashIterate(pHashObj, data, &iter))) {
- void *key = tSimpleHashGetKey(data, NULL);
+ void *key = tSimpleHashGetKey(data, &kLen);
+ ASSERT_EQ(keyLen, kLen);
keySum += *(int64_t *)key;
dataSum += *(int64_t *)data;
}
-
+
ASSERT_EQ(keySum, dataSum);
ASSERT_EQ(keySum, originKeySum);
@@ -74,4 +76,69 @@ TEST(testCase, tSimpleHashTest) {
tSimpleHashCleanup(pHashObj);
}
+
+TEST(testCase, tSimpleHashTest_binaryKey) {
+ SSHashObj *pHashObj =
+ tSimpleHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT));
+
+ assert(pHashObj != nullptr);
+
+ ASSERT_EQ(0, tSimpleHashGetSize(pHashObj));
+
+ typedef struct {
+ int64_t suid;
+ int64_t uid;
+ } SCombineKey;
+
+ size_t keyLen = sizeof(SCombineKey);
+ size_t dataLen = sizeof(int64_t);
+
+ int64_t originDataSum = 0;
+ SCombineKey combineKey = {0};
+ for (int64_t i = 1; i <= 100; ++i) {
+ combineKey.suid = i;
+ combineKey.uid = i + 1;
+ tSimpleHashPut(pHashObj, (const void *)&combineKey, keyLen, (const void *)&i, dataLen);
+ originDataSum += i;
+ ASSERT_EQ(i, tSimpleHashGetSize(pHashObj));
+ }
+
+ for (int64_t i = 1; i <= 100; ++i) {
+ combineKey.suid = i;
+ combineKey.uid = i + 1;
+ void *data = tSimpleHashGet(pHashObj, (const void *)&combineKey, keyLen);
+ ASSERT_EQ(i, *(int64_t *)data);
+ }
+
+ void *data = NULL;
+ int32_t iter = 0;
+ int64_t keySum = 0;
+ int64_t dataSum = 0;
+ size_t kLen = 0;
+ while ((data = tSimpleHashIterate(pHashObj, data, &iter))) {
+ void *key = tSimpleHashGetKey(data, &kLen);
+ ASSERT_EQ(keyLen, kLen);
+ dataSum += *(int64_t *)data;
+ }
+
+ ASSERT_EQ(originDataSum, dataSum);
+
+ tSimpleHashRemove(pHashObj, (const void *)&combineKey, keyLen);
+
+ while ((data = tSimpleHashIterate(pHashObj, data, &iter))) {
+ void *key = tSimpleHashGetKey(data, &kLen);
+ ASSERT_EQ(keyLen, kLen);
+ }
+
+ for (int64_t i = 1; i <= 99; ++i) {
+ combineKey.suid = i;
+ combineKey.uid = i + 1;
+ tSimpleHashRemove(pHashObj, (const void *)&combineKey, keyLen);
+ ASSERT_EQ(99 - i, tSimpleHashGetSize(pHashObj));
+ }
+
+ tSimpleHashCleanup(pHashObj);
+}
+
+
#pragma GCC diagnostic pop
\ No newline at end of file
diff --git a/source/libs/function/inc/tpercentile.h b/source/libs/function/inc/tpercentile.h
index dfb52f76946c502b38231130858b5694b7171f35..554f9e567f35cc0272a2a9755153de1b54d34392 100644
--- a/source/libs/function/inc/tpercentile.h
+++ b/source/libs/function/inc/tpercentile.h
@@ -51,20 +51,20 @@ struct tMemBucket;
typedef int32_t (*__perc_hash_func_t)(struct tMemBucket *pBucket, const void *value);
typedef struct tMemBucket {
- int16_t numOfSlots;
- int16_t type;
- int16_t bytes;
- int32_t total;
- int32_t elemPerPage; // number of elements for each object
- int32_t maxCapacity; // maximum allowed number of elements that can be sort directly to get the result
- int32_t bufPageSize; // disk page size
- MinMaxEntry range; // value range
- int32_t times; // count that has been checked for deciding the correct data value buckets.
- __compar_fn_t comparFn;
-
- tMemBucketSlot * pSlots;
- SDiskbasedBuf *pBuffer;
- __perc_hash_func_t hashFunc;
+ int16_t numOfSlots;
+ int16_t type;
+ int16_t bytes;
+ int32_t total;
+ int32_t elemPerPage; // number of elements for each object
+ int32_t maxCapacity; // maximum allowed number of elements that can be sort directly to get the result
+ int32_t bufPageSize; // disk page size
+ MinMaxEntry range; // value range
+ int32_t times; // count that has been checked for deciding the correct data value buckets.
+ __compar_fn_t comparFn;
+ tMemBucketSlot* pSlots;
+ SDiskbasedBuf* pBuffer;
+ __perc_hash_func_t hashFunc;
+ SHashObj* groupPagesMap; // disk page map for different groups;
} tMemBucket;
tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval, double maxval);
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index ed82e4cb50cd2ce72ab3e9965b7ef1481fe2ccfa..b7cd02befd326eafd7b0a9354a3f5c50147d834b 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -303,7 +303,7 @@ static int32_t translateInOutStr(SFunctionNode* pFunc, char* pErrBuf, int32_t le
}
SExprNode* pPara1 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0);
- if (!IS_VAR_DATA_TYPE(pPara1->resType.type)) {
+ if (!IS_STR_DATA_TYPE(pPara1->resType.type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -317,7 +317,7 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len
}
SExprNode* pPara1 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0);
- if (!IS_VAR_DATA_TYPE(pPara1->resType.type)) {
+ if (!IS_STR_DATA_TYPE(pPara1->resType.type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -546,7 +546,7 @@ static int32_t translateApercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
// param2
if (3 == numOfParams) {
uint8_t para3Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 2))->resType.type;
- if (!IS_VAR_DATA_TYPE(para3Type)) {
+ if (!IS_STR_DATA_TYPE(para3Type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -593,7 +593,7 @@ static int32_t translateApercentileImpl(SFunctionNode* pFunc, char* pErrBuf, int
// param2
if (3 == numOfParams) {
uint8_t para3Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 2))->resType.type;
- if (!IS_VAR_DATA_TYPE(para3Type)) {
+ if (!IS_STR_DATA_TYPE(para3Type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -1388,7 +1388,7 @@ static int32_t translateSample(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
}
// set result type
- if (IS_VAR_DATA_TYPE(colType)) {
+ if (IS_STR_DATA_TYPE(colType)) {
pFunc->node.resType = (SDataType){.bytes = pCol->resType.bytes, .type = colType};
} else {
pFunc->node.resType = (SDataType){.bytes = tDataTypes[colType].bytes, .type = colType};
@@ -1431,7 +1431,7 @@ static int32_t translateTail(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
}
// set result type
- if (IS_VAR_DATA_TYPE(colType)) {
+ if (IS_STR_DATA_TYPE(colType)) {
pFunc->node.resType = (SDataType){.bytes = pCol->resType.bytes, .type = colType};
} else {
pFunc->node.resType = (SDataType){.bytes = tDataTypes[colType].bytes, .type = colType};
@@ -1514,7 +1514,7 @@ static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
for (int32_t i = 1; i < 3; ++i) {
nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i));
paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type;
- if (!IS_VAR_DATA_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) {
+ if (!IS_STR_DATA_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -1682,7 +1682,7 @@ static int32_t translateLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
}
- if (!IS_VAR_DATA_TYPE(((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type)) {
+ if (!IS_STR_DATA_TYPE(((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -1714,7 +1714,7 @@ static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
for (int32_t i = 0; i < numOfParams; ++i) {
SNode* pPara = nodesListGetNode(pFunc->pParameterList, i);
uint8_t paraType = ((SExprNode*)pPara)->resType.type;
- if (!IS_VAR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
+ if (!IS_STR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
if (TSDB_DATA_TYPE_NCHAR == paraType) {
@@ -1770,7 +1770,7 @@ static int32_t translateSubstr(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
uint8_t para0Type = pPara0->resType.type;
uint8_t para1Type = pPara1->resType.type;
- if (!IS_VAR_DATA_TYPE(para0Type) || !IS_INTEGER_TYPE(para1Type)) {
+ if (!IS_STR_DATA_TYPE(para0Type) || !IS_INTEGER_TYPE(para1Type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -1802,7 +1802,7 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
uint8_t para2Type = pFunc->node.resType.type;
int32_t para2Bytes = pFunc->node.resType.bytes;
- if (IS_VAR_DATA_TYPE(para2Type)) {
+ if (IS_STR_DATA_TYPE(para2Type)) {
para2Bytes -= VARSTR_HEADER_SIZE;
}
if (para2Bytes <= 0 || para2Bytes > 4096) { // cast dst var type length limits to 4096 bytes
@@ -1859,7 +1859,7 @@ static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
}
- if (!IS_VAR_DATA_TYPE(((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type)) {
+ if (!IS_STR_DATA_TYPE(((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -1878,7 +1878,7 @@ static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_
uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
uint8_t para2Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type;
- if ((!IS_VAR_DATA_TYPE(para1Type) && !IS_INTEGER_TYPE(para1Type) && TSDB_DATA_TYPE_TIMESTAMP != para1Type) ||
+ if ((!IS_STR_DATA_TYPE(para1Type) && !IS_INTEGER_TYPE(para1Type) && TSDB_DATA_TYPE_TIMESTAMP != para1Type) ||
!IS_INTEGER_TYPE(para2Type)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
@@ -1911,7 +1911,7 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le
for (int32_t i = 0; i < 2; ++i) {
uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type;
- if (!IS_VAR_DATA_TYPE(paraType) && !IS_INTEGER_TYPE(paraType) && TSDB_DATA_TYPE_TIMESTAMP != paraType) {
+ if (!IS_STR_DATA_TYPE(paraType) && !IS_INTEGER_TYPE(paraType) && TSDB_DATA_TYPE_TIMESTAMP != paraType) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
}
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index 013c58cc4501c091cc745330b584174064aff404..32d0472a50c596ed4a125a961555124aa408be3f 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -3643,7 +3643,7 @@ int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx);
STopBotRes* pRes = getTopBotOutputInfo(pCtx);
- int16_t type = pCtx->input.pData[0]->info.type;
+ int16_t type = pCtx->pExpr->base.resSchema.type;
int32_t slotId = pCtx->pExpr->base.resSchema.slotId;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c
index 517253dc01691754425bd93c40bfef2a2750eed5..dbe0b6bb3ae887a2f9ac78fc98274ca5bbd1f867 100644
--- a/source/libs/function/src/tpercentile.c
+++ b/source/libs/function/src/tpercentile.c
@@ -33,13 +33,13 @@ static SFilePage *loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx)
SFilePage *buffer = (SFilePage *)taosMemoryCalloc(1, pMemBucket->bytes * pMemBucket->pSlots[slotIdx].info.size + sizeof(SFilePage));
int32_t groupId = getGroupId(pMemBucket->numOfSlots, slotIdx, pMemBucket->times);
- SIDList list = getDataBufPagesIdList(pMemBucket->pBuffer, groupId);
+ SArray* pIdList = *(SArray**)taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId));
int32_t offset = 0;
- for(int32_t i = 0; i < list->size; ++i) {
- struct SPageInfo* pgInfo = *(struct SPageInfo**) taosArrayGet(list, i);
+ for(int32_t i = 0; i < taosArrayGetSize(pIdList); ++i) {
+ int32_t* pageId = taosArrayGet(pIdList, i);
- SFilePage* pg = getBufPage(pMemBucket->pBuffer, getPageId(pgInfo));
+ SFilePage* pg = getBufPage(pMemBucket->pBuffer, *pageId);
memcpy(buffer->data + offset, pg->data, (size_t)(pg->num * pMemBucket->bytes));
offset += (int32_t)(pg->num * pMemBucket->bytes);
@@ -97,11 +97,11 @@ double findOnlyResult(tMemBucket *pMemBucket) {
}
int32_t groupId = getGroupId(pMemBucket->numOfSlots, i, pMemBucket->times);
- SIDList list = getDataBufPagesIdList(pMemBucket->pBuffer, groupId);
+ SArray* list = *(SArray**)taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId));
assert(list->size == 1);
- struct SPageInfo* pgInfo = (struct SPageInfo*) taosArrayGetP(list, 0);
- SFilePage* pPage = getBufPage(pMemBucket->pBuffer, getPageId(pgInfo));
+ int32_t* pageId = taosArrayGet(list, 0);
+ SFilePage* pPage = getBufPage(pMemBucket->pBuffer, *pageId);
assert(pPage->num == 1);
double v = 0;
@@ -233,7 +233,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
pBucket->times = 1;
pBucket->maxCapacity = 200000;
-
+ pBucket->groupPagesMap = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
if (setBoundingBox(&pBucket->range, pBucket->type, minval, maxval) != 0) {
// qError("MemBucket:%p, invalid value range: %f-%f", pBucket, minval, maxval);
taosMemoryFree(pBucket);
@@ -280,8 +280,16 @@ void tMemBucketDestroy(tMemBucket *pBucket) {
return;
}
+ void* p = taosHashIterate(pBucket->groupPagesMap, NULL);
+ while(p) {
+ SArray** p1 = p;
+ p = taosHashIterate(pBucket->groupPagesMap, p);
+ taosArrayDestroy(*p1);
+ }
+
destroyDiskbasedBuf(pBucket->pBuffer);
taosMemoryFreeClear(pBucket->pSlots);
+ taosHashCleanup(pBucket->groupPagesMap);
taosMemoryFreeClear(pBucket);
}
@@ -357,8 +365,16 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
pSlot->info.data = NULL;
}
+ SArray* pPageIdList = (SArray*)taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId));
+ if (pPageIdList == NULL) {
+ SArray* pList = taosArrayInit(4, sizeof(int32_t));
+ taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pList, POINTER_BYTES);
+ pPageIdList = pList;
+ }
+
pSlot->info.data = getNewBufPage(pBucket->pBuffer, groupId, &pageId);
pSlot->info.pageId = pageId;
+ taosArrayPush(pPageIdList, &pageId);
}
memcpy(pSlot->info.data->data + pSlot->info.data->num * pBucket->bytes, d, pBucket->bytes);
@@ -476,7 +492,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
resetSlotInfo(pMemBucket);
int32_t groupId = getGroupId(pMemBucket->numOfSlots, i, pMemBucket->times - 1);
- SIDList list = getDataBufPagesIdList(pMemBucket->pBuffer, groupId);
+ SIDList list = taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId));
assert(list->size > 0);
for (int32_t f = 0; f < list->size; ++f) {
diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c
index 1cbc78df48b1cbeb5d1645dcd945168f21d25ba6..5b27e030b92b03a3450cf2a864a406209c1a9dcd 100644
--- a/source/libs/function/src/udfd.c
+++ b/source/libs/function/src/udfd.c
@@ -84,6 +84,7 @@ typedef struct SUdf {
TUdfAggStartFunc aggStartFunc;
TUdfAggProcessFunc aggProcFunc;
TUdfAggFinishFunc aggFinishFunc;
+ TUdfAggMergeFunc aggMergeFunc;
TUdfInitFunc initFunc;
TUdfDestroyFunc destroyFunc;
@@ -271,6 +272,15 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) {
break;
}
+ case TSDB_UDF_CALL_AGG_MERGE: {
+ SUdfInterBuf outBuf = {.buf = taosMemoryMalloc(udf->bufSize), .bufLen = udf->bufSize, .numOfResult = 0};
+ code = udf->aggMergeFunc(&call->interBuf, &call->interBuf2, &outBuf);
+ freeUdfInterBuf(&call->interBuf);
+ freeUdfInterBuf(&call->interBuf2);
+ subRsp->resultBuf = outBuf;
+
+ break;
+ }
case TSDB_UDF_CALL_AGG_FIN: {
SUdfInterBuf outBuf = {.buf = taosMemoryMalloc(udf->bufSize), .bufLen = udf->bufSize, .numOfResult = 0};
code = udf->aggFinishFunc(&call->interBuf, &outBuf);
@@ -309,6 +319,10 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) {
freeUdfInterBuf(&subRsp->resultBuf);
break;
}
+ case TSDB_UDF_CALL_AGG_MERGE: {
+ freeUdfInterBuf(&subRsp->resultBuf);
+ break;
+ }
case TSDB_UDF_CALL_AGG_FIN: {
freeUdfInterBuf(&subRsp->resultBuf);
break;
@@ -560,7 +574,11 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) {
strncpy(finishFuncName, processFuncName, strlen(processFuncName));
strncat(finishFuncName, finishSuffix, strlen(finishSuffix));
uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggFinishFunc));
- // TODO: merge
+ char mergeFuncName[TSDB_FUNC_NAME_LEN + 6] = {0};
+ char *mergeSuffix = "_merge";
+ strncpy(finishFuncName, processFuncName, strlen(processFuncName));
+ strncat(finishFuncName, mergeSuffix, strlen(mergeSuffix));
+ uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggMergeFunc));
}
return 0;
}
diff --git a/source/libs/index/src/indexFilter.c b/source/libs/index/src/indexFilter.c
index 21aeaba70bb02f6f44c2fc6d40d07515201ee25a..75844ce76f1cb50d6847709309dae1ed3f77bf70 100644
--- a/source/libs/index/src/indexFilter.c
+++ b/source/libs/index/src/indexFilter.c
@@ -255,6 +255,13 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
if (node->opType == OP_TYPE_JSON_GET_VALUE) {
return code;
}
+ if ((node->pLeft != NULL && nodeType(node->pLeft) == QUERY_NODE_COLUMN) &&
+ (node->pRight != NULL && nodeType(node->pRight) == QUERY_NODE_VALUE)) {
+ SColumnNode *cn = (SColumnNode *)(node->pLeft);
+ if (cn->node.resType.type == TSDB_DATA_TYPE_JSON) {
+ SIF_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
+ }
+ }
SIFParam *paramList = taosMemoryCalloc(nParam, sizeof(SIFParam));
if (NULL == paramList) {
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index 9390d129df4f536070320246555d690ab8b4972c..83bccbffb4b973fe3a4b720219ab0bb91d6f05b6 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -545,6 +545,7 @@ static int32_t physiSysTableScanCopy(const SSystemTableScanPhysiNode* pSrc, SSys
COPY_OBJECT_FIELD(mgmtEpSet, sizeof(SEpSet));
COPY_SCALAR_FIELD(showRewrite);
COPY_SCALAR_FIELD(accountId);
+ COPY_SCALAR_FIELD(sysInfo);
return TSDB_CODE_SUCCESS;
}
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index 0f32001c476c2e98465a0ce3f07fb705c3f53244..822bdec365e6f5128d7c36cf6b7d765eeb2488de 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -1654,6 +1654,7 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
static const char* jkSysTableScanPhysiPlanMnodeEpSet = "MnodeEpSet";
static const char* jkSysTableScanPhysiPlanShowRewrite = "ShowRewrite";
static const char* jkSysTableScanPhysiPlanAccountId = "AccountId";
+static const char* jkSysTableScanPhysiPlanSysInfo = "SysInfo";
static int32_t physiSysTableScanNodeToJson(const void* pObj, SJson* pJson) {
const SSystemTableScanPhysiNode* pNode = (const SSystemTableScanPhysiNode*)pObj;
@@ -1668,6 +1669,9 @@ static int32_t physiSysTableScanNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkSysTableScanPhysiPlanAccountId, pNode->accountId);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkSysTableScanPhysiPlanSysInfo, pNode->sysInfo);
+ }
return code;
}
@@ -1684,7 +1688,9 @@ static int32_t jsonToPhysiSysTableScanNode(const SJson* pJson, void* pObj) {
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkSysTableScanPhysiPlanAccountId, pNode->accountId, code);
- ;
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkSysTableScanPhysiPlanSysInfo, &pNode->sysInfo);
}
return code;
diff --git a/source/libs/nodes/src/nodesToSQLFuncs.c b/source/libs/nodes/src/nodesToSQLFuncs.c
index e521c57c3d80eac9455ab9affa5a4b053983ef84..9325d0288636ca7e22fe4fdd3a8e50ff90cdf0de 100644
--- a/source/libs/nodes/src/nodesToSQLFuncs.c
+++ b/source/libs/nodes/src/nodesToSQLFuncs.c
@@ -135,7 +135,12 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) {
NODES_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
}
- *len += snprintf(buf + *len, bufSize - *len, "%s", t);
+ int32_t tlen = strlen(t);
+ if (tlen > 32) {
+ *len += snprintf(buf + *len, bufSize - *len, "%.*s...%s", 32, t, t + tlen - 1);
+ } else {
+ *len += snprintf(buf + *len, bufSize - *len, "%s", t);
+ }
taosMemoryFree(t);
return TSDB_CODE_SUCCESS;
@@ -199,12 +204,17 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) {
SNodeListNode *pListNode = (SNodeListNode *)pNode;
SNode *node = NULL;
bool first = true;
+ int32_t num = 0;
*len += snprintf(buf + *len, bufSize - *len, "(");
FOREACH(node, pListNode->pNodeList) {
if (!first) {
*len += snprintf(buf + *len, bufSize - *len, ", ");
+ if (++num >= 10) {
+ *len += snprintf(buf + *len, bufSize - *len, "...");
+ break;
+ }
}
NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len));
first = false;
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index 56e68d8374518ab7494371151513c099bc37ab80..9bff061d02fbfa8d5795dff82c9ec93b7093f96d 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -495,12 +495,9 @@ bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B).
/************************************************ create/drop stream **************************************************/
cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A)
- stream_options(B) into_opt(C) AS query_expression(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, C, B, D); }
+ stream_options(B) INTO full_table_name(C) AS query_expression(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, C, B, D); }
cmd ::= DROP STREAM exists_opt(A) stream_name(B). { pCxt->pRootNode = createDropStreamStmt(pCxt, A, &B); }
-into_opt(A) ::= . { A = NULL; }
-into_opt(A) ::= INTO full_table_name(B). { A = B; }
-
stream_options(A) ::= . { A = createStreamOptions(pCxt); }
stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; }
stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; }
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index ffa7729745021be10cfc22aa66dab7f7b3abccb3..82b5842663a824b08553da9ac3b1044a19ad3ef6 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -464,6 +464,9 @@ static int32_t collectMetaKeyFromShowCreateTable(SCollectMetaKeyCxt* pCxt, SShow
if (TSDB_CODE_SUCCESS == code) {
code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = reserveUserAuthInCacheExt(pCxt->pParseCxt->pUser, &name, AUTH_TYPE_READ, pCxt->pMetaCache);
+ }
return code;
}
diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c
index befc822808c7b50eeaea5753a61bb10ffef81523..d9a5761d99b7f04d5f2d4d9604ceee3faf76a896 100644
--- a/source/libs/parser/src/parAuthenticator.c
+++ b/source/libs/parser/src/parAuthenticator.c
@@ -96,6 +96,10 @@ static int32_t authInsert(SAuthCxt* pCxt, SInsertStmt* pInsert) {
return code;
}
+static int32_t authShowCreateTable(SAuthCxt* pCxt, SShowCreateTableStmt* pStmt) {
+ return checkAuth(pCxt, pStmt->dbName, AUTH_TYPE_READ);
+}
+
static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
switch (nodeType(pStmt)) {
case QUERY_NODE_SET_OPERATOR:
@@ -108,6 +112,24 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
return authDelete(pCxt, (SDeleteStmt*)pStmt);
case QUERY_NODE_INSERT_STMT:
return authInsert(pCxt, (SInsertStmt*)pStmt);
+ case QUERY_NODE_SHOW_DNODES_STMT:
+ case QUERY_NODE_SHOW_MNODES_STMT:
+ case QUERY_NODE_SHOW_MODULES_STMT:
+ case QUERY_NODE_SHOW_QNODES_STMT:
+ case QUERY_NODE_SHOW_SNODES_STMT:
+ case QUERY_NODE_SHOW_BNODES_STMT:
+ case QUERY_NODE_SHOW_CLUSTER_STMT:
+ case QUERY_NODE_SHOW_LICENCES_STMT:
+ case QUERY_NODE_SHOW_VGROUPS_STMT:
+ case QUERY_NODE_SHOW_VARIABLES_STMT:
+ case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
+ case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
+ case QUERY_NODE_SHOW_VNODES_STMT:
+ case QUERY_NODE_SHOW_SCORES_STMT:
+ return !pCxt->pParseCxt->enableSysInfo ? TSDB_CODE_PAR_PERMISSION_DENIED : TSDB_CODE_SUCCESS;
+ case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
+ case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
+ return authShowCreateTable(pCxt, (SShowCreateTableStmt*)pStmt);
default:
break;
}
diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c
index de9f8156187514fe27020beec1e641e132d3cfff..c9115d90e18a73ff6328e877eaddfeb0e2c72b36 100644
--- a/source/libs/parser/src/parInsert.c
+++ b/source/libs/parser/src/parInsert.c
@@ -125,6 +125,37 @@ static int32_t skipInsertInto(char** pSql, SMsgBuf* pMsg) {
return TSDB_CODE_SUCCESS;
}
+static char* tableNameGetPosition(SToken* pToken, char target) {
+ bool inEscape = false;
+ bool inQuote = false;
+ char quotaStr = 0;
+
+ for (uint32_t i = 0; i < pToken->n; ++i) {
+ if (*(pToken->z + i) == target && (!inEscape) && (!inQuote)) {
+ return pToken->z + i;
+ }
+
+ if (*(pToken->z + i) == TS_ESCAPE_CHAR) {
+ if (!inQuote) {
+ inEscape = !inEscape;
+ }
+ }
+
+ if (*(pToken->z + i) == '\'' || *(pToken->z + i) == '"') {
+ if (!inEscape) {
+ if (!inQuote) {
+ quotaStr = *(pToken->z + i);
+ inQuote = !inQuote;
+ } else if (quotaStr == *(pToken->z + i)) {
+ inQuote = !inQuote;
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, const char* dbName, SMsgBuf* pMsgBuf) {
const char* msg1 = "name too long";
const char* msg2 = "invalid database name";
@@ -132,7 +163,7 @@ static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, con
const char* msg4 = "invalid table name";
int32_t code = TSDB_CODE_SUCCESS;
- char* p = strnchr(pTableName->z, TS_PATH_DELIMITER[0], pTableName->n, true);
+ char* p = tableNameGetPosition(pTableName, TS_PATH_DELIMITER[0]);
if (p != NULL) { // db has been specified in sql string so we ignore current db path
assert(*p == TS_PATH_DELIMITER[0]);
@@ -1684,16 +1715,24 @@ static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt) {
}
static int32_t collectTableMetaKey(SInsertParseSyntaxCxt* pCxt, bool isStable, int32_t tableNo, SToken* pTbToken) {
- SName name;
+ SName name = {0};
CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
CHECK_CODE(reserveTableMetaInCacheForInsert(&name, isStable ? CATALOG_REQ_TYPE_META : CATALOG_REQ_TYPE_BOTH, tableNo,
pCxt->pMetaCache));
return TSDB_CODE_SUCCESS;
}
+static int32_t checkTableName(const char* pTableName, SMsgBuf* pMsgBuf) {
+ if (NULL != strchr(pTableName, '.')) {
+ return generateSyntaxErrMsgExt(pMsgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, "The table name cannot contain '.'");
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t collectAutoCreateTableMetaKey(SInsertParseSyntaxCxt* pCxt, int32_t tableNo, SToken* pTbToken) {
- SName name;
+ SName name = {0};
CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
+ CHECK_CODE(checkTableName(name.tname, &pCxt->msg));
CHECK_CODE(reserveTableMetaInCacheForInsert(&name, CATALOG_REQ_TYPE_VGROUP, tableNo, pCxt->pMetaCache));
return TSDB_CODE_SUCCESS;
}
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 09847feb4db8842a908a536b404371a76a0858eb..5a32c87fc3da2f2c1eaa7760ed2fa05fdb560e1f 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -784,6 +784,9 @@ static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* p
int32_t nums = pMeta->tableInfo.numOfColumns +
(igTags ? 0 : ((TSDB_SUPER_TABLE == pMeta->tableType) ? pMeta->tableInfo.numOfTags : 0));
for (int32_t i = 0; i < nums; ++i) {
+ if (invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) {
+ continue;
+ }
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY);
@@ -826,7 +829,8 @@ static int32_t findAndSetColumn(STranslateContext* pCxt, SColumnNode** pColRef,
}
int32_t nums = pMeta->tableInfo.numOfTags + pMeta->tableInfo.numOfColumns;
for (int32_t i = 0; i < nums; ++i) {
- if (0 == strcmp(pCol->colName, pMeta->schema[i].name)) {
+ if (0 == strcmp(pCol->colName, pMeta->schema[i].name) &&
+ !invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) {
setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, (i - pMeta->tableInfo.numOfColumns), pCol);
*pFound = true;
break;
@@ -2192,14 +2196,14 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
code = setTableCacheLastMode(pCxt, &name, pRealTable);
}
}
- pRealTable->table.precision = pRealTable->pMeta->tableInfo.precision;
- pRealTable->table.singleTable = isSingleTable(pRealTable);
if (TSDB_CODE_SUCCESS == code) {
+ pRealTable->table.precision = pRealTable->pMeta->tableInfo.precision;
+ pRealTable->table.singleTable = isSingleTable(pRealTable);
+ if (TSDB_SUPER_TABLE == pRealTable->pMeta->tableType) {
+ pCxt->stableQuery = true;
+ }
code = addNamespace(pCxt, pRealTable);
}
- if (TSDB_SUPER_TABLE == pRealTable->pMeta->tableType) {
- pCxt->stableQuery = true;
- }
break;
}
case QUERY_NODE_TEMP_TABLE: {
@@ -2594,8 +2598,12 @@ static int32_t getQueryTimeRange(STranslateContext* pCxt, SNode* pWhere, STimeWi
return code;
}
-static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode* pInterval) {
+static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode* pInterval, bool isInterpFill) {
if (FILL_MODE_NONE == pFill->mode) {
+ if (isInterpFill) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "Unsupported fill type");
+ }
+
return TSDB_CODE_SUCCESS;
}
@@ -2635,7 +2643,7 @@ static int32_t translateFill(STranslateContext* pCxt, SSelectStmt* pSelect, SInt
}
((SFillNode*)pInterval->pFill)->timeRange = pSelect->timeRange;
- return checkFill(pCxt, (SFillNode*)pInterval->pFill, (SValueNode*)pInterval->pInterval);
+ return checkFill(pCxt, (SFillNode*)pInterval->pFill, (SValueNode*)pInterval->pInterval, false);
}
static int64_t getMonthsFromTimeVal(int64_t val, int32_t fromPrecision, char unit) {
@@ -2864,7 +2872,7 @@ static int32_t translateInterpFill(STranslateContext* pCxt, SSelectStmt* pSelect
code = getQueryTimeRange(pCxt, pSelect->pRange, &(((SFillNode*)pSelect->pFill)->timeRange));
}
if (TSDB_CODE_SUCCESS == code) {
- code = checkFill(pCxt, (SFillNode*)pSelect->pFill, (SValueNode*)pSelect->pEvery);
+ code = checkFill(pCxt, (SFillNode*)pSelect->pFill, (SValueNode*)pSelect->pEvery, true);
}
return code;
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index c820e955d78dc9439499d21645c2456884edb318..c4bd1aff044a491edede232eff74b8dea1feeadb 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 427
+#define YYNOCODE 426
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- SAlterOption yy95;
- EOperatorType yy198;
- EOrder yy204;
- int8_t yy215;
- ENullOrder yy277;
- bool yy313;
- int64_t yy473;
- SNodeList* yy544;
- SToken yy617;
- EJoinType yy708;
- SDataType yy784;
- EFillMode yy816;
- SNode* yy840;
- int32_t yy844;
+ SAlterOption yy5;
+ int8_t yy59;
+ int64_t yy69;
+ EJoinType yy156;
+ SNodeList* yy172;
+ EFillMode yy186;
+ SToken yy209;
+ int32_t yy232;
+ SNode* yy272;
+ bool yy293;
+ EOperatorType yy392;
+ ENullOrder yy493;
+ SDataType yy616;
+ EOrder yy818;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -140,16 +140,16 @@ typedef union {
#define ParseCTX_STORE
#define YYFALLBACK 1
#define YYNSTATE 667
-#define YYNRULE 491
+#define YYNRULE 489
#define YYNTOKEN 305
#define YY_MAX_SHIFT 666
-#define YY_MIN_SHIFTREDUCE 973
-#define YY_MAX_SHIFTREDUCE 1463
-#define YY_ERROR_ACTION 1464
-#define YY_ACCEPT_ACTION 1465
-#define YY_NO_ACTION 1466
-#define YY_MIN_REDUCE 1467
-#define YY_MAX_REDUCE 1957
+#define YY_MIN_SHIFTREDUCE 972
+#define YY_MAX_SHIFTREDUCE 1460
+#define YY_ERROR_ACTION 1461
+#define YY_ACCEPT_ACTION 1462
+#define YY_NO_ACTION 1463
+#define YY_MIN_REDUCE 1464
+#define YY_MAX_REDUCE 1952
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,694 +216,650 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2548)
+#define YY_ACTTAB_COUNT (2259)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 526, 30, 261, 526, 549, 433, 526, 434, 1502, 11,
- /* 10 */ 10, 117, 39, 37, 55, 1653, 1654, 117, 471, 378,
- /* 20 */ 339, 1468, 1264, 1006, 476, 1023, 1290, 1022, 1607, 1791,
- /* 30 */ 1598, 1607, 127, 1340, 1607, 1262, 441, 552, 434, 1502,
- /* 40 */ 469, 1775, 107, 1779, 1290, 106, 105, 104, 103, 102,
- /* 50 */ 101, 100, 99, 98, 1775, 1024, 1335, 1809, 150, 64,
- /* 60 */ 1935, 14, 1567, 1010, 1011, 553, 1771, 1777, 1270, 450,
- /* 70 */ 1761, 125, 577, 165, 39, 37, 1403, 1932, 571, 1771,
- /* 80 */ 1777, 328, 339, 1529, 1264, 551, 161, 1877, 1878, 1,
- /* 90 */ 1882, 571, 1659, 479, 478, 1340, 1823, 1262, 1376, 327,
- /* 100 */ 95, 1792, 580, 1794, 1795, 576, 496, 571, 1657, 344,
- /* 110 */ 1869, 663, 1652, 1654, 330, 1865, 160, 513, 1335, 494,
- /* 120 */ 1935, 492, 1289, 14, 325, 1342, 1343, 1705, 164, 543,
- /* 130 */ 1270, 1161, 1162, 1934, 33, 32, 1895, 1932, 40, 38,
- /* 140 */ 36, 35, 34, 148, 63, 1479, 640, 639, 638, 637,
+ /* 0 */ 433, 1930, 434, 1499, 1593, 441, 526, 434, 1499, 513,
+ /* 10 */ 30, 260, 39, 37, 1929, 326, 325, 117, 1927, 1702,
+ /* 20 */ 339, 1465, 1261, 146, 471, 40, 38, 36, 35, 34,
+ /* 30 */ 1786, 552, 1606, 1337, 1604, 1259, 344, 552, 1287, 1649,
+ /* 40 */ 1651, 378, 107, 1774, 526, 106, 105, 104, 103, 102,
+ /* 50 */ 101, 100, 99, 98, 1770, 117, 1332, 432, 1804, 64,
+ /* 60 */ 436, 14, 476, 36, 35, 34, 553, 148, 1267, 1476,
+ /* 70 */ 450, 1756, 1604, 577, 39, 37, 1400, 1595, 1766, 1772,
+ /* 80 */ 328, 1930, 339, 1526, 1261, 1804, 217, 1286, 1770, 1,
+ /* 90 */ 571, 1005, 1656, 542, 164, 1337, 1818, 1259, 1927, 327,
+ /* 100 */ 95, 1787, 580, 1789, 1790, 576, 43, 571, 1654, 158,
+ /* 110 */ 1864, 663, 1766, 1772, 330, 1860, 159, 513, 1332, 63,
+ /* 120 */ 1930, 78, 1643, 14, 571, 1339, 1340, 1703, 163, 541,
+ /* 130 */ 1267, 1009, 1010, 165, 33, 32, 1890, 1927, 40, 38,
+ /* 140 */ 36, 35, 34, 543, 63, 63, 640, 639, 638, 637,
/* 150 */ 349, 2, 636, 635, 128, 630, 629, 628, 627, 626,
/* 160 */ 625, 624, 139, 620, 619, 618, 348, 347, 615, 614,
- /* 170 */ 1265, 107, 1263, 663, 106, 105, 104, 103, 102, 101,
- /* 180 */ 100, 99, 98, 1809, 36, 35, 34, 1342, 1343, 224,
- /* 190 */ 225, 542, 384, 1268, 1269, 613, 1317, 1318, 1320, 1321,
- /* 200 */ 1322, 1323, 1324, 1325, 573, 569, 1333, 1334, 1336, 1337,
- /* 210 */ 1338, 1339, 1341, 1344, 1467, 1288, 1434, 33, 32, 482,
- /* 220 */ 481, 40, 38, 36, 35, 34, 123, 168, 541, 303,
- /* 230 */ 1465, 223, 1265, 84, 1263, 1264, 477, 480, 116, 115,
- /* 240 */ 114, 113, 112, 111, 110, 109, 108, 305, 1262, 1023,
- /* 250 */ 516, 1022, 22, 174, 1600, 1268, 1269, 1490, 1317, 1318,
- /* 260 */ 1320, 1321, 1322, 1323, 1324, 1325, 573, 569, 1333, 1334,
- /* 270 */ 1336, 1337, 1338, 1339, 1341, 1344, 39, 37, 1489, 1024,
- /* 280 */ 538, 1270, 168, 526, 339, 71, 1264, 1488, 70, 354,
- /* 290 */ 1244, 1245, 1708, 1791, 170, 211, 512, 1340, 1761, 1262,
- /* 300 */ 1119, 602, 601, 600, 1123, 599, 1125, 1126, 598, 1128,
- /* 310 */ 595, 1607, 1134, 592, 1136, 1137, 589, 586, 1935, 1761,
- /* 320 */ 1335, 1809, 1584, 1270, 663, 14, 1659, 1935, 1761, 553,
- /* 330 */ 1935, 166, 1270, 343, 1761, 1932, 577, 1935, 39, 37,
- /* 340 */ 1933, 487, 1657, 165, 1932, 552, 339, 1932, 1264, 549,
- /* 350 */ 165, 76, 305, 2, 1932, 516, 497, 544, 539, 1340,
- /* 360 */ 1823, 1262, 1698, 159, 95, 1792, 580, 1794, 1795, 576,
- /* 370 */ 210, 571, 63, 173, 1869, 663, 1646, 127, 330, 1865,
- /* 380 */ 160, 552, 1335, 1265, 490, 1263, 419, 605, 484, 1342,
- /* 390 */ 1343, 33, 32, 209, 1270, 40, 38, 36, 35, 34,
- /* 400 */ 1896, 634, 632, 39, 37, 1345, 1268, 1269, 1487, 91,
- /* 410 */ 622, 339, 1791, 1264, 42, 8, 125, 40, 38, 36,
- /* 420 */ 35, 34, 124, 611, 1340, 58, 1262, 1596, 57, 49,
- /* 430 */ 1599, 162, 1877, 1878, 1265, 1882, 1263, 663, 178, 177,
- /* 440 */ 1809, 352, 137, 136, 608, 607, 606, 1335, 575, 1761,
- /* 450 */ 43, 1342, 1343, 1761, 316, 577, 1486, 1268, 1269, 1270,
- /* 460 */ 1317, 1318, 1320, 1321, 1322, 1323, 1324, 1325, 573, 569,
- /* 470 */ 1333, 1334, 1336, 1337, 1338, 1339, 1341, 1344, 63, 1823,
- /* 480 */ 9, 74, 1935, 294, 1792, 580, 1794, 1795, 576, 574,
- /* 490 */ 571, 568, 1841, 1289, 122, 165, 1265, 1761, 1263, 1932,
- /* 500 */ 33, 32, 663, 1602, 40, 38, 36, 35, 34, 317,
- /* 510 */ 168, 315, 314, 1485, 473, 351, 1342, 1343, 475, 1268,
- /* 520 */ 1269, 1291, 1317, 1318, 1320, 1321, 1322, 1323, 1324, 1325,
- /* 530 */ 573, 569, 1333, 1334, 1336, 1337, 1338, 1339, 1341, 1344,
- /* 540 */ 474, 1010, 1011, 33, 32, 1460, 1364, 40, 38, 36,
- /* 550 */ 35, 34, 168, 168, 1761, 526, 1935, 1592, 377, 146,
- /* 560 */ 376, 1265, 63, 1263, 26, 1532, 382, 168, 1610, 165,
- /* 570 */ 33, 32, 217, 1932, 40, 38, 36, 35, 34, 218,
- /* 580 */ 1484, 1791, 1414, 1607, 1268, 1269, 1594, 1317, 1318, 1320,
- /* 590 */ 1321, 1322, 1323, 1324, 1325, 573, 569, 1333, 1334, 1336,
- /* 600 */ 1337, 1338, 1339, 1341, 1344, 39, 37, 77, 27, 1809,
- /* 610 */ 498, 1884, 63, 339, 78, 1264, 168, 578, 1369, 1483,
- /* 620 */ 505, 1761, 1761, 373, 577, 1302, 1340, 28, 1262, 482,
- /* 630 */ 481, 1482, 1459, 33, 32, 1881, 123, 40, 38, 36,
- /* 640 */ 35, 34, 375, 371, 438, 1590, 477, 480, 1823, 1335,
- /* 650 */ 1287, 1935, 96, 1792, 580, 1794, 1795, 576, 253, 571,
- /* 660 */ 1761, 1270, 1869, 513, 165, 1481, 1868, 1865, 1932, 1081,
- /* 670 */ 33, 32, 1761, 1706, 40, 38, 36, 35, 34, 666,
- /* 680 */ 33, 32, 9, 526, 40, 38, 36, 35, 34, 1478,
- /* 690 */ 1477, 33, 32, 268, 383, 40, 38, 36, 35, 34,
- /* 700 */ 168, 1704, 1083, 300, 663, 432, 1761, 157, 436, 1698,
- /* 710 */ 214, 1607, 656, 652, 648, 644, 266, 1582, 1342, 1343,
- /* 720 */ 176, 33, 32, 307, 572, 40, 38, 36, 35, 34,
- /* 730 */ 1761, 1761, 39, 37, 526, 604, 526, 302, 1476, 1287,
- /* 740 */ 339, 549, 1264, 526, 307, 389, 412, 404, 92, 424,
- /* 750 */ 168, 231, 1302, 1340, 405, 1262, 440, 1585, 74, 436,
- /* 760 */ 1362, 1407, 1607, 1265, 1607, 1263, 397, 1289, 425, 127,
- /* 770 */ 399, 1607, 1475, 1703, 1779, 300, 1335, 1889, 1396, 1761,
- /* 780 */ 1603, 1362, 44, 4, 523, 1775, 1268, 1269, 1270, 1317,
- /* 790 */ 1318, 1320, 1321, 1322, 1323, 1324, 1325, 573, 569, 1333,
- /* 800 */ 1334, 1336, 1337, 1338, 1339, 1341, 1344, 390, 125, 2,
- /* 810 */ 1771, 1777, 334, 1761, 1363, 7, 220, 450, 611, 386,
- /* 820 */ 90, 526, 571, 163, 1877, 1878, 1659, 1882, 1424, 145,
- /* 830 */ 87, 663, 448, 312, 1236, 1363, 213, 137, 136, 608,
- /* 840 */ 607, 606, 1657, 1480, 1884, 1342, 1343, 423, 1474, 1607,
+ /* 170 */ 1262, 107, 1260, 663, 106, 105, 104, 103, 102, 101,
+ /* 180 */ 100, 99, 98, 440, 1775, 1287, 436, 1339, 1340, 223,
+ /* 190 */ 224, 11, 10, 1265, 1266, 1770, 1314, 1315, 1317, 1318,
+ /* 200 */ 1319, 1320, 1321, 1322, 573, 569, 1330, 1331, 1333, 1334,
+ /* 210 */ 1335, 1336, 1338, 1341, 1464, 496, 1431, 33, 32, 1766,
+ /* 220 */ 1772, 40, 38, 36, 35, 34, 526, 167, 494, 150,
+ /* 230 */ 492, 571, 1262, 1564, 1260, 1261, 210, 55, 116, 115,
+ /* 240 */ 114, 113, 112, 111, 110, 109, 108, 305, 1259, 63,
+ /* 250 */ 516, 1701, 22, 300, 1604, 1265, 1266, 167, 1314, 1315,
+ /* 260 */ 1317, 1318, 1319, 1320, 1321, 1322, 573, 569, 1330, 1331,
+ /* 270 */ 1333, 1334, 1335, 1336, 1338, 1341, 39, 37, 1650, 1651,
+ /* 280 */ 1373, 1267, 167, 167, 339, 552, 1261, 613, 1286, 49,
+ /* 290 */ 1160, 1161, 76, 305, 1786, 1487, 516, 1337, 1421, 1259,
+ /* 300 */ 1118, 602, 601, 600, 1122, 599, 1124, 1125, 598, 1127,
+ /* 310 */ 595, 342, 1133, 592, 1135, 1136, 589, 586, 1285, 146,
+ /* 320 */ 1332, 1581, 1804, 173, 663, 14, 479, 478, 1606, 377,
+ /* 330 */ 553, 376, 1267, 1656, 1930, 1756, 1756, 577, 39, 37,
+ /* 340 */ 312, 535, 1419, 1420, 1422, 1423, 339, 1928, 1261, 1654,
+ /* 350 */ 1705, 1927, 84, 2, 42, 71, 1656, 63, 70, 1337,
+ /* 360 */ 1818, 1259, 1267, 343, 95, 1787, 580, 1789, 1790, 576,
+ /* 370 */ 605, 571, 1654, 1597, 1864, 663, 345, 1589, 330, 1860,
+ /* 380 */ 159, 1288, 1332, 1262, 146, 1260, 1022, 167, 1021, 1339,
+ /* 390 */ 1340, 33, 32, 1606, 1267, 40, 38, 36, 35, 34,
+ /* 400 */ 1891, 1930, 384, 39, 37, 1342, 1265, 1266, 1486, 1485,
+ /* 410 */ 611, 339, 1786, 1261, 165, 8, 1023, 438, 1927, 634,
+ /* 420 */ 632, 1080, 611, 1284, 1337, 622, 1259, 167, 549, 137,
+ /* 430 */ 136, 608, 607, 606, 1262, 1695, 1260, 663, 1484, 303,
+ /* 440 */ 1804, 137, 136, 608, 607, 606, 172, 1332, 575, 1756,
+ /* 450 */ 1756, 1339, 1340, 1756, 1082, 577, 127, 1265, 1266, 1267,
+ /* 460 */ 1314, 1315, 1317, 1318, 1319, 1320, 1321, 1322, 573, 569,
+ /* 470 */ 1330, 1331, 1333, 1334, 1335, 1336, 1338, 1341, 1818, 1756,
+ /* 480 */ 9, 1591, 293, 1787, 580, 1789, 1790, 576, 574, 571,
+ /* 490 */ 568, 1836, 167, 74, 125, 167, 1262, 222, 1260, 33,
+ /* 500 */ 32, 1529, 663, 40, 38, 36, 35, 34, 551, 160,
+ /* 510 */ 1872, 1873, 1587, 1877, 1483, 1600, 1339, 1340, 252, 1265,
+ /* 520 */ 1266, 1579, 1314, 1315, 1317, 1318, 1319, 1320, 1321, 1322,
+ /* 530 */ 573, 569, 1330, 1331, 1333, 1334, 1335, 1336, 1338, 1341,
+ /* 540 */ 1700, 526, 300, 33, 32, 1457, 91, 40, 38, 36,
+ /* 550 */ 35, 34, 169, 167, 316, 1756, 1241, 1242, 623, 124,
+ /* 560 */ 1576, 1262, 1879, 1260, 26, 482, 481, 1596, 1462, 1604,
+ /* 570 */ 33, 32, 123, 1582, 40, 38, 36, 35, 34, 213,
+ /* 580 */ 1786, 1411, 477, 480, 1265, 1266, 1876, 1314, 1315, 1317,
+ /* 590 */ 1318, 1319, 1320, 1321, 1322, 573, 569, 1330, 1331, 1333,
+ /* 600 */ 1334, 1335, 1336, 1338, 1341, 39, 37, 475, 1804, 317,
+ /* 610 */ 146, 315, 314, 339, 473, 1261, 578, 1361, 475, 1607,
+ /* 620 */ 549, 1756, 611, 577, 28, 1299, 1337, 354, 1259, 474,
+ /* 630 */ 33, 32, 1456, 450, 40, 38, 36, 35, 34, 538,
+ /* 640 */ 474, 137, 136, 608, 607, 606, 1818, 1695, 127, 1332,
+ /* 650 */ 96, 1787, 580, 1789, 1790, 576, 572, 571, 175, 74,
+ /* 660 */ 1864, 1267, 526, 609, 1863, 1860, 1647, 1930, 554, 512,
+ /* 670 */ 33, 32, 122, 382, 40, 38, 36, 35, 34, 27,
+ /* 680 */ 164, 1599, 9, 1482, 1927, 1022, 125, 1021, 7, 1366,
+ /* 690 */ 1604, 33, 32, 1481, 1565, 40, 38, 36, 35, 34,
+ /* 700 */ 469, 250, 1872, 548, 663, 547, 33, 32, 1930, 1930,
+ /* 710 */ 40, 38, 36, 35, 34, 1023, 544, 539, 1339, 1340,
+ /* 720 */ 526, 166, 164, 307, 1756, 1927, 1927, 135, 487, 1404,
+ /* 730 */ 526, 383, 39, 37, 1756, 1286, 1480, 302, 1879, 1284,
+ /* 740 */ 339, 389, 1261, 497, 307, 526, 412, 604, 1604, 424,
+ /* 750 */ 526, 549, 1299, 1337, 1477, 1259, 404, 209, 1604, 61,
+ /* 760 */ 1359, 405, 1875, 1262, 373, 1260, 397, 1479, 425, 1478,
+ /* 770 */ 399, 490, 255, 1604, 54, 484, 1332, 1756, 1604, 127,
+ /* 780 */ 208, 1359, 1475, 375, 371, 419, 1265, 1266, 1267, 1314,
+ /* 790 */ 1315, 1317, 1318, 1319, 1320, 1321, 1322, 573, 569, 1330,
+ /* 800 */ 1331, 1333, 1334, 1335, 1336, 1338, 1341, 390, 1756, 2,
+ /* 810 */ 1756, 1397, 58, 526, 1360, 57, 1879, 125, 505, 386,
+ /* 820 */ 1289, 33, 32, 1756, 448, 40, 38, 36, 35, 34,
+ /* 830 */ 1474, 663, 161, 1872, 1873, 1360, 1877, 177, 176, 1505,
+ /* 840 */ 1874, 1604, 1347, 1009, 1010, 1339, 1340, 423, 1286, 1580,
/* 850 */ 418, 417, 416, 415, 414, 411, 410, 409, 408, 407,
- /* 860 */ 403, 402, 401, 400, 394, 393, 392, 391, 1880, 388,
- /* 870 */ 387, 535, 1422, 1423, 1425, 1426, 29, 337, 1357, 1358,
- /* 880 */ 1359, 1360, 1361, 1365, 1366, 1367, 1368, 1350, 61, 1761,
- /* 890 */ 1265, 609, 1263, 1289, 1650, 1935, 1400, 29, 337, 1357,
- /* 900 */ 1358, 1359, 1360, 1361, 1365, 1366, 1367, 1368, 166, 1583,
- /* 910 */ 1791, 1473, 1932, 1268, 1269, 1472, 1317, 1318, 1320, 1321,
- /* 920 */ 1322, 1323, 1324, 1325, 573, 569, 1333, 1334, 1336, 1337,
- /* 930 */ 1338, 1339, 1341, 1344, 623, 147, 1579, 1791, 1809, 526,
- /* 940 */ 279, 611, 610, 256, 1319, 1650, 578, 1884, 1471, 1470,
- /* 950 */ 449, 1761, 1761, 577, 277, 60, 1761, 475, 59, 1292,
- /* 960 */ 137, 136, 608, 607, 606, 1809, 554, 1607, 1289, 613,
- /* 970 */ 1568, 1879, 135, 578, 181, 429, 427, 1823, 1761, 474,
- /* 980 */ 577, 94, 1792, 580, 1794, 1795, 576, 536, 571, 1761,
- /* 990 */ 1761, 1869, 1780, 554, 468, 306, 1865, 273, 53, 509,
- /* 1000 */ 1637, 1659, 1396, 1775, 1823, 526, 63, 1935, 94, 1792,
- /* 1010 */ 580, 1794, 1795, 576, 526, 571, 1604, 1658, 1869, 54,
- /* 1020 */ 167, 1748, 306, 1865, 1932, 1736, 1519, 202, 1771, 1777,
- /* 1030 */ 200, 336, 335, 1607, 1935, 1462, 1463, 558, 526, 526,
- /* 1040 */ 571, 1278, 1607, 1273, 93, 526, 526, 165, 483, 506,
- /* 1050 */ 510, 1932, 1340, 561, 1271, 326, 228, 522, 526, 204,
- /* 1060 */ 526, 1791, 203, 146, 499, 526, 1607, 1607, 361, 524,
- /* 1070 */ 1319, 525, 1609, 1607, 1607, 1335, 262, 41, 222, 68,
- /* 1080 */ 67, 381, 342, 526, 172, 1272, 1607, 1270, 1607, 1809,
- /* 1090 */ 146, 131, 245, 1607, 346, 206, 233, 578, 205, 1609,
- /* 1100 */ 301, 567, 1761, 369, 577, 367, 363, 359, 356, 353,
- /* 1110 */ 345, 1607, 1782, 208, 134, 135, 207, 1810, 146, 1514,
- /* 1120 */ 1399, 1512, 51, 1791, 1213, 226, 237, 1609, 1823, 556,
- /* 1130 */ 566, 51, 95, 1792, 580, 1794, 1795, 576, 519, 571,
- /* 1140 */ 41, 485, 1869, 488, 168, 1319, 330, 1865, 1948, 11,
- /* 1150 */ 10, 1809, 616, 41, 617, 1784, 350, 1903, 584, 578,
- /* 1160 */ 134, 230, 1112, 1503, 1761, 1647, 577, 135, 119, 1421,
- /* 1170 */ 134, 1899, 550, 240, 1069, 1791, 1067, 255, 1370, 250,
- /* 1180 */ 1276, 258, 260, 3, 5, 355, 313, 1326, 1050, 1279,
- /* 1190 */ 1823, 1274, 360, 1229, 95, 1792, 580, 1794, 1795, 576,
- /* 1200 */ 272, 571, 269, 1809, 1869, 1140, 1508, 1144, 330, 1865,
- /* 1210 */ 1948, 578, 1282, 1284, 1151, 1149, 1761, 138, 577, 1926,
- /* 1220 */ 175, 1051, 1275, 1287, 569, 1333, 1334, 1336, 1337, 1338,
- /* 1230 */ 1339, 1791, 385, 1354, 406, 1700, 413, 421, 420, 1293,
- /* 1240 */ 559, 1791, 1823, 422, 426, 431, 95, 1792, 580, 1794,
- /* 1250 */ 1795, 576, 428, 571, 658, 439, 1869, 430, 562, 1809,
- /* 1260 */ 330, 1865, 1948, 1295, 442, 443, 184, 578, 1294, 1809,
- /* 1270 */ 186, 1888, 1761, 1296, 577, 444, 445, 578, 189, 447,
- /* 1280 */ 191, 72, 1761, 73, 577, 451, 470, 554, 195, 472,
- /* 1290 */ 1791, 304, 1597, 199, 118, 1593, 1741, 554, 1823, 501,
- /* 1300 */ 201, 140, 286, 1792, 580, 1794, 1795, 576, 1823, 571,
- /* 1310 */ 141, 1595, 286, 1792, 580, 1794, 1795, 576, 1809, 571,
- /* 1320 */ 1591, 142, 143, 212, 270, 500, 578, 215, 1935, 507,
- /* 1330 */ 504, 1761, 511, 577, 322, 219, 534, 514, 1935, 132,
- /* 1340 */ 1740, 167, 1710, 520, 517, 1932, 133, 324, 81, 521,
- /* 1350 */ 1791, 165, 1292, 530, 271, 1932, 83, 1823, 1608, 235,
- /* 1360 */ 1791, 96, 1792, 580, 1794, 1795, 576, 1900, 571, 537,
- /* 1370 */ 239, 1869, 532, 1910, 6, 565, 1865, 533, 1809, 546,
- /* 1380 */ 329, 1909, 540, 531, 529, 244, 578, 1891, 1809, 528,
- /* 1390 */ 1396, 1761, 1291, 577, 154, 126, 578, 249, 563, 560,
- /* 1400 */ 246, 1761, 48, 577, 1885, 247, 331, 248, 85, 1791,
- /* 1410 */ 582, 1651, 1580, 265, 274, 659, 660, 1823, 1931, 662,
- /* 1420 */ 52, 149, 1792, 580, 1794, 1795, 576, 1823, 571, 1951,
- /* 1430 */ 153, 96, 1792, 580, 1794, 1795, 576, 1809, 571, 557,
- /* 1440 */ 1755, 1869, 323, 287, 297, 578, 1866, 1850, 296, 254,
- /* 1450 */ 1761, 276, 577, 564, 1754, 278, 257, 259, 65, 1753,
- /* 1460 */ 1791, 1752, 66, 1749, 357, 555, 1949, 358, 1256, 1257,
- /* 1470 */ 171, 362, 1747, 364, 365, 366, 1823, 1746, 1745, 368,
- /* 1480 */ 295, 1792, 580, 1794, 1795, 576, 370, 571, 1809, 1744,
- /* 1490 */ 372, 1743, 374, 527, 1232, 1231, 578, 1721, 1720, 379,
- /* 1500 */ 380, 1761, 1201, 577, 1719, 1718, 1693, 129, 1692, 1691,
- /* 1510 */ 1690, 69, 1791, 1689, 1688, 1687, 1686, 1685, 395, 396,
- /* 1520 */ 1684, 398, 1791, 130, 1669, 1668, 1667, 1823, 1683, 1682,
- /* 1530 */ 1681, 295, 1792, 580, 1794, 1795, 576, 1680, 571, 1791,
- /* 1540 */ 1809, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 578, 1672,
- /* 1550 */ 1809, 1671, 1670, 1761, 1666, 577, 1665, 1664, 578, 1663,
- /* 1560 */ 1203, 1662, 1661, 1761, 1660, 577, 1534, 1809, 179, 1533,
- /* 1570 */ 1531, 1499, 120, 182, 180, 575, 1498, 158, 435, 1823,
- /* 1580 */ 1761, 1013, 577, 290, 1792, 580, 1794, 1795, 576, 1823,
- /* 1590 */ 571, 190, 1012, 149, 1792, 580, 1794, 1795, 576, 1791,
- /* 1600 */ 571, 437, 1734, 183, 121, 1728, 1823, 1717, 1716, 1702,
- /* 1610 */ 294, 1792, 580, 1794, 1795, 576, 1791, 571, 188, 1842,
- /* 1620 */ 1586, 545, 1043, 1530, 1528, 452, 454, 1809, 1526, 453,
- /* 1630 */ 456, 457, 338, 458, 1524, 578, 460, 462, 1950, 461,
- /* 1640 */ 1761, 1522, 577, 465, 1809, 464, 1511, 1510, 1495, 340,
- /* 1650 */ 466, 1588, 578, 1155, 1154, 1587, 50, 1761, 631, 577,
- /* 1660 */ 1080, 1077, 633, 1520, 198, 1076, 1823, 1075, 1515, 1513,
- /* 1670 */ 295, 1792, 580, 1794, 1795, 576, 318, 571, 319, 320,
- /* 1680 */ 486, 1494, 1493, 1823, 1791, 489, 197, 295, 1792, 580,
- /* 1690 */ 1794, 1795, 576, 491, 571, 1492, 493, 495, 97, 1733,
- /* 1700 */ 152, 1238, 1791, 1727, 216, 467, 463, 459, 455, 196,
- /* 1710 */ 56, 502, 1809, 144, 1715, 1713, 1714, 1712, 1711, 221,
- /* 1720 */ 578, 1248, 15, 1709, 227, 1761, 79, 577, 1701, 503,
- /* 1730 */ 1809, 321, 508, 80, 232, 518, 41, 87, 578, 229,
- /* 1740 */ 47, 75, 16, 1761, 194, 577, 243, 242, 82, 25,
- /* 1750 */ 17, 1823, 1436, 23, 234, 280, 1792, 580, 1794, 1795,
- /* 1760 */ 576, 1791, 571, 236, 1418, 515, 238, 1782, 151, 1823,
- /* 1770 */ 1420, 252, 241, 281, 1792, 580, 1794, 1795, 576, 24,
- /* 1780 */ 571, 1413, 1393, 46, 1781, 86, 18, 155, 1392, 1809,
- /* 1790 */ 1448, 1453, 1442, 1447, 332, 1452, 1451, 578, 333, 10,
- /* 1800 */ 45, 1280, 1761, 1330, 577, 1355, 193, 187, 13, 192,
- /* 1810 */ 1791, 19, 1328, 446, 1327, 156, 1826, 169, 570, 31,
- /* 1820 */ 12, 20, 1310, 21, 583, 1141, 341, 1138, 1823, 185,
- /* 1830 */ 587, 1791, 282, 1792, 580, 1794, 1795, 576, 1809, 571,
- /* 1840 */ 585, 588, 581, 1135, 579, 590, 578, 1129, 593, 596,
- /* 1850 */ 1118, 1761, 1127, 577, 591, 594, 597, 1133, 1132, 1809,
- /* 1860 */ 1131, 1130, 88, 89, 263, 603, 1150, 578, 1146, 62,
- /* 1870 */ 1041, 1072, 1761, 612, 577, 1071, 1070, 1823, 1068, 1066,
- /* 1880 */ 1065, 289, 1792, 580, 1794, 1795, 576, 1064, 571, 1791,
- /* 1890 */ 1087, 621, 264, 1062, 1061, 1060, 1059, 1058, 1823, 1791,
- /* 1900 */ 1057, 1056, 291, 1792, 580, 1794, 1795, 576, 1047, 571,
- /* 1910 */ 1084, 1082, 1053, 1052, 1049, 1048, 1046, 1809, 1527, 641,
- /* 1920 */ 1525, 642, 643, 645, 647, 578, 1523, 1809, 649, 646,
- /* 1930 */ 1761, 651, 577, 1521, 650, 578, 653, 655, 654, 1509,
- /* 1940 */ 1761, 657, 577, 1491, 1003, 267, 661, 1466, 1466, 1266,
- /* 1950 */ 275, 1791, 664, 1466, 665, 1466, 1823, 1466, 1466, 1466,
- /* 1960 */ 283, 1792, 580, 1794, 1795, 576, 1823, 571, 1791, 1466,
- /* 1970 */ 292, 1792, 580, 1794, 1795, 576, 1466, 571, 1466, 1809,
- /* 1980 */ 1466, 1466, 1466, 1466, 1466, 1466, 1466, 578, 1466, 1466,
- /* 1990 */ 1466, 1466, 1761, 1466, 577, 1466, 1809, 1466, 1466, 1466,
- /* 2000 */ 1466, 1466, 1466, 1466, 578, 1466, 1466, 1466, 1466, 1761,
- /* 2010 */ 1466, 577, 1466, 1466, 1466, 1466, 1466, 1791, 1823, 1466,
- /* 2020 */ 1466, 1466, 284, 1792, 580, 1794, 1795, 576, 1466, 571,
- /* 2030 */ 1466, 1466, 1466, 1466, 1791, 1823, 1466, 1466, 1466, 293,
- /* 2040 */ 1792, 580, 1794, 1795, 576, 1809, 571, 1466, 1466, 1466,
- /* 2050 */ 1466, 1466, 1466, 578, 1466, 1466, 1466, 1466, 1761, 1466,
- /* 2060 */ 577, 1466, 1809, 1466, 1466, 1466, 1466, 1466, 1466, 1466,
- /* 2070 */ 578, 1466, 1466, 1466, 1466, 1761, 1466, 577, 1466, 1466,
- /* 2080 */ 1466, 1466, 1466, 1791, 1823, 1466, 1466, 1466, 285, 1792,
- /* 2090 */ 580, 1794, 1795, 576, 1466, 571, 1466, 1466, 1466, 1466,
- /* 2100 */ 1466, 1823, 1466, 1466, 1466, 298, 1792, 580, 1794, 1795,
- /* 2110 */ 576, 1809, 571, 1466, 1466, 1466, 1466, 1466, 1466, 578,
- /* 2120 */ 1466, 1466, 1466, 1466, 1761, 1466, 577, 1466, 1466, 1466,
- /* 2130 */ 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1791, 1466, 1466,
- /* 2140 */ 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1791, 1466, 1466,
- /* 2150 */ 1823, 1466, 1466, 1466, 299, 1792, 580, 1794, 1795, 576,
- /* 2160 */ 1466, 571, 1466, 1466, 1466, 1809, 1466, 1466, 1466, 1466,
- /* 2170 */ 1466, 1466, 1466, 578, 1466, 1809, 1466, 1466, 1761, 1466,
- /* 2180 */ 577, 1466, 1466, 578, 1466, 1466, 1466, 1466, 1761, 1466,
- /* 2190 */ 577, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1791, 1466,
- /* 2200 */ 1466, 1466, 1466, 1466, 1823, 1466, 1466, 1466, 1803, 1792,
- /* 2210 */ 580, 1794, 1795, 576, 1823, 571, 1791, 1466, 1802, 1792,
- /* 2220 */ 580, 1794, 1795, 576, 1466, 571, 1809, 1466, 1466, 1466,
- /* 2230 */ 1466, 1466, 1466, 1466, 578, 1466, 1466, 1466, 1466, 1761,
- /* 2240 */ 1466, 577, 1466, 1466, 1809, 1466, 1466, 1466, 1466, 1466,
- /* 2250 */ 1466, 1466, 578, 1466, 1466, 1466, 1466, 1761, 1466, 577,
- /* 2260 */ 1466, 1466, 1466, 1466, 1466, 1823, 1466, 1466, 1466, 1801,
- /* 2270 */ 1792, 580, 1794, 1795, 576, 1791, 571, 1466, 1466, 1466,
- /* 2280 */ 1466, 1466, 1466, 1823, 1466, 1466, 1466, 310, 1792, 580,
- /* 2290 */ 1794, 1795, 576, 1466, 571, 1466, 1791, 1466, 1466, 1466,
- /* 2300 */ 1466, 1466, 1466, 1809, 1466, 1466, 1466, 1466, 1466, 1466,
- /* 2310 */ 1466, 578, 1466, 1466, 1466, 1466, 1761, 1466, 577, 1466,
- /* 2320 */ 1466, 1466, 1466, 1466, 1809, 1466, 1466, 1466, 1466, 1466,
- /* 2330 */ 1466, 1466, 578, 1466, 1466, 1466, 1466, 1761, 1466, 577,
- /* 2340 */ 1466, 1466, 1823, 1466, 1466, 1466, 309, 1792, 580, 1794,
- /* 2350 */ 1795, 576, 1791, 571, 1466, 1466, 1466, 1466, 1466, 1466,
- /* 2360 */ 1466, 1466, 1791, 1823, 1466, 1466, 1466, 311, 1792, 580,
- /* 2370 */ 1794, 1795, 576, 1466, 571, 1466, 1466, 1466, 1466, 1466,
- /* 2380 */ 1809, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 578, 1466,
- /* 2390 */ 1809, 1466, 1466, 1761, 549, 577, 1466, 1466, 578, 1466,
- /* 2400 */ 1466, 1466, 1466, 1761, 1466, 577, 1466, 1466, 1466, 1466,
- /* 2410 */ 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1823,
- /* 2420 */ 1466, 1466, 127, 308, 1792, 580, 1794, 1795, 576, 1823,
- /* 2430 */ 571, 1466, 1466, 288, 1792, 580, 1794, 1795, 576, 1466,
- /* 2440 */ 571, 549, 554, 1466, 1466, 1466, 1466, 1466, 1466, 1466,
- /* 2450 */ 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466,
- /* 2460 */ 1466, 125, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 127,
- /* 2470 */ 1466, 1466, 1466, 1466, 1466, 1466, 251, 1877, 548, 1466,
- /* 2480 */ 547, 1466, 1466, 1935, 1466, 1466, 1466, 1466, 1466, 554,
- /* 2490 */ 1466, 1466, 1466, 1466, 1466, 1466, 167, 1466, 1466, 1466,
- /* 2500 */ 1932, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 125, 1466,
- /* 2510 */ 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466,
- /* 2520 */ 1466, 1466, 1466, 251, 1877, 548, 1466, 547, 1466, 1466,
- /* 2530 */ 1935, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466, 1466,
- /* 2540 */ 1466, 1466, 1466, 165, 1466, 1466, 1466, 1932,
+ /* 860 */ 403, 402, 401, 400, 394, 393, 392, 391, 549, 388,
+ /* 870 */ 387, 1756, 1656, 616, 1473, 1393, 29, 337, 1354, 1355,
+ /* 880 */ 1356, 1357, 1358, 1362, 1363, 1364, 1365, 658, 1655, 468,
+ /* 890 */ 1262, 610, 1260, 1286, 1647, 1068, 127, 29, 337, 1354,
+ /* 900 */ 1355, 1356, 1357, 1358, 1362, 1363, 1364, 1365, 272, 613,
+ /* 910 */ 536, 1634, 1316, 1265, 1266, 1756, 1314, 1315, 1317, 1318,
+ /* 920 */ 1319, 1320, 1321, 1322, 573, 569, 1330, 1331, 1333, 1334,
+ /* 930 */ 1335, 1336, 1338, 1341, 125, 147, 1472, 1786, 561, 352,
+ /* 940 */ 278, 351, 1884, 1393, 1743, 482, 481, 1516, 1774, 162,
+ /* 950 */ 1872, 1873, 123, 1877, 276, 60, 1805, 232, 59, 1770,
+ /* 960 */ 526, 526, 477, 480, 1471, 1804, 44, 4, 244, 483,
+ /* 970 */ 145, 449, 1601, 578, 180, 429, 427, 1756, 1756, 1930,
+ /* 980 */ 577, 1930, 1500, 1766, 1772, 334, 1470, 1786, 1604, 1604,
+ /* 990 */ 526, 361, 164, 554, 164, 571, 1927, 216, 1927, 498,
+ /* 1000 */ 556, 499, 1469, 1818, 1468, 1756, 63, 94, 1787, 580,
+ /* 1010 */ 1789, 1790, 576, 526, 571, 1804, 558, 1864, 1604, 336,
+ /* 1020 */ 335, 306, 1860, 578, 506, 1316, 526, 1756, 1756, 1275,
+ /* 1030 */ 577, 201, 77, 1930, 199, 1396, 1644, 510, 526, 1930,
+ /* 1040 */ 1337, 1604, 1268, 1756, 93, 1756, 166, 1511, 1467, 227,
+ /* 1050 */ 1927, 350, 164, 1818, 1604, 1786, 1927, 95, 1787, 580,
+ /* 1060 */ 1789, 1790, 576, 1332, 571, 526, 1604, 1864, 41, 485,
+ /* 1070 */ 1316, 330, 1860, 1943, 526, 1267, 522, 53, 509, 68,
+ /* 1080 */ 67, 381, 1898, 1804, 171, 524, 221, 203, 526, 1756,
+ /* 1090 */ 202, 578, 205, 1604, 207, 204, 1756, 206, 577, 525,
+ /* 1100 */ 301, 1509, 1604, 369, 1894, 367, 363, 359, 356, 353,
+ /* 1110 */ 1270, 554, 131, 526, 1786, 1212, 1604, 1269, 566, 567,
+ /* 1120 */ 526, 1818, 134, 488, 261, 94, 1787, 580, 1789, 1790,
+ /* 1130 */ 576, 346, 571, 225, 135, 1864, 51, 550, 666, 306,
+ /* 1140 */ 1860, 1604, 1804, 562, 167, 236, 51, 323, 1604, 41,
+ /* 1150 */ 578, 1930, 267, 90, 1786, 1756, 617, 577, 41, 519,
+ /* 1160 */ 1777, 11, 10, 87, 164, 249, 156, 3, 1927, 229,
+ /* 1170 */ 254, 656, 652, 648, 644, 265, 584, 1276, 1066, 1271,
+ /* 1180 */ 1818, 1111, 1804, 1418, 294, 1787, 580, 1789, 1790, 576,
+ /* 1190 */ 578, 571, 239, 1367, 1786, 1756, 1323, 577, 1459, 1460,
+ /* 1200 */ 1279, 1281, 257, 1779, 259, 271, 134, 92, 135, 5,
+ /* 1210 */ 230, 1049, 569, 1330, 1331, 1333, 1334, 1335, 1336, 559,
+ /* 1220 */ 1818, 360, 1804, 1139, 95, 1787, 580, 1789, 1790, 576,
+ /* 1230 */ 578, 571, 268, 355, 1864, 1756, 119, 577, 330, 1860,
+ /* 1240 */ 1943, 134, 549, 523, 1050, 313, 1228, 1273, 174, 1921,
+ /* 1250 */ 385, 1351, 1284, 1143, 1272, 1150, 406, 413, 1697, 421,
+ /* 1260 */ 1818, 420, 422, 1786, 95, 1787, 580, 1789, 1790, 576,
+ /* 1270 */ 127, 571, 426, 428, 1864, 219, 430, 1290, 330, 1860,
+ /* 1280 */ 1943, 431, 439, 1148, 1292, 442, 183, 443, 138, 1883,
+ /* 1290 */ 554, 1804, 1291, 1235, 185, 212, 444, 1293, 188, 578,
+ /* 1300 */ 445, 190, 447, 72, 1756, 73, 577, 451, 125, 194,
+ /* 1310 */ 470, 472, 1594, 198, 118, 1590, 304, 1786, 200, 554,
+ /* 1320 */ 140, 269, 141, 250, 1872, 548, 1592, 547, 1588, 1818,
+ /* 1330 */ 1930, 142, 143, 285, 1787, 580, 1789, 1790, 576, 211,
+ /* 1340 */ 571, 500, 1736, 164, 214, 1804, 507, 1927, 504, 511,
+ /* 1350 */ 218, 322, 534, 578, 514, 520, 501, 1735, 1756, 1930,
+ /* 1360 */ 577, 132, 1707, 517, 324, 1289, 81, 1786, 521, 133,
+ /* 1370 */ 270, 83, 166, 554, 537, 1605, 1927, 530, 1905, 234,
+ /* 1380 */ 1895, 238, 6, 1818, 1786, 532, 533, 285, 1787, 580,
+ /* 1390 */ 1789, 1790, 576, 329, 571, 1804, 546, 531, 540, 529,
+ /* 1400 */ 528, 248, 1288, 578, 1393, 126, 563, 560, 1756, 48,
+ /* 1410 */ 577, 1880, 1804, 1930, 1904, 85, 1648, 331, 1577, 659,
+ /* 1420 */ 578, 582, 264, 660, 243, 1756, 164, 577, 153, 1886,
+ /* 1430 */ 1927, 247, 245, 1818, 1786, 246, 253, 96, 1787, 580,
+ /* 1440 */ 1789, 1790, 576, 1845, 571, 273, 662, 1864, 299, 275,
+ /* 1450 */ 1818, 565, 1860, 256, 149, 1787, 580, 1789, 1790, 576,
+ /* 1460 */ 1786, 571, 1804, 52, 1946, 1926, 557, 286, 296, 258,
+ /* 1470 */ 578, 564, 295, 1750, 277, 1756, 1749, 577, 65, 1748,
+ /* 1480 */ 1747, 66, 1744, 357, 358, 1253, 1254, 170, 1804, 362,
+ /* 1490 */ 1742, 364, 365, 527, 366, 1741, 578, 368, 555, 1944,
+ /* 1500 */ 1818, 1756, 1740, 577, 96, 1787, 580, 1789, 1790, 576,
+ /* 1510 */ 1786, 571, 370, 1739, 1864, 372, 1738, 1230, 374, 1861,
+ /* 1520 */ 1231, 1718, 1786, 379, 380, 1716, 1818, 1717, 1715, 1690,
+ /* 1530 */ 294, 1787, 580, 1789, 1790, 576, 1786, 571, 1804, 1689,
+ /* 1540 */ 1200, 129, 1688, 1687, 69, 1686, 578, 395, 1681, 396,
+ /* 1550 */ 1804, 1756, 1685, 577, 1684, 1683, 1682, 398, 578, 1680,
+ /* 1560 */ 1679, 1678, 1677, 1756, 1804, 577, 1676, 1675, 1674, 1673,
+ /* 1570 */ 1672, 1671, 575, 1670, 1669, 1668, 1818, 1756, 1667, 577,
+ /* 1580 */ 289, 1787, 580, 1789, 1790, 576, 130, 571, 1818, 1786,
+ /* 1590 */ 1666, 1665, 149, 1787, 580, 1789, 1790, 576, 1664, 571,
+ /* 1600 */ 1663, 1662, 1818, 1202, 1660, 1659, 293, 1787, 580, 1789,
+ /* 1610 */ 1790, 576, 1661, 571, 1658, 1837, 1657, 1804, 545, 1531,
+ /* 1620 */ 178, 1530, 338, 120, 181, 578, 196, 1528, 179, 1496,
+ /* 1630 */ 1756, 157, 577, 435, 1012, 437, 1011, 1945, 1495, 182,
+ /* 1640 */ 152, 121, 1786, 452, 453, 467, 463, 459, 455, 195,
+ /* 1650 */ 1731, 1725, 1714, 189, 1786, 1818, 187, 1713, 1699, 294,
+ /* 1660 */ 1787, 580, 1789, 1790, 576, 1583, 571, 1527, 1786, 1042,
+ /* 1670 */ 1804, 1525, 454, 1523, 456, 340, 458, 457, 578, 1521,
+ /* 1680 */ 460, 75, 1804, 1756, 193, 577, 462, 461, 1519, 464,
+ /* 1690 */ 578, 465, 466, 1508, 1507, 1756, 1804, 577, 1492, 1585,
+ /* 1700 */ 1153, 1154, 197, 1584, 578, 1079, 1074, 50, 1818, 1756,
+ /* 1710 */ 1517, 577, 294, 1787, 580, 1789, 1790, 576, 631, 571,
+ /* 1720 */ 1818, 1076, 1786, 633, 279, 1787, 580, 1789, 1790, 576,
+ /* 1730 */ 1075, 571, 1512, 318, 1818, 319, 1786, 1510, 280, 1787,
+ /* 1740 */ 580, 1789, 1790, 576, 320, 571, 192, 186, 1786, 191,
+ /* 1750 */ 1804, 486, 489, 446, 1491, 491, 1490, 1489, 578, 493,
+ /* 1760 */ 495, 97, 1730, 1756, 1804, 577, 1237, 56, 1724, 184,
+ /* 1770 */ 502, 1712, 578, 1710, 508, 503, 1804, 1756, 215, 577,
+ /* 1780 */ 1711, 1709, 321, 1708, 578, 15, 144, 220, 1818, 1756,
+ /* 1790 */ 1245, 577, 281, 1787, 580, 1789, 1790, 576, 1706, 571,
+ /* 1800 */ 1698, 226, 1818, 518, 79, 1786, 288, 1787, 580, 1789,
+ /* 1810 */ 1790, 576, 228, 571, 1818, 1786, 515, 80, 290, 1787,
+ /* 1820 */ 580, 1789, 1790, 576, 82, 571, 87, 41, 231, 23,
+ /* 1830 */ 47, 1786, 1433, 1804, 233, 241, 235, 1415, 237, 242,
+ /* 1840 */ 1417, 578, 16, 1804, 25, 1777, 1756, 151, 577, 240,
+ /* 1850 */ 24, 578, 46, 1410, 86, 1786, 1756, 17, 577, 1804,
+ /* 1860 */ 1390, 251, 1389, 1776, 154, 1450, 45, 578, 18, 1439,
+ /* 1870 */ 1445, 1818, 1756, 13, 577, 282, 1787, 580, 1789, 1790,
+ /* 1880 */ 576, 1818, 571, 1804, 1444, 291, 1787, 580, 1789, 1790,
+ /* 1890 */ 576, 578, 571, 332, 1449, 1448, 1756, 1818, 577, 333,
+ /* 1900 */ 10, 283, 1787, 580, 1789, 1790, 576, 1277, 571, 1352,
+ /* 1910 */ 19, 1786, 1821, 1307, 1327, 570, 155, 1325, 31, 581,
+ /* 1920 */ 1324, 1818, 12, 20, 168, 292, 1787, 580, 1789, 1790,
+ /* 1930 */ 576, 1786, 571, 21, 583, 1140, 341, 585, 579, 1804,
+ /* 1940 */ 1137, 587, 588, 590, 1134, 591, 593, 578, 596, 1132,
+ /* 1950 */ 594, 1786, 1756, 1128, 577, 1126, 1131, 597, 1117, 1804,
+ /* 1960 */ 1130, 88, 1149, 603, 1129, 89, 62, 578, 262, 1145,
+ /* 1970 */ 612, 1786, 1756, 1071, 577, 1070, 1040, 1818, 1069, 1804,
+ /* 1980 */ 1067, 284, 1787, 580, 1789, 1790, 576, 578, 571, 1065,
+ /* 1990 */ 1064, 1786, 1756, 1063, 577, 263, 1086, 1818, 1061, 1804,
+ /* 2000 */ 1060, 297, 1787, 580, 1789, 1790, 576, 578, 571, 621,
+ /* 2010 */ 1059, 1058, 1756, 1057, 577, 1056, 1055, 1818, 1083, 1804,
+ /* 2020 */ 1081, 298, 1787, 580, 1789, 1790, 576, 578, 571, 1052,
+ /* 2030 */ 1051, 1786, 1756, 1048, 577, 1047, 1046, 1818, 1045, 1524,
+ /* 2040 */ 641, 1798, 1787, 580, 1789, 1790, 576, 1786, 571, 642,
+ /* 2050 */ 643, 1522, 645, 646, 647, 1520, 649, 1818, 651, 1804,
+ /* 2060 */ 650, 1797, 1787, 580, 1789, 1790, 576, 578, 571, 1518,
+ /* 2070 */ 653, 654, 1756, 655, 577, 1804, 1506, 657, 1002, 1488,
+ /* 2080 */ 266, 661, 664, 578, 1263, 274, 665, 1463, 1756, 1463,
+ /* 2090 */ 577, 1463, 1463, 1463, 1463, 1463, 1463, 1818, 1786, 1463,
+ /* 2100 */ 1463, 1796, 1787, 580, 1789, 1790, 576, 1463, 571, 1463,
+ /* 2110 */ 1463, 1463, 1463, 1818, 1786, 1463, 1463, 310, 1787, 580,
+ /* 2120 */ 1789, 1790, 576, 1463, 571, 1463, 1804, 1463, 1463, 1463,
+ /* 2130 */ 1463, 1463, 1463, 1463, 578, 1463, 1463, 1463, 1463, 1756,
+ /* 2140 */ 1463, 577, 1804, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 2150 */ 578, 1463, 1463, 1463, 1463, 1756, 1463, 577, 1463, 1463,
+ /* 2160 */ 1463, 1463, 1463, 1463, 1818, 1786, 1463, 1463, 309, 1787,
+ /* 2170 */ 580, 1789, 1790, 576, 1463, 571, 1463, 1463, 1463, 1463,
+ /* 2180 */ 1818, 1786, 1463, 1463, 311, 1787, 580, 1789, 1790, 576,
+ /* 2190 */ 1463, 571, 1463, 1804, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 2200 */ 1463, 578, 1463, 1463, 1463, 1463, 1756, 1463, 577, 1804,
+ /* 2210 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 578, 1463, 1463,
+ /* 2220 */ 1463, 1463, 1756, 1463, 577, 1463, 1463, 1463, 1463, 1463,
+ /* 2230 */ 1463, 1818, 1463, 1463, 1463, 308, 1787, 580, 1789, 1790,
+ /* 2240 */ 576, 1463, 571, 1463, 1463, 1463, 1463, 1818, 1463, 1463,
+ /* 2250 */ 1463, 287, 1787, 580, 1789, 1790, 576, 1463, 571,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 316, 390, 391, 316, 316, 312, 316, 314, 315, 1,
- /* 10 */ 2, 327, 12, 13, 327, 350, 351, 327, 334, 364,
- /* 20 */ 20, 0, 22, 4, 334, 20, 20, 22, 344, 308,
- /* 30 */ 338, 344, 344, 33, 344, 35, 312, 20, 314, 315,
- /* 40 */ 35, 349, 21, 338, 20, 24, 25, 26, 27, 28,
- /* 50 */ 29, 30, 31, 32, 349, 50, 56, 336, 321, 4,
- /* 60 */ 405, 61, 325, 44, 45, 344, 374, 375, 68, 60,
- /* 70 */ 349, 383, 351, 418, 12, 13, 14, 422, 386, 374,
- /* 80 */ 375, 376, 20, 0, 22, 397, 398, 399, 400, 89,
- /* 90 */ 402, 386, 336, 322, 323, 33, 375, 35, 90, 343,
- /* 100 */ 379, 380, 381, 382, 383, 384, 21, 386, 352, 347,
- /* 110 */ 389, 111, 350, 351, 393, 394, 395, 351, 56, 34,
- /* 120 */ 405, 36, 20, 61, 358, 125, 126, 361, 407, 20,
- /* 130 */ 68, 125, 126, 418, 8, 9, 415, 422, 12, 13,
- /* 140 */ 14, 15, 16, 307, 89, 309, 63, 64, 65, 66,
+ /* 0 */ 312, 404, 314, 315, 337, 312, 316, 314, 315, 351,
+ /* 10 */ 389, 390, 12, 13, 417, 328, 358, 327, 421, 361,
+ /* 20 */ 20, 0, 22, 336, 334, 12, 13, 14, 15, 16,
+ /* 30 */ 308, 20, 345, 33, 344, 35, 347, 20, 20, 350,
+ /* 40 */ 351, 364, 21, 338, 316, 24, 25, 26, 27, 28,
+ /* 50 */ 29, 30, 31, 32, 349, 327, 56, 313, 336, 4,
+ /* 60 */ 316, 61, 334, 14, 15, 16, 344, 307, 68, 309,
+ /* 70 */ 60, 349, 344, 351, 12, 13, 14, 338, 373, 374,
+ /* 80 */ 375, 404, 20, 0, 22, 336, 56, 20, 349, 89,
+ /* 90 */ 385, 4, 336, 344, 417, 33, 374, 35, 421, 343,
+ /* 100 */ 378, 379, 380, 381, 382, 383, 89, 385, 352, 335,
+ /* 110 */ 388, 111, 373, 374, 392, 393, 394, 351, 56, 89,
+ /* 120 */ 404, 91, 348, 61, 385, 125, 126, 361, 406, 380,
+ /* 130 */ 68, 44, 45, 417, 8, 9, 414, 421, 12, 13,
+ /* 140 */ 14, 15, 16, 20, 89, 89, 63, 64, 65, 66,
/* 150 */ 67, 89, 69, 70, 71, 72, 73, 74, 75, 76,
/* 160 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
/* 170 */ 170, 21, 172, 111, 24, 25, 26, 27, 28, 29,
- /* 180 */ 30, 31, 32, 336, 14, 15, 16, 125, 126, 120,
- /* 190 */ 121, 344, 316, 193, 194, 60, 196, 197, 198, 199,
+ /* 180 */ 30, 31, 32, 313, 338, 20, 316, 125, 126, 120,
+ /* 190 */ 121, 1, 2, 193, 194, 349, 196, 197, 198, 199,
/* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- /* 210 */ 210, 211, 212, 213, 0, 20, 90, 8, 9, 64,
- /* 220 */ 65, 12, 13, 14, 15, 16, 71, 227, 381, 353,
- /* 230 */ 305, 120, 170, 318, 172, 22, 81, 82, 24, 25,
- /* 240 */ 26, 27, 28, 29, 30, 31, 32, 178, 35, 20,
- /* 250 */ 181, 22, 43, 56, 339, 193, 194, 308, 196, 197,
+ /* 210 */ 210, 211, 212, 213, 0, 21, 90, 8, 9, 373,
+ /* 220 */ 374, 12, 13, 14, 15, 16, 316, 227, 34, 321,
+ /* 230 */ 36, 385, 170, 325, 172, 22, 121, 327, 24, 25,
+ /* 240 */ 26, 27, 28, 29, 30, 31, 32, 178, 35, 89,
+ /* 250 */ 181, 360, 43, 362, 344, 193, 194, 227, 196, 197,
/* 260 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- /* 270 */ 208, 209, 210, 211, 212, 213, 12, 13, 308, 50,
- /* 280 */ 155, 68, 227, 316, 20, 88, 22, 308, 91, 364,
- /* 290 */ 179, 180, 0, 308, 327, 121, 364, 33, 349, 35,
+ /* 270 */ 208, 209, 210, 211, 212, 213, 12, 13, 350, 351,
+ /* 280 */ 90, 68, 227, 227, 20, 20, 22, 60, 20, 89,
+ /* 290 */ 125, 126, 177, 178, 308, 308, 181, 33, 193, 35,
/* 300 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- /* 310 */ 112, 344, 114, 115, 116, 117, 118, 119, 405, 349,
- /* 320 */ 56, 336, 0, 68, 111, 61, 336, 405, 349, 344,
- /* 330 */ 405, 418, 68, 343, 349, 422, 351, 405, 12, 13,
- /* 340 */ 418, 4, 352, 418, 422, 20, 20, 422, 22, 316,
- /* 350 */ 418, 177, 178, 89, 422, 181, 19, 232, 233, 33,
- /* 360 */ 375, 35, 344, 335, 379, 380, 381, 382, 383, 384,
- /* 370 */ 33, 386, 89, 355, 389, 111, 348, 344, 393, 394,
- /* 380 */ 395, 20, 56, 170, 47, 172, 77, 100, 51, 125,
- /* 390 */ 126, 8, 9, 56, 68, 12, 13, 14, 15, 16,
- /* 400 */ 415, 322, 323, 12, 13, 14, 193, 194, 308, 318,
- /* 410 */ 68, 20, 308, 22, 89, 89, 383, 12, 13, 14,
- /* 420 */ 15, 16, 331, 101, 33, 88, 35, 337, 91, 89,
- /* 430 */ 339, 398, 399, 400, 170, 402, 172, 111, 129, 130,
- /* 440 */ 336, 364, 120, 121, 122, 123, 124, 56, 344, 349,
- /* 450 */ 89, 125, 126, 349, 37, 351, 308, 193, 194, 68,
+ /* 310 */ 112, 328, 114, 115, 116, 117, 118, 119, 20, 336,
+ /* 320 */ 56, 0, 336, 56, 111, 61, 322, 323, 345, 169,
+ /* 330 */ 344, 171, 68, 336, 404, 349, 349, 351, 12, 13,
+ /* 340 */ 343, 236, 237, 238, 239, 240, 20, 417, 22, 352,
+ /* 350 */ 0, 421, 318, 89, 89, 88, 336, 89, 91, 33,
+ /* 360 */ 374, 35, 68, 343, 378, 379, 380, 381, 382, 383,
+ /* 370 */ 100, 385, 352, 339, 388, 111, 328, 337, 392, 393,
+ /* 380 */ 394, 20, 56, 170, 336, 172, 20, 227, 22, 125,
+ /* 390 */ 126, 8, 9, 345, 68, 12, 13, 14, 15, 16,
+ /* 400 */ 414, 404, 316, 12, 13, 14, 193, 194, 308, 308,
+ /* 410 */ 101, 20, 308, 22, 417, 89, 50, 14, 421, 322,
+ /* 420 */ 323, 35, 101, 20, 33, 68, 35, 227, 316, 120,
+ /* 430 */ 121, 122, 123, 124, 170, 344, 172, 111, 308, 353,
+ /* 440 */ 336, 120, 121, 122, 123, 124, 355, 56, 344, 349,
+ /* 450 */ 349, 125, 126, 349, 68, 351, 344, 193, 194, 68,
/* 460 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
- /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 89, 375,
- /* 480 */ 89, 320, 405, 379, 380, 381, 382, 383, 384, 385,
- /* 490 */ 386, 387, 388, 20, 333, 418, 170, 349, 172, 422,
- /* 500 */ 8, 9, 111, 342, 12, 13, 14, 15, 16, 92,
- /* 510 */ 227, 94, 95, 308, 97, 364, 125, 126, 101, 193,
- /* 520 */ 194, 20, 196, 197, 198, 199, 200, 201, 202, 203,
+ /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 374, 349,
+ /* 480 */ 89, 337, 378, 379, 380, 381, 382, 383, 384, 385,
+ /* 490 */ 386, 387, 227, 320, 382, 227, 170, 120, 172, 8,
+ /* 500 */ 9, 0, 111, 12, 13, 14, 15, 16, 396, 397,
+ /* 510 */ 398, 399, 337, 401, 308, 342, 125, 126, 157, 193,
+ /* 520 */ 194, 0, 196, 197, 198, 199, 200, 201, 202, 203,
/* 530 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
- /* 540 */ 123, 44, 45, 8, 9, 162, 152, 12, 13, 14,
- /* 550 */ 15, 16, 227, 227, 349, 316, 405, 337, 169, 336,
- /* 560 */ 171, 170, 89, 172, 2, 0, 327, 227, 345, 418,
- /* 570 */ 8, 9, 56, 422, 12, 13, 14, 15, 16, 56,
- /* 580 */ 308, 308, 90, 344, 193, 194, 337, 196, 197, 198,
+ /* 540 */ 360, 316, 362, 8, 9, 162, 318, 12, 13, 14,
+ /* 550 */ 15, 16, 327, 227, 37, 349, 179, 180, 324, 331,
+ /* 560 */ 326, 170, 376, 172, 2, 64, 65, 339, 305, 344,
+ /* 570 */ 8, 9, 71, 0, 12, 13, 14, 15, 16, 337,
+ /* 580 */ 308, 90, 81, 82, 193, 194, 400, 196, 197, 198,
/* 590 */ 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
- /* 600 */ 209, 210, 211, 212, 213, 12, 13, 91, 214, 336,
- /* 610 */ 364, 377, 89, 20, 91, 22, 227, 344, 224, 308,
- /* 620 */ 368, 349, 349, 165, 351, 90, 33, 2, 35, 64,
- /* 630 */ 65, 308, 249, 8, 9, 401, 71, 12, 13, 14,
- /* 640 */ 15, 16, 184, 185, 14, 337, 81, 82, 375, 56,
- /* 650 */ 20, 405, 379, 380, 381, 382, 383, 384, 157, 386,
- /* 660 */ 349, 68, 389, 351, 418, 308, 393, 394, 422, 35,
- /* 670 */ 8, 9, 349, 361, 12, 13, 14, 15, 16, 19,
- /* 680 */ 8, 9, 89, 316, 12, 13, 14, 15, 16, 308,
- /* 690 */ 308, 8, 9, 33, 327, 12, 13, 14, 15, 16,
- /* 700 */ 227, 360, 68, 362, 111, 313, 349, 47, 316, 344,
- /* 710 */ 337, 344, 52, 53, 54, 55, 56, 0, 125, 126,
- /* 720 */ 355, 8, 9, 61, 337, 12, 13, 14, 15, 16,
- /* 730 */ 349, 349, 12, 13, 316, 337, 316, 18, 308, 20,
- /* 740 */ 20, 316, 22, 316, 61, 327, 27, 327, 88, 30,
- /* 750 */ 227, 91, 90, 33, 327, 35, 313, 0, 320, 316,
- /* 760 */ 98, 14, 344, 170, 344, 172, 47, 20, 49, 344,
- /* 770 */ 51, 344, 308, 360, 338, 362, 56, 225, 226, 349,
- /* 780 */ 342, 98, 42, 43, 124, 349, 193, 194, 68, 196,
+ /* 600 */ 209, 210, 211, 212, 213, 12, 13, 101, 336, 92,
+ /* 610 */ 336, 94, 95, 20, 97, 22, 344, 152, 101, 345,
+ /* 620 */ 316, 349, 101, 351, 2, 90, 33, 364, 35, 123,
+ /* 630 */ 8, 9, 249, 60, 12, 13, 14, 15, 16, 155,
+ /* 640 */ 123, 120, 121, 122, 123, 124, 374, 344, 344, 56,
+ /* 650 */ 378, 379, 380, 381, 382, 383, 337, 385, 355, 320,
+ /* 660 */ 388, 68, 316, 346, 392, 393, 349, 404, 364, 364,
+ /* 670 */ 8, 9, 333, 327, 12, 13, 14, 15, 16, 214,
+ /* 680 */ 417, 342, 89, 308, 421, 20, 382, 22, 39, 224,
+ /* 690 */ 344, 8, 9, 308, 325, 12, 13, 14, 15, 16,
+ /* 700 */ 35, 397, 398, 399, 111, 401, 8, 9, 404, 404,
+ /* 710 */ 12, 13, 14, 15, 16, 50, 232, 233, 125, 126,
+ /* 720 */ 316, 417, 417, 61, 349, 421, 421, 43, 4, 14,
+ /* 730 */ 316, 327, 12, 13, 349, 20, 308, 18, 376, 20,
+ /* 740 */ 20, 327, 22, 19, 61, 316, 27, 337, 344, 30,
+ /* 750 */ 316, 316, 90, 33, 309, 35, 327, 33, 344, 3,
+ /* 760 */ 98, 327, 400, 170, 165, 172, 47, 308, 49, 308,
+ /* 770 */ 51, 47, 424, 344, 90, 51, 56, 349, 344, 344,
+ /* 780 */ 56, 98, 308, 184, 185, 77, 193, 194, 68, 196,
/* 790 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
- /* 800 */ 207, 208, 209, 210, 211, 212, 213, 88, 383, 89,
- /* 810 */ 374, 375, 376, 349, 152, 39, 156, 60, 101, 100,
- /* 820 */ 89, 316, 386, 398, 399, 400, 336, 402, 193, 157,
- /* 830 */ 99, 111, 327, 343, 174, 152, 176, 120, 121, 122,
- /* 840 */ 123, 124, 352, 309, 377, 125, 126, 128, 308, 344,
+ /* 800 */ 207, 208, 209, 210, 211, 212, 213, 88, 349, 89,
+ /* 810 */ 349, 4, 88, 316, 152, 91, 376, 382, 368, 100,
+ /* 820 */ 20, 8, 9, 349, 327, 12, 13, 14, 15, 16,
+ /* 830 */ 308, 111, 397, 398, 399, 152, 401, 129, 130, 0,
+ /* 840 */ 400, 344, 14, 44, 45, 125, 126, 128, 20, 0,
/* 850 */ 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
- /* 860 */ 141, 142, 143, 144, 145, 146, 147, 148, 401, 150,
- /* 870 */ 151, 236, 237, 238, 239, 240, 214, 215, 216, 217,
- /* 880 */ 218, 219, 220, 221, 222, 223, 224, 14, 3, 349,
- /* 890 */ 170, 346, 172, 20, 349, 405, 4, 214, 215, 216,
- /* 900 */ 217, 218, 219, 220, 221, 222, 223, 224, 418, 0,
- /* 910 */ 308, 308, 422, 193, 194, 308, 196, 197, 198, 199,
+ /* 860 */ 141, 142, 143, 144, 145, 146, 147, 148, 316, 150,
+ /* 870 */ 151, 349, 336, 13, 308, 226, 214, 215, 216, 217,
+ /* 880 */ 218, 219, 220, 221, 222, 223, 224, 48, 352, 317,
+ /* 890 */ 170, 346, 172, 20, 349, 35, 344, 214, 215, 216,
+ /* 900 */ 217, 218, 219, 220, 221, 222, 223, 224, 329, 60,
+ /* 910 */ 415, 332, 197, 193, 194, 349, 196, 197, 198, 199,
/* 920 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- /* 930 */ 210, 211, 212, 213, 324, 18, 326, 308, 336, 316,
- /* 940 */ 23, 101, 346, 425, 197, 349, 344, 377, 308, 308,
- /* 950 */ 327, 349, 349, 351, 37, 38, 349, 101, 41, 20,
- /* 960 */ 120, 121, 122, 123, 124, 336, 364, 344, 20, 60,
- /* 970 */ 325, 401, 43, 344, 57, 58, 59, 375, 349, 123,
- /* 980 */ 351, 379, 380, 381, 382, 383, 384, 416, 386, 349,
- /* 990 */ 349, 389, 338, 364, 317, 393, 394, 329, 157, 158,
- /* 1000 */ 332, 336, 226, 349, 375, 316, 89, 405, 379, 380,
- /* 1010 */ 381, 382, 383, 384, 316, 386, 327, 352, 389, 90,
- /* 1020 */ 418, 0, 393, 394, 422, 327, 0, 93, 374, 375,
- /* 1030 */ 96, 12, 13, 344, 405, 125, 126, 43, 316, 316,
- /* 1040 */ 386, 22, 344, 35, 127, 316, 316, 418, 22, 327,
- /* 1050 */ 327, 422, 33, 43, 35, 328, 327, 327, 316, 93,
- /* 1060 */ 316, 308, 96, 336, 371, 316, 344, 344, 47, 327,
- /* 1070 */ 197, 327, 345, 344, 344, 56, 327, 43, 43, 162,
- /* 1080 */ 163, 164, 328, 316, 167, 35, 344, 68, 344, 336,
- /* 1090 */ 336, 43, 412, 344, 327, 93, 157, 344, 96, 345,
- /* 1100 */ 183, 61, 349, 186, 351, 188, 189, 190, 191, 192,
- /* 1110 */ 328, 344, 46, 93, 43, 43, 96, 336, 336, 0,
- /* 1120 */ 228, 0, 43, 308, 90, 90, 43, 345, 375, 244,
- /* 1130 */ 111, 43, 379, 380, 381, 382, 383, 384, 90, 386,
- /* 1140 */ 43, 22, 389, 22, 227, 197, 393, 394, 395, 1,
- /* 1150 */ 2, 336, 13, 43, 13, 89, 317, 404, 43, 344,
- /* 1160 */ 43, 90, 90, 315, 349, 348, 351, 43, 43, 90,
- /* 1170 */ 43, 378, 403, 90, 35, 308, 35, 419, 90, 396,
- /* 1180 */ 172, 419, 419, 406, 229, 373, 372, 90, 35, 170,
- /* 1190 */ 375, 172, 47, 168, 379, 380, 381, 382, 383, 384,
- /* 1200 */ 90, 386, 366, 336, 389, 90, 0, 90, 393, 394,
- /* 1210 */ 395, 344, 193, 194, 90, 90, 349, 90, 351, 404,
- /* 1220 */ 42, 68, 172, 20, 205, 206, 207, 208, 209, 210,
- /* 1230 */ 211, 308, 356, 193, 316, 316, 356, 152, 354, 20,
- /* 1240 */ 246, 308, 375, 354, 316, 310, 379, 380, 381, 382,
- /* 1250 */ 383, 384, 316, 386, 48, 310, 389, 316, 248, 336,
- /* 1260 */ 393, 394, 395, 20, 370, 351, 320, 344, 20, 336,
- /* 1270 */ 320, 404, 349, 20, 351, 363, 365, 344, 320, 363,
- /* 1280 */ 320, 320, 349, 320, 351, 316, 310, 364, 320, 336,
- /* 1290 */ 308, 310, 336, 336, 316, 336, 349, 364, 375, 369,
- /* 1300 */ 336, 336, 379, 380, 381, 382, 383, 384, 375, 386,
- /* 1310 */ 336, 336, 379, 380, 381, 382, 383, 384, 336, 386,
- /* 1320 */ 336, 336, 336, 318, 370, 175, 344, 318, 405, 316,
- /* 1330 */ 351, 349, 316, 351, 363, 318, 234, 349, 405, 359,
- /* 1340 */ 349, 418, 349, 154, 349, 422, 359, 349, 318, 357,
- /* 1350 */ 308, 418, 20, 349, 332, 422, 318, 375, 344, 359,
- /* 1360 */ 308, 379, 380, 381, 382, 383, 384, 378, 386, 235,
- /* 1370 */ 359, 389, 349, 411, 241, 393, 394, 349, 336, 161,
- /* 1380 */ 349, 411, 349, 243, 242, 413, 344, 414, 336, 230,
- /* 1390 */ 226, 349, 20, 351, 411, 344, 344, 373, 247, 245,
- /* 1400 */ 410, 349, 89, 351, 377, 409, 250, 408, 89, 308,
- /* 1410 */ 340, 349, 326, 318, 316, 36, 311, 375, 421, 310,
- /* 1420 */ 367, 379, 380, 381, 382, 383, 384, 375, 386, 426,
- /* 1430 */ 362, 379, 380, 381, 382, 383, 384, 336, 386, 421,
- /* 1440 */ 0, 389, 341, 330, 330, 344, 394, 392, 330, 420,
- /* 1450 */ 349, 319, 351, 421, 0, 306, 420, 420, 177, 0,
- /* 1460 */ 308, 0, 42, 0, 35, 423, 424, 187, 35, 35,
- /* 1470 */ 35, 187, 0, 35, 35, 187, 375, 0, 0, 187,
- /* 1480 */ 379, 380, 381, 382, 383, 384, 35, 386, 336, 0,
- /* 1490 */ 22, 0, 35, 341, 172, 170, 344, 0, 0, 166,
- /* 1500 */ 165, 349, 46, 351, 0, 0, 0, 42, 0, 0,
- /* 1510 */ 0, 149, 308, 0, 0, 0, 0, 0, 144, 35,
- /* 1520 */ 0, 144, 308, 42, 0, 0, 0, 375, 0, 0,
- /* 1530 */ 0, 379, 380, 381, 382, 383, 384, 0, 386, 308,
- /* 1540 */ 336, 0, 0, 0, 0, 0, 0, 0, 344, 0,
- /* 1550 */ 336, 0, 0, 349, 0, 351, 0, 0, 344, 0,
- /* 1560 */ 22, 0, 0, 349, 0, 351, 0, 336, 56, 0,
- /* 1570 */ 0, 0, 39, 42, 56, 344, 0, 43, 46, 375,
- /* 1580 */ 349, 14, 351, 379, 380, 381, 382, 383, 384, 375,
- /* 1590 */ 386, 161, 14, 379, 380, 381, 382, 383, 384, 308,
- /* 1600 */ 386, 46, 0, 40, 39, 0, 375, 0, 0, 0,
- /* 1610 */ 379, 380, 381, 382, 383, 384, 308, 386, 39, 388,
- /* 1620 */ 0, 417, 62, 0, 0, 35, 39, 336, 0, 47,
- /* 1630 */ 35, 47, 341, 39, 0, 344, 35, 39, 424, 47,
- /* 1640 */ 349, 0, 351, 47, 336, 35, 0, 0, 0, 341,
- /* 1650 */ 39, 0, 344, 35, 22, 0, 98, 349, 43, 351,
- /* 1660 */ 35, 35, 43, 0, 96, 35, 375, 22, 0, 0,
- /* 1670 */ 379, 380, 381, 382, 383, 384, 22, 386, 22, 22,
- /* 1680 */ 49, 0, 0, 375, 308, 35, 33, 379, 380, 381,
- /* 1690 */ 382, 383, 384, 35, 386, 0, 35, 22, 20, 0,
- /* 1700 */ 47, 35, 308, 0, 154, 52, 53, 54, 55, 56,
- /* 1710 */ 157, 22, 336, 173, 0, 0, 0, 0, 0, 90,
- /* 1720 */ 344, 35, 89, 0, 89, 349, 89, 351, 0, 157,
- /* 1730 */ 336, 157, 159, 39, 46, 155, 43, 99, 344, 153,
- /* 1740 */ 43, 88, 231, 349, 91, 351, 46, 43, 89, 43,
- /* 1750 */ 231, 375, 90, 89, 89, 379, 380, 381, 382, 383,
- /* 1760 */ 384, 308, 386, 90, 90, 182, 89, 46, 89, 375,
- /* 1770 */ 90, 46, 89, 379, 380, 381, 382, 383, 384, 89,
- /* 1780 */ 386, 90, 90, 43, 46, 89, 43, 46, 90, 336,
- /* 1790 */ 35, 90, 90, 35, 35, 35, 35, 344, 35, 2,
- /* 1800 */ 225, 22, 349, 90, 351, 193, 153, 154, 231, 156,
- /* 1810 */ 308, 43, 90, 160, 90, 46, 89, 46, 89, 89,
- /* 1820 */ 89, 89, 22, 89, 35, 90, 35, 90, 375, 176,
- /* 1830 */ 35, 308, 379, 380, 381, 382, 383, 384, 336, 386,
- /* 1840 */ 89, 89, 100, 90, 195, 35, 344, 90, 35, 35,
- /* 1850 */ 22, 349, 90, 351, 89, 89, 89, 113, 113, 336,
- /* 1860 */ 113, 113, 89, 89, 43, 101, 35, 344, 22, 89,
- /* 1870 */ 62, 35, 349, 61, 351, 35, 35, 375, 35, 35,
- /* 1880 */ 35, 379, 380, 381, 382, 383, 384, 35, 386, 308,
- /* 1890 */ 68, 87, 43, 35, 35, 22, 35, 22, 375, 308,
- /* 1900 */ 35, 35, 379, 380, 381, 382, 383, 384, 22, 386,
- /* 1910 */ 68, 35, 35, 35, 35, 35, 35, 336, 0, 35,
- /* 1920 */ 0, 47, 39, 35, 39, 344, 0, 336, 35, 47,
- /* 1930 */ 349, 39, 351, 0, 47, 344, 35, 39, 47, 0,
- /* 1940 */ 349, 35, 351, 0, 35, 22, 21, 427, 427, 22,
- /* 1950 */ 22, 308, 21, 427, 20, 427, 375, 427, 427, 427,
- /* 1960 */ 379, 380, 381, 382, 383, 384, 375, 386, 308, 427,
- /* 1970 */ 379, 380, 381, 382, 383, 384, 427, 386, 427, 336,
- /* 1980 */ 427, 427, 427, 427, 427, 427, 427, 344, 427, 427,
- /* 1990 */ 427, 427, 349, 427, 351, 427, 336, 427, 427, 427,
- /* 2000 */ 427, 427, 427, 427, 344, 427, 427, 427, 427, 349,
- /* 2010 */ 427, 351, 427, 427, 427, 427, 427, 308, 375, 427,
- /* 2020 */ 427, 427, 379, 380, 381, 382, 383, 384, 427, 386,
- /* 2030 */ 427, 427, 427, 427, 308, 375, 427, 427, 427, 379,
- /* 2040 */ 380, 381, 382, 383, 384, 336, 386, 427, 427, 427,
- /* 2050 */ 427, 427, 427, 344, 427, 427, 427, 427, 349, 427,
- /* 2060 */ 351, 427, 336, 427, 427, 427, 427, 427, 427, 427,
- /* 2070 */ 344, 427, 427, 427, 427, 349, 427, 351, 427, 427,
- /* 2080 */ 427, 427, 427, 308, 375, 427, 427, 427, 379, 380,
- /* 2090 */ 381, 382, 383, 384, 427, 386, 427, 427, 427, 427,
- /* 2100 */ 427, 375, 427, 427, 427, 379, 380, 381, 382, 383,
- /* 2110 */ 384, 336, 386, 427, 427, 427, 427, 427, 427, 344,
- /* 2120 */ 427, 427, 427, 427, 349, 427, 351, 427, 427, 427,
- /* 2130 */ 427, 427, 427, 427, 427, 427, 427, 308, 427, 427,
- /* 2140 */ 427, 427, 427, 427, 427, 427, 427, 308, 427, 427,
- /* 2150 */ 375, 427, 427, 427, 379, 380, 381, 382, 383, 384,
- /* 2160 */ 427, 386, 427, 427, 427, 336, 427, 427, 427, 427,
- /* 2170 */ 427, 427, 427, 344, 427, 336, 427, 427, 349, 427,
- /* 2180 */ 351, 427, 427, 344, 427, 427, 427, 427, 349, 427,
- /* 2190 */ 351, 427, 427, 427, 427, 427, 427, 427, 308, 427,
- /* 2200 */ 427, 427, 427, 427, 375, 427, 427, 427, 379, 380,
- /* 2210 */ 381, 382, 383, 384, 375, 386, 308, 427, 379, 380,
- /* 2220 */ 381, 382, 383, 384, 427, 386, 336, 427, 427, 427,
- /* 2230 */ 427, 427, 427, 427, 344, 427, 427, 427, 427, 349,
- /* 2240 */ 427, 351, 427, 427, 336, 427, 427, 427, 427, 427,
- /* 2250 */ 427, 427, 344, 427, 427, 427, 427, 349, 427, 351,
- /* 2260 */ 427, 427, 427, 427, 427, 375, 427, 427, 427, 379,
- /* 2270 */ 380, 381, 382, 383, 384, 308, 386, 427, 427, 427,
- /* 2280 */ 427, 427, 427, 375, 427, 427, 427, 379, 380, 381,
- /* 2290 */ 382, 383, 384, 427, 386, 427, 308, 427, 427, 427,
- /* 2300 */ 427, 427, 427, 336, 427, 427, 427, 427, 427, 427,
- /* 2310 */ 427, 344, 427, 427, 427, 427, 349, 427, 351, 427,
- /* 2320 */ 427, 427, 427, 427, 336, 427, 427, 427, 427, 427,
- /* 2330 */ 427, 427, 344, 427, 427, 427, 427, 349, 427, 351,
- /* 2340 */ 427, 427, 375, 427, 427, 427, 379, 380, 381, 382,
- /* 2350 */ 383, 384, 308, 386, 427, 427, 427, 427, 427, 427,
- /* 2360 */ 427, 427, 308, 375, 427, 427, 427, 379, 380, 381,
- /* 2370 */ 382, 383, 384, 427, 386, 427, 427, 427, 427, 427,
- /* 2380 */ 336, 427, 427, 427, 427, 427, 427, 427, 344, 427,
- /* 2390 */ 336, 427, 427, 349, 316, 351, 427, 427, 344, 427,
- /* 2400 */ 427, 427, 427, 349, 427, 351, 427, 427, 427, 427,
- /* 2410 */ 427, 427, 427, 427, 427, 427, 427, 427, 427, 375,
- /* 2420 */ 427, 427, 344, 379, 380, 381, 382, 383, 384, 375,
- /* 2430 */ 386, 427, 427, 379, 380, 381, 382, 383, 384, 427,
- /* 2440 */ 386, 316, 364, 427, 427, 427, 427, 427, 427, 427,
- /* 2450 */ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- /* 2460 */ 427, 383, 427, 427, 427, 427, 427, 427, 427, 344,
- /* 2470 */ 427, 427, 427, 427, 427, 427, 398, 399, 400, 427,
- /* 2480 */ 402, 427, 427, 405, 427, 427, 427, 427, 427, 364,
- /* 2490 */ 427, 427, 427, 427, 427, 427, 418, 427, 427, 427,
- /* 2500 */ 422, 427, 427, 427, 427, 427, 427, 427, 383, 427,
- /* 2510 */ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- /* 2520 */ 427, 427, 427, 398, 399, 400, 427, 402, 427, 427,
- /* 2530 */ 405, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- /* 2540 */ 427, 427, 427, 418, 427, 427, 427, 422,
+ /* 930 */ 210, 211, 212, 213, 382, 18, 308, 308, 43, 364,
+ /* 940 */ 23, 364, 225, 226, 0, 64, 65, 0, 338, 397,
+ /* 950 */ 398, 399, 71, 401, 37, 38, 336, 157, 41, 349,
+ /* 960 */ 316, 316, 81, 82, 308, 336, 42, 43, 411, 22,
+ /* 970 */ 157, 327, 327, 344, 57, 58, 59, 349, 349, 404,
+ /* 980 */ 351, 404, 315, 373, 374, 375, 308, 308, 344, 344,
+ /* 990 */ 316, 47, 417, 364, 417, 385, 421, 56, 421, 364,
+ /* 1000 */ 244, 327, 308, 374, 308, 349, 89, 378, 379, 380,
+ /* 1010 */ 381, 382, 383, 316, 385, 336, 43, 388, 344, 12,
+ /* 1020 */ 13, 392, 393, 344, 327, 197, 316, 349, 349, 22,
+ /* 1030 */ 351, 93, 91, 404, 96, 228, 348, 327, 316, 404,
+ /* 1040 */ 33, 344, 35, 349, 127, 349, 417, 0, 308, 327,
+ /* 1050 */ 421, 317, 417, 374, 344, 308, 421, 378, 379, 380,
+ /* 1060 */ 381, 382, 383, 56, 385, 316, 344, 388, 43, 22,
+ /* 1070 */ 197, 392, 393, 394, 316, 68, 327, 157, 158, 162,
+ /* 1080 */ 163, 164, 403, 336, 167, 327, 43, 93, 316, 349,
+ /* 1090 */ 96, 344, 93, 344, 93, 96, 349, 96, 351, 327,
+ /* 1100 */ 183, 0, 344, 186, 377, 188, 189, 190, 191, 192,
+ /* 1110 */ 35, 364, 43, 316, 308, 90, 344, 35, 111, 61,
+ /* 1120 */ 316, 374, 43, 22, 327, 378, 379, 380, 381, 382,
+ /* 1130 */ 383, 327, 385, 90, 43, 388, 43, 402, 19, 392,
+ /* 1140 */ 393, 344, 336, 248, 227, 43, 43, 341, 344, 43,
+ /* 1150 */ 344, 404, 33, 89, 308, 349, 13, 351, 43, 90,
+ /* 1160 */ 46, 1, 2, 99, 417, 395, 47, 405, 421, 90,
+ /* 1170 */ 418, 52, 53, 54, 55, 56, 43, 170, 35, 172,
+ /* 1180 */ 374, 90, 336, 90, 378, 379, 380, 381, 382, 383,
+ /* 1190 */ 344, 385, 90, 90, 308, 349, 90, 351, 125, 126,
+ /* 1200 */ 193, 194, 418, 89, 418, 90, 43, 88, 43, 229,
+ /* 1210 */ 91, 35, 205, 206, 207, 208, 209, 210, 211, 246,
+ /* 1220 */ 374, 47, 336, 90, 378, 379, 380, 381, 382, 383,
+ /* 1230 */ 344, 385, 366, 372, 388, 349, 43, 351, 392, 393,
+ /* 1240 */ 394, 43, 316, 124, 68, 371, 168, 172, 42, 403,
+ /* 1250 */ 356, 193, 20, 90, 172, 90, 316, 356, 316, 152,
+ /* 1260 */ 374, 354, 354, 308, 378, 379, 380, 381, 382, 383,
+ /* 1270 */ 344, 385, 316, 316, 388, 156, 316, 20, 392, 393,
+ /* 1280 */ 394, 310, 310, 90, 20, 370, 320, 351, 90, 403,
+ /* 1290 */ 364, 336, 20, 174, 320, 176, 363, 20, 320, 344,
+ /* 1300 */ 365, 320, 363, 320, 349, 320, 351, 316, 382, 320,
+ /* 1310 */ 310, 336, 336, 336, 316, 336, 310, 308, 336, 364,
+ /* 1320 */ 336, 370, 336, 397, 398, 399, 336, 401, 336, 374,
+ /* 1330 */ 404, 336, 336, 378, 379, 380, 381, 382, 383, 318,
+ /* 1340 */ 385, 175, 349, 417, 318, 336, 316, 421, 351, 316,
+ /* 1350 */ 318, 363, 234, 344, 349, 154, 369, 349, 349, 404,
+ /* 1360 */ 351, 359, 349, 349, 349, 20, 318, 308, 357, 359,
+ /* 1370 */ 332, 318, 417, 364, 235, 344, 421, 349, 410, 359,
+ /* 1380 */ 377, 359, 241, 374, 308, 349, 349, 378, 379, 380,
+ /* 1390 */ 381, 382, 383, 349, 385, 336, 161, 243, 349, 242,
+ /* 1400 */ 230, 372, 20, 344, 226, 344, 247, 245, 349, 89,
+ /* 1410 */ 351, 376, 336, 404, 410, 89, 349, 250, 326, 36,
+ /* 1420 */ 344, 340, 318, 311, 412, 349, 417, 351, 410, 413,
+ /* 1430 */ 421, 407, 409, 374, 308, 408, 419, 378, 379, 380,
+ /* 1440 */ 381, 382, 383, 391, 385, 316, 310, 388, 362, 319,
+ /* 1450 */ 374, 392, 393, 419, 378, 379, 380, 381, 382, 383,
+ /* 1460 */ 308, 385, 336, 367, 425, 420, 420, 330, 330, 419,
+ /* 1470 */ 344, 420, 330, 0, 306, 349, 0, 351, 177, 0,
+ /* 1480 */ 0, 42, 0, 35, 187, 35, 35, 35, 336, 187,
+ /* 1490 */ 0, 35, 35, 341, 187, 0, 344, 187, 422, 423,
+ /* 1500 */ 374, 349, 0, 351, 378, 379, 380, 381, 382, 383,
+ /* 1510 */ 308, 385, 35, 0, 388, 22, 0, 170, 35, 393,
+ /* 1520 */ 172, 0, 308, 166, 165, 0, 374, 0, 0, 0,
+ /* 1530 */ 378, 379, 380, 381, 382, 383, 308, 385, 336, 0,
+ /* 1540 */ 46, 42, 0, 0, 149, 0, 344, 144, 0, 35,
+ /* 1550 */ 336, 349, 0, 351, 0, 0, 0, 144, 344, 0,
+ /* 1560 */ 0, 0, 0, 349, 336, 351, 0, 0, 0, 0,
+ /* 1570 */ 0, 0, 344, 0, 0, 0, 374, 349, 0, 351,
+ /* 1580 */ 378, 379, 380, 381, 382, 383, 42, 385, 374, 308,
+ /* 1590 */ 0, 0, 378, 379, 380, 381, 382, 383, 0, 385,
+ /* 1600 */ 0, 0, 374, 22, 0, 0, 378, 379, 380, 381,
+ /* 1610 */ 382, 383, 0, 385, 0, 387, 0, 336, 416, 0,
+ /* 1620 */ 56, 0, 341, 39, 42, 344, 33, 0, 56, 0,
+ /* 1630 */ 349, 43, 351, 46, 14, 46, 14, 423, 0, 40,
+ /* 1640 */ 47, 39, 308, 35, 47, 52, 53, 54, 55, 56,
+ /* 1650 */ 0, 0, 0, 161, 308, 374, 39, 0, 0, 378,
+ /* 1660 */ 379, 380, 381, 382, 383, 0, 385, 0, 308, 62,
+ /* 1670 */ 336, 0, 39, 0, 35, 341, 39, 47, 344, 0,
+ /* 1680 */ 35, 88, 336, 349, 91, 351, 39, 47, 0, 35,
+ /* 1690 */ 344, 47, 39, 0, 0, 349, 336, 351, 0, 0,
+ /* 1700 */ 22, 35, 96, 0, 344, 35, 22, 98, 374, 349,
+ /* 1710 */ 0, 351, 378, 379, 380, 381, 382, 383, 43, 385,
+ /* 1720 */ 374, 35, 308, 43, 378, 379, 380, 381, 382, 383,
+ /* 1730 */ 35, 385, 0, 22, 374, 22, 308, 0, 378, 379,
+ /* 1740 */ 380, 381, 382, 383, 22, 385, 153, 154, 308, 156,
+ /* 1750 */ 336, 49, 35, 160, 0, 35, 0, 0, 344, 35,
+ /* 1760 */ 22, 20, 0, 349, 336, 351, 35, 157, 0, 176,
+ /* 1770 */ 22, 0, 344, 0, 159, 157, 336, 349, 154, 351,
+ /* 1780 */ 0, 0, 157, 0, 344, 89, 173, 90, 374, 349,
+ /* 1790 */ 35, 351, 378, 379, 380, 381, 382, 383, 0, 385,
+ /* 1800 */ 0, 89, 374, 155, 89, 308, 378, 379, 380, 381,
+ /* 1810 */ 382, 383, 153, 385, 374, 308, 182, 39, 378, 379,
+ /* 1820 */ 380, 381, 382, 383, 89, 385, 99, 43, 46, 89,
+ /* 1830 */ 43, 308, 90, 336, 89, 43, 90, 90, 89, 46,
+ /* 1840 */ 90, 344, 231, 336, 43, 46, 349, 89, 351, 89,
+ /* 1850 */ 89, 344, 43, 90, 89, 308, 349, 231, 351, 336,
+ /* 1860 */ 90, 46, 90, 46, 46, 90, 225, 344, 43, 90,
+ /* 1870 */ 35, 374, 349, 231, 351, 378, 379, 380, 381, 382,
+ /* 1880 */ 383, 374, 385, 336, 35, 378, 379, 380, 381, 382,
+ /* 1890 */ 383, 344, 385, 35, 35, 35, 349, 374, 351, 35,
+ /* 1900 */ 2, 378, 379, 380, 381, 382, 383, 22, 385, 193,
+ /* 1910 */ 43, 308, 89, 22, 90, 89, 46, 90, 89, 100,
+ /* 1920 */ 90, 374, 89, 89, 46, 378, 379, 380, 381, 382,
+ /* 1930 */ 383, 308, 385, 89, 35, 90, 35, 89, 195, 336,
+ /* 1940 */ 90, 35, 89, 35, 90, 89, 35, 344, 35, 113,
+ /* 1950 */ 89, 308, 349, 90, 351, 90, 113, 89, 22, 336,
+ /* 1960 */ 113, 89, 35, 101, 113, 89, 89, 344, 43, 22,
+ /* 1970 */ 61, 308, 349, 35, 351, 35, 62, 374, 35, 336,
+ /* 1980 */ 35, 378, 379, 380, 381, 382, 383, 344, 385, 35,
+ /* 1990 */ 35, 308, 349, 35, 351, 43, 68, 374, 35, 336,
+ /* 2000 */ 35, 378, 379, 380, 381, 382, 383, 344, 385, 87,
+ /* 2010 */ 22, 35, 349, 22, 351, 35, 35, 374, 68, 336,
+ /* 2020 */ 35, 378, 379, 380, 381, 382, 383, 344, 385, 35,
+ /* 2030 */ 35, 308, 349, 35, 351, 35, 22, 374, 35, 0,
+ /* 2040 */ 35, 378, 379, 380, 381, 382, 383, 308, 385, 47,
+ /* 2050 */ 39, 0, 35, 47, 39, 0, 35, 374, 39, 336,
+ /* 2060 */ 47, 378, 379, 380, 381, 382, 383, 344, 385, 0,
+ /* 2070 */ 35, 47, 349, 39, 351, 336, 0, 35, 35, 0,
+ /* 2080 */ 22, 21, 21, 344, 22, 22, 20, 426, 349, 426,
+ /* 2090 */ 351, 426, 426, 426, 426, 426, 426, 374, 308, 426,
+ /* 2100 */ 426, 378, 379, 380, 381, 382, 383, 426, 385, 426,
+ /* 2110 */ 426, 426, 426, 374, 308, 426, 426, 378, 379, 380,
+ /* 2120 */ 381, 382, 383, 426, 385, 426, 336, 426, 426, 426,
+ /* 2130 */ 426, 426, 426, 426, 344, 426, 426, 426, 426, 349,
+ /* 2140 */ 426, 351, 336, 426, 426, 426, 426, 426, 426, 426,
+ /* 2150 */ 344, 426, 426, 426, 426, 349, 426, 351, 426, 426,
+ /* 2160 */ 426, 426, 426, 426, 374, 308, 426, 426, 378, 379,
+ /* 2170 */ 380, 381, 382, 383, 426, 385, 426, 426, 426, 426,
+ /* 2180 */ 374, 308, 426, 426, 378, 379, 380, 381, 382, 383,
+ /* 2190 */ 426, 385, 426, 336, 426, 426, 426, 426, 426, 426,
+ /* 2200 */ 426, 344, 426, 426, 426, 426, 349, 426, 351, 336,
+ /* 2210 */ 426, 426, 426, 426, 426, 426, 426, 344, 426, 426,
+ /* 2220 */ 426, 426, 349, 426, 351, 426, 426, 426, 426, 426,
+ /* 2230 */ 426, 374, 426, 426, 426, 378, 379, 380, 381, 382,
+ /* 2240 */ 383, 426, 385, 426, 426, 426, 426, 374, 426, 426,
+ /* 2250 */ 426, 378, 379, 380, 381, 382, 383, 426, 385, 426,
+ /* 2260 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2270 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2280 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2290 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2300 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2310 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2320 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2330 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2340 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2350 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2360 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2370 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2380 */ 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
+ /* 2390 */ 426, 426,
};
#define YY_SHIFT_COUNT (666)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (1943)
+#define YY_SHIFT_MAX (2079)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 917, 0, 0, 62, 62, 264, 264, 264, 326, 326,
/* 10 */ 264, 264, 391, 593, 720, 593, 593, 593, 593, 593,
/* 20 */ 593, 593, 593, 593, 593, 593, 593, 593, 593, 593,
/* 30 */ 593, 593, 593, 593, 593, 593, 593, 593, 593, 593,
- /* 40 */ 593, 593, 325, 325, 361, 361, 361, 1019, 1019, 473,
- /* 50 */ 1019, 1019, 389, 523, 283, 340, 283, 17, 17, 19,
- /* 60 */ 19, 55, 6, 283, 283, 17, 17, 17, 17, 17,
- /* 70 */ 17, 17, 17, 17, 17, 9, 17, 17, 17, 24,
- /* 80 */ 17, 17, 102, 17, 17, 102, 109, 17, 102, 102,
- /* 90 */ 102, 17, 135, 719, 662, 683, 683, 150, 213, 213,
+ /* 40 */ 593, 593, 265, 265, 17, 17, 17, 1007, 1007, 268,
+ /* 50 */ 1007, 1007, 160, 30, 56, 200, 56, 11, 11, 87,
+ /* 60 */ 87, 55, 165, 56, 56, 11, 11, 11, 11, 11,
+ /* 70 */ 11, 11, 11, 11, 11, 10, 11, 11, 11, 18,
+ /* 80 */ 11, 11, 67, 11, 11, 67, 123, 11, 67, 67,
+ /* 90 */ 67, 11, 227, 719, 662, 683, 683, 150, 213, 213,
/* 100 */ 213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
- /* 110 */ 213, 213, 213, 213, 213, 213, 213, 417, 155, 6,
- /* 120 */ 630, 630, 757, 634, 909, 501, 501, 501, 634, 195,
- /* 130 */ 195, 24, 292, 292, 102, 102, 255, 255, 287, 342,
- /* 140 */ 198, 198, 198, 198, 198, 198, 198, 660, 21, 383,
- /* 150 */ 565, 635, 5, 174, 125, 747, 873, 229, 497, 856,
- /* 160 */ 939, 552, 776, 552, 740, 885, 885, 885, 892, 948,
- /* 170 */ 955, 1145, 1025, 1178, 1203, 1203, 1178, 1085, 1085, 1203,
- /* 180 */ 1203, 1203, 1219, 1219, 1243, 9, 24, 9, 1248, 1253,
- /* 190 */ 9, 1248, 9, 9, 9, 1203, 9, 1219, 102, 102,
- /* 200 */ 102, 102, 102, 102, 102, 102, 102, 102, 102, 1203,
- /* 210 */ 1219, 255, 1243, 135, 1150, 24, 135, 1203, 1203, 1248,
- /* 220 */ 135, 1102, 255, 255, 255, 255, 1102, 255, 1189, 135,
- /* 230 */ 287, 135, 195, 1332, 255, 1134, 1102, 255, 255, 1134,
- /* 240 */ 1102, 255, 255, 102, 1133, 1218, 1134, 1140, 1142, 1159,
- /* 250 */ 955, 1164, 195, 1372, 1151, 1154, 1156, 1151, 1154, 1151,
- /* 260 */ 1154, 1313, 1319, 255, 342, 1203, 135, 1379, 1219, 2548,
- /* 270 */ 2548, 2548, 2548, 2548, 2548, 2548, 83, 1653, 214, 337,
- /* 280 */ 126, 209, 492, 562, 625, 672, 535, 322, 713, 713,
- /* 290 */ 713, 713, 713, 713, 713, 713, 717, 840, 405, 405,
- /* 300 */ 69, 458, 197, 309, 85, 111, 8, 394, 170, 170,
- /* 310 */ 170, 170, 929, 1021, 934, 966, 1002, 1020, 1026, 1119,
- /* 320 */ 1121, 516, 841, 1034, 1035, 1048, 1071, 1072, 1079, 1083,
- /* 330 */ 1148, 910, 994, 1010, 1088, 1008, 1050, 1040, 1097, 1066,
- /* 340 */ 1110, 1115, 1117, 1124, 1125, 1127, 731, 1139, 1141, 1153,
- /* 350 */ 1206, 1440, 1454, 1281, 1459, 1461, 1420, 1463, 1429, 1280,
- /* 360 */ 1433, 1434, 1435, 1284, 1472, 1438, 1439, 1288, 1477, 1292,
- /* 370 */ 1478, 1451, 1489, 1468, 1491, 1457, 1322, 1325, 1497, 1498,
- /* 380 */ 1333, 1335, 1504, 1505, 1456, 1506, 1465, 1508, 1509, 1510,
- /* 390 */ 1362, 1513, 1514, 1515, 1516, 1517, 1374, 1484, 1520, 1377,
- /* 400 */ 1528, 1529, 1530, 1537, 1541, 1542, 1543, 1544, 1545, 1546,
- /* 410 */ 1547, 1549, 1551, 1552, 1481, 1524, 1525, 1526, 1554, 1556,
- /* 420 */ 1557, 1538, 1559, 1561, 1562, 1564, 1566, 1512, 1569, 1518,
- /* 430 */ 1570, 1571, 1531, 1533, 1534, 1567, 1532, 1578, 1555, 1576,
- /* 440 */ 1563, 1565, 1602, 1605, 1607, 1579, 1430, 1608, 1609, 1620,
- /* 450 */ 1560, 1623, 1624, 1590, 1582, 1587, 1628, 1595, 1584, 1594,
- /* 460 */ 1634, 1601, 1592, 1598, 1641, 1610, 1596, 1611, 1646, 1647,
- /* 470 */ 1648, 1651, 1558, 1568, 1618, 1632, 1655, 1625, 1615, 1619,
- /* 480 */ 1626, 1630, 1645, 1663, 1654, 1668, 1656, 1631, 1669, 1657,
- /* 490 */ 1650, 1681, 1658, 1682, 1661, 1695, 1675, 1678, 1699, 1553,
- /* 500 */ 1666, 1703, 1540, 1689, 1572, 1550, 1714, 1715, 1574, 1573,
- /* 510 */ 1716, 1717, 1718, 1633, 1629, 1686, 1583, 1723, 1635, 1580,
- /* 520 */ 1637, 1728, 1694, 1586, 1659, 1638, 1688, 1693, 1511, 1664,
- /* 530 */ 1662, 1665, 1673, 1674, 1677, 1697, 1680, 1679, 1683, 1690,
- /* 540 */ 1691, 1704, 1700, 1721, 1696, 1706, 1519, 1692, 1698, 1725,
- /* 550 */ 1575, 1740, 1738, 1741, 1701, 1743, 1577, 1702, 1755, 1758,
- /* 560 */ 1759, 1760, 1761, 1763, 1702, 1797, 1779, 1612, 1768, 1727,
- /* 570 */ 1713, 1729, 1722, 1730, 1724, 1769, 1731, 1732, 1771, 1800,
- /* 580 */ 1649, 1734, 1742, 1735, 1789, 1791, 1751, 1737, 1795, 1752,
- /* 590 */ 1753, 1810, 1765, 1757, 1813, 1766, 1762, 1814, 1767, 1744,
- /* 600 */ 1745, 1747, 1748, 1828, 1764, 1773, 1774, 1831, 1780, 1821,
- /* 610 */ 1821, 1846, 1808, 1812, 1836, 1840, 1841, 1843, 1844, 1845,
- /* 620 */ 1852, 1822, 1804, 1849, 1858, 1859, 1873, 1861, 1875, 1865,
- /* 630 */ 1866, 1842, 1615, 1876, 1619, 1877, 1878, 1879, 1880, 1886,
- /* 640 */ 1881, 1918, 1884, 1874, 1883, 1920, 1888, 1882, 1885, 1926,
- /* 650 */ 1893, 1887, 1892, 1933, 1901, 1891, 1898, 1939, 1906, 1909,
- /* 660 */ 1943, 1923, 1925, 1927, 1928, 1931, 1934,
+ /* 110 */ 213, 213, 213, 213, 213, 213, 213, 517, 881, 165,
+ /* 120 */ 403, 403, 573, 386, 849, 361, 361, 361, 386, 298,
+ /* 130 */ 298, 18, 350, 350, 67, 67, 294, 294, 270, 357,
+ /* 140 */ 198, 198, 198, 198, 198, 198, 198, 1119, 21, 383,
+ /* 150 */ 501, 105, 665, 484, 715, 828, 366, 799, 506, 800,
+ /* 160 */ 717, 649, 717, 924, 756, 756, 756, 807, 873, 980,
+ /* 170 */ 1174, 1078, 1206, 1232, 1232, 1206, 1107, 1107, 1232, 1232,
+ /* 180 */ 1232, 1257, 1257, 1264, 10, 18, 10, 1272, 1277, 10,
+ /* 190 */ 1272, 10, 10, 10, 1232, 10, 1257, 67, 67, 67,
+ /* 200 */ 67, 67, 67, 67, 67, 67, 67, 67, 1232, 1257,
+ /* 210 */ 294, 1264, 227, 1166, 18, 227, 1232, 1232, 1272, 227,
+ /* 220 */ 1118, 294, 294, 294, 294, 1118, 294, 1201, 227, 270,
+ /* 230 */ 227, 298, 1345, 294, 1139, 1118, 294, 294, 1139, 1118,
+ /* 240 */ 294, 294, 67, 1141, 1235, 1139, 1154, 1157, 1170, 980,
+ /* 250 */ 1178, 298, 1382, 1159, 1162, 1167, 1159, 1162, 1159, 1162,
+ /* 260 */ 1320, 1326, 294, 357, 1232, 227, 1383, 1257, 2259, 2259,
+ /* 270 */ 2259, 2259, 2259, 2259, 2259, 83, 1593, 214, 724, 126,
+ /* 280 */ 209, 491, 562, 622, 813, 535, 321, 698, 698, 698,
+ /* 290 */ 698, 698, 698, 698, 698, 521, 309, 13, 13, 115,
+ /* 300 */ 69, 599, 267, 708, 194, 377, 190, 465, 49, 49,
+ /* 310 */ 49, 49, 684, 944, 938, 994, 999, 1001, 947, 1047,
+ /* 320 */ 1101, 941, 920, 1025, 1043, 1069, 1079, 1091, 1093, 1102,
+ /* 330 */ 1160, 1073, 973, 895, 1103, 1075, 1082, 1058, 1106, 1114,
+ /* 340 */ 1115, 1133, 1163, 1165, 1193, 1198, 1064, 860, 1143, 1176,
+ /* 350 */ 839, 1473, 1476, 1301, 1479, 1480, 1439, 1482, 1448, 1297,
+ /* 360 */ 1450, 1451, 1452, 1302, 1490, 1456, 1457, 1307, 1495, 1310,
+ /* 370 */ 1502, 1477, 1513, 1493, 1516, 1483, 1348, 1347, 1521, 1527,
+ /* 380 */ 1357, 1359, 1525, 1528, 1494, 1529, 1499, 1539, 1542, 1543,
+ /* 390 */ 1395, 1545, 1552, 1554, 1555, 1556, 1403, 1514, 1548, 1413,
+ /* 400 */ 1559, 1560, 1561, 1562, 1566, 1567, 1568, 1569, 1570, 1571,
+ /* 410 */ 1573, 1574, 1575, 1578, 1544, 1590, 1591, 1598, 1600, 1601,
+ /* 420 */ 1612, 1581, 1604, 1605, 1614, 1616, 1619, 1564, 1621, 1572,
+ /* 430 */ 1627, 1629, 1582, 1584, 1588, 1620, 1587, 1622, 1589, 1638,
+ /* 440 */ 1599, 1602, 1650, 1651, 1652, 1617, 1492, 1657, 1658, 1665,
+ /* 450 */ 1607, 1667, 1671, 1608, 1597, 1633, 1673, 1639, 1630, 1637,
+ /* 460 */ 1679, 1645, 1640, 1647, 1688, 1654, 1644, 1653, 1693, 1694,
+ /* 470 */ 1698, 1699, 1609, 1606, 1666, 1678, 1703, 1670, 1675, 1680,
+ /* 480 */ 1686, 1695, 1684, 1710, 1711, 1732, 1713, 1702, 1737, 1722,
+ /* 490 */ 1717, 1754, 1720, 1756, 1724, 1757, 1738, 1741, 1762, 1610,
+ /* 500 */ 1731, 1768, 1613, 1748, 1618, 1624, 1771, 1773, 1625, 1615,
+ /* 510 */ 1780, 1781, 1783, 1696, 1697, 1755, 1634, 1798, 1712, 1648,
+ /* 520 */ 1715, 1800, 1778, 1659, 1735, 1727, 1782, 1784, 1611, 1740,
+ /* 530 */ 1742, 1745, 1746, 1747, 1749, 1787, 1750, 1758, 1760, 1761,
+ /* 540 */ 1763, 1792, 1793, 1799, 1765, 1801, 1626, 1770, 1772, 1815,
+ /* 550 */ 1641, 1809, 1817, 1818, 1775, 1825, 1642, 1779, 1835, 1849,
+ /* 560 */ 1858, 1859, 1860, 1864, 1779, 1898, 1885, 1716, 1867, 1823,
+ /* 570 */ 1824, 1826, 1827, 1829, 1830, 1870, 1833, 1834, 1878, 1891,
+ /* 580 */ 1743, 1844, 1819, 1845, 1899, 1901, 1848, 1850, 1906, 1853,
+ /* 590 */ 1854, 1908, 1856, 1863, 1911, 1861, 1865, 1913, 1868, 1836,
+ /* 600 */ 1843, 1847, 1851, 1936, 1862, 1872, 1876, 1927, 1877, 1925,
+ /* 610 */ 1925, 1947, 1914, 1909, 1938, 1940, 1943, 1945, 1954, 1955,
+ /* 620 */ 1958, 1928, 1922, 1952, 1963, 1965, 1988, 1976, 1991, 1980,
+ /* 630 */ 1981, 1950, 1675, 1985, 1680, 1994, 1995, 1998, 2000, 2014,
+ /* 640 */ 2003, 2039, 2005, 2002, 2011, 2051, 2017, 2006, 2015, 2055,
+ /* 650 */ 2021, 2013, 2019, 2069, 2035, 2024, 2034, 2076, 2042, 2043,
+ /* 660 */ 2079, 2058, 2060, 2062, 2063, 2061, 2066,
};
-#define YY_REDUCE_COUNT (275)
-#define YY_REDUCE_MIN (-389)
-#define YY_REDUCE_MAX (2125)
+#define YY_REDUCE_COUNT (274)
+#define YY_REDUCE_MIN (-403)
+#define YY_REDUCE_MAX (1873)
static const short yy_reduce_ofst[] = {
- /* 0 */ -75, 602, 629, -279, -15, 753, 815, 867, 923, 933,
- /* 10 */ 273, 982, 104, 1042, 1052, 1101, 1152, 1204, 1214, 1231,
- /* 20 */ 1291, 1308, 1376, 1394, 1453, 1502, 1523, 1581, 1591, 1643,
- /* 30 */ 1660, 1709, 1726, 1775, 1829, 1839, 1890, 1908, 1967, 1988,
- /* 40 */ 2044, 2054, 2078, 2125, -312, 33, 425, -295, 436, 490,
- /* 50 */ -308, 654, -345, -68, 77, 151, 246, -316, -310, -307,
- /* 60 */ -276, -285, -238, -87, -78, -313, -33, 239, 367, 418,
- /* 70 */ 420, 427, 505, 623, 689, 161, 698, 722, 723, -234,
- /* 80 */ 729, 730, 727, 742, 744, -244, -153, 749, 754, -10,
- /* 90 */ 782, 767, 91, -124, -389, -389, -389, -164, -51, -30,
- /* 100 */ -21, 100, 148, 205, 272, 311, 323, 357, 381, 382,
- /* 110 */ 430, 464, 540, 603, 607, 640, 641, 28, -263, -335,
- /* 120 */ 392, 443, 438, -229, -85, 234, 467, 570, 79, 18,
- /* 130 */ 365, 312, 341, 413, 223, 665, 545, 596, 668, 610,
- /* 140 */ 90, 220, 249, 308, 373, 387, 398, 252, 534, 518,
- /* 150 */ 645, 571, 677, 693, 680, 781, 781, 839, 848, 817,
- /* 160 */ 793, 769, 769, 769, 783, 758, 762, 763, 777, 781,
- /* 170 */ 812, 814, 836, 876, 918, 919, 880, 884, 889, 928,
- /* 180 */ 936, 941, 935, 945, 894, 946, 914, 950, 912, 911,
- /* 190 */ 958, 916, 960, 961, 963, 969, 968, 976, 953, 956,
- /* 200 */ 957, 959, 964, 965, 974, 975, 984, 985, 986, 978,
- /* 210 */ 981, 947, 954, 1005, 930, 979, 1009, 1013, 1016, 971,
- /* 220 */ 1017, 980, 988, 991, 993, 995, 987, 998, 992, 1030,
- /* 230 */ 1022, 1038, 1014, 989, 1004, 962, 1000, 1023, 1028, 970,
- /* 240 */ 1011, 1031, 1033, 781, 973, 972, 983, 990, 996, 999,
- /* 250 */ 1024, 769, 1051, 1027, 997, 1029, 1003, 1018, 1036, 1032,
- /* 260 */ 1037, 1055, 1070, 1062, 1086, 1098, 1095, 1105, 1109, 1053,
- /* 270 */ 1068, 1113, 1114, 1118, 1132, 1149,
+ /* 0 */ 263, 629, 747, -278, -14, 679, 846, 886, 955, 1009,
+ /* 10 */ 272, 1059, 104, 1076, 1126, 806, 1152, 1202, 1214, 1228,
+ /* 20 */ 1281, 1334, 1346, 1360, 1414, 1428, 1440, 1497, 1507, 1523,
+ /* 30 */ 1547, 1603, 1623, 1643, 1663, 1683, 1723, 1739, 1790, 1806,
+ /* 40 */ 1857, 1873, 304, 926, 112, 435, 552, -295, 610, -3,
+ /* 50 */ -261, -154, -323, 305, 575, 577, 635, -310, -272, -312,
+ /* 60 */ -307, -403, -311, -284, -70, -90, 225, 346, 404, 414,
+ /* 70 */ 429, 434, 497, 644, 645, 339, 674, 697, 710, -342,
+ /* 80 */ 722, 749, -313, 758, 772, -244, -251, 797, -17, 20,
+ /* 90 */ 48, 804, 228, 86, -379, -379, -379, -240, -13, 100,
+ /* 100 */ 101, 130, 206, 375, 385, 428, 459, 461, 474, 522,
+ /* 110 */ 566, 628, 656, 678, 694, 696, 740, -226, -92, -72,
+ /* 120 */ -256, -130, 173, 4, 34, 186, 362, 440, 97, 91,
+ /* 130 */ 303, -234, -109, 180, 274, 536, 317, 545, 579, 234,
+ /* 140 */ -333, 40, 144, 175, 242, 319, 410, 450, 445, 348,
+ /* 150 */ 369, 495, 572, 557, 620, 620, 734, 667, 688, 727,
+ /* 160 */ 735, 735, 735, 770, 752, 784, 786, 762, 620, 861,
+ /* 170 */ 874, 866, 894, 940, 942, 901, 907, 908, 956, 957,
+ /* 180 */ 960, 971, 972, 915, 966, 936, 974, 933, 935, 978,
+ /* 190 */ 939, 981, 983, 985, 991, 989, 1000, 975, 976, 977,
+ /* 200 */ 979, 982, 984, 986, 990, 992, 995, 996, 998, 1006,
+ /* 210 */ 993, 951, 1021, 987, 997, 1026, 1030, 1033, 988, 1032,
+ /* 220 */ 1002, 1005, 1008, 1013, 1014, 1010, 1015, 1011, 1048, 1038,
+ /* 230 */ 1053, 1031, 1003, 1028, 968, 1020, 1036, 1037, 1004, 1022,
+ /* 240 */ 1044, 1049, 620, 1016, 1012, 1018, 1023, 1027, 1024, 1029,
+ /* 250 */ 735, 1061, 1035, 1045, 1017, 1039, 1046, 1034, 1051, 1050,
+ /* 260 */ 1052, 1081, 1067, 1092, 1129, 1104, 1112, 1136, 1096, 1086,
+ /* 270 */ 1137, 1138, 1142, 1130, 1168,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 10 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 20 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 30 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 40 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 50 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 60 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 70 */ 1464, 1464, 1464, 1464, 1464, 1538, 1464, 1464, 1464, 1464,
- /* 80 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 90 */ 1464, 1464, 1536, 1694, 1464, 1871, 1464, 1464, 1464, 1464,
- /* 100 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 110 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 120 */ 1464, 1464, 1538, 1464, 1536, 1883, 1883, 1883, 1464, 1464,
- /* 130 */ 1464, 1464, 1737, 1737, 1464, 1464, 1464, 1464, 1636, 1464,
- /* 140 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1729, 1464, 1952,
- /* 150 */ 1464, 1464, 1464, 1735, 1906, 1464, 1464, 1464, 1464, 1589,
- /* 160 */ 1898, 1875, 1889, 1876, 1873, 1937, 1937, 1937, 1892, 1464,
- /* 170 */ 1902, 1464, 1722, 1699, 1464, 1464, 1699, 1696, 1696, 1464,
- /* 180 */ 1464, 1464, 1464, 1464, 1464, 1538, 1464, 1538, 1464, 1464,
- /* 190 */ 1538, 1464, 1538, 1538, 1538, 1464, 1538, 1464, 1464, 1464,
- /* 200 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 210 */ 1464, 1464, 1464, 1536, 1731, 1464, 1536, 1464, 1464, 1464,
- /* 220 */ 1536, 1911, 1464, 1464, 1464, 1464, 1911, 1464, 1464, 1536,
- /* 230 */ 1464, 1536, 1464, 1464, 1464, 1913, 1911, 1464, 1464, 1913,
- /* 240 */ 1911, 1464, 1464, 1464, 1925, 1921, 1913, 1929, 1927, 1904,
- /* 250 */ 1902, 1889, 1464, 1464, 1943, 1939, 1955, 1943, 1939, 1943,
- /* 260 */ 1939, 1464, 1605, 1464, 1464, 1464, 1536, 1496, 1464, 1724,
- /* 270 */ 1737, 1639, 1639, 1639, 1539, 1469, 1464, 1464, 1464, 1464,
- /* 280 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1808, 1924,
- /* 290 */ 1923, 1847, 1846, 1845, 1843, 1807, 1464, 1601, 1806, 1805,
- /* 300 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1799, 1800,
- /* 310 */ 1798, 1797, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 320 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 330 */ 1872, 1464, 1940, 1944, 1464, 1464, 1464, 1464, 1464, 1783,
- /* 340 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 350 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 360 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 370 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 380 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 390 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 400 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 410 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 420 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 430 */ 1464, 1464, 1464, 1464, 1501, 1464, 1464, 1464, 1464, 1464,
- /* 440 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 450 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 460 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 470 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1573, 1572,
- /* 480 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 490 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 500 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 510 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1741, 1464, 1464,
- /* 520 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1905, 1464, 1464,
- /* 530 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 540 */ 1464, 1464, 1464, 1783, 1464, 1922, 1464, 1882, 1878, 1464,
- /* 550 */ 1464, 1874, 1782, 1464, 1464, 1938, 1464, 1464, 1464, 1464,
- /* 560 */ 1464, 1464, 1464, 1464, 1464, 1867, 1464, 1464, 1840, 1825,
- /* 570 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 580 */ 1793, 1464, 1464, 1464, 1464, 1464, 1633, 1464, 1464, 1464,
- /* 590 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1618,
- /* 600 */ 1616, 1615, 1614, 1464, 1611, 1464, 1464, 1464, 1464, 1642,
- /* 610 */ 1641, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 620 */ 1464, 1464, 1464, 1557, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 630 */ 1464, 1464, 1549, 1464, 1548, 1464, 1464, 1464, 1464, 1464,
- /* 640 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 650 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464, 1464,
- /* 660 */ 1464, 1464, 1464, 1464, 1464, 1464, 1464,
+ /* 0 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 10 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 20 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 30 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 40 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 50 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 60 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 70 */ 1461, 1461, 1461, 1461, 1461, 1535, 1461, 1461, 1461, 1461,
+ /* 80 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 90 */ 1461, 1461, 1533, 1691, 1461, 1866, 1461, 1461, 1461, 1461,
+ /* 100 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 110 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 120 */ 1461, 1461, 1535, 1461, 1533, 1878, 1878, 1878, 1461, 1461,
+ /* 130 */ 1461, 1461, 1732, 1732, 1461, 1461, 1461, 1461, 1633, 1461,
+ /* 140 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1726, 1461, 1947,
+ /* 150 */ 1461, 1461, 1461, 1901, 1461, 1461, 1461, 1461, 1586, 1893,
+ /* 160 */ 1870, 1884, 1871, 1868, 1932, 1932, 1932, 1887, 1461, 1897,
+ /* 170 */ 1461, 1719, 1696, 1461, 1461, 1696, 1693, 1693, 1461, 1461,
+ /* 180 */ 1461, 1461, 1461, 1461, 1535, 1461, 1535, 1461, 1461, 1535,
+ /* 190 */ 1461, 1535, 1535, 1535, 1461, 1535, 1461, 1461, 1461, 1461,
+ /* 200 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 210 */ 1461, 1461, 1533, 1728, 1461, 1533, 1461, 1461, 1461, 1533,
+ /* 220 */ 1906, 1461, 1461, 1461, 1461, 1906, 1461, 1461, 1533, 1461,
+ /* 230 */ 1533, 1461, 1461, 1461, 1908, 1906, 1461, 1461, 1908, 1906,
+ /* 240 */ 1461, 1461, 1461, 1920, 1916, 1908, 1924, 1922, 1899, 1897,
+ /* 250 */ 1884, 1461, 1461, 1938, 1934, 1950, 1938, 1934, 1938, 1934,
+ /* 260 */ 1461, 1602, 1461, 1461, 1461, 1533, 1493, 1461, 1721, 1732,
+ /* 270 */ 1636, 1636, 1636, 1536, 1466, 1461, 1461, 1461, 1461, 1461,
+ /* 280 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1803, 1919, 1918,
+ /* 290 */ 1842, 1841, 1840, 1838, 1802, 1461, 1598, 1801, 1800, 1461,
+ /* 300 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1794, 1795,
+ /* 310 */ 1793, 1792, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 320 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 330 */ 1867, 1461, 1935, 1939, 1461, 1461, 1461, 1461, 1461, 1778,
+ /* 340 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 350 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 360 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 370 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 380 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 390 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 400 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 410 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 420 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 430 */ 1461, 1461, 1461, 1461, 1498, 1461, 1461, 1461, 1461, 1461,
+ /* 440 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 450 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 460 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 470 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1570, 1569,
+ /* 480 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 490 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 500 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 510 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1736, 1461, 1461,
+ /* 520 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1900, 1461, 1461,
+ /* 530 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 540 */ 1461, 1461, 1461, 1778, 1461, 1917, 1461, 1877, 1873, 1461,
+ /* 550 */ 1461, 1869, 1777, 1461, 1461, 1933, 1461, 1461, 1461, 1461,
+ /* 560 */ 1461, 1461, 1461, 1461, 1461, 1862, 1461, 1461, 1835, 1820,
+ /* 570 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 580 */ 1788, 1461, 1461, 1461, 1461, 1461, 1630, 1461, 1461, 1461,
+ /* 590 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1615,
+ /* 600 */ 1613, 1612, 1611, 1461, 1608, 1461, 1461, 1461, 1461, 1639,
+ /* 610 */ 1638, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 620 */ 1461, 1461, 1461, 1554, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 630 */ 1461, 1461, 1546, 1461, 1545, 1461, 1461, 1461, 1461, 1461,
+ /* 640 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 650 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461, 1461,
+ /* 660 */ 1461, 1461, 1461, 1461, 1461, 1461, 1461,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1686,62 +1642,61 @@ static const char *const yyTokenName[] = {
/* 368 */ "agg_func_opt",
/* 369 */ "bufsize_opt",
/* 370 */ "stream_name",
- /* 371 */ "into_opt",
- /* 372 */ "dnode_list",
- /* 373 */ "where_clause_opt",
- /* 374 */ "signed",
- /* 375 */ "literal_func",
- /* 376 */ "literal_list",
- /* 377 */ "table_alias",
- /* 378 */ "column_alias",
- /* 379 */ "expression",
- /* 380 */ "pseudo_column",
- /* 381 */ "column_reference",
- /* 382 */ "function_expression",
- /* 383 */ "subquery",
- /* 384 */ "star_func",
- /* 385 */ "star_func_para_list",
- /* 386 */ "noarg_func",
- /* 387 */ "other_para_list",
- /* 388 */ "star_func_para",
- /* 389 */ "predicate",
- /* 390 */ "compare_op",
- /* 391 */ "in_op",
- /* 392 */ "in_predicate_value",
- /* 393 */ "boolean_value_expression",
- /* 394 */ "boolean_primary",
- /* 395 */ "common_expression",
- /* 396 */ "from_clause_opt",
- /* 397 */ "table_reference_list",
- /* 398 */ "table_reference",
- /* 399 */ "table_primary",
- /* 400 */ "joined_table",
- /* 401 */ "alias_opt",
- /* 402 */ "parenthesized_joined_table",
- /* 403 */ "join_type",
- /* 404 */ "search_condition",
- /* 405 */ "query_specification",
- /* 406 */ "set_quantifier_opt",
- /* 407 */ "select_list",
- /* 408 */ "partition_by_clause_opt",
- /* 409 */ "range_opt",
- /* 410 */ "every_opt",
- /* 411 */ "fill_opt",
- /* 412 */ "twindow_clause_opt",
- /* 413 */ "group_by_clause_opt",
- /* 414 */ "having_clause_opt",
- /* 415 */ "select_item",
- /* 416 */ "fill_mode",
- /* 417 */ "group_by_list",
- /* 418 */ "query_expression_body",
- /* 419 */ "order_by_clause_opt",
- /* 420 */ "slimit_clause_opt",
- /* 421 */ "limit_clause_opt",
- /* 422 */ "query_primary",
- /* 423 */ "sort_specification_list",
- /* 424 */ "sort_specification",
- /* 425 */ "ordering_specification_opt",
- /* 426 */ "null_ordering_opt",
+ /* 371 */ "dnode_list",
+ /* 372 */ "where_clause_opt",
+ /* 373 */ "signed",
+ /* 374 */ "literal_func",
+ /* 375 */ "literal_list",
+ /* 376 */ "table_alias",
+ /* 377 */ "column_alias",
+ /* 378 */ "expression",
+ /* 379 */ "pseudo_column",
+ /* 380 */ "column_reference",
+ /* 381 */ "function_expression",
+ /* 382 */ "subquery",
+ /* 383 */ "star_func",
+ /* 384 */ "star_func_para_list",
+ /* 385 */ "noarg_func",
+ /* 386 */ "other_para_list",
+ /* 387 */ "star_func_para",
+ /* 388 */ "predicate",
+ /* 389 */ "compare_op",
+ /* 390 */ "in_op",
+ /* 391 */ "in_predicate_value",
+ /* 392 */ "boolean_value_expression",
+ /* 393 */ "boolean_primary",
+ /* 394 */ "common_expression",
+ /* 395 */ "from_clause_opt",
+ /* 396 */ "table_reference_list",
+ /* 397 */ "table_reference",
+ /* 398 */ "table_primary",
+ /* 399 */ "joined_table",
+ /* 400 */ "alias_opt",
+ /* 401 */ "parenthesized_joined_table",
+ /* 402 */ "join_type",
+ /* 403 */ "search_condition",
+ /* 404 */ "query_specification",
+ /* 405 */ "set_quantifier_opt",
+ /* 406 */ "select_list",
+ /* 407 */ "partition_by_clause_opt",
+ /* 408 */ "range_opt",
+ /* 409 */ "every_opt",
+ /* 410 */ "fill_opt",
+ /* 411 */ "twindow_clause_opt",
+ /* 412 */ "group_by_clause_opt",
+ /* 413 */ "having_clause_opt",
+ /* 414 */ "select_item",
+ /* 415 */ "fill_mode",
+ /* 416 */ "group_by_list",
+ /* 417 */ "query_expression_body",
+ /* 418 */ "order_by_clause_opt",
+ /* 419 */ "slimit_clause_opt",
+ /* 420 */ "limit_clause_opt",
+ /* 421 */ "query_primary",
+ /* 422 */ "sort_specification_list",
+ /* 423 */ "sort_specification",
+ /* 424 */ "ordering_specification_opt",
+ /* 425 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2015,231 +1970,229 @@ static const char *const yyRuleName[] = {
/* 263 */ "agg_func_opt ::= AGGREGATE",
/* 264 */ "bufsize_opt ::=",
/* 265 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 266 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression",
+ /* 266 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression",
/* 267 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 268 */ "into_opt ::=",
- /* 269 */ "into_opt ::= INTO full_table_name",
- /* 270 */ "stream_options ::=",
- /* 271 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 272 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 273 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 274 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 275 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 276 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 277 */ "cmd ::= KILL QUERY NK_STRING",
- /* 278 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 279 */ "cmd ::= BALANCE VGROUP",
- /* 280 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 281 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 282 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 283 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 284 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 285 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 286 */ "cmd ::= query_expression",
- /* 287 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression",
- /* 288 */ "cmd ::= INSERT INTO full_table_name query_expression",
- /* 289 */ "literal ::= NK_INTEGER",
- /* 290 */ "literal ::= NK_FLOAT",
- /* 291 */ "literal ::= NK_STRING",
- /* 292 */ "literal ::= NK_BOOL",
- /* 293 */ "literal ::= TIMESTAMP NK_STRING",
- /* 294 */ "literal ::= duration_literal",
- /* 295 */ "literal ::= NULL",
- /* 296 */ "literal ::= NK_QUESTION",
- /* 297 */ "duration_literal ::= NK_VARIABLE",
- /* 298 */ "signed ::= NK_INTEGER",
- /* 299 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 300 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 301 */ "signed ::= NK_FLOAT",
- /* 302 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 303 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 304 */ "signed_literal ::= signed",
- /* 305 */ "signed_literal ::= NK_STRING",
- /* 306 */ "signed_literal ::= NK_BOOL",
- /* 307 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 308 */ "signed_literal ::= duration_literal",
- /* 309 */ "signed_literal ::= NULL",
- /* 310 */ "signed_literal ::= literal_func",
- /* 311 */ "signed_literal ::= NK_QUESTION",
- /* 312 */ "literal_list ::= signed_literal",
- /* 313 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 314 */ "db_name ::= NK_ID",
- /* 315 */ "table_name ::= NK_ID",
- /* 316 */ "column_name ::= NK_ID",
- /* 317 */ "function_name ::= NK_ID",
- /* 318 */ "table_alias ::= NK_ID",
- /* 319 */ "column_alias ::= NK_ID",
- /* 320 */ "user_name ::= NK_ID",
- /* 321 */ "topic_name ::= NK_ID",
- /* 322 */ "stream_name ::= NK_ID",
- /* 323 */ "cgroup_name ::= NK_ID",
- /* 324 */ "expression ::= literal",
- /* 325 */ "expression ::= pseudo_column",
- /* 326 */ "expression ::= column_reference",
- /* 327 */ "expression ::= function_expression",
- /* 328 */ "expression ::= subquery",
- /* 329 */ "expression ::= NK_LP expression NK_RP",
- /* 330 */ "expression ::= NK_PLUS expression",
- /* 331 */ "expression ::= NK_MINUS expression",
- /* 332 */ "expression ::= expression NK_PLUS expression",
- /* 333 */ "expression ::= expression NK_MINUS expression",
- /* 334 */ "expression ::= expression NK_STAR expression",
- /* 335 */ "expression ::= expression NK_SLASH expression",
- /* 336 */ "expression ::= expression NK_REM expression",
- /* 337 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 338 */ "expression ::= expression NK_BITAND expression",
- /* 339 */ "expression ::= expression NK_BITOR expression",
- /* 340 */ "expression_list ::= expression",
- /* 341 */ "expression_list ::= expression_list NK_COMMA expression",
- /* 342 */ "column_reference ::= column_name",
- /* 343 */ "column_reference ::= table_name NK_DOT column_name",
- /* 344 */ "pseudo_column ::= ROWTS",
- /* 345 */ "pseudo_column ::= TBNAME",
- /* 346 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 347 */ "pseudo_column ::= QSTART",
- /* 348 */ "pseudo_column ::= QEND",
- /* 349 */ "pseudo_column ::= QDURATION",
- /* 350 */ "pseudo_column ::= WSTART",
- /* 351 */ "pseudo_column ::= WEND",
- /* 352 */ "pseudo_column ::= WDURATION",
- /* 353 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 354 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 355 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
- /* 356 */ "function_expression ::= literal_func",
- /* 357 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 358 */ "literal_func ::= NOW",
- /* 359 */ "noarg_func ::= NOW",
- /* 360 */ "noarg_func ::= TODAY",
- /* 361 */ "noarg_func ::= TIMEZONE",
- /* 362 */ "noarg_func ::= DATABASE",
- /* 363 */ "noarg_func ::= CLIENT_VERSION",
- /* 364 */ "noarg_func ::= SERVER_VERSION",
- /* 365 */ "noarg_func ::= SERVER_STATUS",
- /* 366 */ "noarg_func ::= CURRENT_USER",
- /* 367 */ "noarg_func ::= USER",
- /* 368 */ "star_func ::= COUNT",
- /* 369 */ "star_func ::= FIRST",
- /* 370 */ "star_func ::= LAST",
- /* 371 */ "star_func ::= LAST_ROW",
- /* 372 */ "star_func_para_list ::= NK_STAR",
- /* 373 */ "star_func_para_list ::= other_para_list",
- /* 374 */ "other_para_list ::= star_func_para",
- /* 375 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 376 */ "star_func_para ::= expression",
- /* 377 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 378 */ "predicate ::= expression compare_op expression",
- /* 379 */ "predicate ::= expression BETWEEN expression AND expression",
- /* 380 */ "predicate ::= expression NOT BETWEEN expression AND expression",
- /* 381 */ "predicate ::= expression IS NULL",
- /* 382 */ "predicate ::= expression IS NOT NULL",
- /* 383 */ "predicate ::= expression in_op in_predicate_value",
- /* 384 */ "compare_op ::= NK_LT",
- /* 385 */ "compare_op ::= NK_GT",
- /* 386 */ "compare_op ::= NK_LE",
- /* 387 */ "compare_op ::= NK_GE",
- /* 388 */ "compare_op ::= NK_NE",
- /* 389 */ "compare_op ::= NK_EQ",
- /* 390 */ "compare_op ::= LIKE",
- /* 391 */ "compare_op ::= NOT LIKE",
- /* 392 */ "compare_op ::= MATCH",
- /* 393 */ "compare_op ::= NMATCH",
- /* 394 */ "compare_op ::= CONTAINS",
- /* 395 */ "in_op ::= IN",
- /* 396 */ "in_op ::= NOT IN",
- /* 397 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 398 */ "boolean_value_expression ::= boolean_primary",
- /* 399 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 400 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 401 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 402 */ "boolean_primary ::= predicate",
- /* 403 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 404 */ "common_expression ::= expression",
- /* 405 */ "common_expression ::= boolean_value_expression",
- /* 406 */ "from_clause_opt ::=",
- /* 407 */ "from_clause_opt ::= FROM table_reference_list",
- /* 408 */ "table_reference_list ::= table_reference",
- /* 409 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 410 */ "table_reference ::= table_primary",
- /* 411 */ "table_reference ::= joined_table",
- /* 412 */ "table_primary ::= table_name alias_opt",
- /* 413 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 414 */ "table_primary ::= subquery alias_opt",
- /* 415 */ "table_primary ::= parenthesized_joined_table",
- /* 416 */ "alias_opt ::=",
- /* 417 */ "alias_opt ::= table_alias",
- /* 418 */ "alias_opt ::= AS table_alias",
- /* 419 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 420 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 421 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 422 */ "join_type ::=",
- /* 423 */ "join_type ::= INNER",
- /* 424 */ "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",
- /* 425 */ "set_quantifier_opt ::=",
- /* 426 */ "set_quantifier_opt ::= DISTINCT",
- /* 427 */ "set_quantifier_opt ::= ALL",
- /* 428 */ "select_list ::= select_item",
- /* 429 */ "select_list ::= select_list NK_COMMA select_item",
- /* 430 */ "select_item ::= NK_STAR",
- /* 431 */ "select_item ::= common_expression",
- /* 432 */ "select_item ::= common_expression column_alias",
- /* 433 */ "select_item ::= common_expression AS column_alias",
- /* 434 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 435 */ "where_clause_opt ::=",
- /* 436 */ "where_clause_opt ::= WHERE search_condition",
- /* 437 */ "partition_by_clause_opt ::=",
- /* 438 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
- /* 439 */ "twindow_clause_opt ::=",
- /* 440 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 441 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
- /* 442 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 443 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 444 */ "sliding_opt ::=",
- /* 445 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 446 */ "fill_opt ::=",
- /* 447 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 448 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 449 */ "fill_mode ::= NONE",
- /* 450 */ "fill_mode ::= PREV",
- /* 451 */ "fill_mode ::= NULL",
- /* 452 */ "fill_mode ::= LINEAR",
- /* 453 */ "fill_mode ::= NEXT",
- /* 454 */ "group_by_clause_opt ::=",
- /* 455 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 456 */ "group_by_list ::= expression",
- /* 457 */ "group_by_list ::= group_by_list NK_COMMA expression",
- /* 458 */ "having_clause_opt ::=",
- /* 459 */ "having_clause_opt ::= HAVING search_condition",
- /* 460 */ "range_opt ::=",
- /* 461 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP",
- /* 462 */ "every_opt ::=",
- /* 463 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 464 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 465 */ "query_expression_body ::= query_primary",
- /* 466 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
- /* 467 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
- /* 468 */ "query_primary ::= query_specification",
- /* 469 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
- /* 470 */ "order_by_clause_opt ::=",
- /* 471 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 472 */ "slimit_clause_opt ::=",
- /* 473 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 474 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 475 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 476 */ "limit_clause_opt ::=",
- /* 477 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 478 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 479 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 480 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 481 */ "search_condition ::= common_expression",
- /* 482 */ "sort_specification_list ::= sort_specification",
- /* 483 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 484 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
- /* 485 */ "ordering_specification_opt ::=",
- /* 486 */ "ordering_specification_opt ::= ASC",
- /* 487 */ "ordering_specification_opt ::= DESC",
- /* 488 */ "null_ordering_opt ::=",
- /* 489 */ "null_ordering_opt ::= NULLS FIRST",
- /* 490 */ "null_ordering_opt ::= NULLS LAST",
+ /* 268 */ "stream_options ::=",
+ /* 269 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 270 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 271 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 272 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 273 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 274 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 275 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 276 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 277 */ "cmd ::= BALANCE VGROUP",
+ /* 278 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 279 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 280 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 281 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 282 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 283 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 284 */ "cmd ::= query_expression",
+ /* 285 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression",
+ /* 286 */ "cmd ::= INSERT INTO full_table_name query_expression",
+ /* 287 */ "literal ::= NK_INTEGER",
+ /* 288 */ "literal ::= NK_FLOAT",
+ /* 289 */ "literal ::= NK_STRING",
+ /* 290 */ "literal ::= NK_BOOL",
+ /* 291 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 292 */ "literal ::= duration_literal",
+ /* 293 */ "literal ::= NULL",
+ /* 294 */ "literal ::= NK_QUESTION",
+ /* 295 */ "duration_literal ::= NK_VARIABLE",
+ /* 296 */ "signed ::= NK_INTEGER",
+ /* 297 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 298 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 299 */ "signed ::= NK_FLOAT",
+ /* 300 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 301 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 302 */ "signed_literal ::= signed",
+ /* 303 */ "signed_literal ::= NK_STRING",
+ /* 304 */ "signed_literal ::= NK_BOOL",
+ /* 305 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 306 */ "signed_literal ::= duration_literal",
+ /* 307 */ "signed_literal ::= NULL",
+ /* 308 */ "signed_literal ::= literal_func",
+ /* 309 */ "signed_literal ::= NK_QUESTION",
+ /* 310 */ "literal_list ::= signed_literal",
+ /* 311 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 312 */ "db_name ::= NK_ID",
+ /* 313 */ "table_name ::= NK_ID",
+ /* 314 */ "column_name ::= NK_ID",
+ /* 315 */ "function_name ::= NK_ID",
+ /* 316 */ "table_alias ::= NK_ID",
+ /* 317 */ "column_alias ::= NK_ID",
+ /* 318 */ "user_name ::= NK_ID",
+ /* 319 */ "topic_name ::= NK_ID",
+ /* 320 */ "stream_name ::= NK_ID",
+ /* 321 */ "cgroup_name ::= NK_ID",
+ /* 322 */ "expression ::= literal",
+ /* 323 */ "expression ::= pseudo_column",
+ /* 324 */ "expression ::= column_reference",
+ /* 325 */ "expression ::= function_expression",
+ /* 326 */ "expression ::= subquery",
+ /* 327 */ "expression ::= NK_LP expression NK_RP",
+ /* 328 */ "expression ::= NK_PLUS expression",
+ /* 329 */ "expression ::= NK_MINUS expression",
+ /* 330 */ "expression ::= expression NK_PLUS expression",
+ /* 331 */ "expression ::= expression NK_MINUS expression",
+ /* 332 */ "expression ::= expression NK_STAR expression",
+ /* 333 */ "expression ::= expression NK_SLASH expression",
+ /* 334 */ "expression ::= expression NK_REM expression",
+ /* 335 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 336 */ "expression ::= expression NK_BITAND expression",
+ /* 337 */ "expression ::= expression NK_BITOR expression",
+ /* 338 */ "expression_list ::= expression",
+ /* 339 */ "expression_list ::= expression_list NK_COMMA expression",
+ /* 340 */ "column_reference ::= column_name",
+ /* 341 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 342 */ "pseudo_column ::= ROWTS",
+ /* 343 */ "pseudo_column ::= TBNAME",
+ /* 344 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 345 */ "pseudo_column ::= QSTART",
+ /* 346 */ "pseudo_column ::= QEND",
+ /* 347 */ "pseudo_column ::= QDURATION",
+ /* 348 */ "pseudo_column ::= WSTART",
+ /* 349 */ "pseudo_column ::= WEND",
+ /* 350 */ "pseudo_column ::= WDURATION",
+ /* 351 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 352 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 353 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
+ /* 354 */ "function_expression ::= literal_func",
+ /* 355 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 356 */ "literal_func ::= NOW",
+ /* 357 */ "noarg_func ::= NOW",
+ /* 358 */ "noarg_func ::= TODAY",
+ /* 359 */ "noarg_func ::= TIMEZONE",
+ /* 360 */ "noarg_func ::= DATABASE",
+ /* 361 */ "noarg_func ::= CLIENT_VERSION",
+ /* 362 */ "noarg_func ::= SERVER_VERSION",
+ /* 363 */ "noarg_func ::= SERVER_STATUS",
+ /* 364 */ "noarg_func ::= CURRENT_USER",
+ /* 365 */ "noarg_func ::= USER",
+ /* 366 */ "star_func ::= COUNT",
+ /* 367 */ "star_func ::= FIRST",
+ /* 368 */ "star_func ::= LAST",
+ /* 369 */ "star_func ::= LAST_ROW",
+ /* 370 */ "star_func_para_list ::= NK_STAR",
+ /* 371 */ "star_func_para_list ::= other_para_list",
+ /* 372 */ "other_para_list ::= star_func_para",
+ /* 373 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 374 */ "star_func_para ::= expression",
+ /* 375 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 376 */ "predicate ::= expression compare_op expression",
+ /* 377 */ "predicate ::= expression BETWEEN expression AND expression",
+ /* 378 */ "predicate ::= expression NOT BETWEEN expression AND expression",
+ /* 379 */ "predicate ::= expression IS NULL",
+ /* 380 */ "predicate ::= expression IS NOT NULL",
+ /* 381 */ "predicate ::= expression in_op in_predicate_value",
+ /* 382 */ "compare_op ::= NK_LT",
+ /* 383 */ "compare_op ::= NK_GT",
+ /* 384 */ "compare_op ::= NK_LE",
+ /* 385 */ "compare_op ::= NK_GE",
+ /* 386 */ "compare_op ::= NK_NE",
+ /* 387 */ "compare_op ::= NK_EQ",
+ /* 388 */ "compare_op ::= LIKE",
+ /* 389 */ "compare_op ::= NOT LIKE",
+ /* 390 */ "compare_op ::= MATCH",
+ /* 391 */ "compare_op ::= NMATCH",
+ /* 392 */ "compare_op ::= CONTAINS",
+ /* 393 */ "in_op ::= IN",
+ /* 394 */ "in_op ::= NOT IN",
+ /* 395 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 396 */ "boolean_value_expression ::= boolean_primary",
+ /* 397 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 398 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 399 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 400 */ "boolean_primary ::= predicate",
+ /* 401 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 402 */ "common_expression ::= expression",
+ /* 403 */ "common_expression ::= boolean_value_expression",
+ /* 404 */ "from_clause_opt ::=",
+ /* 405 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 406 */ "table_reference_list ::= table_reference",
+ /* 407 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 408 */ "table_reference ::= table_primary",
+ /* 409 */ "table_reference ::= joined_table",
+ /* 410 */ "table_primary ::= table_name alias_opt",
+ /* 411 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 412 */ "table_primary ::= subquery alias_opt",
+ /* 413 */ "table_primary ::= parenthesized_joined_table",
+ /* 414 */ "alias_opt ::=",
+ /* 415 */ "alias_opt ::= table_alias",
+ /* 416 */ "alias_opt ::= AS table_alias",
+ /* 417 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 418 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 419 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 420 */ "join_type ::=",
+ /* 421 */ "join_type ::= INNER",
+ /* 422 */ "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",
+ /* 423 */ "set_quantifier_opt ::=",
+ /* 424 */ "set_quantifier_opt ::= DISTINCT",
+ /* 425 */ "set_quantifier_opt ::= ALL",
+ /* 426 */ "select_list ::= select_item",
+ /* 427 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 428 */ "select_item ::= NK_STAR",
+ /* 429 */ "select_item ::= common_expression",
+ /* 430 */ "select_item ::= common_expression column_alias",
+ /* 431 */ "select_item ::= common_expression AS column_alias",
+ /* 432 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 433 */ "where_clause_opt ::=",
+ /* 434 */ "where_clause_opt ::= WHERE search_condition",
+ /* 435 */ "partition_by_clause_opt ::=",
+ /* 436 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
+ /* 437 */ "twindow_clause_opt ::=",
+ /* 438 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 439 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
+ /* 440 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 441 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 442 */ "sliding_opt ::=",
+ /* 443 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 444 */ "fill_opt ::=",
+ /* 445 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 446 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 447 */ "fill_mode ::= NONE",
+ /* 448 */ "fill_mode ::= PREV",
+ /* 449 */ "fill_mode ::= NULL",
+ /* 450 */ "fill_mode ::= LINEAR",
+ /* 451 */ "fill_mode ::= NEXT",
+ /* 452 */ "group_by_clause_opt ::=",
+ /* 453 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 454 */ "group_by_list ::= expression",
+ /* 455 */ "group_by_list ::= group_by_list NK_COMMA expression",
+ /* 456 */ "having_clause_opt ::=",
+ /* 457 */ "having_clause_opt ::= HAVING search_condition",
+ /* 458 */ "range_opt ::=",
+ /* 459 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP",
+ /* 460 */ "every_opt ::=",
+ /* 461 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 462 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 463 */ "query_expression_body ::= query_primary",
+ /* 464 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
+ /* 465 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
+ /* 466 */ "query_primary ::= query_specification",
+ /* 467 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
+ /* 468 */ "order_by_clause_opt ::=",
+ /* 469 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 470 */ "slimit_clause_opt ::=",
+ /* 471 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 472 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 473 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 474 */ "limit_clause_opt ::=",
+ /* 475 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 476 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 477 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 478 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 479 */ "search_condition ::= common_expression",
+ /* 480 */ "sort_specification_list ::= sort_specification",
+ /* 481 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 482 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
+ /* 483 */ "ordering_specification_opt ::=",
+ /* 484 */ "ordering_specification_opt ::= ASC",
+ /* 485 */ "ordering_specification_opt ::= DESC",
+ /* 486 */ "null_ordering_opt ::=",
+ /* 487 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 488 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2393,42 +2346,41 @@ static void yy_destructor(
case 362: /* stream_options */
case 364: /* query_expression */
case 367: /* explain_options */
- case 371: /* into_opt */
- case 373: /* where_clause_opt */
- case 374: /* signed */
- case 375: /* literal_func */
- case 379: /* expression */
- case 380: /* pseudo_column */
- case 381: /* column_reference */
- case 382: /* function_expression */
- case 383: /* subquery */
- case 388: /* star_func_para */
- case 389: /* predicate */
- case 392: /* in_predicate_value */
- case 393: /* boolean_value_expression */
- case 394: /* boolean_primary */
- case 395: /* common_expression */
- case 396: /* from_clause_opt */
- case 397: /* table_reference_list */
- case 398: /* table_reference */
- case 399: /* table_primary */
- case 400: /* joined_table */
- case 402: /* parenthesized_joined_table */
- case 404: /* search_condition */
- case 405: /* query_specification */
- case 409: /* range_opt */
- case 410: /* every_opt */
- case 411: /* fill_opt */
- case 412: /* twindow_clause_opt */
- case 414: /* having_clause_opt */
- case 415: /* select_item */
- case 418: /* query_expression_body */
- case 420: /* slimit_clause_opt */
- case 421: /* limit_clause_opt */
- case 422: /* query_primary */
- case 424: /* sort_specification */
+ case 372: /* where_clause_opt */
+ case 373: /* signed */
+ case 374: /* literal_func */
+ case 378: /* expression */
+ case 379: /* pseudo_column */
+ case 380: /* column_reference */
+ case 381: /* function_expression */
+ case 382: /* subquery */
+ case 387: /* star_func_para */
+ case 388: /* predicate */
+ case 391: /* in_predicate_value */
+ case 392: /* boolean_value_expression */
+ case 393: /* boolean_primary */
+ case 394: /* common_expression */
+ case 395: /* from_clause_opt */
+ case 396: /* table_reference_list */
+ case 397: /* table_reference */
+ case 398: /* table_primary */
+ case 399: /* joined_table */
+ case 401: /* parenthesized_joined_table */
+ case 403: /* search_condition */
+ case 404: /* query_specification */
+ case 408: /* range_opt */
+ case 409: /* every_opt */
+ case 410: /* fill_opt */
+ case 411: /* twindow_clause_opt */
+ case 413: /* having_clause_opt */
+ case 414: /* select_item */
+ case 417: /* query_expression_body */
+ case 419: /* slimit_clause_opt */
+ case 420: /* limit_clause_opt */
+ case 421: /* query_primary */
+ case 423: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy840));
+ nodesDestroyNode((yypminor->yy272));
}
break;
case 306: /* account_options */
@@ -2449,11 +2401,11 @@ static void yy_destructor(
case 363: /* topic_name */
case 365: /* cgroup_name */
case 370: /* stream_name */
- case 377: /* table_alias */
- case 378: /* column_alias */
- case 384: /* star_func */
- case 386: /* noarg_func */
- case 401: /* alias_opt */
+ case 376: /* table_alias */
+ case 377: /* column_alias */
+ case 383: /* star_func */
+ case 385: /* noarg_func */
+ case 400: /* alias_opt */
{
}
@@ -2474,7 +2426,7 @@ static void yy_destructor(
case 320: /* exists_opt */
case 366: /* analyze_opt */
case 368: /* agg_func_opt */
- case 406: /* set_quantifier_opt */
+ case 405: /* set_quantifier_opt */
{
}
@@ -2493,18 +2445,18 @@ static void yy_destructor(
case 346: /* duration_list */
case 347: /* rollup_func_list */
case 358: /* func_list */
- case 372: /* dnode_list */
- case 376: /* literal_list */
- case 385: /* star_func_para_list */
- case 387: /* other_para_list */
- case 407: /* select_list */
- case 408: /* partition_by_clause_opt */
- case 413: /* group_by_clause_opt */
- case 417: /* group_by_list */
- case 419: /* order_by_clause_opt */
- case 423: /* sort_specification_list */
+ case 371: /* dnode_list */
+ case 375: /* literal_list */
+ case 384: /* star_func_para_list */
+ case 386: /* other_para_list */
+ case 406: /* select_list */
+ case 407: /* partition_by_clause_opt */
+ case 412: /* group_by_clause_opt */
+ case 416: /* group_by_list */
+ case 418: /* order_by_clause_opt */
+ case 422: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy544));
+ nodesDestroyList((yypminor->yy172));
}
break;
case 325: /* alter_db_option */
@@ -2518,28 +2470,28 @@ static void yy_destructor(
}
break;
- case 390: /* compare_op */
- case 391: /* in_op */
+ case 389: /* compare_op */
+ case 390: /* in_op */
{
}
break;
- case 403: /* join_type */
+ case 402: /* join_type */
{
}
break;
- case 416: /* fill_mode */
+ case 415: /* fill_mode */
{
}
break;
- case 425: /* ordering_specification_opt */
+ case 424: /* ordering_specification_opt */
{
}
break;
- case 426: /* null_ordering_opt */
+ case 425: /* null_ordering_opt */
{
}
@@ -3104,231 +3056,229 @@ static const struct {
{ 368, -1 }, /* (263) agg_func_opt ::= AGGREGATE */
{ 369, 0 }, /* (264) bufsize_opt ::= */
{ 369, -2 }, /* (265) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 305, -8 }, /* (266) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
+ { 305, -9 }, /* (266) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression */
{ 305, -4 }, /* (267) cmd ::= DROP STREAM exists_opt stream_name */
- { 371, 0 }, /* (268) into_opt ::= */
- { 371, -2 }, /* (269) into_opt ::= INTO full_table_name */
- { 362, 0 }, /* (270) stream_options ::= */
- { 362, -3 }, /* (271) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 362, -3 }, /* (272) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 362, -4 }, /* (273) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 362, -3 }, /* (274) stream_options ::= stream_options WATERMARK duration_literal */
- { 362, -4 }, /* (275) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { 305, -3 }, /* (276) cmd ::= KILL CONNECTION NK_INTEGER */
- { 305, -3 }, /* (277) cmd ::= KILL QUERY NK_STRING */
- { 305, -3 }, /* (278) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 305, -2 }, /* (279) cmd ::= BALANCE VGROUP */
- { 305, -4 }, /* (280) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 305, -4 }, /* (281) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 305, -3 }, /* (282) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 372, -2 }, /* (283) dnode_list ::= DNODE NK_INTEGER */
- { 372, -3 }, /* (284) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 305, -4 }, /* (285) cmd ::= DELETE FROM full_table_name where_clause_opt */
- { 305, -1 }, /* (286) cmd ::= query_expression */
- { 305, -7 }, /* (287) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
- { 305, -4 }, /* (288) cmd ::= INSERT INTO full_table_name query_expression */
- { 308, -1 }, /* (289) literal ::= NK_INTEGER */
- { 308, -1 }, /* (290) literal ::= NK_FLOAT */
- { 308, -1 }, /* (291) literal ::= NK_STRING */
- { 308, -1 }, /* (292) literal ::= NK_BOOL */
- { 308, -2 }, /* (293) literal ::= TIMESTAMP NK_STRING */
- { 308, -1 }, /* (294) literal ::= duration_literal */
- { 308, -1 }, /* (295) literal ::= NULL */
- { 308, -1 }, /* (296) literal ::= NK_QUESTION */
- { 349, -1 }, /* (297) duration_literal ::= NK_VARIABLE */
- { 374, -1 }, /* (298) signed ::= NK_INTEGER */
- { 374, -2 }, /* (299) signed ::= NK_PLUS NK_INTEGER */
- { 374, -2 }, /* (300) signed ::= NK_MINUS NK_INTEGER */
- { 374, -1 }, /* (301) signed ::= NK_FLOAT */
- { 374, -2 }, /* (302) signed ::= NK_PLUS NK_FLOAT */
- { 374, -2 }, /* (303) signed ::= NK_MINUS NK_FLOAT */
- { 338, -1 }, /* (304) signed_literal ::= signed */
- { 338, -1 }, /* (305) signed_literal ::= NK_STRING */
- { 338, -1 }, /* (306) signed_literal ::= NK_BOOL */
- { 338, -2 }, /* (307) signed_literal ::= TIMESTAMP NK_STRING */
- { 338, -1 }, /* (308) signed_literal ::= duration_literal */
- { 338, -1 }, /* (309) signed_literal ::= NULL */
- { 338, -1 }, /* (310) signed_literal ::= literal_func */
- { 338, -1 }, /* (311) signed_literal ::= NK_QUESTION */
- { 376, -1 }, /* (312) literal_list ::= signed_literal */
- { 376, -3 }, /* (313) literal_list ::= literal_list NK_COMMA signed_literal */
- { 316, -1 }, /* (314) db_name ::= NK_ID */
- { 344, -1 }, /* (315) table_name ::= NK_ID */
- { 336, -1 }, /* (316) column_name ::= NK_ID */
- { 351, -1 }, /* (317) function_name ::= NK_ID */
- { 377, -1 }, /* (318) table_alias ::= NK_ID */
- { 378, -1 }, /* (319) column_alias ::= NK_ID */
- { 310, -1 }, /* (320) user_name ::= NK_ID */
- { 363, -1 }, /* (321) topic_name ::= NK_ID */
- { 370, -1 }, /* (322) stream_name ::= NK_ID */
- { 365, -1 }, /* (323) cgroup_name ::= NK_ID */
- { 379, -1 }, /* (324) expression ::= literal */
- { 379, -1 }, /* (325) expression ::= pseudo_column */
- { 379, -1 }, /* (326) expression ::= column_reference */
- { 379, -1 }, /* (327) expression ::= function_expression */
- { 379, -1 }, /* (328) expression ::= subquery */
- { 379, -3 }, /* (329) expression ::= NK_LP expression NK_RP */
- { 379, -2 }, /* (330) expression ::= NK_PLUS expression */
- { 379, -2 }, /* (331) expression ::= NK_MINUS expression */
- { 379, -3 }, /* (332) expression ::= expression NK_PLUS expression */
- { 379, -3 }, /* (333) expression ::= expression NK_MINUS expression */
- { 379, -3 }, /* (334) expression ::= expression NK_STAR expression */
- { 379, -3 }, /* (335) expression ::= expression NK_SLASH expression */
- { 379, -3 }, /* (336) expression ::= expression NK_REM expression */
- { 379, -3 }, /* (337) expression ::= column_reference NK_ARROW NK_STRING */
- { 379, -3 }, /* (338) expression ::= expression NK_BITAND expression */
- { 379, -3 }, /* (339) expression ::= expression NK_BITOR expression */
- { 341, -1 }, /* (340) expression_list ::= expression */
- { 341, -3 }, /* (341) expression_list ::= expression_list NK_COMMA expression */
- { 381, -1 }, /* (342) column_reference ::= column_name */
- { 381, -3 }, /* (343) column_reference ::= table_name NK_DOT column_name */
- { 380, -1 }, /* (344) pseudo_column ::= ROWTS */
- { 380, -1 }, /* (345) pseudo_column ::= TBNAME */
- { 380, -3 }, /* (346) pseudo_column ::= table_name NK_DOT TBNAME */
- { 380, -1 }, /* (347) pseudo_column ::= QSTART */
- { 380, -1 }, /* (348) pseudo_column ::= QEND */
- { 380, -1 }, /* (349) pseudo_column ::= QDURATION */
- { 380, -1 }, /* (350) pseudo_column ::= WSTART */
- { 380, -1 }, /* (351) pseudo_column ::= WEND */
- { 380, -1 }, /* (352) pseudo_column ::= WDURATION */
- { 382, -4 }, /* (353) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 382, -4 }, /* (354) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 382, -6 }, /* (355) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
- { 382, -1 }, /* (356) function_expression ::= literal_func */
- { 375, -3 }, /* (357) literal_func ::= noarg_func NK_LP NK_RP */
- { 375, -1 }, /* (358) literal_func ::= NOW */
- { 386, -1 }, /* (359) noarg_func ::= NOW */
- { 386, -1 }, /* (360) noarg_func ::= TODAY */
- { 386, -1 }, /* (361) noarg_func ::= TIMEZONE */
- { 386, -1 }, /* (362) noarg_func ::= DATABASE */
- { 386, -1 }, /* (363) noarg_func ::= CLIENT_VERSION */
- { 386, -1 }, /* (364) noarg_func ::= SERVER_VERSION */
- { 386, -1 }, /* (365) noarg_func ::= SERVER_STATUS */
- { 386, -1 }, /* (366) noarg_func ::= CURRENT_USER */
- { 386, -1 }, /* (367) noarg_func ::= USER */
- { 384, -1 }, /* (368) star_func ::= COUNT */
- { 384, -1 }, /* (369) star_func ::= FIRST */
- { 384, -1 }, /* (370) star_func ::= LAST */
- { 384, -1 }, /* (371) star_func ::= LAST_ROW */
- { 385, -1 }, /* (372) star_func_para_list ::= NK_STAR */
- { 385, -1 }, /* (373) star_func_para_list ::= other_para_list */
- { 387, -1 }, /* (374) other_para_list ::= star_func_para */
- { 387, -3 }, /* (375) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 388, -1 }, /* (376) star_func_para ::= expression */
- { 388, -3 }, /* (377) star_func_para ::= table_name NK_DOT NK_STAR */
- { 389, -3 }, /* (378) predicate ::= expression compare_op expression */
- { 389, -5 }, /* (379) predicate ::= expression BETWEEN expression AND expression */
- { 389, -6 }, /* (380) predicate ::= expression NOT BETWEEN expression AND expression */
- { 389, -3 }, /* (381) predicate ::= expression IS NULL */
- { 389, -4 }, /* (382) predicate ::= expression IS NOT NULL */
- { 389, -3 }, /* (383) predicate ::= expression in_op in_predicate_value */
- { 390, -1 }, /* (384) compare_op ::= NK_LT */
- { 390, -1 }, /* (385) compare_op ::= NK_GT */
- { 390, -1 }, /* (386) compare_op ::= NK_LE */
- { 390, -1 }, /* (387) compare_op ::= NK_GE */
- { 390, -1 }, /* (388) compare_op ::= NK_NE */
- { 390, -1 }, /* (389) compare_op ::= NK_EQ */
- { 390, -1 }, /* (390) compare_op ::= LIKE */
- { 390, -2 }, /* (391) compare_op ::= NOT LIKE */
- { 390, -1 }, /* (392) compare_op ::= MATCH */
- { 390, -1 }, /* (393) compare_op ::= NMATCH */
- { 390, -1 }, /* (394) compare_op ::= CONTAINS */
- { 391, -1 }, /* (395) in_op ::= IN */
- { 391, -2 }, /* (396) in_op ::= NOT IN */
- { 392, -3 }, /* (397) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 393, -1 }, /* (398) boolean_value_expression ::= boolean_primary */
- { 393, -2 }, /* (399) boolean_value_expression ::= NOT boolean_primary */
- { 393, -3 }, /* (400) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 393, -3 }, /* (401) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 394, -1 }, /* (402) boolean_primary ::= predicate */
- { 394, -3 }, /* (403) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 395, -1 }, /* (404) common_expression ::= expression */
- { 395, -1 }, /* (405) common_expression ::= boolean_value_expression */
- { 396, 0 }, /* (406) from_clause_opt ::= */
- { 396, -2 }, /* (407) from_clause_opt ::= FROM table_reference_list */
- { 397, -1 }, /* (408) table_reference_list ::= table_reference */
- { 397, -3 }, /* (409) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 398, -1 }, /* (410) table_reference ::= table_primary */
- { 398, -1 }, /* (411) table_reference ::= joined_table */
- { 399, -2 }, /* (412) table_primary ::= table_name alias_opt */
- { 399, -4 }, /* (413) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 399, -2 }, /* (414) table_primary ::= subquery alias_opt */
- { 399, -1 }, /* (415) table_primary ::= parenthesized_joined_table */
- { 401, 0 }, /* (416) alias_opt ::= */
- { 401, -1 }, /* (417) alias_opt ::= table_alias */
- { 401, -2 }, /* (418) alias_opt ::= AS table_alias */
- { 402, -3 }, /* (419) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 402, -3 }, /* (420) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 400, -6 }, /* (421) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 403, 0 }, /* (422) join_type ::= */
- { 403, -1 }, /* (423) join_type ::= INNER */
- { 405, -12 }, /* (424) 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 */
- { 406, 0 }, /* (425) set_quantifier_opt ::= */
- { 406, -1 }, /* (426) set_quantifier_opt ::= DISTINCT */
- { 406, -1 }, /* (427) set_quantifier_opt ::= ALL */
- { 407, -1 }, /* (428) select_list ::= select_item */
- { 407, -3 }, /* (429) select_list ::= select_list NK_COMMA select_item */
- { 415, -1 }, /* (430) select_item ::= NK_STAR */
- { 415, -1 }, /* (431) select_item ::= common_expression */
- { 415, -2 }, /* (432) select_item ::= common_expression column_alias */
- { 415, -3 }, /* (433) select_item ::= common_expression AS column_alias */
- { 415, -3 }, /* (434) select_item ::= table_name NK_DOT NK_STAR */
- { 373, 0 }, /* (435) where_clause_opt ::= */
- { 373, -2 }, /* (436) where_clause_opt ::= WHERE search_condition */
- { 408, 0 }, /* (437) partition_by_clause_opt ::= */
- { 408, -3 }, /* (438) partition_by_clause_opt ::= PARTITION BY expression_list */
- { 412, 0 }, /* (439) twindow_clause_opt ::= */
- { 412, -6 }, /* (440) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 412, -4 }, /* (441) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
- { 412, -6 }, /* (442) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 412, -8 }, /* (443) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 359, 0 }, /* (444) sliding_opt ::= */
- { 359, -4 }, /* (445) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 411, 0 }, /* (446) fill_opt ::= */
- { 411, -4 }, /* (447) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 411, -6 }, /* (448) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 416, -1 }, /* (449) fill_mode ::= NONE */
- { 416, -1 }, /* (450) fill_mode ::= PREV */
- { 416, -1 }, /* (451) fill_mode ::= NULL */
- { 416, -1 }, /* (452) fill_mode ::= LINEAR */
- { 416, -1 }, /* (453) fill_mode ::= NEXT */
- { 413, 0 }, /* (454) group_by_clause_opt ::= */
- { 413, -3 }, /* (455) group_by_clause_opt ::= GROUP BY group_by_list */
- { 417, -1 }, /* (456) group_by_list ::= expression */
- { 417, -3 }, /* (457) group_by_list ::= group_by_list NK_COMMA expression */
- { 414, 0 }, /* (458) having_clause_opt ::= */
- { 414, -2 }, /* (459) having_clause_opt ::= HAVING search_condition */
- { 409, 0 }, /* (460) range_opt ::= */
- { 409, -6 }, /* (461) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
- { 410, 0 }, /* (462) every_opt ::= */
- { 410, -4 }, /* (463) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 364, -4 }, /* (464) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 418, -1 }, /* (465) query_expression_body ::= query_primary */
- { 418, -4 }, /* (466) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
- { 418, -3 }, /* (467) query_expression_body ::= query_expression_body UNION query_expression_body */
- { 422, -1 }, /* (468) query_primary ::= query_specification */
- { 422, -6 }, /* (469) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
- { 419, 0 }, /* (470) order_by_clause_opt ::= */
- { 419, -3 }, /* (471) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 420, 0 }, /* (472) slimit_clause_opt ::= */
- { 420, -2 }, /* (473) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 420, -4 }, /* (474) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 420, -4 }, /* (475) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 421, 0 }, /* (476) limit_clause_opt ::= */
- { 421, -2 }, /* (477) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 421, -4 }, /* (478) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 421, -4 }, /* (479) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 383, -3 }, /* (480) subquery ::= NK_LP query_expression NK_RP */
- { 404, -1 }, /* (481) search_condition ::= common_expression */
- { 423, -1 }, /* (482) sort_specification_list ::= sort_specification */
- { 423, -3 }, /* (483) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 424, -3 }, /* (484) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
- { 425, 0 }, /* (485) ordering_specification_opt ::= */
- { 425, -1 }, /* (486) ordering_specification_opt ::= ASC */
- { 425, -1 }, /* (487) ordering_specification_opt ::= DESC */
- { 426, 0 }, /* (488) null_ordering_opt ::= */
- { 426, -2 }, /* (489) null_ordering_opt ::= NULLS FIRST */
- { 426, -2 }, /* (490) null_ordering_opt ::= NULLS LAST */
+ { 362, 0 }, /* (268) stream_options ::= */
+ { 362, -3 }, /* (269) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 362, -3 }, /* (270) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 362, -4 }, /* (271) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 362, -3 }, /* (272) stream_options ::= stream_options WATERMARK duration_literal */
+ { 362, -4 }, /* (273) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ { 305, -3 }, /* (274) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 305, -3 }, /* (275) cmd ::= KILL QUERY NK_STRING */
+ { 305, -3 }, /* (276) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 305, -2 }, /* (277) cmd ::= BALANCE VGROUP */
+ { 305, -4 }, /* (278) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 305, -4 }, /* (279) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 305, -3 }, /* (280) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 371, -2 }, /* (281) dnode_list ::= DNODE NK_INTEGER */
+ { 371, -3 }, /* (282) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 305, -4 }, /* (283) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ { 305, -1 }, /* (284) cmd ::= query_expression */
+ { 305, -7 }, /* (285) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
+ { 305, -4 }, /* (286) cmd ::= INSERT INTO full_table_name query_expression */
+ { 308, -1 }, /* (287) literal ::= NK_INTEGER */
+ { 308, -1 }, /* (288) literal ::= NK_FLOAT */
+ { 308, -1 }, /* (289) literal ::= NK_STRING */
+ { 308, -1 }, /* (290) literal ::= NK_BOOL */
+ { 308, -2 }, /* (291) literal ::= TIMESTAMP NK_STRING */
+ { 308, -1 }, /* (292) literal ::= duration_literal */
+ { 308, -1 }, /* (293) literal ::= NULL */
+ { 308, -1 }, /* (294) literal ::= NK_QUESTION */
+ { 349, -1 }, /* (295) duration_literal ::= NK_VARIABLE */
+ { 373, -1 }, /* (296) signed ::= NK_INTEGER */
+ { 373, -2 }, /* (297) signed ::= NK_PLUS NK_INTEGER */
+ { 373, -2 }, /* (298) signed ::= NK_MINUS NK_INTEGER */
+ { 373, -1 }, /* (299) signed ::= NK_FLOAT */
+ { 373, -2 }, /* (300) signed ::= NK_PLUS NK_FLOAT */
+ { 373, -2 }, /* (301) signed ::= NK_MINUS NK_FLOAT */
+ { 338, -1 }, /* (302) signed_literal ::= signed */
+ { 338, -1 }, /* (303) signed_literal ::= NK_STRING */
+ { 338, -1 }, /* (304) signed_literal ::= NK_BOOL */
+ { 338, -2 }, /* (305) signed_literal ::= TIMESTAMP NK_STRING */
+ { 338, -1 }, /* (306) signed_literal ::= duration_literal */
+ { 338, -1 }, /* (307) signed_literal ::= NULL */
+ { 338, -1 }, /* (308) signed_literal ::= literal_func */
+ { 338, -1 }, /* (309) signed_literal ::= NK_QUESTION */
+ { 375, -1 }, /* (310) literal_list ::= signed_literal */
+ { 375, -3 }, /* (311) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 316, -1 }, /* (312) db_name ::= NK_ID */
+ { 344, -1 }, /* (313) table_name ::= NK_ID */
+ { 336, -1 }, /* (314) column_name ::= NK_ID */
+ { 351, -1 }, /* (315) function_name ::= NK_ID */
+ { 376, -1 }, /* (316) table_alias ::= NK_ID */
+ { 377, -1 }, /* (317) column_alias ::= NK_ID */
+ { 310, -1 }, /* (318) user_name ::= NK_ID */
+ { 363, -1 }, /* (319) topic_name ::= NK_ID */
+ { 370, -1 }, /* (320) stream_name ::= NK_ID */
+ { 365, -1 }, /* (321) cgroup_name ::= NK_ID */
+ { 378, -1 }, /* (322) expression ::= literal */
+ { 378, -1 }, /* (323) expression ::= pseudo_column */
+ { 378, -1 }, /* (324) expression ::= column_reference */
+ { 378, -1 }, /* (325) expression ::= function_expression */
+ { 378, -1 }, /* (326) expression ::= subquery */
+ { 378, -3 }, /* (327) expression ::= NK_LP expression NK_RP */
+ { 378, -2 }, /* (328) expression ::= NK_PLUS expression */
+ { 378, -2 }, /* (329) expression ::= NK_MINUS expression */
+ { 378, -3 }, /* (330) expression ::= expression NK_PLUS expression */
+ { 378, -3 }, /* (331) expression ::= expression NK_MINUS expression */
+ { 378, -3 }, /* (332) expression ::= expression NK_STAR expression */
+ { 378, -3 }, /* (333) expression ::= expression NK_SLASH expression */
+ { 378, -3 }, /* (334) expression ::= expression NK_REM expression */
+ { 378, -3 }, /* (335) expression ::= column_reference NK_ARROW NK_STRING */
+ { 378, -3 }, /* (336) expression ::= expression NK_BITAND expression */
+ { 378, -3 }, /* (337) expression ::= expression NK_BITOR expression */
+ { 341, -1 }, /* (338) expression_list ::= expression */
+ { 341, -3 }, /* (339) expression_list ::= expression_list NK_COMMA expression */
+ { 380, -1 }, /* (340) column_reference ::= column_name */
+ { 380, -3 }, /* (341) column_reference ::= table_name NK_DOT column_name */
+ { 379, -1 }, /* (342) pseudo_column ::= ROWTS */
+ { 379, -1 }, /* (343) pseudo_column ::= TBNAME */
+ { 379, -3 }, /* (344) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 379, -1 }, /* (345) pseudo_column ::= QSTART */
+ { 379, -1 }, /* (346) pseudo_column ::= QEND */
+ { 379, -1 }, /* (347) pseudo_column ::= QDURATION */
+ { 379, -1 }, /* (348) pseudo_column ::= WSTART */
+ { 379, -1 }, /* (349) pseudo_column ::= WEND */
+ { 379, -1 }, /* (350) pseudo_column ::= WDURATION */
+ { 381, -4 }, /* (351) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 381, -4 }, /* (352) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 381, -6 }, /* (353) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+ { 381, -1 }, /* (354) function_expression ::= literal_func */
+ { 374, -3 }, /* (355) literal_func ::= noarg_func NK_LP NK_RP */
+ { 374, -1 }, /* (356) literal_func ::= NOW */
+ { 385, -1 }, /* (357) noarg_func ::= NOW */
+ { 385, -1 }, /* (358) noarg_func ::= TODAY */
+ { 385, -1 }, /* (359) noarg_func ::= TIMEZONE */
+ { 385, -1 }, /* (360) noarg_func ::= DATABASE */
+ { 385, -1 }, /* (361) noarg_func ::= CLIENT_VERSION */
+ { 385, -1 }, /* (362) noarg_func ::= SERVER_VERSION */
+ { 385, -1 }, /* (363) noarg_func ::= SERVER_STATUS */
+ { 385, -1 }, /* (364) noarg_func ::= CURRENT_USER */
+ { 385, -1 }, /* (365) noarg_func ::= USER */
+ { 383, -1 }, /* (366) star_func ::= COUNT */
+ { 383, -1 }, /* (367) star_func ::= FIRST */
+ { 383, -1 }, /* (368) star_func ::= LAST */
+ { 383, -1 }, /* (369) star_func ::= LAST_ROW */
+ { 384, -1 }, /* (370) star_func_para_list ::= NK_STAR */
+ { 384, -1 }, /* (371) star_func_para_list ::= other_para_list */
+ { 386, -1 }, /* (372) other_para_list ::= star_func_para */
+ { 386, -3 }, /* (373) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 387, -1 }, /* (374) star_func_para ::= expression */
+ { 387, -3 }, /* (375) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 388, -3 }, /* (376) predicate ::= expression compare_op expression */
+ { 388, -5 }, /* (377) predicate ::= expression BETWEEN expression AND expression */
+ { 388, -6 }, /* (378) predicate ::= expression NOT BETWEEN expression AND expression */
+ { 388, -3 }, /* (379) predicate ::= expression IS NULL */
+ { 388, -4 }, /* (380) predicate ::= expression IS NOT NULL */
+ { 388, -3 }, /* (381) predicate ::= expression in_op in_predicate_value */
+ { 389, -1 }, /* (382) compare_op ::= NK_LT */
+ { 389, -1 }, /* (383) compare_op ::= NK_GT */
+ { 389, -1 }, /* (384) compare_op ::= NK_LE */
+ { 389, -1 }, /* (385) compare_op ::= NK_GE */
+ { 389, -1 }, /* (386) compare_op ::= NK_NE */
+ { 389, -1 }, /* (387) compare_op ::= NK_EQ */
+ { 389, -1 }, /* (388) compare_op ::= LIKE */
+ { 389, -2 }, /* (389) compare_op ::= NOT LIKE */
+ { 389, -1 }, /* (390) compare_op ::= MATCH */
+ { 389, -1 }, /* (391) compare_op ::= NMATCH */
+ { 389, -1 }, /* (392) compare_op ::= CONTAINS */
+ { 390, -1 }, /* (393) in_op ::= IN */
+ { 390, -2 }, /* (394) in_op ::= NOT IN */
+ { 391, -3 }, /* (395) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 392, -1 }, /* (396) boolean_value_expression ::= boolean_primary */
+ { 392, -2 }, /* (397) boolean_value_expression ::= NOT boolean_primary */
+ { 392, -3 }, /* (398) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 392, -3 }, /* (399) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 393, -1 }, /* (400) boolean_primary ::= predicate */
+ { 393, -3 }, /* (401) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 394, -1 }, /* (402) common_expression ::= expression */
+ { 394, -1 }, /* (403) common_expression ::= boolean_value_expression */
+ { 395, 0 }, /* (404) from_clause_opt ::= */
+ { 395, -2 }, /* (405) from_clause_opt ::= FROM table_reference_list */
+ { 396, -1 }, /* (406) table_reference_list ::= table_reference */
+ { 396, -3 }, /* (407) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 397, -1 }, /* (408) table_reference ::= table_primary */
+ { 397, -1 }, /* (409) table_reference ::= joined_table */
+ { 398, -2 }, /* (410) table_primary ::= table_name alias_opt */
+ { 398, -4 }, /* (411) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 398, -2 }, /* (412) table_primary ::= subquery alias_opt */
+ { 398, -1 }, /* (413) table_primary ::= parenthesized_joined_table */
+ { 400, 0 }, /* (414) alias_opt ::= */
+ { 400, -1 }, /* (415) alias_opt ::= table_alias */
+ { 400, -2 }, /* (416) alias_opt ::= AS table_alias */
+ { 401, -3 }, /* (417) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 401, -3 }, /* (418) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 399, -6 }, /* (419) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 402, 0 }, /* (420) join_type ::= */
+ { 402, -1 }, /* (421) join_type ::= INNER */
+ { 404, -12 }, /* (422) 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 */
+ { 405, 0 }, /* (423) set_quantifier_opt ::= */
+ { 405, -1 }, /* (424) set_quantifier_opt ::= DISTINCT */
+ { 405, -1 }, /* (425) set_quantifier_opt ::= ALL */
+ { 406, -1 }, /* (426) select_list ::= select_item */
+ { 406, -3 }, /* (427) select_list ::= select_list NK_COMMA select_item */
+ { 414, -1 }, /* (428) select_item ::= NK_STAR */
+ { 414, -1 }, /* (429) select_item ::= common_expression */
+ { 414, -2 }, /* (430) select_item ::= common_expression column_alias */
+ { 414, -3 }, /* (431) select_item ::= common_expression AS column_alias */
+ { 414, -3 }, /* (432) select_item ::= table_name NK_DOT NK_STAR */
+ { 372, 0 }, /* (433) where_clause_opt ::= */
+ { 372, -2 }, /* (434) where_clause_opt ::= WHERE search_condition */
+ { 407, 0 }, /* (435) partition_by_clause_opt ::= */
+ { 407, -3 }, /* (436) partition_by_clause_opt ::= PARTITION BY expression_list */
+ { 411, 0 }, /* (437) twindow_clause_opt ::= */
+ { 411, -6 }, /* (438) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 411, -4 }, /* (439) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+ { 411, -6 }, /* (440) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 411, -8 }, /* (441) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 359, 0 }, /* (442) sliding_opt ::= */
+ { 359, -4 }, /* (443) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 410, 0 }, /* (444) fill_opt ::= */
+ { 410, -4 }, /* (445) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 410, -6 }, /* (446) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 415, -1 }, /* (447) fill_mode ::= NONE */
+ { 415, -1 }, /* (448) fill_mode ::= PREV */
+ { 415, -1 }, /* (449) fill_mode ::= NULL */
+ { 415, -1 }, /* (450) fill_mode ::= LINEAR */
+ { 415, -1 }, /* (451) fill_mode ::= NEXT */
+ { 412, 0 }, /* (452) group_by_clause_opt ::= */
+ { 412, -3 }, /* (453) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 416, -1 }, /* (454) group_by_list ::= expression */
+ { 416, -3 }, /* (455) group_by_list ::= group_by_list NK_COMMA expression */
+ { 413, 0 }, /* (456) having_clause_opt ::= */
+ { 413, -2 }, /* (457) having_clause_opt ::= HAVING search_condition */
+ { 408, 0 }, /* (458) range_opt ::= */
+ { 408, -6 }, /* (459) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
+ { 409, 0 }, /* (460) every_opt ::= */
+ { 409, -4 }, /* (461) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 364, -4 }, /* (462) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 417, -1 }, /* (463) query_expression_body ::= query_primary */
+ { 417, -4 }, /* (464) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+ { 417, -3 }, /* (465) query_expression_body ::= query_expression_body UNION query_expression_body */
+ { 421, -1 }, /* (466) query_primary ::= query_specification */
+ { 421, -6 }, /* (467) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+ { 418, 0 }, /* (468) order_by_clause_opt ::= */
+ { 418, -3 }, /* (469) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 419, 0 }, /* (470) slimit_clause_opt ::= */
+ { 419, -2 }, /* (471) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 419, -4 }, /* (472) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 419, -4 }, /* (473) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 420, 0 }, /* (474) limit_clause_opt ::= */
+ { 420, -2 }, /* (475) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 420, -4 }, /* (476) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 420, -4 }, /* (477) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 382, -3 }, /* (478) subquery ::= NK_LP query_expression NK_RP */
+ { 403, -1 }, /* (479) search_condition ::= common_expression */
+ { 422, -1 }, /* (480) sort_specification_list ::= sort_specification */
+ { 422, -3 }, /* (481) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 423, -3 }, /* (482) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+ { 424, 0 }, /* (483) ordering_specification_opt ::= */
+ { 424, -1 }, /* (484) ordering_specification_opt ::= ASC */
+ { 424, -1 }, /* (485) ordering_specification_opt ::= DESC */
+ { 425, 0 }, /* (486) null_ordering_opt ::= */
+ { 425, -2 }, /* (487) null_ordering_opt ::= NULLS FIRST */
+ { 425, -2 }, /* (488) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3465,69 +3415,69 @@ static YYACTIONTYPE yy_reduce(
yy_destructor(yypParser,308,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy617, &yymsp[-1].minor.yy0, yymsp[0].minor.yy215); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy0, yymsp[0].minor.yy59); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy617, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, 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.yy617, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, 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.yy617, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy215 = 1; }
+{ yymsp[1].minor.yy59 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy215 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy59 = 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.yy473, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy69, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); }
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy473, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy69, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy473 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy69 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35);
-{ yylhsminor.yy473 = yymsp[0].minor.yy473; }
- yymsp[0].minor.yy473 = yylhsminor.yy473;
+{ yylhsminor.yy69 = yymsp[0].minor.yy69; }
+ yymsp[0].minor.yy69 = yylhsminor.yy69;
break;
case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy473 = yymsp[-2].minor.yy473 | yymsp[0].minor.yy473; }
- yymsp[-2].minor.yy473 = yylhsminor.yy473;
+{ yylhsminor.yy69 = yymsp[-2].minor.yy69 | yymsp[0].minor.yy69; }
+ yymsp[-2].minor.yy69 = yylhsminor.yy69;
break;
case 37: /* priv_type ::= READ */
-{ yymsp[0].minor.yy473 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy69 = PRIVILEGE_TYPE_READ; }
break;
case 38: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy473 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy69 = PRIVILEGE_TYPE_WRITE; }
break;
case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy617 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy617 = yylhsminor.yy617;
+{ yylhsminor.yy209 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy209 = yylhsminor.yy209;
break;
case 40: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy617 = yymsp[-2].minor.yy617; }
- yymsp[-2].minor.yy617 = yylhsminor.yy617;
+{ yylhsminor.yy209 = yymsp[-2].minor.yy209; }
+ yymsp[-2].minor.yy209 = yylhsminor.yy209;
break;
case 41: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy617, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy209, NULL); }
break;
case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy209, &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.yy617); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3544,31 +3494,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 314: /* db_name ::= NK_ID */ yytestcase(yyruleno==314);
- case 315: /* table_name ::= NK_ID */ yytestcase(yyruleno==315);
- case 316: /* column_name ::= NK_ID */ yytestcase(yyruleno==316);
- case 317: /* function_name ::= NK_ID */ yytestcase(yyruleno==317);
- case 318: /* table_alias ::= NK_ID */ yytestcase(yyruleno==318);
- case 319: /* column_alias ::= NK_ID */ yytestcase(yyruleno==319);
- case 320: /* user_name ::= NK_ID */ yytestcase(yyruleno==320);
- case 321: /* topic_name ::= NK_ID */ yytestcase(yyruleno==321);
- case 322: /* stream_name ::= NK_ID */ yytestcase(yyruleno==322);
- case 323: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==323);
- case 359: /* noarg_func ::= NOW */ yytestcase(yyruleno==359);
- case 360: /* noarg_func ::= TODAY */ yytestcase(yyruleno==360);
- case 361: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==361);
- case 362: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==362);
- case 363: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==363);
- case 364: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==364);
- case 365: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==365);
- case 366: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==366);
- case 367: /* noarg_func ::= USER */ yytestcase(yyruleno==367);
- case 368: /* star_func ::= COUNT */ yytestcase(yyruleno==368);
- case 369: /* star_func ::= FIRST */ yytestcase(yyruleno==369);
- case 370: /* star_func ::= LAST */ yytestcase(yyruleno==370);
- case 371: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==371);
-{ yylhsminor.yy617 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy617 = yylhsminor.yy617;
+ case 312: /* db_name ::= NK_ID */ yytestcase(yyruleno==312);
+ case 313: /* table_name ::= NK_ID */ yytestcase(yyruleno==313);
+ case 314: /* column_name ::= NK_ID */ yytestcase(yyruleno==314);
+ case 315: /* function_name ::= NK_ID */ yytestcase(yyruleno==315);
+ case 316: /* table_alias ::= NK_ID */ yytestcase(yyruleno==316);
+ case 317: /* column_alias ::= NK_ID */ yytestcase(yyruleno==317);
+ case 318: /* user_name ::= NK_ID */ yytestcase(yyruleno==318);
+ case 319: /* topic_name ::= NK_ID */ yytestcase(yyruleno==319);
+ case 320: /* stream_name ::= NK_ID */ yytestcase(yyruleno==320);
+ case 321: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==321);
+ case 357: /* noarg_func ::= NOW */ yytestcase(yyruleno==357);
+ case 358: /* noarg_func ::= TODAY */ yytestcase(yyruleno==358);
+ case 359: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==359);
+ case 360: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==360);
+ case 361: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==361);
+ case 362: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==362);
+ case 363: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==363);
+ case 364: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==364);
+ case 365: /* noarg_func ::= USER */ yytestcase(yyruleno==365);
+ case 366: /* star_func ::= COUNT */ yytestcase(yyruleno==366);
+ case 367: /* star_func ::= FIRST */ yytestcase(yyruleno==367);
+ case 368: /* star_func ::= LAST */ yytestcase(yyruleno==368);
+ case 369: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==369);
+{ yylhsminor.yy209 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy209 = yylhsminor.yy209;
break;
case 52: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -3601,189 +3551,189 @@ 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.yy313, &yymsp[-1].minor.yy617, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy293, &yymsp[-1].minor.yy209, yymsp[0].minor.yy272); }
break;
case 63: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy313, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy293, &yymsp[0].minor.yy209); }
break;
case 64: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy617, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy272); }
break;
case 66: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 67: /* cmd ::= TRIM DATABASE db_name */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 68: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy313 = true; }
+{ yymsp[-2].minor.yy293 = true; }
break;
case 69: /* not_exists_opt ::= */
case 71: /* exists_opt ::= */ yytestcase(yyruleno==71);
case 255: /* analyze_opt ::= */ yytestcase(yyruleno==255);
case 262: /* agg_func_opt ::= */ yytestcase(yyruleno==262);
- case 425: /* set_quantifier_opt ::= */ yytestcase(yyruleno==425);
-{ yymsp[1].minor.yy313 = false; }
+ case 423: /* set_quantifier_opt ::= */ yytestcase(yyruleno==423);
+{ yymsp[1].minor.yy293 = false; }
break;
case 70: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy313 = true; }
+{ yymsp[-1].minor.yy293 = true; }
break;
case 72: /* db_options ::= */
-{ yymsp[1].minor.yy840 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy272 = createDefaultDatabaseOptions(pCxt); }
break;
case 73: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 76: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 77: /* db_options ::= db_options DURATION NK_INTEGER */
case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78);
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 80: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 81: /* db_options ::= db_options KEEP integer_list */
case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82);
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_KEEP, yymsp[0].minor.yy544); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_KEEP, yymsp[0].minor.yy172); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 83: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 85: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 86: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 87: /* db_options ::= db_options STRICT NK_STRING */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 88: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 89: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 90: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_RETENTIONS, yymsp[0].minor.yy544); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_RETENTIONS, yymsp[0].minor.yy172); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 91: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 92: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 93: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 94: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 95: /* 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.yy840 = setDatabaseOption(pCxt, yymsp[-3].minor.yy840, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-3].minor.yy272, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
case 96: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 97: /* 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.yy840 = setDatabaseOption(pCxt, yymsp[-3].minor.yy840, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-3].minor.yy272, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
case 98: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 99: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setDatabaseOption(pCxt, yymsp[-2].minor.yy272, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 100: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy840 = createAlterDatabaseOptions(pCxt); yylhsminor.yy840 = setAlterDatabaseOption(pCxt, yylhsminor.yy840, &yymsp[0].minor.yy95); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterDatabaseOptions(pCxt); yylhsminor.yy272 = setAlterDatabaseOption(pCxt, yylhsminor.yy272, &yymsp[0].minor.yy5); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
case 101: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy840 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy840, &yymsp[0].minor.yy95); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy272, &yymsp[0].minor.yy5); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
case 102: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy95.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy5.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy5.val = yymsp[0].minor.yy0; }
break;
case 103: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy95.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy5.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy5.val = yymsp[0].minor.yy0; }
break;
case 104: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy95.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy5.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy5.val = yymsp[0].minor.yy0; }
break;
case 105: /* alter_db_option ::= KEEP integer_list */
case 106: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==106);
-{ yymsp[-1].minor.yy95.type = DB_OPTION_KEEP; yymsp[-1].minor.yy95.pList = yymsp[0].minor.yy544; }
+{ yymsp[-1].minor.yy5.type = DB_OPTION_KEEP; yymsp[-1].minor.yy5.pList = yymsp[0].minor.yy172; }
break;
case 107: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy95.type = DB_OPTION_WAL; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy5.type = DB_OPTION_WAL; yymsp[-1].minor.yy5.val = yymsp[0].minor.yy0; }
break;
case 108: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy544 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy544 = yylhsminor.yy544;
+{ yylhsminor.yy172 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 109: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 284: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==284);
-{ yylhsminor.yy544 = addNodeToList(pCxt, yymsp[-2].minor.yy544, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy544 = yylhsminor.yy544;
+ case 282: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==282);
+{ yylhsminor.yy172 = addNodeToList(pCxt, yymsp[-2].minor.yy172, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy172 = yylhsminor.yy172;
break;
case 110: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy544 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy544 = yylhsminor.yy544;
+{ yylhsminor.yy172 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 111: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy544 = addNodeToList(pCxt, yymsp[-2].minor.yy544, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy544 = yylhsminor.yy544;
+{ yylhsminor.yy172 = addNodeToList(pCxt, yymsp[-2].minor.yy172, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy172 = yylhsminor.yy172;
break;
case 112: /* retention_list ::= retention */
case 132: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==132);
@@ -3792,266 +3742,266 @@ static YYACTIONTYPE yy_reduce(
case 185: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==185);
case 190: /* col_name_list ::= col_name */ yytestcase(yyruleno==190);
case 238: /* func_list ::= func */ yytestcase(yyruleno==238);
- case 312: /* literal_list ::= signed_literal */ yytestcase(yyruleno==312);
- case 374: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==374);
- case 428: /* select_list ::= select_item */ yytestcase(yyruleno==428);
- case 482: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==482);
-{ yylhsminor.yy544 = createNodeList(pCxt, yymsp[0].minor.yy840); }
- yymsp[0].minor.yy544 = yylhsminor.yy544;
+ case 310: /* literal_list ::= signed_literal */ yytestcase(yyruleno==310);
+ case 372: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==372);
+ case 426: /* select_list ::= select_item */ yytestcase(yyruleno==426);
+ case 480: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==480);
+{ yylhsminor.yy172 = createNodeList(pCxt, yymsp[0].minor.yy272); }
+ yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 113: /* retention_list ::= retention_list NK_COMMA retention */
case 143: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==143);
case 186: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==186);
case 191: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==191);
case 239: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==239);
- case 313: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==313);
- case 375: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==375);
- case 429: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==429);
- case 483: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==483);
-{ yylhsminor.yy544 = addNodeToList(pCxt, yymsp[-2].minor.yy544, yymsp[0].minor.yy840); }
- yymsp[-2].minor.yy544 = yylhsminor.yy544;
+ case 311: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==311);
+ case 373: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==373);
+ case 427: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==427);
+ case 481: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==481);
+{ yylhsminor.yy172 = addNodeToList(pCxt, yymsp[-2].minor.yy172, yymsp[0].minor.yy272); }
+ yymsp[-2].minor.yy172 = yylhsminor.yy172;
break;
case 114: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy840 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 115: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 117: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==117);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy313, yymsp[-5].minor.yy840, yymsp[-3].minor.yy544, yymsp[-1].minor.yy544, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy293, yymsp[-5].minor.yy272, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, yymsp[0].minor.yy272); }
break;
case 116: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy544); }
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy172); }
break;
case 118: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy544); }
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy172); }
break;
case 119: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy313, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy293, yymsp[0].minor.yy272); }
break;
case 120: /* cmd ::= ALTER TABLE alter_table_clause */
- case 286: /* cmd ::= query_expression */ yytestcase(yyruleno==286);
-{ pCxt->pRootNode = yymsp[0].minor.yy840; }
+ case 284: /* cmd ::= query_expression */ yytestcase(yyruleno==284);
+{ pCxt->pRootNode = yymsp[0].minor.yy272; }
break;
case 121: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy272); }
break;
case 122: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy840 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
case 123: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy617, yymsp[0].minor.yy784); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy272, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy209, yymsp[0].minor.yy616); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 124: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy840 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy840, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy617); }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy272, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy209); }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
case 125: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy617, yymsp[0].minor.yy784); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy272, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy616); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 126: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy840 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy617, &yymsp[0].minor.yy617); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy272, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 127: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy617, yymsp[0].minor.yy784); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy272, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy209, yymsp[0].minor.yy616); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 128: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy840 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy840, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy617); }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy272, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy209); }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
case 129: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy617, yymsp[0].minor.yy784); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy272, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy616); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 130: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy840 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy617, &yymsp[0].minor.yy617); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy272, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 131: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy840 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy840, &yymsp[-2].minor.yy617, yymsp[0].minor.yy840); }
- yymsp[-5].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy272, &yymsp[-2].minor.yy209, yymsp[0].minor.yy272); }
+ yymsp[-5].minor.yy272 = yylhsminor.yy272;
break;
case 133: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
case 136: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==136);
-{ yylhsminor.yy544 = addNodeToList(pCxt, yymsp[-1].minor.yy544, yymsp[0].minor.yy840); }
- yymsp[-1].minor.yy544 = yylhsminor.yy544;
+{ yylhsminor.yy172 = addNodeToList(pCxt, yymsp[-1].minor.yy172, yymsp[0].minor.yy272); }
+ yymsp[-1].minor.yy172 = yylhsminor.yy172;
break;
case 134: /* 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.yy840 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy313, yymsp[-8].minor.yy840, yymsp[-6].minor.yy840, yymsp[-5].minor.yy544, yymsp[-2].minor.yy544, yymsp[0].minor.yy840); }
- yymsp[-9].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy293, yymsp[-8].minor.yy272, yymsp[-6].minor.yy272, yymsp[-5].minor.yy172, yymsp[-2].minor.yy172, yymsp[0].minor.yy272); }
+ yymsp[-9].minor.yy272 = yylhsminor.yy272;
break;
case 137: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy840 = createDropTableClause(pCxt, yymsp[-1].minor.yy313, yymsp[0].minor.yy840); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createDropTableClause(pCxt, yymsp[-1].minor.yy293, yymsp[0].minor.yy272); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
case 138: /* specific_cols_opt ::= */
case 169: /* tags_def_opt ::= */ yytestcase(yyruleno==169);
- case 437: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==437);
- case 454: /* group_by_clause_opt ::= */ yytestcase(yyruleno==454);
- case 470: /* order_by_clause_opt ::= */ yytestcase(yyruleno==470);
-{ yymsp[1].minor.yy544 = NULL; }
+ case 435: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==435);
+ case 452: /* group_by_clause_opt ::= */ yytestcase(yyruleno==452);
+ case 468: /* order_by_clause_opt ::= */ yytestcase(yyruleno==468);
+{ yymsp[1].minor.yy172 = NULL; }
break;
case 139: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
-{ yymsp[-2].minor.yy544 = yymsp[-1].minor.yy544; }
+{ yymsp[-2].minor.yy172 = yymsp[-1].minor.yy172; }
break;
case 140: /* full_table_name ::= table_name */
-{ yylhsminor.yy840 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy617, NULL); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy209, NULL); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
case 141: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy840 = createRealTableNode(pCxt, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy617, NULL); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createRealTableNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, NULL); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 144: /* column_def ::= column_name type_name */
-{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy617, yymsp[0].minor.yy784, NULL); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy616, NULL); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
case 145: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy617, yymsp[-2].minor.yy784, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
case 146: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BOOL); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 147: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 148: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 149: /* type_name ::= INT */
case 150: /* type_name ::= INTEGER */ yytestcase(yyruleno==150);
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_INT); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 151: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 152: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 153: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 154: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy616 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 155: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 156: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy616 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 157: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+{ yymsp[-1].minor.yy616 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 158: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+{ yymsp[-1].minor.yy616 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 159: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UINT); }
+{ yymsp[-1].minor.yy616 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 160: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+{ yymsp[-1].minor.yy616 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 161: /* type_name ::= JSON */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_JSON); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 162: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy616 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 163: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 164: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BLOB); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 165: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy616 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 166: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[0].minor.yy616 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 167: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-3].minor.yy616 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 168: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-5].minor.yy616 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 170: /* tags_def_opt ::= tags_def */
- case 373: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==373);
-{ yylhsminor.yy544 = yymsp[0].minor.yy544; }
- yymsp[0].minor.yy544 = yylhsminor.yy544;
+ case 371: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==371);
+{ yylhsminor.yy172 = yymsp[0].minor.yy172; }
+ yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 171: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
-{ yymsp[-3].minor.yy544 = yymsp[-1].minor.yy544; }
+{ yymsp[-3].minor.yy172 = yymsp[-1].minor.yy172; }
break;
case 172: /* table_options ::= */
-{ yymsp[1].minor.yy840 = createDefaultTableOptions(pCxt); }
+{ yymsp[1].minor.yy272 = createDefaultTableOptions(pCxt); }
break;
case 173: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setTableOption(pCxt, yymsp[-2].minor.yy272, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 174: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy544); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setTableOption(pCxt, yymsp[-2].minor.yy272, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy172); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 175: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy544); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setTableOption(pCxt, yymsp[-2].minor.yy272, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy172); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 176: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-4].minor.yy840, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy544); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setTableOption(pCxt, yymsp[-4].minor.yy272, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy172); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 177: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setTableOption(pCxt, yymsp[-2].minor.yy272, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 178: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-4].minor.yy840, TABLE_OPTION_SMA, yymsp[-1].minor.yy544); }
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setTableOption(pCxt, yymsp[-4].minor.yy272, TABLE_OPTION_SMA, yymsp[-1].minor.yy172); }
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
case 179: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy840 = createAlterTableOptions(pCxt); yylhsminor.yy840 = setTableOption(pCxt, yylhsminor.yy840, yymsp[0].minor.yy95.type, &yymsp[0].minor.yy95.val); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createAlterTableOptions(pCxt); yylhsminor.yy272 = setTableOption(pCxt, yylhsminor.yy272, yymsp[0].minor.yy5.type, &yymsp[0].minor.yy5.val); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
case 180: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy95.type, &yymsp[0].minor.yy95.val); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setTableOption(pCxt, yymsp[-1].minor.yy272, yymsp[0].minor.yy5.type, &yymsp[0].minor.yy5.val); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
case 181: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy95.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy5.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy5.val = yymsp[0].minor.yy0; }
break;
case 182: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy95.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy5.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy5.val = yymsp[0].minor.yy0; }
break;
case 183: /* duration_list ::= duration_literal */
- case 340: /* expression_list ::= expression */ yytestcase(yyruleno==340);
-{ yylhsminor.yy544 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); }
- yymsp[0].minor.yy544 = yylhsminor.yy544;
+ case 338: /* expression_list ::= expression */ yytestcase(yyruleno==338);
+{ yylhsminor.yy172 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy272)); }
+ yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
case 184: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 341: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==341);
-{ yylhsminor.yy544 = addNodeToList(pCxt, yymsp[-2].minor.yy544, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); }
- yymsp[-2].minor.yy544 = yylhsminor.yy544;
+ case 339: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==339);
+{ yylhsminor.yy172 = addNodeToList(pCxt, yymsp[-2].minor.yy172, releaseRawExprNode(pCxt, yymsp[0].minor.yy272)); }
+ yymsp[-2].minor.yy172 = yylhsminor.yy172;
break;
case 187: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[0].minor.yy617, NULL); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createFunctionNode(pCxt, &yymsp[0].minor.yy209, NULL); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
case 188: /* rollup_func_name ::= FIRST */
case 189: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==189);
-{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
case 192: /* col_name ::= column_name */
-{ yylhsminor.yy840 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy617); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
case 193: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
@@ -4063,13 +4013,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
case 196: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy272, yymsp[0].minor.yy272, OP_TYPE_LIKE); }
break;
case 197: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy272, yymsp[0].minor.yy272, OP_TYPE_LIKE); }
break;
case 198: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy840, NULL, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy272, NULL, OP_TYPE_LIKE); }
break;
case 199: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
@@ -4084,7 +4034,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
case 203: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy840, yymsp[-1].minor.yy840, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy272, yymsp[-1].minor.yy272, OP_TYPE_EQUAL); }
break;
case 204: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
@@ -4103,13 +4053,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
case 210: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 211: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy272); }
break;
case 212: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy272); }
break;
case 213: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
@@ -4142,7 +4092,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
case 223: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy272); }
break;
case 224: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
@@ -4151,713 +4101,711 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
case 226: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy840, yymsp[-1].minor.yy840, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy272, yymsp[-1].minor.yy272, OP_TYPE_EQUAL); }
break;
case 227: /* db_name_cond_opt ::= */
case 232: /* from_db_opt ::= */ yytestcase(yyruleno==232);
-{ yymsp[1].minor.yy840 = createDefaultDatabaseCondValue(pCxt); }
+{ yymsp[1].minor.yy272 = createDefaultDatabaseCondValue(pCxt); }
break;
case 228: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy617); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy209); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
case 229: /* like_pattern_opt ::= */
- case 268: /* into_opt ::= */ yytestcase(yyruleno==268);
- case 406: /* from_clause_opt ::= */ yytestcase(yyruleno==406);
- case 435: /* where_clause_opt ::= */ yytestcase(yyruleno==435);
- case 439: /* twindow_clause_opt ::= */ yytestcase(yyruleno==439);
- case 444: /* sliding_opt ::= */ yytestcase(yyruleno==444);
- case 446: /* fill_opt ::= */ yytestcase(yyruleno==446);
- case 458: /* having_clause_opt ::= */ yytestcase(yyruleno==458);
- case 460: /* range_opt ::= */ yytestcase(yyruleno==460);
- case 462: /* every_opt ::= */ yytestcase(yyruleno==462);
- case 472: /* slimit_clause_opt ::= */ yytestcase(yyruleno==472);
- case 476: /* limit_clause_opt ::= */ yytestcase(yyruleno==476);
-{ yymsp[1].minor.yy840 = NULL; }
+ case 404: /* from_clause_opt ::= */ yytestcase(yyruleno==404);
+ case 433: /* where_clause_opt ::= */ yytestcase(yyruleno==433);
+ case 437: /* twindow_clause_opt ::= */ yytestcase(yyruleno==437);
+ case 442: /* sliding_opt ::= */ yytestcase(yyruleno==442);
+ case 444: /* fill_opt ::= */ yytestcase(yyruleno==444);
+ case 456: /* having_clause_opt ::= */ yytestcase(yyruleno==456);
+ case 458: /* range_opt ::= */ yytestcase(yyruleno==458);
+ case 460: /* every_opt ::= */ yytestcase(yyruleno==460);
+ case 470: /* slimit_clause_opt ::= */ yytestcase(yyruleno==470);
+ case 474: /* limit_clause_opt ::= */ yytestcase(yyruleno==474);
+{ yymsp[1].minor.yy272 = NULL; }
break;
case 230: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
case 231: /* table_name_cond ::= table_name */
-{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy617); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy209); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
case 233: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy617); }
+{ yymsp[-1].minor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy209); }
break;
case 234: /* 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.yy313, yymsp[-3].minor.yy840, yymsp[-1].minor.yy840, NULL, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy293, yymsp[-3].minor.yy272, yymsp[-1].minor.yy272, NULL, yymsp[0].minor.yy272); }
break;
case 235: /* cmd ::= DROP INDEX exists_opt full_table_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy313, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy293, yymsp[0].minor.yy272); }
break;
case 236: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy840 = createIndexOption(pCxt, yymsp[-7].minor.yy544, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); }
+{ yymsp[-9].minor.yy272 = createIndexOption(pCxt, yymsp[-7].minor.yy172, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), NULL, yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
break;
case 237: /* 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.yy840 = createIndexOption(pCxt, yymsp[-9].minor.yy544, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy840, yymsp[0].minor.yy840); }
+{ yymsp[-11].minor.yy272 = createIndexOption(pCxt, yymsp[-9].minor.yy172, releaseRawExprNode(pCxt, yymsp[-5].minor.yy272), releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
break;
case 240: /* func ::= function_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[-3].minor.yy617, yymsp[-1].minor.yy544); }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy172); }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
case 241: /* sma_stream_opt ::= */
- case 270: /* stream_options ::= */ yytestcase(yyruleno==270);
-{ yymsp[1].minor.yy840 = createStreamOptions(pCxt); }
+ case 268: /* stream_options ::= */ yytestcase(yyruleno==268);
+{ yymsp[1].minor.yy272 = createStreamOptions(pCxt); }
break;
case 242: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */
- case 274: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==274);
-{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 272: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==272);
+{ ((SStreamOptions*)yymsp[-2].minor.yy272)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy272); yylhsminor.yy272 = yymsp[-2].minor.yy272; }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 243: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ ((SStreamOptions*)yymsp[-2].minor.yy272)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy272); yylhsminor.yy272 = yymsp[-2].minor.yy272; }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 244: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy313, &yymsp[-2].minor.yy617, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy293, &yymsp[-2].minor.yy209, yymsp[0].minor.yy272); }
break;
case 245: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy313, &yymsp[-3].minor.yy617, &yymsp[0].minor.yy617, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy293, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy209, false); }
break;
case 246: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy313, &yymsp[-5].minor.yy617, &yymsp[0].minor.yy617, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy293, &yymsp[-5].minor.yy209, &yymsp[0].minor.yy209, true); }
break;
case 247: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy313, &yymsp[-3].minor.yy617, yymsp[0].minor.yy840, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy293, &yymsp[-3].minor.yy209, yymsp[0].minor.yy272, false); }
break;
case 248: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy313, &yymsp[-5].minor.yy617, yymsp[0].minor.yy840, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy293, &yymsp[-5].minor.yy209, yymsp[0].minor.yy272, true); }
break;
case 249: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy313, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy293, &yymsp[0].minor.yy209); }
break;
case 250: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy313, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy293, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); }
break;
case 251: /* cmd ::= DESC full_table_name */
case 252: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==252);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy272); }
break;
case 253: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
case 254: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy313, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); }
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy293, yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
break;
case 256: /* analyze_opt ::= ANALYZE */
case 263: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==263);
- case 426: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==426);
-{ yymsp[0].minor.yy313 = true; }
+ case 424: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==424);
+{ yymsp[0].minor.yy293 = true; }
break;
case 257: /* explain_options ::= */
-{ yymsp[1].minor.yy840 = createDefaultExplainOptions(pCxt); }
+{ yymsp[1].minor.yy272 = createDefaultExplainOptions(pCxt); }
break;
case 258: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy840 = setExplainVerbose(pCxt, yymsp[-2].minor.yy840, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setExplainVerbose(pCxt, yymsp[-2].minor.yy272, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 259: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy840 = setExplainRatio(pCxt, yymsp[-2].minor.yy840, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+{ yylhsminor.yy272 = setExplainRatio(pCxt, yymsp[-2].minor.yy272, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
case 260: /* 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.yy313, yymsp[-8].minor.yy313, &yymsp[-5].minor.yy617, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy784, yymsp[0].minor.yy844); }
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy293, yymsp[-8].minor.yy293, &yymsp[-5].minor.yy209, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy616, yymsp[0].minor.yy232); }
break;
case 261: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy313, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy293, &yymsp[0].minor.yy209); }
break;
case 264: /* bufsize_opt ::= */
-{ yymsp[1].minor.yy844 = 0; }
+{ yymsp[1].minor.yy232 = 0; }
break;
case 265: /* bufsize_opt ::= BUFSIZE NK_INTEGER */
-{ yymsp[-1].minor.yy844 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy232 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
- case 266: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy313, &yymsp[-4].minor.yy617, yymsp[-2].minor.yy840, yymsp[-3].minor.yy840, yymsp[0].minor.yy840); }
+ case 266: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_expression */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-6].minor.yy293, &yymsp[-5].minor.yy209, yymsp[-2].minor.yy272, yymsp[-4].minor.yy272, yymsp[0].minor.yy272); }
break;
case 267: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy313, &yymsp[0].minor.yy617); }
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy293, &yymsp[0].minor.yy209); }
break;
- case 269: /* into_opt ::= INTO full_table_name */
- case 407: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==407);
- case 436: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==436);
- case 459: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==459);
-{ yymsp[-1].minor.yy840 = yymsp[0].minor.yy840; }
+ case 269: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy272)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy272 = yymsp[-2].minor.yy272; }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 271: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy840)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy840 = yymsp[-2].minor.yy840; }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 270: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy272)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy272 = yymsp[-2].minor.yy272; }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 272: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy840)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy840 = yymsp[-2].minor.yy840; }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 271: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-3].minor.yy272)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy272)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy272); yylhsminor.yy272 = yymsp[-3].minor.yy272; }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
- case 273: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-3].minor.yy840)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy840)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-3].minor.yy840; }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+ case 273: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ ((SStreamOptions*)yymsp[-3].minor.yy272)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy272 = yymsp[-3].minor.yy272; }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
- case 275: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-3].minor.yy840)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy840 = yymsp[-3].minor.yy840; }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
- break;
- case 276: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 274: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 277: /* cmd ::= KILL QUERY NK_STRING */
+ case 275: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 278: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 276: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 279: /* cmd ::= BALANCE VGROUP */
+ case 277: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
- case 280: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 278: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 281: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy544); }
+ case 279: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy172); }
break;
- case 282: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 280: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 283: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy544 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- break;
- case 285: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); }
- break;
- case 287: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy840, yymsp[-2].minor.yy544, yymsp[0].minor.yy840); }
- break;
- case 288: /* cmd ::= INSERT INTO full_table_name query_expression */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy840, NULL, yymsp[0].minor.yy840); }
- break;
- case 289: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 290: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 291: /* literal ::= NK_STRING */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 292: /* literal ::= NK_BOOL */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 293: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
- break;
- case 294: /* literal ::= duration_literal */
- case 304: /* signed_literal ::= signed */ yytestcase(yyruleno==304);
- case 324: /* expression ::= literal */ yytestcase(yyruleno==324);
- case 325: /* expression ::= pseudo_column */ yytestcase(yyruleno==325);
- case 326: /* expression ::= column_reference */ yytestcase(yyruleno==326);
- case 327: /* expression ::= function_expression */ yytestcase(yyruleno==327);
- case 328: /* expression ::= subquery */ yytestcase(yyruleno==328);
- case 356: /* function_expression ::= literal_func */ yytestcase(yyruleno==356);
- case 398: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==398);
- case 402: /* boolean_primary ::= predicate */ yytestcase(yyruleno==402);
- case 404: /* common_expression ::= expression */ yytestcase(yyruleno==404);
- case 405: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==405);
- case 408: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==408);
- case 410: /* table_reference ::= table_primary */ yytestcase(yyruleno==410);
- case 411: /* table_reference ::= joined_table */ yytestcase(yyruleno==411);
- case 415: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==415);
- case 465: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==465);
- case 468: /* query_primary ::= query_specification */ yytestcase(yyruleno==468);
-{ yylhsminor.yy840 = yymsp[0].minor.yy840; }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 295: /* literal ::= NULL */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 296: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 297: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 298: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 299: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- break;
- case 300: /* signed ::= NK_MINUS NK_INTEGER */
+ case 281: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy172 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ break;
+ case 283: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
+ break;
+ case 285: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy272, yymsp[-2].minor.yy172, yymsp[0].minor.yy272); }
+ break;
+ case 286: /* cmd ::= INSERT INTO full_table_name query_expression */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy272, NULL, yymsp[0].minor.yy272); }
+ break;
+ case 287: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 288: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 289: /* literal ::= NK_STRING */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 290: /* literal ::= NK_BOOL */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 291: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 292: /* literal ::= duration_literal */
+ case 302: /* signed_literal ::= signed */ yytestcase(yyruleno==302);
+ case 322: /* expression ::= literal */ yytestcase(yyruleno==322);
+ case 323: /* expression ::= pseudo_column */ yytestcase(yyruleno==323);
+ case 324: /* expression ::= column_reference */ yytestcase(yyruleno==324);
+ case 325: /* expression ::= function_expression */ yytestcase(yyruleno==325);
+ case 326: /* expression ::= subquery */ yytestcase(yyruleno==326);
+ case 354: /* function_expression ::= literal_func */ yytestcase(yyruleno==354);
+ case 396: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==396);
+ case 400: /* boolean_primary ::= predicate */ yytestcase(yyruleno==400);
+ case 402: /* common_expression ::= expression */ yytestcase(yyruleno==402);
+ case 403: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==403);
+ case 406: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==406);
+ case 408: /* table_reference ::= table_primary */ yytestcase(yyruleno==408);
+ case 409: /* table_reference ::= joined_table */ yytestcase(yyruleno==409);
+ case 413: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==413);
+ case 463: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==463);
+ case 466: /* query_primary ::= query_specification */ yytestcase(yyruleno==466);
+{ yylhsminor.yy272 = yymsp[0].minor.yy272; }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 293: /* literal ::= NULL */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 294: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 295: /* duration_literal ::= NK_VARIABLE */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 296: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 297: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ break;
+ case 298: /* 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.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 301: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+ case 299: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
- case 302: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 300: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 303: /* signed ::= NK_MINUS NK_FLOAT */
+ case 301: /* 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.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 305: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+ case 303: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
- case 306: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+ case 304: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
- case 307: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ case 305: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 308: /* signed_literal ::= duration_literal */
- case 310: /* signed_literal ::= literal_func */ yytestcase(yyruleno==310);
- case 376: /* star_func_para ::= expression */ yytestcase(yyruleno==376);
- case 431: /* select_item ::= common_expression */ yytestcase(yyruleno==431);
- case 481: /* search_condition ::= common_expression */ yytestcase(yyruleno==481);
-{ yylhsminor.yy840 = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+ case 306: /* signed_literal ::= duration_literal */
+ case 308: /* signed_literal ::= literal_func */ yytestcase(yyruleno==308);
+ case 374: /* star_func_para ::= expression */ yytestcase(yyruleno==374);
+ case 429: /* select_item ::= common_expression */ yytestcase(yyruleno==429);
+ case 479: /* search_condition ::= common_expression */ yytestcase(yyruleno==479);
+{ yylhsminor.yy272 = releaseRawExprNode(pCxt, yymsp[0].minor.yy272); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
- case 309: /* signed_literal ::= NULL */
-{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+ case 307: /* signed_literal ::= NULL */
+{ yylhsminor.yy272 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
- case 311: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy840 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+ case 309: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy272 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
- case 329: /* expression ::= NK_LP expression NK_RP */
- case 403: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==403);
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 327: /* expression ::= NK_LP expression NK_RP */
+ case 401: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==401);
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272)); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 330: /* expression ::= NK_PLUS expression */
+ case 328: /* expression ::= NK_PLUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy840));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy272));
}
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 331: /* expression ::= NK_MINUS expression */
+ case 329: /* expression ::= NK_MINUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy840), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy272), NULL));
}
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 332: /* expression ::= expression NK_PLUS expression */
+ case 330: /* expression ::= expression NK_PLUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 333: /* expression ::= expression NK_MINUS expression */
+ case 331: /* expression ::= expression NK_MINUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 334: /* expression ::= expression NK_STAR expression */
+ case 332: /* expression ::= expression NK_STAR expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 335: /* expression ::= expression NK_SLASH expression */
+ case 333: /* expression ::= expression NK_SLASH expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 336: /* expression ::= expression NK_REM expression */
+ case 334: /* expression ::= expression NK_REM expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 337: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 335: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 338: /* expression ::= expression NK_BITAND expression */
+ case 336: /* expression ::= expression NK_BITAND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 339: /* expression ::= expression NK_BITOR expression */
+ case 337: /* expression ::= expression NK_BITOR expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
- break;
- case 342: /* column_reference ::= column_name */
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy617, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy617)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 343: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy617, createColumnNode(pCxt, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy617)); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
- break;
- case 344: /* pseudo_column ::= ROWTS */
- case 345: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==345);
- case 347: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==347);
- case 348: /* pseudo_column ::= QEND */ yytestcase(yyruleno==348);
- case 349: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==349);
- case 350: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==350);
- case 351: /* pseudo_column ::= WEND */ yytestcase(yyruleno==351);
- case 352: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==352);
- case 358: /* literal_func ::= NOW */ yytestcase(yyruleno==358);
-{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
- break;
- case 346: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy617)))); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
- break;
- case 353: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 354: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==354);
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy617, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy617, yymsp[-1].minor.yy544)); }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
- break;
- case 355: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy784)); }
- yymsp[-5].minor.yy840 = yylhsminor.yy840;
- break;
- case 357: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy617, NULL)); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
- break;
- case 372: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy544 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy544 = yylhsminor.yy544;
- break;
- case 377: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 434: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==434);
-{ yylhsminor.yy840 = createColumnNode(pCxt, &yymsp[-2].minor.yy617, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
- break;
- case 378: /* predicate ::= expression compare_op expression */
- case 383: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==383);
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 340: /* column_reference ::= column_name */
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy209, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 341: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209)); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 342: /* pseudo_column ::= ROWTS */
+ case 343: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==343);
+ case 345: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==345);
+ case 346: /* pseudo_column ::= QEND */ yytestcase(yyruleno==346);
+ case 347: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==347);
+ case 348: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==348);
+ case 349: /* pseudo_column ::= WEND */ yytestcase(yyruleno==349);
+ case 350: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==350);
+ case 356: /* literal_func ::= NOW */ yytestcase(yyruleno==356);
+{ yylhsminor.yy272 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 344: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy209)))); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 351: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 352: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==352);
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy172)); }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 353: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), yymsp[-1].minor.yy616)); }
+ yymsp[-5].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 355: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy209, NULL)); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 370: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy172 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy172 = yylhsminor.yy172;
+ break;
+ case 375: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 432: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==432);
+{ yylhsminor.yy272 = createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 376: /* predicate ::= expression compare_op expression */
+ case 381: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==381);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy198, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy392, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 379: /* predicate ::= expression BETWEEN expression AND expression */
+ case 377: /* predicate ::= expression BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy840), releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy272), releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-4].minor.yy840 = yylhsminor.yy840;
+ yymsp[-4].minor.yy272 = yylhsminor.yy272;
break;
- case 380: /* predicate ::= expression NOT BETWEEN expression AND expression */
+ case 378: /* predicate ::= expression NOT BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy272), releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-5].minor.yy840 = yylhsminor.yy840;
+ yymsp[-5].minor.yy272 = yylhsminor.yy272;
break;
- case 381: /* predicate ::= expression IS NULL */
+ case 379: /* predicate ::= expression IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), NULL));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 382: /* predicate ::= expression IS NOT NULL */
+ case 380: /* predicate ::= expression IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), NULL));
}
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
- case 384: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy198 = OP_TYPE_LOWER_THAN; }
+ case 382: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy392 = OP_TYPE_LOWER_THAN; }
break;
- case 385: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy198 = OP_TYPE_GREATER_THAN; }
+ case 383: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy392 = OP_TYPE_GREATER_THAN; }
break;
- case 386: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy198 = OP_TYPE_LOWER_EQUAL; }
+ case 384: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy392 = OP_TYPE_LOWER_EQUAL; }
break;
- case 387: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy198 = OP_TYPE_GREATER_EQUAL; }
+ case 385: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy392 = OP_TYPE_GREATER_EQUAL; }
break;
- case 388: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy198 = OP_TYPE_NOT_EQUAL; }
+ case 386: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy392 = OP_TYPE_NOT_EQUAL; }
break;
- case 389: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy198 = OP_TYPE_EQUAL; }
+ case 387: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy392 = OP_TYPE_EQUAL; }
break;
- case 390: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy198 = OP_TYPE_LIKE; }
+ case 388: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy392 = OP_TYPE_LIKE; }
break;
- case 391: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy198 = OP_TYPE_NOT_LIKE; }
+ case 389: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy392 = OP_TYPE_NOT_LIKE; }
break;
- case 392: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy198 = OP_TYPE_MATCH; }
+ case 390: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy392 = OP_TYPE_MATCH; }
break;
- case 393: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy198 = OP_TYPE_NMATCH; }
+ case 391: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy392 = OP_TYPE_NMATCH; }
break;
- case 394: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy198 = OP_TYPE_JSON_CONTAINS; }
+ case 392: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy392 = OP_TYPE_JSON_CONTAINS; }
break;
- case 395: /* in_op ::= IN */
-{ yymsp[0].minor.yy198 = OP_TYPE_IN; }
+ case 393: /* in_op ::= IN */
+{ yymsp[0].minor.yy392 = OP_TYPE_IN; }
break;
- case 396: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy198 = OP_TYPE_NOT_IN; }
+ case 394: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy392 = OP_TYPE_NOT_IN; }
break;
- case 397: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy544)); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 395: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy172)); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 399: /* boolean_value_expression ::= NOT boolean_primary */
+ case 397: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy840), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy272), NULL));
}
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 400: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 398: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 401: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 399: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840);
- yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy272);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy272);
+ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), releaseRawExprNode(pCxt, yymsp[0].minor.yy272)));
}
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
+ break;
+ case 405: /* from_clause_opt ::= FROM table_reference_list */
+ case 434: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==434);
+ case 457: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==457);
+{ yymsp[-1].minor.yy272 = yymsp[0].minor.yy272; }
break;
- case 409: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy840 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, NULL); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 407: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy272 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy272, yymsp[0].minor.yy272, NULL); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 412: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy840 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy617, &yymsp[0].minor.yy617); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ case 410: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy272 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 413: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy840 = createRealTableNode(pCxt, &yymsp[-3].minor.yy617, &yymsp[-1].minor.yy617, &yymsp[0].minor.yy617); }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+ case 411: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy272 = createRealTableNode(pCxt, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
- case 414: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy840 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), &yymsp[0].minor.yy617); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ case 412: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy272 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272), &yymsp[0].minor.yy209); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 416: /* alias_opt ::= */
-{ yymsp[1].minor.yy617 = nil_token; }
+ case 414: /* alias_opt ::= */
+{ yymsp[1].minor.yy209 = nil_token; }
break;
- case 417: /* alias_opt ::= table_alias */
-{ yylhsminor.yy617 = yymsp[0].minor.yy617; }
- yymsp[0].minor.yy617 = yylhsminor.yy617;
+ case 415: /* alias_opt ::= table_alias */
+{ yylhsminor.yy209 = yymsp[0].minor.yy209; }
+ yymsp[0].minor.yy209 = yylhsminor.yy209;
break;
- case 418: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy617 = yymsp[0].minor.yy617; }
+ case 416: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy209 = yymsp[0].minor.yy209; }
break;
- case 419: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 420: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==420);
-{ yymsp[-2].minor.yy840 = yymsp[-1].minor.yy840; }
+ case 417: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 418: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==418);
+{ yymsp[-2].minor.yy272 = yymsp[-1].minor.yy272; }
break;
- case 421: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy840 = createJoinTableNode(pCxt, yymsp[-4].minor.yy708, yymsp[-5].minor.yy840, yymsp[-2].minor.yy840, yymsp[0].minor.yy840); }
- yymsp[-5].minor.yy840 = yylhsminor.yy840;
+ case 419: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy272 = createJoinTableNode(pCxt, yymsp[-4].minor.yy156, yymsp[-5].minor.yy272, yymsp[-2].minor.yy272, yymsp[0].minor.yy272); }
+ yymsp[-5].minor.yy272 = yylhsminor.yy272;
break;
- case 422: /* join_type ::= */
-{ yymsp[1].minor.yy708 = JOIN_TYPE_INNER; }
+ case 420: /* join_type ::= */
+{ yymsp[1].minor.yy156 = JOIN_TYPE_INNER; }
break;
- case 423: /* join_type ::= INNER */
-{ yymsp[0].minor.yy708 = JOIN_TYPE_INNER; }
+ case 421: /* join_type ::= INNER */
+{ yymsp[0].minor.yy156 = JOIN_TYPE_INNER; }
break;
- case 424: /* 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 422: /* 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.yy840 = createSelectStmt(pCxt, yymsp[-10].minor.yy313, yymsp[-9].minor.yy544, yymsp[-8].minor.yy840);
- yymsp[-11].minor.yy840 = addWhereClause(pCxt, yymsp[-11].minor.yy840, yymsp[-7].minor.yy840);
- yymsp[-11].minor.yy840 = addPartitionByClause(pCxt, yymsp[-11].minor.yy840, yymsp[-6].minor.yy544);
- yymsp[-11].minor.yy840 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy840, yymsp[-2].minor.yy840);
- yymsp[-11].minor.yy840 = addGroupByClause(pCxt, yymsp[-11].minor.yy840, yymsp[-1].minor.yy544);
- yymsp[-11].minor.yy840 = addHavingClause(pCxt, yymsp[-11].minor.yy840, yymsp[0].minor.yy840);
- yymsp[-11].minor.yy840 = addRangeClause(pCxt, yymsp[-11].minor.yy840, yymsp[-5].minor.yy840);
- yymsp[-11].minor.yy840 = addEveryClause(pCxt, yymsp[-11].minor.yy840, yymsp[-4].minor.yy840);
- yymsp[-11].minor.yy840 = addFillClause(pCxt, yymsp[-11].minor.yy840, yymsp[-3].minor.yy840);
+ yymsp[-11].minor.yy272 = createSelectStmt(pCxt, yymsp[-10].minor.yy293, yymsp[-9].minor.yy172, yymsp[-8].minor.yy272);
+ yymsp[-11].minor.yy272 = addWhereClause(pCxt, yymsp[-11].minor.yy272, yymsp[-7].minor.yy272);
+ yymsp[-11].minor.yy272 = addPartitionByClause(pCxt, yymsp[-11].minor.yy272, yymsp[-6].minor.yy172);
+ yymsp[-11].minor.yy272 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy272, yymsp[-2].minor.yy272);
+ yymsp[-11].minor.yy272 = addGroupByClause(pCxt, yymsp[-11].minor.yy272, yymsp[-1].minor.yy172);
+ yymsp[-11].minor.yy272 = addHavingClause(pCxt, yymsp[-11].minor.yy272, yymsp[0].minor.yy272);
+ yymsp[-11].minor.yy272 = addRangeClause(pCxt, yymsp[-11].minor.yy272, yymsp[-5].minor.yy272);
+ yymsp[-11].minor.yy272 = addEveryClause(pCxt, yymsp[-11].minor.yy272, yymsp[-4].minor.yy272);
+ yymsp[-11].minor.yy272 = addFillClause(pCxt, yymsp[-11].minor.yy272, yymsp[-3].minor.yy272);
}
break;
- case 427: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy313 = false; }
+ case 425: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy293 = false; }
break;
- case 430: /* select_item ::= NK_STAR */
-{ yylhsminor.yy840 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy840 = yylhsminor.yy840;
+ case 428: /* select_item ::= NK_STAR */
+{ yylhsminor.yy272 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy272 = yylhsminor.yy272;
break;
- case 432: /* select_item ::= common_expression column_alias */
-{ yylhsminor.yy840 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), &yymsp[0].minor.yy617); }
- yymsp[-1].minor.yy840 = yylhsminor.yy840;
+ case 430: /* select_item ::= common_expression column_alias */
+{ yylhsminor.yy272 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272), &yymsp[0].minor.yy209); }
+ yymsp[-1].minor.yy272 = yylhsminor.yy272;
break;
- case 433: /* select_item ::= common_expression AS column_alias */
-{ yylhsminor.yy840 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), &yymsp[0].minor.yy617); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 431: /* select_item ::= common_expression AS column_alias */
+{ yylhsminor.yy272 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), &yymsp[0].minor.yy209); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 438: /* partition_by_clause_opt ::= PARTITION BY expression_list */
- case 455: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==455);
- case 471: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==471);
-{ yymsp[-2].minor.yy544 = yymsp[0].minor.yy544; }
+ case 436: /* partition_by_clause_opt ::= PARTITION BY expression_list */
+ case 453: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==453);
+ case 469: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==469);
+{ yymsp[-2].minor.yy172 = yymsp[0].minor.yy172; }
break;
- case 440: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy840 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); }
+ case 438: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy272 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), releaseRawExprNode(pCxt, yymsp[-1].minor.yy272)); }
break;
- case 441: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
-{ yymsp[-3].minor.yy840 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); }
+ case 439: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+{ yymsp[-3].minor.yy272 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy272)); }
break;
- case 442: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy840 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); }
+ case 440: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy272 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), NULL, yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
break;
- case 443: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy840 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy840, yymsp[0].minor.yy840); }
+ case 441: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy272 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy272), releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), yymsp[-1].minor.yy272, yymsp[0].minor.yy272); }
break;
- case 445: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- case 463: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==463);
-{ yymsp[-3].minor.yy840 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy840); }
+ case 443: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ case 461: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==461);
+{ yymsp[-3].minor.yy272 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy272); }
break;
- case 447: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy840 = createFillNode(pCxt, yymsp[-1].minor.yy816, NULL); }
+ case 445: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy272 = createFillNode(pCxt, yymsp[-1].minor.yy186, NULL); }
break;
- case 448: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy840 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy544)); }
+ case 446: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy272 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy172)); }
break;
- case 449: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy816 = FILL_MODE_NONE; }
+ case 447: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy186 = FILL_MODE_NONE; }
break;
- case 450: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy816 = FILL_MODE_PREV; }
+ case 448: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy186 = FILL_MODE_PREV; }
break;
- case 451: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy816 = FILL_MODE_NULL; }
+ case 449: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy186 = FILL_MODE_NULL; }
break;
- case 452: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy816 = FILL_MODE_LINEAR; }
+ case 450: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy186 = FILL_MODE_LINEAR; }
break;
- case 453: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy816 = FILL_MODE_NEXT; }
+ case 451: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy186 = FILL_MODE_NEXT; }
break;
- case 456: /* group_by_list ::= expression */
-{ yylhsminor.yy544 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); }
- yymsp[0].minor.yy544 = yylhsminor.yy544;
+ case 454: /* group_by_list ::= expression */
+{ yylhsminor.yy172 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); }
+ yymsp[0].minor.yy172 = yylhsminor.yy172;
break;
- case 457: /* group_by_list ::= group_by_list NK_COMMA expression */
-{ yylhsminor.yy544 = addNodeToList(pCxt, yymsp[-2].minor.yy544, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); }
- yymsp[-2].minor.yy544 = yylhsminor.yy544;
+ case 455: /* group_by_list ::= group_by_list NK_COMMA expression */
+{ yylhsminor.yy172 = addNodeToList(pCxt, yymsp[-2].minor.yy172, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy272))); }
+ yymsp[-2].minor.yy172 = yylhsminor.yy172;
break;
- case 461: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
-{ yymsp[-5].minor.yy840 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); }
+ case 459: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
+{ yymsp[-5].minor.yy272 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy272), releaseRawExprNode(pCxt, yymsp[-1].minor.yy272)); }
break;
- case 464: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 462: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy840 = addOrderByClause(pCxt, yymsp[-3].minor.yy840, yymsp[-2].minor.yy544);
- yylhsminor.yy840 = addSlimitClause(pCxt, yylhsminor.yy840, yymsp[-1].minor.yy840);
- yylhsminor.yy840 = addLimitClause(pCxt, yylhsminor.yy840, yymsp[0].minor.yy840);
+ yylhsminor.yy272 = addOrderByClause(pCxt, yymsp[-3].minor.yy272, yymsp[-2].minor.yy172);
+ yylhsminor.yy272 = addSlimitClause(pCxt, yylhsminor.yy272, yymsp[-1].minor.yy272);
+ yylhsminor.yy272 = addLimitClause(pCxt, yylhsminor.yy272, yymsp[0].minor.yy272);
}
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
- case 466: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
-{ yylhsminor.yy840 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy840, yymsp[0].minor.yy840); }
- yymsp[-3].minor.yy840 = yylhsminor.yy840;
+ case 464: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+{ yylhsminor.yy272 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy272, yymsp[0].minor.yy272); }
+ yymsp[-3].minor.yy272 = yylhsminor.yy272;
break;
- case 467: /* query_expression_body ::= query_expression_body UNION query_expression_body */
-{ yylhsminor.yy840 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy840, yymsp[0].minor.yy840); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 465: /* query_expression_body ::= query_expression_body UNION query_expression_body */
+{ yylhsminor.yy272 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy272, yymsp[0].minor.yy272); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 469: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+ case 467: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
{
- yymsp[-5].minor.yy840 = addOrderByClause(pCxt, yymsp[-4].minor.yy840, yymsp[-3].minor.yy544);
- yymsp[-5].minor.yy840 = addSlimitClause(pCxt, yymsp[-5].minor.yy840, yymsp[-2].minor.yy840);
- yymsp[-5].minor.yy840 = addLimitClause(pCxt, yymsp[-5].minor.yy840, yymsp[-1].minor.yy840);
+ yymsp[-5].minor.yy272 = addOrderByClause(pCxt, yymsp[-4].minor.yy272, yymsp[-3].minor.yy172);
+ yymsp[-5].minor.yy272 = addSlimitClause(pCxt, yymsp[-5].minor.yy272, yymsp[-2].minor.yy272);
+ yymsp[-5].minor.yy272 = addLimitClause(pCxt, yymsp[-5].minor.yy272, yymsp[-1].minor.yy272);
}
break;
- case 473: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 477: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==477);
-{ yymsp[-1].minor.yy840 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 471: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 475: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==475);
+{ yymsp[-1].minor.yy272 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 474: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 478: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==478);
-{ yymsp[-3].minor.yy840 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 472: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 476: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==476);
+{ yymsp[-3].minor.yy272 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 475: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 479: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==479);
-{ yymsp[-3].minor.yy840 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 473: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 477: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==477);
+{ yymsp[-3].minor.yy272 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 480: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy840); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 478: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy272 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy272); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 484: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy840 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), yymsp[-1].minor.yy204, yymsp[0].minor.yy277); }
- yymsp[-2].minor.yy840 = yylhsminor.yy840;
+ case 482: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy272 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy272), yymsp[-1].minor.yy818, yymsp[0].minor.yy493); }
+ yymsp[-2].minor.yy272 = yylhsminor.yy272;
break;
- case 485: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy204 = ORDER_ASC; }
+ case 483: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy818 = ORDER_ASC; }
break;
- case 486: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy204 = ORDER_ASC; }
+ case 484: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy818 = ORDER_ASC; }
break;
- case 487: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy204 = ORDER_DESC; }
+ case 485: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy818 = ORDER_DESC; }
break;
- case 488: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy277 = NULL_ORDER_DEFAULT; }
+ case 486: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy493 = NULL_ORDER_DEFAULT; }
break;
- case 489: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy277 = NULL_ORDER_FIRST; }
+ case 487: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy493 = NULL_ORDER_FIRST; }
break;
- case 490: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy277 = NULL_ORDER_LAST; }
+ case 488: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy493 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp
index 9bca6cae0a41a145237b1035c5dd1edb4fdf0cd9..68c4ac3706e2a42fd370a96a85d1adf6df162774 100644
--- a/source/libs/parser/test/parInitialCTest.cpp
+++ b/source/libs/parser/test/parInitialCTest.cpp
@@ -568,15 +568,13 @@ TEST_F(ParserInitialCTest, createStream) {
memset(&expect, 0, sizeof(SCMCreateStreamReq));
};
- auto setCreateStreamReqFunc = [&](const char* pStream, const char* pSrcDb, const char* pSql,
- const char* pDstStb = nullptr, int8_t igExists = 0,
- int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0,
- int64_t watermark = 0, int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED) {
+ auto setCreateStreamReqFunc = [&](const char* pStream, const char* pSrcDb, const char* pSql, const char* pDstStb,
+ int8_t igExists = 0, int8_t triggerType = STREAM_TRIGGER_AT_ONCE,
+ int64_t maxDelay = 0, int64_t watermark = 0,
+ int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED) {
snprintf(expect.name, sizeof(expect.name), "0.%s", pStream);
snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb);
- if (NULL != pDstStb) {
- snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb);
- }
+ snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb);
expect.igExists = igExists;
expect.sql = strdup(pSql);
expect.triggerType = triggerType;
@@ -603,15 +601,6 @@ TEST_F(ParserInitialCTest, createStream) {
tFreeSCMCreateStreamReq(&req);
});
- setCreateStreamReqFunc("s1", "test", "create stream s1 as select count(*) from t1 interval(10s)");
- run("CREATE STREAM s1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)");
- clearCreateStreamReq();
-
- setCreateStreamReqFunc("s1", "test", "create stream if not exists s1 as select count(*) from t1 interval(10s)",
- nullptr, 1);
- run("CREATE STREAM IF NOT EXISTS s1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)");
- clearCreateStreamReq();
-
setCreateStreamReqFunc("s1", "test", "create stream s1 into st1 as select count(*) from t1 interval(10s)", "st1");
run("CREATE STREAM s1 INTO st1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)");
clearCreateStreamReq();
@@ -629,7 +618,8 @@ TEST_F(ParserInitialCTest, createStream) {
TEST_F(ParserInitialCTest, createStreamSemanticCheck) {
useDb("root", "test");
- run("CREATE STREAM s1 AS SELECT PERCENTILE(c1, 30) FROM t1 INTERVAL(10S)", TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC);
+ run("CREATE STREAM s1 INTO st1 AS SELECT PERCENTILE(c1, 30) FROM t1 INTERVAL(10S)",
+ TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC);
}
TEST_F(ParserInitialCTest, createTable) {
diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp
index 98281b7bf070095b4bb23326b156d5e8764690de..360b904c170e50682b17d9c99a8ec1cd679a6db0 100644
--- a/source/libs/parser/test/parTestUtil.cpp
+++ b/source/libs/parser/test/parTestUtil.cpp
@@ -207,6 +207,7 @@ class ParserTestBaseImpl {
pCxt->db = caseEnv_.db_.c_str();
pCxt->pUser = caseEnv_.user_.c_str();
pCxt->isSuperUser = caseEnv_.user_ == "root";
+ pCxt->enableSysInfo = true;
pCxt->pSql = stmtEnv_.sql_.c_str();
pCxt->sqlLen = stmtEnv_.sql_.length();
pCxt->pMsg = stmtEnv_.msgBuf_.data();
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index 71f084d41226fee17bd0b8c0d63f69ad07ca3a20..0667c5f5b9e2984d119dab5297abb16e374977fb 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -44,12 +44,15 @@ static void setColumnInfo(SFunctionNode* pFunc, SColumnNode* pCol) {
pCol->colType = COLUMN_TYPE_TBNAME;
break;
case FUNCTION_TYPE_WSTART:
+ pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
+ pCol->colType = COLUMN_TYPE_WINDOW_START;
+ break;
case FUNCTION_TYPE_WEND:
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
- pCol->colType = COLUMN_TYPE_WINDOW_PC;
+ pCol->colType = COLUMN_TYPE_WINDOW_END;
break;
case FUNCTION_TYPE_WDURATION:
- pCol->colType = COLUMN_TYPE_WINDOW_PC;
+ pCol->colType = COLUMN_TYPE_WINDOW_DURATION;
break;
case FUNCTION_TYPE_GROUP_KEY:
pCol->colType = COLUMN_TYPE_GROUP_KEY;
@@ -784,7 +787,10 @@ static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele
static EDealRes needFillValueImpl(SNode* pNode, void* pContext) {
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
SColumnNode* pCol = (SColumnNode*)pNode;
- if (COLUMN_TYPE_WINDOW_PC != pCol->colType && COLUMN_TYPE_GROUP_KEY != pCol->colType) {
+ if (COLUMN_TYPE_WINDOW_START != pCol->colType &&
+ COLUMN_TYPE_WINDOW_END != pCol->colType &&
+ COLUMN_TYPE_WINDOW_DURATION != pCol->colType &&
+ COLUMN_TYPE_GROUP_KEY != pCol->colType) {
*(bool*)pContext = true;
return DEAL_RES_END;
}
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index c7eb6f7b5e61fdd1d4c29cc88a8b980bc1efdf79..cafae18dbe812546f6ef931d804ca4a9e5c1a6fa 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -576,6 +576,7 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
pScan->showRewrite = pScanLogicNode->showRewrite;
pScan->accountId = pCxt->pPlanCxt->acctId;
+ pScan->sysInfo = pCxt->pPlanCxt->sysInfo;
if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TABLES) ||
0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TABLE_DISTRIBUTED) ||
0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TAGS)) {
diff --git a/source/libs/planner/test/planOtherTest.cpp b/source/libs/planner/test/planOtherTest.cpp
index 7107f8b3c94c616ae9db90132a59f2804b542aca..350ccd0d927c9773059cfb2c027a0ca2292e4d13 100644
--- a/source/libs/planner/test/planOtherTest.cpp
+++ b/source/libs/planner/test/planOtherTest.cpp
@@ -37,9 +37,9 @@ TEST_F(PlanOtherTest, createStream) {
TEST_F(PlanOtherTest, createStreamUseSTable) {
useDb("root", "test");
- run("CREATE STREAM IF NOT EXISTS s1 as SELECT COUNT(*) FROM st1 INTERVAL(10s)");
+ run("CREATE STREAM IF NOT EXISTS s1 into st1 as SELECT COUNT(*) FROM st1 INTERVAL(10s)");
- run("CREATE STREAM IF NOT EXISTS s1 as SELECT COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)");
+ run("CREATE STREAM IF NOT EXISTS s1 into st1 as SELECT COUNT(*) FROM st1 PARTITION BY TBNAME INTERVAL(10s)");
}
TEST_F(PlanOtherTest, createSmaIndex) {
diff --git a/source/libs/planner/test/planTestUtil.cpp b/source/libs/planner/test/planTestUtil.cpp
index 5fc8b3cf302612c9b8528a8380475b32a79a8824..f904643be91298fd8bcd1164334663af32851e98 100644
--- a/source/libs/planner/test/planTestUtil.cpp
+++ b/source/libs/planner/test/planTestUtil.cpp
@@ -343,6 +343,7 @@ class PlannerTestBaseImpl {
cxt.pMsg = stmtEnv_.msgBuf_.data();
cxt.msgLen = stmtEnv_.msgBuf_.max_size();
cxt.svrVer = "3.0.0.0";
+ cxt.enableSysInfo = true;
if (prepare) {
SStmtCallback stmtCb = {0};
cxt.pStmtCb = &stmtCb;
diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c
index 5143aa4af1f90ba0e7a0ac2f37af6648ed68c685..d848016e46482614972d5e85469e4297136d6cc0 100644
--- a/source/libs/qcom/src/queryUtil.c
+++ b/source/libs/qcom/src/queryUtil.c
@@ -213,15 +213,25 @@ SSchema createSchema(int8_t type, int32_t bytes, col_id_t colId, const char* nam
return s;
}
+void freeSTableMetaRspPointer(void *p) {
+ tFreeSTableMetaRsp(*(void**)p);
+ taosMemoryFreeClear(*(void**)p);
+}
+
void destroyQueryExecRes(SExecResult* pRes) {
if (NULL == pRes || NULL == pRes->res) {
return;
}
switch (pRes->msgType) {
+ case TDMT_VND_CREATE_TABLE: {
+ taosArrayDestroyEx((SArray*)pRes->res, freeSTableMetaRspPointer);
+ break;
+ }
+ case TDMT_MND_CREATE_STB:
case TDMT_VND_ALTER_TABLE:
case TDMT_MND_ALTER_STB: {
- tFreeSTableMetaRsp((STableMetaRsp*)pRes->res);
+ tFreeSTableMetaRsp(pRes->res);
taosMemoryFreeClear(pRes->res);
break;
}
diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c
index ed8786170d0e37f677d1b731d08eafb511875023..e2d3ac1583926da6fe9d9aff82392c4fcc3c2d65 100644
--- a/source/libs/qcom/src/querymsg.c
+++ b/source/libs/qcom/src/querymsg.c
@@ -354,6 +354,19 @@ static int32_t queryConvertTableMetaMsg(STableMetaRsp *pMetaMsg) {
return TSDB_CODE_SUCCESS;
}
+int32_t queryCreateCTableMetaFromMsg(STableMetaRsp *msg, SCTableMeta *pMeta) {
+ pMeta->vgId = msg->vgId;
+ pMeta->tableType = msg->tableType;
+ pMeta->uid = msg->tuid;
+ pMeta->suid = msg->suid;
+
+ qDebug("ctable %s uid %" PRIx64 " meta returned, type %d vgId:%d db %s suid %" PRIx64 ,
+ msg->tbName, pMeta->uid, pMeta->tableType, pMeta->vgId, msg->dbFName, pMeta->suid);
+
+ return TSDB_CODE_SUCCESS;
+}
+
+
int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta **pMeta) {
int32_t total = msg->numOfColumns + msg->numOfTags;
int32_t metaSize = sizeof(STableMeta) + sizeof(SSchema) * total;
diff --git a/source/libs/scalar/inc/sclInt.h b/source/libs/scalar/inc/sclInt.h
index d423b92da7e83589aacc6d384c0e2cafa0949038..36d2c5a49cb8a00db1ed4f731c3d02fe80a83ea3 100644
--- a/source/libs/scalar/inc/sclInt.h
+++ b/source/libs/scalar/inc/sclInt.h
@@ -45,6 +45,8 @@ typedef struct SScalarCtx {
#define SCL_IS_CONST_CALC(_ctx) (NULL == (_ctx)->pBlockList)
//#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type) && (((SValueNode *)_node)->placeholderNo <= 0))
#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type))
+#define SCL_IS_COMPARISON_OPERATOR(_opType) ((_opType) >= OP_TYPE_GREATER_THAN && (_opType) < OP_TYPE_IS_NOT_UNKNOWN)
+#define SCL_DOWNGRADE_DATETYPE(_type) ((_type) == TSDB_DATA_TYPE_BIGINT || TSDB_DATA_TYPE_DOUBLE == (_type) || (_type) == TSDB_DATA_TYPE_UBIGINT)
#define sclFatal(...) qFatal(__VA_ARGS__)
#define sclError(...) qError(__VA_ARGS__)
diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c
index 6634a29f4091773c89988940c9ab6ed5de2487da..cd1f6624bdf83e4fe143c1a648e5e30947bcdd65 100644
--- a/source/libs/scalar/src/scalar.c
+++ b/source/libs/scalar/src/scalar.c
@@ -9,6 +9,7 @@
#include "scalar.h"
#include "tudf.h"
#include "ttime.h"
+#include "tcompare.h"
int32_t scalarGetOperatorParamNum(EOperatorType type) {
if (OP_TYPE_IS_NULL == type || OP_TYPE_IS_NOT_NULL == type || OP_TYPE_IS_TRUE == type || OP_TYPE_IS_NOT_TRUE == type
@@ -219,6 +220,82 @@ void sclFreeParamList(SScalarParam *param, int32_t paramNum) {
taosMemoryFree(param);
}
+void sclDowngradeValueType(SValueNode *valueNode) {
+ switch (valueNode->node.resType.type) {
+ case TSDB_DATA_TYPE_BIGINT: {
+ int8_t i8 = valueNode->datum.i;
+ if (i8 == valueNode->datum.i) {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_TINYINT;
+ *(int8_t*)&valueNode->typeData = i8;
+ break;
+ }
+ int16_t i16 = valueNode->datum.i;
+ if (i16 == valueNode->datum.i) {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_SMALLINT;
+ *(int16_t*)&valueNode->typeData = i16;
+ break;
+ }
+ int32_t i32 = valueNode->datum.i;
+ if (i32 == valueNode->datum.i) {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_INT;
+ *(int32_t*)&valueNode->typeData = i32;
+ break;
+ }
+ break;
+ }
+ case TSDB_DATA_TYPE_UBIGINT:{
+ uint8_t u8 = valueNode->datum.i;
+ if (u8 == valueNode->datum.i) {
+ int8_t i8 = valueNode->datum.i;
+ if (i8 == valueNode->datum.i) {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_TINYINT;
+ *(int8_t*)&valueNode->typeData = i8;
+ } else {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_UTINYINT;
+ *(uint8_t*)&valueNode->typeData = u8;
+ }
+ break;
+ }
+ uint16_t u16 = valueNode->datum.i;
+ if (u16 == valueNode->datum.i) {
+ int16_t i16 = valueNode->datum.i;
+ if (i16 == valueNode->datum.i) {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_SMALLINT;
+ *(int16_t*)&valueNode->typeData = i16;
+ } else {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_USMALLINT;
+ *(uint16_t*)&valueNode->typeData = u16;
+ }
+ break;
+ }
+ uint32_t u32 = valueNode->datum.i;
+ if (u32 == valueNode->datum.i) {
+ int32_t i32 = valueNode->datum.i;
+ if (i32 == valueNode->datum.i) {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_INT;
+ *(int32_t*)&valueNode->typeData = i32;
+ } else {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_UINT;
+ *(uint32_t*)&valueNode->typeData = u32;
+ }
+ break;
+ }
+ break;
+ }
+ case TSDB_DATA_TYPE_DOUBLE: {
+ float f = valueNode->datum.d;
+ if (FLT_EQUAL(f, valueNode->datum.d)) {
+ valueNode->node.resType.type = TSDB_DATA_TYPE_FLOAT;
+ *(float*)&valueNode->typeData = f;
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
+
int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t *rowNum) {
switch (nodeType(node)) {
case QUERY_NODE_LEFT_VALUE: {
@@ -675,6 +752,10 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) {
return DEAL_RES_ERROR;
}
}
+
+ if (SCL_IS_COMPARISON_OPERATOR(node->opType) && SCL_DOWNGRADE_DATETYPE(valueNode->node.resType.type)) {
+ sclDowngradeValueType(valueNode);
+ }
}
if (node->pRight && (QUERY_NODE_VALUE == nodeType(node->pRight))) {
@@ -692,6 +773,10 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) {
return DEAL_RES_ERROR;
}
}
+
+ if (SCL_IS_COMPARISON_OPERATOR(node->opType) && SCL_DOWNGRADE_DATETYPE(valueNode->node.resType.type)) {
+ sclDowngradeValueType(valueNode);
+ }
}
if (node->pRight && (QUERY_NODE_NODE_LIST == nodeType(node->pRight))) {
diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h
index ce841ed83cc527849021517a6ed9c7a9c3a56f0c..957fd46ba5a767858a3bb5bbe50142b4f1c1ce47 100644
--- a/source/libs/scheduler/inc/schInt.h
+++ b/source/libs/scheduler/inc/schInt.h
@@ -283,7 +283,7 @@ typedef struct SSchJob {
} SSchJob;
typedef struct SSchTaskCtx {
- SSchJob *pJob;
+ int64_t jobRid;
SSchTask *pTask;
} SSchTaskCtx;
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index ecd9daf1bcd3b83803754017aec27c1ebe62becf..5a64aaaebb3860d2c6729ac8eb1e00be0cc9cda1 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -102,15 +102,30 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
tDecoderInit(&coder, msg, msgSize);
code = tDecodeSVCreateTbBatchRsp(&coder, &batchRsp);
if (TSDB_CODE_SUCCESS == code && batchRsp.nRsps > 0) {
+ SCH_LOCK(SCH_WRITE, &pJob->resLock);
+ if (NULL == pJob->execRes.res) {
+ pJob->execRes.res = taosArrayInit(batchRsp.nRsps, POINTER_BYTES);
+ pJob->execRes.msgType = TDMT_VND_CREATE_TABLE;
+ }
+
for (int32_t i = 0; i < batchRsp.nRsps; ++i) {
SVCreateTbRsp *rsp = batchRsp.pRsps + i;
+ if (rsp->pMeta) {
+ taosArrayPush((SArray*)pJob->execRes.res, &rsp->pMeta);
+ }
+
if (TSDB_CODE_SUCCESS != rsp->code) {
code = rsp->code;
- tDecoderClear(&coder);
- SCH_ERR_JRET(code);
}
}
+ SCH_UNLOCK(SCH_WRITE, &pJob->resLock);
+
+ if (taosArrayGetSize((SArray*)pJob->execRes.res) <= 0) {
+ taosArrayDestroy((SArray*)pJob->execRes.res);
+ pJob->execRes.res = NULL;
+ }
}
+
tDecoderClear(&coder);
SCH_ERR_JRET(code);
}
diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c
index d16d15c1191a3360be19e6c485f13bc3ce66d0ef..9cab39c30122072207daa9e9639ab92645fc1633 100644
--- a/source/libs/scheduler/src/schTask.c
+++ b/source/libs/scheduler/src/schTask.c
@@ -821,7 +821,13 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) {
int32_t schLaunchTaskImpl(void *param) {
SSchTaskCtx *pCtx = (SSchTaskCtx *)param;
- SSchJob *pJob = pCtx->pJob;
+ SSchJob *pJob = schAcquireJob(pCtx->jobRid);
+ if (NULL == pJob) {
+ taosMemoryFree(param);
+ qDebug("job refId 0x%" PRIx64 " already not exist", pCtx->jobRid);
+ SCH_RET(TSDB_CODE_SCH_JOB_IS_DROPPING);
+ }
+
SSchTask *pTask = pCtx->pTask;
int8_t status = 0;
int32_t code = 0;
@@ -880,6 +886,8 @@ _return:
}
}
+ schReleaseJob(pJob->refId);
+
SCH_RET(code);
}
@@ -890,7 +898,7 @@ int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) {
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
- param->pJob = pJob;
+ param->jobRid = pJob->refId;
param->pTask = pTask;
if (pJob->taskNum >= SCH_MIN_AYSNC_EXEC_NUM) {
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index c78ff0756f22e50e1f64a3f02526a04376eb9b08..9d4010f60e5fcb222e235181a2ce12b8d4dc4102 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -358,7 +358,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
FAIL_SHUFFLE_DISPATCH:
if (pReqs) {
for (int32_t i = 0; i < vgSz; i++) {
- taosArrayDestroy(pReqs[i].data);
+ taosArrayDestroyP(pReqs[i].data, taosMemoryFree);
taosArrayDestroy(pReqs[i].dataLen);
}
taosMemoryFree(pReqs);
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index 06ca26f0292df2447fa7c267a0d43e65f4117964..102bad742652005df440b5d4d7a87bcef34ba636 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -140,7 +140,6 @@ int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum, bool dispatch)
return 0;
}
-// TODO: handle version
int32_t streamExecForAll(SStreamTask* pTask) {
while (1) {
int32_t batchCnt = 1;
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
index 5ff700546cf63acd3e0c4d0798383d6724947de1..1442ed2e0509e37d8b21806dc05343adcaa0f32c 100644
--- a/source/libs/stream/src/streamMeta.c
+++ b/source/libs/stream/src/streamMeta.c
@@ -14,7 +14,7 @@
*/
#include "executor.h"
-#include "tstream.h"
+#include "streamInc.h"
#include "ttimer.h"
SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc) {
@@ -23,17 +23,23 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
- pMeta->path = strdup(path);
+ int32_t len = strlen(path) + 20;
+ char* streamPath = taosMemoryCalloc(1, len);
+ sprintf(streamPath, "%s/%s", path, "stream");
+ pMeta->path = strdup(streamPath);
if (tdbOpen(pMeta->path, 16 * 1024, 1, &pMeta->db) < 0) {
goto _err;
}
+ sprintf(streamPath, "%s/%s", pMeta->path, "checkpoints");
+ mkdir(streamPath, 0755);
+ taosMemoryFree(streamPath);
+
if (tdbTbOpen("task.db", sizeof(int32_t), -1, NULL, pMeta->db, &pMeta->pTaskDb) < 0) {
goto _err;
}
- // open state storage backend
- if (tdbTbOpen("state.db", sizeof(int32_t), -1, NULL, pMeta->db, &pMeta->pStateDb) < 0) {
+ if (tdbTbOpen("checkpoint.db", sizeof(int32_t), -1, NULL, pMeta->db, &pMeta->pCheckpointDb) < 0) {
goto _err;
}
@@ -49,16 +55,13 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
pMeta->ahandle = ahandle;
pMeta->expandFunc = expandFunc;
- if (streamLoadTasks(pMeta) < 0) {
- goto _err;
- }
return pMeta;
_err:
if (pMeta->path) taosMemoryFree(pMeta->path);
if (pMeta->pTasks) taosHashCleanup(pMeta->pTasks);
- if (pMeta->pStateDb) tdbTbClose(pMeta->pStateDb);
if (pMeta->pTaskDb) tdbTbClose(pMeta->pTaskDb);
+ if (pMeta->pCheckpointDb) tdbTbClose(pMeta->pCheckpointDb);
if (pMeta->db) tdbClose(pMeta->db);
taosMemoryFree(pMeta);
return NULL;
@@ -67,7 +70,7 @@ _err:
void streamMetaClose(SStreamMeta* pMeta) {
tdbCommit(pMeta->db, &pMeta->txn);
tdbTbClose(pMeta->pTaskDb);
- tdbTbClose(pMeta->pStateDb);
+ tdbTbClose(pMeta->pCheckpointDb);
tdbClose(pMeta->db);
void* pIter = NULL;
@@ -262,6 +265,8 @@ int32_t streamLoadTasks(SStreamMeta* pMeta) {
}
}
+ tdbFree(pKey);
+ tdbFree(pVal);
if (tdbTbcClose(pCur) < 0) {
return -1;
}
diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c
index 263053778b1ae94de5a5353edf158e37604baf98..0505c3edd6dd8211792679b7164bcc001bde6c4e 100644
--- a/source/libs/stream/src/streamRecover.c
+++ b/source/libs/stream/src/streamRecover.c
@@ -176,6 +176,7 @@ int32_t tDecodeSStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamRecoverDownstrea
}
int32_t streamSaveStateInfo(SStreamMeta* pMeta, SStreamTask* pTask) {
+#if 0
void* buf = NULL;
ASSERT(pTask->taskLevel == TASK_LEVEL__SINK);
@@ -224,10 +225,12 @@ int32_t streamSaveStateInfo(SStreamMeta* pMeta, SStreamTask* pTask) {
FAIL:
if (buf) taosMemoryFree(buf);
return -1;
+#endif
return 0;
}
int32_t streamLoadStateInfo(SStreamMeta* pMeta, SStreamTask* pTask) {
+#if 0
void* pVal = NULL;
int32_t vLen = 0;
if (tdbTbGet(pMeta->pStateDb, &pTask->taskId, sizeof(void*), &pVal, &vLen) < 0) {
@@ -241,7 +244,7 @@ int32_t streamLoadStateInfo(SStreamMeta* pMeta, SStreamTask* pTask) {
pTask->nextCheckId = aggCheckpoint.checkpointId + 1;
pTask->checkpointInfo = aggCheckpoint.checkpointVer;
-
+#endif
return 0;
}
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
new file mode 100644
index 0000000000000000000000000000000000000000..dfd6f012cc4f64d252f75a20f761c6f87fc05b78
--- /dev/null
+++ b/source/libs/stream/src/streamState.c
@@ -0,0 +1,205 @@
+/*
+ * 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 "executor.h"
+#include "streamInc.h"
+#include "tcommon.h"
+#include "ttimer.h"
+
+SStreamState* streamStateOpen(char* path, SStreamTask* pTask) {
+ SStreamState* pState = taosMemoryCalloc(1, sizeof(SStreamState));
+ if (pState == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+ char statePath[300];
+ sprintf(statePath, "%s/%d", path, pTask->taskId);
+ if (tdbOpen(statePath, 4096, 256, &pState->db) < 0) {
+ goto _err;
+ }
+
+ // open state storage backend
+ if (tdbTbOpen("state.db", sizeof(SWinKey), -1, SWinKeyCmpr, pState->db, &pState->pStateDb) < 0) {
+ goto _err;
+ }
+
+ if (streamStateBegin(pState) < 0) {
+ goto _err;
+ }
+
+ pState->pOwner = pTask;
+
+ return pState;
+
+_err:
+ if (pState->pStateDb) tdbTbClose(pState->pStateDb);
+ if (pState->db) tdbClose(pState->db);
+ taosMemoryFree(pState);
+ return NULL;
+}
+
+void streamStateClose(SStreamState* pState) {
+ tdbCommit(pState->db, &pState->txn);
+ tdbTbClose(pState->pStateDb);
+ tdbClose(pState->db);
+
+ taosMemoryFree(pState);
+}
+
+int32_t streamStateBegin(SStreamState* pState) {
+ if (tdbTxnOpen(&pState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
+ 0) {
+ return -1;
+ }
+
+ if (tdbBegin(pState->db, &pState->txn) < 0) {
+ tdbTxnClose(&pState->txn);
+ return -1;
+ }
+ return 0;
+}
+
+int32_t streamStateCommit(SStreamState* pState) {
+ if (tdbCommit(pState->db, &pState->txn) < 0) {
+ return -1;
+ }
+ memset(&pState->txn, 0, sizeof(TXN));
+ if (tdbTxnOpen(&pState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
+ 0) {
+ return -1;
+ }
+ if (tdbBegin(pState->db, &pState->txn) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+int32_t streamStateAbort(SStreamState* pState) {
+ if (tdbAbort(pState->db, &pState->txn) < 0) {
+ return -1;
+ }
+ memset(&pState->txn, 0, sizeof(TXN));
+ if (tdbTxnOpen(&pState->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
+ 0) {
+ return -1;
+ }
+ if (tdbBegin(pState->db, &pState->txn) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) {
+ return tdbTbUpsert(pState->pStateDb, key, sizeof(SWinKey), value, vLen, &pState->txn);
+}
+int32_t streamStateGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
+ return tdbTbGet(pState->pStateDb, key, sizeof(SWinKey), pVal, pVLen);
+}
+
+int32_t streamStateDel(SStreamState* pState, const SWinKey* key) {
+ return tdbTbDelete(pState->pStateDb, key, sizeof(SWinKey), &pState->txn);
+}
+
+SStreamStateCur* streamStateGetCur(SStreamState* pState, const SWinKey* key) {
+ SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
+ if (pCur == NULL) return NULL;
+ tdbTbcOpen(pState->pStateDb, &pCur->pCur, NULL);
+
+ int32_t c;
+ tdbTbcMoveTo(pCur->pCur, key, sizeof(SWinKey), &c);
+ if (c != 0) {
+ taosMemoryFree(pCur);
+ return NULL;
+ }
+ return pCur;
+}
+
+int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) {
+ const SWinKey* pKTmp = NULL;
+ int32_t kLen;
+ if (tdbTbcGet(pCur->pCur, (const void**)&pKTmp, &kLen, pVal, pVLen) < 0) {
+ return -1;
+ }
+ *pKey = *pKTmp;
+ return 0;
+}
+
+int32_t streamStateSeekFirst(SStreamState* pState, SStreamStateCur* pCur) {
+ //
+ return tdbTbcMoveToFirst(pCur->pCur);
+}
+
+int32_t streamStateSeekLast(SStreamState* pState, SStreamStateCur* pCur) {
+ //
+ return tdbTbcMoveToLast(pCur->pCur);
+}
+
+SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key) {
+ SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
+ if (pCur == NULL) {
+ return NULL;
+ }
+
+ int32_t c;
+ if (tdbTbcMoveTo(pCur->pCur, key, sizeof(SWinKey), &c) < 0) {
+ taosMemoryFree(pCur);
+ return NULL;
+ }
+ if (c > 0) return pCur;
+
+ if (tdbTbcMoveToNext(pCur->pCur) < 0) {
+ taosMemoryFree(pCur);
+ return NULL;
+ }
+
+ return pCur;
+}
+
+SStreamStateCur* streamStateSeekKeyPrev(SStreamState* pState, const SWinKey* key) {
+ SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
+ if (pCur == NULL) {
+ return NULL;
+ }
+
+ int32_t c;
+ if (tdbTbcMoveTo(pCur->pCur, key, sizeof(SWinKey), &c) < 0) {
+ taosMemoryFree(pCur);
+ return NULL;
+ }
+ if (c < 0) return pCur;
+
+ if (tdbTbcMoveToPrev(pCur->pCur) < 0) {
+ taosMemoryFree(pCur);
+ return NULL;
+ }
+
+ return pCur;
+}
+
+int32_t streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur) {
+ //
+ return tdbTbcMoveToNext(pCur->pCur);
+}
+
+int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur) {
+ //
+ return tdbTbcMoveToPrev(pCur->pCur);
+}
+void streamStateFreeCur(SStreamStateCur* pCur) {
+ tdbTbcClose(pCur->pCur);
+ taosMemoryFree(pCur);
+}
+
+void streamFreeVal(void* val) { tdbFree(val); }
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index 4009a47c65af469bc8a6f4fe5443411306e4ec2b..ce5917de296c317f739e79cb78cda21660769aa8 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -165,5 +165,8 @@ void tFreeSStreamTask(SStreamTask* pTask) {
if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
taosArrayDestroy(pTask->shuffleDispatcher.dbInfo.pVgroupInfos);
}
+
+ if (pTask->pState) streamStateClose(pTask->pState);
+
taosMemoryFree(pTask);
}
diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c
index 7a44edb12cddf5a386e3b77031920559d8b0a5e9..4701318779bba3928223c137c13c0bca6e2df417 100644
--- a/source/libs/tdb/src/db/tdbBtree.c
+++ b/source/libs/tdb/src/db/tdbBtree.c
@@ -782,6 +782,11 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx
pBt);
tdbPageInsertCell(pParent, sIdx++, pNewCell, szNewCell, 0);
tdbOsFree(pNewCell);
+
+ if (TDB_CELLDECODER_FREE_VAL(&cd)) {
+ tdbFree(cd.pVal);
+ cd.pVal = NULL;
+ }
}
// move to next new page
@@ -934,6 +939,8 @@ static int tdbFetchOvflPage(SPgno *pPgno, SPage **ppOfp, TXN *pTxn, SBTree *pBt)
return -1;
}
+ tdbPCacheRelease(pBt->pPager->pCache, *ppOfp, pTxn);
+
return ret;
}
@@ -1277,6 +1284,8 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
nLeft -= bytes;
memcpy(&pgno, ofpCell + bytes, sizeof(pgno));
+
+ tdbPCacheRelease(pBt->pPager->pCache, ofp, pTxn);
}
} else {
int nLeftKey = kLen;
@@ -1336,6 +1345,8 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
memcpy(&pgno, ofpCell + bytes, sizeof(pgno));
+ tdbPCacheRelease(pBt->pPager->pCache, ofp, pTxn);
+
nLeftKey -= bytes;
nLeft -= bytes;
}
@@ -1374,6 +1385,8 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
memcpy(&pgno, ofpCell + vLen - nLeft + bytes, sizeof(pgno));
+ tdbPCacheRelease(pBt->pPager->pCache, ofp, pTxn);
+
nLeft -= bytes;
}
}
@@ -1401,7 +1414,7 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD
pDecoder->pgno = 0;
TDB_CELLDECODER_SET_FREE_NIL(pDecoder);
- tdbDebug("tdb btc decoder set nil: %p/0x%x ", pDecoder, pDecoder->freeKV);
+ // tdbTrace("tdb btc decoder set nil: %p/0x%x ", pDecoder, pDecoder->freeKV);
// 1. Decode header part
if (!leaf) {
diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c
index ab9b21dc3fc01158ef5c504d69530b30eab6d79a..76d95cbb91221b6fac5a72a0ddeb0e5493158102 100644
--- a/source/libs/tdb/src/db/tdbPCache.c
+++ b/source/libs/tdb/src/db/tdbPCache.c
@@ -111,6 +111,7 @@ void tdbPCacheRelease(SPCache *pCache, SPage *pPage, TXN *pTxn) {
tdbPCacheLock(pCache);
nRef = tdbUnrefPage(pPage);
+ tdbDebug("pcache/release page %p/%d/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id, nRef);
if (nRef == 0) {
// test the nRef again to make sure
// it is safe th handle the page
@@ -145,7 +146,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn)
// 1. Search the hash table
pPage = pCache->pgHash[tdbPCachePageHash(pPgid) % pCache->nHash];
while (pPage) {
- if (memcmp(pPage->pgid.fileid, pPgid->fileid, TDB_FILE_ID_LEN) == 0 && pPage->pgid.pgno == pPgid->pgno) break;
+ if (pPage->pgid.pgno == pPgid->pgno && memcmp(pPage->pgid.fileid, pPgid->fileid, TDB_FILE_ID_LEN) == 0) break;
pPage = pPage->pHashNext;
}
@@ -212,7 +213,8 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn)
pPage->pPager = pPageH->pPager;
memcpy(pPage->pData, pPageH->pData, pPage->pageSize);
- tdbDebug("pcache/pPageH: %p %d %p %p", pPageH, pPageH->pPageHdr - pPageH->pData, pPageH->xCellSize, pPage);
+ tdbDebug("pcache/pPageH: %p %d %p %p %d", pPageH, pPageH->pPageHdr - pPageH->pData, pPageH->xCellSize, pPage,
+ TDB_PAGE_PGNO(pPageH));
tdbPageInit(pPage, pPageH->pPageHdr - pPageH->pData, pPageH->xCellSize);
pPage->kLen = pPageH->kLen;
pPage->vLen = pPageH->vLen;
@@ -243,7 +245,7 @@ static void tdbPCachePinPage(SPCache *pCache, SPage *pPage) {
pCache->nRecyclable--;
// printf("pin page %d pgno %d pPage %p\n", pPage->id, TDB_PAGE_PGNO(pPage), pPage);
- tdbTrace("pin page %d", pPage->id);
+ tdbDebug("pcache/pin page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
}
}
@@ -264,15 +266,14 @@ static void tdbPCacheUnpinPage(SPCache *pCache, SPage *pPage) {
pCache->nRecyclable++;
// printf("unpin page %d pgno %d pPage %p\n", pPage->id, TDB_PAGE_PGNO(pPage), pPage);
- tdbTrace("unpin page %d", pPage->id);
+ tdbDebug("pcache/unpin page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
}
static void tdbPCacheRemovePageFromHash(SPCache *pCache, SPage *pPage) {
- SPage **ppPage;
- uint32_t h;
+ uint32_t h = tdbPCachePageHash(&(pPage->pgid)) % pCache->nHash;
- h = tdbPCachePageHash(&(pPage->pgid));
- for (ppPage = &(pCache->pgHash[h % pCache->nHash]); (*ppPage) && *ppPage != pPage; ppPage = &((*ppPage)->pHashNext))
+ SPage **ppPage = &(pCache->pgHash[h]);
+ for (; (*ppPage) && *ppPage != pPage; ppPage = &((*ppPage)->pHashNext))
;
if (*ppPage) {
@@ -281,13 +282,11 @@ static void tdbPCacheRemovePageFromHash(SPCache *pCache, SPage *pPage) {
// printf("rmv page %d to hash, pgno %d, pPage %p\n", pPage->id, TDB_PAGE_PGNO(pPage), pPage);
}
- tdbTrace("remove page %d to hash", pPage->id);
+ tdbDebug("pcache/remove page %p/%d/%d from hash %" PRIu32, pPage, TDB_PAGE_PGNO(pPage), pPage->id, h);
}
static void tdbPCacheAddPageToHash(SPCache *pCache, SPage *pPage) {
- int h;
-
- h = tdbPCachePageHash(&(pPage->pgid)) % pCache->nHash;
+ uint32_t h = tdbPCachePageHash(&(pPage->pgid)) % pCache->nHash;
pPage->pHashNext = pCache->pgHash[h];
pCache->pgHash[h] = pPage;
@@ -295,7 +294,7 @@ static void tdbPCacheAddPageToHash(SPCache *pCache, SPage *pPage) {
pCache->nPage++;
// printf("add page %d to hash, pgno %d, pPage %p\n", pPage->id, TDB_PAGE_PGNO(pPage), pPage);
- tdbTrace("add page %d to hash", pPage->id);
+ tdbDebug("pcache/add page %p/%d/%d to hash %" PRIu32, pPage, TDB_PAGE_PGNO(pPage), pPage->id, h);
}
static int tdbPCacheOpenImpl(SPCache *pCache) {
diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c
index 276b06b147586bbf18fe73f94cdb2592032d97e2..a3f376b929291780bdd57cbf99f5db6035e70aff 100644
--- a/source/libs/tdb/src/db/tdbPage.c
+++ b/source/libs/tdb/src/db/tdbPage.c
@@ -68,12 +68,15 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t)
}
*ppPage = pPage;
+
+ tdbDebug("page/create: %p %p", pPage, xMalloc);
return 0;
}
int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg) {
u8 *ptr;
+ tdbDebug("page/destroy: %p %p", pPage, xFree);
ASSERT(xFree);
for (int iOvfl = 0; iOvfl < pPage->nOverflow; iOvfl++) {
@@ -87,6 +90,7 @@ int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg)
}
void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, TXN *, SBTree *pBt)) {
+ tdbDebug("page/zero: %p %" PRIu8 " %p", pPage, szAmHdr, xCellSize);
pPage->pPageHdr = pPage->pData + szAmHdr;
TDB_PAGE_NCELLS_SET(pPage, 0);
TDB_PAGE_CCELLS_SET(pPage, pPage->pageSize - sizeof(SPageFtr));
@@ -103,6 +107,7 @@ void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell
}
void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, TXN *, SBTree *pBt)) {
+ tdbDebug("page/init: %p %" PRIu8 " %p", pPage, szAmHdr, xCellSize);
pPage->pPageHdr = pPage->pData + szAmHdr;
pPage->pCellIdx = pPage->pPageHdr + TDB_PAGE_HDR_SIZE(pPage);
pPage->pFreeStart = pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * TDB_PAGE_NCELLS(pPage);
diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c
index 7cfb188ac9c688a073cea236d8019eb4ab17469c..386ea95dd795b93bcaa2826d471a6e4c97f81b7b 100644
--- a/source/libs/transport/src/thttp.c
+++ b/source/libs/transport/src/thttp.c
@@ -23,6 +23,7 @@
#define HTTP_RECV_BUF_SIZE 1024
+
typedef struct SHttpClient {
uv_connect_t conn;
uv_tcp_t tcp;
@@ -143,9 +144,9 @@ static void clientAllocBuffCb(uv_handle_t *handle, size_t suggested_size, uv_buf
static void clientRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t *buf) {
SHttpClient* cli = handle->data;
if (nread < 0) {
- uError("http-report read error:%s", uv_err_name(nread));
+ uError("http-report recv error:%s", uv_err_name(nread));
} else {
- uInfo("http-report succ to read %d bytes, just ignore it", nread);
+ uTrace("http-report succ to recv %d bytes, just ignore it", nread);
}
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
}
@@ -155,7 +156,7 @@ static void clientSentCb(uv_write_t* req, int32_t status) {
terrno = TAOS_SYSTEM_ERROR(status);
uError("http-report failed to send data %s", uv_strerror(status));
} else {
- uInfo("http-report succ to send data");
+ uTrace("http-report succ to send data");
}
uv_read_start((uv_stream_t *)&cli->tcp, clientAllocBuffCb, clientRecvCb);
}
@@ -174,7 +175,7 @@ static int32_t taosBuildDstAddr(const char* server, uint16_t port, struct sockad
uint32_t ip = taosGetIpv4FromFqdn(server);
if (ip == 0xffffffff) {
terrno = TAOS_SYSTEM_ERROR(errno);
- uError("http-report failed to get http server:%s ip since %s", server, terrstr());
+ uError("http-report failed to get http server:%s since %s", server, errno == 0 ? "invalid http server" : terrstr());
return -1;
}
char buf[128] = {0};
@@ -223,6 +224,7 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
if (ret != 0) {
uError("http-report failed to connect to server, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr, cli->port);
destroyHttpClient(cli);
+ uv_stop(loop);
}
uv_run(loop, UV_RUN_DEFAULT);
diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c
index 447db7613656613255369230138979a7596754a9..207b967923fad439ed043a71752d127bac13934c 100644
--- a/source/libs/transport/src/transSvr.c
+++ b/source/libs/transport/src/transSvr.c
@@ -276,14 +276,16 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
while (transReadComplete(pBuf)) {
tTrace("%s conn %p alread read complete packet", transLabel(pTransInst), conn);
if (true == pBuf->invalid || false == uvHandleReq(conn)) {
- tError("%s conn %p read invalid packet", transLabel(pTransInst), conn);
+ tError("%s conn %p read invalid packet, received from %s, local info:%s", transLabel(pTransInst), conn,
+ conn->dst, conn->src);
destroyConn(conn, true);
return;
}
}
return;
} else {
- tError("%s conn %p read invalid packet, exceed limit", transLabel(pTransInst), conn);
+ tError("%s conn %p read invalid packet, exceed limit, received from %s, local info:", transLabel(pTransInst),
+ conn, conn->dst, conn->src);
destroyConn(conn, true);
return;
}
@@ -649,7 +651,7 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) {
pObj->workerIdx = (pObj->workerIdx + 1) % pObj->numOfThreads;
- tTrace("new conntion accepted by main server, dispatch to %dth worker-thread", pObj->workerIdx);
+ tTrace("new connection accepted by main server, dispatch to %dth worker-thread", pObj->workerIdx);
uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb);
} else {
diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c
index 0983d344c1be9f03ca3010d75c78059e76ac8cb7..93ced912f8e2358c2aab6f04957ce060cf61c924 100644
--- a/source/libs/wal/src/walMeta.c
+++ b/source/libs/wal/src/walMeta.c
@@ -121,7 +121,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) {
if (found == NULL) {
// file corrupted, no complete log
// TODO delete and search in previous files
- ASSERT(0);
+ /*ASSERT(0);*/
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
return -1;
}
diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c
index dd61f7d22548a223bb33f01fb40b9dcd7423e5af..f9f42aa103d2b7ccbb95c60e5ae7e45c95e51699 100644
--- a/source/util/src/tcache.c
+++ b/source/util/src/tcache.c
@@ -702,7 +702,7 @@ void taosCacheCleanup(SCacheObj *pCacheObj) {
taosMsleep(50);
}
- uInfo("cache:%s will be cleaned up", pCacheObj->name);
+ uTrace("cache:%s will be cleaned up", pCacheObj->name);
doCleanupDataCache(pCacheObj);
}
diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c
index fe3065b2b78a46a85d6dc04b90fcff4e0fe80f03..7d7a14483a8bddb2e5a8770d62d34e3b6ae93bb8 100644
--- a/source/util/src/tcompare.c
+++ b/source/util/src/tcompare.c
@@ -186,15 +186,16 @@ int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight) {
int32_t len1 = varDataLen(pLeft);
int32_t len2 = varDataLen(pRight);
- if (len1 != len2) {
- return len1 > len2 ? 1 : -1;
- } else {
- int32_t ret = strncmp(varDataVal(pLeft), varDataVal(pRight), len1);
- if (ret == 0) {
+ int32_t minLen = TMIN(len1, len2);
+ int32_t ret = strncmp(varDataVal(pLeft), varDataVal(pRight), minLen);
+ if (ret == 0) {
+ if (len1 == len2) {
return 0;
} else {
- return ret > 0 ? 1 : -1;
+ return len1 > len2 ? 1 : -1;
}
+ } else {
+ return ret > 0 ? 1 : -1;
}
}
diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c
index e8f1f06ef10d6da3c2ae0c24b7626ccdc5b72aea..ba877915b13b6e522367637bd7713edc8feee0f3 100644
--- a/source/util/src/tcompression.c
+++ b/source/util/src/tcompression.c
@@ -83,8 +83,8 @@ int32_t tsCompressInit() {
if (lossyFloat == false && lossyDouble == false) return 0;
tdszInit(fPrecision, dPrecision, maxRange, curRange, Compressor);
- if (lossyFloat) uInfo("lossy compression float is opened. ");
- if (lossyDouble) uInfo("lossy compression double is opened. ");
+ if (lossyFloat) uTrace("lossy compression float is opened. ");
+ if (lossyDouble) uTrace("lossy compression double is opened. ");
return 1;
}
// exit call
diff --git a/source/util/src/thash.c b/source/util/src/thash.c
index aee84a0d55336c63840d1a5df887da7752592841..b69d8ea52866055668ce4937836c5eb46842f1c2 100644
--- a/source/util/src/thash.c
+++ b/source/util/src/thash.c
@@ -21,7 +21,7 @@
// the add ref count operation may trigger the warning if the reference count is greater than the MAX_WARNING_REF_COUNT
#define MAX_WARNING_REF_COUNT 10000
-#define HASH_MAX_CAPACITY (1024 * 1024 * 16)
+#define HASH_MAX_CAPACITY (1024 * 1024 * 1024)
#define HASH_DEFAULT_LOAD_FACTOR (0.75)
#define HASH_INDEX(v, c) ((v) & ((c)-1))
@@ -67,6 +67,7 @@ struct SHashObj {
bool enableUpdate; // enable update
SArray *pMemBlock; // memory block allocated for SHashEntry
_hash_before_fn_t callbackFp; // function invoked before return the value to caller
+ int64_t compTimes;
};
/*
@@ -146,6 +147,7 @@ static FORCE_INLINE SHashNode *doSearchInEntryList(SHashObj *pHashObj, SHashEntr
uint32_t hashVal) {
SHashNode *pNode = pe->next;
while (pNode) {
+ atomic_add_fetch_64(&pHashObj->compTimes, 1);
if ((pNode->keyLen == keyLen) && ((*(pHashObj->equalFp))(GET_HASH_NODE_KEY(pNode), key, keyLen) == 0) &&
pNode->removed == 0) {
assert(pNode->hashVal == hashVal);
@@ -250,11 +252,15 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
// the max slots is not defined by user
pHashObj->capacity = taosHashCapacity((int32_t)capacity);
+ pHashObj->size = 0;
pHashObj->equalFp = memcmp;
pHashObj->hashFp = fn;
pHashObj->type = type;
+ pHashObj->lock = 0;
pHashObj->enableUpdate = update;
+ pHashObj->freeFp = NULL;
+ pHashObj->callbackFp = NULL;
ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0);
@@ -327,7 +333,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
// disable resize
taosHashRLock(pHashObj);
- int32_t slot = HASH_INDEX(hashVal, pHashObj->capacity);
+ uint32_t slot = HASH_INDEX(hashVal, pHashObj->capacity);
SHashEntry *pe = pHashObj->hashList[slot];
taosHashEntryWLock(pHashObj, pe);
@@ -882,3 +888,7 @@ void *taosHashAcquire(SHashObj *pHashObj, const void *key, size_t keyLen) {
}
void taosHashRelease(SHashObj *pHashObj, void *p) { taosHashCancelIterate(pHashObj, p); }
+
+int64_t taosHashGetCompTimes(SHashObj *pHashObj) { return atomic_load_64(&pHashObj->compTimes); }
+
+
diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c
index 0e608d0da22da836f0a357c7bd4f9b194c11fd13..4d5532b9a639474507948f147fb93e43c2bb8230 100644
--- a/source/util/src/tpagedbuf.c
+++ b/source/util/src/tpagedbuf.c
@@ -33,7 +33,7 @@ struct SDiskbasedBuf {
int32_t pageSize; // current used page size
int32_t inMemPages; // numOfPages that are allocated in memory
SList* freePgList; // free page list
- SHashObj* groupSet; // id hash table, todo remove it
+ SArray* pIdList; // page id list
SHashObj* all;
SList* lruList;
void* emptyDummyIdList; // dummy id list
@@ -241,26 +241,7 @@ static int32_t loadPageFromDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) {
return 0;
}
-static SIDList addNewGroup(SDiskbasedBuf* pBuf, int32_t groupId) {
- assert(taosHashGet(pBuf->groupSet, (const char*)&groupId, sizeof(int32_t)) == NULL);
-
- SArray* pa = taosArrayInit(1, POINTER_BYTES);
- int32_t ret = taosHashPut(pBuf->groupSet, (const char*)&groupId, sizeof(int32_t), &pa, POINTER_BYTES);
- assert(ret == 0);
-
- return pa;
-}
-
-static SPageInfo* registerPage(SDiskbasedBuf* pBuf, int32_t groupId, int32_t pageId) {
- SIDList list = NULL;
-
- char** p = taosHashGet(pBuf->groupSet, (const char*)&groupId, sizeof(int32_t));
- if (p == NULL) { // it is a new group id
- list = addNewGroup(pBuf, groupId);
- } else {
- list = (SIDList)(*p);
- }
-
+static SPageInfo* registerPage(SDiskbasedBuf* pBuf, int32_t pageId) {
pBuf->numOfPages += 1;
SPageInfo* ppi = taosMemoryMalloc(sizeof(SPageInfo));
@@ -273,7 +254,7 @@ static SPageInfo* registerPage(SDiskbasedBuf* pBuf, int32_t groupId, int32_t pag
ppi->pn = NULL;
ppi->dirty = false;
- return *(SPageInfo**)taosArrayPush(list, &ppi);
+ return *(SPageInfo**)taosArrayPush(pBuf->pIdList, &ppi);
}
static SListNode* getEldestUnrefedPage(SDiskbasedBuf* pBuf) {
@@ -293,22 +274,13 @@ static SListNode* getEldestUnrefedPage(SDiskbasedBuf* pBuf) {
}
}
- // int32_t pos = listNEles(pBuf->lruList);
- // SListIter iter1 = {0};
- // tdListInitIter(pBuf->lruList, &iter1, TD_LIST_BACKWARD);
- // SListNode* pn1 = NULL;
- // while((pn1 = tdListNext(&iter1)) != NULL) {
- // SPageInfo* pageInfo = *(SPageInfo**) pn1->data;
- // printf("page %d is used, dirty:%d, pos:%d\n", pageInfo->pageId, pageInfo->dirty, pos - 1);
- // pos -= 1;
- // }
-
return pn;
}
static char* evacOneDataPage(SDiskbasedBuf* pBuf) {
char* bufPage = NULL;
SListNode* pn = getEldestUnrefedPage(pBuf);
+ terrno = 0;
// all pages are referenced by user, try to allocate new space
if (pn == NULL) {
@@ -332,6 +304,7 @@ static char* evacOneDataPage(SDiskbasedBuf* pBuf) {
bufPage = flushPageToDisk(pBuf, d);
}
+ ASSERT((bufPage != NULL) || terrno != TSDB_CODE_SUCCESS);
return bufPage;
}
@@ -380,7 +353,8 @@ int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMem
// init id hash table
_hash_fn_t fn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT);
- pPBuf->groupSet = taosHashInit(10, fn, true, false);
+ pPBuf->pIdList = taosArrayInit(4, POINTER_BYTES);
+
pPBuf->assistBuf = taosMemoryMalloc(pPBuf->pageSize + 2); // EXTRA BYTES
pPBuf->all = taosHashInit(10, fn, true, false);
@@ -423,7 +397,7 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t groupId, int32_t* pageId) {
*pageId = (++pBuf->allocateId);
// register page id info
- pi = registerPage(pBuf, groupId, *pageId);
+ pi = registerPage(pBuf, *pageId);
// add to hash map
taosHashPut(pBuf->all, pageId, sizeof(int32_t), &pi, POINTER_BYTES);
@@ -524,19 +498,11 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) {
pBuf->statis.releasePages += 1;
}
-size_t getNumOfBufGroupId(const SDiskbasedBuf* pBuf) { return taosHashGetSize(pBuf->groupSet); }
-
size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; }
-SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf, int32_t groupId) {
- assert(pBuf != NULL);
-
- char** p = taosHashGet(pBuf->groupSet, (const char*)&groupId, sizeof(int32_t));
- if (p == NULL) { // it is a new group id
- return pBuf->emptyDummyIdList;
- } else {
- return (SArray*)(*p);
- }
+SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf) {
+ ASSERT(pBuf != NULL);
+ return pBuf->pIdList;
}
void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
@@ -576,26 +542,21 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
taosRemoveFile(pBuf->path);
taosMemoryFreeClear(pBuf->path);
- SArray** p = taosHashIterate(pBuf->groupSet, NULL);
- while (p) {
- size_t n = taosArrayGetSize(*p);
- for (int32_t i = 0; i < n; ++i) {
- SPageInfo* pi = taosArrayGetP(*p, i);
- taosMemoryFreeClear(pi->pData);
- taosMemoryFreeClear(pi);
- }
-
- taosArrayDestroy(*p);
- p = taosHashIterate(pBuf->groupSet, p);
+ size_t n = taosArrayGetSize(pBuf->pIdList);
+ for (int32_t i = 0; i < n; ++i) {
+ SPageInfo* pi = taosArrayGetP(pBuf->pIdList, i);
+ taosMemoryFreeClear(pi->pData);
+ taosMemoryFreeClear(pi);
}
+ taosArrayDestroy(pBuf->pIdList);
+
tdListFree(pBuf->lruList);
tdListFree(pBuf->freePgList);
taosArrayDestroy(pBuf->emptyDummyIdList);
taosArrayDestroy(pBuf->pFree);
- taosHashCleanup(pBuf->groupSet);
taosHashCleanup(pBuf->all);
taosMemoryFreeClear(pBuf->id);
@@ -659,32 +620,32 @@ void dBufPrintStatis(const SDiskbasedBuf* pBuf) {
pBuf->totalBufSize / 1024.0, pBuf->numOfPages, listNEles(pBuf->lruList) * pBuf->pageSize / 1024.0,
listNEles(pBuf->lruList), pBuf->fileSize / 1024.0, pBuf->pageSize / 1024.0f, pBuf->id);
- printf(
- "Get/Release pages:%d/%d, flushToDisk:%.2f Kb (%d Pages), loadFromDisk:%.2f Kb (%d Pages), avgPageSize:%.2f Kb\n",
- ps->getPages, ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f, ps->loadPages,
- ps->loadBytes / (1024.0 * ps->loadPages));
+ if (ps->loadPages > 0) {
+ printf(
+ "Get/Release pages:%d/%d, flushToDisk:%.2f Kb (%d Pages), loadFromDisk:%.2f Kb (%d Pages), avgPageSize:%.2f Kb\n",
+ ps->getPages, ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f,
+ ps->loadPages, ps->loadBytes / (1024.0 * ps->loadPages));
+ } else {
+ printf("no page loaded\n");
+ }
}
void clearDiskbasedBuf(SDiskbasedBuf* pBuf) {
- SArray** p = taosHashIterate(pBuf->groupSet, NULL);
- while (p) {
- size_t n = taosArrayGetSize(*p);
- for (int32_t i = 0; i < n; ++i) {
- SPageInfo* pi = taosArrayGetP(*p, i);
- taosMemoryFreeClear(pi->pData);
- taosMemoryFreeClear(pi);
- }
- taosArrayDestroy(*p);
- p = taosHashIterate(pBuf->groupSet, p);
+ size_t n = taosArrayGetSize(pBuf->pIdList);
+ for (int32_t i = 0; i < n; ++i) {
+ SPageInfo* pi = taosArrayGetP(pBuf->pIdList, i);
+ taosMemoryFreeClear(pi->pData);
+ taosMemoryFreeClear(pi);
}
+ taosArrayClear(pBuf->pIdList);
+
tdListEmpty(pBuf->lruList);
tdListEmpty(pBuf->freePgList);
taosArrayClear(pBuf->emptyDummyIdList);
taosArrayClear(pBuf->pFree);
- taosHashClear(pBuf->groupSet);
taosHashClear(pBuf->all);
pBuf->numOfPages = 0; // all pages are in buffer in the first place
diff --git a/source/util/test/hashTest.cpp b/source/util/test/hashTest.cpp
index 99f5a761c5d0d3a489176749883da981c847011d..97e67ea36e7120b5e09f1097b5fb979b6fc12224 100644
--- a/source/util/test/hashTest.cpp
+++ b/source/util/test/hashTest.cpp
@@ -197,6 +197,201 @@ void acquireRleaseTest() {
taosMemoryFreeClear(data.p);
}
+void perfTest() {
+ SHashObj* hash1h = (SHashObj*) taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ SHashObj* hash1s = (SHashObj*) taosHashInit(1000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ SHashObj* hash10s = (SHashObj*) taosHashInit(10000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ SHashObj* hash100s = (SHashObj*) taosHashInit(100000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ SHashObj* hash1m = (SHashObj*) taosHashInit(1000000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ SHashObj* hash10m = (SHashObj*) taosHashInit(10000000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ SHashObj* hash100m = (SHashObj*) taosHashInit(100000000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+
+ char *name = (char*)taosMemoryCalloc(50000000, 9);
+ for (int64_t i = 0; i < 50000000; ++i) {
+ sprintf(name + i * 9, "t%08d", i);
+ }
+
+ for (int64_t i = 0; i < 50; ++i) {
+ taosHashPut(hash1h, name + i * 9, 9, &i, sizeof(i));
+ }
+
+ for (int64_t i = 0; i < 500; ++i) {
+ taosHashPut(hash1s, name + i * 9, 9, &i, sizeof(i));
+ }
+
+ for (int64_t i = 0; i < 5000; ++i) {
+ taosHashPut(hash10s, name + i * 9, 9, &i, sizeof(i));
+ }
+
+ for (int64_t i = 0; i < 50000; ++i) {
+ taosHashPut(hash100s, name + i * 9, 9, &i, sizeof(i));
+ }
+
+ for (int64_t i = 0; i < 500000; ++i) {
+ taosHashPut(hash1m, name + i * 9, 9, &i, sizeof(i));
+ }
+
+ for (int64_t i = 0; i < 5000000; ++i) {
+ taosHashPut(hash10m, name + i * 9, 9, &i, sizeof(i));
+ }
+
+ for (int64_t i = 0; i < 50000000; ++i) {
+ taosHashPut(hash100m, name + i * 9, 9, &i, sizeof(i));
+ }
+
+ int64_t start1h = taosGetTimestampMs();
+ int64_t start1hCt = taosHashGetCompTimes(hash1h);
+ for (int64_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(hash1h, name + (i % 50) * 9, 9));
+ }
+ int64_t end1h = taosGetTimestampMs();
+ int64_t end1hCt = taosHashGetCompTimes(hash1h);
+
+ int64_t start1s = taosGetTimestampMs();
+ int64_t start1sCt = taosHashGetCompTimes(hash1s);
+ for (int64_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(hash1s, name + (i % 500) * 9, 9));
+ }
+ int64_t end1s = taosGetTimestampMs();
+ int64_t end1sCt = taosHashGetCompTimes(hash1s);
+
+ int64_t start10s = taosGetTimestampMs();
+ int64_t start10sCt = taosHashGetCompTimes(hash10s);
+ for (int64_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(hash10s, name + (i % 5000) * 9, 9));
+ }
+ int64_t end10s = taosGetTimestampMs();
+ int64_t end10sCt = taosHashGetCompTimes(hash10s);
+
+ int64_t start100s = taosGetTimestampMs();
+ int64_t start100sCt = taosHashGetCompTimes(hash100s);
+ for (int64_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(hash100s, name + (i % 50000) * 9, 9));
+ }
+ int64_t end100s = taosGetTimestampMs();
+ int64_t end100sCt = taosHashGetCompTimes(hash100s);
+
+ int64_t start1m = taosGetTimestampMs();
+ int64_t start1mCt = taosHashGetCompTimes(hash1m);
+ for (int64_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(hash1m, name + (i % 500000) * 9, 9));
+ }
+ int64_t end1m = taosGetTimestampMs();
+ int64_t end1mCt = taosHashGetCompTimes(hash1m);
+
+ int64_t start10m = taosGetTimestampMs();
+ int64_t start10mCt = taosHashGetCompTimes(hash10m);
+ for (int64_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(hash10m, name + (i % 5000000) * 9, 9));
+ }
+ int64_t end10m = taosGetTimestampMs();
+ int64_t end10mCt = taosHashGetCompTimes(hash10m);
+
+ int64_t start100m = taosGetTimestampMs();
+ int64_t start100mCt = taosHashGetCompTimes(hash100m);
+ for (int64_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(hash100m, name + (i % 50000000) * 9, 9));
+ }
+ int64_t end100m = taosGetTimestampMs();
+ int64_t end100mCt = taosHashGetCompTimes(hash100m);
+
+
+ SArray *sArray[1000] = {0};
+ for (int64_t i = 0; i < 1000; ++i) {
+ sArray[i] = taosArrayInit(100000, 9);
+ }
+ int64_t cap = 4;
+ while (cap < 100000000) cap = (cap << 1u);
+
+ _hash_fn_t hashFp = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ int32_t slotR = cap / 1000 + 1;
+ for (int64_t i = 0; i < 10000000; ++i) {
+ char* p = name + (i % 50000000) * 9;
+ uint32_t v = (*hashFp)(p, 9);
+ taosArrayPush(sArray[(v%cap)/slotR], p);
+ }
+ SArray *slArray = taosArrayInit(100000000, 9);
+ for (int64_t i = 0; i < 1000; ++i) {
+ int32_t num = taosArrayGetSize(sArray[i]);
+ SArray* pArray = sArray[i];
+ for (int64_t m = 0; m < num; ++m) {
+ char* p = (char*)taosArrayGet(pArray, m);
+ ASSERT(taosArrayPush(slArray, p));
+ }
+ }
+ int64_t start100mS = taosGetTimestampMs();
+ int64_t start100mSCt = taosHashGetCompTimes(hash100m);
+ int32_t num = taosArrayGetSize(slArray);
+ for (int64_t i = 0; i < num; ++i) {
+ ASSERT(taosHashGet(hash100m, (char*)TARRAY_GET_ELEM(slArray, i), 9));
+ }
+ int64_t end100mS = taosGetTimestampMs();
+ int64_t end100mSCt = taosHashGetCompTimes(hash100m);
+ for (int64_t i = 0; i < 1000; ++i) {
+ taosArrayDestroy(sArray[i]);
+ }
+ taosArrayDestroy(slArray);
+
+ printf("1h \t %" PRId64 "ms,%" PRId64 "\n", end1h - start1h, end1hCt - start1hCt);
+ printf("1s \t %" PRId64 "ms,%" PRId64 "\n", end1s - start1s, end1sCt - start1sCt);
+ printf("10s \t %" PRId64 "ms,%" PRId64 "\n", end10s - start10s, end10sCt - start10sCt);
+ printf("100s \t %" PRId64 "ms,%" PRId64 "\n", end100s - start100s, end100sCt - start100sCt);
+ printf("1m \t %" PRId64 "ms,%" PRId64 "\n", end1m - start1m, end1mCt - start1mCt);
+ printf("10m \t %" PRId64 "ms,%" PRId64 "\n", end10m - start10m, end10mCt - start10mCt);
+ printf("100m \t %" PRId64 "ms,%" PRId64 "\n", end100m - start100m, end100mCt - start100mCt);
+ printf("100mS \t %" PRId64 "ms,%" PRId64 "\n", end100mS - start100mS, end100mSCt - start100mSCt);
+
+ taosHashCleanup(hash1h);
+ taosHashCleanup(hash1s);
+ taosHashCleanup(hash10s);
+ taosHashCleanup(hash100s);
+ taosHashCleanup(hash1m);
+ taosHashCleanup(hash10m);
+ taosHashCleanup(hash100m);
+
+ SHashObj *mhash[1000] = {0};
+ for (int64_t i = 0; i < 1000; ++i) {
+ mhash[i] = (SHashObj*) taosHashInit(100000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ }
+
+ for (int64_t i = 0; i < 50000000; ++i) {
+#if 0
+ taosHashPut(mhash[i%1000], name + i * 9, 9, &i, sizeof(i));
+#else
+ taosHashPut(mhash[i/50000], name + i * 9, 9, &i, sizeof(i));
+#endif
+ }
+
+ int64_t startMhashCt = 0;
+ for (int64_t i = 0; i < 1000; ++i) {
+ startMhashCt += taosHashGetCompTimes(mhash[i]);
+ }
+
+ int64_t startMhash = taosGetTimestampMs();
+#if 0
+ for (int32_t i = 0; i < 10000000; ++i) {
+ ASSERT(taosHashGet(mhash[i%1000], name + i * 9, 9));
+ }
+#else
+// for (int64_t i = 0; i < 10000000; ++i) {
+ for (int64_t i = 0; i < 50000000; i+=5) {
+ ASSERT(taosHashGet(mhash[i/50000], name + i * 9, 9));
+ }
+#endif
+ int64_t endMhash = taosGetTimestampMs();
+ int64_t endMhashCt = 0;
+ for (int64_t i = 0; i < 1000; ++i) {
+ printf(" %" PRId64 , taosHashGetCompTimes(mhash[i]));
+ endMhashCt += taosHashGetCompTimes(mhash[i]);
+ }
+ printf("\n100m \t %" PRId64 "ms,%" PRId64 "\n", endMhash - startMhash, endMhashCt - startMhashCt);
+
+ for (int64_t i = 0; i < 1000; ++i) {
+ taosHashCleanup(mhash[i]);
+ }
+}
+
+
}
int main(int argc, char** argv) {
@@ -210,4 +405,5 @@ TEST(testCase, hashTest) {
noLockPerformanceTest();
multithreadsTest();
acquireRleaseTest();
+ //perfTest();
}
diff --git a/tests/docs-examples-test/jdbc.sh b/tests/docs-examples-test/jdbc.sh
new file mode 100644
index 0000000000000000000000000000000000000000..d71085a40306956ea8d25e9b575c97ae9945df76
--- /dev/null
+++ b/tests/docs-examples-test/jdbc.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+pgrep taosd || taosd >> /dev/null 2>&1 &
+pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
+cd ../../docs/examples/java
+
+mvn clean test > jdbc-out.log 2>&1
+tail -n 20 jdbc-out.log
+
+cases=`grep 'Tests run' jdbc-out.log | awk 'END{print $3}'`
+totalJDBCCases=`echo ${cases/%,}`
+failed=`grep 'Tests run' jdbc-out.log | awk 'END{print $5}'`
+JDBCFailed=`echo ${failed/%,}`
+error=`grep 'Tests run' jdbc-out.log | awk 'END{print $7}'`
+JDBCError=`echo ${error/%,}`
+
+totalJDBCFailed=`expr $JDBCFailed + $JDBCError`
+totalJDBCSuccess=`expr $totalJDBCCases - $totalJDBCFailed`
+
+if [ "$totalJDBCSuccess" -gt "0" ]; then
+ echo -e "\n${GREEN} ### Total $totalJDBCSuccess JDBC case(s) succeed! ### ${NC}"
+fi
+
+if [ "$totalJDBCFailed" -ne "0" ]; then
+ echo -e "\n${RED} ### Total $totalJDBCFailed JDBC case(s) failed! ### ${NC}"
+ exit 8
+fi
\ No newline at end of file
diff --git a/tests/script/tmp/monitor.sim b/tests/script/tmp/monitor.sim
index 8eb787e95035a106e0c1141a9f8d0de6584c26c3..b410e1b6ad99e8bd83dcf7dd3cf0f3c4961d0ad4 100644
--- a/tests/script/tmp/monitor.sim
+++ b/tests/script/tmp/monitor.sim
@@ -4,6 +4,7 @@ system sh/cfg.sh -n dnode1 -c monitorfqdn -v localhost
system sh/cfg.sh -n dnode1 -c monitorport -v 80
system sh/cfg.sh -n dnode1 -c monitorInterval -v 1
system sh/cfg.sh -n dnode1 -c monitorComp -v 1
+system sh/cfg.sh -n dnode1 -c uptimeInterval -v 3
#system sh/cfg.sh -n dnode1 -c supportVnodes -v 128
#system sh/cfg.sh -n dnode1 -c telemetryReporting -v 1
@@ -14,13 +15,13 @@ system sh/cfg.sh -n dnode1 -c monitorComp -v 1
system sh/exec.sh -n dnode1 -s start
sql connect
-print =============== select * from information_schema.ins_dnodes
+print =============== create database
sql create database db vgroups 2;
sql use db;
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd";
print =============== create drop qnode 1
sql create qnode on dnode 1
-sql create snode on dnode 1
-sql create bnode on dnode 1
+#sql create snode on dnode 1
+#sql create bnode on dnode 1
diff --git a/tests/script/tsim/db/basic2.sim b/tests/script/tsim/db/basic2.sim
index b7ac0b5edd8663f653cc9216bceb1eee6054331e..4f0ba4a13c18f29a758a92318c2a66c133fd28f3 100644
--- a/tests/script/tsim/db/basic2.sim
+++ b/tests/script/tsim/db/basic2.sim
@@ -4,7 +4,7 @@ system sh/exec.sh -n dnode1 -s start
sql connect
print =============== conflict stb
-sql create database db vgroups 1;
+sql create database db vgroups 4;
sql use db;
sql create table stb (ts timestamp, i int) tags (j int);
sql_error create table stb using stb tags (1);
@@ -16,6 +16,9 @@ sql_error create table ctb (ts timestamp, i int) tags (j int);
sql create table ntb (ts timestamp, i int);
sql_error create table ntb (ts timestamp, i int) tags (j int);
+sql drop table ntb
+sql create table ntb (ts timestamp, i int) tags (j int);
+
sql drop database db
print =============== create database d1
diff --git a/tests/script/tsim/parser/alter1.sim b/tests/script/tsim/parser/alter1.sim
index 9d0049e45e5437d9d6de814b744d8fce3ccd876e..369419dcd9cd91688f39c27dbd54c33ee0699ae8 100644
--- a/tests/script/tsim/parser/alter1.sim
+++ b/tests/script/tsim/parser/alter1.sim
@@ -130,4 +130,4 @@ endi
# return -1
#endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/binary_escapeCharacter.sim b/tests/script/tsim/parser/binary_escapeCharacter.sim
index 0b437d8b04a39a400b25368263f88c2b846c155a..5a9c0e7bb1d2b141639a1408ffcc4ae064dd78f8 100644
--- a/tests/script/tsim/parser/binary_escapeCharacter.sim
+++ b/tests/script/tsim/parser/binary_escapeCharacter.sim
@@ -101,4 +101,4 @@ sql_error insert into tb values(now, '\');
#sql_error insert into tb values(now, '\\\n');
sql insert into tb values(now, '\n');
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/col_arithmetic_operation.sim b/tests/script/tsim/parser/col_arithmetic_operation.sim
index f22beefdf88c3d90bff8554cc44b5768bfef3d1e..9a2ba34c85e552585770bb42913b8c83ddd58131 100644
--- a/tests/script/tsim/parser/col_arithmetic_operation.sim
+++ b/tests/script/tsim/parser/col_arithmetic_operation.sim
@@ -132,4 +132,4 @@ sql_error select max(c1-c2) from $tb
print =====================> td-1764
sql select sum(c1)/count(*), sum(c1) as b, count(*) as b from $stb interval(1y)
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/columnValue_unsign.sim b/tests/script/tsim/parser/columnValue_unsign.sim
index 85ff490bf4e520cdbbc0ed0008499af4425b2b93..7ae1b20eca18236c71277ae2c94a0976181a271a 100644
--- a/tests/script/tsim/parser/columnValue_unsign.sim
+++ b/tests/script/tsim/parser/columnValue_unsign.sim
@@ -129,4 +129,4 @@ if $rows != 1 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/fill_stb.sim b/tests/script/tsim/parser/fill_stb.sim
index 656b1ac94e8e0954e98b1d10692afc5d696bfd64..6c61631aa8b3a682b75317943ddeb3642720f588 100644
--- a/tests/script/tsim/parser/fill_stb.sim
+++ b/tests/script/tsim/parser/fill_stb.sim
@@ -279,7 +279,7 @@ endi
#endi
## linear fill
-sql select _wstart, max(c1), min(c2), avg(c3), sum(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(linear)
+sql select _wstart, max(c1), min(c2), avg(c3), sum(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 interval(5m) fill(linear)
$val = $rowNum * 2
$val = $val - 1
$val = $val * $tbNum
diff --git a/tests/script/tsim/parser/groupby.sim b/tests/script/tsim/parser/groupby.sim
index 12a698b1ccb2273d10c1831948103ab88f494d54..4ee9c530a79c72ccac12a99922af1eeefc7485ed 100644
--- a/tests/script/tsim/parser/groupby.sim
+++ b/tests/script/tsim/parser/groupby.sim
@@ -557,7 +557,7 @@ if $data10 != @{slop:0.000000, intercept:1.000000}@ then
return -1
endi
-if $data90 != @{slop:0.000000, intercept:9.000000}@ then
+if $data90 != @{slop:0.000000, intercept:17.000000}@ then
return -1
endi
diff --git a/tests/script/tsim/parser/import_file.sim b/tests/script/tsim/parser/import_file.sim
index e031e0249dd5a3b9efec7b9fed2505671f645e2c..37dc0c447623a8ea54f8d0e7228e38749e7a41be 100644
--- a/tests/script/tsim/parser/import_file.sim
+++ b/tests/script/tsim/parser/import_file.sim
@@ -69,4 +69,4 @@ endi
system rm -f $inFileName
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/repeatAlter.sim b/tests/script/tsim/parser/repeatAlter.sim
index d28a03e193a031ee95b5d237481de8ed31651877..b4012048cc314682e6bdb971a8e4a97fb1c2ca65 100644
--- a/tests/script/tsim/parser/repeatAlter.sim
+++ b/tests/script/tsim/parser/repeatAlter.sim
@@ -6,4 +6,4 @@ while $i <= $loops
$i = $i + 1
endw
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/select_from_cache_disk.sim b/tests/script/tsim/parser/select_from_cache_disk.sim
index 0983e36a3a579f88bdb429e9ad62a67c4fe6823b..3c0b13c6388c2386da011b2576262b65a6f018d5 100644
--- a/tests/script/tsim/parser/select_from_cache_disk.sim
+++ b/tests/script/tsim/parser/select_from_cache_disk.sim
@@ -60,4 +60,4 @@ if $data12 != 1 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/single_row_in_tb.sim b/tests/script/tsim/parser/single_row_in_tb.sim
index 1bd53ad24ef17c89bf5bfd1ddec9ed78b969cf9a..e7b4c9a871b4d8409a8a1624ff83b71fb77a77c2 100644
--- a/tests/script/tsim/parser/single_row_in_tb.sim
+++ b/tests/script/tsim/parser/single_row_in_tb.sim
@@ -33,4 +33,4 @@ print ================== server restart completed
run tsim/parser/single_row_in_tb_query.sim
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/single_row_in_tb_query.sim b/tests/script/tsim/parser/single_row_in_tb_query.sim
index 422756b798cbeb1b3e70d14d952457df0e54a202..37e193f9d202c0f94748342f3a67e1565e8490d3 100644
--- a/tests/script/tsim/parser/single_row_in_tb_query.sim
+++ b/tests/script/tsim/parser/single_row_in_tb_query.sim
@@ -195,4 +195,4 @@ endi
print ===============>safty check TD-4927
sql select first(ts, c1) from sr_stb where ts<1 group by t1;
-sql select first(ts, c1) from sr_stb where ts>0 and ts<1;
\ No newline at end of file
+sql select first(ts, c1) from sr_stb where ts>0 and ts<1;
diff --git a/tests/script/tsim/query/complex_group.sim b/tests/script/tsim/query/complex_group.sim
index 3dad8059cd148504118d56a63f60b25247dc0fb6..d7d14c0ee82b3e10e06f509b4e6a7821be9c901f 100644
--- a/tests/script/tsim/query/complex_group.sim
+++ b/tests/script/tsim/query/complex_group.sim
@@ -454,4 +454,4 @@ if $rows != 1 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/complex_having.sim b/tests/script/tsim/query/complex_having.sim
index 9e28c3803e373e1d973b34c39573b4a7ec4f13f3..4c0af6d10c2d796638be619c6092618217b01257 100644
--- a/tests/script/tsim/query/complex_having.sim
+++ b/tests/script/tsim/query/complex_having.sim
@@ -365,4 +365,4 @@ if $rows != 1 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/complex_limit.sim b/tests/script/tsim/query/complex_limit.sim
index 2a90e7ff1d1f1a4ba25f79a94339219f3d4f5683..acb133f6504f8076161476cfcf6b8f73493157fc 100644
--- a/tests/script/tsim/query/complex_limit.sim
+++ b/tests/script/tsim/query/complex_limit.sim
@@ -508,4 +508,4 @@ if $rows != 1 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/complex_select.sim b/tests/script/tsim/query/complex_select.sim
index f4c9877bfd4c32622238cf21eafac8c35aaafa19..b7697e5cab0e654a40dd16f55f57cfbba4c5653e 100644
--- a/tests/script/tsim/query/complex_select.sim
+++ b/tests/script/tsim/query/complex_select.sim
@@ -558,4 +558,4 @@ if $data00 != 33 then
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/complex_where.sim b/tests/script/tsim/query/complex_where.sim
index bda1c036f02ded7953f8049a46318479b5feb106..847f67ed3461a88c16e1697386f8ee0d6f91d438 100644
--- a/tests/script/tsim/query/complex_where.sim
+++ b/tests/script/tsim/query/complex_where.sim
@@ -669,4 +669,4 @@ if $rows != 1 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/crash_sql.sim b/tests/script/tsim/query/crash_sql.sim
index 1d20491869db719c84065fb6a765268c7366c80b..79a9165e6602b1e8b1931e0f3ad9bf7d0168450f 100644
--- a/tests/script/tsim/query/crash_sql.sim
+++ b/tests/script/tsim/query/crash_sql.sim
@@ -76,7 +76,7 @@ sql insert into ct4 values ( '2022-05-21 01:01:01.000', NULL, NULL, NULL, NULL,
print ================ start query ======================
-print ================ SQL used to cause taosd or taos shell crash
+print ================ SQL used to cause taosd or TDengine CLI crash
sql_error select sum(c1) ,count(c1) from ct4 group by c1 having sum(c10) between 0 and 1 ;
-#system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+#system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/diff.sim b/tests/script/tsim/query/diff.sim
index f0d82b01e92bdffc06f951a5d3911ae4338037d9..badd139a9f7b25aa4192e3f97b0cefe825efc597 100644
--- a/tests/script/tsim/query/diff.sim
+++ b/tests/script/tsim/query/diff.sim
@@ -25,17 +25,17 @@ $i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
-
+
$x = 0
while $x < $rowNum
$cc = $x * 60000
$ms = 1601481600000 + $cc
- sql insert into $tb values ($ms , $x )
+ sql insert into $tb values ($ms , $x )
$x = $x + 1
- endw
-
+ endw
+
$i = $i + 1
-endw
+endw
sleep 100
@@ -61,7 +61,7 @@ sql select _rowts, diff(tbcol) from $tb where ts > $ms
print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
-if $data11 != 1 then
+if $data11 != 1 then
return -1
endi
@@ -72,7 +72,7 @@ sql select _rowts, diff(tbcol) from $tb where ts <= $ms
print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
-if $data11 != 1 then
+if $data11 != 1 then
return -1
endi
@@ -82,7 +82,7 @@ sql select _rowts, diff(tbcol) as b from $tb
print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
-if $data11 != 1 then
+if $data11 != 1 then
return -1
endi
@@ -107,4 +107,4 @@ if $rows != 2 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/explain.sim b/tests/script/tsim/query/explain.sim
index 30a857815ceea75b399c1cf37c351ff80e37189d..2871252d91b822e02911931bf2c8a848472a5e9d 100644
--- a/tests/script/tsim/query/explain.sim
+++ b/tests/script/tsim/query/explain.sim
@@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
-print ======== step1
+print ======== step1
sql create database db1 vgroups 3;
sql use db1;
sql select * from information_schema.ins_databases;
@@ -30,7 +30,7 @@ sql insert into tb4 values (now, 4, "Bitmap Heap Scan on tenk1 t1 (cost=5.07..2
#sql insert into tb4 values (now, 4, "Bitmap Heap Scan on tenk1 t1 (cost=5.07..229.20 rows=101 width=244) (actual time=0.080..0.526 rows=100 loops=1)");
-print ======== step2
+print ======== step2
sql explain select * from st1 where -2;
sql explain select ts from tb1;
sql explain select * from st1;
@@ -41,14 +41,14 @@ sql explain select count(*),sum(f1) from st1;
sql explain select count(*),sum(f1) from st1 group by f1;
#sql explain select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
-print ======== step3
+print ======== step3
sql explain verbose true select * from st1 where -2;
sql explain verbose true select ts from tb1 where f1 > 0;
sql explain verbose true select * from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00';
sql explain verbose true select count(*) from st1 partition by tbname slimit 1 soffset 2 limit 2 offset 1;
sql explain verbose true select * from information_schema.ins_stables where db_name='db2';
-print ======== step4
+print ======== step4
sql explain analyze select ts from st1 where -2;
sql explain analyze select ts from tb1;
sql explain analyze select ts from st1;
@@ -59,7 +59,7 @@ sql explain analyze select count(*),sum(f1) from tb1;
sql explain analyze select count(*),sum(f1) from st1;
sql explain analyze select count(*),sum(f1) from st1 group by f1;
-print ======== step5
+print ======== step5
sql explain analyze verbose true select ts from st1 where -2;
sql explain analyze verbose true select ts from tb1;
sql explain analyze verbose true select ts from st1;
@@ -87,12 +87,12 @@ sql explain analyze verbose true select count(f1) from st1 group by tbname;
#sql explain select * from tb1, tb2 where tb1.ts=tb2.ts;
#sql explain select * from st1, st2 where tb1.ts=tb2.ts;
#sql explain analyze verbose true select sum(a+b) from (select _rowts, min(f1) b,count(*) a from st1 where f1 > 0 interval(1a)) where a < 0 interval(1s);
-#sql explain select min(f1) from st1 interval(1m, 2a) sliding(30s);
+#sql explain select min(f1) from st1 interval(1m, 2a) sliding(30s);
#sql explain verbose true select count(*),sum(f1) from st1 where f1 > 0 and ts > '2021-10-31 00:00:00' group by f1 having sum(f1) > 0;
-#sql explain analyze select min(f1) from st1 interval(3m, 2a) sliding(1m);
+#sql explain analyze select min(f1) from st1 interval(3m, 2a) sliding(1m);
#sql explain analyze select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
#sql explain analyze verbose true select count(*),sum(f1) from st1 where f1 > 0 and ts > '2021-10-31 00:00:00' group by f1 having sum(f1) > 0;
-#sql explain analyze verbose true select min(f1) from st1 interval(3m, 2a) sliding(1m);
+#sql explain analyze verbose true select min(f1) from st1 interval(3m, 2a) sliding(1m);
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/interval.sim b/tests/script/tsim/query/interval.sim
index cc8a73daec1ad54fb1448480b0efd317bbd09be9..833da4a8ba2b3daf495167f06c99d222564a6bf3 100644
--- a/tests/script/tsim/query/interval.sim
+++ b/tests/script/tsim/query/interval.sim
@@ -177,4 +177,4 @@ print =============== clear
# return -1
#endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/scalarFunction.sim b/tests/script/tsim/query/scalarFunction.sim
index 103e66e54e674c10e3fbe3bd88e044ffe7d0041d..1b8115fec635832116f722ce1fb22810d817a0b7 100644
--- a/tests/script/tsim/query/scalarFunction.sim
+++ b/tests/script/tsim/query/scalarFunction.sim
@@ -33,7 +33,7 @@ print =============== create normal table
sql create table ntb (ts timestamp, c1 int, c2 float, c3 double)
sql show tables
-if $rows != 101 then
+if $rows != 101 then
return -1
endi
@@ -444,7 +444,7 @@ if $loop_test == 0 then
print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
-
+
$loop_cnt = 0
check_dnode_ready_0:
$loop_cnt = $loop_cnt + 1
@@ -462,7 +462,7 @@ if $loop_test == 0 then
goto check_dnode_ready_0
endi
- $loop_test = 1
+ $loop_test = 1
goto loop_test_pos
endi
diff --git a/tests/script/tsim/query/scalarNull.sim b/tests/script/tsim/query/scalarNull.sim
index ec95c94f23c12babb06b25b06ce140c9a4a5368a..6abe3d62d9b1aaf88872054c5bd040098400debb 100644
--- a/tests/script/tsim/query/scalarNull.sim
+++ b/tests/script/tsim/query/scalarNull.sim
@@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
-print ======== step1
+print ======== step1
sql create database db1 vgroups 3;
sql use db1;
sql select * from information_schema.ins_databases;
diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim
index 158448d76537947d1f6a0fb8d9569becc33fcdd8..b6eb4ed3aa2aae6873eed4fb0c8056c95ebe6bb6 100644
--- a/tests/script/tsim/query/session.sim
+++ b/tests/script/tsim/query/session.sim
@@ -35,8 +35,8 @@ sql INSERT INTO dev_001 VALUES('2020-05-13 13:00:00.001', 12)
sql INSERT INTO dev_001 VALUES('2020-05-14 13:00:00.001', 13)
sql INSERT INTO dev_001 VALUES('2020-05-15 14:00:00.000', 14)
sql INSERT INTO dev_001 VALUES('2020-05-20 10:00:00.000', 15)
-sql INSERT INTO dev_001 VALUES('2020-05-27 10:00:00.001', 16)
-
+sql INSERT INTO dev_001 VALUES('2020-05-27 10:00:00.001', 16)
+
sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.000', 1)
sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.005', 2)
sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.009', 3)
@@ -46,7 +46,7 @@ sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.036', 6)
sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.51', 7)
# vnode does not return the precision of the table
-print ====> create database d1 precision 'us'
+print ====> create database d1 precision 'us'
sql create database d1 precision 'us'
sql use d1
sql create table dev_001 (ts timestamp ,i timestamp ,j int)
@@ -54,7 +54,7 @@ sql insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2
sql create table secondts(ts timestamp,t2 timestamp,i int)
sql insert into secondts values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4)
-$loop_test = 0
+$loop_test = 0
loop_test_pos:
sql use $dbNamme
@@ -299,7 +299,7 @@ if $loop_test == 0 then
print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
-
+
$loop_cnt = 0
check_dnode_ready_0:
$loop_cnt = $loop_cnt + 1
@@ -317,7 +317,7 @@ if $loop_test == 0 then
goto check_dnode_ready_0
endi
- $loop_test = 1
+ $loop_test = 1
goto loop_test_pos
endi
diff --git a/tests/script/tsim/query/stddev.sim b/tests/script/tsim/query/stddev.sim
index d61c7273e19ebee84cd0117a9faf163c3a854005..b45c7d80a3edd8319f199e07fd607ab4f474df23 100644
--- a/tests/script/tsim/query/stddev.sim
+++ b/tests/script/tsim/query/stddev.sim
@@ -409,4 +409,4 @@ if $rows != 2 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/time_process.sim b/tests/script/tsim/query/time_process.sim
index b3c0e9561f149445a7ae75036736bbf6f8eaf4a4..83a64458465d6d978a38a206b2a7b223cb2bf45d 100644
--- a/tests/script/tsim/query/time_process.sim
+++ b/tests/script/tsim/query/time_process.sim
@@ -111,4 +111,4 @@ if $rows != 2 then
return -1
endi
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/udf.sim b/tests/script/tsim/query/udf.sim
index 7cc1403bcb215547209b1c41dcf0351f9fc80bfd..7f8b1044ef528a3a771946f878167b1123ddd9db 100644
--- a/tests/script/tsim/query/udf.sim
+++ b/tests/script/tsim/query/udf.sim
@@ -9,7 +9,7 @@ system sh/cfg.sh -n dnode1 -c udf -v 1
system sh/exec.sh -n dnode1 -s start
sql connect
-print ======== step1 udf
+print ======== step1 udf
system sh/compile_udf.sh
sql create database udf vgroups 3;
sql use udf;
diff --git a/tests/script/tsim/user/privilege_sysinfo.sim b/tests/script/tsim/user/privilege_sysinfo.sim
index 25c1a84db699a8cdef5678abaf728f4a93690bde..e8348d92d43ede9c594ffa8487e22f27a95de503 100644
--- a/tests/script/tsim/user/privilege_sysinfo.sim
+++ b/tests/script/tsim/user/privilege_sysinfo.sim
@@ -8,7 +8,20 @@ sql create user sysinfo0 pass 'taosdata'
sql create user sysinfo1 pass 'taosdata'
sql alter user sysinfo0 sysinfo 0
sql alter user sysinfo1 sysinfo 1
+
sql create database db
+sql use db
+sql create table db.stb (ts timestamp, i int) tags (t int)
+sql create table db.ctb using db.stb tags (1)
+sql create table db.ntb (ts timestamp, i int)
+sql insert into db.ctb values (now, 1);
+sql insert into db.ntb values (now, 1);
+sql select * from db.stb
+sql select * from db.ctb
+sql select * from db.ntb
+
+sql create database d2
+sql GRANT all ON d2.* to sysinfo0;
print user sysinfo0 login
sql close
@@ -17,11 +30,31 @@ sql connect sysinfo0
print =============== check oper
sql_error create user u1 pass 'u1'
sql_error drop user sysinfo1
-sql_error alter user sysinfo1 pass '1'
sql_error alter user sysinfo0 pass '1'
+sql_error alter user sysinfo0 enable 0
+sql_error alter user sysinfo0 enable 1
+sql_error alter user sysinfo1 pass '1'
+sql_error alter user sysinfo1 enable 1
+sql_error alter user sysinfo1 enable 1
+sql_error GRANT read ON db.* to sysinfo0;
+sql_error GRANT read ON *.* to sysinfo0;
+sql_error REVOKE read ON db.* from sysinfo0;
+sql_error REVOKE read ON *.* from sysinfo0;
+sql_error GRANT write ON db.* to sysinfo0;
+sql_error GRANT write ON *.* to sysinfo0;
+sql_error REVOKE write ON db.* from sysinfo0;
+sql_error REVOKE write ON *.* from sysinfo0;
+sql_error REVOKE write ON *.* from sysinfo0;
sql_error create dnode $hostname port 7200
sql_error drop dnode 1
+sql_error alter dnode 1 'debugFlag 135'
+sql_error alter dnode 1 'dDebugFlag 131'
+sql_error alter dnode 1 'resetlog'
+sql_error alter dnode 1 'monitor' '1'
+sql_error alter dnode 1 'monitor' '0'
+sql_error alter dnode 1 'monitor 1'
+sql_error alter dnode 1 'monitor 0'
sql_error create qnode on dnode 1
sql_error drop qnode on dnode 1
@@ -44,20 +77,106 @@ sql_error create database d1
sql_error drop database db
sql_error use db
sql_error alter database db replica 1;
+sql_error alter database db keep 21
sql_error show db.vgroups
-sql select * from information_schema.ins_stables where db_name = 'db'
-sql select * from information_schema.ins_tables where db_name = 'db'
+
+sql_error create table db.stb1 (ts timestamp, i int) tags (t int)
+sql_error create table db.ctb1 using db.stb1 tags (1)
+sql_error create table db.ntb1 (ts timestamp, i int)
+sql_error insert into db.ctb values (now, 1);
+sql_error insert into db.ntb values (now, 1);
+sql_error select * from db.stb
+sql_error select * from db.ctb
+sql_error select * from db.ntb
+
+sql use d2
+sql create table d2.stb2 (ts timestamp, i int) tags (t int)
+sql create table d2.ctb2 using d2.stb2 tags (1)
+sql create table d2.ntb2 (ts timestamp, i int)
+sql insert into d2.ctb2 values (now, 1);
+sql insert into d2.ntb2 values (now, 1);
+sql select * from d2.stb2
+sql select * from d2.ctb2
+sql select * from d2.ntb2
print =============== check show
-sql select * from information_schema.ins_users
+sql_error show users
sql_error show cluster
-sql select * from information_schema.ins_dnodes
-sql select * from information_schema.ins_mnodes
+sql_error select * from information_schema.ins_dnodes
+sql_error select * from information_schema.ins_mnodes
sql_error show snodes
-sql select * from information_schema.ins_qnodes
+sql_error select * from information_schema.ins_qnodes
+sql_error show dnodes
+sql_error show snodes
+sql_error show qnodes
+sql_error show mnodes
sql_error show bnodes
+sql_error show db.vgroups
+sql_error show db.stables
+sql_error show db.tables
+sql_error show indexes from stb from db
+sql show databases
+sql_error show d2.vgroups
+sql show d2.stables
+sql show d2.tables
+sql show indexes from stb2 from d2
+#sql_error show create database db
+sql_error show create table db.stb;
+sql_error show create table db.ctb;
+sql_error show create table db.ntb;
+sql show streams
+sql show consumers
+sql show topics
+sql show subscriptions
+sql show functions
sql_error show grants
+sql show queries
+sql show connections
+sql show apps
+sql show transactions
+sql_error show create database d2
+sql show create table d2.stb2;
+sql show create table d2.ctb2;
+sql show create table d2.ntb2;
+sql_error show variables;
+sql show local variables;
sql_error show dnode 1 variables;
-sql show variables;
+sql_error show variables;
+
+
+print =============== check information_schema
+sql show databases
+if $rows != 3 then
+ return -1
+endi
+
+sql use information_schema;
+sql_error select * from information_schema.ins_dnodes
+sql_error select * from information_schema.ins_mnodes
+sql_error select * from information_schema.ins_modules
+sql_error select * from information_schema.ins_qnodes
+sql_error select * from information_schema.ins_cluster
+sql select * from information_schema.ins_databases
+sql select * from information_schema.ins_functions
+sql select * from information_schema.ins_indexes
+sql select * from information_schema.ins_stables
+sql select * from information_schema.ins_tables
+sql select * from information_schema.ins_tags
+sql select * from information_schema.ins_users
+sql_error select * from information_schema.ins_grants
+sql_error select * from information_schema.ins_vgroups
+sql_error select * from information_schema.ins_configs
+sql_error select * from information_schema.ins_dnode_variables
+
+print =============== check performance_schema
+sql use performance_schema;
+sql select * from performance_schema.perf_connections
+sql select * from performance_schema.perf_queries
+sql select * from performance_schema.perf_topics
+sql select * from performance_schema.perf_consumers
+sql select * from performance_schema.perf_subscriptions
+sql select * from performance_schema.perf_trans
+sql select * from performance_schema.perf_streams
+sql select * from performance_schema.perf_apps
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
+#system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py
index 934ba9e161c8787dc36cfdafc15044eb9e0ec425..5550519e05249de13d1267dd2a8f5bc1b10fae6d 100644
--- a/tests/system-test/2-query/interp.py
+++ b/tests/system-test/2-query/interp.py
@@ -551,7 +551,57 @@ class TDTestCase:
tdSql.checkData(0, 0, 15)
tdSql.checkData(1, 0, 15)
- tdLog.printNoPrefix("==========step9:test error cases")
+ tdLog.printNoPrefix("==========step9:test multi-interp cases")
+ tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(null)")
+ tdSql.checkRows(5)
+ tdSql.checkCols(4)
+
+ for i in range (tdSql.queryCols):
+ tdSql.checkData(0, i, None)
+ tdSql.checkData(1, i, None)
+ tdSql.checkData(2, i, 15)
+ tdSql.checkData(3, i, None)
+ tdSql.checkData(4, i, None)
+
+ tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(value, 1)")
+ tdSql.checkRows(5)
+ tdSql.checkCols(4)
+
+ for i in range (tdSql.queryCols):
+ tdSql.checkData(0, i, 1)
+ tdSql.checkData(1, i, 1)
+ tdSql.checkData(2, i, 15)
+ tdSql.checkData(3, i, 1)
+ tdSql.checkData(4, i, 1)
+
+ tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(prev)")
+ tdSql.checkRows(5)
+ tdSql.checkCols(4)
+
+ for i in range (tdSql.queryCols):
+ tdSql.checkData(0, i, 5)
+ tdSql.checkData(1, i, 5)
+ tdSql.checkData(2, i, 15)
+ tdSql.checkData(3, i, 15)
+ tdSql.checkData(4, i, 15)
+
+ tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(next)")
+ tdSql.checkRows(3)
+ tdSql.checkCols(4)
+
+ for i in range (tdSql.queryCols):
+ tdSql.checkData(0, i, 15)
+ tdSql.checkData(1, i, 15)
+ tdSql.checkData(2, i, 15)
+
+ tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(linear)")
+ tdSql.checkRows(1)
+ tdSql.checkCols(4)
+
+ for i in range (tdSql.queryCols):
+ tdSql.checkData(0, i, 15)
+
+ tdLog.printNoPrefix("==========step10:test error cases")
tdSql.error(f"select interp(c0) from {dbname}.{tbname}")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05')")
diff --git a/tests/system-test/2-query/json_tag.py b/tests/system-test/2-query/json_tag.py
index 856d7647477f8693e0f20f6950e1ab810c47b4d4..d9715579aed4878c1cf17642824718d412a77511 100644
--- a/tests/system-test/2-query/json_tag.py
+++ b/tests/system-test/2-query/json_tag.py
@@ -338,7 +338,7 @@ class TDTestCase:
tdSql.query(f"select * from {dbname}.jsons1 where jtag->'tag1' between 1 and 30")
tdSql.checkRows(3)
tdSql.query(f"select * from {dbname}.jsons1 where jtag->'tag1' between 'femail' and 'beijing'")
- tdSql.checkRows(2)
+ tdSql.checkRows(0)
# test with tbname/normal column
tdSql.query(f"select * from {dbname}.jsons1 where tbname = 'jsons1_1'")
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 5eec1746185cc31ebcf7a19f18bfcc4fb198f9d8..d27fb99ef7cddc4e2c61b60f8fb0da6b4ddc4d0d 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -103,9 +103,9 @@ ELSE ()
ExternalProject_Add(upx
PREFIX "${_upx_prefix}"
URL https://github.com/upx/upx/releases/download/v3.96/upx-3.96-${PLATFORM_ARCH_STR}_linux.tar.xz
- CONFIGURE_COMMAND cmake -E true
- BUILD_COMMAND cmake -E true
- INSTALL_COMMAND cmake -E true
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
)
ExternalProject_Add(taosadapter
@@ -157,9 +157,9 @@ ELSE ()
ExternalProject_Add(upx
PREFIX "${_upx_prefix}"
URL https://github.com/upx/upx/releases/download/v3.96/upx-3.96-win32.zip
- CONFIGURE_COMMAND cmake -E true
- BUILD_COMMAND cmake -E true
- INSTALL_COMMAND cmake -E true
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
)
ExternalProject_Add(taosadapter