diff --git a/Jenkinsfile b/Jenkinsfile
index 4b84e1f88e71b3a43bc63df10edffe8a8758052a..0842795f0a496103f23fcee1c59a87c5c2bd4f3b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -79,7 +79,7 @@ def pre_test(){
rm -rf debug
mkdir debug
cd debug
- cmake .. > /dev/null
+ cmake .. -DBUILD_TEST=true > /dev/null
make -j4> /dev/null
'''
diff --git a/Jenkinsfile2 b/Jenkinsfile2
index d7df07f06afd8e1e483455e3ce925a03f28740fd..ac152e2aa4605b570d6db4289c594fcb3d01aa0e 100644
--- a/Jenkinsfile2
+++ b/Jenkinsfile2
@@ -173,7 +173,7 @@ def pre_test_build_mac() {
'''
sh '''
cd ${WK}/debug
- cmake ..
+ cmake .. -DBUILD_TEST=true
make -j8
'''
sh '''
@@ -218,12 +218,12 @@ def pre_test_win(){
if (env.CHANGE_URL =~ /\/TDengine\//) {
bat '''
cd %WIN_INTERNAL_ROOT%
- git pull
+ git pull origin ''' + env.CHANGE_TARGET + '''
'''
bat '''
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
- git pull
+ git pull origin ''' + env.CHANGE_TARGET + '''
'''
bat '''
cd %WIN_COMMUNITY_ROOT%
@@ -236,7 +236,7 @@ def pre_test_win(){
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
bat '''
cd %WIN_INTERNAL_ROOT%
- git pull
+ git pull origin ''' + env.CHANGE_TARGET + '''
'''
bat '''
cd %WIN_INTERNAL_ROOT%
@@ -302,7 +302,7 @@ def pre_test_build_win() {
set CL=/MP8
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cmake"
time /t
- cmake .. -G "NMake Makefiles JOM" || exit 7
+ cmake .. -G "NMake Makefiles JOM" -DBUILD_TEST=true || exit 7
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> jom -j 6"
time /t
jom -j 6 || exit 8
diff --git a/README.md b/README.md
index a8126d74d44b2615f0d0a3e80fc330eaac6a2950..fe9bb49ed8d70afb7b1f3a84933efd62b672229e 100644
--- a/README.md
+++ b/README.md
@@ -15,19 +15,19 @@
[![Coverage Status](https://coveralls.io/repos/github/taosdata/TDengine/badge.svg?branch=develop)](https://coveralls.io/github/taosdata/TDengine?branch=develop)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4201/badge)](https://bestpractices.coreinfrastructure.org/projects/4201)
-English | [简体中文](README-CN.md) | [Lean more about TSDB](https://tdengine.com/tsdb)
+English | [简体中文](README-CN.md) | [Learn more about TSDB](https://tdengine.com/tsdb/)
# What is TDengine?
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. 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. TDengine differentiates itself from other time-seires databases with the following advantages:
-- **[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.
+- **[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](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](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](https://docs.tdengine.com/get-started/docker/)**: 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 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](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.
@@ -232,9 +232,9 @@ After building successfully, TDengine can be installed by
sudo make install
```
-Users can find more information about directories installed on the system in the [directory and files](https://docs.taosdata.com/reference/directory/) section.
+Users can find more information about directories installed on the system in the [directory and files](https://docs.tdengine.com/reference/directory/) section.
-Installing from source code will also configure service management for TDengine.Users can also choose to [install from packages](https://docs.taosdata.com/get-started/package/) for it.
+Installing from source code will also configure service management for TDengine.Users can also choose to [install from packages](https://docs.tdengine.com/get-started/package/) for it.
To start the service after installation, in a terminal, use:
@@ -321,7 +321,11 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo
Please follow the [contribution guidelines](CONTRIBUTING.md) to contribute to the project.
-# Join TDengine User Community
+# Join the TDengine Community
-- Join [TDengine Discord Channel](https://discord.com/invite/VZdSuUg4pS?utm_id=discord)
-- Join wechat group by adding WeChat “tdengine”
+For more information about TDengine, you can follow us on social media and join our Discord server:
+
+- [Discord](https://discord.com/invite/VZdSuUg4pS)
+- [Twitter](https://twitter.com/TaosData)
+- [LinkedIn](https://www.linkedin.com/company/tdengine/)
+- [YouTube](https://www.youtube.com/channel/UCmp-1U6GS_3V3hjir6Uq5DQ)
diff --git a/cmake/cmake.options b/cmake/cmake.options
index 3baccde4d711e7c7a535829c95a0ee8cdff3fae6..60ff00affc01408b084a8993441e4fe7052f4977 100644
--- a/cmake/cmake.options
+++ b/cmake/cmake.options
@@ -2,6 +2,12 @@
# Deps options
# =========================================================
+option(
+ BUILD_TEST
+ "If build unit tests using googletest"
+ OFF
+)
+
IF(${TD_WINDOWS})
MESSAGE("build pthread Win32")
@@ -45,12 +51,6 @@ IF(${TD_WINDOWS})
"If build wingetopt on Windows"
ON
)
-
- option(
- BUILD_TEST
- "If build unit tests using googletest"
- ON
- )
option(
TDENGINE_3
@@ -65,28 +65,8 @@ IF(${TD_WINDOWS})
)
ELSEIF (TD_DARWIN_64)
- add_definitions(-DCOMPILER_SUPPORTS_CXX13)
- option(
- BUILD_TEST
- "If build unit tests using googletest"
- ON
- )
-ELSE ()
- include(CheckCXXCompilerFlag)
- CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13)
- IF(${COMPILER_SUPPORTS_CXX13})
+ IF(${BUILD_TEST})
add_definitions(-DCOMPILER_SUPPORTS_CXX13)
- option(
- BUILD_TEST
- "If build unit tests using googletest"
- ON
- )
- ELSE ()
- option(
- BUILD_TEST
- "If build unit tests using googletest"
- OFF
- )
ENDIF ()
ENDIF ()
diff --git a/cmake/cmake.version b/cmake/cmake.version
index d5721f767125721ef2d7ae897789b64debb6d0a1..fcb31adc39bfb4b95519bdf4b1a426fa7256ba3f 100644
--- a/cmake/cmake.version
+++ b/cmake/cmake.version
@@ -2,7 +2,7 @@
IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER})
ELSE ()
- SET(TD_VER_NUMBER "3.0.1.1")
+ SET(TD_VER_NUMBER "3.0.1.2")
ENDIF ()
IF (DEFINED VERCOMPATIBLE)
diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in
index 1a2f5d396f33d74b961feee45e1ebd5c2bed7439..16444c07f24bf97b174bf3bb92d1776ab5906816 100644
--- a/cmake/taosadapter_CMakeLists.txt.in
+++ b/cmake/taosadapter_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
- GIT_TAG 05fb2ff
+ GIT_TAG be729ab
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index b75d4607b8a68376f2fdb600c8478d10ef0f3516..39f243d1478a7a947c13d8e6aefe9906ea202790 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 285b5e0
+ GIT_TAG cf1df1c
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in
index 04b1262cafd6f1dd984f568b847454c409d301ed..ca8fff8da511ef86baa699af8246822d91982238 100644
--- a/cmake/taosws_CMakeLists.txt.in
+++ b/cmake/taosws_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosws-rs
ExternalProject_Add(taosws-rs
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
- GIT_TAG e771403
+ GIT_TAG 1bdfca3
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/07-develop/01-connect/_connect_cs.mdx b/docs/en/07-develop/01-connect/_connect_cs.mdx
index f8d8e519fde7fc6d0954bbfe865155221c0b0595..b81f49b2f0593c65ed6b51b6824d3936f00f2993 100644
--- a/docs/en/07-develop/01-connect/_connect_cs.mdx
+++ b/docs/en/07-develop/01-connect/_connect_cs.mdx
@@ -1,8 +1,7 @@
```csharp title="Native Connection"
-{{#include docs/examples/csharp/ConnectExample.cs}}
+{{#include docs/examples/csharp/connect/Program.cs}}
```
-:::info
-C# connector supports only native connection for now.
-
-:::
+```csharp title="WebSocket Connection"
+{{#include docs/examples/csharp/wsConnect/Program.cs}}
+```
diff --git a/docs/en/07-develop/03-insert-data/_cs_line.mdx b/docs/en/07-develop/03-insert-data/_cs_line.mdx
index 71f46c62be3dfe7d771a35b2298e476bed353aba..ae49901c3ac0a34218def4b1e12702e79960d0b6 100644
--- a/docs/en/07-develop/03-insert-data/_cs_line.mdx
+++ b/docs/en/07-develop/03-insert-data/_cs_line.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/InfluxDBLineExample.cs}}
+{{#include docs/examples/csharp/influxdbLine/Program.cs}}
```
diff --git a/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx b/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx
index 8d80d042c984c513df5ca91813c0cd0a17b58eb5..2627648616b9ac8c92e0d76097d517c066232ef2 100644
--- a/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx
+++ b/docs/en/07-develop/03-insert-data/_cs_opts_json.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/OptsJsonExample.cs}}
+{{#include docs/examples/csharp/optsJSON/Program.cs}}
```
diff --git a/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx b/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx
index cff32abf1feaf703971111542749fbe40152bc33..660db13fd1816150880883cf801ff50019fbae8d 100644
--- a/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx
+++ b/docs/en/07-develop/03-insert-data/_cs_opts_telnet.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/OptsTelnetExample.cs}}
+{{#include docs/examples/csharp/optsTelnet/Program.cs}}
```
diff --git a/docs/en/07-develop/03-insert-data/_cs_sql.mdx b/docs/en/07-develop/03-insert-data/_cs_sql.mdx
index 1dc7bb3d1366aa3000212786756506eb5eb280e6..42a6bc4315393de0b2cba37caffbfbc1c07b952b 100644
--- a/docs/en/07-develop/03-insert-data/_cs_sql.mdx
+++ b/docs/en/07-develop/03-insert-data/_cs_sql.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/SQLInsertExample.cs}}
+{{#include docs/examples/csharp/sqlInsert/Program.cs}}
```
diff --git a/docs/en/07-develop/03-insert-data/_cs_stmt.mdx b/docs/en/07-develop/03-insert-data/_cs_stmt.mdx
index 229c874ab9f515e7eae66890a3dfe2e59c129e86..d8d73ca15ebdce28a40a6c922293493679491e97 100644
--- a/docs/en/07-develop/03-insert-data/_cs_stmt.mdx
+++ b/docs/en/07-develop/03-insert-data/_cs_stmt.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/StmtInsertExample.cs}}
+{{#include docs/examples/csharp/stmtInsert/Program.cs}}
```
diff --git a/docs/en/07-develop/04-query-data/_cs.mdx b/docs/en/07-develop/04-query-data/_cs.mdx
index 4bb582ecbfaeceac679af975e7752d1caeacb018..745ab368115ca0dfbaff1f3a326abfd9bed02430 100644
--- a/docs/en/07-develop/04-query-data/_cs.mdx
+++ b/docs/en/07-develop/04-query-data/_cs.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/QueryExample.cs}}
+{{#include docs/examples/csharp/query/Program.cs}}
```
diff --git a/docs/en/07-develop/04-query-data/_cs_async.mdx b/docs/en/07-develop/04-query-data/_cs_async.mdx
index 3ecf635fd39db402d1db68de6d7336b7b2d9d8e8..19c8e58f32ed3598b5ccb953085b97ef2e4ce067 100644
--- a/docs/en/07-develop/04-query-data/_cs_async.mdx
+++ b/docs/en/07-develop/04-query-data/_cs_async.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/AsyncQueryExample.cs}}
+{{#include docs/examples/csharp/asyncQuery/Program.cs}}
```
diff --git a/docs/en/07-develop/_sub_cs.mdx b/docs/en/07-develop/_sub_cs.mdx
index a435ea0273c94cbe75eaf7431e1a9c39d49d92e3..093b617e9bb9c7da7bc9392f91316b9f3342bae6 100644
--- a/docs/en/07-develop/_sub_cs.mdx
+++ b/docs/en/07-develop/_sub_cs.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/SubscribeDemo.cs}}
+{{#include docs/examples/csharp/subscribe/Program.cs}}
```
\ No newline at end of file
diff --git a/docs/en/12-taos-sql/01-data-type.md b/docs/en/12-taos-sql/01-data-type.md
index 876de50f35ee3ba533bd7d5916632de853a84c0e..60046629a4c6f89ccfe9b20adcbb2fdba2ffb261 100644
--- a/docs/en/12-taos-sql/01-data-type.md
+++ b/docs/en/12-taos-sql/01-data-type.md
@@ -1,70 +1,70 @@
---
sidebar_label: Data Types
title: Data Types
-description: "TDengine supports a variety of data types including timestamp, float, JSON and many others."
+description: 'TDengine supports a variety of data types including timestamp, float, JSON and many others.'
---
## Timestamp
When using TDengine to store and query data, the most important part of the data is timestamp. Timestamp must be specified when creating and inserting data rows. Timestamp must follow the rules below:
-- 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
+- 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 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.
+- 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.
```sql
CREATE DATABASE db_name PRECISION 'ns';
```
+
## Data Types
In TDengine, the data types below can be used when specifying a column or tag.
-| # | **type** | **Bytes** | **Description** |
-| --- | :-------: | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| 1 | TIMESTAMP | 8 | Default precision is millisecond, microsecond and nanosecond are also supported |
-| 2 | INT | 4 | Integer, the value range is [-2^31, 2^31-1] |
-| 3 | INT UNSIGNED| 4| unsigned integer, the value range is [0, 2^32-1]
-| 4 | BIGINT | 8 | Long integer, the value range is [-2^63, 2^63-1] |
-| 5 | BIGINT UNSIGNED | 8 | unsigned long integer, the value range is [0, 2^64-1] |
-| 6 | FLOAT | 4 | Floating point number, the effective number of digits is 6-7, the value range is [-3.4E38, 3.4E38] |
-| 7 | DOUBLE | 8 | Double precision floating point number, the effective number of digits is 15-16, the value range is [-1.7E308, 1.7E308] |
-| 8 | BINARY | User Defined | Single-byte string for ASCII visible characters. Length must be specified when defining a column or tag of binary type. |
-| 9 | SMALLINT | 2 | Short integer, the value range is [-32768, 32767] |
-| 10 | INT UNSIGNED| 2| unsigned integer, the value range is [0, 65535]|
-| 11 | TINYINT | 1 | Single-byte integer, the value range is [-128, 127] |
-| 12 | TINYINT UNSIGNED | 1 | unsigned single-byte integer, the value range is [0, 255] |
-| 13 | BOOL | 1 | Bool, the value range is {true, false} |
-| 14 | NCHAR | User Defined| Multi-Byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\’`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. |
-| 15 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type |
-| 16 | VARCHAR | User-defined | Alias of BINARY |
-
+| # | **type** | **Bytes** | **Description** |
+| --- | :--------------: | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 1 | TIMESTAMP | 8 | Default precision is millisecond, microsecond and nanosecond are also supported. |
+| 2 | INT | 4 | Integer, the value range is [-2^31, 2^31-1]. |
+| 3 | INT UNSIGNED | 4 | Unsigned integer, the value range is [0, 2^32-1]. |
+| 4 | BIGINT | 8 | Long integer, the value range is [-2^63, 2^63-1]. |
+| 5 | BIGINT UNSIGNED | 8 | unsigned long integer, the value range is [0, 2^64-1]. |
+| 6 | FLOAT | 4 | Floating point number, the effective number of digits is 6-7, the value range is [-3.4E38, 3.4E38]. |
+| 7 | DOUBLE | 8 | Double precision floating point number, the effective number of digits is 15-16, the value range is [-1.7E308, 1.7E308]. |
+| 8 | BINARY | User Defined | Single-byte string for ASCII visible characters. Length must be specified when defining a column or tag of binary type. |
+| 9 | SMALLINT | 2 | Short integer, the value range is [-32768, 32767]. |
+| 10 | INT UNSIGNED | 2 | unsigned integer, the value range is [0, 65535]. |
+| 11 | TINYINT | 1 | Single-byte integer, the value range is [-128, 127]. |
+| 12 | TINYINT UNSIGNED | 1 | unsigned single-byte integer, the value range is [0, 255]. |
+| 13 | BOOL | 1 | Bool, the value range is {true, false}. |
+| 14 | NCHAR | User Defined | Multi-byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\'`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. |
+| 15 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type. |
+| 16 | VARCHAR | User-defined | Alias of BINARY |
:::note
-- TDengine is case insensitive and treats any characters in the sql command as lower case by default, case sensitive strings must be quoted with single quotes.
-- Only ASCII visible characters are suggested to be used in a column or tag of BINARY type. Multi-byte characters must be stored in NCHAR type.
-- The length of BINARY can be up to 16374 bytes. The string value must be quoted with single quotes. You must specify a length in bytes for a BINARY value, for example binary(20) for up to twenty single-byte characters. If the data exceeds the specified length, an error will occur. The literal single quote inside the string must be preceded with back slash like `\'`
+
+- Only ASCII visible characters are suggested to be used in a column or tag of BINARY type. Multi-byte characters must be stored in NCHAR type.
+- The length of BINARY can be up to 16,374 bytes. The string value must be quoted with single quotes. You must specify a length in bytes for a BINARY value, for example binary(20) for up to twenty single-byte characters. If the data exceeds the specified length, an error will occur. The literal single quote inside the string must be preceded with back slash like `\'`
- Numeric values in SQL statements will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used, so attention must be paid to avoid overflow. For example, 9999999999999999999 will be considered as overflow because it exceeds the upper limit of long integer, but 9999999999999999999.0 will be considered as a legal float number.
:::
-
## Constants
+
TDengine supports a variety of constants:
-| # | **Syntax** | **Type** | **Description** |
-| --- | :-------: | --------- | -------------------------------------- |
-| 1 | [{+ \| -}]123 | BIGINT | Integer literals are of type BIGINT. Data that exceeds the length of the BIGINT type is truncated. |
-| 2 | 123.45 | DOUBLE | Floating-point literals are of type DOUBLE. Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used. |
-| 3 | 1.2E3 | DOUBLE | Literals in scientific notation are of type DOUBLE. |
-| 4 | 'abc' | BINARY | Content enclosed in single quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal single quote inside the string must be escaped with a backslash (\'). |
-| 5 | 'abc' | BINARY | Content enclosed in double quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal double quote inside the string must be escaped with a backslash (\"). |
-| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | The TIMESTAMP keyword indicates that the following string literal is interpreted as a timestamp. The string must be in YYYY-MM-DD HH:mm:ss.MS format. The precision is inherited from the database configuration. |
-| 7 | {TRUE \| FALSE} | BOOL | Boolean literals are of type BOOL. |
-| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | The preceding characters indicate null literals. These can be used with any data type. |
+| # | **Syntax** | **Type** | **Description** |
+| --- | :-----------------------------------------------: | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 1 | [{+ \| -}]123 | BIGINT | Integer literals are of type BIGINT. Data that exceeds the length of the BIGINT type is truncated. |
+| 2 | 123.45 | DOUBLE | Floating-point literals are of type DOUBLE. Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used. |
+| 3 | 1.2E3 | DOUBLE | Literals in scientific notation are of type DOUBLE. |
+| 4 | 'abc' | BINARY | Content enclosed in single quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal single quote inside the string must be escaped with a backslash `\'`. |
+| 5 | 'abc' | BINARY | Content enclosed in double quotation marks is of type BINARY. The size of a BINARY is the size of the string in bytes. A literal double quote inside the string must be escaped with a backslash `\"`. |
+| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | The TIMESTAMP keyword indicates that the following string literal is interpreted as a timestamp. The string must be in YYYY-MM-DD HH:mm:ss.MS format. The precision is inherited from the database configuration. |
+| 7 | {TRUE \| FALSE} | BOOL | Boolean literals are of type BOOL. |
+| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | The preceding characters indicate null literals. These can be used with any data type. |
:::note
Numeric values will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used, so attention must be paid to avoid overflow. For example, 9999999999999999999 will be considered as overflow because it exceeds the upper limit of long integer, but 9999999999999999999.0 will be considered as a legal float number.
diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md
index e409973173cdf34aade9971612e39a2765630d4a..786444ad77a4ba8cd3c4729863dfae0a53cef798 100644
--- a/docs/en/12-taos-sql/06-select.md
+++ b/docs/en/12-taos-sql/06-select.md
@@ -68,7 +68,7 @@ A query can be performed on some or all columns. Data and tag columns can all be
### Wildcards
-You can use an asterisk (\*) as a wildcard character to indicate all columns. For standard tables, the asterisk indicates only data columns. For supertables and subtables, tag columns are also included.
+You can use an asterisk (\*) as a wildcard character to indicate all columns. For normal tables or sub-tables, the asterisk indicates only data columns. For supertables, tag columns are also included when using asterisk (\*).
```sql
SELECT * FROM d1001;
diff --git a/docs/en/14-reference/03-connector/06-rust.mdx b/docs/en/14-reference/03-connector/06-rust.mdx
index 530287e2a424592045755eeecf37894f59639ef3..edc3016cde6b694668960fb969c53af302b3c963 100644
--- a/docs/en/14-reference/03-connector/06-rust.mdx
+++ b/docs/en/14-reference/03-connector/06-rust.mdx
@@ -116,7 +116,7 @@ The parameters are described as follows:
- **protocol**: Specify which connection method to use. For example, `taos+ws://localhost:6041` uses Websocket to establish connections.
- **username/password**: Username and password used to create connections.
- **host/port**: Specifies the server and port to establish a connection. If you do not specify a hostname or port, native connections default to `localhost:6030` and Websocket connections default to `localhost:6041`.
-- **database**: Specify the default database to connect to.
+- **database**: Specify the default database to connect to. It's optional.
- **params**:Optional parameters.
A sample DSN description string is as follows:
diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx
index bc16cd086bdbef4b594df6e866a019a02ae54fd8..87a10e17cafa2578b76ca768eb51f8d784fc6e7f 100644
--- a/docs/en/14-reference/03-connector/09-csharp.mdx
+++ b/docs/en/14-reference/03-connector/09-csharp.mdx
@@ -17,7 +17,7 @@ import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx"
`TDengine.Connector` is a C# language connector provided by TDengine that allows C# developers to develop C# applications that access TDengine cluster data.
-The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc. The `TDengine.Connector` currently does not provide a REST connection interface. Developers can write their RESTful application by referring to the [REST API](/reference/rest-api/) documentation.
+The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc.The `TDengine.Connector` also supports WebSocket and developers can build connection through DSN, which supports data writing, querying, and parameter binding, etc.
This article describes how to install `TDengine.Connector` in a Linux or Windows environment and connect to TDengine clusters via `TDengine.Connector` to perform basic operations such as data writing and querying.
@@ -35,6 +35,10 @@ Please refer to [version support list](/reference/connector#version-support)
## Supported features
+
+
+
+
1. Connection Management
2. General Query
3. Continuous Query
@@ -42,6 +46,18 @@ Please refer to [version support list](/reference/connector#version-support)
5. Subscription
6. Schemaless
+
+
+
+
+1. Connection Management
+2. General Query
+3. Continuous Query
+4. Parameter Binding
+
+
+
+
## Installation Steps
### Pre-installation preparation
@@ -74,12 +90,18 @@ cp -r src/ myProject
cd myProject
dotnet add exmaple.csproj reference src/TDengine.csproj
```
+
## Establish a Connection
-``` C#
+
+
+
+
+
+``` csharp
using TDengineDriver;
namespace TDengineExample
@@ -112,14 +134,62 @@ namespace TDengineExample
```
+
+
+
+
+The structure of the DSN description string is as follows:
+
+```text
+[]://[[:@]:][/][?=[&=]]
+|------------|---|-----------|-----------|------|------|------------|-----------------------|
+| protocol | | username | password | host | port | database | params |
+```
+
+The parameters are described as follows:
+
+* **protocol**: Specify which connection method to use (support http/ws). For example, `ws://localhost:6041` uses Websocket to establish connections.
+* **username/password**: Username and password used to create connections.
+* **host/port**: Specifies the server and port to establish a connection. Websocket connections default to `localhost:6041`.
+* **database**: Specify the default database to connect to. It's optional.
+* **params**:Optional parameters.
+
+A sample DSN description string is as follows:
+
+```text
+ws://localhost:6041/test
+```
+
+``` csharp
+{{#include docs/examples/csharp/wsConnect/Program.cs}}
+```
+
+
+
+
## Usage examples
### Write data
#### SQL Write
+
+
+
+
+
+
+
+
+```csharp
+{{#include docs/examples/csharp/wsInsert/Program.cs}}
+```
+
+
+
+
#### InfluxDB line protocol write
@@ -132,12 +202,48 @@ namespace TDengineExample
+#### Parameter Binding
+
+
+
+
+
+``` csharp
+{{#include docs/examples/csharp/stmtInsert/Program.cs}}
+```
+
+
+
+
+
+```csharp
+{{#include docs/examples/csharp/wsStmt/Program.cs}}
+```
+
+
+
+
### Query data
#### Synchronous Query
+
+
+
+
+
+
+
+
+```csharp
+{{#include docs/examples/csharp/wsQuery/Program.cs}}
+```
+
+
+
+
#### Asynchronous query
@@ -145,18 +251,21 @@ namespace TDengineExample
### More sample programs
|Sample program |Sample program description |
-|--------------------------------------------------------------------------------------------------------------------|------------ --------------------------------|
+|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/Query/Query.cs) | Table creation, data insertion, and query examples with TDengine.Connector |
| [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/JSONTag) | Writing and querying JSON tag data with TDengine Connector |
| [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/Stmt) | Parameter binding with TDengine Connector |
| [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/schemaless) | Schemaless writes with TDengine Connector |
| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/AsyncQuery/QueryAsync.cs) | Asynchronous queries with TDengine Connector |
-| [TMQ](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | Data subscription with TDengine Connector |
+| [Subscription](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | Subscription example with TDengine Connector |
+| [Basic WebSocket Usage](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSample.cs) | WebSocket basic data in and out with TDengine connector |
+| [WebSocket Parameter Binding](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSTMT.cs) | WebSocket parameter binding example |
## Important update records
| TDengine.Connector | Description |
|--------------------|--------------------------------|
+| 3.0.1 | Support WebSocket and Cloud,With function query, insert, and parameter binding|
| 3.0.0 | Supports TDengine 3.0.0.0. TDengine 2.x is not supported. Added `TDengine.Impl.GetData()` interface to deserialize query results. |
| 1.0.7 | Fixed TDengine.Query() memory leak. |
| 1.0.6 | Fix schemaless bug in 1.0.4 and 1.0.5. |
diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md
index 02921c3f6a4ce21175504c3c07bd51bb4a3dcf60..5ab6f59454efd15aaa80a6dddc7626cab2dc8d88 100644
--- a/docs/en/14-reference/12-config/index.md
+++ b/docs/en/14-reference/12-config/index.md
@@ -164,7 +164,7 @@ The parameters described in this document by the effect that they have on the sy
| Attribute | Description |
| -------- | -------------------- |
| Applicable | Client only |
-| 含义 | SMA index optimization policy |
+| Meaning | SMA index optimization policy |
| Unit | None |
| Default Value | 0 |
| Notes |
@@ -325,7 +325,7 @@ The charset that takes effect is UTF-8.
| Applicable | Server Only |
| Meaning | Maximum number of vnodes per dnode |
| Value Range | 0-4096 |
-| Default Value | 256 |
+| Default Value | 2x the CPU cores |
## Time Parameters
@@ -697,152 +697,154 @@ To prevent system resource from being exhausted by multiple concurrent streams,
| 15 | telemetryPort | No | Yes |
| 16 | queryPolicy | No | Yes |
| 17 | querySmaOptimize | No | Yes |
-| 18 | queryBufferSize | Yes | Yes |
-| 19 | maxNumOfDistinctRes | Yes | Yes |
-| 20 | minSlidingTime | Yes | Yes |
-| 21 | minIntervalTime | Yes | Yes |
-| 22 | countAlwaysReturnValue | Yes | Yes |
-| 23 | dataDir | Yes | Yes |
-| 24 | minimalDataDirGB | Yes | Yes |
-| 25 | supportVnodes | No | Yes |
-| 26 | tempDir | Yes | Yes |
-| 27 | minimalTmpDirGB | Yes | Yes |
-| 28 | compressMsgSize | Yes | Yes |
-| 29 | compressColData | Yes | Yes |
-| 30 | smlChildTableName | Yes | Yes |
-| 31 | smlTagName | Yes | Yes |
-| 32 | smlDataFormat | No | Yes |
-| 33 | statusInterval | Yes | Yes |
-| 34 | shellActivityTimer | Yes | Yes |
-| 35 | transPullupInterval | No | Yes |
-| 36 | mqRebalanceInterval | No | Yes |
-| 37 | ttlUnit | No | Yes |
-| 38 | ttlPushInterval | No | Yes |
-| 39 | numOfTaskQueueThreads | No | Yes |
-| 40 | numOfRpcThreads | No | Yes |
-| 41 | numOfCommitThreads | Yes | Yes |
-| 42 | numOfMnodeReadThreads | No | Yes |
-| 43 | numOfVnodeQueryThreads | No | Yes |
-| 44 | numOfVnodeStreamThreads | No | Yes |
-| 45 | numOfVnodeFetchThreads | No | Yes |
-| 46 | numOfVnodeWriteThreads | No | Yes |
-| 47 | numOfVnodeSyncThreads | No | Yes |
-| 48 | numOfQnodeQueryThreads | No | Yes |
-| 49 | numOfQnodeFetchThreads | No | Yes |
-| 50 | numOfSnodeSharedThreads | No | Yes |
-| 51 | numOfSnodeUniqueThreads | No | Yes |
-| 52 | rpcQueueMemoryAllowed | No | Yes |
-| 53 | logDir | Yes | Yes |
-| 54 | minimalLogDirGB | Yes | Yes |
-| 55 | numOfLogLines | Yes | Yes |
-| 56 | asyncLog | Yes | Yes |
-| 57 | logKeepDays | Yes | Yes |
-| 58 | debugFlag | Yes | Yes |
-| 59 | tmrDebugFlag | Yes | Yes |
-| 60 | uDebugFlag | Yes | Yes |
-| 61 | rpcDebugFlag | Yes | Yes |
-| 62 | jniDebugFlag | Yes | Yes |
-| 63 | qDebugFlag | Yes | Yes |
-| 64 | cDebugFlag | Yes | Yes |
-| 65 | dDebugFlag | Yes | Yes |
-| 66 | vDebugFlag | Yes | Yes |
-| 67 | mDebugFlag | Yes | Yes |
-| 68 | wDebugFlag | Yes | Yes |
-| 69 | sDebugFlag | Yes | Yes |
-| 70 | tsdbDebugFlag | Yes | Yes |
-| 71 | tqDebugFlag | No | Yes |
-| 72 | fsDebugFlag | Yes | Yes |
-| 73 | udfDebugFlag | No | Yes |
-| 74 | smaDebugFlag | No | Yes |
-| 75 | idxDebugFlag | No | Yes |
-| 76 | tdbDebugFlag | No | Yes |
-| 77 | metaDebugFlag | No | Yes |
-| 78 | timezone | Yes | Yes |
-| 79 | locale | Yes | Yes |
-| 80 | charset | Yes | Yes |
-| 81 | udf | Yes | Yes |
-| 82 | enableCoreFile | Yes | Yes |
-| 83 | arbitrator | Yes | No |
-| 84 | numOfThreadsPerCore | Yes | No |
-| 85 | numOfMnodes | Yes | No |
-| 86 | vnodeBak | Yes | No |
-| 87 | balance | Yes | No |
-| 88 | balanceInterval | Yes | No |
-| 89 | offlineThreshold | Yes | No |
-| 90 | role | Yes | No |
-| 91 | dnodeNopLoop | Yes | No |
-| 92 | keepTimeOffset | Yes | No |
-| 93 | rpcTimer | Yes | No |
-| 94 | rpcMaxTime | Yes | No |
-| 95 | rpcForceTcp | Yes | No |
-| 96 | tcpConnTimeout | Yes | No |
-| 97 | syncCheckInterval | Yes | No |
-| 98 | maxTmrCtrl | Yes | No |
-| 99 | monitorReplica | Yes | No |
-| 100 | smlTagNullName | Yes | No |
-| 101 | keepColumnName | Yes | No |
-| 102 | ratioOfQueryCores | Yes | No |
-| 103 | maxStreamCompDelay | Yes | No |
-| 104 | maxFirstStreamCompDelay | Yes | No |
-| 105 | retryStreamCompDelay | Yes | No |
-| 106 | streamCompDelayRatio | Yes | No |
-| 107 | maxVgroupsPerDb | Yes | No |
-| 108 | maxTablesPerVnode | Yes | No |
-| 109 | minTablesPerVnode | Yes | No |
-| 110 | tableIncStepPerVnode | Yes | No |
-| 111 | cache | Yes | No |
-| 112 | blocks | Yes | No |
-| 113 | days | Yes | No |
-| 114 | keep | Yes | No |
-| 115 | minRows | Yes | No |
-| 116 | maxRows | Yes | No |
-| 117 | quorum | Yes | No |
-| 118 | comp | Yes | No |
-| 119 | walLevel | Yes | No |
-| 120 | fsync | Yes | No |
-| 121 | replica | Yes | No |
-| 122 | partitions | Yes | No |
-| 123 | quorum | Yes | No |
-| 124 | update | Yes | No |
-| 125 | cachelast | Yes | No |
-| 126 | maxSQLLength | Yes | No |
-| 127 | maxWildCardsLength | Yes | No |
-| 128 | maxRegexStringLen | Yes | No |
-| 129 | maxNumOfOrderedRes | Yes | No |
-| 130 | maxConnections | Yes | No |
-| 131 | mnodeEqualVnodeNum | Yes | No |
-| 132 | http | Yes | No |
-| 133 | httpEnableRecordSql | Yes | No |
-| 134 | httpMaxThreads | Yes | No |
-| 135 | restfulRowLimit | Yes | No |
-| 136 | httpDbNameMandatory | Yes | No |
-| 137 | httpKeepAlive | Yes | No |
-| 138 | enableRecordSql | Yes | No |
-| 139 | maxBinaryDisplayWidth | Yes | No |
-| 140 | stream | Yes | No |
-| 141 | retrieveBlockingModel | Yes | No |
-| 142 | tsdbMetaCompactRatio | Yes | No |
-| 143 | defaultJSONStrType | Yes | No |
-| 144 | walFlushSize | Yes | No |
-| 145 | keepTimeOffset | Yes | No |
-| 146 | flowctrl | Yes | No |
-| 147 | slaveQuery | Yes | No |
-| 148 | adjustMaster | Yes | No |
-| 149 | topicBinaryLen | Yes | No |
-| 150 | telegrafUseFieldNum | Yes | No |
-| 151 | deadLockKillQuery | Yes | No |
-| 152 | clientMerge | Yes | No |
-| 153 | sdbDebugFlag | Yes | No |
-| 154 | odbcDebugFlag | Yes | No |
-| 155 | httpDebugFlag | Yes | No |
-| 156 | monDebugFlag | Yes | No |
-| 157 | cqDebugFlag | Yes | No |
-| 158 | shortcutFlag | Yes | No |
-| 159 | probeSeconds | Yes | No |
-| 160 | probeKillSeconds | Yes | No |
-| 161 | probeInterval | Yes | No |
-| 162 | lossyColumns | Yes | No |
-| 163 | fPrecision | Yes | No |
-| 164 | dPrecision | Yes | No |
-| 165 | maxRange | Yes | No |
-| 166 | range | Yes | No |
+| 18 | queryRsmaTolerance | No | Yes |
+| 19 | queryBufferSize | Yes | Yes |
+| 20 | maxNumOfDistinctRes | Yes | Yes |
+| 21 | minSlidingTime | Yes | Yes |
+| 22 | minIntervalTime | Yes | Yes |
+| 23 | countAlwaysReturnValue | Yes | Yes |
+| 24 | dataDir | Yes | Yes |
+| 25 | minimalDataDirGB | Yes | Yes |
+| 26 | supportVnodes | No | Yes |
+| 27 | tempDir | Yes | Yes |
+| 28 | minimalTmpDirGB | Yes | Yes |
+| 29 | compressMsgSize | Yes | Yes |
+| 30 | compressColData | Yes | Yes |
+| 31 | smlChildTableName | Yes | Yes |
+| 32 | smlTagName | Yes | Yes |
+| 33 | smlDataFormat | No | Yes |
+| 34 | statusInterval | Yes | Yes |
+| 35 | shellActivityTimer | Yes | Yes |
+| 36 | transPullupInterval | No | Yes |
+| 37 | mqRebalanceInterval | No | Yes |
+| 38 | ttlUnit | No | Yes |
+| 39 | ttlPushInterval | No | Yes |
+| 40 | numOfTaskQueueThreads | No | Yes |
+| 41 | numOfRpcThreads | No | Yes |
+| 42 | numOfCommitThreads | Yes | Yes |
+| 43 | numOfMnodeReadThreads | No | Yes |
+| 44 | numOfVnodeQueryThreads | No | Yes |
+| 45 | numOfVnodeStreamThreads | No | Yes |
+| 46 | numOfVnodeFetchThreads | No | Yes |
+| 47 | numOfVnodeWriteThreads | No | Yes |
+| 48 | numOfVnodeSyncThreads | No | Yes |
+| 49 | numOfVnodeRsmaThreads | No | Yes |
+| 50 | numOfQnodeQueryThreads | No | Yes |
+| 51 | numOfQnodeFetchThreads | No | Yes |
+| 52 | numOfSnodeSharedThreads | No | Yes |
+| 53 | numOfSnodeUniqueThreads | No | Yes |
+| 54 | rpcQueueMemoryAllowed | No | Yes |
+| 55 | logDir | Yes | Yes |
+| 56 | minimalLogDirGB | Yes | Yes |
+| 57 | numOfLogLines | Yes | Yes |
+| 58 | asyncLog | Yes | Yes |
+| 59 | logKeepDays | Yes | Yes |
+| 60 | debugFlag | Yes | Yes |
+| 61 | tmrDebugFlag | Yes | Yes |
+| 62 | uDebugFlag | Yes | Yes |
+| 63 | rpcDebugFlag | Yes | Yes |
+| 64 | jniDebugFlag | Yes | Yes |
+| 65 | qDebugFlag | Yes | Yes |
+| 66 | cDebugFlag | Yes | Yes |
+| 67 | dDebugFlag | Yes | Yes |
+| 68 | vDebugFlag | Yes | Yes |
+| 69 | mDebugFlag | Yes | Yes |
+| 70 | wDebugFlag | Yes | Yes |
+| 71 | sDebugFlag | Yes | Yes |
+| 72 | tsdbDebugFlag | Yes | Yes |
+| 73 | tqDebugFlag | No | Yes |
+| 74 | fsDebugFlag | Yes | Yes |
+| 75 | udfDebugFlag | No | Yes |
+| 76 | smaDebugFlag | No | Yes |
+| 77 | idxDebugFlag | No | Yes |
+| 78 | tdbDebugFlag | No | Yes |
+| 79 | metaDebugFlag | No | Yes |
+| 80 | timezone | Yes | Yes |
+| 81 | locale | Yes | Yes |
+| 82 | charset | Yes | Yes |
+| 83 | udf | Yes | Yes |
+| 84 | enableCoreFile | Yes | Yes |
+| 85 | arbitrator | Yes | No |
+| 86 | numOfThreadsPerCore | Yes | No |
+| 87 | numOfMnodes | Yes | No |
+| 88 | vnodeBak | Yes | No |
+| 89 | balance | Yes | No |
+| 90 | balanceInterval | Yes | No |
+| 91 | offlineThreshold | Yes | No |
+| 92 | role | Yes | No |
+| 93 | dnodeNopLoop | Yes | No |
+| 94 | keepTimeOffset | Yes | No |
+| 95 | rpcTimer | Yes | No |
+| 96 | rpcMaxTime | Yes | No |
+| 97 | rpcForceTcp | Yes | No |
+| 98 | tcpConnTimeout | Yes | No |
+| 99 | syncCheckInterval | Yes | No |
+| 100 | maxTmrCtrl | Yes | No |
+| 101 | monitorReplica | Yes | No |
+| 102 | smlTagNullName | Yes | No |
+| 103 | keepColumnName | Yes | No |
+| 104 | ratioOfQueryCores | Yes | No |
+| 105 | maxStreamCompDelay | Yes | No |
+| 106 | maxFirstStreamCompDelay | Yes | No |
+| 107 | retryStreamCompDelay | Yes | No |
+| 108 | streamCompDelayRatio | Yes | No |
+| 109 | maxVgroupsPerDb | Yes | No |
+| 110 | maxTablesPerVnode | Yes | No |
+| 111 | minTablesPerVnode | Yes | No |
+| 112 | tableIncStepPerVnode | Yes | No |
+| 113 | cache | Yes | No |
+| 114 | blocks | Yes | No |
+| 115 | days | Yes | No |
+| 116 | keep | Yes | No |
+| 117 | minRows | Yes | No |
+| 118 | maxRows | Yes | No |
+| 119 | quorum | Yes | No |
+| 120 | comp | Yes | No |
+| 121 | walLevel | Yes | No |
+| 122 | fsync | Yes | No |
+| 123 | replica | Yes | No |
+| 124 | partitions | Yes | No |
+| 125 | quorum | Yes | No |
+| 126 | update | Yes | No |
+| 127 | cachelast | Yes | No |
+| 128 | maxSQLLength | Yes | No |
+| 129 | maxWildCardsLength | Yes | No |
+| 130 | maxRegexStringLen | Yes | No |
+| 131 | maxNumOfOrderedRes | Yes | No |
+| 132 | maxConnections | Yes | No |
+| 133 | mnodeEqualVnodeNum | Yes | No |
+| 134 | http | Yes | No |
+| 135 | httpEnableRecordSql | Yes | No |
+| 136 | httpMaxThreads | Yes | No |
+| 137 | restfulRowLimit | Yes | No |
+| 138 | httpDbNameMandatory | Yes | No |
+| 139 | httpKeepAlive | Yes | No |
+| 140 | enableRecordSql | Yes | No |
+| 141 | maxBinaryDisplayWidth | Yes | No |
+| 142 | stream | Yes | No |
+| 143 | retrieveBlockingModel | Yes | No |
+| 144 | tsdbMetaCompactRatio | Yes | No |
+| 145 | defaultJSONStrType | Yes | No |
+| 146 | walFlushSize | Yes | No |
+| 147 | keepTimeOffset | Yes | No |
+| 148 | flowctrl | Yes | No |
+| 149 | slaveQuery | Yes | No |
+| 150 | adjustMaster | Yes | No |
+| 151 | topicBinaryLen | Yes | No |
+| 152 | telegrafUseFieldNum | Yes | No |
+| 153 | deadLockKillQuery | Yes | No |
+| 154 | clientMerge | Yes | No |
+| 155 | sdbDebugFlag | Yes | No |
+| 156 | odbcDebugFlag | Yes | No |
+| 157 | httpDebugFlag | Yes | No |
+| 158 | monDebugFlag | Yes | No |
+| 159 | cqDebugFlag | Yes | No |
+| 160 | shortcutFlag | Yes | No |
+| 161 | probeSeconds | Yes | No |
+| 162 | probeKillSeconds | Yes | No |
+| 163 | probeInterval | Yes | No |
+| 164 | lossyColumns | Yes | No |
+| 165 | fPrecision | Yes | No |
+| 166 | dPrecision | Yes | No |
+| 167 | maxRange | Yes | No |
+| 168 | range | Yes | No |
diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md
index e3901114d3271d040934f0a211135beecbdc2f7f..414986d107cb561d23b215a2e3b806f98542182e 100644
--- a/docs/en/28-releases/01-tdengine.md
+++ b/docs/en/28-releases/01-tdengine.md
@@ -6,6 +6,9 @@ description: TDengine release history, Release Notes and download links.
import Release from "/components/ReleaseV3";
+## 3.0.1.2
+
+
## 3.0.1.1
diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md
index 228990df3b15bf7ee111433994813dbb171843ab..086d3adea2d43f9b3eebdfb9520236710e306582 100644
--- a/docs/en/28-releases/02-tools.md
+++ b/docs/en/28-releases/02-tools.md
@@ -6,6 +6,10 @@ description: taosTools release history, Release Notes, download links.
import Release from "/components/ReleaseV3";
+## 2.2.2
+
+
+
## 2.2.0
diff --git a/docs/examples/csharp/.gitignore b/docs/examples/csharp/.gitignore
index b3aff79f3706e23aa74199a7f521f7912d2b0e45..c228f1be2a4b210c9ec11dc31b12571c24f7f0f5 100644
--- a/docs/examples/csharp/.gitignore
+++ b/docs/examples/csharp/.gitignore
@@ -1,4 +1,27 @@
-bin
-obj
.vs
-*.sln
\ No newline at end of file
+asyncQuery/bin
+connect/bin
+influxdbLine/bin
+optsJSON/bin
+optsTelnet/bin
+query/bin
+sqlInsert/bin
+stmtInsert/bin
+subscribe/bin
+wsConnect/bin
+wsInsert/bin
+wsQuery/bin
+wsStmt/bin
+asyncQuery/obj
+connect/obj
+influxdbLine/obj
+optsJSON/obj
+optsTelnet/obj
+query/obj
+sqlInsert/obj
+stmtInsert/obj
+subscribe/obj
+wsConnect/obj
+wsInsert/obj
+wsQuery/obj
+wsStmt/obj
\ No newline at end of file
diff --git a/docs/examples/csharp/QueryExample.cs b/docs/examples/csharp/QueryExample.cs
deleted file mode 100644
index d75bb8d6611f5b3899485eb1a63a42ed6995847d..0000000000000000000000000000000000000000
--- a/docs/examples/csharp/QueryExample.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using TDengineDriver;
-using TDengineDriver.Impl;
-using System.Runtime.InteropServices;
-
-namespace TDengineExample
-{
- internal class QueryExample
- {
- static void Main()
- {
- IntPtr conn = GetConnection();
- // run query
- IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2");
- if (TDengine.ErrorNo(res) != 0)
- {
- Console.WriteLine("Failed to query since: " + TDengine.Error(res));
- TDengine.Close(conn);
- TDengine.Cleanup();
- return;
- }
-
- // get filed count
- int fieldCount = TDengine.FieldCount(res);
- Console.WriteLine("fieldCount=" + fieldCount);
-
- // print column names
- List metas = LibTaos.GetMeta(res);
- for (int i = 0; i < metas.Count; i++)
- {
- Console.Write(metas[i].name + "\t");
- }
- Console.WriteLine();
-
- // print values
- List resData = LibTaos.GetData(res);
- for (int i = 0; i < resData.Count; i++)
- {
- Console.Write($"|{resData[i].ToString()} \t");
- if (((i + 1) % metas.Count == 0))
- {
- Console.WriteLine("");
- }
- }
- Console.WriteLine();
-
- if (TDengine.ErrorNo(res) != 0)
- {
- Console.WriteLine($"Query is not complete, Error {TDengine.ErrorNo(res)} {TDengine.Error(res)}");
- }
- // exit
- TDengine.FreeResult(res);
- TDengine.Close(conn);
- TDengine.Cleanup();
- }
- static IntPtr GetConnection()
- {
- string host = "localhost";
- short port = 6030;
- string username = "root";
- string password = "taosdata";
- string dbname = "power";
- var conn = TDengine.Connect(host, username, password, dbname, port);
- if (conn == IntPtr.Zero)
- {
- Console.WriteLine("Connect to TDengine failed");
- System.Environment.Exit(0);
- }
- else
- {
- Console.WriteLine("Connect to TDengine success");
- }
- return conn;
- }
- }
-}
-
-// output:
-// Connect to TDengine success
-// fieldCount=6
-// ts current voltage phase location groupid
-// 1648432611249 10.3 219 0.31 California.SanFrancisco 2
-// 1648432611749 12.6 218 0.33 California.SanFrancisco 2
\ No newline at end of file
diff --git a/docs/examples/csharp/SQLInsertExample.cs b/docs/examples/csharp/SQLInsertExample.cs
deleted file mode 100644
index 3ce70fe9144d997b320610500be29b329b69a08f..0000000000000000000000000000000000000000
--- a/docs/examples/csharp/SQLInsertExample.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using TDengineDriver;
-
-
-namespace TDengineExample
-{
- internal class SQLInsertExample
- {
-
- static void Main()
- {
- IntPtr conn = GetConnection();
- IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
- CheckRes(conn, res, "failed to create database");
- res = TDengine.Query(conn, "USE power");
- CheckRes(conn, res, "failed to change database");
- res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
- CheckRes(conn, res, "failed to create stable");
- var sql = "INSERT INTO d1001 USING meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000) " +
- "d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000) " +
- "d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " +
- "d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)";
- res = TDengine.Query(conn, sql);
- CheckRes(conn, res, "failed to insert data");
- int affectedRows = TDengine.AffectRows(res);
- Console.WriteLine("affectedRows " + affectedRows);
- TDengine.FreeResult(res);
- ExitProgram(conn, 0);
- }
-
- static IntPtr GetConnection()
- {
- string host = "localhost";
- short port = 6030;
- string username = "root";
- string password = "taosdata";
- string dbname = "";
- var conn = TDengine.Connect(host, username, password, dbname, port);
- if (conn == IntPtr.Zero)
- {
- Console.WriteLine("Connect to TDengine failed");
- Environment.Exit(0);
- }
- else
- {
- Console.WriteLine("Connect to TDengine success");
- }
- return conn;
- }
-
- static void CheckRes(IntPtr conn, IntPtr res, String errorMsg)
- {
- if (TDengine.ErrorNo(res) != 0)
- {
- Console.Write(errorMsg + " since: " + TDengine.Error(res));
- ExitProgram(conn, 1);
- }
- }
-
- static void ExitProgram(IntPtr conn, int exitCode)
- {
- TDengine.Close(conn);
- TDengine.Cleanup();
- Environment.Exit(exitCode);
- }
- }
-}
-
-// output:
-// Connect to TDengine success
-// affectedRows 8
diff --git a/docs/examples/csharp/AsyncQueryExample.cs b/docs/examples/csharp/asyncQuery/Program.cs
similarity index 81%
rename from docs/examples/csharp/AsyncQueryExample.cs
rename to docs/examples/csharp/asyncQuery/Program.cs
index 0d47325932e2f01fec8d55cfdb64c636258f4a03..864f06a15e5d7c9fb8fcfb25c81915e3f2e13f9d 100644
--- a/docs/examples/csharp/AsyncQueryExample.cs
+++ b/docs/examples/csharp/asyncQuery/Program.cs
@@ -11,11 +11,17 @@ namespace TDengineExample
static void Main()
{
IntPtr conn = GetConnection();
- QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback);
- TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero);
- Thread.Sleep(2000);
- TDengine.Close(conn);
- TDengine.Cleanup();
+ try
+ {
+ QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback);
+ TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero);
+ Thread.Sleep(2000);
+ }
+ finally
+ {
+ TDengine.Close(conn);
+ }
+
}
static void QueryCallback(IntPtr param, IntPtr taosRes, int code)
@@ -27,11 +33,11 @@ namespace TDengineExample
}
else
{
- Console.WriteLine($"async query data failed, failed code {code}");
+ throw new Exception($"async query data failed,code:{code},reason:{TDengine.Error(taosRes)}");
}
}
- // Iteratively call this interface until "numOfRows" is no greater than 0.
+ // Iteratively call this interface until "numOfRows" is no greater than 0.
static void FetchRawBlockCallback(IntPtr param, IntPtr taosRes, int numOfRows)
{
if (numOfRows > 0)
@@ -43,7 +49,7 @@ namespace TDengineExample
for (int i = 0; i < dataList.Count; i++)
{
- if (i != 0 && (i+1) % metaList.Count == 0)
+ if (i != 0 && (i + 1) % metaList.Count == 0)
{
Console.WriteLine("{0}\t|", dataList[i]);
}
@@ -63,7 +69,7 @@ namespace TDengineExample
}
else
{
- Console.WriteLine($"FetchRawBlockCallback callback error, error code {numOfRows}");
+ throw new Exception($"FetchRawBlockCallback callback error, error code {numOfRows}");
}
TDengine.FreeResult(taosRes);
}
@@ -79,8 +85,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
- Console.WriteLine("Connect to TDengine failed");
- Environment.Exit(0);
+ throw new Exception("Connect to TDengine failed");
}
else
{
diff --git a/docs/examples/csharp/asyncquery.csproj b/docs/examples/csharp/asyncQuery/asyncquery.csproj
similarity index 98%
rename from docs/examples/csharp/asyncquery.csproj
rename to docs/examples/csharp/asyncQuery/asyncquery.csproj
index 045969edd7febbd11cc6577c8ba958669a5a7e3b..23e590cd25aa88e58cabf81717a6baf320f447bc 100644
--- a/docs/examples/csharp/asyncquery.csproj
+++ b/docs/examples/csharp/asyncQuery/asyncquery.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/docs/examples/csharp/ConnectExample.cs b/docs/examples/csharp/connect/Program.cs
similarity index 90%
rename from docs/examples/csharp/ConnectExample.cs
rename to docs/examples/csharp/connect/Program.cs
index f3548ee65daab8a59695499339a8f89b0aa33a10..955db40c7c80e60350f9c0e8c6f50e7eb85246c2 100644
--- a/docs/examples/csharp/ConnectExample.cs
+++ b/docs/examples/csharp/connect/Program.cs
@@ -16,7 +16,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
- Console.WriteLine("Connect to TDengine failed");
+ throw new Exception("Connect to TDengine failed");
}
else
{
diff --git a/docs/examples/csharp/connect.csproj b/docs/examples/csharp/connect/connect.csproj
similarity index 100%
rename from docs/examples/csharp/connect.csproj
rename to docs/examples/csharp/connect/connect.csproj
diff --git a/docs/examples/csharp/csharp.sln b/docs/examples/csharp/csharp.sln
new file mode 100644
index 0000000000000000000000000000000000000000..560dde55cbddd4e7928598e7dd940c2721bd7b9c
--- /dev/null
+++ b/docs/examples/csharp/csharp.sln
@@ -0,0 +1,94 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30114.105
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asyncquery", "asyncQuery\asyncquery.csproj", "{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "connect", "connect\connect.csproj", "{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "influxdbline", "influxdbLine\influxdbline.csproj", "{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optsJSON", "optsJSON\optsJSON.csproj", "{6725A961-0C66-4196-AC98-8D3F3D757D6C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optstelnet", "optsTelnet\optstelnet.csproj", "{B3B50D25-688B-44D4-8683-482ABC52FFCA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "query", "query\query.csproj", "{F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stmtinsert", "stmtInsert\stmtinsert.csproj", "{B40D6BED-BE3C-4B44-9B12-28BE441311BA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "subscribe", "subscribe\subscribe.csproj", "{C3D45A8E-AFC0-4547-9F3C-467B0B583DED}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsConnect", "wsConnect\wsConnect.csproj", "{51E19494-845E-49ED-97C7-749AE63111BD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsInsert", "wsInsert\wsInsert.csproj", "{13E2233B-4AFF-40D9-AF42-AB3F01617540}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsQuery", "wsQuery\wsQuery.csproj", "{0F394169-C456-442C-929D-C2D43A0EEC7B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsStmt", "wsStmt\wsStmt.csproj", "{27B9C9AB-9055-4BF2-8A14-4E59F09D5985}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqlinsert", "sqlInsert\sqlinsert.csproj", "{CD24BD12-8550-4627-A11D-707B446F48C3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6A24FB80-1E3C-4E2D-A5AB-914FA583874D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6725A961-0C66-4196-AC98-8D3F3D757D6C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B3B50D25-688B-44D4-8683-482ABC52FFCA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F2B7D13B-FE04-4C5C-BB6D-C12E0A9D9970}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B40D6BED-BE3C-4B44-9B12-28BE441311BA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C3D45A8E-AFC0-4547-9F3C-467B0B583DED}.Release|Any CPU.Build.0 = Release|Any CPU
+ {51E19494-845E-49ED-97C7-749AE63111BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {51E19494-845E-49ED-97C7-749AE63111BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {51E19494-845E-49ED-97C7-749AE63111BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {51E19494-845E-49ED-97C7-749AE63111BD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {13E2233B-4AFF-40D9-AF42-AB3F01617540}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0F394169-C456-442C-929D-C2D43A0EEC7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0F394169-C456-442C-929D-C2D43A0EEC7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0F394169-C456-442C-929D-C2D43A0EEC7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0F394169-C456-442C-929D-C2D43A0EEC7B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {27B9C9AB-9055-4BF2-8A14-4E59F09D5985}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CD24BD12-8550-4627-A11D-707B446F48C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CD24BD12-8550-4627-A11D-707B446F48C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CD24BD12-8550-4627-A11D-707B446F48C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CD24BD12-8550-4627-A11D-707B446F48C3}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/docs/examples/csharp/InfluxDBLineExample.cs b/docs/examples/csharp/influxdbLine/Program.cs
similarity index 73%
rename from docs/examples/csharp/InfluxDBLineExample.cs
rename to docs/examples/csharp/influxdbLine/Program.cs
index 7b4453f4ac0b14dd76d166e395bdacb46a5d3fbc..fa3cb21fe04977b5081c922d623dee5514056770 100644
--- a/docs/examples/csharp/InfluxDBLineExample.cs
+++ b/docs/examples/csharp/influxdbLine/Program.cs
@@ -17,8 +17,7 @@ namespace TDengineExample
IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS);
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
}
else
{
@@ -26,7 +25,6 @@ namespace TDengineExample
Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
}
TDengine.FreeResult(res);
- ExitProgram(conn, 0);
}
static IntPtr GetConnection()
@@ -39,9 +37,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
- Console.WriteLine("Connect to TDengine failed");
- TDengine.Cleanup();
- Environment.Exit(1);
+ throw new Exception("Connect to TDengine failed");
}
else
{
@@ -55,23 +51,15 @@ namespace TDengineExample
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine("failed to create database, reason: " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ throw new Exception("failed to create database, reason: " + TDengine.Error(res));
}
res = TDengine.Query(conn, "USE test");
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine("failed to change database, reason: " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ throw new Exception("failed to change database, reason: " + TDengine.Error(res));
}
}
- static void ExitProgram(IntPtr conn, int exitCode)
- {
- TDengine.Close(conn);
- TDengine.Cleanup();
- Environment.Exit(exitCode);
- }
}
}
diff --git a/docs/examples/csharp/influxdbline.csproj b/docs/examples/csharp/influxdbLine/influxdbline.csproj
similarity index 100%
rename from docs/examples/csharp/influxdbline.csproj
rename to docs/examples/csharp/influxdbLine/influxdbline.csproj
diff --git a/docs/examples/csharp/OptsJsonExample.cs b/docs/examples/csharp/optsJSON/Program.cs
similarity index 53%
rename from docs/examples/csharp/OptsJsonExample.cs
rename to docs/examples/csharp/optsJSON/Program.cs
index 2c41acc5c9628befda7eb4ad5c30af5b921de948..b67b5af62bf0a1fd9028125da0b665f723f2e4ec 100644
--- a/docs/examples/csharp/OptsJsonExample.cs
+++ b/docs/examples/csharp/optsJSON/Program.cs
@@ -7,27 +7,31 @@ namespace TDengineExample
static void Main()
{
IntPtr conn = GetConnection();
- PrepareDatabase(conn);
- string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," +
+ try
+ {
+ PrepareDatabase(conn);
+ string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," +
" {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611249, \"value\": 219, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}, " +
"{\"metric\": \"meters.current\", \"timestamp\": 1648432611250, \"value\": 12.6, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," +
" {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611250, \"value\": 221, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}]"
};
- IntPtr res = TDengine.SchemalessInsert(conn, lines, 1, (int)TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
- if (TDengine.ErrorNo(res) != 0)
- {
- Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ IntPtr res = TDengine.SchemalessInsert(conn, lines, 1, (int)TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
+ if (TDengine.ErrorNo(res) != 0)
+ {
+ throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
+ }
+ else
+ {
+ int affectedRows = TDengine.AffectRows(res);
+ Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
+ }
+ TDengine.FreeResult(res);
}
- else
+ finally
{
- int affectedRows = TDengine.AffectRows(res);
- Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
+ TDengine.Close(conn);
}
- TDengine.FreeResult(res);
- ExitProgram(conn, 0);
-
}
static IntPtr GetConnection()
{
@@ -39,9 +43,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
- Console.WriteLine("Connect to TDengine failed");
- TDengine.Cleanup();
- Environment.Exit(1);
+ throw new Exception("Connect to TDengine failed");
}
else
{
@@ -55,22 +57,13 @@ namespace TDengineExample
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine("failed to create database, reason: " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ throw new Exception("failed to create database, reason: " + TDengine.Error(res));
}
res = TDengine.Query(conn, "USE test");
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine("failed to change database, reason: " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ throw new Exception("failed to change database, reason: " + TDengine.Error(res));
}
}
-
- static void ExitProgram(IntPtr conn, int exitCode)
- {
- TDengine.Close(conn);
- TDengine.Cleanup();
- Environment.Exit(exitCode);
- }
}
}
diff --git a/docs/examples/csharp/optsjson.csproj b/docs/examples/csharp/optsJSON/optsJSON.csproj
similarity index 100%
rename from docs/examples/csharp/optsjson.csproj
rename to docs/examples/csharp/optsJSON/optsJSON.csproj
diff --git a/docs/examples/csharp/OptsTelnetExample.cs b/docs/examples/csharp/optsTelnet/Program.cs
similarity index 59%
rename from docs/examples/csharp/OptsTelnetExample.cs
rename to docs/examples/csharp/optsTelnet/Program.cs
index bb752db1afbbb2ef68df9ca25314c8b91cd9a266..e73ceb041accf88222176342d46fe1a669584211 100644
--- a/docs/examples/csharp/OptsTelnetExample.cs
+++ b/docs/examples/csharp/optsTelnet/Program.cs
@@ -7,8 +7,10 @@ namespace TDengineExample
static void Main()
{
IntPtr conn = GetConnection();
- PrepareDatabase(conn);
- string[] lines = {
+ try
+ {
+ PrepareDatabase(conn);
+ string[] lines = {
"meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2",
"meters.current 1648432611250 12.6 location=California.SanFrancisco groupid=2",
"meters.current 1648432611249 10.8 location=California.LosAngeles groupid=3",
@@ -18,20 +20,22 @@ namespace TDengineExample
"meters.voltage 1648432611249 221 location=California.LosAngeles groupid=3",
"meters.voltage 1648432611250 217 location=California.LosAngeles groupid=3",
};
- IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
- if (TDengine.ErrorNo(res) != 0)
- {
- Console.WriteLine("SchemalessInsert failed since " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
+ if (TDengine.ErrorNo(res) != 0)
+ {
+ throw new Exception("SchemalessInsert failed since " + TDengine.Error(res));
+ }
+ else
+ {
+ int affectedRows = TDengine.AffectRows(res);
+ Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
+ }
+ TDengine.FreeResult(res);
}
- else
+ catch
{
- int affectedRows = TDengine.AffectRows(res);
- Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows");
+ TDengine.Close(conn);
}
- TDengine.FreeResult(res);
- ExitProgram(conn, 0);
-
}
static IntPtr GetConnection()
{
@@ -43,9 +47,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
- Console.WriteLine("Connect to TDengine failed");
- TDengine.Cleanup();
- Environment.Exit(1);
+ throw new Exception("Connect to TDengine failed");
}
else
{
@@ -59,22 +61,13 @@ namespace TDengineExample
IntPtr res = TDengine.Query(conn, "CREATE DATABASE test");
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine("failed to create database, reason: " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ throw new Exception("failed to create database, reason: " + TDengine.Error(res));
}
res = TDengine.Query(conn, "USE test");
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine("failed to change database, reason: " + TDengine.Error(res));
- ExitProgram(conn, 1);
+ throw new Exception("failed to change database, reason: " + TDengine.Error(res));
}
}
-
- static void ExitProgram(IntPtr conn, int exitCode)
- {
- TDengine.Close(conn);
- TDengine.Cleanup();
- Environment.Exit(exitCode);
- }
}
}
diff --git a/docs/examples/csharp/optstelnet.csproj b/docs/examples/csharp/optsTelnet/optstelnet.csproj
similarity index 100%
rename from docs/examples/csharp/optstelnet.csproj
rename to docs/examples/csharp/optsTelnet/optstelnet.csproj
diff --git a/docs/examples/csharp/query/Program.cs b/docs/examples/csharp/query/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..84c7f9db1f8a87289b73662c72c63c0078b45678
--- /dev/null
+++ b/docs/examples/csharp/query/Program.cs
@@ -0,0 +1,80 @@
+using TDengineDriver;
+using TDengineDriver.Impl;
+using System.Runtime.InteropServices;
+
+namespace TDengineExample
+{
+ internal class QueryExample
+ {
+ static void Main()
+ {
+ IntPtr conn = GetConnection();
+ try
+ {
+ // run query
+ IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2");
+ if (TDengine.ErrorNo(res) != 0)
+ {
+ throw new Exception("Failed to query since: " + TDengine.Error(res));
+ }
+
+ // get filed count
+ int fieldCount = TDengine.FieldCount(res);
+ Console.WriteLine("fieldCount=" + fieldCount);
+
+ // print column names
+ List metas = LibTaos.GetMeta(res);
+ for (int i = 0; i < metas.Count; i++)
+ {
+ Console.Write(metas[i].name + "\t");
+ }
+ Console.WriteLine();
+
+ // print values
+ List resData = LibTaos.GetData(res);
+ for (int i = 0; i < resData.Count; i++)
+ {
+ Console.Write($"|{resData[i].ToString()} \t");
+ if (((i + 1) % metas.Count == 0))
+ {
+ Console.WriteLine("");
+ }
+ }
+ Console.WriteLine();
+
+ // Free result after use
+ TDengine.FreeResult(res);
+ }
+ finally
+ {
+ TDengine.Close(conn);
+ }
+
+ }
+ static IntPtr GetConnection()
+ {
+ string host = "localhost";
+ short port = 6030;
+ string username = "root";
+ string password = "taosdata";
+ string dbname = "power";
+ var conn = TDengine.Connect(host, username, password, dbname, port);
+ if (conn == IntPtr.Zero)
+ {
+ throw new Exception("Connect to TDengine failed");
+ }
+ else
+ {
+ Console.WriteLine("Connect to TDengine success");
+ }
+ return conn;
+ }
+ }
+}
+
+// output:
+// Connect to TDengine success
+// fieldCount=6
+// ts current voltage phase location groupid
+// 1648432611249 10.3 219 0.31 California.SanFrancisco 2
+// 1648432611749 12.6 218 0.33 California.SanFrancisco 2
\ No newline at end of file
diff --git a/docs/examples/csharp/query.csproj b/docs/examples/csharp/query/query.csproj
similarity index 98%
rename from docs/examples/csharp/query.csproj
rename to docs/examples/csharp/query/query.csproj
index 39fc135d5ab9f5a8397b412e2307a2306abd4f2a..c97dbd3051e1a415b192e73d6753266b0b41b07d 100644
--- a/docs/examples/csharp/query.csproj
+++ b/docs/examples/csharp/query/query.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/docs/examples/csharp/sqlInsert/Program.cs b/docs/examples/csharp/sqlInsert/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f23a6e1663023d1d2fafb3e92e0b605f8ac55e52
--- /dev/null
+++ b/docs/examples/csharp/sqlInsert/Program.cs
@@ -0,0 +1,69 @@
+using TDengineDriver;
+
+
+namespace TDengineExample
+{
+ internal class SQLInsertExample
+ {
+
+ static void Main()
+ {
+ IntPtr conn = GetConnection();
+ try
+ {
+ IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
+ CheckRes(conn, res, "failed to create database");
+ res = TDengine.Query(conn, "USE power");
+ CheckRes(conn, res, "failed to change database");
+ res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
+ CheckRes(conn, res, "failed to create stable");
+ var sql = "INSERT INTO d1001 USING meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000) " +
+ "d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000) " +
+ "d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " +
+ "d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)";
+ res = TDengine.Query(conn, sql);
+ CheckRes(conn, res, "failed to insert data");
+ int affectedRows = TDengine.AffectRows(res);
+ Console.WriteLine("affectedRows " + affectedRows);
+ TDengine.FreeResult(res);
+ }
+ finally
+ {
+ TDengine.Close(conn);
+ }
+
+ }
+
+ static IntPtr GetConnection()
+ {
+ string host = "localhost";
+ short port = 6030;
+ string username = "root";
+ string password = "taosdata";
+ string dbname = "";
+ var conn = TDengine.Connect(host, username, password, dbname, port);
+ if (conn == IntPtr.Zero)
+ {
+ throw new Exception("Connect to TDengine failed");
+ }
+ else
+ {
+ Console.WriteLine("Connect to TDengine success");
+ }
+ return conn;
+ }
+
+ static void CheckRes(IntPtr conn, IntPtr res, String errorMsg)
+ {
+ if (TDengine.ErrorNo(res) != 0)
+ {
+ throw new Exception($"{errorMsg} since: {TDengine.Error(res)}");
+ }
+ }
+
+ }
+}
+
+// output:
+// Connect to TDengine success
+// affectedRows 8
diff --git a/docs/examples/csharp/sqlinsert.csproj b/docs/examples/csharp/sqlInsert/sqlinsert.csproj
similarity index 100%
rename from docs/examples/csharp/sqlinsert.csproj
rename to docs/examples/csharp/sqlInsert/sqlinsert.csproj
diff --git a/docs/examples/csharp/StmtInsertExample.cs b/docs/examples/csharp/stmtInsert/Program.cs
similarity index 52%
rename from docs/examples/csharp/StmtInsertExample.cs
rename to docs/examples/csharp/stmtInsert/Program.cs
index 0a4098091f6371a674eee6f158e1c57bff2b6862..87e1971feb8499c515206f05a1e916070ac57f4c 100644
--- a/docs/examples/csharp/StmtInsertExample.cs
+++ b/docs/examples/csharp/stmtInsert/Program.cs
@@ -9,45 +9,50 @@ namespace TDengineExample
static void Main()
{
conn = GetConnection();
- PrepareSTable();
- // 1. init and prepare
- stmt = TDengine.StmtInit(conn);
- if (stmt == IntPtr.Zero)
+ try
{
- Console.WriteLine("failed to init stmt, " + TDengine.Error(stmt));
- ExitProgram();
- }
- int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)");
- CheckStmtRes(res, "failed to prepare stmt");
+ PrepareSTable();
+ // 1. init and prepare
+ stmt = TDengine.StmtInit(conn);
+ if (stmt == IntPtr.Zero)
+ {
+ throw new Exception("failed to init stmt.");
+ }
+ int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)");
+ CheckStmtRes(res, "failed to prepare stmt");
- // 2. bind table name and tags
- TAOS_MULTI_BIND[] tags = new TAOS_MULTI_BIND[2] { TaosMultiBind.MultiBindBinary(new string[]{"California.SanFrancisco"}), TaosMultiBind.MultiBindInt(new int?[] {2}) };
- res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags);
- CheckStmtRes(res, "failed to bind table name and tags");
+ // 2. bind table name and tags
+ TAOS_MULTI_BIND[] tags = new TAOS_MULTI_BIND[2] { TaosMultiBind.MultiBindBinary(new string[] { "California.SanFrancisco" }), TaosMultiBind.MultiBindInt(new int?[] { 2 }) };
+ res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags);
+ CheckStmtRes(res, "failed to bind table name and tags");
- // 3. bind values
- TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] {
+ // 3. bind values
+ TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] {
TaosMultiBind.MultiBindTimestamp(new long[2] { 1648432611249, 1648432611749}),
TaosMultiBind.MultiBindFloat(new float?[2] { 10.3f, 12.6f}),
TaosMultiBind.MultiBindInt(new int?[2] { 219, 218}),
TaosMultiBind.MultiBindFloat(new float?[2]{ 0.31f, 0.33f})
};
- res = TDengine.StmtBindParamBatch(stmt, values);
- CheckStmtRes(res, "failed to bind params");
+ res = TDengine.StmtBindParamBatch(stmt, values);
+ CheckStmtRes(res, "failed to bind params");
- // 4. add batch
- res = TDengine.StmtAddBatch(stmt);
- CheckStmtRes(res, "failed to add batch");
+ // 4. add batch
+ res = TDengine.StmtAddBatch(stmt);
+ CheckStmtRes(res, "failed to add batch");
- // 5. execute
- res = TDengine.StmtExecute(stmt);
- CheckStmtRes(res, "faild to execute");
+ // 5. execute
+ res = TDengine.StmtExecute(stmt);
+ CheckStmtRes(res, "faild to execute");
+
+ // 6. free
+ TaosMultiBind.FreeTaosBind(tags);
+ TaosMultiBind.FreeTaosBind(values);
+ }
+ finally
+ {
+ TDengine.Close(conn);
+ }
- // 6. free
- TaosMultiBind.FreeTaosBind(tags);
- TaosMultiBind.FreeTaosBind(values);
- TDengine.Close(conn);
- TDengine.Cleanup();
}
static IntPtr GetConnection()
@@ -60,8 +65,7 @@ namespace TDengineExample
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
- Console.WriteLine("Connect to TDengine failed");
- Environment.Exit(0);
+ throw new Exception("Connect to TDengine failed");
}
else
{
@@ -70,8 +74,6 @@ namespace TDengineExample
return conn;
}
-
-
static void PrepareSTable()
{
IntPtr res = TDengine.Query(conn, "CREATE DATABASE power");
@@ -90,9 +92,8 @@ namespace TDengineExample
int code = TDengine.StmtClose(stmt);
if (code != 0)
{
- Console.WriteLine($"falied to close stmt, {code} reason: {TDengine.StmtErrorStr(stmt)} ");
+ throw new Exception($"falied to close stmt, {code} reason: {TDengine.StmtErrorStr(stmt)} ");
}
- ExitProgram();
}
}
@@ -100,16 +101,9 @@ namespace TDengineExample
{
if (TDengine.ErrorNo(res) != 0)
{
- Console.WriteLine(errorMsg + " since:" + TDengine.Error(res));
- ExitProgram();
+ throw new Exception(errorMsg + " since:" + TDengine.Error(res));
}
}
- static void ExitProgram()
- {
- TDengine.Close(conn);
- TDengine.Cleanup();
- Environment.Exit(1);
- }
}
}
diff --git a/docs/examples/csharp/stmtinsert.csproj b/docs/examples/csharp/stmtInsert/stmtinsert.csproj
similarity index 100%
rename from docs/examples/csharp/stmtinsert.csproj
rename to docs/examples/csharp/stmtInsert/stmtinsert.csproj
diff --git a/docs/examples/csharp/SubscribeDemo.cs b/docs/examples/csharp/subscribe/Program.cs
similarity index 90%
rename from docs/examples/csharp/SubscribeDemo.cs
rename to docs/examples/csharp/subscribe/Program.cs
index b62ff12e5ea38eb27ae5de8e8027aa41b1873d23..1fba209f22740e4efe5efb6996902159b2809035 100644
--- a/docs/examples/csharp/SubscribeDemo.cs
+++ b/docs/examples/csharp/subscribe/Program.cs
@@ -11,11 +11,10 @@ namespace TMQExample
{
IntPtr conn = GetConnection();
string topic = "topic_example";
- Console.WriteLine($"create topic if not exist {topic} as select * from meters");
//create topic
IntPtr res = TDengine.Query(conn, $"create topic if not exists {topic} as select * from meters");
-
- if (res == IntPtr.Zero)
+
+ if (TDengine.ErrorNo(res) != 0 )
{
throw new Exception($"create topic failed, reason:{TDengine.Error(res)}");
}
@@ -26,7 +25,7 @@ namespace TMQExample
TDConnectUser = "root",
TDConnectPasswd = "taosdata",
MsgWithTableName = "true",
- TDConnectIp = "127.0.0.1",
+ TDConnectIp = "127.0.0.1",
};
// create consumer
@@ -65,7 +64,6 @@ namespace TMQExample
List topics = consumer.Subscription();
topics.ForEach(t => Console.WriteLine("topic name:{0}", t));
-
// unsubscribe
consumer.Unsubscribe();
@@ -73,7 +71,6 @@ namespace TMQExample
consumer.Close();
TDengine.Close(conn);
-
}
static IntPtr GetConnection()
@@ -86,8 +83,7 @@ namespace TMQExample
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
- Console.WriteLine("Connect to TDengine failed");
- System.Environment.Exit(0);
+ throw new Exception("Connect to TDengine failed");
}
else
{
diff --git a/docs/examples/csharp/subscribe.csproj b/docs/examples/csharp/subscribe/subscribe.csproj
similarity index 98%
rename from docs/examples/csharp/subscribe.csproj
rename to docs/examples/csharp/subscribe/subscribe.csproj
index eff29b3bf42bde521aae70bfd1ed555ac72bfce9..8ae1cf6bc6023558c28797a0d9fcccb2f2e87653 100644
--- a/docs/examples/csharp/subscribe.csproj
+++ b/docs/examples/csharp/subscribe/subscribe.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/docs/examples/csharp/wsConnect/Program.cs b/docs/examples/csharp/wsConnect/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..2e89372c3e3dd23c16bad0362f494b2c64191cbc
--- /dev/null
+++ b/docs/examples/csharp/wsConnect/Program.cs
@@ -0,0 +1,25 @@
+using System;
+using TDengineWS.Impl;
+
+namespace Examples
+{
+ public class WSConnExample
+ {
+ static void Main(string[] args)
+ {
+ string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
+ IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
+ if (wsConn == IntPtr.Zero)
+ {
+ throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
+ }
+ else
+ {
+ Console.WriteLine("Establish connect success.");
+ }
+
+ // close connection.
+ LibTaosWS.WSClose(wsConn);
+ }
+ }
+}
\ No newline at end of file
diff --git a/docs/examples/csharp/wsConnect/wsConnect.csproj b/docs/examples/csharp/wsConnect/wsConnect.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..34951dc761903e5a4b7a4bec5dfe55a965ab88be
--- /dev/null
+++ b/docs/examples/csharp/wsConnect/wsConnect.csproj
@@ -0,0 +1,13 @@
+
+
+
+ Exe
+ net5.0
+ enable
+
+
+
+
+
+
+
diff --git a/docs/examples/csharp/wsInsert/Program.cs b/docs/examples/csharp/wsInsert/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4cd812cda916308f80f7bf2001d38046434056c1
--- /dev/null
+++ b/docs/examples/csharp/wsInsert/Program.cs
@@ -0,0 +1,58 @@
+using System;
+using TDengineWS.Impl;
+
+namespace Examples
+{
+ public class WSInsertExample
+ {
+ static void Main(string[] args)
+ {
+ string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
+ IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
+
+ // Assert if connection is validate
+ if (wsConn == IntPtr.Zero)
+ {
+ throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
+ }
+ else
+ {
+ Console.WriteLine("Establish connect success.");
+ }
+
+ string createTable = "CREATE STABLE test.meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);";
+ string insert = "INSERT INTO test.d1001 USING test.meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000)" +
+ "test.d1002 USING test.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000)" +
+ "test.d1003 USING test.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " +
+ "test.d1004 USING test.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)";
+
+ IntPtr wsRes = LibTaosWS.WSQuery(wsConn, createTable);
+ ValidInsert("create table", wsRes);
+ LibTaosWS.WSFreeResult(wsRes);
+
+ wsRes = LibTaosWS.WSQuery(wsConn, insert);
+ ValidInsert("insert data", wsRes);
+ LibTaosWS.WSFreeResult(wsRes);
+
+ // close connection.
+ LibTaosWS.WSClose(wsConn);
+ }
+
+ static void ValidInsert(string desc, IntPtr wsRes)
+ {
+ int code = LibTaosWS.WSErrorNo(wsRes);
+ if (code != 0)
+ {
+ throw new Exception($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
+ }
+ else
+ {
+ Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes), LibTaosWS.WSAffectRows(wsRes));
+ }
+ }
+ }
+
+}
+// Establish connect success.
+// create table success affect 0 rows, cost 3717542 nanoseconds
+// insert data success affect 8 rows, cost 2613637 nanoseconds
\ No newline at end of file
diff --git a/docs/examples/csharp/wsInsert/wsInsert.csproj b/docs/examples/csharp/wsInsert/wsInsert.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..34951dc761903e5a4b7a4bec5dfe55a965ab88be
--- /dev/null
+++ b/docs/examples/csharp/wsInsert/wsInsert.csproj
@@ -0,0 +1,13 @@
+
+
+
+ Exe
+ net5.0
+ enable
+
+
+
+
+
+
+
diff --git a/docs/examples/csharp/wsQuery/Program.cs b/docs/examples/csharp/wsQuery/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..de5591aa536655606547cf8998145025642989cd
--- /dev/null
+++ b/docs/examples/csharp/wsQuery/Program.cs
@@ -0,0 +1,74 @@
+using System;
+using TDengineWS.Impl;
+using System.Collections.Generic;
+using TDengineDriver;
+
+namespace Examples
+{
+ public class WSQueryExample
+ {
+ static void Main(string[] args)
+ {
+ string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
+ IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
+ if (wsConn == IntPtr.Zero)
+ {
+ throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
+ }
+ else
+ {
+ Console.WriteLine("Establish connect success.");
+ }
+
+ string select = "select * from test.meters";
+
+ // optional:wsRes = LibTaosWS.WSQuery(wsConn, select);
+ IntPtr wsRes = LibTaosWS.WSQueryTimeout(wsConn, select, 1);
+ // Assert if query execute success.
+ int code = LibTaosWS.WSErrorNo(wsRes);
+ if (code != 0)
+ {
+ throw new Exception($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}");
+ }
+
+ // get meta data
+ List metas = LibTaosWS.WSGetFields(wsRes);
+ // get retrieved data
+ List dataSet = LibTaosWS.WSGetData(wsRes);
+
+ // do something with result.
+ foreach (var meta in metas)
+ {
+ Console.Write("{0} {1}({2}) \t|\t", meta.name, meta.TypeName(), meta.size);
+ }
+ Console.WriteLine("");
+
+ for (int i = 0; i < dataSet.Count;)
+ {
+ for (int j = 0; j < metas.Count; j++)
+ {
+ Console.Write("{0}\t|\t", dataSet[i]);
+ i++;
+ }
+ Console.WriteLine("");
+ }
+
+ // Free result after use.
+ LibTaosWS.WSFreeResult(wsRes);
+
+ // close connection.
+ LibTaosWS.WSClose(wsConn);
+ }
+ }
+}
+
+// Establish connect success.
+// ts TIMESTAMP(8) | current FLOAT(4) | voltage INT(4) | phase FLOAT(4) | location BINARY(64) | groupid INT(4) |
+// 1538548685000 | 10.8 | 223 | 0.29 | California.LosAngeles | 3 |
+// 1538548686500 | 11.5 | 221 | 0.35 | California.LosAngeles | 3 |
+// 1538548685500 | 11.8 | 221 | 0.28 | California.LosAngeles | 2 |
+// 1538548696600 | 13.4 | 223 | 0.29 | California.LosAngeles | 2 |
+// 1538548685000 | 10.3 | 219 | 0.31 | California.SanFrancisco | 2 |
+// 1538548695000 | 12.6 | 218 | 0.33 | California.SanFrancisco | 2 |
+// 1538548696800 | 12.3 | 221 | 0.31 | California.SanFrancisco | 2 |
+// 1538548696650 | 10.3 | 218 | 0.25 | California.SanFrancisco | 3 |
\ No newline at end of file
diff --git a/docs/examples/csharp/wsQuery/wsQuery.csproj b/docs/examples/csharp/wsQuery/wsQuery.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..34951dc761903e5a4b7a4bec5dfe55a965ab88be
--- /dev/null
+++ b/docs/examples/csharp/wsQuery/wsQuery.csproj
@@ -0,0 +1,13 @@
+
+
+
+ Exe
+ net5.0
+ enable
+
+
+
+
+
+
+
diff --git a/docs/examples/csharp/wsStmt/Program.cs b/docs/examples/csharp/wsStmt/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..54de77ec1f98deaf14fd2ad9ca0acd57e6b38f63
--- /dev/null
+++ b/docs/examples/csharp/wsStmt/Program.cs
@@ -0,0 +1,95 @@
+using System;
+using TDengineWS.Impl;
+using TDengineDriver;
+using System.Runtime.InteropServices;
+
+namespace Examples
+{
+ public class WSStmtExample
+ {
+ static void Main(string[] args)
+ {
+ const string DSN = "ws://root:taosdata@127.0.0.1:6041/test";
+ const string table = "meters";
+ const string database = "test";
+ const string childTable = "d1005";
+ string insert = $"insert into ? using {database}.{table} tags(?,?) values(?,?,?,?)";
+ const int numOfTags = 2;
+ const int numOfColumns = 4;
+
+ // Establish connection
+ IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN);
+ if (wsConn == IntPtr.Zero)
+ {
+ throw new Exception($"get WS connection failed,reason:{LibTaosWS.WSErrorStr(IntPtr.Zero)} code:{LibTaosWS.WSErrorNo(IntPtr.Zero)}");
+ }
+ else
+ {
+ Console.WriteLine("Establish connect success...");
+ }
+
+ // init stmt
+ IntPtr wsStmt = LibTaosWS.WSStmtInit(wsConn);
+ if (wsStmt != IntPtr.Zero)
+ {
+ int code = LibTaosWS.WSStmtPrepare(wsStmt, insert);
+ ValidStmtStep(code, wsStmt, "WSStmtPrepare");
+
+ TAOS_MULTI_BIND[] wsTags = new TAOS_MULTI_BIND[] { WSMultiBind.WSBindNchar(new string[] { "California.SanDiego" }), WSMultiBind.WSBindInt(new int?[] { 4 }) };
+ code = LibTaosWS.WSStmtSetTbnameTags(wsStmt, $"{database}.{childTable}", wsTags, numOfTags);
+ ValidStmtStep(code, wsStmt, "WSStmtSetTbnameTags");
+
+ TAOS_MULTI_BIND[] data = new TAOS_MULTI_BIND[4];
+ data[0] = WSMultiBind.WSBindTimestamp(new long[] { 1538548687000, 1538548688000, 1538548689000, 1538548690000, 1538548691000 });
+ data[1] = WSMultiBind.WSBindFloat(new float?[] { 10.30F, 10.40F, 10.50F, 10.60F, 10.70F });
+ data[2] = WSMultiBind.WSBindInt(new int?[] { 223, 221, 222, 220, 219 });
+ data[3] = WSMultiBind.WSBindFloat(new float?[] { 0.31F, 0.32F, 0.33F, 0.35F, 0.28F });
+ code = LibTaosWS.WSStmtBindParamBatch(wsStmt, data, numOfColumns);
+ ValidStmtStep(code, wsStmt, "WSStmtBindParamBatch");
+
+ code = LibTaosWS.WSStmtAddBatch(wsStmt);
+ ValidStmtStep(code, wsStmt, "WSStmtAddBatch");
+
+ IntPtr stmtAffectRowPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int32)));
+ code = LibTaosWS.WSStmtExecute(wsStmt, stmtAffectRowPtr);
+ ValidStmtStep(code, wsStmt, "WSStmtExecute");
+ Console.WriteLine("WS STMT insert {0} rows...", Marshal.ReadInt32(stmtAffectRowPtr));
+ Marshal.FreeHGlobal(stmtAffectRowPtr);
+
+ LibTaosWS.WSStmtClose(wsStmt);
+
+ // Free unmanaged memory
+ WSMultiBind.WSFreeTaosBind(wsTags);
+ WSMultiBind.WSFreeTaosBind(data);
+
+ //check result with SQL "SELECT * FROM test.d1005;"
+ }
+ else
+ {
+ throw new Exception("Init STMT failed...");
+ }
+
+ // close connection.
+ LibTaosWS.WSClose(wsConn);
+ }
+
+ static void ValidStmtStep(int code, IntPtr wsStmt, string desc)
+ {
+ if (code != 0)
+ {
+ throw new Exception($"{desc} failed,reason: {LibTaosWS.WSErrorStr(wsStmt)}, code: {code}");
+ }
+ else
+ {
+ Console.WriteLine("{0} success...", desc);
+ }
+ }
+ }
+}
+
+// WSStmtPrepare success...
+// WSStmtSetTbnameTags success...
+// WSStmtBindParamBatch success...
+// WSStmtAddBatch success...
+// WSStmtExecute success...
+// WS STMT insert 5 rows...
\ No newline at end of file
diff --git a/docs/examples/csharp/wsStmt/wsStmt.csproj b/docs/examples/csharp/wsStmt/wsStmt.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..34951dc761903e5a4b7a4bec5dfe55a965ab88be
--- /dev/null
+++ b/docs/examples/csharp/wsStmt/wsStmt.csproj
@@ -0,0 +1,13 @@
+
+
+
+ Exe
+ net5.0
+ enable
+
+
+
+
+
+
+
diff --git a/docs/zh/07-develop/01-connect/_connect_cs.mdx b/docs/zh/07-develop/01-connect/_connect_cs.mdx
index 13b8a5dff250e6143fbed3090ba1f35e74adb9a0..169bf37a636276a4d94c7b7faba4f7896c42e007 100644
--- a/docs/zh/07-develop/01-connect/_connect_cs.mdx
+++ b/docs/zh/07-develop/01-connect/_connect_cs.mdx
@@ -1,8 +1,8 @@
```csharp title="原生连接"
-{{#include docs/examples/csharp/ConnectExample.cs}}
+{{#include docs/examples/csharp/connect/Program.cs}}
```
-:::info
-C# 连接器目前只支持原生连接。
+```csharp title="WebSocket 连接"
+{{#include docs/examples/csharp/wsConnect/Program.cs}}
+```
-:::
diff --git a/docs/zh/07-develop/03-insert-data/_cs_line.mdx b/docs/zh/07-develop/03-insert-data/_cs_line.mdx
index 71f46c62be3dfe7d771a35b2298e476bed353aba..ae49901c3ac0a34218def4b1e12702e79960d0b6 100644
--- a/docs/zh/07-develop/03-insert-data/_cs_line.mdx
+++ b/docs/zh/07-develop/03-insert-data/_cs_line.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/InfluxDBLineExample.cs}}
+{{#include docs/examples/csharp/influxdbLine/Program.cs}}
```
diff --git a/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx b/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx
index 8d80d042c984c513df5ca91813c0cd0a17b58eb5..2627648616b9ac8c92e0d76097d517c066232ef2 100644
--- a/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx
+++ b/docs/zh/07-develop/03-insert-data/_cs_opts_json.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/OptsJsonExample.cs}}
+{{#include docs/examples/csharp/optsJSON/Program.cs}}
```
diff --git a/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx b/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx
index cff32abf1feaf703971111542749fbe40152bc33..660db13fd1816150880883cf801ff50019fbae8d 100644
--- a/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx
+++ b/docs/zh/07-develop/03-insert-data/_cs_opts_telnet.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/OptsTelnetExample.cs}}
+{{#include docs/examples/csharp/optsTelnet/Program.cs}}
```
diff --git a/docs/zh/07-develop/03-insert-data/_cs_sql.mdx b/docs/zh/07-develop/03-insert-data/_cs_sql.mdx
index 1dc7bb3d1366aa3000212786756506eb5eb280e6..42a6bc4315393de0b2cba37caffbfbc1c07b952b 100644
--- a/docs/zh/07-develop/03-insert-data/_cs_sql.mdx
+++ b/docs/zh/07-develop/03-insert-data/_cs_sql.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/SQLInsertExample.cs}}
+{{#include docs/examples/csharp/sqlInsert/Program.cs}}
```
diff --git a/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx b/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx
index 229c874ab9f515e7eae66890a3dfe2e59c129e86..d8d73ca15ebdce28a40a6c922293493679491e97 100644
--- a/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx
+++ b/docs/zh/07-develop/03-insert-data/_cs_stmt.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/StmtInsertExample.cs}}
+{{#include docs/examples/csharp/stmtInsert/Program.cs}}
```
diff --git a/docs/zh/07-develop/04-query-data/_cs.mdx b/docs/zh/07-develop/04-query-data/_cs.mdx
index 4bb582ecbfaeceac679af975e7752d1caeacb018..745ab368115ca0dfbaff1f3a326abfd9bed02430 100644
--- a/docs/zh/07-develop/04-query-data/_cs.mdx
+++ b/docs/zh/07-develop/04-query-data/_cs.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/QueryExample.cs}}
+{{#include docs/examples/csharp/query/Program.cs}}
```
diff --git a/docs/zh/07-develop/04-query-data/_cs_async.mdx b/docs/zh/07-develop/04-query-data/_cs_async.mdx
index 3ecf635fd39db402d1db68de6d7336b7b2d9d8e8..19c8e58f32ed3598b5ccb953085b97ef2e4ce067 100644
--- a/docs/zh/07-develop/04-query-data/_cs_async.mdx
+++ b/docs/zh/07-develop/04-query-data/_cs_async.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/AsyncQueryExample.cs}}
+{{#include docs/examples/csharp/asyncQuery/Program.cs}}
```
diff --git a/docs/zh/07-develop/06-stream.md b/docs/zh/07-develop/06-stream.md
index d5296582d500e3271130bc1bfc6de34492133a8a..c9f1b1d43a3b8666e747db80b5e34473f45f0675 100644
--- a/docs/zh/07-develop/06-stream.md
+++ b/docs/zh/07-develop/06-stream.md
@@ -52,7 +52,7 @@ CREATE TABLE d1004 USING meters TAGS ("California.LosAngeles", 3);
### 创建流
```sql
-create stream current_stream into current_stream_output_stb as select _wstart as start, _wend as end, max(current) as max_current from meters where voltage <= 220 interval (5s);
+create stream current_stream into current_stream_output_stb as select _wstart as start, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);
```
### 写入数据
@@ -71,7 +71,7 @@ insert into d1004 values("2018-10-03 14:38:06.500", 11.50000, 221, 0.35000);
```sql
taos> select start, end, max_current from current_stream_output_stb;
- start | end | max_current |
+ start | wend | max_current |
===========================================================================
2018-10-03 14:38:05.000 | 2018-10-03 14:38:10.000 | 10.30000 |
2018-10-03 14:38:15.000 | 2018-10-03 14:38:20.000 | 12.60000 |
diff --git a/docs/zh/07-develop/_sub_cs.mdx b/docs/zh/07-develop/_sub_cs.mdx
index a435ea0273c94cbe75eaf7431e1a9c39d49d92e3..093b617e9bb9c7da7bc9392f91316b9f3342bae6 100644
--- a/docs/zh/07-develop/_sub_cs.mdx
+++ b/docs/zh/07-develop/_sub_cs.mdx
@@ -1,3 +1,3 @@
```csharp
-{{#include docs/examples/csharp/SubscribeDemo.cs}}
+{{#include docs/examples/csharp/subscribe/Program.cs}}
```
\ No newline at end of file
diff --git a/docs/zh/08-connector/26-rust.mdx b/docs/zh/08-connector/26-rust.mdx
index b838e5c5a2f5c33f09dce6cf1a8d5f61ddc5f264..f6b99beed3b33a4b34208445c516db689b9875fb 100644
--- a/docs/zh/08-connector/26-rust.mdx
+++ b/docs/zh/08-connector/26-rust.mdx
@@ -116,7 +116,7 @@ DSN 描述字符串基本结构如下:
- **protocol**: 显示指定以何种方式建立连接,例如:`taos+ws://localhost:6041` 指定以 Websocket 方式建立连接。
- **username/password**: 用于创建连接的用户名及密码。
- **host/port**: 指定创建连接的服务器及端口,当不指定服务器地址及端口时(`taos://`),原生连接默认为 `localhost:6030`,Websocket 连接默认为 `localhost:6041` 。
-- **database**: 指定默认连接的数据库名。
+- **database**: 指定默认连接的数据库名,可选参数。
- **params**:其他可选参数。
一个完整的 DSN 描述字符串示例如下:
diff --git a/docs/zh/08-connector/40-csharp.mdx b/docs/zh/08-connector/40-csharp.mdx
index 4e49d84835d66622293e607a58699ae93fc7013d..e99f41ae9cb0a97426878e3efb8cb85d66af4929 100644
--- a/docs/zh/08-connector/40-csharp.mdx
+++ b/docs/zh/08-connector/40-csharp.mdx
@@ -17,7 +17,7 @@ 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](../rest-api/) 文档自行编写。
+`TDengine.Connector` 连接器支持通过 TDengine 客户端驱动(taosc)建立与 TDengine 运行实例的连接,提供数据写入、查询、数据订阅、schemaless 数据写入、参数绑定接口数据写入等功能。 `TDengine.Connector` 还支持 WebSocket,通过 DSN 建立 WebSocket 连接,提供数据写入、查询、参数绑定接口数据写入等功能。
本文介绍如何在 Linux 或 Windows 环境中安装 `TDengine.Connector`,并通过 `TDengine.Connector` 连接 TDengine 集群,进行数据写入、查询等基本操作。
@@ -35,12 +35,29 @@ import CSAsyncQuery from "../07-develop/04-query-data/_cs_async.mdx"
## 支持的功能特性
+
+
+
+
1. 连接管理
2. 普通查询
3. 连续查询
4. 参数绑定
-5. 订阅功能
+5. 数据订阅(TMQ)
6. Schemaless
+
+
+
+
+
+1. 连接管理
+2. 普通查询
+3. 连续查询
+4. 参数绑定
+
+
+
+
## 安装步骤
@@ -79,7 +96,13 @@ dotnet add exmaple.csproj reference src/TDengine.csproj
## 建立连接
-``` C#
+
+
+
+
+使用 host、username、password、port 等信息建立连接。
+
+``` csharp
using TDengineDriver;
namespace TDengineExample
@@ -109,17 +132,63 @@ namespace TDengineExample
}
}
}
+```
+
+
+
+
+使用 DSN 建立 WebSocket 连接 DSN 连接。 描述字符串基本结构如下:
+
+```text
+[]://[[:@]:][/][?=[&=]]
+|------------|---|-----------|-----------|------|------|------------|-----------------------|
+| protocol | | username | password | host | port | database | params |
+```
+
+各部分意义见下表:
+
+* **protocol**: 显示指定以何种方式建立连接,例如:`ws://localhost:6041` 指定以 Websocket 方式建立连接(支持http/ws)。
+
+* **username/password**: 用于创建连接的用户名及密码(默认`root/taosdata`)。
+
+* **host/port**: 指定创建连接的服务器及端口,WebSocket 连接默认为 `localhost:6041` 。
+
+* **database**: 指定默认连接的数据库名,可选参数。
+
+* **params**:其他可选参数。
+
+``` csharp
+{{#include docs/examples/csharp/wsConnect/Program.cs}}
```
+
+
+
## 使用示例
### 写入数据
#### SQL 写入
+
+
+
+
+
+
+
+
+```csharp
+{{#include docs/examples/csharp/wsInsert/Program.cs}}
+```
+
+
+
+
+
#### InfluxDB 行协议写入
@@ -132,12 +201,50 @@ namespace TDengineExample
+#### 参数绑定
+
+
+
+
+
+``` csharp
+{{#include docs/examples/csharp/stmtInsert/Program.cs}}
+```
+
+
+
+
+
+```csharp
+{{#include docs/examples/csharp/wsStmt/Program.cs}}
+```
+
+
+
+
+
### 查询数据
#### 同步查询
+
+
+
+
+
+
+
+
+```csharp
+{{#include docs/examples/csharp/wsQuery/Program.cs}}
+```
+
+
+
+
+
#### 异步查询
@@ -151,12 +258,15 @@ namespace TDengineExample
| [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/Stmt) | 使用 TDengine.Connector 实现的参数绑定插入和查询的示例 |
| [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/schemaless) | 使用 TDengine.Connector 实现的使用 schemaless 写入的示例 |
| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/AsyncQuery/QueryAsync.cs) | 使用 TDengine.Connector 实现的异步查询的示例 |
-| [TMQ](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | 使用 TDengine.Connector 实现的订阅数据的示例 |
+| [数据订阅(TMQ)](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | 使用 TDengine.Connector 实现的订阅数据的示例 |
+| [Basic WebSocket Usage](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSample.cs) | 使用 TDengine.Connector 的 WebSocket 基本的示例 |
+| [Basic WebSocket STMT](https://github.com/taosdata/taos-connector-dotnet/blob/5a4a7cd0dbcda114447cdc6d0c6dedd8e84a52da/examples/WS/WebSocketSTMT.cs) | 使用 TDengine.Connector 的 WebSocket STMT 基本的示例 |
## 重要更新记录
| TDengine.Connector | 说明 |
|--------------------|--------------------------------|
+| 3.0.1 | 支持 WebSocket 和 Cloud,查询,插入,参数绑定。 |
| 3.0.0 | 支持 TDengine 3.0.0.0,不兼容 2.x。新增接口TDengine.Impl.GetData(),解析查询结果。 |
| 1.0.7 | 修复 TDengine.Query()内存泄露。 |
| 1.0.6 | 修复 schemaless 在 1.0.4 和 1.0.5 中失效 bug。 |
diff --git a/docs/zh/12-taos-sql/01-data-type.md b/docs/zh/12-taos-sql/01-data-type.md
index ee7b3a4715a11346b9a06da20dbc93ef309c0a3d..128fa20930d1b94b905a20fd1dde853d63e2b0c4 100644
--- a/docs/zh/12-taos-sql/01-data-type.md
+++ b/docs/zh/12-taos-sql/01-data-type.md
@@ -1,7 +1,7 @@
---
sidebar_label: 数据类型
title: 数据类型
-description: "TDengine 支持的数据类型: 时间戳、浮点型、JSON 类型等"
+description: 'TDengine 支持的数据类型: 时间戳、浮点型、JSON 类型等'
---
## 时间戳
@@ -9,64 +9,65 @@ description: "TDengine 支持的数据类型: 时间戳、浮点型、JSON 类
使用 TDengine,最重要的是时间戳。创建并插入记录、查询历史记录的时候,均需要指定时间戳。时间戳有如下规则:
- 时间格式为 `YYYY-MM-DD HH:mm:ss.MS`,默认时间分辨率为毫秒。比如:`2017-08-12 18:25:58.128`
-- 内部函数 now 是客户端的当前时间
-- 插入记录时,如果时间戳为 now,插入数据时使用提交这条记录的客户端的当前时间
-- 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 (自然年)。
+- 内部函数 NOW 是客户端的当前时间
+- 插入记录时,如果时间戳为 NOW,插入数据时使用提交这条记录的客户端的当前时间
+- 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 参数也可以支持微秒和纳秒。
+TDengine 缺省的时间戳精度是毫秒,但通过在 `CREATE DATABASE` 时传递的 `PRECISION` 参数也可以支持微秒和纳秒。
```sql
CREATE DATABASE db_name PRECISION 'ns';
```
+
## 数据类型
在 TDengine 中,普通表的数据模型中可使用以下数据类型。
-| # | **类型** | **Bytes** | **说明** |
-| --- | :-------: | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| 1 | TIMESTAMP | 8 | 时间戳。缺省精度毫秒,可支持微秒和纳秒,详细说明见上节。 |
-| 2 | INT | 4 | 整型,范围 [-2^31, 2^31-1] |
-| 3 | INT UNSIGNED| 4| 无符号整数,[0, 2^32-1]
-| 4 | BIGINT | 8 | 长整型,范围 [-2^63, 2^63-1] |
-| 5 | BIGINT UNSIGNED | 8 | 长整型,范围 [0, 2^64-1] |
-| 6 | FLOAT | 4 | 浮点型,有效位数 6-7,范围 [-3.4E38, 3.4E38] |
-| 7 | DOUBLE | 8 | 双精度浮点型,有效位数 15-16,范围 [-1.7E308, 1.7E308] |
-| 8 | BINARY | 自定义 | 记录单字节字符串,建议只用于处理 ASCII 可见字符,中文等多字节字符需使用 nchar。 |
-| 9 | SMALLINT | 2 | 短整型, 范围 [-32768, 32767] |
-| 10 | SMALLINT UNSIGNED | 2| 无符号短整型,范围 [0, 65535] |
-| 11 | TINYINT | 1 | 单字节整型,范围 [-128, 127] |
-| 12 | TINYINT UNSIGNED | 1 | 无符号单字节整型,范围 [0, 255] |
-| 13 | BOOL | 1 | 布尔型,{true, false} |
-| 14 | NCHAR | 自定义 | 记录包含多字节字符在内的字符串,如中文字符。每个 nchar 字符占用 4 bytes 的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\’`。nchar 使用时须指定字符串大小,类型为 nchar(10) 的列表示此列的字符串最多存储 10 个 nchar 字符,会固定占用 40 bytes 的空间。如果用户字符串长度超出声明长度,将会报错。 |
-| 15 | JSON | | json 数据类型, 只有 tag 可以是 json 格式 |
-| 16 | VARCHAR | 自定义 | BINARY类型的别名 |
-
+| # | **类型** | **Bytes** | **说明** |
+| --- | :---------------: | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 1 | TIMESTAMP | 8 | 时间戳。缺省精度毫秒,可支持微秒和纳秒,详细说明见上节。 |
+| 2 | INT | 4 | 整型,范围 [-2^31, 2^31-1] |
+| 3 | INT UNSIGNED | 4 | 无符号整数,[0, 2^32-1] |
+| 4 | BIGINT | 8 | 长整型,范围 [-2^63, 2^63-1] |
+| 5 | BIGINT UNSIGNED | 8 | 长整型,范围 [0, 2^64-1] |
+| 6 | FLOAT | 4 | 浮点型,有效位数 6-7,范围 [-3.4E38, 3.4E38] |
+| 7 | DOUBLE | 8 | 双精度浮点型,有效位数 15-16,范围 [-1.7E308, 1.7E308] |
+| 8 | BINARY | 自定义 | 记录单字节字符串,建议只用于处理 ASCII 可见字符,中文等多字节字符需使用 NCHAR |
+| 9 | SMALLINT | 2 | 短整型, 范围 [-32768, 32767] |
+| 10 | SMALLINT UNSIGNED | 2 | 无符号短整型,范围 [0, 65535] |
+| 11 | TINYINT | 1 | 单字节整型,范围 [-128, 127] |
+| 12 | TINYINT UNSIGNED | 1 | 无符号单字节整型,范围 [0, 255] |
+| 13 | BOOL | 1 | 布尔型,{true, false} |
+| 14 | NCHAR | 自定义 | 记录包含多字节字符在内的字符串,如中文字符。每个 NCHAR 字符占用 4 字节的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\'`。NCHAR 使用时须指定字符串大小,类型为 NCHAR(10) 的列表示此列的字符串最多存储 10 个 NCHAR 字符,会固定占用 40 字节的空间。如果用户字符串长度超出声明长度,将会报错。 |
+| 15 | JSON | | JSON 数据类型, 只有 Tag 可以是 JSON 格式 |
+| 16 | VARCHAR | 自定义 | BINARY 类型的别名 |
:::note
-- TDengine 对 SQL 语句中的英文字符不区分大小写,自动转化为小写执行。因此用户大小写敏感的字符串及密码,需要使用单引号将字符串引起来。
+
- 虽然 BINARY 类型在底层存储上支持字节型的二进制字符,但不同编程语言对二进制数据的处理方式并不保证一致,因此建议在 BINARY 类型中只存储 ASCII 可见字符,而避免存储不可见字符。多字节的数据,例如中文字符,则需要使用 NCHAR 类型进行保存。如果强行使用 BINARY 类型保存中文字符,虽然有时也能正常读写,但并不带有字符集信息,很容易出现数据乱码甚至数据损坏等情况。
-- BINARY 类型理论上最长可以有 16374 字节。binary 仅支持字符串输入,字符串两端需使用单引号引用。使用时须指定大小,如 binary(20) 定义了最长为 20 个单字节字符的字符串,每个字符占 1 byte 的存储空间,总共固定占用 20 bytes 的空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\’`。
+- BINARY 类型理论上最长可以有 16,374 字节。BINARY 仅支持字符串输入,字符串两端需使用单引号引用。使用时须指定大小,如 BINARY(20) 定义了最长为 20 个单字节字符的字符串,每个字符占 1 字节的存储空间,总共固定占用 20 字节的空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\'`。
- SQL 语句中的数值类型将依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999 会认为超过长整型的上边界而溢出,而 9999999999999999999.0 会被认为是有效的浮点数。
:::
-
## 常量
-TDengine支持多个类型的常量,细节如下表:
-
-| # | **语法** | **类型** | **说明** |
-| --- | :-------: | --------- | -------------------------------------- |
-| 1 | [{+ \| -}]123 | BIGINT | 整型数值的字面量的类型均为BIGINT。如果用户输入超过了BIGINT的表示范围,TDengine 按BIGINT对数值进行截断。|
-| 2 | 123.45 | DOUBLE | 浮点数值的字面量的类型均为DOUBLE。TDengine依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型。|
-| 3 | 1.2E3 | DOUBLE | 科学计数法的字面量的类型为DOUBLE。|
-| 4 | 'abc' | BINARY | 单引号括住的内容为字符串字面值,其类型为BINARY,BINARY的size为实际的字符个数。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 \'。|
-| 5 | "abc" | BINARY | 双引号括住的内容为字符串字面值,其类型为BINARY,BINARY的size为实际的字符个数。对于字符串内的双引号,可以用转义字符反斜线加单引号来表示,即 \"。 |
-| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | TIMESTAMP关键字表示后面的字符串字面量需要被解释为TIMESTAMP类型。字符串需要满足YYYY-MM-DD HH:mm:ss.MS格式,其时间分辨率为当前数据库的时间分辨率。 |
-| 7 | {TRUE \| FALSE} | BOOL | 布尔类型字面量。 |
-| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | 空值字面量。可以用于任意类型。|
+
+TDengine 支持多个类型的常量,细节如下表:
+
+| # | **语法** | **类型** | **说明** |
+| --- | :-----------------------------------------------: | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 1 | [{+ \| -}]123 | BIGINT | 整型数值的字面量的类型均为 BIGINT。如果用户输入超过了 BIGINT 的表示范围,TDengine 按 BIGINT 对数值进行截断。 |
+| 2 | 123.45 | DOUBLE | 浮点数值的字面量的类型均为 DOUBLE。TDengine 依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型。 |
+| 3 | 1.2E3 | DOUBLE | 科学计数法的字面量的类型为 DOUBLE。 |
+| 4 | 'abc' | BINARY | 单引号括住的内容为字符串字面值,其类型为 BINARY,BINARY 的 Size 为实际的字符个数。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\'`。 |
+| 5 | "abc" | BINARY | 双引号括住的内容为字符串字面值,其类型为 BINARY,BINARY 的 Size 为实际的字符个数。对于字符串内的双引号,可以用转义字符反斜线加单引号来表示,即 `\"`。 |
+| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | TIMESTAMP 关键字表示后面的字符串字面量需要被解释为 TIMESTAMP 类型。字符串需要满足 YYYY-MM-DD HH:mm:ss.MS 格式,其时间分辨率为当前数据库的时间分辨率。 |
+| 7 | {TRUE \| FALSE} | BOOL | 布尔类型字面量。 |
+| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | 空值字面量。可以用于任意类型。 |
:::note
-- TDengine依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999会认为超过长整型的上边界而溢出,而9999999999999999999.0会被认为是有效的浮点数。
+
+- TDengine 依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999 会认为超过长整型的上边界而溢出,而 9999999999999999999.0 会被认为是有效的浮点数。
:::
diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md
index 5841904e612cb11a77d3038c411b451ef338d467..394e4a99d59aa3a1a59c2cb483bb2eefd71e44db 100644
--- a/docs/zh/12-taos-sql/06-select.md
+++ b/docs/zh/12-taos-sql/06-select.md
@@ -69,7 +69,7 @@ order_expr:
### 通配符
-通配符 \* 可以用于代指全部列。对于普通表,结果中只有普通列。对于超级表和子表,还包含了 TAG 列。
+通配符 \* 可以用于代指全部列。对于普通表和子表,结果中只有普通列。对于超级表,还包含了 TAG 列。
```sql
SELECT * FROM d1001;
diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md
index 86e9aaa80fdebecbd390ae231437491530d6c2b5..9726406b4d875de3e859c979e013630d496fb468 100644
--- a/docs/zh/12-taos-sql/10-function.md
+++ b/docs/zh/12-taos-sql/10-function.md
@@ -1233,7 +1233,7 @@ SELECT SERVER_VERSION();
### SERVER_STATUS
```sql
-SELECT SERVER_VERSION();
+SELECT SERVER_STATUS();
```
**说明**:返回服务端当前的状态。
diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md
index 7b31e10572c4a6bafd088e7b7c14853ee0d32df1..179a3c6df0d5966d1eefa87e3393eae774f4387f 100644
--- a/docs/zh/14-reference/12-config/index.md
+++ b/docs/zh/14-reference/12-config/index.md
@@ -325,7 +325,7 @@ charset 的有效值是 UTF-8。
| 适用范围 | 仅服务端适用 |
| 含义 | dnode 支持的最大 vnode 数目 |
| 取值范围 | 0-4096 |
-| 缺省值 | 256 |
+| 缺省值 | CPU 核数的 2 倍 |
## 时间相关
@@ -668,153 +668,154 @@ charset 的有效值是 UTF-8。
| 15 | telemetryPort | 否 | 是 |
| 16 | queryPolicy | 否 | 是 |
| 17 | querySmaOptimize | 否 | 是 |
-| 18 | queryBufferSize | 是 | 是 |
-| 19 | maxNumOfDistinctRes | 是 | 是 |
-| 20 | minSlidingTime | 是 | 是 |
-| 21 | minIntervalTime | 是 | 是 |
-| 22 | countAlwaysReturnValue | 是 | 是 |
-| 23 | dataDir | 是 | 是 |
-| 24 | minimalDataDirGB | 是 | 是 |
-| 25 | supportVnodes | 否 | 是 |
-| 26 | tempDir | 是 | 是 |
-| 27 | minimalTmpDirGB | 是 | 是 |
-| 28 | compressMsgSize | 是 | 是 |
-| 29 | compressColData | 是 | 是 |
-| 30 | smlChildTableName | 是 | 是 |
-| 31 | smlTagName | 是 | 是 |
-| 32 | smlDataFormat | 否 | 是 |
-| 33 | statusInterval | 是 | 是 |
-| 34 | shellActivityTimer | 是 | 是 |
-| 35 | transPullupInterval | 否 | 是 |
-| 36 | mqRebalanceInterval | 否 | 是 |
-| 37 | ttlUnit | 否 | 是 |
-| 38 | ttlPushInterval | 否 | 是 |
-| 39 | numOfTaskQueueThreads | 否 | 是 |
-| 40 | numOfRpcThreads | 否 | 是 |
-| 41 | numOfCommitThreads | 是 | 是 |
-| 42 | numOfMnodeReadThreads | 否 | 是 |
-| 43 | numOfVnodeQueryThreads | 否 | 是 |
-| 44 | numOfVnodeStreamThreads | 否 | 是 |
-| 45 | numOfVnodeFetchThreads | 否 | 是 |
-| 46 | numOfVnodeWriteThreads | 否 | 是 |
-| 47 | numOfVnodeSyncThreads | 否 | 是 |
-| 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 | 是 | 否 |
+| 18 | queryRsmaTolerance | 否 | 是 |
+| 19 | queryBufferSize | 是 | 是 |
+| 20 | maxNumOfDistinctRes | 是 | 是 |
+| 21 | minSlidingTime | 是 | 是 |
+| 22 | minIntervalTime | 是 | 是 |
+| 23 | countAlwaysReturnValue | 是 | 是 |
+| 24 | dataDir | 是 | 是 |
+| 25 | minimalDataDirGB | 是 | 是 |
+| 26 | supportVnodes | 否 | 是 |
+| 27 | tempDir | 是 | 是 |
+| 28 | minimalTmpDirGB | 是 | 是 |
+| 29 | compressMsgSize | 是 | 是 |
+| 30 | compressColData | 是 | 是 |
+| 31 | smlChildTableName | 是 | 是 |
+| 32 | smlTagName | 是 | 是 |
+| 33 | smlDataFormat | 否 | 是 |
+| 34 | statusInterval | 是 | 是 |
+| 35 | shellActivityTimer | 是 | 是 |
+| 36 | transPullupInterval | 否 | 是 |
+| 37 | mqRebalanceInterval | 否 | 是 |
+| 38 | ttlUnit | 否 | 是 |
+| 39 | ttlPushInterval | 否 | 是 |
+| 40 | numOfTaskQueueThreads | 否 | 是 |
+| 41 | numOfRpcThreads | 否 | 是 |
+| 42 | numOfCommitThreads | 是 | 是 |
+| 43 | numOfMnodeReadThreads | 否 | 是 |
+| 44 | numOfVnodeQueryThreads | 否 | 是 |
+| 45 | numOfVnodeStreamThreads | 否 | 是 |
+| 46 | numOfVnodeFetchThreads | 否 | 是 |
+| 47 | numOfVnodeWriteThreads | 否 | 是 |
+| 48 | numOfVnodeSyncThreads | 否 | 是 |
+| 49 | numOfVnodeRsmaThreads | 否 | 是 |
+| 50 | numOfQnodeQueryThreads | 否 | 是 |
+| 51 | numOfQnodeFetchThreads | 否 | 是 |
+| 52 | numOfSnodeSharedThreads | 否 | 是 |
+| 53 | numOfSnodeUniqueThreads | 否 | 是 |
+| 54 | rpcQueueMemoryAllowed | 否 | 是 |
+| 55 | logDir | 是 | 是 |
+| 56 | minimalLogDirGB | 是 | 是 |
+| 57 | numOfLogLines | 是 | 是 |
+| 58 | asyncLog | 是 | 是 |
+| 59 | logKeepDays | 是 | 是 |
+| 60 | debugFlag | 是 | 是 |
+| 61 | tmrDebugFlag | 是 | 是 |
+| 62 | uDebugFlag | 是 | 是 |
+| 63 | rpcDebugFlag | 是 | 是 |
+| 64 | jniDebugFlag | 是 | 是 |
+| 65 | qDebugFlag | 是 | 是 |
+| 66 | cDebugFlag | 是 | 是 |
+| 67 | dDebugFlag | 是 | 是 |
+| 68 | vDebugFlag | 是 | 是 |
+| 69 | mDebugFlag | 是 | 是 |
+| 70 | wDebugFlag | 是 | 是 |
+| 71 | sDebugFlag | 是 | 是 |
+| 72 | tsdbDebugFlag | 是 | 是 |
+| 73 | tqDebugFlag | 否 | 是 |
+| 74 | fsDebugFlag | 是 | 是 |
+| 75 | udfDebugFlag | 否 | 是 |
+| 76 | smaDebugFlag | 否 | 是 |
+| 77 | idxDebugFlag | 否 | 是 |
+| 78 | tdbDebugFlag | 否 | 是 |
+| 79 | metaDebugFlag | 否 | 是 |
+| 80 | timezone | 是 | 是 |
+| 81 | locale | 是 | 是 |
+| 82 | charset | 是 | 是 |
+| 83 | udf | 是 | 是 |
+| 84 | enableCoreFile | 是 | 是 |
+| 85 | arbitrator | 是 | 否 |
+| 86 | numOfThreadsPerCore | 是 | 否 |
+| 87 | numOfMnodes | 是 | 否 |
+| 88 | vnodeBak | 是 | 否 |
+| 89 | balance | 是 | 否 |
+| 90 | balanceInterval | 是 | 否 |
+| 91 | offlineThreshold | 是 | 否 |
+| 92 | role | 是 | 否 |
+| 93 | dnodeNopLoop | 是 | 否 |
+| 94 | keepTimeOffset | 是 | 否 |
+| 95 | rpcTimer | 是 | 否 |
+| 96 | rpcMaxTime | 是 | 否 |
+| 97 | rpcForceTcp | 是 | 否 |
+| 98 | tcpConnTimeout | 是 | 否 |
+| 99 | syncCheckInterval | 是 | 否 |
+| 100 | maxTmrCtrl | 是 | 否 |
+| 101 | monitorReplica | 是 | 否 |
+| 102 | smlTagNullName | 是 | 否 |
+| 103 | keepColumnName | 是 | 否 |
+| 104 | ratioOfQueryCores | 是 | 否 |
+| 105 | maxStreamCompDelay | 是 | 否 |
+| 106 | maxFirstStreamCompDelay | 是 | 否 |
+| 107 | retryStreamCompDelay | 是 | 否 |
+| 108 | streamCompDelayRatio | 是 | 否 |
+| 109 | maxVgroupsPerDb | 是 | 否 |
+| 110 | maxTablesPerVnode | 是 | 否 |
+| 111 | minTablesPerVnode | 是 | 否 |
+| 112 | tableIncStepPerVnode | 是 | 否 |
+| 113 | cache | 是 | 否 |
+| 114 | blocks | 是 | 否 |
+| 115 | days | 是 | 否 |
+| 116 | keep | 是 | 否 |
+| 117 | minRows | 是 | 否 |
+| 118 | maxRows | 是 | 否 |
+| 119 | quorum | 是 | 否 |
+| 120 | comp | 是 | 否 |
+| 121 | walLevel | 是 | 否 |
+| 122 | fsync | 是 | 否 |
+| 123 | replica | 是 | 否 |
+| 124 | partitions | 是 | 否 |
+| 125 | quorum | 是 | 否 |
+| 126 | update | 是 | 否 |
+| 127 | cachelast | 是 | 否 |
+| 128 | maxSQLLength | 是 | 否 |
+| 129 | maxWildCardsLength | 是 | 否 |
+| 130 | maxRegexStringLen | 是 | 否 |
+| 131 | maxNumOfOrderedRes | 是 | 否 |
+| 132 | maxConnections | 是 | 否 |
+| 133 | mnodeEqualVnodeNum | 是 | 否 |
+| 134 | http | 是 | 否 |
+| 135 | httpEnableRecordSql | 是 | 否 |
+| 136 | httpMaxThreads | 是 | 否 |
+| 137 | restfulRowLimit | 是 | 否 |
+| 138 | httpDbNameMandatory | 是 | 否 |
+| 139 | httpKeepAlive | 是 | 否 |
+| 140 | enableRecordSql | 是 | 否 |
+| 141 | maxBinaryDisplayWidth | 是 | 否 |
+| 142 | stream | 是 | 否 |
+| 143 | retrieveBlockingModel | 是 | 否 |
+| 144 | tsdbMetaCompactRatio | 是 | 否 |
+| 145 | defaultJSONStrType | 是 | 否 |
+| 146 | walFlushSize | 是 | 否 |
+| 147 | keepTimeOffset | 是 | 否 |
+| 148 | flowctrl | 是 | 否 |
+| 149 | slaveQuery | 是 | 否 |
+| 150 | adjustMaster | 是 | 否 |
+| 151 | topicBinaryLen | 是 | 否 |
+| 152 | telegrafUseFieldNum | 是 | 否 |
+| 153 | deadLockKillQuery | 是 | 否 |
+| 154 | clientMerge | 是 | 否 |
+| 155 | sdbDebugFlag | 是 | 否 |
+| 156 | odbcDebugFlag | 是 | 否 |
+| 157 | httpDebugFlag | 是 | 否 |
+| 158 | monDebugFlag | 是 | 否 |
+| 159 | cqDebugFlag | 是 | 否 |
+| 160 | shortcutFlag | 是 | 否 |
+| 161 | probeSeconds | 是 | 否 |
+| 162 | probeKillSeconds | 是 | 否 |
+| 163 | probeInterval | 是 | 否 |
+| 164 | lossyColumns | 是 | 否 |
+| 165 | fPrecision | 是 | 否 |
+| 166 | dPrecision | 是 | 否 |
+| 167 | maxRange | 是 | 否 |
+| 168 | range | 是 | 否 |
diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md
index 59a241b6c8458b42313b55f8e814ea574c6fd32c..b05cf7a942901efacb3512b9d6721b75e252f7c5 100644
--- a/docs/zh/28-releases/01-tdengine.md
+++ b/docs/zh/28-releases/01-tdengine.md
@@ -6,6 +6,9 @@ description: TDengine 发布历史、Release Notes 及下载链接
import Release from "/components/ReleaseV3";
+## 3.0.1.2
+
+
## 3.0.1.1
diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md
index 9ff8f4222471cc4245885909e2255869ccf1cb99..f793981d064ef1dfe6962a454cdc284763667070 100644
--- a/docs/zh/28-releases/02-tools.md
+++ b/docs/zh/28-releases/02-tools.md
@@ -6,6 +6,10 @@ description: taosTools 的发布历史、Release Notes 和下载链接
import Release from "/components/ReleaseV3";
+## 2.2.2
+
+
+
## 2.2.0
diff --git a/examples/lua/OpenResty/so/luaconnector51.so b/examples/lua/OpenResty/so/luaconnector51.so
index 442de6e39f909e1aeb869988722b84795c048855..168d3a9d2406680ceec3c12f29a8157d19aca2ff 100755
Binary files a/examples/lua/OpenResty/so/luaconnector51.so and b/examples/lua/OpenResty/so/luaconnector51.so differ
diff --git a/examples/lua/lua51/lua_connector51.c b/examples/lua/lua51/lua_connector51.c
index 578622bf1fb50f428a4ba44b3b02c4eeed2508b2..4c702b2aaeac163f73bc0b2503449dd68a25150d 100644
--- a/examples/lua/lua51/lua_connector51.c
+++ b/examples/lua/lua51/lua_connector51.c
@@ -2,7 +2,7 @@
#include
#include
#include
-#include "../../../../include/client/taos.h"
+#include "taos.h"
#include "lauxlib.h"
#include "lua.h"
#include "lualib.h"
@@ -35,7 +35,7 @@ static int l_connect(lua_State *L){
}
lua_getfield(L, 1, "port");
- if (lua_isnumber(L,-1)){
+ if (lua_isnumber(L, -1)){
port = lua_tonumber(L, -1);
//printf("port = %d\n", port);
}
@@ -60,7 +60,6 @@ static int l_connect(lua_State *L){
lua_settop(L,0);
- taos_init();
lua_newtable(L);
int table_index = lua_gettop(L);
@@ -102,7 +101,7 @@ static int l_query(lua_State *L){
printf("failed, reason:%s\n", taos_errstr(result));
lua_pushinteger(L, -1);
lua_setfield(L, table_index, "code");
- lua_pushstring(L, taos_errstr(taos));
+ lua_pushstring(L, taos_errstr(result));
lua_setfield(L, table_index, "error");
return 1;
@@ -113,7 +112,6 @@ static int l_query(lua_State *L){
int rows = 0;
int num_fields = taos_field_count(result);
const TAOS_FIELD *fields = taos_fetch_fields(result);
- //char temp[256];
const int affectRows = taos_affected_rows(result);
// printf(" affect rows:%d\r\n", affectRows);
@@ -122,7 +120,7 @@ static int l_query(lua_State *L){
lua_pushinteger(L, affectRows);
lua_setfield(L, table_index, "affected");
lua_newtable(L);
-
+
while ((row = taos_fetch_row(result))) {
//printf("row index:%d\n",rows);
rows++;
@@ -136,7 +134,7 @@ static int l_query(lua_State *L){
}
lua_pushstring(L,fields[i].name);
-
+ int32_t* length = taos_fetch_lengths(result);
switch (fields[i].type) {
case TSDB_DATA_TYPE_TINYINT:
lua_pushinteger(L,*((char *)row[i]));
@@ -158,7 +156,8 @@ static int l_query(lua_State *L){
break;
case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR:
- lua_pushstring(L,(char *)row[i]);
+ //printf("type:%d, max len:%d, current len:%d\n",fields[i].type, fields[i].bytes, length[i]);
+ lua_pushlstring(L,(char *)row[i], length[i]);
break;
case TSDB_DATA_TYPE_TIMESTAMP:
lua_pushinteger(L,*((int64_t *)row[i]));
@@ -166,6 +165,7 @@ static int l_query(lua_State *L){
case TSDB_DATA_TYPE_BOOL:
lua_pushinteger(L,*((char *)row[i]));
break;
+ case TSDB_DATA_TYPE_NULL:
default:
lua_pushnil(L);
break;
@@ -235,112 +235,6 @@ static int l_async_query(lua_State *L){
return 1;
}
-void stream_cb(void *param, TAOS_RES *result, TAOS_ROW row){
- struct cb_param* p = (struct cb_param*) param;
- TAOS_FIELD *fields = taos_fetch_fields(result);
- int numFields = taos_num_fields(result);
-
- // printf("\nnumfields:%d\n", numFields);
- //printf("\n\r-----------------------------------------------------------------------------------\n");
-
- lua_State *L = p->state;
- lua_rawgeti(L, LUA_REGISTRYINDEX, p->callback);
-
- lua_newtable(L);
-
- for (int i = 0; i < numFields; ++i) {
- if (row[i] == NULL) {
- continue;
- }
-
- lua_pushstring(L,fields[i].name);
-
- switch (fields[i].type) {
- case TSDB_DATA_TYPE_TINYINT:
- lua_pushinteger(L,*((char *)row[i]));
- break;
- case TSDB_DATA_TYPE_SMALLINT:
- lua_pushinteger(L,*((short *)row[i]));
- break;
- case TSDB_DATA_TYPE_INT:
- lua_pushinteger(L,*((int *)row[i]));
- break;
- case TSDB_DATA_TYPE_BIGINT:
- lua_pushinteger(L,*((int64_t *)row[i]));
- break;
- case TSDB_DATA_TYPE_FLOAT:
- lua_pushnumber(L,*((float *)row[i]));
- break;
- case TSDB_DATA_TYPE_DOUBLE:
- lua_pushnumber(L,*((double *)row[i]));
- break;
- case TSDB_DATA_TYPE_BINARY:
- case TSDB_DATA_TYPE_NCHAR:
- lua_pushstring(L,(char *)row[i]);
- break;
- case TSDB_DATA_TYPE_TIMESTAMP:
- lua_pushinteger(L,*((int64_t *)row[i]));
- break;
- case TSDB_DATA_TYPE_BOOL:
- lua_pushinteger(L,*((char *)row[i]));
- break;
- default:
- lua_pushnil(L);
- break;
- }
-
- lua_settable(L, -3);
- }
-
- lua_call(L, 1, 0);
-
- // printf("-----------------------------------------------------------------------------------\n\r");
-}
-
-static int l_open_stream(lua_State *L){
- int r = luaL_ref(L, LUA_REGISTRYINDEX);
- TAOS * taos = (TAOS*)lua_topointer(L,1);
- const char * sqlstr = lua_tostring(L,2);
- int stime = luaL_checknumber(L,3);
-
- lua_newtable(L);
- int table_index = lua_gettop(L);
-
- struct cb_param *p = malloc(sizeof(struct cb_param));
- p->state = L;
- p->callback=r;
- // printf("r:%d, L:%d\n",r,L);
- void * s = taos_open_stream(taos,sqlstr,stream_cb,stime,p,NULL);
- if (s == NULL) {
- printf("failed to open stream, reason:%s\n", taos_errstr(taos));
- free(p);
- lua_pushnumber(L, -1);
- lua_setfield(L, table_index, "code");
- lua_pushstring(L, taos_errstr(taos));
- lua_setfield(L, table_index, "error");
- lua_pushlightuserdata(L,NULL);
- lua_setfield(L, table_index, "stream");
- }else{
- // printf("success to open stream\n");
- lua_pushnumber(L, 0);
- lua_setfield(L, table_index, "code");
- lua_pushstring(L, taos_errstr(taos));
- lua_setfield(L, table_index, "error");
- p->stream = s;
- lua_pushlightuserdata(L,p);
- lua_setfield(L, table_index, "stream");//stream has different content in lua and c.
- }
-
- return 1;
-}
-
-static int l_close_stream(lua_State *L){
- //TODO:get stream and free cb_param
- struct cb_param *p = lua_touserdata(L,1);
- taos_close_stream(p->stream);
- free(p);
- return 0;
-}
static int l_close(lua_State *L){
TAOS *taos= (TAOS*)lua_topointer(L,1);
@@ -367,8 +261,6 @@ static const struct luaL_Reg lib[] = {
{"query", l_query},
{"query_a",l_async_query},
{"close", l_close},
- {"open_stream", l_open_stream},
- {"close_stream", l_close_stream},
{NULL, NULL}
};
diff --git a/examples/lua/lua_connector.c b/examples/lua/lua_connector.c
index 3c13b196b991a6bdf18493c111d37028fcb5de9a..ce13ab3829dec17e4df97ab94f358bd128e80cf1 100644
--- a/examples/lua/lua_connector.c
+++ b/examples/lua/lua_connector.c
@@ -5,7 +5,7 @@
#include
#include
#include
-#include "taos.h"
+#include
struct cb_param{
lua_State* state;
@@ -60,6 +60,8 @@ static int l_connect(lua_State *L){
lua_settop(L,0);
+ taos_init();
+
lua_newtable(L);
int table_index = lua_gettop(L);
diff --git a/examples/lua/test.lua b/examples/lua/test.lua
index 89c0904c6a04ecec79a95cb1f710136e93a4a00b..3d725cc6a368a4d263729a35612ae0461c86b5ab 100644
--- a/examples/lua/test.lua
+++ b/examples/lua/test.lua
@@ -9,6 +9,50 @@ local config = {
max_packet_size = 1024 * 1024
}
+function dump(obj)
+ local getIndent, quoteStr, wrapKey, wrapVal, dumpObj
+ getIndent = function(level)
+ return string.rep("\t", level)
+ end
+ quoteStr = function(str)
+ return '"' .. string.gsub(str, '"', '\\"') .. '"'
+ end
+ wrapKey = function(val)
+ if type(val) == "number" then
+ return "[" .. val .. "]"
+ elseif type(val) == "string" then
+ return "[" .. quoteStr(val) .. "]"
+ else
+ return "[" .. tostring(val) .. "]"
+ end
+ end
+ wrapVal = function(val, level)
+ if type(val) == "table" then
+ return dumpObj(val, level)
+ elseif type(val) == "number" then
+ return val
+ elseif type(val) == "string" then
+ return quoteStr(val)
+ else
+ return tostring(val)
+ end
+ end
+ dumpObj = function(obj, level)
+ if type(obj) ~= "table" then
+ return wrapVal(obj)
+ end
+ level = level + 1
+ local tokens = {}
+ tokens[#tokens + 1] = "{"
+ for k, v in pairs(obj) do
+ tokens[#tokens + 1] = getIndent(level) .. wrapKey(k) .. " = " .. wrapVal(v, level) .. ","
+ end
+ tokens[#tokens + 1] = getIndent(level - 1) .. "}"
+ return table.concat(tokens, "\n")
+ end
+ return dumpObj(obj, 0)
+end
+
local conn
local res = driver.connect(config)
if res.code ~=0 then
@@ -37,7 +81,7 @@ else
print("select db--- pass.")
end
-res = driver.query(conn,"create table m1 (ts timestamp, speed int,owner binary(20))")
+res = driver.query(conn,"create table m1 (ts timestamp, speed int, owner binary(20), mark nchar(30))")
if res.code ~=0 then
print("create table---failed: "..res.error)
return
@@ -45,7 +89,7 @@ else
print("create table--- pass.")
end
-res = driver.query(conn,"insert into m1 values ('2019-09-01 00:00:00.001',0,'robotspace'), ('2019-09-01 00:00:00.002',1,'Hilink'),('2019-09-01 00:00:00.003',2,'Harmony')")
+res = driver.query(conn,"insert into m1 values ('2019-09-01 00:00:00.001', 0, 'robotspace', '世界人民大团结万岁'), ('2019-09-01 00:00:00.002', 1, 'Hilink', '⾾⾿⿀⿁⿂⿃⿄⿅⿆⿇⿈⿉⿊⿋⿌⿍⿎⿏⿐⿑⿒⿓⿔⿕'),('2019-09-01 00:00:00.003', 2, 'Harmony', '₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵')")
if res.code ~=0 then
print("insert records failed: "..res.error)
return
@@ -64,21 +108,25 @@ if res.code ~=0 then
return
else
if (#(res.item) == 3) then
- print("select--- pass")
+ print("select--- pass")
+ print(res.item[1].mark)
+ print(res.item[2].mark)
+ print(res.item[3].mark)
+
else
print("select--- failed: expect 3 affected records, actually received "..#(res.item))
end
end
-res = driver.query(conn,"CREATE TABLE thermometer (ts timestamp, degree double) TAGS(location binary(20), type int)")
+res = driver.query(conn,"create table thermometer (ts timestamp, degree double) tags(location binary(20), type int)")
if res.code ~=0 then
print(res.error)
return
else
print("create super table--- pass")
end
-res = driver.query(conn,"CREATE TABLE therm1 USING thermometer TAGS ('beijing', 1)")
+res = driver.query(conn,"create table therm1 using thermometer tags ('beijing', 1)")
if res.code ~=0 then
print(res.error)
return
@@ -86,7 +134,7 @@ else
print("create table--- pass")
end
-res = driver.query(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.001', 20),('2019-09-01 00:00:00.002', 21)")
+res = driver.query(conn,"insert into therm1 values ('2019-09-01 00:00:00.001', 20),('2019-09-01 00:00:00.002', 21)")
if res.code ~=0 then
print(res.error)
@@ -99,14 +147,14 @@ else
end
end
-res = driver.query(conn,"SELECT COUNT(*) count, AVG(degree) AS av, MAX(degree), MIN(degree) FROM thermometer WHERE location='beijing' or location='tianjin' GROUP BY location, type")
+res = driver.query(conn,"select count(*) as cnt, avg(degree) as av, max(degree), min(degree) from thermometer where location='beijing' or location='tianjin' group by location, type")
if res.code ~=0 then
print("select from super table--- failed:"..res.error)
return
else
print("select from super table--- pass")
for i = 1, #(res.item) do
- print("res:"..res.item[i].count)
+ print("res:"..res.item[i].cnt)
end
end
@@ -127,30 +175,13 @@ end
driver.query_a(conn,"INSERT INTO therm1 VALUES ('2019-09-01 00:00:00.005', 100),('2019-09-01 00:00:00.006', 101),('2019-09-01 00:00:00.007', 102)", async_query_callback)
+res = driver.query(conn, "create stream stream_avg_degree into avg_degree as select avg(degree) from thermometer interval(5s) sliding(1s)")
-function stream_callback(t)
- print("------------------------")
- print("continuous query result:")
- for key, value in pairs(t) do
- print("key:"..key..", value:"..value)
- end
-end
-
-local stream
-res = driver.open_stream(conn,"SELECT COUNT(*) as count, AVG(degree) as avg, MAX(degree) as max, MIN(degree) as min FROM thermometer interval(2s) sliding(2s);)",0, stream_callback)
-if res.code ~=0 then
- print("open stream--- failed:"..res.error)
- return
-else
- print("open stream--- pass")
- stream = res.stream
-end
-
-print("From now on we start continous insert in an definite (infinite if you want) loop.")
+print("From now on we start continous insert in an definite loop, pls wait for about 10 seconds and check stream table for result.")
local loop_index = 0
-while loop_index < 30 do
+while loop_index < 10 do
local t = os.time()*1000
- local v = loop_index
+ local v = math.random(20)
res = driver.query(conn,string.format("INSERT INTO therm1 VALUES (%d, %d)",t,v))
if res.code ~=0 then
@@ -162,7 +193,5 @@ while loop_index < 30 do
os.execute("sleep " .. 1)
loop_index = loop_index + 1
end
-
-driver.close_stream(stream)
-
+driver.query(conn,"DROP STREAM IF EXISTS avg_therm_s")
driver.close(conn)
diff --git a/include/common/tcommon.h b/include/common/tcommon.h
index ba4baa0130602da80da5eb14a45a48dea8a31a03..2544cedda744901ddc98bf9d7698fddf5907513f 100644
--- a/include/common/tcommon.h
+++ b/include/common/tcommon.h
@@ -116,6 +116,7 @@ enum {
STREAM_INPUT__DATA_RETRIEVE,
STREAM_INPUT__GET_RES,
STREAM_INPUT__CHECKPOINT,
+ STREAM_INPUT__REF_DATA_BLOCK,
STREAM_INPUT__DESTROY,
};
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index 66bae5ad3b3e3b34445df01c1b5cc63c56a9fb86..9b69bec5b3f9e9227a9ae0ae32ccde7358457d1e 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -94,7 +94,10 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in
// query client
extern int32_t tsQueryPolicy;
extern int32_t tsQuerySmaOptimize;
+extern int32_t tsQueryRsmaTolerance;
extern bool tsQueryPlannerTrace;
+extern int32_t tsQueryNodeChunkSize;
+extern bool tsQueryUseNodeAllocator;
// client
extern int32_t tsMinSlidingTime;
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index ac6ce82ffb3c3c0f29b3b76ce8cd899d5eed9bce..d11fd4da10cde3117a263affd18b0c9c5bc95316 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -1424,6 +1424,14 @@ typedef struct {
SExplainExecInfo* subplanInfo;
} SExplainRsp;
+typedef struct {
+ SExplainRsp rsp;
+ uint64_t qId;
+ uint64_t tId;
+ int64_t rId;
+ int32_t eId;
+} SExplainLocalRsp;
+
typedef struct STableScanAnalyzeInfo {
uint64_t totalRows;
uint64_t totalCheckedRows;
@@ -1438,6 +1446,7 @@ typedef struct STableScanAnalyzeInfo {
int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
int32_t tDeserializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
+void tFreeSExplainRsp(SExplainRsp *pRsp);
typedef struct {
char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port
@@ -2337,6 +2346,7 @@ int32_t tSerializeSClientHbBatchReq(void* buf, int32_t bufLen, const SClientHbBa
int32_t tDeserializeSClientHbBatchReq(void* buf, int32_t bufLen, SClientHbBatchReq* pReq);
static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq) {
+ if (pReq == NULL) return;
SClientHbBatchReq* req = (SClientHbBatchReq*)pReq;
taosArrayDestroyEx(req->reqs, tFreeClientHbReq);
taosMemoryFree(pReq);
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 3e170d5098ab34b1dc41c6d87d74484eff503fbc..0111b03aac814a276dda2bcdf5b9e43eae4f18e5 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -234,96 +234,100 @@
#define TK_CURRENT_USER 216
#define TK_COUNT 217
#define TK_LAST_ROW 218
-#define TK_BETWEEN 219
-#define TK_IS 220
-#define TK_NK_LT 221
-#define TK_NK_GT 222
-#define TK_NK_LE 223
-#define TK_NK_GE 224
-#define TK_NK_NE 225
-#define TK_MATCH 226
-#define TK_NMATCH 227
-#define TK_CONTAINS 228
-#define TK_IN 229
-#define TK_JOIN 230
-#define TK_INNER 231
-#define TK_SELECT 232
-#define TK_DISTINCT 233
-#define TK_WHERE 234
-#define TK_PARTITION 235
-#define TK_BY 236
-#define TK_SESSION 237
-#define TK_STATE_WINDOW 238
-#define TK_SLIDING 239
-#define TK_FILL 240
-#define TK_VALUE 241
-#define TK_NONE 242
-#define TK_PREV 243
-#define TK_LINEAR 244
-#define TK_NEXT 245
-#define TK_HAVING 246
-#define TK_RANGE 247
-#define TK_EVERY 248
-#define TK_ORDER 249
-#define TK_SLIMIT 250
-#define TK_SOFFSET 251
-#define TK_LIMIT 252
-#define TK_OFFSET 253
-#define TK_ASC 254
-#define TK_NULLS 255
-#define TK_ABORT 256
-#define TK_AFTER 257
-#define TK_ATTACH 258
-#define TK_BEFORE 259
-#define TK_BEGIN 260
-#define TK_BITAND 261
-#define TK_BITNOT 262
-#define TK_BITOR 263
-#define TK_BLOCKS 264
-#define TK_CHANGE 265
-#define TK_COMMA 266
-#define TK_COMPACT 267
-#define TK_CONCAT 268
-#define TK_CONFLICT 269
-#define TK_COPY 270
-#define TK_DEFERRED 271
-#define TK_DELIMITERS 272
-#define TK_DETACH 273
-#define TK_DIVIDE 274
-#define TK_DOT 275
-#define TK_EACH 276
-#define TK_END 277
-#define TK_FAIL 278
-#define TK_FILE 279
-#define TK_FOR 280
-#define TK_GLOB 281
-#define TK_ID 282
-#define TK_IMMEDIATE 283
-#define TK_IMPORT 284
-#define TK_INITIALLY 285
-#define TK_INSTEAD 286
-#define TK_ISNULL 287
-#define TK_KEY 288
-#define TK_NK_BITNOT 289
-#define TK_NK_SEMI 290
-#define TK_NOTNULL 291
-#define TK_OF 292
-#define TK_PLUS 293
-#define TK_PRIVILEGE 294
-#define TK_RAISE 295
-#define TK_REPLACE 296
-#define TK_RESTRICT 297
-#define TK_ROW 298
-#define TK_SEMI 299
-#define TK_STAR 300
-#define TK_STATEMENT 301
-#define TK_STRING 302
-#define TK_TIMES 303
-#define TK_UPDATE 304
-#define TK_VALUES 305
-#define TK_VARIABLE 306
-#define TK_VIEW 307
-#define TK_WAL 308
+#define TK_CASE 219
+#define TK_END 220
+#define TK_WHEN 221
+#define TK_THEN 222
+#define TK_ELSE 223
+#define TK_BETWEEN 224
+#define TK_IS 225
+#define TK_NK_LT 226
+#define TK_NK_GT 227
+#define TK_NK_LE 228
+#define TK_NK_GE 229
+#define TK_NK_NE 230
+#define TK_MATCH 231
+#define TK_NMATCH 232
+#define TK_CONTAINS 233
+#define TK_IN 234
+#define TK_JOIN 235
+#define TK_INNER 236
+#define TK_SELECT 237
+#define TK_DISTINCT 238
+#define TK_WHERE 239
+#define TK_PARTITION 240
+#define TK_BY 241
+#define TK_SESSION 242
+#define TK_STATE_WINDOW 243
+#define TK_SLIDING 244
+#define TK_FILL 245
+#define TK_VALUE 246
+#define TK_NONE 247
+#define TK_PREV 248
+#define TK_LINEAR 249
+#define TK_NEXT 250
+#define TK_HAVING 251
+#define TK_RANGE 252
+#define TK_EVERY 253
+#define TK_ORDER 254
+#define TK_SLIMIT 255
+#define TK_SOFFSET 256
+#define TK_LIMIT 257
+#define TK_OFFSET 258
+#define TK_ASC 259
+#define TK_NULLS 260
+#define TK_ABORT 261
+#define TK_AFTER 262
+#define TK_ATTACH 263
+#define TK_BEFORE 264
+#define TK_BEGIN 265
+#define TK_BITAND 266
+#define TK_BITNOT 267
+#define TK_BITOR 268
+#define TK_BLOCKS 269
+#define TK_CHANGE 270
+#define TK_COMMA 271
+#define TK_COMPACT 272
+#define TK_CONCAT 273
+#define TK_CONFLICT 274
+#define TK_COPY 275
+#define TK_DEFERRED 276
+#define TK_DELIMITERS 277
+#define TK_DETACH 278
+#define TK_DIVIDE 279
+#define TK_DOT 280
+#define TK_EACH 281
+#define TK_FAIL 282
+#define TK_FILE 283
+#define TK_FOR 284
+#define TK_GLOB 285
+#define TK_ID 286
+#define TK_IMMEDIATE 287
+#define TK_IMPORT 288
+#define TK_INITIALLY 289
+#define TK_INSTEAD 290
+#define TK_ISNULL 291
+#define TK_KEY 292
+#define TK_NK_BITNOT 293
+#define TK_NK_SEMI 294
+#define TK_NOTNULL 295
+#define TK_OF 296
+#define TK_PLUS 297
+#define TK_PRIVILEGE 298
+#define TK_RAISE 299
+#define TK_REPLACE 300
+#define TK_RESTRICT 301
+#define TK_ROW 302
+#define TK_SEMI 303
+#define TK_STAR 304
+#define TK_STATEMENT 305
+#define TK_STRING 306
+#define TK_TIMES 307
+#define TK_UPDATE 308
+#define TK_VALUES 309
+#define TK_VARIABLE 310
+#define TK_VIEW 311
+#define TK_WAL 312
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index 25a6221fcb5344cd1f0d98af15840b3905321612..8c1d957381583f1e91a5c1620b90638ea3061ce1 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -29,6 +29,15 @@ typedef void* DataSinkHandle;
struct SRpcMsg;
struct SSubplan;
+typedef int32_t (*localFetchFp)(void *, uint64_t, uint64_t, uint64_t, int64_t, int32_t, void**, SArray*);
+
+typedef struct {
+ void *handle;
+ bool localExec;
+ localFetchFp fp;
+ SArray *explainRes;
+} SLocalFetch;
+
typedef struct {
void* tqReader;
void* meta;
@@ -127,7 +136,7 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
* @param handle
* @return
*/
-int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds);
+int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, SLocalFetch *pLocal);
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
/**
diff --git a/include/libs/function/function.h b/include/libs/function/function.h
index 65ddc180d66e6ab8c56aec68ce2fb5064c104846..60c7b18367ea9bc90c441ab005f85931106aecf3 100644
--- a/include/libs/function/function.h
+++ b/include/libs/function/function.h
@@ -78,7 +78,6 @@ enum {
MAIN_SCAN = 0x0u,
REVERSE_SCAN = 0x1u, // todo remove it
REPEAT_SCAN = 0x2u, // repeat scan belongs to the master scan
- MERGE_STAGE = 0x20u,
};
typedef struct SPoint1 {
@@ -156,11 +155,6 @@ typedef struct SqlFunctionCtx {
char udfName[TSDB_FUNC_NAME_LEN];
} SqlFunctionCtx;
-enum {
- TEXPR_BINARYEXPR_NODE = 0x1,
- TEXPR_UNARYEXPR_NODE = 0x2,
-};
-
typedef struct tExprNode {
int32_t nodeType;
union {
@@ -182,8 +176,9 @@ struct SScalarParam {
SColumnInfoData *columnData;
SHashObj *pHashFilter;
int32_t hashValueType;
- void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
+ void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
int32_t numOfRows;
+ int32_t numOfQualified; // number of qualified elements in the final results
};
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
@@ -201,8 +196,6 @@ int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// udf api
-struct SUdfInfo;
-
/**
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
* @return error code
@@ -226,6 +219,7 @@ int32_t udfStartUdfd(int32_t startDnodeId);
* @return
*/
int32_t udfStopUdfd();
+
#ifdef __cplusplus
}
#endif
diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h
index 6500d3d1831e817c497406e574b721594e63e209..301e11fd17b750fdbd761836d4a0cc776a3ae250 100644
--- a/include/libs/nodes/nodes.h
+++ b/include/libs/nodes/nodes.h
@@ -103,6 +103,8 @@ typedef enum ENodeType {
QUERY_NODE_STREAM_OPTIONS,
QUERY_NODE_LEFT_VALUE,
QUERY_NODE_COLUMN_REF,
+ QUERY_NODE_WHEN_THEN,
+ QUERY_NODE_CASE_WHEN,
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR = 100,
@@ -275,6 +277,17 @@ typedef struct SNodeList {
SListCell* pTail;
} SNodeList;
+typedef struct SNodeAllocator SNodeAllocator;
+
+int32_t nodesInitAllocatorSet();
+void nodesDestroyAllocatorSet();
+int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId);
+int32_t nodesAcquireAllocator(int64_t allocatorId);
+int32_t nodesReleaseAllocator(int64_t allocatorId);
+int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId);
+int64_t nodesReleaseAllocatorWeakRef(int64_t allocatorId);
+void nodesDestroyAllocator(int64_t allocatorId);
+
SNode* nodesMakeNode(ENodeType type);
void nodesDestroyNode(SNode* pNode);
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index 1e86a04775cd0a56c6581d1eb4ad87cf4d7c018b..a531eeffdee9dbd94318ec73c08f076311f1bb3b 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -165,7 +165,8 @@ typedef struct SVnodeModifyLogicNode {
typedef struct SExchangeLogicNode {
SLogicNode node;
- int32_t srcGroupId;
+ int32_t srcStartGroupId;
+ int32_t srcEndGroupId;
} SExchangeLogicNode;
typedef struct SMergeLogicNode {
@@ -395,11 +396,15 @@ typedef struct SDownstreamSourceNode {
uint64_t schedId;
int32_t execId;
int32_t fetchMsgType;
+ bool localExec;
} SDownstreamSourceNode;
typedef struct SExchangePhysiNode {
SPhysiNode node;
- int32_t srcGroupId; // group id of datasource suplans
+ // for set operators, there will be multiple execution groups under one exchange, and the ids of these execution
+ // groups are consecutive
+ int32_t srcStartGroupId;
+ int32_t srcEndGroupId;
bool singleChannel;
SNodeList* pSrcEndPoints; // element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode
} SExchangePhysiNode;
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index e90c994e8f2770fa95da82c71f5cc9ba16b1425f..9b150159fd73774bffa25201a2d4375b7ad03981 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -241,6 +241,19 @@ typedef struct SFillNode {
STimeWindow timeRange;
} SFillNode;
+typedef struct SWhenThenNode {
+ SExprNode node; // QUERY_NODE_WHEN_THEN
+ SNode* pWhen;
+ SNode* pThen;
+} SWhenThenNode;
+
+typedef struct SCaseWhenNode {
+ SExprNode node; // QUERY_NODE_CASE_WHEN
+ SNode* pCase;
+ SNode* pElse;
+ SNodeList* pWhenThenList;
+} SCaseWhenNode;
+
typedef struct SSelectStmt {
ENodeType type; // QUERY_NODE_SELECT_STMT
bool isDistinct;
diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h
index 95bde858640b3d4cd5df616bc1d0a5a65795d8f3..b1a937910dfe8defd107ec525afd20edfc639aaf 100644
--- a/include/libs/parser/parser.h
+++ b/include/libs/parser/parser.h
@@ -56,6 +56,7 @@ typedef struct SParseContext {
bool nodeOffline;
SArray* pTableMetaPos; // sql table pos => catalog data pos
SArray* pTableVgroupPos; // sql table pos => catalog data pos
+ int64_t allocatorId;
} SParseContext;
int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h
index e03ac3811a11b3927531a6250f5b41fb876c0f1c..e52fe39527dda9aa80ea05c1ffcab487b84cd466 100644
--- a/include/libs/planner/planner.h
+++ b/include/libs/planner/planner.h
@@ -39,6 +39,7 @@ typedef struct SPlanContext {
int32_t msgLen;
const char* pUser;
bool sysInfo;
+ int64_t allocatorId;
} 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 44a9e10679c0d0d30ec743e6bf624dcd912b32e9..e9f3864f6738bc7714db49d8f2373900fe10bfb6 100644
--- a/include/libs/qcom/query.h
+++ b/include/libs/qcom/query.h
@@ -52,6 +52,7 @@ typedef enum {
#define QUERY_POLICY_VNODE 1
#define QUERY_POLICY_HYBRID 2
#define QUERY_POLICY_QNODE 3
+#define QUERY_POLICY_CLIENT 4
typedef struct STableComInfo {
uint8_t numOfTags; // the number of tags in schema
@@ -269,43 +270,43 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define qFatal(...) \
do { \
if (qDebugFlag & DEBUG_FATAL) { \
- taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
+ taosPrintLog("QRY FATAL ", DEBUG_FATAL, qDebugFlag, __VA_ARGS__); \
} \
} while (0)
#define qError(...) \
do { \
if (qDebugFlag & DEBUG_ERROR) { \
- taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
+ taosPrintLog("QRY ERROR ", DEBUG_ERROR, qDebugFlag, __VA_ARGS__); \
} \
} while (0)
#define qWarn(...) \
do { \
if (qDebugFlag & DEBUG_WARN) { \
- taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
+ taosPrintLog("QRY WARN ", DEBUG_WARN, qDebugFlag, __VA_ARGS__); \
} \
} while (0)
#define qInfo(...) \
do { \
if (qDebugFlag & DEBUG_INFO) { \
- taosPrintLog("QRY ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
+ taosPrintLog("QRY ", DEBUG_INFO, qDebugFlag, __VA_ARGS__); \
} \
} while (0)
#define qDebug(...) \
do { \
if (qDebugFlag & DEBUG_DEBUG) { \
- taosPrintLog("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
+ taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
} \
} while (0)
#define qTrace(...) \
do { \
if (qDebugFlag & DEBUG_TRACE) { \
- taosPrintLog("QRY ", DEBUG_TRACE, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
+ taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \
} \
} while (0)
#define qDebugL(...) \
do { \
if (qDebugFlag & DEBUG_DEBUG) { \
- taosPrintLongString("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
+ taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
} \
} while (0)
diff --git a/include/libs/qworker/qworker.h b/include/libs/qworker/qworker.h
index 87aefe5187ec7ca61a4de5f6f14adbbf26861dfc..99f51892284bb4eb9884b763bef051771d39e1b7 100644
--- a/include/libs/qworker/qworker.h
+++ b/include/libs/qworker/qworker.h
@@ -29,6 +29,7 @@ enum {
NODE_TYPE_QNODE,
NODE_TYPE_SNODE,
NODE_TYPE_MNODE,
+ NODE_TYPE_CLIENT,
};
typedef struct SQWorkerCfg {
@@ -55,7 +56,24 @@ typedef struct {
uint64_t numOfErrors;
} SQWorkerStat;
-int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qWorkerMgmt, const SMsgCb *pMsgCb);
+typedef struct SQWMsgInfo {
+ int8_t taskType;
+ int8_t explain;
+ int8_t needFetch;
+} SQWMsgInfo;
+
+typedef struct SQWMsg {
+ void *node;
+ int32_t code;
+ int32_t msgType;
+ void *msg;
+ int32_t msgLen;
+ SQWMsgInfo msgInfo;
+ SRpcHandleInfo connInfo;
+} SQWMsg;
+
+
+int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb);
int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg);
@@ -77,10 +95,14 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_
int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SDeleteRes *pRes);
-void qWorkerDestroy(void **qWorkerMgmt);
+void qWorkerDestroy(void **qWorkerMgmt);
int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pStat);
+int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, SQWMsg *qwMsg, SArray *explainRes);
+
+int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, void** pRsp, SArray* explainRes);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/libs/scalar/filter.h b/include/libs/scalar/filter.h
index 1f1d9dea933affc01394111f5d5c3c4082b32cfb..e02b4a617253c7ade77a922568b478eaf62e0d9a 100644
--- a/include/libs/scalar/filter.h
+++ b/include/libs/scalar/filter.h
@@ -31,13 +31,17 @@ enum {
FLT_OPTION_NEED_UNIQE = 4,
};
+#define FILTER_RESULT_ALL_QUALIFIED 0x1
+#define FILTER_RESULT_NONE_QUALIFIED 0x2
+#define FILTER_RESULT_PARTIAL_QUALIFIED 0x3
+
typedef struct SFilterColumnParam {
int32_t numOfCols;
SArray *pDataBlock;
} SFilterColumnParam;
extern int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pinfo, uint32_t options);
-extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, int8_t **p, SColumnDataAgg *statis, int16_t numOfCols);
+extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData** p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* pFilterResStatus);
extern int32_t filterSetDataFromSlotId(SFilterInfo *info, void *param);
extern int32_t filterSetDataFromColId(SFilterInfo *info, void *param);
extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict);
diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h
index e6973cd390c10ff524f70549d161090582ee56ab..077c23c1b580bb693e0ec581920b9ebea46de751 100644
--- a/include/libs/scheduler/scheduler.h
+++ b/include/libs/scheduler/scheduler.h
@@ -64,9 +64,11 @@ typedef bool (*schedulerChkKillFp)(void* param);
typedef struct SSchedulerReq {
bool syncReq;
+ bool localReq;
SRequestConnInfo *pConn;
SArray *pNodeList;
SQueryPlan *pDag;
+ int64_t allocatorRefId;
const char *sql;
int64_t startTs;
schedulerExecFp execFp;
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 554d66d62120977d45bba05988ff495482ef8246..bdc12f7e3f1c03c88ea87233f3bf708b86800c5b 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -125,6 +125,14 @@ typedef struct {
SArray* blocks; // SArray
} SStreamDataBlock;
+// ref data block, for delete
+typedef struct {
+ int8_t type;
+ int64_t ver;
+ int32_t* dataRef;
+ SSDataBlock* pBlock;
+} SStreamRefDataBlock;
+
typedef struct {
int8_t type;
} SStreamCheckpoint;
@@ -339,7 +347,8 @@ static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem
qDebug("task %d %p submit enqueue %p %p %p", pTask->taskId, pTask, pItem, pSubmitClone, pSubmitClone->data);
taosWriteQitem(pTask->inputQueue->queue, pSubmitClone);
// qStreamInput(pTask->exec.executor, pSubmitClone);
- } else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE) {
+ } else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE ||
+ pItem->type == STREAM_INPUT__REF_DATA_BLOCK) {
taosWriteQitem(pTask->inputQueue->queue, pItem);
// qStreamInput(pTask->exec.executor, pItem);
} else if (pItem->type == STREAM_INPUT__CHECKPOINT) {
@@ -492,7 +501,9 @@ typedef struct {
int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq);
int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
-void tFreeStreamDispatchReq(SStreamDispatchReq* pReq);
+void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq);
+
+void tDeleteStreamDispatchReq(SStreamDispatchReq* pReq);
int32_t streamSetupTrigger(SStreamTask* pTask);
diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h
index e6a4dd1d493969a333005a64f515ba35dde34573..285e079b3ec90a066cd70fa3e7576dac3d5c8b8d 100644
--- a/include/libs/sync/sync.h
+++ b/include/libs/sync/sync.h
@@ -22,6 +22,7 @@ extern "C" {
#include "cJSON.h"
#include "tdef.h"
+#include "tlrucache.h"
#include "tmsgcb.h"
extern bool gRaftDetailLog;
@@ -153,7 +154,8 @@ typedef struct SSyncFSM {
// abstract definition of log store in raft
// SWal implements it
typedef struct SSyncLogStore {
- void* data;
+ SLRUCache* pCache;
+ void* data;
// append one log entry
int32_t (*appendEntry)(struct SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry);
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index 840e7309fe9b65b602a356b42f12155a8f980ff8..837d0c630310d723e1baf7715553565408029d0c 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -552,7 +552,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653)
#define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655)
#define TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG TAOS_DEF_ERROR_CODE(0, 0x2656)
-
#define TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2657)
#define TSDB_CODE_PAR_INVALID_WINDOW_PC TAOS_DEF_ERROR_CODE(0, 0x2658)
#define TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2659)
@@ -565,6 +564,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661)
#define TSDB_CODE_PAR_GET_META_ERROR TAOS_DEF_ERROR_CODE(0, 0x2662)
#define TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS TAOS_DEF_ERROR_CODE(0, 0x2663)
+#define TSDB_CODE_PAR_NOT_SUPPORT_JOIN TAOS_DEF_ERROR_CODE(0, 0x2664)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner
diff --git a/include/util/tdef.h b/include/util/tdef.h
index 840a2671fa6eb3f1bb05ff035ddf4a3d164239b7..43fd31afa7cc634e473c93518b78776c182d48d4 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -225,7 +225,8 @@ typedef enum ELogicConditionType {
#define TSDB_APP_NAME_LEN TSDB_UNI_LEN
#define TSDB_TB_COMMENT_LEN 1025
-#define TSDB_QUERY_ID_LEN 26
+#define TSDB_QUERY_ID_LEN 26
+#define TSDB_TRANS_OPER_LEN 16
/**
* In some scenarios uint16_t (0~65535) is used to store the row len.
@@ -482,6 +483,7 @@ enum {
#define SNODE_HANDLE -2
#define VNODE_HANDLE -3
#define BNODE_HANDLE -4
+#define CLIENT_HANDLE -5
#define TSDB_CONFIG_OPTION_LEN 32
#define TSDB_CONFIG_VALUE_LEN 64
diff --git a/include/util/tutil.h b/include/util/tutil.h
index 32a88b37ecffc16c2a222d73d9fe452e6fcaacac..c22495b75fdb0fe0a035d7f30809c3a9152d0798 100644
--- a/include/util/tutil.h
+++ b/include/util/tutil.h
@@ -62,6 +62,7 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar
tMD5Final(&context);
char buf[TSDB_PASSWORD_LEN + 1];
+ buf[TSDB_PASSWORD_LEN] = 0;
sprintf(buf, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", context.digest[0], context.digest[1],
context.digest[2], context.digest[3], context.digest[4], context.digest[5], context.digest[6],
context.digest[7], context.digest[8], context.digest[9], context.digest[10], context.digest[11],
diff --git a/packaging/docker/dockerManifest.sh b/packaging/docker/dockerManifest.sh
index 71788423f6e58b2788346ef2804cd4d03ee54b02..8f71e30fbdca1cc9adf8e9b46c652475822e4b08 100755
--- a/packaging/docker/dockerManifest.sh
+++ b/packaging/docker/dockerManifest.sh
@@ -1,6 +1,7 @@
#!/bin/bash
set -e
#set -x
+set -v
# dockerbuild.sh
# -n [version number]
@@ -11,8 +12,9 @@ set -e
version=""
passWord=""
verType=""
+dockerLatest="n"
-while getopts "hn:p:V:" arg
+while getopts "hn:p:V:a:" arg
do
case $arg in
n)
@@ -29,9 +31,15 @@ do
;;
h)
echo "Usage: `basename $0` -n [version number] "
- echo " -p [password for docker hub] "
+ echo " -p [password for docker hub] "
+ echo " -V [stable |beta] "
+ echo " -a [y | n ] "
exit 0
;;
+ a)
+ #echo "dockerLatest=$OPTARG"
+ dockerLatest=$(echo $OPTARG)
+ ;;
?) #unknow option
echo "unkonw argument"
exit 1
@@ -41,42 +49,55 @@ done
echo "version=${version}"
-#docker manifest rm tdengine/tdengine
-#docker manifest rm tdengine/tdengine:${version}
-if [ "$verType" == "beta" ]; then
- docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
- docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
- docker manifest rm tdengine/tdengine-beta:${version}
- docker manifest rm tdengine/tdengine-beta:latest
- docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
- docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
- docker manifest inspect tdengine/tdengine:latest
- docker manifest inspect tdengine/tdengine:${version}
- docker login -u tdengine -p ${passWord} #replace the docker registry username and password
- docker manifest push tdengine/tdengine-beta:${version}
- docker manifest push tdengine/tdengine-beta:latest
-elif [ "$verType" == "stable" ]; then
- docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
- docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
- docker manifest rm tdengine/tdengine:latest
- docker manifest rm tdengine/tdengine:${version}
- docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
- docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
- docker manifest inspect tdengine/tdengine:latest
- docker manifest inspect tdengine/tdengine:${version}
- docker login -u tdengine -p ${passWord} #replace the docker registry username and password
- docker manifest push tdengine/tdengine:${version}
- docker manifest push tdengine/tdengine:latest
-else
+if [ "$verType" == "stable" ]; then
+ verType=stable
+ dockerinput=TDengine-server-${version}-Linux-$cpuType.tar.gz
+ dockerinput_x64=TDengine-server-${version}-Linux-amd64.tar.gz
+ dockerim=tdengine/tdengine
+ dockeramd64=tdengine/tdengine-amd64
+ dockeraarch64=tdengine/tdengine-aarch64
+ dockeraarch32=tdengine/tdengine-aarch32
+elif [ "$verType" == "beta" ];then
+ verType=beta
+ tagVal=ver-${version}-beta
+ dockerinput=TDengine-server-${version}-${verType}-Linux-$cpuType.tar.gz
+ dockerinput_x64=TDengine-server-${version}-${verType}-Linux-amd64.tar.gz
+ dockerim=tdengine/tdengine-beta
+ dockeramd64=tdengine/tdengine-amd64-beta
+ dockeraarch64=tdengine/tdengine-aarch64-beta
+ dockeraarch32=tdengine/tdengine-aarch32-beta
+ else
echo "unknow verType, nor stabel or beta"
exit 1
fi
-# docker manifest create -a tdengine/${dockername}:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
-# docker manifest create -a tdengine/${dockername}:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
+username="tdengine"
-# docker login -u tdengine -p ${passWord} #replace the docker registry username and password
+# generate docker verison
+echo "generate ${dockerim}:${version}"
+docker manifest create -a ${dockerim}:${version} ${dockeramd64}:${version} ${dockeraarch64}:${version}
+docker manifest inspect ${dockerim}:${version}
+docker manifest rm ${dockerim}:${version}
+docker manifest create -a ${dockerim}:${version} ${dockeramd64}:${version} ${dockeraarch64}:${version}
+docker manifest inspect ${dockerim}:${version}
+docker login -u ${username} -p ${passWord}
+docker manifest push ${dockerim}:${version}
+
+
+# generate docker latest
+echo "generate ${dockerim}:latest "
+
+if [ ${dockerLatest} == 'y' ] ;then
+ echo "docker manifest create -a ${dockerim}:latest ${dockeramd64}:latest ${dockeraarch64}:latest"
+ docker manifest create -a ${dockerim}:latest ${dockeramd64}:latest ${dockeraarch64}:latest
+ docker manifest inspect ${dockerim}:latest
+ docker manifest rm ${dockerim}:latest
+ docker manifest create -a ${dockerim}:latest ${dockeramd64}:latest ${dockeraarch64}:latest
+ docker manifest inspect ${dockerim}:latest
+ docker login -u tdengine -p ${passWord} #replace the docker registry username and password
+ docker manifest push ${dockerim}:latest
+ docker pull tdengine/tdengine:latest
+
+fi
-# docker manifest push tdengine/tdengine:latest
-# # how set latest version ???
diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh
index 541ae6ec1398ae40a450382d25aa53bec18a8ced..8b0b0c190c5acd9352ddc2699db3375e18d5fb9c 100755
--- a/packaging/docker/dockerbuild.sh
+++ b/packaging/docker/dockerbuild.sh
@@ -149,26 +149,4 @@ rm -rf temp1.data
if [ ${dockerLatest} == 'y' ] ;then
docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest
docker push tdengine/tdengine-${dockername}:latest
- echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:latest has been published correctly"
- docker run -d --name doctestla -p 7030-7049:6030-6049 -p 7030-7049:6030-6049/udp tdengine/tdengine-${dockername}:latest
- sleep 2
- curl -u root:taosdata -d 'show variables;' 127.0.0.1:7041/rest/sql > temp2.data
- version_latest=` cat temp2.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]" `
- echo "${version_latest}"
- if [ "${version_latest}" == "\"${version}\"" ] ; then
- echo "docker version is right "
- else
- echo "docker version is wrong "
- exit 1
- fi
fi
-rm -rf temp2.data
-
-if [ -n "$(docker ps -aq)" ] ;then
- echo "delte docker process"
- docker stop $(docker ps -aq)
- docker rm $(docker ps -aq)
-fi
-
-cd ${scriptDir}
-rm -f ${pkgFile}
diff --git a/packaging/release.bat b/packaging/release.bat
index 591227382f9cec4a2fa1308a9b827994430f7236..b87ae68e2b2f8b0507992206af6ed482e5a9392c 100644
--- a/packaging/release.bat
+++ b/packaging/release.bat
@@ -44,8 +44,6 @@ cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=tru
cmake --build .
rd /s /Q C:\TDengine
cmake --install .
-for /r c:\TDengine %%i in (*.dll) do signtool sign /f D:\\123.pfx /p taosdata %%i
-for /r c:\TDengine %%i in (*.exe) do signtool sign /f D:\\123.pfx /p taosdata %%i
if not %errorlevel% == 0 ( call :RUNFAILED build x64 failed & exit /b 1)
cd %package_dir%
iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release
@@ -53,7 +51,6 @@ if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x64% faile
iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release
if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x64% failed & exit /b 1)
-for /r ..\release %%i in (*.exe) do signtool sign /f d:\\123.pfx /p taosdata %%i
goto EXIT0
:USAGE
diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh
index 794b3968fe4df178e3da91d2ebbd1512e288a57e..20f93ecaec41045fca38c552e0b150c65b37c0be 100755
--- a/packaging/testpackage.sh
+++ b/packaging/testpackage.sh
@@ -202,8 +202,8 @@ elif [[ ${packgeName} =~ "tar" ]];then
cd ${oriInstallPath}/${originTdpPath} && tar xf ${subFile}
fi
- cd ${oriInstallPath}/${originTdpPath} && tree > ${installPath}/base_${originversion}_checkfile
- cd ${installPath}/${tdPath} && tree > ${installPath}/now_${version}_checkfile
+ cd ${oriInstallPath}/${originTdpPath} && tree -I "driver" > ${installPath}/base_${originversion}_checkfile
+ cd ${installPath}/${tdPath} && tree -I "driver" > ${installPath}/now_${version}_checkfile
cd ${installPath}
diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log
@@ -215,6 +215,7 @@ elif [[ ${packgeName} =~ "tar" ]];then
exit -1
else
echoColor G "The number and names of files are the same as previous installation packages"
+ rm -rf ${installPath}/diffFile.log
fi
echoColor YD "===== install Package of tar ====="
cd ${installPath}/${tdPath}
@@ -251,6 +252,9 @@ if [[ ${packgeName} =~ "server" ]] ;then
systemctl restart taosd
fi
+rm -rf ${installPath}/${packgeName}
+rm -rf ${installPath}/${tdPath}/
+
# if ([[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "tar" ]]) || [[ ${packgeName} =~ "client" ]] ;then
# echoColor G "===== install taos-tools when package is lite or client ====="
# cd ${installPath}
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 574d8188fef5b2866b17f7a9f8f7842f162421a3..535a436c6c17dfd90603f40dc189bcff5b2902d2 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -59,9 +59,9 @@ enum {
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
-#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
-#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
-#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
+#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
+#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
+#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA)
typedef struct SAppInstInfo SAppInstInfo;
@@ -250,6 +250,8 @@ typedef struct SRequestObj {
bool inRetry;
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
uint32_t retry;
+ int64_t allocatorRefId;
+ SQuery* pQuery;
} SRequestObj;
typedef struct SSyncQueryParam {
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index b739aedca0ff7c8bd8e408e2e456aa7414f1ac30..6a4ef3d821ce4180e40b48d58f423477997628e7 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -27,6 +27,7 @@
#include "trpc.h"
#include "tsched.h"
#include "ttime.h"
+#include "qworker.h"
#define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_RELEASED 0
@@ -288,6 +289,7 @@ void *createRequest(uint64_t connId, int32_t type) {
pRequest->body.resInfo.convertUcs4 = true; // convert ucs4 by default
pRequest->type = type;
+ pRequest->allocatorRefId = -1;
pRequest->pDb = getDbOfConnection(pTscObj);
pRequest->pTscObj = pTscObj;
@@ -349,6 +351,8 @@ void doDestroyRequest(void *p) {
taosArrayDestroy(pRequest->tableList);
taosArrayDestroy(pRequest->dbList);
taosArrayDestroy(pRequest->targetTableList);
+ qDestroyQuery(pRequest->pQuery);
+ nodesDestroyAllocator(pRequest->allocatorRefId);
destroyQueryExecRes(&pRequest->body.resInfo.execRes);
@@ -411,6 +415,7 @@ void taos_init_imp(void) {
initTaskQueue();
fmFuncMgtInit();
+ nodesInitAllocatorSet();
clientConnRefPool = taosOpenRef(200, destroyTscObj);
clientReqRefPool = taosOpenRef(40960, doDestroyRequest);
diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c
index 75ccd44977c38539000fa9888fa7ad033cc653b5..096e2cdac8b892673de7e991f64a60dcb7dc8f6d 100644
--- a/source/client/src/clientHb.c
+++ b/source/client/src/clientHb.c
@@ -274,13 +274,13 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
SClientHbBatchRsp pRsp = {0};
if (TSDB_CODE_SUCCESS == code) {
tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp);
- }
- int32_t now = taosGetTimestampSec();
- int32_t delta = abs(now - pRsp.svrTimestamp);
- if (delta > timestampDeltaLimit) {
- code = TSDB_CODE_TIME_UNSYNCED;
- tscError("time diff: %ds is too big", delta);
+ int32_t now = taosGetTimestampSec();
+ int32_t delta = abs(now - pRsp.svrTimestamp);
+ if (delta > timestampDeltaLimit) {
+ code = TSDB_CODE_TIME_UNSYNCED;
+ tscError("time diff: %ds is too big", delta);
+ }
}
int32_t rspNum = taosArrayGetSize(pRsp.rsps);
@@ -606,28 +606,34 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt);
pBatchReq->reqs = taosArrayInit(connKeyCnt, sizeof(SClientHbReq));
+ int64_t rid = -1;
int32_t code = 0;
- void *pIter = taosHashIterate(pAppHbMgr->activeInfo, NULL);
- while (pIter != NULL) {
- SClientHbReq *pOneReq = pIter;
- pOneReq = taosArrayPush(pBatchReq->reqs, pOneReq);
+ void *pIter = taosHashIterate(pAppHbMgr->activeInfo, NULL);
+
+ SClientHbReq *pOneReq = pIter;
+ SClientHbKey *connKey = pOneReq ? &pOneReq->connKey : NULL;
+ if (connKey != NULL) rid = connKey->tscRid;
+ STscObj *pTscObj = (STscObj *)acquireTscObj(rid);
+ if (pTscObj == NULL) {
+ tFreeClientHbBatchReq(pBatchReq);
+ return NULL;
+ }
+
+ while (pIter != NULL) {
+ pOneReq = taosArrayPush(pBatchReq->reqs, pOneReq);
code = (*clientHbMgr.reqHandle[pOneReq->connKey.connType])(&pOneReq->connKey, &pOneReq->clusterId, pOneReq);
if (code) {
pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter);
+ pOneReq = pIter;
continue;
}
- // hbClearClientHbReq(pOneReq);
-
pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter);
+ pOneReq = pIter;
}
-
- // if (code) {
- // taosArrayDestroyEx(pBatchReq->reqs, hbFreeReq);
- // taosMemoryFreeClear(pBatchReq);
- // }
+ releaseTscObj(rid);
return pBatchReq;
}
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index 5128695359b9628d873af0a75373e530f78a6403..be907ea1e27cadb391f3010a3ba2e19735a83055 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -195,6 +195,19 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
+ (*pRequest)->allocatorRefId = -1;
+ if (tsQueryUseNodeAllocator && !qIsInsertValuesSql((*pRequest)->sqlstr, (*pRequest)->sqlLen)) {
+ if (TSDB_CODE_SUCCESS !=
+ nodesCreateAllocator((*pRequest)->requestId, tsQueryNodeChunkSize, &((*pRequest)->allocatorRefId))) {
+ tscError("%d failed to create node allocator, reqId:0x%" PRIx64 ", conn:%d, %s", (*pRequest)->self,
+ (*pRequest)->requestId, pTscObj->id, sql);
+
+ destroyRequest(*pRequest);
+ *pRequest = NULL;
+ return TSDB_CODE_TSC_OUT_OF_MEMORY;
+ }
+ }
+
tscDebugL("0x%" PRIx64 " SQL: %s, reqId:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId);
return TSDB_CODE_SUCCESS;
}
@@ -366,7 +379,7 @@ int32_t updateQnodeList(SAppInstInfo* pInfo, SArray* pNodeList) {
}
bool qnodeRequired(SRequestObj* pRequest) {
- if (QUERY_POLICY_VNODE == tsQueryPolicy) {
+ if (QUERY_POLICY_VNODE == tsQueryPolicy || QUERY_POLICY_CLIENT == tsQueryPolicy) {
return false;
}
@@ -470,7 +483,8 @@ void setResPrecision(SReqResultInfo* pResInfo, int32_t precision) {
int32_t buildVnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray* pMnodeList, SArray* pDbVgList) {
SArray* nodeList = taosArrayInit(4, sizeof(SQueryNodeLoad));
-
+ char *policy = (tsQueryPolicy == QUERY_POLICY_VNODE) ? "vnode" : "client";
+
int32_t dbNum = taosArrayGetSize(pDbVgList);
for (int32_t i = 0; i < dbNum; ++i) {
SArray* pVg = taosArrayGetP(pDbVgList, i);
@@ -491,20 +505,20 @@ int32_t buildVnodePolicyNodeList(SRequestObj* pRequest, SArray** pNodeList, SArr
int32_t vnodeNum = taosArrayGetSize(nodeList);
if (vnodeNum > 0) {
- tscDebug("0x%" PRIx64 " vnode policy, use vnode list, num:%d", pRequest->requestId, vnodeNum);
+ tscDebug("0x%" PRIx64 " %s policy, use vnode list, num:%d", pRequest->requestId, policy, vnodeNum);
goto _return;
}
int32_t mnodeNum = taosArrayGetSize(pMnodeList);
if (mnodeNum <= 0) {
- tscDebug("0x%" PRIx64 " vnode policy, empty node list", pRequest->requestId);
+ tscDebug("0x%" PRIx64 " %s policy, empty node list", pRequest->requestId, policy);
goto _return;
}
void* pData = taosArrayGet(pMnodeList, 0);
taosArrayAddBatch(nodeList, pData, mnodeNum);
- tscDebug("0x%" PRIx64 " vnode policy, use mnode list, num:%d", pRequest->requestId, mnodeNum);
+ tscDebug("0x%" PRIx64 " %s policy, use mnode list, num:%d", pRequest->requestId, policy, mnodeNum);
_return:
@@ -548,7 +562,8 @@ int32_t buildAsyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray
int32_t code = 0;
switch (tsQueryPolicy) {
- case QUERY_POLICY_VNODE: {
+ case QUERY_POLICY_VNODE:
+ case QUERY_POLICY_CLIENT: {
if (pResultMeta) {
pDbVgList = taosArrayInit(4, POINTER_BYTES);
@@ -609,7 +624,8 @@ int32_t buildSyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray*
int32_t code = 0;
switch (tsQueryPolicy) {
- case QUERY_POLICY_VNODE: {
+ case QUERY_POLICY_VNODE:
+ case QUERY_POLICY_CLIENT: {
int32_t dbNum = taosArrayGetSize(pRequest->dbList);
if (dbNum > 0) {
SCatalog* pCtg = NULL;
@@ -669,6 +685,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
.requestObjRefId = pRequest->self};
SSchedulerReq req = {
.syncReq = true,
+ .localReq = (tsQueryPolicy == QUERY_POLICY_CLIENT),
.pConn = &conn,
.pNodeList = pNodeList,
.pDag = pDag,
@@ -682,6 +699,8 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
};
int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob);
+
+ destroyQueryExecRes(&pRequest->body.resInfo.execRes);
memcpy(&pRequest->body.resInfo.execRes, &res, sizeof(res));
if (code != TSDB_CODE_SUCCESS) {
@@ -1023,7 +1042,8 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
.pMsg = pRequest->msgBuf,
.msgLen = ERROR_MSG_BUF_DEFAULT_SIZE,
.pUser = pRequest->pTscObj->user,
- .sysInfo = pRequest->pTscObj->sysInfo};
+ .sysInfo = pRequest->pTscObj->sysInfo,
+ .allocatorId = pRequest->allocatorRefId};
SAppInstInfo* pAppInfo = getAppInfo(pRequest);
SQueryPlan* pDag = NULL;
@@ -1045,9 +1065,11 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
.pTrans = pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self};
SSchedulerReq req = {
.syncReq = false,
+ .localReq = (tsQueryPolicy == QUERY_POLICY_CLIENT),
.pConn = &conn,
.pNodeList = pNodeList,
.pDag = pDag,
+ .allocatorRefId = pRequest->allocatorRefId,
.sql = pRequest->sqlstr,
.startTs = pRequest->metric.start,
.execFp = schedulerExecCb,
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index 13cbaa0e2290eb186ed439ccdc965ebeb736a40f..650b16f8553a88b662f00ab5dba2951ad9ef2984 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -26,6 +26,7 @@
#include "tref.h"
#include "trpc.h"
#include "version.h"
+#include "qworker.h"
#define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_RELEASED 0
@@ -65,6 +66,7 @@ void taos_cleanup(void) {
fmFuncMgtDestroy();
qCleanupKeywordsTable();
+ nodesDestroyAllocatorSet();
id = clientConnRefPool;
clientConnRefPool = -1;
@@ -669,7 +671,6 @@ typedef struct SqlParseWrapper {
SParseContext *pCtx;
SCatalogReq catalogReq;
SRequestObj *pRequest;
- SQuery *pQuery;
} SqlParseWrapper;
static void destoryTablesReq(void *p) {
@@ -695,8 +696,8 @@ static void destorySqlParseWrapper(SqlParseWrapper *pWrapper) {
void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
SqlParseWrapper *pWrapper = (SqlParseWrapper *)param;
- SQuery *pQuery = pWrapper->pQuery;
SRequestObj *pRequest = pWrapper->pRequest;
+ SQuery *pQuery = pRequest->pQuery;
pRequest->metric.ctgEnd = taosGetTimestampUs();
@@ -725,10 +726,10 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
tscDebug("0x%" PRIx64 " analysis semantics completed, start async query, reqId:0x%" PRIx64, pRequest->self,
pRequest->requestId);
launchAsyncQuery(pRequest, pQuery, pResultMeta);
- qDestroyQuery(pQuery);
} else {
destorySqlParseWrapper(pWrapper);
- qDestroyQuery(pQuery);
+ qDestroyQuery(pRequest->pQuery);
+ pRequest->pQuery = NULL;
if (NEED_CLIENT_HANDLE_ERROR(code)) {
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64,
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
@@ -775,7 +776,8 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
.enableSysInfo = pTscObj->sysInfo,
.async = true,
.svrVer = pTscObj->sVer,
- .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes)};
+ .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes),
+ .allocatorId = pRequest->allocatorRefId};
return TSDB_CODE_SUCCESS;
}
@@ -800,12 +802,10 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
goto _error;
}
- SQuery *pQuery = NULL;
-
pRequest->metric.syntaxStart = taosGetTimestampUs();
SCatalogReq catalogReq = {.forceUpdate = updateMetaForce, .qNodeRequired = qnodeRequired(pRequest)};
- code = qParseSqlSyntax(pCxt, &pQuery, &catalogReq);
+ code = qParseSqlSyntax(pCxt, &pRequest->pQuery, &catalogReq);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
@@ -815,9 +815,9 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
if (!updateMetaForce) {
STscObj *pTscObj = pRequest->pTscObj;
SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
- if (NULL == pQuery->pRoot) {
+ if (NULL == pRequest->pQuery->pRoot) {
atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
- } else if (QUERY_NODE_SELECT_STMT == pQuery->pRoot->type) {
+ } else if (QUERY_NODE_SELECT_STMT == pRequest->pQuery->pRoot->type) {
atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1);
}
}
@@ -829,7 +829,6 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
}
pWrapper->pCtx = pCxt;
- pWrapper->pQuery = pQuery;
pWrapper->pRequest = pRequest;
pWrapper->catalogReq = catalogReq;
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index 25abd65b40b5023fa08eb3934a16b8b74ba460b2..a45f7b2913938ae9884940f45631d0f7c49ed1e8 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -227,6 +227,7 @@ static const SSysDbTableSchema transSchema[] = {
{.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 = "oper", .bytes = TSDB_TRANS_OPER_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "stable", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "failed_times", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index 8a8e6a83a55af2a584b38f7d279b5827fbfb6c86..23cc8686587594d8c101a6912923af6a3c20df3f 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -1278,7 +1278,9 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
colDataAssign(pDst, pSrc, src->info.rows, &src->info);
}
+ uint32_t cap = dst->info.capacity;
dst->info = src->info;
+ dst->info.capacity = cap;
return 0;
}
@@ -1302,8 +1304,9 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
colDataAssign(pDst, pSrc, src->info.rows, &src->info);
}
-
+ uint32_t cap = dst->info.capacity;
dst->info = src->info;
+ dst->info.capacity = cap;
return TSDB_CODE_SUCCESS;
}
@@ -1333,6 +1336,8 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) {
// group id
taosArrayPush(pBlock->pDataBlock, &infoData);
+ infoData.info.type = TSDB_DATA_TYPE_TIMESTAMP;
+ infoData.info.bytes = sizeof(TSKEY);
// calculate start ts
taosArrayPush(pBlock->pDataBlock, &infoData);
// calculate end ts
@@ -2280,4 +2285,3 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
ASSERT(pStart - pData == dataLen);
return pStart;
}
-
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index a6e30ae0b5b77479d8b3e6cf6c130f5c8817da04..e2e59108aa924b883e451af3aebc2282bd4dc6c7 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -58,7 +58,7 @@ int32_t tsNumOfMnodeFetchThreads = 1;
int32_t tsNumOfMnodeReadThreads = 1;
int32_t tsNumOfVnodeQueryThreads = 4;
int32_t tsNumOfVnodeStreamThreads = 2;
-int32_t tsNumOfVnodeFetchThreads = 4;
+int32_t tsNumOfVnodeFetchThreads = 1;
int32_t tsNumOfVnodeWriteThreads = 2;
int32_t tsNumOfVnodeSyncThreads = 2;
int32_t tsNumOfVnodeRsmaThreads = 2;
@@ -91,7 +91,10 @@ bool tsSmlDataFormat =
// query
int32_t tsQueryPolicy = 1;
int32_t tsQuerySmaOptimize = 0;
+int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data.
bool tsQueryPlannerTrace = false;
+int32_t tsQueryNodeChunkSize = 32 * 1024;
+bool tsQueryUseNodeAllocator = true;
/*
* denote if the server needs to compress response message at the application layer to client, including query rsp,
@@ -162,8 +165,8 @@ int32_t tsMqRebalanceInterval = 2;
int32_t tsTtlUnit = 86400;
int32_t tsTtlPushInterval = 86400;
int32_t tsGrantHBInterval = 60;
-int32_t tsUptimeInterval = 300; // seconds
-char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits
+int32_t tsUptimeInterval = 300; // seconds
+char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits
#ifndef _STORAGE
int32_t taosSetTfsCfg(SConfig *pCfg) {
@@ -282,9 +285,11 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "shellActivityTimer", tsShellActivityTimer, 1, 120, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "compressColData", tsCompressColData, -1, 100000000, 1) != 0) return -1;
- if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 1) != 0) return -1;
+ if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 4, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, 1) != 0) return -1;
if (cfgAddBool(pCfg, "queryPlannerTrace", tsQueryPlannerTrace, true) != 0) return -1;
+ if (cfgAddInt32(pCfg, "queryNodeChunkSize", tsQueryNodeChunkSize, 1024, 128 * 1024, true) != 0) return -1;
+ if (cfgAddBool(pCfg, "queryUseNodeAllocator", tsQueryUseNodeAllocator, true) != 0) return -1;
if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1;
if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1;
if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
@@ -366,9 +371,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
tsNumOfVnodeStreamThreads = TMAX(tsNumOfVnodeStreamThreads, 4);
if (cfgAddInt32(pCfg, "numOfVnodeStreamThreads", tsNumOfVnodeStreamThreads, 4, 1024, 0) != 0) return -1;
- tsNumOfVnodeFetchThreads = tsNumOfCores / 4;
- tsNumOfVnodeFetchThreads = TMAX(tsNumOfVnodeFetchThreads, 4);
- if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 4, 1024, 0) != 0) return -1;
+ tsNumOfVnodeFetchThreads = 1;
+ if (cfgAddInt32(pCfg, "numOfVnodeFetchThreads", tsNumOfVnodeFetchThreads, 1, 1024, 0) != 0) return -1;
tsNumOfVnodeWriteThreads = tsNumOfCores;
tsNumOfVnodeWriteThreads = TMAX(tsNumOfVnodeWriteThreads, 1);
@@ -420,6 +424,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
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 (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, 0) != 0) return -1;
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
@@ -645,6 +650,8 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tsQueryPolicy = cfgGetItem(pCfg, "queryPolicy")->i32;
tsQuerySmaOptimize = cfgGetItem(pCfg, "querySmaOptimize")->i32;
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
+ tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
+ tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval;
return 0;
}
@@ -717,6 +724,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32;
tsTtlPushInterval = cfgGetItem(pCfg, "ttlPushInterval")->i32;
tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32;
+ tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32;
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
@@ -979,6 +987,12 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
} else if (strcasecmp("queryPlannerTrace", name) == 0) {
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
+ } else if (strcasecmp("queryNodeChunkSize", name) == 0) {
+ tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32;
+ } else if (strcasecmp("queryUseNodeAllocator", name) == 0) {
+ tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval;
+ } else if (strcasecmp("queryRsmaTolerance", name) == 0) {
+ tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32;
}
break;
}
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 09908150248c7ad1f098d4751ea5fee655ad078f..e4f3a89272fee0e2f54324f3d1c45193ea630bbf 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -4365,7 +4365,7 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
if (tStartDecode(&decoder) < 0) return -1;
if (tDecodeI32(&decoder, &pRsp->numOfPlans) < 0) return -1;
if (pRsp->numOfPlans > 0) {
- pRsp->subplanInfo = taosMemoryMalloc(pRsp->numOfPlans * sizeof(SExplainExecInfo));
+ pRsp->subplanInfo = taosMemoryCalloc(pRsp->numOfPlans, sizeof(SExplainExecInfo));
if (pRsp->subplanInfo == NULL) return -1;
}
for (int32_t i = 0; i < pRsp->numOfPlans; ++i) {
@@ -4373,7 +4373,7 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
if (tDecodeDouble(&decoder, &pRsp->subplanInfo[i].totalCost) < 0) return -1;
if (tDecodeU64(&decoder, &pRsp->subplanInfo[i].numOfRows) < 0) return -1;
if (tDecodeU32(&decoder, &pRsp->subplanInfo[i].verboseLen) < 0) return -1;
- if (tDecodeBinary(&decoder, (uint8_t **)&pRsp->subplanInfo[i].verboseInfo, &pRsp->subplanInfo[i].verboseLen) < 0)
+ if (tDecodeBinaryAlloc(&decoder, &pRsp->subplanInfo[i].verboseInfo, NULL) < 0)
return -1;
}
@@ -4383,6 +4383,19 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
return 0;
}
+void tFreeSExplainRsp(SExplainRsp *pRsp) {
+ if (NULL == pRsp) {
+ return;
+ }
+
+ for (int32_t i = 0; i < pRsp->numOfPlans; ++i) {
+ SExplainExecInfo *pExec = pRsp->subplanInfo + i;
+ taosMemoryFree(pExec->verboseInfo);
+ }
+
+ taosMemoryFreeClear(pRsp->subplanInfo);
+}
+
int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pReq) {
int32_t headLen = sizeof(SMsgHead);
if (buf != NULL) {
diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
index ebbb9fa5d4f820cbdc46f92590dabc56161c80b2..30f54831987999daccac93f5b6cbd0ccc2dfbf28 100644
--- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
+++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
@@ -74,6 +74,7 @@ typedef struct {
TdThread thread;
SVnodeMgmt *pMgmt;
SWrapperCfg *pCfgs;
+ SVnodeObj **ppVnodes;
} SVnodeThread;
// vmInt.c
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
index 1f981cc9e0fbc6b119542980e241e20bb06b1fde..f0c43d8b36bcda71208dcdbb3b9c3841607fc879 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
@@ -218,14 +218,14 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) {
dInfo("start to close all vnodes");
int32_t numOfVnodes = 0;
- SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
+ SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
for (int32_t i = 0; i < numOfVnodes; ++i) {
- vmCloseVnode(pMgmt, pVnodes[i]);
+ vmCloseVnode(pMgmt, ppVnodes[i]);
}
- if (pVnodes != NULL) {
- taosMemoryFree(pVnodes);
+ if (ppVnodes != NULL) {
+ taosMemoryFree(ppVnodes);
}
if (pMgmt->hash != NULL) {
@@ -331,22 +331,92 @@ static int32_t vmRequire(const SMgmtInputOpt *pInput, bool *required) {
return 0;
}
-static int32_t vmStart(SVnodeMgmt *pMgmt) {
+static void *vmRestoreVnodeInThread(void *param) {
+ SVnodeThread *pThread = param;
+ SVnodeMgmt *pMgmt = pThread->pMgmt;
+
+ dInfo("thread:%d, start to restore %d vnodes", pThread->threadIndex, pThread->vnodeNum);
+ setThreadName("restore-vnodes");
+
+ for (int32_t v = 0; v < pThread->vnodeNum; ++v) {
+ SVnodeObj *pVnode = pThread->ppVnodes[v];
+
+ char stepDesc[TSDB_STEP_DESC_LEN] = {0};
+ snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been restored", pVnode->vgId,
+ pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
+ tmsgReportStartup("vnode-restore", stepDesc);
+
+ int32_t code = vnodeStart(pVnode->pImpl);
+ if (code != 0) {
+ dError("vgId:%d, failed to restore vnode by thread:%d", pVnode->vgId, pThread->threadIndex);
+ pThread->failed++;
+ } else {
+ dDebug("vgId:%d, is restored by thread:%d", pVnode->vgId, pThread->threadIndex);
+ pThread->opened++;
+ atomic_add_fetch_32(&pMgmt->state.openVnodes, 1);
+ }
+ }
+
+ dInfo("thread:%d, numOfVnodes:%d, restored:%d failed:%d", pThread->threadIndex, pThread->vnodeNum, pThread->opened,
+ pThread->failed);
+ return NULL;
+}
+
+static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) {
int32_t numOfVnodes = 0;
- SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
+ SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
- for (int32_t i = 0; i < numOfVnodes; ++i) {
- SVnodeObj *pVnode = pVnodes[i];
- vnodeStart(pVnode->pImpl);
+ int32_t threadNum = tsNumOfCores / 2;
+ if (threadNum < 1) threadNum = 1;
+ int32_t vnodesPerThread = numOfVnodes / threadNum + 1;
+
+ SVnodeThread *threads = taosMemoryCalloc(threadNum, sizeof(SVnodeThread));
+ for (int32_t t = 0; t < threadNum; ++t) {
+ threads[t].threadIndex = t;
+ threads[t].pMgmt = pMgmt;
+ threads[t].ppVnodes = taosMemoryCalloc(vnodesPerThread, sizeof(SVnode *));
}
+ for (int32_t v = 0; v < numOfVnodes; ++v) {
+ int32_t t = v % threadNum;
+ SVnodeThread *pThread = &threads[t];
+ pThread->ppVnodes[pThread->vnodeNum++] = ppVnodes[v];
+ }
+
+ pMgmt->state.openVnodes = 0;
+ dInfo("restore %d vnodes with %d threads", numOfVnodes, threadNum);
+
+ for (int32_t t = 0; t < threadNum; ++t) {
+ SVnodeThread *pThread = &threads[t];
+ if (pThread->vnodeNum == 0) continue;
+
+ TdThreadAttr thAttr;
+ taosThreadAttrInit(&thAttr);
+ taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
+ if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) {
+ dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno));
+ }
+
+ taosThreadAttrDestroy(&thAttr);
+ }
+
+ for (int32_t t = 0; t < threadNum; ++t) {
+ SVnodeThread *pThread = &threads[t];
+ if (pThread->vnodeNum > 0 && taosCheckPthreadValid(pThread->thread)) {
+ taosThreadJoin(pThread->thread, NULL);
+ taosThreadClear(&pThread->thread);
+ }
+ taosMemoryFree(pThread->ppVnodes);
+ }
+ taosMemoryFree(threads);
+
for (int32_t i = 0; i < numOfVnodes; ++i) {
- SVnodeObj *pVnode = pVnodes[i];
+ SVnodeObj *pVnode = ppVnodes[i];
vmReleaseVnode(pMgmt, pVnode);
}
- if (pVnodes != NULL) {
- taosMemoryFree(pVnodes);
+ if (ppVnodes != NULL) {
+ taosMemoryFree(ppVnodes);
}
return 0;
@@ -360,7 +430,7 @@ SMgmtFunc vmGetMgmtFunc() {
SMgmtFunc mgmtFunc = {0};
mgmtFunc.openFp = vmInit;
mgmtFunc.closeFp = (NodeCloseFp)vmCleanup;
- mgmtFunc.startFp = (NodeStartFp)vmStart;
+ mgmtFunc.startFp = (NodeStartFp)vmStartVnodes;
mgmtFunc.stopFp = (NodeStopFp)vmStop;
mgmtFunc.requiredFp = vmRequire;
mgmtFunc.getHandlesFp = vmGetMsgHandles;
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 537c9ca83480f0b23120f9d60920de98c763c00c..c3d03a6c5eb086997fd4920b8c6586e3c20c2649 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -171,6 +171,7 @@ typedef struct {
int32_t stopFunc;
int32_t paramLen;
void* param;
+ char opername[TSDB_TRANS_OPER_LEN];
SArray* pRpcArray;
} STrans;
diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h
index 36d056a9415dbd093f382bae65598a3037e79b5f..2372fa30e5bfc1e27b32ff10672929a328029865 100644
--- a/source/dnode/mnode/impl/inc/mndTrans.h
+++ b/source/dnode/mnode/impl/inc/mndTrans.h
@@ -61,7 +61,8 @@ void mndCleanupTrans(SMnode *pMnode);
STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId);
void mndReleaseTrans(SMnode *pMnode, STrans *pTrans);
-STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq);
+STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq,
+ const char *opername);
void mndTransDrop(STrans *pTrans);
int32_t mndTransAppendRedolog(STrans *pTrans, SSdbRaw *pRaw);
int32_t mndTransAppendUndolog(STrans *pTrans, SSdbRaw *pRaw);
diff --git a/source/dnode/mnode/impl/src/mndAcct.c b/source/dnode/mnode/impl/src/mndAcct.c
index 33f0bb7a34d667b8f25fb10b06e6e6a00e669d60..5279a86d83c3070242c8e8280f875005a399a421 100644
--- a/source/dnode/mnode/impl/src/mndAcct.c
+++ b/source/dnode/mnode/impl/src/mndAcct.c
@@ -79,14 +79,14 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
if (pRaw == NULL) return -1;
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- mDebug("acct:%s, will be created when deploying, raw:%p", acctObj.acct, pRaw);
+ mInfo("acct:%s, will be created when deploying, raw:%p", acctObj.acct, pRaw);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-acct");
if (pTrans == NULL) {
mError("acct:%s, failed to create since %s", acctObj.acct, terrstr());
return -1;
}
- mDebug("trans:%d, used to create acct:%s", pTrans->id, acctObj.acct);
+ mInfo("trans:%d, used to create acct:%s", pTrans->id, acctObj.acct);
if (mndTransAppendCommitlog(pTrans, pRaw) != 0) {
mError("trans:%d, failed to commit redo log since %s", pTrans->id, terrstr());
diff --git a/source/dnode/mnode/impl/src/mndBnode.c b/source/dnode/mnode/impl/src/mndBnode.c
index aafcd1999230e71a03c05422cfb538958f4d27c7..9cae83152a7ceba87d13d09ee10befb82c59d9fd 100644
--- a/source/dnode/mnode/impl/src/mndBnode.c
+++ b/source/dnode/mnode/impl/src/mndBnode.c
@@ -246,10 +246,10 @@ static int32_t mndCreateBnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
bnodeObj.createdTime = taosGetTimestampMs();
bnodeObj.updateTime = bnodeObj.createdTime;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-bnode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
+ mInfo("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
if (mndSetCreateBnodeRedoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
if (mndSetCreateBnodeUndoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
if (mndSetCreateBnodeCommitLogs(pTrans, &bnodeObj) != 0) goto _OVER;
@@ -276,7 +276,7 @@ static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("bnode:%d, start to create", createReq.dnodeId);
+ mInfo("bnode:%d, start to create", createReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_BNODE) != 0) {
goto _OVER;
}
@@ -354,10 +354,10 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
static int32_t mndDropBnode(SMnode *pMnode, SRpcMsg *pReq, SBnodeObj *pObj) {
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-bnode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
+ mInfo("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
if (mndSetDropBnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
if (mndSetDropBnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
if (mndSetDropBnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
@@ -381,7 +381,7 @@ static int32_t mndProcessDropBnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("bnode:%d, start to drop", dropReq.dnodeId);
+ mInfo("bnode:%d, start to drop", dropReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_BNODE) != 0) {
goto _OVER;
}
diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c
index 7d633f90bd937c24b82094bdc0fa6d30c30bc250..7a3dde3cf3792de86d190b21f0c2a5df5a1b9502 100644
--- a/source/dnode/mnode/impl/src/mndCluster.c
+++ b/source/dnode/mnode/impl/src/mndCluster.c
@@ -233,14 +233,14 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
if (pRaw == NULL) return -1;
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- mDebug("cluster:%" PRId64 ", will be created when deploying, raw:%p", clusterObj.id, pRaw);
+ mInfo("cluster:%" PRId64 ", will be created when deploying, raw:%p", clusterObj.id, pRaw);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-cluster");
if (pTrans == NULL) {
mError("cluster:%" PRId64 ", failed to create since %s", clusterObj.id, terrstr());
return -1;
}
- mDebug("trans:%d, used to create cluster:%" PRId64, pTrans->id, clusterObj.id);
+ mInfo("trans:%d, used to create cluster:%" PRId64, pTrans->id, clusterObj.id);
if (mndTransAppendCommitlog(pTrans, pRaw) != 0) {
mError("trans:%d, failed to commit redo log since %s", pTrans->id, terrstr());
@@ -316,7 +316,7 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
}
mTrace("update cluster uptime to %" PRId64, clusterObj.upTime);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-uptime");
if (pTrans == NULL) return -1;
SSdbRaw *pCommitRaw = mndClusterActionEncode(&clusterObj);
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index cdfa20866599925445b324bddca2049478bc0568..e0dbc26122dae92cf371834cedeb83f4fc536036 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -109,7 +109,7 @@ static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) {
mndReleaseConsumer(pMnode, pConsumer);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "lost-csm");
if (pTrans == NULL) goto FAIL;
if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL;
if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL;
@@ -142,7 +142,7 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) {
mndReleaseConsumer(pMnode, pConsumer);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "recover-csm");
if (pTrans == NULL) goto FAIL;
if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL;
if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL;
@@ -465,7 +465,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
int32_t newTopicNum = taosArrayGetSize(newSub);
// check topic existance
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "subscribe");
if (pTrans == NULL) goto SUBSCRIBE_OVER;
for (int32_t i = 0; i < newTopicNum; i++) {
diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c
index d42ba1f7ffc45f0fb70457c01c26b35ef206454f..a05d8dd73912ee7996239997dd365e5f5550bbcf 100644
--- a/source/dnode/mnode/impl/src/mndDb.c
+++ b/source/dnode/mnode/impl/src/mndDb.c
@@ -541,10 +541,10 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
}
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-db");
if (pTrans == NULL) goto _OVER;
// mndTransSetSerial(pTrans);
- mDebug("trans:%d, used to create db:%s", pTrans->id, pCreate->db);
+ mInfo("trans:%d, used to create db:%s", pTrans->id, pCreate->db);
mndTransSetDbName(pTrans, dbObj.name, NULL);
mndTransSetOper(pTrans, MND_OPER_CREATE_DB);
@@ -580,7 +580,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("db:%s, start to create, vgroups:%d", createReq.db, createReq.numOfVgroups);
+ mInfo("db:%s, start to create, vgroups:%d", createReq.db, createReq.numOfVgroups);
if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_DB, NULL) != 0) {
goto _OVER;
}
@@ -588,7 +588,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
pDb = mndAcquireDb(pMnode, createReq.db);
if (pDb != NULL) {
if (createReq.ignoreExist) {
- mDebug("db:%s, already exist, ignore exist is set", createReq.db);
+ mInfo("db:%s, already exist, ignore exist is set", createReq.db);
code = 0;
goto _OVER;
} else {
@@ -597,7 +597,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
}
} else if (terrno == TSDB_CODE_SDB_OBJ_CREATING) {
if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, createReq.db) == 0) {
- mDebug("db:%s, is creating and response after trans finished", createReq.db);
+ mInfo("db:%s, is creating and response after trans finished", createReq.db);
code = TSDB_CODE_ACTION_IN_PROGRESS;
goto _OVER;
} else {
@@ -773,9 +773,9 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
}
static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *pNew) {
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "alter-db");
if (pTrans == NULL) return -1;
- mDebug("trans:%d, used to alter db:%s", pTrans->id, pOld->name);
+ mInfo("trans:%d, used to alter db:%s", pTrans->id, pOld->name);
int32_t code = -1;
mndTransSetDbName(pTrans, pOld->name, NULL);
@@ -802,7 +802,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("db:%s, start to alter", alterReq.db);
+ mInfo("db:%s, start to alter", alterReq.db);
pDb = mndAcquireDb(pMnode, alterReq.db);
if (pDb == NULL) {
@@ -1027,10 +1027,10 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) {
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "drop-db");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to drop db:%s", pTrans->id, pDb->name);
+ mInfo("trans:%d, used to drop db:%s", pTrans->id, pDb->name);
mndTransSetDbName(pTrans, pDb->name, NULL);
if (mndCheckTopicExist(pMnode, pDb) < 0) goto _OVER;
@@ -1079,7 +1079,7 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("db:%s, start to drop", dropReq.db);
+ mInfo("db:%s, start to drop", dropReq.db);
pDb = mndAcquireDb(pMnode, dropReq.db);
if (pDb == NULL) {
@@ -1306,11 +1306,11 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
int32_t numOfTable = mndGetDBTableNum(pDb, pMnode);
if (pDbVgVersion->vgVersion >= pDb->vgVersion && numOfTable == pDbVgVersion->numOfTable) {
- mDebug("db:%s, version and numOfTable not changed", pDbVgVersion->dbFName);
+ mInfo("db:%s, version and numOfTable not changed", pDbVgVersion->dbFName);
mndReleaseDb(pMnode, pDb);
continue;
} else {
- mDebug("db:%s, vgroup version changed from %d to %d", pDbVgVersion->dbFName, pDbVgVersion->vgVersion,
+ mInfo("db:%s, vgroup version changed from %d to %d", pDbVgVersion->dbFName, pDbVgVersion->vgVersion,
pDb->vgVersion);
}
@@ -1363,7 +1363,7 @@ static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("db:%s, start to compact", compactReq.db);
+ mInfo("db:%s, start to compact", compactReq.db);
pDb = mndAcquireDb(pMnode, compactReq.db);
if (pDb == NULL) {
@@ -1413,7 +1413,7 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
if (code != 0) {
mError("vgId:%d, failed to send vnode-trim request to vnode since 0x%x", pVgroup->vgId, code);
} else {
- mDebug("vgId:%d, send vnode-trim request to vnode, time:%d", pVgroup->vgId, trimReq.timestamp);
+ mInfo("vgId:%d, send vnode-trim request to vnode, time:%d", pVgroup->vgId, trimReq.timestamp);
}
sdbRelease(pSdb, pVgroup);
}
@@ -1432,7 +1432,7 @@ static int32_t mndProcessTrimDbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("db:%s, start to trim", trimReq.db);
+ mInfo("db:%s, start to trim", trimReq.db);
pDb = mndAcquireDb(pMnode, trimReq.db);
if (pDb == NULL) {
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index 26b4080d14288bee23740394fa4e96755b90feb9..4a8436513fe4c278fe827ae79166b682652dcf61 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -104,9 +104,9 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
memcpy(&dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN);
snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-dnode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to create dnode:%s on first deploy", pTrans->id, dnodeObj.ep);
+ mInfo("trans:%d, used to create dnode:%s on first deploy", pTrans->id, dnodeObj.ep);
pRaw = mndDnodeActionEncode(&dnodeObj);
if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
@@ -326,7 +326,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
if (statusReq.dnodeId == 0) {
pDnode = mndAcquireDnodeByEp(pMnode, statusReq.dnodeEp);
if (pDnode == NULL) {
- mDebug("dnode:%s, not created yet", statusReq.dnodeEp);
+ mInfo("dnode:%s, not created yet", statusReq.dnodeEp);
goto _OVER;
}
} else {
@@ -435,7 +435,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
mInfo("dnode:%d, from offline to online, memory avail:%" PRId64 " total:%" PRId64 " cores:%.2f", pDnode->id,
statusReq.memAvail, statusReq.memTotal, statusReq.numOfCores);
} else {
- mDebug("dnode:%d, send dnode epset, online:%d dnodeVer:%" PRId64 ":%" PRId64 " reboot:%d", pDnode->id, online,
+ mInfo("dnode:%d, send dnode epset, online:%d dnodeVer:%" PRId64 ":%" PRId64 " reboot:%d", pDnode->id, online,
statusReq.dnodeVer, dnodeVer, reboot);
}
@@ -488,9 +488,9 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN);
snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
- pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep);
+ mInfo("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep);
pRaw = mndDnodeActionEncode(&dnodeObj);
if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER;
@@ -667,7 +667,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
SSdbRaw *pRaw = NULL;
STrans *pTrans = NULL;
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-dnode");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id);
diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c
index e6f4b485242d375fd635f1067acca4a3f2083423..48ab485a2c3077ce6f8db401ec2ca5db0e884117 100644
--- a/source/dnode/mnode/impl/src/mndFunc.c
+++ b/source/dnode/mnode/impl/src/mndFunc.c
@@ -219,10 +219,10 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
}
memcpy(func.pCode, pCreate->pCode, func.codeSize);
- pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-func");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to create func:%s", pTrans->id, pCreate->name);
+ mInfo("trans:%d, used to create func:%s", pTrans->id, pCreate->name);
SSdbRaw *pRedoRaw = mndFuncActionEncode(&func);
if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) goto _OVER;
@@ -249,10 +249,10 @@ _OVER:
static int32_t mndDropFunc(SMnode *pMnode, SRpcMsg *pReq, SFuncObj *pFunc) {
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-func");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to drop user:%s", pTrans->id, pFunc->name);
+ mInfo("trans:%d, used to drop user:%s", pTrans->id, pFunc->name);
SSdbRaw *pRedoRaw = mndFuncActionEncode(pFunc);
if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) goto _OVER;
@@ -286,7 +286,7 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("func:%s, start to create", createReq.name);
+ mInfo("func:%s, start to create", createReq.name);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_FUNC) != 0) {
goto _OVER;
}
@@ -294,7 +294,7 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
pFunc = mndAcquireFunc(pMnode, createReq.name);
if (pFunc != NULL) {
if (createReq.igExists) {
- mDebug("func:%s, already exist, ignore exist is set", createReq.name);
+ mInfo("func:%s, already exist, ignore exist is set", createReq.name);
code = 0;
goto _OVER;
} else {
@@ -349,7 +349,7 @@ static int32_t mndProcessDropFuncReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("func:%s, start to drop", dropReq.name);
+ mInfo("func:%s, start to drop", dropReq.name);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_FUNC) != 0) {
goto _OVER;
}
@@ -362,7 +362,7 @@ static int32_t mndProcessDropFuncReq(SRpcMsg *pReq) {
pFunc = mndAcquireFunc(pMnode, dropReq.name);
if (pFunc == NULL) {
if (dropReq.igNotExists) {
- mDebug("func:%s, not exist, ignore not exist is set", dropReq.name);
+ mInfo("func:%s, not exist, ignore not exist is set", dropReq.name);
code = 0;
goto _OVER;
} else {
diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c
index 2221718023c8d080059736fd811c946618fd948d..5aad4af9ac49fff9ffb6f8b08aac0e5bdc3f6c8a 100644
--- a/source/dnode/mnode/impl/src/mndMain.c
+++ b/source/dnode/mnode/impl/src/mndMain.c
@@ -65,7 +65,7 @@ static void mndPullupTrans(SMnode *pMnode) {
}
}
-static void mndTtlTimer(SMnode *pMnode) {
+static void mndPullupTtl(SMnode *pMnode) {
int32_t contLen = 0;
void *pReq = mndBuildTimerMsg(&contLen);
SRpcMsg rpcMsg = {.msgType = TDMT_MND_TTL_TIMER, .pCont = pReq, .contLen = contLen};
@@ -90,7 +90,7 @@ static void mndPullupTelem(SMnode *pMnode) {
}
}
-static void mndGrantHeartBeat(SMnode *pMnode) {
+static void mndPullupGrant(SMnode *pMnode) {
int32_t contLen = 0;
void *pReq = mndBuildTimerMsg(&contLen);
if (pReq != NULL) {
@@ -121,7 +121,7 @@ static void *mndThreadFp(void *param) {
if (mndGetStop(pMnode)) break;
if (lastTime % (tsTtlPushInterval * 10) == 1) {
- mndTtlTimer(pMnode);
+ mndPullupTtl(pMnode);
}
if (lastTime % (tsTransPullupInterval * 10) == 0) {
@@ -137,7 +137,7 @@ static void *mndThreadFp(void *param) {
}
if (lastTime % (tsGrantHBInterval * 10) == 0) {
- mndGrantHeartBeat(pMnode);
+ mndPullupGrant(pMnode);
}
if ((lastTime % (tsUptimeInterval * 10)) == ((tsUptimeInterval - 1) * 10)) {
@@ -300,7 +300,7 @@ static void mndCleanupSteps(SMnode *pMnode, int32_t pos) {
for (int32_t s = pos; s >= 0; s--) {
SMnodeStep *pStep = taosArrayGet(pMnode->pSteps, s);
- mDebug("%s will cleanup", pStep->name);
+ mInfo("%s will cleanup", pStep->name);
if (pStep->cleanupFp != NULL) {
(*pStep->cleanupFp)(pMnode);
}
@@ -324,7 +324,7 @@ static int32_t mndExecSteps(SMnode *pMnode) {
terrno = code;
return -1;
} else {
- mDebug("%s is initialized", pStep->name);
+ mInfo("%s is initialized", pStep->name);
tmsgReportStartup(pStep->name, "initialized");
}
}
@@ -341,7 +341,7 @@ static void mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
}
SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
- mDebug("start to open mnode in %s", path);
+ mInfo("start to open mnode in %s", path);
SMnode *pMnode = taosMemoryCalloc(1, sizeof(SMnode));
if (pMnode == NULL) {
@@ -390,7 +390,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
return NULL;
}
- mDebug("mnode open successfully ");
+ mInfo("mnode open successfully ");
return pMnode;
}
@@ -400,24 +400,24 @@ void mndPreClose(SMnode *pMnode) {
syncLeaderTransfer(pMnode->syncMgmt.sync);
/*
- mDebug("vgId:1, mnode start leader transfer");
+ mInfo("vgId:1, mnode start leader transfer");
// wait for leader transfer finish
while (!atomic_load_8(&(pMnode->syncMgmt.leaderTransferFinish))) {
taosMsleep(10);
- mDebug("vgId:1, mnode waiting for leader transfer");
+ mInfo("vgId:1, mnode waiting for leader transfer");
}
- mDebug("vgId:1, mnode finish leader transfer");
+ mInfo("vgId:1, mnode finish leader transfer");
*/
}
}
void mndClose(SMnode *pMnode) {
if (pMnode != NULL) {
- mDebug("start to close mnode");
+ mInfo("start to close mnode");
mndCleanupSteps(pMnode, -1);
taosMemoryFreeClear(pMnode->path);
taosMemoryFreeClear(pMnode);
- mDebug("mnode is closed");
+ mInfo("mnode is closed");
}
}
diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c
index 71bda4d4f34213a7b3240f6634b26579fb66c1ee..a41f958c0f62490eff3a7f50f495949f06f48925 100644
--- a/source/dnode/mnode/impl/src/mndMnode.c
+++ b/source/dnode/mnode/impl/src/mndMnode.c
@@ -91,7 +91,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
mInfo("mnode:%d, will be created when deploying, raw:%p", mnodeObj.id, pRaw);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-mnode");
if (pTrans == NULL) {
mError("mnode:%d, failed to create since %s", mnodeObj.id, terrstr());
return -1;
@@ -362,7 +362,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
mnodeObj.createdTime = taosGetTimestampMs();
mnodeObj.updateTime = mnodeObj.createdTime;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "create-mnode");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId);
@@ -571,7 +571,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
int32_t code = -1;
STrans *pTrans = NULL;
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-mnode");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
diff --git a/source/dnode/mnode/impl/src/mndOffset.c b/source/dnode/mnode/impl/src/mndOffset.c
index 037a46345ffed6b1205292e513df1c2db9528b3b..797aa88670fc2ac7f83ace7d59851ef9b7874f6c 100644
--- a/source/dnode/mnode/impl/src/mndOffset.c
+++ b/source/dnode/mnode/impl/src/mndOffset.c
@@ -181,7 +181,7 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) {
tDecodeSMqCMCommitOffsetReq(&decoder, &commitOffsetReq);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "commit-offset");
for (int32_t i = 0; i < commitOffsetReq.num; i++) {
SMqOffset *pOffset = &commitOffsetReq.offsets[i];
diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c
index f057f6190defd3c7c8d01e7b8e7d39b37c1f3c6e..cbd398e36181517b19dc5c682badb80a2814f09a 100644
--- a/source/dnode/mnode/impl/src/mndQnode.c
+++ b/source/dnode/mnode/impl/src/mndQnode.c
@@ -248,10 +248,10 @@ static int32_t mndCreateQnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
qnodeObj.createdTime = taosGetTimestampMs();
qnodeObj.updateTime = qnodeObj.createdTime;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-qnode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
+ mInfo("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
if (mndSetCreateQnodeRedoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
if (mndSetCreateQnodeUndoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
if (mndSetCreateQnodeCommitLogs(pTrans, &qnodeObj) != 0) goto _OVER;
@@ -278,7 +278,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("qnode:%d, start to create", createReq.dnodeId);
+ mInfo("qnode:%d, start to create", createReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_QNODE) != 0) {
goto _OVER;
}
@@ -364,10 +364,10 @@ int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pO
static int32_t mndDropQnode(SMnode *pMnode, SRpcMsg *pReq, SQnodeObj *pObj) {
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-qnode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
+ mInfo("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
@@ -389,7 +389,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("qnode:%d, start to drop", dropReq.dnodeId);
+ mInfo("qnode:%d, start to drop", dropReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_QNODE) != 0) {
goto _OVER;
}
diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c
index 654f46ec85682a21e8ef0009c3fcb654180c93b1..0e897de4e7bd64cdaffcd0c0f6da339ab8db4851 100644
--- a/source/dnode/mnode/impl/src/mndQuery.c
+++ b/source/dnode/mnode/impl/src/mndQuery.c
@@ -170,7 +170,7 @@ _exit:
}
int32_t mndInitQuery(SMnode *pMnode) {
- if (qWorkerInit(NODE_TYPE_MNODE, MNODE_HANDLE, NULL, (void **)&pMnode->pQuery, &pMnode->msgCb) != 0) {
+ if (qWorkerInit(NODE_TYPE_MNODE, MNODE_HANDLE, (void **)&pMnode->pQuery, &pMnode->msgCb) != 0) {
mError("failed to init qworker in mnode since %s", terrstr());
return -1;
}
diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c
index 8638cc511890066f45367253313aec8f626ceb8e..90d05e8f211d98a2b66d0c98a76a01492a3f3749 100644
--- a/source/dnode/mnode/impl/src/mndSma.c
+++ b/source/dnode/mnode/impl/src/mndSma.c
@@ -587,11 +587,11 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
nodesDestroyNode((SNode *)pPlan);
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "create-sma");
if (pTrans == NULL) goto _OVER;
mndTransSetDbName(pTrans, pDb->name, NULL);
mndTransSetSerial(pTrans);
- mDebug("trans:%d, used to create sma:%s stream:%s", pTrans->id, pCreate->name, streamObj.name);
+ mInfo("trans:%d, used to create sma:%s stream:%s", pTrans->id, pCreate->name, streamObj.name);
if (mndSetCreateSmaRedoLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER;
if (mndSetCreateSmaVgroupRedoLogs(pMnode, pTrans, &streamObj.fixedSinkVg) != 0) goto _OVER;
@@ -603,8 +603,8 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
if (mndPersistStream(pMnode, pTrans, &streamObj) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
- mDebug("mndSma: create sma index %s %" PRIi64 " on stb:%" PRIi64 ", dstSuid:%" PRIi64 " dstTb:%s dstVg:%d",
- pCreate->name, smaObj.uid, smaObj.stbUid, smaObj.dstTbUid, smaObj.dstTbName, smaObj.dstVgId);
+ mInfo("sma:%s, uid:%" PRIi64 " create on stb:%" PRIi64 ", dstSuid:%" PRIi64 " dstTb:%s dstVg:%d", pCreate->name,
+ smaObj.uid, smaObj.stbUid, smaObj.dstTbUid, smaObj.dstTbName, smaObj.dstVgId);
code = 0;
@@ -665,7 +665,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("sma:%s, start to create", createReq.name);
+ mInfo("sma:%s, start to create", createReq.name);
if (mndCheckCreateSmaReq(&createReq) != 0) {
goto _OVER;
}
@@ -689,7 +689,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
pSma = mndAcquireSma(pMnode, createReq.name);
if (pSma != NULL) {
if (createReq.igExists) {
- mDebug("sma:%s, already exist in sma:%s, ignore exist is set", createReq.name, pSma->name);
+ mInfo("sma:%s, already exist in sma:%s, ignore exist is set", createReq.name, pSma->name);
code = 0;
goto _OVER;
} else {
@@ -799,10 +799,10 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
pStb = mndAcquireStb(pMnode, pSma->stb);
if (pStb == NULL) goto _OVER;
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "drop-sma");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to drop sma:%s", pTrans->id, pSma->name);
+ mInfo("trans:%d, used to drop sma:%s", pTrans->id, pSma->name);
mndTransSetDbName(pTrans, pDb->name, NULL);
mndTransSetSerial(pTrans);
@@ -929,12 +929,12 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("sma:%s, start to drop", dropReq.name);
+ mInfo("sma:%s, start to drop", dropReq.name);
pSma = mndAcquireSma(pMnode, dropReq.name);
if (pSma == NULL) {
if (dropReq.igNotExists) {
- mDebug("sma:%s, not exist, ignore not exist is set", dropReq.name);
+ mInfo("sma:%s, not exist, ignore not exist is set", dropReq.name);
code = 0;
goto _OVER;
} else {
diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c
index d18a233d29eb6f7c0b72a4fbbfc81f2dd2869560..691270997064f0648fad3c268beac0f34921980c 100644
--- a/source/dnode/mnode/impl/src/mndSnode.c
+++ b/source/dnode/mnode/impl/src/mndSnode.c
@@ -253,10 +253,10 @@ static int32_t mndCreateSnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
snodeObj.createdTime = taosGetTimestampMs();
snodeObj.updateTime = snodeObj.createdTime;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-snode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
+ mInfo("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
if (mndSetCreateSnodeRedoLogs(pTrans, &snodeObj) != 0) goto _OVER;
if (mndSetCreateSnodeUndoLogs(pTrans, &snodeObj) != 0) goto _OVER;
@@ -287,7 +287,7 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("snode:%d, start to create", createReq.dnodeId);
+ mInfo("snode:%d, start to create", createReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_SNODE) != 0) {
goto _OVER;
}
@@ -375,10 +375,10 @@ int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pO
static int32_t mndDropSnode(SMnode *pMnode, SRpcMsg *pReq, SSnodeObj *pObj) {
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-snode");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
+ mInfo("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
@@ -403,7 +403,7 @@ static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("snode:%d, start to drop", dropReq.dnodeId);
+ mInfo("snode:%d, start to drop", dropReq.dnodeId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_SNODE) != 0) {
goto _OVER;
}
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index 8719f9f8f0a192ad9a1f52250384f88002599cd3..e0b5bb1abf652dfd39f56b6100ad785ae3add516 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -800,10 +800,10 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
SStbObj stbObj = {0};
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "create-stb");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name);
+ mInfo("trans:%d, used to create stb:%s", pTrans->id, pCreate->name);
if (mndBuildStbFromReq(pMnode, &stbObj, pCreate, pDb) != 0) goto _OVER;
if (mndAddStbToTrans(pMnode, pTrans, pDb, &stbObj) < 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
@@ -854,7 +854,7 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) {
if (code != 0) {
mError("vgId:%d, failed to send drop ttl table request to vnode since 0x%x", pVgroup->vgId, code);
} else {
- mDebug("vgId:%d, send drop ttl table request to vnode, time:%d", pVgroup->vgId, ttlReq.timestamp);
+ mInfo("vgId:%d, send drop ttl table request to vnode, time:%d", pVgroup->vgId, ttlReq.timestamp);
}
sdbRelease(pSdb, pVgroup);
}
@@ -943,7 +943,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("stb:%s, start to create", createReq.name);
+ mInfo("stb:%s, start to create", createReq.name);
if (mndCheckCreateStbReq(&createReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
goto _OVER;
@@ -953,7 +953,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
if (pStb != NULL) {
if (createReq.igExists) {
if (createReq.source == TD_REQ_FROM_APP) {
- mDebug("stb:%s, already exist, ignore exist is set", createReq.name);
+ mInfo("stb:%s, already exist, ignore exist is set", createReq.name);
code = 0;
goto _OVER;
} else if (pStb->uid != createReq.suid) {
@@ -1144,7 +1144,7 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p
pSchema->colId = pNew->nextColId;
pNew->nextColId++;
- mDebug("stb:%s, start to add tag %s", pNew->name, pSchema->name);
+ mInfo("stb:%s, start to add tag %s", pNew->name, pSchema->name);
}
pNew->tagVer++;
@@ -1159,7 +1159,7 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
pIter = sdbFetch(pSdb, SDB_TOPIC, pIter, (void **)&pTopic);
if (pIter == NULL) break;
- mDebug("topic:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, subType:%d sql:%s",
+ mInfo("topic:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, subType:%d sql:%s",
pTopic->name, stbFullName, suid, colId, pTopic->subType, pTopic->sql);
if (pTopic->subType != TOPIC_SUB_TYPE__COLUMN) {
sdbRelease(pSdb, pTopic);
@@ -1177,11 +1177,11 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
SNode *pNode = NULL;
FOREACH(pNode, pNodeList) {
SColumnNode *pCol = (SColumnNode *)pNode;
- mDebug("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId,
+ mInfo("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId,
pCol->tableId, pTopic->ctbStbUid);
if (pCol->tableId != suid && pTopic->ctbStbUid != suid) {
- mDebug("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
+ mInfo("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
goto NEXT;
}
if (pCol->colId > 0 && pCol->colId == colId) {
@@ -1192,7 +1192,7 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
mError("topic:%s, check colId:%d conflicted", pTopic->name, pCol->colId);
return -1;
}
- mDebug("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
+ mInfo("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
}
NEXT:
@@ -1224,7 +1224,7 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName
SColumnNode *pCol = (SColumnNode *)pNode;
if (pCol->tableId != suid) {
- mDebug("stream:%s, check colId:%d passed", pStream->name, pCol->colId);
+ mInfo("stream:%s, check colId:%d passed", pStream->name, pCol->colId);
goto NEXT;
}
if (pCol->colId > 0 && pCol->colId == colId) {
@@ -1235,7 +1235,7 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName
mError("stream:%s, check colId:%d conflicted", pStream->name, pCol->colId);
return -1;
}
- mDebug("stream:%s, check colId:%d passed", pStream->name, pCol->colId);
+ mInfo("stream:%s, check colId:%d passed", pStream->name, pCol->colId);
}
NEXT:
@@ -1254,7 +1254,7 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
if (pIter == NULL) break;
- mDebug("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, sql:%s", pSma->name,
+ mInfo("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, sql:%s", pSma->name,
stbFullName, suid, colId, pSma->sql);
SNode *pAst = NULL;
@@ -1270,10 +1270,10 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
SNode *pNode = NULL;
FOREACH(pNode, pNodeList) {
SColumnNode *pCol = (SColumnNode *)pNode;
- mDebug("tsma:%s, check colId:%d tableId:%" PRId64, pSma->name, pCol->colId, pCol->tableId);
+ mInfo("tsma:%s, check colId:%d tableId:%" PRId64, pSma->name, pCol->colId, pCol->tableId);
if ((pCol->tableId != suid) && (pSma->stbUid != suid)) {
- mDebug("tsma:%s, check colId:%d passed", pSma->name, pCol->colId);
+ mInfo("tsma:%s, check colId:%d passed", pSma->name, pCol->colId);
goto NEXT;
}
if ((pCol->colId) > 0 && (pCol->colId == colId)) {
@@ -1284,7 +1284,7 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
mError("tsma:%s, check colId:%d conflicted", pSma->name, pCol->colId);
return -1;
}
- mDebug("tsma:%s, check colId:%d passed", pSma->name, pCol->colId);
+ mInfo("tsma:%s, check colId:%d passed", pSma->name, pCol->colId);
}
NEXT:
@@ -1329,7 +1329,7 @@ static int32_t mndDropSuperTableTag(SMnode *pMnode, const SStbObj *pOld, SStbObj
pNew->numOfTags--;
pNew->tagVer++;
- mDebug("stb:%s, start to drop tag %s", pNew->name, tagName);
+ mInfo("stb:%s, start to drop tag %s", pNew->name, tagName);
return 0;
}
@@ -1374,7 +1374,7 @@ static int32_t mndAlterStbTagName(SMnode *pMnode, const SStbObj *pOld, SStbObj *
memcpy(pSchema->name, newTagName, TSDB_COL_NAME_LEN);
pNew->tagVer++;
- mDebug("stb:%s, start to modify tag %s to %s", pNew->name, oldTagName, newTagName);
+ mInfo("stb:%s, start to modify tag %s to %s", pNew->name, oldTagName, newTagName);
return 0;
}
@@ -1409,7 +1409,7 @@ static int32_t mndAlterStbTagBytes(SMnode *pMnode, const SStbObj *pOld, SStbObj
pTag->bytes = pField->bytes;
pNew->tagVer++;
- mDebug("stb:%s, start to modify tag len %s to %d", pNew->name, pField->name, pField->bytes);
+ mInfo("stb:%s, start to modify tag len %s to %d", pNew->name, pField->name, pField->bytes);
return 0;
}
@@ -1443,7 +1443,7 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray
pSchema->colId = pNew->nextColId;
pNew->nextColId++;
- mDebug("stb:%s, start to add column %s", pNew->name, pSchema->name);
+ mInfo("stb:%s, start to add column %s", pNew->name, pSchema->name);
}
pNew->colVer++;
@@ -1480,7 +1480,7 @@ static int32_t mndDropSuperTableColumn(SMnode *pMnode, const SStbObj *pOld, SStb
pNew->numOfColumns--;
pNew->colVer++;
- mDebug("stb:%s, start to drop col %s", pNew->name, colName);
+ mInfo("stb:%s, start to drop col %s", pNew->name, colName);
return 0;
}
@@ -1524,7 +1524,7 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO
pCol->bytes = pField->bytes;
pNew->colVer++;
- mDebug("stb:%s, start to modify col len %s to %d", pNew->name, pField->name, pField->bytes);
+ mInfo("stb:%s, start to modify col len %s to %d", pNew->name, pField->name, pField->bytes);
return 0;
}
@@ -1843,10 +1843,10 @@ _OVER:
static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp,
void *alterOriData, int32_t alterOriDataLen) {
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "alter-stb");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to alter stb:%s", pTrans->id, pStb->name);
+ mInfo("trans:%d, used to alter stb:%s", pTrans->id, pStb->name);
mndTransSetDbName(pTrans, pDb->name, pStb->name);
if (needRsp) {
@@ -1942,7 +1942,7 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("stb:%s, start to alter", alterReq.name);
+ mInfo("stb:%s, start to alter", alterReq.name);
if (mndCheckAlterStbReq(&alterReq) != 0) goto _OVER;
pDb = mndAcquireDbByStb(pMnode, alterReq.name);
@@ -2042,10 +2042,10 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb) {
int32_t code = -1;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "drop-stb");
if (pTrans == NULL) goto _OVER;
- mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name);
+ mInfo("trans:%d, used to drop stb:%s", pTrans->id, pStb->name);
mndTransSetDbName(pTrans, pDb->name, pStb->name);
if (mndSetDropStbRedoLogs(pMnode, pTrans, pStb) != 0) goto _OVER;
@@ -2169,12 +2169,12 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("stb:%s, start to drop", dropReq.name);
+ mInfo("stb:%s, start to drop", dropReq.name);
pStb = mndAcquireStb(pMnode, dropReq.name);
if (pStb == NULL) {
if (dropReq.igNotExists) {
- mDebug("stb:%s, not exist, ignore not exist is set", dropReq.name);
+ mInfo("stb:%s, not exist, ignore not exist is set", dropReq.name);
code = 0;
goto _OVER;
} else {
@@ -2237,17 +2237,17 @@ 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);
+ mInfo("information_schema table:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName);
if (mndBuildInsTableSchema(pMnode, infoReq.dbFName, infoReq.tbName, sysinfo, &metaRsp) != 0) {
goto _OVER;
}
} else if (0 == strcmp(infoReq.dbFName, TSDB_PERFORMANCE_SCHEMA_DB)) {
- mDebug("performance_schema table:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName);
+ mInfo("performance_schema table:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName);
if (mndBuildPerfsTableSchema(pMnode, infoReq.dbFName, infoReq.tbName, &metaRsp) != 0) {
goto _OVER;
}
} else {
- mDebug("stb:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName);
+ mInfo("stb:%s.%s, start to retrieve meta", infoReq.dbFName, infoReq.tbName);
if (mndBuildStbSchema(pMnode, infoReq.dbFName, infoReq.tbName, &metaRsp, NULL) != 0) {
goto _OVER;
}
@@ -2294,17 +2294,17 @@ static int32_t mndProcessTableCfgReq(SRpcMsg *pReq) {
}
if (0 == strcmp(cfgReq.dbFName, TSDB_INFORMATION_SCHEMA_DB)) {
- mDebug("information_schema table:%s.%s, start to retrieve cfg", cfgReq.dbFName, cfgReq.tbName);
+ mInfo("information_schema table:%s.%s, start to retrieve cfg", cfgReq.dbFName, cfgReq.tbName);
if (mndBuildInsTableCfg(pMnode, cfgReq.dbFName, cfgReq.tbName, &cfgRsp) != 0) {
goto _OVER;
}
} else if (0 == strcmp(cfgReq.dbFName, TSDB_PERFORMANCE_SCHEMA_DB)) {
- mDebug("performance_schema table:%s.%s, start to retrieve cfg", cfgReq.dbFName, cfgReq.tbName);
+ mInfo("performance_schema table:%s.%s, start to retrieve cfg", cfgReq.dbFName, cfgReq.tbName);
if (mndBuildPerfsTableCfg(pMnode, cfgReq.dbFName, cfgReq.tbName, &cfgRsp) != 0) {
goto _OVER;
}
} else {
- mDebug("stb:%s.%s, start to retrieve cfg", cfgReq.dbFName, cfgReq.tbName);
+ mInfo("stb:%s.%s, start to retrieve cfg", cfgReq.dbFName, cfgReq.tbName);
if (mndBuildStbCfg(pMnode, cfgReq.dbFName, cfgReq.tbName, &cfgRsp) != 0) {
goto _OVER;
}
@@ -2363,7 +2363,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
STableMetaRsp metaRsp = {0};
int32_t smaVer = 0;
- mDebug("stb:%s.%s, start to retrieve meta", pStbVersion->dbFName, pStbVersion->stbName);
+ mInfo("stb:%s.%s, start to retrieve meta", pStbVersion->dbFName, pStbVersion->stbName);
if (mndBuildStbSchema(pMnode, pStbVersion->dbFName, pStbVersion->stbName, &metaRsp, &smaVer) != 0) {
metaRsp.numOfColumns = -1;
metaRsp.suid = pStbVersion->suid;
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 515d5987b9d33f6076bee1aa524f681118882586..c6f46b28fce98ece39e76222c51e8302952bba8f 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -266,7 +266,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SNode *pAst = NULL;
SQueryPlan *pPlan = NULL;
- mDebug("stream:%s to create", pCreate->name);
+ mInfo("stream:%s to create", pCreate->name);
memcpy(pObj->name, pCreate->name, TSDB_STREAM_FNAME_LEN);
pObj->createTime = taosGetTimestampMs();
pObj->updateTime = pObj->createTime;
@@ -285,7 +285,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SDbObj *pSourceDb = mndAcquireDb(pMnode, pCreate->sourceDB);
if (pSourceDb == NULL) {
/*ASSERT(0);*/
- mDebug("stream:%s failed to create, source db %s not exist", pCreate->name, pObj->sourceDb);
+ mInfo("stream:%s failed to create, source db %s not exist", pCreate->name, pObj->sourceDb);
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
return -1;
}
@@ -295,7 +295,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SDbObj *pTargetDb = mndAcquireDbByStb(pMnode, pObj->targetSTbName);
if (pTargetDb == NULL) {
- mDebug("stream:%s failed to create, target db %s not exist", pCreate->name, pObj->targetDb);
+ mInfo("stream:%s failed to create, target db %s not exist", pCreate->name, pObj->targetDb);
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
return -1;
}
@@ -638,7 +638,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("stream:%s, start to create, sql:%s", createStreamReq.name, createStreamReq.sql);
+ mInfo("stream:%s, start to create, sql:%s", createStreamReq.name, createStreamReq.sql);
if (mndCheckCreateStreamReq(&createStreamReq) != 0) {
mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr());
@@ -648,7 +648,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
pStream = mndAcquireStream(pMnode, createStreamReq.name);
if (pStream != NULL) {
if (createStreamReq.igExists) {
- mDebug("stream:%s, already exist, ignore exist is set", createStreamReq.name);
+ mInfo("stream:%s, already exist, ignore exist is set", createStreamReq.name);
code = 0;
goto _OVER;
} else {
@@ -666,13 +666,13 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto _OVER;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "create-stream");
if (pTrans == NULL) {
mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr());
goto _OVER;
}
mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetDb); // hack way
- mDebug("trans:%d, used to create stream:%s", pTrans->id, createStreamReq.name);
+ mInfo("trans:%d, used to create stream:%s", pTrans->id, createStreamReq.name);
// create stb for stream
if (mndCreateStbForStream(pMnode, pTrans, &streamObj, pReq->info.conn.user) < 0) {
@@ -746,7 +746,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
if (pStream == NULL) {
if (dropReq.igNotExists) {
- mDebug("stream:%s, not exist, ignore not exist is set", dropReq.name);
+ mInfo("stream:%s, not exist, ignore not exist is set", dropReq.name);
sdbRelease(pMnode->pSdb, pStream);
return 0;
} else {
@@ -759,13 +759,13 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-stream");
if (pTrans == NULL) {
mError("stream:%s, failed to drop since %s", dropReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
return -1;
}
- mDebug("trans:%d, used to drop stream:%s", pTrans->id, dropReq.name);
+ mInfo("trans:%d, used to drop stream:%s", pTrans->id, dropReq.name);
// drop all tasks
if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
@@ -810,7 +810,7 @@ static int32_t mndProcessRecoverStreamReq(SRpcMsg *pReq) {
if (pStream == NULL) {
if (recoverReq.igNotExists) {
- mDebug("stream:%s, not exist, ignore not exist is set", recoverReq.name);
+ mInfo("stream:%s, not exist, ignore not exist is set", recoverReq.name);
sdbRelease(pMnode->pSdb, pStream);
return 0;
} else {
@@ -829,7 +829,7 @@ static int32_t mndProcessRecoverStreamReq(SRpcMsg *pReq) {
sdbRelease(pMnode->pSdb, pStream);
return -1;
}
- mDebug("trans:%d, used to drop stream:%s", pTrans->id, recoverReq.name);
+ mInfo("trans:%d, used to drop stream:%s", pTrans->id, recoverReq.name);
// broadcast to recover all tasks
if (mndRecoverStreamTasks(pMnode, pTrans, pStream) < 0) {
diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c
index 3a3bf36594884205f569f04da865b17b83549c8a..21e45407fd15f862f059213eaaec03df4f990bc0 100644
--- a/source/dnode/mnode/impl/src/mndSubscribe.c
+++ b/source/dnode/mnode/impl/src/mndSubscribe.c
@@ -441,7 +441,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
}
static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) {
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "persist-reb");
mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL);
if (pTrans == NULL) return -1;
@@ -658,7 +658,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, dropReq.cgroup, dropReq.topic);
if (pSub == NULL) {
if (dropReq.igNotExists) {
- mDebug("cgroup:%s on topic:%s, not exist, ignore not exist is set", dropReq.cgroup, dropReq.topic);
+ mInfo("cgroup:%s on topic:%s, not exist, ignore not exist is set", dropReq.cgroup, dropReq.topic);
return 0;
} else {
terrno = TSDB_CODE_MND_SUBSCRIBE_NOT_EXIST;
@@ -674,14 +674,14 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-cgroup");
if (pTrans == NULL) {
mError("cgroup: %s on topic:%s, failed to drop since %s", dropReq.cgroup, dropReq.topic, terrstr());
mndReleaseSubscribe(pMnode, pSub);
return -1;
}
- mDebug("trans:%d, used to drop cgroup:%s on topic %s", pTrans->id, dropReq.cgroup, dropReq.topic);
+ mInfo("trans:%d, used to drop cgroup:%s on topic %s", pTrans->id, dropReq.cgroup, dropReq.topic);
if (mndDropOffsetBySubKey(pMnode, pTrans, pSub->key) < 0) {
ASSERT(0);
diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c
index e8b75e6a94e1089b037be9ec42a4fdc9deef3b3c..3655289f99268a469809a50a6704e13077fc08e9 100644
--- a/source/dnode/mnode/impl/src/mndSync.c
+++ b/source/dnode/mnode/impl/src/mndSync.c
@@ -105,11 +105,11 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
SMnode *pMnode = pFsm->data;
if (!pMnode->deploy) {
- mInfo("mnode sync restore finished, and will handle outstanding transactions");
+ mInfo("vgId:1, sync restore finished, and will handle outstanding transactions");
mndTransPullup(pMnode);
mndSetRestore(pMnode, true);
} else {
- mInfo("mnode sync restore finished");
+ mInfo("vgId:1, sync restore finished");
}
}
@@ -228,7 +228,7 @@ int32_t mndInitSync(SMnode *pMnode) {
syncInfo.isStandBy = pMgmt->standby;
syncInfo.snapshotStrategy = SYNC_STRATEGY_STANDARD_SNAPSHOT;
- mInfo("start to open mnode sync, standby:%d", pMgmt->standby);
+ mInfo("vgId:1, start to open sync, standby:%d", pMgmt->standby);
if (pMgmt->standby || pMgmt->replica.id > 0) {
SSyncCfg *pCfg = &syncInfo.syncCfg;
pCfg->replicaNum = 1;
@@ -236,7 +236,7 @@ int32_t mndInitSync(SMnode *pMnode) {
SNodeInfo *pNode = &pCfg->nodeInfo[0];
tstrncpy(pNode->nodeFqdn, pMgmt->replica.fqdn, sizeof(pNode->nodeFqdn));
pNode->nodePort = pMgmt->replica.port;
- mInfo("mnode ep:%s:%u", pNode->nodeFqdn, pNode->nodePort);
+ mInfo("vgId:1, ep:%s:%u", pNode->nodeFqdn, pNode->nodePort);
}
tsem_init(&pMgmt->syncSem, 0, 0);
@@ -255,14 +255,14 @@ int32_t mndInitSync(SMnode *pMnode) {
setHeartbeatTimerMS(pMgmt->sync, 300);
*/
- mDebug("mnode-sync is opened, id:%" PRId64, pMgmt->sync);
+ mInfo("mnode-sync is opened, id:%" PRId64, pMgmt->sync);
return 0;
}
void mndCleanupSync(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
syncStop(pMgmt->sync);
- mDebug("mnode-sync is stopped, id:%" PRId64, pMgmt->sync);
+ mInfo("mnode-sync is stopped, id:%" PRId64, pMgmt->sync);
tsem_destroy(&pMgmt->syncSem);
memset(pMgmt, 0, sizeof(SSyncMgmt));
@@ -314,7 +314,7 @@ void mndSyncStart(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
syncSetMsgCb(pMgmt->sync, &pMnode->msgCb);
syncStart(pMgmt->sync);
- mInfo("mnode sync started, id:%" PRId64 " standby:%d", pMgmt->sync, pMgmt->standby);
+ mInfo("vgId:1, sync started, id:%" PRId64 " standby:%d", pMgmt->sync, pMgmt->standby);
}
void mndSyncStop(SMnode *pMnode) {
diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c
index b24d7067bc2cc8b41d651bdedbe3184c8db2f309..b9647a28fbd66f941b4ff8bafc529ec60d20c258 100644
--- a/source/dnode/mnode/impl/src/mndTopic.c
+++ b/source/dnode/mnode/impl/src/mndTopic.c
@@ -358,7 +358,7 @@ static int32_t extractTopicTbInfo(SNode *pAst, SMqTopicObj *pTopic) {
}
static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *pCreate, SDbObj *pDb) {
- mDebug("topic:%s to create", pCreate->name);
+ mInfo("topic:%s to create", pCreate->name);
SMqTopicObj topicObj = {0};
tstrncpy(topicObj.name, pCreate->name, TSDB_TOPIC_FNAME_LEN);
tstrncpy(topicObj.db, pDb->name, TSDB_DB_FNAME_LEN);
@@ -440,7 +440,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
/*topicObj.withTbName = 1;*/
/*topicObj.withSchema = 1;*/
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-topic");
if (pTrans == NULL) {
mError("topic:%s, failed to create since %s", pCreate->name, terrstr());
taosMemoryFreeClear(topicObj.ast);
@@ -448,7 +448,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
taosMemoryFreeClear(topicObj.physicalPlan);
return -1;
}
- mDebug("trans:%d, used to create topic:%s", pTrans->id, pCreate->name);
+ mInfo("trans:%d, used to create topic:%s", pTrans->id, pCreate->name);
SSdbRaw *pCommitRaw = mndTopicActionEncode(&topicObj);
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
@@ -541,7 +541,7 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("topic:%s, start to create, sql:%s", createTopicReq.name, createTopicReq.sql);
+ mInfo("topic:%s, start to create, sql:%s", createTopicReq.name, createTopicReq.sql);
if (mndCheckCreateTopicReq(&createTopicReq) != 0) {
mError("topic:%s, failed to create since %s", createTopicReq.name, terrstr());
@@ -551,7 +551,7 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
pTopic = mndAcquireTopic(pMnode, createTopicReq.name);
if (pTopic != NULL) {
if (createTopicReq.igExists) {
- mDebug("topic:%s, already exist, ignore exist is set", createTopicReq.name);
+ mInfo("topic:%s, already exist, ignore exist is set", createTopicReq.name);
code = 0;
goto _OVER;
} else {
@@ -619,7 +619,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, dropReq.name);
if (pTopic == NULL) {
if (dropReq.igNotExists) {
- mDebug("topic:%s, not exist, ignore not exist is set", dropReq.name);
+ mInfo("topic:%s, not exist, ignore not exist is set", dropReq.name);
return 0;
} else {
terrno = TSDB_CODE_MND_TOPIC_NOT_EXIST;
@@ -663,7 +663,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "drop-topic");
mndTransSetDbName(pTrans, pTopic->db, NULL);
if (pTrans == NULL) {
mError("topic:%s, failed to drop since %s", pTopic->name, terrstr());
@@ -671,7 +671,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
return -1;
}
- mDebug("trans:%d, used to drop topic:%s", pTrans->id, pTopic->name);
+ mInfo("trans:%d, used to drop topic:%s", pTrans->id, pTopic->name);
#if 0
if (mndDropOffsetByTopic(pMnode, pTrans, dropReq.name) < 0) {
diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c
index 8d42cdcfd6e0e5d5a933292eb9fcd5910aace53f..b26fb160439390dc62b98a8f3ae29c8b961fc11f 100644
--- a/source/dnode/mnode/impl/src/mndTrans.c
+++ b/source/dnode/mnode/impl/src/mndTrans.c
@@ -25,7 +25,7 @@
#define TRANS_VER_NUMBER 1
#define TRANS_ARRAY_SIZE 8
-#define TRANS_RESERVE_SIZE 64
+#define TRANS_RESERVE_SIZE 48
static SSdbRaw *mndTransActionEncode(STrans *pTrans);
static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw);
@@ -223,6 +223,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
SDB_SET_BINARY(pRaw, dataPos, pTrans->param, pTrans->paramLen, _OVER)
}
+ SDB_SET_BINARY(pRaw, dataPos, pTrans->opername, TSDB_TRANS_OPER_LEN, _OVER)
SDB_SET_RESERVE(pRaw, dataPos, TRANS_RESERVE_SIZE, _OVER)
SDB_SET_DATALEN(pRaw, dataPos, _OVER)
@@ -305,6 +306,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
if (pTrans->commitActions == NULL) goto _OVER;
for (int32_t i = 0; i < redoActionNum; ++i) {
+ memset(&action, 0, sizeof(action));
SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
@@ -319,7 +321,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32(pRaw, dataPos, &dataLen, _OVER)
action.pRaw = taosMemoryMalloc(dataLen);
if (action.pRaw == NULL) goto _OVER;
- // mTrace("raw:%p, is created", pData);
+ mTrace("raw:%p, is created", pData);
SDB_GET_BINARY(pRaw, dataPos, (void *)action.pRaw, dataLen, _OVER);
if (taosArrayPush(pTrans->redoActions, &action) == NULL) goto _OVER;
action.pRaw = NULL;
@@ -340,6 +342,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
}
for (int32_t i = 0; i < undoActionNum; ++i) {
+ memset(&action, 0, sizeof(action));
SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
@@ -354,7 +357,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32(pRaw, dataPos, &dataLen, _OVER)
action.pRaw = taosMemoryMalloc(dataLen);
if (action.pRaw == NULL) goto _OVER;
- // mTrace("raw:%p, is created", action.pRaw);
+ mTrace("raw:%p, is created", action.pRaw);
SDB_GET_BINARY(pRaw, dataPos, (void *)action.pRaw, dataLen, _OVER);
if (taosArrayPush(pTrans->undoActions, &action) == NULL) goto _OVER;
action.pRaw = NULL;
@@ -375,6 +378,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
}
for (int32_t i = 0; i < commitActionNum; ++i) {
+ memset(&action, 0, sizeof(action));
SDB_GET_INT32(pRaw, dataPos, &action.id, _OVER)
SDB_GET_INT32(pRaw, dataPos, &action.errCode, _OVER)
SDB_GET_INT32(pRaw, dataPos, &action.acceptableCode, _OVER)
@@ -389,7 +393,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32(pRaw, dataPos, &dataLen, _OVER)
action.pRaw = taosMemoryMalloc(dataLen);
if (action.pRaw == NULL) goto _OVER;
- // mTrace("raw:%p, is created", action.pRaw);
+ mTrace("raw:%p, is created", action.pRaw);
SDB_GET_BINARY(pRaw, dataPos, (void *)action.pRaw, dataLen, _OVER);
if (taosArrayPush(pTrans->commitActions, &action) == NULL) goto _OVER;
action.pRaw = NULL;
@@ -417,6 +421,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_BINARY(pRaw, dataPos, pTrans->param, pTrans->paramLen, _OVER);
}
+ SDB_GET_BINARY(pRaw, dataPos, pTrans->opername, TSDB_TRANS_OPER_LEN, _OVER);
SDB_GET_RESERVE(pRaw, dataPos, TRANS_RESERVE_SIZE, _OVER)
terrno = 0;
@@ -455,6 +460,20 @@ static const char *mndTransStr(ETrnStage stage) {
}
}
+static void mndSetTransLastAction(STrans *pTrans, STransAction *pAction) {
+ if (pAction != NULL) {
+ pTrans->lastAction = pAction->id;
+ pTrans->lastMsgType = pAction->msgType;
+ pTrans->lastEpset = pAction->epSet;
+ pTrans->lastErrorNo = pAction->errCode;
+ } else {
+ pTrans->lastAction = 0;
+ pTrans->lastMsgType = 0;
+ memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset));
+ pTrans->lastErrorNo = 0;
+ }
+}
+
static void mndTransTestStartFunc(SMnode *pMnode, void *param, int32_t paramLen) {
mInfo("test trans start, param:%s, len:%d", (char *)param, paramLen);
}
@@ -582,7 +601,8 @@ void mndReleaseTrans(SMnode *pMnode, STrans *pTrans) {
sdbRelease(pSdb, pTrans);
}
-STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq) {
+STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq,
+ const char *opername) {
STrans *pTrans = taosMemoryCalloc(1, sizeof(STrans));
if (pTrans == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -590,6 +610,10 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict,
return NULL;
}
+ if (opername != NULL) {
+ tstrncpy(pTrans->opername, opername, TSDB_TRANS_OPER_LEN);
+ }
+
pTrans->id = sdbGetMaxId(pMnode->pSdb, SDB_TRANS);
pTrans->stage = TRN_STAGE_PREPARE;
pTrans->policy = policy;
@@ -800,7 +824,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) {
pNew->id, pNew->dbname, pNew->stbname, pNew->conflict, pTrans->id, pTrans->dbname, pTrans->stbname,
pTrans->conflict);
} else {
- mDebug("trans:%d, db:%s stb:%s type:%d, not conflict with trans:%d db:%s stb:%s type:%d", pNew->id,
+ mInfo("trans:%d, db:%s stb:%s type:%d, not conflict with trans:%d db:%s stb:%s type:%d", pNew->id,
pNew->dbname, pNew->stbname, pNew->conflict, pTrans->id, pTrans->dbname, pTrans->stbname,
pTrans->conflict);
}
@@ -1037,18 +1061,12 @@ static int32_t mndTransWriteSingleLog(SMnode *pMnode, STrans *pTrans, STransActi
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;
- pTrans->lastMsgType = pAction->msgType;
- pTrans->lastEpset = pAction->epSet;
- pTrans->lastErrorNo = 0;
+ mndSetTransLastAction(pTrans, pAction);
} else {
pAction->errCode = (terrno != 0) ? terrno : code;
mError("trans:%d, %s:%d failed to write sdb since %s, type:%s status:%s", pTrans->id, mndTransStr(pAction->stage),
pAction->id, terrstr(), sdbTableName(pAction->pRaw->type), sdbStatusName(pAction->pRaw->status));
- pTrans->lastAction = pAction->id;
- pTrans->lastMsgType = pAction->msgType;
- pTrans->lastEpset = pAction->epSet;
- pTrans->lastErrorNo = pAction->errCode;
+ mndSetTransLastAction(pTrans, pAction);
}
return code;
@@ -1082,15 +1100,10 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
if (code == 0) {
pAction->msgSent = 1;
pAction->msgReceived = 0;
- pAction->errCode = 0;
+ pAction->errCode = TSDB_CODE_ACTION_IN_PROGRESS;
mInfo("trans:%d, %s:%d is sent, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, detail);
- pTrans->lastAction = pAction->id;
- pTrans->lastMsgType = pAction->msgType;
- pTrans->lastEpset = pAction->epSet;
- if (pTrans->lastErrorNo == 0) {
- pTrans->lastErrorNo = TSDB_CODE_ACTION_IN_PROGRESS;
- }
+ mndSetTransLastAction(pTrans, pAction);
} else {
pAction->msgSent = 0;
pAction->msgReceived = 0;
@@ -1098,10 +1111,7 @@ static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransActio
mError("trans:%d, %s:%d not send since %s, %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, terrstr(),
detail);
- pTrans->lastAction = pAction->id;
- pTrans->lastMsgType = pAction->msgType;
- pTrans->lastEpset = pAction->epSet;
- pTrans->lastErrorNo = pAction->errCode;
+ mndSetTransLastAction(pTrans, pAction);
}
return code;
@@ -1112,10 +1122,7 @@ static int32_t mndTransExecNullMsg(SMnode *pMnode, STrans *pTrans, STransAction
pAction->errCode = 0;
mInfo("trans:%d, %s:%d confirm action executed", pTrans->id, mndTransStr(pAction->stage), pAction->id);
- pTrans->lastAction = pAction->id;
- pTrans->lastMsgType = pAction->msgType;
- pTrans->lastEpset = pAction->epSet;
- pTrans->lastErrorNo = 0;
+ mndSetTransLastAction(pTrans, pAction);
return 0;
}
@@ -1161,25 +1168,19 @@ static int32_t mndTransExecuteActions(SMnode *pMnode, STrans *pTrans, SArray *pA
errCode = pAction->errCode;
pErrAction = pAction;
}
+ } else {
+ pErrAction = pAction;
}
}
+ mndSetTransLastAction(pTrans, pErrAction);
+
if (numOfExecuted == numOfActions) {
if (errCode == 0) {
- pTrans->lastAction = 0;
- pTrans->lastMsgType = 0;
- memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset));
- pTrans->lastErrorNo = 0;
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);
- if (pErrAction != NULL) {
- pTrans->lastAction = pErrAction->id;
- pTrans->lastMsgType = pErrAction->msgType;
- pTrans->lastEpset = pErrAction->epSet;
- pTrans->lastErrorNo = pErrAction->errCode;
- }
mndTransResetActions(pMnode, pTrans, pArray);
terrno = errCode;
return errCode;
@@ -1220,6 +1221,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
if (numOfActions == 0) return code;
if (pTrans->redoActionPos >= numOfActions) return code;
+ mInfo("trans:%d, execute %d actions serial", pTrans->id, numOfActions);
+
for (int32_t action = pTrans->redoActionPos; action < numOfActions; ++action) {
STransAction *pAction = taosArrayGet(pTrans->redoActions, pTrans->redoActionPos);
@@ -1248,16 +1251,8 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
if (code == 0) {
pTrans->failedTimes = 0;
- pTrans->lastAction = action;
- pTrans->lastMsgType = 0;
- pTrans->lastErrorNo = 0;
- memset(&pTrans->lastEpset, 0, sizeof(pTrans->lastEpset));
- } else {
- pTrans->lastAction = action;
- pTrans->lastMsgType = pAction->msgType;
- pTrans->lastErrorNo = code;
- pTrans->lastEpset = pAction->epSet;
}
+ mndSetTransLastAction(pTrans, pAction);
if (mndCannotExecuteTransAction(pMnode)) break;
@@ -1599,6 +1594,11 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, numOfRows, (const char *)stage, false);
+ char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataAppend(pColInfo, numOfRows, (const char *)opername, false);
+
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c
index 5da119bb30af5bb27fb40d1dc42391893fb98c43..5512fa410788a3eaea4adc4e5b08759a4568a999 100644
--- a/source/dnode/mnode/impl/src/mndUser.c
+++ b/source/dnode/mnode/impl/src/mndUser.c
@@ -79,14 +79,14 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
if (pRaw == NULL) return -1;
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- mDebug("user:%s, will be created when deploying, raw:%p", userObj.user, pRaw);
+ mInfo("user:%s, will be created when deploying, raw:%p", userObj.user, pRaw);
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, "create-user");
if (pTrans == NULL) {
mError("user:%s, failed to create since %s", userObj.user, terrstr());
return -1;
}
- mDebug("trans:%d, used to create user:%s", pTrans->id, userObj.user);
+ mInfo("trans:%d, used to create user:%s", pTrans->id, userObj.user);
if (mndTransAppendCommitlog(pTrans, pRaw) != 0) {
mError("trans:%d, failed to commit redo log since %s", pTrans->id, terrstr());
@@ -299,12 +299,12 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
userObj.sysInfo = pCreate->sysInfo;
userObj.enable = pCreate->enable;
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-user");
if (pTrans == NULL) {
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
return -1;
}
- mDebug("trans:%d, used to create user:%s", pTrans->id, pCreate->user);
+ mInfo("trans:%d, used to create user:%s", pTrans->id, pCreate->user);
SSdbRaw *pCommitRaw = mndUserActionEncode(&userObj);
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
@@ -336,7 +336,7 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("user:%s, start to create", createReq.user);
+ mInfo("user:%s, start to create", createReq.user);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_USER) != 0) {
goto _OVER;
}
@@ -383,12 +383,12 @@ _OVER:
}
static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpcMsg *pReq) {
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "alter-user");
if (pTrans == NULL) {
mError("user:%s, failed to alter since %s", pOld->user, terrstr());
return -1;
}
- mDebug("trans:%d, used to alter user:%s", pTrans->id, pOld->user);
+ mInfo("trans:%d, used to alter user:%s", pTrans->id, pOld->user);
SSdbRaw *pCommitRaw = mndUserActionEncode(pNew);
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
@@ -446,7 +446,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("user:%s, start to alter", alterReq.user);
+ mInfo("user:%s, start to alter", alterReq.user);
if (alterReq.user[0] == 0) {
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
@@ -598,12 +598,12 @@ _OVER:
}
static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) {
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-user");
if (pTrans == NULL) {
mError("user:%s, failed to drop since %s", pUser->user, terrstr());
return -1;
}
- mDebug("trans:%d, used to drop user:%s", pTrans->id, pUser->user);
+ mInfo("trans:%d, used to drop user:%s", pTrans->id, pUser->user);
SSdbRaw *pCommitRaw = mndUserActionEncode(pUser);
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
@@ -634,7 +634,7 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) {
goto _OVER;
}
- mDebug("user:%s, start to drop", dropReq.user);
+ mInfo("user:%s, start to drop", dropReq.user);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_USER) != 0) {
goto _OVER;
}
diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c
index a95bdef32302e04ff826d613e33a4fca7ede7f33..c1bc3408199ed92a7a101d04f66aa54f3ef47df2 100644
--- a/source/dnode/mnode/impl/src/mndVgroup.c
+++ b/source/dnode/mnode/impl/src/mndVgroup.c
@@ -404,7 +404,7 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
pDnode->numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
pDnode->memUsed = mndGetVnodesMemory(pMnode, pDnode->id);
- mDebug("dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d memory avail:%" PRId64 " used:%" PRId64, pDnode->id,
+ mInfo("dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d memory avail:%" PRId64 " used:%" PRId64, pDnode->id,
pDnode->numOfVnodes, pDnode->numOfSupportVnodes, isMnode, online, pDnode->memAvail, pDnode->memUsed);
if (isMnode) {
@@ -855,7 +855,7 @@ int32_t mndAddVnodeToVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) {
taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes);
for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) {
SDnodeObj *pDnode = taosArrayGet(pArray, i);
- mDebug("dnode:%d, equivalent vnodes:%d", pDnode->id, pDnode->numOfVnodes);
+ mInfo("dnode:%d, equivalent vnodes:%d", pDnode->id, pDnode->numOfVnodes);
}
SVnodeGid *pVgid = &pVgroup->vnodeGid[pVgroup->replica];
@@ -905,7 +905,7 @@ int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray
taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes);
for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) {
SDnodeObj *pDnode = taosArrayGet(pArray, i);
- mDebug("dnode:%d, equivalent vnodes:%d", pDnode->id, pDnode->numOfVnodes);
+ mInfo("dnode:%d, equivalent vnodes:%d", pDnode->id, pDnode->numOfVnodes);
}
int32_t code = -1;
@@ -1174,7 +1174,7 @@ int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t del
static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
int32_t newDnodeId) {
- mDebug("vgId:%d, will add 1 vnode, replica:%d dnode:%d", pVgroup->vgId, pVgroup->replica, newDnodeId);
+ mInfo("vgId:%d, will add 1 vnode, replica:%d dnode:%d", pVgroup->vgId, pVgroup->replica, newDnodeId);
SVnodeGid *pGid = &pVgroup->vnodeGid[pVgroup->replica];
pVgroup->replica++;
@@ -1190,7 +1190,7 @@ static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDb
static int32_t mndAddDecVgroupReplicaFromTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
int32_t delDnodeId) {
- mDebug("vgId:%d, will remove 1 vnode, replica:%d dnode:%d", pVgroup->vgId, pVgroup->replica, delDnodeId);
+ mInfo("vgId:%d, will remove 1 vnode, replica:%d dnode:%d", pVgroup->vgId, pVgroup->replica, delDnodeId);
SVnodeGid *pGid = NULL;
SVnodeGid delGid = {0};
@@ -1223,10 +1223,10 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
SSdbRaw *pRaw = NULL;
STrans *pTrans = NULL;
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "red-vgroup");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
- mDebug("trans:%d, used to redistribute vgroup, vgId:%d", pTrans->id, pVgroup->vgId);
+ mInfo("trans:%d, used to redistribute vgroup, vgId:%d", pTrans->id, pVgroup->vgId);
SVgObj newVg = {0};
memcpy(&newVg, pVgroup, sizeof(SVgObj));
@@ -1606,10 +1606,10 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
STrans *pTrans = NULL;
SArray *pArray = mndBuildDnodesArray(pMnode, 0);
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "split-vgroup");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
- mDebug("trans:%d, used to split vgroup, vgId:%d", pTrans->id, pVgroup->vgId);
+ mInfo("trans:%d, used to split vgroup, vgId:%d", pTrans->id, pVgroup->vgId);
SVgObj newVg1 = {0};
memcpy(&newVg1, pVgroup, sizeof(SVgObj));
@@ -1666,7 +1666,7 @@ static int32_t mndProcessSplitVgroupMsg(SRpcMsg *pReq) {
SVgObj *pVgroup = NULL;
SDbObj *pDb = NULL;
- mDebug("vgId:%d, start to split", vgId);
+ mInfo("vgId:%d, start to split", vgId);
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_SPLIT_VGROUP) != 0) {
goto _OVER;
}
@@ -1774,16 +1774,16 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
pBalancedVgroups = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
if (pBalancedVgroups == NULL) goto _OVER;
- pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "balance-vgroup");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
- mDebug("trans:%d, used to balance vgroup", pTrans->id);
+ mInfo("trans:%d, used to balance vgroup", pTrans->id);
while (1) {
taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes);
for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) {
SDnodeObj *pDnode = taosArrayGet(pArray, i);
- mDebug("dnode:%d, equivalent vnodes:%d support:%d, score:%f", pDnode->id, pDnode->numOfVnodes,
+ mInfo("dnode:%d, equivalent vnodes:%d support:%d, score:%f", pDnode->id, pDnode->numOfVnodes,
pDnode->numOfSupportVnodes, (float)pDnode->numOfVnodes / pDnode->numOfSupportVnodes);
}
@@ -1792,7 +1792,7 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
float srcScore = (float)(pSrc->numOfVnodes - 1) / pSrc->numOfSupportVnodes;
float dstScore = (float)(pDst->numOfVnodes + 1) / pDst->numOfSupportVnodes;
- mDebug("trans:%d, after balance, src dnode:%d score:%f, dst dnode:%d score:%f", pTrans->id, pSrc->id, srcScore,
+ mInfo("trans:%d, after balance, src dnode:%d score:%f, dst dnode:%d score:%f", pTrans->id, pSrc->id, srcScore,
pDst->id, dstScore);
if (srcScore > dstScore - 0.000001) {
@@ -1803,20 +1803,20 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
numOfVgroups++;
continue;
} else {
- mDebug("trans:%d, no vgroup need to balance from dnode:%d to dnode:%d", pTrans->id, pSrc->id, pDst->id);
+ mInfo("trans:%d, no vgroup need to balance from dnode:%d to dnode:%d", pTrans->id, pSrc->id, pDst->id);
break;
}
} else {
- mDebug("trans:%d, no vgroup need to balance any more", pTrans->id);
+ mInfo("trans:%d, no vgroup need to balance any more", pTrans->id);
break;
}
}
if (numOfVgroups <= 0) {
- mDebug("no need to balance vgroup");
+ mInfo("no need to balance vgroup");
code = 0;
} else {
- mDebug("start to balance vgroup, numOfVgroups:%d", numOfVgroups);
+ mInfo("start to balance vgroup, numOfVgroups:%d", numOfVgroups);
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
code = TSDB_CODE_ACTION_IN_PROGRESS;
}
@@ -1865,7 +1865,7 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) {
if (pArray == NULL) goto _OVER;
if (taosArrayGetSize(pArray) < 2) {
- mDebug("no need to balance vgroup since dnode num less than 2");
+ mInfo("no need to balance vgroup since dnode num less than 2");
code = 0;
} else {
code = mndBalanceVgroup(pMnode, pReq, pArray);
diff --git a/source/dnode/mnode/impl/test/trans/trans2.cpp b/source/dnode/mnode/impl/test/trans/trans2.cpp
index aee8aa27488da6dc6b8b0cbd06a3b34741e66a18..60be7cfbc03f2e19b1f8fd6f821eef08a7d56ee0 100644
--- a/source/dnode/mnode/impl/test/trans/trans2.cpp
+++ b/source/dnode/mnode/impl/test/trans/trans2.cpp
@@ -115,7 +115,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj.superUser = 1;
SRpcMsg rpcMsg = {0};
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, conflict, &rpcMsg);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, conflict, &rpcMsg, "");
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
mndTransAppendRedolog(pTrans, pRedoRaw);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
@@ -148,7 +148,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj.superUser = 1;
SRpcMsg rpcMsg = {0};
- STrans *pTrans = mndTransCreate(pMnode, policy, conflict, &rpcMsg);
+ STrans *pTrans = mndTransCreate(pMnode, policy, conflict, &rpcMsg, "");
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
mndTransAppendRedolog(pTrans, pRedoRaw);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
@@ -220,7 +220,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj.superUser = 1;
SRpcMsg rpcMsg = {0};
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, &rpcMsg);
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, &rpcMsg, "");
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
mndTransAppendRedolog(pTrans, pRedoRaw);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c
index 3db0087334c0eb92be39bc9b97d12356f63062ce..5393c42da33a45629d15f02df803135e853185d7 100644
--- a/source/dnode/mnode/sdb/src/sdb.c
+++ b/source/dnode/mnode/sdb/src/sdb.c
@@ -19,7 +19,7 @@
static int32_t sdbCreateDir(SSdb *pSdb);
SSdb *sdbInit(SSdbOpt *pOption) {
- mDebug("start to init sdb in %s", pOption->path);
+ mInfo("start to init sdb in %s", pOption->path);
SSdb *pSdb = taosMemoryCalloc(1, sizeof(SSdb));
if (pSdb == NULL) {
@@ -61,12 +61,12 @@ SSdb *sdbInit(SSdbOpt *pOption) {
pSdb->commitConfig = -1;
pSdb->pMnode = pOption->pMnode;
taosThreadMutexInit(&pSdb->filelock, NULL);
- mDebug("sdb init successfully");
+ mInfo("sdb init success");
return pSdb;
}
void sdbCleanup(SSdb *pSdb) {
- mDebug("start to cleanup sdb");
+ mInfo("start to cleanup sdb");
sdbWriteFile(pSdb, 0);
@@ -103,12 +103,12 @@ void sdbCleanup(SSdb *pSdb) {
pSdb->hashObjs[i] = NULL;
memset(&pSdb->locks[i], 0, sizeof(pSdb->locks[i]));
- mDebug("sdb table:%s is cleaned up", sdbTableName(i));
+ mInfo("sdb table:%s is cleaned up", sdbTableName(i));
}
taosThreadMutexDestroy(&pSdb->filelock);
taosMemoryFree(pSdb);
- mDebug("sdb is cleaned up");
+ mInfo("sdb is cleaned up");
}
int32_t sdbSetTable(SSdb *pSdb, SSdbTable table) {
@@ -139,7 +139,7 @@ int32_t sdbSetTable(SSdb *pSdb, SSdbTable table) {
pSdb->maxId[sdbType] = 0;
pSdb->hashObjs[sdbType] = hash;
- mDebug("sdb table:%s is initialized", sdbTableName(sdbType));
+ mInfo("sdb table:%s is initialized", sdbTableName(sdbType));
return 0;
}
@@ -175,7 +175,7 @@ void sdbGetCommitInfo(SSdb *pSdb, int64_t *index, int64_t *term, int64_t *config
*index = pSdb->commitIndex;
*term = pSdb->commitTerm;
*config = pSdb->commitConfig;
-#if 0
+#if 1
mTrace("mnode current info, apply index:%" PRId64 " term:%" PRId64 " config:%" PRId64 ", commit index:%" PRId64
" term:%" PRId64 " config:%" PRId64,
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, *index, *term, *config);
diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c
index 00659939e9b1cc2399125bb96edd6bf31d9804fa..ff0c4b26ef76796c6916318f17ad0135261ca015 100644
--- a/source/dnode/mnode/sdb/src/sdbFile.c
+++ b/source/dnode/mnode/sdb/src/sdbFile.c
@@ -23,25 +23,25 @@
#define SDB_FILE_VER 1
static int32_t sdbDeployData(SSdb *pSdb) {
- mDebug("start to deploy sdb");
+ mInfo("start to deploy sdb");
for (int32_t i = SDB_MAX - 1; i >= 0; --i) {
SdbDeployFp fp = pSdb->deployFps[i];
if (fp == NULL) continue;
- mDebug("start to deploy sdb:%s", sdbTableName(i));
+ mInfo("start to deploy sdb:%s", sdbTableName(i));
if ((*fp)(pSdb->pMnode) != 0) {
mError("failed to deploy sdb:%s since %s", sdbTableName(i), terrstr());
return -1;
}
}
- mDebug("sdb deploy successfully");
+ mInfo("sdb deploy success");
return 0;
}
static void sdbResetData(SSdb *pSdb) {
- mDebug("start to reset sdb");
+ mInfo("start to reset sdb");
for (ESdbType i = 0; i < SDB_MAX; ++i) {
SHashObj *hash = pSdb->hashObjs[i];
@@ -64,7 +64,7 @@ static void sdbResetData(SSdb *pSdb) {
taosHashClear(pSdb->hashObjs[i]);
pSdb->tableVer[i] = 0;
pSdb->maxId[i] = 0;
- mDebug("sdb:%s is reset", sdbTableName(i));
+ mInfo("sdb:%s is reset", sdbTableName(i));
}
pSdb->applyIndex = -1;
@@ -73,7 +73,7 @@ static void sdbResetData(SSdb *pSdb) {
pSdb->commitIndex = -1;
pSdb->commitTerm = -1;
pSdb->commitConfig = -1;
- mDebug("sdb reset successfully");
+ mInfo("sdb reset success");
}
static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
@@ -229,7 +229,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
char file[PATH_MAX] = {0};
snprintf(file, sizeof(file), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
- mDebug("start to read sdb file:%s", file);
+ mInfo("start to read sdb file:%s", file);
SSdbRaw *pRaw = taosMemoryMalloc(TSDB_MAX_MSG_SIZE + 100);
if (pRaw == NULL) {
@@ -306,7 +306,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
pSdb->commitTerm = pSdb->applyTerm;
pSdb->commitConfig = pSdb->applyConfig;
memcpy(pSdb->tableVer, tableVer, sizeof(tableVer));
- mDebug("read sdb file:%s successfully, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file,
+ mInfo("read sdb file:%s success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file,
pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig);
_OVER:
@@ -339,7 +339,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
char curfile[PATH_MAX] = {0};
snprintf(curfile, sizeof(curfile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
- mDebug("start to write sdb file, apply index:%" PRId64 " term:%" PRId64 " config:%" PRId64 ", commit index:%" PRId64
+ mInfo("start to write sdb file, apply index:%" PRId64 " term:%" PRId64 " config:%" PRId64 ", commit index:%" PRId64
" term:%" PRId64 " config:%" PRId64 ", file:%s",
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig,
curfile);
@@ -361,7 +361,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
SdbEncodeFp encodeFp = pSdb->encodeFps[i];
if (encodeFp == NULL) continue;
- mDebug("write %s to sdb file, total %d rows", sdbTableName(i), sdbGetSize(pSdb, i));
+ mInfo("write %s to sdb file, total %d rows", sdbTableName(i), sdbGetSize(pSdb, i));
SHashObj *hash = pSdb->hashObjs[i];
TdThreadRwlock *pLock = &pSdb->locks[i];
@@ -437,7 +437,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
pSdb->commitIndex = pSdb->applyIndex;
pSdb->commitTerm = pSdb->applyTerm;
pSdb->commitConfig = pSdb->applyConfig;
- mDebug("write sdb file successfully, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s",
+ mInfo("write sdb file success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s",
pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig, curfile);
}
@@ -519,7 +519,7 @@ static void sdbCloseIter(SSdbIter *pIter) {
pIter->name = NULL;
}
- mDebug("sdbiter:%p, is closed, total:%" PRId64, pIter, pIter->total);
+ mInfo("sdbiter:%p, is closed, total:%" PRId64, pIter, pIter->total);
taosMemoryFree(pIter);
}
@@ -556,7 +556,7 @@ int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *ter
if (term != NULL) *term = commitTerm;
if (config != NULL) *config = commitConfig;
- mDebug("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64
+ mInfo("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64
" file:%s",
pIter, commitIndex, commitTerm, commitConfig, pIter->name);
return 0;
@@ -568,7 +568,7 @@ int32_t sdbStopRead(SSdb *pSdb, SSdbIter *pIter) {
}
int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) {
- int32_t maxlen = 100;
+ int32_t maxlen = 4096;
void *pBuf = taosMemoryCalloc(1, maxlen);
if (pBuf == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -584,14 +584,14 @@ int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) {
taosMemoryFree(pBuf);
return -1;
} else if (readlen == 0) {
- mDebug("sdbiter:%p, read snapshot to the end, total:%" PRId64, pIter, pIter->total);
+ mInfo("sdbiter:%p, read snapshot to the end, total:%" PRId64, pIter, pIter->total);
*ppBuf = NULL;
*len = 0;
taosMemoryFree(pBuf);
return 0;
} else { // (readlen <= maxlen)
pIter->total += readlen;
- mDebug("sdbiter:%p, read:%d bytes from snapshot, total:%" PRId64, pIter, readlen, pIter->total);
+ mInfo("sdbiter:%p, read:%d bytes from snapshot, total:%" PRId64, pIter, readlen, pIter->total);
*ppBuf = pBuf;
*len = readlen;
return 0;
@@ -610,7 +610,7 @@ int32_t sdbStartWrite(SSdb *pSdb, SSdbIter **ppIter) {
}
*ppIter = pIter;
- mDebug("sdbiter:%p, is created to write snapshot, file:%s", pIter, pIter->name);
+ mInfo("sdbiter:%p, is created to write snapshot, file:%s", pIter, pIter->name);
return 0;
}
@@ -619,7 +619,7 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
if (!isApply) {
sdbCloseIter(pIter);
- mDebug("sdbiter:%p, not apply to sdb", pIter);
+ mInfo("sdbiter:%p, not apply to sdb", pIter);
return 0;
}
@@ -655,7 +655,7 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
pSdb->commitIndex = index;
}
- mDebug("sdbiter:%p, successfully applyed to sdb", pIter);
+ mInfo("sdbiter:%p, success applyed to sdb", pIter);
return 0;
}
@@ -668,6 +668,6 @@ int32_t sdbDoWrite(SSdb *pSdb, SSdbIter *pIter, void *pBuf, int32_t len) {
}
pIter->total += writelen;
- mDebug("sdbiter:%p, write:%d bytes to snapshot, total:%" PRId64, pIter, writelen, pIter->total);
+ mInfo("sdbiter:%p, write:%d bytes to snapshot, total:%" PRId64, pIter, writelen, pIter->total);
return 0;
}
diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c
index c579f82a9d18b73105e9f327d4d974f798fb3f76..a102541aca28222bbd48eac0dd1b0a597f795c21 100644
--- a/source/dnode/mnode/sdb/src/sdbHash.c
+++ b/source/dnode/mnode/sdb/src/sdbHash.c
@@ -83,7 +83,7 @@ const char *sdbStatusName(ESdbStatus status) {
}
void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper) {
-#if 0
+#if 1
EKeyType keyType = pSdb->keyTypes[pRow->type];
if (keyType == SDB_KEY_BINARY) {
diff --git a/source/dnode/mnode/sdb/src/sdbRaw.c b/source/dnode/mnode/sdb/src/sdbRaw.c
index 95985cd3d933efa12dc70cd618288dcca57cfad9..3a16ee3f137d0736136f0439f12dd77163beb72a 100644
--- a/source/dnode/mnode/sdb/src/sdbRaw.c
+++ b/source/dnode/mnode/sdb/src/sdbRaw.c
@@ -37,7 +37,7 @@ SSdbRaw *sdbAllocRaw(ESdbType type, int8_t sver, int32_t dataLen) {
pRaw->sver = sver;
pRaw->dataLen = dataLen;
-#if 0
+#if 1
mTrace("raw:%p, is created, len:%d table:%s", pRaw, dataLen, sdbTableName(type));
#endif
return pRaw;
@@ -45,7 +45,7 @@ SSdbRaw *sdbAllocRaw(ESdbType type, int8_t sver, int32_t dataLen) {
void sdbFreeRaw(SSdbRaw *pRaw) {
if (pRaw != NULL) {
-#if 0
+#if 1
mTrace("raw:%p, is freed", pRaw);
#endif
taosMemoryFree(pRaw);
diff --git a/source/dnode/mnode/sdb/src/sdbRow.c b/source/dnode/mnode/sdb/src/sdbRow.c
index b362ee3a454a10c6296c1f0e8bc480f7446e7ea6..c078e7eb21016e251a0e70acd828631dbf86396e 100644
--- a/source/dnode/mnode/sdb/src/sdbRow.c
+++ b/source/dnode/mnode/sdb/src/sdbRow.c
@@ -23,7 +23,7 @@ SSdbRow *sdbAllocRow(int32_t objSize) {
return NULL;
}
-#if 0
+#if 1
mTrace("row:%p, is created, len:%d", pRow->pObj, objSize);
#endif
return pRow;
@@ -47,7 +47,7 @@ void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow, bool callFunc) {
sdbPrintOper(pSdb, pRow, "free");
-#if 0
+#if 1
mTrace("row:%p, is freed", pRow->pObj);
#endif
taosMemoryFreeClear(pRow);
diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c
index b65189153ea4f0aa36680586e472eac4007a457f..efdc8b46934f9677868312c9310cffe989e73ab1 100644
--- a/source/dnode/qnode/src/qnode.c
+++ b/source/dnode/qnode/src/qnode.c
@@ -26,7 +26,7 @@ SQnode *qndOpen(const SQnodeOpt *pOption) {
return NULL;
}
- if (qWorkerInit(NODE_TYPE_QNODE, pQnode->qndId, NULL, (void **)&pQnode->pQuery, &pOption->msgCb)) {
+ if (qWorkerInit(NODE_TYPE_QNODE, pQnode->qndId, (void **)&pQnode->pQuery, &pOption->msgCb)) {
taosMemoryFreeClear(pQnode);
return NULL;
}
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index 24ade017d37f73e83b09578ea5b2211c5b2c43a5..f549ef84f80012b7969a2776e87a18a9e94120ae 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -291,25 +291,25 @@ _query:
tDecoderClear(&dc);
goto _exit;
}
- { // Traverse to find the previous qualified data
- TBC *pCur;
+ { // Traverse to find the previous qualified data
+ TBC *pCur;
tdbTbcOpen(pMeta->pTbDb, &pCur, NULL);
STbDbKey key = {.version = sver, .uid = INT64_MAX};
- int c = 0;
+ int c = 0;
tdbTbcMoveTo(pCur, &key, sizeof(key), &c);
- if(c < 0){
+ if (c < 0) {
tdbTbcMoveToPrev(pCur);
}
void *pKey = NULL;
void *pVal = NULL;
int vLen = 0, kLen = 0;
- while(1){
+ while (1) {
int32_t ret = tdbTbcPrev(pCur, &pKey, &kLen, &pVal, &vLen);
if (ret < 0) break;
- STbDbKey *tmp = (STbDbKey*)pKey;
- if(tmp->uid != uid){
+ STbDbKey *tmp = (STbDbKey *)pKey;
+ if (tmp->uid != uid) {
continue;
}
SDecoder dcNew = {0};
@@ -662,12 +662,13 @@ int64_t metaGetTbNum(SMeta *pMeta) {
// N.B. Called by statusReq per second
int64_t metaGetTimeSeriesNum(SMeta *pMeta) {
// sum of (number of columns of stable - 1) * number of ctables (excluding timestamp column)
- if (pMeta->pVnode->config.vndStats.numOfTimeSeries <= 0 || ++pMeta->pVnode->config.vndStats.itvTimeSeries % 60 == 0) {
+ if (pMeta->pVnode->config.vndStats.numOfTimeSeries <= 0 ||
+ ++pMeta->pVnode->config.vndStats.itvTimeSeries % (60 * 5) == 0) {
int64_t num = 0;
vnodeGetTimeSeriesNum(pMeta->pVnode, &num);
pMeta->pVnode->config.vndStats.numOfTimeSeries = num;
- pMeta->pVnode->config.vndStats.itvTimeSeries = 0;
+ pMeta->pVnode->config.vndStats.itvTimeSeries = (TD_VID(pMeta->pVnode) % 100) * 2;
}
return pMeta->pVnode->config.vndStats.numOfTimeSeries + pMeta->pVnode->config.vndStats.numOfNTimeSeries;
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index ce2a1c4b89336dcd48ae481960e614978f532030..932afe89371433d16b162d9fc52a3c74fb2b0561 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -362,8 +362,9 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
// update uid index
metaUpdateUidIdx(pMeta, &nStbEntry);
- if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
metaULock(pMeta);
+
+ if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
tDecoderClear(&dc);
tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc);
@@ -922,6 +923,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
taosArrayDestroy(pTagArray);
}
+ metaWLock(pMeta);
+
// save to table.db
metaSaveToTbDb(pMeta, &ctbEntry);
@@ -936,6 +939,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
((STag *)(ctbEntry.ctbEntry.pTags))->len, &pMeta->txn);
+ metaULock(pMeta);
+
tDecoderClear(&dc1);
tDecoderClear(&dc2);
if (ctbEntry.ctbEntry.pTags) taosMemoryFree((void *)ctbEntry.ctbEntry.pTags);
diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c
index 07ec7d06947b569b0452b283120430bb44e919ca..2b44cdcef1e56b4ecac59e7e2eb331d0bde18311 100644
--- a/source/dnode/vnode/src/sma/smaCommit.c
+++ b/source/dnode/vnode/src/sma/smaCommit.c
@@ -295,12 +295,17 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
}
/**
- * @brief step 3: consume the SubmitReq in buffer
+ * @brief step 3: commit should wait for all SubmitReq in buffer be consumed
* 1) This is high cost task and should not put in asyncPreCommit originally.
* 2) But, if put in asyncCommit, would trigger taskInfo cloning frequently.
*/
- if (tdRSmaProcessExecImpl(pSma, RSMA_EXEC_COMMIT) < 0) {
- return TSDB_CODE_FAILED;
+ nLoops = 0;
+ while (atomic_load_64(&pRSmaStat->nBufItems) > 0) {
+ ++nLoops;
+ if (nLoops > 1000) {
+ sched_yield();
+ nLoops = 0;
+ }
}
smaInfo("vgId:%d, rsma commit, wait for all items to be consumed, TID:%p", SMA_VID(pSma),
diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c
index b870ea1b6223ce0d2fd1cf527cd5b0c20c27a5b7..ccf4ebb39f26032a329773ead8cd42e0f137e8ee 100644
--- a/source/dnode/vnode/src/sma/smaEnv.c
+++ b/source/dnode/vnode/src/sma/smaEnv.c
@@ -278,7 +278,6 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
smaDebug("vgId:%d, destroy rsma stat %p", SMA_VID(pSma), pRSmaStat);
// step 1: set rsma trigger stat cancelled
atomic_store_8(RSMA_TRIGGER_STAT(pStat), TASK_TRIGGER_STAT_CANCELLED);
- tsem_destroy(&(pStat->notEmpty));
// step 2: destroy the rsma info and associated fetch tasks
taosHashCleanup(RSMA_INFO_HASH(pStat));
@@ -306,6 +305,7 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
tdRSmaFSClose(RSMA_FS(pStat));
// step 6: free pStat
+ tsem_destroy(&(pStat->notEmpty));
taosMemoryFreeClear(pStat);
}
}
diff --git a/source/dnode/vnode/src/sma/smaFS.c b/source/dnode/vnode/src/sma/smaFS.c
index 8e8611f0e869d9e3d29c7456af142f05dba15b91..a5f4e8d2e8ed5d82e13cd8b19a032f9e394bff17 100644
--- a/source/dnode/vnode/src/sma/smaFS.c
+++ b/source/dnode/vnode/src/sma/smaFS.c
@@ -150,6 +150,8 @@ static int32_t tdFetchQTaskInfoFiles(SSma *pSma, int64_t version, SArray **outpu
regex_t regex;
int code = 0;
+ terrno = TSDB_CODE_SUCCESS;
+
tdGetVndDirName(TD_VID(pVnode), tfsGetPrimaryPath(pVnode->pTfs), VNODE_RSMA_DIR, true, dir);
if (!taosCheckExistFile(dir)) {
diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c
index 412def646f39b194bdd9472b357d06acff56ed24..8d1525e081c1224394adf64c7d7ba8e5a6338cc7 100644
--- a/source/dnode/vnode/src/sma/smaRollup.c
+++ b/source/dnode/vnode/src/sma/smaRollup.c
@@ -690,7 +690,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
while (1) {
uint64_t ts;
- int32_t code = qExecTaskOpt(taskInfo, pResList, &ts);
+ int32_t code = qExecTaskOpt(taskInfo, pResList, &ts, NULL);
if (code < 0) {
if (code == TSDB_CODE_QRY_IN_EXEC) {
break;
@@ -1906,7 +1906,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
while (true) {
// step 1: rsma exec - consume data in buffer queue for all suids
- if (type == RSMA_EXEC_OVERFLOW || type == RSMA_EXEC_COMMIT) {
+ if (type == RSMA_EXEC_OVERFLOW) {
void *pIter = NULL;
while ((pIter = taosHashIterate(infoHash, pIter))) {
SRSmaInfo *pInfo = *(SRSmaInfo **)pIter;
@@ -1962,42 +1962,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0);
}
}
- if (type == RSMA_EXEC_COMMIT) {
- if (atomic_load_64(&pRSmaStat->nBufItems) <= 0) {
- break;
- } else {
- // commit should wait for all items be consumed
- continue;
- }
- }
- }
-#if 0
- else if (type == RSMA_EXEC_COMMIT) {
- while (pIter) {
- SRSmaInfo *pInfo = *(SRSmaInfo **)pIter;
- if (taosQueueItemSize(pInfo->iQueue)) {
- if (atomic_val_compare_exchange_8(&pInfo->assigned, 0, 1) == 0) {
- taosReadAllQitems(pInfo->iQueue, pInfo->iQall); // queue has mutex lock
- int32_t qallItemSize = taosQallItemSize(pInfo->iQall);
- if (qallItemSize > 0) {
- atomic_fetch_sub_64(&pRSmaStat->nBufItems, qallItemSize);
- nIdle = 0;
-
- // batch exec
- tdRSmaBatchExec(pSma, pInfo, pInfo->qall, pSubmitArr, type);
- }
-
- // tdRSmaFetchAllResult(pSma, pInfo, pSubmitArr);
- atomic_val_compare_exchange_8(&pInfo->assigned, 1, 0);
- }
- }
- ASSERT(taosQueueItemSize(pInfo->iQueue) == 0);
- pIter = taosHashIterate(infoHash, pIter);
- }
- break;
- }
-#endif
- else {
+ } else {
ASSERT(0);
}
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 98b7dd7163089e5a7e067ca069fb5f61959a74d3..76f3c1b12d7e8e4ae27b38d3a3907ae933d7d904 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -59,7 +59,7 @@ static void destroySTqHandle(void* data) {
tqCloseReader(pData->execHandle.pExecReader);
walCloseReader(pData->pWalReader);
taosHashCleanup(pData->execHandle.execDb.pFilterOutTbUid);
- } else if (pData->execHandle.subType == TOPIC_SUB_TYPE__TABLE){
+ } else if (pData->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
walCloseReader(pData->pWalReader);
tqCloseReader(pData->execHandle.pExecReader);
}
@@ -479,6 +479,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
tqInitDataRsp(&dataRsp, pReq, pHandle->execHandle.subType);
tqScanData(pTq, pHandle, &dataRsp, &fetchOffsetNew);
+#if 1
+
+#endif
if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) {
code = -1;
}
@@ -664,7 +667,10 @@ int32_t tqProcessVgChangeReq(STQ* pTq, int64_t version, char* msg, int32_t msgLe
tqError("vgId:%d, build new consumer handle %s for consumer %d, but old consumerId is %ld", req.vgId, req.subKey,
req.newConsumerId, req.oldConsumerId);
}
- ASSERT(req.newConsumerId != -1);
+ if (req.newConsumerId == -1) {
+ tqError("vgId:%d, tq invalid rebalance request, new consumerId %ld", req.vgId, req.newConsumerId);
+ return 0;
+ }
STqHandle tqHandle = {0};
pHandle = &tqHandle;
/*taosInitRWLatch(&pExec->lock);*/
@@ -876,6 +882,9 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
taosArrayDestroy(pRes->uidList);
+ int32_t* pRef = taosMemoryMalloc(sizeof(int32_t));
+ *pRef = 1;
+
void* pIter = NULL;
while (1) {
pIter = taosHashIterate(pTq->pStreamMeta->pTasks, pIter);
@@ -885,6 +894,33 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
qDebug("delete req enqueue stream task: %d, ver: %" PRId64, pTask->taskId, ver);
+ if (!failed) {
+ SStreamRefDataBlock* pRefBlock = taosAllocateQitem(sizeof(SStreamRefDataBlock), DEF_QITEM);
+ pRefBlock->type = STREAM_INPUT__REF_DATA_BLOCK;
+ pRefBlock->pBlock = pDelBlock;
+ pRefBlock->dataRef = pRef;
+ atomic_add_fetch_32(pRefBlock->dataRef, 1);
+
+ if (streamTaskInput(pTask, (SStreamQueueItem*)pRefBlock) < 0) {
+ qError("stream task input del failed, task id %d", pTask->taskId);
+ continue;
+ }
+ if (streamSchedExec(pTask) < 0) {
+ qError("stream task launch failed, task id %d", pTask->taskId);
+ continue;
+ }
+ } else {
+ streamTaskInputFail(pTask);
+ }
+ }
+ int32_t ref = atomic_sub_fetch_32(pRef, 1);
+ ASSERT(ref >= 0);
+ if (ref == 0) {
+ taosMemoryFree(pDelBlock);
+ taosMemoryFree(pRef);
+ }
+
+#if 0
SStreamDataBlock* pStreamBlock = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM);
pStreamBlock->type = STREAM_INPUT__DATA_BLOCK;
pStreamBlock->blocks = taosArrayInit(0, sizeof(SSDataBlock));
@@ -908,6 +944,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
}
}
blockDataDestroy(pDelBlock);
+#endif
return 0;
}
@@ -1045,6 +1082,7 @@ int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) {
SDecoder decoder;
tDecoderInit(&decoder, msgBody, msgLen);
tDecodeStreamRetrieveReq(&decoder, &req);
+ tDecoderClear(&decoder);
int32_t taskId = req.dstTaskId;
SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId);
if (pTask) {
@@ -1053,6 +1091,7 @@ int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) {
.code = 0,
};
streamProcessRetrieveReq(pTask, &req, &rsp);
+ tDeleteStreamRetrieveReq(&req);
return 0;
} else {
return -1;
diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c
index 62f8debccb8ff9c478de0fb331cc5741b503b011..c55e1059cf8842dccd7d6553d9cff5448dbc5ba5 100644
--- a/source/dnode/vnode/src/tq/tqMeta.c
+++ b/source/dnode/vnode/src/tq/tqMeta.c
@@ -25,17 +25,17 @@ int32_t tEncodeSTqHandle(SEncoder* pEncoder, const STqHandle* pHandle) {
if (tEncodeI8(pEncoder, pHandle->execHandle.subType) < 0) return -1;
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
if (tEncodeCStr(pEncoder, pHandle->execHandle.execCol.qmsg) < 0) return -1;
- } else if(pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB){
+ } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
int32_t size = taosHashGetSize(pHandle->execHandle.execDb.pFilterOutTbUid);
if (tEncodeI32(pEncoder, size) < 0) return -1;
- void *pIter = NULL;
+ void* pIter = NULL;
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
- while(pIter){
- int64_t *tbUid = (int64_t *)taosHashGetKey(pIter, NULL);
+ while (pIter) {
+ int64_t* tbUid = (int64_t*)taosHashGetKey(pIter, NULL);
if (tEncodeI64(pEncoder, *tbUid) < 0) return -1;
pIter = taosHashIterate(pHandle->execHandle.execDb.pFilterOutTbUid, pIter);
}
- } else if(pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE){
+ } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
if (tEncodeI64(pEncoder, pHandle->execHandle.execTb.suid) < 0) return -1;
}
tEndEncode(pEncoder);
@@ -52,17 +52,17 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
if (tDecodeI8(pDecoder, &pHandle->execHandle.subType) < 0) return -1;
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
if (tDecodeCStrAlloc(pDecoder, &pHandle->execHandle.execCol.qmsg) < 0) return -1;
- }else if(pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB){
+ } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
pHandle->execHandle.execDb.pFilterOutTbUid =
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
int32_t size = 0;
if (tDecodeI32(pDecoder, &size) < 0) return -1;
- for(int32_t i = 0; i < size; i++){
+ for (int32_t i = 0; i < size; i++) {
int64_t tbUid = 0;
if (tDecodeI64(pDecoder, &tbUid) < 0) return -1;
taosHashPut(pHandle->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0);
}
- } else if(pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE){
+ } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
if (tDecodeI64(pDecoder, &pHandle->execHandle.execTb.suid) < 0) return -1;
}
tEndDecode(pDecoder);
@@ -117,7 +117,7 @@ int32_t tqMetaSaveCheckInfo(STQ* pTq, const char* key, const void* value, int32_
return -1;
}
- if (tdbTbUpsert(pTq->pExecStore, key, strlen(key), value, vLen, &txn) < 0) {
+ if (tdbTbUpsert(pTq->pCheckStore, key, strlen(key), value, vLen, &txn) < 0) {
return -1;
}
@@ -284,7 +284,6 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
};
if (handle.execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
-
handle.execHandle.task = qCreateQueueExecTaskInfo(
handle.execHandle.execCol.qmsg, &reader, &handle.execHandle.numOfCols, &handle.execHandle.pSchemaWrapper);
ASSERT(handle.execHandle.task);
@@ -297,9 +296,9 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
handle.execHandle.pExecReader = tqOpenReader(pTq->pVnode);
- buildSnapContext(reader.meta, reader.version, 0, handle.execHandle.subType, handle.fetchMeta, (SSnapContext **)(&reader.sContext));
- handle.execHandle.task =
- qCreateQueueExecTaskInfo(NULL, &reader, NULL, NULL);
+ buildSnapContext(reader.meta, reader.version, 0, handle.execHandle.subType, handle.fetchMeta,
+ (SSnapContext**)(&reader.sContext));
+ handle.execHandle.task = qCreateQueueExecTaskInfo(NULL, &reader, NULL, NULL);
} else if (handle.execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
@@ -314,9 +313,9 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
tqReaderSetTbUidList(handle.execHandle.pExecReader, tbUidList);
taosArrayDestroy(tbUidList);
- buildSnapContext(reader.meta, reader.version, handle.execHandle.execTb.suid, handle.execHandle.subType, handle.fetchMeta, (SSnapContext **)(&reader.sContext));
- handle.execHandle.task =
- qCreateQueueExecTaskInfo(NULL, &reader, NULL, NULL);
+ buildSnapContext(reader.meta, reader.version, handle.execHandle.execTb.suid, handle.execHandle.subType,
+ handle.fetchMeta, (SSnapContext**)(&reader.sContext));
+ handle.execHandle.task = qCreateQueueExecTaskInfo(NULL, &reader, NULL, NULL);
}
tqDebug("tq restore %s consumer %" PRId64 " vgId:%d", handle.subKey, handle.consumerId, TD_VID(pTq->pVnode));
taosHashPut(pTq->pHandle, pKey, kLen, &handle, sizeof(STqHandle));
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index 14dbfbd63e9019ee06fd2b70e412fb4dad277f5b..681b25f67684f9846da940f10c4a24e696985acb 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -193,6 +193,8 @@ static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader
static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader);
static int32_t doBuildDataBlock(STsdbReader* pReader);
static TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader);
+static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo);
+static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader);
static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); }
@@ -893,7 +895,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
if (pData->cid < pColData->info.colId) {
colIndex += 1;
} else if (pData->cid == pColData->info.colId) {
- if (pData->flag == HAS_NONE || pData->flag == HAS_NULL) {
+ if (pData->flag == HAS_NONE || pData->flag == HAS_NULL || pData->flag == (HAS_NULL|HAS_NONE)) {
colDataAppendNNULL(pColData, 0, remain);
} else {
if (IS_NUMERIC_TYPE(pColData->info.type) && asc) {
@@ -1285,14 +1287,14 @@ static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, cons
if (p->version >= pBlock->minVer) {
if (i < num - 1) {
TSDBKEY* pnext = taosArrayGet(pBlockScanInfo->delSkyline, i + 1);
- if (i + 1 == num - 1) { // pnext is the last point
+// if (i + 1 == num - 1) { // pnext is the last point
if (pnext->ts >= pBlock->minKey.ts) {
return true;
- }
- } else {
- if (pnext->ts >= pBlock->minKey.ts && pnext->version >= pBlock->minVer) {
- return true;
- }
+// }
+// } else {
+// if (pnext->ts >= pBlock->minKey.ts) {
+// return true;
+// }
}
} else { // it must be the last point
ASSERT(p->version == 0);
@@ -1537,7 +1539,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
minKey = k.ts;
}
- if (minKey > key && pBlockData->nRow > 0) {
+ if (minKey > key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
minKey = key;
}
} else {
@@ -1550,7 +1552,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
minKey = k.ts;
}
- if (minKey < key && pBlockData->nRow > 0) {
+ if (minKey < key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
minKey = key;
}
}
@@ -1688,7 +1690,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
STableBlockScanInfo* pBlockScanInfo, SBlockData* pBlockData) {
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
- if (pBlockData->nRow > 0) {
+ if (hasDataInFileBlock(pBlockData, pDumpInfo)) {
// no last block available, only data block exists
if (!hasDataInLastBlock(pLastBlockReader)) {
return mergeRowsInFileBlocks(pBlockData, pBlockScanInfo, key, pReader);
@@ -1753,7 +1755,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
tsLast = getCurrentKeyInLastBlock(pLastBlockReader);
}
- int64_t key = pBlockData->aTSKEY[pDumpInfo->rowIndex];
+ int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo)? pBlockData->aTSKEY[pDumpInfo->rowIndex]:INT64_MIN;
TSDBKEY k = TSDBROW_KEY(pRow);
TSDBKEY ik = TSDBROW_KEY(piRow);
@@ -1769,7 +1771,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
minKey = ik.ts;
}
- if (minKey > key && pBlockData->nRow > 0) {
+ if (minKey > key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
minKey = key;
}
@@ -1786,7 +1788,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
minKey = ik.ts;
}
- if (minKey < key && pBlockData->nRow > 0) {
+ if (minKey < key && hasDataInFileBlock(pBlockData, pDumpInfo)) {
minKey = key;
}
@@ -2021,6 +2023,13 @@ static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader) {
}
static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLastBlockReader->mergeTree.pIter != NULL; }
+bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) {
+ if (pBlockData->nRow > 0) {
+ ASSERT(pBlockData->nRow == pDumpInfo->totalRows);
+ }
+
+ return pBlockData->nRow > 0 && (!pDumpInfo->allDumped);
+}
int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key,
STsdbReader* pReader) {
@@ -2052,7 +2061,7 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI
SBlockData* pBlockData, SLastBlockReader* pLastBlockReader) {
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
- int64_t key = (pBlockData->nRow > 0) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN;
+ int64_t key = (pBlockData->nRow > 0 && (!pDumpInfo->allDumped)) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN;
if (pBlockScanInfo->iter.hasVal && pBlockScanInfo->iiter.hasVal) {
return doMergeMultiLevelRows(pReader, pBlockScanInfo, pBlockData, pLastBlockReader);
} else {
@@ -2664,8 +2673,11 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* ret
int8_t* pLevel) {
if (VND_IS_RSMA(pVnode)) {
int8_t level = 0;
- int64_t now = taosGetTimestamp(pVnode->config.tsdbCfg.precision);
- int64_t offset = TSDB_TICK_PER_SECOND(pVnode->config.tsdbCfg.precision);
+ int8_t precision = pVnode->config.tsdbCfg.precision;
+ int64_t now = taosGetTimestamp(precision);
+ int64_t offset = tsQueryRsmaTolerance * ((precision == TSDB_TIME_PRECISION_MILLI) ? 1
+ : (precision == TSDB_TIME_PRECISION_MICRO) ? 1000
+ : 1000000);
for (int8_t i = 0; i < TSDB_RETENTION_MAX; ++i) {
SRetention* pRetention = retentions + level;
@@ -3290,9 +3302,31 @@ void* tsdbGetIvtIdx(SMeta* pMeta) {
uint64_t getReaderMaxVersion(STsdbReader* pReader) { return pReader->verRange.maxVer; }
+
+static int32_t doOpenReaderImpl(STsdbReader* pReader) {
+ SDataBlockIter* pBlockIter = &pReader->status.blockIter;
+
+ initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
+ resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
+
+ // no data in files, let's try buffer in memory
+ if (pReader->status.fileIter.numOfFiles == 0) {
+ pReader->status.loadFromFile = false;
+ return TSDB_CODE_SUCCESS;
+ } else {
+ return initForFirstBlockInFile(pReader, pBlockIter);
+ }
+}
+
// ====================================== EXPOSED APIs ======================================
int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTableList, STsdbReader** ppReader,
const char* idstr) {
+ STimeWindow window = pCond->twindows;
+ if (pCond->type == TIMEWINDOW_RANGE_EXTERNAL) {
+ pCond->twindows.skey += 1;
+ pCond->twindows.ekey -= 1;
+ }
+
int32_t code = tsdbReaderCreate(pVnode, pCond, ppReader, 4096, idstr);
if (code != TSDB_CODE_SUCCESS) {
goto _err;
@@ -3300,21 +3334,20 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
// check for query time window
STsdbReader* pReader = *ppReader;
- if (isEmptyQueryTimeWindow(&pReader->window)) {
+ if (isEmptyQueryTimeWindow(&pReader->window) && pCond->type == TIMEWINDOW_RANGE_CONTAINED) {
tsdbDebug("%p query window not overlaps with the data set, no result returned, %s", pReader, pReader->idStr);
return TSDB_CODE_SUCCESS;
}
if (pCond->type == TIMEWINDOW_RANGE_EXTERNAL) {
// update the SQueryTableDataCond to create inner reader
- STimeWindow w = pCond->twindows;
- int32_t order = pCond->order;
+ int32_t order = pCond->order;
if (order == TSDB_ORDER_ASC) {
- pCond->twindows.ekey = pCond->twindows.skey;
+ pCond->twindows.ekey = window.skey;
pCond->twindows.skey = INT64_MIN;
pCond->order = TSDB_ORDER_DESC;
} else {
- pCond->twindows.skey = pCond->twindows.ekey;
+ pCond->twindows.skey = window.ekey;
pCond->twindows.ekey = INT64_MAX;
pCond->order = TSDB_ORDER_ASC;
}
@@ -3326,12 +3359,14 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
}
if (order == TSDB_ORDER_ASC) {
- pCond->twindows.skey = w.ekey;
+ pCond->twindows.skey = window.ekey;
pCond->twindows.ekey = INT64_MAX;
} else {
pCond->twindows.skey = INT64_MIN;
- pCond->twindows.ekey = w.ekey;
+ pCond->twindows.ekey = window.ekey;
}
+ pCond->order = order;
+
code = tsdbReaderCreate(pVnode, pCond, &pReader->innerReader[1], 1, idstr);
if (code != TSDB_CODE_SUCCESS) {
goto _err;
@@ -3340,20 +3375,22 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
// NOTE: the endVersion in pCond is the data version not schema version, so pCond->endVersion is not correct here.
if (pCond->suid != 0) {
- pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, /*pCond->endVersion*/ -1);
+ pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, -1);
if (pReader->pSchema == NULL) {
tsdbError("failed to get table schema, suid:%"PRIu64", ver:%"PRId64" , %s", pReader->suid, -1, pReader->idStr);
}
} else if (taosArrayGetSize(pTableList) > 0) {
STableKeyInfo* pKey = taosArrayGet(pTableList, 0);
- pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, /*pCond->endVersion*/ -1);
+ pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1);
if (pReader->pSchema == NULL) {
tsdbError("failed to get table schema, uid:%"PRIu64", ver:%"PRId64" , %s", pKey->uid, -1, pReader->idStr);
}
}
+ STsdbReader* p = pReader->innerReader[0] != NULL? pReader->innerReader[0]:pReader;
+
int32_t numOfTables = taosArrayGetSize(pTableList);
- pReader->status.pTableMap = createDataBlockScanInfo(pReader, pTableList->pData, numOfTables);
+ pReader->status.pTableMap = createDataBlockScanInfo(p, pTableList->pData, numOfTables);
if (pReader->status.pTableMap == NULL) {
tsdbReaderClose(pReader);
*ppReader = NULL;
@@ -3368,40 +3405,36 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
}
if (pReader->type == TIMEWINDOW_RANGE_CONTAINED) {
- SDataBlockIter* pBlockIter = &pReader->status.blockIter;
-
- initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
- resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
-
- // no data in files, let's try buffer in memory
- if (pReader->status.fileIter.numOfFiles == 0) {
- pReader->status.loadFromFile = false;
- } else {
- code = initForFirstBlockInFile(pReader, pBlockIter);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
+ code = doOpenReaderImpl(pReader);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
}
} else {
- STsdbReader* pPrevReader = pReader->innerReader[0];
- SDataBlockIter* pBlockIter = &pPrevReader->status.blockIter;
+ STsdbReader* pPrevReader = pReader->innerReader[0];
+ STsdbReader* pNextReader = pReader->innerReader[1];
+
+ // we need only one row
+ pPrevReader->capacity = 1;
+ pPrevReader->status.pTableMap = pReader->status.pTableMap;
+ pPrevReader->pReadSnap = pReader->pReadSnap;
- code = tsdbTakeReadSnap(pPrevReader->pTsdb, &pPrevReader->pReadSnap, pReader->idStr);
+ pNextReader->capacity = 1;
+ pNextReader->status.pTableMap = pReader->status.pTableMap;
+ pNextReader->pReadSnap = pReader->pReadSnap;
+
+ code = doOpenReaderImpl(pPrevReader);
if (code != TSDB_CODE_SUCCESS) {
- goto _err;
+ return code;
}
- initFilesetIterator(&pPrevReader->status.fileIter, pPrevReader->pReadSnap->fs.aDFileSet, pPrevReader);
- resetDataBlockIterator(&pPrevReader->status.blockIter, pPrevReader->order);
+ code = doOpenReaderImpl(pNextReader);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
- // no data in files, let's try buffer in memory
- if (pPrevReader->status.fileIter.numOfFiles == 0) {
- pPrevReader->status.loadFromFile = false;
- } else {
- code = initForFirstBlockInFile(pPrevReader, pBlockIter);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
+ code = doOpenReaderImpl(pReader);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
}
}
@@ -3418,6 +3451,19 @@ void tsdbReaderClose(STsdbReader* pReader) {
return;
}
+ {
+ if (pReader->innerReader[0] != NULL) {
+ pReader->innerReader[0]->status.pTableMap = NULL;
+ pReader->innerReader[0]->pReadSnap = NULL;
+
+ pReader->innerReader[1]->status.pTableMap = NULL;
+ pReader->innerReader[1]->pReadSnap = NULL;
+
+ tsdbReaderClose(pReader->innerReader[0]);
+ tsdbReaderClose(pReader->innerReader[1]);
+ }
+ }
+
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
taosMemoryFreeClear(pSupInfo->plist);
@@ -3508,32 +3554,32 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
return false;
}
- if (pReader->innerReader[0] != NULL) {
+ if (pReader->innerReader[0] != NULL && pReader->step == 0) {
bool ret = doTsdbNextDataBlock(pReader->innerReader[0]);
+ resetDataBlockScanInfo(pReader->innerReader[0]->status.pTableMap, pReader->innerReader[0]->window.ekey);
+ pReader->step = EXTERNAL_ROWS_PREV;
+
if (ret) {
- pReader->step = EXTERNAL_ROWS_PREV;
return ret;
}
+ }
- tsdbReaderClose(pReader->innerReader[0]);
- pReader->innerReader[0] = NULL;
+ if (pReader->step == EXTERNAL_ROWS_PREV) {
+ pReader->step = EXTERNAL_ROWS_MAIN;
}
- pReader->step = EXTERNAL_ROWS_MAIN;
bool ret = doTsdbNextDataBlock(pReader);
if (ret) {
return ret;
}
- if (pReader->innerReader[1] != NULL) {
+ if (pReader->innerReader[1] != NULL && pReader->step == EXTERNAL_ROWS_MAIN) {
+ resetDataBlockScanInfo(pReader->innerReader[1]->status.pTableMap, pReader->window.ekey);
bool ret1 = doTsdbNextDataBlock(pReader->innerReader[1]);
+ pReader->step = EXTERNAL_ROWS_NEXT;
if (ret1) {
- pReader->step = EXTERNAL_ROWS_NEXT;
return ret1;
}
-
- tsdbReaderClose(pReader->innerReader[1]);
- pReader->innerReader[1] = NULL;
}
return false;
diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c
index 8cfe1d8adfddb675856238501977fb9d9d8aee6e..825bf8a0a7c0adbf5a19c08c2e2418da3b6e571a 100644
--- a/source/dnode/vnode/src/vnd/vnodeQuery.c
+++ b/source/dnode/vnode/src/vnd/vnodeQuery.c
@@ -16,7 +16,7 @@
#include "vnd.h"
int vnodeQueryOpen(SVnode *pVnode) {
- return qWorkerInit(NODE_TYPE_VNODE, TD_VID(pVnode), NULL, (void **)&pVnode->pQuery, &pVnode->msgCb);
+ return qWorkerInit(NODE_TYPE_VNODE, TD_VID(pVnode), (void **)&pVnode->pQuery, &pVnode->msgCb);
}
void vnodeQueryClose(SVnode *pVnode) { qWorkerDestroy((void **)&pVnode->pQuery); }
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index 65d4e9aaf10cf9c0ee723eb70b94166cde1fba0d..a941b5955ca0e466cd511ef347b655a4bdee3673 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -676,6 +676,18 @@ static void vnodeLeaderTransfer(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsm
static void vnodeRestoreFinish(struct SSyncFSM *pFsm) {
SVnode *pVnode = pFsm->data;
+
+ do {
+ int32_t itemSize = tmsgGetQueueSize(&pVnode->msgCb, pVnode->config.vgId, APPLY_QUEUE);
+ if (itemSize == 0) {
+ vInfo("vgId:%d, apply queue is empty, restore finish", pVnode->config.vgId);
+ break;
+ } else {
+ vInfo("vgId:%d, restore not finish since %d items in apply queue", pVnode->config.vgId);
+ taosMsleep(10);
+ }
+ } while (true);
+
pVnode->restored = true;
vDebug("vgId:%d, sync restore finished", pVnode->config.vgId);
}
diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h
index 706985f89468455b49876ac8d20edef634c42ff9..ad677a81ff304a3637c9a24c2c20b4f03cee3ac1 100644
--- a/source/libs/command/inc/commandInt.h
+++ b/source/libs/command/inc/commandInt.h
@@ -99,8 +99,10 @@ extern "C" {
typedef struct SExplainGroup {
int32_t nodeNum;
+ int32_t nodeIdx;
int32_t physiPlanExecNum;
int32_t physiPlanExecIdx;
+ bool singleChannel;
SRWLatch lock;
SSubplan *plan;
SArray *nodeExecInfo; //Array
diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c
index 967c682b0bb701502dff90081fba8973a34bd22a..c5de44e1f67d3e4843a0357be88bbac730fc2d99 100644
--- a/source/libs/command/src/explain.c
+++ b/source/libs/command/src/explain.c
@@ -21,14 +21,14 @@
#include "tdatablock.h"
int32_t qExplainGenerateResNode(SPhysiNode *pNode, SExplainGroup *group, SExplainResNode **pRes);
-int32_t qExplainAppendGroupResRows(void *pCtx, int32_t groupId, int32_t level);
+int32_t qExplainAppendGroupResRows(void *pCtx, int32_t groupId, int32_t level, bool singleChannel);
void qExplainFreeResNode(SExplainResNode *resNode) {
if (NULL == resNode) {
return;
}
- taosMemoryFreeClear(resNode->pExecInfo);
+ taosArrayDestroy(resNode->pExecInfo);
SNode *node = NULL;
FOREACH(node, resNode->pChildren) { qExplainFreeResNode((SExplainResNode *)node); }
@@ -56,8 +56,9 @@ void qExplainFreeCtx(SExplainCtx *pCtx) {
int32_t num = taosArrayGetSize(group->nodeExecInfo);
for (int32_t i = 0; i < num; ++i) {
SExplainRsp *rsp = taosArrayGet(group->nodeExecInfo, i);
- taosMemoryFreeClear(rsp->subplanInfo);
+ tFreeSExplainRsp(rsp);
}
+ taosArrayDestroy(group->nodeExecInfo);
}
pIter = taosHashIterate(pCtx->groupHash, pIter);
@@ -66,6 +67,7 @@ void qExplainFreeCtx(SExplainCtx *pCtx) {
taosHashCleanup(pCtx->groupHash);
taosArrayDestroy(pCtx->rows);
+ taosMemoryFreeClear(pCtx->tbuf);
taosMemoryFree(pCtx);
}
@@ -248,7 +250,7 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo
return TSDB_CODE_SUCCESS;
}
-int32_t qExplainGenerateResNodeExecInfo(SArray **pExecInfo, SExplainGroup *group) {
+int32_t qExplainGenerateResNodeExecInfo(SPhysiNode *pNode, SArray **pExecInfo, SExplainGroup *group) {
*pExecInfo = taosArrayInit(group->nodeNum, sizeof(SExplainExecInfo));
if (NULL == (*pExecInfo)) {
qError("taosArrayInit %d explainExecInfo failed", group->nodeNum);
@@ -256,17 +258,28 @@ int32_t qExplainGenerateResNodeExecInfo(SArray **pExecInfo, SExplainGroup *group
}
SExplainRsp *rsp = NULL;
- for (int32_t i = 0; i < group->nodeNum; ++i) {
- rsp = taosArrayGet(group->nodeExecInfo, i);
- /*
- if (group->physiPlanExecIdx >= rsp->numOfPlans) {
- qError("physiPlanIdx %d exceed plan num %d", group->physiPlanExecIdx, rsp->numOfPlans);
- return TSDB_CODE_QRY_APP_ERROR;
- }
+ if (group->singleChannel) {
+ if (0 == group->physiPlanExecIdx) {
+ group->nodeIdx = 0;
+ }
+
+ rsp = taosArrayGet(group->nodeExecInfo, group->nodeIdx++);
+ if (group->physiPlanExecIdx >= rsp->numOfPlans) {
+ qError("physiPlanIdx %d exceed plan num %d", group->physiPlanExecIdx, rsp->numOfPlans);
+ return TSDB_CODE_QRY_APP_ERROR;
+ }
+
+ taosArrayPush(*pExecInfo, rsp->subplanInfo + group->physiPlanExecIdx);
+ } else {
+ for (int32_t i = 0; i < group->nodeNum; ++i) {
+ rsp = taosArrayGet(group->nodeExecInfo, i);
+ if (group->physiPlanExecIdx >= rsp->numOfPlans) {
+ qError("physiPlanIdx %d exceed plan num %d", group->physiPlanExecIdx, rsp->numOfPlans);
+ return TSDB_CODE_QRY_APP_ERROR;
+ }
- taosArrayPush(*pExecInfo, rsp->subplanInfo + group->physiPlanExecIdx);
- */
- taosArrayPush(*pExecInfo, rsp->subplanInfo);
+ taosArrayPush(*pExecInfo, rsp->subplanInfo + group->physiPlanExecIdx);
+ }
}
++group->physiPlanExecIdx;
@@ -291,7 +304,7 @@ int32_t qExplainGenerateResNode(SPhysiNode *pNode, SExplainGroup *group, SExplai
resNode->pNode = pNode;
if (group->nodeExecInfo) {
- QRY_ERR_JRET(qExplainGenerateResNodeExecInfo(&resNode->pExecInfo, group));
+ QRY_ERR_JRET(qExplainGenerateResNodeExecInfo(pNode, &resNode->pExecInfo, group));
}
QRY_ERR_JRET(qExplainGenerateResChildren(pNode, group, &resNode->pChildren));
@@ -764,9 +777,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: {
SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode;
- SExplainGroup *group = taosHashGet(ctx->groupHash, &pExchNode->srcGroupId, sizeof(pExchNode->srcGroupId));
+ SExplainGroup *group = taosHashGet(ctx->groupHash, &pExchNode->srcStartGroupId, sizeof(pExchNode->srcStartGroupId));
if (NULL == group) {
- qError("exchange src group %d not in groupHash", pExchNode->srcGroupId);
+ qError("exchange src group %d not in groupHash", pExchNode->srcStartGroupId);
QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
}
@@ -801,7 +814,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
}
- QRY_ERR_RET(qExplainAppendGroupResRows(ctx, pExchNode->srcGroupId, level + 1));
+ QRY_ERR_RET(qExplainAppendGroupResRows(ctx, pExchNode->srcStartGroupId, level + 1, pExchNode->singleChannel));
break;
}
case QUERY_NODE_PHYSICAL_PLAN_SORT: {
@@ -1533,7 +1546,7 @@ int32_t qExplainResNodeToRows(SExplainResNode *pResNode, SExplainCtx *ctx, int32
return TSDB_CODE_SUCCESS;
}
-int32_t qExplainAppendGroupResRows(void *pCtx, int32_t groupId, int32_t level) {
+int32_t qExplainAppendGroupResRows(void *pCtx, int32_t groupId, int32_t level, bool singleChannel) {
SExplainResNode *node = NULL;
int32_t code = 0;
SExplainCtx *ctx = (SExplainCtx *)pCtx;
@@ -1544,6 +1557,9 @@ int32_t qExplainAppendGroupResRows(void *pCtx, int32_t groupId, int32_t level) {
QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
}
+ group->singleChannel = singleChannel;
+ group->physiPlanExecIdx = 0;
+
QRY_ERR_RET(qExplainGenerateResNode(group->plan->pNode, group, &node));
QRY_ERR_JRET(qExplainResNodeToRows(node, ctx, level));
@@ -1707,7 +1723,7 @@ int32_t qExplainAppendPlanRows(SExplainCtx *pCtx) {
}
int32_t qExplainGenerateRsp(SExplainCtx *pCtx, SRetrieveTableRsp **pRsp) {
- QRY_ERR_RET(qExplainAppendGroupResRows(pCtx, pCtx->rootGroupId, 0));
+ QRY_ERR_RET(qExplainAppendGroupResRows(pCtx, pCtx->rootGroupId, 0, false));
QRY_ERR_RET(qExplainAppendPlanRows(pCtx));
QRY_ERR_RET(qExplainGetRspFromCtx(pCtx, pRsp));
@@ -1723,7 +1739,7 @@ int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t
SExplainGroup *group = taosHashGet(ctx->groupHash, &groupId, sizeof(groupId));
if (NULL == group) {
qError("group %d not in groupHash", groupId);
- taosMemoryFreeClear(pRspMsg->subplanInfo);
+ tFreeSExplainRsp(pRspMsg);
QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
}
@@ -1732,7 +1748,7 @@ int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t
group->nodeExecInfo = taosArrayInit(group->nodeNum, sizeof(SExplainRsp));
if (NULL == group->nodeExecInfo) {
qError("taosArrayInit %d explainExecInfo failed", group->nodeNum);
- taosMemoryFreeClear(pRspMsg->subplanInfo);
+ tFreeSExplainRsp(pRspMsg);
taosWUnLockLatch(&group->lock);
QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -1742,7 +1758,7 @@ int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t
} else if (taosArrayGetSize(group->nodeExecInfo) >= group->nodeNum) {
qError("group execInfo already full, size:%d, nodeNum:%d", (int32_t)taosArrayGetSize(group->nodeExecInfo),
group->nodeNum);
- taosMemoryFreeClear(pRspMsg->subplanInfo);
+ tFreeSExplainRsp(pRspMsg);
taosWUnLockLatch(&group->lock);
QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
@@ -1751,13 +1767,14 @@ int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t
if (group->physiPlanExecNum != pRspMsg->numOfPlans) {
qError("physiPlanExecNum %d mismatch with others %d in group %d", pRspMsg->numOfPlans, group->physiPlanExecNum,
groupId);
- taosMemoryFreeClear(pRspMsg->subplanInfo);
+ tFreeSExplainRsp(pRspMsg);
taosWUnLockLatch(&group->lock);
QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
}
taosArrayPush(group->nodeExecInfo, pRspMsg);
+
groupDone = (taosArrayGetSize(group->nodeExecInfo) >= group->nodeNum);
taosWUnLockLatch(&group->lock);
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index 6484b6cb31b3e10d67f62812e20c76091c35c02f..dc98b0547957ab910afb6b4d465c020cfbd60799 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -183,6 +183,7 @@ typedef struct SExecTaskInfo {
EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model]
SSubplan* pSubplan;
struct SOperatorInfo* pRoot;
+ SLocalFetch localFetch;
} SExecTaskInfo;
enum {
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index 45b88ec6a5c8143ba192aa7924cd873e4b406e6c..373cb451f4f73fc0d2f6245f9ea9af06617ea59f 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -49,6 +49,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
SStreamScanInfo* pInfo = pOperator->info;
+#if 0
// TODO: if a block was set but not consumed,
// prevent setting a different type of block
pInfo->validBlockIndex = 0;
@@ -57,6 +58,10 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
} else {
taosArrayClear(pInfo->pBlockLists);
}
+#endif
+
+ ASSERT(pInfo->validBlockIndex == 0);
+ ASSERT(taosArrayGetSize(pInfo->pBlockLists) == 0);
if (type == STREAM_INPUT__MERGED_SUBMIT) {
// ASSERT(numOfBlocks > 1);
@@ -79,7 +84,9 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
} else if (type == STREAM_INPUT__DATA_BLOCK) {
for (int32_t i = 0; i < numOfBlocks; ++i) {
SSDataBlock* pDataBlock = &((SSDataBlock*)input)[i];
+ taosArrayPush(pInfo->pBlockLists, &pDataBlock);
+#if 0
// TODO optimize
SSDataBlock* p = createOneDataBlock(pDataBlock, false);
p->info = pDataBlock->info;
@@ -87,6 +94,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
taosArrayClear(p->pDataBlock);
taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock);
taosArrayPush(pInfo->pBlockLists, &p);
+#endif
}
pInfo->blockType = STREAM_INPUT__DATA_BLOCK;
} else {
@@ -100,6 +108,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
static FORCE_INLINE void streamInputBlockDataDestory(void* pBlock) { blockDataDestroy((SSDataBlock*)pBlock); }
void tdCleanupStreamInputDataBlock(qTaskInfo_t tinfo) {
+#if 0
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
if (!pTaskInfo || !pTaskInfo->pRoot || pTaskInfo->pRoot->numOfDownstream <= 0) {
return;
@@ -116,6 +125,7 @@ void tdCleanupStreamInputDataBlock(qTaskInfo_t tinfo) {
} else {
ASSERT(0);
}
+#endif
}
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type) {
@@ -469,10 +479,14 @@ static void freeBlock(void* param) {
blockDataDestroy(pBlock);
}
-int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds) {
+int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, SLocalFetch* pLocal) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
int64_t threadId = taosGetSelfPthreadId();
+ if (pLocal) {
+ memcpy(&pTaskInfo->localFetch, pLocal, sizeof(*pLocal));
+ }
+
taosArrayClearEx(pResList, freeBlock);
int64_t curOwner = 0;
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index a1ff79bd03738a1f0195879985a9da9544630c03..7fcd41dc3e10d77ccba6ef15f7420b78190c4948 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -81,11 +81,6 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) {
int32_t getMaximumIdleDurationSec() { return tsShellActivityTimer * 2; }
-static int32_t getExprFunctionId(SExprInfo* pExprInfo) {
- assert(pExprInfo != NULL && pExprInfo->pExpr != NULL && pExprInfo->pExpr->nodeType == TEXPR_UNARYEXPR_NODE);
- return 0;
-}
-
static void setBlockSMAInfo(SqlFunctionCtx* pCtx, SExprInfo* pExpr, SSDataBlock* pBlock);
static void releaseQueryBuf(size_t numOfTables);
@@ -1115,7 +1110,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
}
}
-static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep);
+static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, bool keep, int32_t status);
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColMatchInfo) {
if (pFilterNode == NULL || pBlock->info.rows == 0) {
@@ -1126,18 +1121,17 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColM
// todo move to the initialization function
int32_t code = filterInitFromNode((SNode*)pFilterNode, &filter, 0);
-
- size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
- SFilterColumnParam param1 = {.numOfCols = numOfCols, .pDataBlock = pBlock->pDataBlock};
+ SFilterColumnParam param1 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock};
code = filterSetDataFromSlotId(filter, ¶m1);
- int8_t* rowRes = NULL;
+ SColumnInfoData* p = NULL;
+ int32_t status = 0;
// todo the keep seems never to be True??
- bool keep = filterExecute(filter, pBlock, &rowRes, NULL, param1.numOfCols);
+ bool keep = filterExecute(filter, pBlock, &p, NULL, param1.numOfCols, &status);
filterFreeInfo(filter);
- extractQualifiedTupleByFilterResult(pBlock, rowRes, keep);
+ extractQualifiedTupleByFilterResult(pBlock, p, keep, status);
if (pColMatchInfo != NULL) {
for (int32_t i = 0; i < taosArrayGetSize(pColMatchInfo); ++i) {
@@ -1152,16 +1146,22 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColM
}
}
- taosMemoryFree(rowRes);
+ colDataDestroy(p);
+ taosMemoryFree(p);
}
-void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep) {
+void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, bool keep, int32_t status) {
if (keep) {
return;
}
- if (rowRes != NULL) {
- int32_t totalRows = pBlock->info.rows;
+ int32_t totalRows = pBlock->info.rows;
+
+ if (status == FILTER_RESULT_ALL_QUALIFIED) {
+ // here nothing needs to be done
+ } else if (status == FILTER_RESULT_NONE_QUALIFIED) {
+ pBlock->info.rows = 0;
+ } else {
SSDataBlock* px = createOneDataBlock(pBlock, true);
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
@@ -1177,7 +1177,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR
int32_t numOfRows = 0;
for (int32_t j = 0; j < totalRows; ++j) {
- if (rowRes[j] == 0) {
+ if (((int8_t*)p->pData)[j] == 0) {
continue;
}
@@ -1189,6 +1189,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR
numOfRows += 1;
}
+ // todo this value can be assigned directly
if (pBlock->info.rows == totalRows) {
pBlock->info.rows = numOfRows;
} else {
@@ -1197,13 +1198,10 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR
}
blockDataDestroy(px); // fix memory leak
- } else {
- // do nothing
- pBlock->info.rows = 0;
}
}
-void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
+ void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
// for simple group by query without interval, all the tables belong to one group result.
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SAggOperatorInfo* pAggInfo = pOperator->info;
@@ -1778,49 +1776,57 @@ void qProcessRspMsg(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTaskInfo, int32_t sourceIndex) {
size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources);
- SResFetchReq* pMsg = taosMemoryCalloc(1, sizeof(SResFetchReq));
- if (NULL == pMsg) {
- pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY;
- return pTaskInfo->code;
- }
-
SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, sourceIndex);
SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, sourceIndex);
ASSERT(pDataInfo->status == EX_SOURCE_DATA_NOT_READY);
- qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", execId:%d, %d/%" PRIzu,
- GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, pSource->execId,
- sourceIndex, totalSources);
-
- pMsg->header.vgId = htonl(pSource->addr.nodeId);
- pMsg->sId = htobe64(pSource->schedId);
- pMsg->taskId = htobe64(pSource->taskId);
- pMsg->queryId = htobe64(pTaskInfo->id.queryId);
- pMsg->execId = htonl(pSource->execId);
-
- // send the fetch remote task result reques
- SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
- if (NULL == pMsgSendInfo) {
- taosMemoryFreeClear(pMsg);
- qError("%s prepare message %d failed", GET_TASKID(pTaskInfo), (int32_t)sizeof(SMsgSendInfo));
- pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY;
- return pTaskInfo->code;
- }
-
SFetchRspHandleWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SFetchRspHandleWrapper));
pWrapper->exchangeId = pExchangeInfo->self;
pWrapper->sourceIndex = sourceIndex;
- pMsgSendInfo->param = pWrapper;
- pMsgSendInfo->paramFreeFp = taosMemoryFree;
- pMsgSendInfo->msgInfo.pData = pMsg;
- pMsgSendInfo->msgInfo.len = sizeof(SResFetchReq);
- pMsgSendInfo->msgType = pSource->fetchMsgType;
- pMsgSendInfo->fp = loadRemoteDataCallback;
+ if (pSource->localExec) {
+ SDataBuf pBuf = {0};
+ int32_t code = (*pTaskInfo->localFetch.fp)(pTaskInfo->localFetch.handle, pSource->schedId, pTaskInfo->id.queryId, pSource->taskId, 0, pSource->execId, &pBuf.pData, pTaskInfo->localFetch.explainRes);
+ loadRemoteDataCallback(pWrapper, &pBuf, code);
+ taosMemoryFree(pWrapper);
+ } else {
+ SResFetchReq* pMsg = taosMemoryCalloc(1, sizeof(SResFetchReq));
+ if (NULL == pMsg) {
+ pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY;
+ return pTaskInfo->code;
+ }
+
+ qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", execId:%d, %d/%" PRIzu,
+ GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, pSource->execId,
+ sourceIndex, totalSources);
+
+ pMsg->header.vgId = htonl(pSource->addr.nodeId);
+ pMsg->sId = htobe64(pSource->schedId);
+ pMsg->taskId = htobe64(pSource->taskId);
+ pMsg->queryId = htobe64(pTaskInfo->id.queryId);
+ pMsg->execId = htonl(pSource->execId);
+
+ // send the fetch remote task result reques
+ SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
+ if (NULL == pMsgSendInfo) {
+ taosMemoryFreeClear(pMsg);
+ qError("%s prepare message %d failed", GET_TASKID(pTaskInfo), (int32_t)sizeof(SMsgSendInfo));
+ pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY;
+ return pTaskInfo->code;
+ }
+
+ pMsgSendInfo->param = pWrapper;
+ pMsgSendInfo->paramFreeFp = taosMemoryFree;
+ pMsgSendInfo->msgInfo.pData = pMsg;
+ pMsgSendInfo->msgInfo.len = sizeof(SResFetchReq);
+ pMsgSendInfo->msgType = pSource->fetchMsgType;
+ pMsgSendInfo->fp = loadRemoteDataCallback;
- int64_t transporterId = 0;
- int32_t code = asyncSendMsgToServer(pExchangeInfo->pTransporter, &pSource->addr.epSet, &transporterId, pMsgSendInfo);
+ int64_t transporterId = 0;
+ int32_t code = asyncSendMsgToServer(pExchangeInfo->pTransporter, &pSource->addr.epSet, &transporterId, pMsgSendInfo);
+ }
+
return TSDB_CODE_SUCCESS;
}
@@ -3533,7 +3539,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
STableScanInfo* pScanInfo = pOperator->info;
pTaskInfo->cost.pRecoder = &pScanInfo->readRecorder;
} else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) {
- pOperator = createExchangeOperatorInfo(pHandle->pMsgCb->clientRpc, (SExchangePhysiNode*)pPhyNode, pTaskInfo);
+ pOperator = createExchangeOperatorInfo(pHandle ? pHandle->pMsgCb->clientRpc : NULL, (SExchangePhysiNode*)pPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) {
STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode;
if (pHandle->vnode) {
@@ -4049,8 +4055,10 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) {
cleanupTableSchemaInfo(&pTaskInfo->schemaInfo);
cleanupStreamInfo(&pTaskInfo->streamInfo);
- nodesDestroyNode((SNode*)pTaskInfo->pSubplan);
-
+ if (!pTaskInfo->localFetch.localExec) {
+ nodesDestroyNode((SNode*)pTaskInfo->pSubplan);
+ }
+
taosMemoryFreeClear(pTaskInfo->sql);
taosMemoryFreeClear(pTaskInfo->id.str);
taosMemoryFreeClear(pTaskInfo);
@@ -4246,10 +4254,10 @@ int32_t buildDataBlockFromGroupRes(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock
pCtx[j].resultInfo = getResultEntryInfo(pRow, j, rowEntryOffset);
if (pCtx[j].fpSet.finalize) {
- 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));
- T_LONG_JMP(pTaskInfo->env, code);
+ int32_t code1 = pCtx[j].fpSet.finalize(&pCtx[j], pBlock);
+ if (TAOS_FAILED(code1)) {
+ qError("%s build result data block error, code %s", GET_TASKID(pTaskInfo), tstrerror(code1));
+ T_LONG_JMP(pTaskInfo->env, code1);
}
} else if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_value") == 0) {
// do nothing, todo refactor
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index 8f9a78db83994e0d4252ecca3a5fd9ec76855aa8..6c5c33ae29e034add9bb07cea6f98c66dbeec58b 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -920,6 +920,19 @@ _error:
}
static void doClearBufferedBlocks(SStreamScanInfo* pInfo) {
+#if 0
+ if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {
+ size_t total = taosArrayGetSize(pInfo->pBlockLists);
+ for (int32_t i = 0; i < total; i++) {
+ SSDataBlock* p = taosArrayGetP(pInfo->pBlockLists, i);
+ taosArrayDestroy(p->pDataBlock);
+ taosMemoryFree(p);
+ }
+ }
+#endif
+ taosArrayClear(pInfo->pBlockLists);
+ pInfo->validBlockIndex = 0;
+#if 0
size_t total = taosArrayGetSize(pInfo->pBlockLists);
pInfo->validBlockIndex = 0;
@@ -928,6 +941,7 @@ static void doClearBufferedBlocks(SStreamScanInfo* pInfo) {
blockDataDestroy(p);
}
taosArrayClear(pInfo->pBlockLists);
+#endif
}
static bool isSessionWindow(SStreamScanInfo* pInfo) {
@@ -1303,10 +1317,14 @@ void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t*
SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX);
SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
+ SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
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(pGpCol, pBlock->info.rows, (const char*)pGp, false);
+ colDataAppendNULL(pCalStartCol, pBlock->info.rows);
+ colDataAppendNULL(pCalEndCol, pBlock->info.rows);
pBlock->info.rows++;
}
@@ -1480,6 +1498,40 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
}
}
+static int32_t filterDelBlockByUid(SSDataBlock* pDst, const SSDataBlock* pSrc, SStreamScanInfo* pInfo) {
+ STqReader* pReader = pInfo->tqReader;
+ int32_t rows = pSrc->info.rows;
+ blockDataEnsureCapacity(pDst, rows);
+
+ SColumnInfoData* pSrcStartCol = taosArrayGet(pSrc->pDataBlock, START_TS_COLUMN_INDEX);
+ uint64_t* startCol = (uint64_t*)pSrcStartCol->pData;
+ SColumnInfoData* pSrcEndCol = taosArrayGet(pSrc->pDataBlock, END_TS_COLUMN_INDEX);
+ uint64_t* endCol = (uint64_t*)pSrcEndCol->pData;
+ SColumnInfoData* pSrcUidCol = taosArrayGet(pSrc->pDataBlock, UID_COLUMN_INDEX);
+ uint64_t* uidCol = (uint64_t*)pSrcUidCol->pData;
+
+ SColumnInfoData* pDstStartCol = taosArrayGet(pDst->pDataBlock, START_TS_COLUMN_INDEX);
+ SColumnInfoData* pDstEndCol = taosArrayGet(pDst->pDataBlock, END_TS_COLUMN_INDEX);
+ SColumnInfoData* pDstUidCol = taosArrayGet(pDst->pDataBlock, UID_COLUMN_INDEX);
+ int32_t j = 0;
+ for (int32_t i = 0; i < rows; i++) {
+ if (taosHashGet(pReader->tbIdHash, &uidCol[i], sizeof(uint64_t))) {
+ colDataAppend(pDstStartCol, j, (const char*)&startCol[i], false);
+ colDataAppend(pDstEndCol, j, (const char*)&endCol[i], false);
+ colDataAppend(pDstUidCol, j, (const char*)&uidCol[i], false);
+
+ colDataAppendNULL(taosArrayGet(pDst->pDataBlock, GROUPID_COLUMN_INDEX), j);
+ colDataAppendNULL(taosArrayGet(pDst->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX), j);
+ colDataAppendNULL(taosArrayGet(pDst->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX), j);
+ j++;
+ }
+ }
+ pDst->info = pSrc->info;
+ pDst->info.rows = j;
+
+ return 0;
+}
+
static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
// NOTE: this operator does never check if current status is done or not
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
@@ -1542,9 +1594,10 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
size_t total = taosArrayGetSize(pInfo->pBlockLists);
// TODO: refactor
+FETCH_NEXT_BLOCK:
if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {
if (pInfo->validBlockIndex >= total) {
- /*doClearBufferedBlocks(pInfo);*/
+ doClearBufferedBlocks(pInfo);
/*pOperator->status = OP_EXEC_DONE;*/
return NULL;
}
@@ -1568,21 +1621,40 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
} break;
case STREAM_DELETE_DATA: {
printDataBlock(pBlock, "stream scan delete recv");
+ SSDataBlock* pDelBlock = NULL;
+ if (pInfo->tqReader) {
+ pDelBlock = createSpecialDataBlock(STREAM_DELETE_DATA);
+ filterDelBlockByUid(pDelBlock, pBlock, pInfo);
+ } else {
+ pDelBlock = pBlock;
+ }
+ printDataBlock(pBlock, "stream scan delete recv filtered");
if (!isIntervalWindow(pInfo) && !isSessionWindow(pInfo) && !isStateWindow(pInfo)) {
- generateDeleteResultBlock(pInfo, pBlock, pInfo->pDeleteDataRes);
+ generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes);
pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT;
- printDataBlock(pBlock, "stream scan delete result");
- return pInfo->pDeleteDataRes;
+ printDataBlock(pDelBlock, "stream scan delete result");
+ if (pInfo->pDeleteDataRes->info.rows > 0) {
+ return pInfo->pDeleteDataRes;
+ } else {
+ goto FETCH_NEXT_BLOCK;
+ }
} else {
pInfo->blockType = STREAM_INPUT__DATA_SUBMIT;
pInfo->updateResIndex = 0;
- generateScanRange(pInfo, pBlock, pInfo->pUpdateRes);
+ generateScanRange(pInfo, pDelBlock, pInfo->pUpdateRes);
prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex);
copyDataBlock(pInfo->pDeleteDataRes, pInfo->pUpdateRes);
pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA;
pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE;
- printDataBlock(pBlock, "stream scan delete data");
- return pInfo->pDeleteDataRes;
+ printDataBlock(pDelBlock, "stream scan delete data");
+ if (pInfo->tqReader) {
+ blockDataDestroy(pDelBlock);
+ }
+ if (pInfo->pDeleteDataRes->info.rows > 0) {
+ return pInfo->pDeleteDataRes;
+ } else {
+ goto FETCH_NEXT_BLOCK;
+ }
}
} break;
default:
@@ -1644,9 +1716,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
int32_t totBlockNum = taosArrayGetSize(pInfo->pBlockLists);
+ NEXT_SUBMIT_BLK:
while (1) {
if (pInfo->tqReader->pMsg == NULL) {
if (pInfo->validBlockIndex >= totBlockNum) {
+ updateInfoDestoryColseWinSBF(pInfo->pUpdateInfo);
+ doClearBufferedBlocks(pInfo);
return NULL;
}
@@ -1718,7 +1793,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
}
qDebug("scan rows: %d", pBlockInfo->rows);
- return (pBlockInfo->rows == 0) ? NULL : pInfo->pRes;
+ if (pBlockInfo->rows > 0) {
+ return pInfo->pRes;
+ } else {
+ goto NEXT_SUBMIT_BLK;
+ }
+ /*return (pBlockInfo->rows == 0) ? NULL : pInfo->pRes;*/
} else {
ASSERT(0);
return NULL;
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index e7abf1385151ed404e04b490523e8b857badd5dd..4671570802c24e0f48c3f49687bea380e275d674 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -1115,7 +1115,7 @@ static bool compareVal(const char* v, const SStateKeys* pKey) {
if (varDataLen(v) != varDataLen(pKey->pData)) {
return false;
} else {
- return strncmp(varDataVal(v), varDataVal(pKey->pData), varDataLen(v)) == 0;
+ return memcmp(varDataVal(v), varDataVal(pKey->pData), varDataLen(v)) == 0;
}
} else {
return memcmp(pKey->pData, v, pKey->bytes) == 0;
@@ -1695,6 +1695,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) {
}
nodesDestroyNode((SNode*)pInfo->pPhyNode);
colDataDestroy(&pInfo->twAggSup.timeWindowData);
+ cleanupGroupResInfo(&pInfo->groupResInfo);
taosMemoryFreeClear(param);
}
@@ -2082,7 +2083,7 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo
}
}
- pSliceInfo->fillLastPoint = isLastRow ? true : false;
+ pSliceInfo->fillLastPoint = isLastRow;
}
static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock) {
@@ -2301,15 +2302,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
SSDataBlock* pResBlock = pSliceInfo->pRes;
SExprSupp* pSup = &pOperator->exprSupp;
- // if (pOperator->status == OP_RES_TO_RETURN) {
- // // doBuildResultDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
- // if (pResBlock->info.rows == 0 || !hasRemainResults(&pSliceInfo->groupResInfo)) {
- // doSetOperatorCompleted(pOperator);
- // }
- //
- // return pResBlock;
- // }
-
int32_t order = TSDB_ORDER_ASC;
SInterval* pInterval = &pSliceInfo->interval;
SOperatorInfo* downstream = pOperator->pDownstream[0];
@@ -2439,6 +2431,9 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
break;
}
}
+ } else {
+ // store ts value as start, and calculate interp value when processing next block
+ doKeepLinearInfo(pSliceInfo, pBlock, i, true);
}
} else { // non-linear interpolation
if (i < pBlock->info.rows - 1) {
@@ -2517,6 +2512,9 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
break;
}
}
+ } else { // it is the last row of current block
+ // store ts value as start, and calculate interp value when processing next block
+ doKeepLinearInfo(pSliceInfo, pBlock, i, true);
}
} else { // non-linear interpolation
pSliceInfo->current =
@@ -2622,6 +2620,10 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
pInfo->interval.interval = pInterpPhyNode->interval;
pInfo->current = pInfo->win.skey;
+ STableScanInfo* pScanInfo = (STableScanInfo*)downstream->info;
+ pScanInfo->cond.twindows = pInfo->win;
+ pScanInfo->cond.type = TIMEWINDOW_RANGE_EXTERNAL;
+
pOperator->name = "TimeSliceOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC;
pOperator->blocking = false;
@@ -3081,6 +3083,7 @@ void processPullOver(SSDataBlock* pBlock, SHashObj* pMap) {
taosArrayRemove(chArray, index);
if (taosArrayGetSize(chArray) == 0) {
// pull data is over
+ taosArrayDestroy(chArray);
taosHashRemove(pMap, &winRes, sizeof(SWinKey));
}
}
@@ -3117,9 +3120,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
SStreamFinalIntervalOperatorInfo* pInfo = pOperator->info;
SOperatorInfo* downstream = pOperator->pDownstream[0];
- SArray* pUpdated = taosArrayInit(4, POINTER_BYTES);
- _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
- SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
TSKEY maxTs = INT64_MIN;
TSKEY minTs = INT64_MAX;
@@ -3183,6 +3183,9 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
}
}
+ SArray* pUpdated = taosArrayInit(4, POINTER_BYTES);
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
while (1) {
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
if (pBlock == NULL) {
@@ -5663,7 +5666,6 @@ static void doStreamIntervalAggImpl2(SOperatorInfo* pOperatorInfo, SSDataBlock*
TSKEY* tsCols = NULL;
SResultRow* pResult = NULL;
int32_t forwardRows = 0;
- int32_t aa = 4;
ASSERT(pSDataBlock->pDataBlock != NULL);
SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex);
@@ -5763,8 +5765,6 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
_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) {
@@ -5813,36 +5813,6 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
}
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs);
pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, minTs);
-
-#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;
closeStreamIntervalWindow(pInfo->aggSup.pResultRowHashTable, &pInfo->twAggSup, &pInfo->interval, NULL, pUpdatedMap,
pOperator);
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index f3d3393ac3fa122c60cddcd19373011c5c180495..0677bd7d636ba5c7bea0acfaec62e5ca109122e1 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -207,7 +207,6 @@ static int32_t countTrailingSpaces(const SValueNode* pVal, bool isLtrim) {
}
return numOfSpaces;
-
}
void static addTimezoneParam(SNodeList* pList) {
@@ -322,7 +321,7 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len
}
int32_t numOfSpaces = 0;
- SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0);
+ SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0);
// for select trim functions with constant value from table,
// need to set the proper result result schema bytes to avoid
// trailing garbage characters
@@ -331,7 +330,6 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len
numOfSpaces = countTrailingSpaces(pValue, isLtrim);
}
-
int32_t resBytes = pPara1->resType.bytes - numOfSpaces;
pFunc->node.resType = (SDataType){.bytes = resBytes, .type = pPara1->resType.type};
return TSDB_CODE_SUCCESS;
@@ -2141,7 +2139,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "avg",
.type = FUNCTION_TYPE_AVG,
- .classification = FUNC_MGT_AGG_FUNC,
+ .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED,
.translateFunc = translateInNumOutDou,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getAvgFuncEnv,
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index a23f58a7328cd1c94dc7b77e91a8e048ac8b383a..9177d15fae1e9de4d4f3794cff50dfe07f9d2a1d 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -47,6 +47,7 @@ typedef struct SSumRes {
uint64_t usum;
double dsum;
};
+ int16_t type;
} SSumRes;
typedef struct SAvgRes {
@@ -73,6 +74,7 @@ typedef struct SMinmaxResInfo {
STuplePos nullTuplePos;
bool nullTupleSaved;
+ int16_t type;
} SMinmaxResInfo;
typedef struct STopBotResItem {
@@ -485,8 +487,7 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t firstCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx);
SFirstLastRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo);
- int32_t type = pDestCtx->input.pData[0]->info.type;
- int32_t bytes = pDestCtx->input.pData[0]->info.bytes;
+ int32_t bytes = pDBuf->bytes;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
SFirstLastRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo);
@@ -617,6 +618,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) {
int32_t type = pInput->pData[0]->info.type;
SSumRes* pSumRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
+ pSumRes->type = type;
if (IS_NULL_TYPE(type)) {
numOfElem = 0;
@@ -740,10 +742,10 @@ int32_t sumInvertFunction(SqlFunctionCtx* pCtx) {
int32_t sumCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx);
SSumRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo);
- int32_t type = pDestCtx->input.pData[0]->info.type;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
SSumRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo);
+ int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type;
if (IS_SIGNED_NUMERIC_TYPE(type) || type == TSDB_DATA_TYPE_BOOL) {
pDBuf->isum += pSBuf->isum;
@@ -1072,10 +1074,10 @@ int32_t avgInvertFunction(SqlFunctionCtx* pCtx) {
int32_t avgCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx);
SAvgRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo);
- int32_t type = pDestCtx->input.pData[0]->info.type;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
SAvgRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo);
+ int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type;
if (IS_SIGNED_NUMERIC_TYPE(type)) {
pDBuf->sum.isum += pSBuf->sum.isum;
@@ -1181,6 +1183,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
SMinmaxResInfo* pBuf = GET_ROWCELL_INTERBUF(pResInfo);
+ pBuf->type = type;
if (IS_NULL_TYPE(type)) {
numOfElems = 0;
@@ -1729,10 +1732,10 @@ void replaceTupleData(STuplePos* pDestPos, STuplePos* pSourcePos) {
int32_t minMaxCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx, int32_t isMinFunc) {
SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx);
SMinmaxResInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo);
- int32_t type = pDestCtx->input.pData[0]->info.type;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
SMinmaxResInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo);
+ int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type;
if (IS_FLOAT_TYPE(type)) {
if (pSBuf->assign && ((((*(double*)&pDBuf->v) < (*(double*)&pSBuf->v)) ^ isMinFunc) || !pDBuf->assign)) {
*(double*)&pDBuf->v = *(double*)&pSBuf->v;
@@ -2105,10 +2108,10 @@ int32_t stddevPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t stddevCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx);
SStddevRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo);
- int32_t type = pDestCtx->input.pData[0]->info.type;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
SStddevRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo);
+ int16_t type = pDBuf->type == TSDB_DATA_TYPE_NULL ? pSBuf->type : pDBuf->type;
if (IS_SIGNED_NUMERIC_TYPE(type)) {
pDBuf->isum += pSBuf->isum;
@@ -3069,8 +3072,7 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx);
SFirstLastRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo);
- int32_t type = pDestCtx->input.pData[0]->info.type;
- int32_t bytes = pDestCtx->input.pData[0]->info.bytes;
+ int32_t bytes = pDBuf->bytes;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
SFirstLastRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo);
@@ -3746,9 +3748,9 @@ void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type,
}
int32_t topCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
- int32_t type = pDestCtx->input.pData[0]->info.type;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
STopBotRes* pSBuf = getTopBotOutputInfo(pSourceCtx);
+ int16_t type = pSBuf->type;
for (int32_t i = 0; i < pSResInfo->numOfRes; i++) {
addResult(pDestCtx, pSBuf->pItems + i, type, true);
}
@@ -3756,9 +3758,9 @@ int32_t topCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
}
int32_t bottomCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) {
- int32_t type = pDestCtx->input.pData[0]->info.type;
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
STopBotRes* pSBuf = getTopBotOutputInfo(pSourceCtx);
+ int16_t type = pSBuf->type;
for (int32_t i = 0; i < pSResInfo->numOfRes; i++) {
addResult(pDestCtx, pSBuf->pItems + i, type, false);
}
@@ -5414,8 +5416,8 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
int32_t i = pInput->startRowIndex;
if (pCtx->start.key != INT64_MIN) {
- //ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) ||
- // (pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC));
+ // ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) ||
+ // (pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC));
ASSERT(last->key == INT64_MIN);
for (; i < pInput->numOfRows + pInput->startRowIndex; ++i) {
diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c
index 26735fa263cfed15ead940493b3c1eadf0e29c70..bc10ce71aeeb49ca816d4ea95c489f412ef13da6 100644
--- a/source/libs/function/src/functionMgt.c
+++ b/source/libs/function/src/functionMgt.c
@@ -26,11 +26,6 @@ typedef struct SFuncMgtService {
SHashObj* pFuncNameHashTable;
} SFuncMgtService;
-typedef struct SUdfInfo {
- SDataType outputDt;
- int8_t funcType;
-} SUdfInfo;
-
static SFuncMgtService gFunMgtService;
static TdThreadOnce functionHashTableInit = PTHREAD_ONCE_INIT;
static int32_t initFunctionCode = 0;
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index 48e21e137f9f7167bebfdfba7f3f281dbd6232b2..c145952778aa17fb660a4732e2c0d6c068de521a 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -324,6 +324,21 @@ static int32_t fillNodeCopy(const SFillNode* pSrc, SFillNode* pDst) {
return TSDB_CODE_SUCCESS;
}
+static int32_t whenThenNodeCopy(const SWhenThenNode* pSrc, SWhenThenNode* pDst) {
+ COPY_BASE_OBJECT_FIELD(node, exprNodeCopy);
+ CLONE_NODE_FIELD(pWhen);
+ CLONE_NODE_FIELD(pThen);
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t caseWhenNodeCopy(const SCaseWhenNode* pSrc, SCaseWhenNode* pDst) {
+ COPY_BASE_OBJECT_FIELD(node, exprNodeCopy);
+ CLONE_NODE_FIELD(pCase);
+ CLONE_NODE_FIELD(pElse);
+ CLONE_NODE_LIST_FIELD(pWhenThenList);
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) {
CLONE_NODE_LIST_FIELD(pTargets);
CLONE_NODE_FIELD(pConditions);
@@ -414,7 +429,8 @@ static int32_t logicVnodeModifCopy(const SVnodeModifyLogicNode* pSrc, SVnodeModi
static int32_t logicExchangeCopy(const SExchangeLogicNode* pSrc, SExchangeLogicNode* pDst) {
COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
- COPY_SCALAR_FIELD(srcGroupId);
+ COPY_SCALAR_FIELD(srcStartGroupId);
+ COPY_SCALAR_FIELD(srcEndGroupId);
return TSDB_CODE_SUCCESS;
}
@@ -611,6 +627,7 @@ static int32_t downstreamSourceCopy(const SDownstreamSourceNode* pSrc, SDownstre
COPY_SCALAR_FIELD(schedId);
COPY_SCALAR_FIELD(execId);
COPY_SCALAR_FIELD(fetchMsgType);
+ COPY_SCALAR_FIELD(localExec);
return TSDB_CODE_SUCCESS;
}
@@ -711,6 +728,12 @@ SNode* nodesCloneNode(const SNode* pNode) {
case QUERY_NODE_LEFT_VALUE:
code = TSDB_CODE_SUCCESS;
break;
+ case QUERY_NODE_WHEN_THEN:
+ code = whenThenNodeCopy((const SWhenThenNode*)pNode, (SWhenThenNode*)pDst);
+ break;
+ case QUERY_NODE_CASE_WHEN:
+ code = caseWhenNodeCopy((const SCaseWhenNode*)pNode, (SCaseWhenNode*)pDst);
+ break;
case QUERY_NODE_SELECT_STMT:
code = selectStmtCopy((const SSelectStmt*)pNode, (SSelectStmt*)pDst);
break;
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index afd05eff1d1c6a2c895581b4be0f76e75e9ca631..af6c1757a9173dd0b9aeb649b07a3c7edcbc3002 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -81,6 +81,10 @@ const char* nodesNodeName(ENodeType type) {
return "IndexOptions";
case QUERY_NODE_LEFT_VALUE:
return "LeftValue";
+ case QUERY_NODE_WHEN_THEN:
+ return "WhenThen";
+ case QUERY_NODE_CASE_WHEN:
+ return "CaseWhen";
case QUERY_NODE_SET_OPERATOR:
return "SetOperator";
case QUERY_NODE_SELECT_STMT:
@@ -559,6 +563,8 @@ static const char* jkScanLogicPlanStableId = "StableId";
static const char* jkScanLogicPlanScanType = "ScanType";
static const char* jkScanLogicPlanScanCount = "ScanCount";
static const char* jkScanLogicPlanReverseScanCount = "ReverseScanCount";
+static const char* jkScanLogicPlanDynamicScanFuncs = "DynamicScanFuncs";
+static const char* jkScanLogicPlanDataRequired = "DataRequired";
static const char* jkScanLogicPlanTagCond = "TagCond";
static const char* jkScanLogicPlanGroupTags = "GroupTags";
@@ -590,6 +596,12 @@ static int32_t logicScanNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkScanLogicPlanReverseScanCount, pNode->scanSeq[1]);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkScanLogicPlanDynamicScanFuncs, nodeToJson, pNode->pDynamicScanFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkScanLogicPlanDataRequired, pNode->dataRequired);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkScanLogicPlanTagCond, nodeToJson, pNode->pTagCond);
}
@@ -629,6 +641,12 @@ static int32_t jsonToLogicScanNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetUTinyIntValue(pJson, jkScanLogicPlanReverseScanCount, &pNode->scanSeq[1]);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkScanLogicPlanDynamicScanFuncs, &pNode->pDynamicScanFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkScanLogicPlanDataRequired, &pNode->dataRequired);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkScanLogicPlanTagCond, &pNode->pTagCond);
}
@@ -708,14 +726,18 @@ static int32_t jsonToLogicVnodeModifyNode(const SJson* pJson, void* pObj) {
return code;
}
-static const char* jkExchangeLogicPlanSrcGroupId = "SrcGroupId";
+static const char* jkExchangeLogicPlanSrcStartGroupId = "SrcStartGroupId";
+static const char* jkExchangeLogicPlanSrcEndGroupId = "SrcEndGroupId";
static int32_t logicExchangeNodeToJson(const void* pObj, SJson* pJson) {
const SExchangeLogicNode* pNode = (const SExchangeLogicNode*)pObj;
int32_t code = logicPlanNodeToJson(pObj, pJson);
if (TSDB_CODE_SUCCESS == code) {
- code = tjsonAddIntegerToObject(pJson, jkExchangeLogicPlanSrcGroupId, pNode->srcGroupId);
+ code = tjsonAddIntegerToObject(pJson, jkExchangeLogicPlanSrcStartGroupId, pNode->srcStartGroupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkExchangeLogicPlanSrcEndGroupId, pNode->srcEndGroupId);
}
return code;
@@ -726,7 +748,10 @@ static int32_t jsonToLogicExchangeNode(const SJson* pJson, void* pObj) {
int32_t code = jsonToLogicPlanNode(pJson, pObj);
if (TSDB_CODE_SUCCESS == code) {
- code = tjsonGetIntValue(pJson, jkExchangeLogicPlanSrcGroupId, &pNode->srcGroupId);
+ code = tjsonGetIntValue(pJson, jkExchangeLogicPlanSrcStartGroupId, &pNode->srcStartGroupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkExchangeLogicPlanSrcEndGroupId, &pNode->srcEndGroupId);
}
return code;
@@ -1819,7 +1844,8 @@ static int32_t jsonToPhysiAggNode(const SJson* pJson, void* pObj) {
return code;
}
-static const char* jkExchangePhysiPlanSrcGroupId = "SrcGroupId";
+static const char* jkExchangePhysiPlanSrcStartGroupId = "SrcStartGroupId";
+static const char* jkExchangePhysiPlanSrcEndGroupId = "SrcEndGroupId";
static const char* jkExchangePhysiPlanSrcEndPoints = "SrcEndPoints";
static int32_t physiExchangeNodeToJson(const void* pObj, SJson* pJson) {
@@ -1827,7 +1853,10 @@ static int32_t physiExchangeNodeToJson(const void* pObj, SJson* pJson) {
int32_t code = physicPlanNodeToJson(pObj, pJson);
if (TSDB_CODE_SUCCESS == code) {
- code = tjsonAddIntegerToObject(pJson, jkExchangePhysiPlanSrcGroupId, pNode->srcGroupId);
+ code = tjsonAddIntegerToObject(pJson, jkExchangePhysiPlanSrcStartGroupId, pNode->srcStartGroupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkExchangePhysiPlanSrcEndGroupId, pNode->srcEndGroupId);
}
if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkExchangePhysiPlanSrcEndPoints, pNode->pSrcEndPoints);
@@ -1841,7 +1870,10 @@ static int32_t jsonToPhysiExchangeNode(const SJson* pJson, void* pObj) {
int32_t code = jsonToPhysicPlanNode(pJson, pObj);
if (TSDB_CODE_SUCCESS == code) {
- code = tjsonGetIntValue(pJson, jkExchangePhysiPlanSrcGroupId, &pNode->srcGroupId);
+ code = tjsonGetIntValue(pJson, jkExchangePhysiPlanSrcStartGroupId, &pNode->srcStartGroupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkExchangePhysiPlanSrcEndGroupId, &pNode->srcEndGroupId);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkExchangePhysiPlanSrcEndPoints, &pNode->pSrcEndPoints);
@@ -3903,6 +3935,75 @@ static int32_t jsonToDatabaseOptions(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkWhenThenWhen = "When";
+static const char* jkWhenThenThen = "Then";
+
+static int32_t whenThenNodeToJson(const void* pObj, SJson* pJson) {
+ const SWhenThenNode* pNode = (const SWhenThenNode*)pObj;
+
+ int32_t code = exprNodeToJson(pObj, pJson);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkWhenThenWhen, nodeToJson, pNode->pWhen);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkWhenThenThen, nodeToJson, pNode->pThen);
+ }
+
+ return code;
+}
+
+static int32_t jsonToWhenThenNode(const SJson* pJson, void* pObj) {
+ SWhenThenNode* pNode = (SWhenThenNode*)pObj;
+
+ int32_t code = jsonToExprNode(pJson, pObj);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkWhenThenWhen, &pNode->pWhen);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkWhenThenThen, &pNode->pThen);
+ }
+
+ return code;
+}
+
+static const char* jkCaseWhenCase = "Case";
+static const char* jkCaseWhenWhenThenList = "WhenThenList";
+static const char* jkCaseWhenElse = "Else";
+
+static int32_t caseWhenNodeToJson(const void* pObj, SJson* pJson) {
+ const SCaseWhenNode* pNode = (const SCaseWhenNode*)pObj;
+
+ int32_t code = exprNodeToJson(pObj, pJson);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCaseWhenCase, nodeToJson, pNode->pCase);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkCaseWhenWhenThenList, pNode->pWhenThenList);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCaseWhenElse, nodeToJson, pNode->pElse);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCaseWhenNode(const SJson* pJson, void* pObj) {
+ SCaseWhenNode* pNode = (SCaseWhenNode*)pObj;
+
+ int32_t code = jsonToExprNode(pJson, pObj);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCaseWhenCase, &pNode->pCase);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkCaseWhenWhenThenList, &pNode->pWhenThenList);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCaseWhenElse, &pNode->pElse);
+ }
+
+ return code;
+}
+
static const char* jkDataBlockDescDataBlockId = "DataBlockId";
static const char* jkDataBlockDescSlots = "Slots";
static const char* jkDataBlockTotalRowSize = "TotalRowSize";
@@ -4385,6 +4486,10 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return databaseOptionsToJson(pObj, pJson);
case QUERY_NODE_LEFT_VALUE:
return TSDB_CODE_SUCCESS; // SLeftValueNode has no fields to serialize.
+ case QUERY_NODE_WHEN_THEN:
+ return whenThenNodeToJson(pObj, pJson);
+ case QUERY_NODE_CASE_WHEN:
+ return caseWhenNodeToJson(pObj, pJson);
case QUERY_NODE_SET_OPERATOR:
return setOperatorToJson(pObj, pJson);
case QUERY_NODE_SELECT_STMT:
@@ -4548,6 +4653,10 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToDatabaseOptions(pJson, pObj);
case QUERY_NODE_LEFT_VALUE:
return TSDB_CODE_SUCCESS; // SLeftValueNode has no fields to deserialize.
+ case QUERY_NODE_WHEN_THEN:
+ return jsonToWhenThenNode(pJson, pObj);
+ case QUERY_NODE_CASE_WHEN:
+ return jsonToCaseWhenNode(pJson, pObj);
case QUERY_NODE_SET_OPERATOR:
return jsonToSetOperator(pJson, pObj);
case QUERY_NODE_SELECT_STMT:
diff --git a/source/libs/nodes/src/nodesEqualFuncs.c b/source/libs/nodes/src/nodesEqualFuncs.c
index 9cb7e8b66d2a7dbc91e13e76e47c3189112a7825..4e23999ec2c32e2c82a6b0c569b3ff5c60770ef7 100644
--- a/source/libs/nodes/src/nodesEqualFuncs.c
+++ b/source/libs/nodes/src/nodesEqualFuncs.c
@@ -140,6 +140,19 @@ static bool functionNodeEqual(const SFunctionNode* a, const SFunctionNode* b) {
return true;
}
+static bool whenThenNodeEqual(const SWhenThenNode* a, const SWhenThenNode* b) {
+ COMPARE_NODE_FIELD(pWhen);
+ COMPARE_NODE_FIELD(pThen);
+ return true;
+}
+
+static bool caseWhenNodeEqual(const SCaseWhenNode* a, const SCaseWhenNode* b) {
+ COMPARE_NODE_FIELD(pCase);
+ COMPARE_NODE_FIELD(pElse);
+ COMPARE_NODE_LIST_FIELD(pWhenThenList);
+ return true;
+}
+
bool nodesEqualNode(const SNode* a, const SNode* b) {
if (a == b) {
return true;
@@ -164,13 +177,17 @@ bool nodesEqualNode(const SNode* a, const SNode* b) {
return logicConditionNodeEqual((const SLogicConditionNode*)a, (const SLogicConditionNode*)b);
case QUERY_NODE_FUNCTION:
return functionNodeEqual((const SFunctionNode*)a, (const SFunctionNode*)b);
+ case QUERY_NODE_WHEN_THEN:
+ return whenThenNodeEqual((const SWhenThenNode*)a, (const SWhenThenNode*)b);
+ case QUERY_NODE_CASE_WHEN:
+ return caseWhenNodeEqual((const SCaseWhenNode*)a, (const SCaseWhenNode*)b);
case QUERY_NODE_REAL_TABLE:
case QUERY_NODE_TEMP_TABLE:
case QUERY_NODE_JOIN_TABLE:
case QUERY_NODE_GROUPING_SET:
case QUERY_NODE_ORDER_BY_EXPR:
case QUERY_NODE_LIMIT:
- return false; // todo
+ return false;
default:
break;
}
diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c
index 2c47ddea8b6fc267a5a64fc1aae1cf411b23a75c..0c6b11a765ca45311968929f035d21af1742f2f3 100644
--- a/source/libs/nodes/src/nodesMsgFuncs.c
+++ b/source/libs/nodes/src/nodesMsgFuncs.c
@@ -1733,6 +1733,92 @@ static int32_t msgToDownstreamSourceNode(STlvDecoder* pDecoder, void* pObj) {
return code;
}
+enum { WHEN_THEN_CODE_EXPR_BASE = 1, WHEN_THEN_CODE_WHEN, WHEN_THEN_CODE_THEN };
+
+static int32_t whenThenNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SWhenThenNode* pNode = (const SWhenThenNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, WHEN_THEN_CODE_EXPR_BASE, exprNodeToMsg, pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, WHEN_THEN_CODE_WHEN, nodeToMsg, pNode->pWhen);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, WHEN_THEN_CODE_THEN, nodeToMsg, pNode->pThen);
+ }
+
+ return code;
+}
+
+static int32_t msgToWhenThenNode(STlvDecoder* pDecoder, void* pObj) {
+ SWhenThenNode* pNode = (SWhenThenNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case WHEN_THEN_CODE_EXPR_BASE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
+ break;
+ case WHEN_THEN_CODE_WHEN:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pWhen);
+ break;
+ case WHEN_THEN_CODE_THEN:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pThen);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
+enum { CASE_WHEN_CODE_EXPR_BASE = 1, CASE_WHEN_CODE_CASE, CASE_WHEN_CODE_ELSE, CASE_WHEN_CODE_WHEN_THEN_LIST };
+
+static int32_t caseWhenNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SCaseWhenNode* pNode = (const SCaseWhenNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_EXPR_BASE, exprNodeToMsg, pNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_CASE, nodeToMsg, pNode->pCase);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_ELSE, nodeToMsg, pNode->pElse);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, CASE_WHEN_CODE_WHEN_THEN_LIST, nodeListToMsg, pNode->pWhenThenList);
+ }
+
+ return code;
+}
+
+static int32_t msgToCaseWhenNode(STlvDecoder* pDecoder, void* pObj) {
+ SCaseWhenNode* pNode = (SCaseWhenNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case CASE_WHEN_CODE_EXPR_BASE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
+ break;
+ case CASE_WHEN_CODE_CASE:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pCase);
+ break;
+ case CASE_WHEN_CODE_ELSE:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pElse);
+ break;
+ case CASE_WHEN_CODE_WHEN_THEN_LIST:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pWhenThenList);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
enum {
PHY_NODE_CODE_OUTPUT_DESC = 1,
PHY_NODE_CODE_CONDITIONS,
@@ -2294,7 +2380,8 @@ static int32_t msgToPhysiAggNode(STlvDecoder* pDecoder, void* pObj) {
enum {
PHY_EXCHANGE_CODE_BASE_NODE = 1,
- PHY_EXCHANGE_CODE_SRC_GROUP_ID,
+ PHY_EXCHANGE_CODE_SRC_START_GROUP_ID,
+ PHY_EXCHANGE_CODE_SRC_END_GROUP_ID,
PHY_EXCHANGE_CODE_SINGLE_CHANNEL,
PHY_EXCHANGE_CODE_SRC_ENDPOINTS
};
@@ -2304,7 +2391,10 @@ static int32_t physiExchangeNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
int32_t code = tlvEncodeObj(pEncoder, PHY_EXCHANGE_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
if (TSDB_CODE_SUCCESS == code) {
- code = tlvEncodeI32(pEncoder, PHY_EXCHANGE_CODE_SRC_GROUP_ID, pNode->srcGroupId);
+ code = tlvEncodeI32(pEncoder, PHY_EXCHANGE_CODE_SRC_START_GROUP_ID, pNode->srcStartGroupId);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI32(pEncoder, PHY_EXCHANGE_CODE_SRC_END_GROUP_ID, pNode->srcEndGroupId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeBool(pEncoder, PHY_EXCHANGE_CODE_SINGLE_CHANNEL, pNode->singleChannel);
@@ -2326,8 +2416,11 @@ static int32_t msgToPhysiExchangeNode(STlvDecoder* pDecoder, void* pObj) {
case PHY_EXCHANGE_CODE_BASE_NODE:
code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
break;
- case PHY_EXCHANGE_CODE_SRC_GROUP_ID:
- code = tlvDecodeI32(pTlv, &pNode->srcGroupId);
+ case PHY_EXCHANGE_CODE_SRC_START_GROUP_ID:
+ code = tlvDecodeI32(pTlv, &pNode->srcStartGroupId);
+ break;
+ case PHY_EXCHANGE_CODE_SRC_END_GROUP_ID:
+ code = tlvDecodeI32(pTlv, &pNode->srcEndGroupId);
break;
case PHY_EXCHANGE_CODE_SINGLE_CHANNEL:
code = tlvDecodeBool(pTlv, &pNode->singleChannel);
@@ -3434,9 +3527,16 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
code = slotDescNodeToMsg(pObj, pEncoder);
break;
case QUERY_NODE_DOWNSTREAM_SOURCE:
- return downstreamSourceNodeToMsg(pObj, pEncoder);
+ code = downstreamSourceNodeToMsg(pObj, pEncoder);
+ break;
case QUERY_NODE_LEFT_VALUE:
break;
+ case QUERY_NODE_WHEN_THEN:
+ code = whenThenNodeToMsg(pObj, pEncoder);
+ break;
+ case QUERY_NODE_CASE_WHEN:
+ code = caseWhenNodeToMsg(pObj, pEncoder);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN:
code = physiScanNodeToMsg(pObj, pEncoder);
@@ -3563,9 +3663,15 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) {
code = msgToSlotDescNode(pDecoder, pObj);
break;
case QUERY_NODE_DOWNSTREAM_SOURCE:
- return msgToDownstreamSourceNode(pDecoder, pObj);
+ code = msgToDownstreamSourceNode(pDecoder, pObj);
case QUERY_NODE_LEFT_VALUE:
break;
+ case QUERY_NODE_WHEN_THEN:
+ code = msgToWhenThenNode(pDecoder, pObj);
+ break;
+ case QUERY_NODE_CASE_WHEN:
+ code = msgToCaseWhenNode(pDecoder, pObj);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN:
code = msgToPhysiScanNode(pDecoder, pObj);
diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c
index 728e173ff85e87d553d118f0baf0022a99c58f5d..8ea80344fcc463102ba73fe4b69f8a8958c27d35 100644
--- a/source/libs/nodes/src/nodesTraverseFuncs.c
+++ b/source/libs/nodes/src/nodesTraverseFuncs.c
@@ -146,6 +146,25 @@ static EDealRes dispatchExpr(SNode* pNode, ETraversalOrder order, FNodeWalker wa
case QUERY_NODE_TARGET:
res = walkExpr(((STargetNode*)pNode)->pExpr, order, walker, pContext);
break;
+ case QUERY_NODE_WHEN_THEN: {
+ SWhenThenNode* pWhenThen = (SWhenThenNode*)pNode;
+ res = walkExpr(pWhenThen->pWhen, order, walker, pContext);
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = walkExpr(pWhenThen->pThen, order, walker, pContext);
+ }
+ break;
+ }
+ case QUERY_NODE_CASE_WHEN: {
+ SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)pNode;
+ res = walkExpr(pCaseWhen->pCase, order, walker, pContext);
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = walkExpr(pCaseWhen->pElse, order, walker, pContext);
+ }
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = walkExprs(pCaseWhen->pWhenThenList, order, walker, pContext);
+ }
+ break;
+ }
default:
break;
}
@@ -291,6 +310,25 @@ static EDealRes rewriteExpr(SNode** pRawNode, ETraversalOrder order, FNodeRewrit
case QUERY_NODE_TARGET:
res = rewriteExpr(&(((STargetNode*)pNode)->pExpr), order, rewriter, pContext);
break;
+ case QUERY_NODE_WHEN_THEN: {
+ SWhenThenNode* pWhenThen = (SWhenThenNode*)pNode;
+ res = rewriteExpr(&pWhenThen->pWhen, order, rewriter, pContext);
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = rewriteExpr(&pWhenThen->pThen, order, rewriter, pContext);
+ }
+ break;
+ }
+ case QUERY_NODE_CASE_WHEN: {
+ SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)pNode;
+ res = rewriteExpr(&pCaseWhen->pCase, order, rewriter, pContext);
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = rewriteExpr(&pCaseWhen->pElse, order, rewriter, pContext);
+ }
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = rewriteExprs(pCaseWhen->pWhenThenList, order, rewriter, pContext);
+ }
+ break;
+ }
default:
break;
}
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index 805ddb9e422db5a42c6aed1594985d5a233c4ccd..7a04d319ec72ba9f1b0544b3fb7c60cd30bdb35f 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -21,9 +21,209 @@
#include "taoserror.h"
#include "tdatablock.h"
#include "thash.h"
+#include "tref.h"
+
+typedef struct SNodeMemChunk {
+ int32_t availableSize;
+ int32_t usedSize;
+ char* pBuf;
+ struct SNodeMemChunk* pNext;
+} SNodeMemChunk;
+
+typedef struct SNodeAllocator {
+ int64_t self;
+ int64_t queryId;
+ int32_t chunkSize;
+ int32_t chunkNum;
+ SNodeMemChunk* pCurrChunk;
+ SNodeMemChunk* pChunks;
+ TdThreadMutex mutex;
+} SNodeAllocator;
+
+static threadlocal SNodeAllocator* g_pNodeAllocator;
+static int32_t g_allocatorReqRefPool = -1;
+
+static SNodeMemChunk* callocNodeChunk(SNodeAllocator* pAllocator) {
+ SNodeMemChunk* pNewChunk = taosMemoryCalloc(1, sizeof(SNodeMemChunk) + pAllocator->chunkSize);
+ if (NULL == pNewChunk) {
+ return NULL;
+ }
+ pNewChunk->pBuf = (char*)(pNewChunk + 1);
+ pNewChunk->availableSize = pAllocator->chunkSize;
+ pNewChunk->usedSize = 0;
+ pNewChunk->pNext = NULL;
+ if (NULL != pAllocator->pCurrChunk) {
+ pAllocator->pCurrChunk->pNext = pNewChunk;
+ }
+ pAllocator->pCurrChunk = pNewChunk;
+ if (NULL == pAllocator->pChunks) {
+ pAllocator->pChunks = pNewChunk;
+ }
+ ++(pAllocator->chunkNum);
+ return pNewChunk;
+}
+
+static void* nodesCallocImpl(int32_t size) {
+ if (NULL == g_pNodeAllocator) {
+ return taosMemoryCalloc(1, size);
+ }
+
+ if (g_pNodeAllocator->pCurrChunk->usedSize + size > g_pNodeAllocator->pCurrChunk->availableSize) {
+ if (NULL == callocNodeChunk(g_pNodeAllocator)) {
+ return NULL;
+ }
+ }
+ void* p = g_pNodeAllocator->pCurrChunk->pBuf + g_pNodeAllocator->pCurrChunk->usedSize;
+ g_pNodeAllocator->pCurrChunk->usedSize += size;
+ return p;
+}
+
+static void* nodesCalloc(int32_t num, int32_t size) {
+ void* p = nodesCallocImpl(num * size + 1);
+ if (NULL == p) {
+ return NULL;
+ }
+ *(char*)p = (NULL != g_pNodeAllocator) ? 1 : 0;
+ return (char*)p + 1;
+}
+
+static void nodesFree(void* p) {
+ char* ptr = (char*)p - 1;
+ if (0 == *ptr) {
+ taosMemoryFree(ptr);
+ }
+ return;
+}
+
+static int32_t createNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator) {
+ *pAllocator = taosMemoryCalloc(1, sizeof(SNodeAllocator));
+ if (NULL == *pAllocator) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ (*pAllocator)->chunkSize = chunkSize;
+ if (NULL == callocNodeChunk(*pAllocator)) {
+ taosMemoryFreeClear(*pAllocator);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ taosThreadMutexInit(&(*pAllocator)->mutex, NULL);
+ return TSDB_CODE_SUCCESS;
+}
+
+static void destroyNodeAllocator(void* p) {
+ if (NULL == p) {
+ return;
+ }
+
+ SNodeAllocator* pAllocator = p;
+
+ nodesDebug("query id %" PRIx64 " allocator id %" PRIx64 " alloc chunkNum: %d, chunkTotakSize: %d",
+ pAllocator->queryId, pAllocator->self, pAllocator->chunkNum, pAllocator->chunkNum * pAllocator->chunkSize);
+
+ SNodeMemChunk* pChunk = pAllocator->pChunks;
+ while (NULL != pChunk) {
+ SNodeMemChunk* pTemp = pChunk->pNext;
+ taosMemoryFree(pChunk);
+ pChunk = pTemp;
+ }
+ taosThreadMutexDestroy(&pAllocator->mutex);
+ taosMemoryFree(pAllocator);
+}
+
+int32_t nodesInitAllocatorSet() {
+ if (g_allocatorReqRefPool >= 0) {
+ nodesWarn("nodes already initialized");
+ return TSDB_CODE_SUCCESS;
+ }
+
+ g_allocatorReqRefPool = taosOpenRef(1024, destroyNodeAllocator);
+ if (g_allocatorReqRefPool < 0) {
+ nodesError("init nodes failed");
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+void nodesDestroyAllocatorSet() {
+ if (g_allocatorReqRefPool >= 0) {
+ SNodeAllocator* pAllocator = taosIterateRef(g_allocatorReqRefPool, 0);
+ int64_t refId = 0;
+ while (NULL != pAllocator) {
+ refId = pAllocator->self;
+ taosRemoveRef(g_allocatorReqRefPool, refId);
+ pAllocator = taosIterateRef(g_allocatorReqRefPool, refId);
+ }
+ taosCloseRef(g_allocatorReqRefPool);
+ }
+}
+
+int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId) {
+ SNodeAllocator* pAllocator = NULL;
+ int32_t code = createNodeAllocator(chunkSize, &pAllocator);
+ if (TSDB_CODE_SUCCESS == code) {
+ pAllocator->self = taosAddRef(g_allocatorReqRefPool, pAllocator);
+ if (pAllocator->self <= 0) {
+ return terrno;
+ }
+ pAllocator->queryId = queryId;
+ *pAllocatorId = pAllocator->self;
+ }
+ return code;
+}
+
+int32_t nodesAcquireAllocator(int64_t allocatorId) {
+ if (allocatorId <= 0) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId);
+ if (NULL == pAllocator) {
+ return terrno;
+ }
+ taosThreadMutexLock(&pAllocator->mutex);
+ g_pNodeAllocator = pAllocator;
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t nodesReleaseAllocator(int64_t allocatorId) {
+ if (allocatorId <= 0) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (NULL == g_pNodeAllocator) {
+ nodesError("allocator id %" PRIx64
+ " release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator "
+ "function is called!",
+ allocatorId);
+ return TSDB_CODE_FAILED;
+ }
+ SNodeAllocator* pAllocator = g_pNodeAllocator;
+ g_pNodeAllocator = NULL;
+ taosThreadMutexUnlock(&pAllocator->mutex);
+ return taosReleaseRef(g_allocatorReqRefPool, allocatorId);
+}
+
+int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) {
+ if (allocatorId <= 0) {
+ return 0;
+ }
+
+ SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId);
+ return pAllocator->self;
+}
-static SNode* makeNode(ENodeType type, size_t size) {
- SNode* p = taosMemoryCalloc(1, size);
+int64_t nodesReleaseAllocatorWeakRef(int64_t allocatorId) { return taosReleaseRef(g_allocatorReqRefPool, allocatorId); }
+
+void nodesDestroyAllocator(int64_t allocatorId) {
+ if (allocatorId <= 0) {
+ return;
+ }
+
+ taosRemoveRef(g_allocatorReqRefPool, allocatorId);
+}
+
+static SNode* makeNode(ENodeType type, int32_t size) {
+ SNode* p = nodesCalloc(1, size);
if (NULL == p) {
return NULL;
}
@@ -91,6 +291,10 @@ SNode* nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SLeftValueNode));
case QUERY_NODE_COLUMN_REF:
return makeNode(type, sizeof(SColumnDefNode));
+ case QUERY_NODE_WHEN_THEN:
+ return makeNode(type, sizeof(SWhenThenNode));
+ case QUERY_NODE_CASE_WHEN:
+ return makeNode(type, sizeof(SCaseWhenNode));
case QUERY_NODE_SET_OPERATOR:
return makeNode(type, sizeof(SSetOperator));
case QUERY_NODE_SELECT_STMT:
@@ -538,7 +742,21 @@ void nodesDestroyNode(SNode* pNode) {
break;
}
case QUERY_NODE_LEFT_VALUE: // no pointer field
+ case QUERY_NODE_COLUMN_REF: // no pointer field
+ break;
+ case QUERY_NODE_WHEN_THEN: {
+ SWhenThenNode* pStmt = (SWhenThenNode*)pNode;
+ nodesDestroyNode(pStmt->pWhen);
+ nodesDestroyNode(pStmt->pThen);
break;
+ }
+ case QUERY_NODE_CASE_WHEN: {
+ SCaseWhenNode* pStmt = (SCaseWhenNode*)pNode;
+ nodesDestroyNode(pStmt->pCase);
+ nodesDestroyNode(pStmt->pElse);
+ nodesDestroyList(pStmt->pWhenThenList);
+ break;
+ }
case QUERY_NODE_SET_OPERATOR: {
SSetOperator* pStmt = (SSetOperator*)pNode;
nodesDestroyList(pStmt->pProjectionList);
@@ -824,6 +1042,7 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pLogicNode->pWStartTs);
nodesDestroyNode(pLogicNode->pValues);
nodesDestroyList(pLogicNode->pFillExprs);
+ nodesDestroyList(pLogicNode->pNotFillExprs);
break;
}
case QUERY_NODE_LOGIC_PLAN_SORT: {
@@ -1021,12 +1240,12 @@ void nodesDestroyNode(SNode* pNode) {
default:
break;
}
- taosMemoryFreeClear(pNode);
+ nodesFree(pNode);
return;
}
SNodeList* nodesMakeList() {
- SNodeList* p = taosMemoryCalloc(1, sizeof(SNodeList));
+ SNodeList* p = nodesCalloc(1, sizeof(SNodeList));
if (NULL == p) {
return NULL;
}
@@ -1037,7 +1256,7 @@ int32_t nodesListAppend(SNodeList* pList, SNode* pNode) {
if (NULL == pList || NULL == pNode) {
return TSDB_CODE_FAILED;
}
- SListCell* p = taosMemoryCalloc(1, sizeof(SListCell));
+ SListCell* p = nodesCalloc(1, sizeof(SListCell));
if (NULL == p) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return TSDB_CODE_OUT_OF_MEMORY;
@@ -1104,7 +1323,7 @@ int32_t nodesListAppendList(SNodeList* pTarget, SNodeList* pSrc) {
}
pTarget->pTail = pSrc->pTail;
pTarget->length += pSrc->length;
- taosMemoryFreeClear(pSrc);
+ nodesFree(pSrc);
return TSDB_CODE_SUCCESS;
}
@@ -1124,7 +1343,7 @@ int32_t nodesListPushFront(SNodeList* pList, SNode* pNode) {
if (NULL == pList || NULL == pNode) {
return TSDB_CODE_FAILED;
}
- SListCell* p = taosMemoryCalloc(1, sizeof(SListCell));
+ SListCell* p = nodesCalloc(1, sizeof(SListCell));
if (NULL == p) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return TSDB_CODE_OUT_OF_MEMORY;
@@ -1152,7 +1371,7 @@ SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) {
}
SListCell* pNext = pCell->pNext;
nodesDestroyNode(pCell->pNode);
- taosMemoryFreeClear(pCell);
+ nodesFree(pCell);
--(pList->length);
return pNext;
}
@@ -1172,7 +1391,7 @@ void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) {
pPos->pPrev = pSrc->pTail;
pTarget->length += pSrc->length;
- taosMemoryFreeClear(pSrc);
+ nodesFree(pSrc);
}
SNode* nodesListGetNode(SNodeList* pList, int32_t index) {
@@ -1204,7 +1423,7 @@ void nodesDestroyList(SNodeList* pList) {
while (NULL != pNext) {
pNext = nodesListErase(pList, pNext);
}
- taosMemoryFreeClear(pList);
+ nodesFree(pList);
}
void nodesClearList(SNodeList* pList) {
@@ -1216,9 +1435,9 @@ void nodesClearList(SNodeList* pList) {
while (NULL != pNext) {
SListCell* tmp = pNext;
pNext = pNext->pNext;
- taosMemoryFreeClear(tmp);
+ nodesFree(tmp);
}
- taosMemoryFreeClear(pList);
+ nodesFree(pList);
}
void* nodesGetValueFromNode(SValueNode* pNode) {
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index 898e4bf7328f873688f1ed6c8c31690de28f74c5..dea741cc9bdce9788f4f1d5583c56ab6e8637593 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -119,6 +119,8 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
+SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
+SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere);
SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index 6e43843cda4d00dfa78b57028660de831e0a3c82..3e05583d925e288b8d252ee9741b4009ee360e83 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -625,42 +625,44 @@ stream_name(A) ::= NK_ID(B).
cgroup_name(A) ::= NK_ID(B). { A = B; }
/************************************************ expression **********************************************************/
+expr_or_subquery(A) ::= expression(B). { A = B; }
+expr_or_subquery(A) ::= subquery(B). { A = B; }
+
expression(A) ::= literal(B). { A = B; }
expression(A) ::= pseudo_column(B). { A = B; }
expression(A) ::= column_reference(B). { A = B; }
expression(A) ::= function_expression(B). { A = B; }
-//expression(A) ::= case_expression(B). { A = B; }
-expression(A) ::= subquery(B). { A = B; }
+expression(A) ::= case_when_expression(B). { A = B; }
expression(A) ::= NK_LP(B) expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); }
-expression(A) ::= NK_PLUS(B) expression(C). {
+expression(A) ::= NK_PLUS(B) expr_or_subquery(C). {
SToken t = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &B, &t, releaseRawExprNode(pCxt, C));
}
-expression(A) ::= NK_MINUS(B) expression(C). {
+expression(A) ::= NK_MINUS(B) expr_or_subquery(C). {
SToken t = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, C), NULL));
}
-expression(A) ::= expression(B) NK_PLUS expression(C). {
+expression(A) ::= expr_or_subquery(B) NK_PLUS expr_or_subquery(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
-expression(A) ::= expression(B) NK_MINUS expression(C). {
+expression(A) ::= expr_or_subquery(B) NK_MINUS expr_or_subquery(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
-expression(A) ::= expression(B) NK_STAR expression(C). {
+expression(A) ::= expr_or_subquery(B) NK_STAR expr_or_subquery(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
-expression(A) ::= expression(B) NK_SLASH expression(C). {
+expression(A) ::= expr_or_subquery(B) NK_SLASH expr_or_subquery(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
-expression(A) ::= expression(B) NK_REM expression(C). {
+expression(A) ::= expr_or_subquery(B) NK_REM expr_or_subquery(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
@@ -669,12 +671,12 @@ expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C).
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, B), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C)));
}
-expression(A) ::= expression(B) NK_BITAND expression(C). {
+expression(A) ::= expr_or_subquery(B) NK_BITAND expr_or_subquery(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
-expression(A) ::= expression(B) NK_BITOR expression(C). {
+expression(A) ::= expr_or_subquery(B) NK_BITOR expr_or_subquery(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
@@ -682,8 +684,8 @@ expression(A) ::= expression(B) NK_BITOR expression(C).
%type expression_list { SNodeList* }
%destructor expression_list { nodesDestroyList($$); }
-expression_list(A) ::= expression(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
-expression_list(A) ::= expression_list(B) NK_COMMA expression(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
+expression_list(A) ::= expr_or_subquery(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
+expression_list(A) ::= expression_list(B) NK_COMMA expr_or_subquery(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); }
column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); }
@@ -700,7 +702,8 @@ pseudo_column(A) ::= WDURATION(B).
function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
-function_expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); }
+function_expression(A) ::=
+ CAST(B) NK_LP expr_or_subquery(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); }
function_expression(A) ::= literal_func(B). { A = B; }
literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
@@ -735,35 +738,52 @@ star_func_para_list(A) ::= other_para_list(B).
other_para_list(A) ::= star_func_para(B). { A = createNodeList(pCxt, B); }
other_para_list(A) ::= other_para_list(B) NK_COMMA star_func_para(C). { A = addNodeToList(pCxt, B, C); }
-star_func_para(A) ::= expression(B). { A = releaseRawExprNode(pCxt, B); }
+star_func_para(A) ::= expr_or_subquery(B). { A = releaseRawExprNode(pCxt, B); }
star_func_para(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); }
+case_when_expression(A) ::=
+ CASE(E) when_then_list(C) case_when_else_opt(D) END(F). { A = createRawExprNodeExt(pCxt, &E, &F, createCaseWhenNode(pCxt, NULL, C, D)); }
+case_when_expression(A) ::=
+ CASE(E) common_expression(B) when_then_list(C) case_when_else_opt(D) END(F). { A = createRawExprNodeExt(pCxt, &E, &F, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, B), C, D)); }
+
+%type when_then_list { SNodeList* }
+%destructor when_then_list { nodesDestroyList($$); }
+when_then_list(A) ::= when_then_expr(B). { A = createNodeList(pCxt, B); }
+when_then_list(A) ::= when_then_list(B) when_then_expr(C). { A = addNodeToList(pCxt, B, C); }
+
+when_then_expr(A) ::= WHEN common_expression(B) THEN common_expression(C). { A = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
+
+case_when_else_opt(A) ::= . { A = NULL; }
+case_when_else_opt(A) ::= ELSE common_expression(B). { A = releaseRawExprNode(pCxt, B); }
+
/************************************************ predicate ***********************************************************/
-predicate(A) ::= expression(B) compare_op(C) expression(D). {
+predicate(A) ::= expr_or_subquery(B) compare_op(C) expr_or_subquery(D). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D)));
}
//predicate(A) ::= expression(B) compare_op sub_type expression(B).
-predicate(A) ::= expression(B) BETWEEN expression(C) AND expression(D). {
+predicate(A) ::=
+ expr_or_subquery(B) BETWEEN expr_or_subquery(C) AND expr_or_subquery(D). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D)));
}
-predicate(A) ::= expression(B) NOT BETWEEN expression(C) AND expression(D). {
+predicate(A) ::=
+ expr_or_subquery(B) NOT BETWEEN expr_or_subquery(C) AND expr_or_subquery(D). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D)));
}
-predicate(A) ::= expression(B) IS NULL(C). {
+predicate(A) ::= expr_or_subquery(B) IS NULL(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, B), NULL));
}
-predicate(A) ::= expression(B) IS NOT NULL(C). {
+predicate(A) ::= expr_or_subquery(B) IS NOT NULL(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, B), NULL));
}
-predicate(A) ::= expression(B) in_op(C) in_predicate_value(D). {
+predicate(A) ::= expr_or_subquery(B) in_op(C) in_predicate_value(D). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D)));
@@ -813,7 +833,7 @@ boolean_primary(A) ::= predicate(B).
boolean_primary(A) ::= NK_LP(C) boolean_value_expression(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, releaseRawExprNode(pCxt, B)); }
/************************************************ common_expression ********************************************/
-common_expression(A) ::= expression(B). { A = B; }
+common_expression(A) ::= expr_or_subquery(B). { A = B; }
common_expression(A) ::= boolean_value_expression(B). { A = B; }
/************************************************ from_clause_opt *********************************************************/
@@ -894,7 +914,7 @@ partition_by_clause_opt(A) ::= PARTITION BY expression_list(B).
twindow_clause_opt(A) ::= . { A = NULL; }
twindow_clause_opt(A) ::=
SESSION NK_LP column_reference(B) NK_COMMA duration_literal(C) NK_RP. { A = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
-twindow_clause_opt(A) ::= STATE_WINDOW NK_LP expression(B) NK_RP. { A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B)); }
+twindow_clause_opt(A) ::= STATE_WINDOW NK_LP expr_or_subquery(B) NK_RP. { A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B)); }
twindow_clause_opt(A) ::=
INTERVAL NK_LP duration_literal(B) NK_RP sliding_opt(C) fill_opt(D). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), NULL, C, D); }
twindow_clause_opt(A) ::=
@@ -923,14 +943,15 @@ group_by_clause_opt(A) ::= GROUP BY group_by_list(B).
%type group_by_list { SNodeList* }
%destructor group_by_list { nodesDestroyList($$); }
-group_by_list(A) ::= expression(B). { A = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, B))); }
-group_by_list(A) ::= group_by_list(B) NK_COMMA expression(C). { A = addNodeToList(pCxt, B, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, C))); }
+group_by_list(A) ::= expr_or_subquery(B). { A = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, B))); }
+group_by_list(A) ::= group_by_list(B) NK_COMMA expr_or_subquery(C). { A = addNodeToList(pCxt, B, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, C))); }
having_clause_opt(A) ::= . { A = NULL; }
having_clause_opt(A) ::= HAVING search_condition(B). { A = B; }
range_opt(A) ::= . { A = NULL; }
-range_opt(A) ::= RANGE NK_LP expression(B) NK_COMMA expression(C) NK_RP. { A = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
+range_opt(A) ::=
+ RANGE NK_LP expr_or_subquery(B) NK_COMMA expr_or_subquery(C) NK_RP. { A = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
every_opt(A) ::= . { A = NULL; }
every_opt(A) ::= EVERY NK_LP duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
@@ -974,6 +995,7 @@ limit_clause_opt(A) ::= LIMIT NK_INTEGER(C) NK_COMMA NK_INTEGER(B).
/************************************************ subquery ************************************************************/
subquery(A) ::= NK_LP(B) query_expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, C); }
+subquery(A) ::= NK_LP(B) subquery(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); }
/************************************************ search_condition ****************************************************/
search_condition(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); }
@@ -986,7 +1008,7 @@ sort_specification_list(A) ::=
sort_specification_list(B) NK_COMMA sort_specification(C). { A = addNodeToList(pCxt, B, C); }
sort_specification(A) ::=
- expression(B) ordering_specification_opt(C) null_ordering_opt(D). { A = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, B), C, D); }
+ expr_or_subquery(B) ordering_specification_opt(C) null_ordering_opt(D). { A = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, B), C, D); }
%type ordering_specification_opt EOrder
%destructor ordering_specification_opt { }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 6f11c653a4a853744922c9ad17464aad71d77142..65afc84c9de7160cdd0aefddcfda9a184d6d3589 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -247,7 +247,8 @@ SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
pExpr->userAlias[len] = '\0';
}
}
- taosMemoryFreeClear(pNode);
+ pRawExpr->pNode = NULL;
+ nodesDestroyNode(pNode);
return pRealizedExpr;
}
@@ -646,6 +647,25 @@ SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd
return createBetweenAnd(pCxt, createPrimaryKeyCol(pCxt, NULL), pStart, pEnd);
}
+SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen) {
+ CHECK_PARSER_STATUS(pCxt);
+ SWhenThenNode* pWhenThen = (SWhenThenNode*)nodesMakeNode(QUERY_NODE_WHEN_THEN);
+ CHECK_OUT_OF_MEM(pWhenThen);
+ pWhenThen->pWhen = pWhen;
+ pWhenThen->pThen = pThen;
+ return (SNode*)pWhenThen;
+}
+
+SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse) {
+ CHECK_PARSER_STATUS(pCxt);
+ SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)nodesMakeNode(QUERY_NODE_CASE_WHEN);
+ CHECK_OUT_OF_MEM(pCaseWhen);
+ pCaseWhen->pCase = pCase;
+ pCaseWhen->pWhenThenList = pWhenThenList;
+ pCaseWhen->pElse = pElse;
+ return (SNode*)pCaseWhen;
+}
+
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias) {
CHECK_PARSER_STATUS(pCxt);
trimEscape(pAlias);
diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c
index ca9bb16c05fcbcd1edacf380f986e94eba1ca102..4fb55ed373bfdc849853184bd19916c388123ae2 100644
--- a/source/libs/parser/src/parInsert.c
+++ b/source/libs/parser/src/parInsert.c
@@ -1537,6 +1537,9 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
autoCreateTbl = true;
} else if (!existedUsing) {
CHECK_CODE(getTableMeta(pCxt, tbNum, &name, dbFName));
+ if (TSDB_SUPER_TABLE == pCxt->pTableMeta->tableType) {
+ return buildInvalidOperationMsg(&pCxt->msg, "insert data into super table is not supported");
+ }
}
STableDataBlocks* dataBuf = NULL;
@@ -2534,7 +2537,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
if (p) kv = *p;
}
- if (kv){
+ if (kv) {
int32_t colLen = kv->length;
if (pColSchema->type == TSDB_DATA_TYPE_TIMESTAMP) {
// uError("SML:data before:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision);
@@ -2547,7 +2550,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
} else {
MemRowAppend(&pBuf, &(kv->value), colLen, ¶m);
}
- }else{
+ } else {
pBuilder->hasNone = true;
}
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 68eb3e6fb1985dda6a8db9106fc2a6bcc8cd3583..c51553f7a1abc9dce31dbbc620218474e1502e47 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -54,6 +54,7 @@ static SKeyword keywordTable[] = {
{"CACHE", TK_CACHE},
{"CACHEMODEL", TK_CACHEMODEL},
{"CACHESIZE", TK_CACHESIZE},
+ {"CASE", TK_CASE},
{"CAST", TK_CAST},
{"CLIENT_VERSION", TK_CLIENT_VERSION},
{"CLUSTER", TK_CLUSTER},
@@ -82,7 +83,9 @@ static SKeyword keywordTable[] = {
{"DOUBLE", TK_DOUBLE},
{"DROP", TK_DROP},
{"DURATION", TK_DURATION},
+ {"ELSE", TK_ELSE},
{"ENABLE", TK_ENABLE},
+ {"END", TK_END},
{"EXISTS", TK_EXISTS},
{"EXPIRED", TK_EXPIRED},
{"EXPLAIN", TK_EXPLAIN},
@@ -205,6 +208,7 @@ static SKeyword keywordTable[] = {
{"TAG", TK_TAG},
{"TAGS", TK_TAGS},
{"TBNAME", TK_TBNAME},
+ {"THEN", TK_THEN},
{"TIMESTAMP", TK_TIMESTAMP},
{"TIMEZONE", TK_TIMEZONE},
{"TINYINT", TK_TINYINT},
@@ -240,6 +244,7 @@ static SKeyword keywordTable[] = {
{"WAL_ROLL_PERIOD", TK_WAL_ROLL_PERIOD},
{"WAL_SEGMENT_SIZE", TK_WAL_SEGMENT_SIZE},
{"WATERMARK", TK_WATERMARK},
+ {"WHEN", TK_WHEN},
{"WHERE", TK_WHERE},
{"WINDOW_CLOSE", TK_WINDOW_CLOSE},
{"WITH", TK_WITH},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index f0d5e5d67e90f0e2a820e9a5de328717eac57873..82167e89110c176dc85216fbaa71e011787880d9 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -264,6 +264,8 @@ static bool beforeHaving(ESqlClause clause) { return clause < SQL_CLAUSE_HAVING;
static bool afterHaving(ESqlClause clause) { return clause > SQL_CLAUSE_HAVING; }
+static bool beforeWindow(ESqlClause clause) { return clause < SQL_CLAUSE_WINDOW; }
+
static bool hasSameTableAlias(SArray* pTables) {
if (taosArrayGetSize(pTables) < 2) {
return false;
@@ -1476,6 +1478,10 @@ static int32_t translateWindowPseudoColumnFunc(STranslateContext* pCxt, SFunctio
if (!isSelectStmt(pCxt->pCurrStmt) || NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pWindow) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_WINDOW_PC);
}
+ if (beforeWindow(pCxt->currClause)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_WINDOW_PC, "There mustn't be %s",
+ pFunc->functionName);
+ }
return TSDB_CODE_SUCCESS;
}
@@ -1807,6 +1813,59 @@ static EDealRes translateLogicCond(STranslateContext* pCxt, SLogicConditionNode*
return DEAL_RES_CONTINUE;
}
+static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) {
+ SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
+ if (NULL == pFunc) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ strcpy(pFunc->functionName, "cast");
+ pFunc->node.resType = dt;
+ if (TSDB_CODE_SUCCESS != nodesListMakeAppend(&pFunc->pParameterList, pExpr)) {
+ nodesDestroyNode((SNode*)pFunc);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ if (TSDB_CODE_SUCCESS != getFuncInfo(pCxt, pFunc)) {
+ nodesClearList(pFunc->pParameterList);
+ pFunc->pParameterList = NULL;
+ nodesDestroyNode((SNode*)pFunc);
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pExpr)->aliasName);
+ }
+ *pCast = (SNode*)pFunc;
+ return TSDB_CODE_SUCCESS;
+}
+
+static EDealRes translateWhenThen(STranslateContext* pCxt, SWhenThenNode* pWhenThen) {
+ pWhenThen->node.resType = ((SExprNode*)pWhenThen->pThen)->resType;
+ return DEAL_RES_CONTINUE;
+}
+
+static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseWhen) {
+ bool first = true;
+ SNode* pNode = NULL;
+ FOREACH(pNode, pCaseWhen->pWhenThenList) {
+ if (first) {
+ pCaseWhen->node.resType = ((SExprNode*)pNode)->resType;
+ } else if (!dataTypeEqual(&pCaseWhen->node.resType, &((SExprNode*)pNode)->resType)) {
+ SWhenThenNode* pWhenThen = (SWhenThenNode*)pNode;
+ SNode* pCastFunc = NULL;
+ if (TSDB_CODE_SUCCESS != createCastFunc(pCxt, pWhenThen->pThen, pCaseWhen->node.resType, &pCastFunc)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "CASE WHEN data type mismatch");
+ }
+ pWhenThen->pThen = pCastFunc;
+ pWhenThen->node.resType = pCaseWhen->node.resType;
+ }
+ }
+ if (NULL != pCaseWhen->pElse && !dataTypeEqual(&pCaseWhen->node.resType, &((SExprNode*)pCaseWhen->pElse)->resType)) {
+ SNode* pCastFunc = NULL;
+ if (TSDB_CODE_SUCCESS != createCastFunc(pCxt, pCaseWhen->pElse, pCaseWhen->node.resType, &pCastFunc)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, "CASE WHEN data type mismatch");
+ }
+ pCaseWhen->pElse = pCastFunc;
+ ((SExprNode*)pCaseWhen->pElse)->resType = pCaseWhen->node.resType;
+ }
+ return DEAL_RES_CONTINUE;
+}
+
static EDealRes doTranslateExpr(SNode** pNode, void* pContext) {
STranslateContext* pCxt = (STranslateContext*)pContext;
switch (nodeType(*pNode)) {
@@ -1822,6 +1881,10 @@ static EDealRes doTranslateExpr(SNode** pNode, void* pContext) {
return translateLogicCond(pCxt, (SLogicConditionNode*)*pNode);
case QUERY_NODE_TEMP_TABLE:
return translateExprSubquery(pCxt, ((STempTableNode*)*pNode)->pSubquery);
+ case QUERY_NODE_WHEN_THEN:
+ return translateWhenThen(pCxt, (SWhenThenNode*)*pNode);
+ case QUERY_NODE_CASE_WHEN:
+ return translateCaseWhen(pCxt, (SCaseWhenNode*)*pNode);
default:
break;
}
@@ -2213,6 +2276,17 @@ static int32_t setTableCacheLastMode(STranslateContext* pCxt, SSelectStmt* pSele
return code;
}
+static int32_t checkJoinTable(STranslateContext* pCxt, SJoinTableNode* pJoinTable) {
+ if ((QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pLeft) &&
+ !isTimeLineQuery(((STempTableNode*)pJoinTable->pLeft)->pSubquery)) ||
+ (QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pRight) &&
+ !isTimeLineQuery(((STempTableNode*)pJoinTable->pRight)->pSubquery))) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SUPPORT_JOIN,
+ "Join requires valid time series input");
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
int32_t code = TSDB_CODE_SUCCESS;
switch (nodeType(pTable)) {
@@ -2259,6 +2333,9 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
if (TSDB_CODE_SUCCESS == code) {
code = translateTable(pCxt, pJoinTable->pRight);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = checkJoinTable(pCxt, pJoinTable);
+ }
if (TSDB_CODE_SUCCESS == code) {
pJoinTable->table.precision = calcJoinTablePrecision(pJoinTable);
pJoinTable->table.singleTable = joinTableIsSingleTable(pJoinTable);
@@ -3208,27 +3285,6 @@ static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) {
return (SNode*)pCol;
}
-static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) {
- SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
- if (NULL == pFunc) {
- return TSDB_CODE_OUT_OF_MEMORY;
- }
- strcpy(pFunc->functionName, "cast");
- pFunc->node.resType = dt;
- if (TSDB_CODE_SUCCESS != nodesListMakeAppend(&pFunc->pParameterList, pExpr)) {
- nodesDestroyNode((SNode*)pFunc);
- return TSDB_CODE_OUT_OF_MEMORY;
- }
- if (TSDB_CODE_SUCCESS != getFuncInfo(pCxt, pFunc)) {
- nodesClearList(pFunc->pParameterList);
- pFunc->pParameterList = NULL;
- nodesDestroyNode((SNode*)pFunc);
- return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pExpr)->aliasName);
- }
- *pCast = (SNode*)pFunc;
- return TSDB_CODE_SUCCESS;
-}
-
static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pSetOperator) {
SNodeList* pLeftProjections = getProjectList(pSetOperator->pLeft);
SNodeList* pRightProjections = getProjectList(pSetOperator->pRight);
diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c
index 7ee6a5b2236b24a676214c3538ed182aa52f427a..2fe6ebfb79447653731ff907e5128dfededdf111 100644
--- a/source/libs/parser/src/parser.c
+++ b/source/libs/parser/src/parser.c
@@ -177,15 +177,18 @@ int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery) {
int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq) {
SParseMetaCache metaCache = {0};
- int32_t code = TSDB_CODE_SUCCESS;
- if (qIsInsertValuesSql(pCxt->pSql, pCxt->sqlLen)) {
- code = parseInsertSyntax(pCxt, pQuery, &metaCache);
- } else {
- code = parseSqlSyntax(pCxt, pQuery, &metaCache);
+ int32_t code = nodesAcquireAllocator(pCxt->allocatorId);
+ if (TSDB_CODE_SUCCESS == code) {
+ if (qIsInsertValuesSql(pCxt->pSql, pCxt->sqlLen)) {
+ code = parseInsertSyntax(pCxt, pQuery, &metaCache);
+ } else {
+ code = parseSqlSyntax(pCxt, pQuery, &metaCache);
+ }
}
if (TSDB_CODE_SUCCESS == code) {
code = buildCatalogReq(pCxt, &metaCache, pCatalogReq);
}
+ nodesReleaseAllocator(pCxt->allocatorId);
destoryParseMetaCache(&metaCache, true);
terrno = code;
return code;
@@ -194,7 +197,10 @@ int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq
int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq,
const struct SMetaData* pMetaData, SQuery* pQuery) {
SParseMetaCache metaCache = {0};
- int32_t code = putMetaDataToCache(pCatalogReq, pMetaData, &metaCache, NULL == pQuery->pRoot);
+ int32_t code = nodesAcquireAllocator(pCxt->allocatorId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = putMetaDataToCache(pCatalogReq, pMetaData, &metaCache, NULL == pQuery->pRoot);
+ }
if (TSDB_CODE_SUCCESS == code) {
if (NULL == pQuery->pRoot) {
code = parseInsertSql(pCxt, &pQuery, &metaCache);
@@ -202,6 +208,7 @@ int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCata
code = analyseSemantic(pCxt, pQuery, &metaCache);
}
}
+ nodesReleaseAllocator(pCxt->allocatorId);
destoryParseMetaCache(&metaCache, false);
terrno = code;
return code;
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index c24eef00165a99797255babb8e3d92677b47feb7..f4ced2799a8f9e88fb7dffab2a97fed684062934 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 432
+#define YYNOCODE 441
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- EOrder yy2;
- int32_t yy100;
- SNodeList* yy280;
- bool yy281;
- SDataType yy304;
- EJoinType yy468;
- int64_t yy477;
- int8_t yy503;
- SAlterOption yy605;
- SToken yy641;
- ENullOrder yy649;
- EOperatorType yy668;
- EFillMode yy774;
- SNode* yy776;
+ EFillMode yy18;
+ EOperatorType yy128;
+ bool yy173;
+ SNodeList* yy334;
+ int8_t yy341;
+ int64_t yy459;
+ ENullOrder yy487;
+ SAlterOption yy515;
+ EJoinType yy540;
+ SNode* yy560;
+ SDataType yy574;
+ EOrder yy596;
+ SToken yy659;
+ int32_t yy676;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -139,17 +139,17 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 668
-#define YYNRULE 499
-#define YYNTOKEN 309
-#define YY_MAX_SHIFT 667
-#define YY_MIN_SHIFTREDUCE 980
-#define YY_MAX_SHIFTREDUCE 1478
-#define YY_ERROR_ACTION 1479
-#define YY_ACCEPT_ACTION 1480
-#define YY_NO_ACTION 1481
-#define YY_MIN_REDUCE 1482
-#define YY_MAX_REDUCE 1980
+#define YYNSTATE 679
+#define YYNRULE 509
+#define YYNTOKEN 313
+#define YY_MAX_SHIFT 678
+#define YY_MIN_SHIFTREDUCE 1000
+#define YY_MAX_SHIFTREDUCE 1508
+#define YY_ERROR_ACTION 1509
+#define YY_ACCEPT_ACTION 1510
+#define YY_NO_ACTION 1511
+#define YY_MIN_REDUCE 1512
+#define YY_MAX_REDUCE 2020
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,646 +216,720 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2196)
+#define YY_ACTTAB_COUNT (2662)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 428, 1730, 429, 1517, 1811, 436, 1799, 429, 1517, 510,
- /* 10 */ 28, 252, 37, 35, 1957, 1616, 318, 1795, 1013, 1727,
- /* 20 */ 332, 146, 1276, 1494, 1811, 38, 36, 34, 33, 32,
- /* 30 */ 549, 319, 1829, 1352, 337, 1274, 1952, 1672, 1674, 144,
- /* 40 */ 574, 1791, 1797, 321, 71, 1781, 377, 573, 1629, 551,
- /* 50 */ 162, 1957, 1829, 567, 1953, 552, 1347, 120, 1017, 1018,
- /* 60 */ 574, 12, 1673, 1674, 81, 1781, 1622, 573, 1282, 1544,
- /* 70 */ 1843, 1302, 1829, 1952, 91, 1812, 577, 1814, 575, 572,
- /* 80 */ 539, 567, 148, 295, 1889, 1620, 1586, 1956, 298, 1885,
- /* 90 */ 1843, 1953, 1955, 1, 93, 1812, 577, 1814, 1815, 572,
- /* 100 */ 1952, 567, 510, 40, 1889, 1419, 414, 1904, 1888, 1885,
- /* 110 */ 549, 1301, 1728, 551, 162, 664, 538, 104, 1953, 552,
- /* 120 */ 103, 102, 101, 100, 99, 98, 97, 96, 95, 1354,
- /* 130 */ 1355, 1901, 641, 640, 639, 638, 342, 1303, 637, 636,
- /* 140 */ 126, 631, 630, 629, 628, 627, 626, 625, 624, 137,
- /* 150 */ 620, 619, 618, 341, 340, 615, 614, 613, 612, 611,
- /* 160 */ 24, 173, 172, 156, 192, 1482, 31, 30, 475, 474,
- /* 170 */ 38, 36, 34, 33, 32, 1277, 1666, 1275, 150, 427,
- /* 180 */ 1173, 1174, 431, 462, 458, 454, 450, 191, 52, 113,
- /* 190 */ 112, 111, 110, 109, 108, 107, 106, 105, 1280, 1281,
- /* 200 */ 52, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, 569,
- /* 210 */ 565, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, 37,
- /* 220 */ 35, 1415, 41, 72, 635, 633, 189, 332, 523, 1276,
- /* 230 */ 31, 30, 163, 1505, 38, 36, 34, 33, 32, 46,
- /* 240 */ 1352, 445, 1274, 218, 1811, 1131, 599, 598, 597, 1135,
- /* 250 */ 596, 1137, 1138, 595, 1140, 592, 1627, 1146, 589, 1148,
- /* 260 */ 1149, 586, 583, 1347, 6, 20, 1679, 523, 12, 370,
- /* 270 */ 523, 369, 1829, 320, 1781, 1282, 37, 35, 165, 248,
- /* 280 */ 550, 114, 1677, 1302, 332, 1781, 1276, 573, 466, 188,
- /* 290 */ 182, 71, 187, 1331, 56, 1627, 441, 1352, 1627, 1274,
- /* 300 */ 1, 31, 30, 1256, 1257, 38, 36, 34, 33, 32,
- /* 310 */ 1843, 1605, 180, 1623, 92, 1812, 577, 1814, 1815, 572,
- /* 320 */ 1347, 567, 664, 1301, 1889, 12, 608, 163, 323, 1885,
- /* 330 */ 157, 88, 1282, 329, 328, 610, 1354, 1355, 1483, 163,
- /* 340 */ 1618, 206, 161, 1290, 122, 135, 134, 605, 604, 603,
- /* 350 */ 1915, 1795, 1619, 1304, 1352, 549, 1283, 1, 602, 104,
- /* 360 */ 1811, 163, 103, 102, 101, 100, 99, 98, 97, 96,
- /* 370 */ 95, 445, 144, 478, 477, 1791, 1797, 1347, 335, 664,
- /* 380 */ 121, 1630, 1277, 52, 1275, 1376, 144, 567, 1829, 1282,
- /* 390 */ 213, 473, 476, 1354, 1355, 1629, 574, 472, 73, 297,
- /* 400 */ 540, 1781, 513, 573, 1300, 1280, 1281, 1436, 1329, 1330,
- /* 410 */ 1332, 1333, 1334, 1335, 1336, 1337, 569, 565, 1345, 1346,
- /* 420 */ 1348, 1349, 1350, 1351, 1353, 1356, 1843, 52, 40, 75,
- /* 430 */ 92, 1812, 577, 1814, 1815, 572, 562, 567, 1523, 1277,
- /* 440 */ 1889, 1275, 1679, 1679, 323, 1885, 1971, 25, 1504, 304,
- /* 450 */ 532, 1434, 1435, 1437, 1438, 1923, 1408, 1381, 1677, 1678,
- /* 460 */ 1475, 1503, 1280, 1281, 169, 1329, 1330, 1332, 1333, 1334,
- /* 470 */ 1335, 1336, 1337, 569, 565, 1345, 1346, 1348, 1349, 1350,
- /* 480 */ 1351, 1353, 1356, 37, 35, 294, 659, 1299, 1957, 1781,
- /* 490 */ 371, 332, 1301, 1276, 407, 228, 1291, 419, 1286, 1412,
- /* 500 */ 68, 535, 1781, 67, 1352, 1502, 1274, 1362, 506, 435,
- /* 510 */ 1952, 1282, 431, 1301, 392, 1799, 420, 1811, 394, 1294,
- /* 520 */ 1296, 1480, 163, 551, 162, 378, 1795, 1347, 1953, 552,
- /* 530 */ 1952, 565, 1345, 1346, 1348, 1349, 1350, 1351, 379, 1282,
- /* 540 */ 1604, 1957, 1301, 1958, 162, 1829, 1781, 1474, 1953, 552,
- /* 550 */ 1791, 1797, 327, 571, 1030, 1030, 1029, 1029, 1781, 385,
- /* 560 */ 573, 1612, 567, 1952, 7, 52, 163, 163, 31, 30,
- /* 570 */ 464, 381, 38, 36, 34, 33, 32, 1956, 541, 536,
- /* 580 */ 347, 1953, 1954, 1843, 1031, 1031, 664, 285, 1812, 577,
- /* 590 */ 1814, 1815, 572, 570, 567, 564, 1861, 622, 506, 418,
- /* 600 */ 1354, 1355, 413, 412, 411, 410, 409, 406, 405, 404,
- /* 610 */ 403, 402, 398, 397, 396, 395, 389, 388, 387, 386,
- /* 620 */ 1952, 383, 382, 306, 31, 30, 1614, 546, 38, 36,
- /* 630 */ 34, 33, 32, 1958, 162, 546, 31, 30, 1953, 552,
- /* 640 */ 38, 36, 34, 33, 32, 608, 1277, 1904, 1275, 34,
- /* 650 */ 33, 32, 31, 30, 1446, 125, 38, 36, 34, 33,
- /* 660 */ 32, 9, 8, 125, 135, 134, 605, 604, 603, 1280,
- /* 670 */ 1281, 1900, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337,
- /* 680 */ 569, 565, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356,
- /* 690 */ 37, 35, 1357, 123, 1093, 1331, 433, 1768, 332, 1501,
- /* 700 */ 1276, 116, 1299, 163, 163, 133, 483, 548, 158, 1897,
- /* 710 */ 1898, 1352, 1902, 1274, 219, 220, 246, 1897, 545, 26,
- /* 720 */ 544, 493, 1426, 1952, 1331, 31, 30, 1095, 1411, 38,
- /* 730 */ 36, 34, 33, 32, 1347, 205, 551, 162, 1314, 1811,
- /* 740 */ 1781, 1953, 552, 1679, 354, 366, 1282, 37, 35, 486,
- /* 750 */ 336, 523, 1800, 480, 1388, 332, 45, 1276, 204, 1677,
- /* 760 */ 1603, 523, 114, 1795, 368, 364, 1956, 1829, 1352, 471,
- /* 770 */ 1274, 7, 375, 297, 523, 574, 513, 509, 143, 1627,
- /* 780 */ 1781, 1500, 573, 555, 338, 376, 345, 1791, 1797, 1627,
- /* 790 */ 546, 1347, 144, 664, 58, 506, 1602, 57, 1610, 567,
- /* 800 */ 1499, 1629, 1627, 1282, 506, 1843, 1498, 1354, 1355, 92,
- /* 810 */ 1812, 577, 1814, 1815, 572, 1957, 567, 1952, 125, 1889,
- /* 820 */ 610, 209, 1781, 323, 1885, 1971, 1952, 1904, 7, 1495,
- /* 830 */ 1958, 162, 1303, 1497, 1946, 1953, 552, 1720, 1720, 1958,
- /* 840 */ 162, 1781, 1017, 1018, 1953, 552, 492, 1781, 168, 171,
- /* 850 */ 664, 1899, 568, 1277, 606, 1275, 123, 1670, 601, 490,
- /* 860 */ 344, 488, 31, 30, 1354, 1355, 38, 36, 34, 33,
- /* 870 */ 32, 159, 1897, 1898, 1781, 1902, 1280, 1281, 506, 1329,
- /* 880 */ 1330, 1332, 1333, 1334, 1335, 1336, 1337, 569, 565, 1345,
- /* 890 */ 1346, 1348, 1349, 1350, 1351, 1353, 1356, 546, 31, 30,
- /* 900 */ 1952, 608, 38, 36, 34, 33, 32, 44, 505, 1726,
- /* 910 */ 1277, 292, 1275, 1958, 162, 299, 501, 1496, 1953, 552,
- /* 920 */ 135, 134, 605, 604, 603, 125, 309, 249, 607, 1811,
- /* 930 */ 1493, 1670, 1492, 1280, 1281, 1491, 1329, 1330, 1332, 1333,
- /* 940 */ 1334, 1335, 1336, 1337, 569, 565, 1345, 1346, 1348, 1349,
- /* 950 */ 1350, 1351, 1353, 1356, 37, 35, 1374, 1829, 1781, 1725,
- /* 960 */ 1285, 292, 332, 123, 1276, 574, 1490, 623, 494, 1599,
- /* 970 */ 1781, 1781, 573, 1781, 248, 1352, 1781, 1274, 160, 1897,
- /* 980 */ 1898, 264, 1902, 470, 1657, 310, 506, 308, 307, 1811,
- /* 990 */ 468, 556, 1489, 563, 470, 1843, 1488, 1284, 1347, 92,
- /* 1000 */ 1812, 577, 1814, 1815, 572, 469, 567, 1781, 1952, 1889,
- /* 1010 */ 1282, 1375, 554, 323, 1885, 1971, 469, 1829, 1909, 1408,
- /* 1020 */ 197, 1958, 162, 195, 1908, 574, 1953, 552, 1547, 145,
- /* 1030 */ 1781, 558, 573, 1781, 270, 1, 1534, 1781, 31, 30,
- /* 1040 */ 1276, 1587, 38, 36, 34, 33, 32, 463, 268, 60,
- /* 1050 */ 42, 3, 59, 1274, 1830, 1843, 523, 664, 479, 147,
- /* 1060 */ 1812, 577, 1814, 1815, 572, 1529, 567, 384, 176, 424,
- /* 1070 */ 422, 1354, 1355, 27, 330, 1369, 1370, 1371, 1372, 1373,
- /* 1080 */ 1377, 1378, 1379, 1380, 1627, 1527, 1282, 481, 1487, 1057,
- /* 1090 */ 523, 299, 478, 477, 1486, 1811, 240, 523, 523, 121,
- /* 1100 */ 199, 399, 1288, 198, 52, 553, 1972, 484, 400, 443,
- /* 1110 */ 473, 476, 201, 9, 8, 200, 472, 1277, 1627, 1275,
- /* 1120 */ 533, 1485, 1058, 1829, 1314, 1627, 1627, 343, 316, 1781,
- /* 1130 */ 1366, 574, 1374, 664, 212, 1781, 1781, 39, 573, 1287,
- /* 1140 */ 1280, 1281, 90, 1329, 1330, 1332, 1333, 1334, 1335, 1336,
- /* 1150 */ 1337, 569, 565, 1345, 1346, 1348, 1349, 1350, 1351, 1353,
- /* 1160 */ 1356, 1843, 1781, 1477, 1478, 286, 1812, 577, 1814, 1815,
- /* 1170 */ 572, 203, 567, 74, 202, 217, 129, 1802, 65, 64,
- /* 1180 */ 374, 523, 132, 167, 1667, 523, 523, 1375, 1227, 1919,
- /* 1190 */ 523, 133, 444, 1277, 1811, 1275, 1624, 495, 1518, 293,
- /* 1200 */ 523, 502, 362, 547, 360, 356, 352, 349, 346, 1627,
- /* 1210 */ 616, 507, 523, 1627, 1627, 245, 1280, 1281, 1627, 87,
- /* 1220 */ 523, 4, 1829, 223, 1804, 54, 221, 516, 1627, 84,
- /* 1230 */ 550, 519, 1077, 225, 523, 1781, 232, 573, 251, 2,
- /* 1240 */ 1627, 559, 1124, 163, 54, 521, 353, 1811, 1627, 27,
- /* 1250 */ 330, 1369, 1370, 1371, 1372, 1373, 1377, 1378, 1379, 1380,
- /* 1260 */ 1843, 1811, 1627, 348, 92, 1812, 577, 1814, 1815, 572,
- /* 1270 */ 523, 567, 39, 523, 1889, 1829, 1433, 39, 323, 1885,
- /* 1280 */ 157, 522, 305, 574, 253, 617, 1243, 235, 1781, 1829,
- /* 1290 */ 573, 581, 260, 132, 380, 1382, 170, 574, 1627, 133,
- /* 1300 */ 1916, 1627, 1781, 1299, 573, 401, 1722, 1075, 117, 132,
- /* 1310 */ 416, 1811, 408, 1843, 415, 417, 421, 277, 1812, 577,
- /* 1320 */ 1814, 575, 572, 1338, 567, 423, 425, 1843, 263, 1305,
- /* 1330 */ 426, 93, 1812, 577, 1814, 1815, 572, 1811, 567, 1829,
- /* 1340 */ 434, 1889, 1152, 1952, 1156, 561, 1885, 574, 1307, 437,
- /* 1350 */ 1163, 1811, 1781, 179, 573, 438, 551, 162, 439, 1161,
- /* 1360 */ 136, 1953, 552, 1306, 181, 1829, 1308, 440, 184, 442,
- /* 1370 */ 524, 186, 69, 574, 70, 446, 190, 1843, 1781, 1829,
- /* 1380 */ 573, 93, 1812, 577, 1814, 1815, 572, 574, 567, 465,
- /* 1390 */ 523, 1889, 1781, 467, 573, 296, 1886, 1617, 194, 1613,
- /* 1400 */ 196, 339, 138, 1843, 1811, 261, 139, 286, 1812, 577,
- /* 1410 */ 1814, 1815, 572, 1615, 567, 115, 1611, 1843, 1627, 140,
- /* 1420 */ 141, 281, 1812, 577, 1814, 1815, 572, 207, 567, 496,
- /* 1430 */ 1811, 210, 1829, 214, 497, 1761, 503, 508, 500, 315,
- /* 1440 */ 574, 531, 511, 1760, 1732, 1781, 514, 573, 517, 130,
- /* 1450 */ 131, 317, 78, 1304, 1811, 262, 80, 518, 1829, 542,
- /* 1460 */ 527, 534, 1628, 1930, 230, 1920, 571, 234, 529, 5,
- /* 1470 */ 1843, 1781, 543, 573, 147, 1812, 577, 1814, 1815, 572,
- /* 1480 */ 530, 567, 1829, 1929, 1911, 151, 528, 331, 322, 537,
- /* 1490 */ 574, 526, 525, 239, 1408, 1781, 1843, 573, 244, 243,
- /* 1500 */ 285, 1812, 577, 1814, 1815, 572, 124, 567, 1303, 1862,
- /* 1510 */ 241, 242, 1811, 324, 51, 1870, 560, 1905, 557, 82,
- /* 1520 */ 1843, 1973, 579, 667, 286, 1812, 577, 1814, 1815, 572,
- /* 1530 */ 250, 567, 1671, 1974, 1600, 1951, 265, 259, 660, 256,
- /* 1540 */ 1829, 661, 663, 43, 278, 333, 291, 288, 574, 287,
- /* 1550 */ 267, 154, 269, 1781, 1775, 573, 657, 653, 649, 645,
- /* 1560 */ 257, 1774, 62, 1773, 1811, 1772, 63, 1769, 350, 351,
- /* 1570 */ 1268, 1269, 166, 355, 1811, 1767, 357, 358, 1843, 359,
- /* 1580 */ 1766, 361, 286, 1812, 577, 1814, 1815, 572, 1765, 567,
- /* 1590 */ 363, 1764, 1829, 365, 1763, 367, 89, 1246, 1245, 226,
- /* 1600 */ 574, 1743, 1829, 1742, 373, 1781, 372, 573, 1741, 1740,
- /* 1610 */ 574, 1715, 1215, 1714, 1713, 1781, 127, 573, 1712, 1711,
- /* 1620 */ 1710, 66, 1709, 1708, 1707, 1706, 1811, 1705, 390, 1704,
- /* 1630 */ 1843, 391, 520, 393, 271, 1812, 577, 1814, 1815, 572,
- /* 1640 */ 1843, 567, 1703, 1702, 272, 1812, 577, 1814, 1815, 572,
- /* 1650 */ 1811, 567, 1701, 1700, 1829, 1699, 1698, 1697, 1696, 1695,
- /* 1660 */ 1694, 1693, 574, 1692, 1691, 215, 1690, 1781, 128, 573,
- /* 1670 */ 1689, 1688, 1687, 1686, 1811, 1685, 1684, 1683, 1829, 1682,
- /* 1680 */ 1681, 1680, 1549, 1250, 1217, 208, 574, 174, 1548, 175,
- /* 1690 */ 1811, 1781, 1843, 573, 1546, 1514, 273, 1812, 577, 1814,
- /* 1700 */ 1815, 572, 1829, 567, 1020, 1019, 118, 177, 1513, 178,
- /* 1710 */ 574, 155, 1756, 119, 1750, 1781, 1843, 573, 1829, 1739,
- /* 1720 */ 280, 1812, 577, 1814, 1815, 572, 574, 567, 183, 430,
- /* 1730 */ 1811, 1781, 432, 573, 185, 1738, 1724, 1606, 1545, 1543,
- /* 1740 */ 1843, 447, 449, 448, 282, 1812, 577, 1814, 1815, 572,
- /* 1750 */ 1541, 567, 451, 1539, 452, 1050, 1843, 453, 1829, 455,
- /* 1760 */ 274, 1812, 577, 1814, 1815, 572, 574, 567, 456, 457,
- /* 1770 */ 1537, 1781, 460, 573, 1526, 459, 1525, 1510, 1608, 1167,
- /* 1780 */ 461, 1166, 1607, 1811, 1092, 193, 53, 1091, 632, 634,
- /* 1790 */ 1088, 1087, 1535, 1086, 311, 1811, 1843, 1530, 1528, 485,
- /* 1800 */ 283, 1812, 577, 1814, 1815, 572, 482, 567, 312, 1811,
- /* 1810 */ 313, 1829, 1509, 1508, 487, 489, 1507, 491, 1755, 574,
- /* 1820 */ 94, 1749, 1252, 1829, 1781, 142, 573, 498, 1737, 1735,
- /* 1830 */ 1957, 574, 1736, 1734, 1733, 13, 1781, 1829, 573, 1260,
- /* 1840 */ 47, 216, 1731, 1723, 222, 574, 211, 76, 77, 1843,
- /* 1850 */ 1781, 79, 573, 275, 1812, 577, 1814, 1815, 572, 499,
- /* 1860 */ 567, 1843, 314, 504, 1811, 284, 1812, 577, 1814, 1815,
- /* 1870 */ 572, 515, 567, 224, 14, 1843, 84, 227, 39, 276,
- /* 1880 */ 1812, 577, 1814, 1815, 572, 512, 567, 21, 50, 237,
- /* 1890 */ 238, 23, 1829, 1448, 229, 1802, 231, 1430, 247, 49,
- /* 1900 */ 574, 233, 55, 1801, 1432, 1781, 152, 573, 149, 16,
- /* 1910 */ 236, 1463, 1811, 22, 1462, 325, 1425, 83, 1467, 1405,
- /* 1920 */ 1404, 1466, 326, 8, 1468, 1292, 1367, 17, 1811, 1846,
- /* 1930 */ 1843, 48, 1342, 566, 289, 1812, 577, 1814, 1815, 572,
- /* 1940 */ 1829, 567, 153, 164, 1340, 15, 11, 29, 574, 1339,
- /* 1950 */ 1322, 10, 1811, 1781, 18, 573, 1829, 19, 580, 1153,
- /* 1960 */ 576, 334, 582, 578, 574, 1150, 584, 585, 587, 1781,
- /* 1970 */ 588, 573, 1147, 590, 593, 1141, 1139, 1130, 1843, 1145,
- /* 1980 */ 1829, 591, 290, 1812, 577, 1814, 1815, 572, 574, 567,
- /* 1990 */ 1144, 594, 1143, 1781, 1843, 573, 600, 85, 1823, 1812,
- /* 2000 */ 577, 1814, 1815, 572, 1811, 567, 1142, 86, 1162, 61,
- /* 2010 */ 254, 1158, 1048, 609, 1811, 1083, 1082, 1081, 1843, 1080,
- /* 2020 */ 1079, 1078, 1822, 1812, 577, 1814, 1815, 572, 1811, 567,
- /* 2030 */ 1076, 1074, 1829, 1073, 1072, 621, 1099, 255, 1070, 1069,
- /* 2040 */ 574, 1068, 1829, 1067, 1066, 1781, 1065, 573, 1064, 1063,
- /* 2050 */ 574, 1096, 1094, 1060, 1054, 1781, 1829, 573, 1059, 1056,
- /* 2060 */ 1055, 1053, 1542, 642, 574, 1540, 644, 643, 646, 1781,
- /* 2070 */ 1843, 573, 1538, 648, 1821, 1812, 577, 1814, 1815, 572,
- /* 2080 */ 1843, 567, 647, 650, 302, 1812, 577, 1814, 1815, 572,
- /* 2090 */ 651, 567, 652, 1536, 1843, 654, 1811, 655, 301, 1812,
- /* 2100 */ 577, 1814, 1815, 572, 1524, 567, 656, 1506, 1811, 658,
- /* 2110 */ 1010, 258, 662, 1481, 1278, 666, 266, 665, 1811, 1481,
- /* 2120 */ 1481, 1481, 1481, 1481, 1829, 1481, 1481, 1481, 1481, 1481,
- /* 2130 */ 1481, 1481, 574, 1481, 1481, 1481, 1829, 1781, 1481, 573,
- /* 2140 */ 1481, 1481, 1481, 1481, 574, 1481, 1829, 1481, 1481, 1781,
- /* 2150 */ 1481, 573, 1481, 1481, 574, 1481, 1481, 1481, 1481, 1781,
- /* 2160 */ 1481, 573, 1843, 1481, 1481, 1481, 303, 1812, 577, 1814,
- /* 2170 */ 1815, 572, 1481, 567, 1843, 1481, 1481, 1481, 300, 1812,
- /* 2180 */ 577, 1814, 1815, 572, 1843, 567, 1481, 1481, 279, 1812,
- /* 2190 */ 577, 1814, 1815, 572, 1481, 567,
+ /* 0 */ 530, 556, 1760, 530, 435, 1829, 436, 1547, 32, 258,
+ /* 10 */ 1843, 117, 42, 40, 117, 1996, 1825, 1033, 473, 1646,
+ /* 20 */ 339, 478, 1296, 41, 39, 38, 37, 36, 1657, 1323,
+ /* 30 */ 1991, 1657, 1323, 1374, 1577, 1294, 571, 571, 1861, 1648,
+ /* 40 */ 1821, 1827, 327, 555, 166, 1510, 572, 325, 1992, 557,
+ /* 50 */ 1825, 1811, 1642, 584, 578, 150, 1369, 1037, 1038, 571,
+ /* 60 */ 443, 16, 436, 1547, 1659, 1861, 60, 1843, 1302, 42,
+ /* 70 */ 40, 1444, 440, 550, 1821, 1827, 1875, 339, 1319, 1296,
+ /* 80 */ 95, 1841, 1842, 1844, 588, 1846, 1847, 583, 578, 578,
+ /* 90 */ 1374, 530, 1294, 1, 163, 1861, 1928, 384, 485, 484,
+ /* 100 */ 332, 1924, 50, 572, 354, 124, 1498, 56, 1811, 44,
+ /* 110 */ 584, 549, 152, 1369, 1524, 675, 480, 483, 16, 1657,
+ /* 120 */ 513, 1955, 479, 344, 1829, 1302, 1702, 1704, 452, 1376,
+ /* 130 */ 1377, 212, 44, 1875, 301, 1825, 1996, 95, 1841, 1842,
+ /* 140 */ 1844, 588, 1846, 1847, 583, 1830, 578, 1703, 1704, 1991,
+ /* 150 */ 1, 163, 45, 1928, 1843, 56, 1825, 332, 1924, 1821,
+ /* 160 */ 1827, 333, 1997, 166, 532, 1991, 1900, 1992, 557, 1709,
+ /* 170 */ 168, 257, 675, 578, 257, 1297, 326, 1295, 1954, 1995,
+ /* 180 */ 1821, 1827, 1861, 1992, 1994, 1707, 1376, 1377, 77, 303,
+ /* 190 */ 585, 1322, 520, 568, 578, 1811, 154, 584, 1300, 1301,
+ /* 200 */ 1616, 1351, 1352, 1354, 1355, 1356, 1357, 1358, 1359, 580,
+ /* 210 */ 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, 1378, 3,
+ /* 220 */ 1875, 130, 162, 621, 95, 1841, 1842, 1844, 588, 1846,
+ /* 230 */ 1847, 583, 1297, 578, 1295, 1696, 127, 169, 137, 1899,
+ /* 240 */ 1928, 1465, 35, 34, 332, 1924, 41, 39, 38, 37,
+ /* 250 */ 36, 169, 1050, 169, 1049, 1300, 1301, 128, 1351, 1352,
+ /* 260 */ 1354, 1355, 1356, 1357, 1358, 1359, 580, 576, 1367, 1368,
+ /* 270 */ 1370, 1371, 1372, 1373, 1375, 1378, 3, 42, 40, 165,
+ /* 280 */ 1936, 1937, 1051, 1941, 11, 339, 1321, 1296, 1322, 543,
+ /* 290 */ 1463, 1464, 1466, 1467, 434, 1843, 169, 438, 1374, 169,
+ /* 300 */ 1294, 56, 1151, 610, 609, 608, 1155, 607, 1157, 1158,
+ /* 310 */ 606, 1160, 603, 568, 1166, 600, 1168, 1169, 597, 594,
+ /* 320 */ 421, 1369, 11, 1861, 9, 219, 16, 1635, 1475, 225,
+ /* 330 */ 226, 585, 530, 1302, 42, 40, 1811, 613, 584, 546,
+ /* 340 */ 1709, 130, 339, 171, 1296, 35, 34, 343, 1535, 41,
+ /* 350 */ 39, 38, 37, 36, 1324, 1374, 1707, 1294, 1, 56,
+ /* 360 */ 1657, 1875, 56, 1113, 79, 95, 1841, 1842, 1844, 588,
+ /* 370 */ 1846, 1847, 583, 373, 578, 179, 178, 119, 1369, 1903,
+ /* 380 */ 675, 1928, 377, 16, 376, 332, 1924, 452, 303, 1811,
+ /* 390 */ 1302, 520, 375, 371, 1376, 1377, 1115, 1193, 1194, 255,
+ /* 400 */ 1936, 567, 1513, 566, 35, 34, 1991, 530, 41, 39,
+ /* 410 */ 38, 37, 36, 442, 617, 1, 438, 1700, 382, 555,
+ /* 420 */ 166, 552, 547, 107, 1992, 557, 106, 105, 104, 103,
+ /* 430 */ 102, 101, 100, 99, 98, 1657, 517, 675, 1633, 24,
+ /* 440 */ 1297, 1448, 1295, 324, 85, 169, 1757, 1321, 1534, 1302,
+ /* 450 */ 107, 1376, 1377, 106, 105, 104, 103, 102, 101, 100,
+ /* 460 */ 99, 98, 1321, 1300, 1301, 1650, 1351, 1352, 1354, 1355,
+ /* 470 */ 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, 1370, 1371,
+ /* 480 */ 1372, 1373, 1375, 1378, 3, 1512, 11, 35, 34, 1811,
+ /* 490 */ 530, 41, 39, 38, 37, 36, 234, 1297, 621, 1295,
+ /* 500 */ 1995, 383, 126, 169, 1505, 1899, 169, 315, 633, 116,
+ /* 510 */ 115, 114, 113, 112, 111, 110, 109, 108, 1657, 1943,
+ /* 520 */ 1300, 1301, 551, 1351, 1352, 1354, 1355, 1356, 1357, 1358,
+ /* 530 */ 1359, 580, 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375,
+ /* 540 */ 1378, 3, 42, 40, 1709, 224, 1296, 342, 1940, 1644,
+ /* 550 */ 339, 310, 1296, 482, 481, 150, 563, 75, 75, 1294,
+ /* 560 */ 1707, 568, 198, 1374, 1659, 1294, 316, 530, 314, 313,
+ /* 570 */ 123, 475, 1050, 1455, 1049, 477, 156, 1533, 391, 1652,
+ /* 580 */ 1653, 469, 465, 461, 457, 197, 1369, 471, 556, 130,
+ /* 590 */ 92, 1843, 1302, 619, 1320, 1657, 1504, 476, 1302, 42,
+ /* 600 */ 40, 1379, 1051, 125, 1943, 1276, 1277, 339, 1640, 1296,
+ /* 610 */ 568, 1649, 141, 140, 616, 615, 614, 1991, 1811, 1861,
+ /* 620 */ 1374, 76, 1294, 8, 195, 128, 530, 585, 215, 1353,
+ /* 630 */ 555, 166, 1811, 1939, 584, 1992, 557, 406, 130, 675,
+ /* 640 */ 175, 530, 1532, 1369, 1384, 675, 570, 164, 1936, 1937,
+ /* 650 */ 1321, 1941, 407, 579, 1657, 1302, 1709, 1875, 499, 1376,
+ /* 660 */ 1377, 95, 1841, 1842, 1844, 588, 1846, 1847, 583, 1657,
+ /* 670 */ 578, 497, 1708, 495, 128, 2011, 72, 1928, 530, 71,
+ /* 680 */ 8, 332, 1924, 1811, 1843, 485, 484, 194, 188, 450,
+ /* 690 */ 193, 1962, 124, 534, 448, 1900, 167, 1936, 1937, 1297,
+ /* 700 */ 1941, 1295, 675, 480, 483, 1297, 1657, 1295, 1750, 479,
+ /* 710 */ 186, 1531, 1861, 38, 37, 36, 1376, 1377, 1634, 174,
+ /* 720 */ 585, 150, 1300, 1301, 1530, 1811, 508, 584, 1300, 1301,
+ /* 730 */ 1660, 1351, 1352, 1354, 1355, 1356, 1357, 1358, 1359, 580,
+ /* 740 */ 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, 1378, 3,
+ /* 750 */ 1875, 559, 1811, 1943, 95, 1841, 1842, 1844, 588, 1846,
+ /* 760 */ 1847, 583, 1297, 578, 1295, 1811, 28, 169, 1901, 1529,
+ /* 770 */ 1928, 564, 35, 34, 332, 1924, 41, 39, 38, 37,
+ /* 780 */ 36, 1528, 1938, 1843, 1527, 1300, 1301, 7, 1351, 1352,
+ /* 790 */ 1354, 1355, 1356, 1357, 1358, 1359, 580, 576, 1367, 1368,
+ /* 800 */ 1370, 1371, 1372, 1373, 1375, 1378, 3, 42, 40, 1526,
+ /* 810 */ 1811, 1861, 345, 646, 644, 339, 322, 1296, 618, 585,
+ /* 820 */ 150, 1700, 1811, 619, 1811, 1811, 584, 30, 1374, 1659,
+ /* 830 */ 1294, 378, 1353, 35, 34, 1037, 1038, 41, 39, 38,
+ /* 840 */ 37, 36, 141, 140, 616, 615, 614, 513, 1321, 1875,
+ /* 850 */ 1811, 1369, 1523, 292, 1841, 1842, 1844, 588, 1846, 1847,
+ /* 860 */ 583, 218, 578, 1302, 42, 40, 1750, 612, 1756, 517,
+ /* 870 */ 298, 530, 339, 1755, 1296, 298, 1991, 177, 678, 1758,
+ /* 880 */ 1522, 634, 451, 1629, 1525, 1374, 1405, 1294, 8, 1997,
+ /* 890 */ 166, 252, 265, 1811, 1992, 557, 1617, 35, 34, 1657,
+ /* 900 */ 78, 41, 39, 38, 37, 36, 160, 530, 1369, 477,
+ /* 910 */ 675, 668, 664, 660, 656, 263, 516, 1521, 1654, 1077,
+ /* 920 */ 1302, 1811, 35, 34, 1376, 1377, 41, 39, 38, 37,
+ /* 930 */ 36, 476, 513, 35, 34, 1657, 91, 41, 39, 38,
+ /* 940 */ 37, 36, 13, 12, 270, 1, 88, 1687, 530, 530,
+ /* 950 */ 306, 93, 1078, 29, 232, 530, 1305, 530, 1811, 502,
+ /* 960 */ 509, 1991, 530, 1410, 46, 4, 514, 675, 229, 1441,
+ /* 970 */ 1297, 139, 1295, 526, 1997, 166, 1657, 1657, 1520, 1992,
+ /* 980 */ 557, 1376, 1377, 1657, 1437, 1657, 544, 527, 1948, 1437,
+ /* 990 */ 1657, 1403, 1519, 1300, 1301, 1564, 1351, 1352, 1354, 1355,
+ /* 1000 */ 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, 1370, 1371,
+ /* 1010 */ 1372, 1373, 1375, 1378, 3, 530, 300, 486, 1319, 1811,
+ /* 1020 */ 221, 385, 49, 48, 512, 414, 528, 1297, 426, 1295,
+ /* 1030 */ 1353, 1518, 1798, 1811, 386, 1417, 352, 1517, 1270, 1516,
+ /* 1040 */ 214, 203, 1515, 1657, 201, 399, 1404, 427, 1862, 401,
+ /* 1050 */ 1300, 1301, 513, 1351, 1352, 1354, 1355, 1356, 1357, 1358,
+ /* 1060 */ 1359, 580, 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375,
+ /* 1070 */ 1378, 3, 1811, 530, 205, 1559, 149, 204, 1811, 361,
+ /* 1080 */ 1811, 1991, 530, 1811, 529, 207, 151, 560, 206, 1557,
+ /* 1090 */ 392, 276, 1632, 259, 1997, 166, 575, 488, 1308, 1992,
+ /* 1100 */ 557, 1657, 388, 1574, 209, 274, 64, 208, 43, 63,
+ /* 1110 */ 1657, 491, 223, 31, 336, 1398, 1399, 1400, 1401, 1402,
+ /* 1120 */ 1406, 1407, 1408, 1409, 470, 182, 431, 429, 13, 12,
+ /* 1130 */ 425, 1507, 1508, 420, 419, 418, 417, 416, 413, 412,
+ /* 1140 */ 411, 410, 409, 405, 404, 403, 402, 396, 395, 394,
+ /* 1150 */ 393, 246, 390, 389, 312, 134, 1996, 350, 138, 1247,
+ /* 1160 */ 139, 56, 1548, 227, 58, 1996, 652, 651, 650, 649,
+ /* 1170 */ 349, 238, 648, 647, 131, 642, 641, 640, 639, 638,
+ /* 1180 */ 637, 636, 635, 143, 631, 630, 629, 348, 347, 626,
+ /* 1190 */ 625, 624, 623, 622, 1991, 1304, 530, 619, 58, 94,
+ /* 1200 */ 1697, 1958, 1843, 1440, 43, 1832, 523, 346, 1995, 231,
+ /* 1210 */ 627, 1144, 1992, 1993, 254, 1462, 141, 140, 616, 615,
+ /* 1220 */ 614, 1553, 241, 569, 1657, 251, 628, 2, 5, 43,
+ /* 1230 */ 1861, 592, 1097, 1395, 355, 69, 68, 381, 585, 138,
+ /* 1240 */ 173, 360, 490, 1811, 311, 584, 139, 1498, 1095, 1411,
+ /* 1250 */ 120, 351, 1834, 138, 1263, 1360, 299, 500, 176, 369,
+ /* 1260 */ 387, 367, 363, 359, 356, 353, 266, 513, 1875, 670,
+ /* 1270 */ 1319, 211, 96, 586, 338, 1844, 588, 1846, 1847, 583,
+ /* 1280 */ 269, 578, 1172, 501, 1843, 493, 408, 1752, 1928, 487,
+ /* 1290 */ 1176, 415, 305, 1924, 210, 423, 1991, 1183, 422, 513,
+ /* 1300 */ 561, 1181, 424, 1991, 142, 169, 428, 430, 432, 1997,
+ /* 1310 */ 166, 1325, 1861, 1327, 1992, 557, 555, 166, 433, 441,
+ /* 1320 */ 585, 1992, 557, 444, 185, 1811, 445, 584, 1991, 1326,
+ /* 1330 */ 62, 187, 446, 61, 1328, 449, 190, 1307, 192, 447,
+ /* 1340 */ 73, 1997, 166, 74, 1843, 453, 1992, 557, 196, 472,
+ /* 1350 */ 1875, 1791, 267, 474, 95, 1841, 1842, 1844, 588, 1846,
+ /* 1360 */ 1847, 583, 1647, 578, 118, 302, 1843, 200, 2011, 1643,
+ /* 1370 */ 1928, 202, 1861, 144, 332, 1924, 507, 145, 1645, 213,
+ /* 1380 */ 585, 1641, 146, 147, 1985, 1811, 503, 584, 504, 216,
+ /* 1390 */ 510, 515, 542, 321, 1861, 524, 220, 135, 518, 1790,
+ /* 1400 */ 1762, 525, 585, 521, 82, 323, 84, 1811, 1658, 584,
+ /* 1410 */ 1875, 268, 136, 1324, 95, 1841, 1842, 1844, 588, 1846,
+ /* 1420 */ 1847, 583, 1843, 578, 545, 236, 240, 1969, 2011, 538,
+ /* 1430 */ 1928, 540, 1875, 541, 332, 1924, 285, 586, 338, 1844,
+ /* 1440 */ 588, 1846, 1847, 583, 1947, 578, 1959, 335, 334, 1968,
+ /* 1450 */ 1861, 328, 548, 6, 554, 536, 537, 1310, 585, 250,
+ /* 1460 */ 329, 539, 565, 1811, 2014, 584, 562, 1991, 1374, 1437,
+ /* 1470 */ 1303, 129, 1323, 55, 247, 1950, 245, 157, 248, 86,
+ /* 1480 */ 555, 166, 249, 1843, 1944, 1992, 557, 1909, 1875, 1990,
+ /* 1490 */ 590, 1369, 95, 1841, 1842, 1844, 588, 1846, 1847, 583,
+ /* 1500 */ 1701, 578, 1630, 1302, 271, 1843, 533, 262, 1928, 671,
+ /* 1510 */ 253, 1861, 332, 1924, 672, 47, 674, 297, 273, 585,
+ /* 1520 */ 283, 294, 293, 275, 1811, 1805, 584, 66, 1803, 1802,
+ /* 1530 */ 67, 1799, 357, 1861, 1804, 358, 1288, 1289, 172, 362,
+ /* 1540 */ 1797, 585, 364, 365, 366, 1796, 1811, 368, 584, 1875,
+ /* 1550 */ 574, 1795, 370, 96, 1841, 1842, 1844, 588, 1846, 1847,
+ /* 1560 */ 583, 1794, 578, 372, 1793, 374, 1266, 1265, 1773, 1928,
+ /* 1570 */ 1772, 1875, 379, 1927, 1924, 96, 1841, 1842, 1844, 588,
+ /* 1580 */ 1846, 1847, 583, 380, 578, 1771, 1770, 1745, 1235, 1843,
+ /* 1590 */ 1744, 1928, 1743, 1742, 132, 573, 1924, 1741, 1740, 70,
+ /* 1600 */ 1739, 1738, 1737, 1736, 1735, 397, 398, 1734, 400, 1733,
+ /* 1610 */ 1311, 1732, 1306, 1731, 1730, 1729, 1728, 1861, 1727, 1726,
+ /* 1620 */ 1725, 1724, 1723, 1722, 1721, 582, 1720, 1719, 1718, 1717,
+ /* 1630 */ 1811, 133, 584, 1314, 1316, 1716, 1715, 1714, 1713, 1237,
+ /* 1640 */ 1712, 1711, 1710, 1579, 1843, 576, 1367, 1368, 1370, 1371,
+ /* 1650 */ 1372, 1373, 1578, 1576, 1544, 1875, 437, 1543, 1040, 291,
+ /* 1660 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 581, 578, 531,
+ /* 1670 */ 1893, 121, 1861, 183, 184, 1039, 161, 1786, 122, 1780,
+ /* 1680 */ 585, 180, 1769, 1768, 191, 1811, 181, 584, 189, 1754,
+ /* 1690 */ 1636, 439, 1575, 1573, 454, 455, 1571, 1843, 458, 1569,
+ /* 1700 */ 462, 456, 459, 460, 1567, 463, 464, 466, 468, 1070,
+ /* 1710 */ 1875, 1556, 1555, 467, 153, 1841, 1842, 1844, 588, 1846,
+ /* 1720 */ 1847, 583, 1540, 578, 1638, 1861, 1187, 1186, 1637, 1112,
+ /* 1730 */ 1111, 643, 1108, 585, 1565, 1107, 1106, 1560, 1811, 317,
+ /* 1740 */ 584, 645, 318, 1558, 492, 319, 1539, 1538, 494, 1843,
+ /* 1750 */ 489, 199, 57, 496, 1537, 498, 97, 1785, 1779, 148,
+ /* 1760 */ 1272, 1843, 505, 1875, 217, 558, 2012, 96, 1841, 1842,
+ /* 1770 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1861, 1767, 1765,
+ /* 1780 */ 1996, 1766, 1764, 1928, 1763, 582, 1280, 1761, 1925, 1861,
+ /* 1790 */ 1811, 1753, 584, 519, 535, 81, 17, 585, 233, 1386,
+ /* 1800 */ 10, 222, 1811, 1861, 584, 18, 43, 19, 1385, 228,
+ /* 1810 */ 244, 585, 80, 88, 230, 1875, 1811, 54, 584, 291,
+ /* 1820 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1875, 578, 1843,
+ /* 1830 */ 1894, 292, 1841, 1842, 1844, 588, 1846, 1847, 583, 511,
+ /* 1840 */ 578, 1875, 51, 1843, 522, 287, 1841, 1842, 1844, 588,
+ /* 1850 */ 1846, 1847, 583, 83, 578, 1477, 243, 1861, 25, 235,
+ /* 1860 */ 1832, 27, 237, 1459, 506, 585, 239, 59, 320, 1461,
+ /* 1870 */ 1811, 1861, 584, 155, 21, 1492, 337, 1454, 242, 585,
+ /* 1880 */ 1497, 26, 87, 1491, 1811, 330, 584, 1496, 553, 1498,
+ /* 1890 */ 1495, 331, 1434, 1843, 1433, 1875, 53, 256, 12, 153,
+ /* 1900 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1831, 578, 1875,
+ /* 1910 */ 1312, 20, 1843, 292, 1841, 1842, 1844, 588, 1846, 1847,
+ /* 1920 */ 583, 1861, 578, 158, 1396, 1878, 340, 15, 1364, 585,
+ /* 1930 */ 577, 159, 1362, 1361, 1811, 33, 584, 14, 22, 170,
+ /* 1940 */ 1861, 1336, 1344, 52, 587, 589, 591, 23, 585, 341,
+ /* 1950 */ 593, 2013, 1173, 1811, 1170, 584, 595, 1167, 596, 1875,
+ /* 1960 */ 598, 599, 1843, 292, 1841, 1842, 1844, 588, 1846, 1847,
+ /* 1970 */ 583, 601, 578, 1161, 602, 604, 1843, 1159, 1875, 605,
+ /* 1980 */ 1150, 1182, 277, 1841, 1842, 1844, 588, 1846, 1847, 583,
+ /* 1990 */ 1861, 578, 1165, 1164, 611, 1163, 89, 1162, 585, 90,
+ /* 2000 */ 65, 1178, 260, 1811, 1861, 584, 1068, 1103, 620, 1102,
+ /* 2010 */ 1101, 1100, 585, 1099, 632, 1098, 1096, 1811, 1094, 584,
+ /* 2020 */ 1093, 1092, 1119, 1090, 1089, 261, 1088, 1087, 1875, 1086,
+ /* 2030 */ 1085, 1843, 278, 1841, 1842, 1844, 588, 1846, 1847, 583,
+ /* 2040 */ 1084, 578, 1875, 1083, 1114, 1116, 279, 1841, 1842, 1844,
+ /* 2050 */ 588, 1846, 1847, 583, 1080, 578, 1079, 1843, 1076, 1861,
+ /* 2060 */ 1075, 1074, 1073, 1572, 653, 655, 1570, 585, 657, 654,
+ /* 2070 */ 659, 658, 1811, 1568, 584, 661, 663, 662, 1566, 665,
+ /* 2080 */ 667, 666, 1554, 1843, 669, 1861, 1030, 1536, 677, 264,
+ /* 2090 */ 673, 1511, 1298, 585, 272, 676, 1511, 1875, 1811, 1511,
+ /* 2100 */ 584, 286, 1841, 1842, 1844, 588, 1846, 1847, 583, 1843,
+ /* 2110 */ 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585,
+ /* 2120 */ 1511, 1511, 1511, 1875, 1811, 1511, 584, 288, 1841, 1842,
+ /* 2130 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1861, 1511, 1511,
+ /* 2140 */ 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, 1875,
+ /* 2150 */ 1811, 1511, 584, 280, 1841, 1842, 1844, 588, 1846, 1847,
+ /* 2160 */ 583, 1511, 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2170 */ 1511, 585, 1511, 1511, 1511, 1875, 1811, 1511, 584, 289,
+ /* 2180 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1843, 578, 1511,
+ /* 2190 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2200 */ 1511, 1875, 1511, 1843, 1511, 281, 1841, 1842, 1844, 588,
+ /* 2210 */ 1846, 1847, 583, 1511, 578, 1861, 1511, 1511, 1511, 1511,
+ /* 2220 */ 1511, 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, 1511,
+ /* 2230 */ 584, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585,
+ /* 2240 */ 1511, 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511,
+ /* 2250 */ 1511, 1511, 1511, 1875, 1511, 1511, 1511, 290, 1841, 1842,
+ /* 2260 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1511, 1511, 1875,
+ /* 2270 */ 1511, 1511, 1511, 282, 1841, 1842, 1844, 588, 1846, 1847,
+ /* 2280 */ 583, 1843, 578, 1511, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2290 */ 1511, 1511, 1511, 1861, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2300 */ 1511, 585, 1511, 1511, 1511, 1511, 1811, 1511, 584, 1861,
+ /* 2310 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511,
+ /* 2320 */ 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, 1511,
+ /* 2330 */ 1511, 1875, 1511, 1511, 1843, 295, 1841, 1842, 1844, 588,
+ /* 2340 */ 1846, 1847, 583, 1511, 578, 1511, 1511, 1875, 1843, 1511,
+ /* 2350 */ 1511, 296, 1841, 1842, 1844, 588, 1846, 1847, 583, 1511,
+ /* 2360 */ 578, 1511, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2370 */ 585, 1511, 1511, 1511, 1511, 1811, 1861, 584, 1511, 1511,
+ /* 2380 */ 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811,
+ /* 2390 */ 1511, 584, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2400 */ 1875, 1511, 1843, 1511, 1855, 1841, 1842, 1844, 588, 1846,
+ /* 2410 */ 1847, 583, 1511, 578, 1875, 1511, 1511, 1511, 1854, 1841,
+ /* 2420 */ 1842, 1844, 588, 1846, 1847, 583, 1843, 578, 1511, 1511,
+ /* 2430 */ 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511,
+ /* 2440 */ 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511,
+ /* 2450 */ 1511, 1511, 1843, 1511, 1861, 1511, 1511, 1511, 1511, 1511,
+ /* 2460 */ 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, 1875, 584,
+ /* 2470 */ 1511, 1511, 1853, 1841, 1842, 1844, 588, 1846, 1847, 583,
+ /* 2480 */ 1861, 578, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511,
+ /* 2490 */ 1511, 1511, 1875, 1811, 1511, 584, 307, 1841, 1842, 1844,
+ /* 2500 */ 588, 1846, 1847, 583, 1843, 578, 1511, 1511, 1511, 1511,
+ /* 2510 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1875, 1511,
+ /* 2520 */ 1843, 1511, 308, 1841, 1842, 1844, 588, 1846, 1847, 583,
+ /* 2530 */ 1511, 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2540 */ 585, 1511, 1511, 1511, 1511, 1811, 1511, 584, 1861, 1511,
+ /* 2550 */ 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511,
+ /* 2560 */ 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2570 */ 1875, 1511, 1511, 1511, 304, 1841, 1842, 1844, 588, 1846,
+ /* 2580 */ 1847, 583, 1843, 578, 1511, 1511, 1875, 1511, 1511, 1511,
+ /* 2590 */ 309, 1841, 1842, 1844, 588, 1846, 1847, 583, 1511, 578,
+ /* 2600 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2610 */ 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511,
+ /* 2620 */ 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511,
+ /* 2630 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511,
+ /* 2640 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1875, 1511,
+ /* 2650 */ 1511, 1511, 284, 1841, 1842, 1844, 588, 1846, 1847, 583,
+ /* 2660 */ 1511, 578,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 316, 0, 318, 319, 312, 316, 342, 318, 319, 355,
- /* 10 */ 393, 394, 12, 13, 386, 341, 362, 353, 4, 365,
- /* 20 */ 20, 311, 22, 313, 312, 12, 13, 14, 15, 16,
- /* 30 */ 20, 332, 340, 33, 351, 35, 408, 354, 355, 340,
- /* 40 */ 348, 377, 378, 379, 324, 353, 320, 355, 349, 421,
- /* 50 */ 422, 386, 340, 389, 426, 427, 56, 337, 44, 45,
- /* 60 */ 348, 61, 354, 355, 322, 353, 346, 355, 68, 0,
- /* 70 */ 378, 20, 340, 408, 382, 383, 384, 385, 386, 387,
- /* 80 */ 348, 389, 325, 357, 392, 343, 329, 422, 396, 397,
- /* 90 */ 378, 426, 427, 93, 382, 383, 384, 385, 386, 387,
- /* 100 */ 408, 389, 355, 93, 392, 14, 78, 380, 396, 397,
- /* 110 */ 20, 20, 365, 421, 422, 115, 384, 21, 426, 427,
- /* 120 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 129,
- /* 130 */ 130, 404, 63, 64, 65, 66, 67, 20, 69, 70,
- /* 140 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- /* 150 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
- /* 160 */ 2, 133, 134, 339, 33, 0, 8, 9, 326, 327,
- /* 170 */ 12, 13, 14, 15, 16, 175, 352, 177, 47, 317,
- /* 180 */ 129, 130, 320, 52, 53, 54, 55, 56, 93, 24,
- /* 190 */ 25, 26, 27, 28, 29, 30, 31, 32, 198, 199,
- /* 200 */ 93, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 12,
- /* 220 */ 13, 14, 93, 92, 326, 327, 95, 20, 320, 22,
- /* 230 */ 8, 9, 232, 312, 12, 13, 14, 15, 16, 331,
- /* 240 */ 33, 60, 35, 124, 312, 106, 107, 108, 109, 110,
- /* 250 */ 111, 112, 113, 114, 115, 116, 348, 118, 119, 120,
- /* 260 */ 121, 122, 123, 56, 39, 43, 340, 320, 61, 174,
- /* 270 */ 320, 176, 340, 347, 353, 68, 12, 13, 331, 162,
- /* 280 */ 348, 331, 356, 20, 20, 353, 22, 355, 338, 158,
- /* 290 */ 159, 324, 161, 202, 4, 348, 165, 33, 348, 35,
- /* 300 */ 93, 8, 9, 184, 185, 12, 13, 14, 15, 16,
- /* 310 */ 378, 0, 181, 346, 382, 383, 384, 385, 386, 387,
- /* 320 */ 56, 389, 115, 20, 392, 61, 105, 232, 396, 397,
- /* 330 */ 398, 322, 68, 12, 13, 60, 129, 130, 0, 232,
- /* 340 */ 342, 125, 410, 22, 335, 124, 125, 126, 127, 128,
- /* 350 */ 418, 353, 343, 20, 33, 20, 35, 93, 104, 21,
- /* 360 */ 312, 232, 24, 25, 26, 27, 28, 29, 30, 31,
- /* 370 */ 32, 60, 340, 64, 65, 377, 378, 56, 332, 115,
- /* 380 */ 71, 349, 175, 93, 177, 157, 340, 389, 340, 68,
- /* 390 */ 56, 82, 83, 129, 130, 349, 348, 88, 182, 183,
- /* 400 */ 20, 353, 186, 355, 20, 198, 199, 198, 201, 202,
- /* 410 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
- /* 420 */ 213, 214, 215, 216, 217, 218, 378, 93, 93, 95,
- /* 430 */ 382, 383, 384, 385, 386, 387, 115, 389, 0, 175,
- /* 440 */ 392, 177, 340, 340, 396, 397, 398, 219, 312, 347,
- /* 450 */ 241, 242, 243, 244, 245, 407, 231, 229, 356, 356,
- /* 460 */ 167, 312, 198, 199, 56, 201, 202, 203, 204, 205,
- /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
- /* 480 */ 216, 217, 218, 12, 13, 18, 48, 20, 386, 353,
- /* 490 */ 368, 20, 20, 22, 27, 162, 175, 30, 177, 4,
- /* 500 */ 92, 160, 353, 95, 33, 312, 35, 14, 386, 317,
- /* 510 */ 408, 68, 320, 20, 47, 342, 49, 312, 51, 198,
- /* 520 */ 199, 309, 232, 421, 422, 22, 353, 56, 426, 427,
- /* 530 */ 408, 210, 211, 212, 213, 214, 215, 216, 35, 68,
- /* 540 */ 0, 386, 20, 421, 422, 340, 353, 254, 426, 427,
- /* 550 */ 377, 378, 379, 348, 20, 20, 22, 22, 353, 92,
- /* 560 */ 355, 341, 389, 408, 93, 93, 232, 232, 8, 9,
- /* 570 */ 35, 104, 12, 13, 14, 15, 16, 422, 237, 238,
- /* 580 */ 368, 426, 427, 378, 50, 50, 115, 382, 383, 384,
- /* 590 */ 385, 386, 387, 388, 389, 390, 391, 68, 386, 132,
- /* 600 */ 129, 130, 135, 136, 137, 138, 139, 140, 141, 142,
- /* 610 */ 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
- /* 620 */ 408, 154, 155, 156, 8, 9, 341, 320, 12, 13,
- /* 630 */ 14, 15, 16, 421, 422, 320, 8, 9, 426, 427,
- /* 640 */ 12, 13, 14, 15, 16, 105, 175, 380, 177, 14,
- /* 650 */ 15, 16, 8, 9, 94, 348, 12, 13, 14, 15,
- /* 660 */ 16, 1, 2, 348, 124, 125, 126, 127, 128, 198,
- /* 670 */ 199, 404, 201, 202, 203, 204, 205, 206, 207, 208,
- /* 680 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
- /* 690 */ 12, 13, 14, 386, 35, 202, 14, 0, 20, 312,
- /* 700 */ 22, 386, 20, 232, 232, 43, 4, 400, 401, 402,
- /* 710 */ 403, 33, 405, 35, 124, 125, 401, 402, 403, 2,
- /* 720 */ 405, 19, 94, 408, 202, 8, 9, 68, 233, 12,
- /* 730 */ 13, 14, 15, 16, 56, 33, 421, 422, 94, 312,
- /* 740 */ 353, 426, 427, 340, 47, 170, 68, 12, 13, 47,
- /* 750 */ 347, 320, 342, 51, 94, 20, 94, 22, 56, 356,
- /* 760 */ 0, 320, 331, 353, 189, 190, 3, 340, 33, 338,
- /* 770 */ 35, 93, 331, 183, 320, 348, 186, 368, 162, 348,
- /* 780 */ 353, 312, 355, 43, 332, 331, 368, 377, 378, 348,
- /* 790 */ 320, 56, 340, 115, 92, 386, 0, 95, 341, 389,
- /* 800 */ 312, 349, 348, 68, 386, 378, 312, 129, 130, 382,
- /* 810 */ 383, 384, 385, 386, 387, 3, 389, 408, 348, 392,
- /* 820 */ 60, 341, 353, 396, 397, 398, 408, 380, 93, 313,
- /* 830 */ 421, 422, 20, 312, 407, 426, 427, 348, 348, 421,
- /* 840 */ 422, 353, 44, 45, 426, 427, 21, 353, 359, 359,
- /* 850 */ 115, 404, 341, 175, 350, 177, 386, 353, 341, 34,
- /* 860 */ 368, 36, 8, 9, 129, 130, 12, 13, 14, 15,
- /* 870 */ 16, 401, 402, 403, 353, 405, 198, 199, 386, 201,
- /* 880 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
- /* 890 */ 212, 213, 214, 215, 216, 217, 218, 320, 8, 9,
- /* 900 */ 408, 105, 12, 13, 14, 15, 16, 162, 163, 364,
- /* 910 */ 175, 366, 177, 421, 422, 61, 372, 312, 426, 427,
- /* 920 */ 124, 125, 126, 127, 128, 348, 37, 430, 350, 312,
- /* 930 */ 312, 353, 312, 198, 199, 312, 201, 202, 203, 204,
- /* 940 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
- /* 950 */ 215, 216, 217, 218, 12, 13, 102, 340, 353, 364,
- /* 960 */ 35, 366, 20, 386, 22, 348, 312, 328, 368, 330,
- /* 970 */ 353, 353, 355, 353, 162, 33, 353, 35, 401, 402,
- /* 980 */ 403, 333, 405, 105, 336, 96, 386, 98, 99, 312,
- /* 990 */ 101, 251, 312, 61, 105, 378, 312, 35, 56, 382,
- /* 1000 */ 383, 384, 385, 386, 387, 127, 389, 353, 408, 392,
- /* 1010 */ 68, 157, 249, 396, 397, 398, 127, 340, 230, 231,
- /* 1020 */ 97, 421, 422, 100, 407, 348, 426, 427, 0, 18,
- /* 1030 */ 353, 43, 355, 353, 23, 93, 0, 353, 8, 9,
- /* 1040 */ 22, 329, 12, 13, 14, 15, 16, 321, 37, 38,
- /* 1050 */ 42, 43, 41, 35, 340, 378, 320, 115, 22, 382,
- /* 1060 */ 383, 384, 385, 386, 387, 0, 389, 331, 57, 58,
- /* 1070 */ 59, 129, 130, 219, 220, 221, 222, 223, 224, 225,
- /* 1080 */ 226, 227, 228, 229, 348, 0, 68, 22, 312, 35,
- /* 1090 */ 320, 61, 64, 65, 312, 312, 415, 320, 320, 71,
- /* 1100 */ 97, 331, 177, 100, 93, 428, 429, 22, 331, 331,
- /* 1110 */ 82, 83, 97, 1, 2, 100, 88, 175, 348, 177,
- /* 1120 */ 419, 312, 68, 340, 94, 348, 348, 321, 345, 353,
- /* 1130 */ 198, 348, 102, 115, 56, 353, 353, 43, 355, 177,
- /* 1140 */ 198, 199, 131, 201, 202, 203, 204, 205, 206, 207,
- /* 1150 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
- /* 1160 */ 218, 378, 353, 129, 130, 382, 383, 384, 385, 386,
- /* 1170 */ 387, 97, 389, 95, 100, 43, 43, 46, 167, 168,
- /* 1180 */ 169, 320, 43, 172, 352, 320, 320, 157, 94, 381,
- /* 1190 */ 320, 43, 331, 175, 312, 177, 331, 331, 319, 188,
- /* 1200 */ 320, 331, 191, 406, 193, 194, 195, 196, 197, 348,
- /* 1210 */ 13, 331, 320, 348, 348, 399, 198, 199, 348, 93,
- /* 1220 */ 320, 234, 340, 331, 93, 43, 94, 94, 348, 103,
- /* 1230 */ 348, 331, 35, 94, 320, 353, 43, 355, 423, 409,
- /* 1240 */ 348, 253, 94, 232, 43, 331, 47, 312, 348, 219,
- /* 1250 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
- /* 1260 */ 378, 312, 348, 376, 382, 383, 384, 385, 386, 387,
- /* 1270 */ 320, 389, 43, 320, 392, 340, 94, 43, 396, 397,
- /* 1280 */ 398, 331, 375, 348, 331, 13, 173, 94, 353, 340,
- /* 1290 */ 355, 43, 370, 43, 360, 94, 42, 348, 348, 43,
- /* 1300 */ 418, 348, 353, 20, 355, 320, 320, 35, 43, 43,
- /* 1310 */ 157, 312, 360, 378, 358, 358, 320, 382, 383, 384,
- /* 1320 */ 385, 386, 387, 94, 389, 320, 320, 378, 94, 20,
- /* 1330 */ 314, 382, 383, 384, 385, 386, 387, 312, 389, 340,
- /* 1340 */ 314, 392, 94, 408, 94, 396, 397, 348, 20, 374,
- /* 1350 */ 94, 312, 353, 324, 355, 355, 421, 422, 367, 94,
- /* 1360 */ 94, 426, 427, 20, 324, 340, 20, 369, 324, 367,
- /* 1370 */ 345, 324, 324, 348, 324, 320, 324, 378, 353, 340,
- /* 1380 */ 355, 382, 383, 384, 385, 386, 387, 348, 389, 314,
- /* 1390 */ 320, 392, 353, 340, 355, 314, 397, 340, 340, 340,
- /* 1400 */ 340, 331, 340, 378, 312, 374, 340, 382, 383, 384,
- /* 1410 */ 385, 386, 387, 340, 389, 320, 340, 378, 348, 340,
- /* 1420 */ 340, 382, 383, 384, 385, 386, 387, 322, 389, 180,
- /* 1430 */ 312, 322, 340, 322, 373, 353, 320, 320, 355, 367,
- /* 1440 */ 348, 239, 353, 353, 353, 353, 353, 355, 159, 363,
- /* 1450 */ 363, 353, 322, 20, 312, 336, 322, 361, 340, 420,
- /* 1460 */ 353, 240, 348, 414, 363, 381, 348, 363, 353, 246,
- /* 1470 */ 378, 353, 166, 355, 382, 383, 384, 385, 386, 387,
- /* 1480 */ 353, 389, 340, 414, 417, 414, 248, 345, 353, 353,
- /* 1490 */ 348, 247, 235, 416, 231, 353, 378, 355, 376, 411,
- /* 1500 */ 382, 383, 384, 385, 386, 387, 348, 389, 20, 391,
- /* 1510 */ 413, 412, 312, 255, 93, 395, 252, 380, 250, 93,
- /* 1520 */ 378, 429, 344, 19, 382, 383, 384, 385, 386, 387,
- /* 1530 */ 424, 389, 353, 431, 330, 425, 320, 33, 36, 322,
- /* 1540 */ 340, 315, 314, 371, 334, 345, 366, 334, 348, 334,
- /* 1550 */ 323, 47, 310, 353, 0, 355, 52, 53, 54, 55,
- /* 1560 */ 56, 0, 182, 0, 312, 0, 42, 0, 35, 192,
- /* 1570 */ 35, 35, 35, 192, 312, 0, 35, 35, 378, 192,
- /* 1580 */ 0, 192, 382, 383, 384, 385, 386, 387, 0, 389,
- /* 1590 */ 35, 0, 340, 22, 0, 35, 92, 177, 175, 95,
- /* 1600 */ 348, 0, 340, 0, 170, 353, 171, 355, 0, 0,
- /* 1610 */ 348, 0, 46, 0, 0, 353, 42, 355, 0, 0,
- /* 1620 */ 0, 153, 0, 0, 0, 0, 312, 0, 148, 0,
- /* 1630 */ 378, 35, 128, 148, 382, 383, 384, 385, 386, 387,
- /* 1640 */ 378, 389, 0, 0, 382, 383, 384, 385, 386, 387,
- /* 1650 */ 312, 389, 0, 0, 340, 0, 0, 0, 0, 0,
- /* 1660 */ 0, 0, 348, 0, 0, 161, 0, 353, 42, 355,
- /* 1670 */ 0, 0, 0, 0, 312, 0, 0, 0, 340, 0,
- /* 1680 */ 0, 0, 0, 179, 22, 181, 348, 56, 0, 56,
- /* 1690 */ 312, 353, 378, 355, 0, 0, 382, 383, 384, 385,
- /* 1700 */ 386, 387, 340, 389, 14, 14, 39, 42, 0, 40,
- /* 1710 */ 348, 43, 0, 39, 0, 353, 378, 355, 340, 0,
- /* 1720 */ 382, 383, 384, 385, 386, 387, 348, 389, 39, 46,
- /* 1730 */ 312, 353, 46, 355, 166, 0, 0, 0, 0, 0,
- /* 1740 */ 378, 35, 39, 47, 382, 383, 384, 385, 386, 387,
- /* 1750 */ 0, 389, 35, 0, 47, 62, 378, 39, 340, 35,
- /* 1760 */ 382, 383, 384, 385, 386, 387, 348, 389, 47, 39,
- /* 1770 */ 0, 353, 47, 355, 0, 35, 0, 0, 0, 35,
- /* 1780 */ 39, 22, 0, 312, 35, 100, 102, 35, 43, 43,
- /* 1790 */ 35, 35, 0, 22, 22, 312, 378, 0, 0, 35,
- /* 1800 */ 382, 383, 384, 385, 386, 387, 49, 389, 22, 312,
- /* 1810 */ 22, 340, 0, 0, 35, 35, 0, 22, 0, 348,
- /* 1820 */ 20, 0, 35, 340, 353, 178, 355, 22, 0, 0,
- /* 1830 */ 3, 348, 0, 0, 0, 93, 353, 340, 355, 35,
- /* 1840 */ 162, 94, 0, 0, 93, 348, 159, 93, 39, 378,
- /* 1850 */ 353, 93, 355, 382, 383, 384, 385, 386, 387, 162,
- /* 1860 */ 389, 378, 162, 164, 312, 382, 383, 384, 385, 386,
- /* 1870 */ 387, 160, 389, 158, 236, 378, 103, 46, 43, 382,
- /* 1880 */ 383, 384, 385, 386, 387, 187, 389, 93, 43, 43,
- /* 1890 */ 46, 43, 340, 94, 93, 46, 94, 94, 46, 43,
- /* 1900 */ 348, 93, 3, 46, 94, 353, 46, 355, 93, 43,
- /* 1910 */ 93, 35, 312, 93, 35, 35, 94, 93, 35, 94,
- /* 1920 */ 94, 35, 35, 2, 94, 22, 198, 43, 312, 93,
- /* 1930 */ 378, 230, 94, 93, 382, 383, 384, 385, 386, 387,
- /* 1940 */ 340, 389, 46, 46, 94, 236, 236, 93, 348, 94,
- /* 1950 */ 22, 93, 312, 353, 93, 355, 340, 93, 35, 94,
- /* 1960 */ 200, 35, 93, 104, 348, 94, 35, 93, 35, 353,
- /* 1970 */ 93, 355, 94, 35, 35, 94, 94, 22, 378, 117,
- /* 1980 */ 340, 93, 382, 383, 384, 385, 386, 387, 348, 389,
- /* 1990 */ 117, 93, 117, 353, 378, 355, 105, 93, 382, 383,
- /* 2000 */ 384, 385, 386, 387, 312, 389, 117, 93, 35, 93,
- /* 2010 */ 43, 22, 62, 61, 312, 35, 35, 35, 378, 35,
- /* 2020 */ 35, 35, 382, 383, 384, 385, 386, 387, 312, 389,
- /* 2030 */ 35, 35, 340, 35, 35, 91, 68, 43, 35, 35,
- /* 2040 */ 348, 22, 340, 35, 22, 353, 35, 355, 35, 35,
- /* 2050 */ 348, 68, 35, 35, 22, 353, 340, 355, 35, 35,
- /* 2060 */ 35, 35, 0, 35, 348, 0, 39, 47, 35, 353,
- /* 2070 */ 378, 355, 0, 39, 382, 383, 384, 385, 386, 387,
- /* 2080 */ 378, 389, 47, 35, 382, 383, 384, 385, 386, 387,
- /* 2090 */ 47, 389, 39, 0, 378, 35, 312, 47, 382, 383,
- /* 2100 */ 384, 385, 386, 387, 0, 389, 39, 0, 312, 35,
- /* 2110 */ 35, 22, 21, 432, 22, 20, 22, 21, 312, 432,
- /* 2120 */ 432, 432, 432, 432, 340, 432, 432, 432, 432, 432,
- /* 2130 */ 432, 432, 348, 432, 432, 432, 340, 353, 432, 355,
- /* 2140 */ 432, 432, 432, 432, 348, 432, 340, 432, 432, 353,
- /* 2150 */ 432, 355, 432, 432, 348, 432, 432, 432, 432, 353,
- /* 2160 */ 432, 355, 378, 432, 432, 432, 382, 383, 384, 385,
- /* 2170 */ 386, 387, 432, 389, 378, 432, 432, 432, 382, 383,
- /* 2180 */ 384, 385, 386, 387, 378, 389, 432, 432, 382, 383,
- /* 2190 */ 384, 385, 386, 387, 432, 389, 432, 432, 432, 432,
- /* 2200 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2210 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2220 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2230 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2240 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2250 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2260 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2270 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2280 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2290 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2300 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2310 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2320 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2330 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2340 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2350 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2360 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2370 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2380 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2390 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2400 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2410 */ 432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
- /* 2420 */ 432, 432, 432, 432, 432, 432, 432,
+ /* 0 */ 324, 388, 0, 324, 320, 346, 322, 323, 403, 404,
+ /* 10 */ 316, 335, 12, 13, 335, 3, 357, 4, 342, 345,
+ /* 20 */ 20, 342, 22, 12, 13, 14, 15, 16, 352, 20,
+ /* 30 */ 417, 352, 20, 33, 0, 35, 20, 20, 344, 346,
+ /* 40 */ 381, 382, 383, 430, 431, 313, 352, 336, 435, 436,
+ /* 50 */ 357, 357, 345, 359, 395, 344, 56, 44, 45, 20,
+ /* 60 */ 320, 61, 322, 323, 353, 344, 4, 316, 68, 12,
+ /* 70 */ 13, 14, 14, 352, 381, 382, 382, 20, 20, 22,
+ /* 80 */ 386, 387, 388, 389, 390, 391, 392, 393, 395, 395,
+ /* 90 */ 33, 324, 35, 93, 400, 344, 402, 324, 64, 65,
+ /* 100 */ 406, 407, 335, 352, 372, 71, 94, 93, 357, 93,
+ /* 110 */ 359, 390, 315, 56, 317, 115, 82, 83, 61, 352,
+ /* 120 */ 388, 427, 88, 355, 346, 68, 358, 359, 60, 129,
+ /* 130 */ 130, 125, 93, 382, 361, 357, 388, 386, 387, 388,
+ /* 140 */ 389, 390, 391, 392, 393, 346, 395, 358, 359, 417,
+ /* 150 */ 93, 400, 93, 402, 316, 93, 357, 406, 407, 381,
+ /* 160 */ 382, 383, 430, 431, 399, 417, 401, 435, 436, 344,
+ /* 170 */ 419, 162, 115, 395, 162, 175, 351, 177, 427, 431,
+ /* 180 */ 381, 382, 344, 435, 436, 360, 129, 130, 182, 183,
+ /* 190 */ 352, 20, 186, 324, 395, 357, 329, 359, 198, 199,
+ /* 200 */ 333, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+ /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ /* 220 */ 382, 352, 343, 60, 386, 387, 388, 389, 390, 391,
+ /* 230 */ 392, 393, 175, 395, 177, 356, 398, 237, 400, 401,
+ /* 240 */ 402, 198, 8, 9, 406, 407, 12, 13, 14, 15,
+ /* 250 */ 16, 237, 20, 237, 22, 198, 199, 388, 201, 202,
+ /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
+ /* 270 */ 213, 214, 215, 216, 217, 218, 219, 12, 13, 410,
+ /* 280 */ 411, 412, 50, 414, 221, 20, 20, 22, 20, 246,
+ /* 290 */ 247, 248, 249, 250, 321, 316, 237, 324, 33, 237,
+ /* 300 */ 35, 93, 106, 107, 108, 109, 110, 111, 112, 113,
+ /* 310 */ 114, 115, 116, 324, 118, 119, 120, 121, 122, 123,
+ /* 320 */ 78, 56, 221, 344, 223, 56, 61, 0, 94, 124,
+ /* 330 */ 125, 352, 324, 68, 12, 13, 357, 104, 359, 160,
+ /* 340 */ 344, 352, 20, 335, 22, 8, 9, 351, 316, 12,
+ /* 350 */ 13, 14, 15, 16, 20, 33, 360, 35, 93, 93,
+ /* 360 */ 352, 382, 93, 35, 95, 386, 387, 388, 389, 390,
+ /* 370 */ 391, 392, 393, 170, 395, 133, 134, 388, 56, 400,
+ /* 380 */ 115, 402, 174, 61, 176, 406, 407, 60, 183, 357,
+ /* 390 */ 68, 186, 189, 190, 129, 130, 68, 129, 130, 410,
+ /* 400 */ 411, 412, 0, 414, 8, 9, 417, 324, 12, 13,
+ /* 410 */ 14, 15, 16, 321, 354, 93, 324, 357, 335, 430,
+ /* 420 */ 431, 242, 243, 21, 435, 436, 24, 25, 26, 27,
+ /* 430 */ 28, 29, 30, 31, 32, 352, 359, 115, 0, 43,
+ /* 440 */ 175, 14, 177, 366, 326, 237, 369, 20, 316, 68,
+ /* 450 */ 21, 129, 130, 24, 25, 26, 27, 28, 29, 30,
+ /* 460 */ 31, 32, 20, 198, 199, 347, 201, 202, 203, 204,
+ /* 470 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
+ /* 480 */ 215, 216, 217, 218, 219, 0, 221, 8, 9, 357,
+ /* 490 */ 324, 12, 13, 14, 15, 16, 162, 175, 60, 177,
+ /* 500 */ 3, 335, 398, 237, 167, 401, 237, 37, 68, 24,
+ /* 510 */ 25, 26, 27, 28, 29, 30, 31, 32, 352, 384,
+ /* 520 */ 198, 199, 20, 201, 202, 203, 204, 205, 206, 207,
+ /* 530 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
+ /* 540 */ 218, 219, 12, 13, 344, 124, 22, 336, 413, 345,
+ /* 550 */ 20, 351, 22, 330, 331, 344, 43, 328, 328, 35,
+ /* 560 */ 360, 324, 33, 33, 353, 35, 96, 324, 98, 99,
+ /* 570 */ 341, 101, 20, 94, 22, 105, 47, 316, 335, 350,
+ /* 580 */ 350, 52, 53, 54, 55, 56, 56, 35, 388, 352,
+ /* 590 */ 326, 316, 68, 105, 20, 352, 259, 127, 68, 12,
+ /* 600 */ 13, 14, 50, 339, 384, 184, 185, 20, 345, 22,
+ /* 610 */ 324, 347, 124, 125, 126, 127, 128, 417, 357, 344,
+ /* 620 */ 33, 92, 35, 93, 95, 388, 324, 352, 345, 202,
+ /* 630 */ 430, 431, 357, 413, 359, 435, 436, 335, 352, 115,
+ /* 640 */ 56, 324, 316, 56, 14, 115, 409, 410, 411, 412,
+ /* 650 */ 20, 414, 335, 345, 352, 68, 344, 382, 21, 129,
+ /* 660 */ 130, 386, 387, 388, 389, 390, 391, 392, 393, 352,
+ /* 670 */ 395, 34, 360, 36, 388, 400, 92, 402, 324, 95,
+ /* 680 */ 93, 406, 407, 357, 316, 64, 65, 158, 159, 335,
+ /* 690 */ 161, 416, 71, 399, 165, 401, 410, 411, 412, 175,
+ /* 700 */ 414, 177, 115, 82, 83, 175, 352, 177, 352, 88,
+ /* 710 */ 181, 316, 344, 14, 15, 16, 129, 130, 0, 363,
+ /* 720 */ 352, 344, 198, 199, 316, 357, 376, 359, 198, 199,
+ /* 730 */ 353, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+ /* 740 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ /* 750 */ 382, 254, 357, 384, 386, 387, 388, 389, 390, 391,
+ /* 760 */ 392, 393, 175, 395, 177, 357, 2, 237, 400, 316,
+ /* 770 */ 402, 258, 8, 9, 406, 407, 12, 13, 14, 15,
+ /* 780 */ 16, 316, 413, 316, 316, 198, 199, 39, 201, 202,
+ /* 790 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
+ /* 800 */ 213, 214, 215, 216, 217, 218, 219, 12, 13, 316,
+ /* 810 */ 357, 344, 336, 330, 331, 20, 349, 22, 354, 352,
+ /* 820 */ 344, 357, 357, 105, 357, 357, 359, 2, 33, 353,
+ /* 830 */ 35, 372, 202, 8, 9, 44, 45, 12, 13, 14,
+ /* 840 */ 15, 16, 124, 125, 126, 127, 128, 388, 20, 382,
+ /* 850 */ 357, 56, 316, 386, 387, 388, 389, 390, 391, 392,
+ /* 860 */ 393, 56, 395, 68, 12, 13, 352, 345, 368, 359,
+ /* 870 */ 370, 324, 20, 368, 22, 370, 417, 363, 19, 369,
+ /* 880 */ 316, 332, 335, 334, 317, 33, 157, 35, 93, 430,
+ /* 890 */ 431, 439, 33, 357, 435, 436, 333, 8, 9, 352,
+ /* 900 */ 95, 12, 13, 14, 15, 16, 47, 324, 56, 105,
+ /* 910 */ 115, 52, 53, 54, 55, 56, 372, 316, 335, 35,
+ /* 920 */ 68, 357, 8, 9, 129, 130, 12, 13, 14, 15,
+ /* 930 */ 16, 127, 388, 8, 9, 352, 93, 12, 13, 14,
+ /* 940 */ 15, 16, 1, 2, 337, 93, 103, 340, 324, 324,
+ /* 950 */ 61, 92, 68, 224, 95, 324, 35, 324, 357, 335,
+ /* 960 */ 335, 417, 324, 234, 42, 43, 335, 115, 335, 4,
+ /* 970 */ 175, 43, 177, 335, 430, 431, 352, 352, 316, 435,
+ /* 980 */ 436, 129, 130, 352, 236, 352, 428, 128, 235, 236,
+ /* 990 */ 352, 102, 316, 198, 199, 0, 201, 202, 203, 204,
+ /* 1000 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
+ /* 1010 */ 215, 216, 217, 218, 219, 324, 18, 22, 20, 357,
+ /* 1020 */ 161, 22, 94, 162, 163, 27, 335, 175, 30, 177,
+ /* 1030 */ 202, 316, 0, 357, 35, 94, 372, 316, 179, 316,
+ /* 1040 */ 181, 97, 316, 352, 100, 47, 157, 49, 344, 51,
+ /* 1050 */ 198, 199, 388, 201, 202, 203, 204, 205, 206, 207,
+ /* 1060 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
+ /* 1070 */ 218, 219, 357, 324, 97, 0, 162, 100, 357, 47,
+ /* 1080 */ 357, 417, 324, 357, 335, 97, 18, 43, 100, 0,
+ /* 1090 */ 92, 23, 0, 335, 430, 431, 61, 22, 177, 435,
+ /* 1100 */ 436, 352, 104, 0, 97, 37, 38, 100, 43, 41,
+ /* 1110 */ 352, 22, 43, 224, 225, 226, 227, 228, 229, 230,
+ /* 1120 */ 231, 232, 233, 234, 325, 57, 58, 59, 1, 2,
+ /* 1130 */ 132, 129, 130, 135, 136, 137, 138, 139, 140, 141,
+ /* 1140 */ 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
+ /* 1150 */ 152, 424, 154, 155, 156, 43, 3, 325, 43, 94,
+ /* 1160 */ 43, 93, 323, 94, 43, 388, 63, 64, 65, 66,
+ /* 1170 */ 67, 43, 69, 70, 71, 72, 73, 74, 75, 76,
+ /* 1180 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+ /* 1190 */ 87, 88, 89, 90, 417, 35, 324, 105, 43, 131,
+ /* 1200 */ 356, 385, 316, 238, 43, 46, 94, 335, 431, 94,
+ /* 1210 */ 13, 94, 435, 436, 432, 94, 124, 125, 126, 127,
+ /* 1220 */ 128, 0, 94, 415, 352, 408, 13, 418, 239, 43,
+ /* 1230 */ 344, 43, 35, 198, 380, 167, 168, 169, 352, 43,
+ /* 1240 */ 172, 47, 4, 357, 379, 359, 43, 94, 35, 94,
+ /* 1250 */ 43, 372, 93, 43, 173, 94, 188, 19, 42, 191,
+ /* 1260 */ 364, 193, 194, 195, 196, 197, 374, 388, 382, 48,
+ /* 1270 */ 20, 33, 386, 387, 388, 389, 390, 391, 392, 393,
+ /* 1280 */ 94, 395, 94, 372, 316, 47, 324, 324, 402, 51,
+ /* 1290 */ 94, 364, 406, 407, 56, 157, 417, 94, 362, 388,
+ /* 1300 */ 256, 94, 362, 417, 94, 237, 324, 324, 324, 430,
+ /* 1310 */ 431, 20, 344, 20, 435, 436, 430, 431, 318, 318,
+ /* 1320 */ 352, 435, 436, 378, 328, 357, 359, 359, 417, 20,
+ /* 1330 */ 92, 328, 371, 95, 20, 371, 328, 177, 328, 373,
+ /* 1340 */ 328, 430, 431, 328, 316, 324, 435, 436, 328, 318,
+ /* 1350 */ 382, 357, 378, 344, 386, 387, 388, 389, 390, 391,
+ /* 1360 */ 392, 393, 344, 395, 324, 318, 316, 344, 400, 344,
+ /* 1370 */ 402, 344, 344, 344, 406, 407, 359, 344, 344, 326,
+ /* 1380 */ 352, 344, 344, 344, 416, 357, 180, 359, 377, 326,
+ /* 1390 */ 324, 324, 244, 371, 344, 159, 326, 367, 357, 357,
+ /* 1400 */ 357, 365, 352, 357, 326, 357, 326, 357, 352, 359,
+ /* 1410 */ 382, 340, 367, 20, 386, 387, 388, 389, 390, 391,
+ /* 1420 */ 392, 393, 316, 395, 245, 367, 367, 423, 400, 357,
+ /* 1430 */ 402, 357, 382, 357, 406, 407, 386, 387, 388, 389,
+ /* 1440 */ 390, 391, 392, 393, 416, 395, 385, 12, 13, 423,
+ /* 1450 */ 344, 357, 357, 251, 166, 240, 252, 22, 352, 380,
+ /* 1460 */ 260, 253, 257, 357, 440, 359, 255, 417, 33, 236,
+ /* 1470 */ 35, 352, 20, 93, 422, 426, 425, 423, 421, 93,
+ /* 1480 */ 430, 431, 420, 316, 384, 435, 436, 405, 382, 434,
+ /* 1490 */ 348, 56, 386, 387, 388, 389, 390, 391, 392, 393,
+ /* 1500 */ 357, 395, 334, 68, 324, 316, 400, 326, 402, 36,
+ /* 1510 */ 433, 344, 406, 407, 319, 375, 318, 370, 327, 352,
+ /* 1520 */ 338, 338, 338, 314, 357, 0, 359, 182, 0, 0,
+ /* 1530 */ 42, 0, 35, 344, 0, 192, 35, 35, 35, 192,
+ /* 1540 */ 0, 352, 35, 35, 192, 0, 357, 192, 359, 382,
+ /* 1550 */ 115, 0, 35, 386, 387, 388, 389, 390, 391, 392,
+ /* 1560 */ 393, 0, 395, 22, 0, 35, 177, 175, 0, 402,
+ /* 1570 */ 0, 382, 171, 406, 407, 386, 387, 388, 389, 390,
+ /* 1580 */ 391, 392, 393, 170, 395, 0, 0, 0, 46, 316,
+ /* 1590 */ 0, 402, 0, 0, 42, 406, 407, 0, 0, 153,
+ /* 1600 */ 0, 0, 0, 0, 0, 148, 35, 0, 148, 0,
+ /* 1610 */ 175, 0, 177, 0, 0, 0, 0, 344, 0, 0,
+ /* 1620 */ 0, 0, 0, 0, 0, 352, 0, 0, 0, 0,
+ /* 1630 */ 357, 42, 359, 198, 199, 0, 0, 0, 0, 22,
+ /* 1640 */ 0, 0, 0, 0, 316, 210, 211, 212, 213, 214,
+ /* 1650 */ 215, 216, 0, 0, 0, 382, 46, 0, 14, 386,
+ /* 1660 */ 387, 388, 389, 390, 391, 392, 393, 394, 395, 396,
+ /* 1670 */ 397, 39, 344, 42, 40, 14, 43, 0, 39, 0,
+ /* 1680 */ 352, 56, 0, 0, 166, 357, 56, 359, 39, 0,
+ /* 1690 */ 0, 46, 0, 0, 35, 47, 0, 316, 35, 0,
+ /* 1700 */ 35, 39, 47, 39, 0, 47, 39, 35, 39, 62,
+ /* 1710 */ 382, 0, 0, 47, 386, 387, 388, 389, 390, 391,
+ /* 1720 */ 392, 393, 0, 395, 0, 344, 35, 22, 0, 35,
+ /* 1730 */ 35, 43, 35, 352, 0, 35, 22, 0, 357, 22,
+ /* 1740 */ 359, 43, 22, 0, 35, 22, 0, 0, 35, 316,
+ /* 1750 */ 49, 100, 102, 35, 0, 22, 20, 0, 0, 178,
+ /* 1760 */ 35, 316, 22, 382, 159, 437, 438, 386, 387, 388,
+ /* 1770 */ 389, 390, 391, 392, 393, 316, 395, 344, 0, 0,
+ /* 1780 */ 3, 0, 0, 402, 0, 352, 35, 0, 407, 344,
+ /* 1790 */ 357, 0, 359, 187, 349, 39, 93, 352, 46, 220,
+ /* 1800 */ 222, 94, 357, 344, 359, 43, 43, 241, 220, 93,
+ /* 1810 */ 46, 352, 93, 103, 158, 382, 357, 43, 359, 386,
+ /* 1820 */ 387, 388, 389, 390, 391, 392, 393, 382, 395, 316,
+ /* 1830 */ 397, 386, 387, 388, 389, 390, 391, 392, 393, 164,
+ /* 1840 */ 395, 382, 162, 316, 160, 386, 387, 388, 389, 390,
+ /* 1850 */ 391, 392, 393, 93, 395, 94, 43, 344, 93, 93,
+ /* 1860 */ 46, 43, 94, 94, 162, 352, 93, 3, 162, 94,
+ /* 1870 */ 357, 344, 359, 93, 43, 35, 349, 94, 93, 352,
+ /* 1880 */ 94, 93, 93, 35, 357, 35, 359, 35, 429, 94,
+ /* 1890 */ 35, 35, 94, 316, 94, 382, 43, 46, 2, 386,
+ /* 1900 */ 387, 388, 389, 390, 391, 392, 393, 46, 395, 382,
+ /* 1910 */ 22, 241, 316, 386, 387, 388, 389, 390, 391, 392,
+ /* 1920 */ 393, 344, 395, 46, 198, 93, 349, 241, 94, 352,
+ /* 1930 */ 93, 46, 94, 94, 357, 93, 359, 93, 93, 46,
+ /* 1940 */ 344, 94, 22, 235, 200, 104, 35, 93, 352, 35,
+ /* 1950 */ 93, 438, 94, 357, 94, 359, 35, 94, 93, 382,
+ /* 1960 */ 35, 93, 316, 386, 387, 388, 389, 390, 391, 392,
+ /* 1970 */ 393, 35, 395, 94, 93, 35, 316, 94, 382, 93,
+ /* 1980 */ 22, 35, 386, 387, 388, 389, 390, 391, 392, 393,
+ /* 1990 */ 344, 395, 117, 117, 105, 117, 93, 117, 352, 93,
+ /* 2000 */ 93, 22, 43, 357, 344, 359, 62, 35, 61, 35,
+ /* 2010 */ 35, 35, 352, 35, 91, 35, 35, 357, 35, 359,
+ /* 2020 */ 35, 35, 68, 35, 35, 43, 22, 35, 382, 22,
+ /* 2030 */ 35, 316, 386, 387, 388, 389, 390, 391, 392, 393,
+ /* 2040 */ 35, 395, 382, 35, 35, 68, 386, 387, 388, 389,
+ /* 2050 */ 390, 391, 392, 393, 35, 395, 35, 316, 35, 344,
+ /* 2060 */ 35, 22, 35, 0, 35, 39, 0, 352, 35, 47,
+ /* 2070 */ 39, 47, 357, 0, 359, 35, 39, 47, 0, 35,
+ /* 2080 */ 39, 47, 0, 316, 35, 344, 35, 0, 20, 22,
+ /* 2090 */ 21, 441, 22, 352, 22, 21, 441, 382, 357, 441,
+ /* 2100 */ 359, 386, 387, 388, 389, 390, 391, 392, 393, 316,
+ /* 2110 */ 395, 344, 441, 441, 441, 441, 441, 441, 441, 352,
+ /* 2120 */ 441, 441, 441, 382, 357, 441, 359, 386, 387, 388,
+ /* 2130 */ 389, 390, 391, 392, 393, 316, 395, 344, 441, 441,
+ /* 2140 */ 441, 441, 441, 441, 441, 352, 441, 441, 441, 382,
+ /* 2150 */ 357, 441, 359, 386, 387, 388, 389, 390, 391, 392,
+ /* 2160 */ 393, 441, 395, 344, 441, 441, 441, 441, 441, 441,
+ /* 2170 */ 441, 352, 441, 441, 441, 382, 357, 441, 359, 386,
+ /* 2180 */ 387, 388, 389, 390, 391, 392, 393, 316, 395, 441,
+ /* 2190 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441,
+ /* 2200 */ 441, 382, 441, 316, 441, 386, 387, 388, 389, 390,
+ /* 2210 */ 391, 392, 393, 441, 395, 344, 441, 441, 441, 441,
+ /* 2220 */ 441, 441, 441, 352, 441, 441, 441, 441, 357, 441,
+ /* 2230 */ 359, 344, 441, 441, 441, 441, 441, 441, 441, 352,
+ /* 2240 */ 441, 441, 441, 441, 357, 441, 359, 441, 441, 441,
+ /* 2250 */ 441, 441, 441, 382, 441, 441, 441, 386, 387, 388,
+ /* 2260 */ 389, 390, 391, 392, 393, 316, 395, 441, 441, 382,
+ /* 2270 */ 441, 441, 441, 386, 387, 388, 389, 390, 391, 392,
+ /* 2280 */ 393, 316, 395, 441, 441, 441, 441, 441, 441, 441,
+ /* 2290 */ 441, 441, 441, 344, 441, 441, 441, 441, 441, 441,
+ /* 2300 */ 441, 352, 441, 441, 441, 441, 357, 441, 359, 344,
+ /* 2310 */ 441, 441, 441, 441, 441, 441, 441, 352, 441, 441,
+ /* 2320 */ 441, 441, 357, 441, 359, 441, 441, 441, 441, 441,
+ /* 2330 */ 441, 382, 441, 441, 316, 386, 387, 388, 389, 390,
+ /* 2340 */ 391, 392, 393, 441, 395, 441, 441, 382, 316, 441,
+ /* 2350 */ 441, 386, 387, 388, 389, 390, 391, 392, 393, 441,
+ /* 2360 */ 395, 441, 344, 441, 441, 441, 441, 441, 441, 441,
+ /* 2370 */ 352, 441, 441, 441, 441, 357, 344, 359, 441, 441,
+ /* 2380 */ 441, 441, 441, 441, 352, 441, 441, 441, 441, 357,
+ /* 2390 */ 441, 359, 441, 441, 441, 441, 441, 441, 441, 441,
+ /* 2400 */ 382, 441, 316, 441, 386, 387, 388, 389, 390, 391,
+ /* 2410 */ 392, 393, 441, 395, 382, 441, 441, 441, 386, 387,
+ /* 2420 */ 388, 389, 390, 391, 392, 393, 316, 395, 441, 441,
+ /* 2430 */ 344, 441, 441, 441, 441, 441, 441, 441, 352, 441,
+ /* 2440 */ 441, 441, 441, 357, 441, 359, 441, 441, 441, 441,
+ /* 2450 */ 441, 441, 316, 441, 344, 441, 441, 441, 441, 441,
+ /* 2460 */ 441, 441, 352, 441, 441, 441, 441, 357, 382, 359,
+ /* 2470 */ 441, 441, 386, 387, 388, 389, 390, 391, 392, 393,
+ /* 2480 */ 344, 395, 441, 441, 441, 441, 441, 441, 352, 441,
+ /* 2490 */ 441, 441, 382, 357, 441, 359, 386, 387, 388, 389,
+ /* 2500 */ 390, 391, 392, 393, 316, 395, 441, 441, 441, 441,
+ /* 2510 */ 441, 441, 441, 441, 441, 441, 441, 441, 382, 441,
+ /* 2520 */ 316, 441, 386, 387, 388, 389, 390, 391, 392, 393,
+ /* 2530 */ 441, 395, 344, 441, 441, 441, 441, 441, 441, 441,
+ /* 2540 */ 352, 441, 441, 441, 441, 357, 441, 359, 344, 441,
+ /* 2550 */ 441, 441, 441, 441, 441, 441, 352, 441, 441, 441,
+ /* 2560 */ 441, 357, 441, 359, 441, 441, 441, 441, 441, 441,
+ /* 2570 */ 382, 441, 441, 441, 386, 387, 388, 389, 390, 391,
+ /* 2580 */ 392, 393, 316, 395, 441, 441, 382, 441, 441, 441,
+ /* 2590 */ 386, 387, 388, 389, 390, 391, 392, 393, 441, 395,
+ /* 2600 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441,
+ /* 2610 */ 344, 441, 441, 441, 441, 441, 441, 441, 352, 441,
+ /* 2620 */ 441, 441, 441, 357, 441, 359, 441, 441, 441, 441,
+ /* 2630 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441,
+ /* 2640 */ 441, 441, 441, 441, 441, 441, 441, 441, 382, 441,
+ /* 2650 */ 441, 441, 386, 387, 388, 389, 390, 391, 392, 393,
+ /* 2660 */ 441, 395,
};
-#define YY_SHIFT_COUNT (667)
+#define YY_SHIFT_COUNT (678)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2107)
+#define YY_SHIFT_MAX (2087)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 1011, 0, 207, 207, 264, 264, 264, 471, 264, 264,
- /* 10 */ 678, 735, 942, 735, 735, 735, 735, 735, 735, 735,
- /* 20 */ 735, 735, 735, 735, 735, 735, 735, 735, 735, 735,
- /* 30 */ 735, 735, 735, 735, 735, 735, 735, 735, 735, 735,
- /* 40 */ 335, 472, 10, 95, 334, 107, 129, 107, 10, 10,
- /* 50 */ 321, 321, 107, 321, 321, 290, 107, 90, 90, 14,
- /* 60 */ 14, 51, 90, 90, 90, 90, 90, 90, 90, 90,
- /* 70 */ 90, 90, 181, 90, 90, 90, 263, 90, 90, 303,
- /* 80 */ 90, 90, 303, 380, 90, 303, 303, 303, 90, 275,
- /* 90 */ 467, 1030, 854, 854, 96, 1018, 1018, 1018, 1018, 1018,
- /* 100 */ 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018,
- /* 110 */ 1018, 1018, 1018, 1018, 889, 309, 812, 51, 682, 682,
- /* 120 */ 311, 659, 760, 117, 117, 117, 659, 384, 384, 263,
- /* 130 */ 1, 1, 303, 303, 443, 443, 254, 529, 139, 139,
- /* 140 */ 139, 139, 139, 139, 139, 1504, 338, 293, 1028, 209,
- /* 150 */ 535, 341, 91, 493, 534, 798, 878, 333, 788, 225,
- /* 160 */ 788, 1008, 763, 495, 522, 987, 1199, 1113, 1254, 1283,
- /* 170 */ 1283, 1254, 1153, 1153, 1283, 1283, 1283, 1309, 1309, 1328,
- /* 180 */ 181, 263, 181, 1343, 1346, 181, 1343, 181, 181, 181,
- /* 190 */ 1283, 181, 1309, 303, 303, 303, 303, 303, 303, 303,
- /* 200 */ 303, 303, 303, 303, 1283, 1309, 443, 1328, 275, 1249,
- /* 210 */ 263, 275, 1283, 1283, 1343, 275, 1202, 443, 443, 443,
- /* 220 */ 443, 1202, 443, 1289, 275, 254, 275, 384, 1433, 443,
- /* 230 */ 1221, 1202, 443, 443, 1221, 1202, 443, 443, 303, 1223,
- /* 240 */ 1306, 1221, 1238, 1244, 1257, 987, 1263, 384, 1488, 1258,
- /* 250 */ 1264, 1268, 1421, 1426, 443, 529, 1283, 275, 1502, 1309,
- /* 260 */ 2196, 2196, 2196, 2196, 2196, 2196, 2196, 69, 131, 165,
- /* 270 */ 702, 560, 222, 628, 158, 717, 616, 644, 540, 890,
- /* 280 */ 890, 890, 890, 890, 890, 890, 890, 796, 221, 13,
- /* 290 */ 13, 216, 590, 575, 408, 28, 825, 119, 660, 228,
- /* 300 */ 635, 635, 635, 635, 662, 697, 503, 923, 1003, 1015,
- /* 310 */ 1074, 1036, 1065, 1085, 1078, 745, 1094, 1132, 1133, 1139,
- /* 320 */ 1148, 1182, 1193, 1112, 1034, 740, 988, 1201, 925, 962,
- /* 330 */ 932, 1229, 1131, 1234, 1248, 1250, 1256, 1265, 1266, 1126,
- /* 340 */ 1197, 1272, 1054, 438, 1554, 1561, 1380, 1563, 1565, 1524,
- /* 350 */ 1567, 1533, 1377, 1535, 1536, 1537, 1381, 1575, 1541, 1542,
- /* 360 */ 1387, 1580, 1389, 1588, 1555, 1591, 1571, 1594, 1560, 1420,
- /* 370 */ 1423, 1601, 1603, 1435, 1434, 1608, 1609, 1566, 1611, 1613,
- /* 380 */ 1614, 1574, 1618, 1619, 1620, 1468, 1622, 1623, 1624, 1625,
- /* 390 */ 1627, 1480, 1596, 1629, 1485, 1642, 1643, 1652, 1653, 1655,
- /* 400 */ 1656, 1657, 1658, 1659, 1660, 1661, 1663, 1664, 1666, 1626,
- /* 410 */ 1670, 1671, 1672, 1673, 1675, 1676, 1662, 1677, 1679, 1680,
- /* 420 */ 1681, 1682, 1631, 1688, 1633, 1694, 1695, 1665, 1667, 1668,
- /* 430 */ 1690, 1683, 1691, 1686, 1708, 1669, 1674, 1712, 1714, 1719,
- /* 440 */ 1689, 1568, 1735, 1736, 1737, 1693, 1738, 1739, 1706, 1696,
- /* 450 */ 1703, 1750, 1717, 1707, 1718, 1753, 1724, 1721, 1730, 1770,
- /* 460 */ 1740, 1725, 1741, 1774, 1776, 1777, 1778, 1684, 1685, 1744,
- /* 470 */ 1759, 1782, 1749, 1752, 1745, 1746, 1755, 1756, 1771, 1792,
- /* 480 */ 1772, 1797, 1786, 1757, 1798, 1788, 1764, 1812, 1779, 1813,
- /* 490 */ 1780, 1816, 1795, 1800, 1818, 1678, 1787, 1821, 1647, 1805,
- /* 500 */ 1697, 1687, 1828, 1829, 1700, 1699, 1827, 1832, 1833, 1834,
- /* 510 */ 1742, 1747, 1804, 1698, 1842, 1751, 1711, 1754, 1843, 1809,
- /* 520 */ 1715, 1758, 1773, 1831, 1835, 1638, 1794, 1799, 1801, 1802,
- /* 530 */ 1803, 1808, 1845, 1810, 1815, 1817, 1820, 1822, 1846, 1844,
- /* 540 */ 1849, 1824, 1848, 1709, 1825, 1826, 1852, 1701, 1856, 1857,
- /* 550 */ 1860, 1830, 1899, 1866, 1710, 1876, 1879, 1880, 1883, 1886,
- /* 560 */ 1887, 1921, 1903, 1728, 1884, 1836, 1838, 1840, 1850, 1854,
- /* 570 */ 1855, 1896, 1858, 1861, 1897, 1827, 1928, 1760, 1864, 1859,
- /* 580 */ 1865, 1923, 1926, 1869, 1871, 1931, 1874, 1878, 1933, 1877,
- /* 590 */ 1881, 1938, 1888, 1882, 1939, 1898, 1862, 1873, 1875, 1889,
- /* 600 */ 1955, 1891, 1904, 1914, 1973, 1916, 1967, 1967, 1989, 1950,
- /* 610 */ 1952, 1980, 1981, 1982, 1984, 1985, 1986, 1995, 1996, 1998,
- /* 620 */ 1999, 1968, 1944, 1994, 2003, 2004, 2019, 2008, 2022, 2011,
- /* 630 */ 2013, 2014, 1983, 1745, 2017, 1746, 2018, 2023, 2024, 2025,
- /* 640 */ 2032, 2026, 2062, 2028, 2020, 2027, 2065, 2033, 2035, 2034,
- /* 650 */ 2072, 2048, 2043, 2053, 2093, 2060, 2050, 2067, 2104, 2074,
- /* 660 */ 2075, 2107, 2089, 2091, 2092, 2094, 2096, 2095,
+ /* 0 */ 1068, 0, 57, 265, 57, 322, 322, 322, 530, 322,
+ /* 10 */ 322, 322, 322, 322, 587, 795, 852, 795, 795, 795,
+ /* 20 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795,
+ /* 30 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795,
+ /* 40 */ 795, 795, 795, 795, 16, 266, 39, 208, 269, 14,
+ /* 50 */ 59, 14, 39, 39, 1435, 1435, 14, 1435, 1435, 62,
+ /* 60 */ 14, 17, 17, 13, 13, 268, 17, 17, 17, 17,
+ /* 70 */ 17, 17, 17, 17, 17, 17, 68, 17, 17, 17,
+ /* 80 */ 171, 17, 17, 442, 17, 17, 442, 502, 17, 442,
+ /* 90 */ 442, 442, 17, 163, 998, 889, 889, 429, 524, 524,
+ /* 100 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524,
+ /* 110 */ 524, 524, 524, 524, 524, 524, 524, 470, 621, 12,
+ /* 120 */ 268, 58, 58, 327, 328, 438, 101, 101, 9, 9,
+ /* 130 */ 9, 328, 574, 574, 171, 2, 2, 63, 442, 442,
+ /* 140 */ 381, 381, 233, 440, 196, 196, 196, 196, 196, 196,
+ /* 150 */ 196, 859, 402, 337, 34, 43, 552, 179, 427, 630,
+ /* 160 */ 232, 791, 804, 334, 753, 748, 497, 753, 922, 965,
+ /* 170 */ 828, 989, 1194, 1081, 1216, 1250, 1250, 1216, 1138, 1138,
+ /* 180 */ 1250, 1250, 1250, 1291, 1291, 1293, 68, 171, 68, 1309,
+ /* 190 */ 1314, 68, 1309, 68, 68, 68, 1250, 68, 1291, 442,
+ /* 200 */ 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
+ /* 210 */ 1250, 1291, 381, 1293, 163, 1206, 171, 163, 1250, 1250,
+ /* 220 */ 1309, 163, 1148, 381, 381, 381, 381, 1148, 381, 1236,
+ /* 230 */ 163, 233, 163, 574, 1393, 381, 1179, 1148, 381, 381,
+ /* 240 */ 1179, 1148, 381, 381, 442, 1202, 1288, 1179, 1208, 1204,
+ /* 250 */ 1215, 989, 1200, 1205, 1211, 1233, 574, 1452, 1380, 1386,
+ /* 260 */ 381, 440, 1250, 163, 1473, 1291, 2662, 2662, 2662, 2662,
+ /* 270 */ 2662, 2662, 2662, 1103, 529, 485, 1238, 234, 396, 479,
+ /* 280 */ 764, 825, 914, 718, 925, 925, 925, 925, 925, 925,
+ /* 290 */ 925, 925, 925, 1092, 488, 11, 11, 6, 205, 203,
+ /* 300 */ 584, 242, 637, 421, 699, 941, 729, 699, 699, 699,
+ /* 310 */ 928, 1032, 999, 944, 977, 988, 1007, 995, 1075, 1089,
+ /* 320 */ 805, 861, 1065, 1069, 1112, 1115, 1117, 1121, 1128, 1002,
+ /* 330 */ 1044, 513, 1127, 1155, 921, 1160, 1035, 1161, 1153, 1159,
+ /* 340 */ 1186, 1188, 1196, 1203, 1207, 1210, 843, 1197, 1213, 884,
+ /* 350 */ 1221, 1525, 1534, 1345, 1528, 1529, 1488, 1531, 1497, 1343,
+ /* 360 */ 1501, 1502, 1503, 1347, 1540, 1507, 1508, 1352, 1545, 1355,
+ /* 370 */ 1551, 1517, 1561, 1541, 1564, 1530, 1389, 1392, 1568, 1570,
+ /* 380 */ 1401, 1413, 1585, 1586, 1542, 1587, 1590, 1592, 1552, 1593,
+ /* 390 */ 1597, 1598, 1446, 1600, 1601, 1602, 1603, 1604, 1457, 1571,
+ /* 400 */ 1607, 1460, 1609, 1611, 1613, 1614, 1615, 1616, 1618, 1619,
+ /* 410 */ 1620, 1621, 1622, 1623, 1624, 1626, 1589, 1627, 1628, 1629,
+ /* 420 */ 1635, 1636, 1637, 1617, 1638, 1640, 1641, 1642, 1643, 1625,
+ /* 430 */ 1652, 1630, 1653, 1654, 1631, 1632, 1633, 1644, 1610, 1661,
+ /* 440 */ 1645, 1657, 1634, 1639, 1677, 1679, 1682, 1649, 1518, 1683,
+ /* 450 */ 1689, 1690, 1647, 1692, 1693, 1659, 1648, 1662, 1696, 1663,
+ /* 460 */ 1655, 1664, 1699, 1665, 1658, 1667, 1704, 1672, 1666, 1669,
+ /* 470 */ 1711, 1712, 1722, 1724, 1650, 1651, 1691, 1705, 1728, 1694,
+ /* 480 */ 1695, 1688, 1698, 1697, 1700, 1714, 1734, 1717, 1737, 1720,
+ /* 490 */ 1701, 1743, 1723, 1709, 1746, 1713, 1747, 1718, 1754, 1733,
+ /* 500 */ 1736, 1757, 1680, 1725, 1758, 1581, 1740, 1702, 1605, 1778,
+ /* 510 */ 1779, 1706, 1675, 1777, 1781, 1782, 1784, 1703, 1707, 1751,
+ /* 520 */ 1606, 1787, 1716, 1684, 1719, 1791, 1756, 1656, 1760, 1710,
+ /* 530 */ 1752, 1762, 1579, 1578, 1588, 1763, 1566, 1765, 1761, 1766,
+ /* 540 */ 1768, 1769, 1773, 1774, 1775, 1780, 1785, 1788, 1783, 1813,
+ /* 550 */ 1764, 1814, 1789, 1818, 1670, 1786, 1795, 1864, 1831, 1686,
+ /* 560 */ 1840, 1848, 1850, 1852, 1855, 1856, 1798, 1800, 1851, 1708,
+ /* 570 */ 1853, 1861, 1877, 1896, 1888, 1726, 1832, 1834, 1837, 1838,
+ /* 580 */ 1842, 1839, 1885, 1844, 1845, 1893, 1847, 1920, 1744, 1854,
+ /* 590 */ 1841, 1858, 1911, 1914, 1857, 1860, 1921, 1865, 1863, 1925,
+ /* 600 */ 1868, 1879, 1936, 1881, 1883, 1940, 1886, 1875, 1876, 1878,
+ /* 610 */ 1880, 1958, 1889, 1903, 1906, 1946, 1907, 1959, 1959, 1979,
+ /* 620 */ 1944, 1947, 1972, 1974, 1975, 1976, 1978, 1980, 1981, 1983,
+ /* 630 */ 1985, 1986, 1954, 1923, 1982, 1988, 1989, 2004, 1992, 2007,
+ /* 640 */ 1995, 2005, 2008, 1977, 1688, 2009, 1698, 2019, 2021, 2023,
+ /* 650 */ 2025, 2039, 2027, 2063, 2029, 2022, 2026, 2066, 2033, 2024,
+ /* 660 */ 2031, 2073, 2040, 2030, 2037, 2078, 2044, 2034, 2041, 2082,
+ /* 670 */ 2049, 2051, 2087, 2067, 2069, 2070, 2072, 2074, 2068,
};
-#define YY_REDUCE_COUNT (266)
-#define YY_REDUCE_MIN (-383)
-#define YY_REDUCE_MAX (1806)
+#define YY_REDUCE_COUNT (272)
+#define YY_REDUCE_MIN (-395)
+#define YY_REDUCE_MAX (2266)
static const short yy_reduce_ofst[] = {
- /* 0 */ 212, -308, -68, 882, 48, 427, 617, 935, -288, 949,
- /* 10 */ 205, 677, 999, 783, 1025, 1039, 1092, 1118, 1142, 1200,
- /* 20 */ 1252, 1262, 1314, 1338, 1362, 1378, 1418, 1471, 1483, 1497,
- /* 30 */ 1552, 1600, 1616, 1640, 1692, 1702, 1716, 1784, 1796, 1806,
- /* 40 */ 315, 102, 307, 122, 409, 418, 492, 600, 470, 577,
- /* 50 */ -336, 173, -372, -2, 410, -335, 155, -50, 431, -316,
- /* 60 */ -311, -317, -92, -53, 441, 454, 736, 770, 777, 778,
- /* 70 */ 861, 865, -280, 866, 870, 880, -346, 892, 900, -301,
- /* 80 */ 914, 950, -74, -268, 953, 46, 403, 452, 1070, 9,
- /* 90 */ -274, -383, -383, -383, -290, -79, 136, 149, 193, 387,
- /* 100 */ 469, 488, 494, 521, 605, 618, 620, 623, 654, 680,
- /* 110 */ 684, 776, 782, 809, -176, -243, -273, -292, -138, 192,
- /* 120 */ -33, -158, -258, -273, 267, 447, -102, 489, 490, -253,
- /* 130 */ 545, 595, 32, 103, 504, 578, 648, 639, -326, 220,
- /* 140 */ 285, 457, 480, 511, 517, 544, 516, 497, 712, 701,
- /* 150 */ 726, 681, 714, 714, 806, 879, 832, 808, 797, 797,
- /* 160 */ 797, 816, 815, 830, 714, 887, 907, 922, 934, 985,
- /* 170 */ 986, 952, 956, 957, 996, 1005, 1006, 1016, 1026, 975,
- /* 180 */ 1029, 1000, 1040, 991, 998, 1044, 1002, 1047, 1048, 1050,
- /* 190 */ 1055, 1052, 1075, 1053, 1057, 1058, 1059, 1060, 1062, 1066,
- /* 200 */ 1073, 1076, 1079, 1080, 1095, 1081, 1082, 1031, 1105, 1061,
- /* 210 */ 1083, 1109, 1116, 1117, 1072, 1111, 1086, 1089, 1090, 1091,
- /* 220 */ 1093, 1087, 1098, 1096, 1130, 1119, 1134, 1114, 1084, 1107,
- /* 230 */ 1049, 1101, 1115, 1127, 1069, 1104, 1135, 1136, 714, 1067,
- /* 240 */ 1077, 1071, 1097, 1099, 1088, 1122, 797, 1158, 1137, 1102,
- /* 250 */ 1110, 1106, 1120, 1178, 1179, 1204, 1216, 1217, 1226, 1228,
- /* 260 */ 1172, 1180, 1210, 1213, 1215, 1227, 1242,
+ /* 0 */ -268, 886, -249, -162, -306, 275, 968, 1028, 1050, -21,
+ /* 10 */ 368, 1106, 1167, 1189, 1273, 1328, 1381, 467, 1433, 1445,
+ /* 20 */ 1459, 1513, 1527, 1577, 1596, 1646, 1660, 1715, 1741, 1767,
+ /* 30 */ 1793, 1819, 1871, 1887, 1949, 1965, 2018, 2032, 2086, 2110,
+ /* 40 */ 2136, 2188, 2204, 2266, -11, 200, 237, 459, 544, 664,
+ /* 50 */ 879, 911, -131, 286, -341, -222, -387, -307, -201, -252,
+ /* 60 */ 777, -324, -321, -316, -260, -232, -233, 8, 83, 166,
+ /* 70 */ 243, 302, 317, 354, 547, 583, 229, 624, 625, 631,
+ /* 80 */ 77, 633, 638, -289, 691, 749, -175, -279, 758, 211,
+ /* 90 */ -4, 476, 872, 264, -227, -395, -395, -203, 32, 132,
+ /* 100 */ 261, 326, 395, 408, 453, 465, 468, 493, 536, 564,
+ /* 110 */ 601, 662, 676, 715, 721, 723, 726, -121, -133, 135,
+ /* 120 */ -211, -27, 92, 230, 223, 118, -235, 294, 135, 220,
+ /* 130 */ 369, 483, 356, 514, 510, 500, 505, 104, 377, 312,
+ /* 140 */ 60, 464, 607, 549, -326, -293, 204, 263, 283, 308,
+ /* 150 */ 522, 350, 567, 452, 563, 558, 799, 727, 704, 704,
+ /* 160 */ 832, 839, 844, 816, 808, 808, 782, 808, 817, 809,
+ /* 170 */ 704, 854, 865, 892, 896, 962, 963, 927, 936, 940,
+ /* 180 */ 982, 983, 984, 1000, 1001, 945, 996, 967, 1003, 961,
+ /* 190 */ 966, 1008, 964, 1010, 1012, 1015, 1021, 1020, 1031, 1009,
+ /* 200 */ 1018, 1023, 1025, 1027, 1029, 1033, 1034, 1037, 1038, 1039,
+ /* 210 */ 1040, 1047, 994, 974, 1053, 1011, 1017, 1063, 1066, 1067,
+ /* 220 */ 1022, 1070, 1030, 1041, 1042, 1043, 1046, 1045, 1048, 1036,
+ /* 230 */ 1078, 1071, 1080, 1056, 1061, 1072, 1004, 1058, 1074, 1076,
+ /* 240 */ 1026, 1059, 1094, 1095, 704, 1049, 1051, 1054, 1052, 1057,
+ /* 250 */ 1062, 1079, 1024, 1055, 1077, 808, 1119, 1100, 1082, 1142,
+ /* 260 */ 1143, 1168, 1180, 1181, 1195, 1198, 1140, 1147, 1182, 1183,
+ /* 270 */ 1184, 1191, 1209,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 10 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 20 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 30 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 40 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 50 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 60 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 70 */ 1479, 1479, 1553, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 80 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1551,
- /* 90 */ 1716, 1479, 1891, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 100 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 110 */ 1479, 1479, 1479, 1479, 1479, 1479, 1903, 1479, 1479, 1479,
- /* 120 */ 1553, 1479, 1551, 1903, 1903, 1903, 1479, 1479, 1479, 1479,
- /* 130 */ 1757, 1757, 1479, 1479, 1479, 1479, 1656, 1479, 1479, 1479,
- /* 140 */ 1479, 1479, 1479, 1479, 1479, 1751, 1479, 1975, 1479, 1479,
- /* 150 */ 1479, 1926, 1479, 1479, 1479, 1479, 1609, 1918, 1895, 1909,
- /* 160 */ 1896, 1893, 1960, 1912, 1479, 1922, 1479, 1744, 1721, 1479,
- /* 170 */ 1479, 1721, 1718, 1718, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 180 */ 1553, 1479, 1553, 1479, 1479, 1553, 1479, 1553, 1553, 1553,
- /* 190 */ 1479, 1553, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 200 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1551, 1753,
- /* 210 */ 1479, 1551, 1479, 1479, 1479, 1551, 1931, 1479, 1479, 1479,
- /* 220 */ 1479, 1931, 1479, 1479, 1551, 1479, 1551, 1479, 1479, 1479,
- /* 230 */ 1933, 1931, 1479, 1479, 1933, 1931, 1479, 1479, 1479, 1945,
- /* 240 */ 1941, 1933, 1949, 1947, 1924, 1922, 1909, 1479, 1479, 1978,
- /* 250 */ 1966, 1962, 1479, 1625, 1479, 1479, 1479, 1551, 1511, 1479,
- /* 260 */ 1746, 1757, 1659, 1659, 1659, 1554, 1484, 1479, 1479, 1479,
- /* 270 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1828,
- /* 280 */ 1944, 1943, 1867, 1866, 1865, 1863, 1827, 1479, 1621, 1826,
- /* 290 */ 1825, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 300 */ 1819, 1820, 1818, 1817, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 310 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 320 */ 1479, 1479, 1479, 1892, 1479, 1963, 1967, 1479, 1479, 1479,
- /* 330 */ 1479, 1479, 1803, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 340 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 350 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 360 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 370 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 380 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 390 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 400 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 410 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 420 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1516,
- /* 430 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 440 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 450 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 460 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 470 */ 1479, 1479, 1479, 1479, 1592, 1591, 1479, 1479, 1479, 1479,
- /* 480 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 490 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 500 */ 1479, 1479, 1479, 1479, 1479, 1479, 1959, 1479, 1479, 1479,
- /* 510 */ 1479, 1479, 1479, 1479, 1761, 1479, 1479, 1479, 1479, 1479,
- /* 520 */ 1479, 1479, 1479, 1479, 1925, 1479, 1479, 1479, 1479, 1479,
- /* 530 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 540 */ 1803, 1479, 1942, 1479, 1902, 1898, 1479, 1479, 1894, 1802,
- /* 550 */ 1479, 1479, 1479, 1961, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 560 */ 1479, 1887, 1479, 1479, 1860, 1845, 1479, 1479, 1479, 1479,
- /* 570 */ 1479, 1479, 1479, 1479, 1479, 1815, 1479, 1813, 1479, 1479,
- /* 580 */ 1479, 1479, 1479, 1653, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 590 */ 1479, 1479, 1479, 1479, 1479, 1479, 1638, 1636, 1635, 1634,
- /* 600 */ 1479, 1631, 1479, 1479, 1479, 1479, 1662, 1661, 1479, 1479,
- /* 610 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 620 */ 1479, 1479, 1479, 1573, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 630 */ 1479, 1479, 1479, 1564, 1479, 1563, 1479, 1479, 1479, 1479,
- /* 640 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 650 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
- /* 660 */ 1479, 1479, 1479, 1479, 1479, 1479, 1479, 1479,
+ /* 0 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 10 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 20 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 30 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 40 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 50 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 60 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 70 */ 1509, 1509, 1509, 1509, 1509, 1509, 1583, 1509, 1509, 1509,
+ /* 80 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 90 */ 1509, 1509, 1509, 1581, 1746, 1930, 1509, 1509, 1509, 1509,
+ /* 100 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 110 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1942,
+ /* 120 */ 1509, 1509, 1509, 1583, 1509, 1581, 1902, 1902, 1942, 1942,
+ /* 130 */ 1942, 1509, 1509, 1509, 1509, 1787, 1787, 1509, 1509, 1509,
+ /* 140 */ 1509, 1509, 1686, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 150 */ 1509, 1781, 1509, 2015, 1509, 1509, 1509, 1965, 1509, 1509,
+ /* 160 */ 1509, 1509, 1639, 1957, 1934, 1948, 1999, 1935, 1932, 1951,
+ /* 170 */ 1509, 1961, 1509, 1774, 1751, 1509, 1509, 1751, 1748, 1748,
+ /* 180 */ 1509, 1509, 1509, 1509, 1509, 1509, 1583, 1509, 1583, 1509,
+ /* 190 */ 1509, 1583, 1509, 1583, 1583, 1583, 1509, 1583, 1509, 1509,
+ /* 200 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 210 */ 1509, 1509, 1509, 1509, 1581, 1783, 1509, 1581, 1509, 1509,
+ /* 220 */ 1509, 1581, 1970, 1509, 1509, 1509, 1509, 1970, 1509, 1509,
+ /* 230 */ 1581, 1509, 1581, 1509, 1509, 1509, 1972, 1970, 1509, 1509,
+ /* 240 */ 1972, 1970, 1509, 1509, 1509, 1984, 1980, 1972, 1988, 1986,
+ /* 250 */ 1963, 1961, 2018, 2005, 2001, 1948, 1509, 1509, 1509, 1655,
+ /* 260 */ 1509, 1509, 1509, 1581, 1541, 1509, 1776, 1787, 1689, 1689,
+ /* 270 */ 1689, 1584, 1514, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 280 */ 1509, 1509, 1509, 1509, 1860, 1509, 1983, 1982, 1906, 1905,
+ /* 290 */ 1904, 1895, 1859, 1509, 1651, 1858, 1857, 1509, 1509, 1509,
+ /* 300 */ 1509, 1509, 1509, 1509, 1851, 1509, 1509, 1852, 1850, 1849,
+ /* 310 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 320 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 330 */ 2002, 2006, 1931, 1509, 1509, 1509, 1509, 1509, 1842, 1833,
+ /* 340 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 350 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 360 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 370 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 380 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 390 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 400 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 410 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 420 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 430 */ 1509, 1509, 1509, 1509, 1509, 1509, 1546, 1509, 1509, 1509,
+ /* 440 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 450 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 460 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 470 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 480 */ 1509, 1622, 1621, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 490 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 500 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 510 */ 1509, 1509, 1509, 1998, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 520 */ 1509, 1791, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 530 */ 1509, 1892, 1509, 1509, 1509, 1964, 1509, 1509, 1509, 1509,
+ /* 540 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 550 */ 1509, 1833, 1509, 1981, 1509, 1509, 1996, 1509, 2000, 1509,
+ /* 560 */ 1509, 1509, 1509, 1509, 1509, 1509, 1941, 1937, 1509, 1509,
+ /* 570 */ 1933, 1832, 1509, 1926, 1509, 1509, 1877, 1509, 1509, 1509,
+ /* 580 */ 1509, 1509, 1509, 1509, 1509, 1509, 1841, 1509, 1845, 1509,
+ /* 590 */ 1509, 1509, 1509, 1509, 1683, 1509, 1509, 1509, 1509, 1509,
+ /* 600 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1668, 1666, 1665,
+ /* 610 */ 1664, 1509, 1661, 1509, 1509, 1509, 1509, 1692, 1691, 1509,
+ /* 620 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 630 */ 1509, 1509, 1509, 1509, 1603, 1509, 1509, 1509, 1509, 1509,
+ /* 640 */ 1509, 1509, 1509, 1509, 1594, 1509, 1593, 1509, 1509, 1509,
+ /* 650 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 660 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
+ /* 670 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1094,6 +1168,11 @@ static const YYCODETYPE yyFallback[] = {
0, /* CURRENT_USER => nothing */
0, /* COUNT => nothing */
0, /* LAST_ROW => nothing */
+ 0, /* CASE => nothing */
+ 261, /* END => ABORT */
+ 0, /* WHEN => nothing */
+ 0, /* THEN => nothing */
+ 0, /* ELSE => nothing */
0, /* BETWEEN => nothing */
0, /* IS => nothing */
0, /* NK_LT => nothing */
@@ -1132,58 +1211,57 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 256, /* AFTER => ABORT */
- 256, /* ATTACH => ABORT */
- 256, /* BEFORE => ABORT */
- 256, /* BEGIN => ABORT */
- 256, /* BITAND => ABORT */
- 256, /* BITNOT => ABORT */
- 256, /* BITOR => ABORT */
- 256, /* BLOCKS => ABORT */
- 256, /* CHANGE => ABORT */
- 256, /* COMMA => ABORT */
- 256, /* COMPACT => ABORT */
- 256, /* CONCAT => ABORT */
- 256, /* CONFLICT => ABORT */
- 256, /* COPY => ABORT */
- 256, /* DEFERRED => ABORT */
- 256, /* DELIMITERS => ABORT */
- 256, /* DETACH => ABORT */
- 256, /* DIVIDE => ABORT */
- 256, /* DOT => ABORT */
- 256, /* EACH => ABORT */
- 256, /* END => ABORT */
- 256, /* FAIL => ABORT */
- 256, /* FILE => ABORT */
- 256, /* FOR => ABORT */
- 256, /* GLOB => ABORT */
- 256, /* ID => ABORT */
- 256, /* IMMEDIATE => ABORT */
- 256, /* IMPORT => ABORT */
- 256, /* INITIALLY => ABORT */
- 256, /* INSTEAD => ABORT */
- 256, /* ISNULL => ABORT */
- 256, /* KEY => ABORT */
- 256, /* NK_BITNOT => ABORT */
- 256, /* NK_SEMI => ABORT */
- 256, /* NOTNULL => ABORT */
- 256, /* OF => ABORT */
- 256, /* PLUS => ABORT */
- 256, /* PRIVILEGE => ABORT */
- 256, /* RAISE => ABORT */
- 256, /* REPLACE => ABORT */
- 256, /* RESTRICT => ABORT */
- 256, /* ROW => ABORT */
- 256, /* SEMI => ABORT */
- 256, /* STAR => ABORT */
- 256, /* STATEMENT => ABORT */
- 256, /* STRING => ABORT */
- 256, /* TIMES => ABORT */
- 256, /* UPDATE => ABORT */
- 256, /* VALUES => ABORT */
- 256, /* VARIABLE => ABORT */
- 256, /* VIEW => ABORT */
- 256, /* WAL => ABORT */
+ 261, /* AFTER => ABORT */
+ 261, /* ATTACH => ABORT */
+ 261, /* BEFORE => ABORT */
+ 261, /* BEGIN => ABORT */
+ 261, /* BITAND => ABORT */
+ 261, /* BITNOT => ABORT */
+ 261, /* BITOR => ABORT */
+ 261, /* BLOCKS => ABORT */
+ 261, /* CHANGE => ABORT */
+ 261, /* COMMA => ABORT */
+ 261, /* COMPACT => ABORT */
+ 261, /* CONCAT => ABORT */
+ 261, /* CONFLICT => ABORT */
+ 261, /* COPY => ABORT */
+ 261, /* DEFERRED => ABORT */
+ 261, /* DELIMITERS => ABORT */
+ 261, /* DETACH => ABORT */
+ 261, /* DIVIDE => ABORT */
+ 261, /* DOT => ABORT */
+ 261, /* EACH => ABORT */
+ 261, /* FAIL => ABORT */
+ 261, /* FILE => ABORT */
+ 261, /* FOR => ABORT */
+ 261, /* GLOB => ABORT */
+ 261, /* ID => ABORT */
+ 261, /* IMMEDIATE => ABORT */
+ 261, /* IMPORT => ABORT */
+ 261, /* INITIALLY => ABORT */
+ 261, /* INSTEAD => ABORT */
+ 261, /* ISNULL => ABORT */
+ 261, /* KEY => ABORT */
+ 261, /* NK_BITNOT => ABORT */
+ 261, /* NK_SEMI => ABORT */
+ 261, /* NOTNULL => ABORT */
+ 261, /* OF => ABORT */
+ 261, /* PLUS => ABORT */
+ 261, /* PRIVILEGE => ABORT */
+ 261, /* RAISE => ABORT */
+ 261, /* REPLACE => ABORT */
+ 261, /* RESTRICT => ABORT */
+ 261, /* ROW => ABORT */
+ 261, /* SEMI => ABORT */
+ 261, /* STAR => ABORT */
+ 261, /* STATEMENT => ABORT */
+ 261, /* STRING => ABORT */
+ 261, /* TIMES => ABORT */
+ 261, /* UPDATE => ABORT */
+ 261, /* VALUES => ABORT */
+ 261, /* VARIABLE => ABORT */
+ 261, /* VIEW => ABORT */
+ 261, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -1490,219 +1568,228 @@ static const char *const yyTokenName[] = {
/* 216 */ "CURRENT_USER",
/* 217 */ "COUNT",
/* 218 */ "LAST_ROW",
- /* 219 */ "BETWEEN",
- /* 220 */ "IS",
- /* 221 */ "NK_LT",
- /* 222 */ "NK_GT",
- /* 223 */ "NK_LE",
- /* 224 */ "NK_GE",
- /* 225 */ "NK_NE",
- /* 226 */ "MATCH",
- /* 227 */ "NMATCH",
- /* 228 */ "CONTAINS",
- /* 229 */ "IN",
- /* 230 */ "JOIN",
- /* 231 */ "INNER",
- /* 232 */ "SELECT",
- /* 233 */ "DISTINCT",
- /* 234 */ "WHERE",
- /* 235 */ "PARTITION",
- /* 236 */ "BY",
- /* 237 */ "SESSION",
- /* 238 */ "STATE_WINDOW",
- /* 239 */ "SLIDING",
- /* 240 */ "FILL",
- /* 241 */ "VALUE",
- /* 242 */ "NONE",
- /* 243 */ "PREV",
- /* 244 */ "LINEAR",
- /* 245 */ "NEXT",
- /* 246 */ "HAVING",
- /* 247 */ "RANGE",
- /* 248 */ "EVERY",
- /* 249 */ "ORDER",
- /* 250 */ "SLIMIT",
- /* 251 */ "SOFFSET",
- /* 252 */ "LIMIT",
- /* 253 */ "OFFSET",
- /* 254 */ "ASC",
- /* 255 */ "NULLS",
- /* 256 */ "ABORT",
- /* 257 */ "AFTER",
- /* 258 */ "ATTACH",
- /* 259 */ "BEFORE",
- /* 260 */ "BEGIN",
- /* 261 */ "BITAND",
- /* 262 */ "BITNOT",
- /* 263 */ "BITOR",
- /* 264 */ "BLOCKS",
- /* 265 */ "CHANGE",
- /* 266 */ "COMMA",
- /* 267 */ "COMPACT",
- /* 268 */ "CONCAT",
- /* 269 */ "CONFLICT",
- /* 270 */ "COPY",
- /* 271 */ "DEFERRED",
- /* 272 */ "DELIMITERS",
- /* 273 */ "DETACH",
- /* 274 */ "DIVIDE",
- /* 275 */ "DOT",
- /* 276 */ "EACH",
- /* 277 */ "END",
- /* 278 */ "FAIL",
- /* 279 */ "FILE",
- /* 280 */ "FOR",
- /* 281 */ "GLOB",
- /* 282 */ "ID",
- /* 283 */ "IMMEDIATE",
- /* 284 */ "IMPORT",
- /* 285 */ "INITIALLY",
- /* 286 */ "INSTEAD",
- /* 287 */ "ISNULL",
- /* 288 */ "KEY",
- /* 289 */ "NK_BITNOT",
- /* 290 */ "NK_SEMI",
- /* 291 */ "NOTNULL",
- /* 292 */ "OF",
- /* 293 */ "PLUS",
- /* 294 */ "PRIVILEGE",
- /* 295 */ "RAISE",
- /* 296 */ "REPLACE",
- /* 297 */ "RESTRICT",
- /* 298 */ "ROW",
- /* 299 */ "SEMI",
- /* 300 */ "STAR",
- /* 301 */ "STATEMENT",
- /* 302 */ "STRING",
- /* 303 */ "TIMES",
- /* 304 */ "UPDATE",
- /* 305 */ "VALUES",
- /* 306 */ "VARIABLE",
- /* 307 */ "VIEW",
- /* 308 */ "WAL",
- /* 309 */ "cmd",
- /* 310 */ "account_options",
- /* 311 */ "alter_account_options",
- /* 312 */ "literal",
- /* 313 */ "alter_account_option",
- /* 314 */ "user_name",
- /* 315 */ "sysinfo_opt",
- /* 316 */ "privileges",
- /* 317 */ "priv_level",
- /* 318 */ "priv_type_list",
- /* 319 */ "priv_type",
- /* 320 */ "db_name",
- /* 321 */ "dnode_endpoint",
- /* 322 */ "not_exists_opt",
- /* 323 */ "db_options",
- /* 324 */ "exists_opt",
- /* 325 */ "alter_db_options",
- /* 326 */ "integer_list",
- /* 327 */ "variable_list",
- /* 328 */ "retention_list",
- /* 329 */ "alter_db_option",
- /* 330 */ "retention",
- /* 331 */ "full_table_name",
- /* 332 */ "column_def_list",
- /* 333 */ "tags_def_opt",
- /* 334 */ "table_options",
- /* 335 */ "multi_create_clause",
- /* 336 */ "tags_def",
- /* 337 */ "multi_drop_clause",
- /* 338 */ "alter_table_clause",
- /* 339 */ "alter_table_options",
- /* 340 */ "column_name",
- /* 341 */ "type_name",
- /* 342 */ "signed_literal",
- /* 343 */ "create_subtable_clause",
- /* 344 */ "specific_cols_opt",
- /* 345 */ "expression_list",
- /* 346 */ "drop_table_clause",
- /* 347 */ "col_name_list",
- /* 348 */ "table_name",
- /* 349 */ "column_def",
- /* 350 */ "duration_list",
- /* 351 */ "rollup_func_list",
- /* 352 */ "alter_table_option",
- /* 353 */ "duration_literal",
- /* 354 */ "rollup_func_name",
- /* 355 */ "function_name",
- /* 356 */ "col_name",
- /* 357 */ "db_name_cond_opt",
- /* 358 */ "like_pattern_opt",
- /* 359 */ "table_name_cond",
- /* 360 */ "from_db_opt",
- /* 361 */ "index_options",
- /* 362 */ "func_list",
- /* 363 */ "sliding_opt",
- /* 364 */ "sma_stream_opt",
- /* 365 */ "func",
- /* 366 */ "stream_options",
- /* 367 */ "topic_name",
- /* 368 */ "query_or_subquery",
- /* 369 */ "cgroup_name",
- /* 370 */ "analyze_opt",
- /* 371 */ "explain_options",
- /* 372 */ "agg_func_opt",
- /* 373 */ "bufsize_opt",
- /* 374 */ "stream_name",
- /* 375 */ "dnode_list",
- /* 376 */ "where_clause_opt",
- /* 377 */ "signed",
- /* 378 */ "literal_func",
- /* 379 */ "literal_list",
- /* 380 */ "table_alias",
- /* 381 */ "column_alias",
- /* 382 */ "expression",
- /* 383 */ "pseudo_column",
- /* 384 */ "column_reference",
- /* 385 */ "function_expression",
- /* 386 */ "subquery",
- /* 387 */ "star_func",
- /* 388 */ "star_func_para_list",
- /* 389 */ "noarg_func",
- /* 390 */ "other_para_list",
- /* 391 */ "star_func_para",
- /* 392 */ "predicate",
- /* 393 */ "compare_op",
- /* 394 */ "in_op",
- /* 395 */ "in_predicate_value",
- /* 396 */ "boolean_value_expression",
- /* 397 */ "boolean_primary",
- /* 398 */ "common_expression",
- /* 399 */ "from_clause_opt",
- /* 400 */ "table_reference_list",
- /* 401 */ "table_reference",
- /* 402 */ "table_primary",
- /* 403 */ "joined_table",
- /* 404 */ "alias_opt",
- /* 405 */ "parenthesized_joined_table",
- /* 406 */ "join_type",
- /* 407 */ "search_condition",
- /* 408 */ "query_specification",
- /* 409 */ "set_quantifier_opt",
- /* 410 */ "select_list",
- /* 411 */ "partition_by_clause_opt",
- /* 412 */ "range_opt",
- /* 413 */ "every_opt",
- /* 414 */ "fill_opt",
- /* 415 */ "twindow_clause_opt",
- /* 416 */ "group_by_clause_opt",
- /* 417 */ "having_clause_opt",
- /* 418 */ "select_item",
- /* 419 */ "fill_mode",
- /* 420 */ "group_by_list",
- /* 421 */ "query_expression",
- /* 422 */ "query_simple",
- /* 423 */ "order_by_clause_opt",
- /* 424 */ "slimit_clause_opt",
- /* 425 */ "limit_clause_opt",
- /* 426 */ "union_query_expression",
- /* 427 */ "query_simple_or_subquery",
- /* 428 */ "sort_specification_list",
- /* 429 */ "sort_specification",
- /* 430 */ "ordering_specification_opt",
- /* 431 */ "null_ordering_opt",
+ /* 219 */ "CASE",
+ /* 220 */ "END",
+ /* 221 */ "WHEN",
+ /* 222 */ "THEN",
+ /* 223 */ "ELSE",
+ /* 224 */ "BETWEEN",
+ /* 225 */ "IS",
+ /* 226 */ "NK_LT",
+ /* 227 */ "NK_GT",
+ /* 228 */ "NK_LE",
+ /* 229 */ "NK_GE",
+ /* 230 */ "NK_NE",
+ /* 231 */ "MATCH",
+ /* 232 */ "NMATCH",
+ /* 233 */ "CONTAINS",
+ /* 234 */ "IN",
+ /* 235 */ "JOIN",
+ /* 236 */ "INNER",
+ /* 237 */ "SELECT",
+ /* 238 */ "DISTINCT",
+ /* 239 */ "WHERE",
+ /* 240 */ "PARTITION",
+ /* 241 */ "BY",
+ /* 242 */ "SESSION",
+ /* 243 */ "STATE_WINDOW",
+ /* 244 */ "SLIDING",
+ /* 245 */ "FILL",
+ /* 246 */ "VALUE",
+ /* 247 */ "NONE",
+ /* 248 */ "PREV",
+ /* 249 */ "LINEAR",
+ /* 250 */ "NEXT",
+ /* 251 */ "HAVING",
+ /* 252 */ "RANGE",
+ /* 253 */ "EVERY",
+ /* 254 */ "ORDER",
+ /* 255 */ "SLIMIT",
+ /* 256 */ "SOFFSET",
+ /* 257 */ "LIMIT",
+ /* 258 */ "OFFSET",
+ /* 259 */ "ASC",
+ /* 260 */ "NULLS",
+ /* 261 */ "ABORT",
+ /* 262 */ "AFTER",
+ /* 263 */ "ATTACH",
+ /* 264 */ "BEFORE",
+ /* 265 */ "BEGIN",
+ /* 266 */ "BITAND",
+ /* 267 */ "BITNOT",
+ /* 268 */ "BITOR",
+ /* 269 */ "BLOCKS",
+ /* 270 */ "CHANGE",
+ /* 271 */ "COMMA",
+ /* 272 */ "COMPACT",
+ /* 273 */ "CONCAT",
+ /* 274 */ "CONFLICT",
+ /* 275 */ "COPY",
+ /* 276 */ "DEFERRED",
+ /* 277 */ "DELIMITERS",
+ /* 278 */ "DETACH",
+ /* 279 */ "DIVIDE",
+ /* 280 */ "DOT",
+ /* 281 */ "EACH",
+ /* 282 */ "FAIL",
+ /* 283 */ "FILE",
+ /* 284 */ "FOR",
+ /* 285 */ "GLOB",
+ /* 286 */ "ID",
+ /* 287 */ "IMMEDIATE",
+ /* 288 */ "IMPORT",
+ /* 289 */ "INITIALLY",
+ /* 290 */ "INSTEAD",
+ /* 291 */ "ISNULL",
+ /* 292 */ "KEY",
+ /* 293 */ "NK_BITNOT",
+ /* 294 */ "NK_SEMI",
+ /* 295 */ "NOTNULL",
+ /* 296 */ "OF",
+ /* 297 */ "PLUS",
+ /* 298 */ "PRIVILEGE",
+ /* 299 */ "RAISE",
+ /* 300 */ "REPLACE",
+ /* 301 */ "RESTRICT",
+ /* 302 */ "ROW",
+ /* 303 */ "SEMI",
+ /* 304 */ "STAR",
+ /* 305 */ "STATEMENT",
+ /* 306 */ "STRING",
+ /* 307 */ "TIMES",
+ /* 308 */ "UPDATE",
+ /* 309 */ "VALUES",
+ /* 310 */ "VARIABLE",
+ /* 311 */ "VIEW",
+ /* 312 */ "WAL",
+ /* 313 */ "cmd",
+ /* 314 */ "account_options",
+ /* 315 */ "alter_account_options",
+ /* 316 */ "literal",
+ /* 317 */ "alter_account_option",
+ /* 318 */ "user_name",
+ /* 319 */ "sysinfo_opt",
+ /* 320 */ "privileges",
+ /* 321 */ "priv_level",
+ /* 322 */ "priv_type_list",
+ /* 323 */ "priv_type",
+ /* 324 */ "db_name",
+ /* 325 */ "dnode_endpoint",
+ /* 326 */ "not_exists_opt",
+ /* 327 */ "db_options",
+ /* 328 */ "exists_opt",
+ /* 329 */ "alter_db_options",
+ /* 330 */ "integer_list",
+ /* 331 */ "variable_list",
+ /* 332 */ "retention_list",
+ /* 333 */ "alter_db_option",
+ /* 334 */ "retention",
+ /* 335 */ "full_table_name",
+ /* 336 */ "column_def_list",
+ /* 337 */ "tags_def_opt",
+ /* 338 */ "table_options",
+ /* 339 */ "multi_create_clause",
+ /* 340 */ "tags_def",
+ /* 341 */ "multi_drop_clause",
+ /* 342 */ "alter_table_clause",
+ /* 343 */ "alter_table_options",
+ /* 344 */ "column_name",
+ /* 345 */ "type_name",
+ /* 346 */ "signed_literal",
+ /* 347 */ "create_subtable_clause",
+ /* 348 */ "specific_cols_opt",
+ /* 349 */ "expression_list",
+ /* 350 */ "drop_table_clause",
+ /* 351 */ "col_name_list",
+ /* 352 */ "table_name",
+ /* 353 */ "column_def",
+ /* 354 */ "duration_list",
+ /* 355 */ "rollup_func_list",
+ /* 356 */ "alter_table_option",
+ /* 357 */ "duration_literal",
+ /* 358 */ "rollup_func_name",
+ /* 359 */ "function_name",
+ /* 360 */ "col_name",
+ /* 361 */ "db_name_cond_opt",
+ /* 362 */ "like_pattern_opt",
+ /* 363 */ "table_name_cond",
+ /* 364 */ "from_db_opt",
+ /* 365 */ "index_options",
+ /* 366 */ "func_list",
+ /* 367 */ "sliding_opt",
+ /* 368 */ "sma_stream_opt",
+ /* 369 */ "func",
+ /* 370 */ "stream_options",
+ /* 371 */ "topic_name",
+ /* 372 */ "query_or_subquery",
+ /* 373 */ "cgroup_name",
+ /* 374 */ "analyze_opt",
+ /* 375 */ "explain_options",
+ /* 376 */ "agg_func_opt",
+ /* 377 */ "bufsize_opt",
+ /* 378 */ "stream_name",
+ /* 379 */ "dnode_list",
+ /* 380 */ "where_clause_opt",
+ /* 381 */ "signed",
+ /* 382 */ "literal_func",
+ /* 383 */ "literal_list",
+ /* 384 */ "table_alias",
+ /* 385 */ "column_alias",
+ /* 386 */ "expr_or_subquery",
+ /* 387 */ "expression",
+ /* 388 */ "subquery",
+ /* 389 */ "pseudo_column",
+ /* 390 */ "column_reference",
+ /* 391 */ "function_expression",
+ /* 392 */ "case_when_expression",
+ /* 393 */ "star_func",
+ /* 394 */ "star_func_para_list",
+ /* 395 */ "noarg_func",
+ /* 396 */ "other_para_list",
+ /* 397 */ "star_func_para",
+ /* 398 */ "when_then_list",
+ /* 399 */ "case_when_else_opt",
+ /* 400 */ "common_expression",
+ /* 401 */ "when_then_expr",
+ /* 402 */ "predicate",
+ /* 403 */ "compare_op",
+ /* 404 */ "in_op",
+ /* 405 */ "in_predicate_value",
+ /* 406 */ "boolean_value_expression",
+ /* 407 */ "boolean_primary",
+ /* 408 */ "from_clause_opt",
+ /* 409 */ "table_reference_list",
+ /* 410 */ "table_reference",
+ /* 411 */ "table_primary",
+ /* 412 */ "joined_table",
+ /* 413 */ "alias_opt",
+ /* 414 */ "parenthesized_joined_table",
+ /* 415 */ "join_type",
+ /* 416 */ "search_condition",
+ /* 417 */ "query_specification",
+ /* 418 */ "set_quantifier_opt",
+ /* 419 */ "select_list",
+ /* 420 */ "partition_by_clause_opt",
+ /* 421 */ "range_opt",
+ /* 422 */ "every_opt",
+ /* 423 */ "fill_opt",
+ /* 424 */ "twindow_clause_opt",
+ /* 425 */ "group_by_clause_opt",
+ /* 426 */ "having_clause_opt",
+ /* 427 */ "select_item",
+ /* 428 */ "fill_mode",
+ /* 429 */ "group_by_list",
+ /* 430 */ "query_expression",
+ /* 431 */ "query_simple",
+ /* 432 */ "order_by_clause_opt",
+ /* 433 */ "slimit_clause_opt",
+ /* 434 */ "limit_clause_opt",
+ /* 435 */ "union_query_expression",
+ /* 436 */ "query_simple_or_subquery",
+ /* 437 */ "sort_specification_list",
+ /* 438 */ "sort_specification",
+ /* 439 */ "ordering_specification_opt",
+ /* 440 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2039,176 +2126,186 @@ static const char *const yyRuleName[] = {
/* 326 */ "topic_name ::= NK_ID",
/* 327 */ "stream_name ::= NK_ID",
/* 328 */ "cgroup_name ::= NK_ID",
- /* 329 */ "expression ::= literal",
- /* 330 */ "expression ::= pseudo_column",
- /* 331 */ "expression ::= column_reference",
- /* 332 */ "expression ::= function_expression",
- /* 333 */ "expression ::= subquery",
- /* 334 */ "expression ::= NK_LP expression NK_RP",
- /* 335 */ "expression ::= NK_PLUS expression",
- /* 336 */ "expression ::= NK_MINUS expression",
- /* 337 */ "expression ::= expression NK_PLUS expression",
- /* 338 */ "expression ::= expression NK_MINUS expression",
- /* 339 */ "expression ::= expression NK_STAR expression",
- /* 340 */ "expression ::= expression NK_SLASH expression",
- /* 341 */ "expression ::= expression NK_REM expression",
- /* 342 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 343 */ "expression ::= expression NK_BITAND expression",
- /* 344 */ "expression ::= expression NK_BITOR expression",
- /* 345 */ "expression_list ::= expression",
- /* 346 */ "expression_list ::= expression_list NK_COMMA expression",
- /* 347 */ "column_reference ::= column_name",
- /* 348 */ "column_reference ::= table_name NK_DOT column_name",
- /* 349 */ "pseudo_column ::= ROWTS",
- /* 350 */ "pseudo_column ::= TBNAME",
- /* 351 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 352 */ "pseudo_column ::= QSTART",
- /* 353 */ "pseudo_column ::= QEND",
- /* 354 */ "pseudo_column ::= QDURATION",
- /* 355 */ "pseudo_column ::= WSTART",
- /* 356 */ "pseudo_column ::= WEND",
- /* 357 */ "pseudo_column ::= WDURATION",
- /* 358 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 359 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 360 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
- /* 361 */ "function_expression ::= literal_func",
- /* 362 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 363 */ "literal_func ::= NOW",
- /* 364 */ "noarg_func ::= NOW",
- /* 365 */ "noarg_func ::= TODAY",
- /* 366 */ "noarg_func ::= TIMEZONE",
- /* 367 */ "noarg_func ::= DATABASE",
- /* 368 */ "noarg_func ::= CLIENT_VERSION",
- /* 369 */ "noarg_func ::= SERVER_VERSION",
- /* 370 */ "noarg_func ::= SERVER_STATUS",
- /* 371 */ "noarg_func ::= CURRENT_USER",
- /* 372 */ "noarg_func ::= USER",
- /* 373 */ "star_func ::= COUNT",
- /* 374 */ "star_func ::= FIRST",
- /* 375 */ "star_func ::= LAST",
- /* 376 */ "star_func ::= LAST_ROW",
- /* 377 */ "star_func_para_list ::= NK_STAR",
- /* 378 */ "star_func_para_list ::= other_para_list",
- /* 379 */ "other_para_list ::= star_func_para",
- /* 380 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 381 */ "star_func_para ::= expression",
- /* 382 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 383 */ "predicate ::= expression compare_op expression",
- /* 384 */ "predicate ::= expression BETWEEN expression AND expression",
- /* 385 */ "predicate ::= expression NOT BETWEEN expression AND expression",
- /* 386 */ "predicate ::= expression IS NULL",
- /* 387 */ "predicate ::= expression IS NOT NULL",
- /* 388 */ "predicate ::= expression in_op in_predicate_value",
- /* 389 */ "compare_op ::= NK_LT",
- /* 390 */ "compare_op ::= NK_GT",
- /* 391 */ "compare_op ::= NK_LE",
- /* 392 */ "compare_op ::= NK_GE",
- /* 393 */ "compare_op ::= NK_NE",
- /* 394 */ "compare_op ::= NK_EQ",
- /* 395 */ "compare_op ::= LIKE",
- /* 396 */ "compare_op ::= NOT LIKE",
- /* 397 */ "compare_op ::= MATCH",
- /* 398 */ "compare_op ::= NMATCH",
- /* 399 */ "compare_op ::= CONTAINS",
- /* 400 */ "in_op ::= IN",
- /* 401 */ "in_op ::= NOT IN",
- /* 402 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 403 */ "boolean_value_expression ::= boolean_primary",
- /* 404 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 405 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 406 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 407 */ "boolean_primary ::= predicate",
- /* 408 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 409 */ "common_expression ::= expression",
- /* 410 */ "common_expression ::= boolean_value_expression",
- /* 411 */ "from_clause_opt ::=",
- /* 412 */ "from_clause_opt ::= FROM table_reference_list",
- /* 413 */ "table_reference_list ::= table_reference",
- /* 414 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 415 */ "table_reference ::= table_primary",
- /* 416 */ "table_reference ::= joined_table",
- /* 417 */ "table_primary ::= table_name alias_opt",
- /* 418 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 419 */ "table_primary ::= subquery alias_opt",
- /* 420 */ "table_primary ::= parenthesized_joined_table",
- /* 421 */ "alias_opt ::=",
- /* 422 */ "alias_opt ::= table_alias",
- /* 423 */ "alias_opt ::= AS table_alias",
- /* 424 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 425 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 426 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 427 */ "join_type ::=",
- /* 428 */ "join_type ::= INNER",
- /* 429 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
- /* 430 */ "set_quantifier_opt ::=",
- /* 431 */ "set_quantifier_opt ::= DISTINCT",
- /* 432 */ "set_quantifier_opt ::= ALL",
- /* 433 */ "select_list ::= select_item",
- /* 434 */ "select_list ::= select_list NK_COMMA select_item",
- /* 435 */ "select_item ::= NK_STAR",
- /* 436 */ "select_item ::= common_expression",
- /* 437 */ "select_item ::= common_expression column_alias",
- /* 438 */ "select_item ::= common_expression AS column_alias",
- /* 439 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 440 */ "where_clause_opt ::=",
- /* 441 */ "where_clause_opt ::= WHERE search_condition",
- /* 442 */ "partition_by_clause_opt ::=",
- /* 443 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
- /* 444 */ "twindow_clause_opt ::=",
- /* 445 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 446 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
- /* 447 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 448 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 449 */ "sliding_opt ::=",
- /* 450 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 451 */ "fill_opt ::=",
- /* 452 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 453 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 454 */ "fill_mode ::= NONE",
- /* 455 */ "fill_mode ::= PREV",
- /* 456 */ "fill_mode ::= NULL",
- /* 457 */ "fill_mode ::= LINEAR",
- /* 458 */ "fill_mode ::= NEXT",
- /* 459 */ "group_by_clause_opt ::=",
- /* 460 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 461 */ "group_by_list ::= expression",
- /* 462 */ "group_by_list ::= group_by_list NK_COMMA expression",
- /* 463 */ "having_clause_opt ::=",
- /* 464 */ "having_clause_opt ::= HAVING search_condition",
- /* 465 */ "range_opt ::=",
- /* 466 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP",
- /* 467 */ "every_opt ::=",
- /* 468 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 469 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 470 */ "query_simple ::= query_specification",
- /* 471 */ "query_simple ::= union_query_expression",
- /* 472 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 473 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 474 */ "query_simple_or_subquery ::= query_simple",
- /* 475 */ "query_simple_or_subquery ::= subquery",
- /* 476 */ "query_or_subquery ::= query_expression",
- /* 477 */ "query_or_subquery ::= subquery",
- /* 478 */ "order_by_clause_opt ::=",
- /* 479 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 480 */ "slimit_clause_opt ::=",
- /* 481 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 482 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 483 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 484 */ "limit_clause_opt ::=",
- /* 485 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 486 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 487 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 488 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 489 */ "search_condition ::= common_expression",
- /* 490 */ "sort_specification_list ::= sort_specification",
- /* 491 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 492 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
- /* 493 */ "ordering_specification_opt ::=",
- /* 494 */ "ordering_specification_opt ::= ASC",
- /* 495 */ "ordering_specification_opt ::= DESC",
- /* 496 */ "null_ordering_opt ::=",
- /* 497 */ "null_ordering_opt ::= NULLS FIRST",
- /* 498 */ "null_ordering_opt ::= NULLS LAST",
+ /* 329 */ "expr_or_subquery ::= expression",
+ /* 330 */ "expr_or_subquery ::= subquery",
+ /* 331 */ "expression ::= literal",
+ /* 332 */ "expression ::= pseudo_column",
+ /* 333 */ "expression ::= column_reference",
+ /* 334 */ "expression ::= function_expression",
+ /* 335 */ "expression ::= case_when_expression",
+ /* 336 */ "expression ::= NK_LP expression NK_RP",
+ /* 337 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 338 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 339 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 340 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 341 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 342 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 343 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 344 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 345 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 346 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 347 */ "expression_list ::= expr_or_subquery",
+ /* 348 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 349 */ "column_reference ::= column_name",
+ /* 350 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 351 */ "pseudo_column ::= ROWTS",
+ /* 352 */ "pseudo_column ::= TBNAME",
+ /* 353 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 354 */ "pseudo_column ::= QSTART",
+ /* 355 */ "pseudo_column ::= QEND",
+ /* 356 */ "pseudo_column ::= QDURATION",
+ /* 357 */ "pseudo_column ::= WSTART",
+ /* 358 */ "pseudo_column ::= WEND",
+ /* 359 */ "pseudo_column ::= WDURATION",
+ /* 360 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 361 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 362 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 363 */ "function_expression ::= literal_func",
+ /* 364 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 365 */ "literal_func ::= NOW",
+ /* 366 */ "noarg_func ::= NOW",
+ /* 367 */ "noarg_func ::= TODAY",
+ /* 368 */ "noarg_func ::= TIMEZONE",
+ /* 369 */ "noarg_func ::= DATABASE",
+ /* 370 */ "noarg_func ::= CLIENT_VERSION",
+ /* 371 */ "noarg_func ::= SERVER_VERSION",
+ /* 372 */ "noarg_func ::= SERVER_STATUS",
+ /* 373 */ "noarg_func ::= CURRENT_USER",
+ /* 374 */ "noarg_func ::= USER",
+ /* 375 */ "star_func ::= COUNT",
+ /* 376 */ "star_func ::= FIRST",
+ /* 377 */ "star_func ::= LAST",
+ /* 378 */ "star_func ::= LAST_ROW",
+ /* 379 */ "star_func_para_list ::= NK_STAR",
+ /* 380 */ "star_func_para_list ::= other_para_list",
+ /* 381 */ "other_para_list ::= star_func_para",
+ /* 382 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 383 */ "star_func_para ::= expr_or_subquery",
+ /* 384 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 385 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 386 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 387 */ "when_then_list ::= when_then_expr",
+ /* 388 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 389 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 390 */ "case_when_else_opt ::=",
+ /* 391 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 392 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 393 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 394 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 395 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 396 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 397 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 398 */ "compare_op ::= NK_LT",
+ /* 399 */ "compare_op ::= NK_GT",
+ /* 400 */ "compare_op ::= NK_LE",
+ /* 401 */ "compare_op ::= NK_GE",
+ /* 402 */ "compare_op ::= NK_NE",
+ /* 403 */ "compare_op ::= NK_EQ",
+ /* 404 */ "compare_op ::= LIKE",
+ /* 405 */ "compare_op ::= NOT LIKE",
+ /* 406 */ "compare_op ::= MATCH",
+ /* 407 */ "compare_op ::= NMATCH",
+ /* 408 */ "compare_op ::= CONTAINS",
+ /* 409 */ "in_op ::= IN",
+ /* 410 */ "in_op ::= NOT IN",
+ /* 411 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 412 */ "boolean_value_expression ::= boolean_primary",
+ /* 413 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 414 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 415 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 416 */ "boolean_primary ::= predicate",
+ /* 417 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 418 */ "common_expression ::= expr_or_subquery",
+ /* 419 */ "common_expression ::= boolean_value_expression",
+ /* 420 */ "from_clause_opt ::=",
+ /* 421 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 422 */ "table_reference_list ::= table_reference",
+ /* 423 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 424 */ "table_reference ::= table_primary",
+ /* 425 */ "table_reference ::= joined_table",
+ /* 426 */ "table_primary ::= table_name alias_opt",
+ /* 427 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 428 */ "table_primary ::= subquery alias_opt",
+ /* 429 */ "table_primary ::= parenthesized_joined_table",
+ /* 430 */ "alias_opt ::=",
+ /* 431 */ "alias_opt ::= table_alias",
+ /* 432 */ "alias_opt ::= AS table_alias",
+ /* 433 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 434 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 435 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 436 */ "join_type ::=",
+ /* 437 */ "join_type ::= INNER",
+ /* 438 */ "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",
+ /* 439 */ "set_quantifier_opt ::=",
+ /* 440 */ "set_quantifier_opt ::= DISTINCT",
+ /* 441 */ "set_quantifier_opt ::= ALL",
+ /* 442 */ "select_list ::= select_item",
+ /* 443 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 444 */ "select_item ::= NK_STAR",
+ /* 445 */ "select_item ::= common_expression",
+ /* 446 */ "select_item ::= common_expression column_alias",
+ /* 447 */ "select_item ::= common_expression AS column_alias",
+ /* 448 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 449 */ "where_clause_opt ::=",
+ /* 450 */ "where_clause_opt ::= WHERE search_condition",
+ /* 451 */ "partition_by_clause_opt ::=",
+ /* 452 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
+ /* 453 */ "twindow_clause_opt ::=",
+ /* 454 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 455 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 456 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 457 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 458 */ "sliding_opt ::=",
+ /* 459 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 460 */ "fill_opt ::=",
+ /* 461 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 462 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 463 */ "fill_mode ::= NONE",
+ /* 464 */ "fill_mode ::= PREV",
+ /* 465 */ "fill_mode ::= NULL",
+ /* 466 */ "fill_mode ::= LINEAR",
+ /* 467 */ "fill_mode ::= NEXT",
+ /* 468 */ "group_by_clause_opt ::=",
+ /* 469 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 470 */ "group_by_list ::= expr_or_subquery",
+ /* 471 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 472 */ "having_clause_opt ::=",
+ /* 473 */ "having_clause_opt ::= HAVING search_condition",
+ /* 474 */ "range_opt ::=",
+ /* 475 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 476 */ "every_opt ::=",
+ /* 477 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 478 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 479 */ "query_simple ::= query_specification",
+ /* 480 */ "query_simple ::= union_query_expression",
+ /* 481 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 482 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 483 */ "query_simple_or_subquery ::= query_simple",
+ /* 484 */ "query_simple_or_subquery ::= subquery",
+ /* 485 */ "query_or_subquery ::= query_expression",
+ /* 486 */ "query_or_subquery ::= subquery",
+ /* 487 */ "order_by_clause_opt ::=",
+ /* 488 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 489 */ "slimit_clause_opt ::=",
+ /* 490 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 491 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 492 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 493 */ "limit_clause_opt ::=",
+ /* 494 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 495 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 496 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 497 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 498 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 499 */ "search_condition ::= common_expression",
+ /* 500 */ "sort_specification_list ::= sort_specification",
+ /* 501 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 502 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 503 */ "ordering_specification_opt ::=",
+ /* 504 */ "ordering_specification_opt ::= ASC",
+ /* 505 */ "ordering_specification_opt ::= DESC",
+ /* 506 */ "null_ordering_opt ::=",
+ /* 507 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 508 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2335,181 +2432,186 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 309: /* cmd */
- case 312: /* literal */
- case 323: /* db_options */
- case 325: /* alter_db_options */
- case 330: /* retention */
- case 331: /* full_table_name */
- case 334: /* table_options */
- case 338: /* alter_table_clause */
- case 339: /* alter_table_options */
- case 342: /* signed_literal */
- case 343: /* create_subtable_clause */
- case 346: /* drop_table_clause */
- case 349: /* column_def */
- case 353: /* duration_literal */
- case 354: /* rollup_func_name */
- case 356: /* col_name */
- case 357: /* db_name_cond_opt */
- case 358: /* like_pattern_opt */
- case 359: /* table_name_cond */
- case 360: /* from_db_opt */
- case 361: /* index_options */
- case 363: /* sliding_opt */
- case 364: /* sma_stream_opt */
- case 365: /* func */
- case 366: /* stream_options */
- case 368: /* query_or_subquery */
- case 371: /* explain_options */
- case 376: /* where_clause_opt */
- case 377: /* signed */
- case 378: /* literal_func */
- case 382: /* expression */
- case 383: /* pseudo_column */
- case 384: /* column_reference */
- case 385: /* function_expression */
- case 386: /* subquery */
- case 391: /* star_func_para */
- case 392: /* predicate */
- case 395: /* in_predicate_value */
- case 396: /* boolean_value_expression */
- case 397: /* boolean_primary */
- case 398: /* common_expression */
- case 399: /* from_clause_opt */
- case 400: /* table_reference_list */
- case 401: /* table_reference */
- case 402: /* table_primary */
- case 403: /* joined_table */
- case 405: /* parenthesized_joined_table */
- case 407: /* search_condition */
- case 408: /* query_specification */
- case 412: /* range_opt */
- case 413: /* every_opt */
- case 414: /* fill_opt */
- case 415: /* twindow_clause_opt */
- case 417: /* having_clause_opt */
- case 418: /* select_item */
- case 421: /* query_expression */
- case 422: /* query_simple */
- case 424: /* slimit_clause_opt */
- case 425: /* limit_clause_opt */
- case 426: /* union_query_expression */
- case 427: /* query_simple_or_subquery */
- case 429: /* sort_specification */
+ case 313: /* cmd */
+ case 316: /* literal */
+ case 327: /* db_options */
+ case 329: /* alter_db_options */
+ case 334: /* retention */
+ case 335: /* full_table_name */
+ case 338: /* table_options */
+ case 342: /* alter_table_clause */
+ case 343: /* alter_table_options */
+ case 346: /* signed_literal */
+ case 347: /* create_subtable_clause */
+ case 350: /* drop_table_clause */
+ case 353: /* column_def */
+ case 357: /* duration_literal */
+ case 358: /* rollup_func_name */
+ case 360: /* col_name */
+ case 361: /* db_name_cond_opt */
+ case 362: /* like_pattern_opt */
+ case 363: /* table_name_cond */
+ case 364: /* from_db_opt */
+ case 365: /* index_options */
+ case 367: /* sliding_opt */
+ case 368: /* sma_stream_opt */
+ case 369: /* func */
+ case 370: /* stream_options */
+ case 372: /* query_or_subquery */
+ case 375: /* explain_options */
+ case 380: /* where_clause_opt */
+ case 381: /* signed */
+ case 382: /* literal_func */
+ case 386: /* expr_or_subquery */
+ case 387: /* expression */
+ case 388: /* subquery */
+ case 389: /* pseudo_column */
+ case 390: /* column_reference */
+ case 391: /* function_expression */
+ case 392: /* case_when_expression */
+ case 397: /* star_func_para */
+ case 399: /* case_when_else_opt */
+ case 400: /* common_expression */
+ case 401: /* when_then_expr */
+ case 402: /* predicate */
+ case 405: /* in_predicate_value */
+ case 406: /* boolean_value_expression */
+ case 407: /* boolean_primary */
+ case 408: /* from_clause_opt */
+ case 409: /* table_reference_list */
+ case 410: /* table_reference */
+ case 411: /* table_primary */
+ case 412: /* joined_table */
+ case 414: /* parenthesized_joined_table */
+ case 416: /* search_condition */
+ case 417: /* query_specification */
+ case 421: /* range_opt */
+ case 422: /* every_opt */
+ case 423: /* fill_opt */
+ case 424: /* twindow_clause_opt */
+ case 426: /* having_clause_opt */
+ case 427: /* select_item */
+ case 430: /* query_expression */
+ case 431: /* query_simple */
+ case 433: /* slimit_clause_opt */
+ case 434: /* limit_clause_opt */
+ case 435: /* union_query_expression */
+ case 436: /* query_simple_or_subquery */
+ case 438: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy776));
+ nodesDestroyNode((yypminor->yy560));
}
break;
- case 310: /* account_options */
- case 311: /* alter_account_options */
- case 313: /* alter_account_option */
- case 373: /* bufsize_opt */
+ case 314: /* account_options */
+ case 315: /* alter_account_options */
+ case 317: /* alter_account_option */
+ case 377: /* bufsize_opt */
{
}
break;
- case 314: /* user_name */
- case 317: /* priv_level */
- case 320: /* db_name */
- case 321: /* dnode_endpoint */
- case 340: /* column_name */
- case 348: /* table_name */
- case 355: /* function_name */
- case 367: /* topic_name */
- case 369: /* cgroup_name */
- case 374: /* stream_name */
- case 380: /* table_alias */
- case 381: /* column_alias */
- case 387: /* star_func */
- case 389: /* noarg_func */
- case 404: /* alias_opt */
+ case 318: /* user_name */
+ case 321: /* priv_level */
+ case 324: /* db_name */
+ case 325: /* dnode_endpoint */
+ case 344: /* column_name */
+ case 352: /* table_name */
+ case 359: /* function_name */
+ case 371: /* topic_name */
+ case 373: /* cgroup_name */
+ case 378: /* stream_name */
+ case 384: /* table_alias */
+ case 385: /* column_alias */
+ case 393: /* star_func */
+ case 395: /* noarg_func */
+ case 413: /* alias_opt */
{
}
break;
- case 315: /* sysinfo_opt */
+ case 319: /* sysinfo_opt */
{
}
break;
- case 316: /* privileges */
- case 318: /* priv_type_list */
- case 319: /* priv_type */
+ case 320: /* privileges */
+ case 322: /* priv_type_list */
+ case 323: /* priv_type */
{
}
break;
- case 322: /* not_exists_opt */
- case 324: /* exists_opt */
- case 370: /* analyze_opt */
- case 372: /* agg_func_opt */
- case 409: /* set_quantifier_opt */
+ case 326: /* not_exists_opt */
+ case 328: /* exists_opt */
+ case 374: /* analyze_opt */
+ case 376: /* agg_func_opt */
+ case 418: /* set_quantifier_opt */
{
}
break;
- case 326: /* integer_list */
- case 327: /* variable_list */
- case 328: /* retention_list */
- case 332: /* column_def_list */
- case 333: /* tags_def_opt */
- case 335: /* multi_create_clause */
- case 336: /* tags_def */
- case 337: /* multi_drop_clause */
- case 344: /* specific_cols_opt */
- case 345: /* expression_list */
- case 347: /* col_name_list */
- case 350: /* duration_list */
- case 351: /* rollup_func_list */
- case 362: /* func_list */
- case 375: /* dnode_list */
- case 379: /* literal_list */
- case 388: /* star_func_para_list */
- case 390: /* other_para_list */
- case 410: /* select_list */
- case 411: /* partition_by_clause_opt */
- case 416: /* group_by_clause_opt */
- case 420: /* group_by_list */
- case 423: /* order_by_clause_opt */
- case 428: /* sort_specification_list */
+ case 330: /* integer_list */
+ case 331: /* variable_list */
+ case 332: /* retention_list */
+ case 336: /* column_def_list */
+ case 337: /* tags_def_opt */
+ case 339: /* multi_create_clause */
+ case 340: /* tags_def */
+ case 341: /* multi_drop_clause */
+ case 348: /* specific_cols_opt */
+ case 349: /* expression_list */
+ case 351: /* col_name_list */
+ case 354: /* duration_list */
+ case 355: /* rollup_func_list */
+ case 366: /* func_list */
+ case 379: /* dnode_list */
+ case 383: /* literal_list */
+ case 394: /* star_func_para_list */
+ case 396: /* other_para_list */
+ case 398: /* when_then_list */
+ case 419: /* select_list */
+ case 420: /* partition_by_clause_opt */
+ case 425: /* group_by_clause_opt */
+ case 429: /* group_by_list */
+ case 432: /* order_by_clause_opt */
+ case 437: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy280));
+ nodesDestroyList((yypminor->yy334));
}
break;
- case 329: /* alter_db_option */
- case 352: /* alter_table_option */
+ case 333: /* alter_db_option */
+ case 356: /* alter_table_option */
{
}
break;
- case 341: /* type_name */
+ case 345: /* type_name */
{
}
break;
- case 393: /* compare_op */
- case 394: /* in_op */
+ case 403: /* compare_op */
+ case 404: /* in_op */
{
}
break;
- case 406: /* join_type */
+ case 415: /* join_type */
{
}
break;
- case 419: /* fill_mode */
+ case 428: /* fill_mode */
{
}
break;
- case 430: /* ordering_specification_opt */
+ case 439: /* ordering_specification_opt */
{
}
break;
- case 431: /* null_ordering_opt */
+ case 440: /* null_ordering_opt */
{
}
@@ -2808,505 +2910,515 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
- { 309, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- { 309, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- { 310, 0 }, /* (2) account_options ::= */
- { 310, -3 }, /* (3) account_options ::= account_options PPS literal */
- { 310, -3 }, /* (4) account_options ::= account_options TSERIES literal */
- { 310, -3 }, /* (5) account_options ::= account_options STORAGE literal */
- { 310, -3 }, /* (6) account_options ::= account_options STREAMS literal */
- { 310, -3 }, /* (7) account_options ::= account_options QTIME literal */
- { 310, -3 }, /* (8) account_options ::= account_options DBS literal */
- { 310, -3 }, /* (9) account_options ::= account_options USERS literal */
- { 310, -3 }, /* (10) account_options ::= account_options CONNS literal */
- { 310, -3 }, /* (11) account_options ::= account_options STATE literal */
- { 311, -1 }, /* (12) alter_account_options ::= alter_account_option */
- { 311, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- { 313, -2 }, /* (14) alter_account_option ::= PASS literal */
- { 313, -2 }, /* (15) alter_account_option ::= PPS literal */
- { 313, -2 }, /* (16) alter_account_option ::= TSERIES literal */
- { 313, -2 }, /* (17) alter_account_option ::= STORAGE literal */
- { 313, -2 }, /* (18) alter_account_option ::= STREAMS literal */
- { 313, -2 }, /* (19) alter_account_option ::= QTIME literal */
- { 313, -2 }, /* (20) alter_account_option ::= DBS literal */
- { 313, -2 }, /* (21) alter_account_option ::= USERS literal */
- { 313, -2 }, /* (22) alter_account_option ::= CONNS literal */
- { 313, -2 }, /* (23) alter_account_option ::= STATE literal */
- { 309, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
- { 309, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
- { 309, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- { 309, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- { 309, -3 }, /* (28) cmd ::= DROP USER user_name */
- { 315, 0 }, /* (29) sysinfo_opt ::= */
- { 315, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
- { 309, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
- { 309, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
- { 316, -1 }, /* (33) privileges ::= ALL */
- { 316, -1 }, /* (34) privileges ::= priv_type_list */
- { 318, -1 }, /* (35) priv_type_list ::= priv_type */
- { 318, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- { 319, -1 }, /* (37) priv_type ::= READ */
- { 319, -1 }, /* (38) priv_type ::= WRITE */
- { 317, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */
- { 317, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */
- { 309, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */
- { 309, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- { 309, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */
- { 309, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */
- { 309, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- { 309, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- { 309, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */
- { 309, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- { 321, -1 }, /* (49) dnode_endpoint ::= NK_STRING */
- { 321, -1 }, /* (50) dnode_endpoint ::= NK_ID */
- { 321, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */
- { 309, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */
- { 309, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- { 309, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- { 309, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- { 309, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */
- { 309, -2 }, /* (64) cmd ::= USE db_name */
- { 309, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */
- { 309, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */
- { 309, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */
- { 322, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */
- { 322, 0 }, /* (69) not_exists_opt ::= */
- { 324, -2 }, /* (70) exists_opt ::= IF EXISTS */
- { 324, 0 }, /* (71) exists_opt ::= */
- { 323, 0 }, /* (72) db_options ::= */
- { 323, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */
- { 323, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */
- { 323, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */
- { 323, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */
- { 323, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */
- { 323, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */
- { 323, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */
- { 323, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */
- { 323, -3 }, /* (81) db_options ::= db_options KEEP integer_list */
- { 323, -3 }, /* (82) db_options ::= db_options KEEP variable_list */
- { 323, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */
- { 323, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */
- { 323, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- { 323, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */
- { 323, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */
- { 323, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */
- { 323, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */
- { 323, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- { 323, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */
- { 323, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */
- { 323, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- { 323, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- { 323, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- { 323, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- { 323, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- { 323, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- { 323, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- { 323, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- { 323, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- { 323, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
- { 323, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
- { 325, -1 }, /* (104) alter_db_options ::= alter_db_option */
- { 325, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */
- { 329, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */
- { 329, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */
- { 329, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- { 329, -2 }, /* (109) alter_db_option ::= KEEP integer_list */
- { 329, -2 }, /* (110) alter_db_option ::= KEEP variable_list */
- { 329, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- { 329, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- { 326, -1 }, /* (113) integer_list ::= NK_INTEGER */
- { 326, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- { 327, -1 }, /* (115) variable_list ::= NK_VARIABLE */
- { 327, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- { 328, -1 }, /* (117) retention_list ::= retention */
- { 328, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */
- { 330, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- { 309, -9 }, /* (120) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- { 309, -3 }, /* (121) cmd ::= CREATE TABLE multi_create_clause */
- { 309, -9 }, /* (122) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- { 309, -3 }, /* (123) cmd ::= DROP TABLE multi_drop_clause */
- { 309, -4 }, /* (124) cmd ::= DROP STABLE exists_opt full_table_name */
- { 309, -3 }, /* (125) cmd ::= ALTER TABLE alter_table_clause */
- { 309, -3 }, /* (126) cmd ::= ALTER STABLE alter_table_clause */
- { 338, -2 }, /* (127) alter_table_clause ::= full_table_name alter_table_options */
- { 338, -5 }, /* (128) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
- { 338, -4 }, /* (129) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- { 338, -5 }, /* (130) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- { 338, -5 }, /* (131) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- { 338, -5 }, /* (132) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- { 338, -4 }, /* (133) alter_table_clause ::= full_table_name DROP TAG column_name */
- { 338, -5 }, /* (134) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- { 338, -5 }, /* (135) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- { 338, -6 }, /* (136) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- { 335, -1 }, /* (137) multi_create_clause ::= create_subtable_clause */
- { 335, -2 }, /* (138) multi_create_clause ::= multi_create_clause create_subtable_clause */
- { 343, -10 }, /* (139) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
- { 337, -1 }, /* (140) multi_drop_clause ::= drop_table_clause */
- { 337, -2 }, /* (141) multi_drop_clause ::= multi_drop_clause drop_table_clause */
- { 346, -2 }, /* (142) drop_table_clause ::= exists_opt full_table_name */
- { 344, 0 }, /* (143) specific_cols_opt ::= */
- { 344, -3 }, /* (144) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- { 331, -1 }, /* (145) full_table_name ::= table_name */
- { 331, -3 }, /* (146) full_table_name ::= db_name NK_DOT table_name */
- { 332, -1 }, /* (147) column_def_list ::= column_def */
- { 332, -3 }, /* (148) column_def_list ::= column_def_list NK_COMMA column_def */
- { 349, -2 }, /* (149) column_def ::= column_name type_name */
- { 349, -4 }, /* (150) column_def ::= column_name type_name COMMENT NK_STRING */
- { 341, -1 }, /* (151) type_name ::= BOOL */
- { 341, -1 }, /* (152) type_name ::= TINYINT */
- { 341, -1 }, /* (153) type_name ::= SMALLINT */
- { 341, -1 }, /* (154) type_name ::= INT */
- { 341, -1 }, /* (155) type_name ::= INTEGER */
- { 341, -1 }, /* (156) type_name ::= BIGINT */
- { 341, -1 }, /* (157) type_name ::= FLOAT */
- { 341, -1 }, /* (158) type_name ::= DOUBLE */
- { 341, -4 }, /* (159) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- { 341, -1 }, /* (160) type_name ::= TIMESTAMP */
- { 341, -4 }, /* (161) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- { 341, -2 }, /* (162) type_name ::= TINYINT UNSIGNED */
- { 341, -2 }, /* (163) type_name ::= SMALLINT UNSIGNED */
- { 341, -2 }, /* (164) type_name ::= INT UNSIGNED */
- { 341, -2 }, /* (165) type_name ::= BIGINT UNSIGNED */
- { 341, -1 }, /* (166) type_name ::= JSON */
- { 341, -4 }, /* (167) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- { 341, -1 }, /* (168) type_name ::= MEDIUMBLOB */
- { 341, -1 }, /* (169) type_name ::= BLOB */
- { 341, -4 }, /* (170) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- { 341, -1 }, /* (171) type_name ::= DECIMAL */
- { 341, -4 }, /* (172) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- { 341, -6 }, /* (173) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { 333, 0 }, /* (174) tags_def_opt ::= */
- { 333, -1 }, /* (175) tags_def_opt ::= tags_def */
- { 336, -4 }, /* (176) tags_def ::= TAGS NK_LP column_def_list NK_RP */
- { 334, 0 }, /* (177) table_options ::= */
- { 334, -3 }, /* (178) table_options ::= table_options COMMENT NK_STRING */
- { 334, -3 }, /* (179) table_options ::= table_options MAX_DELAY duration_list */
- { 334, -3 }, /* (180) table_options ::= table_options WATERMARK duration_list */
- { 334, -5 }, /* (181) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- { 334, -3 }, /* (182) table_options ::= table_options TTL NK_INTEGER */
- { 334, -5 }, /* (183) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- { 339, -1 }, /* (184) alter_table_options ::= alter_table_option */
- { 339, -2 }, /* (185) alter_table_options ::= alter_table_options alter_table_option */
- { 352, -2 }, /* (186) alter_table_option ::= COMMENT NK_STRING */
- { 352, -2 }, /* (187) alter_table_option ::= TTL NK_INTEGER */
- { 350, -1 }, /* (188) duration_list ::= duration_literal */
- { 350, -3 }, /* (189) duration_list ::= duration_list NK_COMMA duration_literal */
- { 351, -1 }, /* (190) rollup_func_list ::= rollup_func_name */
- { 351, -3 }, /* (191) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- { 354, -1 }, /* (192) rollup_func_name ::= function_name */
- { 354, -1 }, /* (193) rollup_func_name ::= FIRST */
- { 354, -1 }, /* (194) rollup_func_name ::= LAST */
- { 347, -1 }, /* (195) col_name_list ::= col_name */
- { 347, -3 }, /* (196) col_name_list ::= col_name_list NK_COMMA col_name */
- { 356, -1 }, /* (197) col_name ::= column_name */
- { 309, -2 }, /* (198) cmd ::= SHOW DNODES */
- { 309, -2 }, /* (199) cmd ::= SHOW USERS */
- { 309, -2 }, /* (200) cmd ::= SHOW DATABASES */
- { 309, -4 }, /* (201) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
- { 309, -4 }, /* (202) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- { 309, -3 }, /* (203) cmd ::= SHOW db_name_cond_opt VGROUPS */
- { 309, -2 }, /* (204) cmd ::= SHOW MNODES */
- { 309, -2 }, /* (205) cmd ::= SHOW MODULES */
- { 309, -2 }, /* (206) cmd ::= SHOW QNODES */
- { 309, -2 }, /* (207) cmd ::= SHOW FUNCTIONS */
- { 309, -5 }, /* (208) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- { 309, -2 }, /* (209) cmd ::= SHOW STREAMS */
- { 309, -2 }, /* (210) cmd ::= SHOW ACCOUNTS */
- { 309, -2 }, /* (211) cmd ::= SHOW APPS */
- { 309, -2 }, /* (212) cmd ::= SHOW CONNECTIONS */
- { 309, -2 }, /* (213) cmd ::= SHOW LICENCES */
- { 309, -2 }, /* (214) cmd ::= SHOW GRANTS */
- { 309, -4 }, /* (215) cmd ::= SHOW CREATE DATABASE db_name */
- { 309, -4 }, /* (216) cmd ::= SHOW CREATE TABLE full_table_name */
- { 309, -4 }, /* (217) cmd ::= SHOW CREATE STABLE full_table_name */
- { 309, -2 }, /* (218) cmd ::= SHOW QUERIES */
- { 309, -2 }, /* (219) cmd ::= SHOW SCORES */
- { 309, -2 }, /* (220) cmd ::= SHOW TOPICS */
- { 309, -2 }, /* (221) cmd ::= SHOW VARIABLES */
- { 309, -3 }, /* (222) cmd ::= SHOW LOCAL VARIABLES */
- { 309, -4 }, /* (223) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */
- { 309, -2 }, /* (224) cmd ::= SHOW BNODES */
- { 309, -2 }, /* (225) cmd ::= SHOW SNODES */
- { 309, -2 }, /* (226) cmd ::= SHOW CLUSTER */
- { 309, -2 }, /* (227) cmd ::= SHOW TRANSACTIONS */
- { 309, -4 }, /* (228) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- { 309, -2 }, /* (229) cmd ::= SHOW CONSUMERS */
- { 309, -2 }, /* (230) cmd ::= SHOW SUBSCRIPTIONS */
- { 309, -5 }, /* (231) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- { 309, -3 }, /* (232) cmd ::= SHOW VNODES NK_INTEGER */
- { 309, -3 }, /* (233) cmd ::= SHOW VNODES NK_STRING */
- { 357, 0 }, /* (234) db_name_cond_opt ::= */
- { 357, -2 }, /* (235) db_name_cond_opt ::= db_name NK_DOT */
- { 358, 0 }, /* (236) like_pattern_opt ::= */
- { 358, -2 }, /* (237) like_pattern_opt ::= LIKE NK_STRING */
- { 359, -1 }, /* (238) table_name_cond ::= table_name */
- { 360, 0 }, /* (239) from_db_opt ::= */
- { 360, -2 }, /* (240) from_db_opt ::= FROM db_name */
- { 309, -8 }, /* (241) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
- { 309, -4 }, /* (242) cmd ::= DROP INDEX exists_opt full_table_name */
- { 361, -10 }, /* (243) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- { 361, -12 }, /* (244) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
- { 362, -1 }, /* (245) func_list ::= func */
- { 362, -3 }, /* (246) func_list ::= func_list NK_COMMA func */
- { 365, -4 }, /* (247) func ::= function_name NK_LP expression_list NK_RP */
- { 364, 0 }, /* (248) sma_stream_opt ::= */
- { 364, -3 }, /* (249) sma_stream_opt ::= stream_options WATERMARK duration_literal */
- { 364, -3 }, /* (250) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
- { 309, -6 }, /* (251) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- { 309, -7 }, /* (252) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
- { 309, -9 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
- { 309, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
- { 309, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
- { 309, -4 }, /* (256) cmd ::= DROP TOPIC exists_opt topic_name */
- { 309, -7 }, /* (257) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- { 309, -2 }, /* (258) cmd ::= DESC full_table_name */
- { 309, -2 }, /* (259) cmd ::= DESCRIBE full_table_name */
- { 309, -3 }, /* (260) cmd ::= RESET QUERY CACHE */
- { 309, -4 }, /* (261) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- { 370, 0 }, /* (262) analyze_opt ::= */
- { 370, -1 }, /* (263) analyze_opt ::= ANALYZE */
- { 371, 0 }, /* (264) explain_options ::= */
- { 371, -3 }, /* (265) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 371, -3 }, /* (266) explain_options ::= explain_options RATIO NK_FLOAT */
- { 309, -10 }, /* (267) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
- { 309, -4 }, /* (268) cmd ::= DROP FUNCTION exists_opt function_name */
- { 372, 0 }, /* (269) agg_func_opt ::= */
- { 372, -1 }, /* (270) agg_func_opt ::= AGGREGATE */
- { 373, 0 }, /* (271) bufsize_opt ::= */
- { 373, -2 }, /* (272) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 309, -9 }, /* (273) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery */
- { 309, -4 }, /* (274) cmd ::= DROP STREAM exists_opt stream_name */
- { 366, 0 }, /* (275) stream_options ::= */
- { 366, -3 }, /* (276) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 366, -3 }, /* (277) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 366, -4 }, /* (278) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 366, -3 }, /* (279) stream_options ::= stream_options WATERMARK duration_literal */
- { 366, -4 }, /* (280) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { 309, -3 }, /* (281) cmd ::= KILL CONNECTION NK_INTEGER */
- { 309, -3 }, /* (282) cmd ::= KILL QUERY NK_STRING */
- { 309, -3 }, /* (283) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 309, -2 }, /* (284) cmd ::= BALANCE VGROUP */
- { 309, -4 }, /* (285) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 309, -4 }, /* (286) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 309, -3 }, /* (287) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 375, -2 }, /* (288) dnode_list ::= DNODE NK_INTEGER */
- { 375, -3 }, /* (289) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 309, -4 }, /* (290) cmd ::= DELETE FROM full_table_name where_clause_opt */
- { 309, -1 }, /* (291) cmd ::= query_or_subquery */
- { 309, -7 }, /* (292) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- { 309, -4 }, /* (293) cmd ::= INSERT INTO full_table_name query_or_subquery */
- { 312, -1 }, /* (294) literal ::= NK_INTEGER */
- { 312, -1 }, /* (295) literal ::= NK_FLOAT */
- { 312, -1 }, /* (296) literal ::= NK_STRING */
- { 312, -1 }, /* (297) literal ::= NK_BOOL */
- { 312, -2 }, /* (298) literal ::= TIMESTAMP NK_STRING */
- { 312, -1 }, /* (299) literal ::= duration_literal */
- { 312, -1 }, /* (300) literal ::= NULL */
- { 312, -1 }, /* (301) literal ::= NK_QUESTION */
- { 353, -1 }, /* (302) duration_literal ::= NK_VARIABLE */
- { 377, -1 }, /* (303) signed ::= NK_INTEGER */
- { 377, -2 }, /* (304) signed ::= NK_PLUS NK_INTEGER */
- { 377, -2 }, /* (305) signed ::= NK_MINUS NK_INTEGER */
- { 377, -1 }, /* (306) signed ::= NK_FLOAT */
- { 377, -2 }, /* (307) signed ::= NK_PLUS NK_FLOAT */
- { 377, -2 }, /* (308) signed ::= NK_MINUS NK_FLOAT */
- { 342, -1 }, /* (309) signed_literal ::= signed */
- { 342, -1 }, /* (310) signed_literal ::= NK_STRING */
- { 342, -1 }, /* (311) signed_literal ::= NK_BOOL */
- { 342, -2 }, /* (312) signed_literal ::= TIMESTAMP NK_STRING */
- { 342, -1 }, /* (313) signed_literal ::= duration_literal */
- { 342, -1 }, /* (314) signed_literal ::= NULL */
- { 342, -1 }, /* (315) signed_literal ::= literal_func */
- { 342, -1 }, /* (316) signed_literal ::= NK_QUESTION */
- { 379, -1 }, /* (317) literal_list ::= signed_literal */
- { 379, -3 }, /* (318) literal_list ::= literal_list NK_COMMA signed_literal */
- { 320, -1 }, /* (319) db_name ::= NK_ID */
- { 348, -1 }, /* (320) table_name ::= NK_ID */
- { 340, -1 }, /* (321) column_name ::= NK_ID */
- { 355, -1 }, /* (322) function_name ::= NK_ID */
- { 380, -1 }, /* (323) table_alias ::= NK_ID */
- { 381, -1 }, /* (324) column_alias ::= NK_ID */
- { 314, -1 }, /* (325) user_name ::= NK_ID */
- { 367, -1 }, /* (326) topic_name ::= NK_ID */
- { 374, -1 }, /* (327) stream_name ::= NK_ID */
- { 369, -1 }, /* (328) cgroup_name ::= NK_ID */
- { 382, -1 }, /* (329) expression ::= literal */
- { 382, -1 }, /* (330) expression ::= pseudo_column */
- { 382, -1 }, /* (331) expression ::= column_reference */
- { 382, -1 }, /* (332) expression ::= function_expression */
- { 382, -1 }, /* (333) expression ::= subquery */
- { 382, -3 }, /* (334) expression ::= NK_LP expression NK_RP */
- { 382, -2 }, /* (335) expression ::= NK_PLUS expression */
- { 382, -2 }, /* (336) expression ::= NK_MINUS expression */
- { 382, -3 }, /* (337) expression ::= expression NK_PLUS expression */
- { 382, -3 }, /* (338) expression ::= expression NK_MINUS expression */
- { 382, -3 }, /* (339) expression ::= expression NK_STAR expression */
- { 382, -3 }, /* (340) expression ::= expression NK_SLASH expression */
- { 382, -3 }, /* (341) expression ::= expression NK_REM expression */
- { 382, -3 }, /* (342) expression ::= column_reference NK_ARROW NK_STRING */
- { 382, -3 }, /* (343) expression ::= expression NK_BITAND expression */
- { 382, -3 }, /* (344) expression ::= expression NK_BITOR expression */
- { 345, -1 }, /* (345) expression_list ::= expression */
- { 345, -3 }, /* (346) expression_list ::= expression_list NK_COMMA expression */
- { 384, -1 }, /* (347) column_reference ::= column_name */
- { 384, -3 }, /* (348) column_reference ::= table_name NK_DOT column_name */
- { 383, -1 }, /* (349) pseudo_column ::= ROWTS */
- { 383, -1 }, /* (350) pseudo_column ::= TBNAME */
- { 383, -3 }, /* (351) pseudo_column ::= table_name NK_DOT TBNAME */
- { 383, -1 }, /* (352) pseudo_column ::= QSTART */
- { 383, -1 }, /* (353) pseudo_column ::= QEND */
- { 383, -1 }, /* (354) pseudo_column ::= QDURATION */
- { 383, -1 }, /* (355) pseudo_column ::= WSTART */
- { 383, -1 }, /* (356) pseudo_column ::= WEND */
- { 383, -1 }, /* (357) pseudo_column ::= WDURATION */
- { 385, -4 }, /* (358) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 385, -4 }, /* (359) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 385, -6 }, /* (360) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
- { 385, -1 }, /* (361) function_expression ::= literal_func */
- { 378, -3 }, /* (362) literal_func ::= noarg_func NK_LP NK_RP */
- { 378, -1 }, /* (363) literal_func ::= NOW */
- { 389, -1 }, /* (364) noarg_func ::= NOW */
- { 389, -1 }, /* (365) noarg_func ::= TODAY */
- { 389, -1 }, /* (366) noarg_func ::= TIMEZONE */
- { 389, -1 }, /* (367) noarg_func ::= DATABASE */
- { 389, -1 }, /* (368) noarg_func ::= CLIENT_VERSION */
- { 389, -1 }, /* (369) noarg_func ::= SERVER_VERSION */
- { 389, -1 }, /* (370) noarg_func ::= SERVER_STATUS */
- { 389, -1 }, /* (371) noarg_func ::= CURRENT_USER */
- { 389, -1 }, /* (372) noarg_func ::= USER */
- { 387, -1 }, /* (373) star_func ::= COUNT */
- { 387, -1 }, /* (374) star_func ::= FIRST */
- { 387, -1 }, /* (375) star_func ::= LAST */
- { 387, -1 }, /* (376) star_func ::= LAST_ROW */
- { 388, -1 }, /* (377) star_func_para_list ::= NK_STAR */
- { 388, -1 }, /* (378) star_func_para_list ::= other_para_list */
- { 390, -1 }, /* (379) other_para_list ::= star_func_para */
- { 390, -3 }, /* (380) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 391, -1 }, /* (381) star_func_para ::= expression */
- { 391, -3 }, /* (382) star_func_para ::= table_name NK_DOT NK_STAR */
- { 392, -3 }, /* (383) predicate ::= expression compare_op expression */
- { 392, -5 }, /* (384) predicate ::= expression BETWEEN expression AND expression */
- { 392, -6 }, /* (385) predicate ::= expression NOT BETWEEN expression AND expression */
- { 392, -3 }, /* (386) predicate ::= expression IS NULL */
- { 392, -4 }, /* (387) predicate ::= expression IS NOT NULL */
- { 392, -3 }, /* (388) predicate ::= expression in_op in_predicate_value */
- { 393, -1 }, /* (389) compare_op ::= NK_LT */
- { 393, -1 }, /* (390) compare_op ::= NK_GT */
- { 393, -1 }, /* (391) compare_op ::= NK_LE */
- { 393, -1 }, /* (392) compare_op ::= NK_GE */
- { 393, -1 }, /* (393) compare_op ::= NK_NE */
- { 393, -1 }, /* (394) compare_op ::= NK_EQ */
- { 393, -1 }, /* (395) compare_op ::= LIKE */
- { 393, -2 }, /* (396) compare_op ::= NOT LIKE */
- { 393, -1 }, /* (397) compare_op ::= MATCH */
- { 393, -1 }, /* (398) compare_op ::= NMATCH */
- { 393, -1 }, /* (399) compare_op ::= CONTAINS */
- { 394, -1 }, /* (400) in_op ::= IN */
- { 394, -2 }, /* (401) in_op ::= NOT IN */
- { 395, -3 }, /* (402) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 396, -1 }, /* (403) boolean_value_expression ::= boolean_primary */
- { 396, -2 }, /* (404) boolean_value_expression ::= NOT boolean_primary */
- { 396, -3 }, /* (405) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 396, -3 }, /* (406) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 397, -1 }, /* (407) boolean_primary ::= predicate */
- { 397, -3 }, /* (408) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 398, -1 }, /* (409) common_expression ::= expression */
- { 398, -1 }, /* (410) common_expression ::= boolean_value_expression */
- { 399, 0 }, /* (411) from_clause_opt ::= */
- { 399, -2 }, /* (412) from_clause_opt ::= FROM table_reference_list */
- { 400, -1 }, /* (413) table_reference_list ::= table_reference */
- { 400, -3 }, /* (414) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 401, -1 }, /* (415) table_reference ::= table_primary */
- { 401, -1 }, /* (416) table_reference ::= joined_table */
- { 402, -2 }, /* (417) table_primary ::= table_name alias_opt */
- { 402, -4 }, /* (418) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 402, -2 }, /* (419) table_primary ::= subquery alias_opt */
- { 402, -1 }, /* (420) table_primary ::= parenthesized_joined_table */
- { 404, 0 }, /* (421) alias_opt ::= */
- { 404, -1 }, /* (422) alias_opt ::= table_alias */
- { 404, -2 }, /* (423) alias_opt ::= AS table_alias */
- { 405, -3 }, /* (424) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 405, -3 }, /* (425) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 403, -6 }, /* (426) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 406, 0 }, /* (427) join_type ::= */
- { 406, -1 }, /* (428) join_type ::= INNER */
- { 408, -12 }, /* (429) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- { 409, 0 }, /* (430) set_quantifier_opt ::= */
- { 409, -1 }, /* (431) set_quantifier_opt ::= DISTINCT */
- { 409, -1 }, /* (432) set_quantifier_opt ::= ALL */
- { 410, -1 }, /* (433) select_list ::= select_item */
- { 410, -3 }, /* (434) select_list ::= select_list NK_COMMA select_item */
- { 418, -1 }, /* (435) select_item ::= NK_STAR */
- { 418, -1 }, /* (436) select_item ::= common_expression */
- { 418, -2 }, /* (437) select_item ::= common_expression column_alias */
- { 418, -3 }, /* (438) select_item ::= common_expression AS column_alias */
- { 418, -3 }, /* (439) select_item ::= table_name NK_DOT NK_STAR */
- { 376, 0 }, /* (440) where_clause_opt ::= */
- { 376, -2 }, /* (441) where_clause_opt ::= WHERE search_condition */
- { 411, 0 }, /* (442) partition_by_clause_opt ::= */
- { 411, -3 }, /* (443) partition_by_clause_opt ::= PARTITION BY expression_list */
- { 415, 0 }, /* (444) twindow_clause_opt ::= */
- { 415, -6 }, /* (445) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 415, -4 }, /* (446) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
- { 415, -6 }, /* (447) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 415, -8 }, /* (448) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 363, 0 }, /* (449) sliding_opt ::= */
- { 363, -4 }, /* (450) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 414, 0 }, /* (451) fill_opt ::= */
- { 414, -4 }, /* (452) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 414, -6 }, /* (453) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 419, -1 }, /* (454) fill_mode ::= NONE */
- { 419, -1 }, /* (455) fill_mode ::= PREV */
- { 419, -1 }, /* (456) fill_mode ::= NULL */
- { 419, -1 }, /* (457) fill_mode ::= LINEAR */
- { 419, -1 }, /* (458) fill_mode ::= NEXT */
- { 416, 0 }, /* (459) group_by_clause_opt ::= */
- { 416, -3 }, /* (460) group_by_clause_opt ::= GROUP BY group_by_list */
- { 420, -1 }, /* (461) group_by_list ::= expression */
- { 420, -3 }, /* (462) group_by_list ::= group_by_list NK_COMMA expression */
- { 417, 0 }, /* (463) having_clause_opt ::= */
- { 417, -2 }, /* (464) having_clause_opt ::= HAVING search_condition */
- { 412, 0 }, /* (465) range_opt ::= */
- { 412, -6 }, /* (466) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
- { 413, 0 }, /* (467) every_opt ::= */
- { 413, -4 }, /* (468) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 421, -4 }, /* (469) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 422, -1 }, /* (470) query_simple ::= query_specification */
- { 422, -1 }, /* (471) query_simple ::= union_query_expression */
- { 426, -4 }, /* (472) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- { 426, -3 }, /* (473) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- { 427, -1 }, /* (474) query_simple_or_subquery ::= query_simple */
- { 427, -1 }, /* (475) query_simple_or_subquery ::= subquery */
- { 368, -1 }, /* (476) query_or_subquery ::= query_expression */
- { 368, -1 }, /* (477) query_or_subquery ::= subquery */
- { 423, 0 }, /* (478) order_by_clause_opt ::= */
- { 423, -3 }, /* (479) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 424, 0 }, /* (480) slimit_clause_opt ::= */
- { 424, -2 }, /* (481) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 424, -4 }, /* (482) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 424, -4 }, /* (483) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 425, 0 }, /* (484) limit_clause_opt ::= */
- { 425, -2 }, /* (485) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 425, -4 }, /* (486) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 425, -4 }, /* (487) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 386, -3 }, /* (488) subquery ::= NK_LP query_expression NK_RP */
- { 407, -1 }, /* (489) search_condition ::= common_expression */
- { 428, -1 }, /* (490) sort_specification_list ::= sort_specification */
- { 428, -3 }, /* (491) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 429, -3 }, /* (492) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
- { 430, 0 }, /* (493) ordering_specification_opt ::= */
- { 430, -1 }, /* (494) ordering_specification_opt ::= ASC */
- { 430, -1 }, /* (495) ordering_specification_opt ::= DESC */
- { 431, 0 }, /* (496) null_ordering_opt ::= */
- { 431, -2 }, /* (497) null_ordering_opt ::= NULLS FIRST */
- { 431, -2 }, /* (498) null_ordering_opt ::= NULLS LAST */
+ { 313, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ { 313, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ { 314, 0 }, /* (2) account_options ::= */
+ { 314, -3 }, /* (3) account_options ::= account_options PPS literal */
+ { 314, -3 }, /* (4) account_options ::= account_options TSERIES literal */
+ { 314, -3 }, /* (5) account_options ::= account_options STORAGE literal */
+ { 314, -3 }, /* (6) account_options ::= account_options STREAMS literal */
+ { 314, -3 }, /* (7) account_options ::= account_options QTIME literal */
+ { 314, -3 }, /* (8) account_options ::= account_options DBS literal */
+ { 314, -3 }, /* (9) account_options ::= account_options USERS literal */
+ { 314, -3 }, /* (10) account_options ::= account_options CONNS literal */
+ { 314, -3 }, /* (11) account_options ::= account_options STATE literal */
+ { 315, -1 }, /* (12) alter_account_options ::= alter_account_option */
+ { 315, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ { 317, -2 }, /* (14) alter_account_option ::= PASS literal */
+ { 317, -2 }, /* (15) alter_account_option ::= PPS literal */
+ { 317, -2 }, /* (16) alter_account_option ::= TSERIES literal */
+ { 317, -2 }, /* (17) alter_account_option ::= STORAGE literal */
+ { 317, -2 }, /* (18) alter_account_option ::= STREAMS literal */
+ { 317, -2 }, /* (19) alter_account_option ::= QTIME literal */
+ { 317, -2 }, /* (20) alter_account_option ::= DBS literal */
+ { 317, -2 }, /* (21) alter_account_option ::= USERS literal */
+ { 317, -2 }, /* (22) alter_account_option ::= CONNS literal */
+ { 317, -2 }, /* (23) alter_account_option ::= STATE literal */
+ { 313, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
+ { 313, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
+ { 313, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ { 313, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ { 313, -3 }, /* (28) cmd ::= DROP USER user_name */
+ { 319, 0 }, /* (29) sysinfo_opt ::= */
+ { 319, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ { 313, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
+ { 313, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
+ { 320, -1 }, /* (33) privileges ::= ALL */
+ { 320, -1 }, /* (34) privileges ::= priv_type_list */
+ { 322, -1 }, /* (35) priv_type_list ::= priv_type */
+ { 322, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ { 323, -1 }, /* (37) priv_type ::= READ */
+ { 323, -1 }, /* (38) priv_type ::= WRITE */
+ { 321, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ { 321, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */
+ { 313, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */
+ { 313, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ { 313, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */
+ { 313, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */
+ { 313, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ { 313, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ { 313, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */
+ { 313, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ { 325, -1 }, /* (49) dnode_endpoint ::= NK_STRING */
+ { 325, -1 }, /* (50) dnode_endpoint ::= NK_ID */
+ { 325, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */
+ { 313, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */
+ { 313, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ { 313, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ { 313, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ { 313, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */
+ { 313, -2 }, /* (64) cmd ::= USE db_name */
+ { 313, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */
+ { 313, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */
+ { 313, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */
+ { 326, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */
+ { 326, 0 }, /* (69) not_exists_opt ::= */
+ { 328, -2 }, /* (70) exists_opt ::= IF EXISTS */
+ { 328, 0 }, /* (71) exists_opt ::= */
+ { 327, 0 }, /* (72) db_options ::= */
+ { 327, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */
+ { 327, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */
+ { 327, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */
+ { 327, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */
+ { 327, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */
+ { 327, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */
+ { 327, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */
+ { 327, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */
+ { 327, -3 }, /* (81) db_options ::= db_options KEEP integer_list */
+ { 327, -3 }, /* (82) db_options ::= db_options KEEP variable_list */
+ { 327, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */
+ { 327, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */
+ { 327, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ { 327, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */
+ { 327, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */
+ { 327, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */
+ { 327, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */
+ { 327, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ { 327, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */
+ { 327, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ { 327, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ { 327, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ { 327, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ { 327, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ { 327, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ { 327, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ { 327, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ { 327, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ { 327, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ { 327, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+ { 327, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+ { 329, -1 }, /* (104) alter_db_options ::= alter_db_option */
+ { 329, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */
+ { 333, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */
+ { 333, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */
+ { 333, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ { 333, -2 }, /* (109) alter_db_option ::= KEEP integer_list */
+ { 333, -2 }, /* (110) alter_db_option ::= KEEP variable_list */
+ { 333, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ { 333, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ { 330, -1 }, /* (113) integer_list ::= NK_INTEGER */
+ { 330, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ { 331, -1 }, /* (115) variable_list ::= NK_VARIABLE */
+ { 331, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ { 332, -1 }, /* (117) retention_list ::= retention */
+ { 332, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */
+ { 334, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ { 313, -9 }, /* (120) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ { 313, -3 }, /* (121) cmd ::= CREATE TABLE multi_create_clause */
+ { 313, -9 }, /* (122) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ { 313, -3 }, /* (123) cmd ::= DROP TABLE multi_drop_clause */
+ { 313, -4 }, /* (124) cmd ::= DROP STABLE exists_opt full_table_name */
+ { 313, -3 }, /* (125) cmd ::= ALTER TABLE alter_table_clause */
+ { 313, -3 }, /* (126) cmd ::= ALTER STABLE alter_table_clause */
+ { 342, -2 }, /* (127) alter_table_clause ::= full_table_name alter_table_options */
+ { 342, -5 }, /* (128) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ { 342, -4 }, /* (129) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ { 342, -5 }, /* (130) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ { 342, -5 }, /* (131) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ { 342, -5 }, /* (132) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ { 342, -4 }, /* (133) alter_table_clause ::= full_table_name DROP TAG column_name */
+ { 342, -5 }, /* (134) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ { 342, -5 }, /* (135) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ { 342, -6 }, /* (136) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ { 339, -1 }, /* (137) multi_create_clause ::= create_subtable_clause */
+ { 339, -2 }, /* (138) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ { 347, -10 }, /* (139) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
+ { 341, -1 }, /* (140) multi_drop_clause ::= drop_table_clause */
+ { 341, -2 }, /* (141) multi_drop_clause ::= multi_drop_clause drop_table_clause */
+ { 350, -2 }, /* (142) drop_table_clause ::= exists_opt full_table_name */
+ { 348, 0 }, /* (143) specific_cols_opt ::= */
+ { 348, -3 }, /* (144) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ { 335, -1 }, /* (145) full_table_name ::= table_name */
+ { 335, -3 }, /* (146) full_table_name ::= db_name NK_DOT table_name */
+ { 336, -1 }, /* (147) column_def_list ::= column_def */
+ { 336, -3 }, /* (148) column_def_list ::= column_def_list NK_COMMA column_def */
+ { 353, -2 }, /* (149) column_def ::= column_name type_name */
+ { 353, -4 }, /* (150) column_def ::= column_name type_name COMMENT NK_STRING */
+ { 345, -1 }, /* (151) type_name ::= BOOL */
+ { 345, -1 }, /* (152) type_name ::= TINYINT */
+ { 345, -1 }, /* (153) type_name ::= SMALLINT */
+ { 345, -1 }, /* (154) type_name ::= INT */
+ { 345, -1 }, /* (155) type_name ::= INTEGER */
+ { 345, -1 }, /* (156) type_name ::= BIGINT */
+ { 345, -1 }, /* (157) type_name ::= FLOAT */
+ { 345, -1 }, /* (158) type_name ::= DOUBLE */
+ { 345, -4 }, /* (159) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ { 345, -1 }, /* (160) type_name ::= TIMESTAMP */
+ { 345, -4 }, /* (161) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ { 345, -2 }, /* (162) type_name ::= TINYINT UNSIGNED */
+ { 345, -2 }, /* (163) type_name ::= SMALLINT UNSIGNED */
+ { 345, -2 }, /* (164) type_name ::= INT UNSIGNED */
+ { 345, -2 }, /* (165) type_name ::= BIGINT UNSIGNED */
+ { 345, -1 }, /* (166) type_name ::= JSON */
+ { 345, -4 }, /* (167) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ { 345, -1 }, /* (168) type_name ::= MEDIUMBLOB */
+ { 345, -1 }, /* (169) type_name ::= BLOB */
+ { 345, -4 }, /* (170) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ { 345, -1 }, /* (171) type_name ::= DECIMAL */
+ { 345, -4 }, /* (172) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ { 345, -6 }, /* (173) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ { 337, 0 }, /* (174) tags_def_opt ::= */
+ { 337, -1 }, /* (175) tags_def_opt ::= tags_def */
+ { 340, -4 }, /* (176) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ { 338, 0 }, /* (177) table_options ::= */
+ { 338, -3 }, /* (178) table_options ::= table_options COMMENT NK_STRING */
+ { 338, -3 }, /* (179) table_options ::= table_options MAX_DELAY duration_list */
+ { 338, -3 }, /* (180) table_options ::= table_options WATERMARK duration_list */
+ { 338, -5 }, /* (181) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ { 338, -3 }, /* (182) table_options ::= table_options TTL NK_INTEGER */
+ { 338, -5 }, /* (183) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ { 343, -1 }, /* (184) alter_table_options ::= alter_table_option */
+ { 343, -2 }, /* (185) alter_table_options ::= alter_table_options alter_table_option */
+ { 356, -2 }, /* (186) alter_table_option ::= COMMENT NK_STRING */
+ { 356, -2 }, /* (187) alter_table_option ::= TTL NK_INTEGER */
+ { 354, -1 }, /* (188) duration_list ::= duration_literal */
+ { 354, -3 }, /* (189) duration_list ::= duration_list NK_COMMA duration_literal */
+ { 355, -1 }, /* (190) rollup_func_list ::= rollup_func_name */
+ { 355, -3 }, /* (191) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ { 358, -1 }, /* (192) rollup_func_name ::= function_name */
+ { 358, -1 }, /* (193) rollup_func_name ::= FIRST */
+ { 358, -1 }, /* (194) rollup_func_name ::= LAST */
+ { 351, -1 }, /* (195) col_name_list ::= col_name */
+ { 351, -3 }, /* (196) col_name_list ::= col_name_list NK_COMMA col_name */
+ { 360, -1 }, /* (197) col_name ::= column_name */
+ { 313, -2 }, /* (198) cmd ::= SHOW DNODES */
+ { 313, -2 }, /* (199) cmd ::= SHOW USERS */
+ { 313, -2 }, /* (200) cmd ::= SHOW DATABASES */
+ { 313, -4 }, /* (201) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+ { 313, -4 }, /* (202) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ { 313, -3 }, /* (203) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ { 313, -2 }, /* (204) cmd ::= SHOW MNODES */
+ { 313, -2 }, /* (205) cmd ::= SHOW MODULES */
+ { 313, -2 }, /* (206) cmd ::= SHOW QNODES */
+ { 313, -2 }, /* (207) cmd ::= SHOW FUNCTIONS */
+ { 313, -5 }, /* (208) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ { 313, -2 }, /* (209) cmd ::= SHOW STREAMS */
+ { 313, -2 }, /* (210) cmd ::= SHOW ACCOUNTS */
+ { 313, -2 }, /* (211) cmd ::= SHOW APPS */
+ { 313, -2 }, /* (212) cmd ::= SHOW CONNECTIONS */
+ { 313, -2 }, /* (213) cmd ::= SHOW LICENCES */
+ { 313, -2 }, /* (214) cmd ::= SHOW GRANTS */
+ { 313, -4 }, /* (215) cmd ::= SHOW CREATE DATABASE db_name */
+ { 313, -4 }, /* (216) cmd ::= SHOW CREATE TABLE full_table_name */
+ { 313, -4 }, /* (217) cmd ::= SHOW CREATE STABLE full_table_name */
+ { 313, -2 }, /* (218) cmd ::= SHOW QUERIES */
+ { 313, -2 }, /* (219) cmd ::= SHOW SCORES */
+ { 313, -2 }, /* (220) cmd ::= SHOW TOPICS */
+ { 313, -2 }, /* (221) cmd ::= SHOW VARIABLES */
+ { 313, -3 }, /* (222) cmd ::= SHOW LOCAL VARIABLES */
+ { 313, -4 }, /* (223) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */
+ { 313, -2 }, /* (224) cmd ::= SHOW BNODES */
+ { 313, -2 }, /* (225) cmd ::= SHOW SNODES */
+ { 313, -2 }, /* (226) cmd ::= SHOW CLUSTER */
+ { 313, -2 }, /* (227) cmd ::= SHOW TRANSACTIONS */
+ { 313, -4 }, /* (228) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ { 313, -2 }, /* (229) cmd ::= SHOW CONSUMERS */
+ { 313, -2 }, /* (230) cmd ::= SHOW SUBSCRIPTIONS */
+ { 313, -5 }, /* (231) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ { 313, -3 }, /* (232) cmd ::= SHOW VNODES NK_INTEGER */
+ { 313, -3 }, /* (233) cmd ::= SHOW VNODES NK_STRING */
+ { 361, 0 }, /* (234) db_name_cond_opt ::= */
+ { 361, -2 }, /* (235) db_name_cond_opt ::= db_name NK_DOT */
+ { 362, 0 }, /* (236) like_pattern_opt ::= */
+ { 362, -2 }, /* (237) like_pattern_opt ::= LIKE NK_STRING */
+ { 363, -1 }, /* (238) table_name_cond ::= table_name */
+ { 364, 0 }, /* (239) from_db_opt ::= */
+ { 364, -2 }, /* (240) from_db_opt ::= FROM db_name */
+ { 313, -8 }, /* (241) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
+ { 313, -4 }, /* (242) cmd ::= DROP INDEX exists_opt full_table_name */
+ { 365, -10 }, /* (243) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 365, -12 }, /* (244) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 366, -1 }, /* (245) func_list ::= func */
+ { 366, -3 }, /* (246) func_list ::= func_list NK_COMMA func */
+ { 369, -4 }, /* (247) func ::= function_name NK_LP expression_list NK_RP */
+ { 368, 0 }, /* (248) sma_stream_opt ::= */
+ { 368, -3 }, /* (249) sma_stream_opt ::= stream_options WATERMARK duration_literal */
+ { 368, -3 }, /* (250) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
+ { 313, -6 }, /* (251) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ { 313, -7 }, /* (252) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+ { 313, -9 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+ { 313, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+ { 313, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+ { 313, -4 }, /* (256) cmd ::= DROP TOPIC exists_opt topic_name */
+ { 313, -7 }, /* (257) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ { 313, -2 }, /* (258) cmd ::= DESC full_table_name */
+ { 313, -2 }, /* (259) cmd ::= DESCRIBE full_table_name */
+ { 313, -3 }, /* (260) cmd ::= RESET QUERY CACHE */
+ { 313, -4 }, /* (261) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ { 374, 0 }, /* (262) analyze_opt ::= */
+ { 374, -1 }, /* (263) analyze_opt ::= ANALYZE */
+ { 375, 0 }, /* (264) explain_options ::= */
+ { 375, -3 }, /* (265) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 375, -3 }, /* (266) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 313, -10 }, /* (267) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+ { 313, -4 }, /* (268) cmd ::= DROP FUNCTION exists_opt function_name */
+ { 376, 0 }, /* (269) agg_func_opt ::= */
+ { 376, -1 }, /* (270) agg_func_opt ::= AGGREGATE */
+ { 377, 0 }, /* (271) bufsize_opt ::= */
+ { 377, -2 }, /* (272) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 313, -9 }, /* (273) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery */
+ { 313, -4 }, /* (274) cmd ::= DROP STREAM exists_opt stream_name */
+ { 370, 0 }, /* (275) stream_options ::= */
+ { 370, -3 }, /* (276) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 370, -3 }, /* (277) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 370, -4 }, /* (278) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 370, -3 }, /* (279) stream_options ::= stream_options WATERMARK duration_literal */
+ { 370, -4 }, /* (280) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ { 313, -3 }, /* (281) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 313, -3 }, /* (282) cmd ::= KILL QUERY NK_STRING */
+ { 313, -3 }, /* (283) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 313, -2 }, /* (284) cmd ::= BALANCE VGROUP */
+ { 313, -4 }, /* (285) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 313, -4 }, /* (286) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 313, -3 }, /* (287) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 379, -2 }, /* (288) dnode_list ::= DNODE NK_INTEGER */
+ { 379, -3 }, /* (289) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 313, -4 }, /* (290) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ { 313, -1 }, /* (291) cmd ::= query_or_subquery */
+ { 313, -7 }, /* (292) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ { 313, -4 }, /* (293) cmd ::= INSERT INTO full_table_name query_or_subquery */
+ { 316, -1 }, /* (294) literal ::= NK_INTEGER */
+ { 316, -1 }, /* (295) literal ::= NK_FLOAT */
+ { 316, -1 }, /* (296) literal ::= NK_STRING */
+ { 316, -1 }, /* (297) literal ::= NK_BOOL */
+ { 316, -2 }, /* (298) literal ::= TIMESTAMP NK_STRING */
+ { 316, -1 }, /* (299) literal ::= duration_literal */
+ { 316, -1 }, /* (300) literal ::= NULL */
+ { 316, -1 }, /* (301) literal ::= NK_QUESTION */
+ { 357, -1 }, /* (302) duration_literal ::= NK_VARIABLE */
+ { 381, -1 }, /* (303) signed ::= NK_INTEGER */
+ { 381, -2 }, /* (304) signed ::= NK_PLUS NK_INTEGER */
+ { 381, -2 }, /* (305) signed ::= NK_MINUS NK_INTEGER */
+ { 381, -1 }, /* (306) signed ::= NK_FLOAT */
+ { 381, -2 }, /* (307) signed ::= NK_PLUS NK_FLOAT */
+ { 381, -2 }, /* (308) signed ::= NK_MINUS NK_FLOAT */
+ { 346, -1 }, /* (309) signed_literal ::= signed */
+ { 346, -1 }, /* (310) signed_literal ::= NK_STRING */
+ { 346, -1 }, /* (311) signed_literal ::= NK_BOOL */
+ { 346, -2 }, /* (312) signed_literal ::= TIMESTAMP NK_STRING */
+ { 346, -1 }, /* (313) signed_literal ::= duration_literal */
+ { 346, -1 }, /* (314) signed_literal ::= NULL */
+ { 346, -1 }, /* (315) signed_literal ::= literal_func */
+ { 346, -1 }, /* (316) signed_literal ::= NK_QUESTION */
+ { 383, -1 }, /* (317) literal_list ::= signed_literal */
+ { 383, -3 }, /* (318) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 324, -1 }, /* (319) db_name ::= NK_ID */
+ { 352, -1 }, /* (320) table_name ::= NK_ID */
+ { 344, -1 }, /* (321) column_name ::= NK_ID */
+ { 359, -1 }, /* (322) function_name ::= NK_ID */
+ { 384, -1 }, /* (323) table_alias ::= NK_ID */
+ { 385, -1 }, /* (324) column_alias ::= NK_ID */
+ { 318, -1 }, /* (325) user_name ::= NK_ID */
+ { 371, -1 }, /* (326) topic_name ::= NK_ID */
+ { 378, -1 }, /* (327) stream_name ::= NK_ID */
+ { 373, -1 }, /* (328) cgroup_name ::= NK_ID */
+ { 386, -1 }, /* (329) expr_or_subquery ::= expression */
+ { 386, -1 }, /* (330) expr_or_subquery ::= subquery */
+ { 387, -1 }, /* (331) expression ::= literal */
+ { 387, -1 }, /* (332) expression ::= pseudo_column */
+ { 387, -1 }, /* (333) expression ::= column_reference */
+ { 387, -1 }, /* (334) expression ::= function_expression */
+ { 387, -1 }, /* (335) expression ::= case_when_expression */
+ { 387, -3 }, /* (336) expression ::= NK_LP expression NK_RP */
+ { 387, -2 }, /* (337) expression ::= NK_PLUS expr_or_subquery */
+ { 387, -2 }, /* (338) expression ::= NK_MINUS expr_or_subquery */
+ { 387, -3 }, /* (339) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ { 387, -3 }, /* (340) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ { 387, -3 }, /* (341) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ { 387, -3 }, /* (342) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ { 387, -3 }, /* (343) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ { 387, -3 }, /* (344) expression ::= column_reference NK_ARROW NK_STRING */
+ { 387, -3 }, /* (345) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ { 387, -3 }, /* (346) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ { 349, -1 }, /* (347) expression_list ::= expr_or_subquery */
+ { 349, -3 }, /* (348) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ { 390, -1 }, /* (349) column_reference ::= column_name */
+ { 390, -3 }, /* (350) column_reference ::= table_name NK_DOT column_name */
+ { 389, -1 }, /* (351) pseudo_column ::= ROWTS */
+ { 389, -1 }, /* (352) pseudo_column ::= TBNAME */
+ { 389, -3 }, /* (353) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 389, -1 }, /* (354) pseudo_column ::= QSTART */
+ { 389, -1 }, /* (355) pseudo_column ::= QEND */
+ { 389, -1 }, /* (356) pseudo_column ::= QDURATION */
+ { 389, -1 }, /* (357) pseudo_column ::= WSTART */
+ { 389, -1 }, /* (358) pseudo_column ::= WEND */
+ { 389, -1 }, /* (359) pseudo_column ::= WDURATION */
+ { 391, -4 }, /* (360) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 391, -4 }, /* (361) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 391, -6 }, /* (362) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ { 391, -1 }, /* (363) function_expression ::= literal_func */
+ { 382, -3 }, /* (364) literal_func ::= noarg_func NK_LP NK_RP */
+ { 382, -1 }, /* (365) literal_func ::= NOW */
+ { 395, -1 }, /* (366) noarg_func ::= NOW */
+ { 395, -1 }, /* (367) noarg_func ::= TODAY */
+ { 395, -1 }, /* (368) noarg_func ::= TIMEZONE */
+ { 395, -1 }, /* (369) noarg_func ::= DATABASE */
+ { 395, -1 }, /* (370) noarg_func ::= CLIENT_VERSION */
+ { 395, -1 }, /* (371) noarg_func ::= SERVER_VERSION */
+ { 395, -1 }, /* (372) noarg_func ::= SERVER_STATUS */
+ { 395, -1 }, /* (373) noarg_func ::= CURRENT_USER */
+ { 395, -1 }, /* (374) noarg_func ::= USER */
+ { 393, -1 }, /* (375) star_func ::= COUNT */
+ { 393, -1 }, /* (376) star_func ::= FIRST */
+ { 393, -1 }, /* (377) star_func ::= LAST */
+ { 393, -1 }, /* (378) star_func ::= LAST_ROW */
+ { 394, -1 }, /* (379) star_func_para_list ::= NK_STAR */
+ { 394, -1 }, /* (380) star_func_para_list ::= other_para_list */
+ { 396, -1 }, /* (381) other_para_list ::= star_func_para */
+ { 396, -3 }, /* (382) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 397, -1 }, /* (383) star_func_para ::= expr_or_subquery */
+ { 397, -3 }, /* (384) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 392, -4 }, /* (385) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ { 392, -5 }, /* (386) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ { 398, -1 }, /* (387) when_then_list ::= when_then_expr */
+ { 398, -2 }, /* (388) when_then_list ::= when_then_list when_then_expr */
+ { 401, -4 }, /* (389) when_then_expr ::= WHEN common_expression THEN common_expression */
+ { 399, 0 }, /* (390) case_when_else_opt ::= */
+ { 399, -2 }, /* (391) case_when_else_opt ::= ELSE common_expression */
+ { 402, -3 }, /* (392) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ { 402, -5 }, /* (393) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 402, -6 }, /* (394) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 402, -3 }, /* (395) predicate ::= expr_or_subquery IS NULL */
+ { 402, -4 }, /* (396) predicate ::= expr_or_subquery IS NOT NULL */
+ { 402, -3 }, /* (397) predicate ::= expr_or_subquery in_op in_predicate_value */
+ { 403, -1 }, /* (398) compare_op ::= NK_LT */
+ { 403, -1 }, /* (399) compare_op ::= NK_GT */
+ { 403, -1 }, /* (400) compare_op ::= NK_LE */
+ { 403, -1 }, /* (401) compare_op ::= NK_GE */
+ { 403, -1 }, /* (402) compare_op ::= NK_NE */
+ { 403, -1 }, /* (403) compare_op ::= NK_EQ */
+ { 403, -1 }, /* (404) compare_op ::= LIKE */
+ { 403, -2 }, /* (405) compare_op ::= NOT LIKE */
+ { 403, -1 }, /* (406) compare_op ::= MATCH */
+ { 403, -1 }, /* (407) compare_op ::= NMATCH */
+ { 403, -1 }, /* (408) compare_op ::= CONTAINS */
+ { 404, -1 }, /* (409) in_op ::= IN */
+ { 404, -2 }, /* (410) in_op ::= NOT IN */
+ { 405, -3 }, /* (411) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 406, -1 }, /* (412) boolean_value_expression ::= boolean_primary */
+ { 406, -2 }, /* (413) boolean_value_expression ::= NOT boolean_primary */
+ { 406, -3 }, /* (414) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 406, -3 }, /* (415) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 407, -1 }, /* (416) boolean_primary ::= predicate */
+ { 407, -3 }, /* (417) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 400, -1 }, /* (418) common_expression ::= expr_or_subquery */
+ { 400, -1 }, /* (419) common_expression ::= boolean_value_expression */
+ { 408, 0 }, /* (420) from_clause_opt ::= */
+ { 408, -2 }, /* (421) from_clause_opt ::= FROM table_reference_list */
+ { 409, -1 }, /* (422) table_reference_list ::= table_reference */
+ { 409, -3 }, /* (423) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 410, -1 }, /* (424) table_reference ::= table_primary */
+ { 410, -1 }, /* (425) table_reference ::= joined_table */
+ { 411, -2 }, /* (426) table_primary ::= table_name alias_opt */
+ { 411, -4 }, /* (427) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 411, -2 }, /* (428) table_primary ::= subquery alias_opt */
+ { 411, -1 }, /* (429) table_primary ::= parenthesized_joined_table */
+ { 413, 0 }, /* (430) alias_opt ::= */
+ { 413, -1 }, /* (431) alias_opt ::= table_alias */
+ { 413, -2 }, /* (432) alias_opt ::= AS table_alias */
+ { 414, -3 }, /* (433) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 414, -3 }, /* (434) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 412, -6 }, /* (435) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 415, 0 }, /* (436) join_type ::= */
+ { 415, -1 }, /* (437) join_type ::= INNER */
+ { 417, -12 }, /* (438) 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 */
+ { 418, 0 }, /* (439) set_quantifier_opt ::= */
+ { 418, -1 }, /* (440) set_quantifier_opt ::= DISTINCT */
+ { 418, -1 }, /* (441) set_quantifier_opt ::= ALL */
+ { 419, -1 }, /* (442) select_list ::= select_item */
+ { 419, -3 }, /* (443) select_list ::= select_list NK_COMMA select_item */
+ { 427, -1 }, /* (444) select_item ::= NK_STAR */
+ { 427, -1 }, /* (445) select_item ::= common_expression */
+ { 427, -2 }, /* (446) select_item ::= common_expression column_alias */
+ { 427, -3 }, /* (447) select_item ::= common_expression AS column_alias */
+ { 427, -3 }, /* (448) select_item ::= table_name NK_DOT NK_STAR */
+ { 380, 0 }, /* (449) where_clause_opt ::= */
+ { 380, -2 }, /* (450) where_clause_opt ::= WHERE search_condition */
+ { 420, 0 }, /* (451) partition_by_clause_opt ::= */
+ { 420, -3 }, /* (452) partition_by_clause_opt ::= PARTITION BY expression_list */
+ { 424, 0 }, /* (453) twindow_clause_opt ::= */
+ { 424, -6 }, /* (454) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 424, -4 }, /* (455) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ { 424, -6 }, /* (456) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 424, -8 }, /* (457) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 367, 0 }, /* (458) sliding_opt ::= */
+ { 367, -4 }, /* (459) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 423, 0 }, /* (460) fill_opt ::= */
+ { 423, -4 }, /* (461) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 423, -6 }, /* (462) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 428, -1 }, /* (463) fill_mode ::= NONE */
+ { 428, -1 }, /* (464) fill_mode ::= PREV */
+ { 428, -1 }, /* (465) fill_mode ::= NULL */
+ { 428, -1 }, /* (466) fill_mode ::= LINEAR */
+ { 428, -1 }, /* (467) fill_mode ::= NEXT */
+ { 425, 0 }, /* (468) group_by_clause_opt ::= */
+ { 425, -3 }, /* (469) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 429, -1 }, /* (470) group_by_list ::= expr_or_subquery */
+ { 429, -3 }, /* (471) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ { 426, 0 }, /* (472) having_clause_opt ::= */
+ { 426, -2 }, /* (473) having_clause_opt ::= HAVING search_condition */
+ { 421, 0 }, /* (474) range_opt ::= */
+ { 421, -6 }, /* (475) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ { 422, 0 }, /* (476) every_opt ::= */
+ { 422, -4 }, /* (477) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 430, -4 }, /* (478) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 431, -1 }, /* (479) query_simple ::= query_specification */
+ { 431, -1 }, /* (480) query_simple ::= union_query_expression */
+ { 435, -4 }, /* (481) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ { 435, -3 }, /* (482) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ { 436, -1 }, /* (483) query_simple_or_subquery ::= query_simple */
+ { 436, -1 }, /* (484) query_simple_or_subquery ::= subquery */
+ { 372, -1 }, /* (485) query_or_subquery ::= query_expression */
+ { 372, -1 }, /* (486) query_or_subquery ::= subquery */
+ { 432, 0 }, /* (487) order_by_clause_opt ::= */
+ { 432, -3 }, /* (488) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 433, 0 }, /* (489) slimit_clause_opt ::= */
+ { 433, -2 }, /* (490) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 433, -4 }, /* (491) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 433, -4 }, /* (492) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 434, 0 }, /* (493) limit_clause_opt ::= */
+ { 434, -2 }, /* (494) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 434, -4 }, /* (495) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 434, -4 }, /* (496) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 388, -3 }, /* (497) subquery ::= NK_LP query_expression NK_RP */
+ { 388, -3 }, /* (498) subquery ::= NK_LP subquery NK_RP */
+ { 416, -1 }, /* (499) search_condition ::= common_expression */
+ { 437, -1 }, /* (500) sort_specification_list ::= sort_specification */
+ { 437, -3 }, /* (501) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 438, -3 }, /* (502) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ { 439, 0 }, /* (503) ordering_specification_opt ::= */
+ { 439, -1 }, /* (504) ordering_specification_opt ::= ASC */
+ { 439, -1 }, /* (505) ordering_specification_opt ::= DESC */
+ { 440, 0 }, /* (506) null_ordering_opt ::= */
+ { 440, -2 }, /* (507) null_ordering_opt ::= NULLS FIRST */
+ { 440, -2 }, /* (508) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3395,11 +3507,11 @@ static YYACTIONTYPE yy_reduce(
YYMINORTYPE yylhsminor;
case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,310,&yymsp[0].minor);
+ yy_destructor(yypParser,314,&yymsp[0].minor);
break;
case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,311,&yymsp[0].minor);
+ yy_destructor(yypParser,315,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -3413,20 +3525,20 @@ static YYACTIONTYPE yy_reduce(
case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9);
case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
-{ yy_destructor(yypParser,310,&yymsp[-2].minor);
+{ yy_destructor(yypParser,314,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,312,&yymsp[0].minor);
+ yy_destructor(yypParser,316,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,313,&yymsp[0].minor);
+{ yy_destructor(yypParser,317,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,311,&yymsp[-1].minor);
+{ yy_destructor(yypParser,315,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,313,&yymsp[0].minor);
+ yy_destructor(yypParser,317,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -3440,72 +3552,72 @@ static YYACTIONTYPE yy_reduce(
case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22);
case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
{ }
- yy_destructor(yypParser,312,&yymsp[0].minor);
+ yy_destructor(yypParser,316,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy641, &yymsp[-1].minor.yy0, yymsp[0].minor.yy503); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy659, &yymsp[-1].minor.yy0, yymsp[0].minor.yy341); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy641, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy659, 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.yy641, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy659, 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.yy641, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy659, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy659); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy503 = 1; }
+{ yymsp[1].minor.yy341 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy503 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy341 = 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.yy477, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy459, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); }
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy477, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy459, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35);
-{ yylhsminor.yy477 = yymsp[0].minor.yy477; }
- yymsp[0].minor.yy477 = yylhsminor.yy477;
+{ yylhsminor.yy459 = yymsp[0].minor.yy459; }
+ yymsp[0].minor.yy459 = yylhsminor.yy459;
break;
case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy477 = yymsp[-2].minor.yy477 | yymsp[0].minor.yy477; }
- yymsp[-2].minor.yy477 = yylhsminor.yy477;
+{ yylhsminor.yy459 = yymsp[-2].minor.yy459 | yymsp[0].minor.yy459; }
+ yymsp[-2].minor.yy459 = yylhsminor.yy459;
break;
case 37: /* priv_type ::= READ */
-{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_READ; }
break;
case 38: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_WRITE; }
break;
case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy641 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy641 = yylhsminor.yy641;
+{ yylhsminor.yy659 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy659 = yylhsminor.yy659;
break;
case 40: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy641 = yymsp[-2].minor.yy641; }
- yymsp[-2].minor.yy641 = yylhsminor.yy641;
+{ yylhsminor.yy659 = yymsp[-2].minor.yy659; }
+ yymsp[-2].minor.yy659 = yylhsminor.yy659;
break;
case 41: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy641, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy659, NULL); }
break;
case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy659, &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.yy641); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy659); }
break;
case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3532,21 +3644,21 @@ static YYACTIONTYPE yy_reduce(
case 326: /* topic_name ::= NK_ID */ yytestcase(yyruleno==326);
case 327: /* stream_name ::= NK_ID */ yytestcase(yyruleno==327);
case 328: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==328);
- case 364: /* noarg_func ::= NOW */ yytestcase(yyruleno==364);
- case 365: /* noarg_func ::= TODAY */ yytestcase(yyruleno==365);
- case 366: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==366);
- case 367: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==367);
- case 368: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==368);
- case 369: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==369);
- case 370: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==370);
- case 371: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==371);
- case 372: /* noarg_func ::= USER */ yytestcase(yyruleno==372);
- case 373: /* star_func ::= COUNT */ yytestcase(yyruleno==373);
- case 374: /* star_func ::= FIRST */ yytestcase(yyruleno==374);
- case 375: /* star_func ::= LAST */ yytestcase(yyruleno==375);
- case 376: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==376);
-{ yylhsminor.yy641 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy641 = yylhsminor.yy641;
+ case 366: /* noarg_func ::= NOW */ yytestcase(yyruleno==366);
+ case 367: /* noarg_func ::= TODAY */ yytestcase(yyruleno==367);
+ case 368: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==368);
+ case 369: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==369);
+ case 370: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==370);
+ case 371: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==371);
+ case 372: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==372);
+ case 373: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==373);
+ case 374: /* noarg_func ::= USER */ yytestcase(yyruleno==374);
+ case 375: /* star_func ::= COUNT */ yytestcase(yyruleno==375);
+ case 376: /* star_func ::= FIRST */ yytestcase(yyruleno==376);
+ case 377: /* star_func ::= LAST */ yytestcase(yyruleno==377);
+ case 378: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==378);
+{ yylhsminor.yy659 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy659 = yylhsminor.yy659;
break;
case 52: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -3579,208 +3691,208 @@ 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.yy281, &yymsp[-1].minor.yy641, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy659, yymsp[0].minor.yy560); }
break;
case 63: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); }
break;
case 64: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy659); }
break;
case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy641, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy659, yymsp[0].minor.yy560); }
break;
case 66: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy659); }
break;
case 67: /* cmd ::= TRIM DATABASE db_name */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy659); }
break;
case 68: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy281 = true; }
+{ yymsp[-2].minor.yy173 = true; }
break;
case 69: /* not_exists_opt ::= */
case 71: /* exists_opt ::= */ yytestcase(yyruleno==71);
case 262: /* analyze_opt ::= */ yytestcase(yyruleno==262);
case 269: /* agg_func_opt ::= */ yytestcase(yyruleno==269);
- case 430: /* set_quantifier_opt ::= */ yytestcase(yyruleno==430);
-{ yymsp[1].minor.yy281 = false; }
+ case 439: /* set_quantifier_opt ::= */ yytestcase(yyruleno==439);
+{ yymsp[1].minor.yy173 = false; }
break;
case 70: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy281 = true; }
+{ yymsp[-1].minor.yy173 = true; }
break;
case 72: /* db_options ::= */
-{ yymsp[1].minor.yy776 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); }
break;
case 73: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 76: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 77: /* db_options ::= db_options DURATION NK_INTEGER */
case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78);
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 80: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 81: /* db_options ::= db_options KEEP integer_list */
case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82);
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_KEEP, yymsp[0].minor.yy280); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy334); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 83: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 85: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 86: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 87: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 88: /* db_options ::= db_options STRICT NK_STRING */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 89: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 90: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 91: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_RETENTIONS, yymsp[0].minor.yy280); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy334); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 92: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 93: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 94: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 96: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-3].minor.yy776, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 98: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-3].minor.yy776, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 99: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 100: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 101: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 102: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 103: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
-{ yylhsminor.yy776 = setDatabaseOption(pCxt, yymsp[-2].minor.yy776, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 104: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy776 = createAlterDatabaseOptions(pCxt); yylhsminor.yy776 = setAlterDatabaseOption(pCxt, yylhsminor.yy776, &yymsp[0].minor.yy605); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy515); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 105: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy776 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy776, &yymsp[0].minor.yy605); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy515); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 106: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy605.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy515.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; }
break;
case 107: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy605.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy515.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; }
break;
case 108: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy605.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy515.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; }
break;
case 109: /* alter_db_option ::= KEEP integer_list */
case 110: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==110);
-{ yymsp[-1].minor.yy605.type = DB_OPTION_KEEP; yymsp[-1].minor.yy605.pList = yymsp[0].minor.yy280; }
+{ yymsp[-1].minor.yy515.type = DB_OPTION_KEEP; yymsp[-1].minor.yy515.pList = yymsp[0].minor.yy334; }
break;
case 111: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy605.type = DB_OPTION_WAL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy515.type = DB_OPTION_WAL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; }
break;
case 112: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-{ yymsp[-1].minor.yy605.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy515.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; }
break;
case 113: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy280 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy280 = yylhsminor.yy280;
+{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy334 = yylhsminor.yy334;
break;
case 114: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
case 289: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==289);
-{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy280 = yylhsminor.yy280;
+{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy334 = yylhsminor.yy334;
break;
case 115: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy280 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy280 = yylhsminor.yy280;
+{ yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy334 = yylhsminor.yy334;
break;
case 116: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy280 = yylhsminor.yy280;
+{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy334 = yylhsminor.yy334;
break;
case 117: /* retention_list ::= retention */
case 137: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==137);
@@ -3790,11 +3902,12 @@ static YYACTIONTYPE yy_reduce(
case 195: /* col_name_list ::= col_name */ yytestcase(yyruleno==195);
case 245: /* func_list ::= func */ yytestcase(yyruleno==245);
case 317: /* literal_list ::= signed_literal */ yytestcase(yyruleno==317);
- case 379: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==379);
- case 433: /* select_list ::= select_item */ yytestcase(yyruleno==433);
- case 490: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==490);
-{ yylhsminor.yy280 = createNodeList(pCxt, yymsp[0].minor.yy776); }
- yymsp[0].minor.yy280 = yylhsminor.yy280;
+ case 381: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==381);
+ case 387: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==387);
+ case 442: /* select_list ::= select_item */ yytestcase(yyruleno==442);
+ case 500: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==500);
+{ yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy560); }
+ yymsp[0].minor.yy334 = yylhsminor.yy334;
break;
case 118: /* retention_list ::= retention_list NK_COMMA retention */
case 148: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==148);
@@ -3802,253 +3915,254 @@ static YYACTIONTYPE yy_reduce(
case 196: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==196);
case 246: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==246);
case 318: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==318);
- case 380: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==380);
- case 434: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==434);
- case 491: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==491);
-{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, yymsp[0].minor.yy776); }
- yymsp[-2].minor.yy280 = yylhsminor.yy280;
+ case 382: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==382);
+ case 443: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==443);
+ case 501: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==501);
+{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); }
+ yymsp[-2].minor.yy334 = yylhsminor.yy334;
break;
case 119: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy776 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 120: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 122: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==122);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy281, yymsp[-5].minor.yy776, yymsp[-3].minor.yy280, yymsp[-1].minor.yy280, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); }
break;
case 121: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy280); }
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); }
break;
case 123: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy280); }
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy334); }
break;
case 124: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
break;
case 125: /* cmd ::= ALTER TABLE alter_table_clause */
case 291: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==291);
-{ pCxt->pRootNode = yymsp[0].minor.yy776; }
+{ pCxt->pRootNode = yymsp[0].minor.yy560; }
break;
case 126: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); }
break;
case 127: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy776 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 128: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 129: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy776 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy776, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy641); }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy659); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 130: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 131: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy776 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 132: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 133: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy776 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy776, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy641); }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy659); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 134: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy776 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 135: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy776 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy776, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 136: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy776 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy776, &yymsp[-2].minor.yy641, yymsp[0].minor.yy776); }
- yymsp[-5].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy659, yymsp[0].minor.yy560); }
+ yymsp[-5].minor.yy560 = yylhsminor.yy560;
break;
case 138: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
case 141: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==141);
-{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-1].minor.yy280, yymsp[0].minor.yy776); }
- yymsp[-1].minor.yy280 = yylhsminor.yy280;
+ case 388: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==388);
+{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); }
+ yymsp[-1].minor.yy334 = yylhsminor.yy334;
break;
case 139: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
-{ yylhsminor.yy776 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy281, yymsp[-8].minor.yy776, yymsp[-6].minor.yy776, yymsp[-5].minor.yy280, yymsp[-2].minor.yy280, yymsp[0].minor.yy776); }
- yymsp[-9].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy334, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); }
+ yymsp[-9].minor.yy560 = yylhsminor.yy560;
break;
case 142: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy776 = createDropTableClause(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 143: /* specific_cols_opt ::= */
case 174: /* tags_def_opt ::= */ yytestcase(yyruleno==174);
- case 442: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==442);
- case 459: /* group_by_clause_opt ::= */ yytestcase(yyruleno==459);
- case 478: /* order_by_clause_opt ::= */ yytestcase(yyruleno==478);
-{ yymsp[1].minor.yy280 = NULL; }
+ case 451: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==451);
+ case 468: /* group_by_clause_opt ::= */ yytestcase(yyruleno==468);
+ case 487: /* order_by_clause_opt ::= */ yytestcase(yyruleno==487);
+{ yymsp[1].minor.yy334 = NULL; }
break;
case 144: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
-{ yymsp[-2].minor.yy280 = yymsp[-1].minor.yy280; }
+{ yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; }
break;
case 145: /* full_table_name ::= table_name */
-{ yylhsminor.yy776 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy641, NULL); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy659, NULL); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 146: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy776 = createRealTableNode(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641, NULL); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659, NULL); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 149: /* column_def ::= column_name type_name */
-{ yylhsminor.yy776 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy641, yymsp[0].minor.yy304, NULL); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574, NULL); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 150: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy776 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy641, yymsp[-2].minor.yy304, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-2].minor.yy574, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 151: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BOOL); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 152: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 153: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 154: /* type_name ::= INT */
case 155: /* type_name ::= INTEGER */ yytestcase(yyruleno==155);
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_INT); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 156: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 157: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 158: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 159: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 160: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 161: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 162: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 163: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 164: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UINT); }
+{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 165: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 166: /* type_name ::= JSON */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_JSON); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 167: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 168: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 169: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BLOB); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 170: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 171: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 172: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-3].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 173: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-5].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 175: /* tags_def_opt ::= tags_def */
- case 378: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==378);
-{ yylhsminor.yy280 = yymsp[0].minor.yy280; }
- yymsp[0].minor.yy280 = yylhsminor.yy280;
+ case 380: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==380);
+{ yylhsminor.yy334 = yymsp[0].minor.yy334; }
+ yymsp[0].minor.yy334 = yylhsminor.yy334;
break;
case 176: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
-{ yymsp[-3].minor.yy280 = yymsp[-1].minor.yy280; }
+{ yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; }
break;
case 177: /* table_options ::= */
-{ yymsp[1].minor.yy776 = createDefaultTableOptions(pCxt); }
+{ yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); }
break;
case 178: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 179: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy280); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy334); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 180: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy280); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy334); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 181: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-4].minor.yy776, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy280); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy334); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 182: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-2].minor.yy776, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 183: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-4].minor.yy776, TABLE_OPTION_SMA, yymsp[-1].minor.yy280); }
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy334); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
case 184: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy776 = createAlterTableOptions(pCxt); yylhsminor.yy776 = setTableOption(pCxt, yylhsminor.yy776, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy515.type, &yymsp[0].minor.yy515.val); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 185: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy776 = setTableOption(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy515.type, &yymsp[0].minor.yy515.val); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 186: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy605.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy515.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; }
break;
case 187: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy605.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy515.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; }
break;
case 188: /* duration_list ::= duration_literal */
- case 345: /* expression_list ::= expression */ yytestcase(yyruleno==345);
-{ yylhsminor.yy280 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy776)); }
- yymsp[0].minor.yy280 = yylhsminor.yy280;
+ case 347: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==347);
+{ yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
+ yymsp[0].minor.yy334 = yylhsminor.yy334;
break;
case 189: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 346: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==346);
-{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, releaseRawExprNode(pCxt, yymsp[0].minor.yy776)); }
- yymsp[-2].minor.yy280 = yylhsminor.yy280;
+ case 348: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==348);
+{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
+ yymsp[-2].minor.yy334 = yylhsminor.yy334;
break;
case 192: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy776 = createFunctionNode(pCxt, &yymsp[0].minor.yy641, NULL); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy659, NULL); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 193: /* rollup_func_name ::= FIRST */
case 194: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==194);
-{ yylhsminor.yy776 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 197: /* col_name ::= column_name */
-{ yylhsminor.yy776 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy641); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy659); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 198: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
@@ -4060,13 +4174,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
case 201: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy776, yymsp[0].minor.yy776, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); }
break;
case 202: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy776, yymsp[0].minor.yy776, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); }
break;
case 203: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy776, NULL, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); }
break;
case 204: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
@@ -4081,7 +4195,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
case 208: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy776, yymsp[-1].minor.yy776, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); }
break;
case 209: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
@@ -4100,13 +4214,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
case 215: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy659); }
break;
case 216: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); }
break;
case 217: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy560); }
break;
case 218: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
@@ -4139,7 +4253,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
case 228: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); }
break;
case 229: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
@@ -4148,7 +4262,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
case 231: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy776, yymsp[-1].minor.yy776, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); }
break;
case 232: /* cmd ::= SHOW VNODES NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
@@ -4158,144 +4272,145 @@ static YYACTIONTYPE yy_reduce(
break;
case 234: /* db_name_cond_opt ::= */
case 239: /* from_db_opt ::= */ yytestcase(yyruleno==239);
-{ yymsp[1].minor.yy776 = createDefaultDatabaseCondValue(pCxt); }
+{ yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); }
break;
case 235: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy641); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy659); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 236: /* like_pattern_opt ::= */
- case 411: /* from_clause_opt ::= */ yytestcase(yyruleno==411);
- case 440: /* where_clause_opt ::= */ yytestcase(yyruleno==440);
- case 444: /* twindow_clause_opt ::= */ yytestcase(yyruleno==444);
- case 449: /* sliding_opt ::= */ yytestcase(yyruleno==449);
- case 451: /* fill_opt ::= */ yytestcase(yyruleno==451);
- case 463: /* having_clause_opt ::= */ yytestcase(yyruleno==463);
- case 465: /* range_opt ::= */ yytestcase(yyruleno==465);
- case 467: /* every_opt ::= */ yytestcase(yyruleno==467);
- case 480: /* slimit_clause_opt ::= */ yytestcase(yyruleno==480);
- case 484: /* limit_clause_opt ::= */ yytestcase(yyruleno==484);
-{ yymsp[1].minor.yy776 = NULL; }
+ case 390: /* case_when_else_opt ::= */ yytestcase(yyruleno==390);
+ case 420: /* from_clause_opt ::= */ yytestcase(yyruleno==420);
+ case 449: /* where_clause_opt ::= */ yytestcase(yyruleno==449);
+ case 453: /* twindow_clause_opt ::= */ yytestcase(yyruleno==453);
+ case 458: /* sliding_opt ::= */ yytestcase(yyruleno==458);
+ case 460: /* fill_opt ::= */ yytestcase(yyruleno==460);
+ case 472: /* having_clause_opt ::= */ yytestcase(yyruleno==472);
+ case 474: /* range_opt ::= */ yytestcase(yyruleno==474);
+ case 476: /* every_opt ::= */ yytestcase(yyruleno==476);
+ case 489: /* slimit_clause_opt ::= */ yytestcase(yyruleno==489);
+ case 493: /* limit_clause_opt ::= */ yytestcase(yyruleno==493);
+{ yymsp[1].minor.yy560 = NULL; }
break;
case 237: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
case 238: /* table_name_cond ::= table_name */
-{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy641); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy659); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 240: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy641); }
+{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy659); }
break;
case 241: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy281, yymsp[-3].minor.yy776, yymsp[-1].minor.yy776, NULL, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); }
break;
case 242: /* cmd ::= DROP INDEX exists_opt full_table_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
break;
case 243: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy776 = createIndexOption(pCxt, yymsp[-7].minor.yy280, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), NULL, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); }
+{ yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy334, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
break;
case 244: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-11].minor.yy776 = createIndexOption(pCxt, yymsp[-9].minor.yy280, releaseRawExprNode(pCxt, yymsp[-5].minor.yy776), releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), yymsp[-1].minor.yy776, yymsp[0].minor.yy776); }
+{ yymsp[-11].minor.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy334, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
break;
case 247: /* func ::= function_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy776 = createFunctionNode(pCxt, &yymsp[-3].minor.yy641, yymsp[-1].minor.yy280); }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-1].minor.yy334); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 248: /* sma_stream_opt ::= */
case 275: /* stream_options ::= */ yytestcase(yyruleno==275);
-{ yymsp[1].minor.yy776 = createStreamOptions(pCxt); }
+{ yymsp[1].minor.yy560 = createStreamOptions(pCxt); }
break;
case 249: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */
case 279: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==279);
-{ ((SStreamOptions*)yymsp[-2].minor.yy776)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); yylhsminor.yy776 = yymsp[-2].minor.yy776; }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 250: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy776)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); yylhsminor.yy776 = yymsp[-2].minor.yy776; }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 251: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy281, &yymsp[-2].minor.yy641, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy659, yymsp[0].minor.yy560); }
break;
case 252: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy281, &yymsp[-3].minor.yy641, &yymsp[0].minor.yy641, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy659, &yymsp[0].minor.yy659, false); }
break;
case 253: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy281, &yymsp[-5].minor.yy641, &yymsp[0].minor.yy641, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy659, &yymsp[0].minor.yy659, true); }
break;
case 254: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy281, &yymsp[-3].minor.yy641, yymsp[0].minor.yy776, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy659, yymsp[0].minor.yy560, false); }
break;
case 255: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy281, &yymsp[-5].minor.yy641, yymsp[0].minor.yy776, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy659, yymsp[0].minor.yy560, true); }
break;
case 256: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); }
break;
case 257: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy281, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); }
break;
case 258: /* cmd ::= DESC full_table_name */
case 259: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==259);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); }
break;
case 260: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
case 261: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy281, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
break;
case 263: /* analyze_opt ::= ANALYZE */
case 270: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==270);
- case 431: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==431);
-{ yymsp[0].minor.yy281 = true; }
+ case 440: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==440);
+{ yymsp[0].minor.yy173 = true; }
break;
case 264: /* explain_options ::= */
-{ yymsp[1].minor.yy776 = createDefaultExplainOptions(pCxt); }
+{ yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); }
break;
case 265: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy776 = setExplainVerbose(pCxt, yymsp[-2].minor.yy776, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 266: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy776 = setExplainRatio(pCxt, yymsp[-2].minor.yy776, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 267: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy281, yymsp[-8].minor.yy281, &yymsp[-5].minor.yy641, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy304, yymsp[0].minor.yy100); }
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-8].minor.yy173, &yymsp[-5].minor.yy659, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy574, yymsp[0].minor.yy676); }
break;
case 268: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); }
break;
case 271: /* bufsize_opt ::= */
-{ yymsp[1].minor.yy100 = 0; }
+{ yymsp[1].minor.yy676 = 0; }
break;
case 272: /* bufsize_opt ::= BUFSIZE NK_INTEGER */
-{ yymsp[-1].minor.yy100 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy676 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 273: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-6].minor.yy281, &yymsp[-5].minor.yy641, yymsp[-2].minor.yy776, yymsp[-4].minor.yy776, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-6].minor.yy173, &yymsp[-5].minor.yy659, yymsp[-2].minor.yy560, yymsp[-4].minor.yy560, yymsp[0].minor.yy560); }
break;
case 274: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); }
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); }
break;
case 276: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy776)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy776 = yymsp[-2].minor.yy776; }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy560 = yymsp[-2].minor.yy560; }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 277: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy776)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy776 = yymsp[-2].minor.yy776; }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy560 = yymsp[-2].minor.yy560; }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
case 278: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-3].minor.yy776)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy776)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); yylhsminor.yy776 = yymsp[-3].minor.yy776; }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+{ ((SStreamOptions*)yymsp[-3].minor.yy560)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-3].minor.yy560; }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 280: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-3].minor.yy776)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy776 = yymsp[-3].minor.yy776; }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+{ ((SStreamOptions*)yymsp[-3].minor.yy560)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy560 = yymsp[-3].minor.yy560; }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
case 281: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
@@ -4313,549 +4428,566 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 286: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy280); }
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy334); }
break;
case 287: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 288: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy280 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+{ yymsp[-1].minor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
case 290: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
break;
case 292: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy776, yymsp[-2].minor.yy280, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy560, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); }
break;
case 293: /* cmd ::= INSERT INTO full_table_name query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy776, NULL, yymsp[0].minor.yy776); }
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); }
break;
case 294: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 295: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 296: /* literal ::= NK_STRING */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 297: /* literal ::= NK_BOOL */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 298: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 299: /* literal ::= duration_literal */
case 309: /* signed_literal ::= signed */ yytestcase(yyruleno==309);
- case 329: /* expression ::= literal */ yytestcase(yyruleno==329);
- case 330: /* expression ::= pseudo_column */ yytestcase(yyruleno==330);
- case 331: /* expression ::= column_reference */ yytestcase(yyruleno==331);
- case 332: /* expression ::= function_expression */ yytestcase(yyruleno==332);
- case 333: /* expression ::= subquery */ yytestcase(yyruleno==333);
- case 361: /* function_expression ::= literal_func */ yytestcase(yyruleno==361);
- case 403: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==403);
- case 407: /* boolean_primary ::= predicate */ yytestcase(yyruleno==407);
- case 409: /* common_expression ::= expression */ yytestcase(yyruleno==409);
- case 410: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==410);
- case 413: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==413);
- case 415: /* table_reference ::= table_primary */ yytestcase(yyruleno==415);
- case 416: /* table_reference ::= joined_table */ yytestcase(yyruleno==416);
- case 420: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==420);
- case 470: /* query_simple ::= query_specification */ yytestcase(yyruleno==470);
- case 471: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==471);
- case 474: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==474);
- case 476: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==476);
-{ yylhsminor.yy776 = yymsp[0].minor.yy776; }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 329: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==329);
+ case 330: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==330);
+ case 331: /* expression ::= literal */ yytestcase(yyruleno==331);
+ case 332: /* expression ::= pseudo_column */ yytestcase(yyruleno==332);
+ case 333: /* expression ::= column_reference */ yytestcase(yyruleno==333);
+ case 334: /* expression ::= function_expression */ yytestcase(yyruleno==334);
+ case 335: /* expression ::= case_when_expression */ yytestcase(yyruleno==335);
+ case 363: /* function_expression ::= literal_func */ yytestcase(yyruleno==363);
+ case 412: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==412);
+ case 416: /* boolean_primary ::= predicate */ yytestcase(yyruleno==416);
+ case 418: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==418);
+ case 419: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==419);
+ case 422: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==422);
+ case 424: /* table_reference ::= table_primary */ yytestcase(yyruleno==424);
+ case 425: /* table_reference ::= joined_table */ yytestcase(yyruleno==425);
+ case 429: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==429);
+ case 479: /* query_simple ::= query_specification */ yytestcase(yyruleno==479);
+ case 480: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==480);
+ case 483: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==483);
+ case 485: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==485);
+{ yylhsminor.yy560 = yymsp[0].minor.yy560; }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 300: /* literal ::= NULL */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 301: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 302: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 303: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 304: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
case 305: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 306: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 307: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
case 308: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
case 310: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 311: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 312: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 313: /* signed_literal ::= duration_literal */
case 315: /* signed_literal ::= literal_func */ yytestcase(yyruleno==315);
- case 381: /* star_func_para ::= expression */ yytestcase(yyruleno==381);
- case 436: /* select_item ::= common_expression */ yytestcase(yyruleno==436);
- case 475: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==475);
- case 477: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==477);
- case 489: /* search_condition ::= common_expression */ yytestcase(yyruleno==489);
-{ yylhsminor.yy776 = releaseRawExprNode(pCxt, yymsp[0].minor.yy776); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 383: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==383);
+ case 445: /* select_item ::= common_expression */ yytestcase(yyruleno==445);
+ case 484: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==484);
+ case 486: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==486);
+ case 499: /* search_condition ::= common_expression */ yytestcase(yyruleno==499);
+{ yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 314: /* signed_literal ::= NULL */
-{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
case 316: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy776 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+{ yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
- case 334: /* expression ::= NK_LP expression NK_RP */
- case 408: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==408);
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 336: /* expression ::= NK_LP expression NK_RP */
+ case 417: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==417);
+ case 498: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==498);
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 335: /* expression ::= NK_PLUS expression */
+ case 337: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy776));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560));
}
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
- case 336: /* expression ::= NK_MINUS expression */
+ case 338: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy776), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL));
}
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
- case 337: /* expression ::= expression NK_PLUS expression */
+ case 339: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 338: /* expression ::= expression NK_MINUS expression */
+ case 340: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 339: /* expression ::= expression NK_STAR expression */
+ case 341: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 340: /* expression ::= expression NK_SLASH expression */
+ case 342: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 341: /* expression ::= expression NK_REM expression */
+ case 343: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 342: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 344: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 343: /* expression ::= expression NK_BITAND expression */
+ case 345: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 344: /* expression ::= expression NK_BITOR expression */
+ case 346: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
- break;
- case 347: /* column_reference ::= column_name */
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy641, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy641)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
- break;
- case 348: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641, createColumnNode(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy641)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
- break;
- case 349: /* pseudo_column ::= ROWTS */
- case 350: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==350);
- case 352: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==352);
- case 353: /* pseudo_column ::= QEND */ yytestcase(yyruleno==353);
- case 354: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==354);
- case 355: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==355);
- case 356: /* pseudo_column ::= WEND */ yytestcase(yyruleno==356);
- case 357: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==357);
- case 363: /* literal_func ::= NOW */ yytestcase(yyruleno==363);
-{ yylhsminor.yy776 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
- break;
- case 351: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy641)))); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
- break;
- case 358: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 359: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==359);
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy641, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy641, yymsp[-1].minor.yy280)); }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
- break;
- case 360: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), yymsp[-1].minor.yy304)); }
- yymsp[-5].minor.yy776 = yylhsminor.yy776;
- break;
- case 362: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy641, NULL)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
- break;
- case 377: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy280 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy280 = yylhsminor.yy280;
- break;
- case 382: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 439: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==439);
-{ yylhsminor.yy776 = createColumnNode(pCxt, &yymsp[-2].minor.yy641, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
- break;
- case 383: /* predicate ::= expression compare_op expression */
- case 388: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==388);
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 349: /* column_reference ::= column_name */
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy659, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy659)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 350: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659, createColumnNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659)); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 351: /* pseudo_column ::= ROWTS */
+ case 352: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==352);
+ case 354: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==354);
+ case 355: /* pseudo_column ::= QEND */ yytestcase(yyruleno==355);
+ case 356: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==356);
+ case 357: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==357);
+ case 358: /* pseudo_column ::= WEND */ yytestcase(yyruleno==358);
+ case 359: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==359);
+ case 365: /* literal_func ::= NOW */ yytestcase(yyruleno==365);
+{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 353: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy659)))); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 360: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 361: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==361);
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-1].minor.yy334)); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 362: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy574)); }
+ yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 364: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy659, NULL)); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 379: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy334 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy334 = yylhsminor.yy334;
+ break;
+ case 384: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 448: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==448);
+{ yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 385: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 386: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); }
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ break;
+ case 389: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
+ break;
+ case 391: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); }
+ break;
+ case 392: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 397: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==397);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy668, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy128, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 384: /* predicate ::= expression BETWEEN expression AND expression */
+ case 393: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy776), releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-4].minor.yy776 = yylhsminor.yy776;
+ yymsp[-4].minor.yy560 = yylhsminor.yy560;
break;
- case 385: /* predicate ::= expression NOT BETWEEN expression AND expression */
+ case 394: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy776), releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-5].minor.yy776 = yylhsminor.yy776;
+ yymsp[-5].minor.yy560 = yylhsminor.yy560;
break;
- case 386: /* predicate ::= expression IS NULL */
+ case 395: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 387: /* predicate ::= expression IS NOT NULL */
+ case 396: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL));
}
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
- case 389: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_THAN; }
+ case 398: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_THAN; }
break;
- case 390: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_THAN; }
+ case 399: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_THAN; }
break;
- case 391: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_EQUAL; }
+ case 400: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_EQUAL; }
break;
- case 392: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_EQUAL; }
+ case 401: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_EQUAL; }
break;
- case 393: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy668 = OP_TYPE_NOT_EQUAL; }
+ case 402: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy128 = OP_TYPE_NOT_EQUAL; }
break;
- case 394: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy668 = OP_TYPE_EQUAL; }
+ case 403: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy128 = OP_TYPE_EQUAL; }
break;
- case 395: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy668 = OP_TYPE_LIKE; }
+ case 404: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy128 = OP_TYPE_LIKE; }
break;
- case 396: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_LIKE; }
+ case 405: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_LIKE; }
break;
- case 397: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy668 = OP_TYPE_MATCH; }
+ case 406: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy128 = OP_TYPE_MATCH; }
break;
- case 398: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy668 = OP_TYPE_NMATCH; }
+ case 407: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy128 = OP_TYPE_NMATCH; }
break;
- case 399: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy668 = OP_TYPE_JSON_CONTAINS; }
+ case 408: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy128 = OP_TYPE_JSON_CONTAINS; }
break;
- case 400: /* in_op ::= IN */
-{ yymsp[0].minor.yy668 = OP_TYPE_IN; }
+ case 409: /* in_op ::= IN */
+{ yymsp[0].minor.yy128 = OP_TYPE_IN; }
break;
- case 401: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_IN; }
+ case 410: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_IN; }
break;
- case 402: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy280)); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 411: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 404: /* boolean_value_expression ::= NOT boolean_primary */
+ case 413: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy776), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL));
}
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
- case 405: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 414: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 406: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 415: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy776);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy776);
- yylhsminor.yy776 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), releaseRawExprNode(pCxt, yymsp[0].minor.yy776)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
}
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 412: /* from_clause_opt ::= FROM table_reference_list */
- case 441: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==441);
- case 464: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==464);
-{ yymsp[-1].minor.yy776 = yymsp[0].minor.yy776; }
+ case 421: /* from_clause_opt ::= FROM table_reference_list */
+ case 450: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==450);
+ case 473: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==473);
+{ yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; }
break;
- case 414: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy776 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy776, yymsp[0].minor.yy776, NULL); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 423: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 417: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy776 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ case 426: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
- case 418: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy776 = createRealTableNode(pCxt, &yymsp[-3].minor.yy641, &yymsp[-1].minor.yy641, &yymsp[0].minor.yy641); }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+ case 427: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy659, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
- case 419: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy776 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776), &yymsp[0].minor.yy641); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ case 428: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy659); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
- case 421: /* alias_opt ::= */
-{ yymsp[1].minor.yy641 = nil_token; }
+ case 430: /* alias_opt ::= */
+{ yymsp[1].minor.yy659 = nil_token; }
break;
- case 422: /* alias_opt ::= table_alias */
-{ yylhsminor.yy641 = yymsp[0].minor.yy641; }
- yymsp[0].minor.yy641 = yylhsminor.yy641;
+ case 431: /* alias_opt ::= table_alias */
+{ yylhsminor.yy659 = yymsp[0].minor.yy659; }
+ yymsp[0].minor.yy659 = yylhsminor.yy659;
break;
- case 423: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy641 = yymsp[0].minor.yy641; }
+ case 432: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy659 = yymsp[0].minor.yy659; }
break;
- case 424: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 425: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==425);
-{ yymsp[-2].minor.yy776 = yymsp[-1].minor.yy776; }
+ case 433: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 434: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==434);
+{ yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; }
break;
- case 426: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy776 = createJoinTableNode(pCxt, yymsp[-4].minor.yy468, yymsp[-5].minor.yy776, yymsp[-2].minor.yy776, yymsp[0].minor.yy776); }
- yymsp[-5].minor.yy776 = yylhsminor.yy776;
+ case 435: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-4].minor.yy540, yymsp[-5].minor.yy560, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); }
+ yymsp[-5].minor.yy560 = yylhsminor.yy560;
break;
- case 427: /* join_type ::= */
-{ yymsp[1].minor.yy468 = JOIN_TYPE_INNER; }
+ case 436: /* join_type ::= */
+{ yymsp[1].minor.yy540 = JOIN_TYPE_INNER; }
break;
- case 428: /* join_type ::= INNER */
-{ yymsp[0].minor.yy468 = JOIN_TYPE_INNER; }
+ case 437: /* join_type ::= INNER */
+{ yymsp[0].minor.yy540 = JOIN_TYPE_INNER; }
break;
- case 429: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ case 438: /* 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.yy776 = createSelectStmt(pCxt, yymsp[-10].minor.yy281, yymsp[-9].minor.yy280, yymsp[-8].minor.yy776);
- yymsp[-11].minor.yy776 = addWhereClause(pCxt, yymsp[-11].minor.yy776, yymsp[-7].minor.yy776);
- yymsp[-11].minor.yy776 = addPartitionByClause(pCxt, yymsp[-11].minor.yy776, yymsp[-6].minor.yy280);
- yymsp[-11].minor.yy776 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy776, yymsp[-2].minor.yy776);
- yymsp[-11].minor.yy776 = addGroupByClause(pCxt, yymsp[-11].minor.yy776, yymsp[-1].minor.yy280);
- yymsp[-11].minor.yy776 = addHavingClause(pCxt, yymsp[-11].minor.yy776, yymsp[0].minor.yy776);
- yymsp[-11].minor.yy776 = addRangeClause(pCxt, yymsp[-11].minor.yy776, yymsp[-5].minor.yy776);
- yymsp[-11].minor.yy776 = addEveryClause(pCxt, yymsp[-11].minor.yy776, yymsp[-4].minor.yy776);
- yymsp[-11].minor.yy776 = addFillClause(pCxt, yymsp[-11].minor.yy776, yymsp[-3].minor.yy776);
+ yymsp[-11].minor.yy560 = createSelectStmt(pCxt, yymsp[-10].minor.yy173, yymsp[-9].minor.yy334, yymsp[-8].minor.yy560);
+ yymsp[-11].minor.yy560 = addWhereClause(pCxt, yymsp[-11].minor.yy560, yymsp[-7].minor.yy560);
+ yymsp[-11].minor.yy560 = addPartitionByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-6].minor.yy334);
+ yymsp[-11].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy560, yymsp[-2].minor.yy560);
+ yymsp[-11].minor.yy560 = addGroupByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-1].minor.yy334);
+ yymsp[-11].minor.yy560 = addHavingClause(pCxt, yymsp[-11].minor.yy560, yymsp[0].minor.yy560);
+ yymsp[-11].minor.yy560 = addRangeClause(pCxt, yymsp[-11].minor.yy560, yymsp[-5].minor.yy560);
+ yymsp[-11].minor.yy560 = addEveryClause(pCxt, yymsp[-11].minor.yy560, yymsp[-4].minor.yy560);
+ yymsp[-11].minor.yy560 = addFillClause(pCxt, yymsp[-11].minor.yy560, yymsp[-3].minor.yy560);
}
break;
- case 432: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy281 = false; }
+ case 441: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy173 = false; }
break;
- case 435: /* select_item ::= NK_STAR */
-{ yylhsminor.yy776 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy776 = yylhsminor.yy776;
+ case 444: /* select_item ::= NK_STAR */
+{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy560 = yylhsminor.yy560;
break;
- case 437: /* select_item ::= common_expression column_alias */
-{ yylhsminor.yy776 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776), &yymsp[0].minor.yy641); }
- yymsp[-1].minor.yy776 = yylhsminor.yy776;
+ case 446: /* select_item ::= common_expression column_alias */
+{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy659); }
+ yymsp[-1].minor.yy560 = yylhsminor.yy560;
break;
- case 438: /* select_item ::= common_expression AS column_alias */
-{ yylhsminor.yy776 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), &yymsp[0].minor.yy641); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 447: /* select_item ::= common_expression AS column_alias */
+{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy659); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 443: /* partition_by_clause_opt ::= PARTITION BY expression_list */
- case 460: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==460);
- case 479: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==479);
-{ yymsp[-2].minor.yy280 = yymsp[0].minor.yy280; }
+ case 452: /* partition_by_clause_opt ::= PARTITION BY expression_list */
+ case 469: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==469);
+ case 488: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==488);
+{ yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; }
break;
- case 445: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy776 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); }
+ case 454: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
break;
- case 446: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
-{ yymsp[-3].minor.yy776 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); }
+ case 455: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
break;
- case 447: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy776 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), NULL, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); }
+ case 456: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
break;
- case 448: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy776 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy776), releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), yymsp[-1].minor.yy776, yymsp[0].minor.yy776); }
+ case 457: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
break;
- case 450: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- case 468: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==468);
-{ yymsp[-3].minor.yy776 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy776); }
+ case 459: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ case 477: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==477);
+{ yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); }
break;
- case 452: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy776 = createFillNode(pCxt, yymsp[-1].minor.yy774, NULL); }
+ case 461: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); }
break;
- case 453: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy776 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy280)); }
+ case 462: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); }
break;
- case 454: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy774 = FILL_MODE_NONE; }
+ case 463: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy18 = FILL_MODE_NONE; }
break;
- case 455: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy774 = FILL_MODE_PREV; }
+ case 464: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy18 = FILL_MODE_PREV; }
break;
- case 456: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy774 = FILL_MODE_NULL; }
+ case 465: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy18 = FILL_MODE_NULL; }
break;
- case 457: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy774 = FILL_MODE_LINEAR; }
+ case 466: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; }
break;
- case 458: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy774 = FILL_MODE_NEXT; }
+ case 467: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; }
break;
- case 461: /* group_by_list ::= expression */
-{ yylhsminor.yy280 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); }
- yymsp[0].minor.yy280 = yylhsminor.yy280;
+ case 470: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); }
+ yymsp[0].minor.yy334 = yylhsminor.yy334;
break;
- case 462: /* group_by_list ::= group_by_list NK_COMMA expression */
-{ yylhsminor.yy280 = addNodeToList(pCxt, yymsp[-2].minor.yy280, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy776))); }
- yymsp[-2].minor.yy280 = yylhsminor.yy280;
+ case 471: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); }
+ yymsp[-2].minor.yy334 = yylhsminor.yy334;
break;
- case 466: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
-{ yymsp[-5].minor.yy776 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy776), releaseRawExprNode(pCxt, yymsp[-1].minor.yy776)); }
+ case 475: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
break;
- case 469: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 478: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy776 = addOrderByClause(pCxt, yymsp[-3].minor.yy776, yymsp[-2].minor.yy280);
- yylhsminor.yy776 = addSlimitClause(pCxt, yylhsminor.yy776, yymsp[-1].minor.yy776);
- yylhsminor.yy776 = addLimitClause(pCxt, yylhsminor.yy776, yymsp[0].minor.yy776);
+ yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy334);
+ yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560);
+ yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560);
}
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
- case 472: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-{ yylhsminor.yy776 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy776, yymsp[0].minor.yy776); }
- yymsp[-3].minor.yy776 = yylhsminor.yy776;
+ case 481: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); }
+ yymsp[-3].minor.yy560 = yylhsminor.yy560;
break;
- case 473: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-{ yylhsminor.yy776 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy776, yymsp[0].minor.yy776); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 482: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 481: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 485: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==485);
-{ yymsp[-1].minor.yy776 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 490: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 494: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==494);
+{ yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 482: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 486: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==486);
-{ yymsp[-3].minor.yy776 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 491: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 495: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==495);
+{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 483: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 487: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==487);
-{ yymsp[-3].minor.yy776 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 492: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 496: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==496);
+{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 488: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy776 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy776); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 497: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 492: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy776 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy776), yymsp[-1].minor.yy2, yymsp[0].minor.yy649); }
- yymsp[-2].minor.yy776 = yylhsminor.yy776;
+ case 502: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy596, yymsp[0].minor.yy487); }
+ yymsp[-2].minor.yy560 = yylhsminor.yy560;
break;
- case 493: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy2 = ORDER_ASC; }
+ case 503: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy596 = ORDER_ASC; }
break;
- case 494: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy2 = ORDER_ASC; }
+ case 504: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy596 = ORDER_ASC; }
break;
- case 495: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy2 = ORDER_DESC; }
+ case 505: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy596 = ORDER_DESC; }
break;
- case 496: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy649 = NULL_ORDER_DEFAULT; }
+ case 506: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy487 = NULL_ORDER_DEFAULT; }
break;
- case 497: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy649 = NULL_ORDER_FIRST; }
+ case 507: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy487 = NULL_ORDER_FIRST; }
break;
- case 498: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy649 = NULL_ORDER_LAST; }
+ case 508: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy487 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp
index 716dd7ffc000c5995a1121314825c6f1081d7079..79a70384012224a077bd0633e319112a19b6e6e7 100644
--- a/source/libs/parser/test/parSelectTest.cpp
+++ b/source/libs/parser/test/parSelectTest.cpp
@@ -60,6 +60,9 @@ TEST_F(ParserSelectTest, expression) {
run("SELECT ts > 0, c1 between 10 and 20 and c2 = 'qaz' FROM t1");
run("SELECT c1 | 10, c2 & 20, c4 | c5 FROM t1");
+
+ run("SELECT CASE WHEN ts > '2020-1-1 10:10:10' THEN c1 + 10 ELSE c1 - 10 END FROM t1 "
+ "WHERE CASE c1 WHEN c3 + 20 THEN c3 - 1 WHEN c3 + 10 THEN c3 - 2 ELSE 10 END > 0");
}
TEST_F(ParserSelectTest, condition) {
@@ -312,6 +315,8 @@ TEST_F(ParserSelectTest, subquery) {
run("SELECT _C0 FROM (SELECT _ROWTS, ts FROM st1s1)");
run("SELECT ts FROM (SELECT t1.ts FROM st1s1 t1)");
+
+ run("(((SELECT t1.ts FROM st1s1 t1)))");
}
TEST_F(ParserSelectTest, subquerySemanticCheck) {
@@ -445,4 +450,11 @@ TEST_F(ParserSelectTest, withoutFromSemanticCheck) {
run("SELECT TBNAME", TSDB_CODE_PAR_INVALID_TBNAME);
}
+TEST_F(ParserSelectTest, joinSemanticCheck) {
+ useDb("root", "test");
+
+ run("SELECT * FROM (SELECT tag1, SUM(c1) s FROM st1 GROUP BY tag1) t1, st1 t2 where t1.tag1 = t2.tag1",
+ TSDB_CODE_PAR_NOT_SUPPORT_JOIN);
+}
+
} // namespace ParserTest
diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp
index 360b904c170e50682b17d9c99a8ec1cd679a6db0..14c991917bf534fb2719b2c9d90aff9325042615 100644
--- a/source/libs/parser/test/parTestUtil.cpp
+++ b/source/libs/parser/test/parTestUtil.cpp
@@ -119,12 +119,18 @@ class ParserTestBaseImpl {
TEST_INTERFACE_ASYNC_API
};
- static void _destoryParseMetaCache(SParseMetaCache* pMetaCache, bool request) {
+ static void destoryParseContext(SParseContext* pCxt) {
+ taosArrayDestroy(pCxt->pTableMetaPos);
+ taosArrayDestroy(pCxt->pTableVgroupPos);
+ delete pCxt;
+ }
+
+ static void destoryParseMetaCacheWarpper(SParseMetaCache* pMetaCache, bool request) {
destoryParseMetaCache(pMetaCache, request);
delete pMetaCache;
}
- static void _destroyQuery(SQuery** pQuery) {
+ static void destroyQuery(SQuery** pQuery) {
if (nullptr == pQuery) {
return;
}
@@ -303,10 +309,10 @@ class ParserTestBaseImpl {
setParseContext(sql, &cxt);
if (qIsInsertValuesSql(cxt.pSql, cxt.sqlLen)) {
- unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery);
+ unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery);
doParseInsertSql(&cxt, query.get(), nullptr);
} else {
- unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery);
+ unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery);
doParse(&cxt, query.get());
SQuery* pQuery = *(query.get());
@@ -335,7 +341,7 @@ class ParserTestBaseImpl {
SParseContext cxt = {0};
setParseContext(sql, &cxt);
- unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery);
+ unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery);
doParseSql(&cxt, query.get());
SQuery* pQuery = *(query.get());
@@ -354,26 +360,26 @@ class ParserTestBaseImpl {
void runAsyncInternalFuncs(const string& sql, int32_t expect, ParserStage checkStage) {
reset(expect, checkStage, TEST_INTERFACE_ASYNC_INTERNAL);
try {
- SParseContext cxt = {0};
- setParseContext(sql, &cxt, true);
+ unique_ptr > cxt(new SParseContext(), destoryParseContext);
+ setParseContext(sql, cxt.get(), true);
- unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery);
+ unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery);
bool request = true;
unique_ptr > metaCache(
- new SParseMetaCache(), bind(_destoryParseMetaCache, _1, cref(request)));
- bool isInsertValues = qIsInsertValuesSql(cxt.pSql, cxt.sqlLen);
+ new SParseMetaCache(), bind(destoryParseMetaCacheWarpper, _1, cref(request)));
+ bool isInsertValues = qIsInsertValuesSql(cxt->pSql, cxt->sqlLen);
if (isInsertValues) {
- doParseInsertSyntax(&cxt, query.get(), metaCache.get());
+ doParseInsertSyntax(cxt.get(), query.get(), metaCache.get());
} else {
- doParse(&cxt, query.get());
- doCollectMetaKey(&cxt, *(query.get()), metaCache.get());
+ doParse(cxt.get(), query.get());
+ doCollectMetaKey(cxt.get(), *(query.get()), metaCache.get());
}
SQuery* pQuery = *(query.get());
unique_ptr catalogReq(new SCatalogReq(),
MockCatalogService::destoryCatalogReq);
- doBuildCatalogReq(&cxt, metaCache.get(), catalogReq.get());
+ doBuildCatalogReq(cxt.get(), metaCache.get(), catalogReq.get());
string err;
thread t1([&]() {
@@ -386,13 +392,13 @@ class ParserTestBaseImpl {
doPutMetaDataToCache(catalogReq.get(), metaData.get(), metaCache.get(), isInsertValues);
if (isInsertValues) {
- doParseInsertSql(&cxt, query.get(), metaCache.get());
+ doParseInsertSql(cxt.get(), query.get(), metaCache.get());
} else {
- doAuthenticate(&cxt, pQuery, metaCache.get());
+ doAuthenticate(cxt.get(), pQuery, metaCache.get());
- doTranslate(&cxt, pQuery, metaCache.get());
+ doTranslate(cxt.get(), pQuery, metaCache.get());
- doCalculateConstant(&cxt, pQuery);
+ doCalculateConstant(cxt.get(), pQuery);
}
} catch (const TerminateFlag& e) {
// success and terminate
@@ -423,13 +429,13 @@ class ParserTestBaseImpl {
void runAsyncApis(const string& sql, int32_t expect, ParserStage checkStage) {
reset(expect, checkStage, TEST_INTERFACE_ASYNC_API);
try {
- SParseContext cxt = {0};
- setParseContext(sql, &cxt);
+ unique_ptr > cxt(new SParseContext(), destoryParseContext);
+ setParseContext(sql, cxt.get());
unique_ptr catalogReq(new SCatalogReq(),
MockCatalogService::destoryCatalogReq);
- unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), _destroyQuery);
- doParseSqlSyntax(&cxt, query.get(), catalogReq.get());
+ unique_ptr query((SQuery**)taosMemoryCalloc(1, sizeof(SQuery*)), destroyQuery);
+ doParseSqlSyntax(cxt.get(), query.get(), catalogReq.get());
SQuery* pQuery = *(query.get());
string err;
@@ -438,7 +444,7 @@ class ParserTestBaseImpl {
unique_ptr metaData(new SMetaData(), MockCatalogService::destoryMetaData);
doGetAllMeta(catalogReq.get(), metaData.get());
- doAnalyseSqlSemantic(&cxt, catalogReq.get(), metaData.get(), pQuery);
+ doAnalyseSqlSemantic(cxt.get(), catalogReq.get(), metaData.get(), pQuery);
} catch (const TerminateFlag& e) {
// success and terminate
} catch (const runtime_error& e) {
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index b160f45479a8e11a160fc092b7af536c4165436a..a700a21301ddb7a67717807ae9243e773463359f 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -617,7 +617,7 @@ static bool pushDownCondOptIsPriKey(SNode* pNode, SNodeList* pTableCols) {
return false;
}
SColumnNode* pCol = (SColumnNode*)pNode;
- if (PRIMARYKEY_TIMESTAMP_COL_ID != pCol->colId) {
+ if (PRIMARYKEY_TIMESTAMP_COL_ID != pCol->colId || TSDB_SYSTEM_TABLE == pCol->tableType) {
return false;
}
return pushDownCondOptBelongThisTable(pNode, pTableCols);
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index b0177e61ed290e8ef687e5de8c54c824545d8103..ec7050fdbc3dc1b9b13762182232322934082840 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -1046,7 +1046,8 @@ static int32_t doCreateExchangePhysiNode(SPhysiPlanContext* pCxt, SExchangeLogic
return TSDB_CODE_OUT_OF_MEMORY;
}
- pExchange->srcGroupId = pExchangeLogicNode->srcGroupId;
+ pExchange->srcStartGroupId = pExchangeLogicNode->srcStartGroupId;
+ pExchange->srcEndGroupId = pExchangeLogicNode->srcEndGroupId;
*pPhyNode = (SPhysiNode*)pExchange;
return TSDB_CODE_SUCCESS;
@@ -1425,7 +1426,8 @@ static int32_t createExchangePhysiNodeByMerge(SMergePhysiNode* pMerge) {
if (NULL == pExchange) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- pExchange->srcGroupId = pMerge->srcGroupId;
+ pExchange->srcStartGroupId = pMerge->srcGroupId;
+ pExchange->srcEndGroupId = pMerge->srcGroupId;
pExchange->singleChannel = true;
pExchange->node.pParent = (SPhysiNode*)pMerge;
pExchange->node.pOutputDataBlockDesc = (SDataBlockDescNode*)nodesCloneNode((SNode*)pMerge->node.pOutputDataBlockDesc);
diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c
index a3cb0c265420fcd385aacd1dbc979fe2a4d24e59..74ed3b57a4417aa43662bb722d3b78f3b13ee002 100644
--- a/source/libs/planner/src/planSpliter.c
+++ b/source/libs/planner/src/planSpliter.c
@@ -84,7 +84,8 @@ static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SE
if (NULL == pExchange) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- pExchange->srcGroupId = pCxt->groupId;
+ pExchange->srcStartGroupId = pCxt->groupId;
+ pExchange->srcEndGroupId = pCxt->groupId;
pExchange->node.precision = pChild->precision;
pExchange->node.pTargets = nodesCloneList(pChild->pTargets);
if (NULL == pExchange->node.pTargets) {
@@ -112,7 +113,8 @@ static int32_t splCreateExchangeNodeForSubplan(SSplitContext* pCxt, SLogicSubpla
static bool splIsChildSubplan(SLogicNode* pLogicNode, int32_t groupId) {
if (QUERY_NODE_LOGIC_PLAN_EXCHANGE == nodeType(pLogicNode)) {
- return ((SExchangeLogicNode*)pLogicNode)->srcGroupId == groupId;
+ return groupId >= ((SExchangeLogicNode*)pLogicNode)->srcStartGroupId &&
+ groupId <= ((SExchangeLogicNode*)pLogicNode)->srcEndGroupId;
}
if (QUERY_NODE_LOGIC_PLAN_MERGE == nodeType(pLogicNode)) {
@@ -1007,6 +1009,7 @@ static int32_t stbSplSplitMergeScanNode(SSplitContext* pCxt, SLogicSubplan* pSub
code = stbSplCreateMergeNode(pCxt, pSubplan, (SLogicNode*)pScan, pMergeKeys, pMergeScan, groupSort);
}
if (TSDB_CODE_SUCCESS == code) {
+ nodesDestroyNode((SNode*)pScan);
code = nodesListMakeStrictAppend(&pSubplan->pChildren,
(SNode*)splCreateScanSubplan(pCxt, pMergeScan, SPLIT_FLAG_STABLE_SPLIT));
}
@@ -1183,6 +1186,7 @@ static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubpl
if (TSDB_CODE_SUCCESS != code) {
break;
}
+ ++(pCxt->groupId);
}
if (TSDB_CODE_SUCCESS == code) {
nodesDestroyList(pSubplanChildren);
@@ -1206,12 +1210,14 @@ static bool unAllSplFindSplitNode(SSplitContext* pCxt, SLogicSubplan* pSubplan,
return false;
}
-static int32_t unAllSplCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SProjectLogicNode* pProject) {
+static int32_t unAllSplCreateExchangeNode(SSplitContext* pCxt, int32_t startGroupId, SLogicSubplan* pSubplan,
+ SProjectLogicNode* pProject) {
SExchangeLogicNode* pExchange = (SExchangeLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE);
if (NULL == pExchange) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- pExchange->srcGroupId = pCxt->groupId;
+ pExchange->srcStartGroupId = startGroupId;
+ pExchange->srcEndGroupId = pCxt->groupId - 1;
pExchange->node.precision = pProject->node.precision;
pExchange->node.pTargets = nodesCloneList(pProject->node.pTargets);
if (NULL == pExchange->node.pTargets) {
@@ -1245,11 +1251,11 @@ static int32_t unionAllSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
return TSDB_CODE_SUCCESS;
}
+ int32_t startGroupId = pCxt->groupId;
int32_t code = unionSplitSubplan(pCxt, info.pSubplan, (SLogicNode*)info.pProject);
if (TSDB_CODE_SUCCESS == code) {
- code = unAllSplCreateExchangeNode(pCxt, info.pSubplan, info.pProject);
+ code = unAllSplCreateExchangeNode(pCxt, startGroupId, info.pSubplan, info.pProject);
}
- ++(pCxt->groupId);
pCxt->split = true;
return code;
}
@@ -1259,12 +1265,14 @@ typedef struct SUnionDistinctSplitInfo {
SLogicSubplan* pSubplan;
} SUnionDistinctSplitInfo;
-static int32_t unDistSplCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SAggLogicNode* pAgg) {
+static int32_t unDistSplCreateExchangeNode(SSplitContext* pCxt, int32_t startGroupId, SLogicSubplan* pSubplan,
+ SAggLogicNode* pAgg) {
SExchangeLogicNode* pExchange = (SExchangeLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE);
if (NULL == pExchange) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- pExchange->srcGroupId = pCxt->groupId;
+ pExchange->srcStartGroupId = startGroupId;
+ pExchange->srcEndGroupId = pCxt->groupId - 1;
pExchange->node.precision = pAgg->node.precision;
pExchange->node.pTargets = nodesCloneList(pAgg->pGroupKeys);
if (NULL == pExchange->node.pTargets) {
@@ -1292,11 +1300,11 @@ static int32_t unionDistinctSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan)
return TSDB_CODE_SUCCESS;
}
+ int32_t startGroupId = pCxt->groupId;
int32_t code = unionSplitSubplan(pCxt, info.pSubplan, (SLogicNode*)info.pAgg);
if (TSDB_CODE_SUCCESS == code) {
- code = unDistSplCreateExchangeNode(pCxt, info.pSubplan, info.pAgg);
+ code = unDistSplCreateExchangeNode(pCxt, startGroupId, info.pSubplan, info.pAgg);
}
- ++(pCxt->groupId);
pCxt->split = true;
return code;
}
@@ -1429,7 +1437,7 @@ static const SSplitRule splitRuleSet[] = {
{.pName = "SingleTableJoinSplit", .splitFunc = singleTableJoinSplit},
{.pName = "UnionAllSplit", .splitFunc = unionAllSplit},
{.pName = "UnionDistinctSplit", .splitFunc = unionDistinctSplit},
- {.pName = "SmaIndexSplit", .splitFunc = smaIndexSplit},
+ {.pName = "SmaIndexSplit", .splitFunc = smaIndexSplit}, // not used yet
{.pName = "InsertSelectSplit", .splitFunc = insertSelectSplit}
};
// clang-format on
diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c
index 35903d45b16175c1f9c21904b96ced434178ec51..53549c122d958bbb043f2e9c885d91ea2b742ad1 100644
--- a/source/libs/planner/src/planner.c
+++ b/source/libs/planner/src/planner.c
@@ -33,7 +33,10 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
SLogicSubplan* pLogicSubplan = NULL;
SQueryLogicPlan* pLogicPlan = NULL;
- int32_t code = createLogicPlan(pCxt, &pLogicSubplan);
+ int32_t code = nodesAcquireAllocator(pCxt->allocatorId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = createLogicPlan(pCxt, &pLogicSubplan);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = optimizeLogicPlan(pCxt, pLogicSubplan);
}
@@ -49,6 +52,7 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
if (TSDB_CODE_SUCCESS == code) {
dumpQueryPlan(*pPlan);
}
+ nodesReleaseAllocator(pCxt->allocatorId);
nodesDestroyNode((SNode*)pLogicSubplan);
nodesDestroyNode((SNode*)pLogicPlan);
@@ -59,7 +63,7 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
static int32_t setSubplanExecutionNode(SPhysiNode* pNode, int32_t groupId, SDownstreamSourceNode* pSource) {
if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == nodeType(pNode)) {
SExchangePhysiNode* pExchange = (SExchangePhysiNode*)pNode;
- if (pExchange->srcGroupId == groupId) {
+ if (groupId >= pExchange->srcStartGroupId && groupId <= pExchange->srcEndGroupId) {
return nodesListMakeStrictAppend(&pExchange->pSrcEndPoints, nodesCloneNode((SNode*)pSource));
}
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE == nodeType(pNode)) {
diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp
index 27ec409d52a912834ae6e3ec6e2e6a41f2812fe1..c7769b15b15875af3c33e919eb872fd65071698c 100644
--- a/source/libs/planner/test/planBasicTest.cpp
+++ b/source/libs/planner/test/planBasicTest.cpp
@@ -40,6 +40,13 @@ TEST_F(PlanBasicTest, whereClause) {
run("SELECT ts, c1 FROM t1 WHERE ts > NOW AND ts IS NULL AND (c1 > 0 OR c3 < 20)");
}
+TEST_F(PlanBasicTest, caseWhen) {
+ useDb("root", "test");
+
+ run("SELECT CASE WHEN ts > '2020-1-1 10:10:10' THEN c1 + 10 ELSE c1 - 10 END FROM t1 "
+ "WHERE CASE c1 WHEN c2 + 20 THEN c4 - 1 WHEN c2 + 10 THEN c4 - 2 ELSE 10 END > 0");
+}
+
TEST_F(PlanBasicTest, func) {
useDb("root", "test");
diff --git a/source/libs/planner/test/planGroupByTest.cpp b/source/libs/planner/test/planGroupByTest.cpp
index a553d3addc7e445412a56a579e2fda7e02f742ea..8b8f92bd4f770b1ae652fe9358acf6a822181d0f 100644
--- a/source/libs/planner/test/planGroupByTest.cpp
+++ b/source/libs/planner/test/planGroupByTest.cpp
@@ -40,6 +40,8 @@ TEST_F(PlanGroupByTest, basic) {
run("SELECT COUNT(*) FROM st1 GROUP BY c1");
run("SELECT SUM(c1) FROM st1 GROUP BY c2 HAVING SUM(c1) IS NOT NULL");
+
+ run("SELECT AVG(c1) FROM st1");
}
TEST_F(PlanGroupByTest, withPartitionBy) {
diff --git a/source/libs/planner/test/planJoinTest.cpp b/source/libs/planner/test/planJoinTest.cpp
index 66ef4d3f1914957232a34e67944ed07c69a2e30c..535bb0b416943d59fcd32009b23594d07d3a38f1 100644
--- a/source/libs/planner/test/planJoinTest.cpp
+++ b/source/libs/planner/test/planJoinTest.cpp
@@ -28,6 +28,8 @@ TEST_F(PlanJoinTest, basic) {
run("SELECT t1.*, t2.* FROM st1s1 t1, st1s2 t2 WHERE t1.ts = t2.ts");
run("SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts");
+
+ run("SELECT t1.c1, t2.c1 FROM st1 t1 JOIN st2 t2 ON t1.ts = t2.ts");
}
TEST_F(PlanJoinTest, complex) {
@@ -56,9 +58,3 @@ TEST_F(PlanJoinTest, multiJoin) {
run("SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts JOIN st1s3 t3 ON t1.ts = t3.ts");
}
-
-TEST_F(PlanJoinTest, stable) {
- useDb("root", "test");
-
- run("SELECT t1.c1, t2.c1 FROM st1 t1 JOIN st2 t2 ON t1.ts = t2.ts ");
-}
diff --git a/source/libs/planner/test/planTestMain.cpp b/source/libs/planner/test/planTestMain.cpp
index 8f6fc832a2d8c4722c02781d2a357606a1eb481b..df6e72ce46e0aad05f62e45ba66e38c8f0c9fc96 100644
--- a/source/libs/planner/test/planTestMain.cpp
+++ b/source/libs/planner/test/planTestMain.cpp
@@ -22,6 +22,7 @@
#include "mockCatalog.h"
#include "parser.h"
#include "planTestUtil.h"
+#include "tglobal.h"
class PlannerEnv : public testing::Environment {
public:
@@ -30,6 +31,8 @@ class PlannerEnv : public testing::Environment {
initMetaDataEnv();
generateMetaData();
initLog(TD_TMP_DIR_PATH "td");
+ initCfg();
+ nodesInitAllocatorSet();
}
virtual void TearDown() {
@@ -37,6 +40,7 @@ class PlannerEnv : public testing::Environment {
qCleanupKeywordsTable();
fmFuncMgtDestroy();
taosCloseLog();
+ nodesDestroyAllocatorSet();
}
PlannerEnv() {}
@@ -67,6 +71,8 @@ class PlannerEnv : public testing::Environment {
std::cout << "failed to init log file" << std::endl;
}
}
+
+ void initCfg() { tsQueryPlannerTrace = true; }
};
static void parseArg(int argc, char* argv[]) {
@@ -79,6 +85,7 @@ static void parseArg(int argc, char* argv[]) {
{"limitSql", required_argument, NULL, 'i'},
{"log", required_argument, NULL, 'l'},
{"queryPolicy", required_argument, NULL, 'q'},
+ {"useNodeAllocator", required_argument, NULL, 'a'},
{0, 0, 0, 0}
};
// clang-format on
@@ -99,6 +106,9 @@ static void parseArg(int argc, char* argv[]) {
case 'q':
setQueryPolicy(optarg);
break;
+ case 'a':
+ setUseNodeAllocator(optarg);
+ break;
default:
break;
}
diff --git a/source/libs/planner/test/planTestUtil.cpp b/source/libs/planner/test/planTestUtil.cpp
index 2b8e3d98644fcfb1595642ab9cc4a3b8f078366a..73d695195cab5b1d5257c1b783e0c3a5dfe05840 100644
--- a/source/libs/planner/test/planTestUtil.cpp
+++ b/source/libs/planner/test/planTestUtil.cpp
@@ -41,6 +41,7 @@ using namespace testing;
enum DumpModule {
DUMP_MODULE_NOTHING = 1,
+ DUMP_MODULE_SQL,
DUMP_MODULE_PARSER,
DUMP_MODULE_LOGIC,
DUMP_MODULE_OPTIMIZED,
@@ -56,10 +57,13 @@ int32_t g_skipSql = 0;
int32_t g_limitSql = 0;
int32_t g_logLevel = 131;
int32_t g_queryPolicy = QUERY_POLICY_VNODE;
+bool g_useNodeAllocator = false;
void setDumpModule(const char* pModule) {
if (NULL == pModule) {
g_dumpModule = DUMP_MODULE_ALL;
+ } else if (0 == strncasecmp(pModule, "sql", strlen(pModule))) {
+ g_dumpModule = DUMP_MODULE_SQL;
} else if (0 == strncasecmp(pModule, "parser", strlen(pModule))) {
g_dumpModule = DUMP_MODULE_PARSER;
} else if (0 == strncasecmp(pModule, "logic", strlen(pModule))) {
@@ -79,10 +83,11 @@ void setDumpModule(const char* pModule) {
}
}
-void setSkipSqlNum(const char* pNum) { g_skipSql = stoi(pNum); }
-void setLimitSqlNum(const char* pNum) { g_limitSql = stoi(pNum); }
-void setLogLevel(const char* pLogLevel) { g_logLevel = stoi(pLogLevel); }
-void setQueryPolicy(const char* pQueryPolicy) { g_queryPolicy = stoi(pQueryPolicy); }
+void setSkipSqlNum(const char* pArg) { g_skipSql = stoi(pArg); }
+void setLimitSqlNum(const char* pArg) { g_limitSql = stoi(pArg); }
+void setLogLevel(const char* pArg) { g_logLevel = stoi(pArg); }
+void setQueryPolicy(const char* pArg) { g_queryPolicy = stoi(pArg); }
+void setUseNodeAllocator(const char* pArg) { g_useNodeAllocator = stoi(pArg); }
int32_t getLogLevel() { return g_logLevel; }
@@ -124,6 +129,12 @@ class PlannerTestBaseImpl {
}
void runImpl(const string& sql, int32_t queryPolicy) {
+ int64_t allocatorId = 0;
+ if (g_useNodeAllocator) {
+ nodesCreateAllocator(sqlNo_, 32 * 1024, &allocatorId);
+ nodesAcquireAllocator(allocatorId);
+ }
+
reset();
tsQueryPolicy = queryPolicy;
try {
@@ -155,8 +166,13 @@ class PlannerTestBaseImpl {
dump(g_dumpModule);
} catch (...) {
dump(DUMP_MODULE_ALL);
+ nodesReleaseAllocator(allocatorId);
+ nodesDestroyAllocator(allocatorId);
throw;
}
+
+ nodesReleaseAllocator(allocatorId);
+ nodesDestroyAllocator(allocatorId);
}
void prepare(const string& sql) {
@@ -216,6 +232,8 @@ class PlannerTestBaseImpl {
doCreatePhysiPlan(&cxt, pLogicPlan, &pPlan);
unique_ptr plan(pPlan, (void (*)(SQueryPlan*))nodesDestroyNode);
+ checkPlanMsg((SNode*)pPlan);
+
dump(g_dumpModule);
} catch (...) {
dump(DUMP_MODULE_ALL);
@@ -252,7 +270,6 @@ class PlannerTestBaseImpl {
string splitLogicPlan_;
string scaledLogicPlan_;
string physiPlan_;
- string physiPlanMsg_;
vector physiSubplans_;
};
@@ -276,17 +293,16 @@ class PlannerTestBaseImpl {
res_.splitLogicPlan_.clear();
res_.scaledLogicPlan_.clear();
res_.physiPlan_.clear();
- res_.physiPlanMsg_.clear();
res_.physiSubplans_.clear();
}
void dump(DumpModule module) {
- cout << "========================================== " << sqlNo_ << " sql : [" << stmtEnv_.sql_ << "]" << endl;
-
if (DUMP_MODULE_NOTHING == module) {
return;
}
+ cout << "========================================== " << sqlNo_ << " sql : [" << stmtEnv_.sql_ << "]" << endl;
+
if (DUMP_MODULE_ALL == module || DUMP_MODULE_PARSER == module) {
if (res_.prepareAst_.empty()) {
cout << "+++++++++++++++++++++syntax tree : " << endl;
@@ -411,8 +427,6 @@ class PlannerTestBaseImpl {
SNode* pSubplan;
FOREACH(pSubplan, ((SNodeListNode*)pNode)->pNodeList) { res_.physiSubplans_.push_back(toString(pSubplan)); }
}
- res_.physiPlanMsg_ = toMsg((SNode*)(*pPlan));
- cout << "json len: " << res_.physiPlan_.length() << ", msg len: " << res_.physiPlanMsg_.length() << endl;
}
void setPlanContext(SQuery* pQuery, SPlanContext* pCxt) {
@@ -451,27 +465,16 @@ class PlannerTestBaseImpl {
string toString(const SNode* pRoot) {
char* pStr = NULL;
int32_t len = 0;
-
- auto start = chrono::steady_clock::now();
DO_WITH_THROW(nodesNodeToString, pRoot, false, &pStr, &len)
- if (QUERY_NODE_PHYSICAL_PLAN == nodeType(pRoot)) {
- cout << "nodesNodeToString: "
- << chrono::duration_cast(chrono::steady_clock::now() - start).count() << "us" << endl;
- }
-
string str(pStr);
taosMemoryFreeClear(pStr);
return str;
}
- string toMsg(const SNode* pRoot) {
+ void checkPlanMsg(const SNode* pRoot) {
char* pStr = NULL;
int32_t len = 0;
-
- auto start = chrono::steady_clock::now();
DO_WITH_THROW(nodesNodeToMsg, pRoot, &pStr, &len)
- cout << "nodesNodeToMsg: "
- << chrono::duration_cast(chrono::steady_clock::now() - start).count() << "us" << endl;
string copyStr(pStr, len);
SNode* pNode = NULL;
@@ -491,9 +494,7 @@ class PlannerTestBaseImpl {
nodesDestroyNode(pNode);
taosMemoryFreeClear(pNewStr);
- string str(pStr, len);
taosMemoryFreeClear(pStr);
- return str;
}
caseEnv caseEnv_;
diff --git a/source/libs/planner/test/planTestUtil.h b/source/libs/planner/test/planTestUtil.h
index b0ddd726a6d4c0cf3b9294990e593cf67839823b..be8b51f769d4764048bdf9ded777dfb1f3dd6e56 100644
--- a/source/libs/planner/test/planTestUtil.h
+++ b/source/libs/planner/test/planTestUtil.h
@@ -41,11 +41,12 @@ class PlannerTestBase : public testing::Test {
std::unique_ptr impl_;
};
-extern void setDumpModule(const char* pModule);
-extern void setSkipSqlNum(const char* pNum);
-extern void setLimitSqlNum(const char* pNum);
-extern void setLogLevel(const char* pLogLevel);
-extern void setQueryPolicy(const char* pQueryPolicy);
+extern void setDumpModule(const char* pArg);
+extern void setSkipSqlNum(const char* pArg);
+extern void setLimitSqlNum(const char* pArg);
+extern void setLogLevel(const char* pArg);
+extern void setQueryPolicy(const char* pArg);
+extern void setUseNodeAllocator(const char* pArg);
extern int32_t getLogLevel();
#endif // PLAN_TEST_UTIL_H
diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h
index 729ac474e4720a13a2da8d463820d05db72970f0..3a3226359998d23da690aa361c5dffd1ce7d12fc 100644
--- a/source/libs/qworker/inc/qwInt.h
+++ b/source/libs/qworker/inc/qwInt.h
@@ -29,7 +29,7 @@ extern "C" {
#include "executor.h"
#include "trpc.h"
-#define QW_DEFAULT_SCHEDULER_NUMBER 10000
+#define QW_DEFAULT_SCHEDULER_NUMBER 100
#define QW_DEFAULT_TASK_NUMBER 10000
#define QW_DEFAULT_SCH_TASK_NUMBER 10000
#define QW_DEFAULT_SHORT_RUN_TIMES 2
@@ -83,22 +83,6 @@ typedef struct SQWDebug {
extern SQWDebug gQWDebug;
-typedef struct SQWMsgInfo {
- int8_t taskType;
- int8_t explain;
- int8_t needFetch;
-} SQWMsgInfo;
-
-typedef struct SQWMsg {
- void *node;
- int32_t code;
- int32_t msgType;
- char *msg;
- int32_t msgLen;
- SQWMsgInfo msgInfo;
- SRpcHandleInfo connInfo;
-} SQWMsg;
-
typedef struct SQWHbParam {
bool inUse;
int32_t qwrId;
@@ -133,6 +117,7 @@ typedef struct SQWTaskCtx {
int8_t taskType;
int8_t explain;
int8_t needFetch;
+ int8_t localExec;
int32_t msgType;
int32_t fetchType;
int32_t execId;
@@ -150,6 +135,7 @@ typedef struct SQWTaskCtx {
int8_t events[QW_EVENT_MAX];
+ SArray *explainRes;
void *taskHandle;
void *sinkHandle;
STbVerInfo tbInfo;
@@ -205,6 +191,7 @@ typedef struct SQWorker {
SHashObj *ctxHash; // key: queryId+taskId, value: SQWTaskCtx
SMsgCb msgCb;
SQWStat stat;
+ int32_t *destroyed;
} SQWorker;
typedef struct SQWorkerMgmt {
diff --git a/source/libs/qworker/inc/qwMsg.h b/source/libs/qworker/inc/qwMsg.h
index 3ff5b5950f6e241af51d77da843d7f00e9fdd0b6..b46c5d6baf90cdbba9883b7a0cfe24f175c7c4b5 100644
--- a/source/libs/qworker/inc/qwMsg.h
+++ b/source/libs/qworker/inc/qwMsg.h
@@ -42,7 +42,7 @@ int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t c
int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SArray* pExecList);
int32_t qwBuildAndSendErrorRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code);
void qwFreeFetchRsp(void *msg);
-int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp);
+int32_t qwMallocFetchRsp(int8_t rpcMalloc, int32_t length, SRetrieveTableRsp **rsp);
int32_t qwBuildAndSendHbRsp(SRpcHandleInfo *pConn, SSchedulerHbRsp *rsp, int32_t code);
int32_t qwRegisterQueryBrokenLinkArg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn);
int32_t qwRegisterHbBrokenLinkArg(SQWorker *mgmt, uint64_t sId, SRpcHandleInfo *pConn);
diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c
index c38c9ac1cf522d747188e5e3fff5c7a81944a490..e4271dfcdaf2579ce884646a52bee523e419c3c5 100644
--- a/source/libs/qworker/src/qwMsg.c
+++ b/source/libs/qworker/src/qwMsg.c
@@ -9,10 +9,10 @@
#include "tmsg.h"
#include "tname.h"
-int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp) {
+int32_t qwMallocFetchRsp(int8_t rpcMalloc, int32_t length, SRetrieveTableRsp **rsp) {
int32_t msgSize = sizeof(SRetrieveTableRsp) + length;
- SRetrieveTableRsp *pRsp = (SRetrieveTableRsp *)rpcReallocCont(*rsp, msgSize);
+ SRetrieveTableRsp *pRsp = (SRetrieveTableRsp *)(rpcMalloc ? rpcReallocCont(*rsp, msgSize) : taosMemoryRealloc(*rsp, msgSize));
if (NULL == pRsp) {
qError("rpcMallocCont %d failed", msgSize);
QW_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c
index 581eea4a81f90c01333233253d99d8c21f8e1a64..9f1a9a3146b0aeba875d051d731f750779b94e42 100644
--- a/source/libs/qworker/src/qwUtil.c
+++ b/source/libs/qworker/src/qwUtil.c
@@ -485,6 +485,8 @@ void qwDestroyImpl(void *pMgmt) {
}
taosHashCleanup(mgmt->schHash);
+ *mgmt->destroyed = 1;
+
taosMemoryFree(mgmt);
atomic_sub_fetch_32(&gQwMgmt.qwNum, 1);
diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c
index 4dcc06b4706b6c85b626bb03877c578e3fe2f8fe..3c102938d02a74d7beda2e95e21b34b4f844fae5 100644
--- a/source/libs/qworker/src/qworker.c
+++ b/source/libs/qworker/src/qworker.c
@@ -63,11 +63,25 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
SArray *execInfoList = taosArrayInit(4, sizeof(SExplainExecInfo));
QW_ERR_RET(qGetExplainExecInfo(taskHandle, execInfoList));
- SRpcHandleInfo connInfo = ctx->ctrlConnInfo;
- connInfo.ahandle = NULL;
- int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList);
- taosArrayDestroyEx(execInfoList, freeItem);
- QW_ERR_RET(code);
+ if (ctx->localExec) {
+ SExplainLocalRsp localRsp = {0};
+ localRsp.rsp.numOfPlans = taosArrayGetSize(execInfoList);
+ SExplainExecInfo *pExec = taosMemoryCalloc(localRsp.rsp.numOfPlans, sizeof(SExplainExecInfo));
+ memcpy(pExec, taosArrayGet(execInfoList, 0), localRsp.rsp.numOfPlans * sizeof(SExplainExecInfo));
+ localRsp.rsp.subplanInfo = pExec;
+ localRsp.qId = qId;
+ localRsp.tId = tId;
+ localRsp.rId = rId;
+ localRsp.eId = eId;
+ taosArrayPush(ctx->explainRes, &localRsp);
+ taosArrayDestroy(execInfoList);
+ } else {
+ SRpcHandleInfo connInfo = ctx->ctrlConnInfo;
+ connInfo.ahandle = NULL;
+ int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList);
+ taosArrayDestroyEx(execInfoList, freeItem);
+ QW_ERR_RET(code);
+ }
}
if (!ctx->needFetch) {
@@ -86,6 +100,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) {
int32_t execNum = 0;
qTaskInfo_t taskHandle = ctx->taskHandle;
DataSinkHandle sinkHandle = ctx->sinkHandle;
+ SLocalFetch localFetch = {(void*)mgmt, ctx->localExec, qWorkerProcessLocalFetch, ctx->explainRes};
SArray *pResList = taosArrayInit(4, POINTER_BYTES);
while (true) {
@@ -94,8 +109,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) {
// if *taskHandle is NULL, it's killed right now
if (taskHandle) {
qwDbgSimulateSleep();
-
- code = qExecTaskOpt(taskHandle, pResList, &useconds);
+ code = qExecTaskOpt(taskHandle, pResList, &useconds, &localFetch);
if (code) {
if (code != TSDB_CODE_OPS_NOT_SUPPORT) {
QW_TASK_ELOG("qExecTask failed, code:%x - %s", code, tstrerror(code));
@@ -235,7 +249,7 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen,
qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC);
if (NULL == rsp) {
- QW_ERR_RET(qwMallocFetchRsp(len, &rsp));
+ QW_ERR_RET(qwMallocFetchRsp(!ctx->localExec, len, &rsp));
*pOutput = output;
} else {
pOutput->queryEnd = output.queryEnd;
@@ -256,7 +270,7 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen,
*dataLen += len;
- QW_ERR_RET(qwMallocFetchRsp(*dataLen, &rsp));
+ QW_ERR_RET(qwMallocFetchRsp(!ctx->localExec, *dataLen, &rsp));
output.pData = rsp->data + *dataLen - len;
code = dsGetDataBlock(ctx->sinkHandle, &output);
@@ -480,16 +494,18 @@ _return:
}
if (QW_PHASE_POST_QUERY == phase && ctx) {
- ctx->queryRsped = true;
-
- bool rsped = false;
- SQWMsg qwMsg = {.msgType = ctx->msgType, .connInfo = ctx->ctrlConnInfo};
- qwDbgSimulateRedirect(&qwMsg, ctx, &rsped);
- qwDbgSimulateDead(QW_FPARAMS(), ctx, &rsped);
- if (!rsped) {
- qwBuildAndSendQueryRsp(input->msgType + 1, &ctx->ctrlConnInfo, code, ctx);
- QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", ctx->ctrlConnInfo.handle, code, tstrerror(code));
+ if (!ctx->localExec) {
+ bool rsped = false;
+ SQWMsg qwMsg = {.msgType = ctx->msgType, .connInfo = ctx->ctrlConnInfo};
+ qwDbgSimulateRedirect(&qwMsg, ctx, &rsped);
+ qwDbgSimulateDead(QW_FPARAMS(), ctx, &rsped);
+ if (!rsped) {
+ qwBuildAndSendQueryRsp(input->msgType + 1, &ctx->ctrlConnInfo, code, ctx);
+ QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", ctx->ctrlConnInfo.handle, code, tstrerror(code));
+ }
}
+
+ ctx->queryRsped = true;
}
if (ctx) {
@@ -518,11 +534,6 @@ int32_t qwAbortPrerocessQuery(QW_FPARAMS_DEF) {
int32_t qwPreprocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
int32_t code = 0;
- bool queryRsped = false;
- SSubplan *plan = NULL;
- SQWPhaseInput input = {0};
- qTaskInfo_t pTaskInfo = NULL;
- DataSinkHandle sinkHandle = NULL;
SQWTaskCtx *ctx = NULL;
QW_ERR_JRET(qwRegisterQueryBrokenLinkArg(QW_FPARAMS(), &qwMsg->connInfo));
@@ -562,6 +573,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) {
ctx->explain = qwMsg->msgInfo.explain;
ctx->needFetch = qwMsg->msgInfo.needFetch;
ctx->msgType = qwMsg->msgType;
+ ctx->localExec = false;
// QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg);
@@ -584,19 +596,12 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) {
QW_ERR_JRET(TSDB_CODE_QRY_APP_ERROR);
}
- // QW_ERR_JRET(qwBuildAndSendQueryRsp(&qwMsg->connInfo, code));
- // QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));
-
- // queryRsped = true;
-
ctx->level = plan->level;
atomic_store_ptr(&ctx->taskHandle, pTaskInfo);
atomic_store_ptr(&ctx->sinkHandle, sinkHandle);
- if (pTaskInfo && sinkHandle) {
- qwSaveTbVersionInfo(pTaskInfo, ctx);
- QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, NULL));
- }
+ qwSaveTbVersionInfo(pTaskInfo, ctx);
+ QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, NULL));
_return:
@@ -606,11 +611,6 @@ _return:
input.msgType = qwMsg->msgType;
code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL);
- // if (!queryRsped) {
- // qwBuildAndSendQueryRsp(&qwMsg->connInfo, code);
- // QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", qwMsg->connInfo.handle, code, tstrerror(code));
- //}
-
QW_RET(TSDB_CODE_SUCCESS);
}
@@ -1006,8 +1006,8 @@ _return:
QW_RET(TSDB_CODE_SUCCESS);
}
-int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qWorkerMgmt, const SMsgCb *pMsgCb) {
- if (NULL == qWorkerMgmt || pMsgCb->mgmt == NULL) {
+int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb) {
+ if (NULL == qWorkerMgmt || (pMsgCb && pMsgCb->mgmt == NULL)) {
qError("invalid param to init qworker");
QW_RET(TSDB_CODE_QRY_INVALID_INPUT);
}
@@ -1030,22 +1030,9 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qW
QW_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
}
- if (cfg) {
- mgmt->cfg = *cfg;
- if (0 == mgmt->cfg.maxSchedulerNum) {
- mgmt->cfg.maxSchedulerNum = QW_DEFAULT_SCHEDULER_NUMBER;
- }
- if (0 == mgmt->cfg.maxTaskNum) {
- mgmt->cfg.maxTaskNum = QW_DEFAULT_TASK_NUMBER;
- }
- if (0 == mgmt->cfg.maxSchTaskNum) {
- mgmt->cfg.maxSchTaskNum = QW_DEFAULT_SCH_TASK_NUMBER;
- }
- } else {
- mgmt->cfg.maxSchedulerNum = QW_DEFAULT_SCHEDULER_NUMBER;
- mgmt->cfg.maxTaskNum = QW_DEFAULT_TASK_NUMBER;
- mgmt->cfg.maxSchTaskNum = QW_DEFAULT_SCH_TASK_NUMBER;
- }
+ mgmt->cfg.maxSchedulerNum = QW_DEFAULT_SCHEDULER_NUMBER;
+ mgmt->cfg.maxTaskNum = QW_DEFAULT_TASK_NUMBER;
+ mgmt->cfg.maxSchTaskNum = QW_DEFAULT_SCH_TASK_NUMBER;
mgmt->schHash = taosHashInit(mgmt->cfg.maxSchedulerNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false,
HASH_ENTRY_LOCK);
@@ -1070,7 +1057,11 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qW
mgmt->nodeType = nodeType;
mgmt->nodeId = nodeId;
- mgmt->msgCb = *pMsgCb;
+ if (pMsgCb) {
+ mgmt->msgCb = *pMsgCb;
+ } else {
+ memset(&mgmt->msgCb, 0, sizeof(mgmt->msgCb));
+ }
mgmt->refId = taosAddRef(gQwMgmt.qwRef, mgmt);
if (mgmt->refId < 0) {
@@ -1114,10 +1105,17 @@ void qWorkerDestroy(void **qWorkerMgmt) {
return;
}
+ int32_t destroyed = 0;
SQWorker *mgmt = *qWorkerMgmt;
-
+ mgmt->destroyed = &destroyed;
+
if (taosRemoveRef(gQwMgmt.qwRef, mgmt->refId)) {
qError("remove qw from ref list failed, refId:%" PRIx64, mgmt->refId);
+ return;
+ }
+
+ while (0 == destroyed) {
+ taosMsleep(2);
}
}
@@ -1146,3 +1144,112 @@ int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pSt
return TSDB_CODE_SUCCESS;
}
+
+int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, SQWMsg *qwMsg, SArray *explainRes) {
+ SQWorker *mgmt = (SQWorker*)pMgmt;
+ int32_t code = 0;
+ SQWTaskCtx *ctx = NULL;
+ SSubplan *plan = (SSubplan *)qwMsg->msg;
+ SQWPhaseInput input = {0};
+ qTaskInfo_t pTaskInfo = NULL;
+ DataSinkHandle sinkHandle = NULL;
+ SReadHandle rHandle = {0};
+
+ QW_ERR_JRET(qwAddTaskCtx(QW_FPARAMS()));
+ QW_ERR_JRET(qwAddTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_INIT));
+
+ QW_ERR_JRET(qwHandlePrePhaseEvents(QW_FPARAMS(), QW_PHASE_PRE_QUERY, &input, NULL));
+ QW_ERR_JRET(qwAcquireTaskCtx(QW_FPARAMS(), &ctx));
+
+ ctx->taskType = qwMsg->msgInfo.taskType;
+ ctx->explain = qwMsg->msgInfo.explain;
+ ctx->needFetch = qwMsg->msgInfo.needFetch;
+ ctx->msgType = qwMsg->msgType;
+ ctx->localExec = true;
+ ctx->explainRes = explainRes;
+
+ rHandle.pMsgCb = taosMemoryCalloc(1, sizeof(SMsgCb));
+ rHandle.pMsgCb->clientRpc = qwMsg->connInfo.handle;
+
+ code = qCreateExecTask(&rHandle, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, NULL, OPTR_EXEC_MODEL_BATCH);
+ if (code) {
+ QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code));
+ QW_ERR_JRET(code);
+ }
+
+ if (NULL == sinkHandle || NULL == pTaskInfo) {
+ QW_TASK_ELOG("create task result error, taskHandle:%p, sinkHandle:%p", pTaskInfo, sinkHandle);
+ QW_ERR_JRET(TSDB_CODE_QRY_APP_ERROR);
+ }
+
+ ctx->level = plan->level;
+ atomic_store_ptr(&ctx->taskHandle, pTaskInfo);
+ atomic_store_ptr(&ctx->sinkHandle, sinkHandle);
+
+ QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, NULL));
+
+_return:
+
+ taosMemoryFree(rHandle.pMsgCb);
+
+ input.code = code;
+ input.msgType = qwMsg->msgType;
+ code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL);
+
+ if (ctx) {
+ QW_UPDATE_RSP_CODE(ctx, code);
+ qwReleaseTaskCtx(mgmt, ctx);
+ }
+
+ QW_RET(code);
+}
+
+int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, void** pRsp, SArray* explainRes) {
+ SQWorker *mgmt = (SQWorker*)pMgmt;
+ int32_t code = 0;
+ int32_t dataLen = 0;
+ SQWTaskCtx *ctx = NULL;
+ void *rsp = NULL;
+ bool queryStop = false;
+
+ SQWPhaseInput input = {0};
+
+ QW_ERR_JRET(qwHandlePrePhaseEvents(QW_FPARAMS(), QW_PHASE_PRE_FETCH, &input, NULL));
+
+ QW_ERR_JRET(qwGetTaskCtx(QW_FPARAMS(), &ctx));
+
+ ctx->msgType = TDMT_SCH_MERGE_FETCH;
+ ctx->explainRes = explainRes;
+
+ SOutputData sOutput = {0};
+
+ while (true) {
+ QW_ERR_JRET(qwGetQueryResFromSink(QW_FPARAMS(), ctx, &dataLen, &rsp, &sOutput));
+
+ if (NULL == rsp) {
+ QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, &queryStop));
+
+ continue;
+ } else {
+ bool qComplete = (DS_BUF_EMPTY == sOutput.bufStatus && sOutput.queryEnd);
+
+ qwBuildFetchRsp(rsp, &sOutput, dataLen, qComplete);
+ if (qComplete) {
+ atomic_store_8((int8_t *)&ctx->queryEnd, true);
+ }
+
+ break;
+ }
+ }
+
+_return:
+
+ *pRsp = rsp;
+
+ input.code = code;
+ code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_FETCH, &input, NULL);
+
+ QW_RET(code);
+}
+
+
diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp
index 1f76ea1e7e294090019d8f67e108b1b97cb84d6b..60d6594c1b62389147fd7f8dd7c5de0ee4b4211b 100644
--- a/source/libs/qworker/test/qworkerTests.cpp
+++ b/source/libs/qworker/test/qworkerTests.cpp
@@ -877,7 +877,7 @@ TEST(seqTest, normalCase) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
code = qWorkerProcessQueryMsg(mockPointer, mgmt, &queryRpc, 0);
@@ -913,7 +913,7 @@ TEST(seqTest, cancelFirst) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc, 0);
@@ -950,7 +950,7 @@ TEST(seqTest, randCase) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
int32_t t = 0;
@@ -1021,7 +1021,7 @@ TEST(seqTest, multithreadRand) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
TdThreadAttr thattr;
@@ -1084,7 +1084,7 @@ TEST(rcTest, shortExecshortDelay) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
qwtTestMaxExecTaskUsec = 0;
@@ -1168,7 +1168,7 @@ TEST(rcTest, longExecshortDelay) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
qwtTestMaxExecTaskUsec = 1000000;
@@ -1254,7 +1254,7 @@ TEST(rcTest, shortExeclongDelay) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
qwtTestMaxExecTaskUsec = 0;
@@ -1338,7 +1338,7 @@ TEST(rcTest, dropTest) {
SMsgCb msgCb = {0};
msgCb.mgmt = (void *)mockPointer;
msgCb.putToQueueFp = (PutToQueueFp)qwtPutReqToQueue;
- code = qWorkerInit(NODE_TYPE_VNODE, 1, NULL, &mgmt, &msgCb);
+ code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb);
ASSERT_EQ(code, 0);
tsem_init(&qwtTestQuerySem, 0, 0);
diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h
index e7695b2f04ea4fed2ebf9a77bf00717e1978003e..ef3d3f79f959805681d0bc0e2e0b101cd8518388 100644
--- a/source/libs/scalar/inc/filterInt.h
+++ b/source/libs/scalar/inc/filterInt.h
@@ -99,7 +99,7 @@ typedef struct SFilterRange {
typedef bool (*rangeCompFunc) (const void *, const void *, const void *, const void *, __compar_fn_t);
typedef int32_t(*filter_desc_compare_func)(const void *, const void *);
-typedef bool(*filter_exec_func)(void *, int32_t, int8_t**, SColumnDataAgg *, int16_t);
+typedef bool(*filter_exec_func)(void*, int32_t, SColumnInfoData*, SColumnDataAgg*, int16_t, int32_t*);
typedef int32_t (*filer_get_col_from_name)(void *, int32_t, char*, void **);
typedef struct SFilterRangeCompare {
diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c
index 9e676354374fce6c2e733ac8d42c45baef9bada8..2ad06249ca930c5efdb7ac4e2406e3b7dae13dd4 100644
--- a/source/libs/scalar/src/filter.c
+++ b/source/libs/scalar/src/filter.c
@@ -2976,14 +2976,12 @@ _return:
return TSDB_CODE_SUCCESS;
}
-bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols) {
SFilterInfo *info = (SFilterInfo *)pinfo;
bool all = true;
uint32_t *unitIdx = NULL;
- if (*p == NULL) {
- *p = taosMemoryCalloc(numOfRows, sizeof(int8_t));
- }
+ int8_t* p = (int8_t*)pRes->pData;
for (int32_t i = 0; i < numOfRows; ++i) {
//FILTER_UNIT_CLR_F(info);
@@ -3002,35 +3000,35 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p,
uint8_t optr = cunit->optr;
if (colDataIsNull((SColumnInfoData *)(cunit->colData), 0, i, NULL)) {
- (*p)[i] = optr == OP_TYPE_IS_NULL ? true : false;
+ p[i] = (optr == OP_TYPE_IS_NULL) ? true : false;
} else {
if (optr == OP_TYPE_IS_NOT_NULL) {
- (*p)[i] = 1;
+ p[i] = 1;
} else if (optr == OP_TYPE_IS_NULL) {
- (*p)[i] = 0;
+ p[i] = 0;
} else if (cunit->rfunc >= 0) {
- (*p)[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]);
+ p[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]);
} else {
- (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData);
+ p[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData);
}
//FILTER_UNIT_SET_R(info, uidx, p[i]);
//FILTER_UNIT_SET_F(info, uidx);
}
- if ((*p)[i] == 0) {
+ if (p[i] == 0) {
break;
}
}
- if ((*p)[i]) {
+ if (p[i]) {
break;
}
unitIdx += unitNum;
}
- if ((*p)[i] == 0) {
+ if (p[i] == 0) {
all = false;
}
}
@@ -3040,7 +3038,7 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p,
-int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols, bool* all) {
+int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, SColumnInfoData* p, SColumnDataAgg *statis, int16_t numOfCols, bool* all) {
if (statis && numOfRows >= FILTER_RM_UNIT_MIN_ROWS) {
info->blkFlag = 0;
@@ -3058,7 +3056,6 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t*
assert(info->unitNum > 1);
*all = filterExecuteBasedOnStatisImpl(info, numOfRows, p, statis, numOfCols);
-
goto _return;
}
}
@@ -3067,59 +3064,58 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t*
_return:
info->blkFlag = 0;
-
return TSDB_CODE_SUCCESS;
}
-
-static FORCE_INLINE bool filterExecuteImplAll(void *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+static FORCE_INLINE bool filterExecuteImplAll(void *info, int32_t numOfRows, SColumnInfoData* p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* numOfQualified) {
return true;
}
-static FORCE_INLINE bool filterExecuteImplEmpty(void *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+
+static FORCE_INLINE bool filterExecuteImplEmpty(void *info, int32_t numOfRows, SColumnInfoData* p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* numOfQualified) {
return false;
}
-static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+
+static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes,
+ SColumnDataAgg *statis, int16_t numOfCols, int32_t *numOfQualified) {
SFilterInfo *info = (SFilterInfo *)pinfo;
bool all = true;
- if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) {
- return all;
- }
+ int8_t* p = (int8_t*)pRes->pData;
- if (*p == NULL) {
- *p = taosMemoryCalloc(numOfRows, sizeof(int8_t));
+ if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) {
+ return all;
}
for (int32_t i = 0; i < numOfRows; ++i) {
uint32_t uidx = info->groups[0].unitIdxs[0];
void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i);
- (*p)[i] = ((colData == NULL) || colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL));
+ p[i] = ((colData == NULL) || colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL));
- if ((*p)[i] == 0) {
+ if (p[i] == 0) {
all = false;
}
}
return all;
}
-static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+
+static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes,
+ SColumnDataAgg *statis, int16_t numOfCols, int32_t *numOfQualified) {
SFilterInfo *info = (SFilterInfo *)pinfo;
bool all = true;
- if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) {
+ if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) {
return all;
}
- if (*p == NULL) {
- *p = taosMemoryCalloc(numOfRows, sizeof(int8_t));
- }
+ int8_t* p = (int8_t*)pRes->pData;
for (int32_t i = 0; i < numOfRows; ++i) {
uint32_t uidx = info->groups[0].unitIdxs[0];
void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i);
- (*p)[i] = ((colData != NULL) && !colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL));
- if ((*p)[i] == 0) {
+ p[i] = ((colData != NULL) && !colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL));
+ if (p[i] == 0) {
all = false;
}
}
@@ -3127,7 +3123,7 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows
return all;
}
-bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, SColumnInfoData* pRes, SColumnDataAgg *statis, int16_t numOfCols, int32_t* numOfQualified) {
SFilterInfo *info = (SFilterInfo *)pinfo;
bool all = true;
uint16_t dataSize = info->cunits[0].dataSize;
@@ -3136,49 +3132,49 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnD
void *valData2 = info->cunits[0].valData2;
__compar_fn_t func = gDataCompare[info->cunits[0].func];
- if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) {
+ if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) {
return all;
}
- if (*p == NULL) {
- *p = taosMemoryCalloc(numOfRows, sizeof(int8_t));
- }
+ int8_t* p = (int8_t*) pRes->pData;
for (int32_t i = 0; i < numOfRows; ++i) {
- void *colData = colDataGetData((SColumnInfoData *)info->cunits[0].colData, i);
SColumnInfoData* pData = info->cunits[0].colData;
+
+ void *colData = colDataGetData(pData, i);
if (colData == NULL || colDataIsNull_s(pData, i)) {
all = false;
continue;
}
- (*p)[i] = (*rfunc)(colData, colData, valData, valData2, func);
+ p[i] = (*rfunc)(colData, colData, valData, valData2, func);
- if ((*p)[i] == 0) {
+ if (p[i] == 0) {
all = false;
+ } else {
+ (*numOfQualified)++;
}
}
return all;
}
-bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes, SColumnDataAgg *statis,
+ int16_t numOfCols, int32_t *numOfQualified) {
SFilterInfo *info = (SFilterInfo *)pinfo;
bool all = true;
- if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) {
+ if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) {
return all;
}
- if (*p == NULL) {
- *p = taosMemoryCalloc(numOfRows, sizeof(int8_t));
- }
+ int8_t* p = (int8_t*) pRes->pData;
for (int32_t i = 0; i < numOfRows; ++i) {
uint32_t uidx = info->groups[0].unitIdxs[0];
void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i);
if (colData == NULL || colDataIsNull_s((SColumnInfoData *)info->cunits[uidx].colData, i)) {
- (*p)[i] = 0;
+ p[i] = 0;
all = false;
continue;
}
@@ -3191,14 +3187,14 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDa
qError("castConvert1 taosUcs4ToMbs error");
}else{
varDataSetLen(newColData, len);
- (*p)[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, newColData, info->cunits[uidx].valData);
+ p[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, newColData, info->cunits[uidx].valData);
}
taosMemoryFreeClear(newColData);
}else{
- (*p)[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, colData, info->cunits[uidx].valData);
+ p[i] = filterDoCompare(gDataCompare[info->cunits[uidx].func], info->cunits[uidx].optr, colData, info->cunits[uidx].valData);
}
- if ((*p)[i] == 0) {
+ if (p[i] == 0) {
all = false;
}
}
@@ -3206,18 +3202,16 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDa
return all;
}
-
-bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+bool filterExecuteImpl(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes, SColumnDataAgg *statis, int16_t numOfCols,
+ int32_t *numOfQualified) {
SFilterInfo *info = (SFilterInfo *)pinfo;
bool all = true;
- if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) {
+ if (filterExecuteBasedOnStatis(info, numOfRows, pRes, statis, numOfCols, &all) == 0) {
return all;
}
- if (*p == NULL) {
- *p = taosMemoryCalloc(numOfRows, sizeof(int8_t));
- }
+ int8_t* p = (int8_t*) pRes->pData;
for (int32_t i = 0; i < numOfRows; ++i) {
//FILTER_UNIT_CLR_F(info);
@@ -3235,14 +3229,14 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg
uint8_t optr = cunit->optr;
if (colData == NULL || colDataIsNull((SColumnInfoData *)(cunit->colData), 0, i, NULL)) {
- (*p)[i] = optr == OP_TYPE_IS_NULL ? true : false;
+ p[i] = optr == OP_TYPE_IS_NULL ? true : false;
} else {
if (optr == OP_TYPE_IS_NOT_NULL) {
- (*p)[i] = 1;
+ p[i] = 1;
} else if (optr == OP_TYPE_IS_NULL) {
- (*p)[i] = 0;
+ p[i] = 0;
} else if (cunit->rfunc >= 0) {
- (*p)[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]);
+ p[i] = (*gRangeCompare[cunit->rfunc])(colData, colData, cunit->valData, cunit->valData2, gDataCompare[cunit->func]);
} else {
if(cunit->dataType == TSDB_DATA_TYPE_NCHAR && (cunit->optr == OP_TYPE_MATCH || cunit->optr == OP_TYPE_NMATCH)){
char *newColData = taosMemoryCalloc(cunit->dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1);
@@ -3251,11 +3245,11 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg
qError("castConvert1 taosUcs4ToMbs error");
}else{
varDataSetLen(newColData, len);
- (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, newColData, cunit->valData);
+ p[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, newColData, cunit->valData);
}
taosMemoryFreeClear(newColData);
}else{
- (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData);
+ p[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData);
}
}
@@ -3263,17 +3257,17 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg
//FILTER_UNIT_SET_F(info, uidx);
}
- if ((*p)[i] == 0) {
+ if (p[i] == 0) {
break;
}
}
- if ((*p)[i]) {
+ if (p[i]) {
break;
}
}
- if ((*p)[i] == 0) {
+ if (p[i] == 0) {
all = false;
}
}
@@ -4026,37 +4020,62 @@ _return:
FLT_RET(code);
}
-bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) {
+bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData** p, SColumnDataAgg *statis, int16_t numOfCols, int32_t *pResultStatus) {
if (NULL == info) {
+ *pResultStatus = FILTER_RESULT_ALL_QUALIFIED;
return false;
}
- if (info->scalarMode) {
- SScalarParam output = {0};
+ SScalarParam output = {0};
+ SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)};
- SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)};
- int32_t code = sclCreateColumnInfoData(&type, pSrc->info.rows, &output);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
+ int32_t code = sclCreateColumnInfoData(&type, pSrc->info.rows, &output);
+ if (code != TSDB_CODE_SUCCESS) {
+ return false;
+ }
+ if (info->scalarMode) {
SArray *pList = taosArrayInit(1, POINTER_BYTES);
taosArrayPush(pList, &pSrc);
FLT_ERR_RET(scalarCalculate(info->sclCtx.node, pList, &output));
- *p = taosMemoryMalloc(output.numOfRows * sizeof(bool));
-
- memcpy(*p, output.columnData->pData, output.numOfRows);
- colDataDestroy(output.columnData);
- taosMemoryFree(output.columnData);
+ *p = output.columnData;
taosArrayDestroy(pList);
+
+ if (output.numOfQualified == output.numOfRows) {
+ *pResultStatus = FILTER_RESULT_ALL_QUALIFIED;
+ } else if (output.numOfQualified == 0) {
+ *pResultStatus = FILTER_RESULT_NONE_QUALIFIED;
+ } else {
+ *pResultStatus = FILTER_RESULT_PARTIAL_QUALIFIED;
+ }
return false;
- }
+ } else {
+ *p = output.columnData;
+ output.numOfRows = pSrc->info.rows;
- return (*info->func)(info, pSrc->info.rows, p, statis, numOfCols);
-}
+ bool keep = (*info->func)(info, pSrc->info.rows, *p, statis, numOfCols, &output.numOfQualified);
+ // todo this should be return during filter procedure
+ int32_t num = 0;
+ for(int32_t i = 0; i < output.numOfRows; ++i) {
+ if (((int8_t*)((*p)->pData))[i] == 1) {
+ ++num;
+ }
+ }
+
+ if (num == output.numOfRows) {
+ *pResultStatus = FILTER_RESULT_ALL_QUALIFIED;
+ } else if (num == 0) {
+ *pResultStatus = FILTER_RESULT_NONE_QUALIFIED;
+ } else {
+ *pResultStatus = FILTER_RESULT_PARTIAL_QUALIFIED;
+ }
+
+ return keep;
+ }
+}
typedef struct SClassifyConditionCxt {
bool hasPrimaryKey;
diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c
index cd1f6624bdf83e4fe143c1a648e5e30947bcdd65..9cba94d85a1ffbfe2f2f1634589039e3a96b7585 100644
--- a/source/libs/scalar/src/scalar.c
+++ b/source/libs/scalar/src/scalar.c
@@ -606,6 +606,8 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o
SCL_ERR_JRET(code);
}
+ int32_t numOfQualified = 0;
+
bool value = false;
bool complete = true;
for (int32_t i = 0; i < rowNum; ++i) {
@@ -631,6 +633,9 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o
if (complete) {
colDataAppend(output->columnData, i, (char*) &value, false);
+ if (value) {
+ numOfQualified++;
+ }
}
}
@@ -639,8 +644,9 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o
output->numOfRows = 0;
}
-_return:
+ output->numOfQualified = numOfQualified;
+_return:
sclFreeParamList(params, paramNum);
SCL_RET(code);
}
@@ -847,7 +853,7 @@ EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) {
memcpy(res->datum.p, output.columnData->pData, len);
} else if (IS_VAR_DATA_TYPE(type)) {
//res->datum.p = taosMemoryCalloc(res->node.resType.bytes + VARSTR_HEADER_SIZE + 1, 1);
- res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData), 1);
+ res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData) + 1, 1);
res->node.resType.bytes = varDataTLen(output.columnData->pData);
memcpy(res->datum.p, output.columnData->pData, varDataTLen(output.columnData->pData));
} else {
@@ -1242,6 +1248,7 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) {
colInfoDataEnsureCapacity(pDst->columnData, res->numOfRows);
colDataAssign(pDst->columnData, res->columnData, res->numOfRows, NULL);
pDst->numOfRows = res->numOfRows;
+ pDst->numOfQualified = res->numOfQualified;
}
sclFreeParam(res);
@@ -1249,7 +1256,6 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) {
}
_return:
- //nodesDestroyNode(pNode);
sclFreeRes(ctx.pRes);
return code;
}
diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c
index a003315fcabeab38f49ae3a6056e25dff10e4e16..fe2a970aaa811cc02f589c845e3c62b7e70af8e8 100644
--- a/source/libs/scalar/src/sclvector.c
+++ b/source/libs/scalar/src/sclvector.c
@@ -1475,19 +1475,19 @@ void vectorMathMinus(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pO
void vectorAssign(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) {
SColumnInfoData *pOutputCol = pOut->columnData;
-
pOut->numOfRows = pLeft->numOfRows;
-// if (IS_HELPER_NULL(pRight->columnData, 0)) {
if(colDataIsNull_s(pRight->columnData, 0)){
- for (int32_t i = 0; i < pOut->numOfRows; ++i) {
- colDataAppend(pOutputCol, i, NULL, true);
- }
+ colDataAppendNNULL(pOutputCol, 0, pOut->numOfRows);
} else {
+ char* d = colDataGetData(pRight->columnData, 0);
for (int32_t i = 0; i < pOut->numOfRows; ++i) {
- colDataAppend(pOutputCol, i, colDataGetData(pRight->columnData, 0), false);
+ colDataAppend(pOutputCol, i, d, false);
}
}
+
+ ASSERT(pRight->numOfQualified == 1 || pRight->numOfQualified == 0);
+ pOut->numOfQualified = pRight->numOfQualified * pOut->numOfRows;
}
void vectorConcat(SScalarParam* pLeft, SScalarParam* pRight, void *out, int32_t _ord) {
@@ -1646,38 +1646,60 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
doReleaseVec(pRightCol, rightConvert);
}
-#define VEC_COM_INNER(pCol, index1, index2) \
- for (; i < pCol->numOfRows && i >= 0; i += step) {\
- if (IS_HELPER_NULL(pLeft->columnData, index1) || IS_HELPER_NULL(pRight->columnData, index2)) {\
- bool res = false;\
- colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);\
- continue;\
- }\
- char *pLeftData = colDataGetData(pLeft->columnData, index1);\
- char *pRightData = colDataGetData(pRight->columnData, index2);\
- int64_t leftOut = 0;\
- int64_t rightOut = 0;\
- bool freeLeft = false;\
- bool freeRight = false;\
- bool isJsonnull = false;\
- bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight),\
- &pLeftData, &pRightData, &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight);\
- if(isJsonnull){\
- ASSERT(0);\
- }\
- if(!pLeftData || !pRightData){\
- result = false;\
- }\
- if(!result){\
- colDataAppendInt8(pOut->columnData, i, (int8_t*)&result);\
- }else{\
- bool res = filterDoCompare(fp, optr, pLeftData, pRightData);\
- colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);\
- }\
- if(freeLeft) taosMemoryFreeClear(pLeftData);\
- if(freeRight) taosMemoryFreeClear(pRightData);\
+int32_t doVectorCompareImpl(int32_t numOfRows, SScalarParam *pOut, int32_t startIndex, int32_t step, __compar_fn_t fp,
+ SScalarParam *pLeft, SScalarParam *pRight, int32_t optr) {
+ int32_t num = 0;
+
+ for (int32_t i = startIndex; i < numOfRows && i >= 0; i += step) {
+ int32_t leftIndex = (i >= pLeft->numOfRows)? 0:i;
+ int32_t rightIndex = (i >= pRight->numOfRows)? 0:i;
+
+ if (IS_HELPER_NULL(pLeft->columnData, leftIndex) || IS_HELPER_NULL(pRight->columnData, rightIndex)) {
+ bool res = false;
+ colDataAppendInt8(pOut->columnData, i, (int8_t *)&res);
+ continue;
+ }
+
+ char * pLeftData = colDataGetData(pLeft->columnData, leftIndex);
+ char * pRightData = colDataGetData(pRight->columnData, rightIndex);
+ int64_t leftOut = 0;
+ int64_t rightOut = 0;
+ bool freeLeft = false;
+ bool freeRight = false;
+ bool isJsonnull = false;
+
+ bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData,
+ &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight);
+ if (isJsonnull) {
+ ASSERT(0);
+ }
+
+ if (!pLeftData || !pRightData) {
+ result = false;
+ }
+
+ if (!result) {
+ colDataAppendInt8(pOut->columnData, i, (int8_t *)&result);
+ } else {
+ bool res = filterDoCompare(fp, optr, pLeftData, pRightData);
+ colDataAppendInt8(pOut->columnData, i, (int8_t *)&res);
+ if (res) {
+ ++num;
+ }
+ }
+
+ if (freeLeft) {
+ taosMemoryFreeClear(pLeftData);
+ }
+
+ if (freeRight) {
+ taosMemoryFreeClear(pRightData);
+ }
}
+ return num;
+}
+
void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord, int32_t optr) {
int32_t i = ((_ord) == TSDB_ORDER_ASC) ? 0 : TMAX(pLeft->numOfRows, pRight->numOfRows) - 1;
int32_t step = ((_ord) == TSDB_ORDER_ASC) ? 1 : -1;
@@ -1704,16 +1726,12 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
char *pLeftData = colDataGetData(pLeft->columnData, i);
bool res = filterDoCompare(fp, optr, pLeftData, pRight->pHashFilter);
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
+ if (res) {
+ pOut->numOfQualified++;
+ }
}
- return;
- }
-
- if (pLeft->numOfRows == pRight->numOfRows) {
- VEC_COM_INNER(pLeft, i, i)
- } else if (pRight->numOfRows == 1) {
- VEC_COM_INNER(pLeft, i, 0)
- } else if (pLeft->numOfRows == 1) {
- VEC_COM_INNER(pRight, 0, i)
+ } else { // normal compare
+ pOut->numOfQualified = doVectorCompareImpl(pOut->numOfRows, pOut, i, step, fp, pLeft, pRight, optr);
}
}
diff --git a/source/libs/scheduler/CMakeLists.txt b/source/libs/scheduler/CMakeLists.txt
index 88180391ddaae2b5dfd2b2f33a3bc4a34cac8e09..3288120b67518aa532db7579a7677086899514c7 100644
--- a/source/libs/scheduler/CMakeLists.txt
+++ b/source/libs/scheduler/CMakeLists.txt
@@ -9,7 +9,7 @@ target_include_directories(
target_link_libraries(
scheduler
- PUBLIC os util nodes planner qcom common catalog transport command
+ PUBLIC os util nodes planner qcom common catalog transport command qworker executor
)
if(${BUILD_TEST})
diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h
index 7fea2867323f9d5f119740d94a80da4f1a0b5b51..7ced4f626c413d7f208d524e833c3b2626678751 100644
--- a/source/libs/scheduler/inc/schInt.h
+++ b/source/libs/scheduler/inc/schInt.h
@@ -151,6 +151,7 @@ typedef struct SSchedulerMgmt {
SSchStat stat;
SRWLatch hbLock;
SHashObj *hbConnections;
+ void *queryMgmt;
} SSchedulerMgmt;
typedef struct SSchCallbackParamHeader {
@@ -235,8 +236,10 @@ typedef struct SSchTask {
typedef struct SSchJobAttr {
EExplainMode explainMode;
bool queryJob;
+ bool insertJob;
bool needFetch;
bool needFlowCtrl;
+ bool localExec;
} SSchJobAttr;
typedef struct {
@@ -254,7 +257,8 @@ typedef struct SSchJob {
SRequestConnInfo conn;
SArray *nodeList; // qnode/vnode list, SArray
SArray *levels; // starting from 0. SArray
- SQueryPlan *pDag;
+ SQueryPlan *pDag;
+ int64_t allocatorRefId;
SArray *dataSrcTasks; // SArray
int32_t levelIdx;
@@ -262,7 +266,7 @@ typedef struct SSchJob {
SHashObj *taskList;
SHashObj *execTasks; // executing and executed tasks, key:taskid, value:SQueryTask*
SHashObj *flowCtrl; // key is ep, element is SSchFlowControl
-
+
SExplainCtx *explainCtx;
int8_t status;
SQueryNodeAddr resNode;
@@ -303,6 +307,8 @@ extern SSchedulerMgmt schMgmt;
#define SCH_IS_DATA_BIND_QRY_TASK(task) ((task)->plan->subplanType == SUBPLAN_TYPE_SCAN)
#define SCH_IS_DATA_BIND_TASK(task) (((task)->plan->subplanType == SUBPLAN_TYPE_SCAN) || ((task)->plan->subplanType == SUBPLAN_TYPE_MODIFY))
#define SCH_IS_LEAF_TASK(_job, _task) (((_task)->level->level + 1) == (_job)->levelNum)
+#define SCH_IS_DATA_MERGE_TASK(task) (!SCH_IS_DATA_BIND_TASK(task))
+#define SCH_IS_LOCAL_EXEC_TASK(_job, _task) ((_job)->attr.localExec && SCH_IS_QUERY_JOB(_job) && (!SCH_IS_INSERT_JOB(_job)) && (!SCH_IS_DATA_BIND_QRY_TASK(_task)))
#define SCH_SET_TASK_STATUS(task, st) atomic_store_8(&(task)->status, st)
#define SCH_GET_TASK_STATUS(task) atomic_load_8(&(task)->status)
@@ -325,8 +331,9 @@ extern SSchedulerMgmt schMgmt;
#define SCH_FETCH_TYPE(_pSrcTask) (SCH_IS_DATA_BIND_QRY_TASK(_pSrcTask) ? TDMT_SCH_FETCH : TDMT_SCH_MERGE_FETCH)
#define SCH_TASK_NEED_FETCH(_task) ((_task)->plan->subplanType != SUBPLAN_TYPE_MODIFY)
-#define SCH_SET_JOB_TYPE(_job, type) do { if ((type) != SUBPLAN_TYPE_MODIFY) { (_job)->attr.queryJob = true; } } while (0)
+#define SCH_SET_JOB_TYPE(_job, type) do { if ((type) != SUBPLAN_TYPE_MODIFY) { (_job)->attr.queryJob = true; } else { (_job)->attr.insertJob = true; } } while (0)
#define SCH_IS_QUERY_JOB(_job) ((_job)->attr.queryJob)
+#define SCH_IS_INSERT_JOB(_job) ((_job)->attr.insertJob)
#define SCH_JOB_NEED_FETCH(_job) ((_job)->attr.needFetch)
#define SCH_JOB_NEED_WAIT(_job) (!SCH_IS_QUERY_JOB(_job))
#define SCH_JOB_NEED_DROP(_job) (SCH_IS_QUERY_JOB(_job))
@@ -501,6 +508,8 @@ void schDirectPostJobRes(SSchedulerReq* pReq, int32_t errCode);
int32_t schHandleJobFailure(SSchJob *pJob, int32_t errCode);
int32_t schHandleJobDrop(SSchJob *pJob, int32_t errCode);
bool schChkCurrentOp(SSchJob *pJob, int32_t op, int8_t sync);
+int32_t schProcessFetchRsp(SSchJob *pJob, SSchTask *pTask, char *msg, int32_t rspCode);
+int32_t schProcessExplainRsp(SSchJob *pJob, SSchTask *pTask, SExplainRsp *rsp);
extern SSchDebug gSCHDebug;
diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c
index 98501427ab7b006daa78bc5d1c6c7c8d377572a0..5e47c0a0edb23a923220fd45c5b014603ed201b2 100644
--- a/source/libs/scheduler/src/schJob.c
+++ b/source/libs/scheduler/src/schJob.c
@@ -673,6 +673,7 @@ void schFreeJobImpl(void *job) {
destroyQueryExecRes(&pJob->execRes);
qDestroyQueryPlan(pJob->pDag);
+ nodesReleaseAllocatorWeakRef(pJob->allocatorRefId);
taosMemoryFreeClear(pJob->userRes.execRes);
taosMemoryFreeClear(pJob->fetchRes);
@@ -719,11 +720,13 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
}
pJob->attr.explainMode = pReq->pDag->explainInfo.mode;
+ pJob->attr.localExec = pReq->localReq;
pJob->conn = *pReq->pConn;
if (pReq->sql) {
pJob->sql = strdup(pReq->sql);
}
pJob->pDag = pReq->pDag;
+ pJob->allocatorRefId = nodesMakeAllocatorWeakRef(pReq->allocatorRefId);
pJob->chkKillFp = pReq->chkKillFp;
pJob->chkKillParam = pReq->chkKillParam;
pJob->userRes.execFp = pReq->execFp;
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index c6dc57d752aba9e0bc40fb208584443f2edf57f2..1b59c06140daad7370c7721c172b3da2a8163732 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -72,6 +72,71 @@ int32_t schValidateRspMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgType) {
return TSDB_CODE_SUCCESS;
}
+int32_t schProcessFetchRsp(SSchJob *pJob, SSchTask *pTask, char *msg, int32_t rspCode) {
+ SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)msg;
+ int32_t code = 0;
+
+ SCH_ERR_JRET(rspCode);
+
+ if (NULL == msg) {
+ SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
+ }
+
+ if (SCH_IS_EXPLAIN_JOB(pJob)) {
+ if (rsp->completed) {
+ SRetrieveTableRsp *pRsp = NULL;
+ SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp));
+ if (pRsp) {
+ SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp));
+ }
+
+ taosMemoryFreeClear(msg);
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ SCH_ERR_JRET(schLaunchFetchTask(pJob));
+
+ taosMemoryFreeClear(msg);
+
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pJob->fetchRes) {
+ SCH_TASK_ELOG("got fetch rsp while res already exists, res:%p", pJob->fetchRes);
+ SCH_ERR_JRET(TSDB_CODE_SCH_STATUS_ERROR);
+ }
+
+ atomic_store_ptr(&pJob->fetchRes, rsp);
+ atomic_add_fetch_32(&pJob->resNumOfRows, htonl(rsp->numOfRows));
+
+ if (rsp->completed) {
+ SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_SUCC);
+ }
+
+ SCH_TASK_DLOG("got fetch rsp, rows:%d, complete:%d", htonl(rsp->numOfRows), rsp->completed);
+
+ msg = NULL;
+ schProcessOnDataFetched(pJob);
+
+_return:
+
+ taosMemoryFreeClear(msg);
+
+ SCH_RET(code);
+}
+
+int32_t schProcessExplainRsp(SSchJob *pJob, SSchTask *pTask, SExplainRsp *rsp) {
+ SRetrieveTableRsp *pRsp = NULL;
+ SCH_ERR_RET(qExplainUpdateExecInfo(pJob->explainCtx, rsp, pTask->plan->id.groupId, &pRsp));
+
+ if (pRsp) {
+ SCH_ERR_RET(schProcessOnExplainDone(pJob, pTask, pRsp));
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
// Note: no more task error processing, handled in function internal
int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDataBuf *pMsg, int32_t rspCode) {
int32_t code = 0;
@@ -301,65 +366,20 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
SExplainRsp rsp = {0};
if (tDeserializeSExplainRsp(msg, msgSize, &rsp)) {
- taosMemoryFree(rsp.subplanInfo);
+ tFreeSExplainRsp(&rsp);
SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
}
- SRetrieveTableRsp *pRsp = NULL;
- SCH_ERR_JRET(qExplainUpdateExecInfo(pJob->explainCtx, &rsp, pTask->plan->id.groupId, &pRsp));
+ SCH_ERR_JRET(schProcessExplainRsp(pJob, pTask, &rsp));
- if (pRsp) {
- SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp));
- }
+ taosMemoryFreeClear(msg);
break;
}
case TDMT_SCH_FETCH_RSP:
case TDMT_SCH_MERGE_FETCH_RSP: {
- SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)msg;
-
- SCH_ERR_JRET(rspCode);
- if (NULL == msg) {
- SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT);
- }
-
- if (SCH_IS_EXPLAIN_JOB(pJob)) {
- if (rsp->completed) {
- SRetrieveTableRsp *pRsp = NULL;
- SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp));
- if (pRsp) {
- SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp));
- }
-
- taosMemoryFreeClear(msg);
-
- return TSDB_CODE_SUCCESS;
- }
-
- SCH_ERR_JRET(schLaunchFetchTask(pJob));
-
- taosMemoryFreeClear(msg);
-
- return TSDB_CODE_SUCCESS;
- }
-
- if (pJob->fetchRes) {
- SCH_TASK_ELOG("got fetch rsp while res already exists, res:%p", pJob->fetchRes);
- taosMemoryFreeClear(rsp);
- SCH_ERR_JRET(TSDB_CODE_SCH_STATUS_ERROR);
- }
-
- atomic_store_ptr(&pJob->fetchRes, rsp);
- atomic_add_fetch_32(&pJob->resNumOfRows, htonl(rsp->numOfRows));
-
- if (rsp->completed) {
- SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_SUCC);
- }
-
- SCH_TASK_DLOG("got fetch rsp, rows:%d, complete:%d", htonl(rsp->numOfRows), rsp->completed);
-
+ code = schProcessFetchRsp(pJob, pTask, msg, rspCode);
msg = NULL;
-
- schProcessOnDataFetched(pJob);
+ SCH_ERR_JRET(code);
break;
}
case TDMT_SCH_DROP_TASK_RSP: {
diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c
index 8b3a2016b80bb1c0f96bc312f2043f370f5b7c54..b6f96a188e4fc06f365b6ccf527c3587abb959af 100644
--- a/source/libs/scheduler/src/schTask.c
+++ b/source/libs/scheduler/src/schTask.c
@@ -20,6 +20,8 @@
#include "tmsg.h"
#include "tref.h"
#include "trpc.h"
+#include "qworker.h"
+#include "tglobal.h"
void schFreeTask(SSchJob *pJob, SSchTask *pTask) {
schDeregisterTaskHb(pJob, pTask);
@@ -89,6 +91,10 @@ _return:
}
int32_t schRecordTaskSucceedNode(SSchJob *pJob, SSchTask *pTask) {
+ if (SCH_IS_LOCAL_EXEC_TASK(pJob, pTask)) {
+ return TSDB_CODE_SUCCESS;
+ }
+
SQueryNodeAddr *addr = taosArrayGet(pTask->candidateAddrs, pTask->candidateIdx);
if (NULL == addr) {
SCH_TASK_ELOG("taosArrayGet candidate addr failed, idx:%d, size:%d", pTask->candidateIdx,
@@ -229,7 +235,6 @@ int32_t schProcessOnTaskFailure(SSchJob *pJob, SSchTask *pTask, int32_t errCode)
SCH_RET(errCode);
}
-// Note: no more task error processing, handled in function internal
int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) {
bool moved = false;
int32_t code = 0;
@@ -294,6 +299,7 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) {
.execId = pTask->execId,
.addr = pTask->succeedAddr,
.fetchMsgType = SCH_FETCH_TYPE(pTask),
+ .localExec = SCH_IS_LOCAL_EXEC_TASK(pJob, pTask),
};
qSetSubplanExecutionNode(parent->plan, pTask->plan->id.groupId, &source);
SCH_UNLOCK(SCH_WRITE, &parent->planLock);
@@ -824,6 +830,120 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId *pEpId, SArray *pStatusList) {
return TSDB_CODE_SUCCESS;
}
+int32_t schHandleExplainRes(SArray *pExplainRes) {
+ int32_t code = 0;
+ int32_t resNum = taosArrayGetSize(pExplainRes);
+ if (resNum <= 0) {
+ goto _return;
+ }
+
+ SSchTask *pTask = NULL;
+ SSchJob *pJob = NULL;
+
+ for (int32_t i = 0; i < resNum; ++i) {
+ SExplainLocalRsp* localRsp = taosArrayGet(pExplainRes, i);
+
+ qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ", begin to handle LOCAL explain rsp msg", localRsp->qId, localRsp->tId);
+
+ pJob = schAcquireJob(localRsp->rId);
+ if (NULL == pJob) {
+ qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 "job no exist, may be dropped, refId:0x%" PRIx64, localRsp->qId, localRsp->tId, localRsp->rId);
+ SCH_ERR_JRET(TSDB_CODE_QRY_JOB_NOT_EXIST);
+ }
+
+ int8_t status = 0;
+ if (schJobNeedToStop(pJob, &status)) {
+ SCH_TASK_DLOG("will not do further processing cause of job status %s", jobTaskStatusStr(status));
+ schReleaseJob(pJob->refId);
+ SCH_ERR_JRET(TSDB_CODE_SCH_IGNORE_ERROR);
+ }
+
+ code = schGetTaskInJob(pJob, localRsp->tId, &pTask);
+
+ if (TSDB_CODE_SUCCESS == code) {
+ code = schProcessExplainRsp(pJob, pTask, &localRsp->rsp);
+ }
+
+ schReleaseJob(pJob->refId);
+
+ qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ", end to handle LOCAL explain rsp msg, code:%x", localRsp->qId, localRsp->tId, code);
+
+ SCH_ERR_JRET(code);
+
+ localRsp->rsp.numOfPlans = 0;
+ localRsp->rsp.subplanInfo = NULL;
+ pTask = NULL;
+ pJob = NULL;
+ }
+
+_return:
+
+ for (int32_t i = 0; i < resNum; ++i) {
+ SExplainLocalRsp* localRsp = taosArrayGet(pExplainRes, i);
+ tFreeSExplainRsp(&localRsp->rsp);
+ }
+
+ taosArrayDestroy(pExplainRes);
+
+ SCH_RET(code);
+}
+
+int32_t schLaunchRemoteTask(SSchJob *pJob, SSchTask *pTask) {
+ SSubplan *plan = pTask->plan;
+ int32_t code = 0;
+
+ if (NULL == pTask->msg) { // TODO add more detailed reason for failure
+ code = qSubPlanToMsg(plan, &pTask->msg, &pTask->msgLen);
+ if (TSDB_CODE_SUCCESS != code) {
+ SCH_TASK_ELOG("failed to create physical plan, code:%s, msg:%p, len:%d", tstrerror(code), pTask->msg,
+ pTask->msgLen);
+ SCH_ERR_RET(code);
+ } else if (tsQueryPlannerTrace) {
+ char *msg = NULL;
+ int32_t msgLen = 0;
+ qSubPlanToString(plan, &msg, &msgLen);
+ SCH_TASK_DLOGL("physical plan len:%d, %s", msgLen, msg);
+ taosMemoryFree(msg);
+ }
+ }
+
+ SCH_ERR_RET(schSetTaskCandidateAddrs(pJob, pTask));
+
+ if (SCH_IS_QUERY_JOB(pJob)) {
+ SCH_ERR_RET(schEnsureHbConnection(pJob, pTask));
+ }
+
+ SCH_RET(schBuildAndSendMsg(pJob, pTask, NULL, plan->msgType));
+}
+
+int32_t schLaunchLocalTask(SSchJob *pJob, SSchTask *pTask) {
+ //SCH_ERR_JRET(schSetTaskCandidateAddrs(pJob, pTask));
+ if (NULL == schMgmt.queryMgmt) {
+ SCH_ERR_RET(qWorkerInit(NODE_TYPE_CLIENT, CLIENT_HANDLE, (void **)&schMgmt.queryMgmt, NULL));
+ }
+
+ SArray *explainRes = NULL;
+ SQWMsg qwMsg = {0};
+ qwMsg.msgInfo.taskType = TASK_TYPE_TEMP;
+ qwMsg.msgInfo.explain = SCH_IS_EXPLAIN_JOB(pJob);
+ qwMsg.msgInfo.needFetch = SCH_TASK_NEED_FETCH(pTask);
+ qwMsg.msg = pTask->plan;
+ qwMsg.msgType = pTask->plan->msgType;
+ qwMsg.connInfo.handle = pJob->conn.pTrans;
+
+ if (SCH_IS_EXPLAIN_JOB(pJob)) {
+ explainRes = taosArrayInit(pJob->taskNum, sizeof(SExplainLocalRsp));
+ }
+
+ SCH_ERR_RET(qWorkerProcessLocalQuery(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId, pTask->execId, &qwMsg, explainRes));
+
+ if (SCH_IS_EXPLAIN_JOB(pJob)) {
+ SCH_ERR_RET(schHandleExplainRes(explainRes));
+ }
+
+ SCH_RET(schProcessOnTaskSuccess(pJob, pTask));
+}
+
int32_t schLaunchTaskImpl(void *param) {
SSchTaskCtx *pCtx = (SSchTaskCtx *)param;
SSchJob *pJob = schAcquireJob(pCtx->jobRid);
@@ -847,7 +967,8 @@ int32_t schLaunchTaskImpl(void *param) {
pTask->retryTimes++;
pTask->waitRetry = false;
- SCH_TASK_DLOG("start to launch task, execId %d, retry %d", pTask->execId, pTask->retryTimes);
+ SCH_TASK_DLOG("start to launch %s task, execId %d, retry %d", SCH_IS_LOCAL_EXEC_TASK(pJob, pTask) ? "LOCAL" : "REMOTE",
+ pTask->execId, pTask->retryTimes);
SCH_LOG_TASK_START_TS(pTask);
@@ -862,27 +983,12 @@ int32_t schLaunchTaskImpl(void *param) {
SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_EXEC);
}
- SSubplan *plan = pTask->plan;
-
- if (NULL == pTask->msg) { // TODO add more detailed reason for failure
- code = qSubPlanToMsg(plan, &pTask->msg, &pTask->msgLen);
- if (TSDB_CODE_SUCCESS != code) {
- SCH_TASK_ELOG("failed to create physical plan, code:%s, msg:%p, len:%d", tstrerror(code), pTask->msg,
- pTask->msgLen);
- SCH_ERR_JRET(code);
- } else {
- SCH_TASK_DLOGL("physical plan len:%d, %s", pTask->msgLen, pTask->msg);
- }
- }
-
- SCH_ERR_JRET(schSetTaskCandidateAddrs(pJob, pTask));
-
- if (SCH_IS_QUERY_JOB(pJob)) {
- SCH_ERR_JRET(schEnsureHbConnection(pJob, pTask));
+ if (SCH_IS_LOCAL_EXEC_TASK(pJob, pTask)) {
+ SCH_ERR_JRET(schLaunchLocalTask(pJob, pTask));
+ } else {
+ SCH_ERR_JRET(schLaunchRemoteTask(pJob, pTask));
}
- SCH_ERR_JRET(schBuildAndSendMsg(pJob, pTask, NULL, plan->msgType));
-
_return:
if (pJob->taskNum >= SCH_MIN_AYSNC_EXEC_NUM) {
@@ -975,6 +1081,29 @@ void schDropTaskInHashList(SSchJob *pJob, SHashObj *list) {
}
}
+int32_t schExecRemoteFetch(SSchJob *pJob, SSchTask *pTask) {
+ SCH_RET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask)));
+}
+
+int32_t schExecLocalFetch(SSchJob *pJob, SSchTask *pTask) {
+ void *pRsp = NULL;
+ SArray *explainRes = NULL;
+
+ if (SCH_IS_EXPLAIN_JOB(pJob)) {
+ explainRes = taosArrayInit(pJob->taskNum, sizeof(SExplainLocalRsp));
+ }
+
+ SCH_ERR_RET(qWorkerProcessLocalFetch(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId, pTask->execId, &pRsp, explainRes));
+
+ if (SCH_IS_EXPLAIN_JOB(pJob)) {
+ SCH_ERR_RET(schHandleExplainRes(explainRes));
+ }
+
+ SCH_ERR_RET(schProcessFetchRsp(pJob, pTask, pRsp, TSDB_CODE_SUCCESS));
+
+ return TSDB_CODE_SUCCESS;
+}
+
// Note: no more error processing, handled in function internal
int32_t schLaunchFetchTask(SSchJob *pJob) {
int32_t code = 0;
@@ -985,7 +1114,11 @@ int32_t schLaunchFetchTask(SSchJob *pJob) {
return TSDB_CODE_SUCCESS;
}
- SCH_ERR_JRET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, SCH_FETCH_TYPE(pJob->fetchTask)));
+ if (SCH_IS_LOCAL_EXEC_TASK(pJob, pJob->fetchTask)) {
+ SCH_ERR_JRET(schExecLocalFetch(pJob, pJob->fetchTask));
+ } else {
+ SCH_ERR_JRET(schExecRemoteFetch(pJob, pJob->fetchTask));
+ }
return TSDB_CODE_SUCCESS;
diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c
index f1ec7f5e043fc7810e54377f811e90d3dcc29b0f..0ccaef385744738969973b19a38182cbac4399d9 100644
--- a/source/libs/scheduler/src/scheduler.c
+++ b/source/libs/scheduler/src/scheduler.c
@@ -17,6 +17,7 @@
#include "schInt.h"
#include "tmsg.h"
#include "tref.h"
+#include "qworker.h"
SSchedulerMgmt schMgmt = {
.jobRef = -1,
@@ -192,4 +193,7 @@ void schedulerDestroy(void) {
schMgmt.hbConnections = NULL;
}
SCH_UNLOCK(SCH_WRITE, &schMgmt.hbLock);
+
+ qWorkerDestroy(&schMgmt.queryMgmt);
+ schMgmt.queryMgmt = NULL;
}
diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c
index d6e87c27366da27dda96a41c7a9d2fda92c652a9..4a63cd3bb28cdbb31ad4f2ca7531787fccb7e7d4 100644
--- a/source/libs/stream/src/stream.c
+++ b/source/libs/stream/src/stream.c
@@ -182,7 +182,7 @@ int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, S
pReq->upstreamTaskId);
streamTaskEnqueue(pTask, pReq, pRsp);
- tFreeStreamDispatchReq(pReq);
+ tDeleteStreamDispatchReq(pReq);
if (exec) {
if (streamTryExec(pTask) < 0) {
diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c
index cd5f499c34a4db63e6e9c4820f5abeb1076c394a..e6705a77b28a07e04e5439ed1c9bbf561ff7c3df 100644
--- a/source/libs/stream/src/streamData.c
+++ b/source/libs/stream/src/streamData.c
@@ -179,5 +179,15 @@ void streamFreeQitem(SStreamQueueItem* data) {
taosArrayDestroy(pMerge->reqs);
taosArrayDestroy(pMerge->dataRefs);
taosFreeQitem(pMerge);
+ } else if (type == STREAM_INPUT__REF_DATA_BLOCK) {
+ SStreamRefDataBlock* pRefBlock = (SStreamRefDataBlock*)data;
+
+ int32_t ref = atomic_sub_fetch_32(pRefBlock->dataRef, 1);
+ ASSERT(ref >= 0);
+ if (ref == 0) {
+ blockDataDestroy(pRefBlock->pBlock);
+ taosMemoryFree(pRefBlock->dataRef);
+ }
+ taosFreeQitem(pRefBlock);
}
}
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 7cdb7c0db95cd582fad03174d0fa6927cb1fd668..e6960ae35086c471f7891e551a8fd17ec4776ef1 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -62,7 +62,7 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) {
return 0;
}
-void tFreeStreamDispatchReq(SStreamDispatchReq* pReq) {
+void tDeleteStreamDispatchReq(SStreamDispatchReq* pReq) {
taosArrayDestroyP(pReq->data, taosMemoryFree);
taosArrayDestroy(pReq->dataLen);
}
@@ -95,7 +95,10 @@ int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq) {
return 0;
}
+void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq) { taosMemoryFree(pReq->pRetrieve); }
+
int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) {
+ int32_t code = -1;
SRetrieveTableRsp* pRetrieve = NULL;
void* buf = NULL;
int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock);
@@ -143,7 +146,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock)
buf = rpcMallocCont(sizeof(SMsgHead) + len);
if (buf == NULL) {
- goto FAIL;
+ goto CLEAR;
}
((SMsgHead*)buf)->vgId = htonl(pEpInfo->nodeId);
@@ -151,6 +154,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock)
SEncoder encoder;
tEncoderInit(&encoder, abuf, len);
tEncodeStreamRetrieveReq(&encoder, &req);
+ tEncoderClear(&encoder);
SRpcMsg rpcMsg = {
.code = 0,
@@ -161,17 +165,18 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock)
if (tmsgSendReq(&pEpInfo->epSet, &rpcMsg) < 0) {
ASSERT(0);
- return -1;
+ goto CLEAR;
}
+ buf = NULL;
qDebug("task %d(child %d) send retrieve req to task %d at node %d, reqId %" PRId64, pTask->taskId,
pTask->selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req.reqId);
}
- return 0;
-FAIL:
- if (pRetrieve) taosMemoryFree(pRetrieve);
- if (buf) taosMemoryFree(buf);
- return -1;
+ code = 0;
+CLEAR:
+ taosMemoryFree(pRetrieve);
+ rpcFreeCont(buf);
+ return code;
}
static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDispatchReq* pReq) {
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index 102bad742652005df440b5d4d7a87bcef34ba636..5ad5aa549d28a6b8c4835177dcb11df5418fe57c 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -38,6 +38,9 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray*
SArray* blocks = pMerged->reqs;
qDebug("task %d %p set submit input (merged), batch num: %d", pTask->taskId, pTask, (int32_t)blocks->size);
qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__MERGED_SUBMIT);
+ } else if (pItem->type == STREAM_INPUT__REF_DATA_BLOCK) {
+ const SStreamRefDataBlock* pRefBlock = (const SStreamRefDataBlock*)data;
+ qSetMultiStreamInput(exec, pRefBlock->pBlock, 1, STREAM_INPUT__DATA_BLOCK);
} else {
ASSERT(0);
}
diff --git a/source/libs/sync/CMakeLists.txt b/source/libs/sync/CMakeLists.txt
index 551849c6f29f3def8b275877aba28f7048ea1793..6025070cb72adcf9e3753ca674695edb48266b3f 100644
--- a/source/libs/sync/CMakeLists.txt
+++ b/source/libs/sync/CMakeLists.txt
@@ -15,6 +15,6 @@ target_include_directories(
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
-if(${BUILD_TEST})
+if(BUILD_TEST AND BUILD_SYNC_TEST)
add_subdirectory(test)
-endif(${BUILD_TEST})
+endif()
diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c
index 1e68fe346c71d65e0594643da5b94e2dd1ab204d..b604d25816e300560571458fde7153196e77eee5 100644
--- a/source/libs/sync/src/syncCommit.c
+++ b/source/libs/sync/src/syncCommit.c
@@ -69,15 +69,26 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
if (agree) {
// term
- SSyncRaftEntry* pEntry = pSyncNode->pLogStore->getEntry(pSyncNode->pLogStore, index);
- ASSERT(pEntry != NULL);
-
+ SSyncRaftEntry* pEntry = NULL;
+ SLRUCache* pCache = pSyncNode->pLogStore->pCache;
+ LRUHandle* h = taosLRUCacheLookup(pCache, &index, sizeof(index));
+ if (h) {
+ pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
+ } else {
+ pEntry = pSyncNode->pLogStore->getEntry(pSyncNode->pLogStore, index);
+ ASSERT(pEntry != NULL);
+ }
// cannot commit, even if quorum agree. need check term!
if (pEntry->term <= pSyncNode->pRaftStore->currentTerm) {
// update commit index
newCommitIndex = index;
- syncEntryDestory(pEntry);
+ if (h) {
+ taosLRUCacheRelease(pCache, h, false);
+ } else {
+ syncEntryDestory(pEntry);
+ }
+
break;
} else {
do {
@@ -88,7 +99,11 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
} while (0);
}
- syncEntryDestory(pEntry);
+ if (h) {
+ taosLRUCacheRelease(pCache, h, false);
+ } else {
+ syncEntryDestory(pEntry);
+ }
}
}
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index 6f29b54f806f1113ec69dface7bdcbb4b0c42afc..17157fbd2327ce126b4e63e509c7f0935539860e 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -2581,6 +2581,20 @@ static int32_t syncNodeEqNoop(SSyncNode* ths) {
return ret;
}
+static void deleteCacheEntry(const void* key, size_t keyLen, void* value) { taosMemoryFree(value); }
+
+static int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHandle** h) {
+ int code = 0;
+ int entryLen = sizeof(*pEntry) + pEntry->dataLen;
+ LRUStatus status = taosLRUCacheInsert(pLogStore->pCache, &pEntry->index, sizeof(pEntry->index), pEntry, entryLen,
+ deleteCacheEntry, h, TAOS_LRU_PRIORITY_LOW);
+ if (status != TAOS_LRU_STATUS_OK) {
+ code = -1;
+ }
+
+ return code;
+}
+
static int32_t syncNodeAppendNoop(SSyncNode* ths) {
int32_t ret = 0;
@@ -2589,13 +2603,21 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths) {
SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, ths->vgId);
ASSERT(pEntry != NULL);
+ LRUHandle* h = NULL;
+ syncCacheEntry(ths->pLogStore, pEntry, &h);
+
if (ths->state == TAOS_SYNC_STATE_LEADER) {
int32_t code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry);
ASSERT(code == 0);
syncNodeReplicate(ths, false);
}
- syncEntryDestory(pEntry);
+ if (h) {
+ taosLRUCacheRelease(ths->pLogStore->pCache, h, false);
+ } else {
+ syncEntryDestory(pEntry);
+ }
+
return ret;
}
@@ -2654,6 +2676,9 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI
SSyncRaftEntry* pEntry = syncEntryBuild2((SyncClientRequest*)pMsg, term, index);
ASSERT(pEntry != NULL);
+ LRUHandle* h = NULL;
+ syncCacheEntry(ths->pLogStore, pEntry, &h);
+
if (ths->state == TAOS_SYNC_STATE_LEADER) {
// append entry
code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry);
@@ -2685,7 +2710,12 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI
}
}
- syncEntryDestory(pEntry);
+ if (h) {
+ taosLRUCacheRelease(ths->pLogStore->pCache, h, false);
+ } else {
+ syncEntryDestory(pEntry);
+ }
+
return ret;
}
@@ -2973,9 +3003,15 @@ int32_t syncNodeCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex,
for (SyncIndex i = beginIndex; i <= endIndex; ++i) {
if (i != SYNC_INDEX_INVALID) {
SSyncRaftEntry* pEntry;
- code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry);
- ASSERT(code == 0);
- ASSERT(pEntry != NULL);
+ SLRUCache* pCache = ths->pLogStore->pCache;
+ LRUHandle* h = taosLRUCacheLookup(pCache, &i, sizeof(i));
+ if (h) {
+ pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
+ } else {
+ code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry);
+ ASSERT(code == 0);
+ ASSERT(pEntry != NULL);
+ }
SRpcMsg rpcMsg;
syncEntry2OriginalRpc(pEntry, &rpcMsg);
@@ -3058,7 +3094,11 @@ int32_t syncNodeCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex,
}
rpcFreeCont(rpcMsg.pCont);
- syncEntryDestory(pEntry);
+ if (h) {
+ taosLRUCacheRelease(pCache, h, false);
+ } else {
+ syncEntryDestory(pEntry);
+ }
}
}
}
diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c
index 0649e064e45391cfe9082c24264a33b762d1a279..496c8419de7f56a96d544997f989ef6d16de4de3 100644
--- a/source/libs/sync/src/syncRaftLog.c
+++ b/source/libs/sync/src/syncRaftLog.c
@@ -53,6 +53,15 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) {
SSyncLogStore* pLogStore = taosMemoryMalloc(sizeof(SSyncLogStore));
ASSERT(pLogStore != NULL);
+ pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5);
+ if (pLogStore->pCache == NULL) {
+ terrno = TSDB_CODE_WAL_OUT_OF_MEMORY;
+ taosMemoryFree(pLogStore);
+ return NULL;
+ }
+
+ taosLRUCacheSetStrictCapacity(pLogStore->pCache, false);
+
pLogStore->data = taosMemoryMalloc(sizeof(SSyncLogStoreData));
ASSERT(pLogStore->data != NULL);
@@ -102,6 +111,10 @@ void logStoreDestory(SSyncLogStore* pLogStore) {
taosThreadMutexDestroy(&(pData->mutex));
taosMemoryFree(pLogStore->data);
+
+ taosLRUCacheEraseUnrefEntries(pLogStore->pCache);
+ taosLRUCacheCleanup(pLogStore->pCache);
+
taosMemoryFree(pLogStore);
}
}
@@ -243,7 +256,7 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr
static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry) {
SSyncLogStoreData* pData = pLogStore->data;
SWal* pWal = pData->pWal;
- int32_t code;
+ int32_t code = 0;
*ppEntry = NULL;
@@ -257,6 +270,7 @@ static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index,
taosThreadMutexLock(&(pData->mutex));
code = walReadVer(pWalHandle, index);
+ // code = walReadVerCached(pWalHandle, index);
if (code != 0) {
int32_t err = terrno;
const char* errStr = tstrerror(err);
@@ -412,6 +426,7 @@ SSyncRaftEntry* logStoreGetEntry(SSyncLogStore* pLogStore, SyncIndex index) {
ASSERT(pWalHandle != NULL);
int32_t code = walReadVer(pWalHandle, index);
+ // int32_t code = walReadVerCached(pWalHandle, index);
if (code != 0) {
int32_t err = terrno;
const char* errStr = tstrerror(err);
diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c
index 1e2eefabf42bd97644baf38e19b77595529aab38..f4878ea861b342724896e844d4796d4bdd598c01 100644
--- a/source/libs/tdb/src/db/tdbPage.c
+++ b/source/libs/tdb/src/db/tdbPage.c
@@ -80,6 +80,7 @@ int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg)
ASSERT(xFree);
for (int iOvfl = 0; iOvfl < pPage->nOverflow; iOvfl++) {
+ tdbDebug("tdbPage/destroy/free ovfl cell: %p/%p", pPage->apOvfl[iOvfl], pPage);
tdbOsFree(pPage->apOvfl[iOvfl]);
}
@@ -152,7 +153,7 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl
pNewCell = (SCell *)tdbOsMalloc(szCell);
memcpy(pNewCell, pCell, szCell);
- tdbDebug("tdbPage/new ovfl cell: %p", pNewCell);
+ tdbDebug("tdbPage/insert/new ovfl cell: %p/%p", pNewCell, pPage);
pPage->apOvfl[iOvfl] = pNewCell;
pPage->aiOvfl[iOvfl] = idx;
@@ -202,7 +203,7 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) {
if (pPage->aiOvfl[iOvfl] == idx) {
// remove the over flow cell
tdbOsFree(pPage->apOvfl[iOvfl]);
- tdbDebug("tdbPage/free ovfl cell: %p", pPage->apOvfl[iOvfl]);
+ tdbDebug("tdbPage/drop/free ovfl cell: %p", pPage->apOvfl[iOvfl]);
for (; (++iOvfl) < pPage->nOverflow;) {
pPage->aiOvfl[iOvfl - 1] = pPage->aiOvfl[iOvfl] - 1;
pPage->apOvfl[iOvfl - 1] = pPage->apOvfl[iOvfl];
@@ -255,6 +256,7 @@ void tdbPageCopy(SPage *pFromPage, SPage *pToPage, int deepCopyOvfl) {
int szCell = (*pFromPage->xCellSize)(pFromPage, pFromPage->apOvfl[iOvfl], 0, NULL, NULL);
pNewCell = (SCell *)tdbOsMalloc(szCell);
memcpy(pNewCell, pFromPage->apOvfl[iOvfl], szCell);
+ tdbDebug("tdbPage/copy/new ovfl cell: %p/%p/%p", pNewCell, pToPage, pFromPage);
}
pToPage->apOvfl[iOvfl] = pNewCell;
diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c
index 1559c85e23d59fec376890433f924522df8dc761..c1d8dbef62f2111fa1194bd66e8e5949a7b3303a 100644
--- a/source/libs/transport/src/thttp.c
+++ b/source/libs/transport/src/thttp.c
@@ -146,7 +146,7 @@ static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const
if (nread < 0) {
uError("http-report recv error:%s", uv_err_name(nread));
} else {
- uTrace("http-report succ to recv %d bytes, just ignore it", nread);
+ uTrace("http-report succ to recv %d bytes", nread);
}
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
}
@@ -160,7 +160,16 @@ static void clientSentCb(uv_write_t* req, int32_t status) {
} else {
uTrace("http-report succ to send data");
}
- uv_read_start((uv_stream_t*)&cli->tcp, clientAllocBuffCb, clientRecvCb);
+ status = uv_read_start((uv_stream_t*)&cli->tcp, clientAllocBuffCb, clientRecvCb);
+ if (status != 0) {
+ terrno = TAOS_SYSTEM_ERROR(status);
+ uError("http-report failed to recv data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
+ if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
+ uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
+ } else {
+ destroyHttpClient(cli);
+ }
+ }
}
static void clientConnCb(uv_connect_t* req, int32_t status) {
SHttpClient* cli = req->data;
@@ -170,7 +179,16 @@ static void clientConnCb(uv_connect_t* req, int32_t status) {
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
return;
}
- uv_write(&cli->req, (uv_stream_t*)&cli->tcp, cli->wbuf, 2, clientSentCb);
+ status = uv_write(&cli->req, (uv_stream_t*)&cli->tcp, cli->wbuf, 2, clientSentCb);
+ if (0 != status) {
+ terrno = TAOS_SYSTEM_ERROR(status);
+ uError("http-report failed to send data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
+ if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
+ uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
+ } else {
+ destroyHttpClient(cli);
+ }
+ }
}
static FORCE_INLINE int32_t taosBuildDstAddr(const char* server, uint16_t port, struct sockaddr_in* dest) {
@@ -220,13 +238,22 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
uv_tcp_init(loop, &cli->tcp);
// set up timeout to avoid stuck;
int32_t fd = taosCreateSocketWithTimeout(5);
- uv_tcp_open((uv_tcp_t*)&cli->tcp, fd);
- int32_t ret = uv_tcp_connect(&cli->conn, &cli->tcp, (const struct sockaddr*)&dest, clientConnCb);
+ int ret = uv_tcp_open((uv_tcp_t*)&cli->tcp, fd);
if (ret != 0) {
- uError("http-report failed to connect to server, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr, cli->port);
+ uError("http-report failed to open socket, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr, cli->port);
destroyHttpClient(cli);
uv_stop(loop);
+ terrno = TAOS_SYSTEM_ERROR(ret);
+ } else {
+ ret = uv_tcp_connect(&cli->conn, &cli->tcp, (const struct sockaddr*)&dest, clientConnCb);
+ if (ret != 0) {
+ uError("http-report failed to connect to http-server, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr,
+ cli->port);
+ destroyHttpClient(cli);
+ uv_stop(loop);
+ terrno = TAOS_SYSTEM_ERROR(ret);
+ }
}
uv_run(loop, UV_RUN_DEFAULT);
diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c
index 5284aeff779f6b26f6f5a39aba61c781264108fd..c69046f707a1fddb7a593771ad15535a70615ff8 100644
--- a/source/libs/wal/src/walMeta.c
+++ b/source/libs/wal/src/walMeta.c
@@ -116,7 +116,6 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) {
}
#endif
}
- // TODO truncate file
if (found == NULL) {
// file corrupted, no complete log
@@ -125,8 +124,20 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
return -1;
}
+
+ // truncate file
SWalCkHead* lastEntry = (SWalCkHead*)found;
int64_t retVer = lastEntry->head.version;
+ int64_t lastEntryBeginOffset = offset + (int64_t)((char*)found - (char*)buf);
+ int64_t lastEntryEndOffset = lastEntryBeginOffset + sizeof(SWalCkHead) + lastEntry->head.bodyLen;
+ if (lastEntryEndOffset != fileSize) {
+ wWarn("vgId:%d repair meta truncate file %s to %ld, orig size %ld", pWal->cfg.vgId, fnameStr, lastEntryEndOffset,
+ fileSize);
+ taosFtruncateFile(pFile, lastEntryEndOffset);
+ ((SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet))->fileSize = lastEntryEndOffset;
+ pWal->totSize -= (fileSize - lastEntryEndOffset);
+ }
+
taosCloseFile(&pFile);
taosMemoryFree(buf);
@@ -226,16 +237,92 @@ int walCheckAndRepairMeta(SWal* pWal) {
}
}
- // TODO: set fileSize and lastVer if necessary
-
return 0;
}
int walCheckAndRepairIdx(SWal* pWal) {
- // TODO: iterate all log files
- // if idx not found, scan log and write idx
- // if found, check complete by first and last entry of each idx file
- // if idx incomplete, binary search last valid entry, and then build other part
+ int32_t sz = taosArrayGetSize(pWal->fileInfoSet);
+ for (int32_t i = 0; i < sz; i++) {
+ SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, i);
+
+ char fnameStr[WAL_FILE_LEN];
+ walBuildIdxName(pWal, pFileInfo->firstVer, fnameStr);
+ int64_t fsize;
+ TdFilePtr pIdxFile = taosOpenFile(fnameStr, TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE);
+ if (pIdxFile == NULL) {
+ ASSERT(0);
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ wError("vgId:%d, cannot open file %s, since %s", pWal->cfg.vgId, fnameStr, terrstr());
+ return -1;
+ }
+
+ taosFStatFile(pIdxFile, &fsize, NULL);
+ if (fsize == (pFileInfo->lastVer - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)) {
+ taosCloseFile(&pIdxFile);
+ continue;
+ }
+
+ int32_t left = fsize % sizeof(SWalIdxEntry);
+ int64_t offset = taosLSeekFile(pIdxFile, -left, SEEK_END);
+ if (left != 0) {
+ taosFtruncateFile(pIdxFile, offset);
+ wWarn("vgId:%d wal truncate file %s to offset %ld since size invalid, file size %ld", pWal->cfg.vgId, fnameStr,
+ offset, fsize);
+ }
+ offset -= sizeof(SWalIdxEntry);
+
+ SWalIdxEntry idxEntry = {.ver = pFileInfo->firstVer};
+ while (1) {
+ if (offset < 0) {
+ taosLSeekFile(pIdxFile, 0, SEEK_SET);
+ taosWriteFile(pIdxFile, &idxEntry, sizeof(SWalIdxEntry));
+ break;
+ }
+ taosLSeekFile(pIdxFile, offset, SEEK_SET);
+ int64_t contLen = taosReadFile(pIdxFile, &idxEntry, sizeof(SWalIdxEntry));
+ if (contLen < 0 || contLen != sizeof(SWalIdxEntry)) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return -1;
+ }
+ if ((idxEntry.ver - pFileInfo->firstVer) * sizeof(SWalIdxEntry) != offset) {
+ taosFtruncateFile(pIdxFile, offset);
+ wWarn("vgId:%d wal truncate file %s to offset %ld since entry invalid, entry ver %ld, entry offset %ld",
+ pWal->cfg.vgId, fnameStr, offset, idxEntry.ver, idxEntry.offset);
+ offset -= sizeof(SWalIdxEntry);
+ } else {
+ break;
+ }
+ }
+
+ if (idxEntry.ver < pFileInfo->lastVer) {
+ char fLogNameStr[WAL_FILE_LEN];
+ walBuildLogName(pWal, pFileInfo->firstVer, fLogNameStr);
+ TdFilePtr pLogFile = taosOpenFile(fLogNameStr, TD_FILE_READ);
+ if (pLogFile == NULL) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ wError("vgId:%d, cannot open file %s, since %s", pWal->cfg.vgId, fLogNameStr, terrstr());
+ return -1;
+ }
+ while (idxEntry.ver < pFileInfo->lastVer) {
+ taosLSeekFile(pLogFile, idxEntry.offset, SEEK_SET);
+ SWalCkHead ckHead;
+ taosReadFile(pLogFile, &ckHead, sizeof(SWalCkHead));
+ if (idxEntry.ver != ckHead.head.version) {
+ // todo truncate this idx also
+ taosCloseFile(&pLogFile);
+ wError("vgId:%d, invalid repair case, log seek to %ld to find ver %ld, actual ver %ld", pWal->cfg.vgId,
+ idxEntry.offset, idxEntry.ver, ckHead.head.version);
+ return -1;
+ }
+ idxEntry.ver = ckHead.head.version + 1;
+ idxEntry.offset = idxEntry.offset + sizeof(SWalCkHead) + ckHead.head.bodyLen;
+ wWarn("vgId:%d wal idx append new entry %ld %ld", pWal->cfg.vgId, idxEntry.ver, idxEntry.offset);
+ taosWriteFile(pIdxFile, &idxEntry, sizeof(SWalIdxEntry));
+ }
+ taosCloseFile(&pLogFile);
+ }
+ taosCloseFile(&pIdxFile);
+ }
return 0;
}
diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c
index c939c8c43685ef3dc6ea0b4fde1cd5fbfb33a8d1..a55f00d27702294f6bf996690c80ca5e3765428a 100644
--- a/source/libs/wal/src/walMgmt.c
+++ b/source/libs/wal/src/walMgmt.c
@@ -149,15 +149,21 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) {
walLoadMeta(pWal);
if (walCheckAndRepairMeta(pWal) < 0) {
+ wError("vgId:%d cannot open wal since repair meta file failed", pWal->cfg.vgId);
taosHashCleanup(pWal->pRefHash);
taosRemoveRef(tsWal.refSetId, pWal->refId);
taosThreadMutexDestroy(&pWal->mutex);
taosArrayDestroy(pWal->fileInfoSet);
- taosMemoryFree(pWal);
return NULL;
}
if (walCheckAndRepairIdx(pWal) < 0) {
+ wError("vgId:%d cannot open wal since repair idx file failed", pWal->cfg.vgId);
+ taosHashCleanup(pWal->pRefHash);
+ taosRemoveRef(tsWal.refSetId, pWal->refId);
+ taosThreadMutexDestroy(&pWal->mutex);
+ taosArrayDestroy(pWal->fileInfoSet);
+ return NULL;
}
wDebug("vgId:%d, wal:%p is opened, level:%d fsyncPeriod:%d", pWal->cfg.vgId, pWal, pWal->cfg.level,
diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c
index 2767fed9373aa47ebdbea39b07f28c238db14c7d..e1a8697ad53519b3f0db59f28ee6f82355ac82dd 100644
--- a/source/util/src/tpagedbuf.c
+++ b/source/util/src/tpagedbuf.c
@@ -284,7 +284,6 @@ static char* evacOneDataPage(SDiskbasedBuf* pBuf) {
// all pages are referenced by user, try to allocate new space
if (pn == NULL) {
- assert(0);
int32_t prev = pBuf->inMemPages;
// increase by 50% of previous mem pages
@@ -304,7 +303,6 @@ static char* evacOneDataPage(SDiskbasedBuf* pBuf) {
bufPage = flushPageToDisk(pBuf, d);
}
- ASSERT((bufPage != NULL) || terrno != TSDB_CODE_SUCCESS);
return bufPage;
}
@@ -377,12 +375,6 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t* pageId) {
char* availablePage = NULL;
if (NO_IN_MEM_AVAILABLE_PAGES(pBuf)) {
availablePage = evacOneDataPage(pBuf);
-
- // Failed to allocate a new buffer page, and there is an error occurs.
- if (availablePage == NULL) {
- assert(0);
- return NULL;
- }
}
SPageInfo* pi = NULL;
@@ -652,4 +644,4 @@ void clearDiskbasedBuf(SDiskbasedBuf* pBuf) {
pBuf->totalBufSize = 0;
pBuf->allocateId = -1;
pBuf->fileSize = 0;
-}
\ No newline at end of file
+}
diff --git a/tests/docs-examples-test/csharp.sh b/tests/docs-examples-test/csharp.sh
index a8f1ce4119f0f41d8372c9ceb8fef6053caa1563..8d1031ab8f8367e260804a58ecc2ae4f9822550c 100644
--- a/tests/docs-examples-test/csharp.sh
+++ b/tests/docs-examples-test/csharp.sh
@@ -6,23 +6,32 @@ pgrep taosd || taosd >> /dev/null 2>&1 &
pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
cd ../../docs/examples/csharp
-dotnet run --project connect.csproj
+dotnet run --project connect/connect.csproj
taos -s "drop database if exists power"
-dotnet run --project sqlinsert.csproj
-dotnet run --project query.csproj
-dotnet run --project asyncquery.csproj
-dotnet run --project subscribe.csproj
+dotnet run --project sqlInsert/sqlinsert.csproj
+dotnet run --project query/query.csproj
+dotnet run --project asyncQuery/asyncquery.csproj
+dotnet run --project subscribe/subscribe.csproj
taos -s "drop topic if exists topic_example"
taos -s "drop database if exists power"
-dotnet run --project stmtinsert.csproj
+dotnet run --project stmtInsert/stmtinsert.csproj
taos -s "drop database if exists test"
-dotnet run --project influxdbline.csproj
+dotnet run --project influxdbLine/influxdbline.csproj
taos -s "drop database if exists test"
-dotnet run --project optstelnet.csproj
+dotnet run --project optsTelnet/optstelnet.csproj
taos -s "drop database if exists test"
-dotnet run --project optsjson.csproj
\ No newline at end of file
+dotnet run --project optsJSON/optsJSON.csproj
+
+taos -s "create database if exists test"
+dotnet run --project wsConnect/wsConnect.csproj
+dotnet run --project wsInsert/wsInsert.csproj
+dotnet run --project wsStmt/wsStmt.csproj
+dotnet run --project wsQuery/wsQuery.csproj
+
+taos -s "drop database if exists test"
+taos -s "drop database if exists power"
\ No newline at end of file
diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh
index f0ee9be46fa5c3f399cde738cad29aa3f03ea7b8..bb57f238f029e2098f70fc553a8e6280ff46e5c4 100755
--- a/tests/parallel_test/run_container.sh
+++ b/tests/parallel_test/run_container.sh
@@ -79,9 +79,11 @@ fi
ulimit -c unlimited
TMP_DIR=$WORKDIR/tmp
-
+SOURCEDIR=$WORKDIR/src
MOUNT_DIR=""
+packageName="TDengine-server-3.0.1.0-Linux-x64.tar.gz"
rm -rf ${TMP_DIR}/thread_volume/$thread_no/sim
+mkdir -p $SOURCEDIR
mkdir -p ${TMP_DIR}/thread_volume/$thread_no/sim/tsim
mkdir -p ${TMP_DIR}/thread_volume/$thread_no/coredump
rm -rf ${TMP_DIR}/thread_volume/$thread_no/coredump/*
@@ -90,6 +92,11 @@ if [ ! -d "${TMP_DIR}/thread_volume/$thread_no/$exec_dir" ]; then
echo "cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/"
cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/
fi
+
+if [ ! -f "${SOURCEDIR}/${packageName}" ]; then
+ wget -P ${SOURCEDIR} https://taosdata.com/assets-download/3.0/${packageName}
+fi
+
MOUNT_DIR="$TMP_DIR/thread_volume/$thread_no/$exec_dir:$CONTAINER_TESTDIR/tests/$exec_dir"
echo "$thread_no -> ${exec_dir}:$cmd"
coredump_dir=`cat /proc/sys/kernel/core_pattern | xargs dirname`
@@ -97,6 +104,7 @@ coredump_dir=`cat /proc/sys/kernel/core_pattern | xargs dirname`
docker run \
-v $REP_MOUNT_PARAM \
-v $MOUNT_DIR \
+ -v ${SOURCEDIR}:/usr/local/src/ \
-v "$TMP_DIR/thread_volume/$thread_no/sim:${SIM_DIR}" \
-v ${TMP_DIR}/thread_volume/$thread_no/coredump:$coredump_dir \
-v $WORKDIR/taos-connector-python/taos:/usr/local/lib/python3.8/site-packages/taos:ro \
diff --git a/tests/script/tsim/insert/basic.sim b/tests/script/tsim/insert/basic.sim
index c4ef3e39dab9f09028ecfd401fb6444a0fe0ecd4..c926cbc8b0cf2f7250d8b7ba9850ecc13cee19d4 100644
--- a/tests/script/tsim/insert/basic.sim
+++ b/tests/script/tsim/insert/basic.sim
@@ -12,7 +12,7 @@ $tb = $tbPrefix . $i
print =============== step1
sql drop database -x step1
step1:
-sql create database $db
+sql create database $db vgroups 2
sql use $db
sql create table $tb (ts timestamp, speed int)
diff --git a/tests/script/tsim/tmq/topic.sim b/tests/script/tsim/tmq/topic.sim
index 602b1064720636b504a3baa302cdd418c3cabe89..cb1e74798ea072a03d2ea2570a5a245222b5c8c5 100644
--- a/tests/script/tsim/tmq/topic.sim
+++ b/tests/script/tsim/tmq/topic.sim
@@ -72,15 +72,31 @@ sql create topic topic_ntb_column as select ts, c3 from ntb0
sql create topic topic_ntb_all as select * from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode1 -s start
-print == show topics
sql show topics
if $rows != 9 then
return -1
endi
-print == drop topic
sql drop topic topic_stb_column
+
+sql show topics
+if $rows != 8 then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode1 -s start
+
+print == show topics
+sql show topics
+if $rows != 8 then
+ return -1
+endi
+
+print == drop topic
sql drop topic topic_ctb_column
sql drop topic topic_ntb_column
@@ -90,4 +106,4 @@ if $rows != 6 then
return -1
endi
-
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/trans/create_db.sim b/tests/script/tsim/trans/create_db.sim
index 8543bec144aac5b3e0c230cced7af3dc2e466a75..f04e505dd54a78fa2b6f81fb7c09ab97d9f438d7 100644
--- a/tests/script/tsim/trans/create_db.sim
+++ b/tests/script/tsim/trans/create_db.sim
@@ -56,7 +56,7 @@ if $data[0][2] != redoAction then
return -1
endi
-if $data[0][3] != d1 then
+if $data[0][4] != d1 then
return -1
endi
@@ -120,7 +120,7 @@ if $system_content != Windows_NT then
return -1
endi
- if $data[0][3] != d2 then
+ if $data[0][4] != d2 then
return -1
endi
diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py
new file mode 100644
index 0000000000000000000000000000000000000000..25b023bb76e9e9f34f288624a5f33daeca78d717
--- /dev/null
+++ b/tests/system-test/0-others/compatibility.py
@@ -0,0 +1,157 @@
+from urllib.parse import uses_relative
+import taos
+import sys
+import os
+import time
+
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+from util.dnodes import *
+from util.dnodes import TDDnodes
+from util.dnodes import TDDnode
+from util.cluster import *
+
+
+class TDTestCase:
+ def caseDescription(self):
+ '''
+ 3.0 data compatibility test
+ case1: basedata version is 3.0.1.0
+ '''
+ return
+
+ def init(self, conn, logSql):
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor())
+
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" in files or "taosd.exe" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root)-len("/build/bin")]
+ break
+ return buildPath
+
+ def getCfgPath(self):
+ buildPath = self.getBuildPath()
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ cfgPath = buildPath + "/../sim/dnode1/cfg/"
+ else:
+ cfgPath = buildPath + "/../sim/dnode1/cfg/"
+
+ return cfgPath
+
+ def installTaosd(self,bPath,cPath):
+ # os.system(f"rmtaos && mkdir -p {self.getBuildPath()}/build/lib/temp && mv {self.getBuildPath()}/build/lib/libtaos.so* {self.getBuildPath()}/build/lib/temp/ ")
+ # os.system(f" mv {bPath}/build {bPath}/build_bak ")
+ # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so {self.getBuildPath()}/build/lib/libtaos.so_bak ")
+ # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so.1 {self.getBuildPath()}/build/lib/libtaos.so.1_bak ")
+
+ packagePath="/usr/local/src/"
+ packageName="TDengine-server-3.0.1.0-Linux-x64.tar.gz"
+ os.system(f"cd {packagePath} && tar xvf TDengine-server-3.0.1.0-Linux-x64.tar.gz && cd TDengine-server-3.0.1.0 && ./install.sh -e no " )
+ tdDnodes.stop(1)
+ print(f"start taosd: nohup taosd -c {cPath} & ")
+ os.system(f" nohup taosd -c {cPath} & " )
+ sleep(1)
+
+
+
+ def buildTaosd(self,bPath):
+ # os.system(f"mv {bPath}/build_bak {bPath}/build ")
+ os.system(f" cd {bPath} && make install ")
+
+
+ def run(self):
+ bPath=self.getBuildPath()
+ cPath=self.getCfgPath()
+ dbname = "test"
+ stb = f"{dbname}.meters"
+ self.installTaosd(bPath,cPath)
+ tableNumbers=100
+ recordNumbers1=100
+ recordNumbers2=1000
+ tdsqlF=tdCom.newTdSql()
+ print(tdsqlF)
+ tdsqlF.query(f"SELECT SERVER_VERSION();")
+ print(tdsqlF.query(f"SELECT SERVER_VERSION();"))
+ oldServerVersion=tdsqlF.queryResult[0][0]
+ tdLog.info(f"Base server version is {oldServerVersion}")
+ tdsqlF.query(f"SELECT CLIENT_VERSION();")
+ # the oldClientVersion can't be updated in the same python process,so the version is new compiled verison
+ oldClientVersion=tdsqlF.queryResult[0][0]
+ tdLog.info(f"Base client version is {oldClientVersion}")
+
+ tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{oldServerVersion}")
+ tdLog.info(f"taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
+ os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
+ sleep(3)
+
+ # tdsqlF.query(f"select count(*) from {stb}")
+ # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1)
+ os.system("pkill taosd")
+ sleep(1)
+
+ tdLog.printNoPrefix("==========step2:update new version ")
+ self.buildTaosd(bPath)
+ tdDnodes.start(1)
+ sleep(1)
+ tdsql=tdCom.newTdSql()
+ print(tdsql)
+
+
+ tdsql.query(f"SELECT SERVER_VERSION();")
+ nowServerVersion=tdsql.queryResult[0][0]
+ tdLog.info(f"New server version is {nowServerVersion}")
+ tdsql.query(f"SELECT CLIENT_VERSION();")
+ nowClientVersion=tdsql.queryResult[0][0]
+ tdLog.info(f"New client version is {nowClientVersion}")
+
+ tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}")
+ tdsql.query(f"select count(*) from {stb}")
+ tdsql.checkData(0,0,tableNumbers*recordNumbers1)
+ os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ")
+ tdsql.query(f"select count(*) from {stb}")
+ tdsql.checkData(0,0,tableNumbers*recordNumbers2)
+
+ tdsql=tdCom.newTdSql()
+ tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542")
+ tdsql.execute("drop database if exists db")
+ tdsql.execute("create database db")
+ tdsql.execute("use db")
+ tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);")
+ tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);")
+ tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);")
+ tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);")
+ tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);")
+ tdsql.query("select * from db.ct3")
+ tdsql.checkData(0,1,13)
+ tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);")
+ tdsql.query("select * from db.ct4")
+ tdsql.checkData(0,1,14)
+ tdsql.query("describe information_schema.ins_databases;")
+ qRows=tdsql.queryRows
+ for i in range(qRows) :
+ if tdsql.queryResult[i][0]=="retentions" :
+ return True
+ else:
+ return False
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/1-insert/database_pre_suf.py b/tests/system-test/1-insert/database_pre_suf.py
new file mode 100755
index 0000000000000000000000000000000000000000..fc4bf7f5de2bffd5ad83f9936b633af7d0513169
--- /dev/null
+++ b/tests/system-test/1-insert/database_pre_suf.py
@@ -0,0 +1,377 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import random
+import os
+import time
+import taos
+import subprocess
+from faker import Faker
+from util.log import tdLog
+from util.cases import tdCases
+from util.sql import tdSql
+from util.dnodes import tdDnodes
+from util.dnodes import *
+
+class TDTestCase:
+ updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
+ "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
+ "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143}
+
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.testcasePath = os.path.split(__file__)[0]
+ self.testcaseFilename = os.path.split(__file__)[-1]
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.db = "pre_suf"
+
+ def dropandcreateDB_random(self,database,n,vgroups,table_prefix,table_suffix,check_result):
+ ts = 1630000000000
+ num_random = 100
+ fake = Faker('zh_CN')
+ tdSql.execute('''drop database if exists %s ;''' %database)
+ tdSql.execute('''create database %s keep 36500 vgroups %d table_prefix %d table_suffix %d;'''%(database,vgroups,table_prefix,table_suffix))
+ tdSql.execute('''use %s;'''%database)
+
+ tdSql.execute('''create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+ tdSql.execute('''create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+
+ for i in range(10*n):
+ tdSql.execute('''create table bj_%d (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp ) ;'''%i)
+ tdSql.execute('''create table sh_%d (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp ) ;'''%i)
+ tdSql.execute('''create table bj_table_%d_r (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp ) ;'''%i)
+ tdSql.execute('''create table sh_table_%d_r (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp ) ;'''%i)
+ tdSql.execute('''create table hn_table_%d_r \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;'''%i)
+ tdSql.execute('''create table bj_stable_1_%d using stable_1 tags('bj_stable_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table sh_table_%d_a using stable_1 tags('sh_a_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table sh_table_%d_b using stable_1 tags('sh_b_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table sh_table_%d_c using stable_1 tags('sh_c_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+
+ tdSql.execute('''create table bj_table_%d_a using stable_1 tags('bj_a_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table bj_table_%d_b using stable_1 tags('bj_b_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table bj_table_%d_c using stable_1 tags('bj_c_table_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+
+
+ tdSql.execute('''create table tj_table_%d_a using stable_2 tags('tj_a_table_2_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table tj_table_%d_b using stable_2 tags('tj_b_table_2_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(i,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+
+
+ # create stream
+ tdSql.execute('''create stream current_stream into stream_max_stable_1 as select _wstart as start, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''')
+
+ # insert data
+ for i in range(num_random*n):
+ tdSql.execute('''insert into bj_stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1),
+ fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
+ fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
+ tdSql.execute('''insert into hn_table_1_r (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1) ,
+ fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1) ,
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
+ fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
+
+ tdSql.execute('''insert into bj_stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)\
+ values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
+ fake.random_int(min=0, max=9223372036854775807, step=1),
+ fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
+ fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
+ tdSql.execute('''insert into hn_table_2_r (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
+ fake.random_int(min=0, max=9223372036854775807, step=1),
+ fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
+ fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
+
+ tdSql.execute('''insert into bj_stable_1_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=-0, max=2147483647, step=1),
+ fake.random_int(min=-0, max=9223372036854775807, step=1),
+ fake.random_int(min=-0, max=32767, step=1) , fake.random_int(min=-0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
+ fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
+
+ tdSql.execute('''insert into bj_stable_1_4 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000 +1, fake.random_int(min=-0, max=2147483647, step=1),
+ fake.random_int(min=-0, max=9223372036854775807, step=1),
+ fake.random_int(min=-0, max=32767, step=1) , fake.random_int(min=-0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
+ fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
+
+ tdSql.execute('''insert into bj_stable_1_5 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000 +10, fake.random_int(min=-0, max=2147483647, step=1),
+ fake.random_int(min=-0, max=9223372036854775807, step=1),
+ fake.random_int(min=-0, max=32767, step=1) , fake.random_int(min=-0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i, fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() ,
+ fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr() , fake.pystr()))
+
+ tdSql.query("select count(*) from stable_1;")
+ tdSql.checkData(0,0,5*num_random*n)
+ tdSql.query("select count(*) from hn_table_1_r;")
+ tdSql.checkData(0,0,num_random*n)
+
+ # stream data check
+ tdSql.query("select start,wend,max_int from stream_max_stable_1 ;")
+ tdSql.checkRows(20)
+ tdSql.query("select sum(max_int) from stream_max_stable_1 ;")
+ stream_data_1 = tdSql.queryResult[0][0]
+ tdSql.query("select sum(min_int) from stream_max_stable_1 ;")
+ stream_data_2 = tdSql.queryResult[0][0]
+ tdSql.query("select sum(max_int),sum(min_int) from (select _wstart as start, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s));")
+ sql_data_1 = tdSql.queryResult[0][0]
+ sql_data_2 = tdSql.queryResult[0][1]
+
+ self.stream_value_check(stream_data_1,sql_data_1)
+ self.stream_value_check(stream_data_2,sql_data_2)
+
+ tdSql.query("select sum(max_int),sum(min_int) from (select _wstart as start, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 interval (5s));")
+ sql_data_1 = tdSql.queryResult[0][0]
+ sql_data_2 = tdSql.queryResult[0][1]
+
+ self.stream_value_check(stream_data_1,sql_data_1)
+ self.stream_value_check(stream_data_2,sql_data_2)
+
+ tdSql.query("select max(max_int) from stream_max_stable_1 ;")
+ stream_data_1 = tdSql.queryResult[0][0]
+ tdSql.query("select min(min_int) from stream_max_stable_1 ;")
+ stream_data_2 = tdSql.queryResult[0][0]
+ tdSql.query("select max(q_int) as max_int, min(q_bigint) as min_int from stable_1;")
+ sql_data_1 = tdSql.queryResult[0][0]
+ sql_data_2 = tdSql.queryResult[0][1]
+
+ self.stream_value_check(stream_data_1,sql_data_1)
+ self.stream_value_check(stream_data_2,sql_data_2)
+
+
+ tdSql.query(" select * from information_schema.ins_databases where name = '%s';" %database)
+ print(tdSql.queryResult)
+
+ # tdSql.query(" select table_prefix,table_suffix from information_schema.ins_databases where name = '%s';" %database)
+ # print(tdSql.queryResult)
+ #TD-19082
+
+ #tdSql.query(" select * from information_schema.ins_tables where db_name = '%s';" %database)
+ #print(tdSql.queryResult)
+
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s';" %database)
+ queryRows = len(tdSql.queryResult)
+ for i in range(queryRows):
+ print("row=%d, vgroup_id=%s, tbname=%s " %(i,tdSql.queryResult[i][1],tdSql.queryResult[i][0]))
+
+ tdLog.info("\n=============flush database ====================\n")
+
+ tdSql.execute(" flush database %s;" %database)
+
+ tdSql.query(" select * from information_schema.ins_databases where name = '%s';" %database)
+ print(tdSql.queryResult)
+
+ # tdSql.query(" select table_prefix,table_suffix from information_schema.ins_databases where name = '%s';" %database)
+ # print(tdSql.queryResult)
+ #TD-19082
+
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s';" %database)
+ queryRows = len(tdSql.queryResult)
+ for i in range(queryRows):
+ print("row=%d, vgroup_id=%s, tbname=%s " %(i,tdSql.queryResult[i][1],tdSql.queryResult[i][0]))
+
+
+ # check in one vgroup
+ if check_result == 'Y':
+ #base table : sh_table_0_a
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_0_a';" %(database))
+ base_value_table_name = tdSql.queryResult[0][0]
+ base_value_table_vgroup = tdSql.queryResult[0][1]
+
+ #check table :sh_table_i_a
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_a';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_a';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :sh_table_i_b
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_b';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_b';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :sh_table_i_c
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_c';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_c';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :sh_table_i_r
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'sh_table_%%_r';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='sh_table_%d_r';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :bj_table_i_a
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_a';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_a';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :bj_table_i_b
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_b';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_b';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :bj_table_i_c
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_c';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_c';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :bj_table_i_r
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'bj_table_%%_r';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='bj_table_%d_r';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :hn_table_i_r
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'hn_table_%%_r';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='hn_table_%d_r';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :tj_table_i_a
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'tj_table_%%_a';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='tj_table_%d_a';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ #check table :tj_table_i_b
+ check_rows = tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name like 'tj_table_%%_b';" %(database))
+ for i in range(check_rows):
+ tdSql.query(" select table_name,vgroup_id from information_schema.ins_tables where db_name = '%s' and table_name='tj_table_%d_b';" %(database,i))
+ self.value_check(base_value_table_name,base_value_table_vgroup)
+
+ else:
+ pass
+
+ def value_check(self,base_value_table_name,base_value_table_vgroup):
+ check_value_table_name = tdSql.queryResult[0][0]
+ check_value_table_vgroup = tdSql.queryResult[0][1]
+ #tdLog.info(f"{base_value_table_name},{base_value_table_vgroup},{check_value_table_name},{check_value_table_vgroup}")
+
+ if base_value_table_vgroup==check_value_table_vgroup:
+ tdLog.info(f"checkEqual success, base_table_name={base_value_table_name},base_table_host={base_value_table_vgroup} ,check_table_name={check_value_table_name},check_table_host={check_value_table_vgroup}")
+ else :
+ tdLog.exit(f"checkEqual error, base_table_name=={base_value_table_name},base_table_host={base_value_table_vgroup} ,check_table_name={check_value_table_name},check_table_host={check_value_table_vgroup}")
+
+ def stream_value_check(self,stream_data,sql_data):
+ if stream_data==sql_data:
+ tdLog.info(f"checkEqual success, stream_data={stream_data},sql_data={sql_data}")
+ else :
+ tdLog.exit(f"checkEqual error, stream_data=={stream_data},sql_data={sql_data}")
+
+ def run(self):
+ startTime = time.time()
+
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ #(self,database,n,vgroups,table_prefix,table_suffix)
+ self.dropandcreateDB_random("%s" %self.db, 1,2,0,0,'N')
+ self.dropandcreateDB_random("%s" %self.db, 1,2,0,2,'N')
+ self.dropandcreateDB_random("%s" %self.db, 1,2,2,0,'N')
+ self.dropandcreateDB_random("%s" %self.db, 1,2,3,3,'Y')
+ self.dropandcreateDB_random("%s" %self.db, 1,3,3,3,'Y')
+ self.dropandcreateDB_random("%s" %self.db, 1,4,4,4,'Y')
+ self.dropandcreateDB_random("%s" %self.db, 1,5,5,5,'Y')
+
+
+ #taos -f sql
+ print("taos -f sql start!")
+ taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
+ _ = subprocess.check_output(taos_cmd1, shell=True)
+ print("taos -f sql over!")
+
+
+ endTime = time.time()
+ print("total time %ds" % (endTime - startTime))
+
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py
index 5550519e05249de13d1267dd2a8f5bc1b10fae6d..7bf0191ec176c8a833eb3ff16fbb007e456fe93f 100644
--- a/tests/system-test/2-query/interp.py
+++ b/tests/system-test/2-query/interp.py
@@ -595,11 +595,11 @@ class TDTestCase:
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.checkRows(3)
tdSql.checkCols(4)
for i in range (tdSql.queryCols):
- tdSql.checkData(0, i, 15)
+ tdSql.checkData(0, i, 13)
tdLog.printNoPrefix("==========step10:test error cases")
diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh
index f4a5c22d3979d1e8dbc9c681360360dd1fd45a15..3ae3f628866900b21f2fc873b8d3dcbf90186108 100755
--- a/tests/system-test/fulltest.sh
+++ b/tests/system-test/fulltest.sh
@@ -17,6 +17,7 @@ python3 ./test.py -f 0-others/udf_cfg2.py
python3 ./test.py -f 0-others/sysinfo.py
python3 ./test.py -f 0-others/user_control.py
python3 ./test.py -f 0-others/fsync.py
+python3 ./test.py -f 0-others/compatibility.py
python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
@@ -35,6 +36,7 @@ python3 ./test.py -f 1-insert/mutil_stage.py
python3 ./test.py -f 1-insert/table_param_ttl.py -R
python3 ./test.py -f 1-insert/update_data_muti_rows.py
python3 ./test.py -f 1-insert/db_tb_name_check.py
+python3 ./test.py -f 1-insert/database_pre_suf.py
python3 ./test.py -f 2-query/abs.py
python3 ./test.py -f 2-query/abs.py -R
@@ -515,3 +517,94 @@ python3 ./test.py -f 2-query/tsbsQuery.py -Q 3
python3 ./test.py -f 2-query/sml.py -Q 3
python3 ./test.py -f 2-query/interp.py -Q 3
+
+#------------querPolicy 4-----------
+
+python3 ./test.py -f 2-query/between.py -Q 4
+python3 ./test.py -f 2-query/distinct.py -Q 4
+python3 ./test.py -f 2-query/varchar.py -Q 4
+python3 ./test.py -f 2-query/ltrim.py -Q 4
+python3 ./test.py -f 2-query/rtrim.py -Q 4
+python3 ./test.py -f 2-query/length.py -Q 4
+python3 ./test.py -f 2-query/char_length.py -Q 4
+python3 ./test.py -f 2-query/upper.py -Q 4
+python3 ./test.py -f 2-query/lower.py -Q 4
+python3 ./test.py -f 2-query/join.py -Q 4
+python3 ./test.py -f 2-query/join2.py -Q 4
+python3 ./test.py -f 2-query/cast.py -Q 4
+python3 ./test.py -f 2-query/substr.py -Q 4
+python3 ./test.py -f 2-query/union.py -Q 4
+python3 ./test.py -f 2-query/union1.py -Q 4
+python3 ./test.py -f 2-query/concat.py -Q 4
+python3 ./test.py -f 2-query/concat2.py -Q 4
+python3 ./test.py -f 2-query/concat_ws.py -Q 4
+python3 ./test.py -f 2-query/concat_ws2.py -Q 4
+#python3 ./test.py -f 2-query/check_tsdb.py -Q 4
+python3 ./test.py -f 2-query/spread.py -Q 4
+python3 ./test.py -f 2-query/hyperloglog.py -Q 4
+python3 ./test.py -f 2-query/explain.py -Q 4
+python3 ./test.py -f 2-query/leastsquares.py -Q 4
+python3 ./test.py -f 2-query/timezone.py -Q 4
+python3 ./test.py -f 2-query/Now.py -Q 4
+python3 ./test.py -f 2-query/Today.py -Q 4
+python3 ./test.py -f 2-query/max.py -Q 4
+python3 ./test.py -f 2-query/min.py -Q 4
+python3 ./test.py -f 2-query/count.py -Q 4
+#python3 ./test.py -f 2-query/last.py -Q 4
+python3 ./test.py -f 2-query/first.py -Q 4
+python3 ./test.py -f 2-query/To_iso8601.py -Q 4
+python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 4
+python3 ./test.py -f 2-query/timetruncate.py -Q 4
+python3 ./test.py -f 2-query/diff.py -Q 4
+python3 ./test.py -f 2-query/Timediff.py -Q 4
+python3 ./test.py -f 2-query/json_tag.py -Q 4
+python3 ./test.py -f 2-query/top.py -Q 4
+python3 ./test.py -f 2-query/bottom.py -Q 4
+python3 ./test.py -f 2-query/percentile.py -Q 4
+python3 ./test.py -f 2-query/apercentile.py -Q 4
+python3 ./test.py -f 2-query/abs.py -Q 4
+python3 ./test.py -f 2-query/ceil.py -Q 4
+python3 ./test.py -f 2-query/floor.py -Q 4
+python3 ./test.py -f 2-query/round.py -Q 4
+python3 ./test.py -f 2-query/log.py -Q 4
+python3 ./test.py -f 2-query/pow.py -Q 4
+python3 ./test.py -f 2-query/sqrt.py -Q 4
+python3 ./test.py -f 2-query/sin.py -Q 4
+python3 ./test.py -f 2-query/cos.py -Q 4
+python3 ./test.py -f 2-query/tan.py -Q 4
+python3 ./test.py -f 2-query/arcsin.py -Q 4
+python3 ./test.py -f 2-query/arccos.py -Q 4
+python3 ./test.py -f 2-query/arctan.py -Q 4
+python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4
+# python3 ./test.py -f 2-query/nestedQuery.py -Q 4
+# python3 ./test.py -f 2-query/nestedQuery_str.py -Q 4
+# python3 ./test.py -f 2-query/avg.py -Q 4
+# python3 ./test.py -f 2-query/elapsed.py -Q 4
+python3 ./test.py -f 2-query/csum.py -Q 4
+#python3 ./test.py -f 2-query/mavg.py -Q 4
+python3 ./test.py -f 2-query/sample.py -Q 4
+python3 ./test.py -f 2-query/function_diff.py -Q 4
+python3 ./test.py -f 2-query/unique.py -Q 4
+python3 ./test.py -f 2-query/stateduration.py -Q 4
+python3 ./test.py -f 2-query/function_stateduration.py -Q 4
+python3 ./test.py -f 2-query/statecount.py -Q 4
+python3 ./test.py -f 2-query/tail.py -Q 4
+python3 ./test.py -f 2-query/ttl_comment.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_count.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_max.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_min.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 4
+python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 4
+python3 ./test.py -f 2-query/twa.py -Q 4
+python3 ./test.py -f 2-query/irate.py -Q 4
+python3 ./test.py -f 2-query/function_null.py -Q 4
+python3 ./test.py -f 2-query/count_partition.py -Q 4
+python3 ./test.py -f 2-query/max_partition.py -Q 4
+python3 ./test.py -f 2-query/last_row.py -Q 4
+python3 ./test.py -f 2-query/tsbsQuery.py -Q 4
+#python3 ./test.py -f 2-query/sml.py -Q 4
+python3 ./test.py -f 2-query/interp.py -Q 4
+
diff --git a/tools/shell/src/shellUtil.c b/tools/shell/src/shellUtil.c
index 0430428c381bbcee3f4abf51a44e61bc849f094d..8c47d165557317dbcf710dda7d72b77037340692 100644
--- a/tools/shell/src/shellUtil.c
+++ b/tools/shell/src/shellUtil.c
@@ -143,7 +143,7 @@ void shellCheckConnectMode() {
shell.args.port = 6041;
}
shell.args.dsn = taosMemoryCalloc(1, 1024);
- snprintf(shell.args.dsn, 1024, "ws://%s:%d/rest/ws",
+ snprintf(shell.args.dsn, 1024, "ws://%s:%d",
shell.args.host, shell.args.port);
}
shell.args.cloud = false;
diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c
index b8b8392b961a92263f791ee4b480e61a8c148efd..94bb909e296cb791538301abae42e01fb704b448 100644
--- a/tools/shell/src/shellWebsocket.c
+++ b/tools/shell/src/shellWebsocket.c
@@ -206,26 +206,31 @@ void shellRunSingleCommandWebsocketImp(char *command) {
printMode = true; // When output to a file, the switch does not work.
}
- if (!shell.ws_conn && shell_conn_ws_server(0)) {
- return;
- }
-
shell.stop_query = false;
- st = taosGetTimestampUs();
+ WS_RES* res;
- WS_RES* res = ws_query_timeout(shell.ws_conn, command, shell.args.timeout);
- int code = ws_errno(res);
- if (code != 0) {
- et = taosGetTimestampUs();
- fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6);
- if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) {
- fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n");
- } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) {
- fprintf(stderr, "TDengine server is down, will try to reconnect\n");
- shell.ws_conn = NULL;
+ for (int reconnectNum = 0; reconnectNum < 2; reconnectNum++) {
+ if (!shell.ws_conn && shell_conn_ws_server(0)) {
+ return;
}
- ws_free_result(res);
- return;
+ st = taosGetTimestampUs();
+
+ res = ws_query_timeout(shell.ws_conn, command, shell.args.timeout);
+ int code = ws_errno(res);
+ if (code != 0 && !shell.stop_query) {
+ et = taosGetTimestampUs();
+ fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6);
+ if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) {
+ fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n");
+ } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) {
+ fprintf(stderr, "TDengine server is down, will try to reconnect\n");
+ shell.ws_conn = NULL;
+ }
+ ws_free_result(res);
+ if (reconnectNum == 0) continue;
+ return;
+ }
+ break;
}
double execute_time = ws_take_timing(res)/1E6;