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/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/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..448c2b99c013da6880631c514bc24cf577fdc002 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 f03c09a 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 627cd53c09abf60840a4ab14a73d99a1ef061479..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 76bc64d + GIT_TAG 1bdfca3 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/docs/en/05-get-started/01-docker.md b/docs/en/05-get-started/01-docker.md index be61dfeb8e0f28220dd58fcf86ce8115d53714c2..d0874c331e81c8f174ab2d90c06302f58af03ea6 100644 --- a/docs/en/05-get-started/01-docker.md +++ b/docs/en/05-get-started/01-docker.md @@ -5,8 +5,8 @@ title: Quick Install on Docker This document describes how to install TDengine in a Docker container and perform queries and inserts. +- The easiest way to explore TDengine is through [TDengine Cloud](http://cloud.tdengine.com). - To get started with TDengine in a non-containerized environment, see [Quick Install from Package](../../get-started/package). -- For a fully managed solution, see the [TDengine Cloud documentation](/cloud/). - If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine). ## Run TDengine diff --git a/docs/en/05-get-started/03-package.md b/docs/en/05-get-started/03-package.md index da06aca14892bfc73e7d8b2ced6b7a391c3e5cf0..25a92573faa6d6b3a9625f161bc7d0258492b91a 100644 --- a/docs/en/05-get-started/03-package.md +++ b/docs/en/05-get-started/03-package.md @@ -9,8 +9,8 @@ import PkgListV3 from "/components/PkgListV3"; This document describes how to install TDengine on Linux and Windows and perform queries and inserts. +- The easiest way to explore TDengine is through [TDengine Cloud](http://cloud.tdengine.com). - To get started with TDengine on Docker, see [Quick Install on Docker](../../get-started/docker). -- For a fully managed solution, see the [TDengine Cloud documentation](/cloud/). - If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine). The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter). 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/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx index ce28ee87d9317487d5c610d23287775be6b753ec..da26b34c6f77861a5a2308204dba56964ce05430 100644 --- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx +++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx @@ -123,7 +123,7 @@ where `TOKEN` is the string after Base64 encoding of `{username}:{password}`, e. ### HTTP body structure -#### Successful Operation +#### Successful Insert Operation Example: @@ -143,7 +143,7 @@ Description: - rows: (`int`) Only returns `1`. - data: (`[][]any`) Returns the number of rows affected. -#### Successful Query +#### Successful Query Operation Example: 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 694da603b924844cf0e2f30d038b6eafdc2ec0d1..c228f1be2a4b210c9ec11dc31b12571c24f7f0f5 100644 --- a/docs/examples/csharp/.gitignore +++ b/docs/examples/csharp/.gitignore @@ -1,12 +1,27 @@ -bin -obj .vs -*.sln -wsConnect/obj -wsInsert/obj -wsQuery/obj -wsStmt/obj +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 \ No newline at end of file +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/wsInsert/Program.cs b/docs/examples/csharp/wsInsert/Program.cs index 4ff830b437fa21cb76474de1bb73c82fb71558ef..4cd812cda916308f80f7bf2001d38046434056c1 100644 --- a/docs/examples/csharp/wsInsert/Program.cs +++ b/docs/examples/csharp/wsInsert/Program.cs @@ -47,7 +47,7 @@ namespace Examples } else { - Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes),LibTaosWS.WSAffectRows(wsRes)); + Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes), LibTaosWS.WSAffectRows(wsRes)); } } } diff --git a/docs/examples/csharp/wsQuery/Program.cs b/docs/examples/csharp/wsQuery/Program.cs index bf3cf2bbe288a23d989656ad3efa20f22dac89c3..de5591aa536655606547cf8998145025642989cd 100644 --- a/docs/examples/csharp/wsQuery/Program.cs +++ b/docs/examples/csharp/wsQuery/Program.cs @@ -55,7 +55,7 @@ namespace Examples // Free result after use. LibTaosWS.WSFreeResult(wsRes); - + // close connection. LibTaosWS.WSClose(wsConn); } diff --git a/docs/zh/07-develop/01-connect/_connect_cs.mdx b/docs/zh/07-develop/01-connect/_connect_cs.mdx index 9d0755fc646edb6f6ea9b834428b2b20e2044b4b..169bf37a636276a4d94c7b7faba4f7896c42e007 100644 --- a/docs/zh/07-develop/01-connect/_connect_cs.mdx +++ b/docs/zh/07-develop/01-connect/_connect_cs.mdx @@ -1,5 +1,5 @@ ```csharp title="原生连接" -{{#include docs/examples/csharp/ConnectExample.cs}} +{{#include docs/examples/csharp/connect/Program.cs}} ``` ```csharp title="WebSocket 连接" 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/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx index 12a9cf5347c9f2bb5490a1a19999da79b9d5c58f..a8e16823015a11b883edd3ec81b0efcfcc2bfb8f 100644 --- a/docs/zh/08-connector/02-rest-api.mdx +++ b/docs/zh/08-connector/02-rest-api.mdx @@ -125,7 +125,7 @@ curl -L -u username:password -d "" :/rest/sql/[db_name] ### HTTP body 结构 -#### 正确执行 +#### 正确执行插入 样例: @@ -145,7 +145,7 @@ curl -L -u username:password -d "" :/rest/sql/[db_name] - rows:(`int`)只返回 `1`。 - data:(`[][]any`)返回受影响行数。 -#### 正确查询 +#### 正确执行查询 样例: 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 9ba8be2c22fb46df8a5c73c499a7b22c6468f280..e99f41ae9cb0a97426878e3efb8cb85d66af4929 100644 --- a/docs/zh/08-connector/40-csharp.mdx +++ b/docs/zh/08-connector/40-csharp.mdx @@ -154,7 +154,7 @@ namespace TDengineExample * **host/port**: 指定创建连接的服务器及端口,WebSocket 连接默认为 `localhost:6041` 。 -* **database**: 指定默认连接的数据库名。 +* **database**: 指定默认连接的数据库名,可选参数。 * **params**:其他可选参数。 @@ -208,7 +208,7 @@ namespace TDengineExample ``` csharp -{{#include docs/examples/csharp/StmtInsertExample.cs}} +{{#include docs/examples/csharp/stmtInsert/Program.cs}} ``` 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/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/tdataformat.h b/include/common/tdataformat.h index 5b495601756d246abd08a3ef07f5efa8a6b47e62..ac94b0af7d8c2118e65a94f9b06e84c7b5ed4b48 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -66,10 +66,18 @@ int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type); int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type); // SColVal ================================ -#define COL_VAL_NONE(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .isNone = 1}) -#define COL_VAL_NULL(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .isNull = 1}) +#define CV_FLAG_VALUE ((int8_t)0x0) +#define CV_FLAG_NONE ((int8_t)0x1) +#define CV_FLAG_NULL ((int8_t)0x2) + +#define COL_VAL_NONE(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .flag = CV_FLAG_NONE}) +#define COL_VAL_NULL(CID, TYPE) ((SColVal){.cid = (CID), .type = (TYPE), .flag = CV_FLAG_NULL}) #define COL_VAL_VALUE(CID, TYPE, V) ((SColVal){.cid = (CID), .type = (TYPE), .value = (V)}) +#define COL_VAL_IS_NONE(CV) ((CV)->flag == CV_FLAG_NONE) +#define COL_VAL_IS_NULL(CV) ((CV)->flag == CV_FLAG_NULL) +#define COL_VAL_IS_VALUE(CV) ((CV)->flag == CV_FLAG_VALUE) + // STSRow2 ================================ #define TSROW_LEN(PROW, V) tGetI32v((uint8_t *)(PROW)->data, (V) ? &(V) : NULL) #define TSROW_SVER(PROW, V) tGetI32v((PROW)->data + TSROW_LEN(PROW, NULL), (V) ? &(V) : NULL) @@ -175,8 +183,7 @@ struct SValue { struct SColVal { int16_t cid; int8_t type; - int8_t isNone; - int8_t isNull; + int8_t flag; SValue value; }; 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..49db88d7031b578ac490d59f424eaada3dc7dbe9 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -866,7 +866,8 @@ int32_t tSerializeSDbCfgReq(void* buf, int32_t bufLen, SDbCfgReq* pReq); int32_t tDeserializeSDbCfgReq(void* buf, int32_t bufLen, SDbCfgReq* pReq); typedef struct { - char db[TSDB_DB_FNAME_LEN]; + char db[TSDB_DB_FNAME_LEN]; + int32_t maxSpeed; } STrimDbReq; int32_t tSerializeSTrimDbReq(void* buf, int32_t bufLen, STrimDbReq* pReq); @@ -1424,6 +1425,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 +1447,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 @@ -1720,6 +1730,8 @@ typedef struct { int64_t maxDelay; int64_t watermark; int8_t igExpired; + int32_t numOfTags; + SArray* pTags; // array of SField } SCMCreateStreamReq; typedef struct { @@ -2337,6 +2349,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..f40ff275cae339f13f662c39903eda8b33eb3098 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -107,223 +107,229 @@ #define TK_TABLE_PREFIX 89 #define TK_TABLE_SUFFIX 90 #define TK_NK_COLON 91 -#define TK_TABLE 92 -#define TK_NK_LP 93 -#define TK_NK_RP 94 -#define TK_STABLE 95 -#define TK_ADD 96 -#define TK_COLUMN 97 -#define TK_MODIFY 98 -#define TK_RENAME 99 -#define TK_TAG 100 -#define TK_SET 101 -#define TK_NK_EQ 102 -#define TK_USING 103 -#define TK_TAGS 104 -#define TK_COMMENT 105 -#define TK_BOOL 106 -#define TK_TINYINT 107 -#define TK_SMALLINT 108 -#define TK_INT 109 -#define TK_INTEGER 110 -#define TK_BIGINT 111 -#define TK_FLOAT 112 -#define TK_DOUBLE 113 -#define TK_BINARY 114 -#define TK_TIMESTAMP 115 -#define TK_NCHAR 116 -#define TK_UNSIGNED 117 -#define TK_JSON 118 -#define TK_VARCHAR 119 -#define TK_MEDIUMBLOB 120 -#define TK_BLOB 121 -#define TK_VARBINARY 122 -#define TK_DECIMAL 123 -#define TK_MAX_DELAY 124 -#define TK_WATERMARK 125 -#define TK_ROLLUP 126 -#define TK_TTL 127 -#define TK_SMA 128 -#define TK_FIRST 129 -#define TK_LAST 130 -#define TK_SHOW 131 -#define TK_DATABASES 132 -#define TK_TABLES 133 -#define TK_STABLES 134 -#define TK_MNODES 135 -#define TK_MODULES 136 -#define TK_QNODES 137 -#define TK_FUNCTIONS 138 -#define TK_INDEXES 139 -#define TK_ACCOUNTS 140 -#define TK_APPS 141 -#define TK_CONNECTIONS 142 -#define TK_LICENCES 143 -#define TK_GRANTS 144 -#define TK_QUERIES 145 -#define TK_SCORES 146 -#define TK_TOPICS 147 -#define TK_VARIABLES 148 -#define TK_BNODES 149 -#define TK_SNODES 150 -#define TK_CLUSTER 151 -#define TK_TRANSACTIONS 152 -#define TK_DISTRIBUTED 153 -#define TK_CONSUMERS 154 -#define TK_SUBSCRIPTIONS 155 -#define TK_VNODES 156 -#define TK_LIKE 157 -#define TK_INDEX 158 -#define TK_FUNCTION 159 -#define TK_INTERVAL 160 -#define TK_TOPIC 161 -#define TK_AS 162 -#define TK_WITH 163 -#define TK_META 164 -#define TK_CONSUMER 165 -#define TK_GROUP 166 -#define TK_DESC 167 -#define TK_DESCRIBE 168 -#define TK_RESET 169 -#define TK_QUERY 170 -#define TK_CACHE 171 -#define TK_EXPLAIN 172 -#define TK_ANALYZE 173 -#define TK_VERBOSE 174 -#define TK_NK_BOOL 175 -#define TK_RATIO 176 -#define TK_NK_FLOAT 177 -#define TK_OUTPUTTYPE 178 -#define TK_AGGREGATE 179 -#define TK_BUFSIZE 180 -#define TK_STREAM 181 -#define TK_INTO 182 -#define TK_TRIGGER 183 -#define TK_AT_ONCE 184 -#define TK_WINDOW_CLOSE 185 -#define TK_IGNORE 186 -#define TK_EXPIRED 187 -#define TK_KILL 188 -#define TK_CONNECTION 189 -#define TK_TRANSACTION 190 -#define TK_BALANCE 191 -#define TK_VGROUP 192 -#define TK_MERGE 193 -#define TK_REDISTRIBUTE 194 -#define TK_SPLIT 195 -#define TK_DELETE 196 -#define TK_INSERT 197 -#define TK_NULL 198 -#define TK_NK_QUESTION 199 -#define TK_NK_ARROW 200 -#define TK_ROWTS 201 -#define TK_TBNAME 202 -#define TK_QSTART 203 -#define TK_QEND 204 -#define TK_QDURATION 205 -#define TK_WSTART 206 -#define TK_WEND 207 -#define TK_WDURATION 208 -#define TK_CAST 209 -#define TK_NOW 210 -#define TK_TODAY 211 -#define TK_TIMEZONE 212 -#define TK_CLIENT_VERSION 213 -#define TK_SERVER_VERSION 214 -#define TK_SERVER_STATUS 215 -#define TK_CURRENT_USER 216 -#define TK_COUNT 217 -#define TK_LAST_ROW 218 -#define TK_BETWEEN 219 -#define TK_IS 220 -#define TK_NK_LT 221 -#define TK_NK_GT 222 -#define TK_NK_LE 223 -#define TK_NK_GE 224 -#define TK_NK_NE 225 -#define TK_MATCH 226 -#define TK_NMATCH 227 -#define TK_CONTAINS 228 -#define TK_IN 229 -#define TK_JOIN 230 -#define TK_INNER 231 -#define TK_SELECT 232 -#define TK_DISTINCT 233 -#define TK_WHERE 234 -#define TK_PARTITION 235 -#define TK_BY 236 -#define TK_SESSION 237 -#define TK_STATE_WINDOW 238 -#define TK_SLIDING 239 -#define TK_FILL 240 -#define TK_VALUE 241 -#define TK_NONE 242 -#define TK_PREV 243 -#define TK_LINEAR 244 -#define TK_NEXT 245 -#define TK_HAVING 246 -#define TK_RANGE 247 -#define TK_EVERY 248 -#define TK_ORDER 249 -#define TK_SLIMIT 250 -#define TK_SOFFSET 251 -#define TK_LIMIT 252 -#define TK_OFFSET 253 -#define TK_ASC 254 -#define TK_NULLS 255 -#define TK_ABORT 256 -#define TK_AFTER 257 -#define TK_ATTACH 258 -#define TK_BEFORE 259 -#define TK_BEGIN 260 -#define TK_BITAND 261 -#define TK_BITNOT 262 -#define TK_BITOR 263 -#define TK_BLOCKS 264 -#define TK_CHANGE 265 -#define TK_COMMA 266 -#define TK_COMPACT 267 -#define TK_CONCAT 268 -#define TK_CONFLICT 269 -#define TK_COPY 270 -#define TK_DEFERRED 271 -#define TK_DELIMITERS 272 -#define TK_DETACH 273 -#define TK_DIVIDE 274 -#define TK_DOT 275 -#define TK_EACH 276 -#define TK_END 277 -#define TK_FAIL 278 -#define TK_FILE 279 -#define TK_FOR 280 -#define TK_GLOB 281 -#define TK_ID 282 -#define TK_IMMEDIATE 283 -#define TK_IMPORT 284 -#define TK_INITIALLY 285 -#define TK_INSTEAD 286 -#define TK_ISNULL 287 -#define TK_KEY 288 -#define TK_NK_BITNOT 289 -#define TK_NK_SEMI 290 -#define TK_NOTNULL 291 -#define TK_OF 292 -#define TK_PLUS 293 -#define TK_PRIVILEGE 294 -#define TK_RAISE 295 -#define TK_REPLACE 296 -#define TK_RESTRICT 297 -#define TK_ROW 298 -#define TK_SEMI 299 -#define TK_STAR 300 -#define TK_STATEMENT 301 -#define TK_STRING 302 -#define TK_TIMES 303 -#define TK_UPDATE 304 -#define TK_VALUES 305 -#define TK_VARIABLE 306 -#define TK_VIEW 307 -#define TK_WAL 308 +#define TK_MAX_SPEED 92 +#define TK_TABLE 93 +#define TK_NK_LP 94 +#define TK_NK_RP 95 +#define TK_STABLE 96 +#define TK_ADD 97 +#define TK_COLUMN 98 +#define TK_MODIFY 99 +#define TK_RENAME 100 +#define TK_TAG 101 +#define TK_SET 102 +#define TK_NK_EQ 103 +#define TK_USING 104 +#define TK_TAGS 105 +#define TK_COMMENT 106 +#define TK_BOOL 107 +#define TK_TINYINT 108 +#define TK_SMALLINT 109 +#define TK_INT 110 +#define TK_INTEGER 111 +#define TK_BIGINT 112 +#define TK_FLOAT 113 +#define TK_DOUBLE 114 +#define TK_BINARY 115 +#define TK_TIMESTAMP 116 +#define TK_NCHAR 117 +#define TK_UNSIGNED 118 +#define TK_JSON 119 +#define TK_VARCHAR 120 +#define TK_MEDIUMBLOB 121 +#define TK_BLOB 122 +#define TK_VARBINARY 123 +#define TK_DECIMAL 124 +#define TK_MAX_DELAY 125 +#define TK_WATERMARK 126 +#define TK_ROLLUP 127 +#define TK_TTL 128 +#define TK_SMA 129 +#define TK_FIRST 130 +#define TK_LAST 131 +#define TK_SHOW 132 +#define TK_DATABASES 133 +#define TK_TABLES 134 +#define TK_STABLES 135 +#define TK_MNODES 136 +#define TK_MODULES 137 +#define TK_QNODES 138 +#define TK_FUNCTIONS 139 +#define TK_INDEXES 140 +#define TK_ACCOUNTS 141 +#define TK_APPS 142 +#define TK_CONNECTIONS 143 +#define TK_LICENCES 144 +#define TK_GRANTS 145 +#define TK_QUERIES 146 +#define TK_SCORES 147 +#define TK_TOPICS 148 +#define TK_VARIABLES 149 +#define TK_BNODES 150 +#define TK_SNODES 151 +#define TK_CLUSTER 152 +#define TK_TRANSACTIONS 153 +#define TK_DISTRIBUTED 154 +#define TK_CONSUMERS 155 +#define TK_SUBSCRIPTIONS 156 +#define TK_VNODES 157 +#define TK_LIKE 158 +#define TK_INDEX 159 +#define TK_FUNCTION 160 +#define TK_INTERVAL 161 +#define TK_TOPIC 162 +#define TK_AS 163 +#define TK_WITH 164 +#define TK_META 165 +#define TK_CONSUMER 166 +#define TK_GROUP 167 +#define TK_DESC 168 +#define TK_DESCRIBE 169 +#define TK_RESET 170 +#define TK_QUERY 171 +#define TK_CACHE 172 +#define TK_EXPLAIN 173 +#define TK_ANALYZE 174 +#define TK_VERBOSE 175 +#define TK_NK_BOOL 176 +#define TK_RATIO 177 +#define TK_NK_FLOAT 178 +#define TK_OUTPUTTYPE 179 +#define TK_AGGREGATE 180 +#define TK_BUFSIZE 181 +#define TK_STREAM 182 +#define TK_INTO 183 +#define TK_TRIGGER 184 +#define TK_AT_ONCE 185 +#define TK_WINDOW_CLOSE 186 +#define TK_IGNORE 187 +#define TK_EXPIRED 188 +#define TK_SUBTABLE 189 +#define TK_KILL 190 +#define TK_CONNECTION 191 +#define TK_TRANSACTION 192 +#define TK_BALANCE 193 +#define TK_VGROUP 194 +#define TK_MERGE 195 +#define TK_REDISTRIBUTE 196 +#define TK_SPLIT 197 +#define TK_DELETE 198 +#define TK_INSERT 199 +#define TK_NULL 200 +#define TK_NK_QUESTION 201 +#define TK_NK_ARROW 202 +#define TK_ROWTS 203 +#define TK_TBNAME 204 +#define TK_QSTART 205 +#define TK_QEND 206 +#define TK_QDURATION 207 +#define TK_WSTART 208 +#define TK_WEND 209 +#define TK_WDURATION 210 +#define TK_CAST 211 +#define TK_NOW 212 +#define TK_TODAY 213 +#define TK_TIMEZONE 214 +#define TK_CLIENT_VERSION 215 +#define TK_SERVER_VERSION 216 +#define TK_SERVER_STATUS 217 +#define TK_CURRENT_USER 218 +#define TK_COUNT 219 +#define TK_LAST_ROW 220 +#define TK_CASE 221 +#define TK_END 222 +#define TK_WHEN 223 +#define TK_THEN 224 +#define TK_ELSE 225 +#define TK_BETWEEN 226 +#define TK_IS 227 +#define TK_NK_LT 228 +#define TK_NK_GT 229 +#define TK_NK_LE 230 +#define TK_NK_GE 231 +#define TK_NK_NE 232 +#define TK_MATCH 233 +#define TK_NMATCH 234 +#define TK_CONTAINS 235 +#define TK_IN 236 +#define TK_JOIN 237 +#define TK_INNER 238 +#define TK_SELECT 239 +#define TK_DISTINCT 240 +#define TK_WHERE 241 +#define TK_PARTITION 242 +#define TK_BY 243 +#define TK_SESSION 244 +#define TK_STATE_WINDOW 245 +#define TK_SLIDING 246 +#define TK_FILL 247 +#define TK_VALUE 248 +#define TK_NONE 249 +#define TK_PREV 250 +#define TK_LINEAR 251 +#define TK_NEXT 252 +#define TK_HAVING 253 +#define TK_RANGE 254 +#define TK_EVERY 255 +#define TK_ORDER 256 +#define TK_SLIMIT 257 +#define TK_SOFFSET 258 +#define TK_LIMIT 259 +#define TK_OFFSET 260 +#define TK_ASC 261 +#define TK_NULLS 262 +#define TK_ABORT 263 +#define TK_AFTER 264 +#define TK_ATTACH 265 +#define TK_BEFORE 266 +#define TK_BEGIN 267 +#define TK_BITAND 268 +#define TK_BITNOT 269 +#define TK_BITOR 270 +#define TK_BLOCKS 271 +#define TK_CHANGE 272 +#define TK_COMMA 273 +#define TK_COMPACT 274 +#define TK_CONCAT 275 +#define TK_CONFLICT 276 +#define TK_COPY 277 +#define TK_DEFERRED 278 +#define TK_DELIMITERS 279 +#define TK_DETACH 280 +#define TK_DIVIDE 281 +#define TK_DOT 282 +#define TK_EACH 283 +#define TK_FAIL 284 +#define TK_FILE 285 +#define TK_FOR 286 +#define TK_GLOB 287 +#define TK_ID 288 +#define TK_IMMEDIATE 289 +#define TK_IMPORT 290 +#define TK_INITIALLY 291 +#define TK_INSTEAD 292 +#define TK_ISNULL 293 +#define TK_KEY 294 +#define TK_NK_BITNOT 295 +#define TK_NK_SEMI 296 +#define TK_NOTNULL 297 +#define TK_OF 298 +#define TK_PLUS 299 +#define TK_PRIVILEGE 300 +#define TK_RAISE 301 +#define TK_REPLACE 302 +#define TK_RESTRICT 303 +#define TK_ROW 304 +#define TK_SEMI 305 +#define TK_STAR 306 +#define TK_STATEMENT 307 +#define TK_STRING 308 +#define TK_TIMES 309 +#define TK_UPDATE 310 +#define TK_VALUES 311 +#define TK_VARIABLE 312 +#define TK_VIEW 313 +#define TK_WAL 314 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/dnode/mnode/mnode.h b/include/dnode/mnode/mnode.h index 3bed77d682f14d3409b02bccd366bd99b3be2a94..0d43539629c170a2dcf22bee395cbc7caa93edc5 100644 --- a/include/dnode/mnode/mnode.h +++ b/include/dnode/mnode/mnode.h @@ -106,6 +106,8 @@ void mndPostProcessQueryMsg(SRpcMsg *pMsg); */ void mndGenerateMachineCode(); +void mndDumpSdb(); + #ifdef __cplusplus } #endif 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/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 22e92b2e8031d4b2d604433f9f32db0bc3754b4f..075251295190c95e80580d122b6a728ce93ced80 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -119,6 +119,7 @@ typedef struct SFlushDatabaseStmt { typedef struct STrimDatabaseStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; + int32_t maxSpeed; } STrimDatabaseStmt; typedef struct STableOptions { @@ -383,6 +384,8 @@ typedef struct SCreateStreamStmt { bool ignoreExists; SStreamOptions* pOptions; SNode* pQuery; + SNodeList* pTags; + SNode* pSubtable; } SCreateStreamStmt; typedef struct SDropStreamStmt { diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 6500d3d1831e817c497406e574b721594e63e209..32249e3d8b357ce1ba35df1b717af7c1e43b9999 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -27,9 +27,9 @@ extern "C" { #define LIST_LENGTH(l) (NULL != (l) ? (l)->length : 0) -#define FOREACH(node, list) \ - for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \ - (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); cell = cell->pNext) +#define FOREACH(node, list) \ + for (SListCell *cell = (NULL != (list) ? (list)->pHead : NULL), *pNext; \ + (NULL != cell ? (node = cell->pNode, pNext = cell->pNext, true) : (node = NULL, pNext = NULL, false)); cell = pNext) #define REPLACE_NODE(newNode) cell->pNode = (SNode*)(newNode) @@ -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..e6e34648f9c62b74bbae9cbecc3ad826acddfe91 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -94,6 +94,8 @@ typedef struct SScanLogicNode { SArray* pSmaIndexes; SNodeList* pGroupTags; bool groupSort; + SNodeList* pTags; // for create stream + SNode* pSubtable; // for create stream int8_t cacheLastMode; bool hasNormalCols; // neither tag column nor primary key tag column bool sortPrimaryKey; @@ -165,7 +167,8 @@ typedef struct SVnodeModifyLogicNode { typedef struct SExchangeLogicNode { SLogicNode node; - int32_t srcGroupId; + int32_t srcStartGroupId; + int32_t srcEndGroupId; } SExchangeLogicNode; typedef struct SMergeLogicNode { @@ -232,6 +235,8 @@ typedef struct SSortLogicNode { typedef struct SPartitionLogicNode { SLogicNode node; SNodeList* pPartitionKeys; + SNodeList* pTags; + SNode* pSubtable; } SPartitionLogicNode; typedef enum ESubplanType { @@ -331,6 +336,8 @@ typedef struct STableScanPhysiNode { SNodeList* pDynamicScanFuncs; SNodeList* pGroupTags; bool groupSort; + SNodeList* pTags; + SNode* pSubtable; int64_t interval; int64_t offset; int64_t sliding; @@ -395,11 +402,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; @@ -490,7 +501,11 @@ typedef struct SPartitionPhysiNode { SNodeList* pTargets; } SPartitionPhysiNode; -typedef SPartitionPhysiNode SStreamPartitionPhysiNode; +typedef struct SStreamPartitionPhysiNode { + SPartitionPhysiNode part; + SNodeList* pTags; + SNode* pSubtable; +} SStreamPartitionPhysiNode; typedef struct SDataSinkNode { ENodeType type; diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index e90c994e8f2770fa95da82c71f5cc9ba16b1425f..5ee097bd9254970536c61caace0fdde3f6a11d9d 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; @@ -248,6 +261,8 @@ typedef struct SSelectStmt { SNode* pFromTable; SNode* pWhere; SNodeList* pPartitionByList; + SNodeList* pTags; // for create stream + SNode* pSubtable; // for create stream SNode* pWindow; SNodeList* pGroupByList; // SGroupingSetNode SNode* pHaving; 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/os/osSocket.h b/include/os/osSocket.h index 4bad51e26322405d9c4187e3bd7a12a75ee011b9..c6729da76af0e59cb3ccda024709b86fe034b039 100644 --- a/include/os/osSocket.h +++ b/include/os/osSocket.h @@ -167,7 +167,7 @@ uint32_t ip2uint(const char *const ip_addr); void taosIgnSIGPIPE(); void taosSetMaskSIGPIPE(); uint32_t taosInetAddr(const char *ipAddr); -const char *taosInetNtoa(struct in_addr ipInt); +const char *taosInetNtoa(struct in_addr ipInt, char *dstStr, int32_t len); #ifdef __cplusplus } diff --git a/include/os/osString.h b/include/os/osString.h index 8eb341faa7bf61e4c2f67f8a21859da94c0dcbf4..8c1885efdfd72c3bdbd7e588e834901c78c41d1f 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -77,7 +77,6 @@ int32_t taosWcharsWidth(TdWchar *pWchar, int32_t size); int32_t taosMbToWchar(TdWchar *pWchar, const char *pStr, int32_t size); int32_t taosMbsToWchars(TdWchar *pWchars, const char *pStrs, int32_t size); int32_t taosWcharToMb(char *pStr, TdWchar wchar); -int32_t taosWcharsToMbs(char *pStrs, TdWchar *pWchars, int32_t size); char *taosStrCaseStr(const char *str, const char *pattern); 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/client/src/clientSml.c b/source/client/src/clientSml.c index f2493f6c57daf5654524f2c0e4f49d14df40b022..195466061d2c19cbd6cedf6fadc08c8f2cc92bdc 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -79,7 +79,7 @@ #define NCHAR_ADD_LEN 3 // L"nchar" 3 means L" " #define MAX_RETRY_TIMES 5 -#define LINE_BATCH 20000 +#define LINE_BATCH 2000 //================================================================================================= typedef TSDB_SML_PROTOCOL_TYPE SMLProtocolType; @@ -151,13 +151,14 @@ typedef struct { typedef struct { SRequestObj *request; tsem_t sem; + int32_t cnt; + int32_t total; TdThreadSpinlock lock; } Params; typedef struct { int64_t id; Params *params; - bool isLast; SMLProtocolType protocol; int8_t precision; @@ -1531,6 +1532,7 @@ static SSmlHandle* smlBuildSmlInfo(STscObj* pTscObj, SRequestObj* request, SMLPr info->pRequest = request; info->msgBuf.buf = info->pRequest->msgBuf; info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; + info->pRequest->stmtType = info->pQuery->pRoot->type; } info->exec = smlInitHandle(info->pQuery); @@ -2331,6 +2333,9 @@ static int32_t smlInsertData(SSmlHandle *info) { // info->affectedRows = taos_affected_rows(info->pRequest); // return info->pRequest->code; + SAppClusterSummary *pActivity = &info->taos->pAppInfo->summary; + atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1); + launchAsyncQuery(info->pRequest, info->pQuery, NULL); return TSDB_CODE_SUCCESS; } @@ -2449,28 +2454,26 @@ static void smlInsertCallback(void *param, void *res, int32_t code) { int32_t rows = taos_affected_rows(pRequest); uDebug("SML:0x%" PRIx64 " result. code:%d, msg:%s", info->id, pRequest->code, pRequest->msgBuf); + Params *pParam = info->params; // lock - taosThreadSpinLock(&info->params->lock); + taosThreadSpinLock(&pParam->lock); + pParam->cnt++; if (code != TSDB_CODE_SUCCESS) { - info->params->request->code = code; - info->params->request->body.resInfo.numOfRows += rows; + pParam->request->code = code; + pParam->request->body.resInfo.numOfRows += rows; }else{ - info->params->request->body.resInfo.numOfRows += info->affectedRows; + pParam->request->body.resInfo.numOfRows += info->affectedRows; } - taosThreadSpinUnlock(&info->params->lock); + if (pParam->cnt == pParam->total) { + tsem_post(&pParam->sem); + } + taosThreadSpinUnlock(&pParam->lock); // unlock - uDebug("SML:0x%" PRIx64 " insert finished, code: %d, rows: %d, total: %d", info->id, code, rows, info->affectedRows); - Params *pParam = info->params; - bool isLast = info->isLast; info->cost.endTime = taosGetTimestampUs(); info->cost.code = code; smlPrintStatisticInfo(info); smlDestroyInfo(info); - - if (isLast) { - tsem_post(&pParam->sem); - } } /** @@ -2512,7 +2515,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr pTscObj->schemalessType = 1; SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; - Params params; + Params params = {0}; params.request = request; tsem_init(¶ms.sem, 0, 0); taosThreadSpinInit(&(params.lock), 0); @@ -2557,6 +2560,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr } batchs = ceil(((double)numLines) / LINE_BATCH); + params.total = batchs; for (int i = 0; i < batchs; ++i) { SRequestObj* req = (SRequestObj*)createRequest(pTscObj->id, TSDB_SQL_INSERT); if(!req){ @@ -2575,11 +2579,9 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr if (numLines > perBatch) { numLines -= perBatch; - info->isLast = false; } else { perBatch = numLines; numLines = 0; - info->isLast = true; } info->params = ¶ms; 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/tdataformat.c b/source/common/src/tdataformat.c index 15a369fe404da6e279afe14bdaf3e68ac6a07f8a..c0ae99806e2f97fc3e4e4340ddc6a4716452dff1 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -212,9 +212,9 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S if (pColVal->cid == pTColumn->colId) { iColVal++; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { flags |= TSROW_HAS_NONE; - } else if (pColVal->isNull) { + } else if (COL_VAL_IS_NULL(pColVal)) { flags |= TSROW_HAS_NULL; maxIdx = nkv; nTag++; @@ -398,9 +398,9 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S if (pColVal->cid == pTColumn->colId) { iColVal++; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { goto _set_none; - } else if (pColVal->isNull) { + } else if (COL_VAL_IS_NULL(pColVal)) { goto _set_null; } else { goto _set_value; @@ -1222,9 +1222,9 @@ _exit: static FORCE_INLINE int32_t tColDataAppendValue0(SColData *pColData, SColVal *pColVal) { // 0 int32_t code = 0; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { pColData->flag = HAS_NONE; - } else if (pColVal->isNull) { + } else if (COL_VAL_IS_NULL(pColVal)) { pColData->flag = HAS_NULL; } else { pColData->flag = HAS_VALUE; @@ -1239,7 +1239,7 @@ _exit: static FORCE_INLINE int32_t tColDataAppendValue1(SColData *pColData, SColVal *pColVal) { // HAS_NONE int32_t code = 0; - if (!pColVal->isNone) { + if (!COL_VAL_IS_NONE(pColVal)) { int32_t nBit = BIT1_SIZE(pColData->nVal + 1); code = tRealloc(&pColData->pBitMap, nBit); @@ -1248,7 +1248,7 @@ static FORCE_INLINE int32_t tColDataAppendValue1(SColData *pColData, SColVal *pC memset(pColData->pBitMap, 0, nBit); SET_BIT1(pColData->pBitMap, pColData->nVal, 1); - if (pColVal->isNull) { + if (COL_VAL_IS_NULL(pColVal)) { pColData->flag |= HAS_NULL; } else { pColData->flag |= HAS_VALUE; @@ -1279,12 +1279,12 @@ _exit: static FORCE_INLINE int32_t tColDataAppendValue2(SColData *pColData, SColVal *pColVal) { // HAS_NULL int32_t code = 0; - if (!pColVal->isNull) { + if (!COL_VAL_IS_NULL(pColVal)) { int32_t nBit = BIT1_SIZE(pColData->nVal + 1); code = tRealloc(&pColData->pBitMap, nBit); if (code) goto _exit; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { pColData->flag |= HAS_NONE; memset(pColData->pBitMap, 255, nBit); @@ -1321,12 +1321,12 @@ _exit: static FORCE_INLINE int32_t tColDataAppendValue3(SColData *pColData, SColVal *pColVal) { // HAS_NULL|HAS_NONE int32_t code = 0; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); if (code) goto _exit; SET_BIT1(pColData->pBitMap, pColData->nVal, 0); - } else if (pColVal->isNull) { + } else if (COL_VAL_IS_NULL(pColVal)) { code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); if (code) goto _exit; @@ -1371,8 +1371,8 @@ _exit: static FORCE_INLINE int32_t tColDataAppendValue4(SColData *pColData, SColVal *pColVal) { // HAS_VALUE int32_t code = 0; - if (pColVal->isNone || pColVal->isNull) { - if (pColVal->isNone) { + if (!COL_VAL_IS_VALUE(pColVal)) { + if (COL_VAL_IS_NONE(pColVal)) { pColData->flag |= HAS_NONE; } else { pColData->flag |= HAS_NULL; @@ -1399,7 +1399,7 @@ _exit: static FORCE_INLINE int32_t tColDataAppendValue5(SColData *pColData, SColVal *pColVal) { // HAS_VALUE|HAS_NONE int32_t code = 0; - if (pColVal->isNull) { + if (COL_VAL_IS_NULL(pColVal)) { pColData->flag |= HAS_NULL; uint8_t *pBitMap = NULL; @@ -1417,7 +1417,7 @@ static FORCE_INLINE int32_t tColDataAppendValue5(SColData *pColData, SColVal *pC code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); if (code) goto _exit; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { SET_BIT1(pColData->pBitMap, pColData->nVal, 0); } else { SET_BIT1(pColData->pBitMap, pColData->nVal, 1); @@ -1434,7 +1434,7 @@ _exit: static FORCE_INLINE int32_t tColDataAppendValue6(SColData *pColData, SColVal *pColVal) { // HAS_VALUE|HAS_NULL int32_t code = 0; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { pColData->flag |= HAS_NONE; uint8_t *pBitMap = NULL; @@ -1452,7 +1452,7 @@ static FORCE_INLINE int32_t tColDataAppendValue6(SColData *pColData, SColVal *pC code = tRealloc(&pColData->pBitMap, BIT1_SIZE(pColData->nVal + 1)); if (code) goto _exit; - if (pColVal->isNull) { + if (COL_VAL_IS_NULL(pColVal)) { SET_BIT1(pColData->pBitMap, pColData->nVal, 0); } else { SET_BIT1(pColData->pBitMap, pColData->nVal, 1); @@ -1473,9 +1473,9 @@ static FORCE_INLINE int32_t tColDataAppendValue7(SColData *pColData, code = tRealloc(&pColData->pBitMap, BIT2_SIZE(pColData->nVal + 1)); if (code) goto _exit; - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { SET_BIT2(pColData->pBitMap, pColData->nVal, 0); - } else if (pColVal->isNull) { + } else if (COL_VAL_IS_NULL(pColVal)) { SET_BIT2(pColData->pBitMap, pColData->nVal, 1); } else { SET_BIT2(pColData->pBitMap, pColData->nVal, 2); diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index a6e30ae0b5b77479d8b3e6cf6c130f5c8817da04..e1d7569e29ec5a3adfcfad760081b0827d9c7d0e 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; } @@ -678,7 +685,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsQueryBufferSize = cfgGetItem(pCfg, "queryBufferSize")->i32; tsPrintAuth = cfgGetItem(pCfg, "printAuth")->bval; +#if !defined(WINDOWS) && !defined(DARWIN) tsMultiProcess = cfgGetItem(pCfg, "multiProcess")->bval; +#endif tsMnodeShmSize = cfgGetItem(pCfg, "mnodeShmSize")->i32; tsVnodeShmSize = cfgGetItem(pCfg, "vnodeShmSize")->i32; tsQnodeShmSize = cfgGetItem(pCfg, "qnodeShmSize")->i32; @@ -717,6 +726,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)); @@ -911,7 +921,9 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { } case 'u': { if (strcasecmp("multiProcess", name) == 0) { + #if !defined(WINDOWS) && !defined(DARWIN) tsMultiProcess = cfgGetItem(pCfg, "multiProcess")->bval; + #endif } else if (strcasecmp("udfDebugFlag", name) == 0) { udfDebugFlag = cfgGetItem(pCfg, "udfDebugFlag")->i32; } @@ -979,6 +991,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..f4ffc4c996d540a0623319cad50cf25483414ea4 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2682,6 +2682,7 @@ int32_t tSerializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) { if (tStartEncode(&encoder) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; + if (tEncodeI32(&encoder, pReq->maxSpeed) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -2695,6 +2696,7 @@ int32_t tDeserializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) { if (tStartDecode(&decoder) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->maxSpeed) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); @@ -3347,12 +3349,12 @@ int32_t tDeserializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) { return 0; } -void tFreeSTableMetaRsp(void *pRsp) { +void tFreeSTableMetaRsp(void *pRsp) { if (NULL == pRsp) { return; } - - taosMemoryFreeClear(((STableMetaRsp *)pRsp)->pSchemas); + + taosMemoryFreeClear(((STableMetaRsp *)pRsp)->pSchemas); } void tFreeSTableIndexRsp(void *info) { @@ -4365,7 +4367,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,8 +4375,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) - return -1; + if (tDecodeBinaryAlloc(&decoder, &pRsp->subplanInfo[i].verboseInfo, NULL) < 0) return -1; } tEndDecode(&decoder); @@ -4383,6 +4384,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) { @@ -4813,6 +4827,14 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI8(&encoder, pReq->igExpired) < 0) return -1; if (sqlLen > 0 && tEncodeCStr(&encoder, pReq->sql) < 0) return -1; if (astLen > 0 && tEncodeCStr(&encoder, pReq->ast) < 0) return -1; + if (tEncodeI32(&encoder, pReq->numOfTags) < 0) return -1; + for (int32_t i = 0; i < pReq->numOfTags; ++i) { + SField *pField = taosArrayGet(pReq->pTags, i); + if (tEncodeI8(&encoder, pField->type) < 0) return -1; + if (tEncodeI8(&encoder, pField->flags) < 0) return -1; + if (tEncodeI32(&encoder, pField->bytes) < 0) return -1; + if (tEncodeCStr(&encoder, pField->name) < 0) return -1; + } tEndEncode(&encoder); @@ -4851,6 +4873,28 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea if (pReq->ast == NULL) return -1; if (tDecodeCStrTo(&decoder, pReq->ast) < 0) return -1; } + + if (tDecodeI32(&decoder, &pReq->numOfTags) < 0) return -1; + if (pReq->numOfTags > 0) { + pReq->pTags = taosArrayInit(pReq->numOfTags, sizeof(SField)); + if (pReq->pTags == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + for (int32_t i = 0; i < pReq->numOfTags; ++i) { + SField field = {0}; + if (tDecodeI8(&decoder, &field.type) < 0) return -1; + if (tDecodeI8(&decoder, &field.flags) < 0) return -1; + if (tDecodeI32(&decoder, &field.bytes) < 0) return -1; + if (tDecodeCStrTo(&decoder, field.name) < 0) return -1; + if (taosArrayPush(pReq->pTags, &field) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + } + tEndDecode(&decoder); tDecoderClear(&decoder); diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 9880fe362eb55e909842cb0e9aec007667426c71..f23a2b386e280a185c1af7f4976070ed04d4f3f3 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -620,7 +620,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { ASSERT(pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID); } else { if (IS_VAR_DATA_TYPE(pTColumn->type)) { - if (pColVal && !pColVal->isNone && !pColVal->isNull) { + if (pColVal && COL_VAL_IS_VALUE(pColVal)) { varDataLen += (pColVal->value.nData + sizeof(VarDataLenT)); if (maxVarDataLen < (pColVal->value.nData + sizeof(VarDataLenT))) { maxVarDataLen = pColVal->value.nData + sizeof(VarDataLenT); @@ -680,9 +680,9 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { const void *val = NULL; if (iColVal < nColVal) { pColVal = (SColVal *)taosArrayGet(pArray, iColVal); - if (pColVal->isNone) { + if (COL_VAL_IS_NONE(pColVal)) { valType = TD_VTYPE_NONE; - } else if (pColVal->isNull) { + } else if (COL_VAL_IS_NULL(pColVal)) { valType = TD_VTYPE_NULL; } else if (IS_VAR_DATA_TYPE(pTColumn->type)) { varDataSetLen(varBuf, pColVal->value.nData); diff --git a/source/common/test/dataformatTest.cpp b/source/common/test/dataformatTest.cpp index 65f21bee402409eab971036db59e61cca8aa746c..6d77180610af6f2d8d13b6d977c4493af026564e 100644 --- a/source/common/test/dataformatTest.cpp +++ b/source/common/test/dataformatTest.cpp @@ -133,11 +133,11 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) { SColVal colVal = {0}; colVal.cid = PRIMARYKEY_TIMESTAMP_COL_ID + i; if (strncasecmp(data[i], NONE_CSTR, NONE_LEN) == 0) { - colVal.isNone = 1; + colVal.flag = CV_FLAG_NONE; taosArrayPush(*pArray, &colVal); continue; } else if (strncasecmp(data[i], NULL_CSTR, NULL_LEN) == 0) { - colVal.isNull = 1; + colVal.flag = CV_FLAG_NULL; taosArrayPush(*pArray, &colVal); continue; } @@ -204,11 +204,11 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) { } int32_t debugPrintSColVal(SColVal *cv, int8_t type) { - if (cv->isNone) { + if (COL_VAL_IS_NONE(cv)) { printf("None "); return 0; } - if (cv->isNull) { + if (COL_VAL_IS_NULL(cv)) { printf("Null "); return 0; } @@ -298,11 +298,11 @@ void debugPrintTSRow(STSRow2 *row, STSchema *pTSchema, const char *tags, int32_t static int32_t checkSColVal(const char *rawVal, SColVal *cv, int8_t type) { ASSERT(rawVal); - if (cv->isNone) { + if (COL_VAL_IS_NONE(cv)) { EXPECT_STRCASEEQ(rawVal, NONE_CSTR); return 0; } - if (cv->isNull) { + if (COL_VAL_IS_NULL(cv)) { EXPECT_STRCASEEQ(rawVal, NULL_CSTR); return 0; } diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 4030eaa6fe2fd32ec5718b6e4f7689f619747366..6406ae560f3619ca5b7019e309430e40246d4d54 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -16,10 +16,12 @@ #define _DEFAULT_SOURCE #include "dmMgmt.h" #include "tconfig.h" +#include "mnode.h" #define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'." #define DM_CFG_DIR "Configuration directory." #define DM_DMP_CFG "Dump configuration." +#define DM_SDB_INFO "Dump sdb info." #define DM_ENV_CMD "The env cmd variable string to use when configuring the server, such as: -e 'TAOS_FQDN=td1'." #define DM_ENV_FILE "The env variable file path to use when configuring the server, default is './.env', .env text can be 'TAOS_FQDN=td1'." #define DM_NODE_TYPE "Startup type of the node, default is 0." @@ -31,6 +33,7 @@ static struct { bool winServiceMode; #endif bool dumpConfig; + bool dumpSdb; bool generateGrant; bool printAuth; bool printVersion; @@ -82,6 +85,8 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { } } else if (strcmp(argv[i], "-a") == 0) { tstrncpy(global.apolloUrl, argv[++i], PATH_MAX); + } else if (strcmp(argv[i], "-s") == 0) { + global.dumpSdb = true; } else if (strcmp(argv[i], "-E") == 0) { tstrncpy(global.envFile, argv[++i], PATH_MAX); } else if (strcmp(argv[i], "-n") == 0) { @@ -131,6 +136,7 @@ static void dmPrintHelp() { printf("Usage: taosd [OPTION...] \n\n"); printf("%s%s%s%s\n", indent, "-a,", indent, DM_APOLLO_URL); printf("%s%s%s%s\n", indent, "-c,", indent, DM_CFG_DIR); + printf("%s%s%s%s\n", indent, "-s,", indent, DM_SDB_INFO); printf("%s%s%s%s\n", indent, "-C,", indent, DM_DMP_CFG); printf("%s%s%s%s\n", indent, "-e,", indent, DM_ENV_CMD); printf("%s%s%s%s\n", indent, "-E,", indent, DM_ENV_FILE); @@ -229,6 +235,14 @@ int mainWindows(int argc,char** argv) { return 0; } + if (global.dumpSdb) { + mndDumpSdb(); + taosCleanupCfg(); + taosCloseLog(); + taosCleanupArgs(); + return 0; + } + dmSetProcInfo(argc, (char **)argv); taosCleanupArgs(); 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/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 0a42f06081fbc75a114badedf0886786f934985d..d7df30bc7587cada18a308176e2fc739c1679afa 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -244,7 +244,7 @@ int32_t vmPutMsgToMonitorQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM); if (pMsg == NULL) { - rpcFreeCont(pMsg->pCont); + rpcFreeCont(pRpc->pCont); pRpc->pCont = NULL; return -1; } 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/mndStb.h b/source/dnode/mnode/impl/inc/mndStb.h index 8f0d55e10061ce4517c4305ae7450a7439b91cfd..ba9acdbd8fb7bc7762e26f6580f7eecee49a961c 100644 --- a/source/dnode/mnode/impl/inc/mndStb.h +++ b/source/dnode/mnode/impl/inc/mndStb.h @@ -40,6 +40,8 @@ int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char* dbFName, char* stbFName, vo void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst); void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize); +const char *mndGetStbStr(const char *src); + #ifdef __cplusplus } #endif 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..12bf23bb219d3987a1b77ec3c34e9aaa8982de82 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -54,13 +54,15 @@ static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg); static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg); int32_t mndInitConsumer(SMnode *pMnode) { - SSdbTable table = {.sdbType = SDB_CONSUMER, - .keyType = SDB_KEY_INT64, - .encodeFp = (SdbEncodeFp)mndConsumerActionEncode, - .decodeFp = (SdbDecodeFp)mndConsumerActionDecode, - .insertFp = (SdbInsertFp)mndConsumerActionInsert, - .updateFp = (SdbUpdateFp)mndConsumerActionUpdate, - .deleteFp = (SdbDeleteFp)mndConsumerActionDelete}; + SSdbTable table = { + .sdbType = SDB_CONSUMER, + .keyType = SDB_KEY_INT64, + .encodeFp = (SdbEncodeFp)mndConsumerActionEncode, + .decodeFp = (SdbDecodeFp)mndConsumerActionDecode, + .insertFp = (SdbInsertFp)mndConsumerActionInsert, + .updateFp = (SdbUpdateFp)mndConsumerActionUpdate, + .deleteFp = (SdbDeleteFp)mndConsumerActionDelete, + }; mndSetMsgHandle(pMnode, TDMT_MND_SUBSCRIBE, mndProcessSubscribeReq); mndSetMsgHandle(pMnode, TDMT_MND_MQ_HB, mndProcessMqHbReq); @@ -109,7 +111,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 +144,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 +467,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/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c new file mode 100644 index 0000000000000000000000000000000000000000..881ebbbf9de161018a3d0965bd61f2ab92666094 --- /dev/null +++ b/source/dnode/mnode/impl/src/mndDump.c @@ -0,0 +1,645 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#define _DEFAULT_SOURCE +#include "mndDb.h" +#include "mndInt.h" +#include "mndStb.h" +#include "sdb.h" +#include "tconfig.h" +#include "tjson.h" +#include "ttypes.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +void reportStartup(const char *name, const char *desc) {} +void sendRsp(SRpcMsg *pMsg) { rpcFreeCont(pMsg->pCont); } + +int32_t sendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) { + terrno = TSDB_CODE_INVALID_PTR; + return -1; +} + +char *i642str(int64_t val) { + static char str[24] = {0}; + snprintf(str, sizeof(str), "%" PRId64, val); + return str; +} + +void dumpFunc(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "funcs"); + + while (1) { + SFuncObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_FUNC, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "name", pObj->name); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "funcType", i642str(pObj->funcType)); + tjsonAddStringToObject(item, "scriptType", i642str(pObj->scriptType)); + tjsonAddStringToObject(item, "align", i642str(pObj->align)); + tjsonAddStringToObject(item, "outputType", i642str(pObj->outputType)); + tjsonAddStringToObject(item, "outputLen", i642str(pObj->outputLen)); + tjsonAddStringToObject(item, "bufSize", i642str(pObj->bufSize)); + tjsonAddStringToObject(item, "signature", i642str(pObj->signature)); + tjsonAddStringToObject(item, "commentSize", i642str(pObj->commentSize)); + tjsonAddStringToObject(item, "codeSize", i642str(pObj->codeSize)); + sdbRelease(pSdb, pObj); + } +} + +void dumpDb(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonCreateObject(); + tjsonAddItemToObject(json, "dbs", items); + + while (1) { + SDbObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_DB, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToObject(items, "db", item); + + tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name)); + tjsonAddStringToObject(item, "acct", pObj->acct); + tjsonAddStringToObject(item, "createUser", pObj->createUser); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "uid", i642str(pObj->uid)); + tjsonAddStringToObject(item, "cfgVersion", i642str(pObj->cfgVersion)); + tjsonAddStringToObject(item, "vgVersion", i642str(pObj->vgVersion)); + tjsonAddStringToObject(item, "numOfVgroups", i642str(pObj->cfg.numOfVgroups)); + tjsonAddStringToObject(item, "numOfStables", i642str(pObj->cfg.numOfStables)); + tjsonAddStringToObject(item, "buffer", i642str(pObj->cfg.buffer)); + tjsonAddStringToObject(item, "pageSize", i642str(pObj->cfg.pageSize)); + tjsonAddStringToObject(item, "pages", i642str(pObj->cfg.pages)); + tjsonAddStringToObject(item, "cacheLastSize", i642str(pObj->cfg.cacheLastSize)); + tjsonAddStringToObject(item, "daysPerFile", i642str(pObj->cfg.daysPerFile)); + tjsonAddStringToObject(item, "daysToKeep0", i642str(pObj->cfg.daysToKeep0)); + tjsonAddStringToObject(item, "daysToKeep1", i642str(pObj->cfg.daysToKeep1)); + tjsonAddStringToObject(item, "daysToKeep2", i642str(pObj->cfg.daysToKeep2)); + tjsonAddStringToObject(item, "minRows", i642str(pObj->cfg.minRows)); + tjsonAddStringToObject(item, "maxRows", i642str(pObj->cfg.maxRows)); + tjsonAddStringToObject(item, "precision", i642str(pObj->cfg.precision)); + tjsonAddStringToObject(item, "compression", i642str(pObj->cfg.compression)); + tjsonAddStringToObject(item, "replications", i642str(pObj->cfg.replications)); + tjsonAddStringToObject(item, "strict", i642str(pObj->cfg.strict)); + tjsonAddStringToObject(item, "cacheLast",i642str( pObj->cfg.cacheLast)); + tjsonAddStringToObject(item, "hashMethod", i642str(pObj->cfg.hashMethod)); + tjsonAddStringToObject(item, "hashPrefix", i642str(pObj->cfg.hashPrefix)); + tjsonAddStringToObject(item, "hashSuffix", i642str(pObj->cfg.hashSuffix)); + tjsonAddStringToObject(item, "sstTrigger", i642str(pObj->cfg.sstTrigger)); + tjsonAddStringToObject(item, "tsdbPageSize",i642str( pObj->cfg.tsdbPageSize)); + tjsonAddStringToObject(item, "schemaless", i642str(pObj->cfg.schemaless)); + tjsonAddStringToObject(item, "walLevel",i642str( pObj->cfg.walLevel)); + tjsonAddStringToObject(item, "walFsyncPeriod", i642str(pObj->cfg.walFsyncPeriod)); + tjsonAddStringToObject(item, "walRetentionPeriod", i642str(pObj->cfg.walRetentionPeriod)); + tjsonAddStringToObject(item, "walRetentionSize",i642str( pObj->cfg.walRetentionSize)); + tjsonAddStringToObject(item, "walRollPeriod", i642str(pObj->cfg.walRollPeriod)); + tjsonAddStringToObject(item, "walSegmentSize", i642str(pObj->cfg.walSegmentSize)); + + tjsonAddStringToObject(item, "numOfRetensions",i642str( pObj->cfg.numOfRetensions)); + for (int32_t i = 0; i < pObj->cfg.numOfRetensions; ++i) { + SJson *rentensions = tjsonAddArrayToObject(item, "rentensions"); + SJson *rentension = tjsonCreateObject(); + tjsonAddItemToArray(rentensions, rentension); + + SRetention *pRetension = taosArrayGet(pObj->cfg.pRetensions, i); + tjsonAddStringToObject(item, "freq", i642str(pRetension->freq)); + tjsonAddStringToObject(item, "freqUnit", i642str(pRetension->freqUnit)); + tjsonAddStringToObject(item, "keep", i642str(pRetension->keep)); + tjsonAddStringToObject(item, "keepUnit",i642str( pRetension->keepUnit)); + } + + sdbRelease(pSdb, pObj); + } +} + +void dumpStb(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "stbs"); + + while (1) { + SStbObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "name", mndGetStbStr(pObj->name)); + tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->db)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "uid", i642str(pObj->uid)); + tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)); + tjsonAddStringToObject(item, "tagVer",i642str( pObj->tagVer)); + tjsonAddStringToObject(item, "colVer", i642str(pObj->colVer)); + tjsonAddStringToObject(item, "smaVer", i642str(pObj->smaVer)); + tjsonAddStringToObject(item, "nextColId", i642str(pObj->nextColId)); + tjsonAddStringToObject(item, "watermark1", i642str(pObj->watermark[0])); + tjsonAddStringToObject(item, "watermark2", i642str(pObj->watermark[1])); + tjsonAddStringToObject(item, "maxdelay0",i642str( pObj->maxdelay[0])); + tjsonAddStringToObject(item, "maxdelay1",i642str( pObj->maxdelay[1])); + tjsonAddStringToObject(item, "ttl",i642str( pObj->ttl)); + tjsonAddStringToObject(item, "numOfFuncs",i642str( pObj->numOfFuncs)); + tjsonAddStringToObject(item, "commentLen", i642str(pObj->commentLen)); + tjsonAddStringToObject(item, "ast1Len", i642str(pObj->ast1Len)); + tjsonAddStringToObject(item, "ast2Len",i642str( pObj->ast2Len)); + + tjsonAddStringToObject(item, "numOfColumns",i642str( pObj->numOfColumns)); + SJson *columns = tjsonAddArrayToObject(item, "columns"); + for (int32_t i = 0; i < pObj->numOfColumns; ++i) { + SJson *column = tjsonCreateObject(); + tjsonAddItemToArray(columns, column); + + SSchema *pColumn = &pObj->pColumns[i]; + tjsonAddStringToObject(column, "type", i642str(pColumn->type)); + tjsonAddStringToObject(column, "typestr", tDataTypes[pColumn->type].name); + tjsonAddStringToObject(column, "flags", i642str(pColumn->flags)); + tjsonAddStringToObject(column, "colId", i642str(pColumn->colId)); + tjsonAddStringToObject(column, "bytes", i642str(pColumn->bytes)); + tjsonAddStringToObject(column, "name", pColumn->name); + } + + tjsonAddStringToObject(item, "numOfTags", i642str(pObj->numOfTags)); + SJson *tags = tjsonAddArrayToObject(item, "tags"); + for (int32_t i = 0; i < pObj->numOfTags; ++i) { + SJson *tag = tjsonCreateObject(); + tjsonAddItemToArray(tags, tag); + + SSchema *pTag = &pObj->pTags[i]; + tjsonAddStringToObject(tag, "type", i642str(pTag->type)); + tjsonAddStringToObject(tag, "typestr", tDataTypes[pTag->type].name); + tjsonAddStringToObject(tag, "flags",i642str( pTag->flags)); + tjsonAddStringToObject(tag, "colId", i642str(pTag->colId)); + tjsonAddStringToObject(tag, "bytes", i642str(pTag->bytes)); + tjsonAddStringToObject(tag, "name", pTag->name); + } + + sdbRelease(pSdb, pObj); + } +} + +void dumpSma(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "smas"); + + while (1) { + SSmaObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "name", mndGetStbStr(pObj->name)); + tjsonAddStringToObject(item, "stb", mndGetStbStr(pObj->stb)); + tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->db)); + tjsonAddStringToObject(item, "dstTbName", mndGetStbStr(pObj->dstTbName)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "uid", i642str(pObj->uid)); + tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid)); + tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)); + tjsonAddStringToObject(item, "dstTbUid", i642str(pObj->dstTbUid)); + tjsonAddStringToObject(item, "intervalUnit", i642str(pObj->intervalUnit)); + tjsonAddStringToObject(item, "slidingUnit",i642str( pObj->slidingUnit)); + tjsonAddStringToObject(item, "timezone", i642str(pObj->timezone)); + tjsonAddStringToObject(item, "dstVgId",i642str( pObj->dstVgId)); + tjsonAddStringToObject(item, "interval", i642str(pObj->interval)); + tjsonAddStringToObject(item, "offset", i642str(pObj->offset)); + tjsonAddStringToObject(item, "sliding", i642str(pObj->sliding)); + tjsonAddStringToObject(item, "exprLen",i642str( pObj->exprLen)); + tjsonAddStringToObject(item, "tagsFilterLen", i642str(pObj->tagsFilterLen)); + tjsonAddStringToObject(item, "sqlLen",i642str( pObj->sqlLen)); + tjsonAddStringToObject(item, "astLen",i642str( pObj->astLen)); + sdbRelease(pSdb, pObj); + } +} + +void dumpVgroup(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "vgroups"); + + while (1) { + SVgObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "vgId", i642str(pObj->vgId)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "version",i642str(pObj->version)); + tjsonAddStringToObject(item, "hashBegin", i642str(pObj->hashBegin)); + tjsonAddStringToObject(item, "hashEnd", i642str(pObj->hashEnd)); + tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->dbName)); + tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)); + tjsonAddStringToObject(item, "isTsma", i642str(pObj->isTsma)); + tjsonAddStringToObject(item, "replica",i642str( pObj->replica)); + for (int32_t i = 0; i < pObj->replica; ++i) { + SJson *replicas = tjsonAddArrayToObject(item, "replicas"); + SJson *replica = tjsonCreateObject(); + tjsonAddItemToArray(replicas, replica); + tjsonAddStringToObject(replica, "dnodeId", i642str(pObj->vnodeGid[i].dnodeId)); + } + sdbRelease(pSdb, pObj); + } +} + +void dumpTopic(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "topics"); + + while (1) { + SMqTopicObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_TOPIC, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name)); + tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->db)); + tjsonAddStringToObject(item, "createTime", i642str(pObj->createTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "uid", i642str(pObj->uid)); + tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)); + tjsonAddStringToObject(item, "version",i642str( pObj->version)); + tjsonAddStringToObject(item, "subType",i642str( pObj->subType)); + tjsonAddStringToObject(item, "withMeta", i642str(pObj->withMeta)); + tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid)); + tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen)); + tjsonAddStringToObject(item, "astLen",i642str( pObj->astLen)); + tjsonAddStringToObject(item, "sqlLen",i642str( pObj->sqlLen)); + tjsonAddStringToObject(item, "ntbUid", i642str(pObj->ntbUid)); + tjsonAddStringToObject(item, "ctbStbUid", i642str(pObj->ctbStbUid)); + sdbRelease(pSdb, pObj); + } +} + +void dumpConsumer(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "consumers"); + + while (1) { + SMqConsumerObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_CONSUMER, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "consumerId", i642str(pObj->consumerId)); + tjsonAddStringToObject(item, "cgroup", pObj->cgroup); + sdbRelease(pSdb, pObj); + } +} + +void dumpSubscribe(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "subscribes"); + + while (1) { + SMqSubscribeObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_SUBSCRIBE, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "key", pObj->key); + tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)); + tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid)); + sdbRelease(pSdb, pObj); + } +} + +void dumpOffset(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "offsets"); + + while (1) { + SMqOffsetObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_OFFSET, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "key", pObj->key); + tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)); + tjsonAddStringToObject(item, "offset", i642str(pObj->offset)); + sdbRelease(pSdb, pObj); + } +} + +void dumpStream(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "streams"); + + while (1) { + SStreamObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "name", mndGetDbStr(pObj->name)); + tjsonAddStringToObject(item, "createTime", i642str(pObj->createTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "version", i642str(pObj->version)); + tjsonAddStringToObject(item, "totalLevel", i642str(pObj->totalLevel)); + tjsonAddStringToObject(item, "smaId", i642str(pObj->smaId)); + tjsonAddStringToObject(item, "uid", i642str(pObj->uid)); + tjsonAddStringToObject(item, "status",i642str( pObj->status)); + tjsonAddStringToObject(item, "igExpired",i642str( pObj->igExpired)); + tjsonAddStringToObject(item, "trigger",i642str( pObj->trigger)); + tjsonAddStringToObject(item, "triggerParam", i642str(pObj->triggerParam)); + tjsonAddStringToObject(item, "watermark", i642str(pObj->watermark)); + tjsonAddStringToObject(item, "sourceDbUid", i642str(pObj->sourceDbUid)); + tjsonAddStringToObject(item, "targetDbUid", i642str(pObj->targetDbUid)); + tjsonAddStringToObject(item, "sourceDb", mndGetDbStr(pObj->sourceDb)); + tjsonAddStringToObject(item, "targetDb", mndGetDbStr(pObj->targetDb)); + tjsonAddStringToObject(item, "targetSTbName", mndGetStbStr(pObj->targetSTbName)); + tjsonAddStringToObject(item, "targetStbUid", i642str(pObj->targetStbUid)); + tjsonAddStringToObject(item, "fixedSinkVgId", i642str(pObj->fixedSinkVgId)); + sdbRelease(pSdb, pObj); + } +} + +void dumpAcct(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "accts"); + + while (1) { + SAcctObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_ACCT, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "acct", pObj->acct); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "acctId", i642str(pObj->acctId)); + sdbRelease(pSdb, pObj); + } +} + +void dumpAuth(SSdb *pSdb, SJson *json) { + // todo +} + +void dumpUser(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "users"); + + while (1) { + SUserObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_USER, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "name", pObj->user); + tjsonAddStringToObject(item, "acct", pObj->acct); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "superUser",i642str( pObj->superUser)); + tjsonAddStringToObject(item, "authVersion", i642str(pObj->authVersion)); + tjsonAddStringToObject(item, "numOfReadDbs",i642str( taosHashGetSize(pObj->readDbs))); + tjsonAddStringToObject(item, "numOfWriteDbs", i642str(taosHashGetSize(pObj->writeDbs))); + sdbRelease(pSdb, pObj); + } +} + +void dumpDnode(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "dnodes"); + + while (1) { + SDnodeObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "id",i642str( pObj->id)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "port",i642str( pObj->port)); + tjsonAddStringToObject(item, "fqdn", pObj->fqdn); + sdbRelease(pSdb, pObj); + } +} + +void dumpBnode(SSdb *pSdb, SJson *json) { + // not implemented yet +} + +void dumpSnode(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "snodes"); + + while (1) { + SSnodeObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_QNODE, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "id",i642str( pObj->id)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + sdbRelease(pSdb, pObj); + } +} + +void dumpQnode(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "qnodes"); + + while (1) { + SQnodeObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_QNODE, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "id", i642str(pObj->id)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + sdbRelease(pSdb, pObj); + } +} + +void dumpMnode(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "mnodes"); + + while (1) { + SMnodeObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_MNODE, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "id", i642str(pObj->id)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + sdbRelease(pSdb, pObj); + } +} + +void dumpCluster(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "clusters"); + + while (1) { + SClusterObj *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "id", i642str(pObj->id)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); + tjsonAddStringToObject(item, "name", pObj->name); + sdbRelease(pSdb, pObj); + } +} + +void dumpTrans(SSdb *pSdb, SJson *json) { + void *pIter = NULL; + SJson *items = tjsonAddArrayToObject(json, "transactions"); + + while (1) { + STrans *pObj = NULL; + pIter = sdbFetch(pSdb, SDB_TRANS, pIter, (void **)&pObj); + if (pIter == NULL) break; + + SJson *item = tjsonCreateObject(); + tjsonAddItemToArray(items, item); + tjsonAddStringToObject(item, "id", i642str(pObj->id)); + tjsonAddStringToObject(item, "stage", i642str(pObj->stage)); + tjsonAddStringToObject(item, "policy", i642str(pObj->policy)); + tjsonAddStringToObject(item, "conflict",i642str( pObj->conflict)); + tjsonAddStringToObject(item, "exec", i642str(pObj->exec)); + tjsonAddStringToObject(item, "oper", i642str(pObj->oper)); + tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); + tjsonAddStringToObject(item, "dbname", pObj->dbname); + tjsonAddStringToObject(item, "stbname", pObj->stbname); + tjsonAddStringToObject(item, "opername", pObj->opername); + tjsonAddStringToObject(item, "commitLogNum",i642str( taosArrayGetSize(pObj->commitActions))); + tjsonAddStringToObject(item, "redoActionNum",i642str(taosArrayGetSize(pObj->redoActions))); + tjsonAddStringToObject(item, "undoActionNum", i642str(taosArrayGetSize(pObj->undoActions))); + sdbRelease(pSdb, pObj); + } +} + +void dumpHeader(SSdb *pSdb, SJson *json) { + tjsonAddStringToObject(json, "sver", i642str(1)); + tjsonAddStringToObject(json, "applyIndex", i642str(pSdb->applyIndex)); + tjsonAddStringToObject(json, "applyTerm", i642str(pSdb->applyTerm)); + tjsonAddStringToObject(json, "applyConfig", i642str(pSdb->applyConfig)); + + SJson *maxIdsJson = tjsonCreateObject(); + tjsonAddItemToObject(json, "maxIds", maxIdsJson); + for (int32_t i = 0; i < SDB_MAX; ++i) { + int64_t maxId = 0; + if (i < SDB_MAX) { + maxId = pSdb->maxId[i]; + } + tjsonAddStringToObject(maxIdsJson, sdbTableName(i), i642str(maxId)); + } + + SJson *tableVersJson = tjsonCreateObject(); + tjsonAddItemToObject(json, "tableVers", tableVersJson); + for (int32_t i = 0; i < SDB_MAX; ++i) { + int64_t tableVer = 0; + if (i < SDB_MAX) { + tableVer = pSdb->tableVer[i]; + } + tjsonAddStringToObject(tableVersJson, sdbTableName(i), i642str(tableVer)); + } +} + +void mndDumpSdb() { + mInfo("start to dump sdb info to sdb.json"); + + char path[PATH_MAX * 2] = {0}; + snprintf(path, sizeof(path), "%s%smnode", tsDataDir, TD_DIRSEP); + + SMsgCb msgCb = {0}; + msgCb.reportStartupFp = reportStartup; + msgCb.sendReqFp = sendReq; + msgCb.sendRspFp = sendRsp; + msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack + tmsgSetDefault(&msgCb); + + walInit(); + syncInit(); + + SMnodeOpt opt = {.msgCb = msgCb}; + SMnode *pMnode = mndOpen(path, &opt); + if (pMnode == NULL) return; + + SSdb *pSdb = pMnode->pSdb; + SJson *json = tjsonCreateObject(); + dumpHeader(pSdb, json); + dumpFunc(pSdb, json); + dumpDb(pSdb, json); + dumpStb(pSdb, json); + dumpSma(pSdb, json); + dumpVgroup(pSdb, json); + dumpTopic(pSdb, json); + dumpConsumer(pSdb, json); + dumpSubscribe(pSdb, json); + dumpOffset(pSdb, json); + dumpStream(pSdb, json); + dumpAcct(pSdb, json); + dumpAuth(pSdb, json); + dumpUser(pSdb, json); + dumpDnode(pSdb, json); + dumpBnode(pSdb, json); + dumpSnode(pSdb, json); + dumpQnode(pSdb, json); + dumpMnode(pSdb, json); + dumpCluster(pSdb, json); + dumpTrans(pSdb, json); + + char *pCont = tjsonToString(json); + int32_t contLen = strlen(pCont); + char file[] = "sdb.json"; + TdFilePtr pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + mError("failed to write %s since %s", file, terrstr()); + return; + } + taosWriteFile(pFile, pCont, contLen); + taosWriteFile(pFile, "\n", 1); + taosFsyncFile(pFile); + taosCloseFile(&pFile); + tjsonDelete(json); + taosMemoryFree(pCont); + + mInfo("dump sdb info success"); +} + +#pragma GCC diagnostic pop diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index e6f4b485242d375fd635f1067acca4a3f2083423..727f7b0cc90f42d6d560fb1f34a5c9a82f70de22 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -38,13 +38,15 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB static void mndCancelGetNextFunc(SMnode *pMnode, void *pIter); int32_t mndInitFunc(SMnode *pMnode) { - SSdbTable table = {.sdbType = SDB_FUNC, - .keyType = SDB_KEY_BINARY, - .encodeFp = (SdbEncodeFp)mndFuncActionEncode, - .decodeFp = (SdbDecodeFp)mndFuncActionDecode, - .insertFp = (SdbInsertFp)mndFuncActionInsert, - .updateFp = (SdbUpdateFp)mndFuncActionUpdate, - .deleteFp = (SdbDeleteFp)mndFuncActionDelete}; + SSdbTable table = { + .sdbType = SDB_FUNC, + .keyType = SDB_KEY_BINARY, + .encodeFp = (SdbEncodeFp)mndFuncActionEncode, + .decodeFp = (SdbDecodeFp)mndFuncActionDecode, + .insertFp = (SdbInsertFp)mndFuncActionInsert, + .updateFp = (SdbUpdateFp)mndFuncActionUpdate, + .deleteFp = (SdbDeleteFp)mndFuncActionDelete, + }; mndSetMsgHandle(pMnode, TDMT_MND_CREATE_FUNC, mndProcessCreateFuncReq); mndSetMsgHandle(pMnode, TDMT_MND_DROP_FUNC, mndProcessDropFuncReq); @@ -219,10 +221,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 +251,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 +288,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 +296,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 +351,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 +364,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..0c2cd41605eb093353a12833302684329e4377d0 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; @@ -2579,3 +2579,14 @@ static void mndCancelGetNextStb(SMnode *pMnode, void *pIter) { SSdb *pSdb = pMnode->pSdb; sdbCancelFetch(pSdb, pIter); } + +const char *mndGetStbStr(const char *src) { + char *posDb = strstr(src, TS_PATH_DELIMITER); + if (posDb != NULL) ++posDb; + if (posDb == NULL) return src; + + char *posStb = strstr(posDb, TS_PATH_DELIMITER); + if (posStb != NULL) ++posStb; + if (posStb == NULL) return posDb; + return posStb; +} \ No newline at end of file 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..81b73a171799da96efaa4a76d126857b400e811f 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,12 +1594,17 @@ 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++); colDataAppend(pColInfo, numOfRows, (const char *)dbname, false); - char stbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + char stbname[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(stbname, mndGetDbStr(pTrans->stbname), pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, (const char *)stbname, false); 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..7ff46709975641784cace6d185f1750ef75237d6 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -40,6 +40,8 @@ const char *sdbTableName(ESdbType type) { return "auth"; case SDB_ACCT: return "acct"; + case SDB_STREAM_CK: + return "stream_ck"; case SDB_STREAM: return "stream"; case SDB_OFFSET: @@ -83,7 +85,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/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 817089f23796ba218988205e939adae8cdc97d37..c2f0d582798b3d8653bd57fe3cc97f2db24745de 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -88,9 +88,8 @@ typedef struct SLDataIter SLDataIter; static FORCE_INLINE int64_t tsdbLogicToFileSize(int64_t lSize, int32_t szPage) { int64_t fOffSet = LOGIC_TO_FILE_OFFSET(lSize, szPage); int64_t pgno = OFFSET_PGNO(fOffSet, szPage); - int32_t szPageCont = PAGE_CONTENT_SIZE(szPage); - if (fOffSet % szPageCont == 0) { + if (fOffSet % szPage == 0) { pgno--; } @@ -285,8 +284,8 @@ int32_t tsdbDelFReaderClose(SDelFReader **ppReader); int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData); int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx); // tsdbRead.c ============================================================================================== -int32_t tsdbTakeReadSnap(STsdb *pTsdb, STsdbReadSnap **ppSnap, const char* id); -void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap, const char* id); +int32_t tsdbTakeReadSnap(STsdb *pTsdb, STsdbReadSnap **ppSnap, const char *id); +void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap, const char *id); // tsdbMerge.c ============================================================================================== int32_t tsdbMerge(STsdb *pTsdb); 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/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/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 8452d14c869f1a41c81b904b90e13a49169f8f1e..32272b541cca6d6cf4057bd8f51e6facb0a86083 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -272,8 +272,8 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row, STsdb SColVal colVal = {0}; tTSRowGetVal(row, pTSchema, iCol, &colVal); - if (colVal.isNone || colVal.isNull) { - if (keyTs == tTsVal1->ts && !tColVal->isNone && !tColVal->isNull) { + if (!COL_VAL_IS_VALUE(&colVal)) { + if (keyTs == tTsVal1->ts && COL_VAL_IS_VALUE(tColVal)) { invalidate = true; break; @@ -1062,7 +1062,7 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, STSRow **ppRo goto _err; } - if (pColVal->isNone && !setNoneCol) { + if (COL_VAL_IS_NONE(pColVal) && !setNoneCol) { noneCol = iCol; setNoneCol = true; } @@ -1087,9 +1087,9 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, STSRow **ppRo SColVal *tColVal = (SColVal *)taosArrayGet(pColArray, iCol); tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - if (tColVal->isNone && !pColVal->isNone) { + if (COL_VAL_IS_NONE(tColVal) && !COL_VAL_IS_NONE(pColVal)) { taosArraySet(pColArray, iCol, pColVal); - } else if (tColVal->isNone && pColVal->isNone && !setNoneCol) { + } else if (COL_VAL_IS_NONE(tColVal) && COL_VAL_IS_NONE(pColVal) && !setNoneCol) { noneCol = iCol; setNoneCol = true; } @@ -1161,7 +1161,7 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray) { goto _err; } - if ((pColVal->isNone || pColVal->isNull) && !setNoneCol) { + if (!COL_VAL_IS_VALUE(pColVal) && !setNoneCol) { noneCol = iCol; setNoneCol = true; } @@ -1181,9 +1181,9 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray) { SColVal *tColVal = (SColVal *)taosArrayGet(pColArray, iCol); tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - if ((tColVal->isNone || tColVal->isNull) && (!pColVal->isNone && !pColVal->isNull)) { + if (!COL_VAL_IS_VALUE(tColVal) && COL_VAL_IS_VALUE(pColVal)) { taosArraySet(pColArray, iCol, &(SLastCol){.ts = rowTs, .colVal = *pColVal}); - } else if ((tColVal->isNone || tColVal->isNull) && (pColVal->isNone || pColVal->isNull) && !setNoneCol) { + } else if (!COL_VAL_IS_VALUE(tColVal) && !COL_VAL_IS_VALUE(pColVal) && !setNoneCol) { noneCol = iCol; setNoneCol = true; } diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index ea9a7ec7d9b3df80edbb1e5f93db5b2420f908e5..5f981649f355f0384a0e089feb8da27d60630cc8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -45,7 +45,7 @@ static void saveOneRow(STSRow* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea tTSRowGetVal(pRow, pReader->pSchema, slotId, &colVal); if (IS_VAR_DATA_TYPE(colVal.type)) { - if (colVal.isNull || colVal.isNone) { + if (!COL_VAL_IS_VALUE(&colVal)) { colDataAppendNULL(pColInfoData, numOfRows); } else { varDataSetLen(pReader->transferBuf[slotId], colVal.value.nData); @@ -53,7 +53,7 @@ static void saveOneRow(STSRow* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea colDataAppend(pColInfoData, numOfRows, pReader->transferBuf[slotId], false); } } else { - colDataAppend(pColInfoData, numOfRows, (const char*)&colVal.value, colVal.isNull || colVal.isNone); + colDataAppend(pColInfoData, numOfRows, (const char*)&colVal.value, !COL_VAL_IS_VALUE(&colVal)); } } } @@ -84,7 +84,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList p->transferBuf = taosMemoryCalloc(p->pSchema->numOfCols, POINTER_BYTES); if (p->transferBuf == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return TSDB_CODE_OUT_OF_MEMORY; } for (int32_t i = 0; i < p->pSchema->numOfCols; ++i) { @@ -117,7 +117,8 @@ int32_t tsdbCacherowsReaderClose(void* pReader) { return TSDB_CODE_SUCCESS; } -static int32_t doExtractCacheRow(SCacheRowsReader* pr, SLRUCache* lruCache, uint64_t uid, STSRow** pRow, LRUHandle** h) { +static int32_t doExtractCacheRow(SCacheRowsReader* pr, SLRUCache* lruCache, uint64_t uid, STSRow** pRow, + LRUHandle** h) { int32_t code = TSDB_CODE_SUCCESS; if ((pr->type & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW) { code = tsdbCacheGetLastrowH(lruCache, uid, pr->pVnode->pTsdb, h); @@ -166,7 +167,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 STableKeyInfo* pKeyInfo = taosArrayGet(pr->pTableList, i); code = doExtractCacheRow(pr, lruCache, pKeyInfo->uid, &pRow, &h); - if (code != TSDB_CODE_SUCCESS) { + if (code != TSDB_CODE_SUCCESS) { return code; } @@ -194,7 +195,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 for (int32_t i = pr->tableIndex; i < numOfTables; ++i) { STableKeyInfo* pKeyInfo = taosArrayGet(pr->pTableList, i); code = doExtractCacheRow(pr, lruCache, pKeyInfo->uid, &pRow, &h); - if (code != TSDB_CODE_SUCCESS) { + if (code != TSDB_CODE_SUCCESS) { return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 14dbfbd63e9019ee06fd2b70e412fb4dad277f5b..3d2c89ba0217b2d6d19025714d73cf9aebfb8586 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); } @@ -660,7 +662,7 @@ static void setBlockAllDumped(SFileBlockDumpInfo* pDumpInfo, int64_t maxKey, int static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_t colIndex, SColVal* pColVal, SBlockLoadSuppInfo* pSup) { if (IS_VAR_DATA_TYPE(pColVal->type)) { - if (pColVal->isNull || pColVal->isNone) { + if (!COL_VAL_IS_VALUE(pColVal)) { colDataAppendNULL(pColInfoData, rowIndex); } else { varDataSetLen(pSup->buildBuf[colIndex], pColVal->value.nData); @@ -669,7 +671,7 @@ static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_ colDataAppend(pColInfoData, rowIndex, pSup->buildBuf[colIndex], false); } } else { - colDataAppend(pColInfoData, rowIndex, (const char*)&pColVal->value, pColVal->isNull || pColVal->isNone); + colDataAppend(pColInfoData, rowIndex, (const char*)&pColVal->value, !COL_VAL_IS_VALUE(pColVal)); } } @@ -758,51 +760,43 @@ static int doBinarySearchKey(TSKEY* keyList, int num, int pos, TSKEY key, int or s = pos; // check - assert(pos >=0 && pos < num); + assert(pos >= 0 && pos < num); assert(num > 0); if (order == TSDB_ORDER_ASC) { // find the first position which is smaller than the key - e = num - 1; - if (key < keyList[pos]) - return -1; + e = num - 1; + if (key < keyList[pos]) return -1; while (1) { // check can return - if (key >= keyList[e]) - return e; - if (key <= keyList[s]) - return s; - if (e - s <= 1) - return s; + if (key >= keyList[e]) return e; + if (key <= keyList[s]) return s; + if (e - s <= 1) return s; // change start or end position - int mid = s + (e - s + 1)/2; + int mid = s + (e - s + 1) / 2; if (keyList[mid] > key) e = mid; - else if(keyList[mid] < key) + else if (keyList[mid] < key) s = mid; else return mid; } - } else { // DESC + } else { // DESC // find the first position which is bigger than the key - e = 0; - if (key > keyList[pos]) - return -1; + e = 0; + if (key > keyList[pos]) return -1; while (1) { // check can return - if (key <= keyList[e]) - return e; - if (key >= keyList[s]) - return s; - if (s - e <= 1) - return s; + if (key <= keyList[e]) return e; + if (key >= keyList[s]) return s; + if (s - e <= 1) return s; // change start or end position - int mid = s - (s - e + 1)/2; + int mid = s - (s - e + 1) / 2; if (keyList[mid] < key) e = mid; - else if(keyList[mid] > key) + else if (keyList[mid] > key) s = mid; else return mid; @@ -813,7 +807,7 @@ static int doBinarySearchKey(TSKEY* keyList, int num, int pos, TSKEY key, int or int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData, SDataBlk* pBlock, int32_t pos) { // NOTE: reverse the order to find the end position in data block int32_t endPos = -1; - bool asc = ASCENDING_TRAVERSE(pReader->order); + bool asc = ASCENDING_TRAVERSE(pReader->order); if (asc && pReader->window.ekey >= pBlock->maxKey.ts) { endPos = pBlock->nRow - 1; @@ -849,8 +843,8 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn } else if (!asc && pReader->window.ekey >= pBlock->maxKey.ts) { pDumpInfo->rowIndex = pBlock->nRow - 1; } else { - int32_t pos = asc? pBlock->nRow-1:0; - int32_t order = (pReader->order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC; + int32_t pos = asc ? pBlock->nRow - 1 : 0; + int32_t order = (pReader->order == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC; pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, pReader->window.skey, order); } @@ -863,13 +857,13 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn endIndex += step; int32_t remain = asc ? (endIndex - pDumpInfo->rowIndex) : (pDumpInfo->rowIndex - endIndex); - if (remain > pReader->capacity) { // output buffer check + if (remain > pReader->capacity) { // output buffer check remain = pReader->capacity; } int32_t rowIndex = 0; - int32_t i = 0; + int32_t i = 0; SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i); if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) { if (asc) { @@ -893,7 +887,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) { @@ -938,7 +932,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn int64_t ts = pBlockData->aTSKEY[pDumpInfo->rowIndex]; setBlockAllDumped(pDumpInfo, ts, pReader->order); } else { - int64_t k = asc? pBlock->maxKey.ts:pBlock->minKey.ts; + int64_t k = asc ? pBlock->maxKey.ts : pBlock->minKey.ts; setBlockAllDumped(pDumpInfo, k, pReader->order); } @@ -948,8 +942,8 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn int32_t unDumpedRows = asc ? pBlock->nRow - pDumpInfo->rowIndex : pDumpInfo->rowIndex + 1; tsdbDebug("%p copy file block to sdatablock, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64 ", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s", - pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, remain, unDumpedRows, - pBlock->minVer, pBlock->maxVer, elapsedTime, pReader->idStr); + pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, remain, + unDumpedRows, pBlock->minVer, pBlock->maxVer, elapsedTime, pReader->idStr); return TSDB_CODE_SUCCESS; } @@ -1285,14 +1279,8 @@ 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 (pnext->ts >= pBlock->minKey.ts) { - return true; - } - } else { - if (pnext->ts >= pBlock->minKey.ts && pnext->version >= pBlock->minVer) { - return true; - } + if (pnext->ts >= pBlock->minKey.ts) { + return true; } } else { // it must be the last point ASSERT(p->version == 0); @@ -1537,7 +1525,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 +1538,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 +1676,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 +1741,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 +1757,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 +1774,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 +2009,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 +2047,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 { @@ -2092,11 +2087,12 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { if (pBlockInfo != NULL) { pBlockScanInfo = taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid)); SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter); - TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader); + TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader); // it is a clean block, load it directly if (isCleanFileDataBlock(pReader, pBlockInfo, pBlock, pBlockScanInfo, keyInBuf, pLastBlockReader)) { - if (pReader->order == TSDB_ORDER_ASC || (pReader->order == TSDB_ORDER_DESC && (!hasDataInLastBlock(pLastBlockReader)))) { + if (pReader->order == TSDB_ORDER_ASC || + (pReader->order == TSDB_ORDER_DESC && (!hasDataInLastBlock(pLastBlockReader)))) { copyBlockDataToSDataBlock(pReader, pBlockScanInfo); goto _end; } @@ -2149,12 +2145,12 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { } } - _end: +_end: pResBlock->info.uid = pBlockScanInfo->uid; blockDataUpdateTsWindow(pResBlock, 0); setComposedBlockFlag(pReader, true); - double el = (taosGetTimestampUs() - st)/1000.0; + double el = (taosGetTimestampUs() - st) / 1000.0; pReader->cost.composedBlocks += 1; pReader->cost.buildComposedBlockTime += el; @@ -2664,8 +2660,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; @@ -3216,7 +3215,8 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S tColDataGetValue(pData, rowIndex, &cv); doCopyColVal(pCol, outputRowIndex, i, &cv, pSupInfo); j += 1; - } else if (pData->cid > pCol->info.colId) { // the specified column does not exist in file block, fill with null data + } else if (pData->cid > pCol->info.colId) { + // the specified column does not exist in file block, fill with null data colDataAppendNULL(pCol, outputRowIndex); } @@ -3290,9 +3290,30 @@ 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 +3321,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 +3346,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 +3362,23 @@ 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); + 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); + 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 +3393,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; + + pNextReader->capacity = 1; + pNextReader->status.pTableMap = pReader->status.pTableMap; + pNextReader->pReadSnap = pReader->pReadSnap; - code = tsdbTakeReadSnap(pPrevReader->pTsdb, &pPrevReader->pReadSnap, pReader->idStr); + 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 +3439,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); @@ -3461,7 +3495,8 @@ void tsdbReaderClose(STsdbReader* pReader) { tsdbDebug( "%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64 - " SMA-time:%.2f ms, fileBlocks:%" PRId64 ", fileBlocks-load-time:%.2f ms, " + " SMA-time:%.2f ms, fileBlocks:%" PRId64 + ", fileBlocks-load-time:%.2f ms, " "build in-memory-block-time:%.2f ms, lastBlocks:%" PRId64 ", lastBlocks-time:%.2f ms, composed-blocks:%" PRId64 ", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb %s", pReader, pCost->headFileLoad, pCost->headFileLoadTime, pCost->smaDataLoad, pCost->smaLoadTime, pCost->numOfBlocks, @@ -3508,32 +3543,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; @@ -3719,8 +3754,10 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) { } } - tsdbDebug("%p reset reader, suid:%" PRIu64 ", numOfTables:%d, skey:%"PRId64", query range:%" PRId64 " - %" PRId64 " in query %s", - pReader, pReader->suid, numOfTables, pCond->twindows.skey, pReader->window.skey, pReader->window.ekey, pReader->idStr); + tsdbDebug("%p reset reader, suid:%" PRIu64 ", numOfTables:%d, skey:%" PRId64 ", query range:%" PRId64 " - %" PRId64 + " in query %s", + pReader, pReader->suid, numOfTables, pCond->twindows.skey, pReader->window.skey, pReader->window.ekey, + pReader->idStr); return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 64c150484b4f873bd15fb69c2b238bd840e1ea1f..8026441cbcf9d85e8de6f0ae5b707c56f775b09a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -705,12 +705,12 @@ int32_t tRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) { tsdbRowGetColVal(pRow, pTSchema, jCol++, pColVal); if (key.version > pMerger->version) { - if (!pColVal->isNone) { + if (!COL_VAL_IS_NONE(pColVal)) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else if (key.version < pMerger->version) { SColVal *tColVal = (SColVal *)taosArrayGet(pMerger->pArray, iCol); - if (tColVal->isNone && !pColVal->isNone) { + if (COL_VAL_IS_NONE(tColVal) && !COL_VAL_IS_NONE(pColVal)) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else { @@ -776,12 +776,12 @@ int32_t tRowMerge(SRowMerger *pMerger, TSDBROW *pRow) { tsdbRowGetColVal(pRow, pMerger->pTSchema, iCol, pColVal); if (key.version > pMerger->version) { - if (!pColVal->isNone) { + if (!COL_VAL_IS_NONE(pColVal)) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else if (key.version < pMerger->version) { SColVal *tColVal = (SColVal *)taosArrayGet(pMerger->pArray, iCol); - if (tColVal->isNone && !pColVal->isNone) { + if (COL_VAL_IS_NONE(tColVal) && !COL_VAL_IS_NONE(pColVal)) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else { @@ -1505,7 +1505,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) { tColDataGetValue(pColData, iVal, pColVal); - if (pColVal->isNone || pColVal->isNull) { + if (!COL_VAL_IS_VALUE(pColVal)) { pColAgg->numOfNull++; } else { switch (pColData->type) { 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/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..12e00a0a06d46525d04829b17ef5e0b755c80ac7 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 { @@ -989,7 +990,7 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWi SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNode* pPartNode, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNode* pPartNode, +SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPartitionPhysiNode* pPartNode, SExecTaskInfo* pTaskInfo); SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, SExecTaskInfo* pTaskInfo); 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..a0729bdf3b2721758110ed0a62e4ef6297d09ee1 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,8 @@ 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) { @@ -1125,19 +1121,18 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColM SFilterInfo* filter = NULL; // 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}; + int32_t code = filterInitFromNode((SNode*)pFilterNode, &filter, 0); + 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 +1147,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 +1178,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 +1190,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,9 +1199,6 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR } blockDataDestroy(px); // fix memory leak - } else { - // do nothing - pBlock->info.rows = 0; } } @@ -1778,49 +1777,60 @@ 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; } @@ -3350,9 +3360,7 @@ static void cleanupTableSchemaInfo(SSchemaInfo* pSchemaInfo) { tDeleteSSchemaWrapper(pSchemaInfo->qsw); } -static void cleanupStreamInfo(SStreamTaskInfo* pStreamInfo) { - tDeleteSSchemaWrapper(pStreamInfo->schema); -} +static void cleanupStreamInfo(SStreamTaskInfo* pStreamInfo) { tDeleteSSchemaWrapper(pStreamInfo->schema); } static int32_t sortTableGroup(STableListInfo* pTableListInfo) { taosArrayClear(pTableListInfo->pGroupList); @@ -3533,7 +3541,8 @@ 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) { @@ -3723,7 +3732,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_PARTITION == type) { pOptr = createPartitionOperatorInfo(ops[0], (SPartitionPhysiNode*)pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION == type) { - pOptr = createStreamPartitionOperatorInfo(ops[0], (SPartitionPhysiNode*)pPhyNode, pTaskInfo); + pOptr = createStreamPartitionOperatorInfo(ops[0], (SStreamPartitionPhysiNode*)pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE == type) { SStateWinodwPhysiNode* pStateNode = (SStateWinodwPhysiNode*)pPhyNode; pOptr = createStatewindowOperatorInfo(ops[0], pStateNode, pTaskInfo); @@ -4049,7 +4058,9 @@ 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); @@ -4246,10 +4257,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/groupoperator.c b/source/libs/executor/src/groupoperator.c index 5eb6557dbd4093f8c4599eb5d35107c95673e702..7cb641a9432029bc088273812a6b07fe6af102da 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -989,11 +989,11 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr goto _error; } int32_t code = TSDB_CODE_SUCCESS; - pInfo->partitionSup.pGroupCols = extractPartitionColInfo(pPartNode->pPartitionKeys); + pInfo->partitionSup.pGroupCols = extractPartitionColInfo(pPartNode->part.pPartitionKeys); - if (pPartNode->pExprs != NULL) { + if (pPartNode->part.pExprs != NULL) { int32_t num = 0; - SExprInfo* pCalExprInfo = createExprInfo(pPartNode->pExprs, NULL, &num); + SExprInfo* pCalExprInfo = createExprInfo(pPartNode->part.pExprs, NULL, &num); code = initExprSupp(&pInfo->scalarSup, pCalExprInfo, num); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -1008,7 +1008,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr } pInfo->partitionSup.needCalc = true; - SSDataBlock* pResBlock = createResDataBlock(pPartNode->node.pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pPartNode->part.node.pOutputDataBlockDesc); if (!pResBlock) { goto _error; } @@ -1022,7 +1022,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT); int32_t numOfCols = 0; - SExprInfo* pExprInfo = createExprInfo(pPartNode->pTargets, NULL, &numOfCols); + SExprInfo* pExprInfo = createExprInfo(pPartNode->part.pTargets, NULL, &numOfCols); pOperator->name = "StreamPartitionOperator"; pOperator->blocking = false; 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 aed4ae9b2668e76d36f759696441dd42996b5a93..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); } @@ -2015,7 +2016,11 @@ static void doKeepPrevRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock pkey->isNull = false; char* val = colDataGetData(pColInfoData, rowIndex); - memcpy(pkey->pData, val, pkey->bytes); + if (!IS_VAR_DATA_TYPE(pkey->type)) { + memcpy(pkey->pData, val, pkey->bytes); + } else { + memcpy(pkey->pData, val, varDataLen(val)); + } } } @@ -2033,7 +2038,11 @@ static void doKeepNextRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock pkey->isNull = false; char* val = colDataGetData(pColInfoData, rowIndex); - memcpy(pkey->pData, val, pkey->bytes); + if (!IS_VAR_DATA_TYPE(pkey->type)) { + memcpy(pkey->pData, val, pkey->bytes); + } else { + memcpy(pkey->pData, val, varDataLen(val)); + } } } @@ -2074,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) { @@ -2293,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]; @@ -2431,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) { @@ -2509,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 = @@ -2614,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; @@ -3073,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)); } } @@ -3109,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; @@ -3175,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) { @@ -5655,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); @@ -5755,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) { @@ -5805,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..a8d51905ab68ea40c7f35b8aa09116030dca7038 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; @@ -1555,7 +1558,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { } } else if (type == TSDB_DATA_TYPE_FLOAT) { float* pData = (float*)pCol->pData; - double* val = (double*)&pBuf->v; + float* val = (float*)&pBuf->v; for (int32_t i = start; i < start + numOfRows; ++i) { if ((pCol->hasNull) && colDataIsNull_f(pCol->nullbitmap, i)) { @@ -1622,7 +1625,7 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { pEntryInfo->isNullRes = (pEntryInfo->numOfRes == 0) ? 1 : 0; if (pCol->info.type == TSDB_DATA_TYPE_FLOAT) { - float v = *(double*)&pRes->v; + float v = *(float*)&pRes->v; colDataAppend(pCol, currentRow, (const char*)&v, pEntryInfo->isNullRes); } else { colDataAppend(pCol, currentRow, (const char*)&pRes->v, pEntryInfo->isNullRes); @@ -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; @@ -2974,10 +2977,9 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { return TSDB_CODE_SUCCESS; } -static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst) { +static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst, int32_t rowIndex) { SInputColumnInfoData* pColInfo = &pCtx->input; - int32_t start = pColInfo->startRowIndex; if (pOutput->hasResult) { if (isFirst) { if (pInput->ts > pOutput->ts) { @@ -2995,7 +2997,7 @@ static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, S pOutput->bytes = pInput->bytes; memcpy(pOutput->buf, pInput->buf, pOutput->bytes); - firstlastSaveTupleData(pCtx->pSrcBlock, start, pCtx, pOutput); + firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pOutput); pOutput->hasResult = true; } @@ -3013,7 +3015,7 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer for (int32_t i = start; i < start + pInput->numOfRows; ++i) { char* data = colDataGetData(pCol, i); SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data); - firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery); + firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i); if (!numOfElems) { numOfElems = pInputInfo->hasResult ? 1 : 0; } @@ -3069,8 +3071,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 +3747,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 +3757,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 +5415,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..7cad5df3a19339aab6fb96ec9fef5fdc6fb05f46 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); @@ -366,6 +381,8 @@ static int32_t logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) { COPY_SCALAR_FIELD(igExpired); CLONE_NODE_LIST_FIELD(pGroupTags); COPY_SCALAR_FIELD(groupSort); + CLONE_NODE_LIST_FIELD(pTags); + CLONE_NODE_FIELD(pSubtable); return TSDB_CODE_SUCCESS; } @@ -414,7 +431,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; } @@ -472,6 +490,8 @@ static int32_t logicSortCopy(const SSortLogicNode* pSrc, SSortLogicNode* pDst) { static int32_t logicPartitionCopy(const SPartitionLogicNode* pSrc, SPartitionLogicNode* pDst) { COPY_BASE_OBJECT_FIELD(node, logicNodeCopy); CLONE_NODE_LIST_FIELD(pPartitionKeys); + CLONE_NODE_LIST_FIELD(pTags); + CLONE_NODE_FIELD(pSubtable); return TSDB_CODE_SUCCESS; } @@ -611,6 +631,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 +732,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..78afadb75cc74be4b19e9e042042a64960a4dc69 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; @@ -1513,6 +1538,8 @@ static const char* jkTableScanPhysiPlanWatermark = "Watermark"; static const char* jkTableScanPhysiPlanIgnoreExpired = "IgnoreExpired"; static const char* jkTableScanPhysiPlanGroupTags = "GroupTags"; static const char* jkTableScanPhysiPlanGroupSort = "GroupSort"; +static const char* jkTableScanPhysiPlanTags = "Tags"; +static const char* jkTableScanPhysiPlanSubtable = "Subtable"; static const char* jkTableScanPhysiPlanAssignBlockUid = "AssignBlockUid"; static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) { @@ -1570,6 +1597,12 @@ static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkTableScanPhysiPlanGroupSort, pNode->groupSort); } + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkTableScanPhysiPlanTags, pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkTableScanPhysiPlanSubtable, nodeToJson, pNode->pSubtable); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkTableScanPhysiPlanAssignBlockUid, pNode->assignBlockUid); } @@ -1632,6 +1665,12 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkTableScanPhysiPlanGroupSort, &pNode->groupSort); } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkTableScanPhysiPlanTags, &pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkTableScanPhysiPlanSubtable, &pNode->pSubtable); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkTableScanPhysiPlanAssignBlockUid, &pNode->assignBlockUid); } @@ -1819,7 +1858,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 +1867,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 +1884,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); @@ -2238,6 +2284,37 @@ static int32_t jsonToPhysiPartitionNode(const SJson* pJson, void* pObj) { return code; } +static const char* jkStreamPartitionPhysiPlanTags = "Tags"; +static const char* jkStreamPartitionPhysiPlanSubtable = "Subtable"; + +static int32_t physiStreamPartitionNodeToJson(const void* pObj, SJson* pJson) { + const SStreamPartitionPhysiNode* pNode = (const SStreamPartitionPhysiNode*)pObj; + + int32_t code = physiPartitionNodeToJson(pObj, pJson); + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkStreamPartitionPhysiPlanTags, pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkStreamPartitionPhysiPlanSubtable, nodeToJson, pNode->pSubtable); + } + + return code; +} + +static int32_t jsonToPhysiStreamPartitionNode(const SJson* pJson, void* pObj) { + SStreamPartitionPhysiNode* pNode = (SStreamPartitionPhysiNode*)pObj; + + int32_t code = jsonToPhysiPartitionNode(pJson, pObj); + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkStreamPartitionPhysiPlanTags, &pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkStreamPartitionPhysiPlanSubtable, &pNode->pSubtable); + } + + return code; +} + static const char* jkIndefRowsFuncPhysiPlanExprs = "Exprs"; static const char* jkIndefRowsFuncPhysiPlanFuncs = "Funcs"; @@ -3903,6 +3980,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"; @@ -4008,6 +4154,8 @@ static const char* jkSelectStmtProjections = "Projections"; static const char* jkSelectStmtFrom = "From"; static const char* jkSelectStmtWhere = "Where"; static const char* jkSelectStmtPartitionBy = "PartitionBy"; +static const char* jkSelectStmtTags = "Tags"; +static const char* jkSelectStmtSubtable = "Subtable"; static const char* jkSelectStmtWindow = "Window"; static const char* jkSelectStmtGroupBy = "GroupBy"; static const char* jkSelectStmtHaving = "Having"; @@ -4033,6 +4181,12 @@ static int32_t selectStmtToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = nodeListToJson(pJson, jkSelectStmtPartitionBy, pNode->pPartitionByList); } + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkSelectStmtTags, pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkSelectStmtSubtable, nodeToJson, pNode->pSubtable); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddObject(pJson, jkSelectStmtWindow, nodeToJson, pNode->pWindow); } @@ -4077,6 +4231,12 @@ static int32_t jsonToSelectStmt(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkSelectStmtPartitionBy, &pNode->pPartitionByList); } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkSelectStmtTags, &pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkSelectStmtSubtable, &pNode->pSubtable); + } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeObject(pJson, jkSelectStmtWindow, &pNode->pWindow); } @@ -4385,6 +4545,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: @@ -4481,8 +4645,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE: return physiStateWindowNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_PARTITION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: return physiPartitionNodeToJson(pObj, pJson); + case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: + return physiStreamPartitionNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: return physiIndefRowsFuncNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: @@ -4548,6 +4713,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: @@ -4629,8 +4798,9 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE: return jsonToPhysiStateWindowNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_PARTITION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: return jsonToPhysiPartitionNode(pJson, pObj); + case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: + return jsonToPhysiStreamPartitionNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: return jsonToPhysiIndefRowsFuncNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: 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..989a4f5925028e2f15561432709d921ddac44416 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, @@ -1907,7 +1993,9 @@ enum { PHY_TABLE_SCAN_CODE_SCAN = 1, PHY_TABLE_SCAN_CODE_INLINE_ATTRS, PHY_TABLE_SCAN_CODE_DYN_SCAN_FUNCS, - PHY_TABLE_SCAN_CODE_GROUP_TAGS + PHY_TABLE_SCAN_CODE_GROUP_TAGS, + PHY_TABLE_SCAN_CODE_TAGS, + PHY_TABLE_SCAN_CODE_SUBTABLE }; static int32_t physiTableScanNodeInlineToMsg(const void* pObj, STlvEncoder* pEncoder) { @@ -1976,6 +2064,12 @@ static int32_t physiTableScanNodeToMsg(const void* pObj, STlvEncoder* pEncoder) if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeObj(pEncoder, PHY_TABLE_SCAN_CODE_GROUP_TAGS, nodeListToMsg, pNode->pGroupTags); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, PHY_TABLE_SCAN_CODE_TAGS, nodeListToMsg, pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, PHY_TABLE_SCAN_CODE_SUBTABLE, nodeToMsg, pNode->pSubtable); + } return code; } @@ -2052,6 +2146,12 @@ static int32_t msgToPhysiTableScanNode(STlvDecoder* pDecoder, void* pObj) { case PHY_TABLE_SCAN_CODE_GROUP_TAGS: code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pGroupTags); break; + case PHY_TABLE_SCAN_CODE_TAGS: + code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTags); + break; + case PHY_TABLE_SCAN_CODE_SUBTABLE: + code = msgToNodeFromTlv(pTlv, (void**)&pNode->pSubtable); + break; default: break; } @@ -2294,7 +2394,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 +2405,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 +2430,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); @@ -2821,6 +2928,46 @@ static int32_t msgToPhysiPartitionNode(STlvDecoder* pDecoder, void* pObj) { return code; } +enum { PHY_STREAM_PARTITION_CODE_BASE_NODE = 1, PHY_STREAM_PARTITION_CODE_TAGS, PHY_STREAM_PARTITION_CODE_SUBTABLE }; + +static int32_t physiStreamPartitionNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { + const SStreamPartitionPhysiNode* pNode = (const SStreamPartitionPhysiNode*)pObj; + + int32_t code = tlvEncodeObj(pEncoder, PHY_STREAM_PARTITION_CODE_BASE_NODE, physiPartitionNodeToMsg, &pNode->part); + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, PHY_STREAM_PARTITION_CODE_TAGS, nodeListToMsg, pNode->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, PHY_STREAM_PARTITION_CODE_SUBTABLE, nodeToMsg, pNode->pSubtable); + } + + return code; +} + +static int32_t msgToPhysiStreamPartitionNode(STlvDecoder* pDecoder, void* pObj) { + SStreamPartitionPhysiNode* pNode = (SStreamPartitionPhysiNode*)pObj; + + int32_t code = TSDB_CODE_SUCCESS; + STlv* pTlv = NULL; + tlvForEach(pDecoder, pTlv, code) { + switch (pTlv->type) { + case PHY_STREAM_PARTITION_CODE_BASE_NODE: + code = tlvDecodeObjFromTlv(pTlv, msgToPhysiPartitionNode, &pNode->part); + break; + case PHY_STREAM_PARTITION_CODE_TAGS: + code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTags); + break; + case PHY_STREAM_PARTITION_CODE_SUBTABLE: + code = msgToNodeFromTlv(pTlv, (void**)&pNode->pSubtable); + break; + default: + break; + } + } + + return code; +} + enum { PHY_INDEF_ROWS_FUNC_CODE_BASE_NODE = 1, PHY_INDEF_ROWS_FUNC_CODE_EXPRS, PHY_INDEF_ROWS_FUNC_CODE_FUNCS }; static int32_t physiIndefRowsFuncNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { @@ -3434,9 +3581,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); @@ -3492,9 +3646,11 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { code = physiStateWindowNodeToMsg(pObj, pEncoder); break; case QUERY_NODE_PHYSICAL_PLAN_PARTITION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: code = physiPartitionNodeToMsg(pObj, pEncoder); break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: + code = physiStreamPartitionNodeToMsg(pObj, pEncoder); + break; case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: code = physiIndefRowsFuncNodeToMsg(pObj, pEncoder); break; @@ -3563,9 +3719,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); @@ -3621,9 +3783,11 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) { code = msgToPhysiStateWindowNode(pDecoder, pObj); break; case QUERY_NODE_PHYSICAL_PLAN_PARTITION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: code = msgToPhysiPartitionNode(pDecoder, pObj); break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: + code = msgToPhysiStreamPartitionNode(pDecoder, pObj); + break; case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: code = msgToPhysiIndefRowsFuncNode(pDecoder, pObj); break; diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c index 728e173ff85e87d553d118f0baf0022a99c58f5d..9f851f6a3f763d8d3d87797ffb6826e908ddba4a 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; } @@ -340,6 +378,8 @@ void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker wa nodesWalkExpr(pSelect->pWhere, walker, pContext); case SQL_CLAUSE_WHERE: nodesWalkExprs(pSelect->pPartitionByList, walker, pContext); + nodesWalkExprs(pSelect->pTags, walker, pContext); + nodesWalkExpr(pSelect->pSubtable, walker, pContext); case SQL_CLAUSE_PARTITION_BY: nodesWalkExpr(pSelect->pWindow, walker, pContext); case SQL_CLAUSE_WINDOW: @@ -374,6 +414,8 @@ void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewrit nodesRewriteExpr(&(pSelect->pWhere), rewriter, pContext); case SQL_CLAUSE_WHERE: nodesRewriteExprs(pSelect->pPartitionByList, rewriter, pContext); + nodesRewriteExprs(pSelect->pTags, rewriter, pContext); + nodesRewriteExpr(&(pSelect->pSubtable), rewriter, pContext); case SQL_CLAUSE_PARTITION_BY: nodesRewriteExpr(&(pSelect->pWindow), rewriter, pContext); case SQL_CLAUSE_WINDOW: diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 805ddb9e422db5a42c6aed1594985d5a233c4ccd..71e53bd9be9d26c84c78710a5bb5d0f9d0d14d73 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 SNode* makeNode(ENodeType type, size_t size) { - SNode* p = taosMemoryCalloc(1, size); +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; +} + +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); @@ -554,6 +772,8 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyNode(pStmt->pFromTable); nodesDestroyNode(pStmt->pWhere); nodesDestroyList(pStmt->pPartitionByList); + nodesDestroyList(pStmt->pTags); + nodesDestroyNode(pStmt->pSubtable); nodesDestroyNode(pStmt->pWindow); nodesDestroyList(pStmt->pGroupByList); nodesDestroyNode(pStmt->pHaving); @@ -824,6 +1044,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 +1242,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 +1258,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 +1325,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 +1345,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 +1373,7 @@ SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) { } SListCell* pNext = pCell->pNext; nodesDestroyNode(pCell->pNode); - taosMemoryFreeClear(pCell); + nodesFree(pCell); --(pList->length); return pNext; } @@ -1172,7 +1393,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 +1425,7 @@ void nodesDestroyList(SNodeList* pList) { while (NULL != pNext) { pNext = nodesListErase(pList, pNext); } - taosMemoryFreeClear(pList); + nodesFree(pList); } void nodesClearList(SNodeList* pList) { @@ -1216,9 +1437,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..1a955b3f6b04aa4c14e85697706940d2de9bd001 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); @@ -145,7 +147,7 @@ SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, STok SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pDbName); SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions); SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); -SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); +SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed); SNode* createDefaultTableOptions(SAstCreateContext* pCxt); SNode* createAlterTableOptions(SAstCreateContext* pCxt); SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal); @@ -210,7 +212,7 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName); SNode* createStreamOptions(SAstCreateContext* pCxt); SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, - SNode* pOptions, SNode* pQuery); + SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery); SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName); SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId); SNode* createKillQueryStmt(SAstCreateContext* pCxt, const SToken* pQueryId); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 6e43843cda4d00dfa78b57028660de831e0a3c82..cf465d6d762d8cae27d728dbb5b1b4fec50d2285 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -159,7 +159,7 @@ cmd ::= DROP DATABASE exists_opt(A) db_name(B). cmd ::= USE db_name(A). { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &A); } cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); } cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); } -cmd ::= TRIM DATABASE db_name(A). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A); } +cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); } %type not_exists_opt { bool } %destructor not_exists_opt { } @@ -246,6 +246,11 @@ retention_list(A) ::= retention_list(B) NK_COMMA retention(C). retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). { A = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &B), createDurationValueNode(pCxt, &C)); } +%type speed_opt { int32_t } +%destructor speed_opt { } +speed_opt(A) ::= . { A = 0; } +speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } + /************************************************ create/drop table/stable ********************************************/ cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } @@ -501,8 +506,8 @@ bufsize_opt(A) ::= . bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } /************************************************ create/drop stream **************************************************/ -cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A) - stream_options(B) INTO full_table_name(C) AS query_or_subquery(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, C, B, D); } +cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A) stream_options(B) INTO + full_table_name(C) tags_def_opt(F) subtable_opt(G) AS query_or_subquery(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, C, B, F, G, D); } cmd ::= DROP STREAM exists_opt(A) stream_name(B). { pCxt->pRootNode = createDropStreamStmt(pCxt, A, &B); } stream_options(A) ::= . { A = createStreamOptions(pCxt); } @@ -512,6 +517,9 @@ stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10); A = B; } +subtable_opt(A) ::= . { A = NULL; } +subtable_opt(A) ::= SUBTABLE NK_LP expression(B) NK_RP. { A = releaseRawExprNode(pCxt, B); } + /************************************************ kill connection/query ***********************************************/ cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } cmd ::= KILL QUERY NK_STRING(A). { pCxt->pRootNode = createKillQueryStmt(pCxt, &A); } @@ -625,42 +633,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 +679,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 +692,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 +710,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 +746,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 +841,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 *********************************************************/ @@ -889,12 +917,21 @@ where_clause_opt(A) ::= WHERE search_condition(B). %type partition_by_clause_opt { SNodeList* } %destructor partition_by_clause_opt { nodesDestroyList($$); } partition_by_clause_opt(A) ::= . { A = NULL; } -partition_by_clause_opt(A) ::= PARTITION BY expression_list(B). { A = B; } +partition_by_clause_opt(A) ::= PARTITION BY partition_list(B). { A = B; } + +%type partition_list { SNodeList* } +%destructor partition_list { nodesDestroyList($$); } +partition_list(A) ::= partition_item(B). { A = createNodeList(pCxt, B); } +partition_list(A) ::= partition_list(B) NK_COMMA partition_item(C). { A = addNodeToList(pCxt, B, C); } + +partition_item(A) ::= expr_or_subquery(B). { A = releaseRawExprNode(pCxt, B); } +partition_item(A) ::= expr_or_subquery(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); } +partition_item(A) ::= expr_or_subquery(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); } 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 +960,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 +1012,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 +1025,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..10a066db40e497767e6e4eca623aabf3ded3dcea 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); @@ -1035,7 +1055,7 @@ SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { return (SNode*)pStmt; } -SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { +SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed) { CHECK_PARSER_STATUS(pCxt); if (!checkDbName(pCxt, pDbName, false)) { return NULL; @@ -1043,6 +1063,7 @@ SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { STrimDatabaseStmt* pStmt = (STrimDatabaseStmt*)nodesMakeNode(QUERY_NODE_TRIM_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); + pStmt->maxSpeed = maxSpeed; return (SNode*)pStmt; } @@ -1680,7 +1701,7 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { } SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, - SNode* pOptions, SNode* pQuery) { + SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery) { CHECK_PARSER_STATUS(pCxt); SCreateStreamStmt* pStmt = (SCreateStreamStmt*)nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); CHECK_OUT_OF_MEM(pStmt); @@ -1693,6 +1714,8 @@ SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const pStmt->ignoreExists = ignoreExists; pStmt->pOptions = (SStreamOptions*)pOptions; pStmt->pQuery = pQuery; + pStmt->pTags = pTags; + pStmt->pSubtable = pSubtable; return (SNode*)pStmt; } diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index a7c08d8f659c2477c8c28c9711d687176a9477ae..efc9d77e67b8865b16409894920609277b38c1db 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -275,6 +275,12 @@ static int32_t calcConstSelectFrom(SCalcConstContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { code = calcConstList(pSelect->pPartitionByList); } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstList(pSelect->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstNode(&pSelect->pSubtable); + } if (TSDB_CODE_SUCCESS == code) { code = calcConstNode(&pSelect->pWindow); } 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/parInsertData.c b/source/libs/parser/src/parInsertData.c index 3ea5e81872f1562f09e35226c69c5a5295d684ab..e8c877bed2d69346cd718625688b0db3de85ae69 100644 --- a/source/libs/parser/src/parInsertData.c +++ b/source/libs/parser/src/parInsertData.c @@ -505,7 +505,7 @@ static int32_t tdBlockRowMerge(STableMeta* pTableMeta, SBlockKeyTuple* pEndKeyTp SColVal colVal = {0}; for (int32_t j = 0; j < nDupRows; ++j) { tTSRowGetVal((pEndKeyTp - j)->payloadAddr, pSchema, i, &colVal); - if (!colVal.isNone) { + if (!COL_VAL_IS_NONE(&colVal)) { break; } } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 68eb3e6fb1985dda6a8db9106fc2a6bcc8cd3583..26127be0d62940d13df785c9bcba5d603b35b5d6 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}, @@ -126,6 +129,7 @@ static SKeyword keywordTable[] = { {"MATCH", TK_MATCH}, {"MAXROWS", TK_MAXROWS}, {"MAX_DELAY", TK_MAX_DELAY}, + {"MAX_SPEED", TK_MAX_SPEED}, {"MERGE", TK_MERGE}, {"META", TK_META}, {"MINROWS", TK_MINROWS}, @@ -197,6 +201,7 @@ static SKeyword keywordTable[] = { {"STREAMS", TK_STREAMS}, {"STRICT", TK_STRICT}, {"SUBSCRIPTIONS", TK_SUBSCRIPTIONS}, + {"SUBTABLE", TK_SUBTABLE}, {"SYSINFO", TK_SYSINFO}, {"TABLE", TK_TABLE}, {"TABLES", TK_TABLES}, @@ -205,6 +210,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 +246,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..c386ddf6d63a095146445c4f262971ed252017db 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); @@ -2999,7 +3076,14 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SSelectStmt* pSelec return TSDB_CODE_SUCCESS; } pCxt->currClause = SQL_CLAUSE_PARTITION_BY; - return translateExprList(pCxt, pSelect->pPartitionByList); + int32_t code = translateExprList(pCxt, pSelect->pPartitionByList); + if (TSDB_CODE_SUCCESS == code) { + code = translateExprList(pCxt, pSelect->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = translateExpr(pCxt, &pSelect->pSubtable); + } + return code; } static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) { @@ -3208,27 +3292,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); @@ -3912,7 +3975,7 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm } static int32_t translateTrimDatabase(STranslateContext* pCxt, STrimDatabaseStmt* pStmt) { - STrimDbReq req = {0}; + STrimDbReq req = {.maxSpeed = pStmt->maxSpeed}; SName name = {0}; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, req.db); @@ -5155,6 +5218,93 @@ static int32_t addWstartTsToCreateStreamQuery(SNode* pStmt) { return code; } +static int32_t addTagsToCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SSelectStmt* pSelect) { + if (NULL == pStmt->pTags) { + return TSDB_CODE_SUCCESS; + } + + SNode* pTag = NULL; + FOREACH(pTag, pStmt->pTags) { + bool found = false; + SNode* pPart = NULL; + FOREACH(pPart, pSelect->pPartitionByList) { + if (0 == strcmp(((SColumnDefNode*)pTag)->colName, ((SExprNode*)pPart)->userAlias)) { + if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSelect->pTags, nodesCloneNode(pPart))) { + return TSDB_CODE_OUT_OF_MEMORY; + } + found = true; + break; + } + } + if (!found) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, ((SColumnDefNode*)pTag)->colName); + } + } + return TSDB_CODE_SUCCESS; +} + +typedef struct SRewriteSubtableCxt { + STranslateContext* pCxt; + SNodeList* pPartitionList; +} SRewriteSubtableCxt; + +static EDealRes rewriteSubtable(SNode** pNode, void* pContext) { + if (QUERY_NODE_COLUMN == nodeType(*pNode)) { + SRewriteSubtableCxt* pCxt = pContext; + bool found = false; + SNode* pPart = NULL; + FOREACH(pPart, pCxt->pPartitionList) { + if (0 == strcmp(((SColumnNode*)*pNode)->colName, ((SExprNode*)pPart)->userAlias)) { + SNode* pNew = nodesCloneNode(pPart); + if (NULL == pNew) { + pCxt->pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; + return DEAL_RES_ERROR; + } + nodesDestroyNode(*pNode); + *pNode = pNew; + found = true; + break; + } + if (!found) { + return generateDealNodeErrMsg(pCxt->pCxt, TSDB_CODE_PAR_INVALID_COLUMN, ((SColumnNode*)*pNode)->colName); + } + } + return DEAL_RES_IGNORE_CHILD; + } + return DEAL_RES_CONTINUE; +} + +static int32_t addSubtableNameToCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, + SSelectStmt* pSelect) { + if (NULL == pStmt->pSubtable) { + return TSDB_CODE_SUCCESS; + } + pSelect->pSubtable = nodesCloneNode(pStmt->pSubtable); + if (NULL == pSelect->pSubtable) { + return TSDB_CODE_OUT_OF_MEMORY; + } + SRewriteSubtableCxt cxt = {.pCxt = pCxt, .pPartitionList = pSelect->pPartitionByList}; + nodesRewriteExpr(&pSelect->pSubtable, rewriteSubtable, &cxt); + return pCxt->errCode; +} + +static int32_t addSubtableInfoToCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { + SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery; + if (NULL == pSelect->pPartitionByList) { + if (NULL != pStmt->pTags || NULL != pStmt->pSubtable) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Unsupported stream query"); + } + return TSDB_CODE_SUCCESS; + } + + int32_t code = addTagsToCreateStreamQuery(pCxt, pStmt, pSelect); + if (TSDB_CODE_SUCCESS == code) { + code = addSubtableNameToCreateStreamQuery(pCxt, pStmt, pSelect); + } + + return code; +} + static int32_t checkStreamQuery(STranslateContext* pCxt, SSelectStmt* pSelect) { if (TSDB_DATA_TYPE_TIMESTAMP != ((SExprNode*)nodesListGetNode(pSelect->pProjectionList, 0))->resType.type || !pSelect->isTimeLineResult || crossTableWithoutAggOper(pSelect) || NULL != pSelect->pOrderByList || @@ -5164,18 +5314,21 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SSelectStmt* pSelect) { return TSDB_CODE_SUCCESS; } -static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SCMCreateStreamReq* pReq) { +static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { pCxt->createStream = true; - int32_t code = addWstartTsToCreateStreamQuery(pStmt); + int32_t code = addWstartTsToCreateStreamQuery(pStmt->pQuery); if (TSDB_CODE_SUCCESS == code) { - code = translateQuery(pCxt, pStmt); + code = addSubtableInfoToCreateStreamQuery(pCxt, pStmt); + } + if (TSDB_CODE_SUCCESS == code) { + code = translateQuery(pCxt, pStmt->pQuery); } if (TSDB_CODE_SUCCESS == code) { - code = checkStreamQuery(pCxt, (SSelectStmt*)pStmt); + code = checkStreamQuery(pCxt, (SSelectStmt*)pStmt->pQuery); } if (TSDB_CODE_SUCCESS == code) { - getSourceDatabase(pStmt, pCxt->pParseCxt->acctId, pReq->sourceDB); - code = nodesNodeToString(pStmt, false, &pReq->ast, NULL); + getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB); + code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL); } return code; } @@ -5193,7 +5346,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* tNameExtractFullName(&name, pReq->targetStbFullName); } - int32_t code = buildCreateStreamQuery(pCxt, pStmt->pQuery, pReq); + int32_t code = buildCreateStreamQuery(pCxt, pStmt, pReq); if (TSDB_CODE_SUCCESS == code) { pReq->sql = strdup(pCxt->pParseCxt->pSql); if (NULL == pReq->sql) { @@ -5206,6 +5359,8 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pReq->maxDelay = (NULL != pStmt->pOptions->pDelay ? ((SValueNode*)pStmt->pOptions->pDelay)->datum.i : 0); pReq->watermark = (NULL != pStmt->pOptions->pWatermark ? ((SValueNode*)pStmt->pOptions->pWatermark)->datum.i : 0); pReq->igExpired = pStmt->pOptions->ignoreExpired; + columnDefNodeToField(pStmt->pTags, &pReq->pTags); + pReq->numOfTags = LIST_LENGTH(pStmt->pTags); } return code; 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..2ccdd2cdf25d7a9fcccd45398c24b35d4445f137 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 447 #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; + int64_t yy57; + EJoinType yy114; + SNodeList* yy148; + int8_t yy167; + int32_t yy172; + bool yy287; + SAlterOption yy323; + EOrder yy362; + SNode* yy392; + SToken yy677; + EFillMode yy708; + EOperatorType yy758; + ENullOrder yy781; + SDataType yy838; } 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 689 +#define YYNRULE 518 +#define YYNTOKEN 315 +#define YY_MAX_SHIFT 688 +#define YY_MIN_SHIFTREDUCE 1016 +#define YY_MAX_SHIFTREDUCE 1533 +#define YY_ERROR_ACTION 1534 +#define YY_ACCEPT_ACTION 1535 +#define YY_NO_ACTION 1536 +#define YY_MIN_REDUCE 1537 +#define YY_MAX_REDUCE 2054 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,646 +216,752 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2196) +#define YY_ACTTAB_COUNT (2818) 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 */ 1858, 1560, 443, 1858, 444, 1572, 451, 1872, 444, 1572, + /* 10 */ 1675, 1854, 44, 42, 1854, 351, 13, 12, 1729, 1731, + /* 20 */ 346, 1854, 1316, 43, 41, 40, 39, 38, 1342, 2030, + /* 30 */ 155, 77, 1549, 1394, 1049, 1314, 1890, 1850, 1856, 334, + /* 40 */ 1850, 1856, 340, 1840, 582, 125, 1343, 1850, 1856, 1840, + /* 50 */ 588, 594, 30, 588, 1679, 542, 1389, 1929, 37, 36, + /* 60 */ 588, 17, 43, 41, 40, 39, 38, 1872, 1322, 44, + /* 70 */ 42, 1464, 1870, 581, 1053, 1054, 1904, 346, 566, 1316, + /* 80 */ 97, 1871, 1873, 598, 1875, 1876, 593, 1066, 588, 1065, + /* 90 */ 1394, 62, 1314, 167, 1, 1957, 1890, 34, 265, 339, + /* 100 */ 1953, 166, 479, 581, 595, 578, 1341, 2025, 1736, 1840, + /* 110 */ 1437, 594, 172, 1389, 1723, 333, 685, 1067, 17, 527, + /* 120 */ 1983, 1523, 565, 170, 1734, 1322, 331, 2026, 567, 1784, + /* 130 */ 1396, 1397, 596, 460, 132, 179, 1904, 1538, 1211, 1212, + /* 140 */ 98, 345, 1873, 598, 1875, 1876, 593, 46, 588, 1890, + /* 150 */ 442, 1, 1066, 446, 1065, 1957, 58, 560, 109, 312, + /* 160 */ 1953, 108, 107, 106, 105, 104, 103, 102, 101, 100, + /* 170 */ 2025, 130, 74, 685, 1972, 73, 1317, 46, 1315, 47, + /* 180 */ 58, 58, 1067, 7, 1559, 565, 170, 1396, 1397, 264, + /* 190 */ 2026, 567, 580, 168, 1965, 1966, 559, 1970, 1730, 1731, + /* 200 */ 1320, 1321, 1969, 1371, 1372, 1374, 1375, 1376, 1377, 1378, + /* 210 */ 1379, 590, 586, 1387, 1388, 1390, 1391, 1392, 1393, 1395, + /* 220 */ 1398, 3, 203, 1537, 37, 36, 1840, 581, 43, 41, + /* 230 */ 40, 39, 38, 1317, 1342, 1315, 160, 231, 232, 173, + /* 240 */ 1468, 477, 473, 469, 465, 202, 1341, 118, 117, 116, + /* 250 */ 115, 114, 113, 112, 111, 110, 391, 1320, 1321, 26, + /* 260 */ 1371, 1372, 1374, 1375, 1376, 1377, 1378, 1379, 590, 586, + /* 270 */ 1387, 1388, 1390, 1391, 1392, 1393, 1395, 1398, 3, 44, + /* 280 */ 42, 485, 78, 77, 1859, 200, 58, 346, 1558, 1316, + /* 290 */ 450, 1490, 173, 446, 308, 1854, 310, 629, 578, 530, + /* 300 */ 1394, 173, 1314, 484, 109, 217, 1680, 108, 107, 106, + /* 310 */ 105, 104, 103, 102, 101, 100, 144, 143, 626, 625, + /* 320 */ 624, 1850, 1856, 1389, 173, 173, 173, 132, 17, 2030, + /* 330 */ 1840, 1872, 225, 1341, 588, 1322, 44, 42, 1736, 553, + /* 340 */ 1488, 1489, 1491, 1492, 346, 350, 1316, 578, 199, 193, + /* 350 */ 448, 198, 561, 1557, 1734, 456, 1339, 1394, 2025, 1314, + /* 360 */ 1890, 1, 79, 310, 130, 540, 530, 384, 582, 383, + /* 370 */ 58, 191, 81, 1840, 2029, 594, 132, 119, 2026, 2028, + /* 380 */ 1389, 380, 1457, 685, 481, 17, 169, 1965, 1966, 142, + /* 390 */ 1970, 1662, 1322, 1404, 1684, 1840, 1870, 1396, 1397, 1341, + /* 400 */ 1904, 382, 378, 1316, 97, 1871, 1873, 598, 1875, 1876, + /* 410 */ 593, 1556, 588, 121, 631, 556, 1314, 167, 1, 1957, + /* 420 */ 623, 37, 36, 339, 1953, 43, 41, 40, 39, 38, + /* 430 */ 1373, 173, 11, 1344, 9, 262, 1965, 577, 428, 576, + /* 440 */ 685, 51, 2025, 1317, 1984, 1315, 1661, 218, 349, 1322, + /* 450 */ 1714, 460, 332, 1840, 1396, 1397, 153, 565, 170, 1659, + /* 460 */ 153, 1555, 2026, 567, 544, 1686, 1929, 1320, 1321, 1686, + /* 470 */ 1371, 1372, 1374, 1375, 1376, 1377, 1378, 1379, 590, 586, + /* 480 */ 1387, 1388, 1390, 1391, 1392, 1393, 1395, 1398, 3, 230, + /* 490 */ 11, 40, 39, 38, 183, 182, 1340, 685, 562, 557, + /* 500 */ 1317, 322, 1315, 1840, 1169, 620, 619, 618, 1173, 617, + /* 510 */ 1175, 1176, 616, 1178, 613, 173, 1184, 610, 1186, 1187, + /* 520 */ 607, 604, 1129, 1787, 1320, 1321, 1554, 1371, 1372, 1374, + /* 530 */ 1375, 1376, 1377, 1378, 1379, 590, 586, 1387, 1388, 1390, + /* 540 */ 1391, 1392, 1393, 1395, 1398, 3, 44, 42, 540, 1294, + /* 550 */ 1295, 2030, 629, 11, 346, 1131, 1316, 1317, 1322, 1315, + /* 560 */ 52, 323, 1343, 321, 320, 629, 483, 1394, 1840, 1314, + /* 570 */ 485, 144, 143, 626, 625, 624, 241, 1684, 507, 1872, + /* 580 */ 2025, 1320, 1321, 1373, 144, 143, 626, 625, 624, 352, + /* 590 */ 1389, 505, 484, 503, 158, 1341, 2029, 153, 1872, 1641, + /* 600 */ 2026, 2027, 1322, 44, 42, 1399, 1686, 540, 1890, 1660, + /* 610 */ 1783, 346, 305, 1316, 643, 94, 595, 490, 489, 175, + /* 620 */ 1553, 1840, 540, 594, 1394, 1736, 1314, 1890, 8, 127, + /* 630 */ 656, 654, 317, 1425, 389, 595, 1684, 1676, 1552, 1551, + /* 640 */ 1840, 1734, 594, 128, 596, 1548, 1928, 1389, 1904, 540, + /* 650 */ 685, 1684, 292, 345, 1873, 598, 1875, 1876, 593, 1322, + /* 660 */ 588, 119, 1840, 1870, 1396, 1397, 1547, 1904, 486, 631, + /* 670 */ 566, 97, 1871, 1873, 598, 1875, 1876, 593, 1684, 588, + /* 680 */ 1840, 1840, 2025, 1546, 2045, 8, 1957, 1840, 37, 36, + /* 690 */ 339, 1953, 43, 41, 40, 39, 38, 565, 170, 2025, + /* 700 */ 1991, 31, 2026, 567, 540, 264, 1344, 685, 1840, 153, + /* 710 */ 1317, 1430, 1315, 570, 565, 170, 390, 32, 1687, 2026, + /* 720 */ 567, 1396, 1397, 37, 36, 1840, 1461, 43, 41, 40, + /* 730 */ 39, 38, 1545, 1684, 1320, 1321, 1544, 1371, 1372, 1374, + /* 740 */ 1375, 1376, 1377, 1378, 1379, 590, 586, 1387, 1388, 1390, + /* 750 */ 1391, 1392, 1393, 1395, 1398, 3, 540, 37, 36, 1972, + /* 760 */ 1535, 43, 41, 40, 39, 38, 518, 1317, 398, 1315, + /* 770 */ 1782, 87, 305, 173, 1840, 1500, 37, 36, 1840, 1373, + /* 780 */ 43, 41, 40, 39, 38, 1684, 1543, 1968, 1542, 1972, + /* 790 */ 1541, 1320, 1321, 1677, 1371, 1372, 1374, 1375, 1376, 1377, + /* 800 */ 1378, 1379, 590, 586, 1387, 1388, 1390, 1391, 1392, 1393, + /* 810 */ 1395, 1398, 3, 44, 42, 1777, 498, 1967, 1053, 1054, + /* 820 */ 361, 346, 1777, 1316, 1977, 1457, 178, 540, 1840, 540, + /* 830 */ 1840, 508, 1840, 181, 1394, 540, 1314, 523, 540, 413, + /* 840 */ 2029, 414, 527, 540, 1480, 216, 1872, 458, 540, 240, + /* 850 */ 459, 627, 1785, 1325, 1727, 1681, 1684, 1389, 1684, 501, + /* 860 */ 136, 1540, 1673, 495, 1684, 1872, 2025, 1684, 215, 1322, + /* 870 */ 44, 42, 1684, 1736, 1550, 1890, 628, 1684, 346, 1727, + /* 880 */ 1316, 2031, 170, 595, 540, 45, 2026, 567, 1840, 1735, + /* 890 */ 594, 1394, 2030, 1314, 1890, 8, 519, 644, 1827, 1654, + /* 900 */ 540, 1669, 595, 1840, 540, 64, 540, 1840, 63, 594, + /* 910 */ 573, 1870, 524, 1684, 1389, 1904, 235, 685, 536, 156, + /* 920 */ 1871, 1873, 598, 1875, 1876, 593, 1322, 588, 571, 1684, + /* 930 */ 1870, 1396, 1397, 1684, 1904, 1684, 1530, 1265, 97, 1871, + /* 940 */ 1873, 598, 1875, 1876, 593, 368, 588, 493, 492, 48, + /* 950 */ 4, 2045, 1, 1957, 126, 392, 277, 339, 1953, 1714, + /* 960 */ 545, 1994, 1460, 1589, 1642, 488, 491, 2019, 393, 540, + /* 970 */ 208, 487, 210, 206, 685, 209, 585, 1317, 385, 1315, + /* 980 */ 526, 538, 50, 522, 1523, 494, 37, 36, 1396, 1397, + /* 990 */ 43, 41, 40, 39, 38, 523, 1328, 523, 1684, 1532, + /* 1000 */ 1533, 1320, 1321, 1671, 1371, 1372, 1374, 1375, 1376, 1377, + /* 1010 */ 1378, 1379, 590, 586, 1387, 1388, 1390, 1391, 1392, 1393, + /* 1020 */ 1395, 1398, 3, 307, 2025, 1339, 2025, 1584, 1582, 1529, + /* 1030 */ 212, 540, 421, 211, 1317, 433, 1315, 13, 12, 2031, + /* 1040 */ 170, 2031, 170, 539, 2026, 567, 2026, 567, 214, 496, + /* 1050 */ 499, 213, 406, 229, 434, 224, 408, 1667, 1320, 1321, + /* 1060 */ 1684, 1371, 1372, 1374, 1375, 1376, 1377, 1378, 1379, 590, + /* 1070 */ 586, 1387, 1388, 1390, 1391, 1392, 1393, 1395, 1398, 3, + /* 1080 */ 37, 36, 60, 137, 43, 41, 40, 39, 38, 154, + /* 1090 */ 540, 540, 637, 569, 283, 80, 93, 1997, 399, 221, + /* 1100 */ 638, 589, 266, 353, 1324, 233, 90, 141, 281, 66, + /* 1110 */ 395, 1599, 65, 259, 1113, 1415, 142, 622, 60, 1684, + /* 1120 */ 1684, 245, 1111, 1861, 554, 478, 253, 574, 187, 439, + /* 1130 */ 437, 1891, 357, 1573, 1431, 533, 1724, 1987, 432, 1093, + /* 1140 */ 578, 427, 426, 425, 424, 423, 420, 419, 418, 417, + /* 1150 */ 416, 412, 411, 410, 409, 403, 402, 401, 400, 237, + /* 1160 */ 397, 396, 319, 45, 45, 58, 261, 602, 1162, 132, + /* 1170 */ 1487, 1863, 1094, 248, 662, 661, 660, 659, 356, 141, + /* 1180 */ 658, 657, 133, 652, 651, 650, 649, 648, 647, 646, + /* 1190 */ 645, 146, 641, 640, 639, 355, 354, 636, 635, 634, + /* 1200 */ 633, 632, 142, 96, 37, 36, 130, 1578, 43, 41, + /* 1210 */ 40, 39, 38, 122, 1872, 1380, 276, 2, 579, 1190, + /* 1220 */ 141, 258, 5, 362, 318, 367, 1281, 273, 171, 1965, + /* 1230 */ 1966, 1194, 1970, 180, 1339, 152, 415, 394, 1779, 71, + /* 1240 */ 70, 388, 422, 1890, 177, 429, 430, 1327, 435, 436, + /* 1250 */ 431, 595, 184, 438, 1201, 680, 1840, 313, 594, 359, + /* 1260 */ 440, 306, 1345, 441, 376, 1199, 374, 370, 366, 363, + /* 1270 */ 360, 449, 145, 1347, 452, 190, 523, 192, 453, 1870, + /* 1280 */ 1346, 1348, 454, 1904, 195, 455, 1872, 97, 1871, 1873, + /* 1290 */ 598, 1875, 1876, 593, 457, 588, 197, 75, 129, 1423, + /* 1300 */ 140, 1928, 1957, 76, 201, 2025, 339, 1953, 1872, 461, + /* 1310 */ 173, 480, 482, 120, 309, 1890, 1674, 205, 1670, 207, + /* 1320 */ 2031, 170, 147, 595, 148, 2026, 567, 1602, 1840, 1672, + /* 1330 */ 594, 1668, 149, 150, 510, 512, 1818, 1890, 274, 219, + /* 1340 */ 514, 513, 517, 222, 520, 595, 525, 226, 552, 528, + /* 1350 */ 1840, 1870, 594, 328, 1424, 1904, 1817, 1789, 138, 97, + /* 1360 */ 1871, 1873, 598, 1875, 1876, 593, 531, 588, 139, 330, + /* 1370 */ 534, 535, 2045, 1870, 1957, 1872, 84, 1904, 339, 1953, + /* 1380 */ 275, 97, 1871, 1873, 598, 1875, 1876, 593, 1976, 588, + /* 1390 */ 86, 493, 492, 1685, 1932, 1344, 1957, 1988, 126, 555, + /* 1400 */ 339, 1953, 1998, 548, 1890, 243, 550, 551, 6, 488, + /* 1410 */ 491, 335, 595, 558, 247, 487, 358, 1840, 564, 594, + /* 1420 */ 2003, 252, 33, 343, 1418, 1419, 1420, 1421, 1422, 1426, + /* 1430 */ 1427, 1428, 1429, 523, 1979, 2002, 549, 547, 336, 254, + /* 1440 */ 1870, 161, 255, 546, 1904, 256, 257, 1872, 97, 1871, + /* 1450 */ 1873, 598, 1875, 1876, 593, 260, 588, 575, 1457, 572, + /* 1460 */ 131, 1930, 2025, 1957, 2024, 1343, 57, 339, 1953, 2048, + /* 1470 */ 1973, 688, 1938, 88, 600, 1728, 1890, 2031, 170, 1655, + /* 1480 */ 278, 269, 2026, 567, 595, 272, 681, 682, 684, 1840, + /* 1490 */ 49, 594, 304, 280, 1834, 282, 1833, 68, 290, 164, + /* 1500 */ 1832, 1831, 301, 300, 678, 674, 670, 666, 270, 69, + /* 1510 */ 1828, 364, 1870, 365, 1308, 1309, 1904, 176, 369, 1826, + /* 1520 */ 97, 1871, 1873, 598, 1875, 1876, 593, 371, 588, 1872, + /* 1530 */ 372, 373, 1825, 543, 375, 1957, 342, 341, 377, 339, + /* 1540 */ 1953, 1824, 1823, 1822, 379, 95, 1330, 381, 238, 1284, + /* 1550 */ 1283, 1800, 1799, 386, 387, 1798, 1797, 1394, 1890, 1323, + /* 1560 */ 1253, 1772, 1771, 1770, 1769, 134, 595, 1768, 1767, 511, + /* 1570 */ 72, 1840, 1766, 594, 1765, 1764, 1763, 1762, 404, 405, + /* 1580 */ 1389, 537, 1761, 1872, 407, 1760, 523, 1759, 1758, 1757, + /* 1590 */ 1756, 1755, 1322, 1255, 1870, 1754, 1753, 1752, 1904, 1751, + /* 1600 */ 1750, 1749, 98, 1871, 1873, 598, 1875, 1876, 593, 1872, + /* 1610 */ 588, 1748, 1890, 1747, 227, 2025, 1746, 1957, 1745, 1744, + /* 1620 */ 595, 1956, 1953, 135, 1743, 1840, 1742, 594, 1741, 1740, + /* 1630 */ 2031, 170, 1288, 1739, 220, 2026, 567, 1738, 1890, 1737, + /* 1640 */ 584, 1137, 1604, 1603, 1601, 1569, 592, 188, 1870, 1056, + /* 1650 */ 185, 1840, 1904, 594, 186, 165, 98, 1871, 1873, 598, + /* 1660 */ 1875, 1876, 593, 445, 588, 1055, 123, 447, 1568, 1813, + /* 1670 */ 189, 1957, 1807, 124, 1870, 583, 1953, 1796, 1904, 1872, + /* 1680 */ 194, 1795, 298, 1871, 1873, 598, 1875, 1876, 593, 591, + /* 1690 */ 588, 541, 1922, 196, 1781, 1663, 1600, 1598, 1086, 462, + /* 1700 */ 1331, 463, 1326, 1596, 464, 466, 467, 1594, 1890, 470, + /* 1710 */ 468, 1592, 472, 471, 474, 476, 595, 1581, 1580, 1565, + /* 1720 */ 1665, 1840, 475, 594, 1334, 1336, 59, 1205, 1204, 1664, + /* 1730 */ 653, 655, 204, 1128, 1127, 1124, 586, 1387, 1388, 1390, + /* 1740 */ 1391, 1392, 1393, 1872, 1870, 1123, 1122, 1590, 1904, 324, + /* 1750 */ 1585, 497, 157, 1871, 1873, 598, 1875, 1876, 593, 325, + /* 1760 */ 588, 1583, 326, 500, 1564, 502, 1563, 504, 1562, 1872, + /* 1770 */ 506, 99, 1890, 1300, 1812, 1806, 25, 53, 1290, 515, + /* 1780 */ 595, 151, 223, 516, 1794, 1840, 1872, 594, 1792, 2030, + /* 1790 */ 521, 1793, 1791, 1790, 1298, 327, 228, 529, 1890, 18, + /* 1800 */ 1788, 532, 234, 329, 568, 2046, 595, 82, 1870, 1780, + /* 1810 */ 83, 1840, 1904, 594, 236, 1890, 98, 1871, 1873, 598, + /* 1820 */ 1875, 1876, 593, 592, 588, 85, 90, 239, 1840, 1406, + /* 1830 */ 594, 1957, 19, 20, 1870, 15, 1954, 1405, 1904, 1872, + /* 1840 */ 27, 56, 299, 1871, 1873, 598, 1875, 1876, 593, 1502, + /* 1850 */ 588, 1870, 242, 250, 246, 1904, 1872, 244, 1484, 298, + /* 1860 */ 1871, 1873, 598, 1875, 1876, 593, 159, 588, 1890, 1923, + /* 1870 */ 10, 1486, 249, 28, 251, 1479, 595, 1861, 29, 89, + /* 1880 */ 61, 1840, 1522, 594, 22, 1890, 1517, 1516, 337, 1523, + /* 1890 */ 21, 16, 1521, 595, 1520, 338, 1454, 1453, 1840, 54, + /* 1900 */ 594, 263, 1860, 1332, 1870, 55, 1907, 162, 1904, 1416, + /* 1910 */ 12, 1872, 156, 1871, 1873, 598, 1875, 1876, 593, 1384, + /* 1920 */ 588, 1870, 1382, 587, 35, 1904, 163, 1381, 1872, 294, + /* 1930 */ 1871, 1873, 598, 1875, 1876, 593, 14, 588, 23, 174, + /* 1940 */ 1890, 1356, 1364, 24, 597, 599, 601, 348, 595, 1191, + /* 1950 */ 605, 608, 603, 1840, 1995, 594, 611, 1890, 1188, 606, + /* 1960 */ 614, 1185, 344, 609, 612, 595, 1179, 1177, 615, 1168, + /* 1970 */ 1840, 1200, 594, 563, 621, 267, 1870, 91, 92, 1872, + /* 1980 */ 1904, 67, 1183, 1196, 157, 1871, 1873, 598, 1875, 1876, + /* 1990 */ 593, 1182, 588, 1870, 1181, 1084, 1180, 1904, 1872, 630, + /* 2000 */ 1119, 299, 1871, 1873, 598, 1875, 1876, 593, 1890, 588, + /* 2010 */ 1118, 1117, 1116, 347, 1115, 1114, 595, 1112, 1110, 1109, + /* 2020 */ 1108, 1840, 642, 594, 1135, 1106, 1105, 1890, 1104, 268, + /* 2030 */ 1103, 1102, 1101, 1100, 1099, 595, 1132, 2047, 1130, 1096, + /* 2040 */ 1840, 1090, 594, 1095, 1870, 1092, 1091, 1089, 1904, 1597, + /* 2050 */ 663, 1595, 299, 1871, 1873, 598, 1875, 1876, 593, 1872, + /* 2060 */ 588, 665, 667, 509, 664, 668, 1593, 1904, 669, 671, + /* 2070 */ 672, 292, 1871, 1873, 598, 1875, 1876, 593, 673, 588, + /* 2080 */ 1591, 675, 676, 677, 1579, 679, 1561, 1046, 1890, 271, + /* 2090 */ 683, 1536, 1318, 279, 686, 687, 595, 1536, 1536, 1536, + /* 2100 */ 1536, 1840, 1536, 594, 1536, 1536, 1536, 1536, 1536, 1536, + /* 2110 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1872, 1536, 1536, + /* 2120 */ 1536, 1536, 1536, 1536, 1870, 1536, 1536, 1536, 1904, 1536, + /* 2130 */ 1536, 1536, 284, 1871, 1873, 598, 1875, 1876, 593, 1872, + /* 2140 */ 588, 1536, 1536, 1536, 1536, 1536, 1890, 1536, 1536, 1536, + /* 2150 */ 1536, 1536, 1536, 1536, 595, 1536, 1536, 1536, 1536, 1840, + /* 2160 */ 1536, 594, 1536, 1536, 1536, 1536, 1536, 1536, 1890, 1536, + /* 2170 */ 1536, 1536, 1536, 1536, 1536, 1536, 595, 1536, 1536, 1536, + /* 2180 */ 1536, 1840, 1870, 594, 1536, 1536, 1904, 1536, 1536, 1536, + /* 2190 */ 285, 1871, 1873, 598, 1875, 1876, 593, 1536, 588, 1536, + /* 2200 */ 1872, 1536, 1536, 1536, 1870, 1536, 1536, 1536, 1904, 1536, + /* 2210 */ 1536, 1536, 286, 1871, 1873, 598, 1875, 1876, 593, 1872, + /* 2220 */ 588, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1890, + /* 2230 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 595, 1536, 1536, + /* 2240 */ 1536, 1536, 1840, 1536, 594, 1536, 1536, 1536, 1890, 1536, + /* 2250 */ 1536, 1536, 1536, 1536, 1536, 1536, 595, 1536, 1536, 1536, + /* 2260 */ 1536, 1840, 1536, 594, 1536, 1870, 1536, 1536, 1536, 1904, + /* 2270 */ 1536, 1536, 1872, 293, 1871, 1873, 598, 1875, 1876, 593, + /* 2280 */ 1536, 588, 1536, 1536, 1870, 1536, 1536, 1536, 1904, 1872, + /* 2290 */ 1536, 1536, 295, 1871, 1873, 598, 1875, 1876, 593, 1536, + /* 2300 */ 588, 1890, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 595, + /* 2310 */ 1536, 1536, 1536, 1536, 1840, 1536, 594, 1536, 1890, 1536, + /* 2320 */ 1536, 1536, 1536, 1536, 1536, 1536, 595, 1536, 1536, 1536, + /* 2330 */ 1536, 1840, 1872, 594, 1536, 1536, 1536, 1870, 1536, 1536, + /* 2340 */ 1536, 1904, 1536, 1536, 1536, 287, 1871, 1873, 598, 1875, + /* 2350 */ 1876, 593, 1536, 588, 1870, 1536, 1872, 1536, 1904, 1536, + /* 2360 */ 1536, 1890, 296, 1871, 1873, 598, 1875, 1876, 593, 595, + /* 2370 */ 588, 1536, 1536, 1536, 1840, 1872, 594, 1536, 1536, 1536, + /* 2380 */ 1536, 1536, 1536, 1536, 1536, 1890, 1536, 1536, 1536, 1536, + /* 2390 */ 1536, 1536, 1536, 595, 1536, 1536, 1536, 1870, 1840, 1536, + /* 2400 */ 594, 1904, 1536, 1536, 1890, 288, 1871, 1873, 598, 1875, + /* 2410 */ 1876, 593, 595, 588, 1536, 1536, 1536, 1840, 1536, 594, + /* 2420 */ 1536, 1870, 1536, 1536, 1536, 1904, 1536, 1536, 1536, 297, + /* 2430 */ 1871, 1873, 598, 1875, 1876, 593, 1872, 588, 1536, 1536, + /* 2440 */ 1870, 1536, 1536, 1536, 1904, 1536, 1536, 1536, 289, 1871, + /* 2450 */ 1873, 598, 1875, 1876, 593, 1872, 588, 1536, 1536, 1536, + /* 2460 */ 1536, 1536, 1536, 1536, 1536, 1890, 1536, 1536, 1536, 1536, + /* 2470 */ 1536, 1536, 1536, 595, 1536, 1536, 1536, 1536, 1840, 1536, + /* 2480 */ 594, 1536, 1536, 1536, 1890, 1536, 1536, 1536, 1536, 1536, + /* 2490 */ 1536, 1536, 595, 1536, 1536, 1536, 1536, 1840, 1536, 594, + /* 2500 */ 1536, 1870, 1536, 1536, 1536, 1904, 1536, 1536, 1536, 302, + /* 2510 */ 1871, 1873, 598, 1875, 1876, 593, 1536, 588, 1536, 1872, + /* 2520 */ 1870, 1536, 1536, 1536, 1904, 1536, 1536, 1536, 303, 1871, + /* 2530 */ 1873, 598, 1875, 1876, 593, 1536, 588, 1872, 1536, 1536, + /* 2540 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1890, 1536, + /* 2550 */ 1536, 1536, 1536, 1536, 1536, 1536, 595, 1536, 1536, 1536, + /* 2560 */ 1536, 1840, 1536, 594, 1536, 1536, 1890, 1536, 1536, 1536, + /* 2570 */ 1536, 1536, 1536, 1536, 595, 1536, 1536, 1536, 1536, 1840, + /* 2580 */ 1872, 594, 1536, 1536, 1870, 1536, 1536, 1536, 1904, 1536, + /* 2590 */ 1536, 1536, 1884, 1871, 1873, 598, 1875, 1876, 593, 1536, + /* 2600 */ 588, 1536, 1870, 1536, 1536, 1536, 1904, 1536, 1536, 1890, + /* 2610 */ 1883, 1871, 1873, 598, 1875, 1876, 593, 595, 588, 1536, + /* 2620 */ 1536, 1536, 1840, 1536, 594, 1536, 1536, 1536, 1536, 1536, + /* 2630 */ 1536, 1536, 1536, 1872, 1536, 1536, 1536, 1536, 1536, 1536, + /* 2640 */ 1536, 1536, 1536, 1536, 1536, 1870, 1536, 1536, 1536, 1904, + /* 2650 */ 1872, 1536, 1536, 1882, 1871, 1873, 598, 1875, 1876, 593, + /* 2660 */ 1536, 588, 1890, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 2670 */ 595, 1536, 1536, 1536, 1536, 1840, 1536, 594, 1536, 1890, + /* 2680 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 595, 1536, 1536, + /* 2690 */ 1536, 1536, 1840, 1872, 594, 1536, 1536, 1536, 1870, 1536, + /* 2700 */ 1536, 1536, 1904, 1536, 1536, 1536, 314, 1871, 1873, 598, + /* 2710 */ 1875, 1876, 593, 1536, 588, 1870, 1536, 1872, 1536, 1904, + /* 2720 */ 1536, 1536, 1890, 315, 1871, 1873, 598, 1875, 1876, 593, + /* 2730 */ 595, 588, 1536, 1536, 1536, 1840, 1872, 594, 1536, 1536, + /* 2740 */ 1536, 1536, 1536, 1536, 1536, 1536, 1890, 1536, 1536, 1536, + /* 2750 */ 1536, 1536, 1536, 1536, 595, 1536, 1536, 1536, 1870, 1840, + /* 2760 */ 1536, 594, 1904, 1536, 1536, 1890, 311, 1871, 1873, 598, + /* 2770 */ 1875, 1876, 593, 595, 588, 1536, 1536, 1536, 1840, 1536, + /* 2780 */ 594, 1536, 1870, 1536, 1536, 1536, 1904, 1536, 1536, 1536, + /* 2790 */ 316, 1871, 1873, 598, 1875, 1876, 593, 1536, 588, 1536, + /* 2800 */ 1536, 1870, 1536, 1536, 1536, 1904, 1536, 1536, 1536, 291, + /* 2810 */ 1871, 1873, 598, 1875, 1876, 593, 1536, 588, }; 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 */ 349, 318, 322, 349, 324, 325, 322, 318, 324, 325, + /* 10 */ 349, 360, 12, 13, 360, 358, 1, 2, 361, 362, + /* 20 */ 20, 360, 22, 12, 13, 14, 15, 16, 20, 3, + /* 30 */ 317, 330, 319, 33, 4, 35, 347, 386, 387, 388, + /* 40 */ 386, 387, 388, 360, 355, 344, 20, 386, 387, 360, + /* 50 */ 399, 362, 2, 399, 353, 403, 56, 405, 8, 9, + /* 60 */ 399, 61, 12, 13, 14, 15, 16, 318, 68, 12, + /* 70 */ 13, 14, 383, 20, 44, 45, 387, 20, 392, 22, + /* 80 */ 391, 392, 393, 394, 395, 396, 397, 20, 399, 22, + /* 90 */ 33, 4, 35, 404, 94, 406, 347, 407, 408, 410, + /* 100 */ 411, 346, 35, 20, 355, 326, 20, 421, 347, 360, + /* 110 */ 95, 362, 423, 56, 359, 354, 116, 50, 61, 362, + /* 120 */ 431, 95, 436, 437, 363, 68, 369, 441, 442, 372, + /* 130 */ 130, 131, 383, 60, 355, 56, 387, 0, 130, 131, + /* 140 */ 391, 392, 393, 394, 395, 396, 397, 94, 399, 347, + /* 150 */ 323, 94, 20, 326, 22, 406, 94, 355, 21, 410, + /* 160 */ 411, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 170 */ 421, 392, 93, 116, 389, 96, 176, 94, 178, 94, + /* 180 */ 94, 94, 50, 39, 318, 436, 437, 130, 131, 163, + /* 190 */ 441, 442, 413, 414, 415, 416, 394, 418, 361, 362, + /* 200 */ 200, 201, 417, 203, 204, 205, 206, 207, 208, 209, + /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + /* 220 */ 220, 221, 33, 0, 8, 9, 360, 20, 12, 13, + /* 230 */ 14, 15, 16, 176, 20, 178, 47, 125, 126, 239, + /* 240 */ 14, 52, 53, 54, 55, 56, 20, 24, 25, 26, + /* 250 */ 27, 28, 29, 30, 31, 32, 326, 200, 201, 43, + /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + /* 270 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 12, + /* 280 */ 13, 106, 93, 330, 349, 96, 94, 20, 318, 22, + /* 290 */ 323, 200, 239, 326, 364, 360, 184, 106, 326, 187, + /* 300 */ 33, 239, 35, 128, 21, 126, 353, 24, 25, 26, + /* 310 */ 27, 28, 29, 30, 31, 32, 125, 126, 127, 128, + /* 320 */ 129, 386, 387, 56, 239, 239, 239, 355, 61, 392, + /* 330 */ 360, 318, 56, 20, 399, 68, 12, 13, 347, 248, + /* 340 */ 249, 250, 251, 252, 20, 354, 22, 326, 159, 160, + /* 350 */ 14, 162, 20, 318, 363, 166, 20, 33, 421, 35, + /* 360 */ 347, 94, 183, 184, 392, 326, 187, 175, 355, 177, + /* 370 */ 94, 182, 96, 360, 437, 362, 355, 338, 441, 442, + /* 380 */ 56, 171, 238, 116, 345, 61, 414, 415, 416, 43, + /* 390 */ 418, 0, 68, 14, 355, 360, 383, 130, 131, 20, + /* 400 */ 387, 191, 192, 22, 391, 392, 393, 394, 395, 396, + /* 410 */ 397, 318, 399, 392, 60, 161, 35, 404, 94, 406, + /* 420 */ 105, 8, 9, 410, 411, 12, 13, 14, 15, 16, + /* 430 */ 204, 239, 223, 20, 225, 414, 415, 416, 78, 418, + /* 440 */ 116, 95, 421, 176, 431, 178, 0, 340, 339, 68, + /* 450 */ 343, 60, 339, 360, 130, 131, 347, 436, 437, 0, + /* 460 */ 347, 318, 441, 442, 403, 356, 405, 200, 201, 356, + /* 470 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + /* 480 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 125, + /* 490 */ 223, 14, 15, 16, 134, 135, 20, 116, 244, 245, + /* 500 */ 176, 37, 178, 360, 107, 108, 109, 110, 111, 112, + /* 510 */ 113, 114, 115, 116, 117, 239, 119, 120, 121, 122, + /* 520 */ 123, 124, 35, 0, 200, 201, 318, 203, 204, 205, + /* 530 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + /* 540 */ 216, 217, 218, 219, 220, 221, 12, 13, 326, 185, + /* 550 */ 186, 392, 106, 223, 20, 68, 22, 176, 68, 178, + /* 560 */ 338, 97, 20, 99, 100, 106, 102, 33, 360, 35, + /* 570 */ 106, 125, 126, 127, 128, 129, 163, 355, 21, 318, + /* 580 */ 421, 200, 201, 204, 125, 126, 127, 128, 129, 339, + /* 590 */ 56, 34, 128, 36, 331, 20, 437, 347, 318, 336, + /* 600 */ 441, 442, 68, 12, 13, 14, 356, 326, 347, 0, + /* 610 */ 371, 20, 373, 22, 68, 328, 355, 333, 334, 338, + /* 620 */ 318, 360, 326, 362, 33, 347, 35, 347, 94, 342, + /* 630 */ 333, 334, 354, 158, 338, 355, 355, 350, 318, 318, + /* 640 */ 360, 363, 362, 402, 383, 318, 405, 56, 387, 326, + /* 650 */ 116, 355, 391, 392, 393, 394, 395, 396, 397, 68, + /* 660 */ 399, 338, 360, 383, 130, 131, 318, 387, 345, 60, + /* 670 */ 392, 391, 392, 393, 394, 395, 396, 397, 355, 399, + /* 680 */ 360, 360, 421, 318, 404, 94, 406, 360, 8, 9, + /* 690 */ 410, 411, 12, 13, 14, 15, 16, 436, 437, 421, + /* 700 */ 420, 226, 441, 442, 326, 163, 20, 116, 360, 347, + /* 710 */ 176, 236, 178, 43, 436, 437, 338, 2, 356, 441, + /* 720 */ 442, 130, 131, 8, 9, 360, 4, 12, 13, 14, + /* 730 */ 15, 16, 318, 355, 200, 201, 318, 203, 204, 205, + /* 740 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + /* 750 */ 216, 217, 218, 219, 220, 221, 326, 8, 9, 389, + /* 760 */ 315, 12, 13, 14, 15, 16, 379, 176, 338, 178, + /* 770 */ 371, 328, 373, 239, 360, 95, 8, 9, 360, 204, + /* 780 */ 12, 13, 14, 15, 16, 355, 318, 417, 318, 389, + /* 790 */ 318, 200, 201, 350, 203, 204, 205, 206, 207, 208, + /* 800 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + /* 810 */ 219, 220, 221, 12, 13, 355, 4, 417, 44, 45, + /* 820 */ 375, 20, 355, 22, 237, 238, 366, 326, 360, 326, + /* 830 */ 360, 19, 360, 366, 33, 326, 35, 392, 326, 338, + /* 840 */ 3, 338, 362, 326, 95, 33, 318, 338, 326, 163, + /* 850 */ 338, 357, 372, 35, 360, 338, 355, 56, 355, 47, + /* 860 */ 338, 318, 348, 51, 355, 318, 421, 355, 56, 68, + /* 870 */ 12, 13, 355, 347, 319, 347, 357, 355, 20, 360, + /* 880 */ 22, 436, 437, 355, 326, 43, 441, 442, 360, 363, + /* 890 */ 362, 33, 3, 35, 347, 94, 338, 335, 0, 337, + /* 900 */ 326, 348, 355, 360, 326, 93, 326, 360, 96, 362, + /* 910 */ 43, 383, 338, 355, 56, 387, 338, 116, 338, 391, + /* 920 */ 392, 393, 394, 395, 396, 397, 68, 399, 258, 355, + /* 930 */ 383, 130, 131, 355, 387, 355, 168, 95, 391, 392, + /* 940 */ 393, 394, 395, 396, 397, 47, 399, 64, 65, 42, + /* 950 */ 43, 404, 94, 406, 71, 22, 340, 410, 411, 343, + /* 960 */ 432, 433, 240, 0, 336, 82, 83, 420, 35, 326, + /* 970 */ 98, 88, 98, 101, 116, 101, 61, 176, 375, 178, + /* 980 */ 375, 338, 163, 164, 95, 22, 8, 9, 130, 131, + /* 990 */ 12, 13, 14, 15, 16, 392, 178, 392, 355, 130, + /* 1000 */ 131, 200, 201, 348, 203, 204, 205, 206, 207, 208, + /* 1010 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + /* 1020 */ 219, 220, 221, 18, 421, 20, 421, 0, 0, 261, + /* 1030 */ 98, 326, 27, 101, 176, 30, 178, 1, 2, 436, + /* 1040 */ 437, 436, 437, 338, 441, 442, 441, 442, 98, 22, + /* 1050 */ 22, 101, 47, 43, 49, 56, 51, 348, 200, 201, + /* 1060 */ 355, 203, 204, 205, 206, 207, 208, 209, 210, 211, + /* 1070 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + /* 1080 */ 8, 9, 43, 43, 12, 13, 14, 15, 16, 18, + /* 1090 */ 326, 326, 13, 256, 23, 96, 94, 390, 93, 348, + /* 1100 */ 13, 348, 338, 338, 35, 95, 104, 43, 37, 38, + /* 1110 */ 105, 0, 41, 445, 35, 200, 43, 348, 43, 355, + /* 1120 */ 355, 43, 35, 46, 434, 327, 428, 260, 57, 58, + /* 1130 */ 59, 347, 327, 325, 95, 95, 359, 390, 133, 35, + /* 1140 */ 326, 136, 137, 138, 139, 140, 141, 142, 143, 144, + /* 1150 */ 145, 146, 147, 148, 149, 150, 151, 152, 153, 95, + /* 1160 */ 155, 156, 157, 43, 43, 94, 438, 43, 95, 355, + /* 1170 */ 95, 94, 68, 95, 63, 64, 65, 66, 67, 43, + /* 1180 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + /* 1190 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + /* 1200 */ 89, 90, 43, 132, 8, 9, 392, 0, 12, 13, + /* 1210 */ 14, 15, 16, 43, 318, 95, 95, 422, 419, 95, + /* 1220 */ 43, 412, 241, 385, 384, 47, 174, 377, 414, 415, + /* 1230 */ 416, 95, 418, 42, 20, 163, 326, 367, 326, 168, + /* 1240 */ 169, 170, 367, 347, 173, 365, 158, 178, 92, 332, + /* 1250 */ 365, 355, 326, 326, 95, 48, 360, 61, 362, 375, + /* 1260 */ 326, 190, 20, 320, 193, 95, 195, 196, 197, 198, + /* 1270 */ 199, 320, 95, 20, 381, 330, 392, 330, 362, 383, + /* 1280 */ 20, 20, 374, 387, 330, 376, 318, 391, 392, 393, + /* 1290 */ 394, 395, 396, 397, 374, 399, 330, 330, 402, 103, + /* 1300 */ 404, 405, 406, 330, 330, 421, 410, 411, 318, 326, + /* 1310 */ 239, 320, 347, 326, 320, 347, 347, 347, 347, 347, + /* 1320 */ 436, 437, 347, 355, 347, 441, 442, 0, 360, 347, + /* 1330 */ 362, 347, 347, 347, 189, 382, 360, 347, 381, 328, + /* 1340 */ 380, 181, 362, 328, 326, 355, 326, 328, 246, 360, + /* 1350 */ 360, 383, 362, 374, 158, 387, 360, 360, 370, 391, + /* 1360 */ 392, 393, 394, 395, 396, 397, 360, 399, 370, 360, + /* 1370 */ 160, 368, 404, 383, 406, 318, 328, 387, 410, 411, + /* 1380 */ 343, 391, 392, 393, 394, 395, 396, 397, 420, 399, + /* 1390 */ 328, 64, 65, 355, 404, 20, 406, 390, 71, 247, + /* 1400 */ 410, 411, 390, 360, 347, 370, 360, 360, 253, 82, + /* 1410 */ 83, 360, 355, 360, 370, 88, 375, 360, 167, 362, + /* 1420 */ 427, 429, 226, 227, 228, 229, 230, 231, 232, 233, + /* 1430 */ 234, 235, 236, 392, 430, 427, 255, 254, 262, 426, + /* 1440 */ 383, 427, 425, 242, 387, 424, 385, 318, 391, 392, + /* 1450 */ 393, 394, 395, 396, 397, 439, 399, 259, 238, 257, + /* 1460 */ 355, 404, 421, 406, 440, 20, 94, 410, 411, 446, + /* 1470 */ 389, 19, 409, 94, 351, 360, 347, 436, 437, 337, + /* 1480 */ 326, 328, 441, 442, 355, 33, 36, 321, 320, 360, + /* 1490 */ 378, 362, 373, 329, 0, 316, 0, 183, 341, 47, + /* 1500 */ 0, 0, 341, 341, 52, 53, 54, 55, 56, 42, + /* 1510 */ 0, 35, 383, 194, 35, 35, 387, 35, 194, 0, + /* 1520 */ 391, 392, 393, 394, 395, 396, 397, 35, 399, 318, + /* 1530 */ 35, 194, 0, 404, 194, 406, 12, 13, 35, 410, + /* 1540 */ 411, 0, 0, 0, 22, 93, 22, 35, 96, 178, + /* 1550 */ 176, 0, 0, 172, 171, 0, 0, 33, 347, 35, + /* 1560 */ 46, 0, 0, 0, 0, 42, 355, 0, 0, 375, + /* 1570 */ 154, 360, 0, 362, 0, 0, 0, 0, 149, 35, + /* 1580 */ 56, 129, 0, 318, 149, 0, 392, 0, 0, 0, + /* 1590 */ 0, 0, 68, 22, 383, 0, 0, 0, 387, 0, + /* 1600 */ 0, 0, 391, 392, 393, 394, 395, 396, 397, 318, + /* 1610 */ 399, 0, 347, 0, 162, 421, 0, 406, 0, 0, + /* 1620 */ 355, 410, 411, 42, 0, 360, 0, 362, 0, 0, + /* 1630 */ 436, 437, 180, 0, 182, 441, 442, 0, 347, 0, + /* 1640 */ 116, 35, 0, 0, 0, 0, 355, 42, 383, 14, + /* 1650 */ 56, 360, 387, 362, 56, 43, 391, 392, 393, 394, + /* 1660 */ 395, 396, 397, 46, 399, 14, 39, 46, 0, 0, + /* 1670 */ 40, 406, 0, 39, 383, 410, 411, 0, 387, 318, + /* 1680 */ 39, 0, 391, 392, 393, 394, 395, 396, 397, 398, + /* 1690 */ 399, 400, 401, 167, 0, 0, 0, 0, 62, 35, + /* 1700 */ 176, 47, 178, 0, 39, 35, 47, 0, 347, 35, + /* 1710 */ 39, 0, 39, 47, 35, 39, 355, 0, 0, 0, + /* 1720 */ 0, 360, 47, 362, 200, 201, 103, 35, 22, 0, + /* 1730 */ 43, 43, 101, 35, 35, 35, 212, 213, 214, 215, + /* 1740 */ 216, 217, 218, 318, 383, 35, 22, 0, 387, 22, + /* 1750 */ 0, 49, 391, 392, 393, 394, 395, 396, 397, 22, + /* 1760 */ 399, 0, 22, 35, 0, 35, 0, 35, 0, 318, + /* 1770 */ 22, 20, 347, 95, 0, 0, 94, 163, 35, 22, + /* 1780 */ 355, 179, 160, 163, 0, 360, 318, 362, 0, 3, + /* 1790 */ 165, 0, 0, 0, 35, 163, 95, 188, 347, 94, + /* 1800 */ 0, 161, 94, 352, 443, 444, 355, 94, 383, 0, + /* 1810 */ 39, 360, 387, 362, 159, 347, 391, 392, 393, 394, + /* 1820 */ 395, 396, 397, 355, 399, 94, 104, 46, 360, 222, + /* 1830 */ 362, 406, 43, 43, 383, 243, 411, 222, 387, 318, + /* 1840 */ 94, 43, 391, 392, 393, 394, 395, 396, 397, 95, + /* 1850 */ 399, 383, 94, 43, 94, 387, 318, 95, 95, 391, + /* 1860 */ 392, 393, 394, 395, 396, 397, 94, 399, 347, 401, + /* 1870 */ 224, 95, 94, 94, 46, 95, 355, 46, 43, 94, + /* 1880 */ 3, 360, 95, 362, 43, 347, 35, 35, 35, 95, + /* 1890 */ 243, 243, 35, 355, 35, 35, 95, 95, 360, 237, + /* 1900 */ 362, 46, 46, 22, 383, 43, 94, 46, 387, 200, + /* 1910 */ 2, 318, 391, 392, 393, 394, 395, 396, 397, 95, + /* 1920 */ 399, 383, 95, 94, 94, 387, 46, 95, 318, 391, + /* 1930 */ 392, 393, 394, 395, 396, 397, 94, 399, 94, 46, + /* 1940 */ 347, 95, 22, 94, 202, 105, 35, 35, 355, 95, + /* 1950 */ 35, 35, 94, 360, 433, 362, 35, 347, 95, 94, + /* 1960 */ 35, 95, 352, 94, 94, 355, 95, 95, 94, 22, + /* 1970 */ 360, 35, 362, 435, 106, 43, 383, 94, 94, 318, + /* 1980 */ 387, 94, 118, 22, 391, 392, 393, 394, 395, 396, + /* 1990 */ 397, 118, 399, 383, 118, 62, 118, 387, 318, 61, + /* 2000 */ 35, 391, 392, 393, 394, 395, 396, 397, 347, 399, + /* 2010 */ 35, 35, 35, 352, 35, 35, 355, 35, 35, 35, + /* 2020 */ 35, 360, 91, 362, 68, 35, 35, 347, 22, 43, + /* 2030 */ 35, 22, 35, 35, 35, 355, 68, 444, 35, 35, + /* 2040 */ 360, 22, 362, 35, 383, 35, 35, 35, 387, 0, + /* 2050 */ 35, 0, 391, 392, 393, 394, 395, 396, 397, 318, + /* 2060 */ 399, 39, 35, 383, 47, 47, 0, 387, 39, 35, + /* 2070 */ 47, 391, 392, 393, 394, 395, 396, 397, 39, 399, + /* 2080 */ 0, 35, 47, 39, 0, 35, 0, 35, 347, 22, + /* 2090 */ 21, 447, 22, 22, 21, 20, 355, 447, 447, 447, + /* 2100 */ 447, 360, 447, 362, 447, 447, 447, 447, 447, 447, + /* 2110 */ 447, 447, 447, 447, 447, 447, 447, 318, 447, 447, + /* 2120 */ 447, 447, 447, 447, 383, 447, 447, 447, 387, 447, + /* 2130 */ 447, 447, 391, 392, 393, 394, 395, 396, 397, 318, + /* 2140 */ 399, 447, 447, 447, 447, 447, 347, 447, 447, 447, + /* 2150 */ 447, 447, 447, 447, 355, 447, 447, 447, 447, 360, + /* 2160 */ 447, 362, 447, 447, 447, 447, 447, 447, 347, 447, + /* 2170 */ 447, 447, 447, 447, 447, 447, 355, 447, 447, 447, + /* 2180 */ 447, 360, 383, 362, 447, 447, 387, 447, 447, 447, + /* 2190 */ 391, 392, 393, 394, 395, 396, 397, 447, 399, 447, + /* 2200 */ 318, 447, 447, 447, 383, 447, 447, 447, 387, 447, + /* 2210 */ 447, 447, 391, 392, 393, 394, 395, 396, 397, 318, + /* 2220 */ 399, 447, 447, 447, 447, 447, 447, 447, 447, 347, + /* 2230 */ 447, 447, 447, 447, 447, 447, 447, 355, 447, 447, + /* 2240 */ 447, 447, 360, 447, 362, 447, 447, 447, 347, 447, + /* 2250 */ 447, 447, 447, 447, 447, 447, 355, 447, 447, 447, + /* 2260 */ 447, 360, 447, 362, 447, 383, 447, 447, 447, 387, + /* 2270 */ 447, 447, 318, 391, 392, 393, 394, 395, 396, 397, + /* 2280 */ 447, 399, 447, 447, 383, 447, 447, 447, 387, 318, + /* 2290 */ 447, 447, 391, 392, 393, 394, 395, 396, 397, 447, + /* 2300 */ 399, 347, 447, 447, 447, 447, 447, 447, 447, 355, + /* 2310 */ 447, 447, 447, 447, 360, 447, 362, 447, 347, 447, + /* 2320 */ 447, 447, 447, 447, 447, 447, 355, 447, 447, 447, + /* 2330 */ 447, 360, 318, 362, 447, 447, 447, 383, 447, 447, + /* 2340 */ 447, 387, 447, 447, 447, 391, 392, 393, 394, 395, + /* 2350 */ 396, 397, 447, 399, 383, 447, 318, 447, 387, 447, + /* 2360 */ 447, 347, 391, 392, 393, 394, 395, 396, 397, 355, + /* 2370 */ 399, 447, 447, 447, 360, 318, 362, 447, 447, 447, + /* 2380 */ 447, 447, 447, 447, 447, 347, 447, 447, 447, 447, + /* 2390 */ 447, 447, 447, 355, 447, 447, 447, 383, 360, 447, + /* 2400 */ 362, 387, 447, 447, 347, 391, 392, 393, 394, 395, + /* 2410 */ 396, 397, 355, 399, 447, 447, 447, 360, 447, 362, + /* 2420 */ 447, 383, 447, 447, 447, 387, 447, 447, 447, 391, + /* 2430 */ 392, 393, 394, 395, 396, 397, 318, 399, 447, 447, + /* 2440 */ 383, 447, 447, 447, 387, 447, 447, 447, 391, 392, + /* 2450 */ 393, 394, 395, 396, 397, 318, 399, 447, 447, 447, + /* 2460 */ 447, 447, 447, 447, 447, 347, 447, 447, 447, 447, + /* 2470 */ 447, 447, 447, 355, 447, 447, 447, 447, 360, 447, + /* 2480 */ 362, 447, 447, 447, 347, 447, 447, 447, 447, 447, + /* 2490 */ 447, 447, 355, 447, 447, 447, 447, 360, 447, 362, + /* 2500 */ 447, 383, 447, 447, 447, 387, 447, 447, 447, 391, + /* 2510 */ 392, 393, 394, 395, 396, 397, 447, 399, 447, 318, + /* 2520 */ 383, 447, 447, 447, 387, 447, 447, 447, 391, 392, + /* 2530 */ 393, 394, 395, 396, 397, 447, 399, 318, 447, 447, + /* 2540 */ 447, 447, 447, 447, 447, 447, 447, 447, 347, 447, + /* 2550 */ 447, 447, 447, 447, 447, 447, 355, 447, 447, 447, + /* 2560 */ 447, 360, 447, 362, 447, 447, 347, 447, 447, 447, + /* 2570 */ 447, 447, 447, 447, 355, 447, 447, 447, 447, 360, + /* 2580 */ 318, 362, 447, 447, 383, 447, 447, 447, 387, 447, + /* 2590 */ 447, 447, 391, 392, 393, 394, 395, 396, 397, 447, + /* 2600 */ 399, 447, 383, 447, 447, 447, 387, 447, 447, 347, + /* 2610 */ 391, 392, 393, 394, 395, 396, 397, 355, 399, 447, + /* 2620 */ 447, 447, 360, 447, 362, 447, 447, 447, 447, 447, + /* 2630 */ 447, 447, 447, 318, 447, 447, 447, 447, 447, 447, + /* 2640 */ 447, 447, 447, 447, 447, 383, 447, 447, 447, 387, + /* 2650 */ 318, 447, 447, 391, 392, 393, 394, 395, 396, 397, + /* 2660 */ 447, 399, 347, 447, 447, 447, 447, 447, 447, 447, + /* 2670 */ 355, 447, 447, 447, 447, 360, 447, 362, 447, 347, + /* 2680 */ 447, 447, 447, 447, 447, 447, 447, 355, 447, 447, + /* 2690 */ 447, 447, 360, 318, 362, 447, 447, 447, 383, 447, + /* 2700 */ 447, 447, 387, 447, 447, 447, 391, 392, 393, 394, + /* 2710 */ 395, 396, 397, 447, 399, 383, 447, 318, 447, 387, + /* 2720 */ 447, 447, 347, 391, 392, 393, 394, 395, 396, 397, + /* 2730 */ 355, 399, 447, 447, 447, 360, 318, 362, 447, 447, + /* 2740 */ 447, 447, 447, 447, 447, 447, 347, 447, 447, 447, + /* 2750 */ 447, 447, 447, 447, 355, 447, 447, 447, 383, 360, + /* 2760 */ 447, 362, 387, 447, 447, 347, 391, 392, 393, 394, + /* 2770 */ 395, 396, 397, 355, 399, 447, 447, 447, 360, 447, + /* 2780 */ 362, 447, 383, 447, 447, 447, 387, 447, 447, 447, + /* 2790 */ 391, 392, 393, 394, 395, 396, 397, 447, 399, 447, + /* 2800 */ 447, 383, 447, 447, 447, 387, 447, 447, 447, 391, + /* 2810 */ 392, 393, 394, 395, 396, 397, 447, 399, }; -#define YY_SHIFT_COUNT (667) +#define YY_SHIFT_COUNT (688) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2107) +#define YY_SHIFT_MAX (2086) 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 */ 1071, 0, 57, 267, 57, 324, 324, 324, 534, 324, + /* 10 */ 324, 324, 324, 324, 591, 801, 801, 858, 801, 801, + /* 20 */ 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, + /* 30 */ 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, + /* 40 */ 801, 801, 801, 801, 801, 801, 53, 86, 83, 192, + /* 50 */ 276, 62, 85, 62, 83, 83, 1524, 1524, 62, 1524, + /* 60 */ 1524, 87, 62, 207, 207, 30, 30, 8, 207, 207, + /* 70 */ 207, 207, 207, 207, 207, 207, 207, 207, 73, 207, + /* 80 */ 207, 207, 214, 207, 207, 313, 207, 207, 313, 332, + /* 90 */ 207, 313, 313, 313, 207, 354, 1005, 1196, 1196, 283, + /* 100 */ 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, + /* 110 */ 381, 381, 381, 381, 381, 381, 381, 381, 381, 464, + /* 120 */ 883, 26, 8, 336, 336, 391, 487, 609, 209, 209, + /* 130 */ 542, 542, 542, 487, 476, 476, 315, 214, 523, 523, + /* 140 */ 330, 313, 313, 490, 490, 315, 546, 397, 397, 397, + /* 150 */ 397, 397, 397, 397, 1452, 137, 413, 768, 1327, 91, + /* 160 */ 67, 254, 226, 379, 132, 774, 175, 686, 587, 144, + /* 170 */ 837, 587, 907, 722, 575, 981, 1178, 1052, 1191, 1214, + /* 180 */ 1214, 1191, 1088, 1088, 1156, 1214, 1214, 1214, 1242, 1242, + /* 190 */ 1253, 73, 214, 73, 1260, 1261, 73, 1260, 73, 73, + /* 200 */ 73, 1214, 73, 1242, 313, 313, 313, 313, 313, 313, + /* 210 */ 313, 313, 313, 313, 313, 1214, 1242, 490, 1145, 1253, + /* 220 */ 354, 1160, 214, 354, 1214, 1214, 1260, 354, 1102, 490, + /* 230 */ 490, 490, 490, 1102, 490, 1210, 354, 315, 354, 476, + /* 240 */ 1375, 1375, 490, 1152, 1102, 490, 490, 1152, 1102, 490, + /* 250 */ 490, 313, 1155, 1251, 1152, 1181, 1183, 1201, 981, 1176, + /* 260 */ 1198, 1202, 1220, 476, 1445, 1372, 1379, 490, 546, 1214, + /* 270 */ 354, 1450, 1242, 2818, 2818, 2818, 2818, 2818, 2818, 2818, + /* 280 */ 1111, 189, 223, 812, 680, 216, 749, 50, 715, 1072, + /* 290 */ 446, 978, 978, 978, 978, 978, 978, 978, 978, 978, + /* 300 */ 459, 191, 11, 11, 179, 112, 210, 79, 360, 557, + /* 310 */ 364, 477, 15, 475, 477, 477, 477, 346, 898, 933, + /* 320 */ 872, 874, 932, 950, 963, 1027, 1028, 999, 819, 842, + /* 330 */ 1010, 1040, 1064, 1073, 1075, 1078, 869, 670, 867, 1036, + /* 340 */ 1039, 818, 1069, 915, 1120, 889, 1077, 1121, 1124, 1136, + /* 350 */ 1159, 1170, 1177, 1002, 1079, 1087, 1104, 1207, 1494, 1496, + /* 360 */ 1314, 1500, 1501, 1467, 1510, 1476, 1319, 1479, 1480, 1482, + /* 370 */ 1324, 1519, 1492, 1495, 1337, 1532, 1340, 1541, 1503, 1542, + /* 380 */ 1522, 1543, 1512, 1371, 1374, 1551, 1552, 1381, 1383, 1555, + /* 390 */ 1556, 1514, 1561, 1562, 1563, 1523, 1564, 1567, 1568, 1416, + /* 400 */ 1572, 1574, 1575, 1576, 1577, 1429, 1544, 1582, 1435, 1585, + /* 410 */ 1587, 1588, 1589, 1590, 1591, 1595, 1596, 1597, 1599, 1600, + /* 420 */ 1601, 1611, 1613, 1581, 1616, 1618, 1619, 1624, 1626, 1628, + /* 430 */ 1571, 1629, 1633, 1637, 1639, 1606, 1642, 1594, 1643, 1598, + /* 440 */ 1644, 1645, 1605, 1627, 1612, 1635, 1617, 1651, 1621, 1668, + /* 450 */ 1630, 1634, 1669, 1672, 1677, 1641, 1526, 1681, 1694, 1695, + /* 460 */ 1636, 1696, 1697, 1664, 1654, 1665, 1703, 1670, 1659, 1671, + /* 470 */ 1707, 1674, 1666, 1673, 1711, 1679, 1675, 1676, 1717, 1718, + /* 480 */ 1719, 1720, 1623, 1631, 1692, 1706, 1729, 1698, 1699, 1687, + /* 490 */ 1688, 1700, 1710, 1724, 1747, 1727, 1750, 1737, 1702, 1761, + /* 500 */ 1740, 1728, 1764, 1730, 1766, 1732, 1768, 1748, 1751, 1678, + /* 510 */ 1682, 1774, 1614, 1743, 1775, 1602, 1757, 1620, 1622, 1784, + /* 520 */ 1788, 1632, 1625, 1786, 1791, 1792, 1793, 1705, 1701, 1759, + /* 530 */ 1609, 1800, 1708, 1640, 1713, 1809, 1771, 1655, 1731, 1722, + /* 540 */ 1781, 1789, 1607, 1646, 1615, 1790, 1592, 1746, 1754, 1758, + /* 550 */ 1762, 1763, 1760, 1798, 1776, 1772, 1778, 1779, 1780, 1810, + /* 560 */ 1828, 1831, 1785, 1835, 1647, 1787, 1794, 1877, 1841, 1648, + /* 570 */ 1851, 1852, 1853, 1857, 1859, 1860, 1801, 1802, 1855, 1662, + /* 580 */ 1862, 1856, 1861, 1908, 1881, 1709, 1812, 1824, 1829, 1827, + /* 590 */ 1830, 1832, 1880, 1842, 1844, 1893, 1846, 1920, 1742, 1849, + /* 600 */ 1840, 1854, 1911, 1912, 1858, 1863, 1915, 1865, 1866, 1916, + /* 610 */ 1869, 1871, 1921, 1870, 1872, 1925, 1874, 1864, 1873, 1876, + /* 620 */ 1878, 1947, 1868, 1883, 1884, 1936, 1887, 1932, 1932, 1961, + /* 630 */ 1933, 1938, 1965, 1975, 1976, 1977, 1979, 1980, 1982, 1983, + /* 640 */ 1984, 1985, 1956, 1931, 1986, 1990, 1991, 2006, 1995, 2009, + /* 650 */ 1997, 1998, 1999, 1968, 1687, 2003, 1688, 2004, 2008, 2010, + /* 660 */ 2011, 2019, 2012, 2049, 2015, 2017, 2022, 2051, 2027, 2018, + /* 670 */ 2029, 2066, 2034, 2023, 2039, 2080, 2046, 2035, 2044, 2084, + /* 680 */ 2050, 2052, 2086, 2067, 2069, 2070, 2071, 2073, 2075, }; -#define YY_REDUCE_COUNT (266) -#define YY_REDUCE_MIN (-383) -#define YY_REDUCE_MAX (1806) +#define YY_REDUCE_COUNT (279) +#define YY_REDUCE_MIN (-349) +#define YY_REDUCE_MAX (2418) 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 */ 445, -251, -311, 896, 13, 280, 547, 968, 261, 990, + /* 10 */ 1057, 1129, 1211, 1265, 1291, 528, 1361, 1425, 1451, 1468, + /* 20 */ 1521, 1538, 1593, 1610, 1661, 1680, 1741, 1799, 1821, 1882, + /* 30 */ 1901, 1954, 1971, 2014, 2038, 2057, 2118, 2137, 2201, 2219, + /* 40 */ 2262, 2315, 2332, 2375, 2399, 2418, 21, 278, -221, 603, + /* 50 */ 605, 884, 1041, 1194, -28, 814, -349, -346, -314, -339, + /* 60 */ -65, -63, 159, 39, 323, -320, -316, -343, 222, 281, + /* 70 */ 296, 378, 430, 501, 503, 509, 512, 517, -299, 522, + /* 80 */ 558, 574, -243, 578, 580, 113, 643, 705, -239, -198, + /* 90 */ 764, 109, -9, 250, 765, 287, -70, -310, -310, -287, + /* 100 */ -317, -134, -30, 35, 93, 143, 208, 302, 320, 321, + /* 110 */ 327, 348, 365, 414, 418, 468, 470, 472, 543, -245, + /* 120 */ 263, -215, -163, -173, -33, -47, 284, 443, -348, 61, + /* 130 */ -215, 370, 400, 297, 460, 467, 107, 480, 239, 399, + /* 140 */ 241, 362, 526, 494, 519, 616, 562, 514, 553, 655, + /* 150 */ 709, 751, 753, 769, 387, 555, 707, 668, 628, 690, + /* 160 */ 798, 698, 784, 784, 805, 808, 777, 747, 799, 799, + /* 170 */ 728, 799, 809, 795, 784, 838, 840, 850, 870, 910, + /* 180 */ 912, 875, 880, 885, 917, 926, 927, 934, 943, 951, + /* 190 */ 893, 945, 916, 947, 908, 909, 954, 920, 966, 967, + /* 200 */ 973, 983, 974, 991, 965, 969, 970, 971, 972, 975, + /* 210 */ 977, 982, 984, 985, 986, 987, 994, 976, 953, 957, + /* 220 */ 1011, 960, 980, 1015, 1018, 1020, 979, 1019, 988, 989, + /* 230 */ 996, 997, 1006, 998, 1009, 1003, 1048, 1037, 1062, 1038, + /* 240 */ 1007, 1012, 1043, 993, 1035, 1046, 1047, 1008, 1044, 1051, + /* 250 */ 1053, 784, 1004, 992, 1014, 1013, 1017, 1021, 1061, 1023, + /* 260 */ 1024, 1016, 799, 1105, 1081, 1063, 1123, 1115, 1142, 1154, + /* 270 */ 1153, 1166, 1168, 1112, 1119, 1157, 1161, 1162, 1164, 1179, }; 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 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 10 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 20 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 30 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 40 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 50 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 60 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 70 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1608, 1534, + /* 80 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 90 */ 1534, 1534, 1534, 1534, 1534, 1606, 1773, 1959, 1534, 1534, + /* 100 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 110 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 120 */ 1534, 1971, 1534, 1534, 1534, 1608, 1534, 1606, 1931, 1931, + /* 130 */ 1971, 1971, 1971, 1534, 1534, 1534, 1713, 1534, 1814, 1814, + /* 140 */ 1534, 1534, 1534, 1534, 1534, 1713, 1534, 1534, 1534, 1534, + /* 150 */ 1534, 1534, 1534, 1534, 1808, 1534, 1996, 2049, 1534, 1534, + /* 160 */ 1534, 1999, 1534, 1534, 1534, 1534, 1666, 1986, 1963, 1977, + /* 170 */ 2033, 1964, 1961, 1980, 1534, 1990, 1534, 1801, 1778, 1534, + /* 180 */ 1534, 1778, 1775, 1775, 1657, 1534, 1534, 1534, 1534, 1534, + /* 190 */ 1534, 1608, 1534, 1608, 1534, 1534, 1608, 1534, 1608, 1608, + /* 200 */ 1608, 1534, 1608, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 210 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1820, 1534, + /* 220 */ 1606, 1810, 1534, 1606, 1534, 1534, 1534, 1606, 2004, 1534, + /* 230 */ 1534, 1534, 1534, 2004, 1534, 1534, 1606, 1534, 1606, 1534, + /* 240 */ 1534, 1534, 1534, 2006, 2004, 1534, 1534, 2006, 2004, 1534, + /* 250 */ 1534, 1534, 2018, 2014, 2006, 2022, 2020, 1992, 1990, 2052, + /* 260 */ 2039, 2035, 1977, 1534, 1534, 1534, 1682, 1534, 1534, 1534, + /* 270 */ 1606, 1566, 1534, 1803, 1814, 1716, 1716, 1716, 1609, 1539, + /* 280 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 290 */ 1534, 1889, 1534, 2017, 2016, 1935, 1934, 1933, 1924, 1888, + /* 300 */ 1534, 1678, 1887, 1886, 1534, 1534, 1534, 1534, 1534, 1534, + /* 310 */ 1534, 1880, 1534, 1534, 1881, 1879, 1878, 1534, 1534, 1534, + /* 320 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 330 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 2036, 2040, 1960, + /* 340 */ 1534, 1534, 1534, 1534, 1534, 1871, 1862, 1534, 1534, 1534, + /* 350 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 360 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 370 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 380 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 390 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 400 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 410 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 420 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 430 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 440 */ 1534, 1534, 1534, 1534, 1571, 1534, 1534, 1534, 1534, 1534, + /* 450 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 460 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 470 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 480 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1647, + /* 490 */ 1646, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 500 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1870, + /* 510 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 520 */ 1534, 1534, 1534, 2032, 1534, 1534, 1534, 1534, 1534, 1534, + /* 530 */ 1534, 1818, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 540 */ 1534, 1921, 1534, 1534, 1534, 1993, 1534, 1534, 1534, 1534, + /* 550 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 560 */ 1534, 1862, 1534, 2015, 1534, 1534, 2030, 1534, 2034, 1534, + /* 570 */ 1534, 1534, 1534, 1534, 1534, 1534, 1970, 1966, 1534, 1534, + /* 580 */ 1962, 1861, 1534, 1955, 1534, 1534, 1906, 1534, 1534, 1534, + /* 590 */ 1534, 1534, 1534, 1534, 1534, 1534, 1870, 1534, 1874, 1534, + /* 600 */ 1534, 1534, 1534, 1534, 1710, 1534, 1534, 1534, 1534, 1534, + /* 610 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1695, 1693, 1692, + /* 620 */ 1691, 1534, 1688, 1534, 1534, 1534, 1534, 1719, 1718, 1534, + /* 630 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 640 */ 1534, 1534, 1534, 1534, 1628, 1534, 1534, 1534, 1534, 1534, + /* 650 */ 1534, 1534, 1534, 1534, 1619, 1534, 1618, 1534, 1534, 1534, + /* 660 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 670 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, + /* 680 */ 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, }; /********** End of lemon-generated parsing tables *****************************/ @@ -967,6 +1073,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLE_PREFIX => nothing */ 0, /* TABLE_SUFFIX => nothing */ 0, /* NK_COLON => nothing */ + 0, /* MAX_SPEED => nothing */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1063,6 +1170,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* WINDOW_CLOSE => nothing */ 0, /* IGNORE => nothing */ 0, /* EXPIRED => nothing */ + 0, /* SUBTABLE => nothing */ 0, /* KILL => nothing */ 0, /* CONNECTION => nothing */ 0, /* TRANSACTION => nothing */ @@ -1094,6 +1202,11 @@ static const YYCODETYPE yyFallback[] = { 0, /* CURRENT_USER => nothing */ 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ + 0, /* CASE => nothing */ + 263, /* END => ABORT */ + 0, /* WHEN => nothing */ + 0, /* THEN => nothing */ + 0, /* ELSE => nothing */ 0, /* BETWEEN => nothing */ 0, /* IS => nothing */ 0, /* NK_LT => nothing */ @@ -1132,58 +1245,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 */ + 263, /* AFTER => ABORT */ + 263, /* ATTACH => ABORT */ + 263, /* BEFORE => ABORT */ + 263, /* BEGIN => ABORT */ + 263, /* BITAND => ABORT */ + 263, /* BITNOT => ABORT */ + 263, /* BITOR => ABORT */ + 263, /* BLOCKS => ABORT */ + 263, /* CHANGE => ABORT */ + 263, /* COMMA => ABORT */ + 263, /* COMPACT => ABORT */ + 263, /* CONCAT => ABORT */ + 263, /* CONFLICT => ABORT */ + 263, /* COPY => ABORT */ + 263, /* DEFERRED => ABORT */ + 263, /* DELIMITERS => ABORT */ + 263, /* DETACH => ABORT */ + 263, /* DIVIDE => ABORT */ + 263, /* DOT => ABORT */ + 263, /* EACH => ABORT */ + 263, /* FAIL => ABORT */ + 263, /* FILE => ABORT */ + 263, /* FOR => ABORT */ + 263, /* GLOB => ABORT */ + 263, /* ID => ABORT */ + 263, /* IMMEDIATE => ABORT */ + 263, /* IMPORT => ABORT */ + 263, /* INITIALLY => ABORT */ + 263, /* INSTEAD => ABORT */ + 263, /* ISNULL => ABORT */ + 263, /* KEY => ABORT */ + 263, /* NK_BITNOT => ABORT */ + 263, /* NK_SEMI => ABORT */ + 263, /* NOTNULL => ABORT */ + 263, /* OF => ABORT */ + 263, /* PLUS => ABORT */ + 263, /* PRIVILEGE => ABORT */ + 263, /* RAISE => ABORT */ + 263, /* REPLACE => ABORT */ + 263, /* RESTRICT => ABORT */ + 263, /* ROW => ABORT */ + 263, /* SEMI => ABORT */ + 263, /* STAR => ABORT */ + 263, /* STATEMENT => ABORT */ + 263, /* STRING => ABORT */ + 263, /* TIMES => ABORT */ + 263, /* UPDATE => ABORT */ + 263, /* VALUES => ABORT */ + 263, /* VARIABLE => ABORT */ + 263, /* VIEW => ABORT */ + 263, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1363,346 +1475,361 @@ static const char *const yyTokenName[] = { /* 89 */ "TABLE_PREFIX", /* 90 */ "TABLE_SUFFIX", /* 91 */ "NK_COLON", - /* 92 */ "TABLE", - /* 93 */ "NK_LP", - /* 94 */ "NK_RP", - /* 95 */ "STABLE", - /* 96 */ "ADD", - /* 97 */ "COLUMN", - /* 98 */ "MODIFY", - /* 99 */ "RENAME", - /* 100 */ "TAG", - /* 101 */ "SET", - /* 102 */ "NK_EQ", - /* 103 */ "USING", - /* 104 */ "TAGS", - /* 105 */ "COMMENT", - /* 106 */ "BOOL", - /* 107 */ "TINYINT", - /* 108 */ "SMALLINT", - /* 109 */ "INT", - /* 110 */ "INTEGER", - /* 111 */ "BIGINT", - /* 112 */ "FLOAT", - /* 113 */ "DOUBLE", - /* 114 */ "BINARY", - /* 115 */ "TIMESTAMP", - /* 116 */ "NCHAR", - /* 117 */ "UNSIGNED", - /* 118 */ "JSON", - /* 119 */ "VARCHAR", - /* 120 */ "MEDIUMBLOB", - /* 121 */ "BLOB", - /* 122 */ "VARBINARY", - /* 123 */ "DECIMAL", - /* 124 */ "MAX_DELAY", - /* 125 */ "WATERMARK", - /* 126 */ "ROLLUP", - /* 127 */ "TTL", - /* 128 */ "SMA", - /* 129 */ "FIRST", - /* 130 */ "LAST", - /* 131 */ "SHOW", - /* 132 */ "DATABASES", - /* 133 */ "TABLES", - /* 134 */ "STABLES", - /* 135 */ "MNODES", - /* 136 */ "MODULES", - /* 137 */ "QNODES", - /* 138 */ "FUNCTIONS", - /* 139 */ "INDEXES", - /* 140 */ "ACCOUNTS", - /* 141 */ "APPS", - /* 142 */ "CONNECTIONS", - /* 143 */ "LICENCES", - /* 144 */ "GRANTS", - /* 145 */ "QUERIES", - /* 146 */ "SCORES", - /* 147 */ "TOPICS", - /* 148 */ "VARIABLES", - /* 149 */ "BNODES", - /* 150 */ "SNODES", - /* 151 */ "CLUSTER", - /* 152 */ "TRANSACTIONS", - /* 153 */ "DISTRIBUTED", - /* 154 */ "CONSUMERS", - /* 155 */ "SUBSCRIPTIONS", - /* 156 */ "VNODES", - /* 157 */ "LIKE", - /* 158 */ "INDEX", - /* 159 */ "FUNCTION", - /* 160 */ "INTERVAL", - /* 161 */ "TOPIC", - /* 162 */ "AS", - /* 163 */ "WITH", - /* 164 */ "META", - /* 165 */ "CONSUMER", - /* 166 */ "GROUP", - /* 167 */ "DESC", - /* 168 */ "DESCRIBE", - /* 169 */ "RESET", - /* 170 */ "QUERY", - /* 171 */ "CACHE", - /* 172 */ "EXPLAIN", - /* 173 */ "ANALYZE", - /* 174 */ "VERBOSE", - /* 175 */ "NK_BOOL", - /* 176 */ "RATIO", - /* 177 */ "NK_FLOAT", - /* 178 */ "OUTPUTTYPE", - /* 179 */ "AGGREGATE", - /* 180 */ "BUFSIZE", - /* 181 */ "STREAM", - /* 182 */ "INTO", - /* 183 */ "TRIGGER", - /* 184 */ "AT_ONCE", - /* 185 */ "WINDOW_CLOSE", - /* 186 */ "IGNORE", - /* 187 */ "EXPIRED", - /* 188 */ "KILL", - /* 189 */ "CONNECTION", - /* 190 */ "TRANSACTION", - /* 191 */ "BALANCE", - /* 192 */ "VGROUP", - /* 193 */ "MERGE", - /* 194 */ "REDISTRIBUTE", - /* 195 */ "SPLIT", - /* 196 */ "DELETE", - /* 197 */ "INSERT", - /* 198 */ "NULL", - /* 199 */ "NK_QUESTION", - /* 200 */ "NK_ARROW", - /* 201 */ "ROWTS", - /* 202 */ "TBNAME", - /* 203 */ "QSTART", - /* 204 */ "QEND", - /* 205 */ "QDURATION", - /* 206 */ "WSTART", - /* 207 */ "WEND", - /* 208 */ "WDURATION", - /* 209 */ "CAST", - /* 210 */ "NOW", - /* 211 */ "TODAY", - /* 212 */ "TIMEZONE", - /* 213 */ "CLIENT_VERSION", - /* 214 */ "SERVER_VERSION", - /* 215 */ "SERVER_STATUS", - /* 216 */ "CURRENT_USER", - /* 217 */ "COUNT", - /* 218 */ "LAST_ROW", - /* 219 */ "BETWEEN", - /* 220 */ "IS", - /* 221 */ "NK_LT", - /* 222 */ "NK_GT", - /* 223 */ "NK_LE", - /* 224 */ "NK_GE", - /* 225 */ "NK_NE", - /* 226 */ "MATCH", - /* 227 */ "NMATCH", - /* 228 */ "CONTAINS", - /* 229 */ "IN", - /* 230 */ "JOIN", - /* 231 */ "INNER", - /* 232 */ "SELECT", - /* 233 */ "DISTINCT", - /* 234 */ "WHERE", - /* 235 */ "PARTITION", - /* 236 */ "BY", - /* 237 */ "SESSION", - /* 238 */ "STATE_WINDOW", - /* 239 */ "SLIDING", - /* 240 */ "FILL", - /* 241 */ "VALUE", - /* 242 */ "NONE", - /* 243 */ "PREV", - /* 244 */ "LINEAR", - /* 245 */ "NEXT", - /* 246 */ "HAVING", - /* 247 */ "RANGE", - /* 248 */ "EVERY", - /* 249 */ "ORDER", - /* 250 */ "SLIMIT", - /* 251 */ "SOFFSET", - /* 252 */ "LIMIT", - /* 253 */ "OFFSET", - /* 254 */ "ASC", - /* 255 */ "NULLS", - /* 256 */ "ABORT", - /* 257 */ "AFTER", - /* 258 */ "ATTACH", - /* 259 */ "BEFORE", - /* 260 */ "BEGIN", - /* 261 */ "BITAND", - /* 262 */ "BITNOT", - /* 263 */ "BITOR", - /* 264 */ "BLOCKS", - /* 265 */ "CHANGE", - /* 266 */ "COMMA", - /* 267 */ "COMPACT", - /* 268 */ "CONCAT", - /* 269 */ "CONFLICT", - /* 270 */ "COPY", - /* 271 */ "DEFERRED", - /* 272 */ "DELIMITERS", - /* 273 */ "DETACH", - /* 274 */ "DIVIDE", - /* 275 */ "DOT", - /* 276 */ "EACH", - /* 277 */ "END", - /* 278 */ "FAIL", - /* 279 */ "FILE", - /* 280 */ "FOR", - /* 281 */ "GLOB", - /* 282 */ "ID", - /* 283 */ "IMMEDIATE", - /* 284 */ "IMPORT", - /* 285 */ "INITIALLY", - /* 286 */ "INSTEAD", - /* 287 */ "ISNULL", - /* 288 */ "KEY", - /* 289 */ "NK_BITNOT", - /* 290 */ "NK_SEMI", - /* 291 */ "NOTNULL", - /* 292 */ "OF", - /* 293 */ "PLUS", - /* 294 */ "PRIVILEGE", - /* 295 */ "RAISE", - /* 296 */ "REPLACE", - /* 297 */ "RESTRICT", - /* 298 */ "ROW", - /* 299 */ "SEMI", - /* 300 */ "STAR", - /* 301 */ "STATEMENT", - /* 302 */ "STRING", - /* 303 */ "TIMES", - /* 304 */ "UPDATE", - /* 305 */ "VALUES", - /* 306 */ "VARIABLE", - /* 307 */ "VIEW", - /* 308 */ "WAL", - /* 309 */ "cmd", - /* 310 */ "account_options", - /* 311 */ "alter_account_options", - /* 312 */ "literal", - /* 313 */ "alter_account_option", - /* 314 */ "user_name", - /* 315 */ "sysinfo_opt", - /* 316 */ "privileges", - /* 317 */ "priv_level", - /* 318 */ "priv_type_list", - /* 319 */ "priv_type", - /* 320 */ "db_name", - /* 321 */ "dnode_endpoint", - /* 322 */ "not_exists_opt", - /* 323 */ "db_options", - /* 324 */ "exists_opt", - /* 325 */ "alter_db_options", - /* 326 */ "integer_list", - /* 327 */ "variable_list", - /* 328 */ "retention_list", - /* 329 */ "alter_db_option", - /* 330 */ "retention", - /* 331 */ "full_table_name", - /* 332 */ "column_def_list", - /* 333 */ "tags_def_opt", - /* 334 */ "table_options", - /* 335 */ "multi_create_clause", - /* 336 */ "tags_def", - /* 337 */ "multi_drop_clause", - /* 338 */ "alter_table_clause", - /* 339 */ "alter_table_options", - /* 340 */ "column_name", - /* 341 */ "type_name", - /* 342 */ "signed_literal", - /* 343 */ "create_subtable_clause", - /* 344 */ "specific_cols_opt", - /* 345 */ "expression_list", - /* 346 */ "drop_table_clause", - /* 347 */ "col_name_list", - /* 348 */ "table_name", - /* 349 */ "column_def", - /* 350 */ "duration_list", - /* 351 */ "rollup_func_list", - /* 352 */ "alter_table_option", - /* 353 */ "duration_literal", - /* 354 */ "rollup_func_name", - /* 355 */ "function_name", - /* 356 */ "col_name", - /* 357 */ "db_name_cond_opt", - /* 358 */ "like_pattern_opt", - /* 359 */ "table_name_cond", - /* 360 */ "from_db_opt", - /* 361 */ "index_options", - /* 362 */ "func_list", - /* 363 */ "sliding_opt", - /* 364 */ "sma_stream_opt", - /* 365 */ "func", - /* 366 */ "stream_options", - /* 367 */ "topic_name", - /* 368 */ "query_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", + /* 92 */ "MAX_SPEED", + /* 93 */ "TABLE", + /* 94 */ "NK_LP", + /* 95 */ "NK_RP", + /* 96 */ "STABLE", + /* 97 */ "ADD", + /* 98 */ "COLUMN", + /* 99 */ "MODIFY", + /* 100 */ "RENAME", + /* 101 */ "TAG", + /* 102 */ "SET", + /* 103 */ "NK_EQ", + /* 104 */ "USING", + /* 105 */ "TAGS", + /* 106 */ "COMMENT", + /* 107 */ "BOOL", + /* 108 */ "TINYINT", + /* 109 */ "SMALLINT", + /* 110 */ "INT", + /* 111 */ "INTEGER", + /* 112 */ "BIGINT", + /* 113 */ "FLOAT", + /* 114 */ "DOUBLE", + /* 115 */ "BINARY", + /* 116 */ "TIMESTAMP", + /* 117 */ "NCHAR", + /* 118 */ "UNSIGNED", + /* 119 */ "JSON", + /* 120 */ "VARCHAR", + /* 121 */ "MEDIUMBLOB", + /* 122 */ "BLOB", + /* 123 */ "VARBINARY", + /* 124 */ "DECIMAL", + /* 125 */ "MAX_DELAY", + /* 126 */ "WATERMARK", + /* 127 */ "ROLLUP", + /* 128 */ "TTL", + /* 129 */ "SMA", + /* 130 */ "FIRST", + /* 131 */ "LAST", + /* 132 */ "SHOW", + /* 133 */ "DATABASES", + /* 134 */ "TABLES", + /* 135 */ "STABLES", + /* 136 */ "MNODES", + /* 137 */ "MODULES", + /* 138 */ "QNODES", + /* 139 */ "FUNCTIONS", + /* 140 */ "INDEXES", + /* 141 */ "ACCOUNTS", + /* 142 */ "APPS", + /* 143 */ "CONNECTIONS", + /* 144 */ "LICENCES", + /* 145 */ "GRANTS", + /* 146 */ "QUERIES", + /* 147 */ "SCORES", + /* 148 */ "TOPICS", + /* 149 */ "VARIABLES", + /* 150 */ "BNODES", + /* 151 */ "SNODES", + /* 152 */ "CLUSTER", + /* 153 */ "TRANSACTIONS", + /* 154 */ "DISTRIBUTED", + /* 155 */ "CONSUMERS", + /* 156 */ "SUBSCRIPTIONS", + /* 157 */ "VNODES", + /* 158 */ "LIKE", + /* 159 */ "INDEX", + /* 160 */ "FUNCTION", + /* 161 */ "INTERVAL", + /* 162 */ "TOPIC", + /* 163 */ "AS", + /* 164 */ "WITH", + /* 165 */ "META", + /* 166 */ "CONSUMER", + /* 167 */ "GROUP", + /* 168 */ "DESC", + /* 169 */ "DESCRIBE", + /* 170 */ "RESET", + /* 171 */ "QUERY", + /* 172 */ "CACHE", + /* 173 */ "EXPLAIN", + /* 174 */ "ANALYZE", + /* 175 */ "VERBOSE", + /* 176 */ "NK_BOOL", + /* 177 */ "RATIO", + /* 178 */ "NK_FLOAT", + /* 179 */ "OUTPUTTYPE", + /* 180 */ "AGGREGATE", + /* 181 */ "BUFSIZE", + /* 182 */ "STREAM", + /* 183 */ "INTO", + /* 184 */ "TRIGGER", + /* 185 */ "AT_ONCE", + /* 186 */ "WINDOW_CLOSE", + /* 187 */ "IGNORE", + /* 188 */ "EXPIRED", + /* 189 */ "SUBTABLE", + /* 190 */ "KILL", + /* 191 */ "CONNECTION", + /* 192 */ "TRANSACTION", + /* 193 */ "BALANCE", + /* 194 */ "VGROUP", + /* 195 */ "MERGE", + /* 196 */ "REDISTRIBUTE", + /* 197 */ "SPLIT", + /* 198 */ "DELETE", + /* 199 */ "INSERT", + /* 200 */ "NULL", + /* 201 */ "NK_QUESTION", + /* 202 */ "NK_ARROW", + /* 203 */ "ROWTS", + /* 204 */ "TBNAME", + /* 205 */ "QSTART", + /* 206 */ "QEND", + /* 207 */ "QDURATION", + /* 208 */ "WSTART", + /* 209 */ "WEND", + /* 210 */ "WDURATION", + /* 211 */ "CAST", + /* 212 */ "NOW", + /* 213 */ "TODAY", + /* 214 */ "TIMEZONE", + /* 215 */ "CLIENT_VERSION", + /* 216 */ "SERVER_VERSION", + /* 217 */ "SERVER_STATUS", + /* 218 */ "CURRENT_USER", + /* 219 */ "COUNT", + /* 220 */ "LAST_ROW", + /* 221 */ "CASE", + /* 222 */ "END", + /* 223 */ "WHEN", + /* 224 */ "THEN", + /* 225 */ "ELSE", + /* 226 */ "BETWEEN", + /* 227 */ "IS", + /* 228 */ "NK_LT", + /* 229 */ "NK_GT", + /* 230 */ "NK_LE", + /* 231 */ "NK_GE", + /* 232 */ "NK_NE", + /* 233 */ "MATCH", + /* 234 */ "NMATCH", + /* 235 */ "CONTAINS", + /* 236 */ "IN", + /* 237 */ "JOIN", + /* 238 */ "INNER", + /* 239 */ "SELECT", + /* 240 */ "DISTINCT", + /* 241 */ "WHERE", + /* 242 */ "PARTITION", + /* 243 */ "BY", + /* 244 */ "SESSION", + /* 245 */ "STATE_WINDOW", + /* 246 */ "SLIDING", + /* 247 */ "FILL", + /* 248 */ "VALUE", + /* 249 */ "NONE", + /* 250 */ "PREV", + /* 251 */ "LINEAR", + /* 252 */ "NEXT", + /* 253 */ "HAVING", + /* 254 */ "RANGE", + /* 255 */ "EVERY", + /* 256 */ "ORDER", + /* 257 */ "SLIMIT", + /* 258 */ "SOFFSET", + /* 259 */ "LIMIT", + /* 260 */ "OFFSET", + /* 261 */ "ASC", + /* 262 */ "NULLS", + /* 263 */ "ABORT", + /* 264 */ "AFTER", + /* 265 */ "ATTACH", + /* 266 */ "BEFORE", + /* 267 */ "BEGIN", + /* 268 */ "BITAND", + /* 269 */ "BITNOT", + /* 270 */ "BITOR", + /* 271 */ "BLOCKS", + /* 272 */ "CHANGE", + /* 273 */ "COMMA", + /* 274 */ "COMPACT", + /* 275 */ "CONCAT", + /* 276 */ "CONFLICT", + /* 277 */ "COPY", + /* 278 */ "DEFERRED", + /* 279 */ "DELIMITERS", + /* 280 */ "DETACH", + /* 281 */ "DIVIDE", + /* 282 */ "DOT", + /* 283 */ "EACH", + /* 284 */ "FAIL", + /* 285 */ "FILE", + /* 286 */ "FOR", + /* 287 */ "GLOB", + /* 288 */ "ID", + /* 289 */ "IMMEDIATE", + /* 290 */ "IMPORT", + /* 291 */ "INITIALLY", + /* 292 */ "INSTEAD", + /* 293 */ "ISNULL", + /* 294 */ "KEY", + /* 295 */ "NK_BITNOT", + /* 296 */ "NK_SEMI", + /* 297 */ "NOTNULL", + /* 298 */ "OF", + /* 299 */ "PLUS", + /* 300 */ "PRIVILEGE", + /* 301 */ "RAISE", + /* 302 */ "REPLACE", + /* 303 */ "RESTRICT", + /* 304 */ "ROW", + /* 305 */ "SEMI", + /* 306 */ "STAR", + /* 307 */ "STATEMENT", + /* 308 */ "STRING", + /* 309 */ "TIMES", + /* 310 */ "UPDATE", + /* 311 */ "VALUES", + /* 312 */ "VARIABLE", + /* 313 */ "VIEW", + /* 314 */ "WAL", + /* 315 */ "cmd", + /* 316 */ "account_options", + /* 317 */ "alter_account_options", + /* 318 */ "literal", + /* 319 */ "alter_account_option", + /* 320 */ "user_name", + /* 321 */ "sysinfo_opt", + /* 322 */ "privileges", + /* 323 */ "priv_level", + /* 324 */ "priv_type_list", + /* 325 */ "priv_type", + /* 326 */ "db_name", + /* 327 */ "dnode_endpoint", + /* 328 */ "not_exists_opt", + /* 329 */ "db_options", + /* 330 */ "exists_opt", + /* 331 */ "alter_db_options", + /* 332 */ "speed_opt", + /* 333 */ "integer_list", + /* 334 */ "variable_list", + /* 335 */ "retention_list", + /* 336 */ "alter_db_option", + /* 337 */ "retention", + /* 338 */ "full_table_name", + /* 339 */ "column_def_list", + /* 340 */ "tags_def_opt", + /* 341 */ "table_options", + /* 342 */ "multi_create_clause", + /* 343 */ "tags_def", + /* 344 */ "multi_drop_clause", + /* 345 */ "alter_table_clause", + /* 346 */ "alter_table_options", + /* 347 */ "column_name", + /* 348 */ "type_name", + /* 349 */ "signed_literal", + /* 350 */ "create_subtable_clause", + /* 351 */ "specific_cols_opt", + /* 352 */ "expression_list", + /* 353 */ "drop_table_clause", + /* 354 */ "col_name_list", + /* 355 */ "table_name", + /* 356 */ "column_def", + /* 357 */ "duration_list", + /* 358 */ "rollup_func_list", + /* 359 */ "alter_table_option", + /* 360 */ "duration_literal", + /* 361 */ "rollup_func_name", + /* 362 */ "function_name", + /* 363 */ "col_name", + /* 364 */ "db_name_cond_opt", + /* 365 */ "like_pattern_opt", + /* 366 */ "table_name_cond", + /* 367 */ "from_db_opt", + /* 368 */ "index_options", + /* 369 */ "func_list", + /* 370 */ "sliding_opt", + /* 371 */ "sma_stream_opt", + /* 372 */ "func", + /* 373 */ "stream_options", + /* 374 */ "topic_name", + /* 375 */ "query_or_subquery", + /* 376 */ "cgroup_name", + /* 377 */ "analyze_opt", + /* 378 */ "explain_options", + /* 379 */ "agg_func_opt", + /* 380 */ "bufsize_opt", + /* 381 */ "stream_name", + /* 382 */ "subtable_opt", + /* 383 */ "expression", + /* 384 */ "dnode_list", + /* 385 */ "where_clause_opt", + /* 386 */ "signed", + /* 387 */ "literal_func", + /* 388 */ "literal_list", + /* 389 */ "table_alias", + /* 390 */ "column_alias", + /* 391 */ "expr_or_subquery", + /* 392 */ "subquery", + /* 393 */ "pseudo_column", + /* 394 */ "column_reference", + /* 395 */ "function_expression", + /* 396 */ "case_when_expression", + /* 397 */ "star_func", + /* 398 */ "star_func_para_list", + /* 399 */ "noarg_func", + /* 400 */ "other_para_list", + /* 401 */ "star_func_para", + /* 402 */ "when_then_list", + /* 403 */ "case_when_else_opt", + /* 404 */ "common_expression", + /* 405 */ "when_then_expr", + /* 406 */ "predicate", + /* 407 */ "compare_op", + /* 408 */ "in_op", + /* 409 */ "in_predicate_value", + /* 410 */ "boolean_value_expression", + /* 411 */ "boolean_primary", + /* 412 */ "from_clause_opt", + /* 413 */ "table_reference_list", + /* 414 */ "table_reference", + /* 415 */ "table_primary", + /* 416 */ "joined_table", + /* 417 */ "alias_opt", + /* 418 */ "parenthesized_joined_table", + /* 419 */ "join_type", + /* 420 */ "search_condition", + /* 421 */ "query_specification", + /* 422 */ "set_quantifier_opt", + /* 423 */ "select_list", + /* 424 */ "partition_by_clause_opt", + /* 425 */ "range_opt", + /* 426 */ "every_opt", + /* 427 */ "fill_opt", + /* 428 */ "twindow_clause_opt", + /* 429 */ "group_by_clause_opt", + /* 430 */ "having_clause_opt", + /* 431 */ "select_item", + /* 432 */ "partition_list", + /* 433 */ "partition_item", + /* 434 */ "fill_mode", + /* 435 */ "group_by_list", + /* 436 */ "query_expression", + /* 437 */ "query_simple", + /* 438 */ "order_by_clause_opt", + /* 439 */ "slimit_clause_opt", + /* 440 */ "limit_clause_opt", + /* 441 */ "union_query_expression", + /* 442 */ "query_simple_or_subquery", + /* 443 */ "sort_specification_list", + /* 444 */ "sort_specification", + /* 445 */ "ordering_specification_opt", + /* 446 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1777,7 +1904,7 @@ static const char *const yyRuleName[] = { /* 64 */ "cmd ::= USE db_name", /* 65 */ "cmd ::= ALTER DATABASE db_name alter_db_options", /* 66 */ "cmd ::= FLUSH DATABASE db_name", - /* 67 */ "cmd ::= TRIM DATABASE db_name", + /* 67 */ "cmd ::= TRIM DATABASE db_name speed_opt", /* 68 */ "not_exists_opt ::= IF NOT EXISTS", /* 69 */ "not_exists_opt ::=", /* 70 */ "exists_opt ::= IF EXISTS", @@ -1830,385 +1957,404 @@ static const char *const yyRuleName[] = { /* 117 */ "retention_list ::= retention", /* 118 */ "retention_list ::= retention_list NK_COMMA retention", /* 119 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 120 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 121 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 122 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 123 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 124 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 125 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 126 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 127 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 128 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 129 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 130 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 131 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 132 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 133 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 134 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 135 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 136 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 137 */ "multi_create_clause ::= create_subtable_clause", - /* 138 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 139 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", - /* 140 */ "multi_drop_clause ::= drop_table_clause", - /* 141 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 142 */ "drop_table_clause ::= exists_opt full_table_name", - /* 143 */ "specific_cols_opt ::=", - /* 144 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 145 */ "full_table_name ::= table_name", - /* 146 */ "full_table_name ::= db_name NK_DOT table_name", - /* 147 */ "column_def_list ::= column_def", - /* 148 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 149 */ "column_def ::= column_name type_name", - /* 150 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 151 */ "type_name ::= BOOL", - /* 152 */ "type_name ::= TINYINT", - /* 153 */ "type_name ::= SMALLINT", - /* 154 */ "type_name ::= INT", - /* 155 */ "type_name ::= INTEGER", - /* 156 */ "type_name ::= BIGINT", - /* 157 */ "type_name ::= FLOAT", - /* 158 */ "type_name ::= DOUBLE", - /* 159 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 160 */ "type_name ::= TIMESTAMP", - /* 161 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 162 */ "type_name ::= TINYINT UNSIGNED", - /* 163 */ "type_name ::= SMALLINT UNSIGNED", - /* 164 */ "type_name ::= INT UNSIGNED", - /* 165 */ "type_name ::= BIGINT UNSIGNED", - /* 166 */ "type_name ::= JSON", - /* 167 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 168 */ "type_name ::= MEDIUMBLOB", - /* 169 */ "type_name ::= BLOB", - /* 170 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 171 */ "type_name ::= DECIMAL", - /* 172 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 173 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 174 */ "tags_def_opt ::=", - /* 175 */ "tags_def_opt ::= tags_def", - /* 176 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 177 */ "table_options ::=", - /* 178 */ "table_options ::= table_options COMMENT NK_STRING", - /* 179 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 180 */ "table_options ::= table_options WATERMARK duration_list", - /* 181 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 182 */ "table_options ::= table_options TTL NK_INTEGER", - /* 183 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 184 */ "alter_table_options ::= alter_table_option", - /* 185 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 186 */ "alter_table_option ::= COMMENT NK_STRING", - /* 187 */ "alter_table_option ::= TTL NK_INTEGER", - /* 188 */ "duration_list ::= duration_literal", - /* 189 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 190 */ "rollup_func_list ::= rollup_func_name", - /* 191 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 192 */ "rollup_func_name ::= function_name", - /* 193 */ "rollup_func_name ::= FIRST", - /* 194 */ "rollup_func_name ::= LAST", - /* 195 */ "col_name_list ::= col_name", - /* 196 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 197 */ "col_name ::= column_name", - /* 198 */ "cmd ::= SHOW DNODES", - /* 199 */ "cmd ::= SHOW USERS", - /* 200 */ "cmd ::= SHOW DATABASES", - /* 201 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 202 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 203 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 204 */ "cmd ::= SHOW MNODES", - /* 205 */ "cmd ::= SHOW MODULES", - /* 206 */ "cmd ::= SHOW QNODES", - /* 207 */ "cmd ::= SHOW FUNCTIONS", - /* 208 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 209 */ "cmd ::= SHOW STREAMS", - /* 210 */ "cmd ::= SHOW ACCOUNTS", - /* 211 */ "cmd ::= SHOW APPS", - /* 212 */ "cmd ::= SHOW CONNECTIONS", - /* 213 */ "cmd ::= SHOW LICENCES", - /* 214 */ "cmd ::= SHOW GRANTS", - /* 215 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 216 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 217 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 218 */ "cmd ::= SHOW QUERIES", - /* 219 */ "cmd ::= SHOW SCORES", - /* 220 */ "cmd ::= SHOW TOPICS", - /* 221 */ "cmd ::= SHOW VARIABLES", - /* 222 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 223 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", - /* 224 */ "cmd ::= SHOW BNODES", - /* 225 */ "cmd ::= SHOW SNODES", - /* 226 */ "cmd ::= SHOW CLUSTER", - /* 227 */ "cmd ::= SHOW TRANSACTIONS", - /* 228 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 229 */ "cmd ::= SHOW CONSUMERS", - /* 230 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 231 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 232 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 233 */ "cmd ::= SHOW VNODES NK_STRING", - /* 234 */ "db_name_cond_opt ::=", - /* 235 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 236 */ "like_pattern_opt ::=", - /* 237 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 238 */ "table_name_cond ::= table_name", - /* 239 */ "from_db_opt ::=", - /* 240 */ "from_db_opt ::= FROM db_name", - /* 241 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", - /* 242 */ "cmd ::= DROP INDEX exists_opt full_table_name", - /* 243 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 244 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", - /* 245 */ "func_list ::= func", - /* 246 */ "func_list ::= func_list NK_COMMA func", - /* 247 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 248 */ "sma_stream_opt ::=", - /* 249 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", - /* 250 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", - /* 251 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 252 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 253 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 254 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 255 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 256 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 257 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 258 */ "cmd ::= DESC full_table_name", - /* 259 */ "cmd ::= DESCRIBE full_table_name", - /* 260 */ "cmd ::= RESET QUERY CACHE", - /* 261 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 262 */ "analyze_opt ::=", - /* 263 */ "analyze_opt ::= ANALYZE", - /* 264 */ "explain_options ::=", - /* 265 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 266 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 267 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 268 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 269 */ "agg_func_opt ::=", - /* 270 */ "agg_func_opt ::= AGGREGATE", - /* 271 */ "bufsize_opt ::=", - /* 272 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 273 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery", - /* 274 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 275 */ "stream_options ::=", - /* 276 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 277 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 278 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 279 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 280 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 281 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 282 */ "cmd ::= KILL QUERY NK_STRING", - /* 283 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 284 */ "cmd ::= BALANCE VGROUP", - /* 285 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 286 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 287 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 288 */ "dnode_list ::= DNODE NK_INTEGER", - /* 289 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 290 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 291 */ "cmd ::= query_or_subquery", - /* 292 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 293 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", - /* 294 */ "literal ::= NK_INTEGER", - /* 295 */ "literal ::= NK_FLOAT", - /* 296 */ "literal ::= NK_STRING", - /* 297 */ "literal ::= NK_BOOL", - /* 298 */ "literal ::= TIMESTAMP NK_STRING", - /* 299 */ "literal ::= duration_literal", - /* 300 */ "literal ::= NULL", - /* 301 */ "literal ::= NK_QUESTION", - /* 302 */ "duration_literal ::= NK_VARIABLE", - /* 303 */ "signed ::= NK_INTEGER", - /* 304 */ "signed ::= NK_PLUS NK_INTEGER", - /* 305 */ "signed ::= NK_MINUS NK_INTEGER", - /* 306 */ "signed ::= NK_FLOAT", - /* 307 */ "signed ::= NK_PLUS NK_FLOAT", - /* 308 */ "signed ::= NK_MINUS NK_FLOAT", - /* 309 */ "signed_literal ::= signed", - /* 310 */ "signed_literal ::= NK_STRING", - /* 311 */ "signed_literal ::= NK_BOOL", - /* 312 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 313 */ "signed_literal ::= duration_literal", - /* 314 */ "signed_literal ::= NULL", - /* 315 */ "signed_literal ::= literal_func", - /* 316 */ "signed_literal ::= NK_QUESTION", - /* 317 */ "literal_list ::= signed_literal", - /* 318 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 319 */ "db_name ::= NK_ID", - /* 320 */ "table_name ::= NK_ID", - /* 321 */ "column_name ::= NK_ID", - /* 322 */ "function_name ::= NK_ID", - /* 323 */ "table_alias ::= NK_ID", - /* 324 */ "column_alias ::= NK_ID", - /* 325 */ "user_name ::= NK_ID", - /* 326 */ "topic_name ::= NK_ID", - /* 327 */ "stream_name ::= NK_ID", - /* 328 */ "cgroup_name ::= NK_ID", - /* 329 */ "expression ::= literal", - /* 330 */ "expression ::= pseudo_column", - /* 331 */ "expression ::= column_reference", - /* 332 */ "expression ::= function_expression", - /* 333 */ "expression ::= subquery", - /* 334 */ "expression ::= NK_LP expression NK_RP", - /* 335 */ "expression ::= NK_PLUS expression", - /* 336 */ "expression ::= NK_MINUS expression", - /* 337 */ "expression ::= expression NK_PLUS expression", - /* 338 */ "expression ::= expression NK_MINUS expression", - /* 339 */ "expression ::= expression NK_STAR expression", - /* 340 */ "expression ::= expression NK_SLASH expression", - /* 341 */ "expression ::= expression NK_REM expression", - /* 342 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 343 */ "expression ::= expression NK_BITAND expression", - /* 344 */ "expression ::= expression NK_BITOR expression", - /* 345 */ "expression_list ::= expression", - /* 346 */ "expression_list ::= expression_list NK_COMMA expression", - /* 347 */ "column_reference ::= column_name", - /* 348 */ "column_reference ::= table_name NK_DOT column_name", - /* 349 */ "pseudo_column ::= ROWTS", - /* 350 */ "pseudo_column ::= TBNAME", - /* 351 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 352 */ "pseudo_column ::= QSTART", - /* 353 */ "pseudo_column ::= QEND", - /* 354 */ "pseudo_column ::= QDURATION", - /* 355 */ "pseudo_column ::= WSTART", - /* 356 */ "pseudo_column ::= WEND", - /* 357 */ "pseudo_column ::= WDURATION", - /* 358 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 359 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 360 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 361 */ "function_expression ::= literal_func", - /* 362 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 363 */ "literal_func ::= NOW", - /* 364 */ "noarg_func ::= NOW", - /* 365 */ "noarg_func ::= TODAY", - /* 366 */ "noarg_func ::= TIMEZONE", - /* 367 */ "noarg_func ::= DATABASE", - /* 368 */ "noarg_func ::= CLIENT_VERSION", - /* 369 */ "noarg_func ::= SERVER_VERSION", - /* 370 */ "noarg_func ::= SERVER_STATUS", - /* 371 */ "noarg_func ::= CURRENT_USER", - /* 372 */ "noarg_func ::= USER", - /* 373 */ "star_func ::= COUNT", - /* 374 */ "star_func ::= FIRST", - /* 375 */ "star_func ::= LAST", - /* 376 */ "star_func ::= LAST_ROW", - /* 377 */ "star_func_para_list ::= NK_STAR", - /* 378 */ "star_func_para_list ::= other_para_list", - /* 379 */ "other_para_list ::= star_func_para", - /* 380 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 381 */ "star_func_para ::= expression", - /* 382 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 383 */ "predicate ::= expression compare_op expression", - /* 384 */ "predicate ::= expression BETWEEN expression AND expression", - /* 385 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 386 */ "predicate ::= expression IS NULL", - /* 387 */ "predicate ::= expression IS NOT NULL", - /* 388 */ "predicate ::= expression in_op in_predicate_value", - /* 389 */ "compare_op ::= NK_LT", - /* 390 */ "compare_op ::= NK_GT", - /* 391 */ "compare_op ::= NK_LE", - /* 392 */ "compare_op ::= NK_GE", - /* 393 */ "compare_op ::= NK_NE", - /* 394 */ "compare_op ::= NK_EQ", - /* 395 */ "compare_op ::= LIKE", - /* 396 */ "compare_op ::= NOT LIKE", - /* 397 */ "compare_op ::= MATCH", - /* 398 */ "compare_op ::= NMATCH", - /* 399 */ "compare_op ::= CONTAINS", - /* 400 */ "in_op ::= IN", - /* 401 */ "in_op ::= NOT IN", - /* 402 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 403 */ "boolean_value_expression ::= boolean_primary", - /* 404 */ "boolean_value_expression ::= NOT boolean_primary", - /* 405 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 406 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 407 */ "boolean_primary ::= predicate", - /* 408 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 409 */ "common_expression ::= expression", - /* 410 */ "common_expression ::= boolean_value_expression", - /* 411 */ "from_clause_opt ::=", - /* 412 */ "from_clause_opt ::= FROM table_reference_list", - /* 413 */ "table_reference_list ::= table_reference", - /* 414 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 415 */ "table_reference ::= table_primary", - /* 416 */ "table_reference ::= joined_table", - /* 417 */ "table_primary ::= table_name alias_opt", - /* 418 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 419 */ "table_primary ::= subquery alias_opt", - /* 420 */ "table_primary ::= parenthesized_joined_table", - /* 421 */ "alias_opt ::=", - /* 422 */ "alias_opt ::= table_alias", - /* 423 */ "alias_opt ::= AS table_alias", - /* 424 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 425 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 426 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 427 */ "join_type ::=", - /* 428 */ "join_type ::= INNER", - /* 429 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 430 */ "set_quantifier_opt ::=", - /* 431 */ "set_quantifier_opt ::= DISTINCT", - /* 432 */ "set_quantifier_opt ::= ALL", - /* 433 */ "select_list ::= select_item", - /* 434 */ "select_list ::= select_list NK_COMMA select_item", - /* 435 */ "select_item ::= NK_STAR", - /* 436 */ "select_item ::= common_expression", - /* 437 */ "select_item ::= common_expression column_alias", - /* 438 */ "select_item ::= common_expression AS column_alias", - /* 439 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 440 */ "where_clause_opt ::=", - /* 441 */ "where_clause_opt ::= WHERE search_condition", - /* 442 */ "partition_by_clause_opt ::=", - /* 443 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 444 */ "twindow_clause_opt ::=", - /* 445 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 446 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 447 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 448 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 449 */ "sliding_opt ::=", - /* 450 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 451 */ "fill_opt ::=", - /* 452 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 453 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 454 */ "fill_mode ::= NONE", - /* 455 */ "fill_mode ::= PREV", - /* 456 */ "fill_mode ::= NULL", - /* 457 */ "fill_mode ::= LINEAR", - /* 458 */ "fill_mode ::= NEXT", - /* 459 */ "group_by_clause_opt ::=", - /* 460 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 461 */ "group_by_list ::= expression", - /* 462 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 463 */ "having_clause_opt ::=", - /* 464 */ "having_clause_opt ::= HAVING search_condition", - /* 465 */ "range_opt ::=", - /* 466 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 467 */ "every_opt ::=", - /* 468 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 469 */ "query_expression ::= query_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", + /* 120 */ "speed_opt ::=", + /* 121 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 122 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 123 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 124 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 125 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 126 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 127 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 128 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 129 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 130 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 131 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 132 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 133 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 134 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 135 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 136 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 137 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 138 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 139 */ "multi_create_clause ::= create_subtable_clause", + /* 140 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 141 */ "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", + /* 142 */ "multi_drop_clause ::= drop_table_clause", + /* 143 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 144 */ "drop_table_clause ::= exists_opt full_table_name", + /* 145 */ "specific_cols_opt ::=", + /* 146 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 147 */ "full_table_name ::= table_name", + /* 148 */ "full_table_name ::= db_name NK_DOT table_name", + /* 149 */ "column_def_list ::= column_def", + /* 150 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 151 */ "column_def ::= column_name type_name", + /* 152 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 153 */ "type_name ::= BOOL", + /* 154 */ "type_name ::= TINYINT", + /* 155 */ "type_name ::= SMALLINT", + /* 156 */ "type_name ::= INT", + /* 157 */ "type_name ::= INTEGER", + /* 158 */ "type_name ::= BIGINT", + /* 159 */ "type_name ::= FLOAT", + /* 160 */ "type_name ::= DOUBLE", + /* 161 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 162 */ "type_name ::= TIMESTAMP", + /* 163 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 164 */ "type_name ::= TINYINT UNSIGNED", + /* 165 */ "type_name ::= SMALLINT UNSIGNED", + /* 166 */ "type_name ::= INT UNSIGNED", + /* 167 */ "type_name ::= BIGINT UNSIGNED", + /* 168 */ "type_name ::= JSON", + /* 169 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 170 */ "type_name ::= MEDIUMBLOB", + /* 171 */ "type_name ::= BLOB", + /* 172 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 173 */ "type_name ::= DECIMAL", + /* 174 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 175 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 176 */ "tags_def_opt ::=", + /* 177 */ "tags_def_opt ::= tags_def", + /* 178 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 179 */ "table_options ::=", + /* 180 */ "table_options ::= table_options COMMENT NK_STRING", + /* 181 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 182 */ "table_options ::= table_options WATERMARK duration_list", + /* 183 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 184 */ "table_options ::= table_options TTL NK_INTEGER", + /* 185 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 186 */ "alter_table_options ::= alter_table_option", + /* 187 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 188 */ "alter_table_option ::= COMMENT NK_STRING", + /* 189 */ "alter_table_option ::= TTL NK_INTEGER", + /* 190 */ "duration_list ::= duration_literal", + /* 191 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 192 */ "rollup_func_list ::= rollup_func_name", + /* 193 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 194 */ "rollup_func_name ::= function_name", + /* 195 */ "rollup_func_name ::= FIRST", + /* 196 */ "rollup_func_name ::= LAST", + /* 197 */ "col_name_list ::= col_name", + /* 198 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 199 */ "col_name ::= column_name", + /* 200 */ "cmd ::= SHOW DNODES", + /* 201 */ "cmd ::= SHOW USERS", + /* 202 */ "cmd ::= SHOW DATABASES", + /* 203 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 204 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 205 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 206 */ "cmd ::= SHOW MNODES", + /* 207 */ "cmd ::= SHOW MODULES", + /* 208 */ "cmd ::= SHOW QNODES", + /* 209 */ "cmd ::= SHOW FUNCTIONS", + /* 210 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 211 */ "cmd ::= SHOW STREAMS", + /* 212 */ "cmd ::= SHOW ACCOUNTS", + /* 213 */ "cmd ::= SHOW APPS", + /* 214 */ "cmd ::= SHOW CONNECTIONS", + /* 215 */ "cmd ::= SHOW LICENCES", + /* 216 */ "cmd ::= SHOW GRANTS", + /* 217 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 218 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 219 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 220 */ "cmd ::= SHOW QUERIES", + /* 221 */ "cmd ::= SHOW SCORES", + /* 222 */ "cmd ::= SHOW TOPICS", + /* 223 */ "cmd ::= SHOW VARIABLES", + /* 224 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 225 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", + /* 226 */ "cmd ::= SHOW BNODES", + /* 227 */ "cmd ::= SHOW SNODES", + /* 228 */ "cmd ::= SHOW CLUSTER", + /* 229 */ "cmd ::= SHOW TRANSACTIONS", + /* 230 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 231 */ "cmd ::= SHOW CONSUMERS", + /* 232 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 233 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 234 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 235 */ "cmd ::= SHOW VNODES NK_STRING", + /* 236 */ "db_name_cond_opt ::=", + /* 237 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 238 */ "like_pattern_opt ::=", + /* 239 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 240 */ "table_name_cond ::= table_name", + /* 241 */ "from_db_opt ::=", + /* 242 */ "from_db_opt ::= FROM db_name", + /* 243 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", + /* 244 */ "cmd ::= DROP INDEX exists_opt full_table_name", + /* 245 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 246 */ "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", + /* 247 */ "func_list ::= func", + /* 248 */ "func_list ::= func_list NK_COMMA func", + /* 249 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 250 */ "sma_stream_opt ::=", + /* 251 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", + /* 252 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", + /* 253 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 254 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 255 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 256 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 257 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 258 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 259 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 260 */ "cmd ::= DESC full_table_name", + /* 261 */ "cmd ::= DESCRIBE full_table_name", + /* 262 */ "cmd ::= RESET QUERY CACHE", + /* 263 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 264 */ "analyze_opt ::=", + /* 265 */ "analyze_opt ::= ANALYZE", + /* 266 */ "explain_options ::=", + /* 267 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 268 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 269 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 270 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 271 */ "agg_func_opt ::=", + /* 272 */ "agg_func_opt ::= AGGREGATE", + /* 273 */ "bufsize_opt ::=", + /* 274 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 275 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", + /* 276 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 277 */ "stream_options ::=", + /* 278 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 279 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 280 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 281 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 282 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 283 */ "subtable_opt ::=", + /* 284 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 285 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 286 */ "cmd ::= KILL QUERY NK_STRING", + /* 287 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 288 */ "cmd ::= BALANCE VGROUP", + /* 289 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 290 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 291 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 292 */ "dnode_list ::= DNODE NK_INTEGER", + /* 293 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 294 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 295 */ "cmd ::= query_or_subquery", + /* 296 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 297 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", + /* 298 */ "literal ::= NK_INTEGER", + /* 299 */ "literal ::= NK_FLOAT", + /* 300 */ "literal ::= NK_STRING", + /* 301 */ "literal ::= NK_BOOL", + /* 302 */ "literal ::= TIMESTAMP NK_STRING", + /* 303 */ "literal ::= duration_literal", + /* 304 */ "literal ::= NULL", + /* 305 */ "literal ::= NK_QUESTION", + /* 306 */ "duration_literal ::= NK_VARIABLE", + /* 307 */ "signed ::= NK_INTEGER", + /* 308 */ "signed ::= NK_PLUS NK_INTEGER", + /* 309 */ "signed ::= NK_MINUS NK_INTEGER", + /* 310 */ "signed ::= NK_FLOAT", + /* 311 */ "signed ::= NK_PLUS NK_FLOAT", + /* 312 */ "signed ::= NK_MINUS NK_FLOAT", + /* 313 */ "signed_literal ::= signed", + /* 314 */ "signed_literal ::= NK_STRING", + /* 315 */ "signed_literal ::= NK_BOOL", + /* 316 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 317 */ "signed_literal ::= duration_literal", + /* 318 */ "signed_literal ::= NULL", + /* 319 */ "signed_literal ::= literal_func", + /* 320 */ "signed_literal ::= NK_QUESTION", + /* 321 */ "literal_list ::= signed_literal", + /* 322 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 323 */ "db_name ::= NK_ID", + /* 324 */ "table_name ::= NK_ID", + /* 325 */ "column_name ::= NK_ID", + /* 326 */ "function_name ::= NK_ID", + /* 327 */ "table_alias ::= NK_ID", + /* 328 */ "column_alias ::= NK_ID", + /* 329 */ "user_name ::= NK_ID", + /* 330 */ "topic_name ::= NK_ID", + /* 331 */ "stream_name ::= NK_ID", + /* 332 */ "cgroup_name ::= NK_ID", + /* 333 */ "expr_or_subquery ::= expression", + /* 334 */ "expr_or_subquery ::= subquery", + /* 335 */ "expression ::= literal", + /* 336 */ "expression ::= pseudo_column", + /* 337 */ "expression ::= column_reference", + /* 338 */ "expression ::= function_expression", + /* 339 */ "expression ::= case_when_expression", + /* 340 */ "expression ::= NK_LP expression NK_RP", + /* 341 */ "expression ::= NK_PLUS expr_or_subquery", + /* 342 */ "expression ::= NK_MINUS expr_or_subquery", + /* 343 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 344 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 345 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 346 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 347 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 348 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 349 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 350 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 351 */ "expression_list ::= expr_or_subquery", + /* 352 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 353 */ "column_reference ::= column_name", + /* 354 */ "column_reference ::= table_name NK_DOT column_name", + /* 355 */ "pseudo_column ::= ROWTS", + /* 356 */ "pseudo_column ::= TBNAME", + /* 357 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 358 */ "pseudo_column ::= QSTART", + /* 359 */ "pseudo_column ::= QEND", + /* 360 */ "pseudo_column ::= QDURATION", + /* 361 */ "pseudo_column ::= WSTART", + /* 362 */ "pseudo_column ::= WEND", + /* 363 */ "pseudo_column ::= WDURATION", + /* 364 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 365 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 366 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 367 */ "function_expression ::= literal_func", + /* 368 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 369 */ "literal_func ::= NOW", + /* 370 */ "noarg_func ::= NOW", + /* 371 */ "noarg_func ::= TODAY", + /* 372 */ "noarg_func ::= TIMEZONE", + /* 373 */ "noarg_func ::= DATABASE", + /* 374 */ "noarg_func ::= CLIENT_VERSION", + /* 375 */ "noarg_func ::= SERVER_VERSION", + /* 376 */ "noarg_func ::= SERVER_STATUS", + /* 377 */ "noarg_func ::= CURRENT_USER", + /* 378 */ "noarg_func ::= USER", + /* 379 */ "star_func ::= COUNT", + /* 380 */ "star_func ::= FIRST", + /* 381 */ "star_func ::= LAST", + /* 382 */ "star_func ::= LAST_ROW", + /* 383 */ "star_func_para_list ::= NK_STAR", + /* 384 */ "star_func_para_list ::= other_para_list", + /* 385 */ "other_para_list ::= star_func_para", + /* 386 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 387 */ "star_func_para ::= expr_or_subquery", + /* 388 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 389 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 390 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 391 */ "when_then_list ::= when_then_expr", + /* 392 */ "when_then_list ::= when_then_list when_then_expr", + /* 393 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 394 */ "case_when_else_opt ::=", + /* 395 */ "case_when_else_opt ::= ELSE common_expression", + /* 396 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 397 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 398 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 399 */ "predicate ::= expr_or_subquery IS NULL", + /* 400 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 401 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 402 */ "compare_op ::= NK_LT", + /* 403 */ "compare_op ::= NK_GT", + /* 404 */ "compare_op ::= NK_LE", + /* 405 */ "compare_op ::= NK_GE", + /* 406 */ "compare_op ::= NK_NE", + /* 407 */ "compare_op ::= NK_EQ", + /* 408 */ "compare_op ::= LIKE", + /* 409 */ "compare_op ::= NOT LIKE", + /* 410 */ "compare_op ::= MATCH", + /* 411 */ "compare_op ::= NMATCH", + /* 412 */ "compare_op ::= CONTAINS", + /* 413 */ "in_op ::= IN", + /* 414 */ "in_op ::= NOT IN", + /* 415 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 416 */ "boolean_value_expression ::= boolean_primary", + /* 417 */ "boolean_value_expression ::= NOT boolean_primary", + /* 418 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 419 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 420 */ "boolean_primary ::= predicate", + /* 421 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 422 */ "common_expression ::= expr_or_subquery", + /* 423 */ "common_expression ::= boolean_value_expression", + /* 424 */ "from_clause_opt ::=", + /* 425 */ "from_clause_opt ::= FROM table_reference_list", + /* 426 */ "table_reference_list ::= table_reference", + /* 427 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 428 */ "table_reference ::= table_primary", + /* 429 */ "table_reference ::= joined_table", + /* 430 */ "table_primary ::= table_name alias_opt", + /* 431 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 432 */ "table_primary ::= subquery alias_opt", + /* 433 */ "table_primary ::= parenthesized_joined_table", + /* 434 */ "alias_opt ::=", + /* 435 */ "alias_opt ::= table_alias", + /* 436 */ "alias_opt ::= AS table_alias", + /* 437 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 438 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 439 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 440 */ "join_type ::=", + /* 441 */ "join_type ::= INNER", + /* 442 */ "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", + /* 443 */ "set_quantifier_opt ::=", + /* 444 */ "set_quantifier_opt ::= DISTINCT", + /* 445 */ "set_quantifier_opt ::= ALL", + /* 446 */ "select_list ::= select_item", + /* 447 */ "select_list ::= select_list NK_COMMA select_item", + /* 448 */ "select_item ::= NK_STAR", + /* 449 */ "select_item ::= common_expression", + /* 450 */ "select_item ::= common_expression column_alias", + /* 451 */ "select_item ::= common_expression AS column_alias", + /* 452 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 453 */ "where_clause_opt ::=", + /* 454 */ "where_clause_opt ::= WHERE search_condition", + /* 455 */ "partition_by_clause_opt ::=", + /* 456 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 457 */ "partition_list ::= partition_item", + /* 458 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 459 */ "partition_item ::= expr_or_subquery", + /* 460 */ "partition_item ::= expr_or_subquery column_alias", + /* 461 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 462 */ "twindow_clause_opt ::=", + /* 463 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 464 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 465 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 466 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 467 */ "sliding_opt ::=", + /* 468 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 469 */ "fill_opt ::=", + /* 470 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 471 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 472 */ "fill_mode ::= NONE", + /* 473 */ "fill_mode ::= PREV", + /* 474 */ "fill_mode ::= NULL", + /* 475 */ "fill_mode ::= LINEAR", + /* 476 */ "fill_mode ::= NEXT", + /* 477 */ "group_by_clause_opt ::=", + /* 478 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 479 */ "group_by_list ::= expr_or_subquery", + /* 480 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 481 */ "having_clause_opt ::=", + /* 482 */ "having_clause_opt ::= HAVING search_condition", + /* 483 */ "range_opt ::=", + /* 484 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 485 */ "every_opt ::=", + /* 486 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 487 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 488 */ "query_simple ::= query_specification", + /* 489 */ "query_simple ::= union_query_expression", + /* 490 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 491 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 492 */ "query_simple_or_subquery ::= query_simple", + /* 493 */ "query_simple_or_subquery ::= subquery", + /* 494 */ "query_or_subquery ::= query_expression", + /* 495 */ "query_or_subquery ::= subquery", + /* 496 */ "order_by_clause_opt ::=", + /* 497 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 498 */ "slimit_clause_opt ::=", + /* 499 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 500 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 501 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 502 */ "limit_clause_opt ::=", + /* 503 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 504 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 505 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 506 */ "subquery ::= NK_LP query_expression NK_RP", + /* 507 */ "subquery ::= NK_LP subquery NK_RP", + /* 508 */ "search_condition ::= common_expression", + /* 509 */ "sort_specification_list ::= sort_specification", + /* 510 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 511 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 512 */ "ordering_specification_opt ::=", + /* 513 */ "ordering_specification_opt ::= ASC", + /* 514 */ "ordering_specification_opt ::= DESC", + /* 515 */ "null_ordering_opt ::=", + /* 516 */ "null_ordering_opt ::= NULLS FIRST", + /* 517 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2335,181 +2481,190 @@ 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 315: /* cmd */ + case 318: /* literal */ + case 329: /* db_options */ + case 331: /* alter_db_options */ + case 337: /* retention */ + case 338: /* full_table_name */ + case 341: /* table_options */ + case 345: /* alter_table_clause */ + case 346: /* alter_table_options */ + case 349: /* signed_literal */ + case 350: /* create_subtable_clause */ + case 353: /* drop_table_clause */ + case 356: /* column_def */ + case 360: /* duration_literal */ + case 361: /* rollup_func_name */ + case 363: /* col_name */ + case 364: /* db_name_cond_opt */ + case 365: /* like_pattern_opt */ + case 366: /* table_name_cond */ + case 367: /* from_db_opt */ + case 368: /* index_options */ + case 370: /* sliding_opt */ + case 371: /* sma_stream_opt */ + case 372: /* func */ + case 373: /* stream_options */ + case 375: /* query_or_subquery */ + case 378: /* explain_options */ + case 382: /* subtable_opt */ + case 383: /* expression */ + case 385: /* where_clause_opt */ + case 386: /* signed */ + case 387: /* literal_func */ + case 391: /* expr_or_subquery */ + case 392: /* subquery */ + case 393: /* pseudo_column */ + case 394: /* column_reference */ + case 395: /* function_expression */ + case 396: /* case_when_expression */ + case 401: /* star_func_para */ + case 403: /* case_when_else_opt */ + case 404: /* common_expression */ + case 405: /* when_then_expr */ + case 406: /* predicate */ + case 409: /* in_predicate_value */ + case 410: /* boolean_value_expression */ + case 411: /* boolean_primary */ + case 412: /* from_clause_opt */ + case 413: /* table_reference_list */ + case 414: /* table_reference */ + case 415: /* table_primary */ + case 416: /* joined_table */ + case 418: /* parenthesized_joined_table */ + case 420: /* search_condition */ + case 421: /* query_specification */ + case 425: /* range_opt */ + case 426: /* every_opt */ + case 427: /* fill_opt */ + case 428: /* twindow_clause_opt */ + case 430: /* having_clause_opt */ + case 431: /* select_item */ + case 433: /* partition_item */ + case 436: /* query_expression */ + case 437: /* query_simple */ + case 439: /* slimit_clause_opt */ + case 440: /* limit_clause_opt */ + case 441: /* union_query_expression */ + case 442: /* query_simple_or_subquery */ + case 444: /* sort_specification */ { - nodesDestroyNode((yypminor->yy776)); + nodesDestroyNode((yypminor->yy392)); } break; - case 310: /* account_options */ - case 311: /* alter_account_options */ - case 313: /* alter_account_option */ - case 373: /* bufsize_opt */ + case 316: /* account_options */ + case 317: /* alter_account_options */ + case 319: /* alter_account_option */ + case 332: /* speed_opt */ + case 380: /* 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 320: /* user_name */ + case 323: /* priv_level */ + case 326: /* db_name */ + case 327: /* dnode_endpoint */ + case 347: /* column_name */ + case 355: /* table_name */ + case 362: /* function_name */ + case 374: /* topic_name */ + case 376: /* cgroup_name */ + case 381: /* stream_name */ + case 389: /* table_alias */ + case 390: /* column_alias */ + case 397: /* star_func */ + case 399: /* noarg_func */ + case 417: /* alias_opt */ { } break; - case 315: /* sysinfo_opt */ + case 321: /* sysinfo_opt */ { } break; - case 316: /* privileges */ - case 318: /* priv_type_list */ - case 319: /* priv_type */ + case 322: /* privileges */ + case 324: /* priv_type_list */ + case 325: /* 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 328: /* not_exists_opt */ + case 330: /* exists_opt */ + case 377: /* analyze_opt */ + case 379: /* agg_func_opt */ + case 422: /* 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 333: /* integer_list */ + case 334: /* variable_list */ + case 335: /* retention_list */ + case 339: /* column_def_list */ + case 340: /* tags_def_opt */ + case 342: /* multi_create_clause */ + case 343: /* tags_def */ + case 344: /* multi_drop_clause */ + case 351: /* specific_cols_opt */ + case 352: /* expression_list */ + case 354: /* col_name_list */ + case 357: /* duration_list */ + case 358: /* rollup_func_list */ + case 369: /* func_list */ + case 384: /* dnode_list */ + case 388: /* literal_list */ + case 398: /* star_func_para_list */ + case 400: /* other_para_list */ + case 402: /* when_then_list */ + case 423: /* select_list */ + case 424: /* partition_by_clause_opt */ + case 429: /* group_by_clause_opt */ + case 432: /* partition_list */ + case 435: /* group_by_list */ + case 438: /* order_by_clause_opt */ + case 443: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy280)); + nodesDestroyList((yypminor->yy148)); } break; - case 329: /* alter_db_option */ - case 352: /* alter_table_option */ + case 336: /* alter_db_option */ + case 359: /* alter_table_option */ { } break; - case 341: /* type_name */ + case 348: /* type_name */ { } break; - case 393: /* compare_op */ - case 394: /* in_op */ + case 407: /* compare_op */ + case 408: /* in_op */ { } break; - case 406: /* join_type */ + case 419: /* join_type */ { } break; - case 419: /* fill_mode */ + case 434: /* fill_mode */ { } break; - case 430: /* ordering_specification_opt */ + case 445: /* ordering_specification_opt */ { } break; - case 431: /* null_ordering_opt */ + case 446: /* null_ordering_opt */ { } @@ -2808,505 +2963,524 @@ 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 */ + { 315, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 315, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 316, 0 }, /* (2) account_options ::= */ + { 316, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 316, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 316, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 316, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 316, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 316, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 316, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 316, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 316, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 317, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 317, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 319, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 319, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 319, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 319, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 319, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 319, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 319, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 319, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 319, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 319, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 315, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 315, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 315, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 315, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 315, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 321, 0 }, /* (29) sysinfo_opt ::= */ + { 321, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 315, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 315, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 322, -1 }, /* (33) privileges ::= ALL */ + { 322, -1 }, /* (34) privileges ::= priv_type_list */ + { 324, -1 }, /* (35) priv_type_list ::= priv_type */ + { 324, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 325, -1 }, /* (37) priv_type ::= READ */ + { 325, -1 }, /* (38) priv_type ::= WRITE */ + { 323, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 323, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 315, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 315, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 315, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 315, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 315, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 315, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 315, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 315, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 327, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 327, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 327, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 315, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 315, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 315, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 315, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 315, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 315, -2 }, /* (64) cmd ::= USE db_name */ + { 315, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 315, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ + { 315, -4 }, /* (67) cmd ::= TRIM DATABASE db_name speed_opt */ + { 328, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ + { 328, 0 }, /* (69) not_exists_opt ::= */ + { 330, -2 }, /* (70) exists_opt ::= IF EXISTS */ + { 330, 0 }, /* (71) exists_opt ::= */ + { 329, 0 }, /* (72) db_options ::= */ + { 329, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ + { 329, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ + { 329, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ + { 329, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ + { 329, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ + { 329, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ + { 329, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */ + { 329, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */ + { 329, -3 }, /* (81) db_options ::= db_options KEEP integer_list */ + { 329, -3 }, /* (82) db_options ::= db_options KEEP variable_list */ + { 329, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */ + { 329, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 329, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + { 329, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ + { 329, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ + { 329, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ + { 329, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */ + { 329, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 329, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */ + { 329, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 329, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + { 329, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + { 329, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 329, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 329, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 329, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 329, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 329, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 329, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + { 329, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + { 329, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + { 331, -1 }, /* (104) alter_db_options ::= alter_db_option */ + { 331, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */ + { 336, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */ + { 336, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 336, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 336, -2 }, /* (109) alter_db_option ::= KEEP integer_list */ + { 336, -2 }, /* (110) alter_db_option ::= KEEP variable_list */ + { 336, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 336, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 333, -1 }, /* (113) integer_list ::= NK_INTEGER */ + { 333, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 334, -1 }, /* (115) variable_list ::= NK_VARIABLE */ + { 334, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 335, -1 }, /* (117) retention_list ::= retention */ + { 335, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */ + { 337, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 332, 0 }, /* (120) speed_opt ::= */ + { 332, -2 }, /* (121) speed_opt ::= MAX_SPEED NK_INTEGER */ + { 315, -9 }, /* (122) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 315, -3 }, /* (123) cmd ::= CREATE TABLE multi_create_clause */ + { 315, -9 }, /* (124) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 315, -3 }, /* (125) cmd ::= DROP TABLE multi_drop_clause */ + { 315, -4 }, /* (126) cmd ::= DROP STABLE exists_opt full_table_name */ + { 315, -3 }, /* (127) cmd ::= ALTER TABLE alter_table_clause */ + { 315, -3 }, /* (128) cmd ::= ALTER STABLE alter_table_clause */ + { 345, -2 }, /* (129) alter_table_clause ::= full_table_name alter_table_options */ + { 345, -5 }, /* (130) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 345, -4 }, /* (131) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 345, -5 }, /* (132) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 345, -5 }, /* (133) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 345, -5 }, /* (134) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 345, -4 }, /* (135) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 345, -5 }, /* (136) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 345, -5 }, /* (137) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 345, -6 }, /* (138) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 342, -1 }, /* (139) multi_create_clause ::= create_subtable_clause */ + { 342, -2 }, /* (140) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 350, -10 }, /* (141) 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 */ + { 344, -1 }, /* (142) multi_drop_clause ::= drop_table_clause */ + { 344, -2 }, /* (143) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 353, -2 }, /* (144) drop_table_clause ::= exists_opt full_table_name */ + { 351, 0 }, /* (145) specific_cols_opt ::= */ + { 351, -3 }, /* (146) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 338, -1 }, /* (147) full_table_name ::= table_name */ + { 338, -3 }, /* (148) full_table_name ::= db_name NK_DOT table_name */ + { 339, -1 }, /* (149) column_def_list ::= column_def */ + { 339, -3 }, /* (150) column_def_list ::= column_def_list NK_COMMA column_def */ + { 356, -2 }, /* (151) column_def ::= column_name type_name */ + { 356, -4 }, /* (152) column_def ::= column_name type_name COMMENT NK_STRING */ + { 348, -1 }, /* (153) type_name ::= BOOL */ + { 348, -1 }, /* (154) type_name ::= TINYINT */ + { 348, -1 }, /* (155) type_name ::= SMALLINT */ + { 348, -1 }, /* (156) type_name ::= INT */ + { 348, -1 }, /* (157) type_name ::= INTEGER */ + { 348, -1 }, /* (158) type_name ::= BIGINT */ + { 348, -1 }, /* (159) type_name ::= FLOAT */ + { 348, -1 }, /* (160) type_name ::= DOUBLE */ + { 348, -4 }, /* (161) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 348, -1 }, /* (162) type_name ::= TIMESTAMP */ + { 348, -4 }, /* (163) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 348, -2 }, /* (164) type_name ::= TINYINT UNSIGNED */ + { 348, -2 }, /* (165) type_name ::= SMALLINT UNSIGNED */ + { 348, -2 }, /* (166) type_name ::= INT UNSIGNED */ + { 348, -2 }, /* (167) type_name ::= BIGINT UNSIGNED */ + { 348, -1 }, /* (168) type_name ::= JSON */ + { 348, -4 }, /* (169) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 348, -1 }, /* (170) type_name ::= MEDIUMBLOB */ + { 348, -1 }, /* (171) type_name ::= BLOB */ + { 348, -4 }, /* (172) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 348, -1 }, /* (173) type_name ::= DECIMAL */ + { 348, -4 }, /* (174) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 348, -6 }, /* (175) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 340, 0 }, /* (176) tags_def_opt ::= */ + { 340, -1 }, /* (177) tags_def_opt ::= tags_def */ + { 343, -4 }, /* (178) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 341, 0 }, /* (179) table_options ::= */ + { 341, -3 }, /* (180) table_options ::= table_options COMMENT NK_STRING */ + { 341, -3 }, /* (181) table_options ::= table_options MAX_DELAY duration_list */ + { 341, -3 }, /* (182) table_options ::= table_options WATERMARK duration_list */ + { 341, -5 }, /* (183) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 341, -3 }, /* (184) table_options ::= table_options TTL NK_INTEGER */ + { 341, -5 }, /* (185) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 346, -1 }, /* (186) alter_table_options ::= alter_table_option */ + { 346, -2 }, /* (187) alter_table_options ::= alter_table_options alter_table_option */ + { 359, -2 }, /* (188) alter_table_option ::= COMMENT NK_STRING */ + { 359, -2 }, /* (189) alter_table_option ::= TTL NK_INTEGER */ + { 357, -1 }, /* (190) duration_list ::= duration_literal */ + { 357, -3 }, /* (191) duration_list ::= duration_list NK_COMMA duration_literal */ + { 358, -1 }, /* (192) rollup_func_list ::= rollup_func_name */ + { 358, -3 }, /* (193) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 361, -1 }, /* (194) rollup_func_name ::= function_name */ + { 361, -1 }, /* (195) rollup_func_name ::= FIRST */ + { 361, -1 }, /* (196) rollup_func_name ::= LAST */ + { 354, -1 }, /* (197) col_name_list ::= col_name */ + { 354, -3 }, /* (198) col_name_list ::= col_name_list NK_COMMA col_name */ + { 363, -1 }, /* (199) col_name ::= column_name */ + { 315, -2 }, /* (200) cmd ::= SHOW DNODES */ + { 315, -2 }, /* (201) cmd ::= SHOW USERS */ + { 315, -2 }, /* (202) cmd ::= SHOW DATABASES */ + { 315, -4 }, /* (203) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 315, -4 }, /* (204) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 315, -3 }, /* (205) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 315, -2 }, /* (206) cmd ::= SHOW MNODES */ + { 315, -2 }, /* (207) cmd ::= SHOW MODULES */ + { 315, -2 }, /* (208) cmd ::= SHOW QNODES */ + { 315, -2 }, /* (209) cmd ::= SHOW FUNCTIONS */ + { 315, -5 }, /* (210) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 315, -2 }, /* (211) cmd ::= SHOW STREAMS */ + { 315, -2 }, /* (212) cmd ::= SHOW ACCOUNTS */ + { 315, -2 }, /* (213) cmd ::= SHOW APPS */ + { 315, -2 }, /* (214) cmd ::= SHOW CONNECTIONS */ + { 315, -2 }, /* (215) cmd ::= SHOW LICENCES */ + { 315, -2 }, /* (216) cmd ::= SHOW GRANTS */ + { 315, -4 }, /* (217) cmd ::= SHOW CREATE DATABASE db_name */ + { 315, -4 }, /* (218) cmd ::= SHOW CREATE TABLE full_table_name */ + { 315, -4 }, /* (219) cmd ::= SHOW CREATE STABLE full_table_name */ + { 315, -2 }, /* (220) cmd ::= SHOW QUERIES */ + { 315, -2 }, /* (221) cmd ::= SHOW SCORES */ + { 315, -2 }, /* (222) cmd ::= SHOW TOPICS */ + { 315, -2 }, /* (223) cmd ::= SHOW VARIABLES */ + { 315, -3 }, /* (224) cmd ::= SHOW LOCAL VARIABLES */ + { 315, -4 }, /* (225) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 315, -2 }, /* (226) cmd ::= SHOW BNODES */ + { 315, -2 }, /* (227) cmd ::= SHOW SNODES */ + { 315, -2 }, /* (228) cmd ::= SHOW CLUSTER */ + { 315, -2 }, /* (229) cmd ::= SHOW TRANSACTIONS */ + { 315, -4 }, /* (230) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 315, -2 }, /* (231) cmd ::= SHOW CONSUMERS */ + { 315, -2 }, /* (232) cmd ::= SHOW SUBSCRIPTIONS */ + { 315, -5 }, /* (233) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 315, -3 }, /* (234) cmd ::= SHOW VNODES NK_INTEGER */ + { 315, -3 }, /* (235) cmd ::= SHOW VNODES NK_STRING */ + { 364, 0 }, /* (236) db_name_cond_opt ::= */ + { 364, -2 }, /* (237) db_name_cond_opt ::= db_name NK_DOT */ + { 365, 0 }, /* (238) like_pattern_opt ::= */ + { 365, -2 }, /* (239) like_pattern_opt ::= LIKE NK_STRING */ + { 366, -1 }, /* (240) table_name_cond ::= table_name */ + { 367, 0 }, /* (241) from_db_opt ::= */ + { 367, -2 }, /* (242) from_db_opt ::= FROM db_name */ + { 315, -8 }, /* (243) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + { 315, -4 }, /* (244) cmd ::= DROP INDEX exists_opt full_table_name */ + { 368, -10 }, /* (245) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 368, -12 }, /* (246) 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 */ + { 369, -1 }, /* (247) func_list ::= func */ + { 369, -3 }, /* (248) func_list ::= func_list NK_COMMA func */ + { 372, -4 }, /* (249) func ::= function_name NK_LP expression_list NK_RP */ + { 371, 0 }, /* (250) sma_stream_opt ::= */ + { 371, -3 }, /* (251) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 371, -3 }, /* (252) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 315, -6 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 315, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 315, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 315, -7 }, /* (256) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 315, -9 }, /* (257) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 315, -4 }, /* (258) cmd ::= DROP TOPIC exists_opt topic_name */ + { 315, -7 }, /* (259) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 315, -2 }, /* (260) cmd ::= DESC full_table_name */ + { 315, -2 }, /* (261) cmd ::= DESCRIBE full_table_name */ + { 315, -3 }, /* (262) cmd ::= RESET QUERY CACHE */ + { 315, -4 }, /* (263) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 377, 0 }, /* (264) analyze_opt ::= */ + { 377, -1 }, /* (265) analyze_opt ::= ANALYZE */ + { 378, 0 }, /* (266) explain_options ::= */ + { 378, -3 }, /* (267) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 378, -3 }, /* (268) explain_options ::= explain_options RATIO NK_FLOAT */ + { 315, -10 }, /* (269) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 315, -4 }, /* (270) cmd ::= DROP FUNCTION exists_opt function_name */ + { 379, 0 }, /* (271) agg_func_opt ::= */ + { 379, -1 }, /* (272) agg_func_opt ::= AGGREGATE */ + { 380, 0 }, /* (273) bufsize_opt ::= */ + { 380, -2 }, /* (274) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 315, -11 }, /* (275) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ + { 315, -4 }, /* (276) cmd ::= DROP STREAM exists_opt stream_name */ + { 373, 0 }, /* (277) stream_options ::= */ + { 373, -3 }, /* (278) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 373, -3 }, /* (279) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 373, -4 }, /* (280) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 373, -3 }, /* (281) stream_options ::= stream_options WATERMARK duration_literal */ + { 373, -4 }, /* (282) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 382, 0 }, /* (283) subtable_opt ::= */ + { 382, -4 }, /* (284) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 315, -3 }, /* (285) cmd ::= KILL CONNECTION NK_INTEGER */ + { 315, -3 }, /* (286) cmd ::= KILL QUERY NK_STRING */ + { 315, -3 }, /* (287) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 315, -2 }, /* (288) cmd ::= BALANCE VGROUP */ + { 315, -4 }, /* (289) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 315, -4 }, /* (290) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 315, -3 }, /* (291) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 384, -2 }, /* (292) dnode_list ::= DNODE NK_INTEGER */ + { 384, -3 }, /* (293) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 315, -4 }, /* (294) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 315, -1 }, /* (295) cmd ::= query_or_subquery */ + { 315, -7 }, /* (296) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 315, -4 }, /* (297) cmd ::= INSERT INTO full_table_name query_or_subquery */ + { 318, -1 }, /* (298) literal ::= NK_INTEGER */ + { 318, -1 }, /* (299) literal ::= NK_FLOAT */ + { 318, -1 }, /* (300) literal ::= NK_STRING */ + { 318, -1 }, /* (301) literal ::= NK_BOOL */ + { 318, -2 }, /* (302) literal ::= TIMESTAMP NK_STRING */ + { 318, -1 }, /* (303) literal ::= duration_literal */ + { 318, -1 }, /* (304) literal ::= NULL */ + { 318, -1 }, /* (305) literal ::= NK_QUESTION */ + { 360, -1 }, /* (306) duration_literal ::= NK_VARIABLE */ + { 386, -1 }, /* (307) signed ::= NK_INTEGER */ + { 386, -2 }, /* (308) signed ::= NK_PLUS NK_INTEGER */ + { 386, -2 }, /* (309) signed ::= NK_MINUS NK_INTEGER */ + { 386, -1 }, /* (310) signed ::= NK_FLOAT */ + { 386, -2 }, /* (311) signed ::= NK_PLUS NK_FLOAT */ + { 386, -2 }, /* (312) signed ::= NK_MINUS NK_FLOAT */ + { 349, -1 }, /* (313) signed_literal ::= signed */ + { 349, -1 }, /* (314) signed_literal ::= NK_STRING */ + { 349, -1 }, /* (315) signed_literal ::= NK_BOOL */ + { 349, -2 }, /* (316) signed_literal ::= TIMESTAMP NK_STRING */ + { 349, -1 }, /* (317) signed_literal ::= duration_literal */ + { 349, -1 }, /* (318) signed_literal ::= NULL */ + { 349, -1 }, /* (319) signed_literal ::= literal_func */ + { 349, -1 }, /* (320) signed_literal ::= NK_QUESTION */ + { 388, -1 }, /* (321) literal_list ::= signed_literal */ + { 388, -3 }, /* (322) literal_list ::= literal_list NK_COMMA signed_literal */ + { 326, -1 }, /* (323) db_name ::= NK_ID */ + { 355, -1 }, /* (324) table_name ::= NK_ID */ + { 347, -1 }, /* (325) column_name ::= NK_ID */ + { 362, -1 }, /* (326) function_name ::= NK_ID */ + { 389, -1 }, /* (327) table_alias ::= NK_ID */ + { 390, -1 }, /* (328) column_alias ::= NK_ID */ + { 320, -1 }, /* (329) user_name ::= NK_ID */ + { 374, -1 }, /* (330) topic_name ::= NK_ID */ + { 381, -1 }, /* (331) stream_name ::= NK_ID */ + { 376, -1 }, /* (332) cgroup_name ::= NK_ID */ + { 391, -1 }, /* (333) expr_or_subquery ::= expression */ + { 391, -1 }, /* (334) expr_or_subquery ::= subquery */ + { 383, -1 }, /* (335) expression ::= literal */ + { 383, -1 }, /* (336) expression ::= pseudo_column */ + { 383, -1 }, /* (337) expression ::= column_reference */ + { 383, -1 }, /* (338) expression ::= function_expression */ + { 383, -1 }, /* (339) expression ::= case_when_expression */ + { 383, -3 }, /* (340) expression ::= NK_LP expression NK_RP */ + { 383, -2 }, /* (341) expression ::= NK_PLUS expr_or_subquery */ + { 383, -2 }, /* (342) expression ::= NK_MINUS expr_or_subquery */ + { 383, -3 }, /* (343) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 383, -3 }, /* (344) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 383, -3 }, /* (345) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 383, -3 }, /* (346) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 383, -3 }, /* (347) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 383, -3 }, /* (348) expression ::= column_reference NK_ARROW NK_STRING */ + { 383, -3 }, /* (349) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 383, -3 }, /* (350) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 352, -1 }, /* (351) expression_list ::= expr_or_subquery */ + { 352, -3 }, /* (352) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 394, -1 }, /* (353) column_reference ::= column_name */ + { 394, -3 }, /* (354) column_reference ::= table_name NK_DOT column_name */ + { 393, -1 }, /* (355) pseudo_column ::= ROWTS */ + { 393, -1 }, /* (356) pseudo_column ::= TBNAME */ + { 393, -3 }, /* (357) pseudo_column ::= table_name NK_DOT TBNAME */ + { 393, -1 }, /* (358) pseudo_column ::= QSTART */ + { 393, -1 }, /* (359) pseudo_column ::= QEND */ + { 393, -1 }, /* (360) pseudo_column ::= QDURATION */ + { 393, -1 }, /* (361) pseudo_column ::= WSTART */ + { 393, -1 }, /* (362) pseudo_column ::= WEND */ + { 393, -1 }, /* (363) pseudo_column ::= WDURATION */ + { 395, -4 }, /* (364) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 395, -4 }, /* (365) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 395, -6 }, /* (366) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 395, -1 }, /* (367) function_expression ::= literal_func */ + { 387, -3 }, /* (368) literal_func ::= noarg_func NK_LP NK_RP */ + { 387, -1 }, /* (369) literal_func ::= NOW */ + { 399, -1 }, /* (370) noarg_func ::= NOW */ + { 399, -1 }, /* (371) noarg_func ::= TODAY */ + { 399, -1 }, /* (372) noarg_func ::= TIMEZONE */ + { 399, -1 }, /* (373) noarg_func ::= DATABASE */ + { 399, -1 }, /* (374) noarg_func ::= CLIENT_VERSION */ + { 399, -1 }, /* (375) noarg_func ::= SERVER_VERSION */ + { 399, -1 }, /* (376) noarg_func ::= SERVER_STATUS */ + { 399, -1 }, /* (377) noarg_func ::= CURRENT_USER */ + { 399, -1 }, /* (378) noarg_func ::= USER */ + { 397, -1 }, /* (379) star_func ::= COUNT */ + { 397, -1 }, /* (380) star_func ::= FIRST */ + { 397, -1 }, /* (381) star_func ::= LAST */ + { 397, -1 }, /* (382) star_func ::= LAST_ROW */ + { 398, -1 }, /* (383) star_func_para_list ::= NK_STAR */ + { 398, -1 }, /* (384) star_func_para_list ::= other_para_list */ + { 400, -1 }, /* (385) other_para_list ::= star_func_para */ + { 400, -3 }, /* (386) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 401, -1 }, /* (387) star_func_para ::= expr_or_subquery */ + { 401, -3 }, /* (388) star_func_para ::= table_name NK_DOT NK_STAR */ + { 396, -4 }, /* (389) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 396, -5 }, /* (390) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 402, -1 }, /* (391) when_then_list ::= when_then_expr */ + { 402, -2 }, /* (392) when_then_list ::= when_then_list when_then_expr */ + { 405, -4 }, /* (393) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 403, 0 }, /* (394) case_when_else_opt ::= */ + { 403, -2 }, /* (395) case_when_else_opt ::= ELSE common_expression */ + { 406, -3 }, /* (396) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 406, -5 }, /* (397) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 406, -6 }, /* (398) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 406, -3 }, /* (399) predicate ::= expr_or_subquery IS NULL */ + { 406, -4 }, /* (400) predicate ::= expr_or_subquery IS NOT NULL */ + { 406, -3 }, /* (401) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 407, -1 }, /* (402) compare_op ::= NK_LT */ + { 407, -1 }, /* (403) compare_op ::= NK_GT */ + { 407, -1 }, /* (404) compare_op ::= NK_LE */ + { 407, -1 }, /* (405) compare_op ::= NK_GE */ + { 407, -1 }, /* (406) compare_op ::= NK_NE */ + { 407, -1 }, /* (407) compare_op ::= NK_EQ */ + { 407, -1 }, /* (408) compare_op ::= LIKE */ + { 407, -2 }, /* (409) compare_op ::= NOT LIKE */ + { 407, -1 }, /* (410) compare_op ::= MATCH */ + { 407, -1 }, /* (411) compare_op ::= NMATCH */ + { 407, -1 }, /* (412) compare_op ::= CONTAINS */ + { 408, -1 }, /* (413) in_op ::= IN */ + { 408, -2 }, /* (414) in_op ::= NOT IN */ + { 409, -3 }, /* (415) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 410, -1 }, /* (416) boolean_value_expression ::= boolean_primary */ + { 410, -2 }, /* (417) boolean_value_expression ::= NOT boolean_primary */ + { 410, -3 }, /* (418) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 410, -3 }, /* (419) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 411, -1 }, /* (420) boolean_primary ::= predicate */ + { 411, -3 }, /* (421) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 404, -1 }, /* (422) common_expression ::= expr_or_subquery */ + { 404, -1 }, /* (423) common_expression ::= boolean_value_expression */ + { 412, 0 }, /* (424) from_clause_opt ::= */ + { 412, -2 }, /* (425) from_clause_opt ::= FROM table_reference_list */ + { 413, -1 }, /* (426) table_reference_list ::= table_reference */ + { 413, -3 }, /* (427) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 414, -1 }, /* (428) table_reference ::= table_primary */ + { 414, -1 }, /* (429) table_reference ::= joined_table */ + { 415, -2 }, /* (430) table_primary ::= table_name alias_opt */ + { 415, -4 }, /* (431) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 415, -2 }, /* (432) table_primary ::= subquery alias_opt */ + { 415, -1 }, /* (433) table_primary ::= parenthesized_joined_table */ + { 417, 0 }, /* (434) alias_opt ::= */ + { 417, -1 }, /* (435) alias_opt ::= table_alias */ + { 417, -2 }, /* (436) alias_opt ::= AS table_alias */ + { 418, -3 }, /* (437) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 418, -3 }, /* (438) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 416, -6 }, /* (439) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 419, 0 }, /* (440) join_type ::= */ + { 419, -1 }, /* (441) join_type ::= INNER */ + { 421, -12 }, /* (442) 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 */ + { 422, 0 }, /* (443) set_quantifier_opt ::= */ + { 422, -1 }, /* (444) set_quantifier_opt ::= DISTINCT */ + { 422, -1 }, /* (445) set_quantifier_opt ::= ALL */ + { 423, -1 }, /* (446) select_list ::= select_item */ + { 423, -3 }, /* (447) select_list ::= select_list NK_COMMA select_item */ + { 431, -1 }, /* (448) select_item ::= NK_STAR */ + { 431, -1 }, /* (449) select_item ::= common_expression */ + { 431, -2 }, /* (450) select_item ::= common_expression column_alias */ + { 431, -3 }, /* (451) select_item ::= common_expression AS column_alias */ + { 431, -3 }, /* (452) select_item ::= table_name NK_DOT NK_STAR */ + { 385, 0 }, /* (453) where_clause_opt ::= */ + { 385, -2 }, /* (454) where_clause_opt ::= WHERE search_condition */ + { 424, 0 }, /* (455) partition_by_clause_opt ::= */ + { 424, -3 }, /* (456) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 432, -1 }, /* (457) partition_list ::= partition_item */ + { 432, -3 }, /* (458) partition_list ::= partition_list NK_COMMA partition_item */ + { 433, -1 }, /* (459) partition_item ::= expr_or_subquery */ + { 433, -2 }, /* (460) partition_item ::= expr_or_subquery column_alias */ + { 433, -3 }, /* (461) partition_item ::= expr_or_subquery AS column_alias */ + { 428, 0 }, /* (462) twindow_clause_opt ::= */ + { 428, -6 }, /* (463) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 428, -4 }, /* (464) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 428, -6 }, /* (465) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 428, -8 }, /* (466) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 370, 0 }, /* (467) sliding_opt ::= */ + { 370, -4 }, /* (468) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 427, 0 }, /* (469) fill_opt ::= */ + { 427, -4 }, /* (470) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 427, -6 }, /* (471) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 434, -1 }, /* (472) fill_mode ::= NONE */ + { 434, -1 }, /* (473) fill_mode ::= PREV */ + { 434, -1 }, /* (474) fill_mode ::= NULL */ + { 434, -1 }, /* (475) fill_mode ::= LINEAR */ + { 434, -1 }, /* (476) fill_mode ::= NEXT */ + { 429, 0 }, /* (477) group_by_clause_opt ::= */ + { 429, -3 }, /* (478) group_by_clause_opt ::= GROUP BY group_by_list */ + { 435, -1 }, /* (479) group_by_list ::= expr_or_subquery */ + { 435, -3 }, /* (480) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 430, 0 }, /* (481) having_clause_opt ::= */ + { 430, -2 }, /* (482) having_clause_opt ::= HAVING search_condition */ + { 425, 0 }, /* (483) range_opt ::= */ + { 425, -6 }, /* (484) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 426, 0 }, /* (485) every_opt ::= */ + { 426, -4 }, /* (486) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 436, -4 }, /* (487) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 437, -1 }, /* (488) query_simple ::= query_specification */ + { 437, -1 }, /* (489) query_simple ::= union_query_expression */ + { 441, -4 }, /* (490) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 441, -3 }, /* (491) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 442, -1 }, /* (492) query_simple_or_subquery ::= query_simple */ + { 442, -1 }, /* (493) query_simple_or_subquery ::= subquery */ + { 375, -1 }, /* (494) query_or_subquery ::= query_expression */ + { 375, -1 }, /* (495) query_or_subquery ::= subquery */ + { 438, 0 }, /* (496) order_by_clause_opt ::= */ + { 438, -3 }, /* (497) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 439, 0 }, /* (498) slimit_clause_opt ::= */ + { 439, -2 }, /* (499) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 439, -4 }, /* (500) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 439, -4 }, /* (501) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 440, 0 }, /* (502) limit_clause_opt ::= */ + { 440, -2 }, /* (503) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 440, -4 }, /* (504) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 440, -4 }, /* (505) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 392, -3 }, /* (506) subquery ::= NK_LP query_expression NK_RP */ + { 392, -3 }, /* (507) subquery ::= NK_LP subquery NK_RP */ + { 420, -1 }, /* (508) search_condition ::= common_expression */ + { 443, -1 }, /* (509) sort_specification_list ::= sort_specification */ + { 443, -3 }, /* (510) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 444, -3 }, /* (511) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 445, 0 }, /* (512) ordering_specification_opt ::= */ + { 445, -1 }, /* (513) ordering_specification_opt ::= ASC */ + { 445, -1 }, /* (514) ordering_specification_opt ::= DESC */ + { 446, 0 }, /* (515) null_ordering_opt ::= */ + { 446, -2 }, /* (516) null_ordering_opt ::= NULLS FIRST */ + { 446, -2 }, /* (517) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3395,11 +3569,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,316,&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,317,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3413,20 +3587,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,316,&yymsp[-2].minor); { } - yy_destructor(yypParser,312,&yymsp[0].minor); + yy_destructor(yypParser,318,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,313,&yymsp[0].minor); +{ yy_destructor(yypParser,319,&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,317,&yymsp[-1].minor); { } - yy_destructor(yypParser,313,&yymsp[0].minor); + yy_destructor(yypParser,319,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3440,72 +3614,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,318,&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.yy677, &yymsp[-1].minor.yy0, yymsp[0].minor.yy167); } 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.yy677, 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.yy677, 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.yy677, 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.yy677); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy503 = 1; } +{ yymsp[1].minor.yy167 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy503 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy167 = 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.yy57, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy677); } 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.yy57, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy677); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy57 = 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.yy57 = yymsp[0].minor.yy57; } + yymsp[0].minor.yy57 = yylhsminor.yy57; 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.yy57 = yymsp[-2].minor.yy57 | yymsp[0].minor.yy57; } + yymsp[-2].minor.yy57 = yylhsminor.yy57; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy57 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy477 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy57 = 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.yy677 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy677 = yylhsminor.yy677; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy641 = yymsp[-2].minor.yy641; } - yymsp[-2].minor.yy641 = yylhsminor.yy641; +{ yylhsminor.yy677 = yymsp[-2].minor.yy677; } + yymsp[-2].minor.yy677 = yylhsminor.yy677; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy641, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy677, 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.yy677, &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.yy677); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3522,31 +3696,31 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 319: /* db_name ::= NK_ID */ yytestcase(yyruleno==319); - case 320: /* table_name ::= NK_ID */ yytestcase(yyruleno==320); - case 321: /* column_name ::= NK_ID */ yytestcase(yyruleno==321); - case 322: /* function_name ::= NK_ID */ yytestcase(yyruleno==322); - case 323: /* table_alias ::= NK_ID */ yytestcase(yyruleno==323); - case 324: /* column_alias ::= NK_ID */ yytestcase(yyruleno==324); - case 325: /* user_name ::= NK_ID */ yytestcase(yyruleno==325); - case 326: /* topic_name ::= NK_ID */ yytestcase(yyruleno==326); - case 327: /* stream_name ::= NK_ID */ yytestcase(yyruleno==327); - case 328: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==328); - case 364: /* noarg_func ::= NOW */ yytestcase(yyruleno==364); - case 365: /* noarg_func ::= TODAY */ yytestcase(yyruleno==365); - case 366: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==366); - case 367: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==367); - case 368: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==368); - case 369: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==369); - case 370: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==370); - case 371: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==371); - case 372: /* noarg_func ::= USER */ yytestcase(yyruleno==372); - case 373: /* star_func ::= COUNT */ yytestcase(yyruleno==373); - case 374: /* star_func ::= FIRST */ yytestcase(yyruleno==374); - case 375: /* star_func ::= LAST */ yytestcase(yyruleno==375); - case 376: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==376); -{ yylhsminor.yy641 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy641 = yylhsminor.yy641; + case 323: /* db_name ::= NK_ID */ yytestcase(yyruleno==323); + case 324: /* table_name ::= NK_ID */ yytestcase(yyruleno==324); + case 325: /* column_name ::= NK_ID */ yytestcase(yyruleno==325); + case 326: /* function_name ::= NK_ID */ yytestcase(yyruleno==326); + case 327: /* table_alias ::= NK_ID */ yytestcase(yyruleno==327); + case 328: /* column_alias ::= NK_ID */ yytestcase(yyruleno==328); + case 329: /* user_name ::= NK_ID */ yytestcase(yyruleno==329); + case 330: /* topic_name ::= NK_ID */ yytestcase(yyruleno==330); + case 331: /* stream_name ::= NK_ID */ yytestcase(yyruleno==331); + case 332: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==332); + case 370: /* noarg_func ::= NOW */ yytestcase(yyruleno==370); + case 371: /* noarg_func ::= TODAY */ yytestcase(yyruleno==371); + case 372: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==372); + case 373: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==373); + case 374: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==374); + case 375: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==375); + case 376: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==376); + case 377: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==377); + case 378: /* noarg_func ::= USER */ yytestcase(yyruleno==378); + case 379: /* star_func ::= COUNT */ yytestcase(yyruleno==379); + case 380: /* star_func ::= FIRST */ yytestcase(yyruleno==380); + case 381: /* star_func ::= LAST */ yytestcase(yyruleno==381); + case 382: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==382); +{ yylhsminor.yy677 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy677 = yylhsminor.yy677; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3579,1283 +3753,1312 @@ 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.yy287, &yymsp[-1].minor.yy677, yymsp[0].minor.yy392); } 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.yy287, &yymsp[0].minor.yy677); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy677); } 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.yy677, yymsp[0].minor.yy392); } break; case 66: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy641); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy677); } break; - case 67: /* cmd ::= TRIM DATABASE db_name */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy641); } + case 67: /* cmd ::= TRIM DATABASE db_name speed_opt */ +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy677, yymsp[0].minor.yy172); } break; case 68: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy281 = true; } +{ yymsp[-2].minor.yy287 = 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 264: /* analyze_opt ::= */ yytestcase(yyruleno==264); + case 271: /* agg_func_opt ::= */ yytestcase(yyruleno==271); + case 443: /* set_quantifier_opt ::= */ yytestcase(yyruleno==443); +{ yymsp[1].minor.yy287 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy281 = true; } +{ yymsp[-1].minor.yy287 = true; } break; case 72: /* db_options ::= */ -{ yymsp[1].minor.yy776 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy392 = 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_KEEP, yymsp[0].minor.yy148); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_RETENTIONS, yymsp[0].minor.yy148); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-3].minor.yy392, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-3].minor.yy392, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = setDatabaseOption(pCxt, yymsp[-2].minor.yy392, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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.yy392 = createAlterDatabaseOptions(pCxt); yylhsminor.yy392 = setAlterDatabaseOption(pCxt, yylhsminor.yy392, &yymsp[0].minor.yy323); } + yymsp[0].minor.yy392 = yylhsminor.yy392; 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.yy392 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy392, &yymsp[0].minor.yy323); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; 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.yy323.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy323.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.yy323.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy323.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.yy323.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy323.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.yy323.type = DB_OPTION_KEEP; yymsp[-1].minor.yy323.pList = yymsp[0].minor.yy148; } 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.yy323.type = DB_OPTION_WAL; yymsp[-1].minor.yy323.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.yy323.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy323.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.yy148 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy148 = yylhsminor.yy148; 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; + case 293: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==293); +{ yylhsminor.yy148 = addNodeToList(pCxt, yymsp[-2].minor.yy148, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy148 = yylhsminor.yy148; break; case 115: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy280 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy280 = yylhsminor.yy280; +{ yylhsminor.yy148 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy148 = yylhsminor.yy148; 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.yy148 = addNodeToList(pCxt, yymsp[-2].minor.yy148, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy148 = yylhsminor.yy148; break; case 117: /* retention_list ::= retention */ - case 137: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==137); - case 140: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==140); - case 147: /* column_def_list ::= column_def */ yytestcase(yyruleno==147); - case 190: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==190); - case 195: /* col_name_list ::= col_name */ yytestcase(yyruleno==195); - case 245: /* func_list ::= func */ yytestcase(yyruleno==245); - case 317: /* literal_list ::= signed_literal */ yytestcase(yyruleno==317); - case 379: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==379); - case 433: /* select_list ::= select_item */ yytestcase(yyruleno==433); - case 490: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==490); -{ yylhsminor.yy280 = createNodeList(pCxt, yymsp[0].minor.yy776); } - yymsp[0].minor.yy280 = yylhsminor.yy280; + case 139: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==139); + case 142: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==142); + case 149: /* column_def_list ::= column_def */ yytestcase(yyruleno==149); + case 192: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==192); + case 197: /* col_name_list ::= col_name */ yytestcase(yyruleno==197); + case 247: /* func_list ::= func */ yytestcase(yyruleno==247); + case 321: /* literal_list ::= signed_literal */ yytestcase(yyruleno==321); + case 385: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==385); + case 391: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==391); + case 446: /* select_list ::= select_item */ yytestcase(yyruleno==446); + case 457: /* partition_list ::= partition_item */ yytestcase(yyruleno==457); + case 509: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==509); +{ yylhsminor.yy148 = createNodeList(pCxt, yymsp[0].minor.yy392); } + yymsp[0].minor.yy148 = yylhsminor.yy148; break; case 118: /* retention_list ::= retention_list NK_COMMA retention */ - case 148: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==148); - case 191: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==191); - case 196: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==196); - case 246: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==246); - case 318: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==318); - case 380: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==380); - case 434: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==434); - case 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 150: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==150); + case 193: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==193); + case 198: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==198); + case 248: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==248); + case 322: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==322); + case 386: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==386); + case 447: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==447); + case 458: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==458); + case 510: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==510); +{ yylhsminor.yy148 = addNodeToList(pCxt, yymsp[-2].minor.yy148, yymsp[0].minor.yy392); } + yymsp[-2].minor.yy148 = yylhsminor.yy148; 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.yy392 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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); } + case 120: /* speed_opt ::= */ + case 273: /* bufsize_opt ::= */ yytestcase(yyruleno==273); +{ yymsp[1].minor.yy172 = 0; } break; - case 121: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy280); } + case 121: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 274: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==274); +{ yymsp[-1].minor.yy172 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 123: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy280); } + case 122: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 124: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==124); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy287, yymsp[-5].minor.yy392, yymsp[-3].minor.yy148, yymsp[-1].minor.yy148, yymsp[0].minor.yy392); } break; - case 124: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); } + case 123: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy148); } break; - case 125: /* cmd ::= ALTER TABLE alter_table_clause */ - case 291: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==291); -{ pCxt->pRootNode = yymsp[0].minor.yy776; } + case 125: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy148); } break; - case 126: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy776); } + case 126: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy287, yymsp[0].minor.yy392); } 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; + case 127: /* cmd ::= ALTER TABLE alter_table_clause */ + case 295: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==295); +{ pCxt->pRootNode = yymsp[0].minor.yy392; } 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; + case 128: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy392); } 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; + case 129: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy392 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; 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; + case 130: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy677, yymsp[0].minor.yy838); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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; + case 131: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy392 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy392, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy677); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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; + case 132: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy677, yymsp[0].minor.yy838); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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; + case 133: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy392 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy677, &yymsp[0].minor.yy677); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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; + case 134: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy677, yymsp[0].minor.yy838); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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; + case 135: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy392 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy392, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy677); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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; + case 136: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy392 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy677, yymsp[0].minor.yy838); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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 137: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy392 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy392, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy677, &yymsp[0].minor.yy677); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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; + case 138: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy392 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy392, &yymsp[-2].minor.yy677, yymsp[0].minor.yy392); } + yymsp[-5].minor.yy392 = yylhsminor.yy392; 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; + case 140: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 143: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==143); + case 392: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==392); +{ yylhsminor.yy148 = addNodeToList(pCxt, yymsp[-1].minor.yy148, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy148 = yylhsminor.yy148; 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 141: /* 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.yy392 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy287, yymsp[-8].minor.yy392, yymsp[-6].minor.yy392, yymsp[-5].minor.yy148, yymsp[-2].minor.yy148, yymsp[0].minor.yy392); } + yymsp[-9].minor.yy392 = yylhsminor.yy392; break; - case 144: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy280 = yymsp[-1].minor.yy280; } + case 144: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy392 = createDropTableClause(pCxt, yymsp[-1].minor.yy287, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 145: /* full_table_name ::= table_name */ -{ yylhsminor.yy776 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy641, NULL); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 145: /* specific_cols_opt ::= */ + case 176: /* tags_def_opt ::= */ yytestcase(yyruleno==176); + case 455: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==455); + case 477: /* group_by_clause_opt ::= */ yytestcase(yyruleno==477); + case 496: /* order_by_clause_opt ::= */ yytestcase(yyruleno==496); +{ yymsp[1].minor.yy148 = NULL; } 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; + case 146: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ +{ yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148; } 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; + case 147: /* full_table_name ::= table_name */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy677, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; 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; + case 148: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy677, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 151: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 151: /* column_def ::= column_name type_name */ +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy677, yymsp[0].minor.yy838, NULL); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 152: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 152: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy677, yymsp[-2].minor.yy838, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 153: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 153: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 154: /* type_name ::= INT */ - case 155: /* type_name ::= INTEGER */ yytestcase(yyruleno==155); -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_INT); } + case 154: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 156: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 155: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 157: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 156: /* type_name ::= INT */ + case 157: /* type_name ::= INTEGER */ yytestcase(yyruleno==157); +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 158: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 158: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_BIGINT); } 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); } + case 159: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 160: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 160: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_DOUBLE); } 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); } + case 161: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy838 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 162: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 162: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 163: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 163: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy838 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 164: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UINT); } + case 164: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy838 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 165: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 165: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy838 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 166: /* type_name ::= JSON */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_JSON); } + case 166: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy838 = createDataType(TSDB_DATA_TYPE_UINT); } 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); } + case 167: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy838 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 168: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 168: /* type_name ::= JSON */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 169: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 169: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy838 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } 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); } + case 170: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 171: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 171: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy838 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 172: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 172: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy838 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } 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); } + case 173: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy838 = 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 174: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy838 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 176: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy280 = yymsp[-1].minor.yy280; } + case 175: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy838 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 177: /* table_options ::= */ -{ yymsp[1].minor.yy776 = createDefaultTableOptions(pCxt); } + case 177: /* tags_def_opt ::= tags_def */ + case 384: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==384); +{ yylhsminor.yy148 = yymsp[0].minor.yy148; } + yymsp[0].minor.yy148 = yylhsminor.yy148; 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; + case 178: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ +{ yymsp[-3].minor.yy148 = yymsp[-1].minor.yy148; } 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; + case 179: /* table_options ::= */ +{ yymsp[1].minor.yy392 = createDefaultTableOptions(pCxt); } 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; + case 180: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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; + case 181: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy148); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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; + case 182: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy148); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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; + case 183: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-4].minor.yy392, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy148); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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; + case 184: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-2].minor.yy392, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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; + case 185: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-4].minor.yy392, TABLE_OPTION_SMA, yymsp[-1].minor.yy148); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; 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; } + case 186: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy392 = createAlterTableOptions(pCxt); yylhsminor.yy392 = setTableOption(pCxt, yylhsminor.yy392, yymsp[0].minor.yy323.type, &yymsp[0].minor.yy323.val); } + yymsp[0].minor.yy392 = yylhsminor.yy392; 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; } + case 187: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy392 = setTableOption(pCxt, yymsp[-1].minor.yy392, yymsp[0].minor.yy323.type, &yymsp[0].minor.yy323.val); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; 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 188: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy323.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy323.val = yymsp[0].minor.yy0; } 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 189: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy323.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy323.val = yymsp[0].minor.yy0; } break; - case 192: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy776 = createFunctionNode(pCxt, &yymsp[0].minor.yy641, NULL); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 190: /* duration_list ::= duration_literal */ + case 351: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==351); +{ yylhsminor.yy148 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[0].minor.yy148 = yylhsminor.yy148; 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; + case 191: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 352: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==352); +{ yylhsminor.yy148 = addNodeToList(pCxt, yymsp[-2].minor.yy148, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[-2].minor.yy148 = yylhsminor.yy148; break; - case 197: /* col_name ::= column_name */ -{ yylhsminor.yy776 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy641); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 194: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy392 = createFunctionNode(pCxt, &yymsp[0].minor.yy677, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 198: /* cmd ::= SHOW DNODES */ + case 195: /* rollup_func_name ::= FIRST */ + case 196: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==196); +{ yylhsminor.yy392 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 199: /* col_name ::= column_name */ +{ yylhsminor.yy392 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy677); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 200: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 199: /* cmd ::= SHOW USERS */ + case 201: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 200: /* cmd ::= SHOW DATABASES */ + case 202: /* cmd ::= SHOW DATABASES */ { 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); } + case 203: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, 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); } + case 204: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, 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); } + case 205: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy392, NULL, OP_TYPE_LIKE); } break; - case 204: /* cmd ::= SHOW MNODES */ + case 206: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 205: /* cmd ::= SHOW MODULES */ + case 207: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT); } break; - case 206: /* cmd ::= SHOW QNODES */ + case 208: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 207: /* cmd ::= SHOW FUNCTIONS */ + case 209: /* cmd ::= SHOW FUNCTIONS */ { 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); } + case 210: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy392, yymsp[-1].minor.yy392, OP_TYPE_EQUAL); } break; - case 209: /* cmd ::= SHOW STREAMS */ + case 211: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 210: /* cmd ::= SHOW ACCOUNTS */ + case 212: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 211: /* cmd ::= SHOW APPS */ + case 213: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 212: /* cmd ::= SHOW CONNECTIONS */ + case 214: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 213: /* cmd ::= SHOW LICENCES */ - case 214: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==214); + case 215: /* cmd ::= SHOW LICENCES */ + case 216: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==216); { 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); } + case 217: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy677); } break; - case 216: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy776); } + case 218: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy392); } break; - case 217: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy776); } + case 219: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy392); } break; - case 218: /* cmd ::= SHOW QUERIES */ + case 220: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 219: /* cmd ::= SHOW SCORES */ + case 221: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 220: /* cmd ::= SHOW TOPICS */ + case 222: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 221: /* cmd ::= SHOW VARIABLES */ + case 223: /* cmd ::= SHOW VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 222: /* cmd ::= SHOW LOCAL VARIABLES */ + case 224: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 223: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + case 225: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-1].minor.yy0)); } break; - case 224: /* cmd ::= SHOW BNODES */ + case 226: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 225: /* cmd ::= SHOW SNODES */ + case 227: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 226: /* cmd ::= SHOW CLUSTER */ + case 228: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 227: /* cmd ::= SHOW TRANSACTIONS */ + case 229: /* cmd ::= SHOW TRANSACTIONS */ { 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); } + case 230: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy392); } break; - case 229: /* cmd ::= SHOW CONSUMERS */ + case 231: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 230: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 232: /* cmd ::= SHOW SUBSCRIPTIONS */ { 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); } + case 233: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy392, yymsp[-1].minor.yy392, OP_TYPE_EQUAL); } break; - case 232: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 234: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 233: /* cmd ::= SHOW VNODES NK_STRING */ + case 235: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 234: /* db_name_cond_opt ::= */ - case 239: /* from_db_opt ::= */ yytestcase(yyruleno==239); -{ yymsp[1].minor.yy776 = createDefaultDatabaseCondValue(pCxt); } + case 236: /* db_name_cond_opt ::= */ + case 241: /* from_db_opt ::= */ yytestcase(yyruleno==241); +{ yymsp[1].minor.yy392 = 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; + case 237: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy677); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; 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 238: /* like_pattern_opt ::= */ + case 283: /* subtable_opt ::= */ yytestcase(yyruleno==283); + case 394: /* case_when_else_opt ::= */ yytestcase(yyruleno==394); + case 424: /* from_clause_opt ::= */ yytestcase(yyruleno==424); + case 453: /* where_clause_opt ::= */ yytestcase(yyruleno==453); + case 462: /* twindow_clause_opt ::= */ yytestcase(yyruleno==462); + case 467: /* sliding_opt ::= */ yytestcase(yyruleno==467); + case 469: /* fill_opt ::= */ yytestcase(yyruleno==469); + case 481: /* having_clause_opt ::= */ yytestcase(yyruleno==481); + case 483: /* range_opt ::= */ yytestcase(yyruleno==483); + case 485: /* every_opt ::= */ yytestcase(yyruleno==485); + case 498: /* slimit_clause_opt ::= */ yytestcase(yyruleno==498); + case 502: /* limit_clause_opt ::= */ yytestcase(yyruleno==502); +{ yymsp[1].minor.yy392 = NULL; } break; - case 237: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 239: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy392 = 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; + case 240: /* table_name_cond ::= table_name */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy677); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 240: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy641); } + case 242: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy677); } 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); } + case 243: /* 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.yy287, yymsp[-3].minor.yy392, yymsp[-1].minor.yy392, NULL, yymsp[0].minor.yy392); } break; - case 242: /* cmd ::= DROP INDEX exists_opt full_table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy281, yymsp[0].minor.yy776); } + case 244: /* cmd ::= DROP INDEX exists_opt full_table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy287, yymsp[0].minor.yy392); } 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); } + case 245: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy392 = createIndexOption(pCxt, yymsp[-7].minor.yy148, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), NULL, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } 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); } + case 246: /* 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.yy392 = createIndexOption(pCxt, yymsp[-9].minor.yy148, releaseRawExprNode(pCxt, yymsp[-5].minor.yy392), releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } 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; + case 249: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy392 = createFunctionNode(pCxt, &yymsp[-3].minor.yy677, yymsp[-1].minor.yy148); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 248: /* sma_stream_opt ::= */ - case 275: /* stream_options ::= */ yytestcase(yyruleno==275); -{ yymsp[1].minor.yy776 = createStreamOptions(pCxt); } + case 250: /* sma_stream_opt ::= */ + case 277: /* stream_options ::= */ yytestcase(yyruleno==277); +{ yymsp[1].minor.yy392 = 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; + case 251: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ + case 281: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==281); +{ ((SStreamOptions*)yymsp[-2].minor.yy392)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); yylhsminor.yy392 = yymsp[-2].minor.yy392; } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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; + case 252: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy392)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); yylhsminor.yy392 = yymsp[-2].minor.yy392; } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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); } + case 253: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy287, &yymsp[-2].minor.yy677, yymsp[0].minor.yy392); } 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); } + case 254: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy287, &yymsp[-3].minor.yy677, &yymsp[0].minor.yy677, 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); } + case 255: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy287, &yymsp[-5].minor.yy677, &yymsp[0].minor.yy677, 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); } + case 256: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy287, &yymsp[-3].minor.yy677, yymsp[0].minor.yy392, 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); } + case 257: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy287, &yymsp[-5].minor.yy677, yymsp[0].minor.yy392, true); } break; - case 256: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); } + case 258: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy287, &yymsp[0].minor.yy677); } 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); } + case 259: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy287, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy677); } 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); } + case 260: /* cmd ::= DESC full_table_name */ + case 261: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==261); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy392); } break; - case 260: /* cmd ::= RESET QUERY CACHE */ + case 262: /* 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); } + case 263: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy287, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } 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 265: /* analyze_opt ::= ANALYZE */ + case 272: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==272); + case 444: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==444); +{ yymsp[0].minor.yy287 = true; } break; - case 264: /* explain_options ::= */ -{ yymsp[1].minor.yy776 = createDefaultExplainOptions(pCxt); } + case 266: /* explain_options ::= */ +{ yymsp[1].minor.yy392 = 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; + case 267: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy392 = setExplainVerbose(pCxt, yymsp[-2].minor.yy392, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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; + case 268: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy392 = setExplainRatio(pCxt, yymsp[-2].minor.yy392, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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); } + case 269: /* 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.yy287, yymsp[-8].minor.yy287, &yymsp[-5].minor.yy677, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy838, yymsp[0].minor.yy172); } break; - case 268: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); } + case 270: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy287, &yymsp[0].minor.yy677); } break; - case 271: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy100 = 0; } + case 275: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy287, &yymsp[-7].minor.yy677, yymsp[-4].minor.yy392, yymsp[-6].minor.yy392, yymsp[-3].minor.yy148, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); } break; - case 272: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy100 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 276: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy287, &yymsp[0].minor.yy677); } 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); } + case 278: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy392)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy392 = yymsp[-2].minor.yy392; } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 274: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy281, &yymsp[0].minor.yy641); } + case 279: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy392)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy392 = yymsp[-2].minor.yy392; } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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; + case 280: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy392)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy392)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); yylhsminor.yy392 = yymsp[-3].minor.yy392; } + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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; + case 282: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-3].minor.yy392)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy392 = yymsp[-3].minor.yy392; } + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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; + case 284: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 468: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==468); + case 486: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==486); +{ yymsp[-3].minor.yy392 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy392); } 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; - break; - case 281: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 285: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 282: /* cmd ::= KILL QUERY NK_STRING */ + case 286: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 283: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 287: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 284: /* cmd ::= BALANCE VGROUP */ + case 288: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 285: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 289: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { 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); } + case 290: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy148); } break; - case 287: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 291: /* 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)); } - break; - case 290: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy776, yymsp[0].minor.yy776); } - 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); } - 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); } - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - break; - case 303: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; - break; - case 304: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - break; - case 305: /* signed ::= NK_MINUS NK_INTEGER */ + case 292: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy148 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + break; + case 294: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } + break; + case 296: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy392, yymsp[-2].minor.yy148, yymsp[0].minor.yy392); } + break; + case 297: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy392, NULL, yymsp[0].minor.yy392); } + break; + case 298: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 299: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 300: /* literal ::= NK_STRING */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 301: /* literal ::= NK_BOOL */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 302: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; + break; + case 303: /* literal ::= duration_literal */ + case 313: /* signed_literal ::= signed */ yytestcase(yyruleno==313); + case 333: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==333); + case 334: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==334); + case 335: /* expression ::= literal */ yytestcase(yyruleno==335); + case 336: /* expression ::= pseudo_column */ yytestcase(yyruleno==336); + case 337: /* expression ::= column_reference */ yytestcase(yyruleno==337); + case 338: /* expression ::= function_expression */ yytestcase(yyruleno==338); + case 339: /* expression ::= case_when_expression */ yytestcase(yyruleno==339); + case 367: /* function_expression ::= literal_func */ yytestcase(yyruleno==367); + case 416: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==416); + case 420: /* boolean_primary ::= predicate */ yytestcase(yyruleno==420); + case 422: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==422); + case 423: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==423); + case 426: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==426); + case 428: /* table_reference ::= table_primary */ yytestcase(yyruleno==428); + case 429: /* table_reference ::= joined_table */ yytestcase(yyruleno==429); + case 433: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==433); + case 488: /* query_simple ::= query_specification */ yytestcase(yyruleno==488); + case 489: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==489); + case 492: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==492); + case 494: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==494); +{ yylhsminor.yy392 = yymsp[0].minor.yy392; } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 304: /* literal ::= NULL */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 305: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 306: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 307: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 308: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + break; + case 309: /* 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.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 306: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 310: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 307: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 311: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 308: /* signed ::= NK_MINUS NK_FLOAT */ + case 312: /* 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.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; - 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; - 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; - break; - case 312: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy776 = 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; - break; - case 314: /* signed_literal ::= NULL */ -{ yylhsminor.yy776 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; - break; - case 316: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy776 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; - 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; - break; - case 335: /* expression ::= NK_PLUS expression */ + yymsp[-1].minor.yy392 = yylhsminor.yy392; + break; + case 314: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 315: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 316: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 317: /* signed_literal ::= duration_literal */ + case 319: /* signed_literal ::= literal_func */ yytestcase(yyruleno==319); + case 387: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==387); + case 449: /* select_item ::= common_expression */ yytestcase(yyruleno==449); + case 459: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==459); + case 493: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==493); + case 495: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==495); + case 508: /* search_condition ::= common_expression */ yytestcase(yyruleno==508); +{ yylhsminor.yy392 = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 318: /* signed_literal ::= NULL */ +{ yylhsminor.yy392 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 320: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy392 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 340: /* expression ::= NK_LP expression NK_RP */ + case 421: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==421); + case 507: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==507); +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; + break; + case 341: /* 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.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 336: /* expression ::= NK_MINUS expression */ + case 342: /* 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.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy392), NULL)); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 337: /* expression ::= expression NK_PLUS expression */ + case 343: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 338: /* expression ::= expression NK_MINUS expression */ + case 344: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 339: /* expression ::= expression NK_STAR expression */ + case 345: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 340: /* expression ::= expression NK_SLASH expression */ + case 346: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 341: /* expression ::= expression NK_REM expression */ + case 347: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 342: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 348: /* 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.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 343: /* expression ::= expression NK_BITAND expression */ + case 349: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 344: /* expression ::= expression NK_BITOR expression */ + case 350: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - 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.yy392 = yylhsminor.yy392; + break; + case 353: /* column_reference ::= column_name */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy677, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy677)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 354: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy677, createColumnNode(pCxt, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy677)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; + break; + case 355: /* pseudo_column ::= ROWTS */ + case 356: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==356); + case 358: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==358); + case 359: /* pseudo_column ::= QEND */ yytestcase(yyruleno==359); + case 360: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==360); + case 361: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==361); + case 362: /* pseudo_column ::= WEND */ yytestcase(yyruleno==362); + case 363: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==363); + case 369: /* literal_func ::= NOW */ yytestcase(yyruleno==369); +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 357: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy677)))); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; + break; + case 364: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 365: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==365); +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy677, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy677, yymsp[-1].minor.yy148)); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; + break; + case 366: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-1].minor.yy838)); } + yymsp[-5].minor.yy392 = yylhsminor.yy392; + break; + case 368: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy677, NULL)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; + break; + case 383: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy148 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy148 = yylhsminor.yy148; + break; + case 388: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 452: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==452); +{ yylhsminor.yy392 = createColumnNode(pCxt, &yymsp[-2].minor.yy677, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; + break; + case 389: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy148, yymsp[-1].minor.yy392)); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; + break; + case 390: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-2].minor.yy148, yymsp[-1].minor.yy392)); } + yymsp[-4].minor.yy392 = yylhsminor.yy392; + break; + case 393: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy392 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + break; + case 395: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy392 = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); } + break; + case 396: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 401: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==401); { - 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy758, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 384: /* predicate ::= expression BETWEEN expression AND expression */ + case 397: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy392), releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-4].minor.yy776 = yylhsminor.yy776; + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; - case 385: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 398: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy392), releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-5].minor.yy776 = yylhsminor.yy776; + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; - case 386: /* predicate ::= expression IS NULL */ + case 399: /* 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.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), NULL)); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 387: /* predicate ::= expression IS NOT NULL */ + case 400: /* 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.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), NULL)); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 389: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_THAN; } + case 402: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy758 = OP_TYPE_LOWER_THAN; } break; - case 390: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_THAN; } + case 403: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy758 = OP_TYPE_GREATER_THAN; } break; - case 391: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy668 = OP_TYPE_LOWER_EQUAL; } + case 404: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy758 = OP_TYPE_LOWER_EQUAL; } break; - case 392: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy668 = OP_TYPE_GREATER_EQUAL; } + case 405: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy758 = OP_TYPE_GREATER_EQUAL; } break; - case 393: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy668 = OP_TYPE_NOT_EQUAL; } + case 406: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy758 = OP_TYPE_NOT_EQUAL; } break; - case 394: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy668 = OP_TYPE_EQUAL; } + case 407: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy758 = OP_TYPE_EQUAL; } break; - case 395: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy668 = OP_TYPE_LIKE; } + case 408: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy758 = OP_TYPE_LIKE; } break; - case 396: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_LIKE; } + case 409: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy758 = OP_TYPE_NOT_LIKE; } break; - case 397: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy668 = OP_TYPE_MATCH; } + case 410: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy758 = OP_TYPE_MATCH; } break; - case 398: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy668 = OP_TYPE_NMATCH; } + case 411: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy758 = OP_TYPE_NMATCH; } break; - case 399: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy668 = OP_TYPE_JSON_CONTAINS; } + case 412: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy758 = OP_TYPE_JSON_CONTAINS; } break; - case 400: /* in_op ::= IN */ -{ yymsp[0].minor.yy668 = OP_TYPE_IN; } + case 413: /* in_op ::= IN */ +{ yymsp[0].minor.yy758 = OP_TYPE_IN; } break; - case 401: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy668 = OP_TYPE_NOT_IN; } + case 414: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy758 = 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 415: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy148)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 404: /* boolean_value_expression ::= NOT boolean_primary */ + case 417: /* 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.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy392), NULL)); } - yymsp[-1].minor.yy776 = yylhsminor.yy776; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 405: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 418: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 406: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 419: /* 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.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy776 = yylhsminor.yy776; + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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 425: /* from_clause_opt ::= FROM table_reference_list */ + case 454: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==454); + case 482: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==482); +{ yymsp[-1].minor.yy392 = yymsp[0].minor.yy392; } 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 427: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy392 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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 430: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy677, &yymsp[0].minor.yy677); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; 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 431: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, &yymsp[-3].minor.yy677, &yymsp[-1].minor.yy677, &yymsp[0].minor.yy677); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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 432: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy392 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392), &yymsp[0].minor.yy677); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 421: /* alias_opt ::= */ -{ yymsp[1].minor.yy641 = nil_token; } + case 434: /* alias_opt ::= */ +{ yymsp[1].minor.yy677 = nil_token; } break; - case 422: /* alias_opt ::= table_alias */ -{ yylhsminor.yy641 = yymsp[0].minor.yy641; } - yymsp[0].minor.yy641 = yylhsminor.yy641; + case 435: /* alias_opt ::= table_alias */ +{ yylhsminor.yy677 = yymsp[0].minor.yy677; } + yymsp[0].minor.yy677 = yylhsminor.yy677; break; - case 423: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy641 = yymsp[0].minor.yy641; } + case 436: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy677 = yymsp[0].minor.yy677; } 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 437: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 438: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==438); +{ yymsp[-2].minor.yy392 = yymsp[-1].minor.yy392; } 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 439: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy392 = createJoinTableNode(pCxt, yymsp[-4].minor.yy114, yymsp[-5].minor.yy392, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; - case 427: /* join_type ::= */ -{ yymsp[1].minor.yy468 = JOIN_TYPE_INNER; } + case 440: /* join_type ::= */ +{ yymsp[1].minor.yy114 = JOIN_TYPE_INNER; } break; - case 428: /* join_type ::= INNER */ -{ yymsp[0].minor.yy468 = JOIN_TYPE_INNER; } + case 441: /* join_type ::= INNER */ +{ yymsp[0].minor.yy114 = 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 442: /* 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.yy392 = createSelectStmt(pCxt, yymsp[-10].minor.yy287, yymsp[-9].minor.yy148, yymsp[-8].minor.yy392); + yymsp[-11].minor.yy392 = addWhereClause(pCxt, yymsp[-11].minor.yy392, yymsp[-7].minor.yy392); + yymsp[-11].minor.yy392 = addPartitionByClause(pCxt, yymsp[-11].minor.yy392, yymsp[-6].minor.yy148); + yymsp[-11].minor.yy392 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy392, yymsp[-2].minor.yy392); + yymsp[-11].minor.yy392 = addGroupByClause(pCxt, yymsp[-11].minor.yy392, yymsp[-1].minor.yy148); + yymsp[-11].minor.yy392 = addHavingClause(pCxt, yymsp[-11].minor.yy392, yymsp[0].minor.yy392); + yymsp[-11].minor.yy392 = addRangeClause(pCxt, yymsp[-11].minor.yy392, yymsp[-5].minor.yy392); + yymsp[-11].minor.yy392 = addEveryClause(pCxt, yymsp[-11].minor.yy392, yymsp[-4].minor.yy392); + yymsp[-11].minor.yy392 = addFillClause(pCxt, yymsp[-11].minor.yy392, yymsp[-3].minor.yy392); } break; - case 432: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy281 = false; } - break; - case 435: /* select_item ::= NK_STAR */ -{ yylhsminor.yy776 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy776 = yylhsminor.yy776; + case 445: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy287 = false; } 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 448: /* select_item ::= NK_STAR */ +{ yylhsminor.yy392 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy392 = yylhsminor.yy392; 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 450: /* select_item ::= common_expression column_alias */ + case 460: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==460); +{ yylhsminor.yy392 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392), &yymsp[0].minor.yy677); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; 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 451: /* select_item ::= common_expression AS column_alias */ + case 461: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==461); +{ yylhsminor.yy392 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), &yymsp[0].minor.yy677); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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 456: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 478: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==478); + case 497: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==497); +{ yymsp[-2].minor.yy148 = yymsp[0].minor.yy148; } 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 463: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy392 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } 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 464: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy392 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } 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 465: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy392 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), NULL, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } 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 466: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy392 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy392), releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; - case 452: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy776 = createFillNode(pCxt, yymsp[-1].minor.yy774, NULL); } + case 470: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy392 = createFillNode(pCxt, yymsp[-1].minor.yy708, 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 471: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy392 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy148)); } break; - case 454: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy774 = FILL_MODE_NONE; } + case 472: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy708 = FILL_MODE_NONE; } break; - case 455: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy774 = FILL_MODE_PREV; } + case 473: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy708 = FILL_MODE_PREV; } break; - case 456: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy774 = FILL_MODE_NULL; } + case 474: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy708 = FILL_MODE_NULL; } break; - case 457: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy774 = FILL_MODE_LINEAR; } + case 475: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy708 = FILL_MODE_LINEAR; } break; - case 458: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy774 = FILL_MODE_NEXT; } + case 476: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy708 = 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 479: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy148 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } + yymsp[0].minor.yy148 = yylhsminor.yy148; 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 480: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy148 = addNodeToList(pCxt, yymsp[-2].minor.yy148, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } + yymsp[-2].minor.yy148 = yylhsminor.yy148; 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 484: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy392 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } break; - case 469: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 487: /* 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.yy392 = addOrderByClause(pCxt, yymsp[-3].minor.yy392, yymsp[-2].minor.yy148); + yylhsminor.yy392 = addSlimitClause(pCxt, yylhsminor.yy392, yymsp[-1].minor.yy392); + yylhsminor.yy392 = addLimitClause(pCxt, yylhsminor.yy392, yymsp[0].minor.yy392); } - yymsp[-3].minor.yy776 = yylhsminor.yy776; + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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 490: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy392 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; 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 491: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy392 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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 499: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 503: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==503); +{ yymsp[-1].minor.yy392 = 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 500: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 504: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==504); +{ yymsp[-3].minor.yy392 = 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 501: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 505: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==505); +{ yymsp[-3].minor.yy392 = 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 506: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy392); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; 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 511: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy392 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), yymsp[-1].minor.yy362, yymsp[0].minor.yy781); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 493: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy2 = ORDER_ASC; } + case 512: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy362 = ORDER_ASC; } break; - case 494: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy2 = ORDER_ASC; } + case 513: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy362 = ORDER_ASC; } break; - case 495: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy2 = ORDER_DESC; } + case 514: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy362 = ORDER_DESC; } break; - case 496: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy649 = NULL_ORDER_DEFAULT; } + case 515: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy781 = NULL_ORDER_DEFAULT; } break; - case 497: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy649 = NULL_ORDER_FIRST; } + case 516: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy781 = NULL_ORDER_FIRST; } break; - case 498: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy649 = NULL_ORDER_LAST; } + case 517: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy781 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index a159d797faed1fccf1194c54ecbe5506531ff0cc..121bbaa733c3d4b019fbaf5638e32a2fe7ac37d2 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -610,6 +610,20 @@ TEST_F(ParserInitialCTest, createStream) { expect.igExpired = igExpired; }; + auto addTag = [&](const char* pFieldName, uint8_t type, int32_t bytes = 0) { + SField field = {0}; + strcpy(field.name, pFieldName); + field.type = type; + field.bytes = bytes > 0 ? bytes : tDataTypes[type].bytes; + field.flags |= COL_SMA_ON; + + if (NULL == expect.pTags) { + expect.pTags = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SField)); + } + taosArrayPush(expect.pTags, &field); + expect.numOfTags += 1; + }; + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_STREAM_STMT); SCMCreateStreamReq req = {0}; @@ -625,6 +639,19 @@ TEST_F(ParserInitialCTest, createStream) { ASSERT_EQ(req.maxDelay, expect.maxDelay); ASSERT_EQ(req.watermark, expect.watermark); ASSERT_EQ(req.igExpired, expect.igExpired); + ASSERT_EQ(req.numOfTags, expect.numOfTags); + if (expect.numOfTags > 0) { + ASSERT_EQ(taosArrayGetSize(req.pTags), expect.numOfTags); + ASSERT_EQ(taosArrayGetSize(req.pTags), taosArrayGetSize(expect.pTags)); + for (int32_t i = 0; i < expect.numOfTags; ++i) { + SField* pField = (SField*)taosArrayGet(req.pTags, i); + SField* pExpectField = (SField*)taosArrayGet(expect.pTags, i); + ASSERT_EQ(std::string(pField->name), std::string(pExpectField->name)); + ASSERT_EQ(pField->type, pExpectField->type); + ASSERT_EQ(pField->bytes, pExpectField->bytes); + ASSERT_EQ(pField->flags, pExpectField->flags); + } + } tFreeSCMCreateStreamReq(&req); }); @@ -640,6 +667,17 @@ TEST_F(ParserInitialCTest, createStream) { run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 INTO st1 AS SELECT COUNT(*) " "FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); + + setCreateStreamReqFunc( + "s1", "test", + "create stream s1 into st3 tags(tname varchar(10), id int) subtable(concat('new-', tname)) as " + "select _wstart wstart, count(*) cnt from st1 partition by tbname tname, tag1 id interval(10s)", + "st3"); + addTag("tname", TSDB_DATA_TYPE_VARCHAR, 10 + VARSTR_HEADER_SIZE); + addTag("id", TSDB_DATA_TYPE_INT); + run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " + "AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, tag1 id INTERVAL(10S)"); + clearCreateStreamReq(); } TEST_F(ParserInitialCTest, createStreamSemanticCheck) { 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/parShowToUse.cpp b/source/libs/parser/test/parShowToUse.cpp index e33252c072fb1b34e5801098e27c2a51bef51c68..f38859c83249dc74356e28fec930ab29cc3338c0 100644 --- a/source/libs/parser/test/parShowToUse.cpp +++ b/source/libs/parser/test/parShowToUse.cpp @@ -250,7 +250,10 @@ TEST_F(ParserShowToUseTest, trimDatabase) { STrimDbReq expect = {0}; - auto setTrimDbReq = [&](const char* pDb) { snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); }; + auto setTrimDbReq = [&](const char* pDb, int32_t maxSpeed = 0) { + snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); + expect.maxSpeed = maxSpeed; + }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_TRIM_DATABASE_STMT); @@ -258,10 +261,14 @@ TEST_F(ParserShowToUseTest, trimDatabase) { STrimDbReq req = {0}; ASSERT_EQ(tDeserializeSTrimDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(std::string(req.db), std::string(expect.db)); + ASSERT_EQ(req.maxSpeed, expect.maxSpeed); }); setTrimDbReq("wxy_db"); run("TRIM DATABASE wxy_db"); + + setTrimDbReq("wxy_db", 100); + run("TRIM DATABASE wxy_db MAX_SPEED 100"); } TEST_F(ParserShowToUseTest, useDatabase) { 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/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index fea2be55f962af0ff1d37b94ea4ddbe244eb3363..52f9ddaa6faa54a15900604c570366ef55ceeefe 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1022,6 +1022,20 @@ static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pS } } + if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pTags) { + pPartition->pTags = nodesCloneList(pSelect->pTags); + if (NULL == pPartition->pTags) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + + if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pSubtable) { + pPartition->pSubtable = nodesCloneNode(pSelect->pSubtable); + if (NULL == pPartition->pSubtable) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pPartition; } else { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index b160f45479a8e11a160fc092b7af536c4165436a..927969bf9ceedbef2b56339a77af51041bf61f40 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); @@ -1615,6 +1615,8 @@ static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub SScanLogicNode* pScan = (SScanLogicNode*)nodesListGetNode(pNode->pChildren, 0); if (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode)) { TSWAP(((SPartitionLogicNode*)pNode)->pPartitionKeys, pScan->pGroupTags); + TSWAP(((SPartitionLogicNode*)pNode)->pTags, pScan->pTags); + TSWAP(((SPartitionLogicNode*)pNode)->pSubtable, pScan->pSubtable); int32_t code = replaceLogicNode(pLogicSubplan, pNode, (SLogicNode*)pScan); if (TSDB_CODE_SUCCESS == code) { code = adjustLogicNodeDataRequirement((SLogicNode*)pScan, pNode->resultDataOrder); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index b0177e61ed290e8ef687e5de8c54c824545d8103..421da8f110b452d776d281626b14ab5bb6b681b3 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -563,7 +563,16 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp pTableScan->igExpired = pScanLogicNode->igExpired; pTableScan->assignBlockUid = pCxt->pPlanCxt->rSmaQuery ? true : false; - return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode); + int32_t code = createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode); + if (TSDB_CODE_SUCCESS == code) { + code = setListSlotId(pCxt, pTableScan->scan.node.pOutputDataBlockDesc->dataBlockId, -1, pScanLogicNode->pTags, + &pTableScan->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = setNodeSlotId(pCxt, pTableScan->scan.node.pOutputDataBlockDesc->dataBlockId, -1, pScanLogicNode->pSubtable, + &pTableScan->pSubtable); + } + return code; } static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubplan, @@ -1046,7 +1055,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; @@ -1321,11 +1331,10 @@ static int32_t createSortPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren return code; } -static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, - SPartitionLogicNode* pPartLogicNode, SPhysiNode** pPhyNode) { - SPartitionPhysiNode* pPart = (SPartitionPhysiNode*)makePhysiNode( - pCxt, (SLogicNode*)pPartLogicNode, - pCxt->pPlanCxt->streamQuery ? QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION : QUERY_NODE_PHYSICAL_PLAN_PARTITION); +static int32_t createPartitionPhysiNodeImpl(SPhysiPlanContext* pCxt, SNodeList* pChildren, + SPartitionLogicNode* pPartLogicNode, ENodeType type, + SPhysiNode** pPhyNode) { + SPartitionPhysiNode* pPart = (SPartitionPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pPartLogicNode, type); if (NULL == pPart) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1370,6 +1379,34 @@ static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi return code; } +static int32_t createStreamPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, + SPartitionLogicNode* pPartLogicNode, SPhysiNode** pPhyNode) { + SStreamPartitionPhysiNode* pPart = NULL; + int32_t code = createPartitionPhysiNodeImpl(pCxt, pChildren, pPartLogicNode, + QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, (SPhysiNode**)&pPart); + SDataBlockDescNode* pChildTupe = (((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc); + if (TSDB_CODE_SUCCESS == code) { + code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pPartLogicNode->pTags, &pPart->pTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = setNodeSlotId(pCxt, pChildTupe->dataBlockId, -1, pPartLogicNode->pSubtable, &pPart->pSubtable); + } + if (TSDB_CODE_SUCCESS == code) { + *pPhyNode = (SPhysiNode*)pPart; + } else { + nodesDestroyNode((SNode*)pPart); + } + return code; +} + +static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, + SPartitionLogicNode* pPartLogicNode, SPhysiNode** pPhyNode) { + if (pCxt->pPlanCxt->streamQuery) { + return createStreamPartitionPhysiNode(pCxt, pChildren, pPartLogicNode, pPhyNode); + } + return createPartitionPhysiNodeImpl(pCxt, pChildren, pPartLogicNode, QUERY_NODE_PHYSICAL_PLAN_PARTITION, pPhyNode); +} + static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SFillLogicNode* pFillNode, SPhysiNode** pPhyNode) { SFillPhysiNode* pFill = (SFillPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pFillNode, QUERY_NODE_PHYSICAL_PLAN_FILL); @@ -1425,7 +1462,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/planOtherTest.cpp b/source/libs/planner/test/planOtherTest.cpp index 350ccd0d927c9773059cfb2c027a0ca2292e4d13..f6416b3cb1acae44621017fc64c2b58612211d12 100644 --- a/source/libs/planner/test/planOtherTest.cpp +++ b/source/libs/planner/test/planOtherTest.cpp @@ -32,6 +32,12 @@ TEST_F(PlanOtherTest, createStream) { run("create stream if not exists s1 trigger window_close watermark 10s into st1 as select count(*) from t1 " "interval(10s)"); + + run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " + "AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, c1 id INTERVAL(10S)"); + + run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " + "AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, tag1 id INTERVAL(10S)"); } TEST_F(PlanOtherTest, createStreamUseSTable) { 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..ac063cb50dcbb81a2fec19728444b9b76c69fa70 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,67 +3064,70 @@ 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; + } else { + (*numOfQualified) += 1; } } 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; + } else { + (*numOfQualified) += 1; } } 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 +3136,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,33 +3191,33 @@ 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; + } else { + (*numOfQualified) += 1; } } 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 +3235,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 +3251,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,18 +3263,20 @@ 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; + } else { + (*numOfQualified) += 1; } } @@ -4026,37 +4028,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/syncUtil.c b/source/libs/sync/src/syncUtil.c index 15e94baee4f4d7ff32d2d956cc04f9d2ca3e240f..325073f3660172a1067d0bf92e11a8ae9f88fa01 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -57,7 +57,7 @@ void syncUtilU642Addr(uint64_t u64, char* host, size_t len, uint16_t* port) { struct in_addr addr; addr.s_addr = hostU32; - snprintf(host, len, "%s", taosInetNtoa(addr)); + taosInetNtoa(addr, host, len); *port = (uint16_t)((u64 & 0x00000000FFFF0000) >> 16); } 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/os/src/osDir.c b/source/os/src/osDir.c index 418e86a40a918d3340ef809701d3f1d44cb7bb04..cf74525543c0743e8d44225de7b888fdbd1ae790 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -58,6 +58,24 @@ int wordexp(char *words, wordexp_t *pwordexp, int flags) { void wordfree(wordexp_t *pwordexp) {} +#elif defined(DARWIN) + +#include +#include +#include +#include +#include + +typedef struct dirent dirent; +typedef struct dirent TdDirEntry; + +typedef struct TdDir { + TdDirEntry dirEntry; + TdDirEntry dirEntry1; + TdDirEntryPtr dirEntryPtr; + DIR *pDir; +} TdDir; + #else #include @@ -343,7 +361,7 @@ char *taosDirName(char *name) { name[0] = 0; } return name; -#elif defined(_TD_DARWIN_64) +#else char *end = strrchr(name, '/'); if (end != NULL) { *end = '\0'; @@ -351,8 +369,6 @@ char *taosDirName(char *name) { name[0] = 0; } return name; -#else - return dirname(name); #endif } @@ -362,7 +378,9 @@ char *taosDirEntryBaseName(char *name) { _splitpath(name, NULL, NULL, Filename1, Ext1); return name + (strlen(name) - strlen(Filename1) - strlen(Ext1)); #else - return (char *)basename(name); + char *pPoint = strchr(name, '.'); + if (pPoint != NULL) pPoint = 0; + return name; #endif } @@ -386,6 +404,13 @@ TdDirPtr taosOpenDir(const char *dirname) { return NULL; } return pDir; +#elif defined(DARWIN) + DIR *pDir = opendir(dirname); + if (pDir == NULL) return NULL; + TdDirPtr dirPtr = (TdDirPtr)taosMemoryMalloc(sizeof(TdDir)); + dirPtr->dirEntryPtr = (TdDirEntryPtr)&(dirPtr->dirEntry1); + dirPtr->pDir = pDir; + return dirPtr; #else return (TdDirPtr)opendir(dirname); #endif @@ -400,6 +425,12 @@ TdDirEntryPtr taosReadDir(TdDirPtr pDir) { return NULL; } return (TdDirEntryPtr) & (pDir->dirEntry.findFileData); +#elif defined(DARWIN) + if (readdir_r(pDir->pDir, (dirent*)&(pDir->dirEntry), (dirent**)&(pDir->dirEntryPtr)) == 0) { + return pDir->dirEntryPtr; + } else { + return NULL; + } #else return (TdDirEntryPtr)readdir((DIR *)pDir); #endif @@ -436,6 +467,11 @@ int32_t taosCloseDir(TdDirPtr *ppDir) { taosMemoryFree(*ppDir); *ppDir = NULL; return 0; +#elif defined(DARWIN) + closedir((*ppDir)->pDir); + taosMemoryFree(*ppDir); + *ppDir = NULL; + return 0; #else closedir((DIR *)*ppDir); *ppDir = NULL; diff --git a/source/os/src/osSemaphore.c b/source/os/src/osSemaphore.c index 5baba5af1e8051afd06b6f188795fb7c26e99a7e..310804da8dc5845d71b68897918f49e6afd1752e 100644 --- a/source/os/src/osSemaphore.c +++ b/source/os/src/osSemaphore.c @@ -106,293 +106,8 @@ int32_t tsem_timewait(tsem_t* sem, int64_t nanosecs) { #elif defined(_TD_DARWIN_64) -/* - * darwin implementation - */ - #include -// #define SEM_USE_PTHREAD -// #define SEM_USE_POSIX -// #define SEM_USE_SEM - -// #ifdef SEM_USE_SEM -// #include -// #include -// #include -// #include - -// static TdThread sem_thread; -// static TdThreadOnce sem_once; -// static task_t sem_port; -// static volatile int sem_inited = 0; -// static semaphore_t sem_exit; - -// static void *sem_thread_routine(void *arg) { -// (void)arg; -// setThreadName("sem_thrd"); - -// sem_port = mach_task_self(); -// kern_return_t ret = semaphore_create(sem_port, &sem_exit, SYNC_POLICY_FIFO, 0); -// if (ret != KERN_SUCCESS) { -// fprintf(stderr, "==%s[%d]%s()==failed to create sem_exit\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__); -// sem_inited = -1; -// return NULL; -// } -// sem_inited = 1; -// semaphore_wait(sem_exit); -// return NULL; -// } - -// static void once_init(void) { -// int r = 0; -// r = taosThreadCreate(&sem_thread, NULL, sem_thread_routine, NULL); -// if (r) { -// fprintf(stderr, "==%s[%d]%s()==failed to create thread\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__); -// return; -// } -// while (sem_inited == 0) { -// ; -// } -// } -// #endif - -// struct tsem_s { -// #ifdef SEM_USE_PTHREAD -// TdThreadMutex lock; -// TdThreadCond cond; -// volatile int64_t val; -// #elif defined(SEM_USE_POSIX) -// size_t id; -// sem_t *sem; -// #elif defined(SEM_USE_SEM) -// semaphore_t sem; -// #else // SEM_USE_PTHREAD -// dispatch_semaphore_t sem; -// #endif // SEM_USE_PTHREAD - -// volatile unsigned int valid : 1; -// }; - -// int tsem_init(tsem_t *sem, int pshared, unsigned int value) { -// // fprintf(stderr, "==%s[%d]%s():[%p]==creating\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, sem); -// if (*sem) { -// fprintf(stderr, "==%s[%d]%s():[%p]==already initialized\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// struct tsem_s *p = (struct tsem_s *)taosMemoryCalloc(1, sizeof(*p)); -// if (!p) { -// fprintf(stderr, "==%s[%d]%s():[%p]==out of memory\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, sem); -// abort(); -// } - -// #ifdef SEM_USE_PTHREAD -// int r = taosThreadMutexInit(&p->lock, NULL); -// do { -// if (r) break; -// r = taosThreadCondInit(&p->cond, NULL); -// if (r) { -// taosThreadMutexDestroy(&p->lock); -// break; -// } -// p->val = value; -// } while (0); -// if (r) { -// fprintf(stderr, "==%s[%d]%s():[%p]==not created\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, sem); -// abort(); -// } -// #elif defined(SEM_USE_POSIX) -// static size_t tick = 0; -// do { -// size_t id = atomic_add_fetch_64(&tick, 1); -// if (id == SEM_VALUE_MAX) { -// atomic_store_64(&tick, 0); -// id = 0; -// } -// char name[NAME_MAX - 4]; -// snprintf(name, sizeof(name), "/t" PRId64, id); -// p->sem = sem_open(name, O_CREAT | O_EXCL, pshared, value); -// p->id = id; -// if (p->sem != SEM_FAILED) break; -// int e = errno; -// if (e == EEXIST) continue; -// if (e == EINTR) continue; -// fprintf(stderr, "==%s[%d]%s():[%p]==not created[%d]%s\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem, -// e, strerror(e)); -// abort(); -// } while (p->sem == SEM_FAILED); -// #elif defined(SEM_USE_SEM) -// taosThreadOnce(&sem_once, once_init); -// if (sem_inited != 1) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal resource init failed\n", taosDirEntryBaseName(__FILE__), __LINE__, -// __func__, sem); -// errno = ENOMEM; -// return -1; -// } -// kern_return_t ret = semaphore_create(sem_port, &p->sem, SYNC_POLICY_FIFO, value); -// if (ret != KERN_SUCCESS) { -// fprintf(stderr, "==%s[%d]%s():[%p]==semophore_create failed\n", taosDirEntryBaseName(__FILE__), __LINE__, -// __func__, -// sem); -// // we fail-fast here, because we have less-doc about semaphore_create for the moment -// abort(); -// } -// #else // SEM_USE_PTHREAD -// p->sem = dispatch_semaphore_create(value); -// if (p->sem == NULL) { -// fprintf(stderr, "==%s[%d]%s():[%p]==not created\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, sem); -// abort(); -// } -// #endif // SEM_USE_PTHREAD - -// p->valid = 1; - -// *sem = p; - -// return 0; -// } - -// int tsem_wait(tsem_t *sem) { -// if (!*sem) { -// fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, sem); -// abort(); -// } -// struct tsem_s *p = *sem; -// if (!p->valid) { -// fprintf(stderr, "==%s[%d]%s():[%p]==already destroyed\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); abort(); -// } -// #ifdef SEM_USE_PTHREAD -// if (taosThreadMutexLock(&p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// p->val -= 1; -// if (p->val < 0) { -// if (taosThreadCondWait(&p->cond, &p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, -// __func__, -// sem); -// abort(); -// } -// } -// if (taosThreadMutexUnlock(&p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// return 0; -// #elif defined(SEM_USE_POSIX) -// return sem_wait(p->sem); -// #elif defined(SEM_USE_SEM) -// return semaphore_wait(p->sem); -// #else // SEM_USE_PTHREAD -// return dispatch_semaphore_wait(p->sem, DISPATCH_TIME_FOREVER); -// #endif // SEM_USE_PTHREAD -// } - -// int tsem_post(tsem_t *sem) { -// if (!*sem) { -// fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, sem); -// abort(); -// } -// struct tsem_s *p = *sem; -// if (!p->valid) { -// fprintf(stderr, "==%s[%d]%s():[%p]==already destroyed\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); abort(); -// } -// #ifdef SEM_USE_PTHREAD -// if (taosThreadMutexLock(&p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// p->val += 1; -// if (p->val <= 0) { -// if (taosThreadCondSignal(&p->cond)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, -// __func__, -// sem); -// abort(); -// } -// } -// if (taosThreadMutexUnlock(&p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// return 0; -// #elif defined(SEM_USE_POSIX) -// return sem_post(p->sem); -// #elif defined(SEM_USE_SEM) -// return semaphore_signal(p->sem); -// #else // SEM_USE_PTHREAD -// return dispatch_semaphore_signal(p->sem); -// #endif // SEM_USE_PTHREAD -// } - -// int tsem_destroy(tsem_t *sem) { -// // fprintf(stderr, "==%s[%d]%s():[%p]==destroying\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, sem); -// if (!*sem) { -// // fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// // abort(); -// return 0; -// } -// struct tsem_s *p = *sem; -// if (!p->valid) { -// // fprintf(stderr, "==%s[%d]%s():[%p]==already destroyed\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// // sem); abort(); -// return 0; -// } -// #ifdef SEM_USE_PTHREAD -// if (taosThreadMutexLock(&p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// p->valid = 0; -// if (taosThreadCondDestroy(&p->cond)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// if (taosThreadMutexUnlock(&p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// if (taosThreadMutexDestroy(&p->lock)) { -// fprintf(stderr, "==%s[%d]%s():[%p]==internal logic error\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem); -// abort(); -// } -// #elif defined(SEM_USE_POSIX) -// char name[NAME_MAX - 4]; -// snprintf(name, sizeof(name), "/t" PRId64, p->id); -// int r = sem_unlink(name); -// if (r) { -// int e = errno; -// fprintf(stderr, "==%s[%d]%s():[%p]==unlink failed[%d]%s\n", taosDirEntryBaseName(__FILE__), __LINE__, __func__, -// sem, -// e, strerror(e)); -// abort(); -// } -// #elif defined(SEM_USE_SEM) -// semaphore_destroy(sem_port, p->sem); -// #else // SEM_USE_PTHREAD -// #endif // SEM_USE_PTHREAD - -// p->valid = 0; -// taosMemoryFree(p); - -// *sem = NULL; -// return 0; -// } - int tsem_init(tsem_t *psem, int flags, unsigned int count) { *psem = dispatch_semaphore_create(count); if (*psem == NULL) return -1; @@ -401,8 +116,8 @@ int tsem_init(tsem_t *psem, int flags, unsigned int count) { int tsem_destroy(tsem_t *psem) { if (psem == NULL || *psem == NULL) return -1; - dispatch_release(*psem); - *psem = NULL; + // dispatch_release(*psem); + // *psem = NULL; return 0; } diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index f34032056cba6a2e2160e7b7a54abe79a959d301..b34d071773591600e06adc9b08873a89b7e2e1b4 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -312,14 +312,8 @@ uint32_t taosInetAddr(const char *ipAddr) { return inet_addr(ipAddr); #endif } -const char *taosInetNtoa(struct in_addr ipInt) { -#ifdef WINDOWS - // not thread safe, only for debug usage while print log - static char tmpDstStr[16]; - return inet_ntop(AF_INET, &ipInt, tmpDstStr, INET6_ADDRSTRLEN); -#else - return inet_ntoa(ipInt); -#endif +const char *taosInetNtoa(struct in_addr ipInt, char *dstStr, int32_t len) { + return inet_ntop(AF_INET, &ipInt, dstStr, len); } #ifndef SIGPIPE @@ -670,7 +664,7 @@ int taosGetLocalIp(const char *eth, char *ip) { return -1; } memcpy(&sin, &ifr.ifr_addr, sizeof(sin)); - snprintf(ip, 64, "%s", inet_ntoa(sin.sin_addr)); + taosInetNtoa(sin.sin_addr, ip, 64); taosCloseSocketNoCheck1(fd); #endif return 0; diff --git a/source/os/src/osString.c b/source/os/src/osString.c index db3aaa49a6351e4b6a26a4a7b601f4e267c4f4c7..3619e9584791900321647399b01e76be3af928a3 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -306,8 +306,6 @@ int32_t taosMbsToWchars(TdWchar *pWchars, const char *pStrs, int32_t size) { ret int32_t taosWcharToMb(char *pStr, TdWchar wchar) { return wctomb(pStr, wchar); } -int32_t taosWcharsToMbs(char *pStrs, TdWchar *pWchars, int32_t size) { return wcstombs(pStrs, pWchars, size); } - char *taosStrCaseStr(const char *str, const char *pattern) { size_t i; @@ -326,6 +324,9 @@ char *taosStrCaseStr(const char *str, const char *pattern) { int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) { int64_t tmp = strtoll(str, pEnd, radix); +#ifdef DARWIN + if (errno == EINVAL) errno = 0; +#endif #ifdef TD_CHECK_STR_TO_INT_ERROR assert(errno != ERANGE); assert(errno != EINVAL); @@ -335,6 +336,9 @@ int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) { uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) { uint64_t tmp = strtoull(str, pEnd, radix); +#ifdef DARWIN + if (errno == EINVAL) errno = 0; +#endif #ifdef TD_CHECK_STR_TO_INT_ERROR assert(errno != ERANGE); assert(errno != EINVAL); @@ -344,6 +348,9 @@ uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) { int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) { int32_t tmp = strtol(str, pEnd, radix); +#ifdef DARWIN + if (errno == EINVAL) errno = 0; +#endif #ifdef TD_CHECK_STR_TO_INT_ERROR assert(errno != ERANGE); assert(errno != EINVAL); @@ -353,6 +360,9 @@ int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) { uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) { uint32_t tmp = strtol(str, pEnd, radix); +#ifdef DARWIN + if (errno == EINVAL) errno = 0; +#endif #ifdef TD_CHECK_STR_TO_INT_ERROR assert(errno != ERANGE); assert(errno != EINVAL); @@ -362,6 +372,9 @@ uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) { int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) { int32_t tmp = strtol(str, pEnd, radix); +#ifdef DARWIN + if (errno == EINVAL) errno = 0; +#endif #ifdef TD_CHECK_STR_TO_INT_ERROR assert(errno != ERANGE); assert(errno != EINVAL); @@ -373,6 +386,9 @@ int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) { uint16_t taosStr2UInt16(const char *str, char **pEnd, int32_t radix) { uint32_t tmp = strtoul(str, pEnd, radix); +#ifdef DARWIN + if (errno == EINVAL) errno = 0; +#endif #ifdef TD_CHECK_STR_TO_INT_ERROR assert(errno != ERANGE); assert(errno != EINVAL); @@ -394,6 +410,9 @@ int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix) { uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix) { uint32_t tmp = strtoul(str, pEnd, radix); +#ifdef DARWIN + if (errno == EINVAL) errno = 0; +#endif #ifdef TD_CHECK_STR_TO_INT_ERROR assert(errno != ERANGE); assert(errno != EINVAL); diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 6867c1373bdb03ad63c3001291feaad468090dea..a57bd4ee632a7abf829d95f8f47cbbfba94684bd 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -143,8 +143,11 @@ static int32_t taosGetSysCpuInfo(SysCpuInfo *cpuInfo) { cpuInfo->user = CompareFileTime(&pre_userTime, &userTime); cpuInfo->nice = 0; } -#elif defined(_TD_DARWIN_64) - assert(0); +#elif defined(DARWIN) + cpuInfo->idle = 0; + cpuInfo->system = 0; + cpuInfo->user = 0; + cpuInfo->nice = 0; #else TdFilePtr pFile = taosOpenFile(tsSysCpuFile, TD_FILE_READ | TD_FILE_STREAM); if (pFile == NULL) { @@ -180,8 +183,11 @@ static int32_t taosGetProcCpuInfo(ProcCpuInfo *cpuInfo) { cpuInfo->cutime = 0; cpuInfo->cstime = 0; } -#elif defined(_TD_DARWIN_64) - assert(0); +#elif defined(DARWIN) + cpuInfo->stime = 0; + cpuInfo->utime = 0; + cpuInfo->cutime = 0; + cpuInfo->cstime = 0; #else TdFilePtr pFile = taosOpenFile(tsProcCpuFile, TD_FILE_READ | TD_FILE_STREAM); if (pFile == NULL) { @@ -359,7 +365,7 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) { pCmd = taosOpenCmd("sysctl -n machdep.cpu.core_count"); if (pCmd == NULL) return code; memset(buf, 0, sizeof(buf)); - if (taosGetsCmd(pCmd, maxLen, cpuModel) > 0) { + if (taosGetsCmd(pCmd, sizeof(buf) - 1, buf) > 0) { code = 0; done |= 2; *numOfCores = atof(buf); diff --git a/source/os/src/osTimezone.c b/source/os/src/osTimezone.c index 2ce2033a00ef92523cf724c9a16e4bb7ecbed2ef..34a09c3e6c6610ec1114238867cf9f068ebd5557 100644 --- a/source/os/src/osTimezone.c +++ b/source/os/src/osTimezone.c @@ -891,6 +891,7 @@ void taosGetSystemTimezone(char *outTimezoneStr, enum TdTimezone *tsTimezone) { time_t tx1 = taosGetTimestampSec(); struct tm tm1; taosLocalTime(&tx1, &tm1); + daylight = tm1.tm_isdst; /* * format example: diff --git a/tests/docs-examples-test/csharp.sh b/tests/docs-examples-test/csharp.sh index d7f2670478fa593e1d4c81ccc50c04248a4693cc..8d1031ab8f8367e260804a58ecc2ae4f9822550c 100644 --- a/tests/docs-examples-test/csharp.sh +++ b/tests/docs-examples-test/csharp.sh @@ -6,24 +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 +taos -s "drop database if exists power" +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 +taos -s "drop topic if exists topic_example" +taos -s "drop database if exists power" +dotnet run --project stmtInsert/stmtinsert.csproj -#taos -s "drop database if exists test" -#dotnet run --project influxdbline.csproj +taos -s "drop database if exists test" +dotnet run --project influxdbLine/influxdbline.csproj -#taos -s "drop database if exists test" -#dotnet run --project optstelnet.csproj +taos -s "drop database if exists test" +dotnet run --project optsTelnet/optstelnet.csproj -#taos -s "drop database if exists test" -#dotnet run --project optsjson.csproji -echo "uncomment temporily" +taos -s "drop database if exists test" +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/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 89b7fe00ebb0cf04b4570643966d553a4bccea9b..4bcbe190d564a3d734d8c720af88eb1493867019 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -415,23 +415,15 @@ class TDDnode: i += 1 if i > 50: break - tailCmdStr = 'tail -f ' - popen = subprocess.Popen( - tailCmdStr + logFile, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - shell=True) - pid = popen.pid - # print('Popen.pid:' + str(pid)) - timeout = time.time() + 60 * 2 - while True: - line = popen.stdout.readline().strip() - if bkey in line: - popen.kill() - break - if time.time() > timeout: - tdLog.exit('wait too long for taosd start') - tdLog.debug("the dnode:%d has been started." % (self.index)) + with open(logFile) as f: + timeout = time.time() + 60 * 2 + while True: + line = f.readline().encode('utf-8') + if bkey in line: + break + if time.time() > timeout: + tdLog.exit('wait too long for taosd start') + tdLog.debug("the dnode:%d has been started." % (self.index)) else: tdLog.debug( "wait 10 seconds for the dnode:%d to start." % @@ -480,19 +472,21 @@ class TDDnode: toBeKilled = "valgrind.bin" if self.running != 0: - psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled + psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs" % toBeKilled processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() onlyKillOnceWindows = 0 while(processID): if not platform.system().lower() == 'windows' or (onlyKillOnceWindows == 0 and platform.system().lower() == 'windows'): killCmd = "kill -INT %s > /dev/null 2>&1" % processID + if platform.system().lower() == 'windows': + killCmd = "kill -INT %s > nul 2>&1" % processID os.system(killCmd) onlyKillOnceWindows = 1 time.sleep(1) processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() if not platform.system().lower() == 'windows': for port in range(6030, 6041): fuserCmd = "fuser -k -n tcp %d > /dev/null" % port @@ -516,11 +510,11 @@ class TDDnode: if self.running != 0: if platform.system().lower() == 'windows': - psCmd = "for /f %%a in ('wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId ^| xargs echo ^| awk ^'{print $2}^' ^&^& echo aa') do @(ps | grep %%a | awk '{print $1}' )" % (self.index) + psCmd = "for /f %%a in ('wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId ^| xargs echo ^| awk ^'{print $2}^' ^&^& echo aa') do @(ps | grep %%a | awk '{print $1}' | xargs)" % (self.index) else: - psCmd = "ps -ef|grep -w %s| grep dnode%d|grep -v grep | awk '{print $2}'" % (toBeKilled,self.index) + psCmd = "ps -ef|grep -w %s| grep dnode%d|grep -v grep | awk '{print $2}' | xargs" % (toBeKilled,self.index) processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() onlyKillOnceWindows = 0 while(processID): @@ -530,7 +524,7 @@ class TDDnode: onlyKillOnceWindows = 1 time.sleep(1) processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() if self.valgrind: time.sleep(2) @@ -547,9 +541,9 @@ class TDDnode: toBeKilled = "valgrind.bin" if self.running != 0: - psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled + psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs" % toBeKilled processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() onlyKillOnceWindows = 0 while(processID): @@ -559,7 +553,7 @@ class TDDnode: onlyKillOnceWindows = 1 time.sleep(1) processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() for port in range(6030, 6041): fuserCmd = "fuser -k -n tcp %d" % port os.system(fuserCmd) @@ -704,15 +698,15 @@ class TDDnodes: for i in range(len(self.dnodes)): self.dnodes[i].stop() - psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}'" - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() if processID: cmd = "sudo systemctl stop taosd" os.system(cmd) # if os.system(cmd) != 0 : # tdLog.exit(cmd) - psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}'" - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}' | xargs" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): if platform.system().lower() == 'windows': killCmd = "kill -9 %s > nul 2>&1" % processID @@ -721,11 +715,11 @@ class TDDnodes: os.system(killCmd) time.sleep(1) processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() if self.killValgrind == 1: - psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'" - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() while(processID): if platform.system().lower() == 'windows': killCmd = "kill -TERM %s > nul 2>&1" % processID @@ -734,7 +728,7 @@ class TDDnodes: os.system(killCmd) time.sleep(1) processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") + psCmd, shell=True).decode("utf-8").strip() # if os.system(cmd) != 0 : # tdLog.exit(cmd) 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/99-TDcase/TD-19201.py b/tests/system-test/99-TDcase/TD-19201.py new file mode 100644 index 0000000000000000000000000000000000000000..26caa27815e427364e9275502bf062236e6fca38 --- /dev/null +++ b/tests/system-test/99-TDcase/TD-19201.py @@ -0,0 +1,797 @@ +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * + +class TDTestCase: + hostname = socket.gethostname() + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + #tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files or "taosd.exe" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def create_tables(self): + tdSql.execute(f"drop database if exists table_numeric_max_min") + tdSql.execute(f"create database if not exists table_numeric_max_min keep 36500 replica 1") + tdSql.execute(f"use table_numeric_max_min") + tdSql.execute(f"use table_numeric_max_min") + tdSql.execute(f"create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create stable stable_null_data (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create stable stable_null_childtable (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp)") + tdSql.execute(f"create table stable_1_1 using stable_1 tags('stable_1_1', '1875819221' , '590058475305213213', '27794' , '-9' , 0 , 'binary1.RwUtFTPELUljKAhTomOd' , 'nchar1.jUSliorTipXBPWUFvgmL' , '70702407145428.500000', '3942240905.627770' ,'0')") + tdSql.execute(f"create table stable_1_2 using stable_1 tags('stable_1_2', '-1129886283' , '8365334906094716813', '-6150' , '57' , 1 , 'binary1.vTmIEcSbytCJAERpWCGd' , 'nchar1.voiUIweoRUDKNWYNjrBV' , '5437.641507', '77141629449.138901' , '1999-09-09 09:09:09.090')") + tdSql.execute(f"create table stable_1_3 using stable_1 tags('stable_1_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , '2099-09-09 09:09:09.090')") + tdSql.execute(f"create table stable_1_4 using stable_1 tags('stable_1_4', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')") + tdSql.execute(f"create table stable_1_5 using stable_1 tags('stable_1_5', '1771737352' , '8519944309455480374', '-8770' , '-7' , 1 , 'binary1.SJUKdVsgafZagrqnYdTh' , 'nchar1.ONFhJIwhhLWJUtLKvKmw' , '31182473.161482', '64.321472' ,'-339837172')") + tdSql.execute(f"create table stable_1_6 using stable_1 tags('stable_1_6', '987461012' , '-776424343185148156', '-6733' , '-115' , 1 , 'binary1.YQTZHyzKNWJIZrDeOKdP' , 'nchar1.BxnvJVUAFklEphKHWIqP' , '60.387150', '385878886707.695007' ,'-1313802358')") + tdSql.execute(f"create table stable_2_1 using stable_2 tags('stable_2_1', '1972317427' , '-3820929692060830425', '18206' , '89' , 1 , 'binary2.InbFxJVQLmIseMeYntEH' , 'nchar2.wkGXcuYevFTHgydogliI' , '656538.907187', '11.667827' ,'0')") + tdSql.execute(f"create table stable_2_2 using stable_2 tags('stable_2_2' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')") + tdSql.execute(f"create table stable_2_3 using stable_2 tags('stable_2_3', '121025327' , '-5067951734787165505', '-4541' , '39' , 1 , 'binary2.PWqqHvgkGRmSULvNblZM' , 'nchar2.BsSqoSHfdDzTWBIDTxIW' , '722578830492.845947', '-62936658111.557999' ,'1719325653')") + tdSql.execute(f"create table stable_2_4 using stable_2 tags('stable_2_4', '-1703445602' , '952583276175911157', '-15847' , '-1' , 1 , 'binary2.ZIRXiGPcWsDDYadmVHbC' , 'nchar2.CkMRgnmReMXbRfKiaHos' , '-2.806483', '620882751.119021' ,'1462034599')") + tdSql.execute(f"create table stable_2_5 using stable_2 tags('stable_2_5', '2022084941' , '-172782721714864542', '-31211' , '-13' , 1 , 'binary2.RgbEIzefrTuDfyRolGgQ' , 'nchar2.ahMsbNznUpydshGChFWR' , '9230.698315', '11569418.757060' ,'1789286591')") + tdSql.execute(f"create table stable_2_6 using stable_2 tags('stable_2_6', '2139131012' , '-2151050146076640638', '11205' , '98' , 1 , 'binary2.XdcwVjbqUuKEFWdeAOGK' , 'nchar2.adnShgPhNhoFUgVrzrIF' , '4896671.448837', '-663422197.440925' ,'-591925015')") + tdSql.execute(f"create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')") + tdSql.execute(f"create table regular_table_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + tdSql.execute(f"create table regular_table_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + tdSql.execute(f"create table regular_table_3 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + tdSql.execute(f"create table regular_table_null (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)") + + return + + def insert_data(self): + tdLog.debug("start to insert data ............") + + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630000000000, -143708439, -6740796029571244151, 15012, -31, -934058894431.915039, -3695933.334631, 0, 'binary.wEvcyPTYhxxKhVFrShTZ', 'nchar.河南省成都市高明邱街y座 294108', 1630000000000)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000000, -1643794439, -3164709410897301333, -7208, -11, -1306531857188.310059, 632395.211968, 0, 'binary.jrpjGVDqTHJXDbUIxEir', 'nchar.青海省贵阳县牧野邯郸路U座 687168', 1630000000000)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1629999999999, 1048090051, 4753139546176318956, 31490, 65, -8328268324.680830, 74037727.447481, 1, 'binary.QFXcjYxRIgvVcaabbAuo', 'nchar.湖南省畅市璧山石家庄路O座 936681', 1630000000000)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000000, 1054267597, 332752484638053804, 1388, 112, -125.582297, -76003.954672, 1, 'binary.YNzAxeYGxNpFArjidcOh', 'nchar.江西省雪市六枝特深圳街b座 108494', 1630000000000)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000001, -115380468, -2294264221485096401, -20382, -90, -3775423439181.850098, -95439449.928655, 1, 'binary.ilLTZcPTGRSwIjACLGlM', 'nchar.台湾省瑜市平山李街D座 331780', 1630000000001)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000001, -504963560, -8159067702893064842, -5491, -49, 841872.351000, -84748281935263.906250, 1, 'binary.DtKESUYTjuakZGPtBWsn', 'nchar.山东省西宁县房山北镇街k座 852004', 1630000000001)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630000000000, 1962198354, 5726511532140217455, 20962, -124, -35534.621562, 655.911379, 0, 'binary.kczEOqXlmYDzQxVrxiri', 'nchar.天津市秀英市锡山成都街c座 934752', 1630000000000)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630015000000, -2044434228, -1228575710134602773, 23424, 71, 6.886844, 71.519941, 0, 'binary.iVmwRqGqAbGImLpoUiKX', 'nchar.山东省兰州市山亭卜路d座 110251', 1630000000001)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000000, -1561126129, 4402494144547686327, 19018, -31, 857260.740185, -750.240044, 0, 'binary.qPQkCflOVhWCAnuCCHWY', 'nchar.广东省秀荣市山亭南京路C座 785792', 1630000000001)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630014999999, 1095266727, 2746241631637453300, 7253, 92, -237902303804.821014, 46908.997377, 1, 'binary.NMQGxjbGhMVVbcQEBaEK', 'nchar.台湾省东莞市高坪南京街u座 150902', 1630000000001)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000000, 2130829317, 2085871782840505044, 2484, 30, -3.105125, 29879090388.666199, 1, 'binary.yfnegmvETJTxPrIrvxxe', 'nchar.福建省兴安盟县西夏澳门路p座 460995', 1630000000001)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000001, -1664825220, -5631789961756669368, -23059, -76, 8441.841532, -6705.596239, 1, 'binary.LZlUlCryyKuhhwGGlSjc', 'nchar.四川省巢湖县长寿西宁街O座 989989', 1630000000002)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000001, -1067652799, -5826504339509635297, -390, -15, -66135776826527.101562, -8198121301.465600, 1, 'binary.bppXThGxTXGyhKdEpRgX', 'nchar.四川省桂芳县长寿杭州路M座 546474', 1630000000002)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630015000000, 1596913082, 1646557549281147083, -14492, -72, 33.692574, 72141847615.397003, 0, 'binary.XxVywbRiXEabPDUoMgxT', 'nchar.重庆市凤兰市城北呼和浩特街O座 959006', 1630000000001)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630030000000, 1109067209, 8318147433525574130, 291, 81, 308262.371110, 3017294.523108, 0, 'binary.mJPDrXToNeEldaahHrjD', 'nchar.新疆维吾尔自治区广州市清河沈阳街F座 287894', 1630000000002)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000000, -995915290, 3161170011949889743, -3415, -62, -5111655245631.230469, -7257779.688047, 0, 'binary.vzcGfGPzmKOqwWlstVmQ', 'nchar.河北省海燕县怀柔齐齐哈尔路O座 679791', 1630000000002)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630029999999, 1270783858, 3618027349082548235, 25887, 84, -659813588408.829956, -32621042966661.398438, 1, 'binary.GqXavHpdBwhbCDrQnpSF', 'nchar.湖北省永安市金平通辽路o座 143728', 1630000000002)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000000, 1739749630, 1610294704102234156, 18492, 117, -24323056593048.300781, 46.116231, 1, 'binary.hzRmZmuYAUsAdQrSEyFm', 'nchar.贵州省杰市南长王街Q座 377635', 1630000000002)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000001, -1718628594, -4057665590789803346, -27617, -32, -84372491943.149796, 5698.767553, 1, 'binary.wPOmeglMuNsatgqVOYvh', 'nchar.新疆维吾尔自治区深圳市长寿梁路l座 415101', 1630000000003)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000001, -97007549, -1557528468040059015, -6101, -18, -34048.334225, -1657.736116, 1, 'binary.eDYjVVXEPBpiilaVwOrx', 'nchar.贵州省成市六枝特傅街t座 803260', 1630000000003)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630030000000, -2121650398, -1192567467640899873, 27738, 2, -89612476.306992, -5984440.654033, 0, 'binary.BOOyBOTaGGGWppOLcCbQ', 'nchar.天津市峰县朝阳梁街X座 288727', 1630000000002)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 1148326681, -6925816541216354608, -31227, 54, 222564.451289, 8431.504529, 0, 'binary.NHZMOcXRwhSPvmIIxdxp', 'nchar.台湾省台北市魏都路街Y座 785205', 1630000000003)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 544052556, 66604009301449217, 21345, 113, 765168602.280518, -97989380.717398, 0, 'binary.CwzIKVOzfevwyQikTtty', 'nchar.江苏省郑州县新城骆街E座 897275', 1630000000003)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630044999999, 781814072, 820039380718257377, 16412, 8, 13534073596162.000000, 84710586503.486099, 1, 'binary.LBBuZbsGbCPwrtpgpJUU', 'nchar.西藏自治区西宁县牧野孙路U座 873211', 1630000000003)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 2133537352, 8495070517087119217, 650, 4, -99578297.552409, 635328734398.352051, 1, 'binary.NfQiEIznVNaygWdjgrpf', 'nchar.山西省阜新县锡山台北路j座 854425', 1630000000003)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000001, -222510400, -1899555459266145413, -1874, -18, -116.302821, -2969179.976125, 1, 'binary.BgnCkJAICiNgxqiaowKU', 'nchar.上海市淑珍市城东上海路v座 534884', 1630000000004)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000001, -995678859, -7818673459856301613, -15799, -53, 4590.410976, -289305504318.122009, 1, 'binary.jzxySgQRnfthYtrsClss', 'nchar.香港特别行政区洁市东丽白路X座 942700', 1630000000004)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630045000000, 2039518409, -7951010656620124852, 26555, 97, 317885662.762503, -15671218405798.900391, 0, 'binary.PpJrRRqrlVkrvHDFhGfc', 'nchar.广东省长春县沈河银川街p座 226735', 1630000000003)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630060000000, 723117353, -1590889099228121365, -2895, -118, -9424.662668, 106.531721, 0, 'binary.TublFbdwZUkjDXBnzoCS', 'nchar.内蒙古自治区成都市淄川梁路O座 490394', 1630000000004)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000000, -1943729504, 4725330849524291079, 19350, 23, -72996737.774954, 99.647626, 0, 'binary.NaxwyUiYqMDJixXFkrwl', 'nchar.青海省佛山县浔阳辽阳路i座 673884', 1630000000004)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630059999999, 260526220, 1293392929073191769, 195, 84, -889913.874227, -86079294.573690, 1, 'binary.uSifMBsrTaQhLuYRzSNB', 'nchar.河北省台北市梁平石家庄路p座 882177', 1630000000004)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000000, 1100804375, 8343686791181684001, 11516, 82, -898520.749607, 8.704132, 1, 'binary.mlUobRUmHCNOOqCgXLAC', 'nchar.上海市潮州县魏都永安街n座 239177', 1630000000004)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000001, -1734497021, -6543273238001990224, -9471, -105, 5.215463, -8.406843, 1, 'binary.UnQSdMFNesxovxaQqywB', 'nchar.河北省兰英市高明西安街O座 898407', 1630000000005)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000001, -356952133, -5811125050930035045, -10106, -86, -59731.343942, -6.711605, 1, 'binary.BucKdpqIcWfBATWFIUwQ', 'nchar.台湾省梅市华龙葛路f座 841443', 1630000000005)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630060000000, -1448303077, 7581281332610752593, -28597, 65, 42652369.542399, 19027309795.674400, 0, 'binary.kNqlJbVupSKDoutNSkZj', 'nchar.内蒙古自治区梅市龙潭郑街P座 821111', 1630000000004)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630075000000, -1735114764, -910694996111564041, 17973, 73, 210.783307, 78353441914751.406250, 0, 'binary.TCDlFpIyMpXfcghfWlUe', 'nchar.湖南省惠州市浔阳章街y座 769412', 1630000000005)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000000, -1569047795, 6154014930112626762, -23107, 71, 7415.321612, -333.790673, 0, 'binary.cQDlPOzuViCfYAjUdgwt', 'nchar.吉林省婷婷市西夏西宁路m座 909021', 1630000000005)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630074999999, 856956546, 6275962241273936020, 9270, 21, -33.848277, 64751237042062.703125, 1, 'binary.ctAKBcRCfQQDgayszuAG', 'nchar.江苏省宁市清河李路g座 724944', 1630000000005)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000000, 1448326946, 7972199845302312059, 705, 105, -204.655811, 732152.198035, 1, 'binary.BcZdTPFgPbkxBUcFljtp', 'nchar.宁夏回族自治区峰县沈北新长春街L座 533383', 1630000000005)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000001, -2035071163, -7787122277706108419, -7254, -103, 5674.411412, 577.478622, 1, 'binary.evhulVVFzQzmcxSxrhKQ', 'nchar.内蒙古自治区亮市合川长沙路n座 765501', 1630000000006)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000001, -306773260, -7374114523451218038, -9388, -82, -62404928835266.203125, 42386299338.397598, 1, 'binary.esbdUcokubRSnOqkJkLB', 'nchar.山东省琴市上街马鞍山路C座 147584', 1630000000006)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630075000000, -400440831, 3437601667225177538, 20276, -39, -16726360314300.500000, -4598873.151255, 0, 'binary.OkLYkfrvFAWiFDpqiaxV', 'nchar.广东省佛山市璧山孟街L座 706570', 1630000000005)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630090000000, 1973623075, -488129617113651385, -13853, 30, 75272169.904987, 27857.549440, 0, 'binary.xkRVpVawmLMQlKCdvZtZ', 'nchar.江西省磊市怀柔太原路K座 851187', 1630000000006)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000000, -252137090, -5296831169315465834, -20550, -20, -3.941531, -75700534.472326, 0, 'binary.BpKasTBDYsehOyjPzszU', 'nchar.上海市红市西峰张路E座 415889', 1630000000006)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630089999999, 2024548336, 4139843660031507838, 19827, 13, -2167586.132392, -25417449654.380001, 1, 'binary.HAdhzWKQINYLaYkXNWMA', 'nchar.河南省汕尾市沙市张街w座 551925', 1630000000006)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000000, 2107913968, 1289804881586351882, 11892, 64, 5317489029302.500000, -87057162.779656, 1, 'binary.OgWLsotYlsjEVMRdLBuE', 'nchar.安徽省健县西峰太原路Q座 657330', 1630000000006)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000001, -1388002413, -8410442498260521376, -32608, -106, 253633520667.924011, 189217.183223, 1, 'binary.uYfWFNKpQafMupBPxsaQ', 'nchar.重庆市宜都县闵行简街i座 191919', 1630000000007)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000001, -1299395984, -5371389022375922971, -10699, -3, -77152176732086.500000, 3022372632154.790039, 1, 'binary.suubVqjYFZLbSTtupfJz', 'nchar.上海市桂珍市沈河重庆街m座 297301', 1630000000007)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630090000000, -2027322440, 2494209288710251536, 9722, 36, -5920.224246, -6082294200418.269531, 0, 'binary.AdrnDYFrIaLanobBNtfe', 'nchar.青海省邯郸市新城潮州街n座 431311', 1630000000006)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630105000000, 1693347900, 3148347996562430560, 7984, -125, 851.227689, 36582.261941, 0, 'binary.CRmkBadMfWkcImouLOYC', 'nchar.陕西省澳门市沙湾海口街B座 465135', 1630000000007)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000000, -993042639, -3563434487593064918, 25565, 92, 35189008.309030, 636.547745, 0, 'binary.OoULtmPoUYrnyIRmOomq', 'nchar.内蒙古自治区雷县涪城辽阳路M座 278853', 1630000000007)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630104999999, 896614799, 2243073176348662224, 28908, 61, -27224979.660738, -774.713640, 1, 'binary.eLMnpehchKlvWYooNwzT', 'nchar.山西省六盘水县兴山周路E座 606601', 1630000000007)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000000, 814428057, 1481917516738425350, 15453, 4, 48966471575006.898438, 963385.769898, 1, 'binary.ihMiqNMlQJJZzmmqQCxd', 'nchar.安徽省南昌县翔安济南路m座 375964', 1630000000007)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000001, -449300050, -9120117477577024283, -32402, -33, 10292695658.142700, -34437.176958, 1, 'binary.qKdRIooLiEPovATVrIjv', 'nchar.贵州省淑华县兴山西宁路l座 608705', 1630000000008)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000001, -432206150, -2588236186691485163, -23087, -15, 400818.639211, -4.716588, 1, 'binary.eZOuaAtkYBpffobznIIg', 'nchar.湖北省阜新县高港西安街U座 699140', 1630000000008)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630105000000, -1368554069, -7541187960916300774, 14988, -91, 1942225715.555290, -70334.201426, 0, 'binary.HvoKMzXkvOzwerEjbwEu', 'nchar.甘肃省佛山县丰都阜新路h座 248791', 1630000000007)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630120000000, 1041114692, -4272739428405588701, -2465, 88, 21784769476439.500000, -68577664683.573502, 0, 'binary.FplIhrrnZDEqcPpMXcCz', 'nchar.广东省亮市清河嘉禾路Q座 453757', 1630000000008)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000000, 176715584, -8079534335031834008, -22423, -105, 2684870082.726260, -8.267891, 0, 'binary.xAOmXPYnrbGdHxHqywad', 'nchar.甘肃省荆门市清浦马鞍山路r座 410741', 1630000000008)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630119999999, 640308875, 3240059255473088756, 31836, 80, -7728815076.892700, 750986226173.490967, 1, 'binary.OzGnekdKxbZxbKgGFJlg', 'nchar.澳门特别行政区台北市白云淮安路B座 375090', 1630000000008)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000000, 1092638007, 8935528528767608896, 4337, 23, -372778.775792, 93085.883825, 1, 'binary.vZySFqduHRgMRgGDCHMO', 'nchar.青海省旭县山亭陈路r座 820766', 1630000000008)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000001, -1961834598, -4976614618620345763, -15019, -7, -181775367037.890015, -489008.481333, 1, 'binary.FbQxRmecVULCPbyUFBtd', 'nchar.河北省志强县浔阳福州街G座 429013', 1630000000009)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000001, -1722034194, -2355585911534022326, -4297, -50, -55.449413, -615331713611.660034, 1, 'binary.JELgidqLYfIKlQGqJxFQ', 'nchar.河南省柳州县花溪田路q座 284391', 1630000000009)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630120000000, -1171799899, 6798705239630104147, 14631, 13, -690512100.797553, 4942216164.922990, 0, 'binary.JZyfPEyhblizmAILYppl', 'nchar.广东省玉英县孝南沈阳街Y座 637681', 1630000000008)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630135000000, -1384036824, 218630290551636514, 30524, -57, -887.357597, 6.720203, 0, 'binary.NpfAGysaedqwHzyjOEhb', 'nchar.澳门特别行政区六盘水市和平长沙街x座 821514', 1630000000009)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000000, -1305588265, -8021530421135445279, -32118, -94, -3231868745378.140137, -3384463304.343490, 0, 'binary.yAnQLRdPTIoYFmazSvtN', 'nchar.贵州省宜都县海港童路E座 199160', 1630000000009)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630134999999, 152017229, 5533762214494486905, 29777, 107, -597881444.549760, 60.902207, 1, 'binary.CoERNXcHahySItezBpen', 'nchar.云南省北京县海陵张路A座 568099', 1630000000009)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000000, 1236190014, 4653596223295984266, 14748, 21, -5951588996860.620117, 2234250837.617470, 1, 'binary.WwUGpNKIpNfbqTYAZTDT', 'nchar.广东省济南市长寿林街l座 798089', 1630000000009)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000001, -873242705, -7271514029553280325, -7516, -61, 66128079.834318, 77571831.128020, 1, 'binary.LLhLPAXTmmXelsILHdQZ', 'nchar.西藏自治区瑜县长寿天津路t座 566335', 1630000000010)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000001, -2107043391, -6872223014761334604, -253, -30, -2052472.350812, -816315756.554040, 1, 'binary.wvSnelJAPwZethZNEZqM', 'nchar.上海市兴安盟县徐汇陈街L座 910420', 1630000000010)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630135000000, -283811418, -890001232755261528, -15727, -29, 632302961.122940, 3372672571.351960, 0, 'binary.DNpxbprlJeuvywljvLWV', 'nchar.黑龙江省畅县大东佛山街o座 623470', 1630000000009)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1841425030, 5840114857227443220, 15419, 20, -176685681169.731995, -20366.126795, 0, 'binary.wpRXidgNPOERhEaZlJAM', 'nchar.青海省帅市平山梧州路s座 315192', 1630000000010)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1868258378, -829467537608086421, -15673, 43, -682501443.992492, 564.308967, 0, 'binary.PThYCRdfuhudrwOYOFgy', 'nchar.重庆市欣县丰都唐路B座 999593', 1630000000010)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630149999999, 7371013, 8606554902691526904, 11354, 74, 26482.297818, -6880189394.673160, 1, 'binary.OtbSjvYZOPWbIQOdIrKG', 'nchar.福建省波县璧山嘉禾路X座 190183', 1630000000010)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1574294578, 6360685624760963951, 11117, 71, -272.941943, 29.887578, 1, 'binary.djhaZVhHOWsrnxbiHVTk', 'nchar.西藏自治区南昌县清河拉萨街w座 620924', 1630000000010)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000001, -259884599, -3561655319278167435, -1554, -47, -0.233381, 45265486282274.000000, 1, 'binary.ILwvbvFGWLKDelTSCcDm', 'nchar.河北省哈尔滨市海港梧州路m座 889188', 1630000000011)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000001, -1515650476, -7802732131723416636, -12941, -64, -809.874644, 6032.826263, 1, 'binary.tAYvdysPqcwaHdGoSNgs', 'nchar.上海市玉兰市高明宁德街v座 296568', 1630000000011)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630150000000, 1110286890, -8373744956439073351, 15041, -53, 4069186274.937290, 2.194559, 0, 'binary.auztDxkjzltBpZNEImEj', 'nchar.贵州省平市璧山乐路a座 747181', 1630000000010)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630165000000, -270068972, 7039763496469502050, -17618, 23, -975020808834.901001, 20433408805144.398438, 0, 'binary.FNcyuyrPVVVfxbzDuGlf', 'nchar.宁夏回族自治区平市白云沈阳街Q座 933408', 1630000000011)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000000, 1508766963, -2166535776743943172, -8241, 42, 2.785578, 579582.453552, 0, 'binary.ManjhxWWPYfMDOZgGgDH', 'nchar.宁夏回族自治区石家庄市永川徐路s座 143325', 1630000000011)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630164999999, 1060176497, 5654208159595485509, 24751, 76, -33188910.345760, 3221.783209, 1, 'binary.cZSBdkTCfHzKdaUbRObM', 'nchar.河南省磊市友好方路y座 897409', 1630000000011)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000000, 497425977, 354065118101195712, 31551, 8, -615489296.966200, -71357728420.250000, 1, 'binary.yxlWGAHHdFrrqtbkxmms', 'nchar.西藏自治区惠州县安次汕尾街f座 271896', 1630000000011)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000001, -1895192712, -4432843295407575817, -20962, -98, -233660222.154913, 56771044.886008, 1, 'binary.CYsQdbzmYnNmadYZeaGH', 'nchar.重庆市阜新县永川惠州街l座 567817', 1630000000012)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000001, -716978435, -3103914421806026937, -21749, -50, 700892864.685490, 48303403313.167900, 1, 'binary.BWgPkqjghxVKeRoXrTZu', 'nchar.广西壮族自治区拉萨县萧山海门路k座 599659', 1630000000012)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630165000000, -1947418103, -2239330846377726020, -32039, -98, 56444198375439.101562, 1600824326231.459961, 0, 'binary.MDSyTDtKwgaMZDQPRBnU', 'nchar.宁夏回族自治区广州市蓟州马鞍山街C座 728186', 1630000000011)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 418330248, -5409102699471857283, -15785, -3, 6935.516881, 35832047684.500603, 0, 'binary.KevLpYjpMOfugEsBCBlm', 'nchar.广东省宜都市蓟州周街Y座 950736', 1630000000012)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 1176493205, 2459630938091775425, -16447, -108, -2248206343057.399902, -6078285.169543, 0, 'binary.hMRUCjOJuPOsbiZnpUAp', 'nchar.台湾省北镇市海港西安街Y座 510871', 1630000000012)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630179999999, 778869650, 849789444462698421, 10597, 31, 7103017.633025, 176806.190116, 1, 'binary.HYiRCyeEqGzFGwoHupCH', 'nchar.上海市杰县安次成都街f座 504387', 1630000000012)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 976603072, 3464432716810727627, 31947, 3, -25689733.219437, 8778.999062, 1, 'binary.oIPQmjoWcexSWGXgBAoz', 'nchar.江苏省丽华县闵行广州路s座 381177', 1630000000012)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000001, -1070149378, -5440223162019446936, -3467, -31, 39057698787674.796875, -90.367916, 1, 'binary.VZKQmmtwMfYTGzlJOyzv', 'nchar.新疆维吾尔自治区丽丽县高坪乌鲁木齐路P座 898975', 1630000000013)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000001, -34074056, -4597641513205145794, -21694, -46, -1647875.388086, 944448733008.215942, 1, 'binary.tJCYGQwLiehXnYdGKEAX', 'nchar.广西壮族自治区巢湖县翔安周街s座 313835', 1630000000013)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630180000000, 1604229550, 1136238301593252013, -13346, 79, 44.613233, -20420040255472.898438, 0, 'binary.dTQiFvIdRuhkakGujxGq', 'nchar.广西壮族自治区冬梅市秀英张路h座 755432', 1630000000012)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630195000000, -1261626278, 8850592003715310781, -3464, -28, -7417877514167.179688, -337072829176.359009, 0, 'binary.DmaGJbQkLmJQaURuaowv', 'nchar.天津市梧州市友好韩路r座 509518', 1630000000013)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000000, 779648104, 7349237640085656137, 6427, -18, -8212845456.626070, -382.979362, 0, 'binary.CTvjwpLAPIpvFzGoTwwo', 'nchar.陕西省雷县房山济南街v座 822721', 1630000000013)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630194999999, 2139522991, 329464564820839576, 24696, 37, 29057737.124244, 207289.798705, 1, 'binary.WgIELLWDqNqWvdsblKCB', 'nchar.新疆维吾尔自治区马鞍山县孝南天津路c座 644425', 1630000000013)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000000, 1838525411, 7428851921488225564, 29432, 50, -682610786103.390015, -10041.651604, 1, 'binary.KxfGzIGCDurNlCmGKYcc', 'nchar.江苏省建军县淄川唐路A座 669136', 1630000000013)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000001, -1450415363, -2829926279480742311, -27438, -88, -9583575812.348600, 273024623.630804, 1, 'binary.THXDnYCLdvuTXRSUsMnH', 'nchar.河北省丽娟县吉区陈街o座 998303', 1630000000014)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000001, -886751600, -2534482963926108103, -10707, -39, -617571391893.729980, -67.220665, 1, 'binary.hTLReGUfQIJXEaSINBnV', 'nchar.河南省海口县涪城古路p座 921643', 1630000000014)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630195000000, 1570287998, -344238082251883349, -7319, 81, 90.287960, 88600160.145757, 0, 'binary.dtVTWjArbQtxafOTUJTM', 'nchar.云南省北镇县丰都张路W座 898660', 1630000000013)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 665794589, 6004756980835485088, 2092, -123, -627.945609, -7528668680465.099609, 0, 'binary.IKfpbOnsEUqZvDUDXwxE', 'nchar.云南省深圳县高明黄街I座 754805', 1630000000014)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 1588394658, -8959712112812621693, 2206, -36, -441691927006.486023, 646726.359195, 0, 'binary.aBvZFciAllhXZWLUFnpr', 'nchar.甘肃省建国县房山李路y座 514187', 1630000000014)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630209999999, 1202083307, 5412703541265854339, 12679, 43, -192710.317268, -669700577.626661, 1, 'binary.jzdrBvoIOBydYtlFDBfZ', 'nchar.吉林省淮安市南湖西安街g座 120691', 1630000000014)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 593595969, 819751030048983732, 20912, 107, 9850514448.774269, -5078164092007.000000, 1, 'binary.bJypQCiflteoujptLzMI', 'nchar.湖北省广州县大东华路Q座 390816', 1630000000014)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000001, -808169724, -297187932768772011, -24985, -112, -407819568.753060, -79910028504558.000000, 1, 'binary.sUZnozuiMlgMQjgaKLWT', 'nchar.辽宁省太原市南湖刘街o座 982705', 1630000000015)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000001, -671630434, -2446424003708709538, -6161, -89, -894616811978.269043, -9662906448.356800, 1, 'binary.xabYsCWCjPMPlKTSVUhg', 'nchar.河北省婷市长寿成都街b座 907850', 1630000000015)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630210000000, 382558478, 5220322206204946702, -11796, -81, 300102736.783901, -1.980706, 0, 'binary.armYvyPdgPaDoNbFvsmU', 'nchar.海南省丹丹市永川戴街g座 757366', 1630000000014)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630225000000, 1556546304, 2632455039606144331, 12588, -78, -9911986.409861, 229879157290.842987, 0, 'binary.GKOAUmTHRsUYNGpJuJXS', 'nchar.西藏自治区浩市龙潭东莞街H座 896444', 1630000000015)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000000, -412103084, 7651422716161914550, -8997, -43, -7588824690.400900, 32094429957.228199, 0, 'binary.vHMehvIzcpBBVNWMluzW', 'nchar.安徽省重庆县朝阳兴城街o座 531109', 1630000000015)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630224999999, 202190259, 6158110401345061186, 25612, 56, 99429428549280.703125, 4845580.749217, 1, 'binary.QFvJnTjavOlzsXAEZVwH', 'nchar.重庆市彬县沈河通辽街r座 998791', 1630000000015)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000000, 1577801807, 7099278354328143832, 21437, 127, 13218371734602.199219, 161023981083.549988, 1, 'binary.wcmkWTSCZNJlHhnahEQx', 'nchar.广东省彬县永川顾路M座 592892', 1630000000015)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000001, -409805763, -6445166879074268180, -22964, -55, -228981.319085, 7949825.592390, 1, 'binary.sbSiqKmjPKvnXbSeKwXG', 'nchar.湖南省沈阳市安次李街u座 919293', 1630000000016)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000001, -1355452771, -6578771374830832013, -11963, -31, 7.979511, -2.355683, 1, 'binary.xkUAxXHQaMRjzWXGozUi', 'nchar.黑龙江省莹县龙潭刘街C座 459661', 1630000000016)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630225000000, 651625961, 351888809599313432, 19819, 10, 7236673390283.780273, -9467952650.400270, 0, 'binary.JHSbZaIRcqbSjVqzeLeL', 'nchar.河北省合肥市清河曹街a座 227339', 1630000000015)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630240000000, -635394652, -8268124534001451281, -4907, 93, -64765076507.232002, 8584607.867581, 0, 'binary.UPKoftKIqXYBGkgijulk', 'nchar.天津市永安县怀柔合山街K座 967698', 1630000000016)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000000, -213770053, 5635964652235949546, 25274, -124, -5.607006, 535.380902, 0, 'binary.wDdznQCwUKDSARatEpet', 'nchar.四川省北京市翔安佛山街I座 729861', 1630000000016)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630239999999, 238657263, 8869424583833435507, 27884, 75, 7565809000.422980, -416084252676.710022, 1, 'binary.OgrrbsocdxzSAsMKmGFW', 'nchar.辽宁省凤英市魏都李路J座 525191', 1630000000016)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000000, 1210124155, 7042734097723621808, 10874, 73, 86.768567, 6463014968.922540, 1, 'binary.oVXdkvYFywXquaOlhtXC', 'nchar.山西省兰州县花溪齐齐哈尔街s座 800225', 1630000000016)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000001, -1447960279, -635780358358789864, -5330, -51, -91432.263672, 2275481108331.560059, 1, 'binary.gMIOOqmPvHzbiBiPEVsv', 'nchar.香港特别行政区波市崇文惠州街C座 328563', 1630000000017)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000001, -1695106558, -3628563110892589597, -22424, -5, 5.150266, -77282937.851303, 1, 'binary.xJkaFVdbXowwlHYQZaUe', 'nchar.安徽省杭州市西峰邯郸路L座 436694', 1630000000017)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630240000000, 413277553, -2335706071365382890, 32108, -32, 4843.206092, 46356442353609.296875, 0, 'binary.CoOYGsXiwrFxtoGItDBS', 'nchar.广东省太原市崇文石家庄街q座 321264', 1630000000016)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1654794184, -8374474014569215734, -31917, -15, -938770678.951200, -6731352698.717200, 0, 'binary.QHlEvczXvDhrjeXKechh', 'nchar.广西壮族自治区杭州市城北合肥街Q座 560934', 1630000000017)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1566108371, -3808480661071967050, -30863, 42, -89576902.121811, 78224.319157, 0, 'binary.coyrtmcCFEMDoUzvhCay', 'nchar.江西省芳市涪城银川街b座 311496', 1630000000017)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630254999999, 954795210, 5603814446969530884, 969, 18, -5490774.644756, 178.908991, 1, 'binary.VOdZRucmuTuXzTGKuWfA', 'nchar.四川省宁县城东李路i座 842257', 1630000000017)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1152370442, 5925336630497472314, 12541, 125, -719570559.985753, -8.257668, 1, 'binary.huKmkwvJTPCAFDoXOBlW', 'nchar.安徽省柳州县安次昆明路i座 788628', 1630000000017)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000001, -185956520, -4103946855252239353, -25507, -108, -7.426104, 4211603.554600, 1, 'binary.LsRcBtiQqicggCLXZoWe', 'nchar.福建省玉华县滨城郭路B座 383017', 1630000000018)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000001, -1921474054, -6233300582184415910, -708, -43, -311807806.567927, -658203860771.300049, 1, 'binary.fZeaeMgVywkMCcqxATSP', 'nchar.陕西省杨市沙市吕路y座 145823', 1630000000018)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630255000000, 1570551972, 3518470870097214499, 31701, 67, -937555.256387, 928225.166342, 0, 'binary.JHXTHKFgRbIHElDZDhBC', 'nchar.云南省娜县合川钟街I座 842962', 1630000000017)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630270000000, 41007230, -53608277352743061, 27336, 106, -147300.927027, -84382353.649139, 0, 'binary.wuOctyBeTsCZynkMWYzu', 'nchar.辽宁省惠州市牧野刘路u座 359412', 1630000000018)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000000, -781808333, 579199728109057365, -6090, 83, 77577783.578131, -3329626275.966800, 0, 'binary.jVblcXbShCimKsOQPpIm', 'nchar.江西省太原市兴山辛集街G座 996182', 1630000000018)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630269999999, 1365142146, 4845996538283657204, 32039, 114, 75890.665555, 5702245.657774, 1, 'binary.EnWxuBUlakKcHrXrPBOj', 'nchar.重庆市荣县锡山蒋街H座 306410', 1630000000018)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000000, 333444667, 7150058468897111437, 14463, 56, 8105784073132.780273, 2424186854.253130, 1, 'binary.hWWfvRLXRhrTBXsFKBhN', 'nchar.海南省广州县长寿贵阳路i座 445153', 1630000000018)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000001, -210822579, -5173305434078560312, -32628, -58, -605574731.487583, 8.466106, 1, 'binary.ZKvMAWaDuBEInoXJgQSL', 'nchar.湖北省玲县清城杨街y座 553175', 1630000000019)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000001, -99120821, -6443231186326613201, -4035, -59, 967868262277.944946, -3544.231286, 1, 'binary.QBaMOSBKnDsAwBeYphtn', 'nchar.澳门特别行政区春梅县黄浦西安路O座 267015', 1630000000019)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630270000000, 1289868664, -3904737247840537443, -9207, 24, 87052030.454020, -5467838.797992, 0, 'binary.QtwNbVNKonvfueApUYkW', 'nchar.海南省强市花溪太原路L座 680108', 1630000000018)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630285000000, 1387304128, 4228361435380026760, -1238, -38, 819.343099, 3269274838.864710, 0, 'binary.QwtMztxuEtuQdccEPSgc', 'nchar.河北省沈阳县沈北新巢湖街F座 514745', 1630000000019)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000000, 1400828058, 7402159199902680827, 4622, -81, 83124160209331.093750, -597482.723308, 0, 'binary.GkCjoKlnQLMdOZQfOaRe', 'nchar.黑龙江省海口市高港北镇路g座 490967', 1630000000019)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630284999999, 952122349, 4226769910009513793, 1618, 46, -82338299659233.500000, -49022614631460.601562, 1, 'binary.lcXghoPWtfUTfSAAJDPS', 'nchar.湖北省巢湖市兴山关街E座 864057', 1630000000019)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000000, 749718159, 3908265828578345378, 4939, 2, -3187143413.393930, -63.396907, 1, 'binary.JgknllAiyOFQYSPvLBrT', 'nchar.广西壮族自治区齐齐哈尔市西峰冉街r座 460995', 1630000000019)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000001, -1152099753, -8078485240322452190, -23406, -63, 7434279511617.269531, -297650111.818850, 1, 'binary.vtvGwZIEcxVUBWDFVniL', 'nchar.香港特别行政区雷县六枝特卫街O座 501711', 1630000000020)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000001, -2025743219, -8360647266536686674, -31408, -127, 3198209717985.200195, -5167244033576.759766, 1, 'binary.EeDihkVVSciCssqEbEgY', 'nchar.湖北省波市高港王街x座 618754', 1630000000020)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630285000000, -651143475, 6089391424113410155, -28724, 72, -6172591503482.719727, 874675419692.713013, 0, 'binary.wAmJChouNetSkLgButdA', 'nchar.内蒙古自治区淑珍县南溪昆明街X座 457011', 1630000000019)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630300000000, -1036308321, 8505935902679868907, -12126, -56, 21041094684126.500000, -31779.452036, 0, 'binary.CHRMHcuiDKIrbquzMWnc', 'nchar.香港特别行政区桂英市徐汇马路y座 894271', 1630000000020)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000000, -1691555741, -2294462358761347751, -1794, -1, -4454607780157.769531, -197045759.620307, 0, 'binary.dciaYPKuPwWmZtbTNqAa', 'nchar.宁夏回族自治区沈阳市普陀李街p座 330494', 1630000000020)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630299999999, 1198995002, 3637649461872145723, 16760, 95, -2.986117, 21825715.342398, 1, 'binary.CobYIOXzviHBQmtndNfY', 'nchar.湖南省合肥市高坪天津街w座 641163', 1630000000020)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000000, 1641081252, 3497467759234706417, 16909, 61, -156530.187860, -60111517262.459099, 1, 'binary.WegyfVyvBuwzQpvVtxrJ', 'nchar.天津市天津县高明汕尾路L座 748705', 1630000000020)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000001, -1498342366, -7248641586651479050, -14472, -49, -8.737031, -916375489.622606, 1, 'binary.qfSLXCSfQexiQHdraTYY', 'nchar.海南省凤兰市普陀王街a座 920512', 1630000000021)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000001, -1529997535, -3950829483875051901, -14962, -125, 2566536996.957260, 46289841809.267998, 1, 'binary.xcQvVjJSZRlsYkqJLaqC', 'nchar.黑龙江省济南市永川苏街u座 855053', 1630000000021)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630300000000, 66936834, 6231741803696417438, -26509, 116, -36723525869968.101562, -140577503982.942993, 0, 'binary.JuGZrZpqrsboVygUyAtd', 'nchar.台湾省汕尾县萧山巢湖路n座 479255', 1630000000020)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630315000000, -1768408453, 3912858851624378906, -8457, 115, 63.229176, -5678913267191.299805, 0, 'binary.OaHLnnqkcUEKxOOHCYCJ', 'nchar.甘肃省济南县高明李街w座 328341', 1630000000021)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000000, -1676018488, 5929581737688896192, 587, 50, 8974753.896018, 9867720208144.640625, 0, 'binary.kPHIzCFGzzXfjYJPRBPj', 'nchar.广西壮族自治区齐齐哈尔县滨城杜路G座 832544', 1630000000021)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630314999999, 388708472, 3484566086576549522, 24020, 101, -3436412657.609220, 1.526276, 1, 'binary.VWdcyMxbxjRZCcDesjWH', 'nchar.重庆市娜县清浦周路Q座 318835', 1630000000021)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000000, 1742645526, 7447737287016433535, 11601, 102, 205650774.133360, -718740206925.855957, 1, 'binary.pLVCvWZQFPGWrURwfLcX', 'nchar.湖北省辽阳县静安李路s座 669158', 1630000000021)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000001, -1688761021, -3633609441651034972, -32192, -45, -6589.308664, -96579.525261, 1, 'binary.fsNWygGviERgbHDCTNoU', 'nchar.湖南省合肥市清河马鞍山路g座 155575', 1630000000022)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000001, -1972942235, -7595572329950088744, -21058, -64, -652542.999844, -6645809.678817, 1, 'binary.HeHuMgTlvUMAUlpdnygc', 'nchar.西藏自治区郑州县白云东莞路J座 860659', 1630000000022)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630315000000, 34583826, -5677401721211288846, 5759, 4, -922.875171, 41207973.369290, 0, 'binary.FgvACcdWyWjXDQzboRVN', 'nchar.山西省台北市南湖北镇路X座 676913', 1630000000021)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 125729034, 5772587033883405659, 31451, 115, 1579351734.492360, 83475.538080, 0, 'binary.YAKBKrKRqlgNweLacnpB', 'nchar.青海省秀华市合川刘街r座 962617', 1630000000022)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 1327440015, 5359031926120752338, 13595, -7, -143.262728, -8.120978, 0, 'binary.VJYIDxwcizIsqjyjvTpO', 'nchar.北京市柳县清河淮安路q座 744491', 1630000000022)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630329999999, 1046617386, 1012222098325008150, 22053, 93, 45723435049.348999, -4738289642.121180, 1, 'binary.OmMMfoOWmDphnVXsqVny', 'nchar.澳门特别行政区建华县永川郭路W座 929334', 1630000000022)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 1996072991, 2291923905975087108, 25734, 49, -988.744553, 891307.838533, 1, 'binary.RIMwMykwFAdjljWnLgTu', 'nchar.天津市重庆县沙市西宁路T座 441908', 1630000000022)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000001, -509016842, -8755338571881630470, -16764, -101, 54206022913.869003, -38597163884.896202, 1, 'binary.miOrdOLIjNjowuqZLMJY', 'nchar.河北省福州县牧野西安街K座 544169', 1630000000023)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000001, -1043050284, -4065479627331509328, -30284, -44, -7442000934306.809570, 8404611937.272200, 1, 'binary.FYEOsVKepLPcPqRAMtQf', 'nchar.江苏省凤英市门头沟莫路D座 821625', 1630000000023)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630330000000, 1336266375, -3748199673349739489, -14794, -38, -98329032120.339996, 4354904615.450910, 0, 'binary.byOStgFhklLTIvsltIZw', 'nchar.甘肃省丽娟市安次哈尔滨路m座 552966', 1630000000022)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630345000000, -125236222, -7443235125783230646, -4372, -51, -2592298452.864900, -1806314197.669880, 0, 'binary.UJkpaKsbERScbXdQuhvo', 'nchar.宁夏回族自治区柳州县锡山赵街f座 139786', 1630000000023)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000000, -219965012, -4716987119042513689, 24416, -100, -3747315428739.759766, 0.494564, 0, 'binary.NOTNVTroRkOsLgVdkLoJ', 'nchar.重庆市娟县江北哈尔滨街w座 338249', 1630000000023)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630344999999, 1470657859, 2320764016731890530, 27688, 116, 12160748.177215, 83545.714436, 1, 'binary.QLjYhzfGDKcPmHFQjBub', 'nchar.安徽省婷市白云惠州街i座 922795', 1630000000023)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000000, 1908975565, 3788319142030902566, 28513, 73, -810951288254.207031, 704115304293.949951, 1, 'binary.WHaxQQMLidfdINYOwQiY', 'nchar.安徽省淑兰县萧山重庆街W座 385558', 1630000000023)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000001, -720454315, -3301539443338809381, -23269, -40, -354.491111, 9.482702, 1, 'binary.GaEJJOwaHtRTijYNSKrt', 'nchar.香港特别行政区玲县龙潭南宁街R座 455543', 1630000000024)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000001, -1952988609, -8224270172957627373, -12805, -23, -39.405009, 9889.998342, 1, 'binary.nnoIletebLWbHwpqrpjQ', 'nchar.陕西省深圳市长寿兴城路L座 522359', 1630000000024)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630345000000, -523958452, 2997994281167364719, 22138, 13, 8.626707, -2801928136.443440, 0, 'binary.yqSdjVqJlmWCSBRuPeAS', 'nchar.甘肃省惠州县和平田路N座 869008', 1630000000023)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630360000000, -677274672, -7849607379954530156, -24205, 84, -971756295956.161011, -13922706678085.400391, 0, 'binary.jwdoZKFVRIbdNbxvzglZ', 'nchar.北京市帅县金平沈路L座 955700', 1630000000024)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000000, 1246868406, 8440235059780981684, 17929, -72, -179883228781.260010, 74775.726422, 0, 'binary.AdgnDiCLdBHvjVsUEUlA', 'nchar.福建省张家港市怀柔唐街k座 206637', 1630000000024)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630359999999, 1874112564, 2471561821001658734, 21353, 86, 60186670.967332, 977025.978653, 1, 'binary.tNjvCgdWlmcOHVbLJRMN', 'nchar.福建省太原市闵行郑路j座 374763', 1630000000024)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000000, 1286025365, 9197590639676784477, 7479, 117, -78306895.453520, 16133.105382, 1, 'binary.oyzmHpPVRNdmGjSWoOye', 'nchar.安徽省佳县清河高路t座 131773', 1630000000024)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000001, -805620343, -9199526400762315204, -32703, -90, 255348664.922541, 1.265149, 1, 'binary.rMWNLTrygVpKqbvfAPEQ', 'nchar.西藏自治区大冶县沈河马路x座 692129', 1630000000025)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000001, -1016979209, -233992014932124431, -3372, -83, 1155.736906, 74.581949, 1, 'binary.wfBaavnTeXgzocUDpJkd', 'nchar.青海省兰英县南溪梁街d座 749974', 1630000000025)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630360000000, 1965870107, -2918841171553952995, -22593, -23, 8305333945954.679688, -3905.740237, 0, 'binary.WijQcImFTfQfgOAyFVuR', 'nchar.贵州省兰英市沙湾广州街R座 380656', 1630000000024)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 1859005003, 1104214274917305717, 10798, 94, 850723.403288, -2.625752, 0, 'binary.uDiGDbJBCeWVuQCYGwQU', 'nchar.江西省海燕县西夏天津街h座 925745', 1630000000025)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 249965459, 4153812250107690762, 8690, -85, -2.375649, -7556996798575.759766, 0, 'binary.OsRPmbVqrwwmstYOvsFp', 'nchar.宁夏回族自治区丹丹市淄川梧州路M座 486374', 1630000000025)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630374999999, 1624260248, 7015806862250068758, 4350, 97, 5194046419.133550, -8059822602.437020, 1, 'binary.OMehRclQHcJBTynDoScY', 'nchar.江苏省兴安盟县长寿拉萨街L座 799456', 1630000000025)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 396319016, 1703630598675774845, 15206, 66, 82212219.419588, -694808505327.339966, 1, 'binary.ThuTfsNgNgkwqdluGnzy', 'nchar.新疆维吾尔自治区重庆市东丽天津街U座 711659', 1630000000025)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000001, -321755377, -7381963169677430909, -17059, -104, -50669392403.276001, 24555.641531, 1, 'binary.pYwaFBbMgRmreHVLLqHM', 'nchar.吉林省关岭县西峰王街A座 128393', 1630000000026)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000001, -3112247, -2326747004845963522, -32753, -15, -6.479060, -4.885868, 1, 'binary.nyUKFiEfATIOqiQYTGYd', 'nchar.北京市深圳市海陵邓街w座 923149', 1630000000026)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630375000000, 1848873864, -1425149577411932526, -15441, -97, 53983878.838902, 7.604429, 0, 'binary.AebpWwYtnpvpbQojcptM', 'nchar.福建省勇县大东董街D座 925934', 1630000000025)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630390000000, 620402706, -2092872879669844684, 22721, -99, -3.578269, 9.904233, 0, 'binary.kcxyJbYKMUthZCemDZwN', 'nchar.天津市淑英县淄川陶路n座 983382', 1630000000026)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000000, 1424324822, -5344921050768394808, -9933, -104, -579352179419.427002, -8535712823374.900391, 0, 'binary.iQVkXSwNBowzrsOuetLF', 'nchar.辽宁省兰州市蓟州长春路b座 767058', 1630000000026)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630389999999, 1338486910, 5553939443389037108, 7465, 21, 57919539684.215698, -1133897.445424, 1, 'binary.PewhoryOLSZsZOExXrsO', 'nchar.云南省东莞县秀英六盘水街f座 870761', 1630000000026)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000000, 1377263295, 2287159705001305018, 23692, 108, 839604115054.706055, 4528078.990663, 1, 'binary.NQMLbBaxRGpfdrcfKtci', 'nchar.广东省龙市魏都呼和浩特街X座 339810', 1630000000026)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000001, -1972396465, -2625500637464979513, -26565, -22, -441.336819, 4228263266694.529785, 1, 'binary.HCciTUVnuKaUQHOTLmoy', 'nchar.福建省潜江县长寿张街i座 756207', 1630000000027)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000001, -1919101583, -1025584328134825800, -12869, -73, 82107948133.142197, 8170338838.340360, 1, 'binary.SdhXWDcuORDtQtHNqinV', 'nchar.山东省淑珍县龙潭王街u座 917673', 1630000000027)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630390000000, -342515504, -850995699758580491, -27592, -104, 9983310041114.599609, -3552213.522875, 0, 'binary.mrZLEcTnUkwltOKwWmMG', 'nchar.陕西省六安县东城汪路a座 741921', 1630000000026)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630405000000, -697189031, -5174916001528455052, -18768, 31, 889278993.213705, -4519776483.921300, 0, 'binary.mjvvuLgBZRyYZvSnmrpW', 'nchar.广东省北京县淄川哈尔滨街k座 473589', 1630000000027)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000000, 1399897758, -5070718027080576434, -28441, 81, -6464798967823.299805, 64.959990, 0, 'binary.auzkgdvXEbwhZrzOnCgY', 'nchar.四川省岩市西峰兴安盟街L座 261109', 1630000000027)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630404999999, 586219277, 5261527665322286803, 15053, 17, -7473982.479707, 53758410580.825996, 1, 'binary.ejuJVeKrOYTBIOGtnvwN', 'nchar.黑龙江省英县璧山袁街c座 834323', 1630000000027)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000000, 2069647643, 8085374297895048889, 25867, 38, -9114097802.719160, -511.311795, 1, 'binary.hyODFAlyNDYzGBrgfzQx', 'nchar.河北省荆门市高明蒋路p座 794155', 1630000000027)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000001, -23773554, -991944997406075040, -17827, -70, -817975598.936861, -59647871.118851, 1, 'binary.HMzLCwXDnCBrSjyvRiij', 'nchar.四川省梅县牧野乌鲁木齐街u座 768713', 1630000000028)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000001, -777805682, -6317678604532276560, -15689, -38, -900453816.555716, 384.378368, 1, 'binary.QygspByIGreKmSuckTRN', 'nchar.新疆维吾尔自治区莉县永川巢湖街H座 128070', 1630000000028)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630405000000, 254749120, 1622387876144097468, 8950, 5, -81.624948, -24.366419, 0, 'binary.prUIqqWJFRMgzMaUTmax', 'nchar.新疆维吾尔自治区惠州县长寿南京路y座 661755', 1630000000027)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630420000000, -1223538957, 2286130958857879860, 13823, 69, 40014883538.375099, -65188739203798.500000, 0, 'binary.YhGtRmitXcCooBPlNxlh', 'nchar.北京市西安县兴山罗街c座 992434', 1630000000028)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000000, 1037952556, -1750883376714996603, 24124, 25, -182.347721, 547.995492, 0, 'binary.JYQaxIMJeszunPLADRsN', 'nchar.青海省玉珍县大东黄街N座 831217', 1630000000028)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630419999999, 403592186, 7560013542016462366, 168, 55, 9517875.498748, 352.106624, 1, 'binary.KbgXOhPmkagxFsFbQakf', 'nchar.澳门特别行政区郑州县沙市长沙路s座 614203', 1630000000028)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000000, 1368705327, 8252423483843671206, 16131, 92, -5515498174334.660156, -3.888975, 1, 'binary.MIPrismzSjiOFMNueQYp', 'nchar.福建省昆明县高港巢湖街t座 950444', 1630000000028)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000001, -1017841441, -1591486103588407573, -17251, -3, -2188221503680.879883, -926521.314582, 1, 'binary.BONmREpjVojUyNnkKVDr', 'nchar.辽宁省北京市浔阳潮州路g座 945777', 1630000000029)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000001, -1833376251, -9184585089936473286, -3917, -99, -92896209472.994095, -1.820004, 1, 'binary.PVpVjMOTKQwOyrnumWdy', 'nchar.北京市淮安市孝南潘街L座 593813', 1630000000029)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630420000000, 1948244273, -196734016981898350, -12592, 74, 572284.494489, 2864954.350333, 0, 'binary.hfQUVCcsvQaXPEtLGHpD', 'nchar.甘肃省想市翔安通辽街N座 611877', 1630000000028)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630435000000, -838875167, -1361899531005372465, 29323, 99, -1007837437.160790, 3992.134409, 0, 'binary.AXEKjEPNWZzTiqwFpkrg', 'nchar.宁夏回族自治区郑州市徐汇沈阳街X座 928833', 1630000000029)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000000, 1388029674, -546879967630233611, 2763, -36, 672919.301731, -18885480.555128, 0, 'binary.wxQQJhYFoSSMpDGXpiTJ', 'nchar.河北省波县沙市喻路d座 714578', 1630000000029)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630434999999, 2123582595, 7410514965760337418, 2706, 2, 62014125.916508, 2008325132.990800, 1, 'binary.JqrmmSVJyyJSphzDfdfF', 'nchar.浙江省浩市怀柔郑路c座 136184', 1630000000029)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000000, 1201222250, 7502546531668208416, 9700, 30, 71831491844532.593750, -589.390815, 1, 'binary.QjDXDUKqRtDbRoKaLzPh', 'nchar.重庆市玉梅市高坪大冶街Y座 589155', 1630000000029)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000001, -541998051, -1627876155987640389, -18145, -31, -566248120966.409058, 4.742559, 1, 'binary.DAHIBWzujRgGmXHITFdP', 'nchar.宁夏回族自治区博市高坪嘉禾街w座 519572', 1630000000030)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000001, -546978867, -2173360923517013860, -19473, -44, 59.410448, 5922.830565, 1, 'binary.RSrVhjmSLyoKdKZvXTIz', 'nchar.福建省海口县金平东莞街o座 455086', 1630000000030)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630435000000, -439057091, 8924713488149522354, 7802, 47, 48376534665906.500000, 45445.194835, 0, 'binary.ZDMaZnUxfgdroXGRliPY', 'nchar.吉林省建市沈河范路n座 318872', 1630000000029)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630450000000, -765134201, 347278210407306547, -999, 101, -9542079.208161, 81311055.831151, 0, 'binary.uytkzHZmorAgiDiISVoG', 'nchar.台湾省潜江县沈河罗街d座 335953', 1630000000030)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000000, -883583883, 8388741643434251423, -15135, -94, -68313.913298, -35.800171, 0, 'binary.tzspsEtclAyEBtTUGUVb', 'nchar.安徽省辛集县花溪周路x座 919405', 1630000000030)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630449999999, 863783720, 5196197078377636765, 15104, 13, 51450224872520.898438, 725329.992278, 1, 'binary.iZrgQLIwNNvEhiErAwkt', 'nchar.海南省宇县静安朱街Q座 212815', 1630000000030)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000000, 1599585284, 3659927052268251378, 27540, 113, 426035.852478, -9384.374028, 1, 'binary.yjEiWqUVlFokNWyaFBDd', 'nchar.贵州省海门县上街周路L座 539708', 1630000000030)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000001, -1507574370, -2553743849779578949, -26885, -73, -54390935620.480400, -8539853135856.200195, 1, 'binary.nVGhmvtMlkPpeaBpAFTM', 'nchar.宁夏回族自治区马鞍山市萧山潘路A座 970545', 1630000000031)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000001, -961124591, -9073578603354545587, -23272, -29, 425584796.348519, 190947665.184546, 1, 'binary.kXxbQgCutjoylguhQAdl', 'nchar.天津市旭县房山屈路c座 773300', 1630000000031)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630450000000, -1705974843, -2143380587844176814, -21730, 59, 5199526189.259490, 7705938.503009, 0, 'binary.bxSiEDFvjRcoPXYDTYCh', 'nchar.福建省淮安市和平赵街l座 610790', 1630000000030)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630465000000, -314548498, -5935072584738796094, -27392, -1, -274339.402115, 3511.621351, 0, 'binary.zPUYZbaXGMPJOywgECDZ', 'nchar.福建省兴安盟市上街昆明路j座 373799', 1630000000031)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000000, 1966145764, 6102444836691824974, -10115, -19, -5651247.555394, -57863153091.628502, 0, 'binary.ZrFDxoPexxwNZrlMQtvg', 'nchar.西藏自治区凯市长寿邯郸街i座 464310', 1630000000031)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630464999999, 1652311395, 2469620212179292220, 8776, 21, -3689.666358, 7851383246.205440, 1, 'binary.GFGXaNXjaQWBuiuIuflv', 'nchar.台湾省荆门市淄川永安街A座 461064', 1630000000031)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000000, 1692550978, 7365080219522096539, 27515, 70, -99952861.539751, 339330736.780068, 1, 'binary.bJznaiQdbEjfsGYBWcoX', 'nchar.新疆维吾尔自治区红梅市上街合肥街V座 387140', 1630000000031)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000001, -881848122, -3511404188725458925, -17230, -50, 6717458.476512, -951.668912, 1, 'binary.WKsWUZoBjTlKVGgAJxPx', 'nchar.青海省云县涪城永安街T座 147122', 1630000000032)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000001, -1473523142, -4395305224463915000, -3855, -100, 72183.581727, 7932375.897433, 1, 'binary.qNxynPRwuwQrqgyuePBu', 'nchar.安徽省沈阳市双滦张街V座 833089', 1630000000032)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630465000000, -158748589, 6425132610953044127, 18824, 57, -78085392.809785, -521675448.839484, 0, 'binary.TkNybjkEeqjVoGZKWfiU', 'nchar.河南省林县安次陈路l座 523653', 1630000000031)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630480000000, 780205345, -3394022500515803762, -8656, 59, 4353205.758237, 6894995444848.599609, 0, 'binary.dyNGyigdTXCBLJSGKHrJ', 'nchar.天津市秀梅县城北夏街Q座 373284', 1630000000032)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000000, 1285010274, 6775476870679767416, -30268, -78, 2376719.820365, -102060.306247, 0, 'binary.gEkadxughuSyhxVlowaj', 'nchar.甘肃省广州县淄川张路u座 694715', 1630000000032)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630479999999, 133942525, 4687491610368814212, 2473, 123, 74.707449, -37825106590154.500000, 1, 'binary.jFkkgXUPSCrZnMUmiDca', 'nchar.江西省海燕市怀柔辽阳街T座 593401', 1630000000032)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000000, 1198452303, 2827497746106779583, 15755, 3, -96312992172.283997, -7583.330552, 1, 'binary.OuAJuifTLwDmabcKuPpO', 'nchar.陕西省欢县永川李路U座 124763', 1630000000032)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000001, -1161482672, -642941094008198244, -13538, -101, -4415177912288.160156, 57577.407295, 1, 'binary.TMzTATElhmlhyqFvwFKJ', 'nchar.江西省红霞市城东车路h座 867833', 1630000000033)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000001, -2145746929, -2828855748044877841, -24180, -68, 3002911.812991, -5.963978, 1, 'binary.IOKXhDrLSveyxAAZcVVV', 'nchar.山东省桂芝市东城长春街f座 739636', 1630000000033)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630480000000, -2128865070, -3361908133638881363, -7698, -124, -2810320306.295400, 42424.469553, 0, 'binary.pRTQbYdbdqTUGzTBJjwW', 'nchar.四川省平县和平刘街G座 530429', 1630000000032)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630495000000, -179608812, -2830103688811366966, 17973, -6, -98267364621.484100, -34541396619.394699, 0, 'binary.VMzHtbnrmjokPDZCMXsk', 'nchar.广西壮族自治区永安市魏都海口街Y座 538635', 1630000000033)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000000, 17975727, -9147014879010075409, -29070, 11, 6629237.824116, -644456283208.812988, 0, 'binary.qxIcDfHdizkemidhxBOX', 'nchar.四川省金凤县魏都朱路Y座 167401', 1630000000033)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630494999999, 1748308690, 5607449654092965535, 32130, 79, 662142.922850, -4208712290.375350, 1, 'binary.bsqrWOhUgZliFzqtMCyZ', 'nchar.北京市兴安盟县门头沟夏街W座 853138', 1630000000033)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000000, 292621133, 8029177555041414497, 32719, 52, 9.459390, -85.260795, 1, 'binary.SptfDQZmkxZwzQDPUgly', 'nchar.山西省玉市白云合山街d座 653433', 1630000000033)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000001, -45395742, -3417033390164130042, -31766, -93, -22336078027069.101562, 68135086530908.703125, 1, 'binary.SEnorgonMIgtUKkNTOxP', 'nchar.澳门特别行政区永安县合川吴路W座 144142', 1630000000034)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000001, -1446286464, -2834239883196880371, -9824, -122, 515950931167.439026, 3301610613616.100098, 1, 'binary.pwZptdrFvhLwFfJFLqQh', 'nchar.浙江省桂荣县龙潭徐路e座 191807', 1630000000034)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630495000000, 147020729, 3276148986164408557, 21995, -8, -669813.120570, -66.191763, 0, 'binary.CDlhPrXllKDbKnpPbQCR', 'nchar.江西省桂香市大兴太原路v座 117465', 1630000000033)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630510000000, -138813503, 6315166587841671464, 1355, 40, 9602.262694, 861862121.594895, 0, 'binary.cvjJVfNMFXXyaKDjkvRu', 'nchar.山西省淮安县静安刘路E座 917860', 1630000000034)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000000, -1499926587, -5494769986822553194, -7513, -59, 20.566688, 164110090.400241, 0, 'binary.ncYYeVQupIbKXmfuwZoJ', 'nchar.浙江省昆明市滨城深圳街C座 408704', 1630000000034)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630509999999, 59717021, 5309467270318718403, 20281, 80, -690547726621.959961, -279234186984.130005, 1, 'binary.XBJIPnZODnweOOXmzRkO', 'nchar.重庆市南京市滨城罗街R座 920733', 1630000000034)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000000, 965932797, 2618901242071795537, 19035, 60, 88667158.776933, 57.714218, 1, 'binary.vPKtTfrDyvkwPapGKBHC', 'nchar.重庆市阳县高坪张路e座 430297', 1630000000034)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000001, -369410792, -8341233851372213560, -21268, -53, -68353.245312, 680.211243, 1, 'binary.HBmqhBQjhNYwAaLJWbpE', 'nchar.新疆维吾尔自治区坤市蓟州曾路Y座 389605', 1630000000035)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000001, -290124344, -5005783105138836089, -31038, -99, -4125833987.987010, -61865.560889, 1, 'binary.msJuffjbXNohLzDghECt', 'nchar.吉林省辽阳县淄川廖路y座 592416', 1630000000035)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630510000000, 1554805513, 5103394770308878784, -20138, -118, -158087627.334212, -54553.318555, 0, 'binary.QAiiKHDGWEvrjERhDojf', 'nchar.江苏省柳州县江北潜江街R座 415694', 1630000000034)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630525000000, -319429462, 2783408640725418994, -12995, 109, 8059.171767, 34270137051.186001, 0, 'binary.INFGvqMFdDTmdeFePZnQ', 'nchar.青海省南宁市璧山欧街K座 723228', 1630000000035)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000000, -2053704222, -387584738711581594, -28738, 100, 321.108570, 174292.288484, 0, 'binary.JEULkwBGXQMTtcrRCcru', 'nchar.重庆市南昌市东丽大冶路r座 919184', 1630000000035)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630524999999, 1042899672, 525664086008023453, 18210, 36, -992.375585, 67404918237736.601562, 1, 'binary.SyRZdWnAthyOUqpOtOos', 'nchar.内蒙古自治区辛集县华龙武汉街U座 797248', 1630000000035)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000000, 210832777, 8293861208931311807, 3500, 77, -4.291887, 8353937865.544660, 1, 'binary.JNasTUjHeTYxMpjwHQwp', 'nchar.黑龙江省济南市孝南广州路u座 818270', 1630000000035)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000001, -1784712756, -1900282826185833888, -12635, -10, -147742335517.860992, 1892142041.165020, 1, 'binary.FsBnuFMAwIdTjEjYkjBR', 'nchar.天津市丹丹市双滦马鞍山路L座 954700', 1630000000036)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000001, -1963762926, -3093406333417399437, -28946, -93, -361883.201813, -7970832707874.200195, 1, 'binary.AzpaKlaPZcHBJgfiMusA', 'nchar.台湾省桂香市兴山罗街I座 411116', 1630000000036)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630525000000, -1594406401, 2911814076154398648, 1593, -40, 94252.505169, -57.127701, 0, 'binary.UieVjNVQaDaURDdvbVxx', 'nchar.河南省建华市锡山马鞍山街d座 922365', 1630000000035)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630540000000, -298407008, -890073803487483026, 19138, 22, -13371145012.763000, 787260475.918045, 0, 'binary.ligoRoVSAHzFhUvIDwlE', 'nchar.上海市淑兰市锡山周街z座 377582', 1630000000036)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000000, 1742761629, -3538927150920177969, -26178, -17, -60236333852265.898438, -8776.586953, 0, 'binary.RxvCthLQrpgveOwWJJfo', 'nchar.辽宁省长沙市淄川石路J座 923025', 1630000000036)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630539999999, 656087591, 7671013800748633383, 21136, 114, -9294.519104, 4829386792163.620117, 1, 'binary.vsIjUPiZNVxiFWHzGqkg', 'nchar.湖南省石家庄县城东杨街b座 396607', 1630000000036)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000000, 1908331659, 2529406409884626842, 19478, 70, 33286729894380.898438, -3.973702, 1, 'binary.owpOIRLxxXjudcaMtZsk', 'nchar.重庆市彬县金平牛路B座 110982', 1630000000036)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000001, -70790307, -4087110708810857496, -6014, -118, -605686122.372439, 26511865.401597, 1, 'binary.GLAJYWukLZueieYRsidQ', 'nchar.湖北省峰县牧野辽阳路N座 528796', 1630000000037)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000001, -375748080, -5402179642725069125, -17546, -56, 333.228050, -8211802092271.910156, 1, 'binary.yhkrusrZjfABOqNjyutJ', 'nchar.河南省济南县长寿刘路V座 435013', 1630000000037)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630540000000, 1483404105, -1062308720694573985, 21132, 127, -3034420855288.169922, -4783009296713.500000, 0, 'binary.pkmpVTKNUbqmEYaWIxNI', 'nchar.吉林省石家庄市六枝特张路z座 262916', 1630000000036)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630555000000, 632563376, -2204241930370454289, 20442, -66, 68778435235.149796, 41338715505.798897, 0, 'binary.RsQnCVXQtzoeXuamUiBl', 'nchar.吉林省洁县永川香港街V座 762000', 1630000000037)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000000, -472397946, 1038938837241211981, -29204, 47, 3047173131.130830, 9172947943.508301, 0, 'binary.gSxMxJFnpWRALREpkZUQ', 'nchar.云南省辽阳市六枝特汕尾路m座 376809', 1630000000037)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630554999999, 396390446, 1620566595591926682, 11031, 85, -9305855762.999241, 1578928.160116, 1, 'binary.pgBGZOKYSliCxHFmGsyp', 'nchar.浙江省军市清浦许路C座 950185', 1630000000037)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000000, 1237088867, 9126129724607826846, 23721, 97, 147.865610, 55260948679.278999, 1, 'binary.EygLnzSPKfjPvserwjwg', 'nchar.青海省济南县普陀太原路P座 240312', 1630000000037)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000001, -1965530504, -871830532885341515, -23233, -76, -3.827964, 9.798035, 1, 'binary.ECLVeNvkmqcTHEoSSxYT', 'nchar.西藏自治区北京市长寿昆明路X座 708472', 1630000000038)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000001, -1484513338, -792998805013840059, -31538, -71, -8141323055.196050, -7510534665057.400391, 1, 'binary.jmfqESFcasFwykqiXlqj', 'nchar.贵州省重庆市吉区张家港路m座 856450', 1630000000038)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630555000000, 1069828446, 6908596510608104575, 28783, 110, -9162083944.840309, -102.142752, 0, 'binary.gkjpRGJEiQVghWoJbwzo', 'nchar.安徽省潜江县魏都李街r座 766818', 1630000000037)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630570000000, 446510409, -3656476974551396976, 13256, -104, 8171493376646.099609, -530097963872.411987, 0, 'binary.FEewTpfZgngFmPSTSvxJ', 'nchar.内蒙古自治区建华市锡山哈尔滨路U座 278315', 1630000000038)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000000, 1541307361, 3859916508801896099, 21134, 123, -1454095130.880070, -793.944907, 0, 'binary.vUtaMtwXoWgIARQjnHHj', 'nchar.广东省秀华县东丽天津街f座 273761', 1630000000038)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630569999999, 554982384, 4634928837125592948, 23064, 110, -16387837.580834, 67731033.476346, 1, 'binary.zpGkiHSJABZuoZlpNXMp', 'nchar.四川省晶县龙潭太原街d座 373693', 1630000000038)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000000, 1650730478, 2509551581387664974, 17823, 0, -810284073.820230, 9519108910338.419922, 1, 'binary.MykLktVEEpwPHBiBMoqk', 'nchar.山西省峰市门头沟香港路j座 412357', 1630000000038)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000001, -2032946157, -7551742451999725958, -11549, -110, 548121030.233320, 8537.353780, 1, 'binary.lyLVozekCioDlqntmATw', 'nchar.青海省太原市江北宁德街J座 782858', 1630000000039)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000001, -563992071, -3064141540636515026, -15744, -120, -430754463567.528015, -3116194745462.259766, 1, 'binary.sHiKXDptOBQSALxyVOWj', 'nchar.湖南省玉兰市龙潭大冶街I座 537334', 1630000000039)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630570000000, -2129764760, -4193554531789104653, -23767, 118, 93.790612, 786694048079.288940, 0, 'binary.WQewsnemfqUAFHeLJnXF', 'nchar.新疆维吾尔自治区东市滨城王街s座 713240', 1630000000038)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630585000000, 640199308, -5655660832137064380, -11147, 77, 16876033.858953, -7485.569430, 0, 'binary.bRHphFiZkeWtyDjXqNaO', 'nchar.天津市杨县高坪梁街B座 525434', 1630000000039)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000000, -1686982965, -8299508680322272166, 3619, -126, -64849.198682, -9337.273192, 0, 'binary.IGNxucSArjxWEALkrQRY', 'nchar.安徽省淑兰县城北齐齐哈尔街P座 697435', 1630000000039)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630584999999, 677947760, 1314864805338112674, 15237, 86, -929824456656.410034, -85.764381, 1, 'binary.vfXYvrHXFnDSAHwCndcp', 'nchar.青海省建华县花溪柳州街T座 100213', 1630000000039)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000000, 307125580, 5094829418785488158, 19844, 2, -54041115.787217, 6.233947, 1, 'binary.nAMUcXLvZLCQRHFwNvkT', 'nchar.广东省淑华市上街天津路S座 813901', 1630000000039)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000001, -494862894, -4253955294640876951, -19423, -20, -37835740177817.796875, 51554911990.855003, 1, 'binary.zffLjgnXcDlwdKAxADMr', 'nchar.河北省玉珍县西峰刁路C座 452461', 1630000000040)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000001, -437854754, -8916960191048231333, -6475, -87, 422259.957474, 81115866.296574, 1, 'binary.NlfhDIBFmzxTiVSybgon', 'nchar.新疆维吾尔自治区石家庄县高港大冶街f座 940073', 1630000000040)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630585000000, 895715893, 6676915082558096536, -2843, 80, 3019829720.850890, 45890083973973.703125, 0, 'binary.YtrhJOiBzFYUzUxxGHcB', 'nchar.河北省桂英县海陵重庆路X座 577152', 1630000000039)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630600000000, 790711145, -5535878799111175644, 24130, 71, -864521126.754360, -5257536.250149, 0, 'binary.uCOCqMGewUkNeUhAbNNf', 'nchar.上海市澳门县大兴海门路k座 319118', 1630000000040)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000000, -1515729891, 6489509016449838006, -19281, 68, -75090633218986.296875, 43026646570.672997, 0, 'binary.zhgeUDYkrfqFOzepcyTJ', 'nchar.北京市北京市南长拉萨街H座 770300', 1630000000040)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630599999999, 1558178384, 7355756171678259138, 18244, 101, -2195442510.130770, -623135577.309077, 1, 'binary.bKLXWDPaBjWRXgOeesiD', 'nchar.江苏省红市长寿贵阳路T座 962883', 1630000000040)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000000, 1292528970, 2464957048738107533, 21085, 23, -97350629.653519, 97632.613057, 1, 'binary.QhAZodfGPuZBebCyHSme', 'nchar.澳门特别行政区建平县山亭邯郸街x座 185831', 1630000000040)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000001, -475557451, -6826045973586477294, -7961, -56, 1705823848847.199951, -268959384930.907990, 1, 'binary.wnZulRregqgognSRRYWI', 'nchar.陕西省桂兰市孝南太原路b座 604090', 1630000000041)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000001, -1662397849, -6337230624292122601, -10537, -31, -7225617.287194, 9.181853, 1, 'binary.dIBenysHkntfJuvBkgWK', 'nchar.安徽省海口县闵行六安街S座 630253', 1630000000041)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630600000000, 485553847, 7808570548913367950, -25532, 111, 1267936395.925200, 965.329639, 0, 'binary.uUkJRhVNdIFbCCKdSxNu', 'nchar.云南省六盘水市沈河黄街r座 670992', 1630000000040)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630615000000, 1664157316, -3375551224102004419, 200, 88, -745584775385.793945, -699.239448, 0, 'binary.AyZCLhYiMxZgfYXlVciw', 'nchar.吉林省六盘水市清浦贺路O座 851729', 1630000000041)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000000, -1198323418, 1449001209366933334, -29356, 113, 970.596178, -8258648600.433700, 0, 'binary.wnEzpmjBgvHDFbCHrxCx', 'nchar.辽宁省淮安市沈北新拉萨街Q座 858646', 1630000000041)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630614999999, 632223220, 7440877353040054077, 26302, 94, -9662701.768525, -9843725.667981, 1, 'binary.JqnabMfPCrzsTaYczTLh', 'nchar.山西省玉市孝南李路i座 331687', 1630000000041)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000000, 1054653217, 644785387636789462, 23531, 71, -8451351.603558, -83219909153.306000, 1, 'binary.IPnIZyUyPMYVVcGjGYqM', 'nchar.香港特别行政区济南市秀英巫路v座 383455', 1630000000041)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000001, -951785691, -4025456465792961539, -30955, -57, 74739.936019, 23857138186877.699219, 1, 'binary.sKKfLrkShxlGFGromDFZ', 'nchar.江西省宁德市梁平香港街U座 132395', 1630000000042)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000001, -1327031516, -9041664297455549079, -6004, -44, -6224.384964, -39.676621, 1, 'binary.amQNMbMfFfKQljlJEvIS', 'nchar.澳门特别行政区兴城县平山张街J座 904644', 1630000000042)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630615000000, -1454876122, -1664191631337826145, 2979, -43, 52777147.724176, 1229194365813.330078, 0, 'binary.IxkIHjiRPnVlBdHQSdLm', 'nchar.广西壮族自治区帆县山亭张街G座 965406', 1630000000041)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630630000000, -1983928412, -7333101339332877122, 3761, 37, -38344519.775088, -65261.718170, 0, 'binary.CaPFXqhDLSOaNmNnOsLh', 'nchar.上海市马鞍山市城北宁德路c座 402187', 1630000000042)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000000, -98362180, 3588425829881816071, -9471, -3, -739.807551, -194649953397.838013, 0, 'binary.LQjcSrpQYoEDKvOOlKKI', 'nchar.青海省南宁市孝南宜都路F座 208181', 1630000000042)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630629999999, 826686189, 1712941616400699580, 9250, 116, -92395295608805.296875, -2.541895, 1, 'binary.shGShhPNnWdZQDAdbiHo', 'nchar.辽宁省六盘水市门头沟黄街t座 892638', 1630000000042)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000000, 186750484, 8366250288933508150, 15325, 23, -4695500.207880, -64.107600, 1, 'binary.IkdeyRigedSouvHypNnn', 'nchar.福建省倩县怀柔潮州街g座 858358', 1630000000042)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000001, -667795153, -2546515577402776696, -6866, -12, -8902370.867967, 90891053949.643005, 1, 'binary.OaUjyowfAGaGXKoVLWZR', 'nchar.河南省长春市城东郑路L座 791122', 1630000000043)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000001, -120091173, -4224513340638046957, -14010, -106, 47098343261485.101562, 8407041730175.440430, 1, 'binary.NcaWdgNTvgnnrmOyMSRv', 'nchar.西藏自治区健市南湖北镇路F座 518953', 1630000000043)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630630000000, 1431440158, 8179550750509486230, -9219, -2, 81300.928795, -56.108837, 0, 'binary.EBrNkPXmiwUfZTalWRtd', 'nchar.广西壮族自治区南宁市锡山罗路W座 812195', 1630000000042)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630645000000, -412013965, -7913679721963250806, 10182, 93, -5654939.111803, -846597080580.864990, 0, 'binary.qEwLmiFwCrLZumFHOYjb', 'nchar.西藏自治区合山县滨城贵阳街j座 422034', 1630000000043)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000000, 1503721252, -1036748170680619716, 3291, -18, 4.597429, 62188775030.721703, 0, 'binary.XKwsLUCTTzTuOxhWzjkr', 'nchar.新疆维吾尔自治区红市大东邯郸路r座 535699', 1630000000043)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630644999999, 1420828021, 2546086650460850227, 17595, 113, 43.359177, 8941185489440.390625, 1, 'binary.AYcgokdEsFMUOIcUpxnM', 'nchar.云南省桂英县高明张街s座 776931', 1630000000043)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000000, 1943840699, 8246807181436486678, 25310, 76, 35456238889763.703125, 642320879.336482, 1, 'binary.RVHWrlKKNsXNwSQINHba', 'nchar.重庆市华市滨城李路l座 828098', 1630000000043)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000001, -2009472018, -7027630570263393098, -21696, -67, -8424796538428.150391, -49416.120873, 1, 'binary.JpOZwpoVKCDjiqsFhbaS', 'nchar.安徽省深圳市高明陈街w座 281329', 1630000000044)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000001, -177128590, -4886914070408811519, -24807, -23, 170878.982356, -2.287124, 1, 'binary.BMICVHrfygzpAnylwEKr', 'nchar.河北省萍市锡山韩路y座 412263', 1630000000044)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630645000000, 1079184574, 5846412039067228007, -30088, -25, -4212078244.552720, 679329505569.878052, 0, 'binary.gazNmQBKvUAcQQdcOFfh', 'nchar.福建省柳州市翔安石家庄路k座 779547', 1630000000043)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630660000000, -1579595934, -4731667789895780038, 15158, 77, 526489893298.299011, -396.223420, 0, 'binary.xUUoAUpZeJJsquiJOKsO', 'nchar.吉林省兵县闵行乌鲁木齐路Q座 534261', 1630000000044)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000000, -223991084, -2619845069313547475, -14196, 65, 9226.169120, 44944134.392266, 0, 'binary.JGVSgWAUVwADbVUvpSiy', 'nchar.天津市太原县六枝特王街g座 766627', 1630000000044)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630659999999, 395324903, 3937705474539369893, 15533, 65, 0.584074, -967418.449977, 1, 'binary.vWVYYMXIWQAEHBTKKWjP', 'nchar.广西壮族自治区上海市南溪淮安路O座 810462', 1630000000044)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000000, 762050937, 673715091051246407, 16484, 115, 97643376.627697, 763.832549, 1, 'binary.YaiVXlPHKJSEOWuRsRwS', 'nchar.江苏省东莞县友好彭路R座 578518', 1630000000044)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000001, -9754404, -5144925573679303827, -11209, -98, -7.448873, -448115242.603042, 1, 'binary.QNAVDZqImSFgnHpVdWtS', 'nchar.澳门特别行政区沈阳县和平张街H座 176143', 1630000000045)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000001, -1866035632, -2427166402076174209, -27881, -22, 7.396055, -698670.261246, 1, 'binary.uZkazUtEEMgPQgeEXPEe', 'nchar.山西省秀珍县房山西宁街g座 249969', 1630000000045)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630660000000, -1051806775, 7747932212903150302, -3555, 33, 136.466491, -14409582572.354000, 0, 'binary.tuGfceNZePXxugZSWrOK', 'nchar.湖南省海燕市朝阳长春街y座 700043', 1630000000044)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630675000000, -98786523, -8235989830378110865, 1159, 12, 539082.659713, -335587651.682570, 0, 'binary.XQfGXHbnwGQPulAcrAPX', 'nchar.澳门特别行政区郑州市沈河张路S座 530101', 1630000000045)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000000, -1987879809, 8328244568807450232, -19551, 26, -829281.870267, -2.960861, 0, 'binary.tsChIuGKmCXkiRucjEmc', 'nchar.澳门特别行政区强市长寿银川街V座 830000', 1630000000045)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630674999999, 2068284680, 6162503383056743038, 27733, 48, -35701228967431.296875, -53.652855, 1, 'binary.wNSWJmuVBjpRVVCpksQC', 'nchar.河北省磊县锡山通辽路I座 205908', 1630000000045)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000000, 1151350758, 2480050564933255492, 12388, 102, -738078.108110, 37271792.258503, 1, 'binary.HLSVgACKcmyXKMuAaoCr', 'nchar.云南省龙县丰都乌鲁木齐街j座 584869', 1630000000045)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000001, -853667209, -5695092490915541765, -2174, -112, 26.293549, 2.242559, 1, 'binary.OgZwwWPZuNLXAAdBcanX', 'nchar.四川省巢湖市门头沟广州路C座 781739', 1630000000046)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000001, -1502448521, -720023346921095762, -11220, -47, -4788.467802, -40669738519.174500, 1, 'binary.omeLfsdjbehlFckYepVj', 'nchar.山东省东县城北辛集路e座 898860', 1630000000046)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630675000000, 1648896854, 7223892135855185984, -5070, -5, 1481003953669.600098, 64887.632295, 0, 'binary.TBMjUXWqSdTfxYFZJeBD', 'nchar.北京市博县金平耿路U座 676471', 1630000000045)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630690000000, -287136285, 1361266513134048206, -3947, 6, -94329.350983, 20808636.344494, 0, 'binary.OdsJNUSWeVvTxQdKykmk', 'nchar.陕西省冬梅市魏都王街J座 907521', 1630000000046)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000000, -1467609417, -3843627157269427935, -5413, -42, -614746115.104684, 58.540238, 0, 'binary.NtWJpduxaSUSCqzynFYI', 'nchar.内蒙古自治区兰英县梁平合山街l座 424641', 1630000000046)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630689999999, 155983724, 4361653758945923763, 29353, 81, -498.227438, -5998.851784, 1, 'binary.MRJjXYWHBZvzaAjTzrli', 'nchar.安徽省丹丹市江北海门路R座 285157', 1630000000046)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000000, 1258506389, 8207419892749460886, 22177, 98, -8132825907524.299805, -80427.275975, 1, 'binary.NKvCFHNYSDBOyLxAkMxr', 'nchar.台湾省荆门市萧山石路c座 773841', 1630000000046)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000001, -1760453704, -2551026868258460946, -4549, -24, 80821.980662, 16.963865, 1, 'binary.pARRcJciJQzdzcCZRqZA', 'nchar.江西省关岭县安次阎路W座 514665', 1630000000047)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000001, -1840599952, -7633977303259618496, -30566, -98, -54802925.996342, -179096513.804220, 1, 'binary.sXxbWKCIeaTzSmMmYYYY', 'nchar.新疆维吾尔自治区娟市清浦唐街G座 762308', 1630000000047)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630690000000, -1855444632, 2154100108226554299, -9690, 41, -247749.941627, -334792954703.443970, 0, 'binary.zIvNZWbipczRwxcTNujW', 'nchar.黑龙江省帅市和平张路W座 522431', 1630000000046)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630705000000, 1051015641, -2016886488941734520, 25881, 35, -862249.687896, -7581394980.840040, 0, 'binary.HfnUyPAwYxEHQotoCfFT', 'nchar.湖北省郑州县和平哈尔滨街S座 408314', 1630000000047)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000000, -510388953, -8064065802993152150, 32481, -96, 7.338368, -983.214115, 0, 'binary.URxUEcHRhmRFuPRLMOfU', 'nchar.北京市海燕县大东安路T座 198225', 1630000000047)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630704999999, 570191599, 5721926649273388978, 16320, 75, 1203.837639, 108022950538.300003, 1, 'binary.VVxoQGPpWrOYSXzSxWlM', 'nchar.重庆市玉梅县城北北镇街j座 561254', 1630000000047)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000000, 516742969, 5254851840608530925, 22978, 57, 98.947992, 2.621934, 1, 'binary.qJtFyhoRvILawwiVeHZU', 'nchar.上海市宁德县萧山李路a座 549521', 1630000000047)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000001, -1289549437, -4852255743592819912, -21575, -83, 21395693569392.300781, -20107182860.251999, 1, 'binary.mtOMrfEeDMegNqMauPgK', 'nchar.安徽省飞县滨城范街D座 780146', 1630000000048)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000001, -530361614, -2932962238369711981, -20256, -101, 1185.387219, -32573778030.118999, 1, 'binary.VFBPpHGESAAGkeRzIbtK', 'nchar.广西壮族自治区金凤县龙潭沈阳路L座 296744', 1630000000048)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630705000000, 726917225, 502661849153334288, -12421, -29, -481018.973281, 685.805197, 0, 'binary.XJeHLodwUXxQGrQUyIzI', 'nchar.河北省彬县萧山海门路s座 748879', 1630000000047)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630720000000, -1161611813, 5817478319014146944, -7727, 6, -378647512.223777, 60632396886.272797, 0, 'binary.jEENQpaYOWcVHUYKPaPn', 'nchar.山东省辽阳市兴山关岭路J座 414020', 1630000000048)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000000, 400786735, 1794586209142898723, 29093, -32, 2336.811166, 4.882355, 0, 'binary.xaDzuonslxHsHxVUcTUr', 'nchar.广东省红市南湖兴城路V座 308999', 1630000000048)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630719999999, 1998845359, 296563873066744098, 25562, 88, 543674818246.236023, 589024.805283, 1, 'binary.IROrsLaBEXcULJZvtXDS', 'nchar.河北省婷市南湖奚路F座 111413', 1630000000048)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000000, 1792844644, 7461061401252152973, 21237, 38, -26922171.906852, 2426.989224, 1, 'binary.tkXpypBtMzRGUmlEOHzz', 'nchar.上海市齐齐哈尔县涪城呼和浩特路f座 808674', 1630000000048)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000001, -1746905381, -2536142587987184204, -30442, -113, -76482733.355534, -14901138135.959801, 1, 'binary.WatcMYFnezOmZtsAGUDK', 'nchar.香港特别行政区杭州县六枝特李路Q座 925367', 1630000000049)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000001, -2131665185, -7526157230511290768, -20114, -12, -44.609385, -754455.135801, 1, 'binary.mJjTgToZxAwHTtdlzHCm', 'nchar.湖南省南京市沙湾尤路s座 734395', 1630000000049)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630720000000, 935471992, -1206109439865175665, -13528, 3, 2923999104624.620117, -91367340672254.593750, 0, 'binary.UeJygdaPzMTyLGaYNqVw', 'nchar.上海市佛山县秀英汪街s座 123655', 1630000000048)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630735000000, -1162065386, -3625158475592858359, 15940, -1, -3.678888, 1905.623857, 0, 'binary.ltmEKwzkvDqQIZWAxJtQ', 'nchar.宁夏回族自治区旭县翔安潜江路e座 531775', 1630000000049)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000000, 27870294, -1672838010426046661, -271, -67, -36401764.482018, -8776255.622473, 0, 'binary.YpzKzQOXpmQFzkDvKTPZ', 'nchar.贵州省波县和平深圳街H座 685163', 1630000000049)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630734999999, 2123054685, 1637804037910336988, 6220, 95, 70038469196607.601562, 3457393391629.479980, 1, 'binary.cRdRGuitRXDuGAWVDxAE', 'nchar.宁夏回族自治区南昌县高港永安路k座 452965', 1630000000049)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000000, 920693621, 6310859245401227510, 303, 79, -60035982.548857, 1543090.996048, 1, 'binary.uTFJycIGGxiHvreuiUWd', 'nchar.黑龙江省重庆市华龙辛集路k座 324574', 1630000000049)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000001, -45388705, -6671698571264178710, -1142, -44, 9.623297, -36288182.831700, 1, 'binary.HMSrCuTIHQiHmuAoGqJK', 'nchar.浙江省六盘水市锡山广州街f座 930027', 1630000000050)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000001, -1979960230, -5366544476848969489, -9255, -38, 13559526845534.199219, -52598830.800144, 1, 'binary.lwsPLPMBhvmOtIthgnDA', 'nchar.香港特别行政区璐县友好李街I座 225346', 1630000000050)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630735000000, 953316928, 521541905227278512, -7691, 108, 0.929415, 6372.352970, 0, 'binary.FAMTMFGzUQzWeWuWvvCv', 'nchar.青海省浩县吉区李路l座 492272', 1630000000049)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630750000000, 1289374504, -1538126395055742224, -12336, 94, -41.978570, -543035800648.830017, 0, 'binary.SHhbtXRCqxYOqQcWUDtU', 'nchar.台湾省玉英县东丽邵路W座 597939', 1630000000050)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000000, 994205413, -8986580971408422193, 23422, -119, -30609466.792492, 844615733.994923, 0, 'binary.cjCTzFJrdzKdAEluupXy', 'nchar.河北省长沙县长寿任街w座 978621', 1630000000050)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630749999999, 422908755, 5457973965996455589, 7028, 70, 40563882.192469, -9235464112.622881, 1, 'binary.xeqmTUMylYPDFkFJGLQY', 'nchar.澳门特别行政区兵县黄浦六安路y座 904155', 1630000000050)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000000, 798218536, 664231232740969491, 19717, 18, -63.765636, -5311500109000.320312, 1, 'binary.hiiCPuMjaHFEOXUsUyFs', 'nchar.北京市马鞍山县友好杭州路E座 623925', 1630000000050)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000001, -1902203841, -2257246515637886253, -26212, -11, -4386502.688771, 17.396601, 1, 'binary.dEfjmLzekcjvysMUToXa', 'nchar.黑龙江省雪县东城高路T座 703981', 1630000000051)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000001, -519516209, -6438472832772944658, -2516, -5, -137.313109, -21.647080, 1, 'binary.XOwaYPgBCUulNhxMuijU', 'nchar.天津市北京市江北宜都路X座 191896', 1630000000051)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630750000000, -1936399460, 5919953889802638962, -6029, 116, -47.500353, 6967.754987, 0, 'binary.TEvmwdpcePbbpPUuCcOL', 'nchar.湖北省帆县西峰邯郸街l座 145632', 1630000000050)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630765000000, -115300759, -5011960136761658883, -1020, 94, 23611.457680, 3419810648081.700195, 0, 'binary.CowDUEaCtAEdafPCLLwM', 'nchar.江苏省沈阳县涪城梧州路g座 537113', 1630000000051)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000000, -1632078764, -2531000958759467663, -1282, -120, -44.781583, -983514.899761, 0, 'binary.YgAVHKRKbzDqkjthriDR', 'nchar.宁夏回族自治区桂芳县怀柔辛路h座 764420', 1630000000051)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630764999999, 1335747951, 332059218903242958, 16913, 38, -258359415.692471, -64088.294941, 1, 'binary.ugUzQSUcPjEXMIDrFobB', 'nchar.澳门特别行政区南宁市大东深圳路a座 447398', 1630000000051)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000000, 489030717, 421762966583668765, 31429, 94, -93516881483951.796875, -3894133275.320640, 1, 'binary.pMcnfkpKjgIgIQUaEjjG', 'nchar.广西壮族自治区倩县沙市李街q座 504473', 1630000000051)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000001, -1552553924, -4861456845426343956, -27864, -39, -47713477064.426201, -5155612964147.650391, 1, 'binary.gZMscjyRXoGyNsFLHpoR', 'nchar.广东省梧州市龙潭蒲路T座 644808', 1630000000052)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000001, -915605364, -5868675460644756043, -650, -56, 7433399325297.160156, -52322640586113.500000, 1, 'binary.oopvfRaqoQJMcVsjkWaW', 'nchar.湖北省建平县海陵孙路S座 240665', 1630000000052)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630765000000, -1546478570, 400491964521467219, 12189, -119, -47542.132966, -2297.923262, 0, 'binary.HeXyWwlnWwUQoKSQqlmu', 'nchar.新疆维吾尔自治区拉萨市蓟州李街B座 664953', 1630000000051)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630780000000, -97528818, 8438123946253432917, -2893, 109, -2306175015456.819824, 13390.816579, 0, 'binary.pqfTTMuvVmSCfxCmFTwS', 'nchar.吉林省莉县新城廖街W座 455043', 1630000000052)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000000, 1001095126, -3172038662584640805, 31275, -17, -6999060.910240, 2846571851.119890, 0, 'binary.CLiSpqGShMtzcfyVTbqa', 'nchar.四川省长沙县东丽张路i座 936342', 1630000000052)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630779999999, 1092904458, 4456537336906696912, 16315, 4, -13230586.214814, 29375192427.605099, 1, 'binary.IAiAMcGMqeACFMkfgGju', 'nchar.福建省汕尾县丰都海门路R座 239728', 1630000000052)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000000, 1949642007, 5173135551369380298, 13811, 118, -59765334.101800, 645915504896.780029, 1, 'binary.KZORRCLafoZgcOOJmook', 'nchar.四川省重庆县新城王街u座 375952', 1630000000052)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000001, -437886009, -8023690985345652194, -14116, -22, -41686906094.233299, -2499063538390.600098, 1, 'binary.jWguWEtBAUgcMKtgXieL', 'nchar.台湾省沈阳市山亭牟路X座 126443', 1630000000053)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000001, -1594359349, -8856134295356844294, -29431, -58, -5120.713906, 18405344215702.800781, 1, 'binary.eeRKiigMAbjCTZnPHkGn', 'nchar.北京市宁德市合川朱路d座 269386', 1630000000053)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630780000000, -585788677, 3989310696333618920, 29186, 73, -6608.937490, 11.883322, 0, 'binary.lMUQhCelPiyrOIsQUUai', 'nchar.台湾省俊市蓟州淮安街k座 712450', 1630000000052)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630795000000, -738727537, -4908907813359743923, -26386, -105, -841510.274518, -80431949.274122, 0, 'binary.zWAWphEtCuSMACUmkfvN', 'nchar.天津市沈阳县清城杨街X座 500455', 1630000000053)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000000, 393352810, -379075072584781331, 9788, 6, 50170524851777.796875, 44763418392.943497, 0, 'binary.lDVSDncOcANkMxzrtUzK', 'nchar.青海省福州市清城蒋路Y座 567996', 1630000000053)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630794999999, 433850999, 5300519222587016898, 9473, 108, -190097.678270, 2904794070549.299805, 1, 'binary.QBIulMvNBsGMfStAKgCQ', 'nchar.重庆市亮市璧山合肥街U座 535443', 1630000000053)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000000, 1651231384, 6954565384064882242, 12216, 115, 81102616.344608, 39273.314632, 1, 'binary.mFwsFjuuCpdYWXqSMkgn', 'nchar.西藏自治区武汉市滨城太原路b座 798865', 1630000000053)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000001, -1219816305, -7051889644919104807, -28601, -74, 491555.463996, 72211361404034.796875, 1, 'binary.aSnbvFgLheGIahlWoBEf', 'nchar.贵州省倩县大东张街m座 344033', 1630000000054)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000001, -2116828534, -5490698997387226161, -12838, -39, 145344193.926365, -463003297.110519, 1, 'binary.wyWFnvMlYxuviQIhtJTb', 'nchar.贵州省鑫县浔阳贵阳街w座 498999', 1630000000054)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630795000000, -717310584, 7305335468389593497, 26992, -11, -33.942630, -4.966136, 0, 'binary.dKiRVdIDouQiceoUupoT', 'nchar.青海省银川市秀英叶路A座 419144', 1630000000053)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630810000000, 1063250813, -5121723296303557180, 3452, -49, 128.722024, 8116.722860, 0, 'binary.XwbrXvujPArWLXYhQRQK', 'nchar.内蒙古自治区玉兰市城东银川街O座 519239', 1630000000054)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000000, -433540276, 3265329093020138852, 19837, -63, -8299471626012.559570, -76400754030.522995, 0, 'binary.qUMRRVLolMSqDjJOJGMj', 'nchar.宁夏回族自治区平市高坪广州路D座 168860', 1630000000054)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630809999999, 1771552222, 3276405219271274913, 6311, 75, -9805500055353.400391, -378716.572329, 1, 'binary.YdwgZmlYfeivmxtaWueZ', 'nchar.四川省军市吉区罗街K座 863617', 1630000000054)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000000, 1511546600, 5132492378969879970, 21762, 77, -160772007871.860992, 4897001212199.500000, 1, 'binary.HNELJpdiwwcvGwnYiiQt', 'nchar.青海省六安县沈北新李街G座 938908', 1630000000054)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000001, -429657495, -726300776399539025, -5426, -71, -906430389.497117, 26283347323689.101562, 1, 'binary.yGIWxOkDtQCQgbPJhHFi', 'nchar.福建省娟市丰都董街I座 482079', 1630000000055)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000001, -1918072152, -3958702025992555431, -20124, -100, 325915062.818627, 82697862.465381, 1, 'binary.zNgoJphhqXQOvIxQHzgJ', 'nchar.浙江省秀珍县滨城陈街j座 333330', 1630000000055)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630810000000, 1166488162, 7007631474167031432, -9261, -6, 6932344629.512100, 531610708.460607, 0, 'binary.OwLQNOOkVKVzVtHPJDqC', 'nchar.黑龙江省娜市朝阳李街y座 366075', 1630000000054)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630825000000, 1579885922, 6474658599299815947, 28280, 52, 105208627.487617, 794627163.462063, 0, 'binary.FEXGjykuWeGEfkKImWDw', 'nchar.四川省淮安县长寿海门路T座 448080', 1630000000055)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000000, 734586506, 5695938165634694036, -6919, -31, 16653611667.163200, 5495624345.768730, 0, 'binary.YXkQvxGjNZCQDlipuLTw', 'nchar.上海市宜都市滨城田街s座 403680', 1630000000055)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630824999999, 1560886565, 601626973389436785, 25259, 120, -10180.909667, -11157634.936217, 1, 'binary.OlTzMGFNSfSrcixpefQx', 'nchar.四川省太原县沈河申路d座 235380', 1630000000055)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000000, 1316061964, 4308983887809754383, 29120, 81, -318524399.639939, -76861841765211.906250, 1, 'binary.BFHoxbNIFRIxSwrutvbT', 'nchar.澳门特别行政区永安市璧山廖街c座 427250', 1630000000055)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000001, -2082927804, -1484742345187780268, -6764, -32, -834228179.920564, 182.911517, 1, 'binary.FTNnvEphxFByhzkfmAhb', 'nchar.甘肃省南昌市东丽南昌街v座 686725', 1630000000056)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000001, -231751967, -5929805332846772894, -26985, 0, -0.118923, -67637720.762575, 1, 'binary.TYBLuEQrsrxSAJbNcCwe', 'nchar.河南省莹县房山石路a座 319475', 1630000000056)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630825000000, -1500118527, 7742809515581132121, -8755, 59, -47.623223, 4.266104, 0, 'binary.rbQwEMlJmykGPTkOccLp', 'nchar.湖南省辉县和平香港街s座 101830', 1630000000055)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630840000000, -714663691, 5099404450420041478, 27567, 14, 4.945851, -23542476442552.601562, 0, 'binary.tdLqigCoasQnRffCEaDD', 'nchar.江西省太原县华龙何街H座 269392', 1630000000056)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000000, -316339515, 6558297131565034564, 10392, 20, -171972.831509, -13296859.696109, 0, 'binary.sBJTgABqvGumXOfORHBt', 'nchar.吉林省昆明县崇文关岭街K座 822911', 1630000000056)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630839999999, 312047911, 6751577130057851873, 24735, 43, 1278880274.608010, -2.634735, 1, 'binary.yaVlkhtTxxgrtZTsFdxa', 'nchar.云南省台北县魏都张路U座 698041', 1630000000056)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000000, 364153602, 8378783503904272354, 9837, 123, 617669.431755, 134.118945, 1, 'binary.RPldGyMrCeJhQIJpDaWz', 'nchar.重庆市丽华市淄川昆明路y座 543556', 1630000000056)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000001, -1417705247, -1906089795101484200, -3898, -46, 13831918214786.900391, 4384545313581.750000, 1, 'binary.tHnemGaRugDffcmoyWli', 'nchar.青海省建平市清城赵路z座 958026', 1630000000057)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000001, -434542286, -3699533697590169746, -21081, -126, 76.275011, -41585.936197, 1, 'binary.XBOSfXHSompdpAuWKgmz', 'nchar.河北省合肥县滨城重庆街k座 644142', 1630000000057)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630840000000, -1785884903, -7685034849720410750, -21661, -99, -3153441121.646620, 502521483208.367004, 0, 'binary.MvIfmuaYUqcNIjJBVEAH', 'nchar.重庆市张家港县东丽孟路X座 295908', 1630000000056)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630855000000, 1437018826, 7400326252504732743, -29033, 112, -53177718.768333, -23404.680449, 0, 'binary.XZcaYfmvLZtxhrmzHWEJ', 'nchar.青海省柳市静安陈路h座 801659', 1630000000057)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000000, -869253997, 8132787450326867533, 22924, -123, -902072.768906, 33.572941, 0, 'binary.FjuniySwJpoodedUTAmT', 'nchar.香港特别行政区六盘水县新城太原街W座 631866', 1630000000057)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630854999999, 1667164436, 4152850799576560541, 29745, 75, -450320.964115, 82908.189997, 1, 'binary.NdSzaJxdoQPGYefWPJyi', 'nchar.四川省春梅县璧山刘街a座 898553', 1630000000057)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000000, 1667649794, 1088688853312235292, 9455, 97, -3.427779, -66.503636, 1, 'binary.tvFPXcrLOMTMCJFqcwxT', 'nchar.内蒙古自治区柳县璧山齐齐哈尔街T座 380899', 1630000000057)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000001, -2145233720, -3109219509113963979, -18812, -108, -981408379333.303955, -684.345037, 1, 'binary.jghuIXEGcUtKikJpzLOh', 'nchar.四川省银川县崇文张街H座 193298', 1630000000058)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000001, -1420593489, -5757610227096963226, -16816, -112, 75645.512896, 4840288.738839, 1, 'binary.CCvnOIBQeUgdTvsedOIX', 'nchar.河北省俊市孝南王路V座 596559', 1630000000058)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630855000000, -1569315493, -7039982472137840249, -11039, 43, 396.176284, -6.336007, 0, 'binary.oNPEvbRQaKHZmlKRACCu', 'nchar.江苏省六盘水市锡山杨路Y座 725607', 1630000000057)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630870000000, 1811347552, -8209360489735809987, -12235, -88, 2775714032.345980, -273997.706213, 0, 'binary.riDaPlhuskGRZsNxzooI', 'nchar.辽宁省潮州市东城徐街R座 431820', 1630000000058)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000000, 1930606515, -6940503292627563742, 14608, -109, -544236.299151, 18944279791.470501, 0, 'binary.vbFXWFeRlIaxUNtkKXIp', 'nchar.甘肃省红霞市门头沟长沙街A座 350032', 1630000000058)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630869999999, 488072919, 4847709443565724927, 25414, 31, -442295.525846, 654487670258.910034, 1, 'binary.RLQFgpAcQCfhuZExHLkx', 'nchar.江苏省巢湖县秀英翁路z座 536419', 1630000000058)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000000, 334934868, 8084257597250217608, 2587, 69, -46356096021.352997, 17315.165561, 1, 'binary.uCbRqUiElxGzVXQYYkmE', 'nchar.云南省太原县黄浦段街q座 675838', 1630000000058)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000001, -1943550230, -3503251484175500724, -28810, -67, 4134905907363.700195, -97.850683, 1, 'binary.ozdeiPLKjSgywqNpCBYN', 'nchar.香港特别行政区西宁县城北王街H座 794624', 1630000000059)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000001, -970612310, -8553425754362908809, -2144, -72, -99455587437.982300, -97357630030126.500000, 1, 'binary.EcHZioPjEFGIxUhBosdz', 'nchar.辽宁省玉兰市新城拉萨路W座 721716', 1630000000059)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630870000000, -384741102, -7726003315883440776, -2966, -80, -60458.951496, -4975581.359366, 0, 'binary.TZmxmIbpirBCEoTvqUzY', 'nchar.安徽省呼和浩特县六枝特朱路B座 888783', 1630000000058)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630885000000, -2123493348, -4231564094016455736, -31657, 21, 591198324.991950, 794309276463.779053, 0, 'binary.ZKZunxmtjBCRRCZBHTsL', 'nchar.重庆市六盘水市崇文魏街z座 678361', 1630000000059)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000000, 766378371, 492367445257699608, -7708, 99, -3.863619, 5004672.630707, 0, 'binary.AmjCwTkBprSgkFpguYng', 'nchar.山东省健市徐汇兴安盟街z座 942291', 1630000000059)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630884999999, 724025582, 7859514857348468608, 2877, 125, -58160.749327, -8273.730579, 1, 'binary.XZmZYlSRZZddcxEOjfEd', 'nchar.新疆维吾尔自治区潜江县清城梧州路m座 660147', 1630000000059)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000000, 1075248136, 8396611731005005497, 20388, 107, -7832228.556238, 17032.924250, 1, 'binary.xKdxeqytYTWmncKRyiEZ', 'nchar.吉林省琴县清浦台北路t座 640801', 1630000000059)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000001, -2130070769, -5654655793240443105, -30365, -37, 71673.437636, 624958800878.404053, 1, 'binary.qLvSSOSazLTUKvqpCCBL', 'nchar.河南省桂芝市房山韩街x座 576203', 1630000000060)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000001, -1953170165, -7336932030848188049, -12255, -67, -1400233209790.189941, 568697943954.404053, 1, 'binary.pQNaWtAWfSUVMWbrhVmk', 'nchar.天津市晶市清河太原路F座 911684', 1630000000060)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630885000000, 281132201, 5123656302965848910, 6859, 69, 6896942.124392, 7059472733608.709961, 0, 'binary.PHwnvqWGOkMIPxdQCkTT', 'nchar.安徽省婷市东城太原街x座 154074', 1630000000059)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630900000000, 2108150002, -3953623224839666424, 26021, -120, -3832507656102.310059, 41875460523837.203125, 0, 'binary.eEaxRyDoGrrYZQfYhDwC', 'nchar.福建省杨市山亭陈街X座 274347', 1630000000060)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000000, -95171868, -3159580668189063241, -4074, 47, 82585.410649, -7462199.923442, 0, 'binary.nAHveWPuvkfTISitbBzq', 'nchar.河北省琳县蓟州吴路H座 196552', 1630000000060)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630899999999, 941556630, 7998670511234147715, 15902, 22, -6585.641376, -0.373709, 1, 'binary.WrcojJGdsiZyAaRxYrdw', 'nchar.江苏省东莞市翔安杭州路l座 318171', 1630000000060)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000000, 1042736485, 7949270623018065586, 28676, 76, -61426.518584, -889632484.718458, 1, 'binary.MMPKnkKEPUMKxiatOAXs', 'nchar.北京市杭州县永川梧州街L座 989832', 1630000000060)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000001, -343938435, -815062415332308272, -26680, -52, 5.498240, 63.248674, 1, 'binary.HoqLkegpacFGqzFWeVXL', 'nchar.山西省辽阳市城北沈阳路u座 992590', 1630000000061)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000001, -1788477052, -5188731326210734405, -1324, -57, -2910628601164.899902, 87786.407935, 1, 'binary.LlQNfNmJFPmYIFPwUEzx', 'nchar.重庆市丽华县东丽成都街e座 389910', 1630000000061)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630900000000, 2018195628, 7377417636728033494, 9220, 11, 4207000288325.890137, -618075239621.894043, 0, 'binary.sazxRvzqSdaThdGddmPa', 'nchar.黑龙江省呼和浩特县南长兴安盟路r座 293112', 1630000000060)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630915000000, -1893993866, -4365820244764275930, 31103, 68, -2066117083545.469971, -5037.126794, 0, 'binary.bMuXKucyDJjBggYIIAvd', 'nchar.上海市玉英县合川许街L座 434453', 1630000000061)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000000, 176036972, 6462275287504332531, -12663, 9, 7238554.481668, -24.426760, 0, 'binary.nCtwVdottyyUkynsejOK', 'nchar.天津市秀荣市浔阳施路B座 784962', 1630000000061)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630914999999, 462886464, 2194905473450940337, 12828, 98, 3.368086, 9.615829, 1, 'binary.BRImBBEftaaKZeOGRSvW', 'nchar.江西省广州县普陀潜江街J座 122271', 1630000000061)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000000, 1703114933, 1832458494225860699, 29866, 118, -3807017124.642100, -912951646003.170044, 1, 'binary.gPctXUuQQLaDZMWiQWzA', 'nchar.陕西省深圳县城北刘路C座 874212', 1630000000061)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000001, -674623669, -6380867918231277409, -1843, -119, 435947.604417, 766787648570.537964, 1, 'binary.XevOOqIPqCmaJUcXaaKz', 'nchar.云南省巢湖市丰都柳州街t座 325613', 1630000000062)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000001, -1559227469, -7051851803063121646, -27579, -65, -509948.590885, 2838.905231, 1, 'binary.QfqLcJjHqpLoidJREEnX', 'nchar.广西壮族自治区桂芝县清城宋路Q座 713677', 1630000000062)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630915000000, -1205146480, -6555909736905274411, 10866, 11, -917806.522567, 7477874070.574810, 0, 'binary.zDfAtyjfdffSTqbqeobG', 'nchar.北京市春梅县滨城陈路X座 531714', 1630000000061)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630930000000, -1494759877, 7825831993548386780, 3895, -126, -662731502.286191, 540530.198658, 0, 'binary.GGbtLZVCzfmnUdMHExqv', 'nchar.海南省东莞市上街杜街d座 891312', 1630000000062)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000000, -1188314039, -5179463148601079589, -727, -86, 3813.243840, 9214.756895, 0, 'binary.uTiBEULehnYGBTLmKywi', 'nchar.河北省勇市东城石街B座 963105', 1630000000062)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630929999999, 1589240480, 6788343323702456012, 17814, 12, -5156431732058.429688, 47771.262506, 1, 'binary.wJyZOXguJRYIbgIuIRye', 'nchar.浙江省桂花市朝阳杨街E座 783650', 1630000000062)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000000, 1494846642, 513923720305876961, 29664, 79, 77561611.652663, -742112715702.303955, 1, 'binary.ymFCwOLqQdnnsFafDwkr', 'nchar.上海市六盘水市孝南上海路i座 565965', 1630000000062)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000001, -253589870, -4348911754768762667, -11980, -62, -4485569068.944760, 96365.291525, 1, 'binary.CzIxfDKtViliFCPuYkSq', 'nchar.青海省凯县锡山宁德街m座 619840', 1630000000063)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000001, -1105799208, -3800641476990756597, -22387, -123, 63290.349790, 171660453137.690002, 1, 'binary.jQRSOxYnBcNuWfRXmBkT', 'nchar.湖北省丽华县城东西安街w座 178969', 1630000000063)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630930000000, -1072430928, -1022000926125289868, 18740, 19, -2339625154017.399902, -5914609622.300700, 0, 'binary.ZbiUjpLNbsjFkdkPPfbM', 'nchar.湖南省杭州县南溪黄路D座 533554', 1630000000062)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630945000000, 2135168110, 1934009776464408479, 6695, 72, 16367931616261.000000, -584177.637447, 0, 'binary.ICfwWUnCEvXrJWGQNYjv', 'nchar.海南省秀梅市丰都重庆路G座 676020', 1630000000063)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000000, -1604447094, -5852815210707209114, 17991, 107, 130598712.764873, 289933642.558557, 0, 'binary.yVowiloVQgZDlfKNlbWh', 'nchar.山西省燕市双滦潜江路o座 423049', 1630000000063)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630944999999, 701182235, 666030532933625291, 203, 77, -1.180313, -2809676597535.319824, 1, 'binary.wFVimJeupABVGEvwMiTv', 'nchar.河北省敏市东丽徐街H座 593999', 1630000000063)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000000, 1199058915, 6158980904131584989, 19579, 17, 541875543475.742004, -597076.697923, 1, 'binary.FjLluJSaCVzuHbHvJfzo', 'nchar.甘肃省淑兰市南长马路c座 137684', 1630000000063)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000001, -1563988450, -9012098528369421000, -14380, -126, -444977.754816, 72.749039, 1, 'binary.OjWhbhEvRlHpqFEHXmfR', 'nchar.浙江省南宁市普陀周街r座 756238', 1630000000064)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000001, -135825310, -1557116121902920061, -27295, -123, -9.714553, -1221.739051, 1, 'binary.PoymphzdepeBanAfXkZU', 'nchar.内蒙古自治区颖市花溪吴路Y座 361290', 1630000000064)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630945000000, 220678360, 6988249753807558085, -2581, 63, 44373988506.265701, -776960795071.900024, 0, 'binary.FceJEjYHrZmPNoGcSJYM', 'nchar.香港特别行政区秀华市金平刘街v座 478775', 1630000000063)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 15376875, -6664581571745752730, -13465, 6, 16623190903.482500, 48981341.814827, 0, 'binary.lwtmrfdurUFDSkHMZuOe', 'nchar.辽宁省晨市南湖辛集街k座 508374', 1630000000064)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 1241969440, -1628740312418081543, 13806, 9, -321375164064.127014, 309512084.295555, 0, 'binary.nxCrfJncdqIIHvFslwbz', 'nchar.重庆市广州县永川太原街S座 529006', 1630000000064)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630959999999, 1631111972, 732723021793120104, 9398, 75, 81.940353, 358.935299, 1, 'binary.QZSHkvsYmRHnGFnyMije', 'nchar.台湾省兴城市孝南兴城街p座 734723', 1630000000064)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 1489317687, 5519190191808186905, 7935, 65, -46699875.436843, -3.678916, 1, 'binary.lMozaeGkbfYcTzrxJcoV', 'nchar.广东省辽阳县龙潭侯街q座 888715', 1630000000064)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000001, -1081644320, -7901892167113844563, -4059, -78, -12875427.525138, 777315388163.552979, 1, 'binary.TDrOTkriDBpZtXBadhIx', 'nchar.青海省萍县西夏潜江路R座 701876', 1630000000065)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000001, -283328976, -5407024306435227732, -18436, -30, -0.910943, 6223301643044.309570, 1, 'binary.bZikexFXrPKScwiyBTtX', 'nchar.台湾省秀华县西峰关岭街Q座 185151', 1630000000065)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630960000000, 667615766, 7516057978804562053, -6908, 82, 8.929773, -91.562693, 0, 'binary.ugfnkKdKlACxwKMCBEbb', 'nchar.海南省成都市沙市孟路Z座 646247', 1630000000064)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630975000000, 1998856189, -4326051996015773570, 17831, 76, -9.863853, -54574439998977.796875, 0, 'binary.JCxsLYijtQSKzNLYAICB', 'nchar.江西省颖县丰都蔡路q座 399088', 1630000000065)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000000, -1961052557, -8491150711564049542, 24318, -42, -54126426844007.601562, -2466916.622248, 0, 'binary.XijTExPHHgzfADOYawHs', 'nchar.海南省西宁市丰都齐齐哈尔路m座 331224', 1630000000065)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630974999999, 1021775776, 722158673624256018, 6062, 102, -94606143062457.906250, 35023478748411.500000, 1, 'binary.AstGPfaVxEefogcWzDzq', 'nchar.重庆市潜江市江北李街Y座 700708', 1630000000065)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000000, 1449414466, 6336873094660298228, 12438, 74, -790114.216316, -390.420215, 1, 'binary.secMQTXGKVthFXgMEFYl', 'nchar.香港特别行政区上海县西夏谷街n座 477311', 1630000000065)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000001, -1715903601, -471065515874324599, -10712, -65, -64736531762581.101562, -96042855.418683, 1, 'binary.lSSCcLFElDWxKZTdHRLN', 'nchar.天津市北镇县淄川禹街B座 570652', 1630000000066)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000001, -176995412, -7722430198424559895, -29062, -58, -5301089280.401760, -31441552360.634201, 1, 'binary.ikoqYkfzTrxBhYnfmKUW', 'nchar.新疆维吾尔自治区秀珍县浔阳王路D座 979771', 1630000000066)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630975000000, -65800677, -4755363672240072131, -11875, 34, 67445667.955342, 40434.343296, 0, 'binary.qDCRKCYQnmiDLFcdBAnT', 'nchar.广西壮族自治区北镇县浔阳宜都路W座 236322', 1630000000065)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1630990000000, -1190594011, 8137196870545919699, -28040, -9, -68.827873, 52589.409559, 0, 'binary.lTlvbMfWCVccDOCnIDBK', 'nchar.西藏自治区艳市徐汇六安街X座 527915', 1630000000066)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000000, 6478249, -2262813485458902331, 28341, 73, -10648.983192, 21.336997, 0, 'binary.vLfZLtfmMGABLIsYcSuG', 'nchar.贵州省倩市朝阳周路Y座 721501', 1630000000066)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630989999999, 1492685945, 2082419493615737887, 1936, 121, 270330631887.458008, 464724.616085, 1, 'binary.esYXdqdUGVFhLCHHciWA', 'nchar.宁夏回族自治区合肥市永川昆明路Z座 321933', 1630000000066)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000000, 746488837, 4063291949108736915, 11202, 12, -294206344.943296, -54829.586060, 1, 'binary.ynUOCSQSnPGHiIFNcUlr', 'nchar.河北省慧市朝阳台北街m座 705236', 1630000000066)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000001, -457991373, -2036730114286415967, -2136, -105, -5092278572843.200195, 17587773689.161999, 1, 'binary.OCGshioisqgLTUFLRMSc', 'nchar.上海市南宁市沙湾南昌街q座 991276', 1630000000067)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000001, -1242447360, -2110971702178298800, -16302, -30, -4130.477367, 8402.793080, 1, 'binary.jHAuHSxbhQHBBbaHCVSe', 'nchar.云南省石家庄县江北程路B座 226188', 1630000000067)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1630990000000, 71825038, 5708278874002188089, 4731, -80, 86.310448, -81380752238174.406250, 0, 'binary.WsCFazjKcLJjwrFHPelC', 'nchar.新疆维吾尔自治区永安县白云巢湖路j座 278171', 1630000000066)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631005000000, -925781701, -5868946429108894256, 5048, 19, 6559385936.497240, -9870442107.342270, 0, 'binary.iLESXKenJaWTIeKHFleM', 'nchar.新疆维吾尔自治区浩县高坪田街l座 923007', 1630000000067)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000000, -463506149, 8120086957375329125, -6384, 111, -9995250.448939, -736463.811003, 0, 'binary.AcGtBjWRUbXgHysDRMhs', 'nchar.江西省璐县海港惠州街g座 399144', 1630000000067)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631004999999, 306491871, 6281636598236510189, 24086, 67, -639.213146, 35478635363.208801, 1, 'binary.WPbbRgxYIRecrOFSlRYM', 'nchar.西藏自治区宁德市孝南刘路O座 708041', 1630000000067)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000000, 1797589305, 162080808454486608, 29046, 34, -54.791716, -71755480989.907196, 1, 'binary.DdiJOQDpLZuOsXbvtmFm', 'nchar.甘肃省台北县长寿高路t座 429482', 1630000000067)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000001, -709883988, -950329647663976821, -6274, -38, 64687083.568152, -133880631485.500000, 1, 'binary.cADQdfbZkXfcNPPOPQwp', 'nchar.宁夏回族自治区静市江北覃路u座 523043', 1630000000068)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000001, -1863995155, -8908360222222924661, -32472, -104, 82.537309, -89404622537910.703125, 1, 'binary.PBNnqQRGjNfbmaGVYlKD', 'nchar.新疆维吾尔自治区六安县西峰阜新路d座 990661', 1630000000068)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631005000000, -775088092, -151303921680143861, -23850, -72, -89808431301.207199, -646.674122, 0, 'binary.PGaLWNQGDnVSztoNNsSO', 'nchar.贵州省佳市翔安宜都街Q座 487382', 1630000000067)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631020000000, -487874477, 8081110518718693872, 10742, -8, 59233198.443672, -81768146.768733, 0, 'binary.AfIofVnHdvWMCGyeajlC', 'nchar.广东省利市锡山崔街X座 803273', 1630000000068)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000000, 822234976, 8508573074776208709, 17893, -96, -82.790723, -288719.773859, 0, 'binary.DoAGpoAKorgskVVmqIgo', 'nchar.河南省淑珍市淄川西宁街S座 903273', 1630000000068)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631019999999, 1639981656, 5471134581418657990, 22743, 76, 6306.116018, -7013891.566539, 1, 'binary.mVTonpWtYFauqLNntbcK', 'nchar.山东省巢湖县门头沟黄路g座 818470', 1630000000068)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000000, 1877786780, 1239434978427674122, 3482, 55, 4308520.332734, -7.194133, 1, 'binary.ATBjqErbvWNgzCwEXuVp', 'nchar.辽宁省凯县锡山广州街A座 668121', 1630000000068)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000001, -40134567, -5917934079243952151, -8151, -41, -1.160545, -5389824243.111000, 1, 'binary.hSZKVixlyoxpHpdvwYxY', 'nchar.黑龙江省合山市璧山吕路T座 593619', 1630000000069)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000001, -2005527285, -6681721755343029867, -25686, -12, -362992022448.400024, -5460308076525.500000, 1, 'binary.oWDnMrJWMhYgnspOVCyk', 'nchar.河南省明市城北阜新路D座 863966', 1630000000069)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631020000000, 24149104, 3385048008347468396, 25731, -51, 8252.733643, -4262287074.133500, 0, 'binary.pwblolLPhJQylCJAhGzn', 'nchar.浙江省柳州县淄川成都路q座 844741', 1630000000068)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631035000000, 212157003, -1467339935461255928, -7186, -34, 7497729511.586900, -98266.367876, 0, 'binary.jDxeCyLAKzKgEHGHAlif', 'nchar.广西壮族自治区桂英县永川张路K座 770340', 1630000000069)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000000, -2004196647, -7368122492859630941, 15455, -76, -57468499221.112396, 3727126030.311050, 0, 'binary.FIJWJSaOYEwWZHqhongU', 'nchar.上海市成都市花溪宜都路B座 441493', 1630000000069)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631034999999, 1412945598, 9027606879125343725, 21349, 38, -73686.799340, 3622986817296.899902, 1, 'binary.EPkNzxzaeCAWQetzzzlv', 'nchar.河南省荆门县沙市梧州街X座 162307', 1630000000069)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000000, 2125121614, 5109732906858974031, 26301, 81, -52025949738.545998, -0.369444, 1, 'binary.bjABIQwvmToiYBuNZkgo', 'nchar.青海省欢县龙潭荆门路q座 401300', 1630000000069)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000001, -517552216, -7052845906951781652, -9720, -120, -259291.640787, -9.749093, 1, 'binary.AmPftzlwURAILqlHhYtv', 'nchar.浙江省凤兰县南湖太原街U座 609741', 1630000000070)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000001, -534996716, -6181873037570436300, -10798, -57, -8617907014714.200195, -583022086.598419, 1, 'binary.EhUOJdpDsZWYyyDDATpW', 'nchar.河北省琳市城东六盘水路z座 798939', 1630000000070)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631035000000, 502477321, -3940198187319461410, -590, -122, 11555.763461, 3.474600, 0, 'binary.iufgzJsvjLKSoGJGBiLS', 'nchar.黑龙江省佛山市大东兰州街G座 694559', 1630000000069)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631050000000, -1001974902, 6450834421987986410, 3297, 112, -8092802.381089, -13006311.799326, 0, 'binary.ELgeHxhmjoFyFgkFXZui', 'nchar.贵州省阜新县高明永安路M座 392539', 1630000000070)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000000, -1991708456, -864737276653013043, -1035, 104, -621.411878, 358.192500, 0, 'binary.dzcYxzyOZMYgtByHiDTc', 'nchar.重庆市上海县东丽崔街N座 481064', 1630000000070)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631049999999, 1210716085, 5098727175987952663, 14612, 99, 122287663.454320, 1915439.569884, 1, 'binary.xPKETDcCdbWtoYoUCgre', 'nchar.甘肃省晨县上街龚路E座 215933', 1630000000070)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000000, 372703643, 5265014540357675070, 11084, 4, 955.287790, -677466762016.219971, 1, 'binary.TyniuJCZqfeldsiTGmnn', 'nchar.四川省济南市六枝特尚路V座 872192', 1630000000070)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000001, -1186882087, -6843278012193945664, -21562, -48, -73364783.992379, -8374993150.154530, 1, 'binary.HVKExGKBzdrjjQbKdgim', 'nchar.四川省通辽县西夏秦路J座 522373', 1630000000071)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000001, -1513635853, -4943689304527658905, -26256, -17, -157022486.675383, 47593146446.323402, 1, 'binary.xmsafXeSTguAIwMoWsSm', 'nchar.陕西省哈尔滨市大东辛集路G座 719181', 1630000000071)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631050000000, -2096895302, 2527287882879318478, -11906, 39, -2092909636.574400, 832609111532.883057, 0, 'binary.DpAgGGDNkTqeFPziAoZv', 'nchar.重庆市旭县翔安杨街N座 500333', 1630000000070)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631065000000, -607426580, 480106595535647664, -14319, 71, 485500665.146682, -7157.602006, 0, 'binary.NuToHMvRscGxwMENZqOS', 'nchar.贵州省秀荣县璧山申路Y座 936410', 1630000000071)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000000, -1266376029, 7399492335983317341, 21772, -21, 3959426326750.160156, 4299575.449645, 0, 'binary.sdhZOekTsIiwOYFEShct', 'nchar.重庆市大冶县友好长沙街T座 325982', 1630000000071)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631064999999, 1209625354, 8611086034262933876, 7159, 57, 66305514.987262, -249576.528082, 1, 'binary.xDqLioOjrUudmVTRaKmP', 'nchar.广东省海门市魏都北京街t座 626317', 1630000000071)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000000, 423864530, 7171258036520933259, 5585, 41, -9923192491285.410156, 9.901365, 1, 'binary.JiryCLzxGYRamjkLmMDH', 'nchar.江西省澳门县新城重庆路b座 208813', 1630000000071)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000001, -1049869765, -6885754556853202467, -6460, -118, -883111.347273, 654352667.175980, 1, 'binary.ZcJrqAQpBfTRFJupVZDH', 'nchar.陕西省雪县长寿淮安街o座 362739', 1630000000072)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000001, -1239790498, -4444805752431922421, -28574, -70, -70077.276971, -76046.699605, 1, 'binary.mCAmZahnycvOkwVDVpgV', 'nchar.辽宁省上海市合川赵路q座 784249', 1630000000072)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631065000000, -1048465520, -2935190573459597102, 21673, 87, -2585566.109742, -2007.606237, 0, 'binary.HNslYqKBtmSuAbsFzwKj', 'nchar.山西省莉市海陵昆明路t座 518218', 1630000000071)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 630458653, 711094046704512569, -30447, 17, 18100.228068, -28061872.208530, 0, 'binary.SrRBINnQSvdBTBKNGHFz', 'nchar.吉林省敏市高明尹街t座 876540', 1630000000072)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 1587008473, -497820597464002656, -14935, -92, -5426069.379042, -9834.237204, 0, 'binary.qRermCLWFAWnLBFapDsH', 'nchar.陕西省军县璧山石家庄街l座 337307', 1630000000072)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631079999999, 482971664, 4456457973181208346, 29811, 105, -2892240.803873, 28282444.178390, 1, 'binary.ZumfNrRUgHCXCqqjBwgX', 'nchar.安徽省宁德县南湖关岭街K座 983548', 1630000000072)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 1255752961, 4617338544672893130, 31384, 45, -3965.493491, -943974751.371172, 1, 'binary.xoiyGCRmWsgMFgfrdONj', 'nchar.内蒙古自治区鹏县南湖石家庄路E座 253529', 1630000000072)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000001, -1695698428, -671923235747543675, -26225, -99, -89596996493.199203, 53.155372, 1, 'binary.VzjkizbqoeqlOEtsqzTd', 'nchar.海南省台北市锡山长春街F座 321351', 1630000000073)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000001, -470196570, -1577429027012366617, -7829, -48, -39.524752, 51706491389416.898438, 1, 'binary.rOSrdNRJmYutBQkKnIvQ', 'nchar.辽宁省哈尔滨县上街南京街x座 664388', 1630000000073)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631080000000, 752187387, 5814377969189879673, -39, -37, -1240781.998722, -680710584267.488037, 0, 'binary.bFiODlLTjBvFimRGPEZH', 'nchar.上海市桂荣市高明张街U座 936978', 1630000000072)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631095000000, 1299240809, -3372032764175680697, 18966, 71, 284347227.242907, -129822972.670593, 0, 'binary.eqzlYcordfJQQJMBljjF', 'nchar.浙江省台北市大兴邯郸街l座 594497', 1630000000073)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000000, -601799850, -773012696448162526, -24255, 69, -85539.695742, 8483599308481.120117, 0, 'binary.fodqpEDidmdgTobhLwVp', 'nchar.江苏省秀荣县大东李路o座 709775', 1630000000073)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631094999999, 369111551, 4483914872861013771, 27035, 120, -61260954640579.898438, 5141985.329967, 1, 'binary.hBVqWjfnRCktdjBpGTYb', 'nchar.宁夏回族自治区六安市秀英哈尔滨街M座 426619', 1630000000073)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000000, 1544340960, 8517061698296926738, 16940, 119, -62221249203.984596, 7342075383114.320312, 1, 'binary.EbuTOcRDAAmBGOFvyfZO', 'nchar.宁夏回族自治区武汉县龙潭蔡路M座 210568', 1630000000073)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000001, -1324385506, -8127100560658016141, -3090, -49, 1019018870.899400, -86.370275, 1, 'binary.aBZiPEKTvPqdXPsDXgvy', 'nchar.云南省晨县山亭宜都路d座 616893', 1630000000074)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000001, -2055898711, -5445111939290776239, -31593, -49, -77345663240.806595, -914.503516, 1, 'binary.BSnRpSkSznADKblDKOiG', 'nchar.河南省凤兰市高明黄路M座 303020', 1630000000074)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631095000000, -943484549, 260761652713813572, -31076, 88, 886963.235930, -38250864.484145, 0, 'binary.qUWErZCBbTHzETMfuRMa', 'nchar.陕西省兴安盟市和平乌鲁木齐街w座 905284', 1630000000073)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631110000000, 1560015019, -6729804845934136099, 352, -115, 9316.130184, 220903.824895, 0, 'binary.fWtsEHhFIrXfqBGYlTNJ', 'nchar.海南省济南县白云李街S座 920870', 1630000000074)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000000, 600240137, -4687958607276237783, 31931, 50, 5721.825376, 570753990973.805054, 0, 'binary.utJxZlgPEdcqNAFObuFZ', 'nchar.广东省台北县普陀兴安盟街T座 505320', 1630000000074)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631109999999, 1370148713, 2682283741646434124, 21747, 108, -7336368856593.450195, -86249517.560025, 1, 'binary.ApKvhLsWkpRndmodhPEN', 'nchar.云南省雪梅县安次卢路J座 135754', 1630000000074)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000000, 656300451, 4206774300939189669, 24233, 69, 540899878.718127, 5.252156, 1, 'binary.TRvUgqDMiPmpDbTDQJIO', 'nchar.四川省香港县秀英关岭路Y座 839081', 1630000000074)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000001, -1440742963, -6981670779291616929, -17863, -118, 9339406547236.320312, -80509839.572484, 1, 'binary.nsuhquhIJtXKINhuhbZm', 'nchar.天津市齐齐哈尔县朝阳西宁路L座 393435', 1630000000075)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000001, -1680777424, -3789071286423645612, -29891, -91, -3687858.975654, 28786.604619, 1, 'binary.YfWaoxPFJKJagXhyEOmA', 'nchar.湖北省银川县崇文何路i座 475105', 1630000000075)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631110000000, -1095049119, -2038760289253362613, -4186, -124, 13304836.627667, 77695031812.673798, 0, 'binary.TEZgbSkvAdOPvsssvtOX', 'nchar.四川省鹏市东丽胡路Q座 963536', 1630000000074)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631125000000, -1618319757, 6350170596406303692, -28807, -17, -1265501669.731500, 757504.607632, 0, 'binary.xQXfGqKJJntmbtHJzqHc', 'nchar.吉林省重庆县南湖郑路E座 472846', 1630000000075)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000000, -2143880375, -2493359647253702127, 6606, 66, 404444.216865, -7014.675537, 0, 'binary.bPjaavfcVrQcVEYxUtAe', 'nchar.安徽省兰英市涪城王路f座 265166', 1630000000075)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631124999999, 1951461498, 4426546683527923406, 26976, 106, 861491.829361, -5937918253.865560, 1, 'binary.hZDumWlAzVpYfXkEaPlW', 'nchar.云南省重庆县清河陈路P座 522865', 1630000000075)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000000, 1219706153, 7536523458446532711, 5155, 120, -675841841.464953, 91755264081.884003, 1, 'binary.KsCtLZBdLUvbbTIKedAw', 'nchar.香港特别行政区永安县高坪南昌街L座 368651', 1630000000075)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000001, -1663211983, -3109525234509445099, -21222, -8, -21298956.340869, -9657.318325, 1, 'binary.wBVWJVLFoOdXTzTtRNuT', 'nchar.广西壮族自治区惠州市高明柳州路b座 545369', 1630000000076)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000001, -1810125590, -8421898795641820385, -4441, -89, -2734964221.741360, -37493460960.576599, 1, 'binary.yxiYtSxCJYuTTjLuCcLI', 'nchar.辽宁省太原市和平侯街i座 586968', 1630000000076)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631125000000, -1416386308, -7684571277090397009, 22278, -110, -31.162606, -776.531904, 0, 'binary.XYkmkoMHknNtlosmchSh', 'nchar.河北省郑州市花溪周路n座 600734', 1630000000075)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631140000000, 989052773, -5476387551687883714, -11570, 127, -37404372.212454, 42699806.700508, 0, 'binary.SifrNRSsBKcJKDqsnfXN', 'nchar.云南省拉萨县高港张路n座 873322', 1630000000076)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000000, 90148890, -9176843805101255090, 7217, -69, 7747.651553, 246706074.781856, 0, 'binary.iuKZktHzJRwchXDkGhbL', 'nchar.河北省娟县高港汕尾路p座 635670', 1630000000076)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631139999999, 2092906691, 5816259342140952837, 27223, 3, -21145.797856, 39546630288.518501, 1, 'binary.hLAAdJsauemmUBKhTtqW', 'nchar.江西省沈阳市海陵周路O座 413415', 1630000000076)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000000, 1419713973, 818822617965851283, 32245, 47, 92022664.783976, 3311483.287128, 1, 'binary.yfRnxroKprvGvOyoTlEh', 'nchar.广东省辛集县萧山西安路M座 462571', 1630000000076)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000001, -2137737633, -3177008163567761597, -29189, -74, 548693287695.377014, 72371.674202, 1, 'binary.wRfxAxVfEcdfKteGLuaX', 'nchar.内蒙古自治区淮安县普陀杨街A座 734889', 1630000000077)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000001, -1023034969, -7642623044713882631, -13299, -59, 3279504.422480, 6716289645.631150, 1, 'binary.vlQPmKsSiqtoGCixEBsV', 'nchar.广西壮族自治区晶市上街宁德街B座 609891', 1630000000077)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631140000000, -30379416, 1958421706180608853, 1892, -29, 4674012.774896, -21398530385.866001, 0, 'binary.pxvGQUheUZkqNsxiAZuT', 'nchar.澳门特别行政区倩县房山杨街U座 114062', 1630000000076)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631155000000, -1117272908, 752098947372767902, -2819, -56, -9085630.993944, -6895774866846.309570, 0, 'binary.HlxBvTuGkChJDLzDaxyu', 'nchar.陕西省昆明县龙潭周街D座 817221', 1630000000077)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000000, 2086908228, -5781823409166665769, -3324, 9, -3.671731, 50135208435.527000, 0, 'binary.UWkIRXVdPsZxZFVaWBtS', 'nchar.湖南省郑州县清城古路B座 982490', 1630000000077)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631154999999, 870002160, 4167669984685102889, 30468, 115, 641517032220.147949, 2742.639429, 1, 'binary.JCROwpmJQkPqZkIzrRkU', 'nchar.江西省静市黄浦潜江路B座 249825', 1630000000077)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000000, 1396830896, 8133688472099187160, 22272, 75, -4524332410799.129883, -35663261.321445, 1, 'binary.kOEOFvSdtLEFJlgywaSJ', 'nchar.河南省英市长寿汪街E座 114327', 1630000000077)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000001, -837033747, -5283148083077494740, -1260, -39, 565321.239314, 275.746366, 1, 'binary.YKouegacQvxoSSgTaPrv', 'nchar.安徽省淑兰市新城李路r座 256922', 1630000000078)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000001, -1906954896, -5724786982458123670, -1426, -24, 299922.459639, -1285.219883, 1, 'binary.ZqHGrayEGFBlDHVAObSZ', 'nchar.甘肃省桂芝市金平武街X座 777677', 1630000000078)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631155000000, 745556057, 516983514584470898, -12904, -49, -716006320.556210, -218.138046, 0, 'binary.ZJBaxSKndLZrHVRppYnT', 'nchar.广西壮族自治区梧州县秀英甘街b座 779502', 1630000000077)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631170000000, 2139488417, 6066602372775042425, -1518, 84, -80581942.592809, -37314203203.592003, 0, 'binary.yymGCDKbqZkixkIjIIGT', 'nchar.湖北省荆门市和平淮安路J座 884655', 1630000000078)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000000, -374714905, -7736740878366341122, -14276, -79, -64248.970229, -68011884269.584396, 0, 'binary.hMgGBmPqKYkzsArGfbxQ', 'nchar.新疆维吾尔自治区沈阳县城东齐齐哈尔街b座 794676', 1630000000078)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631169999999, 1397781824, 6557161155035163362, 11749, 37, -3.906174, -1.651866, 1, 'binary.hwfhcmJDDTvQaCRmlKCd', 'nchar.江西省玉华市长寿梁路o座 261941', 1630000000078)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000000, 1387979869, 2661199544340098486, 9621, 49, 166489205686.515015, -7163639.756925, 1, 'binary.atyzvvxverSTvukiOHRc', 'nchar.澳门特别行政区琳县南长深圳街L座 927560', 1630000000078)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000001, -1573224659, -6074816603000302535, -28617, -101, 26624788159.678699, 62.218691, 1, 'binary.QpcyRVyxqqnHSSLxWCdz', 'nchar.台湾省荆门市和平关岭街w座 554552', 1630000000079)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000001, -613007188, -2265367830140686655, -30242, -74, 132051246084.664993, 9583075.585374, 1, 'binary.ZwGExMXBaZQnYGUqOZnk', 'nchar.贵州省天津市龙潭吴街P座 514026', 1630000000079)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631170000000, -229811940, -4723474584235949728, -30413, -126, -37.161630, 6566121399.880410, 0, 'binary.QKZaMSaDgNKbuVjVXVZX', 'nchar.湖北省超市友好南宁街b座 387820', 1630000000078)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631185000000, -1462514908, 6815473990049018903, 26765, -60, 8053251416.958930, -94687.447387, 0, 'binary.gMqqCIzQCNGNgbSwolZX', 'nchar.山西省春梅市魏都张街I座 216775', 1630000000079)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000000, -1558957537, -3515355671345392932, 32525, 83, -873729.459053, -4948145879174.500000, 0, 'binary.eHTWpPQVAzoRsZXjDHro', 'nchar.内蒙古自治区雪梅市西夏广州路T座 462974', 1630000000079)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631184999999, 1354974803, 4535068117623812145, 15974, 126, -3641262362.474420, -215837.649412, 1, 'binary.mgwWzOiTRoTHUbvzEMSm', 'nchar.宁夏回族自治区欣县东丽南昌街a座 409781', 1630000000079)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000000, 909020116, 7166005914556535033, 14716, 26, 50294221.576123, 67159744502236.203125, 1, 'binary.aHafHhYbmjwnjfaDKjaV', 'nchar.天津市马鞍山县南溪宜都路W座 812458', 1630000000079)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000001, -1306330996, -7521905733671260635, -1, -23, -651220.365910, 209.745394, 1, 'binary.xazZjdXNjaykPYfDWhos', 'nchar.广西壮族自治区慧县南溪李路n座 595049', 1630000000080)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000001, -829584454, -6819959797009261424, -30794, -119, -2545863021084.839844, 48573662965.169998, 1, 'binary.RQfCFnyRhVGAwoZKbfBg', 'nchar.江西省畅市大兴呼和浩特路N座 966282', 1630000000080)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631185000000, 159441443, 3829890051273914786, 22074, -46, -0.126559, -59066.623155, 0, 'binary.sCHQwHDxsHrpfheUsPvS', 'nchar.甘肃省婷婷市和平林街X座 967902', 1630000000079)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631200000000, -1984142506, 918572017792917031, -20270, -51, 7172084337794.419922, -67689618090033.000000, 0, 'binary.pfhSySLjKZbOfIPTmqAB', 'nchar.宁夏回族自治区亮县牧野石家庄路L座 408034', 1630000000080)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000000, -1972988665, -3214499273794963694, 3010, 42, -8898.495820, -7139.318526, 0, 'binary.ivdrcXkAeWkscdYzZJEe', 'nchar.浙江省瑞县海港永安街R座 494785', 1630000000080)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631199999999, 1089140558, 5653452583897077783, 8528, 7, -9816158771686.500000, -30.580967, 1, 'binary.tqyfrLsfYAZeSvFCwYXQ', 'nchar.安徽省倩市梁平广州路E座 417291', 1630000000080)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000000, 1752602476, 8379644292871336124, 1479, 55, 0.152144, 8340466.258810, 1, 'binary.CaqLbGdnvyvDGmnqAdwA', 'nchar.宁夏回族自治区兰英县滨城董街m座 612134', 1630000000080)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000001, -2070609011, -3927356551694226099, -14160, -96, -489939465270.245972, -176.619265, 1, 'binary.HtBovhAaClqmUKDVoPoA', 'nchar.西藏自治区兴城市西峰李街O座 294081', 1630000000081)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000001, -507025125, -6769707689103886410, -26670, -62, 7.854748, 91216299872.798492, 1, 'binary.kVTRaSjNPeaJAGYzWqVF', 'nchar.山西省邯郸县六枝特袁街q座 379922', 1630000000081)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631200000000, -91932554, -8911762384559779952, -12134, 114, 8455.888482, 192830806126.287994, 0, 'binary.UmxEgaxmRlsWpDOOjGns', 'nchar.安徽省秀云县金平亢街Z座 413285', 1630000000080)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631215000000, -2106211575, 4343732691913651727, 30695, -65, -1182138766033.570068, -1420143959702.800049, 0, 'binary.lENnnzItGfhHBhuBSKkg', 'nchar.宁夏回族自治区淮安市大东章街Z座 522024', 1630000000081)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000000, -1514266386, -1557718503233026241, -10740, -93, -3712.656749, 628.936406, 0, 'binary.KCtPSzikgeatarBhSEXT', 'nchar.安徽省莹县淄川石家庄街i座 428331', 1630000000081)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631214999999, 243460896, 1867078685154320423, 13109, 8, 2562.515572, -8164811617493.440430, 1, 'binary.GwEkcVzBVjqKKvBBYCHl', 'nchar.广西壮族自治区邯郸县门头沟兰州街l座 647959', 1630000000081)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000000, 669742703, 3588783546529218834, 10833, 6, -408721127673.909973, 801103747.542088, 1, 'binary.uwFahDnlWanEVobNZkCM', 'nchar.甘肃省张家港县白云罗路f座 137164', 1630000000081)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000001, -442417658, -7549129289634916853, -2159, -58, -98911613476.491501, -874.865816, 1, 'binary.aMVpynzemnksvKTWGcDC', 'nchar.吉林省建国市牧野钟街E座 377779', 1630000000082)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000001, -1409923779, -8427760215446628026, -18353, -47, -50606823244.468002, -345539443425.945007, 1, 'binary.cugznUahvcPVWaAAckbf', 'nchar.海南省宁市合川宜都街o座 305915', 1630000000082)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631215000000, -1342274642, -8536170080112789400, 30067, 115, 12581450912.783600, -291.972491, 0, 'binary.eOcZzgBgRRIVelvjVeto', 'nchar.澳门特别行政区欢县高坪广州路N座 593765', 1630000000081)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631230000000, -456444500, -653943768841413221, -16654, 115, -74554935958741.203125, 7070430643.419100, 0, 'binary.zrOBefSbOEUgRLtVobMw', 'nchar.北京市璐市东城太原路Z座 165710', 1630000000082)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000000, 1112822860, 8809469361686033607, -22243, 84, 718004818.589884, 836.474427, 0, 'binary.cLnnuHpDQIMfMBODNYpW', 'nchar.青海省广州市房山阜新路h座 898094', 1630000000082)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631229999999, 993462171, 7980976104707598817, 22906, 119, -90532577531185.000000, 2883997.534517, 1, 'binary.akkJQvtKVOUMeEJdtLWQ', 'nchar.辽宁省西安市魏都长沙路q座 830446', 1630000000082)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000000, 659535811, 6648102677976806439, 14934, 106, 8.999744, -78105262.595693, 1, 'binary.RBWgiabXuPgAeanvsJoE', 'nchar.香港特别行政区倩县长寿王路D座 334836', 1630000000082)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000001, -1147877996, -6106212901363852731, -30865, -72, 9390.844553, -7383783838166.849609, 1, 'binary.UsylaHHTjnwUCmWOFRop', 'nchar.新疆维吾尔自治区齐齐哈尔市海港南昌路q座 642772', 1630000000083)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000001, -8588768, -7260337404461154045, -21386, -116, 46305041.132235, 6654257695.256100, 1, 'binary.SneLCpCrEbSFqlWIVLwu', 'nchar.陕西省欢县花溪荆门路T座 249790', 1630000000083)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631230000000, 1003481306, 6017067765177374344, -16218, 60, 82.649494, -712.838445, 0, 'binary.qLRxDlzDPjVVbRZHOADr', 'nchar.河北省畅县徐汇大冶街D座 822863', 1630000000082)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631245000000, -294434895, 1924629096591118432, 17988, -44, -63587509.905294, -40747153.224679, 0, 'binary.olALLZcgYbqmLLsQAfvv', 'nchar.云南省强市淄川淮安路c座 262889', 1630000000083)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000000, 738129131, 1815388765763244472, -6405, -93, 52.721010, 216.728740, 0, 'binary.yxHFbosrzvHvxaTBUoNe', 'nchar.浙江省福州县梁平嘉禾街i座 170922', 1630000000083)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631244999999, 224419688, 3680471494276801590, 18367, 87, -74383724488933.593750, 0.593016, 1, 'binary.FsYcmhXFIVEwuCmapLFd', 'nchar.青海省合肥市清浦辽阳路I座 165564', 1630000000083)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000000, 54658682, 2220380251657075236, 12017, 72, -2409.191361, 16465604801985.900391, 1, 'binary.WVLQqvEMPTlqXptHGBTA', 'nchar.陕西省桂珍县魏都陆路z座 653467', 1630000000083)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000001, -111362062, -2079998725394443456, -14043, -83, -8050700.333128, -786.595631, 1, 'binary.wugzMLvmLdkxesgmixOH', 'nchar.安徽省南京县清城柳州路Q座 634494', 1630000000084)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000001, -646454407, -7621015329762251852, -32454, -96, 58254987.947866, -86.835965, 1, 'binary.nUZjCcyTPHcAJQjyqiKW', 'nchar.河北省嘉禾市锡山张街F座 809458', 1630000000084)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631245000000, 1630911956, 9008151774496407995, 3422, 97, 1410480123999.199951, -40614657267267.296875, 0, 'binary.kaWyIWeHVgVeCBWtXjos', 'nchar.青海省婷婷市和平黄街G座 571553', 1630000000083)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631260000000, 1229299947, -3222073200735135026, -25377, -68, 76060893505437.296875, 79056750996157.000000, 0, 'binary.TIeullzMmPeJOEDzERVs', 'nchar.内蒙古自治区长春市普陀通辽路R座 260095', 1630000000084)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000000, -1829114311, 192679604105772908, 25050, 51, 429584494.456619, -7710.519461, 0, 'binary.sxkAVzIUJGdjrEKTWivG', 'nchar.重庆市帅县南湖长沙街T座 169523', 1630000000084)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631259999999, 2133083813, 7400378387863708089, 15500, 29, 483042885.250631, -4018.354623, 1, 'binary.buDeWRmTqpbBhNKoIWjt', 'nchar.天津市婷县新城呼和浩特街Z座 481098', 1630000000084)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000000, 2102189676, 8289210275637280206, 12319, 12, 2360.126260, -0.783536, 1, 'binary.zkocBZqDNaubCdBsYlZK', 'nchar.河南省潜江县吉区邱路R座 988052', 1630000000084)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000001, -88622269, -8452436543600128194, -14877, -107, 2.227830, -896.432470, 1, 'binary.fgqZcQmlErAwLKYvDwkA', 'nchar.福建省嘉禾县城北汕尾街S座 162248', 1630000000085)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000001, -603730496, -5142204606726944282, -6542, -22, -701.644082, -75915023637.720001, 1, 'binary.JtkfvmLGOlQzBtNKysLt', 'nchar.云南省沈阳县高港李路S座 869342', 1630000000085)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631260000000, 2144837535, 6790333755067852306, 29522, -5, -5292215263549.620117, 9659.226553, 0, 'binary.ZtAHxvlbFZNbmkaMfRDe', 'nchar.台湾省大冶市吉区石家庄街O座 527169', 1630000000084)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 1290141025, -2143848369719800423, 7189, 8, -822375762195.462036, 20283811003.944000, 0, 'binary.loHjtwzgyvJksRhJNiQS', 'nchar.河北省佳县徐汇刘路G座 705107', 1630000000085)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 801182958, -7572521914234103164, 4604, 107, -859019.418204, -261693048307.811005, 0, 'binary.YAcVYbiCpwSqCdWIgbBo', 'nchar.上海市武汉县闵行杨街a座 347736', 1630000000085)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631274999999, 521859506, 3602105093569999375, 21665, 21, 9019367.551508, 532663957703.719971, 1, 'binary.NgxLslBkOvvWWVcDCUlC', 'nchar.海南省哈尔滨市翔安沈阳路r座 486389', 1630000000085)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 1634351470, 1549009549596999035, 26284, 69, -2.961951, -6310787053.197710, 1, 'binary.AERkUPEHGySISfgqulEw', 'nchar.台湾省西安市双滦深圳路R座 706492', 1630000000085)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000001, -1577694201, -8482950364465928222, -19741, -105, 351508461253.127991, -28134084860.892399, 1, 'binary.zgfPMXusJGeFxLLImITl', 'nchar.黑龙江省红梅县吉区嘉禾路Y座 870326', 1630000000086)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000001, -1817845693, -2298814801521952311, -14645, -83, 223713055.105098, -75532242.499559, 1, 'binary.flJqybaXNWGYZTymaTJG', 'nchar.江西省淑珍市平山周街Y座 953199', 1630000000086)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631275000000, 632609765, 4219748384315739773, -26000, 71, -450862164529.280029, 14560508342304.800781, 0, 'binary.ZHQyoqVmbWNpweggaXDK', 'nchar.宁夏回族自治区辛集市城北辽阳路N座 240842', 1630000000085)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631290000000, -770991939, 5485773724851375125, 23994, -64, 623888353027.609009, -55981854.579338, 0, 'binary.QKhLWpoMPsfwyQYNoPZA', 'nchar.上海市玲县普陀龚街p座 566117', 1630000000086)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000000, -793126068, 2224199903529481270, 6843, 106, 99682310978838.093750, 467505798786.474976, 0, 'binary.HmkxkSqBoJJStxYjyvrz', 'nchar.天津市志强市沙市雷路g座 547769', 1630000000086)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631289999999, 896685945, 4158350015273846866, 26730, 53, -6200015073790.200195, 12566017.333818, 1, 'binary.NEkCzZWDoXmvngPlArSM', 'nchar.天津市海口市魏都黄街O座 679546', 1630000000086)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000000, 832269201, 4123871706026762985, 13927, 88, 499.930604, -70366099857.880005, 1, 'binary.mADUJbHlBrbziiXvrWeZ', 'nchar.云南省惠州市沙市海口路c座 131412', 1630000000086)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000001, -102246541, -3324596924342719960, -3905, -96, -4816.768188, 93915714.748034, 1, 'binary.qiNYdNPnHVKQBpzXATmm', 'nchar.河南省呼和浩特市清浦广州路g座 216441', 1630000000087)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000001, -282159644, -7801886583063959893, -15115, -96, -7.823940, -2620.949488, 1, 'binary.GzTEiirhkGvJXbGkiPrq', 'nchar.香港特别行政区玉珍市朝阳刘街r座 939747', 1630000000087)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631290000000, -669399368, 5115472553771177504, 12526, 91, -28942186887.971001, -6.435703, 0, 'binary.XIZFOElmYhlMyQRewDCt', 'nchar.甘肃省乌鲁木齐市西夏贵阳路T座 579190', 1630000000086)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 262080824, 8383920960732834455, 13968, -34, -45.211929, -1300.277717, 0, 'binary.hIMCRvrXPAOVpFRmYnUy', 'nchar.江西省北镇市双滦刘街W座 798066', 1630000000087)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 2114811730, -1509702226741249727, -13264, 72, 2.150671, 5261316406.519730, 0, 'binary.FtIdbPhtUPjIuTSbpJQq', 'nchar.新疆维吾尔自治区沈阳县锡山林路M座 892641', 1630000000087)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631304999999, 2143525047, 6899945126249773541, 26738, 102, -292.795385, 138207363422.498993, 1, 'binary.eIPLVCyRogBRyzGbrFic', 'nchar.辽宁省福州县长寿杨路z座 941701', 1630000000087)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 1073200557, 807774567632061607, 29517, 113, 67931.421812, -1651664.861578, 1, 'binary.UyFmxxBiWhvpNXabSZxN', 'nchar.天津市斌市普陀哈尔滨路P座 502633', 1630000000087)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000001, -489200958, -5831038164958816606, -16406, -76, -6392689.485758, 3750666.814934, 1, 'binary.bCLmDBrnkgDcXvcwrBqA', 'nchar.甘肃省哈尔滨市吉区苏街y座 407071', 1630000000088)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000001, -2127347634, -4083644771875265580, -20817, -30, -3.785714, 681029605720.448975, 1, 'binary.GcWganOJXCPvFeMQZTYJ', 'nchar.黑龙江省丽丽县高港长春路v座 665579', 1630000000088)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631305000000, 1527621467, -7509002110121261571, -26325, 32, 3.577428, 5008201901846.370117, 0, 'binary.mFsrNoKYqMYXhFEIfVXS', 'nchar.山西省梅市南湖合肥路w座 573200', 1630000000087)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631320000000, -493256377, -8751737434302823435, -27869, -96, 330393978255.500000, 94835651689763.000000, 0, 'binary.PqdASxtDLyeIFzBiaFGV', 'nchar.湖南省关岭市双滦武路o座 527508', 1630000000088)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000000, -2087366027, -6303077694275632802, -15261, -89, 43362171018304.000000, -166690.281684, 0, 'binary.zPrdaJdDKwcSHuAxtOlS', 'nchar.澳门特别行政区超市高港刘街N座 420236', 1630000000088)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631319999999, 1129994268, 1552944233564611739, 10242, 108, 562740269.814683, -48475927235174.601562, 1, 'binary.rqJyBwQmuzFVARUJRgKb', 'nchar.山西省巢湖县西夏沈阳街S座 255735', 1630000000088)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000000, 2063639050, 2521461528938336565, 2345, 89, -6038709960145.540039, 24451.395881, 1, 'binary.iSmMBujSmVtayVzDoWgG', 'nchar.内蒙古自治区桂香市吉区潘路v座 620160', 1630000000088)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000001, -1449143866, -6390394742281036218, -100, -33, -120.220087, 109963155461.466003, 1, 'binary.fPxCvZJXReoaPBmALmPQ', 'nchar.内蒙古自治区婷市兴山冯路h座 570428', 1630000000089)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000001, -1895163787, -1867618456195867046, -5071, -105, -1871044419105.310059, 443341008.795331, 1, 'binary.tMibvAJACwmXDYSGDcNH', 'nchar.贵州省兵市静安黄街O座 248304', 1630000000089)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631320000000, -1870734956, 5919383249914923168, 25989, 91, -1.395899, -450627922362.231995, 0, 'binary.rCKozKCilrDzhrinGzhJ', 'nchar.江西省楠县闵行银川路V座 237404', 1630000000088)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631335000000, 408968903, -8367166343934446562, -19738, 15, 854582448833.431030, -9969.161351, 0, 'binary.GLyIXkgZbApVCOoVSqaO', 'nchar.江苏省香港县黄浦淮安街D座 525365', 1630000000089)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000000, -1122322355, 8412393600271974612, -23315, 95, -68174012.309009, 15387044.711345, 0, 'binary.MGjySGAlYDujClbZejIQ', 'nchar.安徽省邯郸市城东大冶路G座 360663', 1630000000089)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631334999999, 2026186883, 445653452435547622, 18307, 49, 213343.543679, -4.739704, 1, 'binary.fOSZlDCKdxiQaysyscfx', 'nchar.江西省雷市花溪陈街B座 320678', 1630000000089)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000000, 507343304, 7297664243660949047, 12008, 109, -531.925870, 1673114199.854260, 1, 'binary.cTljYtBXIOAsDXqDTlMd', 'nchar.广西壮族自治区帅市崇文王街u座 771522', 1630000000089)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000001, -2001883206, -817341878022425389, -2161, -42, 9.708559, -53706854436.695000, 1, 'binary.IUNzHoyqCMDBQckAVEQz', 'nchar.四川省宇县城东淮安街C座 920078', 1630000000090)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000001, -1408747533, -4778697158136936011, -27, -101, 47621.171490, 3290528001686.430176, 1, 'binary.vyTXYeaTyzhYwNCQiJrW', 'nchar.广西壮族自治区秀芳县大兴天津路H座 858644', 1630000000090)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631335000000, -1227268662, 4866318703531659868, 8057, -67, 1812966973.800030, 6.738090, 0, 'binary.EMfIIquLTRUJOViCbaXD', 'nchar.河北省长春县翔安禹路f座 740911', 1630000000089)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631350000000, 29364546, 7439453869072957110, 3379, 93, 55692580455.865402, 25451.386688, 0, 'binary.SOQDYnfDtUghMpNrrrvd', 'nchar.吉林省玉梅市清城大冶街w座 657754', 1630000000090)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000000, -1512569467, -2170613746493368276, -9226, 86, 94917216138828.500000, 45.344859, 0, 'binary.osdODKgoqrkMjsUQuBxO', 'nchar.湖南省华县山亭赵街o座 343015', 1630000000090)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631349999999, 341004545, 1678452718654659972, 11982, 53, 647268193.946854, -9.321045, 1, 'binary.PlQgjTLDuHwIfIkGmfIq', 'nchar.江苏省长沙市门头沟秦路m座 511307', 1630000000090)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000000, 1022164581, 8771702396738754711, 1690, 106, -2055.312055, 363.845057, 1, 'binary.QVYMJaQkcoJnLdYFnwsS', 'nchar.台湾省西宁市南长郑州路f座 795021', 1630000000090)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000001, -2139193188, -4423061215457882616, -22771, -31, 492.888005, 22942151260.387100, 1, 'binary.LSzPYUKvvRlNrhoKoYkL', 'nchar.天津市静县浔阳济南路G座 357460', 1630000000091)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000001, -1786702987, -5274362232731441209, -16394, -43, 237512315596.303986, -558.984176, 1, 'binary.onBwaQpiFBImnuhjravU', 'nchar.河南省雪市淄川王街Y座 875679', 1630000000091)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631350000000, -1431645289, -6529328401317482981, 9944, -97, 279578438.723650, -79899714.177569, 0, 'binary.ZhbLqmODnxwYrimmIigl', 'nchar.北京市大冶市怀柔刘街t座 692168', 1630000000090)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631365000000, 568429328, -9060392884809893816, 28469, 61, 307437180734.507019, -21602647797.441101, 0, 'binary.IGDZBmjwYmOzJaUbkiKN', 'nchar.福建省兴城市兴山巢湖路P座 743092', 1630000000091)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000000, -1550415271, -7558411265476450633, -26998, -58, 1694624.435305, -47865257382.732803, 0, 'binary.JhBLpAPozgqCVUQnONkT', 'nchar.黑龙江省秀云县清城白路q座 555712', 1630000000091)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631364999999, 2050068224, 8869318186483878987, 18135, 56, -324240012.550862, 139208652187.634003, 1, 'binary.fzVzLhgOcjBWiooIbfZy', 'nchar.西藏自治区太原市长寿西宁路h座 862819', 1630000000091)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000000, 5839085, 4176280397163068047, 4608, 4, 683.468225, 4674219497.311910, 1, 'binary.YBbSDgHLgpNnIYBAiMnd', 'nchar.广东省欣县沙市惠州街I座 803450', 1630000000091)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000001, -1606114187, -8492599008143584602, -21024, -58, 977.510976, -2962257.665275, 1, 'binary.DQLAjLojVsSPrXVqoaFU', 'nchar.江苏省建国市涪城兰州路k座 224858', 1630000000092)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000001, -1085786582, -7556940745324501035, -214, 0, 85978773227.734802, 3688136776873.470215, 1, 'binary.LsObIWxTJIHqdNcQniXu', 'nchar.贵州省小红市西夏林路J座 503400', 1630000000092)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631365000000, -486512987, -1848007965784118332, 20641, 39, 7524.727066, 43002.993255, 0, 'binary.JtdWjkAwXwWmNqghjGgR', 'nchar.江苏省福州县萧山李路l座 332686', 1630000000091)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631380000000, 1015255006, -6233642644171313082, -30770, 103, -52871950.517558, -203.631390, 0, 'binary.dcFQefENHBmSbWfsxkNZ', 'nchar.吉林省凤兰县大兴李路j座 146250', 1630000000092)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000000, -1944800483, 2662387305551873341, -32553, -7, 49980.865995, -377372259.892400, 0, 'binary.EWzwpfuElPwODlQeSUsg', 'nchar.湖北省荆门县闵行永安街F座 378209', 1630000000092)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631379999999, 869226799, 2896504572324576563, 949, 78, 3067118231.817550, 5.678553, 1, 'binary.thrXsOuUUQEwGkXiZqVD', 'nchar.香港特别行政区荆门市高港天津街K座 250023', 1630000000092)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000000, 323027847, 2827349391284089242, 1441, 44, -17278.296831, 78816030.490657, 1, 'binary.YZbYVJvcLQeMTfNdLJhv', 'nchar.贵州省淑珍县永川辽阳街g座 249023', 1630000000092)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000001, -2127572203, -4937514564787173908, -63, -76, -123946739.447527, 698804470.690330, 1, 'binary.MtiGMwxbCoGxBrSCfmnb', 'nchar.广东省齐齐哈尔县梁平关岭路t座 761348', 1630000000093)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000001, -1306426634, -4986879132935813626, -28229, -23, 39146958063046.203125, 87460954188.246506, 1, 'binary.SZAYkmBTuWBkLyHMsNln', 'nchar.辽宁省荣市浔阳马鞍山街h座 139222', 1630000000093)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631380000000, -24693354, -7179764382339676335, -4810, 42, 49617345.815346, -40955896779.561096, 0, 'binary.AOTdejxaZWZTeWiSQccI', 'nchar.湖南省呼和浩特市南长东莞路Q座 526334', 1630000000092)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631395000000, 110327094, -7171919345203251134, 10385, 50, -88221.924084, -14499963.327697, 0, 'binary.jBWuQXhwybyeWaUeuiCo', 'nchar.河北省深圳县城北昆明路h座 627103', 1630000000093)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000000, 1589122997, 4808726552373126087, 13356, -88, -777.180511, -5649.819038, 0, 'binary.PLvgyyFexDVwuXPcgOUJ', 'nchar.广东省璐市梁平石街p座 625686', 1630000000093)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631394999999, 415752279, 5607734497564153556, 28120, 114, -758865393.966240, 2879.590758, 1, 'binary.pNjKEKLwWZUgNZshphnH', 'nchar.新疆维吾尔自治区海门市萧山潜江路N座 450879', 1630000000093)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000000, 1725928224, 406982977976053694, 31934, 55, 2365333426653.399902, 52689398.325206, 1, 'binary.tODfUdiMrapEBaRDyjTC', 'nchar.甘肃省旭县六枝特陈路k座 228235', 1630000000093)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000001, -1943166726, -461080508996818206, -3563, -103, -984164002.302936, 3328600.852324, 1, 'binary.hSqhMEcJIhZRmIFrQDKl', 'nchar.江苏省桂荣县大东宜都街q座 375062', 1630000000094)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000001, -965688414, -4532230014607129716, -32045, -103, -8.400039, -554153162149.166016, 1, 'binary.ZQVXUVCHEOWxAjlnoSEK', 'nchar.吉林省通辽县璧山龙路l座 482360', 1630000000094)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631395000000, -306891211, -3703573295039531167, 6006, 86, 226610060352.789001, -47040211.883215, 0, 'binary.BJYBsZjtDafCchXYbpRr', 'nchar.台湾省哈尔滨县翔安惠州街U座 837583', 1630000000093)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 1886325467, -3863586930565866233, 8904, 38, -946832.388950, 55.658536, 0, 'binary.QSJUCkzpJcOiAmsyKmUs', 'nchar.云南省宁德市高港东莞街N座 505827', 1630000000094)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 1857465087, -4382581587636034119, 23552, -18, -13.792084, 829139755.682817, 0, 'binary.ljHNBjHCmNlXXVTnknxH', 'nchar.四川省北京县华龙济南街x座 750613', 1630000000094)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631409999999, 1895012884, 2424275775986822787, 22179, 90, -0.394803, -56.575361, 1, 'binary.KBNSdgumJOCWoMmWtLJU', 'nchar.江苏省静县秀英太原路S座 251913', 1630000000094)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 1569144121, 5640124213375907439, 8815, 5, 257555.261048, 48254141.237573, 1, 'binary.KKozUPJSMbzhEyunifsH', 'nchar.湖南省伟县萧山萧街k座 474899', 1630000000094)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000001, -1384685953, -2320337996509410200, -15795, -10, -98.406889, 42984.674970, 1, 'binary.orjVZeKJsgJsTEqHljkf', 'nchar.海南省建华县沈北新林街g座 586911', 1630000000095)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000001, -1012235418, -8338932088221751208, -8979, -127, -25798805.860955, -48091893253761.101562, 1, 'binary.XDTOObdfDUqcGtXWVONC', 'nchar.浙江省柳市双滦鲍路a座 506391', 1630000000095)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631410000000, 726812223, 8571870874380055515, 22786, -83, 942970127.407073, 52.995631, 0, 'binary.xgcSGhNrZOWGKZtOlArO', 'nchar.宁夏回族自治区丽华县蓟州深圳路K座 592080', 1630000000094)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631425000000, 2071766507, 1772340392886850115, -24057, 25, 78.445247, -79637.635931, 0, 'binary.sROneWSFNuXBalpsjyEo', 'nchar.安徽省广州市孝南刘路b座 713687', 1630000000095)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000000, 1087816300, 5318228817994763162, -27394, -31, 267905.242469, 8213154732519.320312, 0, 'binary.imZeNtwoLVXCQJPFObQE', 'nchar.山西省沈阳县高港长沙街F座 461428', 1630000000095)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631424999999, 2108909701, 7807744131165483728, 13566, 88, 6.922028, -9.200773, 1, 'binary.vYUalkfScnQyDPeEqCTq', 'nchar.江苏省太原市华龙陈街K座 781219', 1630000000095)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000000, 990358809, 3801390332798973674, 31813, 108, 5.517866, 6845.746002, 1, 'binary.DXVimvDjqwoNARHjTXuI', 'nchar.上海市杰市怀柔天津街N座 936198', 1630000000095)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000001, -52260486, -2710179305466920974, -16431, -119, -958.607117, -38510688978203.898438, 1, 'binary.erVQJAvbzEahBSRwIflK', 'nchar.江西省桂英县六枝特北镇路A座 788549', 1630000000096)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000001, -2093648842, -6938612375617002825, -6697, -12, 4655.180387, 8131192.215618, 1, 'binary.IKRYKZeWgWRTpWFkjzBI', 'nchar.西藏自治区海门市高坪六安路l座 342816', 1630000000096)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631425000000, -1314836279, -7834501286968314160, 15789, -123, 33900643554.123798, -2082127.625636, 0, 'binary.rDTPIDjxHVnobHXBYtXY', 'nchar.北京市昆明市合川董路B座 463423', 1630000000095)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631440000000, -1084304030, 7788263187088917501, -6031, 103, -857.741582, 8339855538945.950195, 0, 'binary.TyxrsRIKPjtzXgKyuAEH', 'nchar.山西省宜都县锡山李路J座 745663', 1630000000096)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000000, -1295742585, -5131971234132550528, -2973, 42, 52247.313515, 3926177760.319000, 0, 'binary.vXduhvWXmyRcbKfMRWlx', 'nchar.安徽省兵县高明许街p座 922555', 1630000000096)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631439999999, 20091569, 6781601496202385368, 19493, 34, 430582007336.525024, -2.412247, 1, 'binary.kZJLmYOxtxuJZnMBDufv', 'nchar.内蒙古自治区颖市浔阳王路J座 977519', 1630000000096)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000000, 1813973451, 4213442260213870776, 26872, 44, 67809323307135.703125, -88973468.418878, 1, 'binary.LTPEGjxcghSRynZSWwqM', 'nchar.云南省南昌县梁平杨街G座 627457', 1630000000096)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000001, -958070866, -691160751112903120, -20406, -41, 2363414966580.939941, 8820731593.777920, 1, 'binary.RZliiclFrDaNImulqJTo', 'nchar.台湾省梧州县沈北新葛街m座 433410', 1630000000097)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000001, -1829734602, -7898671321317813289, -22642, -75, 4.101330, 40052.692465, 1, 'binary.KqgvcwBhRIxCNTZaTnLf', 'nchar.福建省金凤市海陵武汉街u座 555612', 1630000000097)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631440000000, 521824259, -8660783264753873829, -29076, -1, 43333588339.556999, -11986.154286, 0, 'binary.GKzBHXETTitGAjMDqHEz', 'nchar.广东省合山县萧山宜都路u座 831011', 1630000000096)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 113309185, -5404115880106386219, 26329, -5, 3883055.927579, -91.272110, 0, 'binary.DJuxhSLmckBxGAZrTrdg', 'nchar.黑龙江省丽丽县海陵张路x座 667710', 1630000000097)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 1249035464, -1549873989524700903, -1552, 12, 30063970786.732201, 11.623060, 0, 'binary.wGOvxPtoGpoLQkqKqHYd', 'nchar.山东省建国县沙湾南昌路c座 673842', 1630000000097)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631454999999, 420485592, 1118062875777571668, 19952, 48, -13933.583298, -2462443202766.899902, 1, 'binary.PUybFnyERTpaOdCfdUeZ', 'nchar.内蒙古自治区海燕县新城郑州街o座 509072', 1630000000097)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 30946503, 7185137291847458233, 19072, 30, -152414.945183, -623547849.652030, 1, 'binary.bPgvDlyyWMQtWdUCTHsf', 'nchar.西藏自治区东莞县上街谢路z座 842631', 1630000000097)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000001, -136337675, -6941068854543647771, -30263, -36, 49955993237.460999, 2059.397798, 1, 'binary.AvuVCfvKjWXieILiINcT', 'nchar.台湾省建国县南长刘街Y座 514218', 1630000000098)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000001, -1639262737, -5524893491321561875, -14837, -81, 464457921385.609985, -381392530568.276978, 1, 'binary.aDgJHFZdhjaRiLJgewyJ', 'nchar.贵州省建县锡山谢路U座 298544', 1630000000098)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631455000000, 74809487, -2714524097635173095, 20984, 33, 1802605.962684, 77.296856, 0, 'binary.vYEpwfCOmksSKWbrqYDR', 'nchar.香港特别行政区哈尔滨县山亭董街I座 748187', 1630000000097)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631470000000, 222279926, -7912824848487896120, 9941, -30, -29340217214.750000, -19574.321414, 0, 'binary.VsnXIRHAihqVgXYwhHKL', 'nchar.江苏省拉萨县闵行合山街c座 761422', 1630000000098)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000000, -557137010, 2878767942030754357, -31366, -47, -4333332356.734030, -1526389473.865540, 0, 'binary.jcMUSJuZgsPjePUNiAdT', 'nchar.海南省东县锡山澳门街q座 268693', 1630000000098)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631469999999, 447814637, 2176882939455175378, 20639, 104, -1356647372.422460, 6.253297, 1, 'binary.fyooIrohcePtHVwJGMuD', 'nchar.河北省关岭市金平香港路p座 886482', 1630000000098)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000000, 606893531, 4789787682189143102, 14991, 38, 32272292804541.800781, -943.731667, 1, 'binary.VuPeMxNmIrwVmeDRCPTm', 'nchar.黑龙江省兰州市东城陈街O座 771980', 1630000000098)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000001, -994364364, -2126966193042917392, -11261, -99, 7.179842, 9558.331194, 1, 'binary.qpXjZYHYtFFCkEkBnwAb', 'nchar.北京市建国市永川崔路g座 413491', 1630000000099)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000001, -1952105143, -3184538982013952257, -9023, -66, 2300257.628379, -83.900999, 1, 'binary.ufpdchwhzdeEoRvElolr', 'nchar.黑龙江省通辽市高明胡街B座 971162', 1630000000099)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631470000000, 1789157808, -942637929512454815, -20552, 22, -2222313287.171970, 295235211456.737000, 0, 'binary.VznwmsilndimcCoBZmyp', 'nchar.澳门特别行政区东莞县静安杭州路m座 966043', 1630000000098)") + tdSql.execute(f"insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(1631485000000, -1420187501, 5901473154726700075, -22562, 122, -8503751910.519820, 2716.822481, 0, 'binary.SlMenUlCCEwyXsFKefLW', 'nchar.海南省马鞍山市兴山余路y座 674434', 1630000000099)") + tdSql.execute(f"insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000000, 325131812, -7109049890424943791, 905, -37, 431982153775.299011, -415064.781722, 0, 'binary.NdxijvQdCvCbloWQQDtL', 'nchar.台湾省济南市大东郭街V座 658918', 1630000000099)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631484999999, 1572668480, 108340538386194628, 29463, 54, -3679552.122859, -769.652903, 1, 'binary.qWPhdNHKBtjYxVZgdXOh', 'nchar.新疆维吾尔自治区华市翔安赵路R座 753468', 1630000000099)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000000, 1226876580, 7653003049181344524, 5255, 97, 2751345.497375, 35183472041.125603, 1, 'binary.qAhAfHMuKshsMmbgIOYK', 'nchar.上海市邯郸县兴山张街x座 375209', 1630000000099)") + tdSql.execute(f"insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000001, -375162227, -4279732710928397934, -19628, -20, 38774493096.818199, 7390201646933.400391, 1, 'binary.yMDiebwbXIHZiaQKPRut', 'nchar.北京市海燕县南长合山街t座 129283', 1630000000100)") + tdSql.execute(f"insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000001, -1188106611, -4426272680272146753, -13643, -51, 40149362212590.203125, 438738.291810, 1, 'binary.CbdGAjuBbirCzXoUVXUG', 'nchar.辽宁省宜都市新城吴街d座 246995', 1630000000100)") + tdSql.execute(f"insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(1631485000000, 698542868, 244085745806715589, -10836, -29, 23705559.480467, 89055463790.105301, 0, 'binary.TCkhaOCjQbElXSecegWh', 'nchar.新疆维吾尔自治区晶县秀英程街a座 168535', 1630000000099)") + + tdLog.debug("insert data ............ [OK]") + return + + def run(self): + tdSql.prepare() + self.create_tables() + self.insert_data() + tdLog.printNoPrefix("======== test TD-19201 ") + tdSql.execute(f"flush database table_numeric_max_min") + + tdSql.query(f"select MAX(q_float) from stable_1_2") + max_val = tdSql.getData(0, 0) + #print(max_val) + + tdSql.query(f"select ts,q_float from stable_1_2 order by q_float desc limit 5") + first_val = tdSql.getData(0, 1) + #print(first_val) + + tdSql.checkEqual(max_val, first_val) + + + + 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/fulltest.sh b/tests/system-test/fulltest.sh index f4a5c22d3979d1e8dbc9c681360360dd1fd45a15..a2bf935ebb9f88ec5a680d4da4c461ff59f62f27 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 @@ -335,6 +337,8 @@ python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py python3 ./test.py -f 7-tmq/tmq_taosx.py python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py +python3 ./test.py -f 99-TDcase/TD-19201.py + #------------querPolicy 2----------- python3 ./test.py -f 2-query/between.py -Q 2 @@ -515,3 +519,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; diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt index 839c65b633b17872051075be33ce291fbeaefd5a..b048b79e9b71058faaccdadeb723c1e0f46dce58 100644 --- a/utils/test/c/CMakeLists.txt +++ b/utils/test/c/CMakeLists.txt @@ -40,20 +40,3 @@ target_link_libraries( PUBLIC common PUBLIC os ) - -add_executable(sdbDump sdbDump.c) -target_link_libraries( - sdbDump - PUBLIC dnode - PUBLIC mnode - PUBLIC stream - PUBLIC sdb - PUBLIC os -) -target_include_directories( - sdbDump - PUBLIC "${TD_SOURCE_DIR}/include/dnode/mnode" - PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/impl/inc" - PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/sdb/inc" - PRIVATE "${TD_SOURCE_DIR}/source/dnode/mgmt/node_mgmt/inc" -) diff --git a/utils/test/c/sdbDump.c b/utils/test/c/sdbDump.c deleted file mode 100644 index b056fe58a3a245cea470262816544f05a2c0f880..0000000000000000000000000000000000000000 --- a/utils/test/c/sdbDump.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#define _DEFAULT_SOURCE -#include "dmMgmt.h" -#include "mndInt.h" -#include "sdb.h" -#include "tconfig.h" -#include "tjson.h" - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-result" - -#define TMP_DNODE_DIR TD_TMP_DIR_PATH "dumpsdb" -#define TMP_MNODE_DIR TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" -#define TMP_SDB_DATA_DIR TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "data" -#define TMP_SDB_SYNC_DIR TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "sync" -#define TMP_SDB_MNODE_JSON TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "mnode.json" -#define TMP_SDB_DATA_FILE TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "data" TD_DIRSEP "sdb.data" -#define TMP_SDB_RAFT_CFG_FILE TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_config.json" -#define TMP_SDB_RAFT_STORE_FILE TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_store.json" - -void reportStartup(const char *name, const char *desc) {} - -void sendRsp(SRpcMsg *pMsg) { rpcFreeCont(pMsg->pCont); } - -int32_t sendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) { - terrno = TSDB_CODE_INVALID_PTR; - return -1; -} - -char *i642str(int64_t val) { - static char str[24] = {0}; - snprintf(str, sizeof(str), "%" PRId64, val); - return str; -} - -void dumpFunc(SSdb *pSdb, SJson *json) {} - -void dumpDb(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "dbs", items); - - while (1) { - SDbObj *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_DB, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "db", item); - - tjsonAddStringToObject(item, "name", pObj->name); - tjsonAddStringToObject(item, "acct", pObj->acct); - tjsonAddStringToObject(item, "createUser", pObj->createUser); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); - tjsonAddStringToObject(item, "uid", i642str(pObj->uid)); - tjsonAddIntegerToObject(item, "cfgVersion", pObj->cfgVersion); - tjsonAddIntegerToObject(item, "vgVersion", pObj->vgVersion); - tjsonAddIntegerToObject(item, "numOfVgroups", pObj->cfg.numOfVgroups); - tjsonAddIntegerToObject(item, "numOfStables", pObj->cfg.numOfStables); - tjsonAddIntegerToObject(item, "buffer", pObj->cfg.buffer); - tjsonAddIntegerToObject(item, "pageSize", pObj->cfg.pageSize); - tjsonAddIntegerToObject(item, "pages", pObj->cfg.pages); - tjsonAddIntegerToObject(item, "cacheLastSize", pObj->cfg.cacheLastSize); - tjsonAddIntegerToObject(item, "daysPerFile", pObj->cfg.daysPerFile); - tjsonAddIntegerToObject(item, "daysToKeep0", pObj->cfg.daysToKeep0); - tjsonAddIntegerToObject(item, "daysToKeep1", pObj->cfg.daysToKeep1); - tjsonAddIntegerToObject(item, "daysToKeep2", pObj->cfg.daysToKeep2); - tjsonAddIntegerToObject(item, "minRows", pObj->cfg.minRows); - tjsonAddIntegerToObject(item, "maxRows", pObj->cfg.maxRows); - tjsonAddIntegerToObject(item, "precision", pObj->cfg.precision); - tjsonAddIntegerToObject(item, "compression", pObj->cfg.compression); - tjsonAddIntegerToObject(item, "replications", pObj->cfg.replications); - tjsonAddIntegerToObject(item, "strict", pObj->cfg.strict); - tjsonAddIntegerToObject(item, "cacheLast", pObj->cfg.cacheLast); - tjsonAddIntegerToObject(item, "hashMethod", pObj->cfg.hashMethod); - tjsonAddIntegerToObject(item, "numOfRetensions", pObj->cfg.numOfRetensions); - tjsonAddIntegerToObject(item, "schemaless", pObj->cfg.schemaless); - tjsonAddIntegerToObject(item, "walLevel", pObj->cfg.walLevel); - tjsonAddIntegerToObject(item, "walFsyncPeriod", pObj->cfg.walFsyncPeriod); - tjsonAddIntegerToObject(item, "walRetentionPeriod", pObj->cfg.walRetentionPeriod); - tjsonAddIntegerToObject(item, "walRetentionSize", pObj->cfg.walRetentionSize); - tjsonAddIntegerToObject(item, "walRollPeriod", pObj->cfg.walRollPeriod); - tjsonAddIntegerToObject(item, "walSegmentSize", pObj->cfg.walSegmentSize); - - sdbRelease(pSdb, pObj); - } -} - -void dumpStb(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "stbs", items); - - while (1) { - SStbObj *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "stb", item); - - tjsonAddStringToObject(item, "name", pObj->name); - tjsonAddStringToObject(item, "db", pObj->db); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); - tjsonAddStringToObject(item, "uid", i642str(pObj->uid)); - tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid)); - tjsonAddIntegerToObject(item, "tagVer", pObj->tagVer); - tjsonAddIntegerToObject(item, "colVer", pObj->colVer); - tjsonAddIntegerToObject(item, "nextColId", pObj->nextColId); - tjsonAddIntegerToObject(item, "watermark1", pObj->watermark[0]); - tjsonAddIntegerToObject(item, "watermark2", pObj->watermark[1]); - tjsonAddIntegerToObject(item, "maxdelay1", pObj->maxdelay[0]); - tjsonAddIntegerToObject(item, "maxdelay2", pObj->maxdelay[1]); - tjsonAddIntegerToObject(item, "ttl", pObj->ttl); - tjsonAddIntegerToObject(item, "numOfColumns", pObj->numOfColumns); - tjsonAddIntegerToObject(item, "numOfTags", pObj->numOfTags); - tjsonAddIntegerToObject(item, "commentLen", pObj->commentLen); - tjsonAddIntegerToObject(item, "ast1Len", pObj->ast1Len); - tjsonAddIntegerToObject(item, "ast2Len", pObj->ast2Len); - - sdbRelease(pSdb, pObj); - } -} - -void dumpSma(SSdb *pSdb, SJson *json) {} - -void dumpVgroup(SSdb *pSdb, SJson *json) {} - -void dumpTopic(SSdb *pSdb, SJson *json) {} - -void dumpConsumber(SSdb *pSdb, SJson *json) {} - -void dumpSubscribe(SSdb *pSdb, SJson *json) {} - -void dumpOffset(SSdb *pSdb, SJson *json) {} - -void dumpStream(SSdb *pSdb, SJson *json) {} - -void dumpAcct(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "accts", items); - - while (1) { - SAcctObj *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_ACCT, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "acct", item); - - tjsonAddStringToObject(item, "acct", pObj->acct); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); - tjsonAddIntegerToObject(item, "acctId", pObj->acctId); - - sdbRelease(pSdb, pObj); - } -} - -void dumpAuth(SSdb *pSdb, SJson *json) {} - -void dumpUser(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "users", items); - - while (1) { - SUserObj *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_USER, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "user", item); - - tjsonAddStringToObject(item, "name", pObj->user); - tjsonAddStringToObject(item, "pass", pObj->pass); - tjsonAddStringToObject(item, "acct", pObj->acct); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); - tjsonAddIntegerToObject(item, "superUser", pObj->superUser); - tjsonAddIntegerToObject(item, "authVersion", pObj->authVersion); - tjsonAddIntegerToObject(item, "numOfReadDbs", taosHashGetSize(pObj->readDbs)); - tjsonAddIntegerToObject(item, "numOfWriteDbs", taosHashGetSize(pObj->writeDbs)); - - sdbRelease(pSdb, pObj); - } -} - -void dumpDnode(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "dnodes", items); - - while (1) { - SDnodeObj *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "dnode", item); - - tjsonAddIntegerToObject(item, "id", pObj->id); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); - tjsonAddIntegerToObject(item, "port", pObj->port); - tjsonAddStringToObject(item, "fqdn", pObj->fqdn); - - sdbRelease(pSdb, pObj); - } -} - -void dumpBnode(SSdb *pSdb, SJson *json) {} - -void dumpSnode(SSdb *pSdb, SJson *json) {} - -void dumpQnode(SSdb *pSdb, SJson *json) {} - -void dumpMnode(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "mnodes", items); - - while (1) { - SMnodeObj *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_MNODE, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "mnode", item); - - tjsonAddIntegerToObject(item, "id", pObj->id); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); - - sdbRelease(pSdb, pObj); - } -} - -void dumpCluster(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "clusters", items); - - while (1) { - SClusterObj *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "cluster", item); - - tjsonAddStringToObject(item, "id", i642str(pObj->id)); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime)); - tjsonAddStringToObject(item, "name", pObj->name); - - sdbRelease(pSdb, pObj); - } -} - -void dumpTrans(SSdb *pSdb, SJson *json) { - void *pIter = NULL; - SJson *items = tjsonCreateObject(); - tjsonAddItemToObject(json, "transactions", items); - - while (1) { - STrans *pObj = NULL; - pIter = sdbFetch(pSdb, SDB_TRANS, pIter, (void **)&pObj); - if (pIter == NULL) break; - - SJson *item = tjsonCreateObject(); - tjsonAddItemToObject(items, "trans", item); - - tjsonAddIntegerToObject(item, "id", pObj->id); - tjsonAddIntegerToObject(item, "stage", pObj->stage); - tjsonAddIntegerToObject(item, "policy", pObj->policy); - tjsonAddIntegerToObject(item, "conflict", pObj->conflict); - tjsonAddIntegerToObject(item, "exec", pObj->exec); - tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime)); - tjsonAddStringToObject(item, "dbname", pObj->dbname); - tjsonAddStringToObject(item, "stbname", pObj->stbname); - tjsonAddIntegerToObject(item, "commitLogNum", taosArrayGetSize(pObj->commitActions)); - tjsonAddIntegerToObject(item, "redoActionNum", taosArrayGetSize(pObj->redoActions)); - tjsonAddIntegerToObject(item, "undoActionNum", taosArrayGetSize(pObj->undoActions)); - - sdbRelease(pSdb, pObj); - } -} - -void dumpHeader(SSdb *pSdb, SJson *json) { - tjsonAddIntegerToObject(json, "sver", 1); - tjsonAddStringToObject(json, "applyIndex", i642str(pSdb->applyIndex)); - tjsonAddStringToObject(json, "applyTerm", i642str(pSdb->applyTerm)); - tjsonAddStringToObject(json, "applyConfig", i642str(pSdb->applyConfig)); - - SJson *maxIdsJson = tjsonCreateObject(); - tjsonAddItemToObject(json, "maxIds", maxIdsJson); - for (int32_t i = 0; i < SDB_MAX; ++i) { - int64_t maxId = 0; - if (i < SDB_MAX) { - maxId = pSdb->maxId[i]; - } - tjsonAddStringToObject(maxIdsJson, sdbTableName(i), i642str(maxId)); - } - - SJson *tableVersJson = tjsonCreateObject(); - tjsonAddItemToObject(json, "tableVers", tableVersJson); - for (int32_t i = 0; i < SDB_MAX; ++i) { - int64_t tableVer = 0; - if (i < SDB_MAX) { - tableVer = pSdb->tableVer[i]; - } - tjsonAddStringToObject(tableVersJson, sdbTableName(i), i642str(tableVer)); - } -} - -int32_t dumpSdb() { - wDebugFlag = 0; - mDebugFlag = 0; - sDebugFlag = 0; - - SMsgCb msgCb = {0}; - msgCb.reportStartupFp = reportStartup; - msgCb.sendReqFp = sendReq; - msgCb.sendRspFp = sendRsp; - msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack - tmsgSetDefault(&msgCb); - walInit(); - syncInit(); - - SMnodeOpt opt = {.msgCb = msgCb}; - SMnode *pMnode = mndOpen(TMP_MNODE_DIR, &opt); - if (pMnode == NULL) return -1; - - SSdb *pSdb = pMnode->pSdb; - SJson *json = tjsonCreateObject(); - dumpHeader(pSdb, json); - dumpFunc(pSdb, json); - dumpDb(pSdb, json); - dumpStb(pSdb, json); - dumpSma(pSdb, json); - dumpVgroup(pSdb, json); - dumpTopic(pSdb, json); - dumpConsumber(pSdb, json); - dumpSubscribe(pSdb, json); - dumpOffset(pSdb, json); - dumpStream(pSdb, json); - dumpAcct(pSdb, json); - dumpAuth(pSdb, json); - dumpUser(pSdb, json); - dumpDnode(pSdb, json); - dumpBnode(pSdb, json); - dumpSnode(pSdb, json); - dumpQnode(pSdb, json); - dumpMnode(pSdb, json); - dumpCluster(pSdb, json); - dumpTrans(pSdb, json); - - char *pCont = tjsonToString(json); - int32_t contLen = strlen(pCont); - char file[] = "sdb.json"; - TdFilePtr pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); - if (pFile == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); - dError("failed to write %s since %s", file, terrstr()); - return -1; - } - taosWriteFile(pFile, pCont, contLen); - taosWriteFile(pFile, "\n", 1); - taosFsyncFile(pFile); - taosCloseFile(&pFile); - tjsonDelete(json); - taosMemoryFree(pCont); - taosRemoveDir(TMP_DNODE_DIR); - return 0; -} - -int32_t parseArgs(int32_t argc, char *argv[]) { - for (int32_t i = 1; i < argc; ++i) { - if (strcmp(argv[i], "-c") == 0) { - if (i < argc - 1) { - if (strlen(argv[++i]) >= PATH_MAX) { - printf("config file path overflow"); - return -1; - } - tstrncpy(configDir, argv[i], PATH_MAX); - } else { - printf("'-c' requires a parameter, default is %s\n", configDir); - return -1; - } - } else { - printf("-c Configuration directory. \n"); - return -1; - } - } - - if (taosCreateLog("dumplog", 1, configDir, NULL, NULL, NULL, NULL, 1) != 0) { - printf("failed to dump since init log error\n"); - return -1; - } - - if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0) != 0) { - printf("failed to dump since read config error\n"); - return -1; - } - - char mnodeJson[PATH_MAX] = {0}; - char dataFile[PATH_MAX] = {0}; - char raftCfgFile[PATH_MAX] = {0}; - char raftStoreFile[PATH_MAX] = {0}; - snprintf(mnodeJson, PATH_MAX, "%s" TD_DIRSEP "mnode" TD_DIRSEP "mnode.json", tsDataDir); - snprintf(dataFile, PATH_MAX, "%s" TD_DIRSEP "mnode" TD_DIRSEP "data" TD_DIRSEP "sdb.data", tsDataDir); - snprintf(raftCfgFile, PATH_MAX, "%s" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_config.json", tsDataDir); - snprintf(raftStoreFile, PATH_MAX, "%s" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_store.json", tsDataDir); - - char cmd[PATH_MAX * 2] = {0}; - snprintf(cmd, sizeof(cmd), "rm -rf %s", TMP_DNODE_DIR); - - system(cmd); -#ifdef WINDOWS - taosMulMkDir(TMP_SDB_DATA_DIR); - taosMulMkDir(TMP_SDB_SYNC_DIR); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>nul", mnodeJson, TMP_SDB_MNODE_JSON); - system(cmd); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>nul", dataFile, TMP_SDB_DATA_FILE); - system(cmd); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>nul", raftCfgFile, TMP_SDB_RAFT_CFG_FILE); - system(cmd); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>nul", raftStoreFile, TMP_SDB_RAFT_STORE_FILE); - system(cmd); -#else - snprintf(cmd, sizeof(cmd), "mkdir -p %s", TMP_SDB_DATA_DIR); - system(cmd); - snprintf(cmd, sizeof(cmd), "mkdir -p %s", TMP_SDB_SYNC_DIR); - system(cmd); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>/dev/null", mnodeJson, TMP_SDB_MNODE_JSON); - system(cmd); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>/dev/null", dataFile, TMP_SDB_DATA_FILE); - system(cmd); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>/dev/null", raftCfgFile, TMP_SDB_RAFT_CFG_FILE); - system(cmd); - snprintf(cmd, sizeof(cmd), "cp %s %s 2>/dev/null", raftStoreFile, TMP_SDB_RAFT_STORE_FILE); - system(cmd); -#endif - - strcpy(tsDataDir, TMP_DNODE_DIR); - return 0; -} - -int32_t main(int32_t argc, char *argv[]) { - if (parseArgs(argc, argv) != 0) { - return -1; - } - - return dumpSdb(); -} - -#pragma GCC diagnostic pop \ No newline at end of file