diff --git a/cmake/cmake.version b/cmake/cmake.version index fcb31adc39..2d86335b3c 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.1.2") + SET(TD_VER_NUMBER "3.0.1.3") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 39f243d147..5d2fcf27b2 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 cf1df1c + GIT_TAG 70f5a1c SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" 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 be61dfeb8e..d0874c331e 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 da06aca148..25a92573fa 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/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index ab1d2f900b..14dedfb216 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -13,7 +13,7 @@ Single row functions return a result for each row. #### ABS ```sql -SELECT ABS(field_name) FROM { tb_name | stb_name } [WHERE clause] +ABS(expr) ``` **Description**: The absolute value of a specific field. @@ -31,7 +31,7 @@ SELECT ABS(field_name) FROM { tb_name | stb_name } [WHERE clause] #### ACOS ```sql -SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause] +ACOS(expr) ``` **Description**: The arc cosine of a specific field. @@ -49,7 +49,7 @@ SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause] #### ASIN ```sql -SELECT ASIN(field_name) FROM { tb_name | stb_name } [WHERE clause] +ASIN(expr) ``` **Description**: The arc sine of a specific field. @@ -68,7 +68,7 @@ SELECT ASIN(field_name) FROM { tb_name | stb_name } [WHERE clause] #### ATAN ```sql -SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause] +ATAN(expr) ``` **Description**: The arc tangent of a specific field. @@ -87,7 +87,7 @@ SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause] #### CEIL ```sql -SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause]; +CEIL(expr) ``` **Description**: The rounded up value of a specific field @@ -105,7 +105,7 @@ SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### COS ```sql -SELECT COS(field_name) FROM { tb_name | stb_name } [WHERE clause] +COS(expr) ``` **Description**: The cosine of a specific field. @@ -123,7 +123,7 @@ SELECT COS(field_name) FROM { tb_name | stb_name } [WHERE clause] #### FLOOR ```sql -SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; +FLOOR(expr) ``` **Description**: The rounded down value of a specific field @@ -132,7 +132,7 @@ SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### LOG ```sql -SELECT LOG(field_name[, base]) FROM { tb_name | stb_name } [WHERE clause] +LOG(expr [, base]) ``` **Description**: The logarithm of a specific field with `base` as the radix. If you do not enter a base, the natural logarithm of the field is returned. @@ -151,7 +151,7 @@ SELECT LOG(field_name[, base]) FROM { tb_name | stb_name } [WHERE clause] #### POW ```sql -SELECT POW(field_name, power) FROM { tb_name | stb_name } [WHERE clause] +POW(expr, power) ``` **Description**: The power of a specific field with `power` as the exponent. @@ -170,7 +170,7 @@ SELECT POW(field_name, power) FROM { tb_name | stb_name } [WHERE clause] #### ROUND ```sql -SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; +ROUND(expr) ``` **Description**: The rounded value of a specific field. @@ -180,7 +180,7 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### SIN ```sql -SELECT SIN(field_name) FROM { tb_name | stb_name } [WHERE clause] +SIN(expr) ``` **Description**: The sine of a specific field. @@ -198,7 +198,7 @@ SELECT SIN(field_name) FROM { tb_name | stb_name } [WHERE clause] #### SQRT ```sql -SELECT SQRT(field_name) FROM { tb_name | stb_name } [WHERE clause] +SQRT(expr) ``` **Description**: The square root of a specific field. @@ -216,7 +216,7 @@ SELECT SQRT(field_name) FROM { tb_name | stb_name } [WHERE clause] #### TAN ```sql -SELECT TAN(field_name) FROM { tb_name | stb_name } [WHERE clause] +TAN(expr) ``` **Description**: The tangent of a specific field. @@ -238,7 +238,7 @@ Concatenation functions take strings as input and produce string or numeric valu #### CHAR_LENGTH ```sql -SELECT CHAR_LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] +CHAR_LENGTH(expr) ``` **Description**: The length in number of characters of a string @@ -254,7 +254,7 @@ SELECT CHAR_LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] #### CONCAT ```sql -SELECT CONCAT(str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] +CONCAT(expr1, expr2 [, expr] ...) ``` **Description**: The concatenation result of two or more strings @@ -271,7 +271,7 @@ SELECT CONCAT(str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHER #### CONCAT_WS ```sql -SELECT CONCAT_WS(separator, str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] +CONCAT_WS(separator_expr, expr1, expr2 [, expr] ...) ``` **Description**: The concatenation result of two or more strings with separator @@ -288,7 +288,7 @@ SELECT CONCAT_WS(separator, str1|column1, str2|column2, ...) FROM { tb_name | st #### LENGTH ```sql -SELECT LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] +LENGTH(expr) ``` **Description**: The length in bytes of a string @@ -305,7 +305,7 @@ SELECT LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] #### LOWER ```sql -SELECT LOWER(str|column) FROM { tb_name | stb_name } [WHERE clause] +LOWER(expr) ``` **Description**: Convert the input string to lower case @@ -322,7 +322,7 @@ SELECT LOWER(str|column) FROM { tb_name | stb_name } [WHERE clause] #### LTRIM ```sql -SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] +LTRIM(expr) ``` **Description**: Remove the left leading blanks of a string @@ -339,7 +339,7 @@ SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] #### RTRIM ```sql -SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] +LTRIM(expr) ``` **Description**: Remove the right tailing blanks of a string @@ -356,7 +356,7 @@ SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] #### SUBSTR ```sql -SELECT SUBSTR(str,pos[,len]) FROM { tb_name | stb_name } [WHERE clause] +SUBSTR(expr, pos [, len]) ``` **Description**: The sub-string starting from `pos` with length of `len` from the original string `str` - If `len` is not specified, it means from `pos` to the end. @@ -373,7 +373,7 @@ SELECT SUBSTR(str,pos[,len]) FROM { tb_name | stb_name } [WHERE clause] #### UPPER ```sql -SELECT UPPER(str|column) FROM { tb_name | stb_name } [WHERE clause] +UPPER(expr) ``` **Description**: Convert the input string to upper case @@ -394,10 +394,10 @@ Conversion functions change the data type of a value. #### CAST ```sql -SELECT CAST(expression AS type_name) FROM { tb_name | stb_name } [WHERE clause] +CAST(expr AS type_name) ``` -**Description**: Convert the input data `expression` into the type specified by `type_name`. This function can be used only in SELECT statements. +**Description**: Convert the input data `expr` into the type specified by `type_name`. This function can be used only in SELECT statements. **Return value type**: The type specified by parameter `type_name` @@ -418,7 +418,7 @@ SELECT CAST(expression AS type_name) FROM { tb_name | stb_name } [WHERE clause] #### TO_ISO8601 ```sql -SELECT TO_ISO8601(ts[, timezone]) FROM { tb_name | stb_name } [WHERE clause]; +TO_ISO8601(expr [, timezone]) ``` **Description**: The ISO8601 date/time format converted from a UNIX timestamp, plus the timezone. You can specify any time zone with the timezone parameter. If you do not enter this parameter, the time zone on the client is used. @@ -441,7 +441,7 @@ SELECT TO_ISO8601(ts[, timezone]) FROM { tb_name | stb_name } [WHERE clause]; #### TO_JSON ```sql -SELECT TO_JSON(str_literal) FROM { tb_name | stb_name } [WHERE clause]; +TO_JSON(str_literal) ``` **Description**: Converts a string into JSON. @@ -458,7 +458,7 @@ SELECT TO_JSON(str_literal) FROM { tb_name | stb_name } [WHERE clause]; #### TO_UNIXTIMESTAMP ```sql -SELECT TO_UNIXTIMESTAMP(datetime_string) FROM { tb_name | stb_name } [WHERE clause]; +TO_UNIXTIMESTAMP(expr) ``` **Description**: UNIX timestamp converted from a string of date/time format @@ -486,9 +486,7 @@ All functions that return the current time, such as `NOW`, `TODAY`, and `TIMEZON #### NOW ```sql -SELECT NOW() FROM { tb_name | stb_name } [WHERE clause]; -SELECT select_expr FROM { tb_name | stb_name } WHERE ts_col cond_operatior NOW(); -INSERT INTO tb_name VALUES (NOW(), ...); +NOW() ``` **Description**: The current time of the client side system @@ -511,7 +509,7 @@ INSERT INTO tb_name VALUES (NOW(), ...); #### TIMEDIFF ```sql -SELECT TIMEDIFF(ts | datetime_string1, ts | datetime_string2 [, time_unit]) FROM { tb_name | stb_name } [WHERE clause]; +TIMEDIFF(expr1, expr2 [, time_unit]) ``` **Description**: The difference between two timestamps, and rounded to the time unit specified by `time_unit` @@ -534,7 +532,7 @@ SELECT TIMEDIFF(ts | datetime_string1, ts | datetime_string2 [, time_unit]) FROM #### TIMETRUNCATE ```sql -SELECT TIMETRUNCATE(ts | datetime_string , time_unit) FROM { tb_name | stb_name } [WHERE clause]; +TIMETRUNCATE(expr, time_unit) ``` **Description**: Truncate the input timestamp with unit specified by `time_unit` @@ -555,7 +553,7 @@ SELECT TIMETRUNCATE(ts | datetime_string , time_unit) FROM { tb_name | stb_name #### TIMEZONE ```sql -SELECT TIMEZONE() FROM { tb_name | stb_name } [WHERE clause]; +TIMEZONE() ``` **Description**: The timezone of the client side system @@ -570,9 +568,7 @@ SELECT TIMEZONE() FROM { tb_name | stb_name } [WHERE clause]; #### TODAY ```sql -SELECT TODAY() FROM { tb_name | stb_name } [WHERE clause]; -SELECT select_expr FROM { tb_name | stb_name } WHERE ts_col cond_operatior TODAY()]; -INSERT INTO tb_name VALUES (TODAY(), ...); +TODAY() ``` **Description**: The timestamp of 00:00:00 of the client side system @@ -599,7 +595,12 @@ TDengine supports the following aggregate functions: ### APERCENTILE ```sql -SELECT APERCENTILE(field_name, P[, algo_type]) FROM { tb_name | stb_name } [WHERE clause] +APERCENTILE(expr, p [, algo_type]) + +algo_type: { + "default" + | "t-digest" +} ``` **Description**: Similar to `PERCENTILE`, but a simulated result is returned @@ -611,14 +612,14 @@ SELECT APERCENTILE(field_name, P[, algo_type]) FROM { tb_name | stb_name } [WHER **Applicable table types**: standard tables and supertables **Explanations**: -- _P_ is in range [0,100], when _P_ is 0, the result is same as using function MIN; when _P_ is 100, the result is same as function MAX. +- _p_ is in range [0,100], when _p_ is 0, the result is same as using function MIN; when _p_ is 100, the result is same as function MAX. - `algo_type` can only be input as `default` or `t-digest` Enter `default` to use a histogram-based algorithm. Enter `t-digest` to use the t-digest algorithm to calculate the approximation of the quantile. `default` is used by default. - The approximation result of `t-digest` algorithm is sensitive to input data order. For example, when querying STable with different input data order there might be minor differences in calculated results. ### AVG ```sql -SELECT AVG(field_name) FROM tb_name [WHERE clause]; +AVG(expr) ``` **Description**: The average value of the specified fields. @@ -633,7 +634,7 @@ SELECT AVG(field_name) FROM tb_name [WHERE clause]; ### COUNT ```sql -SELECT COUNT([*|field_name]) FROM tb_name [WHERE clause]; +COUNT({* | expr}) ``` **Description**: The number of records in the specified fields. @@ -653,7 +654,7 @@ If you input a specific column, the number of non-null values in the column is r ### ELAPSED ```sql -SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE clause] [INTERVAL(interval [, offset]) [SLIDING sliding]]; +ELAPSED(ts_primary_key [, time_unit]) ``` **Description**:`elapsed` function can be used to calculate the continuous time length in which there is valid data. If it's used with `INTERVAL` clause, the returned result is the calcualted time length within each time window. If it's used without `INTERVAL` caluse, the returned result is the calculated time length within the specified time range. Please be noted that the return value of `elapsed` is the number of `time_unit` in the calculated time length. @@ -665,7 +666,7 @@ SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE **Applicable tables**: table, STable, outter in nested query **Explanations**: -- `field_name` parameter can only be the first column of a table, i.e. timestamp primary key. +- `ts_primary_key` parameter can only be the first column of a table, i.e. timestamp primary key. - The minimum value of `time_unit` is the time precision of the database. If `time_unit` is not specified, the time precision of the database is used as the default time unit. Time unit specified by `time_unit` can be: 1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks) - It can be used with `INTERVAL` to get the time valid time length of each time window. Please be noted that the return value is same as the time window for all time windows except for the first and the last time window. @@ -679,7 +680,7 @@ SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE ### LEASTSQUARES ```sql -SELECT LEASTSQUARES(field_name, start_val, step_val) FROM tb_name [WHERE clause]; +LEASTSQUARES(expr, start_val, step_val) ``` **Description**: The linear regression function of the specified column and the timestamp column (primary key), `start_val` is the initial value and `step_val` is the step value. @@ -694,7 +695,7 @@ SELECT LEASTSQUARES(field_name, start_val, step_val) FROM tb_name [WHERE clause] ### SPREAD ```sql -SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]; +SPREAD(expr) ``` **Description**: The difference between the max and the min of a specific column @@ -709,7 +710,7 @@ SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### STDDEV ```sql -SELECT STDDEV(field_name) FROM tb_name [WHERE clause]; +STDDEV(expr) ``` **Description**: Standard deviation of a specific column in a table or STable @@ -724,7 +725,7 @@ SELECT STDDEV(field_name) FROM tb_name [WHERE clause]; ### SUM ```sql -SELECT SUM(field_name) FROM tb_name [WHERE clause]; +SUM(expr) ``` **Description**: The sum of a specific column in a table or STable @@ -739,7 +740,7 @@ SELECT SUM(field_name) FROM tb_name [WHERE clause]; ### HYPERLOGLOG ```sql -SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } [WHERE clause]; +HYPERLOGLOG(expr) ``` **Description**: @@ -756,7 +757,7 @@ SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### HISTOGRAM ```sql -SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_name [WHERE clause]; +HISTOGRAM(expr,bin_type, bin_description, normalized) ``` **Description**:Returns count of data points in user-specified ranges. @@ -786,7 +787,7 @@ SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_nam ### PERCENTILE ```sql -SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause]; +PERCENTILE(expr, p) ``` **Description**: The value whose rank in a specific column matches the specified percentage. If such a value matching the specified percentage doesn't exist in the column, an interpolation value will be returned. @@ -797,7 +798,7 @@ SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause]; **Applicable table types**: table only -**More explanations**: _P_ is in range [0,100], when _P_ is 0, the result is same as using function MIN; when _P_ is 100, the result is same as function MAX. +**More explanations**: _p_ is in range [0,100], when _p_ is 0, the result is same as using function MIN; when _p_ is 100, the result is same as function MAX. ## Selection Functions @@ -807,7 +808,7 @@ Selection functions return one or more results depending. You can specify the ti ### BOTTOM ```sql -SELECT BOTTOM(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; +BOTTOM(expr, k) ``` **Description**: The least _k_ values of a specific column in a table or STable. If a value has multiple occurrences in the column but counting all of them in will exceed the upper limit _k_, then a part of them will be returned randomly. @@ -827,7 +828,7 @@ SELECT BOTTOM(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ### FIRST ```sql -SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause]; +FIRST(expr) ``` **Description**: The first non-null value of a specific column in a table or STable @@ -847,7 +848,7 @@ SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### INTERP ```sql -SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] RANGE(timestamp1,timestamp2) EVERY(interval) FILL({ VALUE | PREV | NULL | LINEAR | NEXT}); +INTERP(expr) ``` **Description**: The value that matches the specified timestamp range is returned, if existing; or an interpolation value is returned. @@ -870,7 +871,7 @@ SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] RA ### LAST ```sql -SELECT LAST(field_name) FROM { tb_name | stb_name } [WHERE clause]; +LAST(expr) ``` **Description**: The last non-NULL value of a specific column in a table or STable @@ -891,7 +892,7 @@ SELECT LAST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### LAST_ROW ```sql -SELECT LAST_ROW(field_name) FROM { tb_name | stb_name }; +LAST_ROW(expr) ``` **Description**: The last row of a table or STable @@ -910,7 +911,7 @@ SELECT LAST_ROW(field_name) FROM { tb_name | stb_name }; ### MAX ```sql -SELECT MAX(field_name) FROM { tb_name | stb_name } [WHERE clause]; +MAX(expr) ``` **Description**: The maximum value of a specific column of a table or STable @@ -925,7 +926,7 @@ SELECT MAX(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### MIN ```sql -SELECT MIN(field_name) FROM {tb_name | stb_name} [WHERE clause]; +MIN(expr) ``` **Description**: The minimum value of a specific column in a table or STable @@ -940,7 +941,7 @@ SELECT MIN(field_name) FROM {tb_name | stb_name} [WHERE clause]; ### MODE ```sql -SELECT MODE(field_name) FROM tb_name [WHERE clause]; +MODE(expr) ``` **Description**:The value which has the highest frequency of occurrence. NULL is returned if there are multiple values which have highest frequency of occurrence. @@ -955,7 +956,7 @@ SELECT MODE(field_name) FROM tb_name [WHERE clause]; ### SAMPLE ```sql -SELECT SAMPLE(field_name, K) FROM { tb_name | stb_name } [WHERE clause] +SAMPLE(expr, k) ``` **Description**: _k_ sampling values of a specific column. The applicable range of _k_ is [1,1000]. @@ -977,7 +978,7 @@ This function cannot be used in expression calculation. ### TAIL ```sql -SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} [WHERE clause]; +TAIL(expr, k, offset_val) ``` **Description**: The next _k_ rows are returned after skipping the last `offset_val` rows, NULL values are not ignored. `offset_val` is optional parameter. When it's not specified, the last _k_ rows are returned. When `offset_val` is used, the effect is same as `order by ts desc LIMIT k OFFSET offset_val`. @@ -994,7 +995,7 @@ SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} [WHERE clause]; ### TOP ```sql -SELECT TOP(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; +TOP(expr, k) ``` **Description**: The greatest _k_ values of a specific column in a table or STable. If a value has multiple occurrences in the column but counting all of them in will exceed the upper limit _k_, then a part of them will be returned randomly. @@ -1014,7 +1015,7 @@ SELECT TOP(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ### UNIQUE ```sql -SELECT UNIQUE(field_name) FROM {tb_name | stb_name} [WHERE clause]; +UNIQUE(expr) ``` **Description**: The values that occur the first time in the specified column. The effect is similar to `distinct` keyword, but it can also be used to match tags or timestamp. The first occurrence of a timestamp or tag is used. @@ -1033,7 +1034,7 @@ TDengine includes extensions to standard SQL that are intended specifically for ### CSUM ```sql -SELECT CSUM(field_name) FROM { tb_name | stb_name } [WHERE clause] +CSUM(expr) ``` **Description**: The cumulative sum of each row for a specific column. The number of output rows is same as that of the input rows. @@ -1056,7 +1057,12 @@ SELECT CSUM(field_name) FROM { tb_name | stb_name } [WHERE clause] ### DERIVATIVE ```sql -SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHERE clause]; +DERIVATIVE(expr, time_inerval, ignore_negative) + +ignore_negative: { + 0 + | 1 +} ``` **Description**: The derivative of a specific column. The time rage can be specified by parameter `time_interval`, the minimum allowed time range is 1 second (1s); the value of `ignore_negative` can be 0 or 1, 1 means negative values are ignored. @@ -1075,7 +1081,12 @@ SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHER ### DIFF ```sql -SELECT {DIFF(field_name, ignore_negative) | DIFF(field_name)} FROM tb_name [WHERE clause]; +DIFF(expr [, ignore_negative]) + +ignore_negative: { + 0 + | 1 +} ``` **Description**: The different of each row with its previous row for a specific column. `ignore_negative` can be specified as 0 or 1, the default value is 1 if it's not specified. `1` means negative values are ignored. @@ -1095,7 +1106,7 @@ SELECT {DIFF(field_name, ignore_negative) | DIFF(field_name)} FROM tb_name [WHER ### IRATE ```sql -SELECT IRATE(field_name) FROM tb_name WHERE clause; +IRATE(expr) ``` **Description**: instantaneous rate on a specific column. The last two samples in the specified time range are used to calculate instantaneous rate. If the last sample value is smaller, then only the last sample value is used instead of the difference between the last two sample values. @@ -1110,7 +1121,7 @@ SELECT IRATE(field_name) FROM tb_name WHERE clause; ### MAVG ```sql -SELECT MAVG(field_name, K) FROM { tb_name | stb_name } [WHERE clause] +MAVG(expr, k) ``` **Description**: The moving average of continuous _k_ values of a specific column. If the number of input rows is less than _k_, nothing is returned. The applicable range of _k_ is [1,1000]. @@ -1133,7 +1144,7 @@ SELECT MAVG(field_name, K) FROM { tb_name | stb_name } [WHERE clause] ### STATECOUNT ```sql -SELECT STATECOUNT(field_name, oper, val) FROM { tb_name | stb_name } [WHERE clause]; +STATECOUNT(expr, oper, val) ``` **Description**: The number of continuous rows satisfying the specified conditions for a specific column. The result is shown as an extra column for each row. If the specified condition is evaluated as true, the number is increased by 1; otherwise the number is reset to -1. If the input value is NULL, then the corresponding row is skipped. @@ -1160,7 +1171,7 @@ SELECT STATECOUNT(field_name, oper, val) FROM { tb_name | stb_name } [WHERE clau ### STATEDURATION ```sql -SELECT stateDuration(field_name, oper, val, unit) FROM { tb_name | stb_name } [WHERE clause]; +STATEDURATION(expr, oper, val, unit) ``` **Description**: The length of time range in which all rows satisfy the specified condition for a specific column. The result is shown as an extra column for each row. The length for the first row that satisfies the condition is 0. Next, if the condition is evaluated as true for a row, the time interval between current row and its previous row is added up to the time range; otherwise the time range length is reset to -1. If the value of the column is NULL, the corresponding row is skipped. @@ -1188,7 +1199,7 @@ SELECT stateDuration(field_name, oper, val, unit) FROM { tb_name | stb_name } [W ### TWA ```sql -SELECT TWA(field_name) FROM tb_name WHERE clause; +TWA(expr) ``` **Description**: Time weighted average on a specific column within a time range 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 ce28ee87d9..da26b34c6f 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/12-config/index.md b/docs/en/14-reference/12-config/index.md index 5ab6f59454..726a1ccd69 100644 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -177,12 +177,21 @@ The parameters described in this document by the effect that they have on the sy ### maxNumOfDistinctRes | Attribute | Description | -| -------- | -------------------------------- | --- | +| -------- | -------------------------------- | | Applicable | Server Only | | Meaning | The maximum number of distinct rows returned | | Value Range | [100,000 - 100,000,000] | | Default Value | 100,000 | +### keepColumnName + +| Attribute | Description | +| -------- | -------------------------------- | +| Applicable | Client only | +| Meaning | When the Last, First, LastRow function is queried, whether the returned column name contains the function name. | +| Value Range | 0 means including the function name, 1 means not including the function name. | +| Default Value | 0 | + ## Locale Parameters ### timezone diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index 414986d107..a65a2fff63 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -6,6 +6,10 @@ description: TDengine release history, Release Notes and download links. import Release from "/components/ReleaseV3"; +## 3.0.1.3 + + + ## 3.0.1.2 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 086d3adea2..a83723bff7 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.3 + + + ## 2.2.2 diff --git a/docs/zh/08-connector/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx index 12a9cf5347..a8e1682301 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/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 9726406b4d..2a4d82045f 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -14,7 +14,7 @@ toc_max_heading_level: 4 #### ABS ```sql -SELECT ABS(field_name) FROM { tb_name | stb_name } [WHERE clause] +ABS(expr) ``` **功能说明**:获得指定字段的绝对值。 @@ -32,7 +32,7 @@ SELECT ABS(field_name) FROM { tb_name | stb_name } [WHERE clause] #### ACOS ```sql -SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause] +ACOS(expr) ``` **功能说明**:获得指定字段的反余弦结果。 @@ -50,7 +50,7 @@ SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause] #### ASIN ```sql -SELECT ASIN(field_name) FROM { tb_name | stb_name } [WHERE clause] +ASIN(expr) ``` **功能说明**:获得指定字段的反正弦结果。 @@ -69,7 +69,7 @@ SELECT ASIN(field_name) FROM { tb_name | stb_name } [WHERE clause] #### ATAN ```sql -SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause] +ATAN(expr) ``` **功能说明**:获得指定字段的反正切结果。 @@ -88,7 +88,7 @@ SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause] #### CEIL ```sql -SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause]; +CEIL(expr) ``` **功能说明**:获得指定字段的向上取整数的结果。 @@ -106,7 +106,7 @@ SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### COS ```sql -SELECT COS(field_name) FROM { tb_name | stb_name } [WHERE clause] +COS(expr) ``` **功能说明**:获得指定字段的余弦结果。 @@ -124,7 +124,7 @@ SELECT COS(field_name) FROM { tb_name | stb_name } [WHERE clause] #### FLOOR ```sql -SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; +FLOOR(expr) ``` **功能说明**:获得指定字段的向下取整数的结果。 @@ -133,10 +133,10 @@ SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### LOG ```sql -SELECT LOG(field_name[, base]) FROM { tb_name | stb_name } [WHERE clause] +LOG(expr1[, expr2]) ``` -**功能说明**:获得指定字段对于底数 base 的对数。如果 base 参数省略,则返回指定字段的自然对数值。 +**功能说明**:获得 expr1 对于底数 expr2 的对数。如果 expr2 参数省略,则返回指定字段的自然对数值。 **返回结果类型**:DOUBLE。 @@ -152,10 +152,10 @@ SELECT LOG(field_name[, base]) FROM { tb_name | stb_name } [WHERE clause] #### POW ```sql -SELECT POW(field_name, power) FROM { tb_name | stb_name } [WHERE clause] +POW(expr1, expr2) ``` -**功能说明**:获得指定字段的指数为 power 的幂。 +**功能说明**:获得 expr1 的指数为 expr2 的幂。 **返回结果类型**:DOUBLE。 @@ -171,7 +171,7 @@ SELECT POW(field_name, power) FROM { tb_name | stb_name } [WHERE clause] #### ROUND ```sql -SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; +ROUND(expr) ``` **功能说明**:获得指定字段的四舍五入的结果。 @@ -181,7 +181,7 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### SIN ```sql -SELECT SIN(field_name) FROM { tb_name | stb_name } [WHERE clause] +SIN(expr) ``` **功能说明**:获得指定字段的正弦结果。 @@ -199,7 +199,7 @@ SELECT SIN(field_name) FROM { tb_name | stb_name } [WHERE clause] #### SQRT ```sql -SELECT SQRT(field_name) FROM { tb_name | stb_name } [WHERE clause] +SQRT(expr) ``` **功能说明**:获得指定字段的平方根。 @@ -217,7 +217,7 @@ SELECT SQRT(field_name) FROM { tb_name | stb_name } [WHERE clause] #### TAN ```sql -SELECT TAN(field_name) FROM { tb_name | stb_name } [WHERE clause] +TAN(expr) ``` **功能说明**:获得指定字段的正切结果。 @@ -239,7 +239,7 @@ SELECT TAN(field_name) FROM { tb_name | stb_name } [WHERE clause] #### CHAR_LENGTH ```sql -SELECT CHAR_LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] +CHAR_LENGTH(expr) ``` **功能说明**:以字符计数的字符串长度。 @@ -255,7 +255,7 @@ SELECT CHAR_LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] #### CONCAT ```sql -SELECT CONCAT(str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] +CONCAT(expr1, expr2 [, expr] ... ) ``` **功能说明**:字符串连接函数。 @@ -272,7 +272,7 @@ SELECT CONCAT(str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHER #### CONCAT_WS ```sql -SELECT CONCAT_WS(separator, str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] +CONCAT_WS(separator_expr, expr1, expr2 [, expr] ...) ``` **功能说明**:带分隔符的字符串连接函数。 @@ -289,7 +289,7 @@ SELECT CONCAT_WS(separator, str1|column1, str2|column2, ...) FROM { tb_name | st #### LENGTH ```sql -SELECT LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] +LENGTH(expr) ``` **功能说明**:以字节计数的字符串长度。 @@ -306,7 +306,7 @@ SELECT LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] #### LOWER ```sql -SELECT LOWER(str|column) FROM { tb_name | stb_name } [WHERE clause] +LOWER(expr) ``` **功能说明**:将字符串参数值转换为全小写字母。 @@ -323,7 +323,7 @@ SELECT LOWER(str|column) FROM { tb_name | stb_name } [WHERE clause] #### LTRIM ```sql -SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] +LTRIM(expr) ``` **功能说明**:返回清除左边空格后的字符串。 @@ -340,7 +340,7 @@ SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] #### RTRIM ```sql -SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] +LTRIM(expr) ``` **功能说明**:返回清除右边空格后的字符串。 @@ -357,7 +357,7 @@ SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] #### SUBSTR ```sql -SELECT SUBSTR(str,pos[,len]) FROM { tb_name | stb_name } [WHERE clause] +SUBSTR(expr, pos [,len]) ``` **功能说明**:从源字符串 str 中的指定位置 pos 开始取一个长度为 len 的子串并返回。如果输入参数 len 被忽略,返回的子串包含从 pos 开始的整个字串。 @@ -374,7 +374,7 @@ SELECT SUBSTR(str,pos[,len]) FROM { tb_name | stb_name } [WHERE clause] #### UPPER ```sql -SELECT UPPER(str|column) FROM { tb_name | stb_name } [WHERE clause] +UPPER(expr) ``` **功能说明**:将字符串参数值转换为全大写字母。 @@ -395,10 +395,10 @@ SELECT UPPER(str|column) FROM { tb_name | stb_name } [WHERE clause] #### CAST ```sql -SELECT CAST(expression AS type_name) FROM { tb_name | stb_name } [WHERE clause] +CAST(expr AS type_name) ``` -**功能说明**:数据类型转换函数,返回 expression 转换为 type_name 指定的类型后的结果。只适用于 select 子句中。 +**功能说明**:数据类型转换函数,返回 expr 转换为 type_name 指定的类型后的结果。只适用于 select 子句中。 **返回结果类型**:CAST 中指定的类型(type_name)。 @@ -419,7 +419,7 @@ SELECT CAST(expression AS type_name) FROM { tb_name | stb_name } [WHERE clause] #### TO_ISO8601 ```sql -SELECT TO_ISO8601(ts[, timezone]) FROM { tb_name | stb_name } [WHERE clause]; +TO_ISO8601(expr [, timezone]) ``` **功能说明**:将 UNIX 时间戳转换成为 ISO8601 标准的日期时间格式,并附加时区信息。timezone 参数允许用户为输出结果指定附带任意时区信息。如果 timezone 参数省略,输出结果则附带当前客户端的系统时区信息。 @@ -442,7 +442,7 @@ SELECT TO_ISO8601(ts[, timezone]) FROM { tb_name | stb_name } [WHERE clause]; #### TO_JSON ```sql -SELECT TO_JSON(str_literal) FROM { tb_name | stb_name } [WHERE clause]; +TO_JSON(str_literal) ``` **功能说明**: 将字符串常量转换为 JSON 类型。 @@ -459,7 +459,7 @@ SELECT TO_JSON(str_literal) FROM { tb_name | stb_name } [WHERE clause]; #### TO_UNIXTIMESTAMP ```sql -SELECT TO_UNIXTIMESTAMP(datetime_string) FROM { tb_name | stb_name } [WHERE clause]; +TO_UNIXTIMESTAMP(expr) ``` **功能说明**:将日期时间格式的字符串转换成为 UNIX 时间戳。 @@ -487,9 +487,7 @@ SELECT TO_UNIXTIMESTAMP(datetime_string) FROM { tb_name | stb_name } [WHERE clau #### NOW ```sql -SELECT NOW() FROM { tb_name | stb_name } [WHERE clause]; -SELECT select_expr FROM { tb_name | stb_name } WHERE ts_col cond_operatior NOW(); -INSERT INTO tb_name VALUES (NOW(), ...); +NOW() ``` **功能说明**:返回客户端当前系统时间。 @@ -512,7 +510,7 @@ INSERT INTO tb_name VALUES (NOW(), ...); #### TIMEDIFF ```sql -SELECT TIMEDIFF(ts | datetime_string1, ts | datetime_string2 [, time_unit]) FROM { tb_name | stb_name } [WHERE clause]; +TIMEDIFF(expr1, expr2 [, time_unit]) ``` **功能说明**:计算两个时间戳之间的差值,并近似到时间单位 time_unit 指定的精度。 @@ -535,7 +533,7 @@ SELECT TIMEDIFF(ts | datetime_string1, ts | datetime_string2 [, time_unit]) FROM #### TIMETRUNCATE ```sql -SELECT TIMETRUNCATE(ts | datetime_string , time_unit) FROM { tb_name | stb_name } [WHERE clause]; +TIMETRUNCATE(expr, time_unit) ``` **功能说明**:将时间戳按照指定时间单位 time_unit 进行截断。 @@ -556,7 +554,7 @@ SELECT TIMETRUNCATE(ts | datetime_string , time_unit) FROM { tb_name | stb_name #### TIMEZONE ```sql -SELECT TIMEZONE() FROM { tb_name | stb_name } [WHERE clause]; +TIMEZONE() ``` **功能说明**:返回客户端当前时区信息。 @@ -571,9 +569,7 @@ SELECT TIMEZONE() FROM { tb_name | stb_name } [WHERE clause]; #### TODAY ```sql -SELECT TODAY() FROM { tb_name | stb_name } [WHERE clause]; -SELECT select_expr FROM { tb_name | stb_name } WHERE ts_col cond_operatior TODAY()]; -INSERT INTO tb_name VALUES (TODAY(), ...); +TODAY() ``` **功能说明**:返回客户端当日零时的系统时间。 @@ -600,7 +596,12 @@ TDengine 支持针对数据的聚合查询。提供如下聚合函数。 ### APERCENTILE ```sql -SELECT APERCENTILE(field_name, P[, algo_type]) FROM { tb_name | stb_name } [WHERE clause] +APERCENTILE(expr, p [, algo_type]) + +algo_type: { + "default" + | "t-digest" +} ``` **功能说明**:统计表/超级表中指定列的值的近似百分比分位数,与 PERCENTILE 函数相似,但是返回近似结果。 @@ -612,14 +613,14 @@ SELECT APERCENTILE(field_name, P[, algo_type]) FROM { tb_name | stb_name } [WHER **适用于**:表和超级表。 **说明**: -- P值范围是[0,100],当为0时等同于MIN,为100时等同于MAX。 +- p值范围是[0,100],当为0时等同于MIN,为100时等同于MAX。 - algo_type 取值为 "default" 或 "t-digest"。 输入为 "default" 时函数使用基于直方图算法进行计算。输入为 "t-digest" 时使用t-digest算法计算分位数的近似结果。如果不指定 algo_type 则使用 "default" 算法。 - "t-digest"算法的近似结果对于输入数据顺序敏感,对超级表查询时不同的输入排序结果可能会有微小的误差。 ### AVG ```sql -SELECT AVG(field_name) FROM tb_name [WHERE clause]; +AVG(expr) ``` **功能说明**:统计指定字段的平均值。 @@ -634,7 +635,7 @@ SELECT AVG(field_name) FROM tb_name [WHERE clause]; ### COUNT ```sql -SELECT COUNT([*|field_name]) FROM tb_name [WHERE clause]; +COUNT({* | expr}) ``` **功能说明**:统计指定字段的记录行数。 @@ -654,7 +655,7 @@ SELECT COUNT([*|field_name]) FROM tb_name [WHERE clause]; ### ELAPSED ```sql -SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE clause] [INTERVAL(interval [, offset]) [SLIDING sliding]]; +ELAPSED(ts_primary_key [, time_unit]) ``` **功能说明**:elapsed函数表达了统计周期内连续的时间长度,和twa函数配合使用可以计算统计曲线下的面积。在通过INTERVAL子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有INTERVAL子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED返回的并不是时间范围的绝对值,而是绝对值除以time_unit所得到的单位个数。 @@ -666,7 +667,7 @@ SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE **适用于**: 表,超级表,嵌套查询的外层查询 **说明**: -- field_name参数只能是表的第一列,即 TIMESTAMP 类型的主键列。 +- ts_primary_key参数只能是表的第一列,即 TIMESTAMP 类型的主键列。 - 按time_unit参数指定的时间单位返回,最小是数据库的时间分辨率。time_unit 参数未指定时,以数据库的时间分辨率为时间单位。支持的时间单位 time_unit 如下: 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 - 可以和interval组合使用,返回每个时间窗口的时间戳差值。需要特别注意的是,除第一个时间窗口和最后一个时间窗口外,中间窗口的时间戳差值均为窗口长度。 @@ -680,14 +681,14 @@ SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE ### LEASTSQUARES ```sql -SELECT LEASTSQUARES(field_name, start_val, step_val) FROM tb_name [WHERE clause]; +LEASTSQUARES(expr, start_val, step_val) ``` **功能说明**:统计表中某列的值是主键(时间戳)的拟合直线方程。start_val 是自变量初始值,step_val 是自变量的步长值。 **返回数据类型**:字符串表达式(斜率, 截距)。 -**适用数据类型**:field_name 必须是数值类型。 +**适用数据类型**:expr 必须是数值类型。 **适用于**:表。 @@ -695,7 +696,7 @@ SELECT LEASTSQUARES(field_name, start_val, step_val) FROM tb_name [WHERE clause] ### SPREAD ```sql -SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]; +SPREAD(expr) ``` **功能说明**:统计表中某列的最大值和最小值之差。 @@ -710,7 +711,7 @@ SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### STDDEV ```sql -SELECT STDDEV(field_name) FROM tb_name [WHERE clause]; +STDDEV(expr) ``` **功能说明**:统计表中某列的均方差。 @@ -725,7 +726,7 @@ SELECT STDDEV(field_name) FROM tb_name [WHERE clause]; ### SUM ```sql -SELECT SUM(field_name) FROM tb_name [WHERE clause]; +SUM(expr) ``` **功能说明**:统计表/超级表中某列的和。 @@ -740,7 +741,7 @@ SELECT SUM(field_name) FROM tb_name [WHERE clause]; ### HYPERLOGLOG ```sql -SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } [WHERE clause]; +HYPERLOGLOG(expr) ``` **功能说明**: @@ -757,7 +758,7 @@ SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### HISTOGRAM ```sql -SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_name [WHERE clause]; +HISTOGRAM(expr,bin_type, bin_description, normalized) ``` **功能说明**:统计数据按照用户指定区间的分布。 @@ -787,7 +788,7 @@ SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_nam ### PERCENTILE ```sql -SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause]; +PERCENTILE(expr, p) ``` **功能说明**:统计表中某列的值百分比分位数。 @@ -808,7 +809,7 @@ SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause]; ### BOTTOM ```sql -SELECT BOTTOM(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; +BOTTOM(expr, k) ``` **功能说明**:统计表/超级表中某列的值最小 _k_ 个非 NULL 值。如果多条数据取值一样,全部取用又会超出 k 条限制时,系统会从相同值中随机选取符合要求的数量返回。 @@ -828,7 +829,7 @@ SELECT BOTTOM(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ### FIRST ```sql -SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause]; +FIRST(expr) ``` **功能说明**:统计表/超级表中某列的值最先写入的非 NULL 值。 @@ -848,7 +849,7 @@ SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### INTERP ```sql -SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] RANGE(timestamp1,timestamp2) EVERY(interval) FILL({ VALUE | PREV | NULL | LINEAR | NEXT}); +INTERP(expr) ``` **功能说明**:返回指定时间截面指定列的记录值或插值。 @@ -871,7 +872,7 @@ SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] RA ### LAST ```sql -SELECT LAST(field_name) FROM { tb_name | stb_name } [WHERE clause]; +LAST(expr) ``` **功能说明**:统计表/超级表中某列的值最后写入的非 NULL 值。 @@ -892,7 +893,7 @@ SELECT LAST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### LAST_ROW ```sql -SELECT LAST_ROW(field_name) FROM { tb_name | stb_name }; +LAST_ROW(expr) ``` **功能说明**:返回表/超级表的最后一条记录。 @@ -911,7 +912,7 @@ SELECT LAST_ROW(field_name) FROM { tb_name | stb_name }; ### MAX ```sql -SELECT MAX(field_name) FROM { tb_name | stb_name } [WHERE clause]; +MAX(expr) ``` **功能说明**:统计表/超级表中某列的值最大值。 @@ -926,7 +927,7 @@ SELECT MAX(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### MIN ```sql -SELECT MIN(field_name) FROM {tb_name | stb_name} [WHERE clause]; +MIN(expr) ``` **功能说明**:统计表/超级表中某列的值最小值。 @@ -941,7 +942,7 @@ SELECT MIN(field_name) FROM {tb_name | stb_name} [WHERE clause]; ### MODE ```sql -SELECT MODE(field_name) FROM tb_name [WHERE clause]; +MODE(expr) ``` **功能说明**:返回出现频率最高的值,若存在多个频率相同的最高值,输出NULL。 @@ -956,7 +957,7 @@ SELECT MODE(field_name) FROM tb_name [WHERE clause]; ### SAMPLE ```sql -SELECT SAMPLE(field_name, K) FROM { tb_name | stb_name } [WHERE clause] +SAMPLE(expr, k) ``` **功能说明**: 获取数据的 k 个采样值。参数 k 的合法输入范围是 1≤ k ≤ 1000。 @@ -978,7 +979,7 @@ SELECT SAMPLE(field_name, K) FROM { tb_name | stb_name } [WHERE clause] ### TAIL ```sql -SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} [WHERE clause]; +TAIL(expr, k [, offset_rows]) ``` **功能说明**:返回跳过最后 offset_val 个,然后取连续 k 个记录,不忽略 NULL 值。offset_val 可以不输入。此时返回最后的 k 个记录。当有 offset_val 输入的情况下,该函数功能等效于 `order by ts desc LIMIT k OFFSET offset_val`。 @@ -995,7 +996,7 @@ SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} [WHERE clause]; ### TOP ```sql -SELECT TOP(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; +TOP(expr, k) ``` **功能说明**: 统计表/超级表中某列的值最大 _k_ 个非 NULL 值。如果多条数据取值一样,全部取用又会超出 k 条限制时,系统会从相同值中随机选取符合要求的数量返回。 @@ -1015,7 +1016,7 @@ SELECT TOP(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ### UNIQUE ```sql -SELECT UNIQUE(field_name) FROM {tb_name | stb_name} [WHERE clause]; +UNIQUE(expr) ``` **功能说明**:返回该列的数值首次出现的值。该函数功能与 distinct 相似,但是可以匹配标签和时间戳信息。可以针对除时间列以外的字段进行查询,可以匹配标签和时间戳,其中的标签和时间戳是第一次出现时刻的标签和时间戳。 @@ -1034,7 +1035,7 @@ SELECT UNIQUE(field_name) FROM {tb_name | stb_name} [WHERE clause]; ### CSUM ```sql -SELECT CSUM(field_name) FROM { tb_name | stb_name } [WHERE clause] +CSUM(expr) ``` **功能说明**:累加和(Cumulative sum),输出行与输入行数相同。 @@ -1057,7 +1058,12 @@ SELECT CSUM(field_name) FROM { tb_name | stb_name } [WHERE clause] ### DERIVATIVE ```sql -SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHERE clause]; +DERIVATIVE(expr, time_interval, ignore_negative) + +ignore_negative: { + 0 + | 1 +} ``` **功能说明**:统计表中某列数值的单位变化率。其中单位时间区间的长度可以通过 time_interval 参数指定,最小可以是 1 秒(1s);ignore_negative 参数的值可以是 0 或 1,为 1 时表示忽略负值。 @@ -1076,7 +1082,12 @@ SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHER ### DIFF ```sql -SELECT {DIFF(field_name, ignore_negative) | DIFF(field_name)} FROM tb_name [WHERE clause]; +DIFF(expr [, ignore_negative]) + +ignore_negative: { + 0 + | 1 +} ``` **功能说明**:统计表中某列的值与前一行对应值的差。 ignore_negative 取值为 0|1 , 可以不填,默认值为 0. 不忽略负值。ignore_negative 为 1 时表示忽略负数。 @@ -1096,7 +1107,7 @@ SELECT {DIFF(field_name, ignore_negative) | DIFF(field_name)} FROM tb_name [WHER ### IRATE ```sql -SELECT IRATE(field_name) FROM tb_name WHERE clause; +IRATE(expr) ``` **功能说明**:计算瞬时增长率。使用时间区间中最后两个样本数据来计算瞬时增长速率;如果这两个值呈递减关系,那么只取最后一个数用于计算,而不是使用二者差值。 @@ -1111,7 +1122,7 @@ SELECT IRATE(field_name) FROM tb_name WHERE clause; ### MAVG ```sql -SELECT MAVG(field_name, K) FROM { tb_name | stb_name } [WHERE clause] +MAVG(expr, k) ``` **功能说明**: 计算连续 k 个值的移动平均数(moving average)。如果输入行数小于 k,则无结果输出。参数 k 的合法输入范围是 1≤ k ≤ 1000。 @@ -1134,7 +1145,7 @@ SELECT MAVG(field_name, K) FROM { tb_name | stb_name } [WHERE clause] ### STATECOUNT ```sql -SELECT STATECOUNT(field_name, oper, val) FROM { tb_name | stb_name } [WHERE clause]; +STATECOUNT(expr, oper, val) ``` **功能说明**:返回满足某个条件的连续记录的个数,结果作为新的一列追加在每行后面。条件根据参数计算,如果条件为 true 则加 1,条件为 false 则重置为-1,如果数据为 NULL,跳过该条数据。 @@ -1161,7 +1172,7 @@ SELECT STATECOUNT(field_name, oper, val) FROM { tb_name | stb_name } [WHERE clau ### STATEDURATION ```sql -SELECT stateDuration(field_name, oper, val, unit) FROM { tb_name | stb_name } [WHERE clause]; +STATEDURATION(expr, oper, val, unit) ``` **功能说明**:返回满足某个条件的连续记录的时间长度,结果作为新的一列追加在每行后面。条件根据参数计算,如果条件为 true 则加上两个记录之间的时间长度(第一个满足条件的记录时间长度记为 0),条件为 false 则重置为-1,如果数据为 NULL,跳过该条数据。 @@ -1189,7 +1200,7 @@ SELECT stateDuration(field_name, oper, val, unit) FROM { tb_name | stb_name } [W ### TWA ```sql -SELECT TWA(field_name) FROM tb_name WHERE clause; +TWA(expr) ``` **功能说明**:时间加权平均函数。统计表中某列在一段时间内的时间加权平均。 diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index 179a3c6df0..6f26878cdd 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -177,12 +177,21 @@ taos --dump-config ### maxNumOfDistinctRes | 属性 | 说明 | -| -------- | -------------------------------- | --- | +| -------- | -------------------------------- | | 适用范围 | 仅服务端适用 | | 含义 | 允许返回的 distinct 结果最大行数 | | 取值范围 | 默认值为 10 万,最大值 1 亿 | | 缺省值 | 10 万 | +### keepColumnName + +| 属性 | 说明 | +| -------- | -------------------------------- | +| 适用范围 | 仅客户端适用 | +| 含义 | Last、First、LastRow 函数查询时,返回的列名是否包含函数名。 | +| 取值范围 | 0 表示包含函数名,1 表示不包含函数名。 | +| 缺省值 | 0 | + ## 区域相关 ### timezone diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index b05cf7a942..597e98238b 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -6,6 +6,10 @@ description: TDengine 发布历史、Release Notes 及下载链接 import Release from "/components/ReleaseV3"; +## 3.0.1.3 + + + ## 3.0.1.2 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index f793981d06..8604885d3c 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.3 + + + ## 2.2.2 diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 5b49560175..ac94b0af7d 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 9b69bec5b3..bd5e74387e 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -98,6 +98,7 @@ extern int32_t tsQueryRsmaTolerance; extern bool tsQueryPlannerTrace; extern int32_t tsQueryNodeChunkSize; extern bool tsQueryUseNodeAllocator; +extern bool tsKeepColumnName; // client extern int32_t tsMinSlidingTime; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index d11fd4da10..7aec00c7c1 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -55,11 +55,10 @@ extern int32_t tMsgDict[]; #define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8) #define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff) -#define TMSG_INFO(TYPE) \ - ((TYPE) >= 0 && ((TYPE) < TDMT_DND_MAX_MSG || (TYPE) < TDMT_MND_MAX_MSG || (TYPE) < TDMT_VND_MAX_MSG || \ - (TYPE) < TDMT_SCH_MAX_MSG || (TYPE) < TDMT_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || \ - (TYPE) < TDMT_SYNC_MAX_MSG)) \ - ? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \ +#define TMSG_INFO(TYPE) \ + ((TYPE) < TDMT_DND_MAX_MSG || (TYPE) < TDMT_MND_MAX_MSG || (TYPE) < TDMT_VND_MAX_MSG || (TYPE) < TDMT_SCH_MAX_MSG || \ + (TYPE) < TDMT_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || (TYPE) < TDMT_SYNC_MAX_MSG) \ + ? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \ : 0 #define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)) @@ -866,7 +865,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); @@ -1426,10 +1426,10 @@ typedef struct { typedef struct { SExplainRsp rsp; - uint64_t qId; - uint64_t tId; - int64_t rId; - int32_t eId; + uint64_t qId; + uint64_t tId; + int64_t rId; + int32_t eId; } SExplainLocalRsp; typedef struct STableScanAnalyzeInfo { @@ -1446,7 +1446,7 @@ typedef struct STableScanAnalyzeInfo { int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); int32_t tDeserializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); -void tFreeSExplainRsp(SExplainRsp *pRsp); +void tFreeSExplainRsp(SExplainRsp* pRsp); typedef struct { char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port @@ -1729,6 +1729,8 @@ typedef struct { int64_t maxDelay; int64_t watermark; int8_t igExpired; + int32_t numOfTags; + SArray* pTags; // array of SField } SCMCreateStreamReq; typedef struct { diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 0111b03aac..94128a4999 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -107,227 +107,230 @@ #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_CASE 219 -#define TK_END 220 -#define TK_WHEN 221 -#define TK_THEN 222 -#define TK_ELSE 223 -#define TK_BETWEEN 224 -#define TK_IS 225 -#define TK_NK_LT 226 -#define TK_NK_GT 227 -#define TK_NK_LE 228 -#define TK_NK_GE 229 -#define TK_NK_NE 230 -#define TK_MATCH 231 -#define TK_NMATCH 232 -#define TK_CONTAINS 233 -#define TK_IN 234 -#define TK_JOIN 235 -#define TK_INNER 236 -#define TK_SELECT 237 -#define TK_DISTINCT 238 -#define TK_WHERE 239 -#define TK_PARTITION 240 -#define TK_BY 241 -#define TK_SESSION 242 -#define TK_STATE_WINDOW 243 -#define TK_SLIDING 244 -#define TK_FILL 245 -#define TK_VALUE 246 -#define TK_NONE 247 -#define TK_PREV 248 -#define TK_LINEAR 249 -#define TK_NEXT 250 -#define TK_HAVING 251 -#define TK_RANGE 252 -#define TK_EVERY 253 -#define TK_ORDER 254 -#define TK_SLIMIT 255 -#define TK_SOFFSET 256 -#define TK_LIMIT 257 -#define TK_OFFSET 258 -#define TK_ASC 259 -#define TK_NULLS 260 -#define TK_ABORT 261 -#define TK_AFTER 262 -#define TK_ATTACH 263 -#define TK_BEFORE 264 -#define TK_BEGIN 265 -#define TK_BITAND 266 -#define TK_BITNOT 267 -#define TK_BITOR 268 -#define TK_BLOCKS 269 -#define TK_CHANGE 270 -#define TK_COMMA 271 -#define TK_COMPACT 272 -#define TK_CONCAT 273 -#define TK_CONFLICT 274 -#define TK_COPY 275 -#define TK_DEFERRED 276 -#define TK_DELIMITERS 277 -#define TK_DETACH 278 -#define TK_DIVIDE 279 -#define TK_DOT 280 -#define TK_EACH 281 -#define TK_FAIL 282 -#define TK_FILE 283 -#define TK_FOR 284 -#define TK_GLOB 285 -#define TK_ID 286 -#define TK_IMMEDIATE 287 -#define TK_IMPORT 288 -#define TK_INITIALLY 289 -#define TK_INSTEAD 290 -#define TK_ISNULL 291 -#define TK_KEY 292 -#define TK_NK_BITNOT 293 -#define TK_NK_SEMI 294 -#define TK_NOTNULL 295 -#define TK_OF 296 -#define TK_PLUS 297 -#define TK_PRIVILEGE 298 -#define TK_RAISE 299 -#define TK_REPLACE 300 -#define TK_RESTRICT 301 -#define TK_ROW 302 -#define TK_SEMI 303 -#define TK_STAR 304 -#define TK_STATEMENT 305 -#define TK_STRING 306 -#define TK_TIMES 307 -#define TK_UPDATE 308 -#define TK_VALUES 309 -#define TK_VARIABLE 310 -#define TK_VIEW 311 -#define TK_WAL 312 +#define TK_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_IROWTS 211 +#define TK_CAST 212 +#define TK_NOW 213 +#define TK_TODAY 214 +#define TK_TIMEZONE 215 +#define TK_CLIENT_VERSION 216 +#define TK_SERVER_VERSION 217 +#define TK_SERVER_STATUS 218 +#define TK_CURRENT_USER 219 +#define TK_COUNT 220 +#define TK_LAST_ROW 221 +#define TK_CASE 222 +#define TK_END 223 +#define TK_WHEN 224 +#define TK_THEN 225 +#define TK_ELSE 226 +#define TK_BETWEEN 227 +#define TK_IS 228 +#define TK_NK_LT 229 +#define TK_NK_GT 230 +#define TK_NK_LE 231 +#define TK_NK_GE 232 +#define TK_NK_NE 233 +#define TK_MATCH 234 +#define TK_NMATCH 235 +#define TK_CONTAINS 236 +#define TK_IN 237 +#define TK_JOIN 238 +#define TK_INNER 239 +#define TK_SELECT 240 +#define TK_DISTINCT 241 +#define TK_WHERE 242 +#define TK_PARTITION 243 +#define TK_BY 244 +#define TK_SESSION 245 +#define TK_STATE_WINDOW 246 +#define TK_SLIDING 247 +#define TK_FILL 248 +#define TK_VALUE 249 +#define TK_NONE 250 +#define TK_PREV 251 +#define TK_LINEAR 252 +#define TK_NEXT 253 +#define TK_HAVING 254 +#define TK_RANGE 255 +#define TK_EVERY 256 +#define TK_ORDER 257 +#define TK_SLIMIT 258 +#define TK_SOFFSET 259 +#define TK_LIMIT 260 +#define TK_OFFSET 261 +#define TK_ASC 262 +#define TK_NULLS 263 +#define TK_ABORT 264 +#define TK_AFTER 265 +#define TK_ATTACH 266 +#define TK_BEFORE 267 +#define TK_BEGIN 268 +#define TK_BITAND 269 +#define TK_BITNOT 270 +#define TK_BITOR 271 +#define TK_BLOCKS 272 +#define TK_CHANGE 273 +#define TK_COMMA 274 +#define TK_COMPACT 275 +#define TK_CONCAT 276 +#define TK_CONFLICT 277 +#define TK_COPY 278 +#define TK_DEFERRED 279 +#define TK_DELIMITERS 280 +#define TK_DETACH 281 +#define TK_DIVIDE 282 +#define TK_DOT 283 +#define TK_EACH 284 +#define TK_FAIL 285 +#define TK_FILE 286 +#define TK_FOR 287 +#define TK_GLOB 288 +#define TK_ID 289 +#define TK_IMMEDIATE 290 +#define TK_IMPORT 291 +#define TK_INITIALLY 292 +#define TK_INSTEAD 293 +#define TK_ISNULL 294 +#define TK_KEY 295 +#define TK_NK_BITNOT 296 +#define TK_NK_SEMI 297 +#define TK_NOTNULL 298 +#define TK_OF 299 +#define TK_PLUS 300 +#define TK_PRIVILEGE 301 +#define TK_RAISE 302 +#define TK_REPLACE 303 +#define TK_RESTRICT 304 +#define TK_ROW 305 +#define TK_SEMI 306 +#define TK_STAR 307 +#define TK_STATEMENT 308 +#define TK_STRING 309 +#define TK_TIMES 310 +#define TK_UPDATE 311 +#define TK_VALUES 312 +#define TK_VARIABLE 313 +#define TK_VIEW 314 +#define TK_WAL 315 #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 3bed77d682..0d43539629 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/function/functionMgt.h b/include/libs/function/functionMgt.h index c9c19579cb..cb4960707b 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -119,9 +119,10 @@ typedef enum EFunctionType { FUNCTION_TYPE_WSTART, FUNCTION_TYPE_WEND, FUNCTION_TYPE_WDURATION, + FUNCTION_TYPE_IROWTS, // internal function - FUNCTION_TYPE_SELECT_VALUE, + FUNCTION_TYPE_SELECT_VALUE = 3750, FUNCTION_TYPE_BLOCK_DIST, // block distribution aggregate function FUNCTION_TYPE_BLOCK_DIST_INFO, // block distribution pseudo column function FUNCTION_TYPE_TO_COLUMN, @@ -212,6 +213,7 @@ bool fmIsClientPseudoColumnFunc(int32_t funcId); bool fmIsMultiRowsFunc(int32_t funcId); bool fmIsKeepOrderFunc(int32_t funcId); bool fmIsCumulativeFunc(int32_t funcId); +bool fmIsInterpPseudoColumnFunc(int32_t funcId); int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 22e92b2e80..0752512951 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 301e11fd17..560832cd74 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) @@ -239,6 +239,7 @@ typedef enum ENodeType { QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_FILL, + QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION, diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index a531eeffde..25ff18a8fc 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; @@ -233,6 +235,8 @@ typedef struct SSortLogicNode { typedef struct SPartitionLogicNode { SLogicNode node; SNodeList* pPartitionKeys; + SNodeList* pTags; + SNode* pSubtable; } SPartitionLogicNode; typedef enum ESubplanType { @@ -332,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; @@ -458,6 +464,8 @@ typedef struct SFillPhysiNode { EOrder inputTsOrder; } SFillPhysiNode; +typedef SFillPhysiNode SStreamFillPhysiNode; + typedef struct SMultiTableIntervalPhysiNode { SIntervalPhysiNode interval; SNodeList* pPartitionKeys; @@ -495,7 +503,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 9b150159fd..5ee097bd92 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -261,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/stream/streamState.h b/include/libs/stream/streamState.h index 849d83a58b..0adcf976f0 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -31,6 +31,7 @@ typedef struct { TDB* db; TTB* pStateDb; TTB* pFuncStateDb; + TTB* pFillStateDb; // todo refactor TXN txn; } SStreamState; @@ -51,15 +52,22 @@ int32_t streamStateFuncDel(SStreamState* pState, const STupleKey* key); int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); int32_t streamStateGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); int32_t streamStateDel(SStreamState* pState, const SWinKey* key); + +int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); +int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); +int32_t streamStateFillDel(SStreamState* pState, const SWinKey* key); + int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); int32_t streamStateReleaseBuf(SStreamState* pState, const SWinKey* key, void* pVal); void streamFreeVal(void* val); SStreamStateCur* streamStateGetCur(SStreamState* pState, const SWinKey* key); -SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key); -SStreamStateCur* streamStateSeekKeyPrev(SStreamState* pState, const SWinKey* key); +SStreamStateCur* streamStateGetAndCheckCur(SStreamState* pState, SWinKey* key); +SStreamStateCur* streamStateFillSeekKeyNext(SStreamState* pState, const SWinKey* key); +SStreamStateCur* streamStateFillSeekKeyPrev(SStreamState* pState, const SWinKey* key); void streamStateFreeCur(SStreamStateCur* pCur); +int32_t streamStateGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); int32_t streamStateSeekFirst(SStreamState* pState, SStreamStateCur* pCur); diff --git a/include/os/osSocket.h b/include/os/osSocket.h index 4bad51e263..c6729da76a 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 8eb341faa7..8c1885efdf 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/packaging/cfg/nginxd.service b/packaging/cfg/nginxd.service deleted file mode 100644 index 50bbc1a21d..0000000000 --- a/packaging/cfg/nginxd.service +++ /dev/null @@ -1,22 +0,0 @@ -[Unit] -Description=Nginx For TDengine Service -After=network-online.target -Wants=network-online.target - -[Service] -Type=forking -PIDFile=/usr/local/nginxd/logs/nginx.pid -ExecStart=/usr/local/nginxd/sbin/nginx -ExecStop=/usr/local/nginxd/sbin/nginx -s stop -TimeoutStopSec=1000000s -LimitNOFILE=infinity -LimitNPROC=infinity -LimitCORE=infinity -TimeoutStartSec=0 -StandardOutput=null -Restart=always -StartLimitBurst=3 -StartLimitInterval=60s - -[Install] -WantedBy=multi-user.target diff --git a/packaging/check_package.sh b/packaging/check_package.sh index e728c6455a..5c3a2f9267 100644 --- a/packaging/check_package.sh +++ b/packaging/check_package.sh @@ -38,8 +38,6 @@ temp_version="" fin_result="" service_config_dir="/etc/systemd/system" -nginx_port=6060 -nginx_dir="/usr/local/nginxd" # Color setting RED='\033[0;31m' @@ -132,10 +130,7 @@ function check_main_path() { check_file ${install_main_dir} $i done if [ "$verMode" == "cluster" ]; then - nginx_main_dir=("admin" "conf" "html" "sbin" "logs") - for i in "${nginx_main_dir[@]}";do - check_file ${nginx_dir} $i - done + check_file ${install_main_dir} "share/admin" fi echo -e "Check main path:\033[32mOK\033[0m!" } @@ -150,9 +145,6 @@ function check_bin_path() { for i in "${lbin_dir[@]}";do check_link ${bin_link_dir}/$i done - if [ "$verMode" == "cluster" ]; then - check_file ${nginx_dir}/sbin nginx - fi echo -e "Check bin path:\033[32mOK\033[0m!" } diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 5088e9bdac..19abda8793 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -50,8 +50,7 @@ install_main_dir=${installDir} bin_dir="${installDir}/bin" service_config_dir="/etc/systemd/system" -nginx_port=6060 -nginx_dir="/usr/local/nginxd" +web_port=6041 # Color setting RED='\033[0;31m' @@ -182,7 +181,7 @@ function install_main_path() { ${csudo}mkdir -p ${install_main_dir}/include # ${csudo}mkdir -p ${install_main_dir}/init.d if [ "$verMode" == "cluster" ]; then - ${csudo}mkdir -p ${nginx_dir} + ${csudo}mkdir -p ${install_main_dir}/share fi if [[ -e ${script_dir}/email ]]; then @@ -218,12 +217,6 @@ function install_bin() { [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : - - if [ "$verMode" == "cluster" ]; then - ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/* - ${csudo}mkdir -p ${nginx_dir}/logs - ${csudo}chmod 777 ${nginx_dir}/sbin/nginx - fi } function install_lib() { @@ -574,6 +567,13 @@ function install_examples() { fi } +function install_web() { + if [ -d "${script_dir}/share" ]; then + ${csudo}cp -rf ${binary_dir}/share/* ${install_main_dir}/share + fi +} + + function clean_service_on_sysvinit() { if pidof ${serverName} &>/dev/null; then ${csudo}service ${serverName} stop || : @@ -654,16 +654,6 @@ function clean_service_on_systemd() { fi ${csudo}systemctl disable tarbitratord &>/dev/null || echo &>/dev/null ${csudo}rm -f ${tarbitratord_service_config} - - if [ "$verMode" == "cluster" ]; then - nginx_service_config="${service_config_dir}/nginxd.service" - if systemctl is-active --quiet nginxd; then - echo "Nginx for ${productName} is running, stopping it..." - ${csudo}systemctl stop nginxd &>/dev/null || echo &>/dev/null - fi - ${csudo}systemctl disable nginxd &>/dev/null || echo &>/dev/null - ${csudo}rm -f ${nginx_service_config} - fi } function install_service_on_systemd() { @@ -677,19 +667,6 @@ function install_service_on_systemd() { ${csudo}systemctl enable ${serverName} ${csudo}systemctl daemon-reload - - if [ "$verMode" == "cluster" ]; then - [ -f ${script_dir}/cfg/nginxd.service ] && - ${csudo}cp ${script_dir}/cfg/nginxd.service \ - ${service_config_dir}/ || : - ${csudo}systemctl daemon-reload - - if ! ${csudo}systemctl enable nginxd &>/dev/null; then - ${csudo}systemctl daemon-reexec - ${csudo}systemctl enable nginxd - fi - ${csudo}systemctl start nginxd - fi } function install_adapter_service() { @@ -793,19 +770,6 @@ function updateProduct() { sleep 1 fi - if [ "$verMode" == "cluster" ]; then - if pidof nginx &>/dev/null; then - if ((${service_mod} == 0)); then - ${csudo}systemctl stop nginxd || : - elif ((${service_mod} == 1)); then - ${csudo}service nginxd stop || : - else - kill_process nginx - fi - sleep 1 - fi - fi - install_main_path install_log @@ -817,6 +781,7 @@ function updateProduct() { fi install_examples + install_web if [ -z $1 ]; then install_bin install_service @@ -825,18 +790,6 @@ function updateProduct() { install_adapter_config openresty_work=false - if [ "$verMode" == "cluster" ]; then - # Check if openresty is installed - # Check if nginx is installed successfully - if type curl &>/dev/null; then - if curl -sSf http://127.0.0.1:${nginx_port} &>/dev/null; then - echo -e "\033[44;32;1mNginx for ${productName} is updated successfully!${NC}" - openresty_work=true - else - echo -e "\033[44;31;5mNginx for ${productName} does not work! Please try again!\033[0m" - fi - fi - fi echo echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${cfg_install_dir}/${configFile}" @@ -857,7 +810,7 @@ function updateProduct() { fi if [ ${openresty_work} = 'true' ]; then - echo -e "${GREEN_DARK}To access ${productName} ${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${nginx_port}${NC}" + echo -e "${GREEN_DARK}To access ${productName} ${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${web_port}${NC}" else echo -e "${GREEN_DARK}To access ${productName} ${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell${NC}" fi @@ -906,6 +859,7 @@ function installProduct() { install_connector fi install_examples + install_web if [ -z $1 ]; then # install service and client # For installing new @@ -915,17 +869,6 @@ function installProduct() { install_adapter_config openresty_work=false - if [ "$verMode" == "cluster" ]; then - # Check if nginx is installed successfully - if type curl &>/dev/null; then - if curl -sSf http://127.0.0.1:${nginx_port} &>/dev/null; then - echo -e "\033[44;32;1mNginx for ${productName} is installed successfully!${NC}" - openresty_work=true - else - echo -e "\033[44;31;5mNginx for ${productName} does not work! Please try again!\033[0m" - fi - fi - fi install_config diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index d1e7a222cc..58b4385001 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -151,6 +151,7 @@ function install_main_path() { ${csudo}mkdir -p ${install_main_dir}/driver ${csudo}mkdir -p ${install_main_dir}/examples ${csudo}mkdir -p ${install_main_dir}/include + ${csudo}mkdir -p ${install_main_dir}/share # ${csudo}mkdir -p ${install_main_dir}/init.d else ${csudo}rm -rf ${install_main_dir} || ${csudo}rm -rf ${install_main_2_dir} || : @@ -161,6 +162,7 @@ function install_main_path() { ${csudo}mkdir -p ${install_main_dir}/driver || ${csudo}mkdir -p ${install_main_2_dir}/driver ${csudo}mkdir -p ${install_main_dir}/examples || ${csudo}mkdir -p ${install_main_2_dir}/examples ${csudo}mkdir -p ${install_main_dir}/include || ${csudo}mkdir -p ${install_main_2_dir}/include + ${csudo}mkdir -p ${install_main_dir}/share || ${csudo}mkdir -p ${install_main_2_dir}/share fi } @@ -469,6 +471,16 @@ function install_examples() { fi } +function install_web() { + if [ -d "${binary_dir}/build/share" ]; then + if [ "$osType" != "Darwin" ]; then + ${csudo}cp -rf ${binary_dir}/build/share/* ${install_main_dir}/share || : + else + ${csudo}cp -rf ${binary_dir}/build/share/* ${install_main_dir}/share || ${csudo}cp -rf ${binary_dir}/build/share/* ${install_main_2_dir}/share || : + fi + fi +} + function clean_service_on_sysvinit() { if pidof ${serverName} &>/dev/null; then ${csudo}service ${serverName} stop || : @@ -596,6 +608,7 @@ function update_TDengine() { install_lib # install_connector install_examples + install_web install_bin install_service diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 2305b96b36..fb0ef4f9a3 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -107,7 +107,7 @@ else fi install_files="${script_dir}/install.sh" -nginx_dir="${top_dir}/../enterprise/src/plugins/web" +web_dir="${top_dir}/../enterprise/src/plugins/web" init_file_deb=${script_dir}/../deb/taosd init_file_rpm=${script_dir}/../rpm/taosd @@ -132,10 +132,6 @@ if [ -f "${cfg_dir}/${serverName}.service" ]; then cp ${cfg_dir}/${serverName}.service ${install_dir}/cfg || : fi -if [ -f "${top_dir}/packaging/cfg/nginxd.service" ]; then - cp ${top_dir}/packaging/cfg/nginxd.service ${install_dir}/cfg || : -fi - mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/${serverName}.deb mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/${serverName}.rpm @@ -222,16 +218,6 @@ if [ "$verMode" == "cluster" ]; then sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove.sh >>remove_temp.sh mv remove_temp.sh ${install_dir}/bin/remove.sh - mkdir -p ${install_dir}/nginxd && cp -r ${nginx_dir}/* ${install_dir}/nginxd - cp ${nginx_dir}/png/taos.png ${install_dir}/nginxd/admin/images/taos.png - rm -rf ${install_dir}/nginxd/png - - if [ "$cpuType" == "aarch64" ]; then - cp -f ${install_dir}/nginxd/sbin/arm/64bit/nginx ${install_dir}/nginxd/sbin/ - elif [ "$cpuType" == "aarch32" ]; then - cp -f ${install_dir}/nginxd/sbin/arm/32bit/nginx ${install_dir}/nginxd/sbin/ - fi - rm -rf ${install_dir}/nginxd/sbin/arm fi cd ${install_dir} @@ -288,6 +274,13 @@ if [[ $dbName == "taos" ]]; then cp -r ${examples_dir}/C# ${install_dir}/examples mkdir -p ${install_dir}/examples/taosbenchmark-json && cp ${examples_dir}/../tools/taos-tools/example/* ${install_dir}/examples/taosbenchmark-json fi + + # Add web files + if [ -d "${web_dir}/admin" ]; then + mkdir -p ${install_dir}/share/ + cp ${web_dir}/admin ${install_dir}/share/ -r + cp ${web_dir}/png/taos.png ${install_dir}/share/admin/images/taos.png + fi fi # Copy driver diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index bf4ff564f5..a648750904 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -27,13 +27,11 @@ local_bin_link_dir="/usr/local/bin" lib_link_dir="/usr/lib" lib64_link_dir="/usr/lib64" inc_link_dir="/usr/include" -install_nginxd_dir="/usr/local/nginxd" service_config_dir="/etc/systemd/system" taos_service_name=${serverName} taosadapter_service_name="taosadapter" tarbitrator_service_name="tarbitratord" -nginx_service_name="nginxd" csudo="" if command -v sudo >/dev/null; then csudo="sudo " @@ -153,18 +151,6 @@ function clean_service_on_systemd() { fi ${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null ${csudo}rm -f ${tarbitratord_service_config} - - if [ "$verMode" == "cluster" ]; then - nginx_service_config="${service_config_dir}/${nginx_service_name}.service" - if [ -d ${install_nginxd_dir} ]; then - if systemctl is-active --quiet ${nginx_service_name}; then - echo "Nginx for ${productName} is running, stopping it..." - ${csudo}systemctl stop ${nginx_service_name} &>/dev/null || echo &>/dev/null - fi - ${csudo}systemctl disable ${nginx_service_name} &>/dev/null || echo &>/dev/null - ${csudo}rm -f ${nginx_service_config} - fi - fi } function clean_service_on_sysvinit() { @@ -239,7 +225,6 @@ clean_config ${csudo}rm -rf ${data_link_dir} || : ${csudo}rm -rf ${install_main_dir} -${csudo}rm -rf ${install_nginxd_dir} if [[ -e /etc/os-release ]]; then osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release) else diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index f2493f6c57..195466061d 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); - // lock - taosThreadSpinLock(&info->params->lock); - if (code != TSDB_CODE_SUCCESS) { - info->params->request->code = code; - info->params->request->body.resInfo.numOfRows += rows; - }else{ - info->params->request->body.resInfo.numOfRows += info->affectedRows; - } - taosThreadSpinUnlock(&info->params->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; + // lock + taosThreadSpinLock(&pParam->lock); + pParam->cnt++; + if (code != TSDB_CODE_SUCCESS) { + pParam->request->code = code; + pParam->request->body.resInfo.numOfRows += rows; + }else{ + pParam->request->body.resInfo.numOfRows += info->affectedRows; + } + 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); 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/tdataformat.c b/source/common/src/tdataformat.c index 15a369fe40..c0ae99806e 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 e2e59108aa..e4128c2474 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -95,6 +95,7 @@ int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from w bool tsQueryPlannerTrace = false; int32_t tsQueryNodeChunkSize = 32 * 1024; bool tsQueryUseNodeAllocator = true; +bool tsKeepColumnName = false; /* * denote if the server needs to compress response message at the application layer to client, including query rsp, @@ -205,7 +206,9 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input tstrncpy(cfgFile, cfgDir, sizeof(cfgDir)); } - if (apolloUrl == NULL || apolloUrl[0] == '\0') cfgGetApollUrl(envCmd, envFile, apolloUrl); + if (apolloUrl != NULL && apolloUrl[0] == '\0') { + cfgGetApollUrl(envCmd, envFile, apolloUrl); + } if (cfgLoad(pCfg, CFG_STYPE_APOLLO_URL, apolloUrl) != 0) { uError("failed to load from apollo url:%s since %s", apolloUrl, terrstr()); @@ -290,6 +293,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { 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 (cfgAddBool(pCfg, "keepColumnName", tsKeepColumnName, 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; @@ -652,6 +656,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval; tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32; tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval; + tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval; return 0; } @@ -685,7 +690,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; @@ -843,6 +850,9 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { break; } case 'k': { + if (strcasecmp("keepColumnName", name) == 0) { + tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval; + } break; } case 'l': { @@ -919,7 +929,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; } @@ -1122,11 +1134,20 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi if (tsc) { tsLogEmbedded = 0; - if (taosAddClientLogCfg(pCfg) != 0) return -1; + if (taosAddClientLogCfg(pCfg) != 0) { + cfgCleanup(pCfg); + return -1; + } } else { tsLogEmbedded = 1; - if (taosAddClientLogCfg(pCfg) != 0) return -1; - if (taosAddServerLogCfg(pCfg) != 0) return -1; + if (taosAddClientLogCfg(pCfg) != 0) { + cfgCleanup(pCfg); + return -1; + } + if (taosAddServerLogCfg(pCfg) != 0) { + cfgCleanup(pCfg); + return -1; + } } if (taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl) != 0) { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e4f3a89272..f4ffc4c996 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) { @@ -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 (tDecodeBinaryAlloc(&decoder, &pRsp->subplanInfo[i].verboseInfo, NULL) < 0) - return -1; + if (tDecodeBinaryAlloc(&decoder, &pRsp->subplanInfo[i].verboseInfo, NULL) < 0) return -1; } tEndDecode(&decoder); @@ -4826,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); @@ -4864,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 9880fe362e..f23a2b386e 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 65f21bee40..6d77180610 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 4030eaa6fe..6406ae560f 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_qnode/src/qmWorker.c b/source/dnode/mgmt/mgmt_qnode/src/qmWorker.c index 1c7edbe6be..66386b0ee0 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmWorker.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmWorker.c @@ -87,6 +87,7 @@ int32_t qmPutRpcMsgToQueue(SQnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { return 0; default: terrno = TSDB_CODE_INVALID_PARA; + taosFreeQitem(pMsg); return -1; } } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index cbcb541200..82fc286a94 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -135,12 +135,14 @@ _OVER: if (content != NULL) taosMemoryFree(content); if (root != NULL) cJSON_Delete(root); if (pFile != NULL) taosCloseFile(&pFile); + if (*ppCfgs == NULL && pCfgs != NULL) taosMemoryFree(pCfgs); terrno = code; return code; } int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { + int32_t ret = 0; char file[PATH_MAX] = {0}; char realfile[PATH_MAX] = {0}; snprintf(file, sizeof(file), "%s%svnodes.json.bak", pMgmt->path, TD_DIRSEP); @@ -161,13 +163,16 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { char *content = taosMemoryCalloc(1, maxLen + 1); if (content == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; + ret = -1; + goto _OVER; } len += snprintf(content + len, maxLen - len, "{\n"); len += snprintf(content + len, maxLen - len, " \"vnodes\": [\n"); for (int32_t i = 0; i < numOfVnodes; ++i) { SVnodeObj *pVnode = pVnodes[i]; + if (pVnode == NULL) continue; + len += snprintf(content + len, maxLen - len, " {\n"); len += snprintf(content + len, maxLen - len, " \"vgId\": %d,\n", pVnode->vgId); len += snprintf(content + len, maxLen - len, " \"dropped\": %d,\n", pVnode->dropped); @@ -180,12 +185,13 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { } len += snprintf(content + len, maxLen - len, " ]\n"); len += snprintf(content + len, maxLen - len, "}\n"); + terrno = 0; +_OVER: taosWriteFile(pFile, content, len); taosFsyncFile(pFile); taosCloseFile(&pFile); taosMemoryFree(content); - terrno = 0; for (int32_t i = 0; i < numOfVnodes; ++i) { SVnodeObj *pVnode = pVnodes[i]; @@ -196,6 +202,8 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { taosMemoryFree(pVnodes); } + if (ret != 0) return -1; + dDebug("successed to write %s, numOfVnodes:%d", realfile, numOfVnodes); return taosRenameFile(file, realfile); } \ No newline at end of file diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index e3ad1b9389..4047bc2340 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -175,7 +175,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->hashSuffix = pCreate->hashSuffix; pCfg->tsdbPageSize = pCreate->tsdbPageSize * 1024; - pCfg->standby = pCfg->standby; + pCfg->standby = 0; pCfg->syncCfg.myIndex = pCreate->selfIndex; pCfg->syncCfg.replicaNum = pCreate->replica; memset(&pCfg->syncCfg.nodeInfo, 0, sizeof(pCfg->syncCfg.nodeInfo)); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index f0c43d8b36..19ed2cbc88 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -58,11 +58,14 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) { if (pVnode->path == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(pVnode); return -1; } if (vmAllocQueue(pMgmt, pVnode) != 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(pVnode->path); + taosMemoryFree(pVnode); return -1; } @@ -221,6 +224,7 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) { SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); for (int32_t i = 0; i < numOfVnodes; ++i) { + if (ppVnodes == NULL || ppVnodes[i] == NULL) continue; vmCloseVnode(pMgmt, ppVnodes[i]); } @@ -380,7 +384,9 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { for (int32_t v = 0; v < numOfVnodes; ++v) { int32_t t = v % threadNum; SVnodeThread *pThread = &threads[t]; - pThread->ppVnodes[pThread->vnodeNum++] = ppVnodes[v]; + if (pThread->ppVnodes != NULL) { + pThread->ppVnodes[pThread->vnodeNum++] = ppVnodes[v]; + } } pMgmt->state.openVnodes = 0; @@ -411,8 +417,8 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { taosMemoryFree(threads); for (int32_t i = 0; i < numOfVnodes; ++i) { - SVnodeObj *pVnode = ppVnodes[i]; - vmReleaseVnode(pMgmt, pVnode); + if (ppVnodes == NULL || ppVnodes[i] == NULL) continue; + vmReleaseVnode(pMgmt, ppVnodes[i]); } if (ppVnodes != NULL) { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 0a42f06081..d7df30bc75 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/mndStb.h b/source/dnode/mnode/impl/inc/mndStb.h index 8f0d55e100..ba9acdbd8f 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/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 7a3dde3cf3..70c9374821 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -315,7 +315,7 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) { return 0; } - mTrace("update cluster uptime to %" PRId64, clusterObj.upTime); + mInfo("update cluster uptime to %" PRId64, clusterObj.upTime); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-uptime"); if (pTrans == NULL) return -1; diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index e0dbc26122..abc23e3d95 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); @@ -176,6 +178,8 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { SMqConsumerObj *pConsumer; void *pIter = NULL; + mTrace("start to process mq timer"); + // rebalance cannot be parallel if (!mndRebTryStart()) { mInfo("mq rebalance already in progress, do nothing"); diff --git a/source/dnode/mnode/impl/src/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c new file mode 100644 index 0000000000..881ebbbf9d --- /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 48ab485a2c..727f7b0cc9 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); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 5aad4af9ac..a628cefa65 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -119,28 +119,30 @@ static void *mndThreadFp(void *param) { lastTime++; taosMsleep(100); if (mndGetStop(pMnode)) break; + if (lastTime % 10 != 0) continue; - if (lastTime % (tsTtlPushInterval * 10) == 1) { + int64_t sec = lastTime / 10; + if (sec % tsTtlPushInterval == 0) { mndPullupTtl(pMnode); } - if (lastTime % (tsTransPullupInterval * 10) == 0) { + if (sec % tsTransPullupInterval == 0) { mndPullupTrans(pMnode); } - if (lastTime % (tsMqRebalanceInterval * 10) == 0) { + if (sec % tsMqRebalanceInterval == 0) { mndCalMqRebalance(pMnode); } - if (lastTime % (tsTelemInterval * 10) == ((tsTelemInterval - 1) * 10)) { + if (sec % tsTelemInterval == (TMIN(60, (tsTelemInterval - 1)))) { mndPullupTelem(pMnode); } - if (lastTime % (tsGrantHBInterval * 10) == 0) { + if (sec % tsGrantHBInterval == 0) { mndPullupGrant(pMnode); } - if ((lastTime % (tsUptimeInterval * 10)) == ((tsUptimeInterval - 1) * 10)) { + if (sec % tsUptimeInterval == 0) { mndIncreaseUpTime(pMnode); } } @@ -399,15 +401,15 @@ void mndPreClose(SMnode *pMnode) { atomic_store_8(&(pMnode->syncMgmt.leaderTransferFinish), 0); syncLeaderTransfer(pMnode->syncMgmt.sync); - /* - mInfo("vgId:1, mnode start leader transfer"); - // wait for leader transfer finish - while (!atomic_load_8(&(pMnode->syncMgmt.leaderTransferFinish))) { - taosMsleep(10); - mInfo("vgId:1, mnode waiting for leader transfer"); - } - mInfo("vgId:1, mnode finish leader transfer"); - */ +#if 0 + mInfo("vgId:1, mnode start leader transfer"); + // wait for leader transfer finish + while (!atomic_load_8(&(pMnode->syncMgmt.leaderTransferFinish))) { + taosMsleep(10); + mInfo("vgId:1, mnode waiting for leader transfer"); + } + mInfo("vgId:1, mnode finish leader transfer"); +#endif } } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index e0b5bb1abf..38c7850e6c 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -834,6 +834,8 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { int32_t reqLen = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); int32_t contLen = reqLen + sizeof(SMsgHead); + mInfo("start to process ttl timer"); + while (1) { pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); if (pIter == NULL) break; @@ -2579,3 +2581,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/mndTelem.c b/source/dnode/mnode/impl/src/mndTelem.c index 93f7531a27..ff2461b63b 100644 --- a/source/dnode/mnode/impl/src/mndTelem.c +++ b/source/dnode/mnode/impl/src/mndTelem.c @@ -133,7 +133,7 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) { if (taosSendHttpReport(tsTelemServer, tsTelemPort, pCont, strlen(pCont), HTTP_FLAT) != 0) { mError("failed to send telemetry report"); } else { - mTrace("succeed to send telemetry report"); + mInfo("succeed to send telemetry report"); } taosMemoryFree(pCont); } diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index b26fb16043..9613d924c4 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -1478,6 +1478,7 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans) { } static int32_t mndProcessTransTimer(SRpcMsg *pReq) { + mTrace("start to process trans timer"); mndTransPullup(pReq->info.node); return 0; } @@ -1604,7 +1605,7 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl 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/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index ff0c4b26ef..b5cfa7b0f6 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -514,7 +514,7 @@ static void sdbCloseIter(SSdbIter *pIter) { } if (pIter->name != NULL) { - taosRemoveFile(pIter->name); + (void)taosRemoveFile(pIter->name); taosMemoryFree(pIter->name); pIter->name = NULL; } @@ -606,6 +606,7 @@ int32_t sdbStartWrite(SSdb *pSdb, SSdbIter **ppIter) { if (pIter->file == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); mError("failed to open %s since %s", pIter->name, terrstr()); + sdbCloseIter(pIter); return -1; } @@ -636,9 +637,9 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i return -1; } - sdbCloseIter(pIter); if (sdbReadFile(pSdb) != 0) { mError("sdbiter:%p, failed to read from %s since %s", pIter, datafile, terrstr()); + sdbCloseIter(pIter); return -1; } @@ -656,6 +657,7 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i } mInfo("sdbiter:%p, success applyed to sdb", pIter); + sdbCloseIter(pIter); return 0; } diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index a102541aca..ecdf8c71a7 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: @@ -219,14 +221,15 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * return terrno; } SSdbRow *pOldRow = *ppOldRow; - pOldRow->status = pRaw->status; + + atomic_add_fetch_32(&pOldRow->refCount, 1); sdbPrintOper(pSdb, pOldRow, "delete"); taosHashRemove(hash, pOldRow->pObj, keySize); + pSdb->tableVer[pOldRow->type]++; taosThreadRwlockUnlock(pLock); - pSdb->tableVer[pOldRow->type]++; sdbFreeRow(pSdb, pRow, false); sdbCheckRow(pSdb, pOldRow); @@ -315,7 +318,7 @@ static void sdbCheckRow(SSdb *pSdb, SSdbRow *pRow) { TdThreadRwlock *pLock = &pSdb->locks[pRow->type]; taosThreadRwlockWrlock(pLock); - int32_t ref = atomic_load_32(&pRow->refCount); + int32_t ref = atomic_sub_fetch_32(&pRow->refCount, 1); sdbPrintOper(pSdb, pRow, "check"); if (ref <= 0 && pRow->status == SDB_STATUS_DROPPED) { sdbFreeRow(pSdb, pRow, true); diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 817089f237..916311bbee 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -32,6 +32,12 @@ extern "C" { #define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TSD ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) // clang-format on +#define TSDB_CHECK_CODE(CODE, LINO, LABEL) \ + if (CODE) { \ + LINO = __LINE__; \ + goto LABEL; \ + } + typedef struct TSDBROW TSDBROW; typedef struct TABLEID TABLEID; typedef struct TSDBKEY TSDBKEY; @@ -88,9 +94,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--; } @@ -151,7 +156,7 @@ int32_t tCmprBlockL(void const *lhs, void const *rhs); int32_t tBlockDataCreate(SBlockData *pBlockData); void tBlockDataDestroy(SBlockData *pBlockData, int8_t deepClear); -int32_t tBlockDataInit(SBlockData *pBlockData, int64_t suid, int64_t uid, STSchema *pTSchema); +int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema, int16_t *aCid, int32_t nCid); int32_t tBlockDataInitEx(SBlockData *pBlockData, SBlockData *pBlockDataFrom); void tBlockDataReset(SBlockData *pBlockData); int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid); @@ -273,6 +278,7 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk); int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pBlock, SArray *aColumnDataAgg); int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pBlock, SBlockData *pBlockData); int32_t tsdbReadSttBlock(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData); +int32_t tsdbReadSttBlockEx(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData); // SDelFWriter int32_t tsdbDelFWriterOpen(SDelFWriter **ppWriter, SDelFile *pFile, STsdb *pTsdb); int32_t tsdbDelFWriterClose(SDelFWriter **ppWriter, int8_t sync); @@ -285,8 +291,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); @@ -634,6 +640,9 @@ typedef struct SSttBlockLoadInfo { int32_t currentLoadBlockIndex; int32_t loadBlocks; double elapsedTime; + STSchema *pSchema; + int16_t *colIds; + int32_t numOfCols; } SSttBlockLoadInfo; typedef struct SMergeTree { @@ -653,13 +662,14 @@ typedef struct { } SSkmInfo; int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFReader, uint64_t suid, uint64_t uid, - STimeWindow *pTimeWindow, SVersionRange *pVerRange, void *pLoadInfo, const char *idStr); + STimeWindow *pTimeWindow, SVersionRange *pVerRange, void *pBlockLoadInfo, STSchema *pSchema, + int16_t *pCols, int32_t numOfCols, const char *idStr); void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter); bool tMergeTreeNext(SMergeTree *pMTree); TSDBROW tMergeTreeGetRow(SMergeTree *pMTree); void tMergeTreeClose(SMergeTree *pMTree); -SSttBlockLoadInfo *tCreateLastBlockLoadInfo(); +SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols); void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo); void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double *el); void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo); diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 8452d14c86..775f452864 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; @@ -457,7 +457,7 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) { tMergeTreeOpen(&state->mergeTree, 1, state->pDataFReader, state->suid, state->uid, &(STimeWindow){.skey = TSKEY_MIN, .ekey = TSKEY_MAX}, - &(SVersionRange){.minVer = 0, .maxVer = UINT64_MAX}, NULL, NULL); + &(SVersionRange){.minVer = 0, .maxVer = UINT64_MAX}, NULL, NULL, NULL, 0, NULL); bool hasVal = tMergeTreeNext(&state->mergeTree); if (!hasVal) { state->state = SFSLASTNEXTROW_FILESET; @@ -612,7 +612,8 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) { tMapDataGetItemByIdx(&state->blockMap, state->iBlock, &block, tGetDataBlk); /* code = tsdbReadBlockData(state->pDataFReader, &state->blockIdx, &block, &state->blockData, NULL, NULL); */ tBlockDataReset(state->pBlockData); - code = tBlockDataInit(state->pBlockData, state->suid, state->uid, state->pTSchema); + TABLEID tid = {.suid = state->suid, .uid = state->uid}; + code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, NULL, 0); if (code) goto _err; code = tsdbReadDataBlock(state->pDataFReader, &block, state->pBlockData); @@ -1062,7 +1063,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 +1088,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 +1162,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 +1182,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 ea9a7ec7d9..5f981649f3 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/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index a619b9f2e4..5403395623 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -437,7 +437,7 @@ static int32_t tsdbOpenCommitIter(SCommitter *pCommitter) { pIter->iSttBlk = 0; SSttBlk *pSttBlk = (SSttBlk *)taosArrayGet(pIter->aSttBlk, 0); - code = tsdbReadSttBlock(pCommitter->dReader.pReader, iStt, pSttBlk, &pIter->bData); + code = tsdbReadSttBlockEx(pCommitter->dReader.pReader, iStt, pSttBlk, &pIter->bData); if (code) goto _err; pIter->iRow = 0; @@ -1049,7 +1049,7 @@ static int32_t tsdbNextCommitRow(SCommitter *pCommitter) { if (pIter->iSttBlk < taosArrayGetSize(pIter->aSttBlk)) { SSttBlk *pSttBlk = (SSttBlk *)taosArrayGet(pIter->aSttBlk, pIter->iSttBlk); - code = tsdbReadSttBlock(pCommitter->dReader.pReader, pIter->iStt, pSttBlk, &pIter->bData); + code = tsdbReadSttBlockEx(pCommitter->dReader.pReader, pIter->iStt, pSttBlk, &pIter->bData); if (code) goto _exit; pIter->iRow = 0; @@ -1305,7 +1305,8 @@ static int32_t tsdbInitLastBlockIfNeed(SCommitter *pCommitter, TABLEID id) { if (!pBDatal->suid && !pBDatal->uid) { ASSERT(pCommitter->skmTable.suid == id.suid); ASSERT(pCommitter->skmTable.uid == id.uid); - code = tBlockDataInit(pBDatal, id.suid, id.suid ? 0 : id.uid, pCommitter->skmTable.pTSchema); + TABLEID tid = {.suid = id.suid, .uid = id.suid ? 0 : id.uid}; + code = tBlockDataInit(pBDatal, &tid, pCommitter->skmTable.pTSchema, NULL, 0); if (code) goto _exit; } @@ -1428,9 +1429,9 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) { // impl code = tsdbUpdateTableSchema(pCommitter->pTsdb->pVnode->pMeta, id.suid, id.uid, &pCommitter->skmTable); if (code) goto _err; - code = tBlockDataInit(&pCommitter->dReader.bData, id.suid, id.uid, pCommitter->skmTable.pTSchema); + code = tBlockDataInit(&pCommitter->dReader.bData, &id, pCommitter->skmTable.pTSchema, NULL, 0); if (code) goto _err; - code = tBlockDataInit(&pCommitter->dWriter.bData, id.suid, id.uid, pCommitter->skmTable.pTSchema); + code = tBlockDataInit(&pCommitter->dWriter.bData, &id, pCommitter->skmTable.pTSchema, NULL, 0); if (code) goto _err; /* merge with data in .data file */ diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 5f03a82bc0..126d2d729b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -28,11 +28,10 @@ struct SLDataIter { uint64_t uid; STimeWindow timeWindow; SVersionRange verRange; - SSttBlockLoadInfo* pBlockLoadInfo; }; -SSttBlockLoadInfo* tCreateLastBlockLoadInfo() { +SSttBlockLoadInfo* tCreateLastBlockLoadInfo(STSchema* pSchema, int16_t* colList, int32_t numOfCols) { SSttBlockLoadInfo* pLoadInfo = taosMemoryCalloc(TSDB_DEFAULT_STT_FILE, sizeof(SSttBlockLoadInfo)); if (pLoadInfo == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -55,6 +54,9 @@ SSttBlockLoadInfo* tCreateLastBlockLoadInfo() { } pLoadInfo[i].aSttBlk = taosArrayInit(4, sizeof(SSttBlk)); + pLoadInfo[i].pSchema = pSchema; + pLoadInfo[i].colIds = colList; + pLoadInfo[i].numOfCols = numOfCols; } return pLoadInfo; @@ -111,7 +113,19 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) { pInfo->currentLoadBlockIndex ^= 1; if (pIter->pSttBlk != NULL) { // current block not loaded yet int64_t st = taosGetTimestampUs(); - code = tsdbReadSttBlock(pIter->pReader, pIter->iStt, pIter->pSttBlk, &pInfo->blockData[pInfo->currentLoadBlockIndex]); + + SBlockData* pBlock = &pInfo->blockData[pInfo->currentLoadBlockIndex]; + + TABLEID id = {0}; + if (pIter->pSttBlk->suid != 0) { + id.suid = pIter->pSttBlk->suid; + } else { + id.uid = pIter->uid; + } + + tBlockDataInit(pBlock, &id, pInfo->pSchema, pInfo->colIds, pInfo->numOfCols); + code = tsdbReadSttBlock(pIter->pReader, pIter->iStt, pIter->pSttBlk, pBlock); + double el = (taosGetTimestampUs() - st)/ 1000.0; pInfo->elapsedTime += el; pInfo->loadBlocks += 1; @@ -460,7 +474,8 @@ static FORCE_INLINE int32_t tLDataIterCmprFn(const void *p1, const void *p2) { } int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFReader, uint64_t suid, uint64_t uid, - STimeWindow *pTimeWindow, SVersionRange *pVerRange, void* pBlockLoadInfo, const char* idStr) { + STimeWindow *pTimeWindow, SVersionRange *pVerRange, void* pBlockLoadInfo, STSchema* pSchema, + int16_t* pCols, int32_t numOfCols, const char* idStr) { pMTree->backward = backward; pMTree->pIter = NULL; pMTree->pIterList = taosArrayInit(4, POINTER_BYTES); @@ -475,9 +490,10 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead SSttBlockLoadInfo* pLoadInfo = NULL; if (pBlockLoadInfo == NULL) { + ASSERT(0); if (pMTree->pLoadInfo == NULL) { pMTree->destroyLoadInfo = true; - pMTree->pLoadInfo = tCreateLastBlockLoadInfo(); + pMTree->pLoadInfo = tCreateLastBlockLoadInfo(pSchema, pCols, numOfCols); } pLoadInfo = pMTree->pLoadInfo; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 681b25f676..b76b6b6280 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -79,6 +79,7 @@ typedef struct SBlockLoadSuppInfo { SColumnDataAgg tsColAgg; SColumnDataAgg** plist; int16_t* colIds; // column ids for loading file block data + int32_t numOfCols; char** buildBuf; // build string tmp buffer, todo remove it later after all string format being updated. } SBlockLoadSuppInfo; @@ -203,6 +204,7 @@ static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) { size_t numOfCols = blockDataGetNumOfCols(pBlock); + pSupInfo->numOfCols = numOfCols; pSupInfo->colIds = taosMemoryMalloc(numOfCols * sizeof(int16_t)); pSupInfo->buildBuf = taosMemoryCalloc(numOfCols, POINTER_BYTES); if (pSupInfo->buildBuf == NULL || pSupInfo->colIds == NULL) { @@ -352,7 +354,8 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet, STsdb tMergeTreeClose(&pLReader->mergeTree); if (pLReader->pInfo == NULL) { - pLReader->pInfo = tCreateLastBlockLoadInfo(); + // here we ignore the first column, which is always be the primary timestamp column + pLReader->pInfo = tCreateLastBlockLoadInfo(pReader->pSchema, &pReader->suppInfo.colIds[1], pReader->suppInfo.numOfCols - 1); if (pLReader->pInfo == NULL) { tsdbDebug("init fileset iterator failed, code:%s %s", tstrerror(terrno), pReader->idStr); return terrno; @@ -662,7 +665,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); @@ -671,7 +674,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)); } } @@ -760,51 +763,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; @@ -815,7 +810,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; @@ -851,8 +846,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); } @@ -865,13 +860,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) { @@ -895,7 +890,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 || pData->flag == (HAS_NULL|HAS_NONE)) { + 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) { @@ -940,7 +935,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); } @@ -950,8 +945,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; } @@ -1287,14 +1282,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) { -// return true; -// } + if (pnext->ts >= pBlock->minKey.ts) { + return true; } } else { // it must be the last point ASSERT(p->version == 0); @@ -1755,7 +1744,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* tsLast = getCurrentKeyInLastBlock(pLastBlockReader); } - int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo)? pBlockData->aTSKEY[pDumpInfo->rowIndex]:INT64_MIN; + int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN; TSDBKEY k = TSDBROW_KEY(pRow); TSDBKEY ik = TSDBROW_KEY(piRow); @@ -2009,7 +1998,8 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan int32_t code = tMergeTreeOpen(&pLBlockReader->mergeTree, (pLBlockReader->order == TSDB_ORDER_DESC), pReader->pFileReader, - pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange, pLBlockReader->pInfo, pReader->idStr); + pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange, pLBlockReader->pInfo, + pReader->pSchema, pReader->suppInfo.colIds, pReader->suppInfo.numOfCols, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return false; } @@ -2023,12 +2013,12 @@ 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); +bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) { + if (pBlockData->nRow > 0) { + ASSERT(pBlockData->nRow == pDumpInfo->totalRows); } - return pBlockData->nRow > 0 && (!pDumpInfo->allDumped); + return pBlockData->nRow > 0 && (!pDumpInfo->allDumped); } int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBlockScanInfo, int64_t key, @@ -2101,11 +2091,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; } @@ -2158,12 +2149,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; @@ -2465,7 +2456,8 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { code = buildComposedDataBlock(pReader); } else if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) { tBlockDataReset(&pStatus->fileBlockData); - code = tBlockDataInit(&pStatus->fileBlockData, pReader->suid, pScanInfo->uid, pReader->pSchema); + TABLEID tid = {.suid = pReader->suid, .uid = pScanInfo->uid}; + code = tBlockDataInit(&pStatus->fileBlockData, &tid, pReader->pSchema, NULL, 0); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -2945,7 +2937,8 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn // 3. load the neighbor block, and set it to be the currently accessed file data block tBlockDataReset(&pStatus->fileBlockData); - int32_t code = tBlockDataInit(&pStatus->fileBlockData, pReader->suid, pFBlock->uid, pReader->pSchema); + TABLEID tid = {.suid = pReader->suid, .uid = pFBlock->uid}; + int32_t code = tBlockDataInit(&pStatus->fileBlockData, &tid, pReader->pSchema, NULL, 0); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -3228,7 +3221,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); } @@ -3302,7 +3296,6 @@ void* tsdbGetIvtIdx(SMeta* pMeta) { uint64_t getReaderMaxVersion(STsdbReader* pReader) { return pReader->verRange.maxVer; } - static int32_t doOpenReaderImpl(STsdbReader* pReader) { SDataBlockIter* pBlockIter = &pReader->status.blockIter; @@ -3375,19 +3368,20 @@ 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, -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, -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; + STsdbReader* p = pReader->innerReader[0] != NULL ? pReader->innerReader[0] : pReader; int32_t numOfTables = taosArrayGetSize(pTableList); pReader->status.pTableMap = createDataBlockScanInfo(p, pTableList->pData, numOfTables); @@ -3416,10 +3410,14 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl // we need only one row pPrevReader->capacity = 1; pPrevReader->status.pTableMap = pReader->status.pTableMap; + pPrevReader->pSchema = pReader->pSchema; + pPrevReader->pMemSchema = pReader->pMemSchema; pPrevReader->pReadSnap = pReader->pReadSnap; pNextReader->capacity = 1; pNextReader->status.pTableMap = pReader->status.pTableMap; + pNextReader->pSchema = pReader->pSchema; + pNextReader->pMemSchema = pReader->pMemSchema; pNextReader->pReadSnap = pReader->pReadSnap; code = doOpenReaderImpl(pPrevReader); @@ -3453,11 +3451,19 @@ void tsdbReaderClose(STsdbReader* pReader) { { if (pReader->innerReader[0] != NULL) { - pReader->innerReader[0]->status.pTableMap = NULL; - pReader->innerReader[0]->pReadSnap = NULL; + STsdbReader* p = pReader->innerReader[0]; - pReader->innerReader[1]->status.pTableMap = NULL; - pReader->innerReader[1]->pReadSnap = NULL; + p->status.pTableMap = NULL; + p->pReadSnap = NULL; + p->pSchema = NULL; + p->pMemSchema = NULL; + + p = pReader->innerReader[1]; + + p->status.pTableMap = NULL; + p->pReadSnap = NULL; + p->pSchema = NULL; + p->pMemSchema = NULL; tsdbReaderClose(pReader->innerReader[0]); tsdbReaderClose(pReader->innerReader[1]); @@ -3507,7 +3513,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, @@ -3695,7 +3702,8 @@ static SArray* doRetrieveDataBlock(STsdbReader* pReader) { STableBlockScanInfo* pBlockScanInfo = taosHashGet(pStatus->pTableMap, &pFBlock->uid, sizeof(pFBlock->uid)); tBlockDataReset(&pStatus->fileBlockData); - int32_t code = tBlockDataInit(&pStatus->fileBlockData, pReader->suid, pBlockScanInfo->uid, pReader->pSchema); + TABLEID tid = {.suid = pReader->suid, .uid = pBlockScanInfo->uid}; + int32_t code = tBlockDataInit(&pStatus->fileBlockData, &tid, pReader->pSchema, NULL, 0); if (code != TSDB_CODE_SUCCESS) { terrno = code; return NULL; @@ -3765,8 +3773,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/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 5fe0b408b1..fc577e3962 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -926,12 +926,13 @@ _err: return code; } -static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo, SBlockData *pBlockData) { +static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo, SBlockData *pBlockData, + int32_t iStt) { int32_t code = 0; tBlockDataClear(pBlockData); - STsdbFD *pFD = pReader->pDataFD; + STsdbFD *pFD = (iStt < 0) ? pReader->pDataFD : pReader->aSttFD[iStt]; // uid + version + tskey code = tRealloc(&pReader->aBuf[0], pBlkInfo->szKey); @@ -1070,9 +1071,12 @@ _err: int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData *pBlockData) { int32_t code = 0; - code = tsdbReadBlockDataImpl(pReader, &pDataBlk->aSubBlock[0], pBlockData); + code = tsdbReadBlockDataImpl(pReader, &pDataBlk->aSubBlock[0], pBlockData, -1); if (code) goto _err; + ASSERT(pDataBlk->nSubBlock == 1); + +#if 0 if (pDataBlk->nSubBlock > 1) { SBlockData bData1; SBlockData bData2; @@ -1113,6 +1117,7 @@ int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData tBlockDataDestroy(&bData1, 1); tBlockDataDestroy(&bData2, 1); } +#endif return code; @@ -1123,23 +1128,38 @@ _err: int32_t tsdbReadSttBlock(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData) { int32_t code = 0; + int32_t lino = 0; + + code = tsdbReadBlockDataImpl(pReader, &pSttBlk->bInfo, pBlockData, iStt); + TSDB_CHECK_CODE(code, lino, _exit); + +_exit: + if (code) { + tsdbError("vgId:%d %s failed at %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t tsdbReadSttBlockEx(SDataFReader *pReader, int32_t iStt, SSttBlk *pSttBlk, SBlockData *pBlockData) { + int32_t code = 0; + int32_t lino = 0; // alloc code = tRealloc(&pReader->aBuf[0], pSttBlk->bInfo.szBlock); - if (code) goto _err; + TSDB_CHECK_CODE(code, lino, _exit); // read code = tsdbReadFile(pReader->aSttFD[iStt], pSttBlk->bInfo.offset, pReader->aBuf[0], pSttBlk->bInfo.szBlock); - if (code) goto _err; + TSDB_CHECK_CODE(code, lino, _exit); // decmpr code = tDecmprBlockData(pReader->aBuf[0], pSttBlk->bInfo.szBlock, pBlockData, &pReader->aBuf[1]); - if (code) goto _err; + TSDB_CHECK_CODE(code, lino, _exit); - return code; - -_err: - tsdbError("vgId:%d tsdb read stt block failed since %s", TD_VID(pReader->pTsdb->pVnode), tstrerror(code)); +_exit: + if (code) { + tsdbError("vgId:%d %s failed at %d since %s", TD_VID(pReader->pTsdb->pVnode), __func__, lino, tstrerror(code)); + } return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 99e88a442c..a928dc3484 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -140,7 +140,7 @@ static int32_t tsdbSnapReadOpenFile(STsdbSnapReader* pReader) { if (pSttBlk->minVer > pReader->ever) continue; if (pSttBlk->maxVer < pReader->sver) continue; - code = tsdbReadSttBlock(pReader->pDataFReader, iStt, pSttBlk, &pIter->bData); + code = tsdbReadSttBlockEx(pReader->pDataFReader, iStt, pSttBlk, &pIter->bData); if (code) goto _err; for (pIter->iRow = 0; pIter->iRow < pIter->bData.nRow; pIter->iRow++) { @@ -223,7 +223,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { if (pSttBlk->minVer > pReader->ever || pSttBlk->maxVer < pReader->sver) continue; - code = tsdbReadSttBlock(pReader->pDataFReader, pIter->iStt, pSttBlk, &pIter->bData); + code = tsdbReadSttBlockEx(pReader->pDataFReader, pIter->iStt, pSttBlk, &pIter->bData); if (code) goto _err; pIter->iRow = -1; @@ -319,7 +319,7 @@ static int32_t tsdbSnapReadData(STsdbSnapReader* pReader, uint8_t** ppData) { code = tsdbUpdateTableSchema(pTsdb->pVnode->pMeta, id.suid, id.uid, &pReader->skmTable); if (code) goto _err; - code = tBlockDataInit(pBlockData, id.suid, id.uid, pReader->skmTable.pTSchema); + code = tBlockDataInit(pBlockData, &id, pReader->skmTable.pTSchema, NULL, 0); if (code) goto _err; while (pRowInfo->suid == id.suid && pRowInfo->uid == id.uid) { @@ -715,7 +715,7 @@ static int32_t tsdbSnapWriteTableDataStart(STsdbSnapWriter* pWriter, TABLEID* pI if (code) goto _err; tMapDataReset(&pWriter->dWriter.mDataBlk); - code = tBlockDataInit(&pWriter->dWriter.bData, pId->suid, pId->uid, pWriter->skmTable.pTSchema); + code = tBlockDataInit(&pWriter->dWriter.bData, pId, pWriter->skmTable.pTSchema, NULL, 0); if (code) goto _err; return code; @@ -1000,7 +1000,8 @@ static int32_t tsdbSnapWriteToSttFile(STsdbSnapWriter* pWriter, int32_t iRow) { code = tsdbUpdateTableSchema(pWriter->pTsdb->pVnode->pMeta, pWriter->id.suid, pWriter->id.uid, &pWriter->skmTable); if (code) goto _err; - code = tBlockDataInit(pBData, pWriter->id.suid, pWriter->id.suid ? 0 : pWriter->id.uid, pWriter->skmTable.pTSchema); + TABLEID tid = {.suid = pWriter->id.suid, .uid = pWriter->id.suid ? 0 : pWriter->id.uid}; + code = tBlockDataInit(pBData, &tid, pWriter->skmTable.pTSchema, NULL, 0); if (code) goto _err; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 64c150484b..4999e7a49a 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 { @@ -948,24 +948,47 @@ void tBlockDataDestroy(SBlockData *pBlockData, int8_t deepClear) { pBlockData->aColData = NULL; } -int32_t tBlockDataInit(SBlockData *pBlockData, int64_t suid, int64_t uid, STSchema *pTSchema) { +int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema, int16_t *aCid, int32_t nCid) { int32_t code = 0; - ASSERT(suid || uid); + ASSERT(pId->suid || pId->uid); - pBlockData->suid = suid; - pBlockData->uid = uid; + pBlockData->suid = pId->suid; + pBlockData->uid = pId->uid; pBlockData->nRow = 0; taosArrayClear(pBlockData->aIdx); - for (int32_t iColumn = 1; iColumn < pTSchema->numOfCols; iColumn++) { + if (aCid) { + int32_t iColumn = 1; STColumn *pTColumn = &pTSchema->columns[iColumn]; + for (int32_t iCid = 0; iCid < nCid; iCid++) { + while (pTColumn && pTColumn->colId < aCid[iCid]) { + iColumn++; + pTColumn = (iColumn < pTSchema->numOfCols) ? &pTSchema->columns[iColumn] : NULL; + } - SColData *pColData; - code = tBlockDataAddColData(pBlockData, iColumn - 1, &pColData); - if (code) goto _exit; + if (pTColumn == NULL) { + break; + } else if (pTColumn->colId == aCid[iCid]) { + SColData *pColData; + code = tBlockDataAddColData(pBlockData, taosArrayGetSize(pBlockData->aIdx), &pColData); + if (code) goto _exit; + tColDataInit(pColData, pTColumn->colId, pTColumn->type, (pTColumn->flags & COL_SMA_ON) ? 1 : 0); - tColDataInit(pColData, pTColumn->colId, pTColumn->type, (pTColumn->flags & COL_SMA_ON) ? 1 : 0); + iColumn++; + pTColumn = (iColumn < pTSchema->numOfCols) ? &pTSchema->columns[iColumn] : NULL; + } + } + } else { + for (int32_t iColumn = 1; iColumn < pTSchema->numOfCols; iColumn++) { + STColumn *pTColumn = &pTSchema->columns[iColumn]; + + SColData *pColData; + code = tBlockDataAddColData(pBlockData, iColumn - 1, &pColData); + if (code) goto _exit; + + tColDataInit(pColData, pTColumn->colId, pTColumn->type, (pTColumn->flags & COL_SMA_ON) ? 1 : 0); + } } _exit: @@ -1505,7 +1528,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/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index a941b5955c..2c3808a703 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -688,6 +688,8 @@ static void vnodeRestoreFinish(struct SSyncFSM *pFsm) { } } while (true); + walApplyVer(pVnode->pWal, pVnode->state.applied); + pVnode->restored = true; vDebug("vgId:%d, sync restore finished", pVnode->config.vgId); } diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index f47855c2d0..27760d7969 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -34,6 +34,7 @@ extern "C" { #include "scalar.h" #include "taosdef.h" #include "tarray.h" +#include "tfill.h" #include "thash.h" #include "tlockfree.h" #include "tmsg.h" @@ -799,6 +800,22 @@ typedef struct SStreamPartitionOperatorInfo { SSDataBlock* pDelRes; } SStreamPartitionOperatorInfo; +typedef struct SStreamFillOperatorInfo { + SStreamFillSupporter* pFillSup; + SSDataBlock* pRes; + SSDataBlock* pSrcBlock; + int32_t srcRowIndex; + SSDataBlock* pPrevSrcBlock; + SSDataBlock* pSrcDelBlock; + int32_t srcDelRowIndex; + SSDataBlock* pDelRes; + SNode* pCondition; + SArray* pColMatchColInfo; + int32_t primaryTsCol; + int32_t primarySrcSlotId; + SStreamFillInfo* pFillInfo; +} SStreamFillOperatorInfo; + typedef struct STimeSliceOperatorInfo { SSDataBlock* pRes; STimeWindow win; @@ -991,7 +1008,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); @@ -1007,6 +1024,8 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode, + SExecTaskInfo* pTaskInfo); int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, int32_t numOfOutput, SArray* pPseudoList); @@ -1095,6 +1114,7 @@ int32_t setOutputBuf(STimeWindow* win, SResultRow** pResult, int64_t tableGroupI SExecTaskInfo* pTaskInfo); int32_t releaseOutputBuf(SExecTaskInfo* pTaskInfo, SWinKey* pKey, SResultRow* pResult); int32_t saveOutputBuf(SExecTaskInfo* pTaskInfo, SWinKey* pKey, SResultRow* pResult, int32_t resSize); +void getNextIntervalWindow(SInterval* pInterval, STimeWindow* tw, int32_t order); #ifdef __cplusplus } diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index 63abfc019d..ed019be767 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -23,12 +23,13 @@ extern "C" { #include "os.h" #include "taosdef.h" #include "tcommon.h" +#include "tsimplehash.h" struct SSDataBlock; typedef struct SFillColInfo { - SExprInfo *pExpr; - bool notFillCol; // denote if this column needs fill operation + SExprInfo* pExpr; + bool notFillCol; // denote if this column needs fill operation SVariant fillVal; } SFillColInfo; @@ -51,46 +52,96 @@ typedef struct { } SRowVal; typedef struct SFillInfo { - TSKEY start; // start timestamp - TSKEY end; // endKey for fill - TSKEY currentKey; // current active timestamp, the value may be changed during the fill procedure. - int32_t tsSlotId; // primary time stamp slot id - int32_t srcTsSlotId; // timestamp column id in the source data block. - int32_t order; // order [TSDB_ORDER_ASC|TSDB_ORDER_DESC] - int32_t type; // fill type - int32_t numOfRows; // number of rows in the input data block - int32_t index; // active row index - int32_t numOfTotal; // number of filled rows in one round - int32_t numOfCurrent; // number of filled rows in current results - int32_t numOfCols; // number of columns, including the tags columns - SInterval interval; - SRowVal prev; - SRowVal next; - SSDataBlock *pSrcBlock; - int32_t alloc; // data buffer size in rows + TSKEY start; // start timestamp + TSKEY end; // endKey for fill + TSKEY currentKey; // current active timestamp, the value may be changed during the fill procedure. + int32_t tsSlotId; // primary time stamp slot id + int32_t srcTsSlotId; // timestamp column id in the source data block. + int32_t order; // order [TSDB_ORDER_ASC|TSDB_ORDER_DESC] + int32_t type; // fill type + int32_t numOfRows; // number of rows in the input data block + int32_t index; // active row index + int32_t numOfTotal; // number of filled rows in one round + int32_t numOfCurrent; // number of filled rows in current results + int32_t numOfCols; // number of columns, including the tags columns + SInterval interval; + SRowVal prev; + SRowVal next; + SSDataBlock* pSrcBlock; + int32_t alloc; // data buffer size in rows - SFillColInfo* pFillCol; // column info for fill operations - SFillTagColInfo* pTags; // tags value for filling gap - const char* id; + SFillColInfo* pFillCol; // column info for fill operations + SFillTagColInfo* pTags; // tags value for filling gap + const char* id; } SFillInfo; +typedef struct SResultCellData { + bool isNull; + int8_t type; + int32_t bytes; + char pData[]; +} SResultCellData; + +typedef struct SResultRowData { + TSKEY key; + SResultCellData* pRowVal; +} SResultRowData; + +typedef struct SStreamFillLinearInfo { + TSKEY nextEnd; + SArray* pDeltaVal; // double. value for Fill(linear). + SArray* pNextDeltaVal; // double. value for Fill(linear). + int64_t winIndex; + bool hasNext; +} SStreamFillLinearInfo; + +typedef struct SStreamFillInfo { + TSKEY start; // startKey for fill + TSKEY end; // endKey for fill + TSKEY current; // current Key for fill + TSKEY preRowKey; + TSKEY nextRowKey; + SResultRowData* pResRow; + SStreamFillLinearInfo* pLinearInfo; + bool needFill; + int32_t type; // fill type + int32_t pos; + SArray* delRanges; + int32_t delIndex; +} SStreamFillInfo; + +typedef struct SStreamFillSupporter { + int32_t type; // fill type + SInterval interval; + SResultRowData prev; + SResultRowData cur; + SResultRowData next; + SResultRowData nextNext; + SFillColInfo* pAllColInfo; // fill exprs and not fill exprs + int32_t numOfAllCols; // number of all exprs, including the tags columns + int32_t numOfFillCols; + int32_t numOfNotFillCols; + int32_t rowSize; + SSHashObj* pResMap; + bool hasDelete; +} SStreamFillSupporter; + int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRows); - -void taosFillSetStartInfo(struct SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey); -void taosResetFillInfo(struct SFillInfo* pFillInfo, TSKEY startTimestamp); -void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struct SSDataBlock* pInput); -struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprInfo* pNotFillExpr, int32_t numOfNotFillCols, const struct SNodeListNode* val); -bool taosFillHasMoreResults(struct SFillInfo* pFillInfo); +void taosFillSetStartInfo(struct SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey); +void taosResetFillInfo(struct SFillInfo* pFillInfo, TSKEY startTimestamp); +void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struct SSDataBlock* pInput); +struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprInfo* pNotFillExpr, + int32_t numOfNotFillCols, const struct SNodeListNode* val); +bool taosFillHasMoreResults(struct SFillInfo* pFillInfo); SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t numOfNotFillCols, int32_t capacity, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t slotId, int32_t order, const char* id); -void* taosDestroyFillInfo(struct SFillInfo *pFillInfo); +void* taosDestroyFillInfo(struct SFillInfo* pFillInfo); int64_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, SSDataBlock* p, int32_t capacity); -int64_t getFillInfoStart(struct SFillInfo *pFillInfo); - +int64_t getFillInfoStart(struct SFillInfo* pFillInfo); #ifdef __cplusplus } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 7fcd41dc3e..9917791312 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1110,7 +1110,8 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO } } -static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, bool keep, int32_t status); +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) { @@ -1120,12 +1121,12 @@ 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); + int32_t code = filterInitFromNode((SNode*)pFilterNode, &filter, 0); SFilterColumnParam param1 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock}; code = filterSetDataFromSlotId(filter, ¶m1); SColumnInfoData* p = NULL; - int32_t status = 0; + int32_t status = 0; // todo the keep seems never to be True?? bool keep = filterExecute(filter, pBlock, &p, NULL, param1.numOfCols, &status); @@ -1201,7 +1202,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoD } } - void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) { +void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) { // for simple group by query without interval, all the tables belong to one group result. SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SAggOperatorInfo* pAggInfo = pOperator->info; @@ -1787,7 +1788,9 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf 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); + 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 { @@ -1798,8 +1801,8 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf } 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); + 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); @@ -1824,9 +1827,10 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf pMsgSendInfo->fp = loadRemoteDataCallback; int64_t transporterId = 0; - int32_t code = asyncSendMsgToServer(pExchangeInfo->pTransporter, &pSource->addr.epSet, &transporterId, pMsgSendInfo); + int32_t code = + asyncSendMsgToServer(pExchangeInfo->pTransporter, &pSource->addr.epSet, &transporterId, pMsgSendInfo); } - + return TSDB_CODE_SUCCESS; } @@ -3356,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); @@ -3539,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 ? pHandle->pMsgCb->clientRpc : NULL, (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) { @@ -3729,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); @@ -3739,6 +3742,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo pOptr = createMergeJoinOperatorInfo(ops, size, (SSortMergeJoinPhysiNode*)pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_FILL == type) { pOptr = createFillOperatorInfo(ops[0], (SFillPhysiNode*)pPhyNode, pTaskInfo); + } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL == type) { + pOptr = createStreamFillOperatorInfo(ops[0], (SStreamFillPhysiNode*)pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC == type) { pOptr = createIndefinitOutputOperatorInfo(ops[0], pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC == type) { @@ -4058,7 +4063,7 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) { if (!pTaskInfo->localFetch.localExec) { nodesDestroyNode((SNode*)pTaskInfo->pSubplan); } - + taosMemoryFreeClear(pTaskInfo->sql); taosMemoryFreeClear(pTaskInfo->id.str); taosMemoryFreeClear(pTaskInfo); diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 5eb6557dbd..7cb641a943 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 5f54d56ca7..fa05608ced 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1022,11 +1022,7 @@ static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, 0); } -static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion) { - if (pInfo->partitionSup.needCalc) { - return getGroupIdByCol(pInfo, uid, ts, maxVersion); - } - +static uint64_t getGroupIdByUid(SStreamScanInfo* pInfo, uint64_t uid) { SHashObj* map = pInfo->pTableScanOp->pTaskInfo->tableqinfoList.map; uint64_t* groupId = taosHashGet(map, &uid, sizeof(int64_t)); if (groupId) { @@ -1035,6 +1031,14 @@ static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, return 0; } +static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion) { + if (pInfo->partitionSup.needCalc) { + return getGroupIdByCol(pInfo, uid, ts, maxVersion); + } + + return getGroupIdByUid(pInfo, uid); +} + static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t* pRowIndex) { if ((*pRowIndex) == pBlock->info.rows) { return false; @@ -1081,26 +1085,32 @@ static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_ return true; } -static STimeWindow getSlidingWindow(TSKEY* startTsCol, TSKEY* endTsCol, SInterval* pInterval, +static STimeWindow getSlidingWindow(TSKEY* startTsCol, TSKEY* endTsCol, uint64_t* gpIdCol, SInterval* pInterval, SDataBlockInfo* pDataBlockInfo, int32_t* pRowIndex, bool hasGroup) { SResultRowInfo dumyInfo; dumyInfo.cur.pageId = -1; STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, startTsCol[*pRowIndex], pInterval, TSDB_ORDER_ASC); STimeWindow endWin = win; STimeWindow preWin = win; + uint64_t groupId = gpIdCol[*pRowIndex]; while (1) { if (hasGroup) { (*pRowIndex) += 1; } else { - (*pRowIndex) += getNumOfRowsInTimeWindow(pDataBlockInfo, startTsCol, *pRowIndex, endWin.ekey, binarySearchForKey, - NULL, TSDB_ORDER_ASC); + while ((groupId == gpIdCol[(*pRowIndex)] && startTsCol[*pRowIndex] < endWin.ekey)) { + (*pRowIndex) += 1; + if ((*pRowIndex) == pDataBlockInfo->rows) { + break; + } + } } + do { preWin = endWin; getNextTimeWindow(pInterval, &endWin, TSDB_ORDER_ASC); } while (endTsCol[(*pRowIndex) - 1] >= endWin.skey); endWin = preWin; - if (win.ekey == endWin.ekey || (*pRowIndex) == pDataBlockInfo->rows) { + if (win.ekey == endWin.ekey || (*pRowIndex) == pDataBlockInfo->rows || groupId != gpIdCol[*pRowIndex]) { win.ekey = endWin.ekey; return win; } @@ -1235,11 +1245,13 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS int64_t version = pSrcBlock->info.version - 1; for (int32_t i = 0; i < rows;) { uint64_t srcUid = srcUidData[i]; - uint64_t groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], version); - uint64_t srcGpId = srcGp[i]; - TSKEY calStartTs = srcStartTsCol[i]; + uint64_t groupId = srcGp[i]; + if (groupId == 0) { + groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], version); + } + TSKEY calStartTs = srcStartTsCol[i]; colDataAppend(pCalStartTsCol, pDestBlock->info.rows, (const char*)(&calStartTs), false); - STimeWindow win = getSlidingWindow(srcStartTsCol, srcEndTsCol, &pInfo->interval, &pSrcBlock->info, &i, + STimeWindow win = getSlidingWindow(srcStartTsCol, srcEndTsCol, srcGp, &pInfo->interval, &pSrcBlock->info, &i, pInfo->partitionSup.needCalc); TSKEY calEndTs = srcStartTsCol[i - 1]; colDataAppend(pCalEndTsCol, pDestBlock->info.rows, (const char*)(&calEndTs), false); @@ -1248,15 +1260,6 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS colDataAppend(pEndTsCol, pDestBlock->info.rows, (const char*)(&win.ekey), false); colDataAppend(pGpCol, pDestBlock->info.rows, (const char*)(&groupId), false); pDestBlock->info.rows++; - if (pInfo->partitionSup.needCalc && srcGpId != 0 && groupId != srcGpId) { - colDataAppend(pCalStartTsCol, pDestBlock->info.rows, (const char*)(&calStartTs), false); - colDataAppend(pCalEndTsCol, pDestBlock->info.rows, (const char*)(&calEndTs), false); - colDataAppend(pDeUidCol, pDestBlock->info.rows, (const char*)(&srcUid), false); - colDataAppend(pStartTsCol, pDestBlock->info.rows, (const char*)(&win.skey), false); - colDataAppend(pEndTsCol, pDestBlock->info.rows, (const char*)(&win.ekey), false); - colDataAppend(pGpCol, pDestBlock->info.rows, (const char*)(&srcGpId), false); - pDestBlock->info.rows++; - } } return TSDB_CODE_SUCCESS; } @@ -1331,7 +1334,7 @@ void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock* pBlock, bool out) { if (out) { blockDataCleanup(pInfo->pUpdateDataRes); - blockDataEnsureCapacity(pInfo->pUpdateDataRes, pBlock->info.rows); + blockDataEnsureCapacity(pInfo->pUpdateDataRes, pBlock->info.rows * 2); } SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); ASSERT(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); @@ -1352,10 +1355,12 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock isDeletedStreamWindow(&win, pBlock->info.groupId, pInfo->pTableScanOp, &pInfo->twAggSup); if ((update || closedWin) && out) { qDebug("stream update check not pass, update %d, closedWin %d", update, closedWin); - uint64_t gpId = closedWin && pInfo->partitionSup.needCalc - ? calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pBlock, rowId) - : 0; + uint64_t gpId = 0; appendOneRow(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.uid, &gpId); + if (closedWin && pInfo->partitionSup.needCalc) { + gpId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pBlock, rowId); + appendOneRow(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.uid, &gpId); + } } } if (out && pInfo->pUpdateDataRes->info.rows > 0) { @@ -1567,6 +1572,30 @@ static int32_t filterDelBlockByUid(SSDataBlock* pDst, const SSDataBlock* pSrc, S return 0; } +// for partition by tag +static void setBlockGroupIdByUid(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { + SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); + TSKEY* startTsCol = (TSKEY*)pStartTsCol->pData; + SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* gpCol = (uint64_t*)pGpCol->pData; + SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX); + uint64_t* uidCol = (uint64_t*)pUidCol->pData; + int32_t rows = pBlock->info.rows; + if (!pInfo->partitionSup.needCalc) { + for (int32_t i = 0; i < rows; i++) { + uint64_t groupId = getGroupIdByUid(pInfo, uidCol[i]); + colDataAppend(pGpCol, i, (const char*)&groupId, false); + } + } else { + // SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uidCol[i], startTsCol, ts, maxVersion); + // if (!pPreRes || pPreRes->info.rows == 0) { + // return 0; + // } + // ASSERT(pPreRes->info.rows == 1); + // return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, 0); + } +} + static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { // NOTE: this operator does never check if current status is done or not SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; @@ -1663,7 +1692,8 @@ FETCH_NEXT_BLOCK: } else { pDelBlock = pBlock; } - printDataBlock(pBlock, "stream scan delete recv filtered"); + setBlockGroupIdByUid(pInfo, pDelBlock); + printDataBlock(pDelBlock, "stream scan delete recv filtered"); if (!isIntervalWindow(pInfo) && !isSessionWindow(pInfo) && !isStateWindow(pInfo)) { generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes); pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT; diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index f23552c5a7..ea0d26f4de 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -19,6 +19,7 @@ #include "tmsg.h" #include "ttypes.h" +#include "executorimpl.h" #include "tcommon.h" #include "thash.h" #include "ttime.h" @@ -35,18 +36,30 @@ #define GET_DEST_SLOT_ID(_p) ((_p)->pExpr->base.resSchema.slotId) +#define FILL_POS_INVALID 0 +#define FILL_POS_START 1 +#define FILL_POS_MID 2 +#define FILL_POS_END 3 + +typedef struct STimeRange { + TSKEY skey; + TSKEY ekey; + uint64_t groupId; +} STimeRange; + static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey); -static bool fillIfWindowPseudoColumn(SFillInfo* pFillInfo, SFillColInfo* pCol, SColumnInfoData* pDstColInfoData, int32_t rowIndex); +static bool fillIfWindowPseudoColumn(SFillInfo* pFillInfo, SFillColInfo* pCol, SColumnInfoData* pDstColInfoData, + int32_t rowIndex); static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowIndex) { - for(int32_t i = 0; i < pFillInfo->numOfCols; ++i) { - SFillColInfo* pCol = &pFillInfo->pFillCol[i]; - int32_t dstSlotId = GET_DEST_SLOT_ID(pCol); + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { + SFillColInfo* pCol = &pFillInfo->pFillCol[i]; + int32_t dstSlotId = GET_DEST_SLOT_ID(pCol); SColumnInfoData* pDstColInfo = taosArrayGet(pBlock->pDataBlock, dstSlotId); if (pCol->notFillCol) { bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfo, rowIndex); if (!filled) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; + SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; SGroupKeys* pKey = taosArrayGet(p, i); doSetVal(pDstColInfo, rowIndex, pKey); } @@ -76,8 +89,9 @@ static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32 } } -//fill windows pseudo column, _wstart, _wend, _wduration and return true, otherwise return false -static bool fillIfWindowPseudoColumn(SFillInfo* pFillInfo, SFillColInfo* pCol, SColumnInfoData* pDstColInfoData, int32_t rowIndex) { +// fill windows pseudo column, _wstart, _wend, _wduration and return true, otherwise return false +static bool fillIfWindowPseudoColumn(SFillInfo* pFillInfo, SFillColInfo* pCol, SColumnInfoData* pDstColInfoData, + int32_t rowIndex) { if (!pCol->notFillCol) { return false; } @@ -89,15 +103,15 @@ static bool fillIfWindowPseudoColumn(SFillInfo* pFillInfo, SFillColInfo* pCol, S colDataAppend(pDstColInfoData, rowIndex, (const char*)&pFillInfo->currentKey, false); return true; } else if (pCol->pExpr->base.pParam[0].pCol->colType == COLUMN_TYPE_WINDOW_END) { - //TODO: include endpoint + // TODO: include endpoint SInterval* pInterval = &pFillInfo->interval; - int32_t step = (pFillInfo->order == TSDB_ORDER_ASC) ? 1 : -1; - int64_t windowEnd = + int32_t step = (pFillInfo->order == TSDB_ORDER_ASC) ? 1 : -1; + int64_t windowEnd = taosTimeAdd(pFillInfo->currentKey, pInterval->sliding * step, pInterval->slidingUnit, pInterval->precision); colDataAppend(pDstColInfoData, rowIndex, (const char*)&windowEnd, false); return true; } else if (pCol->pExpr->base.pParam[0].pCol->colType == COLUMN_TYPE_WINDOW_DURATION) { - //TODO: include endpoint + // TODO: include endpoint colDataAppend(pDstColInfoData, rowIndex, (const char*)&pFillInfo->interval.sliding, false); return true; } @@ -115,13 +129,13 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* // set the other values if (pFillInfo->type == TSDB_FILL_PREV) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo)? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; + SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); - bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index); + bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index); if (!filled) { SGroupKeys* pKey = taosArrayGet(p, i); doSetVal(pDstColInfoData, index, pKey); @@ -131,9 +145,9 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next.pRowVal : pFillInfo->prev.pRowVal; // todo refactor: start from 0 not 1 for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { - SFillColInfo* pCol = &pFillInfo->pFillCol[i]; + SFillColInfo* pCol = &pFillInfo->pFillCol[i]; SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); - bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index); + bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index); if (!filled) { SGroupKeys* pKey = taosArrayGet(p, i); doSetVal(pDstColInfoData, index, pKey); @@ -154,7 +168,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* if (pCol->notFillCol) { bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstCol, index); if (!filled) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; + SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; SGroupKeys* pKey = taosArrayGet(p, i); doSetVal(pDstCol, index, pKey); } @@ -190,13 +204,13 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; - int32_t slotId = GET_DEST_SLOT_ID(pCol); + int32_t slotId = GET_DEST_SLOT_ID(pCol); SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, slotId); if (pCol->notFillCol) { bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDst, index); if (!filled) { - SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; + SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal; SGroupKeys* pKey = taosArrayGet(p, i); doSetVal(pDst, index, pKey); } @@ -261,8 +275,8 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray } else if (type == QUERY_NODE_OPERATOR) { SColumnInfoData* pSrcCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, i); - bool isNull = colDataIsNull_s(pSrcCol, rowIndex); - char* p = colDataGetData(pSrcCol, rowIndex); + bool isNull = colDataIsNull_s(pSrcCol, rowIndex); + char* p = colDataGetData(pSrcCol, rowIndex); saveColData(pRow, i, p, isNull); } else { ASSERT(0); @@ -425,9 +439,9 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t pFillInfo->order = order; pFillInfo->srcTsSlotId = primaryTsSlotId; - for(int32_t i = 0; i < numOfNotFillCols; ++i) { + for (int32_t i = 0; i < numOfNotFillCols; ++i) { SFillColInfo* p = &pCol[i + numOfFillCols]; - int32_t srcSlotId = GET_DEST_SLOT_ID(p); + int32_t srcSlotId = GET_DEST_SLOT_ID(p); if (srcSlotId == primaryTsSlotId) { pFillInfo->tsSlotId = i + numOfFillCols; break; @@ -499,9 +513,9 @@ void* taosDestroyFillInfo(SFillInfo* pFillInfo) { } taosArrayDestroy(pFillInfo->next.pRowVal); -// for (int32_t i = 0; i < pFillInfo->numOfTags; ++i) { -// taosMemoryFreeClear(pFillInfo->pTags[i].tagVal); -// } + // for (int32_t i = 0; i < pFillInfo->numOfTags; ++i) { + // taosMemoryFreeClear(pFillInfo->pTags[i].tagVal); + // } taosMemoryFreeClear(pFillInfo->pTags); taosMemoryFreeClear(pFillInfo->pFillCol); @@ -640,7 +654,7 @@ SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprIn } } - for(int32_t i = 0; i < numOfNotFillExpr; ++i) { + for (int32_t i = 0; i < numOfNotFillExpr; ++i) { SExprInfo* pExprInfo = &pNotFillExpr[i]; pFillCol[i + numOfFillExpr].pExpr = pExprInfo; pFillCol[i + numOfFillExpr].notFillCol = true; @@ -648,3 +662,1050 @@ SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprIn return pFillCol; } + +TSKEY getNextWindowTs(TSKEY ts, SInterval* pInterval) { + STimeWindow win = {.skey = ts, .ekey = ts}; + getNextIntervalWindow(pInterval, &win, TSDB_ORDER_ASC); + return win.skey; +} + +TSKEY getPrevWindowTs(TSKEY ts, SInterval* pInterval) { + STimeWindow win = {.skey = ts, .ekey = ts}; + getNextIntervalWindow(pInterval, &win, TSDB_ORDER_DESC); + return win.skey; +} + +void setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell) { + colDataAppend(pCol, rowId, pCell->pData, pCell->isNull); +} + +SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index) { + if (!pRaw || !pRaw->pRowVal) { + return NULL; + } + char* pData = (char*)pRaw->pRowVal; + SResultCellData* pCell = pRaw->pRowVal; + for (int32_t i = 0; i < index; i++) { + pData += (pCell->bytes + sizeof(SResultCellData)); + pCell = (SResultCellData*)pData; + } + return pCell; +} + +void* destroyFillColumnInfo(SFillColInfo* pFillCol, int32_t start, int32_t end) { + for (int32_t i = start; i < end; i++) { + destroyExprInfo(pFillCol[i].pExpr, 1); + taosMemoryFreeClear(pFillCol[i].pExpr); + taosVariantDestroy(&pFillCol[i].fillVal); + } + taosMemoryFree(pFillCol); + return NULL; +} + +void* destroyStreamFillSupporter(SStreamFillSupporter* pFillSup) { + pFillSup->pAllColInfo = destroyFillColumnInfo(pFillSup->pAllColInfo, pFillSup->numOfFillCols, pFillSup->numOfAllCols); + tSimpleHashCleanup(pFillSup->pResMap); + pFillSup->pResMap = NULL; + taosMemoryFree(pFillSup); + return NULL; +} + +void* destroyStreamFillLinearInfo(SStreamFillLinearInfo* pFillLinear) { + taosArrayDestroy(pFillLinear->pDeltaVal); + taosArrayDestroy(pFillLinear->pNextDeltaVal); + taosMemoryFree(pFillLinear); + return NULL; +} +void* destroyStreamFillInfo(SStreamFillInfo* pFillInfo) { + if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_NULL) { + taosMemoryFreeClear(pFillInfo->pResRow->pRowVal); + taosMemoryFreeClear(pFillInfo->pResRow); + } + pFillInfo->pLinearInfo = destroyStreamFillLinearInfo(pFillInfo->pLinearInfo); + taosMemoryFree(pFillInfo); + return NULL; +} + +void destroyStreamFillOperatorInfo(void* param) { + SStreamFillOperatorInfo* pInfo = (SStreamFillOperatorInfo*)param; + pInfo->pFillInfo = destroyStreamFillInfo(pInfo->pFillInfo); + pInfo->pFillSup = destroyStreamFillSupporter(pInfo->pFillSup); + pInfo->pRes = blockDataDestroy(pInfo->pRes); + pInfo->pSrcBlock = blockDataDestroy(pInfo->pSrcBlock); + pInfo->pColMatchColInfo = taosArrayDestroy(pInfo->pColMatchColInfo); + taosMemoryFree(pInfo); +} + +static void resetFillWindow(SResultRowData* pRowData) { + pRowData->key = INT64_MIN; + pRowData->pRowVal = NULL; +} + +void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup, SStreamState* pState) { + resetFillWindow(&pFillSup->prev); + resetFillWindow(&pFillSup->cur); + resetFillWindow(&pFillSup->next); + resetFillWindow(&pFillSup->nextNext); +} + +void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) { + SStreamState* pState = pOperator->pTaskInfo->streamInfo.pState; + resetPrevAndNextWindow(pFillSup, pState); + + SWinKey key = {.ts = ts, .groupId = groupId}; + void* curVal = NULL; + int32_t curVLen = 0; + int32_t code = streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); + ASSERT(code == TSDB_CODE_SUCCESS); + pFillSup->cur.key = key.ts; + pFillSup->cur.pRowVal = curVal; +} + +void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) { + SStreamState* pState = pOperator->pTaskInfo->streamInfo.pState; + resetPrevAndNextWindow(pFillSup, pState); + + SWinKey key = {.ts = ts, .groupId = groupId}; + void* curVal = NULL; + int32_t curVLen = 0; + int32_t code = streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); + ASSERT(code == TSDB_CODE_SUCCESS); + pFillSup->cur.key = key.ts; + pFillSup->cur.pRowVal = curVal; + + SStreamStateCur* pCur = streamStateFillSeekKeyPrev(pState, &key); + SWinKey preKey = {.groupId = groupId}; + void* preVal = NULL; + int32_t preVLen = 0; + if (pCur) { + code = streamStateGetGroupKVByCur(pCur, &preKey, (const void**)&preVal, &preVLen); + } + + if (pCur && code == TSDB_CODE_SUCCESS) { + pFillSup->prev.key = preKey.ts; + pFillSup->prev.pRowVal = preVal; + + code = streamStateCurNext(pState, pCur); + ASSERT(code == TSDB_CODE_SUCCESS); + + code = streamStateCurNext(pState, pCur); + if (code != TSDB_CODE_SUCCESS) { + pCur = NULL; + } + } else { + pCur = streamStateFillSeekKeyNext(pState, &key); + } + + if (pCur) { + SWinKey nextKey = {.groupId = groupId}; + void* nextVal = NULL; + int32_t nextVLen = 0; + code = streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextVLen); + if (code == TSDB_CODE_SUCCESS) { + pFillSup->next.key = nextKey.ts; + pFillSup->next.pRowVal = nextVal; + if (pFillSup->type == TSDB_FILL_PREV || pFillSup->type == TSDB_FILL_NEXT) { + code = streamStateCurNext(pState, pCur); + if (code == TSDB_CODE_SUCCESS) { + SWinKey nextNextKey = {.groupId = groupId}; + void* nextNextVal = NULL; + int32_t nextNextVLen = 0; + code = streamStateGetGroupKVByCur(pCur, &nextNextKey, (const void**)&nextNextVal, &nextNextVLen); + if (code == TSDB_CODE_SUCCESS) { + pFillSup->nextNext.key = nextNextKey.ts; + pFillSup->nextNext.pRowVal = nextNextVal; + } + } + } + } + } +} + +static bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } +static bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } +static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { + return pFillSup->nextNext.key != INT64_MIN; + return false; +} + +static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) { + int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); + for (int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i); + SResultCellData* pCell = getResultCell(pRowVal, i); + if (!colDataIsNull_s(pColData, rowId)) { + pCell->isNull = false; + pCell->type = pColData->info.type; + pCell->bytes = pColData->info.bytes; + char* val = colDataGetData(pColData, rowId); + if (IS_VAR_DATA_TYPE(pCell->type)) { + memcpy(pCell->pData, val, varDataTLen(val)); + } else { + memcpy(pCell->pData, val, pCell->bytes); + } + } else { + pCell->isNull = true; + } + } + pRowVal->key = ts; +} + +static void calcDeltaData(SSDataBlock* pBlock, int32_t rowId, SResultRowData* pRowVal, SArray* pDelta, + SFillColInfo* pFillCol, int32_t numOfCol, int32_t winCount, int32_t order) { + for (int32_t i = 0; i < numOfCol; i++) { + if (!pFillCol[i].notFillCol) { + int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i); + SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); + char* var = colDataGetData(pCol, rowId); + double start = 0; + GET_TYPED_DATA(start, double, pCol->info.type, var); + SResultCellData* pCell = getResultCell(pRowVal, slotId); + double end = 0; + GET_TYPED_DATA(end, double, pCell->type, pCell->pData); + double delta = 0; + if (order == TSDB_ORDER_ASC) { + delta = (end - start) / winCount; + } else { + delta = (start - end) / winCount; + } + taosArraySet(pDelta, slotId, &delta); + } + } +} + +static void calcRowDeltaData(SResultRowData* pStartRow, SResultRowData* pEndRow, SArray* pDelta, SFillColInfo* pFillCol, + int32_t numOfCol, int32_t winCount) { + for (int32_t i = 0; i < numOfCol; i++) { + if (!pFillCol[i].notFillCol) { + int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i); + SResultCellData* pSCell = getResultCell(pStartRow, slotId); + double start = 0.0; + GET_TYPED_DATA(start, double, pSCell->type, pSCell->pData); + SResultCellData* pECell = getResultCell(pEndRow, slotId); + double end = 0.0; + GET_TYPED_DATA(end, double, pECell->type, pECell->pData); + double delta = (end - start) / winCount; + taosArraySet(pDelta, slotId, &delta); + } + } +} + +static void setFillInfoStart(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFillInfo) { + ts = taosTimeAdd(ts, pInterval->sliding, pInterval->slidingUnit, pInterval->precision); + pFillInfo->start = ts; +} + +static void setFillInfoEnd(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFillInfo) { + ts = taosTimeAdd(ts, pInterval->sliding * -1, pInterval->slidingUnit, pInterval->precision); + pFillInfo->end = ts; +} + +static void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) { + setFillInfoStart(start, pInterval, pFillInfo); + pFillInfo->current = pFillInfo->start; + setFillInfoEnd(end, pInterval, pFillInfo); +} + +void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { + if (!hasPrevWindow(pFillSup) || !hasNextWindow(pFillSup)) { + pFillInfo->needFill = false; + return; + } + + pFillInfo->needFill = true; + pFillInfo->start = start; + pFillInfo->current = pFillInfo->start; + pFillInfo->end = end; + pFillInfo->pos = FILL_POS_INVALID; + switch (pFillInfo->type) { + case TSDB_FILL_NULL: + case TSDB_FILL_SET_VALUE: + break; + case TSDB_FILL_PREV: + pFillInfo->pResRow = &pFillSup->prev; + break; + case TSDB_FILL_NEXT: + pFillInfo->pResRow = &pFillSup->next; + break; + case TSDB_FILL_LINEAR: { + setFillKeyInfo(pFillSup->prev.key, pFillSup->next.key, &pFillSup->interval, pFillInfo); + pFillInfo->pLinearInfo->hasNext = false; + pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + int32_t numOfWins = taosTimeCountInterval(pFillSup->prev.key, pFillSup->next.key, pFillSup->interval.sliding, + pFillSup->interval.slidingUnit, pFillSup->interval.precision); + calcRowDeltaData(&pFillSup->prev, &pFillSup->next, pFillInfo->pLinearInfo->pDeltaVal, pFillSup->pAllColInfo, + pFillSup->numOfAllCols, numOfWins); + pFillInfo->pResRow = &pFillSup->prev; + pFillInfo->pLinearInfo->winIndex = 0; + } break; + default: + ASSERT(0); + break; + } +} + +void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillSupporter* pFillSup, + SStreamFillInfo* pFillInfo) { + pFillInfo->preRowKey = pFillSup->cur.key; + if (!hasPrevWindow(pFillSup) && !hasNextWindow(pFillSup)) { + pFillInfo->needFill = false; + pFillInfo->pos = FILL_POS_START; + return; + } + TSKEY prevWKey = INT64_MIN; + TSKEY nextWKey = INT64_MIN; + if (hasPrevWindow(pFillSup)) { + prevWKey = pFillSup->prev.key; + } + if (hasNextWindow(pFillSup)) { + nextWKey = pFillSup->next.key; + } + + pFillInfo->needFill = true; + pFillInfo->pos = FILL_POS_INVALID; + switch (pFillInfo->type) { + case TSDB_FILL_NULL: + case TSDB_FILL_SET_VALUE: { + if (pFillSup->prev.key == pFillInfo->preRowKey) { + resetFillWindow(&pFillSup->prev); + } + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) { + if (pFillSup->next.key == pFillInfo->nextRowKey) { + pFillInfo->preRowKey = INT64_MIN; + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + } else { + pFillInfo->needFill = false; + pFillInfo->pos = FILL_POS_START; + } + } else if (hasPrevWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + } else { + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + } + } break; + case TSDB_FILL_PREV: { + if (hasNextWindow(pFillSup) && ((pFillSup->next.key != pFillInfo->nextRowKey) || + (pFillSup->next.key == pFillInfo->nextRowKey && hasNextNextWindow(pFillSup)) || + (pFillSup->next.key == pFillInfo->nextRowKey && !hasPrevWindow(pFillSup)))) { + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + pFillSup->prev.key = pFillSup->cur.key; + pFillSup->prev.pRowVal = pFillSup->cur.pRowVal; + } else if (hasPrevWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + pFillInfo->preRowKey = INT64_MIN; + } + pFillInfo->pResRow = &pFillSup->prev; + } break; + case TSDB_FILL_NEXT: { + if (hasPrevWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + pFillSup->next.key = pFillSup->cur.key; + pFillSup->next.pRowVal = pFillSup->cur.pRowVal; + pFillInfo->preRowKey = INT64_MIN; + } else { + ASSERT(hasNextWindow(pFillSup)); + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + } + pFillInfo->pResRow = &pFillSup->next; + } break; + case TSDB_FILL_LINEAR: { + pFillInfo->pLinearInfo->winIndex = 0; + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_MID; + pFillInfo->pLinearInfo->nextEnd = nextWKey; + int32_t numOfWins = taosTimeCountInterval(prevWKey, ts, pFillSup->interval.sliding, + pFillSup->interval.slidingUnit, pFillSup->interval.precision); + calcRowDeltaData(&pFillSup->prev, &pFillSup->cur, pFillInfo->pLinearInfo->pDeltaVal, pFillSup->pAllColInfo, + pFillSup->numOfAllCols, numOfWins); + pFillInfo->pResRow = &pFillSup->prev; + + numOfWins = taosTimeCountInterval(ts, nextWKey, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + calcRowDeltaData(&pFillSup->cur, &pFillSup->next, pFillInfo->pLinearInfo->pNextDeltaVal, pFillSup->pAllColInfo, + pFillSup->numOfAllCols, numOfWins); + pFillInfo->pLinearInfo->hasNext = true; + } else if (hasPrevWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + int32_t numOfWins = taosTimeCountInterval(prevWKey, ts, pFillSup->interval.sliding, + pFillSup->interval.slidingUnit, pFillSup->interval.precision); + calcRowDeltaData(&pFillSup->prev, &pFillSup->cur, pFillInfo->pLinearInfo->pDeltaVal, pFillSup->pAllColInfo, + pFillSup->numOfAllCols, numOfWins); + pFillInfo->pResRow = &pFillSup->prev; + pFillInfo->pLinearInfo->hasNext = false; + } else { + ASSERT(hasNextWindow(pFillSup)); + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + int32_t numOfWins = taosTimeCountInterval(ts, nextWKey, pFillSup->interval.sliding, + pFillSup->interval.slidingUnit, pFillSup->interval.precision); + calcRowDeltaData(&pFillSup->cur, &pFillSup->next, pFillInfo->pLinearInfo->pDeltaVal, pFillSup->pAllColInfo, + pFillSup->numOfAllCols, numOfWins); + pFillInfo->pResRow = &pFillSup->cur; + pFillInfo->pLinearInfo->hasNext = false; + } + } break; + default: + ASSERT(0); + break; + } + ASSERT(pFillInfo->pos != FILL_POS_INVALID); +} + +static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId) { + SWinKey key = {.groupId = groupId, .ts = ts}; + if (tSimpleHashGet(pFillSup->pResMap, &key, sizeof(SWinKey)) != NULL) { + return false; + } + tSimpleHashPut(pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0); + return true; +} + +static void buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFillSup, TSKEY ts, SSDataBlock* pBlock) { + uint64_t groupId = pBlock->info.groupId; + if (pFillSup->hasDelete && !checkResult(pFillSup, ts, groupId)) { + return; + } + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + int32_t slotId = GET_DEST_SLOT_ID(pFillCol); + SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, slotId); + SFillInfo tmpInfo = { + .currentKey = ts, + .order = TSDB_ORDER_ASC, + .interval = pFillSup->interval, + }; + bool filled = fillIfWindowPseudoColumn(&tmpInfo, pFillCol, pColData, pBlock->info.rows); + if (!filled) { + SResultCellData* pCell = getResultCell(pResRow, slotId); + setRowCell(pColData, pBlock->info.rows, pCell); + } + } + pBlock->info.rows++; +} + +static bool hasRemainCalc(SStreamFillInfo* pFillInfo) { + if (pFillInfo->current != INT64_MIN && pFillInfo->current <= pFillInfo->end) { + return true; + } + return false; +} + +static void doStreamFillNormal(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) { + while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { + buildFillResult(pFillInfo->pResRow, pFillSup, pFillInfo->current, pBlock); + pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + } +} + +static void doStreamFillLinear(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) { + while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { + uint64_t groupId = pBlock->info.groupId; + SWinKey key = {.groupId = groupId, .ts = pFillInfo->current}; + if (pFillSup->hasDelete && !checkResult(pFillSup, pFillInfo->current, groupId)) { + pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + pFillInfo->pLinearInfo->winIndex++; + continue; + } + pFillInfo->pLinearInfo->winIndex++; + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + SFillInfo tmp = { + .currentKey = pFillInfo->current, + .order = TSDB_ORDER_ASC, + .interval = pFillSup->interval, + }; + + int32_t slotId = GET_DEST_SLOT_ID(pFillCol); + SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, slotId); + int16_t type = pColData->info.type; + SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId); + int32_t index = pBlock->info.rows; + if (pFillCol->notFillCol) { + bool filled = fillIfWindowPseudoColumn(&tmp, pFillCol, pColData, index); + if (!filled) { + setRowCell(pColData, index, pCell); + } + } else { + if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pCell->isNull) { + colDataAppendNULL(pColData, index); + continue; + } + double* pDelta = taosArrayGet(pFillInfo->pLinearInfo->pDeltaVal, slotId); + double vCell = 0; + GET_TYPED_DATA(vCell, double, pCell->type, pCell->pData); + vCell += (*pDelta) * pFillInfo->pLinearInfo->winIndex; + int64_t result = 0; + SET_TYPED_DATA(&result, pCell->type, vCell); + colDataAppend(pColData, index, (const char*)&result, false); + } + } + pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + pBlock->info.rows++; + } +} + +static void keepResultInDiscBuf(SOperatorInfo* pOperator, uint64_t groupId, SResultRowData* pRow, int32_t len) { + SWinKey key = {.groupId = groupId, .ts = pRow->key}; + int32_t code = streamStateFillPut(pOperator->pTaskInfo->streamInfo.pState, &key, pRow->pRowVal, len); + ASSERT(code == TSDB_CODE_SUCCESS); +} + +static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter* pFillSup, SSDataBlock* pRes) { + if (pFillInfo->needFill == false) { + buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes); + return; + } + + if (pFillInfo->pos == FILL_POS_START) { + buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes); + } + if (pFillInfo->type != TSDB_FILL_LINEAR) { + doStreamFillNormal(pFillSup, pFillInfo, pRes); + } else { + doStreamFillLinear(pFillSup, pFillInfo, pRes); + + if (pFillInfo->pos == FILL_POS_MID) { + buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes); + } + + if (pFillInfo->current > pFillInfo->end && pFillInfo->pLinearInfo->hasNext) { + pFillInfo->pLinearInfo->hasNext = false; + pFillInfo->pLinearInfo->winIndex = 0; + taosArrayClear(pFillInfo->pLinearInfo->pDeltaVal); + taosArrayAddAll(pFillInfo->pLinearInfo->pDeltaVal, pFillInfo->pLinearInfo->pNextDeltaVal); + pFillInfo->pResRow = &pFillSup->cur; + setFillKeyInfo(pFillSup->cur.key, pFillInfo->pLinearInfo->nextEnd, &pFillSup->interval, pFillInfo); + doStreamFillLinear(pFillSup, pFillInfo, pRes); + } + } + if (pFillInfo->pos == FILL_POS_END) { + buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes); + } +} + +void keepBlockRowInDiscBuf(SOperatorInfo* pOperator, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, TSKEY* tsCol, + int32_t rowId, uint64_t groupId, int32_t rowSize) { + TSKEY ts = tsCol[rowId]; + pFillInfo->nextRowKey = ts; + SResultRowData tmpNextRow = {.key = ts}; + tmpNextRow.pRowVal = taosMemoryCalloc(1, rowSize); + transBlockToResultRow(pBlock, rowId, ts, &tmpNextRow); + keepResultInDiscBuf(pOperator, groupId, &tmpNextRow, rowSize); + taosMemoryFreeClear(tmpNextRow.pRowVal); +} + +static void doFillResults(SOperatorInfo* pOperator, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, + SSDataBlock* pBlock, TSKEY* tsCol, int32_t rowId, SSDataBlock* pRes) { + uint64_t groupId = pBlock->info.groupId; + getWindowFromDiscBuf(pOperator, tsCol[rowId], groupId, pFillSup); + if (pFillSup->prev.key == pFillInfo->preRowKey) { + resetFillWindow(&pFillSup->prev); + } + setFillValueInfo(pBlock, tsCol[rowId], rowId, pFillSup, pFillInfo); + doStreamFillRange(pFillInfo, pFillSup, pRes); +} + +static void doStreamFillImpl(SOperatorInfo* pOperator) { + SStreamFillOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStreamFillSupporter* pFillSup = pInfo->pFillSup; + SStreamFillInfo* pFillInfo = pInfo->pFillInfo; + SSDataBlock* pBlock = pInfo->pSrcBlock; + uint64_t groupId = pBlock->info.groupId; + SSDataBlock* pRes = pInfo->pRes; + pRes->info.groupId = groupId; + if (hasRemainCalc(pFillInfo)) { + doStreamFillRange(pFillInfo, pFillSup, pRes); + } + + SColumnInfoData* pTsCol = taosArrayGet(pInfo->pSrcBlock->pDataBlock, pInfo->primaryTsCol); + TSKEY* tsCol = (TSKEY*)pTsCol->pData; + + if (pInfo->srcRowIndex == 0) { + keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize); + SSDataBlock* preBlock = pInfo->pPrevSrcBlock; + if (preBlock->info.rows > 0) { + int preRowId = preBlock->info.rows - 1; + SColumnInfoData* pPreTsCol = taosArrayGet(preBlock->pDataBlock, pInfo->primaryTsCol); + doFillResults(pOperator, pFillSup, pFillInfo, preBlock, (TSKEY*)pPreTsCol->pData, preRowId, pRes); + } + pInfo->srcRowIndex++; + } + + while (pInfo->srcRowIndex < pBlock->info.rows) { + TSKEY ts = tsCol[pInfo->srcRowIndex]; + keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize); + doFillResults(pOperator, pFillSup, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex - 1, pRes); + if (pInfo->pRes->info.rows == pInfo->pRes->info.capacity) { + blockDataUpdateTsWindow(pRes, pInfo->primaryTsCol); + return; + } + pInfo->srcRowIndex++; + } + blockDataUpdateTsWindow(pRes, pInfo->primaryTsCol); + blockDataCleanup(pInfo->pPrevSrcBlock); + copyDataBlock(pInfo->pPrevSrcBlock, pInfo->pSrcBlock); + blockDataCleanup(pInfo->pSrcBlock); +} + +static void buildDeleteRange(TSKEY start, TSKEY end, uint64_t groupId, SSDataBlock* delRes) { + SSDataBlock* pBlock = delRes; + SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX); + SColumnInfoData* pGroupCol = 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(pStartCol, pBlock->info.rows, (const char*)&start, false); + colDataAppend(pEndCol, pBlock->info.rows, (const char*)&end, false); + colDataAppendNULL(pUidCol, pBlock->info.rows); + colDataAppend(pGroupCol, pBlock->info.rows, (const char*)&groupId, false); + colDataAppendNULL(pCalStartCol, pBlock->info.rows); + colDataAppendNULL(pCalEndCol, pBlock->info.rows); + pBlock->info.rows++; +} + +static void buildDeleteResult(SStreamFillSupporter* pFillSup, TSKEY startTs, TSKEY endTs, uint64_t groupId, + SSDataBlock* delRes) { + if (hasPrevWindow(pFillSup)) { + TSKEY start = getNextWindowTs(pFillSup->prev.key, &pFillSup->interval); + buildDeleteRange(start, endTs, groupId, delRes); + } else if (hasNextWindow(pFillSup)) { + TSKEY end = getPrevWindowTs(pFillSup->next.key, &pFillSup->interval); + buildDeleteRange(startTs, end, groupId, delRes); + } else { + buildDeleteRange(startTs, endTs, groupId, delRes); + } +} + +static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKEY endTs, uint64_t groupId) { + SStreamFillOperatorInfo* pInfo = pOperator->info; + getWindowFromDiscBuf(pOperator, startTs, groupId, pInfo->pFillSup); + setDeleteFillValueInfo(startTs, endTs, pInfo->pFillSup, pInfo->pFillInfo); + SWinKey key = {.ts = startTs, .groupId = groupId}; + if (!pInfo->pFillInfo->needFill) { + streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key); + buildDeleteResult(pInfo->pFillSup, startTs, endTs, groupId, pInfo->pDelRes); + } else { + STimeRange tw = { + .skey = startTs, + .ekey = endTs, + .groupId = groupId, + }; + taosArrayPush(pInfo->pFillInfo->delRanges, &tw); + while (key.ts <= endTs) { + key.ts = taosTimeAdd(key.ts, pInfo->pFillSup->interval.sliding, pInfo->pFillSup->interval.slidingUnit, + pInfo->pFillSup->interval.precision); + tSimpleHashPut(pInfo->pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0); + } + } +} + +static void doDeleteFillFinalize(SOperatorInfo* pOperator) { + SStreamFillOperatorInfo* pInfo = pOperator->info; + SStreamFillInfo* pFillInfo = pInfo->pFillInfo; + int32_t size = taosArrayGetSize(pFillInfo->delRanges); + tSimpleHashClear(pInfo->pFillSup->pResMap); + for (; pFillInfo->delIndex < size; pFillInfo->delIndex++) { + STimeRange* range = taosArrayGet(pFillInfo->delRanges, pFillInfo->delIndex); + if (pInfo->pRes->info.groupId != 0 && pInfo->pRes->info.groupId != range->groupId) { + return; + } + getWindowFromDiscBuf(pOperator, range->skey, range->groupId, pInfo->pFillSup); + setDeleteFillValueInfo(range->skey, range->ekey, pInfo->pFillSup, pInfo->pFillInfo); + if (pInfo->pFillInfo->needFill) { + doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes); + pInfo->pRes->info.groupId = range->groupId; + } + SWinKey key = {.ts = range->skey, .groupId = range->groupId}; + streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key); + } +} + +static void doDeleteFillResult(SOperatorInfo* pOperator) { + SStreamFillOperatorInfo* pInfo = pOperator->info; + SStreamFillSupporter* pFillSup = pInfo->pFillSup; + SStreamFillInfo* pFillInfo = pInfo->pFillInfo; + SSDataBlock* pBlock = pInfo->pSrcDelBlock; + SSDataBlock* pRes = pInfo->pRes; + SSDataBlock* pDelRes = pInfo->pDelRes; + + SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); + TSKEY* tsStarts = (TSKEY*)pStartCol->pData; + SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* groupIds = (uint64_t*)pGroupCol->pData; + while (pInfo->srcDelRowIndex < pBlock->info.rows) { + TSKEY ts = tsStarts[pInfo->srcDelRowIndex]; + TSKEY endTs = ts; + uint64_t groupId = groupIds[pInfo->srcDelRowIndex]; + SWinKey key = {.ts = ts, .groupId = groupId}; + SStreamStateCur* pCur = streamStateGetAndCheckCur(pOperator->pTaskInfo->streamInfo.pState, &key); + if (!pCur) { + pInfo->srcDelRowIndex++; + continue; + } + + SWinKey nextKey = {.groupId = groupId, .ts = ts}; + while (pInfo->srcDelRowIndex < pBlock->info.rows) { + void* nextVal = NULL; + int32_t nextLen = 0; + TSKEY delTs = tsStarts[pInfo->srcDelRowIndex]; + uint64_t delGroupId = groupIds[pInfo->srcDelRowIndex]; + int32_t code = TSDB_CODE_SUCCESS; + if (groupId != delGroupId) { + break; + } + if (delTs > nextKey.ts) { + break; + } + endTs = delTs; + SWinKey delKey = {.groupId = delGroupId, .ts = delTs}; + if (delTs == nextKey.ts) { + code = streamStateCurNext(pOperator->pTaskInfo->streamInfo.pState, pCur); + if (code == TSDB_CODE_SUCCESS) { + code = streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextLen); + } + if (delTs != ts) { + streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &delKey); + } + if (code != TSDB_CODE_SUCCESS) { + break; + } + } + pInfo->srcDelRowIndex++; + } + doDeleteFillResultImpl(pOperator, ts, endTs, groupId); + } + pFillInfo->current = pFillInfo->end + 1; +} + +static void resetStreamFillInfo(SStreamFillOperatorInfo* pInfo) { + blockDataCleanup(pInfo->pPrevSrcBlock); + tSimpleHashClear(pInfo->pFillSup->pResMap); + pInfo->pFillSup->hasDelete = false; + taosArrayClear(pInfo->pFillInfo->delRanges); + pInfo->pFillInfo->delIndex = 0; +} + +static void doApplyStreamScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pSrcBlock, SSDataBlock* pDstBlock) { + SStreamFillOperatorInfo* pInfo = pOperator->info; + SExprSupp* pSup = &pOperator->exprSupp; + + blockDataCleanup(pDstBlock); + blockDataEnsureCapacity(pDstBlock, pSrcBlock->info.rows); + setInputDataBlock(pOperator, pSup->pCtx, pSrcBlock, TSDB_ORDER_ASC, MAIN_SCAN, false); + projectApplyFunctions(pSup->pExprInfo, pDstBlock, pSrcBlock, pSup->pCtx, pSup->numOfExprs, NULL); + pDstBlock->info.groupId = pSrcBlock->info.groupId; + + SColumnInfoData* pDst = taosArrayGet(pDstBlock->pDataBlock, pInfo->primaryTsCol); + SColumnInfoData* pSrc = taosArrayGet(pSrcBlock->pDataBlock, pInfo->primarySrcSlotId); + colDataAssign(pDst, pSrc, pDstBlock->info.rows, &pDstBlock->info); + + int32_t numOfNotFill = pInfo->pFillSup->numOfAllCols - pInfo->pFillSup->numOfFillCols; + for (int32_t i = 0; i < numOfNotFill; ++i) { + SFillColInfo* pCol = &pInfo->pFillSup->pAllColInfo[i + pInfo->pFillSup->numOfFillCols]; + ASSERT(pCol->notFillCol); + + SExprInfo* pExpr = pCol->pExpr; + int32_t srcSlotId = pExpr->base.pParam[0].pCol->slotId; + int32_t dstSlotId = pExpr->base.resSchema.slotId; + + SColumnInfoData* pDst1 = taosArrayGet(pDstBlock->pDataBlock, dstSlotId); + SColumnInfoData* pSrc1 = taosArrayGet(pSrcBlock->pDataBlock, srcSlotId); + colDataAssign(pDst1, pSrc1, pDstBlock->info.rows, &pDstBlock->info); + } + blockDataUpdateTsWindow(pDstBlock, pInfo->primaryTsCol); +} + +static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { + SStreamFillOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } + blockDataCleanup(pInfo->pRes); + if (pOperator->status == OP_RES_TO_RETURN) { + if (hasRemainCalc(pInfo->pFillInfo)) { + doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes); + if (pInfo->pRes->info.rows > 0) { + return pInfo->pRes; + } + } + doDeleteFillFinalize(pOperator); + if (pInfo->pRes->info.rows > 0) { + printDataBlock(pInfo->pRes, "stream fill"); + return pInfo->pRes; + } + doSetOperatorCompleted(pOperator); + resetStreamFillInfo(pInfo); + return NULL; + } + + SSDataBlock* fillResult = NULL; + SOperatorInfo* downstream = pOperator->pDownstream[0]; + while (1) { + if (pInfo->srcRowIndex >= pInfo->pSrcBlock->info.rows) { + // If there are delete datablocks, we receive them first. + SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); + if (pBlock == NULL) { + pOperator->status = OP_RES_TO_RETURN; + SSDataBlock* preBlock = pInfo->pPrevSrcBlock; + if (preBlock->info.rows > 0) { + int preRowId = preBlock->info.rows - 1; + SColumnInfoData* pPreTsCol = taosArrayGet(preBlock->pDataBlock, pInfo->primaryTsCol); + doFillResults(pOperator, pInfo->pFillSup, pInfo->pFillInfo, preBlock, (TSKEY*)pPreTsCol->pData, preRowId, + pInfo->pRes); + } + pInfo->pFillInfo->preRowKey = INT64_MIN; + if (pInfo->pRes->info.rows > 0) { + printDataBlock(pInfo->pRes, "stream fill"); + return pInfo->pRes; + } + break; + } + printDataBlock(pBlock, "stream fill recv"); + + switch (pBlock->info.type) { + case STREAM_RETRIEVE: + return pBlock; + case STREAM_DELETE_RESULT: { + pInfo->pSrcDelBlock = pBlock; + pInfo->srcDelRowIndex = 0; + blockDataCleanup(pInfo->pDelRes); + pInfo->pFillSup->hasDelete = true; + doDeleteFillResult(pOperator); + if (pInfo->pDelRes->info.rows > 0) { + printDataBlock(pInfo->pDelRes, "stream fill delete"); + return pInfo->pDelRes; + } + continue; + } break; + case STREAM_NORMAL: + case STREAM_INVALID: { + doApplyStreamScalarCalculation(pOperator, pBlock, pInfo->pSrcBlock); + pInfo->srcRowIndex = 0; + } break; + default: + ASSERT(0); + break; + } + } + + doStreamFillImpl(pOperator); + doFilter(pInfo->pCondition, pInfo->pRes, pInfo->pColMatchColInfo); + pOperator->resultInfo.totalRows += pInfo->pRes->info.rows; + if (pInfo->pRes->info.rows > 0) { + break; + } + } + if (pOperator->status == OP_RES_TO_RETURN) { + doDeleteFillFinalize(pOperator); + } + + if (pInfo->pRes->info.rows == 0) { + doSetOperatorCompleted(pOperator); + resetStreamFillInfo(pInfo); + return NULL; + } + + pOperator->resultInfo.totalRows += pInfo->pRes->info.rows; + printDataBlock(pInfo->pRes, "stream fill"); + return pInfo->pRes; +} + +static int32_t initResultBuf(SStreamFillSupporter* pFillSup) { + pFillSup->rowSize = sizeof(SResultCellData) * pFillSup->numOfAllCols; + for (int i = 0; i < pFillSup->numOfAllCols; i++) { + SFillColInfo* pCol = &pFillSup->pAllColInfo[i]; + SResSchema* pSchema = &pCol->pExpr->base.resSchema; + pFillSup->rowSize += pSchema->bytes; + } + pFillSup->next.key = INT64_MIN; + pFillSup->nextNext.key = INT64_MIN; + pFillSup->prev.key = INT64_MIN; + pFillSup->next.pRowVal = NULL; + pFillSup->nextNext.pRowVal = NULL; + pFillSup->prev.pRowVal = NULL; + return TSDB_CODE_SUCCESS; +} + +static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNode, SInterval* pInterval, + SExprInfo* pFillExprInfo, int32_t numOfFillCols) { + SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter)); + if (!pFillSup) { + return NULL; + } + pFillSup->numOfFillCols = numOfFillCols; + int32_t numOfNotFillCols = 0; + SExprInfo* pNotFillExprInfo = createExprInfo(pPhyFillNode->pNotFillExprs, NULL, &numOfNotFillCols); + pFillSup->pAllColInfo = createFillColInfo(pFillExprInfo, pFillSup->numOfFillCols, pNotFillExprInfo, numOfNotFillCols, + (const SNodeListNode*)(pPhyFillNode->pValues)); + pFillSup->type = convertFillType(pPhyFillNode->mode); + pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols; + pFillSup->interval = *pInterval; + + int32_t code = initResultBuf(pFillSup); + if (code != TSDB_CODE_SUCCESS) { + destroyStreamFillSupporter(pFillSup); + return NULL; + } + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pFillSup->pResMap = tSimpleHashInit(16, hashFn); + pFillSup->hasDelete = false; + return pFillSup; +} + +SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pRes) { + SStreamFillInfo* pFillInfo = taosMemoryCalloc(1, sizeof(SStreamFillInfo)); + pFillInfo->start = INT64_MIN; + pFillInfo->current = INT64_MIN; + pFillInfo->end = INT64_MIN; + pFillInfo->preRowKey = INT64_MIN; + pFillInfo->needFill = false; + pFillInfo->pLinearInfo = taosMemoryCalloc(1, sizeof(SStreamFillLinearInfo)); + pFillInfo->pLinearInfo->hasNext = false; + pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + pFillInfo->pLinearInfo->pDeltaVal = NULL; + pFillInfo->pLinearInfo->pNextDeltaVal = NULL; + if (pFillSup->type == TSDB_FILL_LINEAR) { + pFillInfo->pLinearInfo->pDeltaVal = taosArrayInit(pFillSup->numOfAllCols, sizeof(double)); + pFillInfo->pLinearInfo->pNextDeltaVal = taosArrayInit(pFillSup->numOfAllCols, sizeof(double)); + for (int32_t i = 0; i < pFillSup->numOfAllCols; i++) { + double value = 0.0; + taosArrayPush(pFillInfo->pLinearInfo->pDeltaVal, &value); + taosArrayPush(pFillInfo->pLinearInfo->pNextDeltaVal, &value); + } + } + pFillInfo->pLinearInfo->winIndex = 0; + + pFillInfo->pResRow = NULL; + if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_NULL) { + pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData)); + pFillInfo->pResRow->key = INT64_MIN; + pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize); + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SColumnInfoData* pColData = taosArrayGet(pRes->pDataBlock, i); + SResultCellData* pCell = getResultCell(pFillInfo->pResRow, i); + pCell->bytes = pColData->info.bytes; + pCell->type = pColData->info.type; + } + } + + pFillInfo->type = pFillSup->type; + pFillInfo->delRanges = taosArrayInit(16, sizeof(STimeRange)); + pFillInfo->delIndex = 0; + return pFillInfo; +} + +SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode, + SExecTaskInfo* pTaskInfo) { + SStreamFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFillOperatorInfo)); + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + if (pInfo == NULL || pOperator == NULL) { + goto _error; + } + + SInterval* pInterval = QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL == downstream->operatorType + ? &((SStreamFinalIntervalOperatorInfo*)downstream->info)->interval + : &((SStreamIntervalOperatorInfo*)downstream->info)->interval; + int32_t numOfFillCols = 0; + SExprInfo* pFillExprInfo = createExprInfo(pPhyFillNode->pFillExprs, NULL, &numOfFillCols); + pInfo->pFillSup = initStreamFillSup(pPhyFillNode, pInterval, pFillExprInfo, numOfFillCols); + if (!pInfo->pFillSup) { + goto _error; + } + + SResultInfo* pResultInfo = &pOperator->resultInfo; + initResultSizeInfo(&pOperator->resultInfo, 4096); + pInfo->pRes = createResDataBlock(pPhyFillNode->node.pOutputDataBlockDesc); + pInfo->pSrcBlock = createResDataBlock(pPhyFillNode->node.pOutputDataBlockDesc); + pInfo->pPrevSrcBlock = createResDataBlock(pPhyFillNode->node.pOutputDataBlockDesc); + blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); + blockDataEnsureCapacity(pInfo->pSrcBlock, pOperator->resultInfo.capacity); + blockDataEnsureCapacity(pInfo->pPrevSrcBlock, pOperator->resultInfo.capacity); + + pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pInfo->pRes); + if (!pInfo->pFillInfo) { + goto _error; + } + + if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE) { + for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i; + int32_t slotId = GET_DEST_SLOT_ID(pFillCol); + SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId); + SVariant* pVar = &(pFillCol->fillVal); + if (pCell->type == TSDB_DATA_TYPE_FLOAT) { + float v = 0; + GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else if (pCell->type == TSDB_DATA_TYPE_DOUBLE) { + double v = 0; + GET_TYPED_DATA(v, double, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else if (IS_SIGNED_NUMERIC_TYPE(pCell->type)) { + int64_t v = 0; + GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else { + pCell->isNull = true; + } + } + } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL) { + for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i; + int32_t slotId = GET_DEST_SLOT_ID(pFillCol); + SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId); + pCell->isNull = true; + } + } + + pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT); + blockDataEnsureCapacity(pInfo->pDelRes, pOperator->resultInfo.capacity); + + pInfo->primaryTsCol = ((STargetNode*)pPhyFillNode->pWStartTs)->slotId; + pInfo->primarySrcSlotId = ((SColumnNode*)((STargetNode*)pPhyFillNode->pWStartTs)->pExpr)->slotId; + + int32_t numOfOutputCols = 0; + SArray* pColMatchColInfo = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc, + &numOfOutputCols, COL_MATCH_FROM_SLOT_ID); + pInfo->pCondition = pPhyFillNode->node.pConditions; + pInfo->pColMatchColInfo = pColMatchColInfo; + initExprSupp(&pOperator->exprSupp, pFillExprInfo, numOfFillCols); + pInfo->srcRowIndex = 0; + + pOperator->name = "FillOperator"; + pOperator->blocking = false; + pOperator->status = OP_NOT_OPENED; + pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL; + pOperator->info = pInfo; + pOperator->pTaskInfo = pTaskInfo; + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamFill, NULL, NULL, destroyStreamFillOperatorInfo, + NULL, NULL, NULL); + + int32_t code = appendDownstream(pOperator, &downstream, 1); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + return pOperator; + +_error: + destroyStreamFillOperatorInfo(pInfo); + taosMemoryFreeClear(pOperator); + return NULL; +} diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 4671570802..12d35be0b7 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -271,6 +271,10 @@ static void getNextTimeWindow(SInterval* pInterval, int32_t precision, int32_t o tw->ekey -= 1; } +void getNextIntervalWindow(SInterval* pInterval, STimeWindow* tw, int32_t order) { + getNextTimeWindow(pInterval, pInterval->precision, order, tw); +} + void doTimeWindowInterpolation(SArray* pPrevValues, SArray* pDataBlock, TSKEY prevTs, int32_t prevRowIndex, TSKEY curTs, int32_t curRowIndex, TSKEY windowKey, int32_t type, SExprSupp* pSup) { SqlFunctionCtx* pCtx = pSup->pCtx; @@ -3146,20 +3150,21 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { } doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); - if (pInfo->binfo.pRes->info.rows == 0) { - pOperator->status = OP_EXEC_DONE; - if (!IS_FINAL_OP(pInfo)) { - clearFunctionContext(&pOperator->exprSupp); - // semi interval operator clear disk buffer - clearStreamIntervalOperator(pInfo); - qDebug("===stream===clear semi operator"); - } else { - freeAllPages(pInfo->pRecycledPages, pInfo->aggSup.pResultBuf); - } - return NULL; + if (pInfo->binfo.pRes->info.rows != 0) { + printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); + return pInfo->binfo.pRes; } - printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); - return pInfo->binfo.pRes; + + doSetOperatorCompleted(pOperator); + if (!IS_FINAL_OP(pInfo)) { + clearFunctionContext(&pOperator->exprSupp); + // semi interval operator clear disk buffer + clearStreamIntervalOperator(pInfo); + qDebug("===stream===clear semi operator"); + } else { + freeAllPages(pInfo->pRecycledPages, pInfo->aggSup.pResultBuf); + } + return NULL; } else { if (!IS_FINAL_OP(pInfo)) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); @@ -3316,7 +3321,13 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { return pInfo->pPullDataRes; } - // we should send result first. + doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); + if (pInfo->pDelRes->info.rows != 0) { + // process the rest of the data + printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); + return pInfo->pDelRes; + } + doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); if (pInfo->binfo.pRes->info.rows != 0) { printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); @@ -3330,13 +3341,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { // process the rest of the data return pInfo->pUpdateRes; } - - doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); - if (pInfo->pDelRes->info.rows != 0) { - // process the rest of the data - printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); - return pInfo->pDelRes; - } return NULL; } @@ -5744,19 +5748,18 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { if (pOperator->status == OP_RES_TO_RETURN) { doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); if (pInfo->pDelRes->info.rows > 0) { - printDataBlock(pInfo->pDelRes, "single interval"); + printDataBlock(pInfo->pDelRes, "single interval delete"); return pInfo->pDelRes; } doBuildResult(pOperator, pInfo->binfo.pRes, &pInfo->groupResInfo); - // doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); - if (pInfo->binfo.pRes->info.rows == 0 || !hasRemainResults(&pInfo->groupResInfo)) { - pOperator->status = OP_EXEC_DONE; - qDebug("===stream===single interval is done"); - freeAllPages(pInfo->pRecycledPages, pInfo->aggSup.pResultBuf); + if (pInfo->binfo.pRes->info.rows > 0) { + printDataBlock(pInfo->binfo.pRes, "single interval"); + return pInfo->binfo.pRes; } - printDataBlock(pInfo->binfo.pRes, "single interval"); - return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes; + + doSetOperatorCompleted(pOperator); + return NULL; } SOperatorInfo* downstream = pOperator->pDownstream[0]; @@ -5823,24 +5826,24 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { } taosArraySort(pUpdated, resultrowComparAsc); - // new disc buf - // finalizeUpdatedResult(pOperator->exprSupp.numOfExprs, pInfo->aggSup.pResultBuf, pUpdated, - // pSup->rowEntryInfoOffset); initMultiResInfoFromArrayList(&pInfo->groupResInfo, pUpdated); blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); removeDeleteResults(pUpdatedMap, pInfo->pDelWins); taosHashCleanup(pUpdatedMap); + doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); if (pInfo->pDelRes->info.rows > 0) { - printDataBlock(pInfo->pDelRes, "single interval"); + printDataBlock(pInfo->pDelRes, "single interval delete"); return pInfo->pDelRes; } - // doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); - // new disc buf doBuildResult(pOperator, pInfo->binfo.pRes, &pInfo->groupResInfo); - printDataBlock(pInfo->binfo.pRes, "single interval"); - return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes; + if (pInfo->binfo.pRes->info.rows > 0) { + printDataBlock(pInfo->binfo.pRes, "single interval"); + return pInfo->binfo.pRes; + } + + return NULL; } void destroyStreamIntervalOperatorInfo(void* param) { diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index 37208c4723..9bff812c3a 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -50,6 +50,7 @@ extern "C" { #define FUNC_MGT_KEEP_ORDER_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(21) #define FUNC_MGT_CUMULATIVE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(22) #define FUNC_MGT_FORBID_STABLE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(23) +#define FUNC_MGT_INTERP_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(24) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 0677bd7d63..54455415b8 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -3146,6 +3146,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, .translateFunc = translateUserFunc, }, + { + .name = "_irowts", + .type = FUNCTION_TYPE_IROWTS, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_INTERP_PC_FUNC, + .translateFunc = translateTimePseudoColumn, + .getEnvFunc = getTimePseudoFuncEnv, + .initFunc = NULL, + .sprocessFunc = NULL, + .finalizeFunc = NULL + }, }; // clang-format on diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index d092c259da..a8d51905ab 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2977,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) { @@ -2998,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; } @@ -3016,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; } diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index bc10ce71ae..ca8ddbc60a 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -224,6 +224,8 @@ bool fmIsInterpFunc(int32_t funcId) { return FUNCTION_TYPE_INTERP == funcMgtBuiltins[funcId].type; } +bool fmIsInterpPseudoColumnFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_INTERP_PC_FUNC); } + bool fmIsLastRowFunc(int32_t funcId) { if (funcId < 0 || funcId >= funcMgtBuiltinsNum) { return false; diff --git a/source/libs/index/src/indexCache.c b/source/libs/index/src/indexCache.c index 7e867db755..39bba4e269 100644 --- a/source/libs/index/src/indexCache.c +++ b/source/libs/index/src/indexCache.c @@ -302,6 +302,7 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR char* p = taosMemoryCalloc(1, strlen(c->colVal) + 1); memcpy(p, c->colVal, strlen(c->colVal)); cond = cmpFn(p + skip, term->colVal, dType); + taosMemoryFree(p); } } if (cond == MATCH) { diff --git a/source/libs/index/src/indexFstFile.c b/source/libs/index/src/indexFstFile.c index 2a33ddd477..7021fdfae3 100644 --- a/source/libs/index/src/indexFstFile.c +++ b/source/libs/index/src/indexFstFile.c @@ -69,6 +69,8 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of int32_t blkOffset = offset % kBlockSize; int32_t blkLeft = kBlockSize - blkOffset; + if (offset >= ctx->file.size) return 0; + do { char key[128] = {0}; idxGenLRUKey(key, ctx->file.buf, blkId); @@ -80,24 +82,34 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of memcpy(buf + total, blk->buf + blkOffset, nread); taosLRUCacheRelease(ctx->lru, h, false); } else { - int32_t cacheMemSize = sizeof(SDataBlock) + kBlockSize; + int32_t left = ctx->file.size - offset; + if (left < kBlockSize) { + nread = TMIN(left, len); + int32_t bytes = taosPReadFile(ctx->file.pFile, buf + total, nread, offset); + assert(bytes == nread); - SDataBlock* blk = taosMemoryCalloc(1, cacheMemSize); - blk->blockId = blkId; - blk->nread = taosPReadFile(ctx->file.pFile, blk->buf, kBlockSize, blkId * kBlockSize); - assert(blk->nread <= kBlockSize); + total += bytes; + return total; + } else { + int32_t cacheMemSize = sizeof(SDataBlock) + kBlockSize; - if (blk->nread < kBlockSize && blk->nread < len) { - break; - } + SDataBlock* blk = taosMemoryCalloc(1, cacheMemSize); + blk->blockId = blkId; + blk->nread = taosPReadFile(ctx->file.pFile, blk->buf, kBlockSize, blkId * kBlockSize); + assert(blk->nread <= kBlockSize); - nread = TMIN(blkLeft, len); - memcpy(buf + total, blk->buf + blkOffset, nread); + if (blk->nread < kBlockSize && blk->nread < len) { + break; + } - LRUStatus s = taosLRUCacheInsert(ctx->lru, key, strlen(key), blk, cacheMemSize, deleteDataBlockFromLRU, NULL, - TAOS_LRU_PRIORITY_LOW); - if (s != TAOS_LRU_STATUS_OK) { - return -1; + nread = TMIN(blkLeft, len); + memcpy(buf + total, blk->buf + blkOffset, nread); + + LRUStatus s = taosLRUCacheInsert(ctx->lru, key, strlen(key), blk, cacheMemSize, deleteDataBlockFromLRU, NULL, + TAOS_LRU_PRIORITY_LOW); + if (s != TAOS_LRU_STATUS_OK) { + return -1; + } } } total += nread; @@ -146,9 +158,7 @@ IFileCtx* idxFileCtxCreate(WriterType type, const char* path, bool readOnly, int } else { ctx->file.pFile = taosOpenFile(path, TD_FILE_READ); - int64_t size = 0; taosFStatFile(ctx->file.pFile, &ctx->file.size, NULL); - ctx->file.size = (int)size; #ifdef USE_MMAP ctx->file.ptr = (char*)tfMmapReadOnly(ctx->file.pFile, ctx->file.size); #endif diff --git a/source/libs/index/test/jsonUT.cc b/source/libs/index/test/jsonUT.cc index 1911514d97..8ae3fd4135 100644 --- a/source/libs/index/test/jsonUT.cc +++ b/source/libs/index/test/jsonUT.cc @@ -172,9 +172,9 @@ TEST_F(JsonEnv, testWriteMillonData) { { std::string colName("voltagefdadfa"); std::string colVal("abxxxxxxxxxxxx"); - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 10000; i++) { colVal[i % colVal.size()] = '0' + i % 128; - for (size_t i = 0; i < 100; i++) { + for (size_t i = 0; i < 10; i++) { SIndexTerm* term = indexTermCreateT(1, ADD_VALUE, TSDB_DATA_TYPE_BINARY, colName.c_str(), colName.size(), colVal.c_str(), colVal.size()); diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index c145952778..7cad5df3a1 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -381,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; } @@ -488,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; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index af6c1757a9..e401a3da7f 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -254,6 +254,7 @@ const char* nodesNodeName(ENodeType type) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: return "PhysiStreamSemiInterval"; case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: return "PhysiFill"; case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: return "PhysiSessionWindow"; @@ -1538,6 +1539,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) { @@ -1595,6 +1598,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); } @@ -1657,6 +1666,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); } @@ -2270,6 +2285,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"; @@ -4109,6 +4155,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"; @@ -4134,6 +4182,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); } @@ -4178,6 +4232,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); } @@ -4576,6 +4636,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: return physiIntervalNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: return physiFillNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION: @@ -4586,8 +4647,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: @@ -4728,6 +4790,7 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: return jsonToPhysiIntervalNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: return jsonToPhysiFillNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION: @@ -4738,8 +4801,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/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 0c6b11a765..8d1d332ac7 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -1993,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) { @@ -2062,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; } @@ -2138,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; } @@ -2914,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) { @@ -3579,6 +3633,7 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { code = physiIntervalNodeToMsg(pObj, pEncoder); break; case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: code = physiFillNodeToMsg(pObj, pEncoder); break; case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: @@ -3592,9 +3647,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; @@ -3714,6 +3771,7 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) { code = msgToPhysiIntervalNode(pDecoder, pObj); break; case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: code = msgToPhysiFillNode(pDecoder, pObj); break; case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: @@ -3727,9 +3785,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 8ea80344fc..9f851f6a3f 100644 --- a/source/libs/nodes/src/nodesTraverseFuncs.c +++ b/source/libs/nodes/src/nodesTraverseFuncs.c @@ -378,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: @@ -412,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 7a04d319ec..f8dda501e9 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -511,6 +511,7 @@ SNode* nodesMakeNode(ENodeType type) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: return makeNode(type, sizeof(SStreamSemiIntervalPhysiNode)); case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: return makeNode(type, sizeof(SFillPhysiNode)); case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: return makeNode(type, sizeof(SSessionWinodwPhysiNode)); @@ -772,6 +773,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); @@ -1154,7 +1157,8 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: destroyWinodwPhysiNode((SWinodwPhysiNode*)pNode); break; - case QUERY_NODE_PHYSICAL_PLAN_FILL: { + case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: { SFillPhysiNode* pPhyNode = (SFillPhysiNode*)pNode; destroyPhysiNode((SPhysiNode*)pPhyNode); nodesDestroyList(pPhyNode->pFillExprs); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index dea741cc9b..1a955b3f6b 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -147,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); @@ -212,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 3e05583d92..225f169289 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); } @@ -699,6 +707,7 @@ pseudo_column(A) ::= QDURATION(B). pseudo_column(A) ::= WSTART(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= WEND(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= IROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } 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)); } @@ -909,7 +918,16 @@ 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) ::= diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 65afc84c9d..10a066db40 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1055,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; @@ -1063,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; } @@ -1700,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); @@ -1713,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 a7c08d8f65..efc9d77e67 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/parInsertData.c b/source/libs/parser/src/parInsertData.c index 3ea5e81872..e8c877bed2 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 c51553f7a1..64510773a2 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -129,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}, @@ -200,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}, @@ -250,6 +252,7 @@ static SKeyword keywordTable[] = { {"WITH", TK_WITH}, {"WRITE", TK_WRITE}, {"_C0", TK_ROWTS}, + {"_IROWTS", TK_IROWTS}, {"_QDURATION", TK_QDURATION}, {"_QEND", TK_QEND}, {"_QSTART", TK_QSTART}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 82167e8911..42476690c1 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1556,6 +1556,9 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu "%s(*) is only supported in SELECTed list", pFunc->functionName); } } + if (tsKeepColumnName) { + strcpy(pFunc->node.userAlias, ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->userAlias); + } return TSDB_CODE_SUCCESS; } @@ -2388,8 +2391,12 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { SColumnNode* pCol = (SColumnNode*)pExpr; len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); - len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pCol->colName); - strncpy(pFunc->node.userAlias, buf, TMIN(len, sizeof(pFunc->node.userAlias) - 1)); + if (tsKeepColumnName) { + strcpy(pFunc->node.userAlias, pCol->colName); + } else { + len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pCol->colName); + strncpy(pFunc->node.userAlias, buf, TMIN(len, sizeof(pFunc->node.userAlias) - 1)); + } } else { len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); @@ -3076,7 +3083,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) { @@ -3968,7 +3982,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); @@ -5211,6 +5225,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 || @@ -5220,18 +5321,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 = checkStreamQuery(pCxt, (SSelectStmt*)pStmt); + code = translateQuery(pCxt, pStmt->pQuery); } if (TSDB_CODE_SUCCESS == code) { - getSourceDatabase(pStmt, pCxt->pParseCxt->acctId, pReq->sourceDB); - code = nodesNodeToString(pStmt, false, &pReq->ast, NULL); + code = checkStreamQuery(pCxt, (SSelectStmt*)pStmt->pQuery); + } + if (TSDB_CODE_SUCCESS == code) { + getSourceDatabase(pStmt->pQuery, pCxt->pParseCxt->acctId, pReq->sourceDB); + code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL); } return code; } @@ -5249,7 +5353,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) { @@ -5262,6 +5366,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/sql.c b/source/libs/parser/src/sql.c index f4ced2799a..9acf6ffcdd 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 441 +#define YYNOCODE 448 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy18; - EOperatorType yy128; - bool yy173; - SNodeList* yy334; - int8_t yy341; - int64_t yy459; - ENullOrder yy487; - SAlterOption yy515; - EJoinType yy540; - SNode* yy560; - SDataType yy574; - EOrder yy596; - SToken yy659; - int32_t yy676; + bool yy89; + EFillMode yy102; + SNodeList* yy152; + int64_t yy221; + EOperatorType yy380; + EOrder yy386; + int8_t yy439; + int32_t yy452; + ENullOrder yy585; + EJoinType yy596; + SNode* yy616; + SAlterOption yy669; + SToken yy673; + SDataType yy784; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 679 -#define YYNRULE 509 -#define YYNTOKEN 313 -#define YY_MAX_SHIFT 678 -#define YY_MIN_SHIFTREDUCE 1000 -#define YY_MAX_SHIFTREDUCE 1508 -#define YY_ERROR_ACTION 1509 -#define YY_ACCEPT_ACTION 1510 -#define YY_NO_ACTION 1511 -#define YY_MIN_REDUCE 1512 -#define YY_MAX_REDUCE 2020 +#define YYNSTATE 689 +#define YYNRULE 519 +#define YYNTOKEN 316 +#define YY_MAX_SHIFT 688 +#define YY_MIN_SHIFTREDUCE 1017 +#define YY_MAX_SHIFTREDUCE 1535 +#define YY_ERROR_ACTION 1536 +#define YY_ACCEPT_ACTION 1537 +#define YY_NO_ACTION 1538 +#define YY_MIN_REDUCE 1539 +#define YY_MAX_REDUCE 2057 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,720 +216,798 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2662) +#define YY_ACTTAB_COUNT (3046) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 530, 556, 1760, 530, 435, 1829, 436, 1547, 32, 258, - /* 10 */ 1843, 117, 42, 40, 117, 1996, 1825, 1033, 473, 1646, - /* 20 */ 339, 478, 1296, 41, 39, 38, 37, 36, 1657, 1323, - /* 30 */ 1991, 1657, 1323, 1374, 1577, 1294, 571, 571, 1861, 1648, - /* 40 */ 1821, 1827, 327, 555, 166, 1510, 572, 325, 1992, 557, - /* 50 */ 1825, 1811, 1642, 584, 578, 150, 1369, 1037, 1038, 571, - /* 60 */ 443, 16, 436, 1547, 1659, 1861, 60, 1843, 1302, 42, - /* 70 */ 40, 1444, 440, 550, 1821, 1827, 1875, 339, 1319, 1296, - /* 80 */ 95, 1841, 1842, 1844, 588, 1846, 1847, 583, 578, 578, - /* 90 */ 1374, 530, 1294, 1, 163, 1861, 1928, 384, 485, 484, - /* 100 */ 332, 1924, 50, 572, 354, 124, 1498, 56, 1811, 44, - /* 110 */ 584, 549, 152, 1369, 1524, 675, 480, 483, 16, 1657, - /* 120 */ 513, 1955, 479, 344, 1829, 1302, 1702, 1704, 452, 1376, - /* 130 */ 1377, 212, 44, 1875, 301, 1825, 1996, 95, 1841, 1842, - /* 140 */ 1844, 588, 1846, 1847, 583, 1830, 578, 1703, 1704, 1991, - /* 150 */ 1, 163, 45, 1928, 1843, 56, 1825, 332, 1924, 1821, - /* 160 */ 1827, 333, 1997, 166, 532, 1991, 1900, 1992, 557, 1709, - /* 170 */ 168, 257, 675, 578, 257, 1297, 326, 1295, 1954, 1995, - /* 180 */ 1821, 1827, 1861, 1992, 1994, 1707, 1376, 1377, 77, 303, - /* 190 */ 585, 1322, 520, 568, 578, 1811, 154, 584, 1300, 1301, - /* 200 */ 1616, 1351, 1352, 1354, 1355, 1356, 1357, 1358, 1359, 580, - /* 210 */ 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, 1378, 3, - /* 220 */ 1875, 130, 162, 621, 95, 1841, 1842, 1844, 588, 1846, - /* 230 */ 1847, 583, 1297, 578, 1295, 1696, 127, 169, 137, 1899, - /* 240 */ 1928, 1465, 35, 34, 332, 1924, 41, 39, 38, 37, - /* 250 */ 36, 169, 1050, 169, 1049, 1300, 1301, 128, 1351, 1352, - /* 260 */ 1354, 1355, 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, - /* 270 */ 1370, 1371, 1372, 1373, 1375, 1378, 3, 42, 40, 165, - /* 280 */ 1936, 1937, 1051, 1941, 11, 339, 1321, 1296, 1322, 543, - /* 290 */ 1463, 1464, 1466, 1467, 434, 1843, 169, 438, 1374, 169, - /* 300 */ 1294, 56, 1151, 610, 609, 608, 1155, 607, 1157, 1158, - /* 310 */ 606, 1160, 603, 568, 1166, 600, 1168, 1169, 597, 594, - /* 320 */ 421, 1369, 11, 1861, 9, 219, 16, 1635, 1475, 225, - /* 330 */ 226, 585, 530, 1302, 42, 40, 1811, 613, 584, 546, - /* 340 */ 1709, 130, 339, 171, 1296, 35, 34, 343, 1535, 41, - /* 350 */ 39, 38, 37, 36, 1324, 1374, 1707, 1294, 1, 56, - /* 360 */ 1657, 1875, 56, 1113, 79, 95, 1841, 1842, 1844, 588, - /* 370 */ 1846, 1847, 583, 373, 578, 179, 178, 119, 1369, 1903, - /* 380 */ 675, 1928, 377, 16, 376, 332, 1924, 452, 303, 1811, - /* 390 */ 1302, 520, 375, 371, 1376, 1377, 1115, 1193, 1194, 255, - /* 400 */ 1936, 567, 1513, 566, 35, 34, 1991, 530, 41, 39, - /* 410 */ 38, 37, 36, 442, 617, 1, 438, 1700, 382, 555, - /* 420 */ 166, 552, 547, 107, 1992, 557, 106, 105, 104, 103, - /* 430 */ 102, 101, 100, 99, 98, 1657, 517, 675, 1633, 24, - /* 440 */ 1297, 1448, 1295, 324, 85, 169, 1757, 1321, 1534, 1302, - /* 450 */ 107, 1376, 1377, 106, 105, 104, 103, 102, 101, 100, - /* 460 */ 99, 98, 1321, 1300, 1301, 1650, 1351, 1352, 1354, 1355, - /* 470 */ 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, 1370, 1371, - /* 480 */ 1372, 1373, 1375, 1378, 3, 1512, 11, 35, 34, 1811, - /* 490 */ 530, 41, 39, 38, 37, 36, 234, 1297, 621, 1295, - /* 500 */ 1995, 383, 126, 169, 1505, 1899, 169, 315, 633, 116, - /* 510 */ 115, 114, 113, 112, 111, 110, 109, 108, 1657, 1943, - /* 520 */ 1300, 1301, 551, 1351, 1352, 1354, 1355, 1356, 1357, 1358, - /* 530 */ 1359, 580, 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, - /* 540 */ 1378, 3, 42, 40, 1709, 224, 1296, 342, 1940, 1644, - /* 550 */ 339, 310, 1296, 482, 481, 150, 563, 75, 75, 1294, - /* 560 */ 1707, 568, 198, 1374, 1659, 1294, 316, 530, 314, 313, - /* 570 */ 123, 475, 1050, 1455, 1049, 477, 156, 1533, 391, 1652, - /* 580 */ 1653, 469, 465, 461, 457, 197, 1369, 471, 556, 130, - /* 590 */ 92, 1843, 1302, 619, 1320, 1657, 1504, 476, 1302, 42, - /* 600 */ 40, 1379, 1051, 125, 1943, 1276, 1277, 339, 1640, 1296, - /* 610 */ 568, 1649, 141, 140, 616, 615, 614, 1991, 1811, 1861, - /* 620 */ 1374, 76, 1294, 8, 195, 128, 530, 585, 215, 1353, - /* 630 */ 555, 166, 1811, 1939, 584, 1992, 557, 406, 130, 675, - /* 640 */ 175, 530, 1532, 1369, 1384, 675, 570, 164, 1936, 1937, - /* 650 */ 1321, 1941, 407, 579, 1657, 1302, 1709, 1875, 499, 1376, - /* 660 */ 1377, 95, 1841, 1842, 1844, 588, 1846, 1847, 583, 1657, - /* 670 */ 578, 497, 1708, 495, 128, 2011, 72, 1928, 530, 71, - /* 680 */ 8, 332, 1924, 1811, 1843, 485, 484, 194, 188, 450, - /* 690 */ 193, 1962, 124, 534, 448, 1900, 167, 1936, 1937, 1297, - /* 700 */ 1941, 1295, 675, 480, 483, 1297, 1657, 1295, 1750, 479, - /* 710 */ 186, 1531, 1861, 38, 37, 36, 1376, 1377, 1634, 174, - /* 720 */ 585, 150, 1300, 1301, 1530, 1811, 508, 584, 1300, 1301, - /* 730 */ 1660, 1351, 1352, 1354, 1355, 1356, 1357, 1358, 1359, 580, - /* 740 */ 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, 1378, 3, - /* 750 */ 1875, 559, 1811, 1943, 95, 1841, 1842, 1844, 588, 1846, - /* 760 */ 1847, 583, 1297, 578, 1295, 1811, 28, 169, 1901, 1529, - /* 770 */ 1928, 564, 35, 34, 332, 1924, 41, 39, 38, 37, - /* 780 */ 36, 1528, 1938, 1843, 1527, 1300, 1301, 7, 1351, 1352, - /* 790 */ 1354, 1355, 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, - /* 800 */ 1370, 1371, 1372, 1373, 1375, 1378, 3, 42, 40, 1526, - /* 810 */ 1811, 1861, 345, 646, 644, 339, 322, 1296, 618, 585, - /* 820 */ 150, 1700, 1811, 619, 1811, 1811, 584, 30, 1374, 1659, - /* 830 */ 1294, 378, 1353, 35, 34, 1037, 1038, 41, 39, 38, - /* 840 */ 37, 36, 141, 140, 616, 615, 614, 513, 1321, 1875, - /* 850 */ 1811, 1369, 1523, 292, 1841, 1842, 1844, 588, 1846, 1847, - /* 860 */ 583, 218, 578, 1302, 42, 40, 1750, 612, 1756, 517, - /* 870 */ 298, 530, 339, 1755, 1296, 298, 1991, 177, 678, 1758, - /* 880 */ 1522, 634, 451, 1629, 1525, 1374, 1405, 1294, 8, 1997, - /* 890 */ 166, 252, 265, 1811, 1992, 557, 1617, 35, 34, 1657, - /* 900 */ 78, 41, 39, 38, 37, 36, 160, 530, 1369, 477, - /* 910 */ 675, 668, 664, 660, 656, 263, 516, 1521, 1654, 1077, - /* 920 */ 1302, 1811, 35, 34, 1376, 1377, 41, 39, 38, 37, - /* 930 */ 36, 476, 513, 35, 34, 1657, 91, 41, 39, 38, - /* 940 */ 37, 36, 13, 12, 270, 1, 88, 1687, 530, 530, - /* 950 */ 306, 93, 1078, 29, 232, 530, 1305, 530, 1811, 502, - /* 960 */ 509, 1991, 530, 1410, 46, 4, 514, 675, 229, 1441, - /* 970 */ 1297, 139, 1295, 526, 1997, 166, 1657, 1657, 1520, 1992, - /* 980 */ 557, 1376, 1377, 1657, 1437, 1657, 544, 527, 1948, 1437, - /* 990 */ 1657, 1403, 1519, 1300, 1301, 1564, 1351, 1352, 1354, 1355, - /* 1000 */ 1356, 1357, 1358, 1359, 580, 576, 1367, 1368, 1370, 1371, - /* 1010 */ 1372, 1373, 1375, 1378, 3, 530, 300, 486, 1319, 1811, - /* 1020 */ 221, 385, 49, 48, 512, 414, 528, 1297, 426, 1295, - /* 1030 */ 1353, 1518, 1798, 1811, 386, 1417, 352, 1517, 1270, 1516, - /* 1040 */ 214, 203, 1515, 1657, 201, 399, 1404, 427, 1862, 401, - /* 1050 */ 1300, 1301, 513, 1351, 1352, 1354, 1355, 1356, 1357, 1358, - /* 1060 */ 1359, 580, 576, 1367, 1368, 1370, 1371, 1372, 1373, 1375, - /* 1070 */ 1378, 3, 1811, 530, 205, 1559, 149, 204, 1811, 361, - /* 1080 */ 1811, 1991, 530, 1811, 529, 207, 151, 560, 206, 1557, - /* 1090 */ 392, 276, 1632, 259, 1997, 166, 575, 488, 1308, 1992, - /* 1100 */ 557, 1657, 388, 1574, 209, 274, 64, 208, 43, 63, - /* 1110 */ 1657, 491, 223, 31, 336, 1398, 1399, 1400, 1401, 1402, - /* 1120 */ 1406, 1407, 1408, 1409, 470, 182, 431, 429, 13, 12, - /* 1130 */ 425, 1507, 1508, 420, 419, 418, 417, 416, 413, 412, - /* 1140 */ 411, 410, 409, 405, 404, 403, 402, 396, 395, 394, - /* 1150 */ 393, 246, 390, 389, 312, 134, 1996, 350, 138, 1247, - /* 1160 */ 139, 56, 1548, 227, 58, 1996, 652, 651, 650, 649, - /* 1170 */ 349, 238, 648, 647, 131, 642, 641, 640, 639, 638, - /* 1180 */ 637, 636, 635, 143, 631, 630, 629, 348, 347, 626, - /* 1190 */ 625, 624, 623, 622, 1991, 1304, 530, 619, 58, 94, - /* 1200 */ 1697, 1958, 1843, 1440, 43, 1832, 523, 346, 1995, 231, - /* 1210 */ 627, 1144, 1992, 1993, 254, 1462, 141, 140, 616, 615, - /* 1220 */ 614, 1553, 241, 569, 1657, 251, 628, 2, 5, 43, - /* 1230 */ 1861, 592, 1097, 1395, 355, 69, 68, 381, 585, 138, - /* 1240 */ 173, 360, 490, 1811, 311, 584, 139, 1498, 1095, 1411, - /* 1250 */ 120, 351, 1834, 138, 1263, 1360, 299, 500, 176, 369, - /* 1260 */ 387, 367, 363, 359, 356, 353, 266, 513, 1875, 670, - /* 1270 */ 1319, 211, 96, 586, 338, 1844, 588, 1846, 1847, 583, - /* 1280 */ 269, 578, 1172, 501, 1843, 493, 408, 1752, 1928, 487, - /* 1290 */ 1176, 415, 305, 1924, 210, 423, 1991, 1183, 422, 513, - /* 1300 */ 561, 1181, 424, 1991, 142, 169, 428, 430, 432, 1997, - /* 1310 */ 166, 1325, 1861, 1327, 1992, 557, 555, 166, 433, 441, - /* 1320 */ 585, 1992, 557, 444, 185, 1811, 445, 584, 1991, 1326, - /* 1330 */ 62, 187, 446, 61, 1328, 449, 190, 1307, 192, 447, - /* 1340 */ 73, 1997, 166, 74, 1843, 453, 1992, 557, 196, 472, - /* 1350 */ 1875, 1791, 267, 474, 95, 1841, 1842, 1844, 588, 1846, - /* 1360 */ 1847, 583, 1647, 578, 118, 302, 1843, 200, 2011, 1643, - /* 1370 */ 1928, 202, 1861, 144, 332, 1924, 507, 145, 1645, 213, - /* 1380 */ 585, 1641, 146, 147, 1985, 1811, 503, 584, 504, 216, - /* 1390 */ 510, 515, 542, 321, 1861, 524, 220, 135, 518, 1790, - /* 1400 */ 1762, 525, 585, 521, 82, 323, 84, 1811, 1658, 584, - /* 1410 */ 1875, 268, 136, 1324, 95, 1841, 1842, 1844, 588, 1846, - /* 1420 */ 1847, 583, 1843, 578, 545, 236, 240, 1969, 2011, 538, - /* 1430 */ 1928, 540, 1875, 541, 332, 1924, 285, 586, 338, 1844, - /* 1440 */ 588, 1846, 1847, 583, 1947, 578, 1959, 335, 334, 1968, - /* 1450 */ 1861, 328, 548, 6, 554, 536, 537, 1310, 585, 250, - /* 1460 */ 329, 539, 565, 1811, 2014, 584, 562, 1991, 1374, 1437, - /* 1470 */ 1303, 129, 1323, 55, 247, 1950, 245, 157, 248, 86, - /* 1480 */ 555, 166, 249, 1843, 1944, 1992, 557, 1909, 1875, 1990, - /* 1490 */ 590, 1369, 95, 1841, 1842, 1844, 588, 1846, 1847, 583, - /* 1500 */ 1701, 578, 1630, 1302, 271, 1843, 533, 262, 1928, 671, - /* 1510 */ 253, 1861, 332, 1924, 672, 47, 674, 297, 273, 585, - /* 1520 */ 283, 294, 293, 275, 1811, 1805, 584, 66, 1803, 1802, - /* 1530 */ 67, 1799, 357, 1861, 1804, 358, 1288, 1289, 172, 362, - /* 1540 */ 1797, 585, 364, 365, 366, 1796, 1811, 368, 584, 1875, - /* 1550 */ 574, 1795, 370, 96, 1841, 1842, 1844, 588, 1846, 1847, - /* 1560 */ 583, 1794, 578, 372, 1793, 374, 1266, 1265, 1773, 1928, - /* 1570 */ 1772, 1875, 379, 1927, 1924, 96, 1841, 1842, 1844, 588, - /* 1580 */ 1846, 1847, 583, 380, 578, 1771, 1770, 1745, 1235, 1843, - /* 1590 */ 1744, 1928, 1743, 1742, 132, 573, 1924, 1741, 1740, 70, - /* 1600 */ 1739, 1738, 1737, 1736, 1735, 397, 398, 1734, 400, 1733, - /* 1610 */ 1311, 1732, 1306, 1731, 1730, 1729, 1728, 1861, 1727, 1726, - /* 1620 */ 1725, 1724, 1723, 1722, 1721, 582, 1720, 1719, 1718, 1717, - /* 1630 */ 1811, 133, 584, 1314, 1316, 1716, 1715, 1714, 1713, 1237, - /* 1640 */ 1712, 1711, 1710, 1579, 1843, 576, 1367, 1368, 1370, 1371, - /* 1650 */ 1372, 1373, 1578, 1576, 1544, 1875, 437, 1543, 1040, 291, - /* 1660 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 581, 578, 531, - /* 1670 */ 1893, 121, 1861, 183, 184, 1039, 161, 1786, 122, 1780, - /* 1680 */ 585, 180, 1769, 1768, 191, 1811, 181, 584, 189, 1754, - /* 1690 */ 1636, 439, 1575, 1573, 454, 455, 1571, 1843, 458, 1569, - /* 1700 */ 462, 456, 459, 460, 1567, 463, 464, 466, 468, 1070, - /* 1710 */ 1875, 1556, 1555, 467, 153, 1841, 1842, 1844, 588, 1846, - /* 1720 */ 1847, 583, 1540, 578, 1638, 1861, 1187, 1186, 1637, 1112, - /* 1730 */ 1111, 643, 1108, 585, 1565, 1107, 1106, 1560, 1811, 317, - /* 1740 */ 584, 645, 318, 1558, 492, 319, 1539, 1538, 494, 1843, - /* 1750 */ 489, 199, 57, 496, 1537, 498, 97, 1785, 1779, 148, - /* 1760 */ 1272, 1843, 505, 1875, 217, 558, 2012, 96, 1841, 1842, - /* 1770 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1861, 1767, 1765, - /* 1780 */ 1996, 1766, 1764, 1928, 1763, 582, 1280, 1761, 1925, 1861, - /* 1790 */ 1811, 1753, 584, 519, 535, 81, 17, 585, 233, 1386, - /* 1800 */ 10, 222, 1811, 1861, 584, 18, 43, 19, 1385, 228, - /* 1810 */ 244, 585, 80, 88, 230, 1875, 1811, 54, 584, 291, - /* 1820 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1875, 578, 1843, - /* 1830 */ 1894, 292, 1841, 1842, 1844, 588, 1846, 1847, 583, 511, - /* 1840 */ 578, 1875, 51, 1843, 522, 287, 1841, 1842, 1844, 588, - /* 1850 */ 1846, 1847, 583, 83, 578, 1477, 243, 1861, 25, 235, - /* 1860 */ 1832, 27, 237, 1459, 506, 585, 239, 59, 320, 1461, - /* 1870 */ 1811, 1861, 584, 155, 21, 1492, 337, 1454, 242, 585, - /* 1880 */ 1497, 26, 87, 1491, 1811, 330, 584, 1496, 553, 1498, - /* 1890 */ 1495, 331, 1434, 1843, 1433, 1875, 53, 256, 12, 153, - /* 1900 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1831, 578, 1875, - /* 1910 */ 1312, 20, 1843, 292, 1841, 1842, 1844, 588, 1846, 1847, - /* 1920 */ 583, 1861, 578, 158, 1396, 1878, 340, 15, 1364, 585, - /* 1930 */ 577, 159, 1362, 1361, 1811, 33, 584, 14, 22, 170, - /* 1940 */ 1861, 1336, 1344, 52, 587, 589, 591, 23, 585, 341, - /* 1950 */ 593, 2013, 1173, 1811, 1170, 584, 595, 1167, 596, 1875, - /* 1960 */ 598, 599, 1843, 292, 1841, 1842, 1844, 588, 1846, 1847, - /* 1970 */ 583, 601, 578, 1161, 602, 604, 1843, 1159, 1875, 605, - /* 1980 */ 1150, 1182, 277, 1841, 1842, 1844, 588, 1846, 1847, 583, - /* 1990 */ 1861, 578, 1165, 1164, 611, 1163, 89, 1162, 585, 90, - /* 2000 */ 65, 1178, 260, 1811, 1861, 584, 1068, 1103, 620, 1102, - /* 2010 */ 1101, 1100, 585, 1099, 632, 1098, 1096, 1811, 1094, 584, - /* 2020 */ 1093, 1092, 1119, 1090, 1089, 261, 1088, 1087, 1875, 1086, - /* 2030 */ 1085, 1843, 278, 1841, 1842, 1844, 588, 1846, 1847, 583, - /* 2040 */ 1084, 578, 1875, 1083, 1114, 1116, 279, 1841, 1842, 1844, - /* 2050 */ 588, 1846, 1847, 583, 1080, 578, 1079, 1843, 1076, 1861, - /* 2060 */ 1075, 1074, 1073, 1572, 653, 655, 1570, 585, 657, 654, - /* 2070 */ 659, 658, 1811, 1568, 584, 661, 663, 662, 1566, 665, - /* 2080 */ 667, 666, 1554, 1843, 669, 1861, 1030, 1536, 677, 264, - /* 2090 */ 673, 1511, 1298, 585, 272, 676, 1511, 1875, 1811, 1511, - /* 2100 */ 584, 286, 1841, 1842, 1844, 588, 1846, 1847, 583, 1843, - /* 2110 */ 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, - /* 2120 */ 1511, 1511, 1511, 1875, 1811, 1511, 584, 288, 1841, 1842, - /* 2130 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1861, 1511, 1511, - /* 2140 */ 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, 1875, - /* 2150 */ 1811, 1511, 584, 280, 1841, 1842, 1844, 588, 1846, 1847, - /* 2160 */ 583, 1511, 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2170 */ 1511, 585, 1511, 1511, 1511, 1875, 1811, 1511, 584, 289, - /* 2180 */ 1841, 1842, 1844, 588, 1846, 1847, 583, 1843, 578, 1511, - /* 2190 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2200 */ 1511, 1875, 1511, 1843, 1511, 281, 1841, 1842, 1844, 588, - /* 2210 */ 1846, 1847, 583, 1511, 578, 1861, 1511, 1511, 1511, 1511, - /* 2220 */ 1511, 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, 1511, - /* 2230 */ 584, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, - /* 2240 */ 1511, 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, - /* 2250 */ 1511, 1511, 1511, 1875, 1511, 1511, 1511, 290, 1841, 1842, - /* 2260 */ 1844, 588, 1846, 1847, 583, 1843, 578, 1511, 1511, 1875, - /* 2270 */ 1511, 1511, 1511, 282, 1841, 1842, 1844, 588, 1846, 1847, - /* 2280 */ 583, 1843, 578, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2290 */ 1511, 1511, 1511, 1861, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2300 */ 1511, 585, 1511, 1511, 1511, 1511, 1811, 1511, 584, 1861, - /* 2310 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, - /* 2320 */ 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, 1511, - /* 2330 */ 1511, 1875, 1511, 1511, 1843, 295, 1841, 1842, 1844, 588, - /* 2340 */ 1846, 1847, 583, 1511, 578, 1511, 1511, 1875, 1843, 1511, - /* 2350 */ 1511, 296, 1841, 1842, 1844, 588, 1846, 1847, 583, 1511, - /* 2360 */ 578, 1511, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2370 */ 585, 1511, 1511, 1511, 1511, 1811, 1861, 584, 1511, 1511, - /* 2380 */ 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, - /* 2390 */ 1511, 584, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2400 */ 1875, 1511, 1843, 1511, 1855, 1841, 1842, 1844, 588, 1846, - /* 2410 */ 1847, 583, 1511, 578, 1875, 1511, 1511, 1511, 1854, 1841, - /* 2420 */ 1842, 1844, 588, 1846, 1847, 583, 1843, 578, 1511, 1511, - /* 2430 */ 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, - /* 2440 */ 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, - /* 2450 */ 1511, 1511, 1843, 1511, 1861, 1511, 1511, 1511, 1511, 1511, - /* 2460 */ 1511, 1511, 585, 1511, 1511, 1511, 1511, 1811, 1875, 584, - /* 2470 */ 1511, 1511, 1853, 1841, 1842, 1844, 588, 1846, 1847, 583, - /* 2480 */ 1861, 578, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, - /* 2490 */ 1511, 1511, 1875, 1811, 1511, 584, 307, 1841, 1842, 1844, - /* 2500 */ 588, 1846, 1847, 583, 1843, 578, 1511, 1511, 1511, 1511, - /* 2510 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1875, 1511, - /* 2520 */ 1843, 1511, 308, 1841, 1842, 1844, 588, 1846, 1847, 583, - /* 2530 */ 1511, 578, 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2540 */ 585, 1511, 1511, 1511, 1511, 1811, 1511, 584, 1861, 1511, - /* 2550 */ 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, 1511, 1511, - /* 2560 */ 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2570 */ 1875, 1511, 1511, 1511, 304, 1841, 1842, 1844, 588, 1846, - /* 2580 */ 1847, 583, 1843, 578, 1511, 1511, 1875, 1511, 1511, 1511, - /* 2590 */ 309, 1841, 1842, 1844, 588, 1846, 1847, 583, 1511, 578, - /* 2600 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2610 */ 1861, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 585, 1511, - /* 2620 */ 1511, 1511, 1511, 1811, 1511, 584, 1511, 1511, 1511, 1511, - /* 2630 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - /* 2640 */ 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1875, 1511, - /* 2650 */ 1511, 1511, 284, 1841, 1842, 1844, 588, 1846, 1847, 583, - /* 2660 */ 1511, 578, + /* 0 */ 1860, 1789, 443, 1860, 444, 1574, 451, 1874, 444, 1574, + /* 10 */ 1677, 1856, 44, 42, 1856, 351, 540, 1675, 1731, 1733, + /* 20 */ 346, 1856, 1317, 43, 41, 40, 39, 38, 52, 2033, + /* 30 */ 40, 39, 38, 1396, 1050, 1315, 1892, 1852, 1858, 334, + /* 40 */ 1852, 1858, 340, 1343, 582, 1686, 1344, 1852, 1858, 1842, + /* 50 */ 588, 594, 30, 588, 442, 581, 1391, 446, 37, 36, + /* 60 */ 588, 17, 43, 41, 40, 39, 38, 1874, 1323, 44, + /* 70 */ 42, 1466, 1872, 1130, 1054, 1055, 1907, 346, 566, 1317, + /* 80 */ 97, 1873, 1875, 598, 1877, 1878, 593, 1067, 588, 1066, + /* 90 */ 1396, 1562, 1315, 167, 1, 1960, 1892, 1732, 1733, 339, + /* 100 */ 1956, 77, 479, 1738, 595, 578, 1132, 2028, 1470, 1842, + /* 110 */ 333, 594, 172, 1391, 1342, 125, 685, 1068, 17, 1736, + /* 120 */ 1986, 1525, 565, 170, 1681, 1323, 1663, 2029, 567, 46, + /* 130 */ 1398, 1399, 596, 1842, 132, 62, 1907, 1540, 1561, 225, + /* 140 */ 98, 345, 1875, 598, 1877, 1878, 593, 1975, 588, 1892, + /* 150 */ 87, 1, 581, 1212, 1213, 1960, 58, 560, 109, 312, + /* 160 */ 1956, 108, 107, 106, 105, 104, 103, 102, 101, 100, + /* 170 */ 2028, 130, 1679, 685, 527, 1972, 1318, 58, 1316, 81, + /* 180 */ 1842, 331, 34, 265, 1786, 565, 170, 1398, 1399, 264, + /* 190 */ 2029, 567, 580, 168, 1968, 1969, 559, 1973, 556, 450, + /* 200 */ 1321, 1322, 446, 1372, 1373, 1375, 1376, 1377, 1378, 1379, + /* 210 */ 1380, 1381, 590, 586, 1389, 1390, 1392, 1393, 1394, 1395, + /* 220 */ 1397, 1400, 3, 581, 203, 58, 46, 94, 1427, 155, + /* 230 */ 578, 1551, 629, 1318, 1342, 1316, 58, 384, 160, 383, + /* 240 */ 173, 127, 1492, 477, 473, 469, 465, 202, 428, 1678, + /* 250 */ 448, 144, 143, 626, 625, 624, 1340, 1321, 1322, 132, + /* 260 */ 1372, 1373, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 590, + /* 270 */ 586, 1389, 1390, 1392, 1393, 1394, 1395, 1397, 1400, 3, + /* 280 */ 44, 42, 562, 557, 78, 490, 489, 200, 346, 1861, + /* 290 */ 1317, 553, 1490, 1491, 1493, 1494, 130, 31, 1374, 578, + /* 300 */ 1856, 1396, 173, 1315, 183, 182, 109, 1432, 58, 108, + /* 310 */ 107, 106, 105, 104, 103, 102, 101, 100, 169, 1968, + /* 320 */ 1969, 629, 1973, 173, 1391, 460, 1852, 1858, 132, 17, + /* 330 */ 2033, 11, 1874, 9, 540, 380, 1323, 44, 42, 588, + /* 340 */ 144, 143, 626, 625, 624, 346, 175, 1317, 578, 158, + /* 350 */ 199, 193, 47, 198, 1643, 382, 378, 456, 1396, 2028, + /* 360 */ 1315, 1892, 1, 1686, 1343, 130, 540, 2033, 542, 582, + /* 370 */ 1932, 173, 173, 191, 1842, 2032, 594, 132, 119, 2029, + /* 380 */ 2031, 1391, 173, 391, 685, 481, 17, 171, 1968, 1969, + /* 390 */ 217, 1973, 1067, 1323, 1066, 1686, 2028, 1872, 1398, 1399, + /* 400 */ 1342, 1907, 1539, 231, 232, 97, 1873, 1875, 598, 1877, + /* 410 */ 1878, 593, 2032, 588, 121, 561, 2029, 2030, 167, 1, + /* 420 */ 1960, 308, 1068, 540, 339, 1956, 118, 117, 116, 115, + /* 430 */ 114, 113, 112, 111, 110, 119, 262, 1968, 577, 1975, + /* 440 */ 576, 685, 486, 2028, 1318, 1987, 1316, 79, 310, 631, + /* 450 */ 1738, 530, 1686, 1341, 173, 1398, 1399, 350, 565, 170, + /* 460 */ 13, 12, 310, 2029, 567, 530, 1736, 1971, 1321, 1322, + /* 470 */ 1661, 1372, 1373, 1375, 1376, 1377, 1378, 1379, 1380, 1381, + /* 480 */ 590, 586, 1389, 1390, 1392, 1393, 1394, 1395, 1397, 1400, + /* 490 */ 3, 230, 11, 1406, 544, 1537, 1932, 322, 173, 1342, + /* 500 */ 77, 1318, 1785, 1316, 305, 1170, 620, 619, 618, 1174, + /* 510 */ 617, 1176, 1177, 616, 1179, 613, 142, 1185, 610, 1187, + /* 520 */ 1188, 607, 604, 1682, 623, 1321, 1322, 179, 1372, 1373, + /* 530 */ 1375, 1376, 1377, 1378, 1379, 1380, 1381, 590, 586, 1389, + /* 540 */ 1390, 1392, 1393, 1394, 1395, 1397, 1400, 3, 44, 42, + /* 550 */ 392, 1295, 1296, 332, 1439, 361, 346, 323, 1317, 321, + /* 560 */ 320, 153, 483, 393, 74, 540, 485, 73, 51, 1396, + /* 570 */ 1688, 1315, 523, 1664, 385, 1975, 629, 389, 37, 36, + /* 580 */ 166, 1874, 43, 41, 40, 39, 38, 1344, 484, 11, + /* 590 */ 1345, 523, 1391, 1725, 1686, 144, 143, 626, 625, 624, + /* 600 */ 1874, 2028, 540, 1970, 1323, 44, 42, 1401, 656, 654, + /* 610 */ 1892, 1560, 1323, 346, 390, 1317, 2034, 170, 595, 643, + /* 620 */ 2028, 2029, 567, 1842, 224, 594, 1396, 1738, 1315, 1892, + /* 630 */ 8, 1686, 507, 460, 317, 2034, 170, 595, 2032, 540, + /* 640 */ 2029, 567, 1842, 1736, 594, 505, 596, 503, 1662, 1391, + /* 650 */ 1907, 398, 685, 1842, 292, 345, 1875, 598, 1877, 1878, + /* 660 */ 593, 1323, 588, 349, 80, 1872, 1398, 1399, 1686, 1907, + /* 670 */ 1671, 153, 566, 97, 1873, 1875, 598, 1877, 1878, 593, + /* 680 */ 1688, 588, 218, 1374, 2028, 1716, 2048, 8, 1960, 1559, + /* 690 */ 37, 36, 339, 1956, 43, 41, 40, 39, 38, 565, + /* 700 */ 170, 2028, 1994, 540, 2029, 567, 540, 45, 631, 685, + /* 710 */ 527, 1784, 1318, 305, 1316, 413, 565, 170, 414, 1552, + /* 720 */ 1787, 2029, 567, 1398, 1399, 153, 627, 1779, 1558, 1729, + /* 730 */ 264, 1842, 1686, 241, 1689, 1686, 1321, 1322, 178, 1372, + /* 740 */ 1373, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 590, 586, + /* 750 */ 1389, 1390, 1392, 1393, 1394, 1395, 1397, 1400, 3, 1266, + /* 760 */ 37, 36, 540, 540, 43, 41, 40, 39, 38, 1318, + /* 770 */ 1842, 1316, 352, 1673, 458, 459, 173, 1502, 37, 36, + /* 780 */ 153, 1557, 43, 41, 40, 39, 38, 128, 1556, 1688, + /* 790 */ 1931, 1686, 1686, 1321, 1322, 26, 1372, 1373, 1375, 1376, + /* 800 */ 1377, 1378, 1379, 1380, 1381, 590, 586, 1389, 1390, 1392, + /* 810 */ 1393, 1394, 1395, 1397, 1400, 3, 44, 42, 526, 1317, + /* 820 */ 1779, 1555, 1738, 1842, 346, 628, 1317, 1554, 1729, 2033, + /* 830 */ 1842, 181, 1315, 540, 1553, 523, 1669, 1396, 1737, 1315, + /* 840 */ 32, 359, 1054, 1055, 485, 1683, 37, 36, 1550, 1874, + /* 850 */ 43, 41, 40, 39, 38, 644, 7, 1656, 523, 540, + /* 860 */ 1391, 1463, 1686, 1842, 2028, 1323, 484, 1549, 1874, 1842, + /* 870 */ 540, 136, 1323, 44, 42, 570, 1842, 540, 1892, 2034, + /* 880 */ 170, 346, 519, 1317, 2029, 567, 595, 2028, 1686, 524, + /* 890 */ 1842, 1842, 569, 594, 1396, 1345, 1315, 1892, 8, 1686, + /* 900 */ 518, 277, 2034, 170, 1716, 595, 1686, 2029, 567, 1842, + /* 910 */ 1842, 1342, 594, 685, 1872, 1829, 1548, 1391, 1907, 540, + /* 920 */ 685, 1525, 156, 1873, 1875, 598, 1877, 1878, 593, 1323, + /* 930 */ 588, 235, 221, 1872, 1398, 1399, 1547, 1907, 1532, 48, + /* 940 */ 4, 97, 1873, 1875, 598, 1877, 1878, 593, 1686, 588, + /* 950 */ 493, 492, 1546, 585, 2048, 1, 1960, 126, 1842, 1591, + /* 960 */ 339, 1956, 368, 545, 1997, 1980, 1459, 540, 488, 491, + /* 970 */ 2022, 1604, 540, 1318, 487, 1316, 1326, 685, 1842, 536, + /* 980 */ 1318, 494, 1316, 358, 538, 1545, 208, 210, 1544, 206, + /* 990 */ 209, 1398, 1399, 589, 1842, 229, 1686, 1321, 1322, 1543, + /* 1000 */ 523, 1686, 50, 522, 1321, 1322, 1542, 1372, 1373, 1375, + /* 1010 */ 1376, 1377, 1378, 1379, 1380, 1381, 590, 586, 1389, 1390, + /* 1020 */ 1392, 1393, 1394, 1395, 1397, 1400, 3, 1842, 540, 2028, + /* 1030 */ 1842, 540, 1531, 1534, 1535, 493, 492, 1318, 240, 1316, + /* 1040 */ 539, 1842, 126, 266, 2034, 170, 573, 233, 1842, 2029, + /* 1050 */ 567, 622, 137, 488, 491, 212, 1459, 1686, 211, 487, + /* 1060 */ 1686, 1321, 1322, 1601, 1372, 1373, 1375, 1376, 1377, 1378, + /* 1070 */ 1379, 1380, 1381, 590, 586, 1389, 1390, 1392, 1393, 1394, + /* 1080 */ 1395, 1397, 1400, 3, 307, 540, 1340, 214, 13, 12, + /* 1090 */ 213, 571, 1417, 421, 1325, 1374, 433, 353, 1462, 1586, + /* 1100 */ 1584, 93, 37, 36, 533, 2000, 43, 41, 40, 39, + /* 1110 */ 38, 90, 1644, 406, 1686, 434, 141, 408, 142, 1329, + /* 1120 */ 60, 496, 499, 259, 245, 60, 662, 661, 660, 659, + /* 1130 */ 356, 45, 658, 657, 133, 652, 651, 650, 649, 648, + /* 1140 */ 647, 646, 645, 146, 641, 640, 639, 355, 354, 636, + /* 1150 */ 635, 634, 633, 632, 554, 154, 478, 37, 36, 399, + /* 1160 */ 283, 43, 41, 40, 39, 38, 253, 1094, 237, 637, + /* 1170 */ 1163, 395, 1489, 45, 281, 66, 248, 1433, 65, 1863, + /* 1180 */ 37, 36, 1893, 1382, 43, 41, 40, 39, 38, 1482, + /* 1190 */ 602, 1114, 357, 1575, 187, 439, 437, 141, 1990, 432, + /* 1200 */ 1095, 1874, 427, 426, 425, 424, 423, 420, 419, 418, + /* 1210 */ 417, 416, 412, 411, 410, 409, 403, 402, 401, 400, + /* 1220 */ 142, 397, 396, 319, 638, 276, 1726, 1865, 37, 36, + /* 1230 */ 1892, 58, 43, 41, 40, 39, 38, 1328, 595, 122, + /* 1240 */ 141, 579, 1191, 1842, 261, 594, 1112, 1580, 258, 1195, + /* 1250 */ 2, 362, 5, 367, 318, 273, 180, 1282, 394, 1340, + /* 1260 */ 415, 1781, 422, 430, 574, 429, 1872, 431, 435, 96, + /* 1270 */ 1907, 436, 1202, 184, 97, 1873, 1875, 598, 1877, 1878, + /* 1280 */ 593, 313, 588, 438, 1346, 129, 441, 140, 1931, 1960, + /* 1290 */ 440, 1200, 145, 339, 1956, 680, 449, 1348, 452, 190, + /* 1300 */ 511, 192, 453, 1347, 454, 71, 70, 388, 1349, 455, + /* 1310 */ 177, 1874, 152, 195, 197, 457, 498, 523, 75, 76, + /* 1320 */ 461, 201, 480, 1425, 482, 1676, 205, 306, 1672, 207, + /* 1330 */ 376, 508, 374, 370, 366, 363, 360, 309, 120, 147, + /* 1340 */ 1892, 510, 148, 1674, 1670, 216, 2028, 149, 595, 512, + /* 1350 */ 150, 274, 219, 1842, 513, 594, 222, 520, 1820, 501, + /* 1360 */ 514, 2034, 170, 495, 525, 226, 2029, 567, 215, 517, + /* 1370 */ 552, 138, 534, 328, 528, 1819, 1872, 173, 1426, 1791, + /* 1380 */ 1907, 531, 330, 139, 97, 1873, 1875, 598, 1877, 1878, + /* 1390 */ 593, 535, 588, 1874, 84, 275, 86, 2048, 1687, 1960, + /* 1400 */ 1345, 548, 2006, 339, 1956, 64, 1991, 555, 63, 243, + /* 1410 */ 2001, 550, 2005, 1979, 551, 247, 335, 558, 6, 564, + /* 1420 */ 336, 549, 1892, 547, 546, 257, 575, 2027, 572, 1459, + /* 1430 */ 595, 1344, 2051, 256, 252, 1842, 1982, 594, 1976, 57, + /* 1440 */ 131, 1941, 88, 600, 1657, 161, 1874, 33, 343, 1420, + /* 1450 */ 1421, 1422, 1423, 1424, 1428, 1429, 1430, 1431, 1872, 254, + /* 1460 */ 255, 278, 1907, 1730, 260, 269, 97, 1873, 1875, 598, + /* 1470 */ 1877, 1878, 593, 681, 588, 1892, 49, 682, 304, 1935, + /* 1480 */ 290, 1960, 684, 595, 301, 339, 1956, 300, 1842, 1836, + /* 1490 */ 594, 282, 280, 1835, 68, 1834, 1833, 69, 1830, 364, + /* 1500 */ 365, 1309, 1310, 176, 369, 1828, 371, 372, 373, 1827, + /* 1510 */ 375, 1872, 1826, 377, 1874, 1907, 1825, 1824, 381, 97, + /* 1520 */ 1873, 1875, 598, 1877, 1878, 593, 379, 588, 1285, 1284, + /* 1530 */ 1802, 1801, 1933, 386, 1960, 387, 1874, 1800, 339, 1956, + /* 1540 */ 342, 341, 1799, 1892, 134, 1254, 1774, 1773, 1772, 1771, + /* 1550 */ 1331, 595, 1770, 1769, 72, 1768, 1842, 1767, 594, 1766, + /* 1560 */ 1765, 1396, 1764, 1324, 404, 1892, 1763, 405, 407, 1762, + /* 1570 */ 1761, 1760, 1759, 595, 1758, 1757, 1756, 1755, 1842, 1872, + /* 1580 */ 594, 1754, 1753, 1907, 1391, 1752, 1751, 97, 1873, 1875, + /* 1590 */ 598, 1877, 1878, 593, 1874, 588, 1323, 1750, 1749, 1748, + /* 1600 */ 543, 1872, 1960, 135, 1747, 1907, 339, 1956, 1746, 98, + /* 1610 */ 1873, 1875, 598, 1877, 1878, 593, 1745, 588, 1744, 1743, + /* 1620 */ 688, 1742, 1256, 1892, 1960, 1741, 1740, 1739, 1959, 1956, + /* 1630 */ 1606, 595, 1605, 1603, 272, 185, 1842, 1138, 594, 186, + /* 1640 */ 1571, 1570, 1057, 1056, 584, 188, 123, 1815, 164, 165, + /* 1650 */ 189, 445, 124, 678, 674, 670, 666, 270, 1809, 1872, + /* 1660 */ 447, 1798, 194, 1907, 196, 1797, 1783, 98, 1873, 1875, + /* 1670 */ 598, 1877, 1878, 593, 1665, 588, 1602, 1087, 1600, 462, + /* 1680 */ 1598, 463, 1960, 466, 464, 467, 583, 1956, 468, 1596, + /* 1690 */ 470, 472, 1594, 471, 95, 474, 1874, 238, 475, 1583, + /* 1700 */ 1582, 476, 1567, 1667, 1332, 1206, 1327, 1205, 1666, 1123, + /* 1710 */ 1129, 653, 59, 1592, 1128, 655, 1125, 1124, 204, 1587, + /* 1720 */ 324, 1585, 497, 325, 1566, 1892, 326, 1565, 1335, 1337, + /* 1730 */ 537, 500, 1564, 592, 506, 1814, 99, 1301, 1842, 1808, + /* 1740 */ 594, 586, 1389, 1390, 1392, 1393, 1394, 1395, 25, 502, + /* 1750 */ 504, 53, 1291, 515, 516, 1874, 223, 151, 1796, 1794, + /* 1760 */ 2033, 1872, 1795, 227, 1793, 1907, 1792, 1790, 1299, 298, + /* 1770 */ 1873, 1875, 598, 1877, 1878, 593, 591, 588, 541, 1925, + /* 1780 */ 18, 1289, 529, 220, 1892, 327, 228, 234, 82, 521, + /* 1790 */ 1782, 83, 595, 239, 90, 236, 532, 1842, 19, 594, + /* 1800 */ 85, 27, 15, 1408, 20, 1504, 244, 21, 56, 10, + /* 1810 */ 1874, 250, 1407, 1486, 242, 251, 246, 1863, 1488, 159, + /* 1820 */ 1872, 1481, 249, 28, 1907, 29, 61, 22, 157, 1873, + /* 1830 */ 1875, 598, 1877, 1878, 593, 89, 588, 1524, 1525, 1892, + /* 1840 */ 1519, 1518, 337, 1523, 1522, 338, 1456, 595, 1455, 263, + /* 1850 */ 1862, 12, 1842, 1418, 594, 16, 55, 1333, 54, 1365, + /* 1860 */ 162, 163, 174, 1874, 1910, 597, 1169, 1386, 587, 601, + /* 1870 */ 1384, 35, 1184, 1383, 14, 1872, 1357, 23, 599, 1907, + /* 1880 */ 568, 2049, 24, 98, 1873, 1875, 598, 1877, 1878, 593, + /* 1890 */ 1192, 588, 1892, 348, 603, 605, 1189, 329, 1960, 608, + /* 1900 */ 595, 611, 621, 1957, 614, 1842, 606, 594, 1201, 1183, + /* 1910 */ 1182, 1181, 1186, 609, 1874, 1180, 612, 267, 1197, 1178, + /* 1920 */ 615, 91, 92, 67, 1085, 1120, 630, 1119, 1872, 1118, + /* 1930 */ 1117, 1874, 1907, 1116, 642, 1115, 299, 1873, 1875, 598, + /* 1940 */ 1877, 1878, 593, 1892, 588, 1113, 1111, 1110, 1109, 1136, + /* 1950 */ 268, 592, 1107, 1106, 1105, 1104, 1842, 1103, 594, 1102, + /* 1960 */ 1892, 1101, 1100, 1131, 1097, 1133, 1096, 1091, 595, 1093, + /* 1970 */ 1599, 1092, 1090, 1842, 663, 594, 1597, 664, 667, 1872, + /* 1980 */ 665, 1595, 1593, 1907, 671, 668, 669, 298, 1873, 1875, + /* 1990 */ 598, 1877, 1878, 593, 673, 588, 1872, 1926, 672, 675, + /* 2000 */ 1907, 676, 677, 1581, 156, 1873, 1875, 598, 1877, 1878, + /* 2010 */ 593, 1563, 588, 679, 1047, 683, 1874, 271, 1319, 279, + /* 2020 */ 686, 687, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2030 */ 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2040 */ 1538, 1538, 1538, 1538, 1538, 1892, 1998, 1538, 1538, 1538, + /* 2050 */ 1538, 1538, 1538, 595, 1538, 1538, 1538, 1538, 1842, 1538, + /* 2060 */ 594, 1538, 1538, 1538, 1538, 1538, 1538, 1874, 1538, 1538, + /* 2070 */ 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2080 */ 1538, 1872, 1538, 1538, 1538, 1907, 1538, 1538, 1538, 294, + /* 2090 */ 1873, 1875, 598, 1877, 1878, 593, 1892, 588, 1538, 1538, + /* 2100 */ 1538, 1538, 1538, 1538, 595, 1538, 1538, 1538, 1538, 1842, + /* 2110 */ 1538, 594, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2120 */ 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2130 */ 1874, 1538, 1872, 563, 1538, 1538, 1907, 1538, 1538, 1538, + /* 2140 */ 157, 1873, 1875, 598, 1877, 1878, 593, 1538, 588, 1538, + /* 2150 */ 1874, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1892, + /* 2160 */ 1538, 1538, 1538, 1538, 344, 1538, 1538, 595, 1538, 1538, + /* 2170 */ 1538, 1538, 1842, 1538, 594, 1538, 1538, 1538, 1538, 1892, + /* 2180 */ 1538, 1538, 1538, 1538, 347, 1538, 1538, 595, 1538, 1538, + /* 2190 */ 1538, 1538, 1842, 2050, 594, 1872, 1538, 1538, 1538, 1907, + /* 2200 */ 1538, 1874, 1538, 299, 1873, 1875, 598, 1877, 1878, 593, + /* 2210 */ 1538, 588, 1538, 1538, 1538, 1872, 1538, 1538, 1874, 1907, + /* 2220 */ 1538, 1538, 1538, 299, 1873, 1875, 598, 1877, 1878, 593, + /* 2230 */ 1892, 588, 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, + /* 2240 */ 1538, 1538, 1538, 1842, 1538, 594, 1538, 1892, 1538, 1538, + /* 2250 */ 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, 1538, 1538, + /* 2260 */ 1842, 1874, 594, 1538, 1538, 1538, 509, 1538, 1538, 1538, + /* 2270 */ 1907, 1538, 1538, 1538, 292, 1873, 1875, 598, 1877, 1878, + /* 2280 */ 593, 1538, 588, 1872, 1538, 1538, 1538, 1907, 1538, 1538, + /* 2290 */ 1892, 284, 1873, 1875, 598, 1877, 1878, 593, 595, 588, + /* 2300 */ 1538, 1538, 1538, 1842, 1538, 594, 1538, 1538, 1538, 1538, + /* 2310 */ 1538, 1538, 1874, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2320 */ 1538, 1538, 1538, 1538, 1538, 1538, 1872, 1538, 1538, 1874, + /* 2330 */ 1907, 1538, 1538, 1538, 285, 1873, 1875, 598, 1877, 1878, + /* 2340 */ 593, 1892, 588, 1538, 1538, 1538, 1538, 1538, 1538, 595, + /* 2350 */ 1538, 1538, 1538, 1538, 1842, 1538, 594, 1538, 1892, 1538, + /* 2360 */ 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, 1538, + /* 2370 */ 1538, 1842, 1538, 594, 1538, 1538, 1538, 1872, 1538, 1538, + /* 2380 */ 1874, 1907, 1538, 1538, 1538, 286, 1873, 1875, 598, 1877, + /* 2390 */ 1878, 593, 1538, 588, 1872, 1538, 1538, 1538, 1907, 1538, + /* 2400 */ 1538, 1538, 293, 1873, 1875, 598, 1877, 1878, 593, 1892, + /* 2410 */ 588, 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, + /* 2420 */ 1538, 1538, 1842, 1538, 594, 1538, 1538, 1538, 1538, 1538, + /* 2430 */ 1538, 1874, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2440 */ 1538, 1538, 1538, 1538, 1538, 1872, 1538, 1538, 1538, 1907, + /* 2450 */ 1874, 1538, 1538, 295, 1873, 1875, 598, 1877, 1878, 593, + /* 2460 */ 1892, 588, 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, + /* 2470 */ 1538, 1538, 1538, 1842, 1538, 594, 1538, 1538, 1538, 1892, + /* 2480 */ 1538, 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, + /* 2490 */ 1538, 1538, 1842, 1538, 594, 1538, 1872, 1538, 1538, 1538, + /* 2500 */ 1907, 1538, 1538, 1538, 287, 1873, 1875, 598, 1877, 1878, + /* 2510 */ 593, 1538, 588, 1874, 1538, 1872, 1538, 1538, 1538, 1907, + /* 2520 */ 1538, 1538, 1538, 296, 1873, 1875, 598, 1877, 1878, 593, + /* 2530 */ 1538, 588, 1538, 1538, 1538, 1874, 1538, 1538, 1538, 1538, + /* 2540 */ 1538, 1538, 1892, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2550 */ 595, 1538, 1538, 1538, 1538, 1842, 1538, 594, 1538, 1538, + /* 2560 */ 1538, 1538, 1538, 1538, 1892, 1538, 1538, 1538, 1538, 1538, + /* 2570 */ 1538, 1538, 595, 1538, 1538, 1538, 1538, 1842, 1872, 594, + /* 2580 */ 1538, 1538, 1907, 1538, 1538, 1538, 288, 1873, 1875, 598, + /* 2590 */ 1877, 1878, 593, 1538, 588, 1874, 1538, 1538, 1538, 1538, + /* 2600 */ 1872, 1538, 1538, 1538, 1907, 1538, 1538, 1538, 297, 1873, + /* 2610 */ 1875, 598, 1877, 1878, 593, 1874, 588, 1538, 1538, 1538, + /* 2620 */ 1538, 1538, 1538, 1538, 1892, 1538, 1538, 1538, 1538, 1538, + /* 2630 */ 1538, 1538, 595, 1538, 1538, 1538, 1538, 1842, 1538, 594, + /* 2640 */ 1538, 1538, 1538, 1538, 1892, 1538, 1538, 1538, 1538, 1538, + /* 2650 */ 1538, 1538, 595, 1538, 1538, 1538, 1538, 1842, 1874, 594, + /* 2660 */ 1872, 1538, 1538, 1538, 1907, 1538, 1538, 1538, 289, 1873, + /* 2670 */ 1875, 598, 1877, 1878, 593, 1538, 588, 1538, 1874, 1538, + /* 2680 */ 1872, 1538, 1538, 1538, 1907, 1538, 1538, 1892, 302, 1873, + /* 2690 */ 1875, 598, 1877, 1878, 593, 595, 588, 1538, 1538, 1538, + /* 2700 */ 1842, 1538, 594, 1538, 1538, 1538, 1538, 1892, 1538, 1538, + /* 2710 */ 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, 1538, 1538, + /* 2720 */ 1842, 1538, 594, 1872, 1538, 1538, 1538, 1907, 1538, 1874, + /* 2730 */ 1538, 303, 1873, 1875, 598, 1877, 1878, 593, 1538, 588, + /* 2740 */ 1538, 1538, 1538, 1872, 1538, 1538, 1538, 1907, 1538, 1538, + /* 2750 */ 1538, 1886, 1873, 1875, 598, 1877, 1878, 593, 1892, 588, + /* 2760 */ 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, 1538, + /* 2770 */ 1538, 1842, 1538, 594, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2780 */ 1874, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2790 */ 1538, 1538, 1538, 1538, 1872, 1538, 1538, 1538, 1907, 1874, + /* 2800 */ 1538, 1538, 1885, 1873, 1875, 598, 1877, 1878, 593, 1892, + /* 2810 */ 588, 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, + /* 2820 */ 1538, 1538, 1842, 1538, 594, 1538, 1538, 1538, 1892, 1538, + /* 2830 */ 1538, 1538, 1538, 1538, 1538, 1538, 595, 1538, 1538, 1538, + /* 2840 */ 1538, 1842, 1538, 594, 1538, 1872, 1538, 1538, 1538, 1907, + /* 2850 */ 1538, 1538, 1538, 1884, 1873, 1875, 598, 1877, 1878, 593, + /* 2860 */ 1538, 588, 1874, 1538, 1872, 1538, 1538, 1538, 1907, 1538, + /* 2870 */ 1538, 1538, 314, 1873, 1875, 598, 1877, 1878, 593, 1538, + /* 2880 */ 588, 1538, 1538, 1538, 1874, 1538, 1538, 1538, 1538, 1538, + /* 2890 */ 1538, 1892, 1538, 1538, 1538, 1538, 1538, 1538, 1538, 595, + /* 2900 */ 1538, 1538, 1538, 1538, 1842, 1538, 594, 1538, 1538, 1538, + /* 2910 */ 1538, 1538, 1538, 1892, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2920 */ 1538, 595, 1538, 1538, 1538, 1538, 1842, 1872, 594, 1538, + /* 2930 */ 1538, 1907, 1538, 1538, 1538, 315, 1873, 1875, 598, 1877, + /* 2940 */ 1878, 593, 1538, 588, 1874, 1538, 1538, 1538, 1538, 1872, + /* 2950 */ 1538, 1538, 1538, 1907, 1538, 1538, 1538, 311, 1873, 1875, + /* 2960 */ 598, 1877, 1878, 593, 1874, 588, 1538, 1538, 1538, 1538, + /* 2970 */ 1538, 1538, 1538, 1892, 1538, 1538, 1538, 1538, 1538, 1538, + /* 2980 */ 1538, 595, 1538, 1538, 1538, 1538, 1842, 1538, 594, 1538, + /* 2990 */ 1538, 1538, 1538, 1892, 1538, 1538, 1538, 1538, 1538, 1538, + /* 3000 */ 1538, 595, 1538, 1538, 1538, 1538, 1842, 1538, 594, 1872, + /* 3010 */ 1538, 1538, 1538, 1907, 1538, 1538, 1538, 316, 1873, 1875, + /* 3020 */ 598, 1877, 1878, 593, 1538, 588, 1538, 1538, 1538, 1872, + /* 3030 */ 1538, 1538, 1538, 1907, 1538, 1538, 1538, 291, 1873, 1875, + /* 3040 */ 598, 1877, 1878, 593, 1538, 588, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 324, 388, 0, 324, 320, 346, 322, 323, 403, 404, - /* 10 */ 316, 335, 12, 13, 335, 3, 357, 4, 342, 345, - /* 20 */ 20, 342, 22, 12, 13, 14, 15, 16, 352, 20, - /* 30 */ 417, 352, 20, 33, 0, 35, 20, 20, 344, 346, - /* 40 */ 381, 382, 383, 430, 431, 313, 352, 336, 435, 436, - /* 50 */ 357, 357, 345, 359, 395, 344, 56, 44, 45, 20, - /* 60 */ 320, 61, 322, 323, 353, 344, 4, 316, 68, 12, - /* 70 */ 13, 14, 14, 352, 381, 382, 382, 20, 20, 22, - /* 80 */ 386, 387, 388, 389, 390, 391, 392, 393, 395, 395, - /* 90 */ 33, 324, 35, 93, 400, 344, 402, 324, 64, 65, - /* 100 */ 406, 407, 335, 352, 372, 71, 94, 93, 357, 93, - /* 110 */ 359, 390, 315, 56, 317, 115, 82, 83, 61, 352, - /* 120 */ 388, 427, 88, 355, 346, 68, 358, 359, 60, 129, - /* 130 */ 130, 125, 93, 382, 361, 357, 388, 386, 387, 388, - /* 140 */ 389, 390, 391, 392, 393, 346, 395, 358, 359, 417, - /* 150 */ 93, 400, 93, 402, 316, 93, 357, 406, 407, 381, - /* 160 */ 382, 383, 430, 431, 399, 417, 401, 435, 436, 344, - /* 170 */ 419, 162, 115, 395, 162, 175, 351, 177, 427, 431, - /* 180 */ 381, 382, 344, 435, 436, 360, 129, 130, 182, 183, - /* 190 */ 352, 20, 186, 324, 395, 357, 329, 359, 198, 199, - /* 200 */ 333, 201, 202, 203, 204, 205, 206, 207, 208, 209, + /* 0 */ 350, 0, 323, 350, 325, 326, 323, 319, 325, 326, + /* 10 */ 350, 361, 12, 13, 361, 359, 327, 349, 362, 363, + /* 20 */ 20, 361, 22, 12, 13, 14, 15, 16, 339, 3, + /* 30 */ 14, 15, 16, 33, 4, 35, 348, 387, 388, 389, + /* 40 */ 387, 388, 389, 20, 356, 356, 20, 387, 388, 361, + /* 50 */ 400, 363, 2, 400, 324, 20, 56, 327, 8, 9, + /* 60 */ 400, 61, 12, 13, 14, 15, 16, 319, 68, 12, + /* 70 */ 13, 14, 384, 35, 44, 45, 388, 20, 393, 22, + /* 80 */ 392, 393, 394, 395, 396, 397, 398, 20, 400, 22, + /* 90 */ 33, 319, 35, 405, 94, 407, 348, 362, 363, 411, + /* 100 */ 412, 331, 35, 348, 356, 327, 68, 422, 14, 361, + /* 110 */ 355, 363, 424, 56, 20, 345, 116, 50, 61, 364, + /* 120 */ 432, 95, 437, 438, 354, 68, 0, 442, 443, 94, + /* 130 */ 130, 131, 384, 361, 356, 4, 388, 0, 319, 56, + /* 140 */ 392, 393, 394, 395, 396, 397, 398, 390, 400, 348, + /* 150 */ 329, 94, 20, 130, 131, 407, 94, 356, 21, 411, + /* 160 */ 412, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 170 */ 422, 393, 351, 116, 363, 418, 176, 94, 178, 96, + /* 180 */ 361, 370, 408, 409, 373, 437, 438, 130, 131, 163, + /* 190 */ 442, 443, 414, 415, 416, 417, 395, 419, 161, 324, + /* 200 */ 200, 201, 327, 203, 204, 205, 206, 207, 208, 209, /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 220 */ 382, 352, 343, 60, 386, 387, 388, 389, 390, 391, - /* 230 */ 392, 393, 175, 395, 177, 356, 398, 237, 400, 401, - /* 240 */ 402, 198, 8, 9, 406, 407, 12, 13, 14, 15, - /* 250 */ 16, 237, 20, 237, 22, 198, 199, 388, 201, 202, + /* 220 */ 220, 221, 222, 20, 33, 94, 94, 329, 158, 318, + /* 230 */ 327, 320, 106, 176, 20, 178, 94, 175, 47, 177, + /* 240 */ 240, 343, 200, 52, 53, 54, 55, 56, 78, 351, + /* 250 */ 14, 125, 126, 127, 128, 129, 20, 200, 201, 356, /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - /* 270 */ 213, 214, 215, 216, 217, 218, 219, 12, 13, 410, - /* 280 */ 411, 412, 50, 414, 221, 20, 20, 22, 20, 246, - /* 290 */ 247, 248, 249, 250, 321, 316, 237, 324, 33, 237, - /* 300 */ 35, 93, 106, 107, 108, 109, 110, 111, 112, 113, - /* 310 */ 114, 115, 116, 324, 118, 119, 120, 121, 122, 123, - /* 320 */ 78, 56, 221, 344, 223, 56, 61, 0, 94, 124, - /* 330 */ 125, 352, 324, 68, 12, 13, 357, 104, 359, 160, - /* 340 */ 344, 352, 20, 335, 22, 8, 9, 351, 316, 12, - /* 350 */ 13, 14, 15, 16, 20, 33, 360, 35, 93, 93, - /* 360 */ 352, 382, 93, 35, 95, 386, 387, 388, 389, 390, - /* 370 */ 391, 392, 393, 170, 395, 133, 134, 388, 56, 400, - /* 380 */ 115, 402, 174, 61, 176, 406, 407, 60, 183, 357, - /* 390 */ 68, 186, 189, 190, 129, 130, 68, 129, 130, 410, - /* 400 */ 411, 412, 0, 414, 8, 9, 417, 324, 12, 13, - /* 410 */ 14, 15, 16, 321, 354, 93, 324, 357, 335, 430, - /* 420 */ 431, 242, 243, 21, 435, 436, 24, 25, 26, 27, - /* 430 */ 28, 29, 30, 31, 32, 352, 359, 115, 0, 43, - /* 440 */ 175, 14, 177, 366, 326, 237, 369, 20, 316, 68, - /* 450 */ 21, 129, 130, 24, 25, 26, 27, 28, 29, 30, - /* 460 */ 31, 32, 20, 198, 199, 347, 201, 202, 203, 204, - /* 470 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - /* 480 */ 215, 216, 217, 218, 219, 0, 221, 8, 9, 357, - /* 490 */ 324, 12, 13, 14, 15, 16, 162, 175, 60, 177, - /* 500 */ 3, 335, 398, 237, 167, 401, 237, 37, 68, 24, - /* 510 */ 25, 26, 27, 28, 29, 30, 31, 32, 352, 384, - /* 520 */ 198, 199, 20, 201, 202, 203, 204, 205, 206, 207, - /* 530 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - /* 540 */ 218, 219, 12, 13, 344, 124, 22, 336, 413, 345, - /* 550 */ 20, 351, 22, 330, 331, 344, 43, 328, 328, 35, - /* 560 */ 360, 324, 33, 33, 353, 35, 96, 324, 98, 99, - /* 570 */ 341, 101, 20, 94, 22, 105, 47, 316, 335, 350, - /* 580 */ 350, 52, 53, 54, 55, 56, 56, 35, 388, 352, - /* 590 */ 326, 316, 68, 105, 20, 352, 259, 127, 68, 12, - /* 600 */ 13, 14, 50, 339, 384, 184, 185, 20, 345, 22, - /* 610 */ 324, 347, 124, 125, 126, 127, 128, 417, 357, 344, - /* 620 */ 33, 92, 35, 93, 95, 388, 324, 352, 345, 202, - /* 630 */ 430, 431, 357, 413, 359, 435, 436, 335, 352, 115, - /* 640 */ 56, 324, 316, 56, 14, 115, 409, 410, 411, 412, - /* 650 */ 20, 414, 335, 345, 352, 68, 344, 382, 21, 129, - /* 660 */ 130, 386, 387, 388, 389, 390, 391, 392, 393, 352, - /* 670 */ 395, 34, 360, 36, 388, 400, 92, 402, 324, 95, - /* 680 */ 93, 406, 407, 357, 316, 64, 65, 158, 159, 335, - /* 690 */ 161, 416, 71, 399, 165, 401, 410, 411, 412, 175, - /* 700 */ 414, 177, 115, 82, 83, 175, 352, 177, 352, 88, - /* 710 */ 181, 316, 344, 14, 15, 16, 129, 130, 0, 363, - /* 720 */ 352, 344, 198, 199, 316, 357, 376, 359, 198, 199, - /* 730 */ 353, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 740 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 750 */ 382, 254, 357, 384, 386, 387, 388, 389, 390, 391, - /* 760 */ 392, 393, 175, 395, 177, 357, 2, 237, 400, 316, - /* 770 */ 402, 258, 8, 9, 406, 407, 12, 13, 14, 15, - /* 780 */ 16, 316, 413, 316, 316, 198, 199, 39, 201, 202, - /* 790 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - /* 800 */ 213, 214, 215, 216, 217, 218, 219, 12, 13, 316, - /* 810 */ 357, 344, 336, 330, 331, 20, 349, 22, 354, 352, - /* 820 */ 344, 357, 357, 105, 357, 357, 359, 2, 33, 353, - /* 830 */ 35, 372, 202, 8, 9, 44, 45, 12, 13, 14, - /* 840 */ 15, 16, 124, 125, 126, 127, 128, 388, 20, 382, - /* 850 */ 357, 56, 316, 386, 387, 388, 389, 390, 391, 392, - /* 860 */ 393, 56, 395, 68, 12, 13, 352, 345, 368, 359, - /* 870 */ 370, 324, 20, 368, 22, 370, 417, 363, 19, 369, - /* 880 */ 316, 332, 335, 334, 317, 33, 157, 35, 93, 430, - /* 890 */ 431, 439, 33, 357, 435, 436, 333, 8, 9, 352, - /* 900 */ 95, 12, 13, 14, 15, 16, 47, 324, 56, 105, - /* 910 */ 115, 52, 53, 54, 55, 56, 372, 316, 335, 35, - /* 920 */ 68, 357, 8, 9, 129, 130, 12, 13, 14, 15, - /* 930 */ 16, 127, 388, 8, 9, 352, 93, 12, 13, 14, - /* 940 */ 15, 16, 1, 2, 337, 93, 103, 340, 324, 324, - /* 950 */ 61, 92, 68, 224, 95, 324, 35, 324, 357, 335, - /* 960 */ 335, 417, 324, 234, 42, 43, 335, 115, 335, 4, - /* 970 */ 175, 43, 177, 335, 430, 431, 352, 352, 316, 435, - /* 980 */ 436, 129, 130, 352, 236, 352, 428, 128, 235, 236, - /* 990 */ 352, 102, 316, 198, 199, 0, 201, 202, 203, 204, - /* 1000 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - /* 1010 */ 215, 216, 217, 218, 219, 324, 18, 22, 20, 357, - /* 1020 */ 161, 22, 94, 162, 163, 27, 335, 175, 30, 177, - /* 1030 */ 202, 316, 0, 357, 35, 94, 372, 316, 179, 316, - /* 1040 */ 181, 97, 316, 352, 100, 47, 157, 49, 344, 51, - /* 1050 */ 198, 199, 388, 201, 202, 203, 204, 205, 206, 207, - /* 1060 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - /* 1070 */ 218, 219, 357, 324, 97, 0, 162, 100, 357, 47, - /* 1080 */ 357, 417, 324, 357, 335, 97, 18, 43, 100, 0, - /* 1090 */ 92, 23, 0, 335, 430, 431, 61, 22, 177, 435, - /* 1100 */ 436, 352, 104, 0, 97, 37, 38, 100, 43, 41, - /* 1110 */ 352, 22, 43, 224, 225, 226, 227, 228, 229, 230, - /* 1120 */ 231, 232, 233, 234, 325, 57, 58, 59, 1, 2, - /* 1130 */ 132, 129, 130, 135, 136, 137, 138, 139, 140, 141, - /* 1140 */ 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - /* 1150 */ 152, 424, 154, 155, 156, 43, 3, 325, 43, 94, - /* 1160 */ 43, 93, 323, 94, 43, 388, 63, 64, 65, 66, - /* 1170 */ 67, 43, 69, 70, 71, 72, 73, 74, 75, 76, - /* 1180 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - /* 1190 */ 87, 88, 89, 90, 417, 35, 324, 105, 43, 131, - /* 1200 */ 356, 385, 316, 238, 43, 46, 94, 335, 431, 94, - /* 1210 */ 13, 94, 435, 436, 432, 94, 124, 125, 126, 127, - /* 1220 */ 128, 0, 94, 415, 352, 408, 13, 418, 239, 43, - /* 1230 */ 344, 43, 35, 198, 380, 167, 168, 169, 352, 43, - /* 1240 */ 172, 47, 4, 357, 379, 359, 43, 94, 35, 94, - /* 1250 */ 43, 372, 93, 43, 173, 94, 188, 19, 42, 191, - /* 1260 */ 364, 193, 194, 195, 196, 197, 374, 388, 382, 48, - /* 1270 */ 20, 33, 386, 387, 388, 389, 390, 391, 392, 393, - /* 1280 */ 94, 395, 94, 372, 316, 47, 324, 324, 402, 51, - /* 1290 */ 94, 364, 406, 407, 56, 157, 417, 94, 362, 388, - /* 1300 */ 256, 94, 362, 417, 94, 237, 324, 324, 324, 430, - /* 1310 */ 431, 20, 344, 20, 435, 436, 430, 431, 318, 318, - /* 1320 */ 352, 435, 436, 378, 328, 357, 359, 359, 417, 20, - /* 1330 */ 92, 328, 371, 95, 20, 371, 328, 177, 328, 373, - /* 1340 */ 328, 430, 431, 328, 316, 324, 435, 436, 328, 318, - /* 1350 */ 382, 357, 378, 344, 386, 387, 388, 389, 390, 391, - /* 1360 */ 392, 393, 344, 395, 324, 318, 316, 344, 400, 344, - /* 1370 */ 402, 344, 344, 344, 406, 407, 359, 344, 344, 326, - /* 1380 */ 352, 344, 344, 344, 416, 357, 180, 359, 377, 326, - /* 1390 */ 324, 324, 244, 371, 344, 159, 326, 367, 357, 357, - /* 1400 */ 357, 365, 352, 357, 326, 357, 326, 357, 352, 359, - /* 1410 */ 382, 340, 367, 20, 386, 387, 388, 389, 390, 391, - /* 1420 */ 392, 393, 316, 395, 245, 367, 367, 423, 400, 357, - /* 1430 */ 402, 357, 382, 357, 406, 407, 386, 387, 388, 389, - /* 1440 */ 390, 391, 392, 393, 416, 395, 385, 12, 13, 423, - /* 1450 */ 344, 357, 357, 251, 166, 240, 252, 22, 352, 380, - /* 1460 */ 260, 253, 257, 357, 440, 359, 255, 417, 33, 236, - /* 1470 */ 35, 352, 20, 93, 422, 426, 425, 423, 421, 93, - /* 1480 */ 430, 431, 420, 316, 384, 435, 436, 405, 382, 434, - /* 1490 */ 348, 56, 386, 387, 388, 389, 390, 391, 392, 393, - /* 1500 */ 357, 395, 334, 68, 324, 316, 400, 326, 402, 36, - /* 1510 */ 433, 344, 406, 407, 319, 375, 318, 370, 327, 352, - /* 1520 */ 338, 338, 338, 314, 357, 0, 359, 182, 0, 0, - /* 1530 */ 42, 0, 35, 344, 0, 192, 35, 35, 35, 192, - /* 1540 */ 0, 352, 35, 35, 192, 0, 357, 192, 359, 382, - /* 1550 */ 115, 0, 35, 386, 387, 388, 389, 390, 391, 392, - /* 1560 */ 393, 0, 395, 22, 0, 35, 177, 175, 0, 402, - /* 1570 */ 0, 382, 171, 406, 407, 386, 387, 388, 389, 390, - /* 1580 */ 391, 392, 393, 170, 395, 0, 0, 0, 46, 316, - /* 1590 */ 0, 402, 0, 0, 42, 406, 407, 0, 0, 153, - /* 1600 */ 0, 0, 0, 0, 0, 148, 35, 0, 148, 0, - /* 1610 */ 175, 0, 177, 0, 0, 0, 0, 344, 0, 0, - /* 1620 */ 0, 0, 0, 0, 0, 352, 0, 0, 0, 0, - /* 1630 */ 357, 42, 359, 198, 199, 0, 0, 0, 0, 22, - /* 1640 */ 0, 0, 0, 0, 316, 210, 211, 212, 213, 214, - /* 1650 */ 215, 216, 0, 0, 0, 382, 46, 0, 14, 386, - /* 1660 */ 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - /* 1670 */ 397, 39, 344, 42, 40, 14, 43, 0, 39, 0, - /* 1680 */ 352, 56, 0, 0, 166, 357, 56, 359, 39, 0, - /* 1690 */ 0, 46, 0, 0, 35, 47, 0, 316, 35, 0, - /* 1700 */ 35, 39, 47, 39, 0, 47, 39, 35, 39, 62, - /* 1710 */ 382, 0, 0, 47, 386, 387, 388, 389, 390, 391, - /* 1720 */ 392, 393, 0, 395, 0, 344, 35, 22, 0, 35, - /* 1730 */ 35, 43, 35, 352, 0, 35, 22, 0, 357, 22, - /* 1740 */ 359, 43, 22, 0, 35, 22, 0, 0, 35, 316, - /* 1750 */ 49, 100, 102, 35, 0, 22, 20, 0, 0, 178, - /* 1760 */ 35, 316, 22, 382, 159, 437, 438, 386, 387, 388, - /* 1770 */ 389, 390, 391, 392, 393, 316, 395, 344, 0, 0, - /* 1780 */ 3, 0, 0, 402, 0, 352, 35, 0, 407, 344, - /* 1790 */ 357, 0, 359, 187, 349, 39, 93, 352, 46, 220, - /* 1800 */ 222, 94, 357, 344, 359, 43, 43, 241, 220, 93, - /* 1810 */ 46, 352, 93, 103, 158, 382, 357, 43, 359, 386, - /* 1820 */ 387, 388, 389, 390, 391, 392, 393, 382, 395, 316, - /* 1830 */ 397, 386, 387, 388, 389, 390, 391, 392, 393, 164, - /* 1840 */ 395, 382, 162, 316, 160, 386, 387, 388, 389, 390, - /* 1850 */ 391, 392, 393, 93, 395, 94, 43, 344, 93, 93, - /* 1860 */ 46, 43, 94, 94, 162, 352, 93, 3, 162, 94, - /* 1870 */ 357, 344, 359, 93, 43, 35, 349, 94, 93, 352, - /* 1880 */ 94, 93, 93, 35, 357, 35, 359, 35, 429, 94, - /* 1890 */ 35, 35, 94, 316, 94, 382, 43, 46, 2, 386, - /* 1900 */ 387, 388, 389, 390, 391, 392, 393, 46, 395, 382, - /* 1910 */ 22, 241, 316, 386, 387, 388, 389, 390, 391, 392, - /* 1920 */ 393, 344, 395, 46, 198, 93, 349, 241, 94, 352, - /* 1930 */ 93, 46, 94, 94, 357, 93, 359, 93, 93, 46, - /* 1940 */ 344, 94, 22, 235, 200, 104, 35, 93, 352, 35, - /* 1950 */ 93, 438, 94, 357, 94, 359, 35, 94, 93, 382, - /* 1960 */ 35, 93, 316, 386, 387, 388, 389, 390, 391, 392, - /* 1970 */ 393, 35, 395, 94, 93, 35, 316, 94, 382, 93, - /* 1980 */ 22, 35, 386, 387, 388, 389, 390, 391, 392, 393, - /* 1990 */ 344, 395, 117, 117, 105, 117, 93, 117, 352, 93, - /* 2000 */ 93, 22, 43, 357, 344, 359, 62, 35, 61, 35, - /* 2010 */ 35, 35, 352, 35, 91, 35, 35, 357, 35, 359, - /* 2020 */ 35, 35, 68, 35, 35, 43, 22, 35, 382, 22, - /* 2030 */ 35, 316, 386, 387, 388, 389, 390, 391, 392, 393, - /* 2040 */ 35, 395, 382, 35, 35, 68, 386, 387, 388, 389, - /* 2050 */ 390, 391, 392, 393, 35, 395, 35, 316, 35, 344, - /* 2060 */ 35, 22, 35, 0, 35, 39, 0, 352, 35, 47, - /* 2070 */ 39, 47, 357, 0, 359, 35, 39, 47, 0, 35, - /* 2080 */ 39, 47, 0, 316, 35, 344, 35, 0, 20, 22, - /* 2090 */ 21, 441, 22, 352, 22, 21, 441, 382, 357, 441, - /* 2100 */ 359, 386, 387, 388, 389, 390, 391, 392, 393, 316, - /* 2110 */ 395, 344, 441, 441, 441, 441, 441, 441, 441, 352, - /* 2120 */ 441, 441, 441, 382, 357, 441, 359, 386, 387, 388, - /* 2130 */ 389, 390, 391, 392, 393, 316, 395, 344, 441, 441, - /* 2140 */ 441, 441, 441, 441, 441, 352, 441, 441, 441, 382, - /* 2150 */ 357, 441, 359, 386, 387, 388, 389, 390, 391, 392, - /* 2160 */ 393, 441, 395, 344, 441, 441, 441, 441, 441, 441, - /* 2170 */ 441, 352, 441, 441, 441, 382, 357, 441, 359, 386, - /* 2180 */ 387, 388, 389, 390, 391, 392, 393, 316, 395, 441, - /* 2190 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, - /* 2200 */ 441, 382, 441, 316, 441, 386, 387, 388, 389, 390, - /* 2210 */ 391, 392, 393, 441, 395, 344, 441, 441, 441, 441, - /* 2220 */ 441, 441, 441, 352, 441, 441, 441, 441, 357, 441, - /* 2230 */ 359, 344, 441, 441, 441, 441, 441, 441, 441, 352, - /* 2240 */ 441, 441, 441, 441, 357, 441, 359, 441, 441, 441, - /* 2250 */ 441, 441, 441, 382, 441, 441, 441, 386, 387, 388, - /* 2260 */ 389, 390, 391, 392, 393, 316, 395, 441, 441, 382, - /* 2270 */ 441, 441, 441, 386, 387, 388, 389, 390, 391, 392, - /* 2280 */ 393, 316, 395, 441, 441, 441, 441, 441, 441, 441, - /* 2290 */ 441, 441, 441, 344, 441, 441, 441, 441, 441, 441, - /* 2300 */ 441, 352, 441, 441, 441, 441, 357, 441, 359, 344, - /* 2310 */ 441, 441, 441, 441, 441, 441, 441, 352, 441, 441, - /* 2320 */ 441, 441, 357, 441, 359, 441, 441, 441, 441, 441, - /* 2330 */ 441, 382, 441, 441, 316, 386, 387, 388, 389, 390, - /* 2340 */ 391, 392, 393, 441, 395, 441, 441, 382, 316, 441, - /* 2350 */ 441, 386, 387, 388, 389, 390, 391, 392, 393, 441, - /* 2360 */ 395, 441, 344, 441, 441, 441, 441, 441, 441, 441, - /* 2370 */ 352, 441, 441, 441, 441, 357, 344, 359, 441, 441, - /* 2380 */ 441, 441, 441, 441, 352, 441, 441, 441, 441, 357, - /* 2390 */ 441, 359, 441, 441, 441, 441, 441, 441, 441, 441, - /* 2400 */ 382, 441, 316, 441, 386, 387, 388, 389, 390, 391, - /* 2410 */ 392, 393, 441, 395, 382, 441, 441, 441, 386, 387, - /* 2420 */ 388, 389, 390, 391, 392, 393, 316, 395, 441, 441, - /* 2430 */ 344, 441, 441, 441, 441, 441, 441, 441, 352, 441, - /* 2440 */ 441, 441, 441, 357, 441, 359, 441, 441, 441, 441, - /* 2450 */ 441, 441, 316, 441, 344, 441, 441, 441, 441, 441, - /* 2460 */ 441, 441, 352, 441, 441, 441, 441, 357, 382, 359, - /* 2470 */ 441, 441, 386, 387, 388, 389, 390, 391, 392, 393, - /* 2480 */ 344, 395, 441, 441, 441, 441, 441, 441, 352, 441, - /* 2490 */ 441, 441, 382, 357, 441, 359, 386, 387, 388, 389, - /* 2500 */ 390, 391, 392, 393, 316, 395, 441, 441, 441, 441, - /* 2510 */ 441, 441, 441, 441, 441, 441, 441, 441, 382, 441, - /* 2520 */ 316, 441, 386, 387, 388, 389, 390, 391, 392, 393, - /* 2530 */ 441, 395, 344, 441, 441, 441, 441, 441, 441, 441, - /* 2540 */ 352, 441, 441, 441, 441, 357, 441, 359, 344, 441, - /* 2550 */ 441, 441, 441, 441, 441, 441, 352, 441, 441, 441, - /* 2560 */ 441, 357, 441, 359, 441, 441, 441, 441, 441, 441, - /* 2570 */ 382, 441, 441, 441, 386, 387, 388, 389, 390, 391, - /* 2580 */ 392, 393, 316, 395, 441, 441, 382, 441, 441, 441, - /* 2590 */ 386, 387, 388, 389, 390, 391, 392, 393, 441, 395, - /* 2600 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, - /* 2610 */ 344, 441, 441, 441, 441, 441, 441, 441, 352, 441, - /* 2620 */ 441, 441, 441, 357, 441, 359, 441, 441, 441, 441, - /* 2630 */ 441, 441, 441, 441, 441, 441, 441, 441, 441, 441, - /* 2640 */ 441, 441, 441, 441, 441, 441, 441, 441, 382, 441, - /* 2650 */ 441, 441, 386, 387, 388, 389, 390, 391, 392, 393, - /* 2660 */ 441, 395, + /* 270 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + /* 280 */ 12, 13, 245, 246, 93, 334, 335, 96, 20, 350, + /* 290 */ 22, 249, 250, 251, 252, 253, 393, 227, 204, 327, + /* 300 */ 361, 33, 240, 35, 134, 135, 21, 237, 94, 24, + /* 310 */ 25, 26, 27, 28, 29, 30, 31, 32, 415, 416, + /* 320 */ 417, 106, 419, 240, 56, 60, 387, 388, 356, 61, + /* 330 */ 393, 224, 319, 226, 327, 171, 68, 12, 13, 400, + /* 340 */ 125, 126, 127, 128, 129, 20, 339, 22, 327, 332, + /* 350 */ 159, 160, 94, 162, 337, 191, 192, 166, 33, 422, + /* 360 */ 35, 348, 94, 356, 20, 393, 327, 393, 404, 356, + /* 370 */ 406, 240, 240, 182, 361, 438, 363, 356, 339, 442, + /* 380 */ 443, 56, 240, 327, 116, 346, 61, 415, 416, 417, + /* 390 */ 126, 419, 20, 68, 22, 356, 422, 384, 130, 131, + /* 400 */ 20, 388, 0, 125, 126, 392, 393, 394, 395, 396, + /* 410 */ 397, 398, 438, 400, 393, 20, 442, 443, 405, 94, + /* 420 */ 407, 365, 50, 327, 411, 412, 24, 25, 26, 27, + /* 430 */ 28, 29, 30, 31, 32, 339, 415, 416, 417, 390, + /* 440 */ 419, 116, 346, 422, 176, 432, 178, 183, 184, 60, + /* 450 */ 348, 187, 356, 20, 240, 130, 131, 355, 437, 438, + /* 460 */ 1, 2, 184, 442, 443, 187, 364, 418, 200, 201, + /* 470 */ 0, 203, 204, 205, 206, 207, 208, 209, 210, 211, + /* 480 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + /* 490 */ 222, 125, 224, 14, 404, 316, 406, 37, 240, 20, + /* 500 */ 331, 176, 372, 178, 374, 107, 108, 109, 110, 111, + /* 510 */ 112, 113, 114, 115, 116, 117, 43, 119, 120, 121, + /* 520 */ 122, 123, 124, 354, 105, 200, 201, 56, 203, 204, + /* 530 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + /* 540 */ 215, 216, 217, 218, 219, 220, 221, 222, 12, 13, + /* 550 */ 22, 185, 186, 340, 95, 376, 20, 97, 22, 99, + /* 560 */ 100, 348, 102, 35, 93, 327, 106, 96, 95, 33, + /* 570 */ 357, 35, 393, 0, 376, 390, 106, 339, 8, 9, + /* 580 */ 347, 319, 12, 13, 14, 15, 16, 20, 128, 224, + /* 590 */ 20, 393, 56, 360, 356, 125, 126, 127, 128, 129, + /* 600 */ 319, 422, 327, 418, 68, 12, 13, 14, 334, 335, + /* 610 */ 348, 319, 68, 20, 339, 22, 437, 438, 356, 68, + /* 620 */ 422, 442, 443, 361, 56, 363, 33, 348, 35, 348, + /* 630 */ 94, 356, 21, 60, 355, 437, 438, 356, 3, 327, + /* 640 */ 442, 443, 361, 364, 363, 34, 384, 36, 0, 56, + /* 650 */ 388, 339, 116, 361, 392, 393, 394, 395, 396, 397, + /* 660 */ 398, 68, 400, 340, 96, 384, 130, 131, 356, 388, + /* 670 */ 349, 348, 393, 392, 393, 394, 395, 396, 397, 398, + /* 680 */ 357, 400, 341, 204, 422, 344, 405, 94, 407, 319, + /* 690 */ 8, 9, 411, 412, 12, 13, 14, 15, 16, 437, + /* 700 */ 438, 422, 421, 327, 442, 443, 327, 43, 60, 116, + /* 710 */ 363, 372, 176, 374, 178, 339, 437, 438, 339, 320, + /* 720 */ 373, 442, 443, 130, 131, 348, 358, 356, 319, 361, + /* 730 */ 163, 361, 356, 163, 357, 356, 200, 201, 367, 203, + /* 740 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + /* 750 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 95, + /* 760 */ 8, 9, 327, 327, 12, 13, 14, 15, 16, 176, + /* 770 */ 361, 178, 340, 349, 339, 339, 240, 95, 8, 9, + /* 780 */ 348, 319, 12, 13, 14, 15, 16, 403, 319, 357, + /* 790 */ 406, 356, 356, 200, 201, 43, 203, 204, 205, 206, + /* 800 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + /* 810 */ 217, 218, 219, 220, 221, 222, 12, 13, 376, 22, + /* 820 */ 356, 319, 348, 361, 20, 358, 22, 319, 361, 3, + /* 830 */ 361, 367, 35, 327, 319, 393, 349, 33, 364, 35, + /* 840 */ 2, 376, 44, 45, 106, 339, 8, 9, 319, 319, + /* 850 */ 12, 13, 14, 15, 16, 336, 39, 338, 393, 327, + /* 860 */ 56, 4, 356, 361, 422, 68, 128, 319, 319, 361, + /* 870 */ 327, 339, 68, 12, 13, 43, 361, 327, 348, 437, + /* 880 */ 438, 20, 339, 22, 442, 443, 356, 422, 356, 339, + /* 890 */ 361, 361, 257, 363, 33, 20, 35, 348, 94, 356, + /* 900 */ 380, 341, 437, 438, 344, 356, 356, 442, 443, 361, + /* 910 */ 361, 20, 363, 116, 384, 0, 319, 56, 388, 327, + /* 920 */ 116, 95, 392, 393, 394, 395, 396, 397, 398, 68, + /* 930 */ 400, 339, 349, 384, 130, 131, 319, 388, 168, 42, + /* 940 */ 43, 392, 393, 394, 395, 396, 397, 398, 356, 400, + /* 950 */ 64, 65, 319, 61, 405, 94, 407, 71, 361, 0, + /* 960 */ 411, 412, 47, 433, 434, 238, 239, 327, 82, 83, + /* 970 */ 421, 0, 327, 176, 88, 178, 35, 116, 361, 339, + /* 980 */ 176, 22, 178, 376, 339, 319, 98, 98, 319, 101, + /* 990 */ 101, 130, 131, 349, 361, 43, 356, 200, 201, 319, + /* 1000 */ 393, 356, 163, 164, 200, 201, 319, 203, 204, 205, + /* 1010 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + /* 1020 */ 216, 217, 218, 219, 220, 221, 222, 361, 327, 422, + /* 1030 */ 361, 327, 262, 130, 131, 64, 65, 176, 163, 178, + /* 1040 */ 339, 361, 71, 339, 437, 438, 43, 95, 361, 442, + /* 1050 */ 443, 349, 43, 82, 83, 98, 239, 356, 101, 88, + /* 1060 */ 356, 200, 201, 0, 203, 204, 205, 206, 207, 208, + /* 1070 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + /* 1080 */ 219, 220, 221, 222, 18, 327, 20, 98, 1, 2, + /* 1090 */ 101, 259, 200, 27, 35, 204, 30, 339, 241, 0, + /* 1100 */ 0, 94, 8, 9, 95, 391, 12, 13, 14, 15, + /* 1110 */ 16, 104, 337, 47, 356, 49, 43, 51, 43, 178, + /* 1120 */ 43, 22, 22, 446, 43, 43, 63, 64, 65, 66, + /* 1130 */ 67, 43, 69, 70, 71, 72, 73, 74, 75, 76, + /* 1140 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + /* 1150 */ 87, 88, 89, 90, 435, 18, 328, 8, 9, 93, + /* 1160 */ 23, 12, 13, 14, 15, 16, 429, 35, 95, 13, + /* 1170 */ 95, 105, 95, 43, 37, 38, 95, 95, 41, 46, + /* 1180 */ 8, 9, 348, 95, 12, 13, 14, 15, 16, 95, + /* 1190 */ 43, 35, 328, 326, 57, 58, 59, 43, 391, 133, + /* 1200 */ 68, 319, 136, 137, 138, 139, 140, 141, 142, 143, + /* 1210 */ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + /* 1220 */ 43, 155, 156, 157, 13, 95, 360, 94, 8, 9, + /* 1230 */ 348, 94, 12, 13, 14, 15, 16, 178, 356, 43, + /* 1240 */ 43, 420, 95, 361, 439, 363, 35, 0, 413, 95, + /* 1250 */ 423, 386, 242, 47, 385, 378, 42, 174, 368, 20, + /* 1260 */ 327, 327, 368, 158, 261, 366, 384, 366, 92, 132, + /* 1270 */ 388, 333, 95, 327, 392, 393, 394, 395, 396, 397, + /* 1280 */ 398, 61, 400, 327, 20, 403, 321, 405, 406, 407, + /* 1290 */ 327, 95, 95, 411, 412, 48, 321, 20, 382, 331, + /* 1300 */ 376, 331, 363, 20, 375, 168, 169, 170, 20, 377, + /* 1310 */ 173, 319, 163, 331, 331, 375, 4, 393, 331, 331, + /* 1320 */ 327, 331, 321, 103, 348, 348, 348, 190, 348, 348, + /* 1330 */ 193, 19, 195, 196, 197, 198, 199, 321, 327, 348, + /* 1340 */ 348, 189, 348, 348, 348, 33, 422, 348, 356, 383, + /* 1350 */ 348, 382, 329, 361, 181, 363, 329, 327, 361, 47, + /* 1360 */ 381, 437, 438, 51, 327, 329, 442, 443, 56, 363, + /* 1370 */ 247, 371, 160, 375, 361, 361, 384, 240, 158, 361, + /* 1380 */ 388, 361, 361, 371, 392, 393, 394, 395, 396, 397, + /* 1390 */ 398, 369, 400, 319, 329, 344, 329, 405, 356, 407, + /* 1400 */ 20, 361, 428, 411, 412, 93, 391, 248, 96, 371, + /* 1410 */ 391, 361, 428, 421, 361, 371, 361, 361, 254, 167, + /* 1420 */ 263, 256, 348, 255, 243, 386, 260, 441, 258, 239, + /* 1430 */ 356, 20, 447, 425, 430, 361, 431, 363, 390, 94, + /* 1440 */ 356, 410, 94, 352, 338, 428, 319, 227, 228, 229, + /* 1450 */ 230, 231, 232, 233, 234, 235, 236, 237, 384, 427, + /* 1460 */ 426, 327, 388, 361, 440, 329, 392, 393, 394, 395, + /* 1470 */ 396, 397, 398, 36, 400, 348, 379, 322, 374, 405, + /* 1480 */ 342, 407, 321, 356, 342, 411, 412, 342, 361, 0, + /* 1490 */ 363, 317, 330, 0, 183, 0, 0, 42, 0, 35, + /* 1500 */ 194, 35, 35, 35, 194, 0, 35, 35, 194, 0, + /* 1510 */ 194, 384, 0, 35, 319, 388, 0, 0, 35, 392, + /* 1520 */ 393, 394, 395, 396, 397, 398, 22, 400, 178, 176, + /* 1530 */ 0, 0, 405, 172, 407, 171, 319, 0, 411, 412, + /* 1540 */ 12, 13, 0, 348, 42, 46, 0, 0, 0, 0, + /* 1550 */ 22, 356, 0, 0, 154, 0, 361, 0, 363, 0, + /* 1560 */ 0, 33, 0, 35, 149, 348, 0, 35, 149, 0, + /* 1570 */ 0, 0, 0, 356, 0, 0, 0, 0, 361, 384, + /* 1580 */ 363, 0, 0, 388, 56, 0, 0, 392, 393, 394, + /* 1590 */ 395, 396, 397, 398, 319, 400, 68, 0, 0, 0, + /* 1600 */ 405, 384, 407, 42, 0, 388, 411, 412, 0, 392, + /* 1610 */ 393, 394, 395, 396, 397, 398, 0, 400, 0, 0, + /* 1620 */ 19, 0, 22, 348, 407, 0, 0, 0, 411, 412, + /* 1630 */ 0, 356, 0, 0, 33, 56, 361, 35, 363, 56, + /* 1640 */ 0, 0, 14, 14, 116, 42, 39, 0, 47, 43, + /* 1650 */ 40, 46, 39, 52, 53, 54, 55, 56, 0, 384, + /* 1660 */ 46, 0, 39, 388, 167, 0, 0, 392, 393, 394, + /* 1670 */ 395, 396, 397, 398, 0, 400, 0, 62, 0, 35, + /* 1680 */ 0, 47, 407, 35, 39, 47, 411, 412, 39, 0, + /* 1690 */ 35, 39, 0, 47, 93, 35, 319, 96, 47, 0, + /* 1700 */ 0, 39, 0, 0, 176, 35, 178, 22, 0, 22, + /* 1710 */ 35, 43, 103, 0, 35, 43, 35, 35, 101, 0, + /* 1720 */ 22, 0, 49, 22, 0, 348, 22, 0, 200, 201, + /* 1730 */ 129, 35, 0, 356, 22, 0, 20, 95, 361, 0, + /* 1740 */ 363, 213, 214, 215, 216, 217, 218, 219, 94, 35, + /* 1750 */ 35, 163, 35, 22, 163, 319, 160, 179, 0, 0, + /* 1760 */ 3, 384, 0, 162, 0, 388, 0, 0, 35, 392, + /* 1770 */ 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, + /* 1780 */ 94, 180, 188, 182, 348, 163, 95, 94, 94, 165, + /* 1790 */ 0, 39, 356, 46, 104, 159, 161, 361, 43, 363, + /* 1800 */ 94, 94, 244, 223, 43, 95, 95, 244, 43, 225, + /* 1810 */ 319, 43, 223, 95, 94, 46, 94, 46, 95, 94, + /* 1820 */ 384, 95, 94, 94, 388, 43, 3, 43, 392, 393, + /* 1830 */ 394, 395, 396, 397, 398, 94, 400, 95, 95, 348, + /* 1840 */ 35, 35, 35, 35, 35, 35, 95, 356, 95, 46, + /* 1850 */ 46, 2, 361, 200, 363, 244, 43, 22, 238, 22, + /* 1860 */ 46, 46, 46, 319, 94, 202, 22, 95, 94, 35, + /* 1870 */ 95, 94, 118, 95, 94, 384, 95, 94, 105, 388, + /* 1880 */ 444, 445, 94, 392, 393, 394, 395, 396, 397, 398, + /* 1890 */ 95, 400, 348, 35, 94, 35, 95, 353, 407, 35, + /* 1900 */ 356, 35, 106, 412, 35, 361, 94, 363, 35, 118, + /* 1910 */ 118, 118, 95, 94, 319, 95, 94, 43, 22, 95, + /* 1920 */ 94, 94, 94, 94, 62, 35, 61, 35, 384, 35, + /* 1930 */ 35, 319, 388, 35, 91, 35, 392, 393, 394, 395, + /* 1940 */ 396, 397, 398, 348, 400, 35, 35, 35, 35, 68, + /* 1950 */ 43, 356, 35, 35, 22, 35, 361, 22, 363, 35, + /* 1960 */ 348, 35, 35, 35, 35, 68, 35, 22, 356, 35, + /* 1970 */ 0, 35, 35, 361, 35, 363, 0, 47, 35, 384, + /* 1980 */ 39, 0, 0, 388, 35, 47, 39, 392, 393, 394, + /* 1990 */ 395, 396, 397, 398, 39, 400, 384, 402, 47, 35, + /* 2000 */ 388, 47, 39, 0, 392, 393, 394, 395, 396, 397, + /* 2010 */ 398, 0, 400, 35, 35, 21, 319, 22, 22, 22, + /* 2020 */ 21, 20, 448, 448, 448, 448, 448, 448, 448, 448, + /* 2030 */ 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + /* 2040 */ 448, 448, 448, 448, 448, 348, 434, 448, 448, 448, + /* 2050 */ 448, 448, 448, 356, 448, 448, 448, 448, 361, 448, + /* 2060 */ 363, 448, 448, 448, 448, 448, 448, 319, 448, 448, + /* 2070 */ 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + /* 2080 */ 448, 384, 448, 448, 448, 388, 448, 448, 448, 392, + /* 2090 */ 393, 394, 395, 396, 397, 398, 348, 400, 448, 448, + /* 2100 */ 448, 448, 448, 448, 356, 448, 448, 448, 448, 361, + /* 2110 */ 448, 363, 448, 448, 448, 448, 448, 448, 448, 448, + /* 2120 */ 448, 448, 448, 448, 448, 448, 448, 448, 448, 448, + /* 2130 */ 319, 448, 384, 436, 448, 448, 388, 448, 448, 448, + /* 2140 */ 392, 393, 394, 395, 396, 397, 398, 448, 400, 448, + /* 2150 */ 319, 448, 448, 448, 448, 448, 448, 448, 448, 348, + /* 2160 */ 448, 448, 448, 448, 353, 448, 448, 356, 448, 448, + /* 2170 */ 448, 448, 361, 448, 363, 448, 448, 448, 448, 348, + /* 2180 */ 448, 448, 448, 448, 353, 448, 448, 356, 448, 448, + /* 2190 */ 448, 448, 361, 445, 363, 384, 448, 448, 448, 388, + /* 2200 */ 448, 319, 448, 392, 393, 394, 395, 396, 397, 398, + /* 2210 */ 448, 400, 448, 448, 448, 384, 448, 448, 319, 388, + /* 2220 */ 448, 448, 448, 392, 393, 394, 395, 396, 397, 398, + /* 2230 */ 348, 400, 448, 448, 448, 448, 448, 448, 356, 448, + /* 2240 */ 448, 448, 448, 361, 448, 363, 448, 348, 448, 448, + /* 2250 */ 448, 448, 448, 448, 448, 356, 448, 448, 448, 448, + /* 2260 */ 361, 319, 363, 448, 448, 448, 384, 448, 448, 448, + /* 2270 */ 388, 448, 448, 448, 392, 393, 394, 395, 396, 397, + /* 2280 */ 398, 448, 400, 384, 448, 448, 448, 388, 448, 448, + /* 2290 */ 348, 392, 393, 394, 395, 396, 397, 398, 356, 400, + /* 2300 */ 448, 448, 448, 361, 448, 363, 448, 448, 448, 448, + /* 2310 */ 448, 448, 319, 448, 448, 448, 448, 448, 448, 448, + /* 2320 */ 448, 448, 448, 448, 448, 448, 384, 448, 448, 319, + /* 2330 */ 388, 448, 448, 448, 392, 393, 394, 395, 396, 397, + /* 2340 */ 398, 348, 400, 448, 448, 448, 448, 448, 448, 356, + /* 2350 */ 448, 448, 448, 448, 361, 448, 363, 448, 348, 448, + /* 2360 */ 448, 448, 448, 448, 448, 448, 356, 448, 448, 448, + /* 2370 */ 448, 361, 448, 363, 448, 448, 448, 384, 448, 448, + /* 2380 */ 319, 388, 448, 448, 448, 392, 393, 394, 395, 396, + /* 2390 */ 397, 398, 448, 400, 384, 448, 448, 448, 388, 448, + /* 2400 */ 448, 448, 392, 393, 394, 395, 396, 397, 398, 348, + /* 2410 */ 400, 448, 448, 448, 448, 448, 448, 356, 448, 448, + /* 2420 */ 448, 448, 361, 448, 363, 448, 448, 448, 448, 448, + /* 2430 */ 448, 319, 448, 448, 448, 448, 448, 448, 448, 448, + /* 2440 */ 448, 448, 448, 448, 448, 384, 448, 448, 448, 388, + /* 2450 */ 319, 448, 448, 392, 393, 394, 395, 396, 397, 398, + /* 2460 */ 348, 400, 448, 448, 448, 448, 448, 448, 356, 448, + /* 2470 */ 448, 448, 448, 361, 448, 363, 448, 448, 448, 348, + /* 2480 */ 448, 448, 448, 448, 448, 448, 448, 356, 448, 448, + /* 2490 */ 448, 448, 361, 448, 363, 448, 384, 448, 448, 448, + /* 2500 */ 388, 448, 448, 448, 392, 393, 394, 395, 396, 397, + /* 2510 */ 398, 448, 400, 319, 448, 384, 448, 448, 448, 388, + /* 2520 */ 448, 448, 448, 392, 393, 394, 395, 396, 397, 398, + /* 2530 */ 448, 400, 448, 448, 448, 319, 448, 448, 448, 448, + /* 2540 */ 448, 448, 348, 448, 448, 448, 448, 448, 448, 448, + /* 2550 */ 356, 448, 448, 448, 448, 361, 448, 363, 448, 448, + /* 2560 */ 448, 448, 448, 448, 348, 448, 448, 448, 448, 448, + /* 2570 */ 448, 448, 356, 448, 448, 448, 448, 361, 384, 363, + /* 2580 */ 448, 448, 388, 448, 448, 448, 392, 393, 394, 395, + /* 2590 */ 396, 397, 398, 448, 400, 319, 448, 448, 448, 448, + /* 2600 */ 384, 448, 448, 448, 388, 448, 448, 448, 392, 393, + /* 2610 */ 394, 395, 396, 397, 398, 319, 400, 448, 448, 448, + /* 2620 */ 448, 448, 448, 448, 348, 448, 448, 448, 448, 448, + /* 2630 */ 448, 448, 356, 448, 448, 448, 448, 361, 448, 363, + /* 2640 */ 448, 448, 448, 448, 348, 448, 448, 448, 448, 448, + /* 2650 */ 448, 448, 356, 448, 448, 448, 448, 361, 319, 363, + /* 2660 */ 384, 448, 448, 448, 388, 448, 448, 448, 392, 393, + /* 2670 */ 394, 395, 396, 397, 398, 448, 400, 448, 319, 448, + /* 2680 */ 384, 448, 448, 448, 388, 448, 448, 348, 392, 393, + /* 2690 */ 394, 395, 396, 397, 398, 356, 400, 448, 448, 448, + /* 2700 */ 361, 448, 363, 448, 448, 448, 448, 348, 448, 448, + /* 2710 */ 448, 448, 448, 448, 448, 356, 448, 448, 448, 448, + /* 2720 */ 361, 448, 363, 384, 448, 448, 448, 388, 448, 319, + /* 2730 */ 448, 392, 393, 394, 395, 396, 397, 398, 448, 400, + /* 2740 */ 448, 448, 448, 384, 448, 448, 448, 388, 448, 448, + /* 2750 */ 448, 392, 393, 394, 395, 396, 397, 398, 348, 400, + /* 2760 */ 448, 448, 448, 448, 448, 448, 356, 448, 448, 448, + /* 2770 */ 448, 361, 448, 363, 448, 448, 448, 448, 448, 448, + /* 2780 */ 319, 448, 448, 448, 448, 448, 448, 448, 448, 448, + /* 2790 */ 448, 448, 448, 448, 384, 448, 448, 448, 388, 319, + /* 2800 */ 448, 448, 392, 393, 394, 395, 396, 397, 398, 348, + /* 2810 */ 400, 448, 448, 448, 448, 448, 448, 356, 448, 448, + /* 2820 */ 448, 448, 361, 448, 363, 448, 448, 448, 348, 448, + /* 2830 */ 448, 448, 448, 448, 448, 448, 356, 448, 448, 448, + /* 2840 */ 448, 361, 448, 363, 448, 384, 448, 448, 448, 388, + /* 2850 */ 448, 448, 448, 392, 393, 394, 395, 396, 397, 398, + /* 2860 */ 448, 400, 319, 448, 384, 448, 448, 448, 388, 448, + /* 2870 */ 448, 448, 392, 393, 394, 395, 396, 397, 398, 448, + /* 2880 */ 400, 448, 448, 448, 319, 448, 448, 448, 448, 448, + /* 2890 */ 448, 348, 448, 448, 448, 448, 448, 448, 448, 356, + /* 2900 */ 448, 448, 448, 448, 361, 448, 363, 448, 448, 448, + /* 2910 */ 448, 448, 448, 348, 448, 448, 448, 448, 448, 448, + /* 2920 */ 448, 356, 448, 448, 448, 448, 361, 384, 363, 448, + /* 2930 */ 448, 388, 448, 448, 448, 392, 393, 394, 395, 396, + /* 2940 */ 397, 398, 448, 400, 319, 448, 448, 448, 448, 384, + /* 2950 */ 448, 448, 448, 388, 448, 448, 448, 392, 393, 394, + /* 2960 */ 395, 396, 397, 398, 319, 400, 448, 448, 448, 448, + /* 2970 */ 448, 448, 448, 348, 448, 448, 448, 448, 448, 448, + /* 2980 */ 448, 356, 448, 448, 448, 448, 361, 448, 363, 448, + /* 2990 */ 448, 448, 448, 348, 448, 448, 448, 448, 448, 448, + /* 3000 */ 448, 356, 448, 448, 448, 448, 361, 448, 363, 384, + /* 3010 */ 448, 448, 448, 388, 448, 448, 448, 392, 393, 394, + /* 3020 */ 395, 396, 397, 398, 448, 400, 448, 448, 448, 384, + /* 3030 */ 448, 448, 448, 388, 448, 448, 448, 392, 393, 394, + /* 3040 */ 395, 396, 397, 398, 448, 400, }; -#define YY_SHIFT_COUNT (678) +#define YY_SHIFT_COUNT (688) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2087) +#define YY_SHIFT_MAX (2011) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1068, 0, 57, 265, 57, 322, 322, 322, 530, 322, - /* 10 */ 322, 322, 322, 322, 587, 795, 852, 795, 795, 795, - /* 20 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, - /* 30 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, - /* 40 */ 795, 795, 795, 795, 16, 266, 39, 208, 269, 14, - /* 50 */ 59, 14, 39, 39, 1435, 1435, 14, 1435, 1435, 62, - /* 60 */ 14, 17, 17, 13, 13, 268, 17, 17, 17, 17, - /* 70 */ 17, 17, 17, 17, 17, 17, 68, 17, 17, 17, - /* 80 */ 171, 17, 17, 442, 17, 17, 442, 502, 17, 442, - /* 90 */ 442, 442, 17, 163, 998, 889, 889, 429, 524, 524, - /* 100 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - /* 110 */ 524, 524, 524, 524, 524, 524, 524, 470, 621, 12, - /* 120 */ 268, 58, 58, 327, 328, 438, 101, 101, 9, 9, - /* 130 */ 9, 328, 574, 574, 171, 2, 2, 63, 442, 442, - /* 140 */ 381, 381, 233, 440, 196, 196, 196, 196, 196, 196, - /* 150 */ 196, 859, 402, 337, 34, 43, 552, 179, 427, 630, - /* 160 */ 232, 791, 804, 334, 753, 748, 497, 753, 922, 965, - /* 170 */ 828, 989, 1194, 1081, 1216, 1250, 1250, 1216, 1138, 1138, - /* 180 */ 1250, 1250, 1250, 1291, 1291, 1293, 68, 171, 68, 1309, - /* 190 */ 1314, 68, 1309, 68, 68, 68, 1250, 68, 1291, 442, - /* 200 */ 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, - /* 210 */ 1250, 1291, 381, 1293, 163, 1206, 171, 163, 1250, 1250, - /* 220 */ 1309, 163, 1148, 381, 381, 381, 381, 1148, 381, 1236, - /* 230 */ 163, 233, 163, 574, 1393, 381, 1179, 1148, 381, 381, - /* 240 */ 1179, 1148, 381, 381, 442, 1202, 1288, 1179, 1208, 1204, - /* 250 */ 1215, 989, 1200, 1205, 1211, 1233, 574, 1452, 1380, 1386, - /* 260 */ 381, 440, 1250, 163, 1473, 1291, 2662, 2662, 2662, 2662, - /* 270 */ 2662, 2662, 2662, 1103, 529, 485, 1238, 234, 396, 479, - /* 280 */ 764, 825, 914, 718, 925, 925, 925, 925, 925, 925, - /* 290 */ 925, 925, 925, 1092, 488, 11, 11, 6, 205, 203, - /* 300 */ 584, 242, 637, 421, 699, 941, 729, 699, 699, 699, - /* 310 */ 928, 1032, 999, 944, 977, 988, 1007, 995, 1075, 1089, - /* 320 */ 805, 861, 1065, 1069, 1112, 1115, 1117, 1121, 1128, 1002, - /* 330 */ 1044, 513, 1127, 1155, 921, 1160, 1035, 1161, 1153, 1159, - /* 340 */ 1186, 1188, 1196, 1203, 1207, 1210, 843, 1197, 1213, 884, - /* 350 */ 1221, 1525, 1534, 1345, 1528, 1529, 1488, 1531, 1497, 1343, - /* 360 */ 1501, 1502, 1503, 1347, 1540, 1507, 1508, 1352, 1545, 1355, - /* 370 */ 1551, 1517, 1561, 1541, 1564, 1530, 1389, 1392, 1568, 1570, - /* 380 */ 1401, 1413, 1585, 1586, 1542, 1587, 1590, 1592, 1552, 1593, - /* 390 */ 1597, 1598, 1446, 1600, 1601, 1602, 1603, 1604, 1457, 1571, - /* 400 */ 1607, 1460, 1609, 1611, 1613, 1614, 1615, 1616, 1618, 1619, - /* 410 */ 1620, 1621, 1622, 1623, 1624, 1626, 1589, 1627, 1628, 1629, - /* 420 */ 1635, 1636, 1637, 1617, 1638, 1640, 1641, 1642, 1643, 1625, - /* 430 */ 1652, 1630, 1653, 1654, 1631, 1632, 1633, 1644, 1610, 1661, - /* 440 */ 1645, 1657, 1634, 1639, 1677, 1679, 1682, 1649, 1518, 1683, - /* 450 */ 1689, 1690, 1647, 1692, 1693, 1659, 1648, 1662, 1696, 1663, - /* 460 */ 1655, 1664, 1699, 1665, 1658, 1667, 1704, 1672, 1666, 1669, - /* 470 */ 1711, 1712, 1722, 1724, 1650, 1651, 1691, 1705, 1728, 1694, - /* 480 */ 1695, 1688, 1698, 1697, 1700, 1714, 1734, 1717, 1737, 1720, - /* 490 */ 1701, 1743, 1723, 1709, 1746, 1713, 1747, 1718, 1754, 1733, - /* 500 */ 1736, 1757, 1680, 1725, 1758, 1581, 1740, 1702, 1605, 1778, - /* 510 */ 1779, 1706, 1675, 1777, 1781, 1782, 1784, 1703, 1707, 1751, - /* 520 */ 1606, 1787, 1716, 1684, 1719, 1791, 1756, 1656, 1760, 1710, - /* 530 */ 1752, 1762, 1579, 1578, 1588, 1763, 1566, 1765, 1761, 1766, - /* 540 */ 1768, 1769, 1773, 1774, 1775, 1780, 1785, 1788, 1783, 1813, - /* 550 */ 1764, 1814, 1789, 1818, 1670, 1786, 1795, 1864, 1831, 1686, - /* 560 */ 1840, 1848, 1850, 1852, 1855, 1856, 1798, 1800, 1851, 1708, - /* 570 */ 1853, 1861, 1877, 1896, 1888, 1726, 1832, 1834, 1837, 1838, - /* 580 */ 1842, 1839, 1885, 1844, 1845, 1893, 1847, 1920, 1744, 1854, - /* 590 */ 1841, 1858, 1911, 1914, 1857, 1860, 1921, 1865, 1863, 1925, - /* 600 */ 1868, 1879, 1936, 1881, 1883, 1940, 1886, 1875, 1876, 1878, - /* 610 */ 1880, 1958, 1889, 1903, 1906, 1946, 1907, 1959, 1959, 1979, - /* 620 */ 1944, 1947, 1972, 1974, 1975, 1976, 1978, 1980, 1981, 1983, - /* 630 */ 1985, 1986, 1954, 1923, 1982, 1988, 1989, 2004, 1992, 2007, - /* 640 */ 1995, 2005, 2008, 1977, 1688, 2009, 1698, 2019, 2021, 2023, - /* 650 */ 2025, 2039, 2027, 2063, 2029, 2022, 2026, 2066, 2033, 2024, - /* 660 */ 2031, 2073, 2040, 2030, 2037, 2078, 2044, 2034, 2041, 2082, - /* 670 */ 2049, 2051, 2087, 2067, 2069, 2070, 2072, 2074, 2068, + /* 0 */ 1137, 0, 57, 268, 57, 325, 325, 325, 536, 325, + /* 10 */ 325, 325, 325, 325, 593, 804, 804, 861, 804, 804, + /* 20 */ 804, 804, 804, 804, 804, 804, 804, 804, 804, 804, + /* 30 */ 804, 804, 804, 804, 804, 804, 804, 804, 804, 804, + /* 40 */ 804, 804, 804, 804, 804, 804, 132, 214, 35, 62, + /* 50 */ 83, 142, 258, 142, 35, 35, 1528, 1528, 142, 1528, + /* 60 */ 1528, 131, 142, 203, 203, 30, 30, 23, 203, 203, + /* 70 */ 203, 203, 203, 203, 203, 203, 203, 203, 265, 203, + /* 80 */ 203, 203, 344, 203, 203, 380, 203, 203, 380, 395, + /* 90 */ 203, 380, 380, 380, 203, 389, 1066, 1220, 1220, 285, + /* 100 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, + /* 110 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 460, + /* 120 */ 886, 26, 23, 236, 236, 573, 38, 648, 107, 107, + /* 130 */ 567, 567, 567, 38, 433, 433, 419, 344, 1, 1, + /* 140 */ 365, 380, 380, 544, 544, 419, 551, 398, 398, 398, + /* 150 */ 398, 398, 398, 398, 1601, 137, 570, 770, 971, 42, + /* 160 */ 67, 37, 94, 479, 372, 798, 738, 875, 727, 817, + /* 170 */ 635, 727, 897, 857, 891, 1010, 1206, 1083, 1214, 1239, + /* 180 */ 1239, 1214, 1105, 1105, 1176, 1239, 1239, 1239, 1264, 1264, + /* 190 */ 1277, 265, 344, 265, 1283, 1288, 265, 1283, 265, 265, + /* 200 */ 265, 1239, 265, 1264, 380, 380, 380, 380, 380, 380, + /* 210 */ 380, 380, 380, 380, 380, 1239, 1264, 544, 1152, 1277, + /* 220 */ 389, 1173, 344, 389, 1239, 1239, 1283, 389, 1123, 544, + /* 230 */ 544, 544, 544, 1123, 544, 1212, 389, 419, 389, 433, + /* 240 */ 1380, 1380, 544, 1159, 1123, 544, 544, 1159, 1123, 544, + /* 250 */ 544, 380, 1164, 1252, 1159, 1165, 1168, 1181, 1010, 1157, + /* 260 */ 1166, 1170, 1190, 433, 1411, 1345, 1348, 544, 551, 1239, + /* 270 */ 389, 1437, 1264, 3046, 3046, 3046, 3046, 3046, 3046, 3046, + /* 280 */ 1063, 191, 402, 1312, 682, 752, 1094, 50, 838, 1149, + /* 290 */ 126, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, + /* 300 */ 470, 215, 11, 11, 264, 278, 164, 471, 170, 611, + /* 310 */ 366, 16, 459, 70, 16, 16, 16, 473, 915, 528, + /* 320 */ 888, 889, 957, 989, 959, 1099, 1100, 568, 839, 664, + /* 330 */ 952, 1009, 1073, 1075, 1077, 1081, 903, 832, 1003, 1087, + /* 340 */ 1082, 941, 1059, 892, 1088, 826, 1133, 1130, 1147, 1154, + /* 350 */ 1177, 1196, 1197, 1007, 1156, 1211, 1132, 1247, 1489, 1493, + /* 360 */ 1311, 1495, 1496, 1455, 1498, 1464, 1306, 1466, 1467, 1468, + /* 370 */ 1310, 1505, 1471, 1472, 1314, 1509, 1316, 1512, 1478, 1516, + /* 380 */ 1504, 1517, 1483, 1350, 1353, 1530, 1531, 1361, 1364, 1537, + /* 390 */ 1542, 1499, 1546, 1547, 1548, 1502, 1549, 1552, 1553, 1400, + /* 400 */ 1555, 1557, 1559, 1560, 1562, 1415, 1532, 1566, 1419, 1569, + /* 410 */ 1570, 1571, 1572, 1574, 1575, 1576, 1577, 1581, 1582, 1585, + /* 420 */ 1586, 1597, 1598, 1561, 1599, 1604, 1608, 1616, 1618, 1619, + /* 430 */ 1600, 1621, 1625, 1626, 1627, 1602, 1630, 1579, 1632, 1583, + /* 440 */ 1633, 1640, 1603, 1607, 1606, 1628, 1605, 1629, 1614, 1641, + /* 450 */ 1610, 1613, 1647, 1658, 1661, 1623, 1497, 1665, 1666, 1674, + /* 460 */ 1615, 1676, 1678, 1644, 1634, 1645, 1680, 1648, 1638, 1649, + /* 470 */ 1689, 1655, 1646, 1652, 1692, 1660, 1651, 1662, 1699, 1700, + /* 480 */ 1702, 1703, 1609, 1617, 1670, 1685, 1708, 1675, 1679, 1668, + /* 490 */ 1672, 1681, 1682, 1687, 1713, 1698, 1719, 1701, 1673, 1721, + /* 500 */ 1704, 1696, 1724, 1714, 1727, 1715, 1732, 1712, 1716, 1642, + /* 510 */ 1654, 1735, 1588, 1717, 1739, 1578, 1731, 1591, 1596, 1758, + /* 520 */ 1759, 1622, 1624, 1757, 1762, 1764, 1766, 1686, 1691, 1733, + /* 530 */ 1594, 1767, 1693, 1635, 1694, 1790, 1752, 1636, 1706, 1690, + /* 540 */ 1747, 1755, 1580, 1584, 1589, 1761, 1558, 1707, 1710, 1720, + /* 550 */ 1711, 1718, 1722, 1765, 1723, 1725, 1728, 1729, 1726, 1768, + /* 560 */ 1769, 1771, 1741, 1782, 1563, 1742, 1743, 1823, 1784, 1611, + /* 570 */ 1805, 1806, 1807, 1808, 1809, 1810, 1751, 1753, 1803, 1620, + /* 580 */ 1813, 1804, 1814, 1849, 1835, 1653, 1770, 1772, 1774, 1775, + /* 590 */ 1777, 1778, 1815, 1780, 1783, 1816, 1781, 1837, 1663, 1788, + /* 600 */ 1773, 1795, 1834, 1858, 1800, 1801, 1860, 1812, 1817, 1864, + /* 610 */ 1819, 1820, 1866, 1822, 1824, 1869, 1826, 1754, 1791, 1792, + /* 620 */ 1793, 1844, 1796, 1827, 1828, 1873, 1829, 1874, 1874, 1896, + /* 630 */ 1862, 1865, 1890, 1892, 1894, 1895, 1898, 1900, 1910, 1911, + /* 640 */ 1912, 1913, 1881, 1843, 1907, 1917, 1918, 1932, 1920, 1935, + /* 650 */ 1924, 1926, 1927, 1897, 1668, 1928, 1672, 1929, 1931, 1934, + /* 660 */ 1936, 1945, 1937, 1970, 1939, 1930, 1941, 1976, 1943, 1938, + /* 670 */ 1947, 1981, 1949, 1951, 1955, 1982, 1964, 1954, 1963, 2003, + /* 680 */ 1978, 1979, 2011, 1995, 1994, 1996, 1997, 1999, 2001, }; -#define YY_REDUCE_COUNT (272) -#define YY_REDUCE_MIN (-395) -#define YY_REDUCE_MAX (2266) +#define YY_REDUCE_COUNT (279) +#define YY_REDUCE_MIN (-350) +#define YY_REDUCE_MAX (2645) static const short yy_reduce_ofst[] = { - /* 0 */ -268, 886, -249, -162, -306, 275, 968, 1028, 1050, -21, - /* 10 */ 368, 1106, 1167, 1189, 1273, 1328, 1381, 467, 1433, 1445, - /* 20 */ 1459, 1513, 1527, 1577, 1596, 1646, 1660, 1715, 1741, 1767, - /* 30 */ 1793, 1819, 1871, 1887, 1949, 1965, 2018, 2032, 2086, 2110, - /* 40 */ 2136, 2188, 2204, 2266, -11, 200, 237, 459, 544, 664, - /* 50 */ 879, 911, -131, 286, -341, -222, -387, -307, -201, -252, - /* 60 */ 777, -324, -321, -316, -260, -232, -233, 8, 83, 166, - /* 70 */ 243, 302, 317, 354, 547, 583, 229, 624, 625, 631, - /* 80 */ 77, 633, 638, -289, 691, 749, -175, -279, 758, 211, - /* 90 */ -4, 476, 872, 264, -227, -395, -395, -203, 32, 132, - /* 100 */ 261, 326, 395, 408, 453, 465, 468, 493, 536, 564, - /* 110 */ 601, 662, 676, 715, 721, 723, 726, -121, -133, 135, - /* 120 */ -211, -27, 92, 230, 223, 118, -235, 294, 135, 220, - /* 130 */ 369, 483, 356, 514, 510, 500, 505, 104, 377, 312, - /* 140 */ 60, 464, 607, 549, -326, -293, 204, 263, 283, 308, - /* 150 */ 522, 350, 567, 452, 563, 558, 799, 727, 704, 704, - /* 160 */ 832, 839, 844, 816, 808, 808, 782, 808, 817, 809, - /* 170 */ 704, 854, 865, 892, 896, 962, 963, 927, 936, 940, - /* 180 */ 982, 983, 984, 1000, 1001, 945, 996, 967, 1003, 961, - /* 190 */ 966, 1008, 964, 1010, 1012, 1015, 1021, 1020, 1031, 1009, - /* 200 */ 1018, 1023, 1025, 1027, 1029, 1033, 1034, 1037, 1038, 1039, - /* 210 */ 1040, 1047, 994, 974, 1053, 1011, 1017, 1063, 1066, 1067, - /* 220 */ 1022, 1070, 1030, 1041, 1042, 1043, 1046, 1045, 1048, 1036, - /* 230 */ 1078, 1071, 1080, 1056, 1061, 1072, 1004, 1058, 1074, 1076, - /* 240 */ 1026, 1059, 1094, 1095, 704, 1049, 1051, 1054, 1052, 1057, - /* 250 */ 1062, 1079, 1024, 1055, 1077, 808, 1119, 1100, 1082, 1142, - /* 260 */ 1143, 1168, 1180, 1181, 1195, 1198, 1140, 1147, 1182, 1183, - /* 270 */ 1184, 1191, 1209, + /* 0 */ 179, -252, -312, 882, 13, 281, 549, 992, 262, 1074, + /* 10 */ 1127, 1195, 1217, 1275, 1377, 530, 1436, 1491, 1544, 1595, + /* 20 */ 1612, 1697, 1748, 1811, 1831, 1882, 1899, 1942, 1993, 2010, + /* 30 */ 2061, 2112, 2131, 2194, 2216, 2276, 2296, 2339, 2359, 2410, + /* 40 */ 2461, 2480, 2543, 2565, 2625, 2645, 21, 279, -222, 198, + /* 50 */ 442, 465, 607, 924, -97, -28, -350, -347, -315, -340, + /* 60 */ -61, -63, -26, 39, 96, -321, -317, -344, -311, 7, + /* 70 */ 238, 275, 312, 376, 379, 435, 436, 506, -230, 532, + /* 80 */ 543, 550, -189, 592, 640, 213, 645, 701, -245, -199, + /* 90 */ 704, 323, 102, 432, 758, -102, 56, -226, -226, -89, + /* 100 */ -228, -181, 292, 370, 409, 462, 469, 502, 508, 515, + /* 110 */ 529, 548, 597, 617, 633, 666, 669, 680, 687, 233, + /* 120 */ 17, -243, -265, -270, -125, 169, -49, -179, -36, 90, + /* 130 */ -243, 49, 185, 274, 371, 464, 341, 347, 130, 339, + /* 140 */ 384, 377, 474, 368, 467, 560, 519, -332, 321, 424, + /* 150 */ 487, 583, 644, 702, 520, 399, 714, 677, 775, 719, + /* 160 */ 828, 737, 834, 834, 864, 867, 866, 807, 821, 821, + /* 170 */ 805, 821, 835, 827, 834, 865, 869, 877, 890, 933, + /* 180 */ 934, 894, 899, 901, 938, 946, 956, 963, 965, 975, + /* 190 */ 916, 968, 939, 970, 929, 932, 982, 940, 983, 987, + /* 200 */ 988, 993, 990, 1001, 976, 977, 978, 980, 981, 991, + /* 210 */ 994, 995, 996, 999, 1002, 1011, 1016, 997, 966, 969, + /* 220 */ 1023, 979, 1006, 1027, 1030, 1037, 998, 1036, 1000, 1013, + /* 230 */ 1014, 1018, 1020, 1012, 1021, 1022, 1065, 1051, 1067, 1042, + /* 240 */ 1015, 1019, 1040, 974, 1038, 1050, 1053, 984, 1044, 1055, + /* 250 */ 1056, 834, 1005, 1004, 1017, 1032, 1034, 1008, 1039, 985, + /* 260 */ 986, 1024, 821, 1084, 1048, 1031, 1091, 1102, 1106, 1134, + /* 270 */ 1136, 1155, 1161, 1097, 1104, 1138, 1142, 1145, 1162, 1174, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 10 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 20 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 30 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 40 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 50 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 60 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 70 */ 1509, 1509, 1509, 1509, 1509, 1509, 1583, 1509, 1509, 1509, - /* 80 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 90 */ 1509, 1509, 1509, 1581, 1746, 1930, 1509, 1509, 1509, 1509, - /* 100 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 110 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1942, - /* 120 */ 1509, 1509, 1509, 1583, 1509, 1581, 1902, 1902, 1942, 1942, - /* 130 */ 1942, 1509, 1509, 1509, 1509, 1787, 1787, 1509, 1509, 1509, - /* 140 */ 1509, 1509, 1686, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 150 */ 1509, 1781, 1509, 2015, 1509, 1509, 1509, 1965, 1509, 1509, - /* 160 */ 1509, 1509, 1639, 1957, 1934, 1948, 1999, 1935, 1932, 1951, - /* 170 */ 1509, 1961, 1509, 1774, 1751, 1509, 1509, 1751, 1748, 1748, - /* 180 */ 1509, 1509, 1509, 1509, 1509, 1509, 1583, 1509, 1583, 1509, - /* 190 */ 1509, 1583, 1509, 1583, 1583, 1583, 1509, 1583, 1509, 1509, - /* 200 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 210 */ 1509, 1509, 1509, 1509, 1581, 1783, 1509, 1581, 1509, 1509, - /* 220 */ 1509, 1581, 1970, 1509, 1509, 1509, 1509, 1970, 1509, 1509, - /* 230 */ 1581, 1509, 1581, 1509, 1509, 1509, 1972, 1970, 1509, 1509, - /* 240 */ 1972, 1970, 1509, 1509, 1509, 1984, 1980, 1972, 1988, 1986, - /* 250 */ 1963, 1961, 2018, 2005, 2001, 1948, 1509, 1509, 1509, 1655, - /* 260 */ 1509, 1509, 1509, 1581, 1541, 1509, 1776, 1787, 1689, 1689, - /* 270 */ 1689, 1584, 1514, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 280 */ 1509, 1509, 1509, 1509, 1860, 1509, 1983, 1982, 1906, 1905, - /* 290 */ 1904, 1895, 1859, 1509, 1651, 1858, 1857, 1509, 1509, 1509, - /* 300 */ 1509, 1509, 1509, 1509, 1851, 1509, 1509, 1852, 1850, 1849, - /* 310 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 320 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 330 */ 2002, 2006, 1931, 1509, 1509, 1509, 1509, 1509, 1842, 1833, - /* 340 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 350 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 360 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 370 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 380 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 390 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 400 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 410 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 420 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 430 */ 1509, 1509, 1509, 1509, 1509, 1509, 1546, 1509, 1509, 1509, - /* 440 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 450 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 460 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 470 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 480 */ 1509, 1622, 1621, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 490 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 500 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 510 */ 1509, 1509, 1509, 1998, 1509, 1509, 1509, 1509, 1509, 1509, - /* 520 */ 1509, 1791, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 530 */ 1509, 1892, 1509, 1509, 1509, 1964, 1509, 1509, 1509, 1509, - /* 540 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 550 */ 1509, 1833, 1509, 1981, 1509, 1509, 1996, 1509, 2000, 1509, - /* 560 */ 1509, 1509, 1509, 1509, 1509, 1509, 1941, 1937, 1509, 1509, - /* 570 */ 1933, 1832, 1509, 1926, 1509, 1509, 1877, 1509, 1509, 1509, - /* 580 */ 1509, 1509, 1509, 1509, 1509, 1509, 1841, 1509, 1845, 1509, - /* 590 */ 1509, 1509, 1509, 1509, 1683, 1509, 1509, 1509, 1509, 1509, - /* 600 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1668, 1666, 1665, - /* 610 */ 1664, 1509, 1661, 1509, 1509, 1509, 1509, 1692, 1691, 1509, - /* 620 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 630 */ 1509, 1509, 1509, 1509, 1603, 1509, 1509, 1509, 1509, 1509, - /* 640 */ 1509, 1509, 1509, 1509, 1594, 1509, 1593, 1509, 1509, 1509, - /* 650 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 660 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, - /* 670 */ 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, 1509, + /* 0 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 10 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 20 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 30 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 40 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 50 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 60 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 70 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1610, 1536, + /* 80 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 90 */ 1536, 1536, 1536, 1536, 1536, 1608, 1775, 1962, 1536, 1536, + /* 100 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 110 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 120 */ 1536, 1974, 1536, 1536, 1536, 1610, 1536, 1608, 1934, 1934, + /* 130 */ 1974, 1974, 1974, 1536, 1536, 1536, 1715, 1536, 1816, 1816, + /* 140 */ 1536, 1536, 1536, 1536, 1536, 1715, 1536, 1536, 1536, 1536, + /* 150 */ 1536, 1536, 1536, 1536, 1810, 1536, 1999, 2052, 1536, 1536, + /* 160 */ 1536, 2002, 1536, 1536, 1536, 1536, 1668, 1989, 1966, 1980, + /* 170 */ 2036, 1967, 1964, 1983, 1536, 1993, 1536, 1803, 1780, 1536, + /* 180 */ 1536, 1780, 1777, 1777, 1659, 1536, 1536, 1536, 1536, 1536, + /* 190 */ 1536, 1610, 1536, 1610, 1536, 1536, 1610, 1536, 1610, 1610, + /* 200 */ 1610, 1536, 1610, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 210 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1822, 1536, + /* 220 */ 1608, 1812, 1536, 1608, 1536, 1536, 1536, 1608, 2007, 1536, + /* 230 */ 1536, 1536, 1536, 2007, 1536, 1536, 1608, 1536, 1608, 1536, + /* 240 */ 1536, 1536, 1536, 2009, 2007, 1536, 1536, 2009, 2007, 1536, + /* 250 */ 1536, 1536, 2021, 2017, 2009, 2025, 2023, 1995, 1993, 2055, + /* 260 */ 2042, 2038, 1980, 1536, 1536, 1536, 1684, 1536, 1536, 1536, + /* 270 */ 1608, 1568, 1536, 1805, 1816, 1718, 1718, 1718, 1611, 1541, + /* 280 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 290 */ 1536, 1891, 1536, 2020, 2019, 1938, 1937, 1936, 1927, 1890, + /* 300 */ 1536, 1680, 1889, 1888, 1536, 1536, 1536, 1536, 1536, 1536, + /* 310 */ 1536, 1882, 1536, 1536, 1883, 1881, 1880, 1536, 1536, 1536, + /* 320 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 330 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 2039, 2043, 1963, + /* 340 */ 1536, 1536, 1536, 1536, 1536, 1873, 1864, 1536, 1536, 1536, + /* 350 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 360 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 370 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 380 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 390 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 400 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 410 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 420 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 430 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 440 */ 1536, 1536, 1536, 1536, 1573, 1536, 1536, 1536, 1536, 1536, + /* 450 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 460 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 470 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 480 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1649, + /* 490 */ 1648, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 500 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1872, + /* 510 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 520 */ 1536, 1536, 1536, 2035, 1536, 1536, 1536, 1536, 1536, 1536, + /* 530 */ 1536, 1820, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 540 */ 1536, 1924, 1536, 1536, 1536, 1996, 1536, 1536, 1536, 1536, + /* 550 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 560 */ 1536, 1864, 1536, 2018, 1536, 1536, 2033, 1536, 2037, 1536, + /* 570 */ 1536, 1536, 1536, 1536, 1536, 1536, 1973, 1969, 1536, 1536, + /* 580 */ 1965, 1863, 1536, 1958, 1536, 1536, 1909, 1536, 1536, 1536, + /* 590 */ 1536, 1536, 1536, 1536, 1536, 1536, 1872, 1536, 1876, 1536, + /* 600 */ 1536, 1536, 1536, 1536, 1712, 1536, 1536, 1536, 1536, 1536, + /* 610 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1697, 1695, 1694, + /* 620 */ 1693, 1536, 1690, 1536, 1536, 1536, 1536, 1721, 1720, 1536, + /* 630 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 640 */ 1536, 1536, 1536, 1536, 1630, 1536, 1536, 1536, 1536, 1536, + /* 650 */ 1536, 1536, 1536, 1536, 1621, 1536, 1620, 1536, 1536, 1536, + /* 660 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 670 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, + /* 680 */ 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1041,6 +1119,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 */ @@ -1137,6 +1216,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 */ @@ -1158,6 +1238,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* WSTART => nothing */ 0, /* WEND => nothing */ 0, /* WDURATION => nothing */ + 0, /* IROWTS => nothing */ 0, /* CAST => nothing */ 0, /* NOW => nothing */ 0, /* TODAY => nothing */ @@ -1169,7 +1250,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ 0, /* CASE => nothing */ - 261, /* END => ABORT */ + 264, /* END => ABORT */ 0, /* WHEN => nothing */ 0, /* THEN => nothing */ 0, /* ELSE => nothing */ @@ -1211,57 +1292,57 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 261, /* AFTER => ABORT */ - 261, /* ATTACH => ABORT */ - 261, /* BEFORE => ABORT */ - 261, /* BEGIN => ABORT */ - 261, /* BITAND => ABORT */ - 261, /* BITNOT => ABORT */ - 261, /* BITOR => ABORT */ - 261, /* BLOCKS => ABORT */ - 261, /* CHANGE => ABORT */ - 261, /* COMMA => ABORT */ - 261, /* COMPACT => ABORT */ - 261, /* CONCAT => ABORT */ - 261, /* CONFLICT => ABORT */ - 261, /* COPY => ABORT */ - 261, /* DEFERRED => ABORT */ - 261, /* DELIMITERS => ABORT */ - 261, /* DETACH => ABORT */ - 261, /* DIVIDE => ABORT */ - 261, /* DOT => ABORT */ - 261, /* EACH => ABORT */ - 261, /* FAIL => ABORT */ - 261, /* FILE => ABORT */ - 261, /* FOR => ABORT */ - 261, /* GLOB => ABORT */ - 261, /* ID => ABORT */ - 261, /* IMMEDIATE => ABORT */ - 261, /* IMPORT => ABORT */ - 261, /* INITIALLY => ABORT */ - 261, /* INSTEAD => ABORT */ - 261, /* ISNULL => ABORT */ - 261, /* KEY => ABORT */ - 261, /* NK_BITNOT => ABORT */ - 261, /* NK_SEMI => ABORT */ - 261, /* NOTNULL => ABORT */ - 261, /* OF => ABORT */ - 261, /* PLUS => ABORT */ - 261, /* PRIVILEGE => ABORT */ - 261, /* RAISE => ABORT */ - 261, /* REPLACE => ABORT */ - 261, /* RESTRICT => ABORT */ - 261, /* ROW => ABORT */ - 261, /* SEMI => ABORT */ - 261, /* STAR => ABORT */ - 261, /* STATEMENT => ABORT */ - 261, /* STRING => ABORT */ - 261, /* TIMES => ABORT */ - 261, /* UPDATE => ABORT */ - 261, /* VALUES => ABORT */ - 261, /* VARIABLE => ABORT */ - 261, /* VIEW => ABORT */ - 261, /* WAL => ABORT */ + 264, /* AFTER => ABORT */ + 264, /* ATTACH => ABORT */ + 264, /* BEFORE => ABORT */ + 264, /* BEGIN => ABORT */ + 264, /* BITAND => ABORT */ + 264, /* BITNOT => ABORT */ + 264, /* BITOR => ABORT */ + 264, /* BLOCKS => ABORT */ + 264, /* CHANGE => ABORT */ + 264, /* COMMA => ABORT */ + 264, /* COMPACT => ABORT */ + 264, /* CONCAT => ABORT */ + 264, /* CONFLICT => ABORT */ + 264, /* COPY => ABORT */ + 264, /* DEFERRED => ABORT */ + 264, /* DELIMITERS => ABORT */ + 264, /* DETACH => ABORT */ + 264, /* DIVIDE => ABORT */ + 264, /* DOT => ABORT */ + 264, /* EACH => ABORT */ + 264, /* FAIL => ABORT */ + 264, /* FILE => ABORT */ + 264, /* FOR => ABORT */ + 264, /* GLOB => ABORT */ + 264, /* ID => ABORT */ + 264, /* IMMEDIATE => ABORT */ + 264, /* IMPORT => ABORT */ + 264, /* INITIALLY => ABORT */ + 264, /* INSTEAD => ABORT */ + 264, /* ISNULL => ABORT */ + 264, /* KEY => ABORT */ + 264, /* NK_BITNOT => ABORT */ + 264, /* NK_SEMI => ABORT */ + 264, /* NOTNULL => ABORT */ + 264, /* OF => ABORT */ + 264, /* PLUS => ABORT */ + 264, /* PRIVILEGE => ABORT */ + 264, /* RAISE => ABORT */ + 264, /* REPLACE => ABORT */ + 264, /* RESTRICT => ABORT */ + 264, /* ROW => ABORT */ + 264, /* SEMI => ABORT */ + 264, /* STAR => ABORT */ + 264, /* STATEMENT => ABORT */ + 264, /* STRING => ABORT */ + 264, /* TIMES => ABORT */ + 264, /* UPDATE => ABORT */ + 264, /* VALUES => ABORT */ + 264, /* VARIABLE => ABORT */ + 264, /* VIEW => ABORT */ + 264, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1441,355 +1522,362 @@ 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 */ "CASE", - /* 220 */ "END", - /* 221 */ "WHEN", - /* 222 */ "THEN", - /* 223 */ "ELSE", - /* 224 */ "BETWEEN", - /* 225 */ "IS", - /* 226 */ "NK_LT", - /* 227 */ "NK_GT", - /* 228 */ "NK_LE", - /* 229 */ "NK_GE", - /* 230 */ "NK_NE", - /* 231 */ "MATCH", - /* 232 */ "NMATCH", - /* 233 */ "CONTAINS", - /* 234 */ "IN", - /* 235 */ "JOIN", - /* 236 */ "INNER", - /* 237 */ "SELECT", - /* 238 */ "DISTINCT", - /* 239 */ "WHERE", - /* 240 */ "PARTITION", - /* 241 */ "BY", - /* 242 */ "SESSION", - /* 243 */ "STATE_WINDOW", - /* 244 */ "SLIDING", - /* 245 */ "FILL", - /* 246 */ "VALUE", - /* 247 */ "NONE", - /* 248 */ "PREV", - /* 249 */ "LINEAR", - /* 250 */ "NEXT", - /* 251 */ "HAVING", - /* 252 */ "RANGE", - /* 253 */ "EVERY", - /* 254 */ "ORDER", - /* 255 */ "SLIMIT", - /* 256 */ "SOFFSET", - /* 257 */ "LIMIT", - /* 258 */ "OFFSET", - /* 259 */ "ASC", - /* 260 */ "NULLS", - /* 261 */ "ABORT", - /* 262 */ "AFTER", - /* 263 */ "ATTACH", - /* 264 */ "BEFORE", - /* 265 */ "BEGIN", - /* 266 */ "BITAND", - /* 267 */ "BITNOT", - /* 268 */ "BITOR", - /* 269 */ "BLOCKS", - /* 270 */ "CHANGE", - /* 271 */ "COMMA", - /* 272 */ "COMPACT", - /* 273 */ "CONCAT", - /* 274 */ "CONFLICT", - /* 275 */ "COPY", - /* 276 */ "DEFERRED", - /* 277 */ "DELIMITERS", - /* 278 */ "DETACH", - /* 279 */ "DIVIDE", - /* 280 */ "DOT", - /* 281 */ "EACH", - /* 282 */ "FAIL", - /* 283 */ "FILE", - /* 284 */ "FOR", - /* 285 */ "GLOB", - /* 286 */ "ID", - /* 287 */ "IMMEDIATE", - /* 288 */ "IMPORT", - /* 289 */ "INITIALLY", - /* 290 */ "INSTEAD", - /* 291 */ "ISNULL", - /* 292 */ "KEY", - /* 293 */ "NK_BITNOT", - /* 294 */ "NK_SEMI", - /* 295 */ "NOTNULL", - /* 296 */ "OF", - /* 297 */ "PLUS", - /* 298 */ "PRIVILEGE", - /* 299 */ "RAISE", - /* 300 */ "REPLACE", - /* 301 */ "RESTRICT", - /* 302 */ "ROW", - /* 303 */ "SEMI", - /* 304 */ "STAR", - /* 305 */ "STATEMENT", - /* 306 */ "STRING", - /* 307 */ "TIMES", - /* 308 */ "UPDATE", - /* 309 */ "VALUES", - /* 310 */ "VARIABLE", - /* 311 */ "VIEW", - /* 312 */ "WAL", - /* 313 */ "cmd", - /* 314 */ "account_options", - /* 315 */ "alter_account_options", - /* 316 */ "literal", - /* 317 */ "alter_account_option", - /* 318 */ "user_name", - /* 319 */ "sysinfo_opt", - /* 320 */ "privileges", - /* 321 */ "priv_level", - /* 322 */ "priv_type_list", - /* 323 */ "priv_type", - /* 324 */ "db_name", - /* 325 */ "dnode_endpoint", - /* 326 */ "not_exists_opt", - /* 327 */ "db_options", - /* 328 */ "exists_opt", - /* 329 */ "alter_db_options", - /* 330 */ "integer_list", - /* 331 */ "variable_list", - /* 332 */ "retention_list", - /* 333 */ "alter_db_option", - /* 334 */ "retention", - /* 335 */ "full_table_name", - /* 336 */ "column_def_list", - /* 337 */ "tags_def_opt", - /* 338 */ "table_options", - /* 339 */ "multi_create_clause", - /* 340 */ "tags_def", - /* 341 */ "multi_drop_clause", - /* 342 */ "alter_table_clause", - /* 343 */ "alter_table_options", - /* 344 */ "column_name", - /* 345 */ "type_name", - /* 346 */ "signed_literal", - /* 347 */ "create_subtable_clause", - /* 348 */ "specific_cols_opt", - /* 349 */ "expression_list", - /* 350 */ "drop_table_clause", - /* 351 */ "col_name_list", - /* 352 */ "table_name", - /* 353 */ "column_def", - /* 354 */ "duration_list", - /* 355 */ "rollup_func_list", - /* 356 */ "alter_table_option", - /* 357 */ "duration_literal", - /* 358 */ "rollup_func_name", - /* 359 */ "function_name", - /* 360 */ "col_name", - /* 361 */ "db_name_cond_opt", - /* 362 */ "like_pattern_opt", - /* 363 */ "table_name_cond", - /* 364 */ "from_db_opt", - /* 365 */ "index_options", - /* 366 */ "func_list", - /* 367 */ "sliding_opt", - /* 368 */ "sma_stream_opt", - /* 369 */ "func", - /* 370 */ "stream_options", - /* 371 */ "topic_name", - /* 372 */ "query_or_subquery", - /* 373 */ "cgroup_name", - /* 374 */ "analyze_opt", - /* 375 */ "explain_options", - /* 376 */ "agg_func_opt", - /* 377 */ "bufsize_opt", - /* 378 */ "stream_name", - /* 379 */ "dnode_list", - /* 380 */ "where_clause_opt", - /* 381 */ "signed", - /* 382 */ "literal_func", - /* 383 */ "literal_list", - /* 384 */ "table_alias", - /* 385 */ "column_alias", - /* 386 */ "expr_or_subquery", - /* 387 */ "expression", - /* 388 */ "subquery", - /* 389 */ "pseudo_column", - /* 390 */ "column_reference", - /* 391 */ "function_expression", - /* 392 */ "case_when_expression", - /* 393 */ "star_func", - /* 394 */ "star_func_para_list", - /* 395 */ "noarg_func", - /* 396 */ "other_para_list", - /* 397 */ "star_func_para", - /* 398 */ "when_then_list", - /* 399 */ "case_when_else_opt", - /* 400 */ "common_expression", - /* 401 */ "when_then_expr", - /* 402 */ "predicate", - /* 403 */ "compare_op", - /* 404 */ "in_op", - /* 405 */ "in_predicate_value", - /* 406 */ "boolean_value_expression", - /* 407 */ "boolean_primary", - /* 408 */ "from_clause_opt", - /* 409 */ "table_reference_list", - /* 410 */ "table_reference", - /* 411 */ "table_primary", - /* 412 */ "joined_table", - /* 413 */ "alias_opt", - /* 414 */ "parenthesized_joined_table", - /* 415 */ "join_type", - /* 416 */ "search_condition", - /* 417 */ "query_specification", - /* 418 */ "set_quantifier_opt", - /* 419 */ "select_list", - /* 420 */ "partition_by_clause_opt", - /* 421 */ "range_opt", - /* 422 */ "every_opt", - /* 423 */ "fill_opt", - /* 424 */ "twindow_clause_opt", - /* 425 */ "group_by_clause_opt", - /* 426 */ "having_clause_opt", - /* 427 */ "select_item", - /* 428 */ "fill_mode", - /* 429 */ "group_by_list", - /* 430 */ "query_expression", - /* 431 */ "query_simple", - /* 432 */ "order_by_clause_opt", - /* 433 */ "slimit_clause_opt", - /* 434 */ "limit_clause_opt", - /* 435 */ "union_query_expression", - /* 436 */ "query_simple_or_subquery", - /* 437 */ "sort_specification_list", - /* 438 */ "sort_specification", - /* 439 */ "ordering_specification_opt", - /* 440 */ "null_ordering_opt", + /* 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 */ "IROWTS", + /* 212 */ "CAST", + /* 213 */ "NOW", + /* 214 */ "TODAY", + /* 215 */ "TIMEZONE", + /* 216 */ "CLIENT_VERSION", + /* 217 */ "SERVER_VERSION", + /* 218 */ "SERVER_STATUS", + /* 219 */ "CURRENT_USER", + /* 220 */ "COUNT", + /* 221 */ "LAST_ROW", + /* 222 */ "CASE", + /* 223 */ "END", + /* 224 */ "WHEN", + /* 225 */ "THEN", + /* 226 */ "ELSE", + /* 227 */ "BETWEEN", + /* 228 */ "IS", + /* 229 */ "NK_LT", + /* 230 */ "NK_GT", + /* 231 */ "NK_LE", + /* 232 */ "NK_GE", + /* 233 */ "NK_NE", + /* 234 */ "MATCH", + /* 235 */ "NMATCH", + /* 236 */ "CONTAINS", + /* 237 */ "IN", + /* 238 */ "JOIN", + /* 239 */ "INNER", + /* 240 */ "SELECT", + /* 241 */ "DISTINCT", + /* 242 */ "WHERE", + /* 243 */ "PARTITION", + /* 244 */ "BY", + /* 245 */ "SESSION", + /* 246 */ "STATE_WINDOW", + /* 247 */ "SLIDING", + /* 248 */ "FILL", + /* 249 */ "VALUE", + /* 250 */ "NONE", + /* 251 */ "PREV", + /* 252 */ "LINEAR", + /* 253 */ "NEXT", + /* 254 */ "HAVING", + /* 255 */ "RANGE", + /* 256 */ "EVERY", + /* 257 */ "ORDER", + /* 258 */ "SLIMIT", + /* 259 */ "SOFFSET", + /* 260 */ "LIMIT", + /* 261 */ "OFFSET", + /* 262 */ "ASC", + /* 263 */ "NULLS", + /* 264 */ "ABORT", + /* 265 */ "AFTER", + /* 266 */ "ATTACH", + /* 267 */ "BEFORE", + /* 268 */ "BEGIN", + /* 269 */ "BITAND", + /* 270 */ "BITNOT", + /* 271 */ "BITOR", + /* 272 */ "BLOCKS", + /* 273 */ "CHANGE", + /* 274 */ "COMMA", + /* 275 */ "COMPACT", + /* 276 */ "CONCAT", + /* 277 */ "CONFLICT", + /* 278 */ "COPY", + /* 279 */ "DEFERRED", + /* 280 */ "DELIMITERS", + /* 281 */ "DETACH", + /* 282 */ "DIVIDE", + /* 283 */ "DOT", + /* 284 */ "EACH", + /* 285 */ "FAIL", + /* 286 */ "FILE", + /* 287 */ "FOR", + /* 288 */ "GLOB", + /* 289 */ "ID", + /* 290 */ "IMMEDIATE", + /* 291 */ "IMPORT", + /* 292 */ "INITIALLY", + /* 293 */ "INSTEAD", + /* 294 */ "ISNULL", + /* 295 */ "KEY", + /* 296 */ "NK_BITNOT", + /* 297 */ "NK_SEMI", + /* 298 */ "NOTNULL", + /* 299 */ "OF", + /* 300 */ "PLUS", + /* 301 */ "PRIVILEGE", + /* 302 */ "RAISE", + /* 303 */ "REPLACE", + /* 304 */ "RESTRICT", + /* 305 */ "ROW", + /* 306 */ "SEMI", + /* 307 */ "STAR", + /* 308 */ "STATEMENT", + /* 309 */ "STRING", + /* 310 */ "TIMES", + /* 311 */ "UPDATE", + /* 312 */ "VALUES", + /* 313 */ "VARIABLE", + /* 314 */ "VIEW", + /* 315 */ "WAL", + /* 316 */ "cmd", + /* 317 */ "account_options", + /* 318 */ "alter_account_options", + /* 319 */ "literal", + /* 320 */ "alter_account_option", + /* 321 */ "user_name", + /* 322 */ "sysinfo_opt", + /* 323 */ "privileges", + /* 324 */ "priv_level", + /* 325 */ "priv_type_list", + /* 326 */ "priv_type", + /* 327 */ "db_name", + /* 328 */ "dnode_endpoint", + /* 329 */ "not_exists_opt", + /* 330 */ "db_options", + /* 331 */ "exists_opt", + /* 332 */ "alter_db_options", + /* 333 */ "speed_opt", + /* 334 */ "integer_list", + /* 335 */ "variable_list", + /* 336 */ "retention_list", + /* 337 */ "alter_db_option", + /* 338 */ "retention", + /* 339 */ "full_table_name", + /* 340 */ "column_def_list", + /* 341 */ "tags_def_opt", + /* 342 */ "table_options", + /* 343 */ "multi_create_clause", + /* 344 */ "tags_def", + /* 345 */ "multi_drop_clause", + /* 346 */ "alter_table_clause", + /* 347 */ "alter_table_options", + /* 348 */ "column_name", + /* 349 */ "type_name", + /* 350 */ "signed_literal", + /* 351 */ "create_subtable_clause", + /* 352 */ "specific_cols_opt", + /* 353 */ "expression_list", + /* 354 */ "drop_table_clause", + /* 355 */ "col_name_list", + /* 356 */ "table_name", + /* 357 */ "column_def", + /* 358 */ "duration_list", + /* 359 */ "rollup_func_list", + /* 360 */ "alter_table_option", + /* 361 */ "duration_literal", + /* 362 */ "rollup_func_name", + /* 363 */ "function_name", + /* 364 */ "col_name", + /* 365 */ "db_name_cond_opt", + /* 366 */ "like_pattern_opt", + /* 367 */ "table_name_cond", + /* 368 */ "from_db_opt", + /* 369 */ "index_options", + /* 370 */ "func_list", + /* 371 */ "sliding_opt", + /* 372 */ "sma_stream_opt", + /* 373 */ "func", + /* 374 */ "stream_options", + /* 375 */ "topic_name", + /* 376 */ "query_or_subquery", + /* 377 */ "cgroup_name", + /* 378 */ "analyze_opt", + /* 379 */ "explain_options", + /* 380 */ "agg_func_opt", + /* 381 */ "bufsize_opt", + /* 382 */ "stream_name", + /* 383 */ "subtable_opt", + /* 384 */ "expression", + /* 385 */ "dnode_list", + /* 386 */ "where_clause_opt", + /* 387 */ "signed", + /* 388 */ "literal_func", + /* 389 */ "literal_list", + /* 390 */ "table_alias", + /* 391 */ "column_alias", + /* 392 */ "expr_or_subquery", + /* 393 */ "subquery", + /* 394 */ "pseudo_column", + /* 395 */ "column_reference", + /* 396 */ "function_expression", + /* 397 */ "case_when_expression", + /* 398 */ "star_func", + /* 399 */ "star_func_para_list", + /* 400 */ "noarg_func", + /* 401 */ "other_para_list", + /* 402 */ "star_func_para", + /* 403 */ "when_then_list", + /* 404 */ "case_when_else_opt", + /* 405 */ "common_expression", + /* 406 */ "when_then_expr", + /* 407 */ "predicate", + /* 408 */ "compare_op", + /* 409 */ "in_op", + /* 410 */ "in_predicate_value", + /* 411 */ "boolean_value_expression", + /* 412 */ "boolean_primary", + /* 413 */ "from_clause_opt", + /* 414 */ "table_reference_list", + /* 415 */ "table_reference", + /* 416 */ "table_primary", + /* 417 */ "joined_table", + /* 418 */ "alias_opt", + /* 419 */ "parenthesized_joined_table", + /* 420 */ "join_type", + /* 421 */ "search_condition", + /* 422 */ "query_specification", + /* 423 */ "set_quantifier_opt", + /* 424 */ "select_list", + /* 425 */ "partition_by_clause_opt", + /* 426 */ "range_opt", + /* 427 */ "every_opt", + /* 428 */ "fill_opt", + /* 429 */ "twindow_clause_opt", + /* 430 */ "group_by_clause_opt", + /* 431 */ "having_clause_opt", + /* 432 */ "select_item", + /* 433 */ "partition_list", + /* 434 */ "partition_item", + /* 435 */ "fill_mode", + /* 436 */ "group_by_list", + /* 437 */ "query_expression", + /* 438 */ "query_simple", + /* 439 */ "order_by_clause_opt", + /* 440 */ "slimit_clause_opt", + /* 441 */ "limit_clause_opt", + /* 442 */ "union_query_expression", + /* 443 */ "query_simple_or_subquery", + /* 444 */ "sort_specification_list", + /* 445 */ "sort_specification", + /* 446 */ "ordering_specification_opt", + /* 447 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1864,7 +1952,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", @@ -1917,395 +2005,405 @@ 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 */ "expr_or_subquery ::= expression", - /* 330 */ "expr_or_subquery ::= subquery", - /* 331 */ "expression ::= literal", - /* 332 */ "expression ::= pseudo_column", - /* 333 */ "expression ::= column_reference", - /* 334 */ "expression ::= function_expression", - /* 335 */ "expression ::= case_when_expression", - /* 336 */ "expression ::= NK_LP expression NK_RP", - /* 337 */ "expression ::= NK_PLUS expr_or_subquery", - /* 338 */ "expression ::= NK_MINUS expr_or_subquery", - /* 339 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 340 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 341 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 342 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 343 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 344 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 345 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 346 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 347 */ "expression_list ::= expr_or_subquery", - /* 348 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 349 */ "column_reference ::= column_name", - /* 350 */ "column_reference ::= table_name NK_DOT column_name", - /* 351 */ "pseudo_column ::= ROWTS", - /* 352 */ "pseudo_column ::= TBNAME", - /* 353 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 354 */ "pseudo_column ::= QSTART", - /* 355 */ "pseudo_column ::= QEND", - /* 356 */ "pseudo_column ::= QDURATION", - /* 357 */ "pseudo_column ::= WSTART", - /* 358 */ "pseudo_column ::= WEND", - /* 359 */ "pseudo_column ::= WDURATION", - /* 360 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 361 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 362 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 363 */ "function_expression ::= literal_func", - /* 364 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 365 */ "literal_func ::= NOW", - /* 366 */ "noarg_func ::= NOW", - /* 367 */ "noarg_func ::= TODAY", - /* 368 */ "noarg_func ::= TIMEZONE", - /* 369 */ "noarg_func ::= DATABASE", - /* 370 */ "noarg_func ::= CLIENT_VERSION", - /* 371 */ "noarg_func ::= SERVER_VERSION", - /* 372 */ "noarg_func ::= SERVER_STATUS", - /* 373 */ "noarg_func ::= CURRENT_USER", - /* 374 */ "noarg_func ::= USER", - /* 375 */ "star_func ::= COUNT", - /* 376 */ "star_func ::= FIRST", - /* 377 */ "star_func ::= LAST", - /* 378 */ "star_func ::= LAST_ROW", - /* 379 */ "star_func_para_list ::= NK_STAR", - /* 380 */ "star_func_para_list ::= other_para_list", - /* 381 */ "other_para_list ::= star_func_para", - /* 382 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 383 */ "star_func_para ::= expr_or_subquery", - /* 384 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 385 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 386 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 387 */ "when_then_list ::= when_then_expr", - /* 388 */ "when_then_list ::= when_then_list when_then_expr", - /* 389 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 390 */ "case_when_else_opt ::=", - /* 391 */ "case_when_else_opt ::= ELSE common_expression", - /* 392 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 393 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 394 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 395 */ "predicate ::= expr_or_subquery IS NULL", - /* 396 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 397 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 398 */ "compare_op ::= NK_LT", - /* 399 */ "compare_op ::= NK_GT", - /* 400 */ "compare_op ::= NK_LE", - /* 401 */ "compare_op ::= NK_GE", - /* 402 */ "compare_op ::= NK_NE", - /* 403 */ "compare_op ::= NK_EQ", - /* 404 */ "compare_op ::= LIKE", - /* 405 */ "compare_op ::= NOT LIKE", - /* 406 */ "compare_op ::= MATCH", - /* 407 */ "compare_op ::= NMATCH", - /* 408 */ "compare_op ::= CONTAINS", - /* 409 */ "in_op ::= IN", - /* 410 */ "in_op ::= NOT IN", - /* 411 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 412 */ "boolean_value_expression ::= boolean_primary", - /* 413 */ "boolean_value_expression ::= NOT boolean_primary", - /* 414 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 415 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 416 */ "boolean_primary ::= predicate", - /* 417 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 418 */ "common_expression ::= expr_or_subquery", - /* 419 */ "common_expression ::= boolean_value_expression", - /* 420 */ "from_clause_opt ::=", - /* 421 */ "from_clause_opt ::= FROM table_reference_list", - /* 422 */ "table_reference_list ::= table_reference", - /* 423 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 424 */ "table_reference ::= table_primary", - /* 425 */ "table_reference ::= joined_table", - /* 426 */ "table_primary ::= table_name alias_opt", - /* 427 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 428 */ "table_primary ::= subquery alias_opt", - /* 429 */ "table_primary ::= parenthesized_joined_table", - /* 430 */ "alias_opt ::=", - /* 431 */ "alias_opt ::= table_alias", - /* 432 */ "alias_opt ::= AS table_alias", - /* 433 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 434 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 435 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 436 */ "join_type ::=", - /* 437 */ "join_type ::= INNER", - /* 438 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 439 */ "set_quantifier_opt ::=", - /* 440 */ "set_quantifier_opt ::= DISTINCT", - /* 441 */ "set_quantifier_opt ::= ALL", - /* 442 */ "select_list ::= select_item", - /* 443 */ "select_list ::= select_list NK_COMMA select_item", - /* 444 */ "select_item ::= NK_STAR", - /* 445 */ "select_item ::= common_expression", - /* 446 */ "select_item ::= common_expression column_alias", - /* 447 */ "select_item ::= common_expression AS column_alias", - /* 448 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 449 */ "where_clause_opt ::=", - /* 450 */ "where_clause_opt ::= WHERE search_condition", - /* 451 */ "partition_by_clause_opt ::=", - /* 452 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 453 */ "twindow_clause_opt ::=", - /* 454 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 455 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 456 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 457 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 458 */ "sliding_opt ::=", - /* 459 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 460 */ "fill_opt ::=", - /* 461 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 462 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 463 */ "fill_mode ::= NONE", - /* 464 */ "fill_mode ::= PREV", - /* 465 */ "fill_mode ::= NULL", - /* 466 */ "fill_mode ::= LINEAR", - /* 467 */ "fill_mode ::= NEXT", - /* 468 */ "group_by_clause_opt ::=", - /* 469 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 470 */ "group_by_list ::= expr_or_subquery", - /* 471 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 472 */ "having_clause_opt ::=", - /* 473 */ "having_clause_opt ::= HAVING search_condition", - /* 474 */ "range_opt ::=", - /* 475 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 476 */ "every_opt ::=", - /* 477 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 478 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 479 */ "query_simple ::= query_specification", - /* 480 */ "query_simple ::= union_query_expression", - /* 481 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 482 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 483 */ "query_simple_or_subquery ::= query_simple", - /* 484 */ "query_simple_or_subquery ::= subquery", - /* 485 */ "query_or_subquery ::= query_expression", - /* 486 */ "query_or_subquery ::= subquery", - /* 487 */ "order_by_clause_opt ::=", - /* 488 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 489 */ "slimit_clause_opt ::=", - /* 490 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 491 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 492 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 493 */ "limit_clause_opt ::=", - /* 494 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 495 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 496 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 497 */ "subquery ::= NK_LP query_expression NK_RP", - /* 498 */ "subquery ::= NK_LP subquery NK_RP", - /* 499 */ "search_condition ::= common_expression", - /* 500 */ "sort_specification_list ::= sort_specification", - /* 501 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 502 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 503 */ "ordering_specification_opt ::=", - /* 504 */ "ordering_specification_opt ::= ASC", - /* 505 */ "ordering_specification_opt ::= DESC", - /* 506 */ "null_ordering_opt ::=", - /* 507 */ "null_ordering_opt ::= NULLS FIRST", - /* 508 */ "null_ordering_opt ::= NULLS LAST", + /* 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 */ "pseudo_column ::= IROWTS", + /* 365 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 366 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 367 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 368 */ "function_expression ::= literal_func", + /* 369 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 370 */ "literal_func ::= NOW", + /* 371 */ "noarg_func ::= NOW", + /* 372 */ "noarg_func ::= TODAY", + /* 373 */ "noarg_func ::= TIMEZONE", + /* 374 */ "noarg_func ::= DATABASE", + /* 375 */ "noarg_func ::= CLIENT_VERSION", + /* 376 */ "noarg_func ::= SERVER_VERSION", + /* 377 */ "noarg_func ::= SERVER_STATUS", + /* 378 */ "noarg_func ::= CURRENT_USER", + /* 379 */ "noarg_func ::= USER", + /* 380 */ "star_func ::= COUNT", + /* 381 */ "star_func ::= FIRST", + /* 382 */ "star_func ::= LAST", + /* 383 */ "star_func ::= LAST_ROW", + /* 384 */ "star_func_para_list ::= NK_STAR", + /* 385 */ "star_func_para_list ::= other_para_list", + /* 386 */ "other_para_list ::= star_func_para", + /* 387 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 388 */ "star_func_para ::= expr_or_subquery", + /* 389 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 390 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 391 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 392 */ "when_then_list ::= when_then_expr", + /* 393 */ "when_then_list ::= when_then_list when_then_expr", + /* 394 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 395 */ "case_when_else_opt ::=", + /* 396 */ "case_when_else_opt ::= ELSE common_expression", + /* 397 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 398 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 399 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 400 */ "predicate ::= expr_or_subquery IS NULL", + /* 401 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 402 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 403 */ "compare_op ::= NK_LT", + /* 404 */ "compare_op ::= NK_GT", + /* 405 */ "compare_op ::= NK_LE", + /* 406 */ "compare_op ::= NK_GE", + /* 407 */ "compare_op ::= NK_NE", + /* 408 */ "compare_op ::= NK_EQ", + /* 409 */ "compare_op ::= LIKE", + /* 410 */ "compare_op ::= NOT LIKE", + /* 411 */ "compare_op ::= MATCH", + /* 412 */ "compare_op ::= NMATCH", + /* 413 */ "compare_op ::= CONTAINS", + /* 414 */ "in_op ::= IN", + /* 415 */ "in_op ::= NOT IN", + /* 416 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 417 */ "boolean_value_expression ::= boolean_primary", + /* 418 */ "boolean_value_expression ::= NOT boolean_primary", + /* 419 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 420 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 421 */ "boolean_primary ::= predicate", + /* 422 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 423 */ "common_expression ::= expr_or_subquery", + /* 424 */ "common_expression ::= boolean_value_expression", + /* 425 */ "from_clause_opt ::=", + /* 426 */ "from_clause_opt ::= FROM table_reference_list", + /* 427 */ "table_reference_list ::= table_reference", + /* 428 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 429 */ "table_reference ::= table_primary", + /* 430 */ "table_reference ::= joined_table", + /* 431 */ "table_primary ::= table_name alias_opt", + /* 432 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 433 */ "table_primary ::= subquery alias_opt", + /* 434 */ "table_primary ::= parenthesized_joined_table", + /* 435 */ "alias_opt ::=", + /* 436 */ "alias_opt ::= table_alias", + /* 437 */ "alias_opt ::= AS table_alias", + /* 438 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 439 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 440 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 441 */ "join_type ::=", + /* 442 */ "join_type ::= INNER", + /* 443 */ "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", + /* 444 */ "set_quantifier_opt ::=", + /* 445 */ "set_quantifier_opt ::= DISTINCT", + /* 446 */ "set_quantifier_opt ::= ALL", + /* 447 */ "select_list ::= select_item", + /* 448 */ "select_list ::= select_list NK_COMMA select_item", + /* 449 */ "select_item ::= NK_STAR", + /* 450 */ "select_item ::= common_expression", + /* 451 */ "select_item ::= common_expression column_alias", + /* 452 */ "select_item ::= common_expression AS column_alias", + /* 453 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 454 */ "where_clause_opt ::=", + /* 455 */ "where_clause_opt ::= WHERE search_condition", + /* 456 */ "partition_by_clause_opt ::=", + /* 457 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 458 */ "partition_list ::= partition_item", + /* 459 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 460 */ "partition_item ::= expr_or_subquery", + /* 461 */ "partition_item ::= expr_or_subquery column_alias", + /* 462 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 463 */ "twindow_clause_opt ::=", + /* 464 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 465 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 466 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 467 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 468 */ "sliding_opt ::=", + /* 469 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 470 */ "fill_opt ::=", + /* 471 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 472 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 473 */ "fill_mode ::= NONE", + /* 474 */ "fill_mode ::= PREV", + /* 475 */ "fill_mode ::= NULL", + /* 476 */ "fill_mode ::= LINEAR", + /* 477 */ "fill_mode ::= NEXT", + /* 478 */ "group_by_clause_opt ::=", + /* 479 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 480 */ "group_by_list ::= expr_or_subquery", + /* 481 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 482 */ "having_clause_opt ::=", + /* 483 */ "having_clause_opt ::= HAVING search_condition", + /* 484 */ "range_opt ::=", + /* 485 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 486 */ "every_opt ::=", + /* 487 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 488 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 489 */ "query_simple ::= query_specification", + /* 490 */ "query_simple ::= union_query_expression", + /* 491 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 492 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 493 */ "query_simple_or_subquery ::= query_simple", + /* 494 */ "query_simple_or_subquery ::= subquery", + /* 495 */ "query_or_subquery ::= query_expression", + /* 496 */ "query_or_subquery ::= subquery", + /* 497 */ "order_by_clause_opt ::=", + /* 498 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 499 */ "slimit_clause_opt ::=", + /* 500 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 501 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 502 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 503 */ "limit_clause_opt ::=", + /* 504 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 505 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 506 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 507 */ "subquery ::= NK_LP query_expression NK_RP", + /* 508 */ "subquery ::= NK_LP subquery NK_RP", + /* 509 */ "search_condition ::= common_expression", + /* 510 */ "sort_specification_list ::= sort_specification", + /* 511 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 512 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 513 */ "ordering_specification_opt ::=", + /* 514 */ "ordering_specification_opt ::= ASC", + /* 515 */ "ordering_specification_opt ::= DESC", + /* 516 */ "null_ordering_opt ::=", + /* 517 */ "null_ordering_opt ::= NULLS FIRST", + /* 518 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2432,186 +2530,190 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 313: /* cmd */ - case 316: /* literal */ - case 327: /* db_options */ - case 329: /* alter_db_options */ - case 334: /* retention */ - case 335: /* full_table_name */ - case 338: /* table_options */ - case 342: /* alter_table_clause */ - case 343: /* alter_table_options */ - case 346: /* signed_literal */ - case 347: /* create_subtable_clause */ - case 350: /* drop_table_clause */ - case 353: /* column_def */ - case 357: /* duration_literal */ - case 358: /* rollup_func_name */ - case 360: /* col_name */ - case 361: /* db_name_cond_opt */ - case 362: /* like_pattern_opt */ - case 363: /* table_name_cond */ - case 364: /* from_db_opt */ - case 365: /* index_options */ - case 367: /* sliding_opt */ - case 368: /* sma_stream_opt */ - case 369: /* func */ - case 370: /* stream_options */ - case 372: /* query_or_subquery */ - case 375: /* explain_options */ - case 380: /* where_clause_opt */ - case 381: /* signed */ - case 382: /* literal_func */ - case 386: /* expr_or_subquery */ - case 387: /* expression */ - case 388: /* subquery */ - case 389: /* pseudo_column */ - case 390: /* column_reference */ - case 391: /* function_expression */ - case 392: /* case_when_expression */ - case 397: /* star_func_para */ - case 399: /* case_when_else_opt */ - case 400: /* common_expression */ - case 401: /* when_then_expr */ - case 402: /* predicate */ - case 405: /* in_predicate_value */ - case 406: /* boolean_value_expression */ - case 407: /* boolean_primary */ - case 408: /* from_clause_opt */ - case 409: /* table_reference_list */ - case 410: /* table_reference */ - case 411: /* table_primary */ - case 412: /* joined_table */ - case 414: /* parenthesized_joined_table */ - case 416: /* search_condition */ - case 417: /* query_specification */ - case 421: /* range_opt */ - case 422: /* every_opt */ - case 423: /* fill_opt */ - case 424: /* twindow_clause_opt */ - case 426: /* having_clause_opt */ - case 427: /* select_item */ - case 430: /* query_expression */ - case 431: /* query_simple */ - case 433: /* slimit_clause_opt */ - case 434: /* limit_clause_opt */ - case 435: /* union_query_expression */ - case 436: /* query_simple_or_subquery */ - case 438: /* sort_specification */ + case 316: /* cmd */ + case 319: /* literal */ + case 330: /* db_options */ + case 332: /* alter_db_options */ + case 338: /* retention */ + case 339: /* full_table_name */ + case 342: /* table_options */ + case 346: /* alter_table_clause */ + case 347: /* alter_table_options */ + case 350: /* signed_literal */ + case 351: /* create_subtable_clause */ + case 354: /* drop_table_clause */ + case 357: /* column_def */ + case 361: /* duration_literal */ + case 362: /* rollup_func_name */ + case 364: /* col_name */ + case 365: /* db_name_cond_opt */ + case 366: /* like_pattern_opt */ + case 367: /* table_name_cond */ + case 368: /* from_db_opt */ + case 369: /* index_options */ + case 371: /* sliding_opt */ + case 372: /* sma_stream_opt */ + case 373: /* func */ + case 374: /* stream_options */ + case 376: /* query_or_subquery */ + case 379: /* explain_options */ + case 383: /* subtable_opt */ + case 384: /* expression */ + case 386: /* where_clause_opt */ + case 387: /* signed */ + case 388: /* literal_func */ + case 392: /* expr_or_subquery */ + case 393: /* subquery */ + case 394: /* pseudo_column */ + case 395: /* column_reference */ + case 396: /* function_expression */ + case 397: /* case_when_expression */ + case 402: /* star_func_para */ + case 404: /* case_when_else_opt */ + case 405: /* common_expression */ + case 406: /* when_then_expr */ + case 407: /* predicate */ + case 410: /* in_predicate_value */ + case 411: /* boolean_value_expression */ + case 412: /* boolean_primary */ + case 413: /* from_clause_opt */ + case 414: /* table_reference_list */ + case 415: /* table_reference */ + case 416: /* table_primary */ + case 417: /* joined_table */ + case 419: /* parenthesized_joined_table */ + case 421: /* search_condition */ + case 422: /* query_specification */ + case 426: /* range_opt */ + case 427: /* every_opt */ + case 428: /* fill_opt */ + case 429: /* twindow_clause_opt */ + case 431: /* having_clause_opt */ + case 432: /* select_item */ + case 434: /* partition_item */ + case 437: /* query_expression */ + case 438: /* query_simple */ + case 440: /* slimit_clause_opt */ + case 441: /* limit_clause_opt */ + case 442: /* union_query_expression */ + case 443: /* query_simple_or_subquery */ + case 445: /* sort_specification */ { - nodesDestroyNode((yypminor->yy560)); + nodesDestroyNode((yypminor->yy616)); } break; - case 314: /* account_options */ - case 315: /* alter_account_options */ - case 317: /* alter_account_option */ - case 377: /* bufsize_opt */ + case 317: /* account_options */ + case 318: /* alter_account_options */ + case 320: /* alter_account_option */ + case 333: /* speed_opt */ + case 381: /* bufsize_opt */ { } break; - case 318: /* user_name */ - case 321: /* priv_level */ - case 324: /* db_name */ - case 325: /* dnode_endpoint */ - case 344: /* column_name */ - case 352: /* table_name */ - case 359: /* function_name */ - case 371: /* topic_name */ - case 373: /* cgroup_name */ - case 378: /* stream_name */ - case 384: /* table_alias */ - case 385: /* column_alias */ - case 393: /* star_func */ - case 395: /* noarg_func */ - case 413: /* alias_opt */ + case 321: /* user_name */ + case 324: /* priv_level */ + case 327: /* db_name */ + case 328: /* dnode_endpoint */ + case 348: /* column_name */ + case 356: /* table_name */ + case 363: /* function_name */ + case 375: /* topic_name */ + case 377: /* cgroup_name */ + case 382: /* stream_name */ + case 390: /* table_alias */ + case 391: /* column_alias */ + case 398: /* star_func */ + case 400: /* noarg_func */ + case 418: /* alias_opt */ { } break; - case 319: /* sysinfo_opt */ + case 322: /* sysinfo_opt */ { } break; - case 320: /* privileges */ - case 322: /* priv_type_list */ - case 323: /* priv_type */ + case 323: /* privileges */ + case 325: /* priv_type_list */ + case 326: /* priv_type */ { } break; - case 326: /* not_exists_opt */ - case 328: /* exists_opt */ - case 374: /* analyze_opt */ - case 376: /* agg_func_opt */ - case 418: /* set_quantifier_opt */ + case 329: /* not_exists_opt */ + case 331: /* exists_opt */ + case 378: /* analyze_opt */ + case 380: /* agg_func_opt */ + case 423: /* set_quantifier_opt */ { } break; - case 330: /* integer_list */ - case 331: /* variable_list */ - case 332: /* retention_list */ - case 336: /* column_def_list */ - case 337: /* tags_def_opt */ - case 339: /* multi_create_clause */ - case 340: /* tags_def */ - case 341: /* multi_drop_clause */ - case 348: /* specific_cols_opt */ - case 349: /* expression_list */ - case 351: /* col_name_list */ - case 354: /* duration_list */ - case 355: /* rollup_func_list */ - case 366: /* func_list */ - case 379: /* dnode_list */ - case 383: /* literal_list */ - case 394: /* star_func_para_list */ - case 396: /* other_para_list */ - case 398: /* when_then_list */ - case 419: /* select_list */ - case 420: /* partition_by_clause_opt */ - case 425: /* group_by_clause_opt */ - case 429: /* group_by_list */ - case 432: /* order_by_clause_opt */ - case 437: /* sort_specification_list */ + case 334: /* integer_list */ + case 335: /* variable_list */ + case 336: /* retention_list */ + case 340: /* column_def_list */ + case 341: /* tags_def_opt */ + case 343: /* multi_create_clause */ + case 344: /* tags_def */ + case 345: /* multi_drop_clause */ + case 352: /* specific_cols_opt */ + case 353: /* expression_list */ + case 355: /* col_name_list */ + case 358: /* duration_list */ + case 359: /* rollup_func_list */ + case 370: /* func_list */ + case 385: /* dnode_list */ + case 389: /* literal_list */ + case 399: /* star_func_para_list */ + case 401: /* other_para_list */ + case 403: /* when_then_list */ + case 424: /* select_list */ + case 425: /* partition_by_clause_opt */ + case 430: /* group_by_clause_opt */ + case 433: /* partition_list */ + case 436: /* group_by_list */ + case 439: /* order_by_clause_opt */ + case 444: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy334)); + nodesDestroyList((yypminor->yy152)); } break; - case 333: /* alter_db_option */ - case 356: /* alter_table_option */ + case 337: /* alter_db_option */ + case 360: /* alter_table_option */ { } break; - case 345: /* type_name */ + case 349: /* type_name */ { } break; - case 403: /* compare_op */ - case 404: /* in_op */ + case 408: /* compare_op */ + case 409: /* in_op */ { } break; - case 415: /* join_type */ + case 420: /* join_type */ { } break; - case 428: /* fill_mode */ + case 435: /* fill_mode */ { } break; - case 439: /* ordering_specification_opt */ + case 446: /* ordering_specification_opt */ { } break; - case 440: /* null_ordering_opt */ + case 447: /* null_ordering_opt */ { } @@ -2910,515 +3012,525 @@ 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[] = { - { 313, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 313, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 314, 0 }, /* (2) account_options ::= */ - { 314, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 314, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 314, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 314, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 314, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 314, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 314, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 314, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 314, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 315, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 315, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 317, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 317, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 317, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 317, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 317, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 317, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 317, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 317, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 317, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 317, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 313, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 313, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 313, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 313, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 313, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 319, 0 }, /* (29) sysinfo_opt ::= */ - { 319, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 313, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 313, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 320, -1 }, /* (33) privileges ::= ALL */ - { 320, -1 }, /* (34) privileges ::= priv_type_list */ - { 322, -1 }, /* (35) priv_type_list ::= priv_type */ - { 322, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 323, -1 }, /* (37) priv_type ::= READ */ - { 323, -1 }, /* (38) priv_type ::= WRITE */ - { 321, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 321, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 313, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 313, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 313, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 313, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 313, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 313, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 313, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 313, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 325, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 325, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 325, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 313, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 313, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 313, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 313, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 313, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 313, -2 }, /* (64) cmd ::= USE db_name */ - { 313, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 313, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ - { 313, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ - { 326, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ - { 326, 0 }, /* (69) not_exists_opt ::= */ - { 328, -2 }, /* (70) exists_opt ::= IF EXISTS */ - { 328, 0 }, /* (71) exists_opt ::= */ - { 327, 0 }, /* (72) db_options ::= */ - { 327, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ - { 327, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ - { 327, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ - { 327, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ - { 327, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ - { 327, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ - { 327, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */ - { 327, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */ - { 327, -3 }, /* (81) db_options ::= db_options KEEP integer_list */ - { 327, -3 }, /* (82) db_options ::= db_options KEEP variable_list */ - { 327, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */ - { 327, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 327, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - { 327, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ - { 327, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ - { 327, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ - { 327, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */ - { 327, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 327, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */ - { 327, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 327, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - { 327, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - { 327, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { 327, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - { 327, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { 327, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - { 327, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { 327, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { 327, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - { 327, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ - { 327, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ - { 329, -1 }, /* (104) alter_db_options ::= alter_db_option */ - { 329, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */ - { 333, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */ - { 333, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 333, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 333, -2 }, /* (109) alter_db_option ::= KEEP integer_list */ - { 333, -2 }, /* (110) alter_db_option ::= KEEP variable_list */ - { 333, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 333, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 330, -1 }, /* (113) integer_list ::= NK_INTEGER */ - { 330, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 331, -1 }, /* (115) variable_list ::= NK_VARIABLE */ - { 331, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 332, -1 }, /* (117) retention_list ::= retention */ - { 332, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */ - { 334, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 313, -9 }, /* (120) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 313, -3 }, /* (121) cmd ::= CREATE TABLE multi_create_clause */ - { 313, -9 }, /* (122) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 313, -3 }, /* (123) cmd ::= DROP TABLE multi_drop_clause */ - { 313, -4 }, /* (124) cmd ::= DROP STABLE exists_opt full_table_name */ - { 313, -3 }, /* (125) cmd ::= ALTER TABLE alter_table_clause */ - { 313, -3 }, /* (126) cmd ::= ALTER STABLE alter_table_clause */ - { 342, -2 }, /* (127) alter_table_clause ::= full_table_name alter_table_options */ - { 342, -5 }, /* (128) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 342, -4 }, /* (129) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 342, -5 }, /* (130) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 342, -5 }, /* (131) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 342, -5 }, /* (132) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 342, -4 }, /* (133) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 342, -5 }, /* (134) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 342, -5 }, /* (135) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 342, -6 }, /* (136) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 339, -1 }, /* (137) multi_create_clause ::= create_subtable_clause */ - { 339, -2 }, /* (138) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 347, -10 }, /* (139) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - { 341, -1 }, /* (140) multi_drop_clause ::= drop_table_clause */ - { 341, -2 }, /* (141) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 350, -2 }, /* (142) drop_table_clause ::= exists_opt full_table_name */ - { 348, 0 }, /* (143) specific_cols_opt ::= */ - { 348, -3 }, /* (144) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 335, -1 }, /* (145) full_table_name ::= table_name */ - { 335, -3 }, /* (146) full_table_name ::= db_name NK_DOT table_name */ - { 336, -1 }, /* (147) column_def_list ::= column_def */ - { 336, -3 }, /* (148) column_def_list ::= column_def_list NK_COMMA column_def */ - { 353, -2 }, /* (149) column_def ::= column_name type_name */ - { 353, -4 }, /* (150) column_def ::= column_name type_name COMMENT NK_STRING */ - { 345, -1 }, /* (151) type_name ::= BOOL */ - { 345, -1 }, /* (152) type_name ::= TINYINT */ - { 345, -1 }, /* (153) type_name ::= SMALLINT */ - { 345, -1 }, /* (154) type_name ::= INT */ - { 345, -1 }, /* (155) type_name ::= INTEGER */ - { 345, -1 }, /* (156) type_name ::= BIGINT */ - { 345, -1 }, /* (157) type_name ::= FLOAT */ - { 345, -1 }, /* (158) type_name ::= DOUBLE */ - { 345, -4 }, /* (159) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 345, -1 }, /* (160) type_name ::= TIMESTAMP */ - { 345, -4 }, /* (161) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 345, -2 }, /* (162) type_name ::= TINYINT UNSIGNED */ - { 345, -2 }, /* (163) type_name ::= SMALLINT UNSIGNED */ - { 345, -2 }, /* (164) type_name ::= INT UNSIGNED */ - { 345, -2 }, /* (165) type_name ::= BIGINT UNSIGNED */ - { 345, -1 }, /* (166) type_name ::= JSON */ - { 345, -4 }, /* (167) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 345, -1 }, /* (168) type_name ::= MEDIUMBLOB */ - { 345, -1 }, /* (169) type_name ::= BLOB */ - { 345, -4 }, /* (170) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 345, -1 }, /* (171) type_name ::= DECIMAL */ - { 345, -4 }, /* (172) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 345, -6 }, /* (173) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 337, 0 }, /* (174) tags_def_opt ::= */ - { 337, -1 }, /* (175) tags_def_opt ::= tags_def */ - { 340, -4 }, /* (176) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 338, 0 }, /* (177) table_options ::= */ - { 338, -3 }, /* (178) table_options ::= table_options COMMENT NK_STRING */ - { 338, -3 }, /* (179) table_options ::= table_options MAX_DELAY duration_list */ - { 338, -3 }, /* (180) table_options ::= table_options WATERMARK duration_list */ - { 338, -5 }, /* (181) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 338, -3 }, /* (182) table_options ::= table_options TTL NK_INTEGER */ - { 338, -5 }, /* (183) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 343, -1 }, /* (184) alter_table_options ::= alter_table_option */ - { 343, -2 }, /* (185) alter_table_options ::= alter_table_options alter_table_option */ - { 356, -2 }, /* (186) alter_table_option ::= COMMENT NK_STRING */ - { 356, -2 }, /* (187) alter_table_option ::= TTL NK_INTEGER */ - { 354, -1 }, /* (188) duration_list ::= duration_literal */ - { 354, -3 }, /* (189) duration_list ::= duration_list NK_COMMA duration_literal */ - { 355, -1 }, /* (190) rollup_func_list ::= rollup_func_name */ - { 355, -3 }, /* (191) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 358, -1 }, /* (192) rollup_func_name ::= function_name */ - { 358, -1 }, /* (193) rollup_func_name ::= FIRST */ - { 358, -1 }, /* (194) rollup_func_name ::= LAST */ - { 351, -1 }, /* (195) col_name_list ::= col_name */ - { 351, -3 }, /* (196) col_name_list ::= col_name_list NK_COMMA col_name */ - { 360, -1 }, /* (197) col_name ::= column_name */ - { 313, -2 }, /* (198) cmd ::= SHOW DNODES */ - { 313, -2 }, /* (199) cmd ::= SHOW USERS */ - { 313, -2 }, /* (200) cmd ::= SHOW DATABASES */ - { 313, -4 }, /* (201) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 313, -4 }, /* (202) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 313, -3 }, /* (203) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 313, -2 }, /* (204) cmd ::= SHOW MNODES */ - { 313, -2 }, /* (205) cmd ::= SHOW MODULES */ - { 313, -2 }, /* (206) cmd ::= SHOW QNODES */ - { 313, -2 }, /* (207) cmd ::= SHOW FUNCTIONS */ - { 313, -5 }, /* (208) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 313, -2 }, /* (209) cmd ::= SHOW STREAMS */ - { 313, -2 }, /* (210) cmd ::= SHOW ACCOUNTS */ - { 313, -2 }, /* (211) cmd ::= SHOW APPS */ - { 313, -2 }, /* (212) cmd ::= SHOW CONNECTIONS */ - { 313, -2 }, /* (213) cmd ::= SHOW LICENCES */ - { 313, -2 }, /* (214) cmd ::= SHOW GRANTS */ - { 313, -4 }, /* (215) cmd ::= SHOW CREATE DATABASE db_name */ - { 313, -4 }, /* (216) cmd ::= SHOW CREATE TABLE full_table_name */ - { 313, -4 }, /* (217) cmd ::= SHOW CREATE STABLE full_table_name */ - { 313, -2 }, /* (218) cmd ::= SHOW QUERIES */ - { 313, -2 }, /* (219) cmd ::= SHOW SCORES */ - { 313, -2 }, /* (220) cmd ::= SHOW TOPICS */ - { 313, -2 }, /* (221) cmd ::= SHOW VARIABLES */ - { 313, -3 }, /* (222) cmd ::= SHOW LOCAL VARIABLES */ - { 313, -4 }, /* (223) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 313, -2 }, /* (224) cmd ::= SHOW BNODES */ - { 313, -2 }, /* (225) cmd ::= SHOW SNODES */ - { 313, -2 }, /* (226) cmd ::= SHOW CLUSTER */ - { 313, -2 }, /* (227) cmd ::= SHOW TRANSACTIONS */ - { 313, -4 }, /* (228) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 313, -2 }, /* (229) cmd ::= SHOW CONSUMERS */ - { 313, -2 }, /* (230) cmd ::= SHOW SUBSCRIPTIONS */ - { 313, -5 }, /* (231) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 313, -3 }, /* (232) cmd ::= SHOW VNODES NK_INTEGER */ - { 313, -3 }, /* (233) cmd ::= SHOW VNODES NK_STRING */ - { 361, 0 }, /* (234) db_name_cond_opt ::= */ - { 361, -2 }, /* (235) db_name_cond_opt ::= db_name NK_DOT */ - { 362, 0 }, /* (236) like_pattern_opt ::= */ - { 362, -2 }, /* (237) like_pattern_opt ::= LIKE NK_STRING */ - { 363, -1 }, /* (238) table_name_cond ::= table_name */ - { 364, 0 }, /* (239) from_db_opt ::= */ - { 364, -2 }, /* (240) from_db_opt ::= FROM db_name */ - { 313, -8 }, /* (241) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ - { 313, -4 }, /* (242) cmd ::= DROP INDEX exists_opt full_table_name */ - { 365, -10 }, /* (243) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 365, -12 }, /* (244) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 366, -1 }, /* (245) func_list ::= func */ - { 366, -3 }, /* (246) func_list ::= func_list NK_COMMA func */ - { 369, -4 }, /* (247) func ::= function_name NK_LP expression_list NK_RP */ - { 368, 0 }, /* (248) sma_stream_opt ::= */ - { 368, -3 }, /* (249) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 368, -3 }, /* (250) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 313, -6 }, /* (251) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 313, -7 }, /* (252) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 313, -9 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 313, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 313, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 313, -4 }, /* (256) cmd ::= DROP TOPIC exists_opt topic_name */ - { 313, -7 }, /* (257) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 313, -2 }, /* (258) cmd ::= DESC full_table_name */ - { 313, -2 }, /* (259) cmd ::= DESCRIBE full_table_name */ - { 313, -3 }, /* (260) cmd ::= RESET QUERY CACHE */ - { 313, -4 }, /* (261) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 374, 0 }, /* (262) analyze_opt ::= */ - { 374, -1 }, /* (263) analyze_opt ::= ANALYZE */ - { 375, 0 }, /* (264) explain_options ::= */ - { 375, -3 }, /* (265) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 375, -3 }, /* (266) explain_options ::= explain_options RATIO NK_FLOAT */ - { 313, -10 }, /* (267) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 313, -4 }, /* (268) cmd ::= DROP FUNCTION exists_opt function_name */ - { 376, 0 }, /* (269) agg_func_opt ::= */ - { 376, -1 }, /* (270) agg_func_opt ::= AGGREGATE */ - { 377, 0 }, /* (271) bufsize_opt ::= */ - { 377, -2 }, /* (272) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 313, -9 }, /* (273) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name AS query_or_subquery */ - { 313, -4 }, /* (274) cmd ::= DROP STREAM exists_opt stream_name */ - { 370, 0 }, /* (275) stream_options ::= */ - { 370, -3 }, /* (276) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 370, -3 }, /* (277) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 370, -4 }, /* (278) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 370, -3 }, /* (279) stream_options ::= stream_options WATERMARK duration_literal */ - { 370, -4 }, /* (280) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 313, -3 }, /* (281) cmd ::= KILL CONNECTION NK_INTEGER */ - { 313, -3 }, /* (282) cmd ::= KILL QUERY NK_STRING */ - { 313, -3 }, /* (283) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 313, -2 }, /* (284) cmd ::= BALANCE VGROUP */ - { 313, -4 }, /* (285) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 313, -4 }, /* (286) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 313, -3 }, /* (287) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 379, -2 }, /* (288) dnode_list ::= DNODE NK_INTEGER */ - { 379, -3 }, /* (289) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 313, -4 }, /* (290) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 313, -1 }, /* (291) cmd ::= query_or_subquery */ - { 313, -7 }, /* (292) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 313, -4 }, /* (293) cmd ::= INSERT INTO full_table_name query_or_subquery */ - { 316, -1 }, /* (294) literal ::= NK_INTEGER */ - { 316, -1 }, /* (295) literal ::= NK_FLOAT */ - { 316, -1 }, /* (296) literal ::= NK_STRING */ - { 316, -1 }, /* (297) literal ::= NK_BOOL */ - { 316, -2 }, /* (298) literal ::= TIMESTAMP NK_STRING */ - { 316, -1 }, /* (299) literal ::= duration_literal */ - { 316, -1 }, /* (300) literal ::= NULL */ - { 316, -1 }, /* (301) literal ::= NK_QUESTION */ - { 357, -1 }, /* (302) duration_literal ::= NK_VARIABLE */ - { 381, -1 }, /* (303) signed ::= NK_INTEGER */ - { 381, -2 }, /* (304) signed ::= NK_PLUS NK_INTEGER */ - { 381, -2 }, /* (305) signed ::= NK_MINUS NK_INTEGER */ - { 381, -1 }, /* (306) signed ::= NK_FLOAT */ - { 381, -2 }, /* (307) signed ::= NK_PLUS NK_FLOAT */ - { 381, -2 }, /* (308) signed ::= NK_MINUS NK_FLOAT */ - { 346, -1 }, /* (309) signed_literal ::= signed */ - { 346, -1 }, /* (310) signed_literal ::= NK_STRING */ - { 346, -1 }, /* (311) signed_literal ::= NK_BOOL */ - { 346, -2 }, /* (312) signed_literal ::= TIMESTAMP NK_STRING */ - { 346, -1 }, /* (313) signed_literal ::= duration_literal */ - { 346, -1 }, /* (314) signed_literal ::= NULL */ - { 346, -1 }, /* (315) signed_literal ::= literal_func */ - { 346, -1 }, /* (316) signed_literal ::= NK_QUESTION */ - { 383, -1 }, /* (317) literal_list ::= signed_literal */ - { 383, -3 }, /* (318) literal_list ::= literal_list NK_COMMA signed_literal */ - { 324, -1 }, /* (319) db_name ::= NK_ID */ - { 352, -1 }, /* (320) table_name ::= NK_ID */ - { 344, -1 }, /* (321) column_name ::= NK_ID */ - { 359, -1 }, /* (322) function_name ::= NK_ID */ - { 384, -1 }, /* (323) table_alias ::= NK_ID */ - { 385, -1 }, /* (324) column_alias ::= NK_ID */ - { 318, -1 }, /* (325) user_name ::= NK_ID */ - { 371, -1 }, /* (326) topic_name ::= NK_ID */ - { 378, -1 }, /* (327) stream_name ::= NK_ID */ - { 373, -1 }, /* (328) cgroup_name ::= NK_ID */ - { 386, -1 }, /* (329) expr_or_subquery ::= expression */ - { 386, -1 }, /* (330) expr_or_subquery ::= subquery */ - { 387, -1 }, /* (331) expression ::= literal */ - { 387, -1 }, /* (332) expression ::= pseudo_column */ - { 387, -1 }, /* (333) expression ::= column_reference */ - { 387, -1 }, /* (334) expression ::= function_expression */ - { 387, -1 }, /* (335) expression ::= case_when_expression */ - { 387, -3 }, /* (336) expression ::= NK_LP expression NK_RP */ - { 387, -2 }, /* (337) expression ::= NK_PLUS expr_or_subquery */ - { 387, -2 }, /* (338) expression ::= NK_MINUS expr_or_subquery */ - { 387, -3 }, /* (339) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 387, -3 }, /* (340) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 387, -3 }, /* (341) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 387, -3 }, /* (342) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 387, -3 }, /* (343) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 387, -3 }, /* (344) expression ::= column_reference NK_ARROW NK_STRING */ - { 387, -3 }, /* (345) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 387, -3 }, /* (346) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 349, -1 }, /* (347) expression_list ::= expr_or_subquery */ - { 349, -3 }, /* (348) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 390, -1 }, /* (349) column_reference ::= column_name */ - { 390, -3 }, /* (350) column_reference ::= table_name NK_DOT column_name */ - { 389, -1 }, /* (351) pseudo_column ::= ROWTS */ - { 389, -1 }, /* (352) pseudo_column ::= TBNAME */ - { 389, -3 }, /* (353) pseudo_column ::= table_name NK_DOT TBNAME */ - { 389, -1 }, /* (354) pseudo_column ::= QSTART */ - { 389, -1 }, /* (355) pseudo_column ::= QEND */ - { 389, -1 }, /* (356) pseudo_column ::= QDURATION */ - { 389, -1 }, /* (357) pseudo_column ::= WSTART */ - { 389, -1 }, /* (358) pseudo_column ::= WEND */ - { 389, -1 }, /* (359) pseudo_column ::= WDURATION */ - { 391, -4 }, /* (360) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 391, -4 }, /* (361) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 391, -6 }, /* (362) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 391, -1 }, /* (363) function_expression ::= literal_func */ - { 382, -3 }, /* (364) literal_func ::= noarg_func NK_LP NK_RP */ - { 382, -1 }, /* (365) literal_func ::= NOW */ - { 395, -1 }, /* (366) noarg_func ::= NOW */ - { 395, -1 }, /* (367) noarg_func ::= TODAY */ - { 395, -1 }, /* (368) noarg_func ::= TIMEZONE */ - { 395, -1 }, /* (369) noarg_func ::= DATABASE */ - { 395, -1 }, /* (370) noarg_func ::= CLIENT_VERSION */ - { 395, -1 }, /* (371) noarg_func ::= SERVER_VERSION */ - { 395, -1 }, /* (372) noarg_func ::= SERVER_STATUS */ - { 395, -1 }, /* (373) noarg_func ::= CURRENT_USER */ - { 395, -1 }, /* (374) noarg_func ::= USER */ - { 393, -1 }, /* (375) star_func ::= COUNT */ - { 393, -1 }, /* (376) star_func ::= FIRST */ - { 393, -1 }, /* (377) star_func ::= LAST */ - { 393, -1 }, /* (378) star_func ::= LAST_ROW */ - { 394, -1 }, /* (379) star_func_para_list ::= NK_STAR */ - { 394, -1 }, /* (380) star_func_para_list ::= other_para_list */ - { 396, -1 }, /* (381) other_para_list ::= star_func_para */ - { 396, -3 }, /* (382) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 397, -1 }, /* (383) star_func_para ::= expr_or_subquery */ - { 397, -3 }, /* (384) star_func_para ::= table_name NK_DOT NK_STAR */ - { 392, -4 }, /* (385) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 392, -5 }, /* (386) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 398, -1 }, /* (387) when_then_list ::= when_then_expr */ - { 398, -2 }, /* (388) when_then_list ::= when_then_list when_then_expr */ - { 401, -4 }, /* (389) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 399, 0 }, /* (390) case_when_else_opt ::= */ - { 399, -2 }, /* (391) case_when_else_opt ::= ELSE common_expression */ - { 402, -3 }, /* (392) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 402, -5 }, /* (393) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 402, -6 }, /* (394) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 402, -3 }, /* (395) predicate ::= expr_or_subquery IS NULL */ - { 402, -4 }, /* (396) predicate ::= expr_or_subquery IS NOT NULL */ - { 402, -3 }, /* (397) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 403, -1 }, /* (398) compare_op ::= NK_LT */ - { 403, -1 }, /* (399) compare_op ::= NK_GT */ - { 403, -1 }, /* (400) compare_op ::= NK_LE */ - { 403, -1 }, /* (401) compare_op ::= NK_GE */ - { 403, -1 }, /* (402) compare_op ::= NK_NE */ - { 403, -1 }, /* (403) compare_op ::= NK_EQ */ - { 403, -1 }, /* (404) compare_op ::= LIKE */ - { 403, -2 }, /* (405) compare_op ::= NOT LIKE */ - { 403, -1 }, /* (406) compare_op ::= MATCH */ - { 403, -1 }, /* (407) compare_op ::= NMATCH */ - { 403, -1 }, /* (408) compare_op ::= CONTAINS */ - { 404, -1 }, /* (409) in_op ::= IN */ - { 404, -2 }, /* (410) in_op ::= NOT IN */ - { 405, -3 }, /* (411) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 406, -1 }, /* (412) boolean_value_expression ::= boolean_primary */ - { 406, -2 }, /* (413) boolean_value_expression ::= NOT boolean_primary */ - { 406, -3 }, /* (414) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 406, -3 }, /* (415) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 407, -1 }, /* (416) boolean_primary ::= predicate */ - { 407, -3 }, /* (417) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 400, -1 }, /* (418) common_expression ::= expr_or_subquery */ - { 400, -1 }, /* (419) common_expression ::= boolean_value_expression */ - { 408, 0 }, /* (420) from_clause_opt ::= */ - { 408, -2 }, /* (421) from_clause_opt ::= FROM table_reference_list */ - { 409, -1 }, /* (422) table_reference_list ::= table_reference */ - { 409, -3 }, /* (423) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 410, -1 }, /* (424) table_reference ::= table_primary */ - { 410, -1 }, /* (425) table_reference ::= joined_table */ - { 411, -2 }, /* (426) table_primary ::= table_name alias_opt */ - { 411, -4 }, /* (427) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 411, -2 }, /* (428) table_primary ::= subquery alias_opt */ - { 411, -1 }, /* (429) table_primary ::= parenthesized_joined_table */ - { 413, 0 }, /* (430) alias_opt ::= */ - { 413, -1 }, /* (431) alias_opt ::= table_alias */ - { 413, -2 }, /* (432) alias_opt ::= AS table_alias */ - { 414, -3 }, /* (433) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 414, -3 }, /* (434) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 412, -6 }, /* (435) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 415, 0 }, /* (436) join_type ::= */ - { 415, -1 }, /* (437) join_type ::= INNER */ - { 417, -12 }, /* (438) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 418, 0 }, /* (439) set_quantifier_opt ::= */ - { 418, -1 }, /* (440) set_quantifier_opt ::= DISTINCT */ - { 418, -1 }, /* (441) set_quantifier_opt ::= ALL */ - { 419, -1 }, /* (442) select_list ::= select_item */ - { 419, -3 }, /* (443) select_list ::= select_list NK_COMMA select_item */ - { 427, -1 }, /* (444) select_item ::= NK_STAR */ - { 427, -1 }, /* (445) select_item ::= common_expression */ - { 427, -2 }, /* (446) select_item ::= common_expression column_alias */ - { 427, -3 }, /* (447) select_item ::= common_expression AS column_alias */ - { 427, -3 }, /* (448) select_item ::= table_name NK_DOT NK_STAR */ - { 380, 0 }, /* (449) where_clause_opt ::= */ - { 380, -2 }, /* (450) where_clause_opt ::= WHERE search_condition */ - { 420, 0 }, /* (451) partition_by_clause_opt ::= */ - { 420, -3 }, /* (452) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 424, 0 }, /* (453) twindow_clause_opt ::= */ - { 424, -6 }, /* (454) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 424, -4 }, /* (455) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 424, -6 }, /* (456) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 424, -8 }, /* (457) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 367, 0 }, /* (458) sliding_opt ::= */ - { 367, -4 }, /* (459) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 423, 0 }, /* (460) fill_opt ::= */ - { 423, -4 }, /* (461) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 423, -6 }, /* (462) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 428, -1 }, /* (463) fill_mode ::= NONE */ - { 428, -1 }, /* (464) fill_mode ::= PREV */ - { 428, -1 }, /* (465) fill_mode ::= NULL */ - { 428, -1 }, /* (466) fill_mode ::= LINEAR */ - { 428, -1 }, /* (467) fill_mode ::= NEXT */ - { 425, 0 }, /* (468) group_by_clause_opt ::= */ - { 425, -3 }, /* (469) group_by_clause_opt ::= GROUP BY group_by_list */ - { 429, -1 }, /* (470) group_by_list ::= expr_or_subquery */ - { 429, -3 }, /* (471) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 426, 0 }, /* (472) having_clause_opt ::= */ - { 426, -2 }, /* (473) having_clause_opt ::= HAVING search_condition */ - { 421, 0 }, /* (474) range_opt ::= */ - { 421, -6 }, /* (475) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 422, 0 }, /* (476) every_opt ::= */ - { 422, -4 }, /* (477) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 430, -4 }, /* (478) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 431, -1 }, /* (479) query_simple ::= query_specification */ - { 431, -1 }, /* (480) query_simple ::= union_query_expression */ - { 435, -4 }, /* (481) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 435, -3 }, /* (482) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 436, -1 }, /* (483) query_simple_or_subquery ::= query_simple */ - { 436, -1 }, /* (484) query_simple_or_subquery ::= subquery */ - { 372, -1 }, /* (485) query_or_subquery ::= query_expression */ - { 372, -1 }, /* (486) query_or_subquery ::= subquery */ - { 432, 0 }, /* (487) order_by_clause_opt ::= */ - { 432, -3 }, /* (488) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 433, 0 }, /* (489) slimit_clause_opt ::= */ - { 433, -2 }, /* (490) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 433, -4 }, /* (491) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 433, -4 }, /* (492) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 434, 0 }, /* (493) limit_clause_opt ::= */ - { 434, -2 }, /* (494) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 434, -4 }, /* (495) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 434, -4 }, /* (496) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 388, -3 }, /* (497) subquery ::= NK_LP query_expression NK_RP */ - { 388, -3 }, /* (498) subquery ::= NK_LP subquery NK_RP */ - { 416, -1 }, /* (499) search_condition ::= common_expression */ - { 437, -1 }, /* (500) sort_specification_list ::= sort_specification */ - { 437, -3 }, /* (501) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 438, -3 }, /* (502) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 439, 0 }, /* (503) ordering_specification_opt ::= */ - { 439, -1 }, /* (504) ordering_specification_opt ::= ASC */ - { 439, -1 }, /* (505) ordering_specification_opt ::= DESC */ - { 440, 0 }, /* (506) null_ordering_opt ::= */ - { 440, -2 }, /* (507) null_ordering_opt ::= NULLS FIRST */ - { 440, -2 }, /* (508) null_ordering_opt ::= NULLS LAST */ + { 316, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 316, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 317, 0 }, /* (2) account_options ::= */ + { 317, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 317, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 317, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 317, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 317, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 317, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 317, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 317, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 317, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 318, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 318, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 320, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 320, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 320, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 320, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 320, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 320, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 320, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 320, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 320, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 320, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 316, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 316, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 316, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 316, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 316, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 322, 0 }, /* (29) sysinfo_opt ::= */ + { 322, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 316, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 316, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 323, -1 }, /* (33) privileges ::= ALL */ + { 323, -1 }, /* (34) privileges ::= priv_type_list */ + { 325, -1 }, /* (35) priv_type_list ::= priv_type */ + { 325, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 326, -1 }, /* (37) priv_type ::= READ */ + { 326, -1 }, /* (38) priv_type ::= WRITE */ + { 324, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 324, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 316, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 316, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 316, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 316, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 316, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 316, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 316, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 316, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 328, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 328, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 328, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 316, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 316, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 316, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 316, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 316, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 316, -2 }, /* (64) cmd ::= USE db_name */ + { 316, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 316, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ + { 316, -4 }, /* (67) cmd ::= TRIM DATABASE db_name speed_opt */ + { 329, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ + { 329, 0 }, /* (69) not_exists_opt ::= */ + { 331, -2 }, /* (70) exists_opt ::= IF EXISTS */ + { 331, 0 }, /* (71) exists_opt ::= */ + { 330, 0 }, /* (72) db_options ::= */ + { 330, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ + { 330, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ + { 330, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ + { 330, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ + { 330, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ + { 330, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ + { 330, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */ + { 330, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */ + { 330, -3 }, /* (81) db_options ::= db_options KEEP integer_list */ + { 330, -3 }, /* (82) db_options ::= db_options KEEP variable_list */ + { 330, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */ + { 330, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 330, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + { 330, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ + { 330, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ + { 330, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ + { 330, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */ + { 330, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 330, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */ + { 330, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 330, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + { 330, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + { 330, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 330, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 330, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 330, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 330, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 330, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 330, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + { 330, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + { 330, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + { 332, -1 }, /* (104) alter_db_options ::= alter_db_option */ + { 332, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */ + { 337, -2 }, /* (106) alter_db_option ::= CACHEMODEL NK_STRING */ + { 337, -2 }, /* (107) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 337, -2 }, /* (108) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 337, -2 }, /* (109) alter_db_option ::= KEEP integer_list */ + { 337, -2 }, /* (110) alter_db_option ::= KEEP variable_list */ + { 337, -2 }, /* (111) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 337, -2 }, /* (112) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 334, -1 }, /* (113) integer_list ::= NK_INTEGER */ + { 334, -3 }, /* (114) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 335, -1 }, /* (115) variable_list ::= NK_VARIABLE */ + { 335, -3 }, /* (116) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 336, -1 }, /* (117) retention_list ::= retention */ + { 336, -3 }, /* (118) retention_list ::= retention_list NK_COMMA retention */ + { 338, -3 }, /* (119) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 333, 0 }, /* (120) speed_opt ::= */ + { 333, -2 }, /* (121) speed_opt ::= MAX_SPEED NK_INTEGER */ + { 316, -9 }, /* (122) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 316, -3 }, /* (123) cmd ::= CREATE TABLE multi_create_clause */ + { 316, -9 }, /* (124) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 316, -3 }, /* (125) cmd ::= DROP TABLE multi_drop_clause */ + { 316, -4 }, /* (126) cmd ::= DROP STABLE exists_opt full_table_name */ + { 316, -3 }, /* (127) cmd ::= ALTER TABLE alter_table_clause */ + { 316, -3 }, /* (128) cmd ::= ALTER STABLE alter_table_clause */ + { 346, -2 }, /* (129) alter_table_clause ::= full_table_name alter_table_options */ + { 346, -5 }, /* (130) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 346, -4 }, /* (131) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 346, -5 }, /* (132) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 346, -5 }, /* (133) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 346, -5 }, /* (134) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 346, -4 }, /* (135) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 346, -5 }, /* (136) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 346, -5 }, /* (137) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 346, -6 }, /* (138) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 343, -1 }, /* (139) multi_create_clause ::= create_subtable_clause */ + { 343, -2 }, /* (140) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 351, -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 */ + { 345, -1 }, /* (142) multi_drop_clause ::= drop_table_clause */ + { 345, -2 }, /* (143) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 354, -2 }, /* (144) drop_table_clause ::= exists_opt full_table_name */ + { 352, 0 }, /* (145) specific_cols_opt ::= */ + { 352, -3 }, /* (146) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 339, -1 }, /* (147) full_table_name ::= table_name */ + { 339, -3 }, /* (148) full_table_name ::= db_name NK_DOT table_name */ + { 340, -1 }, /* (149) column_def_list ::= column_def */ + { 340, -3 }, /* (150) column_def_list ::= column_def_list NK_COMMA column_def */ + { 357, -2 }, /* (151) column_def ::= column_name type_name */ + { 357, -4 }, /* (152) column_def ::= column_name type_name COMMENT NK_STRING */ + { 349, -1 }, /* (153) type_name ::= BOOL */ + { 349, -1 }, /* (154) type_name ::= TINYINT */ + { 349, -1 }, /* (155) type_name ::= SMALLINT */ + { 349, -1 }, /* (156) type_name ::= INT */ + { 349, -1 }, /* (157) type_name ::= INTEGER */ + { 349, -1 }, /* (158) type_name ::= BIGINT */ + { 349, -1 }, /* (159) type_name ::= FLOAT */ + { 349, -1 }, /* (160) type_name ::= DOUBLE */ + { 349, -4 }, /* (161) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 349, -1 }, /* (162) type_name ::= TIMESTAMP */ + { 349, -4 }, /* (163) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 349, -2 }, /* (164) type_name ::= TINYINT UNSIGNED */ + { 349, -2 }, /* (165) type_name ::= SMALLINT UNSIGNED */ + { 349, -2 }, /* (166) type_name ::= INT UNSIGNED */ + { 349, -2 }, /* (167) type_name ::= BIGINT UNSIGNED */ + { 349, -1 }, /* (168) type_name ::= JSON */ + { 349, -4 }, /* (169) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 349, -1 }, /* (170) type_name ::= MEDIUMBLOB */ + { 349, -1 }, /* (171) type_name ::= BLOB */ + { 349, -4 }, /* (172) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 349, -1 }, /* (173) type_name ::= DECIMAL */ + { 349, -4 }, /* (174) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 349, -6 }, /* (175) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 341, 0 }, /* (176) tags_def_opt ::= */ + { 341, -1 }, /* (177) tags_def_opt ::= tags_def */ + { 344, -4 }, /* (178) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 342, 0 }, /* (179) table_options ::= */ + { 342, -3 }, /* (180) table_options ::= table_options COMMENT NK_STRING */ + { 342, -3 }, /* (181) table_options ::= table_options MAX_DELAY duration_list */ + { 342, -3 }, /* (182) table_options ::= table_options WATERMARK duration_list */ + { 342, -5 }, /* (183) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 342, -3 }, /* (184) table_options ::= table_options TTL NK_INTEGER */ + { 342, -5 }, /* (185) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 347, -1 }, /* (186) alter_table_options ::= alter_table_option */ + { 347, -2 }, /* (187) alter_table_options ::= alter_table_options alter_table_option */ + { 360, -2 }, /* (188) alter_table_option ::= COMMENT NK_STRING */ + { 360, -2 }, /* (189) alter_table_option ::= TTL NK_INTEGER */ + { 358, -1 }, /* (190) duration_list ::= duration_literal */ + { 358, -3 }, /* (191) duration_list ::= duration_list NK_COMMA duration_literal */ + { 359, -1 }, /* (192) rollup_func_list ::= rollup_func_name */ + { 359, -3 }, /* (193) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 362, -1 }, /* (194) rollup_func_name ::= function_name */ + { 362, -1 }, /* (195) rollup_func_name ::= FIRST */ + { 362, -1 }, /* (196) rollup_func_name ::= LAST */ + { 355, -1 }, /* (197) col_name_list ::= col_name */ + { 355, -3 }, /* (198) col_name_list ::= col_name_list NK_COMMA col_name */ + { 364, -1 }, /* (199) col_name ::= column_name */ + { 316, -2 }, /* (200) cmd ::= SHOW DNODES */ + { 316, -2 }, /* (201) cmd ::= SHOW USERS */ + { 316, -2 }, /* (202) cmd ::= SHOW DATABASES */ + { 316, -4 }, /* (203) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 316, -4 }, /* (204) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 316, -3 }, /* (205) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 316, -2 }, /* (206) cmd ::= SHOW MNODES */ + { 316, -2 }, /* (207) cmd ::= SHOW MODULES */ + { 316, -2 }, /* (208) cmd ::= SHOW QNODES */ + { 316, -2 }, /* (209) cmd ::= SHOW FUNCTIONS */ + { 316, -5 }, /* (210) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 316, -2 }, /* (211) cmd ::= SHOW STREAMS */ + { 316, -2 }, /* (212) cmd ::= SHOW ACCOUNTS */ + { 316, -2 }, /* (213) cmd ::= SHOW APPS */ + { 316, -2 }, /* (214) cmd ::= SHOW CONNECTIONS */ + { 316, -2 }, /* (215) cmd ::= SHOW LICENCES */ + { 316, -2 }, /* (216) cmd ::= SHOW GRANTS */ + { 316, -4 }, /* (217) cmd ::= SHOW CREATE DATABASE db_name */ + { 316, -4 }, /* (218) cmd ::= SHOW CREATE TABLE full_table_name */ + { 316, -4 }, /* (219) cmd ::= SHOW CREATE STABLE full_table_name */ + { 316, -2 }, /* (220) cmd ::= SHOW QUERIES */ + { 316, -2 }, /* (221) cmd ::= SHOW SCORES */ + { 316, -2 }, /* (222) cmd ::= SHOW TOPICS */ + { 316, -2 }, /* (223) cmd ::= SHOW VARIABLES */ + { 316, -3 }, /* (224) cmd ::= SHOW LOCAL VARIABLES */ + { 316, -4 }, /* (225) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 316, -2 }, /* (226) cmd ::= SHOW BNODES */ + { 316, -2 }, /* (227) cmd ::= SHOW SNODES */ + { 316, -2 }, /* (228) cmd ::= SHOW CLUSTER */ + { 316, -2 }, /* (229) cmd ::= SHOW TRANSACTIONS */ + { 316, -4 }, /* (230) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 316, -2 }, /* (231) cmd ::= SHOW CONSUMERS */ + { 316, -2 }, /* (232) cmd ::= SHOW SUBSCRIPTIONS */ + { 316, -5 }, /* (233) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 316, -3 }, /* (234) cmd ::= SHOW VNODES NK_INTEGER */ + { 316, -3 }, /* (235) cmd ::= SHOW VNODES NK_STRING */ + { 365, 0 }, /* (236) db_name_cond_opt ::= */ + { 365, -2 }, /* (237) db_name_cond_opt ::= db_name NK_DOT */ + { 366, 0 }, /* (238) like_pattern_opt ::= */ + { 366, -2 }, /* (239) like_pattern_opt ::= LIKE NK_STRING */ + { 367, -1 }, /* (240) table_name_cond ::= table_name */ + { 368, 0 }, /* (241) from_db_opt ::= */ + { 368, -2 }, /* (242) from_db_opt ::= FROM db_name */ + { 316, -8 }, /* (243) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + { 316, -4 }, /* (244) cmd ::= DROP INDEX exists_opt full_table_name */ + { 369, -10 }, /* (245) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 369, -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 */ + { 370, -1 }, /* (247) func_list ::= func */ + { 370, -3 }, /* (248) func_list ::= func_list NK_COMMA func */ + { 373, -4 }, /* (249) func ::= function_name NK_LP expression_list NK_RP */ + { 372, 0 }, /* (250) sma_stream_opt ::= */ + { 372, -3 }, /* (251) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 372, -3 }, /* (252) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 316, -6 }, /* (253) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 316, -7 }, /* (254) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 316, -9 }, /* (255) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 316, -7 }, /* (256) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 316, -9 }, /* (257) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 316, -4 }, /* (258) cmd ::= DROP TOPIC exists_opt topic_name */ + { 316, -7 }, /* (259) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 316, -2 }, /* (260) cmd ::= DESC full_table_name */ + { 316, -2 }, /* (261) cmd ::= DESCRIBE full_table_name */ + { 316, -3 }, /* (262) cmd ::= RESET QUERY CACHE */ + { 316, -4 }, /* (263) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 378, 0 }, /* (264) analyze_opt ::= */ + { 378, -1 }, /* (265) analyze_opt ::= ANALYZE */ + { 379, 0 }, /* (266) explain_options ::= */ + { 379, -3 }, /* (267) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 379, -3 }, /* (268) explain_options ::= explain_options RATIO NK_FLOAT */ + { 316, -10 }, /* (269) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 316, -4 }, /* (270) cmd ::= DROP FUNCTION exists_opt function_name */ + { 380, 0 }, /* (271) agg_func_opt ::= */ + { 380, -1 }, /* (272) agg_func_opt ::= AGGREGATE */ + { 381, 0 }, /* (273) bufsize_opt ::= */ + { 381, -2 }, /* (274) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 316, -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 */ + { 316, -4 }, /* (276) cmd ::= DROP STREAM exists_opt stream_name */ + { 374, 0 }, /* (277) stream_options ::= */ + { 374, -3 }, /* (278) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 374, -3 }, /* (279) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 374, -4 }, /* (280) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 374, -3 }, /* (281) stream_options ::= stream_options WATERMARK duration_literal */ + { 374, -4 }, /* (282) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 383, 0 }, /* (283) subtable_opt ::= */ + { 383, -4 }, /* (284) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 316, -3 }, /* (285) cmd ::= KILL CONNECTION NK_INTEGER */ + { 316, -3 }, /* (286) cmd ::= KILL QUERY NK_STRING */ + { 316, -3 }, /* (287) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 316, -2 }, /* (288) cmd ::= BALANCE VGROUP */ + { 316, -4 }, /* (289) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 316, -4 }, /* (290) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 316, -3 }, /* (291) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 385, -2 }, /* (292) dnode_list ::= DNODE NK_INTEGER */ + { 385, -3 }, /* (293) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 316, -4 }, /* (294) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 316, -1 }, /* (295) cmd ::= query_or_subquery */ + { 316, -7 }, /* (296) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 316, -4 }, /* (297) cmd ::= INSERT INTO full_table_name query_or_subquery */ + { 319, -1 }, /* (298) literal ::= NK_INTEGER */ + { 319, -1 }, /* (299) literal ::= NK_FLOAT */ + { 319, -1 }, /* (300) literal ::= NK_STRING */ + { 319, -1 }, /* (301) literal ::= NK_BOOL */ + { 319, -2 }, /* (302) literal ::= TIMESTAMP NK_STRING */ + { 319, -1 }, /* (303) literal ::= duration_literal */ + { 319, -1 }, /* (304) literal ::= NULL */ + { 319, -1 }, /* (305) literal ::= NK_QUESTION */ + { 361, -1 }, /* (306) duration_literal ::= NK_VARIABLE */ + { 387, -1 }, /* (307) signed ::= NK_INTEGER */ + { 387, -2 }, /* (308) signed ::= NK_PLUS NK_INTEGER */ + { 387, -2 }, /* (309) signed ::= NK_MINUS NK_INTEGER */ + { 387, -1 }, /* (310) signed ::= NK_FLOAT */ + { 387, -2 }, /* (311) signed ::= NK_PLUS NK_FLOAT */ + { 387, -2 }, /* (312) signed ::= NK_MINUS NK_FLOAT */ + { 350, -1 }, /* (313) signed_literal ::= signed */ + { 350, -1 }, /* (314) signed_literal ::= NK_STRING */ + { 350, -1 }, /* (315) signed_literal ::= NK_BOOL */ + { 350, -2 }, /* (316) signed_literal ::= TIMESTAMP NK_STRING */ + { 350, -1 }, /* (317) signed_literal ::= duration_literal */ + { 350, -1 }, /* (318) signed_literal ::= NULL */ + { 350, -1 }, /* (319) signed_literal ::= literal_func */ + { 350, -1 }, /* (320) signed_literal ::= NK_QUESTION */ + { 389, -1 }, /* (321) literal_list ::= signed_literal */ + { 389, -3 }, /* (322) literal_list ::= literal_list NK_COMMA signed_literal */ + { 327, -1 }, /* (323) db_name ::= NK_ID */ + { 356, -1 }, /* (324) table_name ::= NK_ID */ + { 348, -1 }, /* (325) column_name ::= NK_ID */ + { 363, -1 }, /* (326) function_name ::= NK_ID */ + { 390, -1 }, /* (327) table_alias ::= NK_ID */ + { 391, -1 }, /* (328) column_alias ::= NK_ID */ + { 321, -1 }, /* (329) user_name ::= NK_ID */ + { 375, -1 }, /* (330) topic_name ::= NK_ID */ + { 382, -1 }, /* (331) stream_name ::= NK_ID */ + { 377, -1 }, /* (332) cgroup_name ::= NK_ID */ + { 392, -1 }, /* (333) expr_or_subquery ::= expression */ + { 392, -1 }, /* (334) expr_or_subquery ::= subquery */ + { 384, -1 }, /* (335) expression ::= literal */ + { 384, -1 }, /* (336) expression ::= pseudo_column */ + { 384, -1 }, /* (337) expression ::= column_reference */ + { 384, -1 }, /* (338) expression ::= function_expression */ + { 384, -1 }, /* (339) expression ::= case_when_expression */ + { 384, -3 }, /* (340) expression ::= NK_LP expression NK_RP */ + { 384, -2 }, /* (341) expression ::= NK_PLUS expr_or_subquery */ + { 384, -2 }, /* (342) expression ::= NK_MINUS expr_or_subquery */ + { 384, -3 }, /* (343) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 384, -3 }, /* (344) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 384, -3 }, /* (345) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 384, -3 }, /* (346) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 384, -3 }, /* (347) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 384, -3 }, /* (348) expression ::= column_reference NK_ARROW NK_STRING */ + { 384, -3 }, /* (349) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 384, -3 }, /* (350) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 353, -1 }, /* (351) expression_list ::= expr_or_subquery */ + { 353, -3 }, /* (352) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 395, -1 }, /* (353) column_reference ::= column_name */ + { 395, -3 }, /* (354) column_reference ::= table_name NK_DOT column_name */ + { 394, -1 }, /* (355) pseudo_column ::= ROWTS */ + { 394, -1 }, /* (356) pseudo_column ::= TBNAME */ + { 394, -3 }, /* (357) pseudo_column ::= table_name NK_DOT TBNAME */ + { 394, -1 }, /* (358) pseudo_column ::= QSTART */ + { 394, -1 }, /* (359) pseudo_column ::= QEND */ + { 394, -1 }, /* (360) pseudo_column ::= QDURATION */ + { 394, -1 }, /* (361) pseudo_column ::= WSTART */ + { 394, -1 }, /* (362) pseudo_column ::= WEND */ + { 394, -1 }, /* (363) pseudo_column ::= WDURATION */ + { 394, -1 }, /* (364) pseudo_column ::= IROWTS */ + { 396, -4 }, /* (365) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 396, -4 }, /* (366) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 396, -6 }, /* (367) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 396, -1 }, /* (368) function_expression ::= literal_func */ + { 388, -3 }, /* (369) literal_func ::= noarg_func NK_LP NK_RP */ + { 388, -1 }, /* (370) literal_func ::= NOW */ + { 400, -1 }, /* (371) noarg_func ::= NOW */ + { 400, -1 }, /* (372) noarg_func ::= TODAY */ + { 400, -1 }, /* (373) noarg_func ::= TIMEZONE */ + { 400, -1 }, /* (374) noarg_func ::= DATABASE */ + { 400, -1 }, /* (375) noarg_func ::= CLIENT_VERSION */ + { 400, -1 }, /* (376) noarg_func ::= SERVER_VERSION */ + { 400, -1 }, /* (377) noarg_func ::= SERVER_STATUS */ + { 400, -1 }, /* (378) noarg_func ::= CURRENT_USER */ + { 400, -1 }, /* (379) noarg_func ::= USER */ + { 398, -1 }, /* (380) star_func ::= COUNT */ + { 398, -1 }, /* (381) star_func ::= FIRST */ + { 398, -1 }, /* (382) star_func ::= LAST */ + { 398, -1 }, /* (383) star_func ::= LAST_ROW */ + { 399, -1 }, /* (384) star_func_para_list ::= NK_STAR */ + { 399, -1 }, /* (385) star_func_para_list ::= other_para_list */ + { 401, -1 }, /* (386) other_para_list ::= star_func_para */ + { 401, -3 }, /* (387) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 402, -1 }, /* (388) star_func_para ::= expr_or_subquery */ + { 402, -3 }, /* (389) star_func_para ::= table_name NK_DOT NK_STAR */ + { 397, -4 }, /* (390) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 397, -5 }, /* (391) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 403, -1 }, /* (392) when_then_list ::= when_then_expr */ + { 403, -2 }, /* (393) when_then_list ::= when_then_list when_then_expr */ + { 406, -4 }, /* (394) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 404, 0 }, /* (395) case_when_else_opt ::= */ + { 404, -2 }, /* (396) case_when_else_opt ::= ELSE common_expression */ + { 407, -3 }, /* (397) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 407, -5 }, /* (398) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 407, -6 }, /* (399) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 407, -3 }, /* (400) predicate ::= expr_or_subquery IS NULL */ + { 407, -4 }, /* (401) predicate ::= expr_or_subquery IS NOT NULL */ + { 407, -3 }, /* (402) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 408, -1 }, /* (403) compare_op ::= NK_LT */ + { 408, -1 }, /* (404) compare_op ::= NK_GT */ + { 408, -1 }, /* (405) compare_op ::= NK_LE */ + { 408, -1 }, /* (406) compare_op ::= NK_GE */ + { 408, -1 }, /* (407) compare_op ::= NK_NE */ + { 408, -1 }, /* (408) compare_op ::= NK_EQ */ + { 408, -1 }, /* (409) compare_op ::= LIKE */ + { 408, -2 }, /* (410) compare_op ::= NOT LIKE */ + { 408, -1 }, /* (411) compare_op ::= MATCH */ + { 408, -1 }, /* (412) compare_op ::= NMATCH */ + { 408, -1 }, /* (413) compare_op ::= CONTAINS */ + { 409, -1 }, /* (414) in_op ::= IN */ + { 409, -2 }, /* (415) in_op ::= NOT IN */ + { 410, -3 }, /* (416) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 411, -1 }, /* (417) boolean_value_expression ::= boolean_primary */ + { 411, -2 }, /* (418) boolean_value_expression ::= NOT boolean_primary */ + { 411, -3 }, /* (419) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 411, -3 }, /* (420) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 412, -1 }, /* (421) boolean_primary ::= predicate */ + { 412, -3 }, /* (422) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 405, -1 }, /* (423) common_expression ::= expr_or_subquery */ + { 405, -1 }, /* (424) common_expression ::= boolean_value_expression */ + { 413, 0 }, /* (425) from_clause_opt ::= */ + { 413, -2 }, /* (426) from_clause_opt ::= FROM table_reference_list */ + { 414, -1 }, /* (427) table_reference_list ::= table_reference */ + { 414, -3 }, /* (428) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 415, -1 }, /* (429) table_reference ::= table_primary */ + { 415, -1 }, /* (430) table_reference ::= joined_table */ + { 416, -2 }, /* (431) table_primary ::= table_name alias_opt */ + { 416, -4 }, /* (432) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 416, -2 }, /* (433) table_primary ::= subquery alias_opt */ + { 416, -1 }, /* (434) table_primary ::= parenthesized_joined_table */ + { 418, 0 }, /* (435) alias_opt ::= */ + { 418, -1 }, /* (436) alias_opt ::= table_alias */ + { 418, -2 }, /* (437) alias_opt ::= AS table_alias */ + { 419, -3 }, /* (438) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 419, -3 }, /* (439) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 417, -6 }, /* (440) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 420, 0 }, /* (441) join_type ::= */ + { 420, -1 }, /* (442) join_type ::= INNER */ + { 422, -12 }, /* (443) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 423, 0 }, /* (444) set_quantifier_opt ::= */ + { 423, -1 }, /* (445) set_quantifier_opt ::= DISTINCT */ + { 423, -1 }, /* (446) set_quantifier_opt ::= ALL */ + { 424, -1 }, /* (447) select_list ::= select_item */ + { 424, -3 }, /* (448) select_list ::= select_list NK_COMMA select_item */ + { 432, -1 }, /* (449) select_item ::= NK_STAR */ + { 432, -1 }, /* (450) select_item ::= common_expression */ + { 432, -2 }, /* (451) select_item ::= common_expression column_alias */ + { 432, -3 }, /* (452) select_item ::= common_expression AS column_alias */ + { 432, -3 }, /* (453) select_item ::= table_name NK_DOT NK_STAR */ + { 386, 0 }, /* (454) where_clause_opt ::= */ + { 386, -2 }, /* (455) where_clause_opt ::= WHERE search_condition */ + { 425, 0 }, /* (456) partition_by_clause_opt ::= */ + { 425, -3 }, /* (457) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 433, -1 }, /* (458) partition_list ::= partition_item */ + { 433, -3 }, /* (459) partition_list ::= partition_list NK_COMMA partition_item */ + { 434, -1 }, /* (460) partition_item ::= expr_or_subquery */ + { 434, -2 }, /* (461) partition_item ::= expr_or_subquery column_alias */ + { 434, -3 }, /* (462) partition_item ::= expr_or_subquery AS column_alias */ + { 429, 0 }, /* (463) twindow_clause_opt ::= */ + { 429, -6 }, /* (464) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 429, -4 }, /* (465) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 429, -6 }, /* (466) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 429, -8 }, /* (467) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 371, 0 }, /* (468) sliding_opt ::= */ + { 371, -4 }, /* (469) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 428, 0 }, /* (470) fill_opt ::= */ + { 428, -4 }, /* (471) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 428, -6 }, /* (472) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 435, -1 }, /* (473) fill_mode ::= NONE */ + { 435, -1 }, /* (474) fill_mode ::= PREV */ + { 435, -1 }, /* (475) fill_mode ::= NULL */ + { 435, -1 }, /* (476) fill_mode ::= LINEAR */ + { 435, -1 }, /* (477) fill_mode ::= NEXT */ + { 430, 0 }, /* (478) group_by_clause_opt ::= */ + { 430, -3 }, /* (479) group_by_clause_opt ::= GROUP BY group_by_list */ + { 436, -1 }, /* (480) group_by_list ::= expr_or_subquery */ + { 436, -3 }, /* (481) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 431, 0 }, /* (482) having_clause_opt ::= */ + { 431, -2 }, /* (483) having_clause_opt ::= HAVING search_condition */ + { 426, 0 }, /* (484) range_opt ::= */ + { 426, -6 }, /* (485) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 427, 0 }, /* (486) every_opt ::= */ + { 427, -4 }, /* (487) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 437, -4 }, /* (488) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 438, -1 }, /* (489) query_simple ::= query_specification */ + { 438, -1 }, /* (490) query_simple ::= union_query_expression */ + { 442, -4 }, /* (491) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 442, -3 }, /* (492) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 443, -1 }, /* (493) query_simple_or_subquery ::= query_simple */ + { 443, -1 }, /* (494) query_simple_or_subquery ::= subquery */ + { 376, -1 }, /* (495) query_or_subquery ::= query_expression */ + { 376, -1 }, /* (496) query_or_subquery ::= subquery */ + { 439, 0 }, /* (497) order_by_clause_opt ::= */ + { 439, -3 }, /* (498) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 440, 0 }, /* (499) slimit_clause_opt ::= */ + { 440, -2 }, /* (500) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 440, -4 }, /* (501) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 440, -4 }, /* (502) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 441, 0 }, /* (503) limit_clause_opt ::= */ + { 441, -2 }, /* (504) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 441, -4 }, /* (505) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 441, -4 }, /* (506) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 393, -3 }, /* (507) subquery ::= NK_LP query_expression NK_RP */ + { 393, -3 }, /* (508) subquery ::= NK_LP subquery NK_RP */ + { 421, -1 }, /* (509) search_condition ::= common_expression */ + { 444, -1 }, /* (510) sort_specification_list ::= sort_specification */ + { 444, -3 }, /* (511) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 445, -3 }, /* (512) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 446, 0 }, /* (513) ordering_specification_opt ::= */ + { 446, -1 }, /* (514) ordering_specification_opt ::= ASC */ + { 446, -1 }, /* (515) ordering_specification_opt ::= DESC */ + { 447, 0 }, /* (516) null_ordering_opt ::= */ + { 447, -2 }, /* (517) null_ordering_opt ::= NULLS FIRST */ + { 447, -2 }, /* (518) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3507,11 +3619,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,314,&yymsp[0].minor); + yy_destructor(yypParser,317,&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,315,&yymsp[0].minor); + yy_destructor(yypParser,318,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3525,20 +3637,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,314,&yymsp[-2].minor); +{ yy_destructor(yypParser,317,&yymsp[-2].minor); { } - yy_destructor(yypParser,316,&yymsp[0].minor); + yy_destructor(yypParser,319,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,317,&yymsp[0].minor); +{ yy_destructor(yypParser,320,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,315,&yymsp[-1].minor); +{ yy_destructor(yypParser,318,&yymsp[-1].minor); { } - yy_destructor(yypParser,317,&yymsp[0].minor); + yy_destructor(yypParser,320,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3552,72 +3664,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,316,&yymsp[0].minor); + yy_destructor(yypParser,319,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy659, &yymsp[-1].minor.yy0, yymsp[0].minor.yy341); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy673, &yymsp[-1].minor.yy0, yymsp[0].minor.yy439); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy659, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy673, 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.yy659, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy673, 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.yy659, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy673, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy659); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy673); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy341 = 1; } +{ yymsp[1].minor.yy439 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy341 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy439 = 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.yy459, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy221, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy673); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy459, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy221, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy673); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy459 = yymsp[0].minor.yy459; } - yymsp[0].minor.yy459 = yylhsminor.yy459; +{ yylhsminor.yy221 = yymsp[0].minor.yy221; } + yymsp[0].minor.yy221 = yylhsminor.yy221; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy459 = yymsp[-2].minor.yy459 | yymsp[0].minor.yy459; } - yymsp[-2].minor.yy459 = yylhsminor.yy459; +{ yylhsminor.yy221 = yymsp[-2].minor.yy221 | yymsp[0].minor.yy221; } + yymsp[-2].minor.yy221 = yylhsminor.yy221; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy659 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy659 = yylhsminor.yy659; +{ yylhsminor.yy673 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy673 = yylhsminor.yy673; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy659 = yymsp[-2].minor.yy659; } - yymsp[-2].minor.yy659 = yylhsminor.yy659; +{ yylhsminor.yy673 = yymsp[-2].minor.yy673; } + yymsp[-2].minor.yy673 = yylhsminor.yy673; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy659, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy673, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy673, &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.yy659); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy673); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3634,31 +3746,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 366: /* noarg_func ::= NOW */ yytestcase(yyruleno==366); - case 367: /* noarg_func ::= TODAY */ yytestcase(yyruleno==367); - case 368: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==368); - case 369: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==369); - case 370: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==370); - case 371: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==371); - case 372: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==372); - case 373: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==373); - case 374: /* noarg_func ::= USER */ yytestcase(yyruleno==374); - case 375: /* star_func ::= COUNT */ yytestcase(yyruleno==375); - case 376: /* star_func ::= FIRST */ yytestcase(yyruleno==376); - case 377: /* star_func ::= LAST */ yytestcase(yyruleno==377); - case 378: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==378); -{ yylhsminor.yy659 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy659 = yylhsminor.yy659; + 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 371: /* noarg_func ::= NOW */ yytestcase(yyruleno==371); + case 372: /* noarg_func ::= TODAY */ yytestcase(yyruleno==372); + case 373: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==373); + case 374: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==374); + case 375: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==375); + case 376: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==376); + case 377: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==377); + case 378: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==378); + case 379: /* noarg_func ::= USER */ yytestcase(yyruleno==379); + case 380: /* star_func ::= COUNT */ yytestcase(yyruleno==380); + case 381: /* star_func ::= FIRST */ yytestcase(yyruleno==381); + case 382: /* star_func ::= LAST */ yytestcase(yyruleno==382); + case 383: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==383); +{ yylhsminor.yy673 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy673 = yylhsminor.yy673; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3691,1303 +3803,1313 @@ 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.yy173, &yymsp[-1].minor.yy659, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy89, &yymsp[-1].minor.yy673, yymsp[0].minor.yy616); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy673); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy659); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy673); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy659, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy673, yymsp[0].minor.yy616); } break; case 66: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy659); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy673); } break; - case 67: /* cmd ::= TRIM DATABASE db_name */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy659); } + case 67: /* cmd ::= TRIM DATABASE db_name speed_opt */ +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy673, yymsp[0].minor.yy452); } break; case 68: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy173 = true; } +{ yymsp[-2].minor.yy89 = 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 439: /* set_quantifier_opt ::= */ yytestcase(yyruleno==439); -{ yymsp[1].minor.yy173 = false; } + case 264: /* analyze_opt ::= */ yytestcase(yyruleno==264); + case 271: /* agg_func_opt ::= */ yytestcase(yyruleno==271); + case 444: /* set_quantifier_opt ::= */ yytestcase(yyruleno==444); +{ yymsp[1].minor.yy89 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy173 = true; } +{ yymsp[-1].minor.yy89 = true; } break; case 72: /* db_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy616 = createDefaultDatabaseOptions(pCxt); } break; case 73: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 76: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 77: /* db_options ::= db_options DURATION NK_INTEGER */ case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78); -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 80: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 81: /* db_options ::= db_options KEEP integer_list */ case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82); -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_KEEP, yymsp[0].minor.yy152); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 83: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 85: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 86: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 87: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 88: /* db_options ::= db_options STRICT NK_STRING */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 89: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 90: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 91: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_RETENTIONS, yymsp[0].minor.yy152); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 92: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 93: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 94: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-3].minor.yy616, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-3].minor.yy616, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; case 99: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 100: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 101: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 102: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 103: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; case 104: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy515); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createAlterDatabaseOptions(pCxt); yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yylhsminor.yy616, &yymsp[0].minor.yy669); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; case 105: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy515); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy616, &yymsp[0].minor.yy669); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; case 106: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy669.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy669.val = yymsp[0].minor.yy0; } break; case 107: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy669.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy669.val = yymsp[0].minor.yy0; } break; case 108: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy669.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy669.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.yy515.type = DB_OPTION_KEEP; yymsp[-1].minor.yy515.pList = yymsp[0].minor.yy334; } +{ yymsp[-1].minor.yy669.type = DB_OPTION_KEEP; yymsp[-1].minor.yy669.pList = yymsp[0].minor.yy152; } break; case 111: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_WAL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy669.type = DB_OPTION_WAL; yymsp[-1].minor.yy669.val = yymsp[0].minor.yy0; } break; case 112: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy669.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy669.val = yymsp[0].minor.yy0; } break; case 113: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy152 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy152 = yylhsminor.yy152; break; case 114: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 289: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==289); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 293: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==293); +{ yylhsminor.yy152 = addNodeToList(pCxt, yymsp[-2].minor.yy152, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy152 = yylhsminor.yy152; break; case 115: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy152 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy152 = yylhsminor.yy152; break; case 116: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy152 = addNodeToList(pCxt, yymsp[-2].minor.yy152, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy152 = yylhsminor.yy152; 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 381: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==381); - case 387: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==387); - case 442: /* select_list ::= select_item */ yytestcase(yyruleno==442); - case 500: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==500); -{ yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + 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 386: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==386); + case 392: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==392); + case 447: /* select_list ::= select_item */ yytestcase(yyruleno==447); + case 458: /* partition_list ::= partition_item */ yytestcase(yyruleno==458); + case 510: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==510); +{ yylhsminor.yy152 = createNodeList(pCxt, yymsp[0].minor.yy616); } + yymsp[0].minor.yy152 = yylhsminor.yy152; 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 382: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==382); - case 443: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==443); - case 501: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==501); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + 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 387: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==387); + case 448: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==448); + case 459: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==459); + case 511: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==511); +{ yylhsminor.yy152 = addNodeToList(pCxt, yymsp[-2].minor.yy152, yymsp[0].minor.yy616); } + yymsp[-2].minor.yy152 = yylhsminor.yy152; break; case 119: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy616 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; 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.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } + case 120: /* speed_opt ::= */ + case 273: /* bufsize_opt ::= */ yytestcase(yyruleno==273); +{ yymsp[1].minor.yy452 = 0; } break; - case 121: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); } + case 121: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 274: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==274); +{ yymsp[-1].minor.yy452 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 123: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy334); } + 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.yy89, yymsp[-5].minor.yy616, yymsp[-3].minor.yy152, yymsp[-1].minor.yy152, yymsp[0].minor.yy616); } break; - case 124: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + case 123: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy152); } break; - case 125: /* cmd ::= ALTER TABLE alter_table_clause */ - case 291: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==291); -{ pCxt->pRootNode = yymsp[0].minor.yy560; } + case 125: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy152); } break; - case 126: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); } + case 126: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy616); } break; - case 127: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 127: /* cmd ::= ALTER TABLE alter_table_clause */ + case 295: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==295); +{ pCxt->pRootNode = yymsp[0].minor.yy616; } break; - case 128: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 128: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy616); } break; - case 129: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy659); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 129: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy616 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 130: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 130: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy673, yymsp[0].minor.yy784); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 131: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 131: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy673); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 132: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 132: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy673, yymsp[0].minor.yy784); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 133: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy659); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 133: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy673, &yymsp[0].minor.yy673); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 134: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 134: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy673, yymsp[0].minor.yy784); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 135: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 135: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy673); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 136: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy659, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + case 136: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy673, yymsp[0].minor.yy784); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; 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); - case 388: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==388); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy334 = yylhsminor.yy334; + case 137: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy673, &yymsp[0].minor.yy673); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; 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.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy334, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-9].minor.yy560 = yylhsminor.yy560; + case 138: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy616 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy616, &yymsp[-2].minor.yy673, yymsp[0].minor.yy616); } + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 142: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + 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 393: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==393); +{ yylhsminor.yy152 = addNodeToList(pCxt, yymsp[-1].minor.yy152, yymsp[0].minor.yy616); } + yymsp[-1].minor.yy152 = yylhsminor.yy152; break; - case 143: /* specific_cols_opt ::= */ - case 174: /* tags_def_opt ::= */ yytestcase(yyruleno==174); - case 451: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==451); - case 468: /* group_by_clause_opt ::= */ yytestcase(yyruleno==468); - case 487: /* order_by_clause_opt ::= */ yytestcase(yyruleno==487); -{ yymsp[1].minor.yy334 = NULL; } + 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.yy616 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy89, yymsp[-8].minor.yy616, yymsp[-6].minor.yy616, yymsp[-5].minor.yy152, yymsp[-2].minor.yy152, yymsp[0].minor.yy616); } + yymsp[-9].minor.yy616 = yylhsminor.yy616; break; - case 144: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; } + case 144: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy616 = createDropTableClause(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy616); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 145: /* full_table_name ::= table_name */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy659, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 145: /* specific_cols_opt ::= */ + case 176: /* tags_def_opt ::= */ yytestcase(yyruleno==176); + case 456: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==456); + case 478: /* group_by_clause_opt ::= */ yytestcase(yyruleno==478); + case 497: /* order_by_clause_opt ::= */ yytestcase(yyruleno==497); +{ yymsp[1].minor.yy152 = NULL; } break; - case 146: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 146: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ +{ yymsp[-2].minor.yy152 = yymsp[-1].minor.yy152; } break; - case 149: /* column_def ::= column_name type_name */ -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy659, yymsp[0].minor.yy574, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 147: /* full_table_name ::= table_name */ +{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy673, NULL); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 150: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-2].minor.yy574, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 148: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy673, NULL); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 151: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 151: /* column_def ::= column_name type_name */ +{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy673, yymsp[0].minor.yy784, NULL); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 152: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 152: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy673, yymsp[-2].minor.yy784, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 153: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 153: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 154: /* type_name ::= INT */ - case 155: /* type_name ::= INTEGER */ yytestcase(yyruleno==155); -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_INT); } + case 154: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 156: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 155: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 157: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 156: /* type_name ::= INT */ + case 157: /* type_name ::= INTEGER */ yytestcase(yyruleno==157); +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 158: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 158: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 159: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 159: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 160: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 160: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 161: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 161: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 162: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 162: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 163: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 163: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 164: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UINT); } + case 164: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 165: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy574 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 165: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 166: /* type_name ::= JSON */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_JSON); } + case 166: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 167: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 167: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 168: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 168: /* type_name ::= JSON */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 169: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 169: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 170: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 170: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 171: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 171: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 172: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 172: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy784 = 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.yy574 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 173: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 175: /* tags_def_opt ::= tags_def */ - case 380: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==380); -{ yylhsminor.yy334 = yymsp[0].minor.yy334; } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 174: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 176: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; } + case 175: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 177: /* table_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); } + case 177: /* tags_def_opt ::= tags_def */ + case 385: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==385); +{ yylhsminor.yy152 = yymsp[0].minor.yy152; } + yymsp[0].minor.yy152 = yylhsminor.yy152; break; - case 178: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 178: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ +{ yymsp[-3].minor.yy152 = yymsp[-1].minor.yy152; } break; - case 179: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 179: /* table_options ::= */ +{ yymsp[1].minor.yy616 = createDefaultTableOptions(pCxt); } break; - case 180: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 180: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 181: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 181: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy152); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 182: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 182: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy152); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 183: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 183: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy152); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 184: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy515.type, &yymsp[0].minor.yy515.val); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 184: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 185: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy515.type, &yymsp[0].minor.yy515.val); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 185: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_SMA, yymsp[-1].minor.yy152); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 186: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy515.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } + case 186: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy616 = createAlterTableOptions(pCxt); yylhsminor.yy616 = setTableOption(pCxt, yylhsminor.yy616, yymsp[0].minor.yy669.type, &yymsp[0].minor.yy669.val); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 187: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy515.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy515.val = yymsp[0].minor.yy0; } + case 187: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy669.type, &yymsp[0].minor.yy669.val); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 188: /* duration_list ::= duration_literal */ - case 347: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==347); -{ yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 188: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy669.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy669.val = yymsp[0].minor.yy0; } break; - case 189: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 348: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==348); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 189: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy669.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy669.val = yymsp[0].minor.yy0; } break; - case 192: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy659, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 190: /* duration_list ::= duration_literal */ + case 351: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==351); +{ yylhsminor.yy152 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } + yymsp[0].minor.yy152 = yylhsminor.yy152; break; - case 193: /* rollup_func_name ::= FIRST */ - case 194: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==194); -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + 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.yy152 = addNodeToList(pCxt, yymsp[-2].minor.yy152, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } + yymsp[-2].minor.yy152 = yylhsminor.yy152; break; - case 197: /* col_name ::= column_name */ -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy659); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 194: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy673, NULL); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 198: /* cmd ::= SHOW DNODES */ + case 195: /* rollup_func_name ::= FIRST */ + case 196: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==196); +{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy616 = yylhsminor.yy616; + break; + case 199: /* col_name ::= column_name */ +{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy673); } + yymsp[0].minor.yy616 = yylhsminor.yy616; + 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.yy560, yymsp[0].minor.yy560, 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.yy616, yymsp[0].minor.yy616, 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.yy560, yymsp[0].minor.yy560, 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.yy616, yymsp[0].minor.yy616, 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.yy560, 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.yy616, 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.yy560, yymsp[-1].minor.yy560, 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.yy616, yymsp[-1].minor.yy616, 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.yy659); } + case 217: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy673); } break; - case 216: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); } + case 218: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy616); } break; - case 217: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy560); } + case 219: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy616); } 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.yy560); } + case 230: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy616); } 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.yy560, yymsp[-1].minor.yy560, 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.yy616, yymsp[-1].minor.yy616, 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.yy560 = createDefaultDatabaseCondValue(pCxt); } + case 236: /* db_name_cond_opt ::= */ + case 241: /* from_db_opt ::= */ yytestcase(yyruleno==241); +{ yymsp[1].minor.yy616 = createDefaultDatabaseCondValue(pCxt); } break; - case 235: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy659); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 237: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy673); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 236: /* like_pattern_opt ::= */ - case 390: /* case_when_else_opt ::= */ yytestcase(yyruleno==390); - case 420: /* from_clause_opt ::= */ yytestcase(yyruleno==420); - case 449: /* where_clause_opt ::= */ yytestcase(yyruleno==449); - case 453: /* twindow_clause_opt ::= */ yytestcase(yyruleno==453); - case 458: /* sliding_opt ::= */ yytestcase(yyruleno==458); - case 460: /* fill_opt ::= */ yytestcase(yyruleno==460); - case 472: /* having_clause_opt ::= */ yytestcase(yyruleno==472); - case 474: /* range_opt ::= */ yytestcase(yyruleno==474); - case 476: /* every_opt ::= */ yytestcase(yyruleno==476); - case 489: /* slimit_clause_opt ::= */ yytestcase(yyruleno==489); - case 493: /* limit_clause_opt ::= */ yytestcase(yyruleno==493); -{ yymsp[1].minor.yy560 = NULL; } + case 238: /* like_pattern_opt ::= */ + case 283: /* subtable_opt ::= */ yytestcase(yyruleno==283); + case 395: /* case_when_else_opt ::= */ yytestcase(yyruleno==395); + case 425: /* from_clause_opt ::= */ yytestcase(yyruleno==425); + case 454: /* where_clause_opt ::= */ yytestcase(yyruleno==454); + case 463: /* twindow_clause_opt ::= */ yytestcase(yyruleno==463); + case 468: /* sliding_opt ::= */ yytestcase(yyruleno==468); + case 470: /* fill_opt ::= */ yytestcase(yyruleno==470); + case 482: /* having_clause_opt ::= */ yytestcase(yyruleno==482); + case 484: /* range_opt ::= */ yytestcase(yyruleno==484); + case 486: /* every_opt ::= */ yytestcase(yyruleno==486); + case 499: /* slimit_clause_opt ::= */ yytestcase(yyruleno==499); + case 503: /* limit_clause_opt ::= */ yytestcase(yyruleno==503); +{ yymsp[1].minor.yy616 = NULL; } break; - case 237: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 239: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 238: /* table_name_cond ::= table_name */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy659); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 240: /* table_name_cond ::= table_name */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy673); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 240: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy659); } + case 242: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy673); } 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.yy173, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } + 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.yy89, yymsp[-3].minor.yy616, yymsp[-1].minor.yy616, NULL, yymsp[0].minor.yy616); } break; - case 242: /* cmd ::= DROP INDEX exists_opt full_table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + case 244: /* cmd ::= DROP INDEX exists_opt full_table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy616); } 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.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy334, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + 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.yy616 = createIndexOption(pCxt, yymsp[-7].minor.yy152, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } 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.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy334, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + 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.yy616 = createIndexOption(pCxt, yymsp[-9].minor.yy152, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 247: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-1].minor.yy334); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 249: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[-3].minor.yy673, yymsp[-1].minor.yy152); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 248: /* sma_stream_opt ::= */ - case 275: /* stream_options ::= */ yytestcase(yyruleno==275); -{ yymsp[1].minor.yy560 = createStreamOptions(pCxt); } + case 250: /* sma_stream_opt ::= */ + case 277: /* stream_options ::= */ yytestcase(yyruleno==277); +{ yymsp[1].minor.yy616 = 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.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + 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.yy616)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 250: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 252: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 251: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy659, yymsp[0].minor.yy560); } + case 253: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy673, yymsp[0].minor.yy616); } break; - case 252: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy659, &yymsp[0].minor.yy659, false); } + case 254: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy673, &yymsp[0].minor.yy673, 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.yy173, &yymsp[-5].minor.yy659, &yymsp[0].minor.yy659, true); } + case 255: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy89, &yymsp[-5].minor.yy673, &yymsp[0].minor.yy673, true); } break; - case 254: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy659, yymsp[0].minor.yy560, false); } + case 256: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy673, yymsp[0].minor.yy616, 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.yy173, &yymsp[-5].minor.yy659, yymsp[0].minor.yy560, 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.yy89, &yymsp[-5].minor.yy673, yymsp[0].minor.yy616, true); } break; - case 256: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } + case 258: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy673); } break; - case 257: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659); } + case 259: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy673); } 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.yy560); } + case 260: /* cmd ::= DESC full_table_name */ + case 261: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==261); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy616); } 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.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 263: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy89, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 263: /* analyze_opt ::= ANALYZE */ - case 270: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==270); - case 440: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==440); -{ yymsp[0].minor.yy173 = true; } + case 265: /* analyze_opt ::= ANALYZE */ + case 272: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==272); + case 445: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==445); +{ yymsp[0].minor.yy89 = true; } break; - case 264: /* explain_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); } + case 266: /* explain_options ::= */ +{ yymsp[1].minor.yy616 = createDefaultExplainOptions(pCxt); } break; - case 265: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 267: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy616 = setExplainVerbose(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 266: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 268: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy616 = setExplainRatio(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; 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.yy173, yymsp[-8].minor.yy173, &yymsp[-5].minor.yy659, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy574, yymsp[0].minor.yy676); } + 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.yy89, yymsp[-8].minor.yy89, &yymsp[-5].minor.yy673, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy784, yymsp[0].minor.yy452); } break; - case 268: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } + case 270: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy673); } break; - case 271: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy676 = 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.yy89, &yymsp[-7].minor.yy673, yymsp[-4].minor.yy616, yymsp[-6].minor.yy616, yymsp[-3].minor.yy152, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } break; - case 272: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy676 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 276: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy673); } 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.yy173, &yymsp[-5].minor.yy659, yymsp[-2].minor.yy560, yymsp[-4].minor.yy560, yymsp[0].minor.yy560); } + case 278: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 274: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy659); } + case 279: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 276: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 280: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy616)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-3].minor.yy616; } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 277: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 282: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-3].minor.yy616)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy616 = yymsp[-3].minor.yy616; } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 278: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy560)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-3].minor.yy560; } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 284: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 469: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==469); + case 487: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==487); +{ yymsp[-3].minor.yy616 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy616); } break; - case 280: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy560)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy560 = yymsp[-3].minor.yy560; } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 281: /* cmd ::= KILL CONNECTION NK_INTEGER */ + 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.yy334); } + case 290: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy152); } 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.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 292: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy152 = 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.yy560, yymsp[0].minor.yy560); } + case 294: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } 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.yy560, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } + 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.yy616, yymsp[-2].minor.yy152, yymsp[0].minor.yy616); } break; - case 293: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } + case 297: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy616, NULL, yymsp[0].minor.yy616); } break; - case 294: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 298: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 295: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 299: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 296: /* literal ::= NK_STRING */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 300: /* literal ::= NK_STRING */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 297: /* literal ::= NK_BOOL */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 301: /* literal ::= NK_BOOL */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 298: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 302: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 299: /* literal ::= duration_literal */ - case 309: /* signed_literal ::= signed */ yytestcase(yyruleno==309); - case 329: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==329); - case 330: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==330); - case 331: /* expression ::= literal */ yytestcase(yyruleno==331); - case 332: /* expression ::= pseudo_column */ yytestcase(yyruleno==332); - case 333: /* expression ::= column_reference */ yytestcase(yyruleno==333); - case 334: /* expression ::= function_expression */ yytestcase(yyruleno==334); - case 335: /* expression ::= case_when_expression */ yytestcase(yyruleno==335); - case 363: /* function_expression ::= literal_func */ yytestcase(yyruleno==363); - case 412: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==412); - case 416: /* boolean_primary ::= predicate */ yytestcase(yyruleno==416); - case 418: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==418); - case 419: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==419); - case 422: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==422); - case 424: /* table_reference ::= table_primary */ yytestcase(yyruleno==424); - case 425: /* table_reference ::= joined_table */ yytestcase(yyruleno==425); - case 429: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==429); - case 479: /* query_simple ::= query_specification */ yytestcase(yyruleno==479); - case 480: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==480); - case 483: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==483); - case 485: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==485); -{ yylhsminor.yy560 = yymsp[0].minor.yy560; } - yymsp[0].minor.yy560 = yylhsminor.yy560; + 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 368: /* function_expression ::= literal_func */ yytestcase(yyruleno==368); + case 417: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==417); + case 421: /* boolean_primary ::= predicate */ yytestcase(yyruleno==421); + case 423: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==423); + case 424: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==424); + case 427: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==427); + case 429: /* table_reference ::= table_primary */ yytestcase(yyruleno==429); + case 430: /* table_reference ::= joined_table */ yytestcase(yyruleno==430); + case 434: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==434); + case 489: /* query_simple ::= query_specification */ yytestcase(yyruleno==489); + case 490: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==490); + case 493: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==493); + case 495: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==495); +{ yylhsminor.yy616 = yymsp[0].minor.yy616; } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 300: /* literal ::= NULL */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 304: /* literal ::= NULL */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 301: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 305: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 302: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 306: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 303: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 307: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 304: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 308: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 305: /* signed ::= NK_MINUS NK_INTEGER */ + 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 306: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 310: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 307: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 311: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy616 = 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 310: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 314: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 311: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 315: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 312: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 316: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy616 = 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 383: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==383); - case 445: /* select_item ::= common_expression */ yytestcase(yyruleno==445); - case 484: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==484); - case 486: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==486); - case 499: /* search_condition ::= common_expression */ yytestcase(yyruleno==499); -{ yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 317: /* signed_literal ::= duration_literal */ + case 319: /* signed_literal ::= literal_func */ yytestcase(yyruleno==319); + case 388: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==388); + case 450: /* select_item ::= common_expression */ yytestcase(yyruleno==450); + case 460: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==460); + case 494: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==494); + case 496: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==496); + case 509: /* search_condition ::= common_expression */ yytestcase(yyruleno==509); +{ yylhsminor.yy616 = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 314: /* signed_literal ::= NULL */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 318: /* signed_literal ::= NULL */ +{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 316: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 320: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy616 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 336: /* expression ::= NK_LP expression NK_RP */ - case 417: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==417); - case 498: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==498); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 340: /* expression ::= NK_LP expression NK_RP */ + case 422: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==422); + case 508: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==508); +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 337: /* expression ::= NK_PLUS expr_or_subquery */ + case 341: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 338: /* expression ::= NK_MINUS expr_or_subquery */ + case 342: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 339: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 343: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 340: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 344: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 341: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 345: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 342: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 346: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 343: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 347: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 344: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 348: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 345: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 349: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 346: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 350: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 349: /* column_reference ::= column_name */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy659, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy659)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 353: /* column_reference ::= column_name */ +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy673, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy673)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 350: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659, createColumnNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy659)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 354: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy673, createColumnNode(pCxt, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy673)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 351: /* pseudo_column ::= ROWTS */ - case 352: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==352); - case 354: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==354); - case 355: /* pseudo_column ::= QEND */ yytestcase(yyruleno==355); - case 356: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==356); - case 357: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==357); - case 358: /* pseudo_column ::= WEND */ yytestcase(yyruleno==358); - case 359: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==359); - case 365: /* literal_func ::= NOW */ yytestcase(yyruleno==365); -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + 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 364: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==364); + case 370: /* literal_func ::= NOW */ yytestcase(yyruleno==370); +{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 353: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy659)))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 357: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy673)))); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 360: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 361: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==361); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy659, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 365: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 366: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==366); +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy673, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy673, yymsp[-1].minor.yy152)); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 362: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy574)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + case 367: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy784)); } + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 364: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy659, NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 369: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy673, NULL)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 379: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy334 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 384: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy152 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy152 = yylhsminor.yy152; break; - case 384: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 448: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==448); -{ yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy659, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 389: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 453: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==453); +{ yylhsminor.yy616 = createColumnNode(pCxt, &yymsp[-2].minor.yy673, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 385: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 390: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy152, yymsp[-1].minor.yy616)); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 386: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 391: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-2].minor.yy152, yymsp[-1].minor.yy616)); } + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 389: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } + case 394: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy616 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } break; - case 391: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } + case 396: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy616 = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); } break; - case 392: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 397: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==397); + case 397: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 402: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==402); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy128, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy380, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 393: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 398: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + yymsp[-4].minor.yy616 = yylhsminor.yy616; break; - case 394: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 399: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 395: /* predicate ::= expr_or_subquery IS NULL */ + case 400: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 396: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 401: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 398: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_THAN; } + case 403: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_THAN; } break; - case 399: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_THAN; } + case 404: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_THAN; } break; - case 400: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy128 = OP_TYPE_LOWER_EQUAL; } + case 405: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_EQUAL; } break; - case 401: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy128 = OP_TYPE_GREATER_EQUAL; } + case 406: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_EQUAL; } break; - case 402: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy128 = OP_TYPE_NOT_EQUAL; } + case 407: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy380 = OP_TYPE_NOT_EQUAL; } break; - case 403: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy128 = OP_TYPE_EQUAL; } + case 408: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy380 = OP_TYPE_EQUAL; } break; - case 404: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy128 = OP_TYPE_LIKE; } + case 409: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy380 = OP_TYPE_LIKE; } break; - case 405: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_LIKE; } + case 410: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_LIKE; } break; - case 406: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy128 = OP_TYPE_MATCH; } + case 411: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy380 = OP_TYPE_MATCH; } break; - case 407: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy128 = OP_TYPE_NMATCH; } + case 412: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy380 = OP_TYPE_NMATCH; } break; - case 408: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy128 = OP_TYPE_JSON_CONTAINS; } + case 413: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy380 = OP_TYPE_JSON_CONTAINS; } break; - case 409: /* in_op ::= IN */ -{ yymsp[0].minor.yy128 = OP_TYPE_IN; } + case 414: /* in_op ::= IN */ +{ yymsp[0].minor.yy380 = OP_TYPE_IN; } break; - case 410: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy128 = OP_TYPE_NOT_IN; } + case 415: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_IN; } break; - case 411: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 416: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy152)); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 413: /* boolean_value_expression ::= NOT boolean_primary */ + case 418: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 414: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 419: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 415: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 420: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); + yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 421: /* from_clause_opt ::= FROM table_reference_list */ - case 450: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==450); - case 473: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==473); -{ yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; } + case 426: /* from_clause_opt ::= FROM table_reference_list */ + case 455: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==455); + case 483: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==483); +{ yymsp[-1].minor.yy616 = yymsp[0].minor.yy616; } break; - case 423: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 428: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy616 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, NULL); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 426: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 431: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy673, &yymsp[0].minor.yy673); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 427: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy659, &yymsp[-1].minor.yy659, &yymsp[0].minor.yy659); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 432: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-3].minor.yy673, &yymsp[-1].minor.yy673, &yymsp[0].minor.yy673); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 428: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy659); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 433: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy616 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy673); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 430: /* alias_opt ::= */ -{ yymsp[1].minor.yy659 = nil_token; } + case 435: /* alias_opt ::= */ +{ yymsp[1].minor.yy673 = nil_token; } break; - case 431: /* alias_opt ::= table_alias */ -{ yylhsminor.yy659 = yymsp[0].minor.yy659; } - yymsp[0].minor.yy659 = yylhsminor.yy659; + case 436: /* alias_opt ::= table_alias */ +{ yylhsminor.yy673 = yymsp[0].minor.yy673; } + yymsp[0].minor.yy673 = yylhsminor.yy673; break; - case 432: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy659 = yymsp[0].minor.yy659; } + case 437: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy673 = yymsp[0].minor.yy673; } break; - case 433: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 434: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==434); -{ yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; } + case 438: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 439: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==439); +{ yymsp[-2].minor.yy616 = yymsp[-1].minor.yy616; } break; - case 435: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-4].minor.yy540, yymsp[-5].minor.yy560, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + case 440: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy616 = createJoinTableNode(pCxt, yymsp[-4].minor.yy596, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-5].minor.yy616 = yylhsminor.yy616; break; - case 436: /* join_type ::= */ -{ yymsp[1].minor.yy540 = JOIN_TYPE_INNER; } + case 441: /* join_type ::= */ +{ yymsp[1].minor.yy596 = JOIN_TYPE_INNER; } break; - case 437: /* join_type ::= INNER */ -{ yymsp[0].minor.yy540 = JOIN_TYPE_INNER; } + case 442: /* join_type ::= INNER */ +{ yymsp[0].minor.yy596 = JOIN_TYPE_INNER; } break; - case 438: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 443: /* 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.yy560 = createSelectStmt(pCxt, yymsp[-10].minor.yy173, yymsp[-9].minor.yy334, yymsp[-8].minor.yy560); - yymsp[-11].minor.yy560 = addWhereClause(pCxt, yymsp[-11].minor.yy560, yymsp[-7].minor.yy560); - yymsp[-11].minor.yy560 = addPartitionByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-6].minor.yy334); - yymsp[-11].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy560, yymsp[-2].minor.yy560); - yymsp[-11].minor.yy560 = addGroupByClause(pCxt, yymsp[-11].minor.yy560, yymsp[-1].minor.yy334); - yymsp[-11].minor.yy560 = addHavingClause(pCxt, yymsp[-11].minor.yy560, yymsp[0].minor.yy560); - yymsp[-11].minor.yy560 = addRangeClause(pCxt, yymsp[-11].minor.yy560, yymsp[-5].minor.yy560); - yymsp[-11].minor.yy560 = addEveryClause(pCxt, yymsp[-11].minor.yy560, yymsp[-4].minor.yy560); - yymsp[-11].minor.yy560 = addFillClause(pCxt, yymsp[-11].minor.yy560, yymsp[-3].minor.yy560); + yymsp[-11].minor.yy616 = createSelectStmt(pCxt, yymsp[-10].minor.yy89, yymsp[-9].minor.yy152, yymsp[-8].minor.yy616); + yymsp[-11].minor.yy616 = addWhereClause(pCxt, yymsp[-11].minor.yy616, yymsp[-7].minor.yy616); + yymsp[-11].minor.yy616 = addPartitionByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-6].minor.yy152); + yymsp[-11].minor.yy616 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy616, yymsp[-2].minor.yy616); + yymsp[-11].minor.yy616 = addGroupByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-1].minor.yy152); + yymsp[-11].minor.yy616 = addHavingClause(pCxt, yymsp[-11].minor.yy616, yymsp[0].minor.yy616); + yymsp[-11].minor.yy616 = addRangeClause(pCxt, yymsp[-11].minor.yy616, yymsp[-5].minor.yy616); + yymsp[-11].minor.yy616 = addEveryClause(pCxt, yymsp[-11].minor.yy616, yymsp[-4].minor.yy616); + yymsp[-11].minor.yy616 = addFillClause(pCxt, yymsp[-11].minor.yy616, yymsp[-3].minor.yy616); } break; - case 441: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy173 = false; } + case 446: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy89 = false; } break; - case 444: /* select_item ::= NK_STAR */ -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 449: /* select_item ::= NK_STAR */ +{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy616 = yylhsminor.yy616; break; - case 446: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy659); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 451: /* select_item ::= common_expression column_alias */ + case 461: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==461); +{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy673); } + yymsp[-1].minor.yy616 = yylhsminor.yy616; break; - case 447: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy659); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 452: /* select_item ::= common_expression AS column_alias */ + case 462: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==462); +{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), &yymsp[0].minor.yy673); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 452: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 469: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==469); - case 488: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==488); -{ yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; } + case 457: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 479: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==479); + case 498: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==498); +{ yymsp[-2].minor.yy152 = yymsp[0].minor.yy152; } break; - case 454: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 464: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy616 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 455: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 465: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy616 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 456: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 466: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 457: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 467: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } break; - case 459: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 477: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==477); -{ yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); } + case 471: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy616 = createFillNode(pCxt, yymsp[-1].minor.yy102, NULL); } break; - case 461: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); } + case 472: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy616 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy152)); } break; - case 462: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } + case 473: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy102 = FILL_MODE_NONE; } break; - case 463: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy18 = FILL_MODE_NONE; } + case 474: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy102 = FILL_MODE_PREV; } break; - case 464: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy18 = FILL_MODE_PREV; } + case 475: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy102 = FILL_MODE_NULL; } break; - case 465: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy18 = FILL_MODE_NULL; } + case 476: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy102 = FILL_MODE_LINEAR; } break; - case 466: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; } + case 477: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy102 = FILL_MODE_NEXT; } break; - case 467: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; } + case 480: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy152 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } + yymsp[0].minor.yy152 = yylhsminor.yy152; break; - case 470: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 481: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy152 = addNodeToList(pCxt, yymsp[-2].minor.yy152, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } + yymsp[-2].minor.yy152 = yylhsminor.yy152; break; - case 471: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 485: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy616 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } break; - case 475: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 478: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 488: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy334); - yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy616 = addOrderByClause(pCxt, yymsp[-3].minor.yy616, yymsp[-2].minor.yy152); + yylhsminor.yy616 = addSlimitClause(pCxt, yylhsminor.yy616, yymsp[-1].minor.yy616); + yylhsminor.yy616 = addLimitClause(pCxt, yylhsminor.yy616, yymsp[0].minor.yy616); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 481: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 491: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-3].minor.yy616 = yylhsminor.yy616; break; - case 482: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 492: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 490: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 494: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==494); -{ yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 500: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 504: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==504); +{ yymsp[-1].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 491: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 495: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==495); -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 501: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 505: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==505); +{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 492: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 496: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==496); -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 502: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 506: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==506); +{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 497: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 507: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy616); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 502: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy596, yymsp[0].minor.yy487); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 512: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy616 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), yymsp[-1].minor.yy386, yymsp[0].minor.yy585); } + yymsp[-2].minor.yy616 = yylhsminor.yy616; break; - case 503: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy596 = ORDER_ASC; } + case 513: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy386 = ORDER_ASC; } break; - case 504: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy596 = ORDER_ASC; } + case 514: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy386 = ORDER_ASC; } break; - case 505: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy596 = ORDER_DESC; } + case 515: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy386 = ORDER_DESC; } break; - case 506: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy487 = NULL_ORDER_DEFAULT; } + case 516: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy585 = NULL_ORDER_DEFAULT; } break; - case 507: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy487 = NULL_ORDER_FIRST; } + case 517: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy585 = NULL_ORDER_FIRST; } break; - case 508: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy487 = NULL_ORDER_LAST; } + case 518: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy585 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index a159d797fa..121bbaa733 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/parShowToUse.cpp b/source/libs/parser/test/parShowToUse.cpp index e33252c072..f38859c832 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/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index fea2be55f9..8c87f60b9f 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -611,6 +611,8 @@ static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt return code; } +static bool isInterpFunc(int32_t funcId) { return fmIsInterpFunc(funcId) || fmIsInterpPseudoColumnFunc(funcId); } + static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { if (!pSelect->hasInterpFunc) { return TSDB_CODE_SUCCESS; @@ -625,7 +627,7 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p pInterpFunc->node.requireDataOrder = getRequireDataOrder(true, pSelect); pInterpFunc->node.resultDataOrder = pInterpFunc->node.requireDataOrder; - int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_SELECT, fmIsInterpFunc, &pInterpFunc->pFuncs); + int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_SELECT, isInterpFunc, &pInterpFunc->pFuncs); if (TSDB_CODE_SUCCESS == code) { code = rewriteExprsForSelect(pInterpFunc->pFuncs, pSelect, SQL_CLAUSE_SELECT); } @@ -1022,6 +1024,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 a700a21301..927969bf9c 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -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 ec7050fdbc..810b82b9fc 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, @@ -1322,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; } @@ -1371,9 +1379,39 @@ 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); + SFillPhysiNode* pFill = (SFillPhysiNode*)makePhysiNode( + pCxt, (SLogicNode*)pFillNode, + pCxt->pPlanCxt->streamQuery ? QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL : QUERY_NODE_PHYSICAL_PLAN_FILL); if (NULL == pFill) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index c7769b15b1..aeb78f4030 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -101,6 +101,8 @@ TEST_F(PlanBasicTest, interpFunc) { useDb("root", "test"); run("SELECT INTERP(c1) FROM t1 RANGE('2017-7-14 18:00:00', '2017-7-14 19:00:00') EVERY(5s) FILL(LINEAR)"); + + run("SELECT _IROWTS, INTERP(c1) FROM t1 RANGE('2017-7-14 18:00:00', '2017-7-14 19:00:00') EVERY(5s) FILL(LINEAR)"); } TEST_F(PlanBasicTest, lastRowFunc) { diff --git a/source/libs/planner/test/planOtherTest.cpp b/source/libs/planner/test/planOtherTest.cpp index 350ccd0d92..f6416b3cb1 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/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 2ad06249ca..ac063cb50d 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -3093,6 +3093,8 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, if (p[i] == 0) { all = false; + } else { + (*numOfQualified) += 1; } } @@ -3117,6 +3119,8 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows p[i] = ((colData != NULL) && !colDataIsNull((SColumnInfoData *)info->cunits[uidx].colData, 0, i, NULL)); if (p[i] == 0) { all = false; + } else { + (*numOfQualified) += 1; } } @@ -3196,6 +3200,8 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes if (p[i] == 0) { all = false; + } else { + (*numOfQualified) += 1; } } @@ -3269,6 +3275,8 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes, SC if (p[i] == 0) { all = false; + } else { + (*numOfQualified) += 1; } } diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index fde8bca77b..7f3e155a70 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -40,6 +40,11 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath) { goto _err; } + // todo refactor + if (tdbTbOpen("func.state.db", sizeof(SWinKey), -1, SWinKeyCmpr, pState->db, &pState->pFillStateDb) < 0) { + goto _err; + } + if (tdbTbOpen("func.state.db", sizeof(STupleKey), -1, STupleKeyCmpr, pState->db, &pState->pFuncStateDb) < 0) { goto _err; } @@ -55,6 +60,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath) { _err: tdbTbClose(pState->pStateDb); tdbTbClose(pState->pFuncStateDb); + tdbTbClose(pState->pFillStateDb); tdbClose(pState->db); taosMemoryFree(pState); return NULL; @@ -64,6 +70,7 @@ void streamStateClose(SStreamState* pState) { tdbCommit(pState->db, &pState->txn); tdbTbClose(pState->pStateDb); tdbTbClose(pState->pFuncStateDb); + tdbTbClose(pState->pFillStateDb); tdbClose(pState->db); taosMemoryFree(pState); @@ -126,14 +133,30 @@ int32_t streamStateFuncDel(SStreamState* pState, const STupleKey* key) { int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) { return tdbTbUpsert(pState->pStateDb, key, sizeof(SWinKey), value, vLen, &pState->txn); } + +// todo refactor +int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) { + return tdbTbUpsert(pState->pFillStateDb, key, sizeof(SWinKey), value, vLen, &pState->txn); +} + int32_t streamStateGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) { return tdbTbGet(pState->pStateDb, key, sizeof(SWinKey), pVal, pVLen); } +// todo refactor +int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) { + return tdbTbGet(pState->pFillStateDb, key, sizeof(SWinKey), pVal, pVLen); +} + int32_t streamStateDel(SStreamState* pState, const SWinKey* key) { return tdbTbDelete(pState->pStateDb, key, sizeof(SWinKey), &pState->txn); } +// todo refactor +int32_t streamStateFillDel(SStreamState* pState, const SWinKey* key) { + return tdbTbDelete(pState->pFillStateDb, key, sizeof(SWinKey), &pState->txn); +} + int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) { // todo refactor int32_t size = *pVLen; @@ -165,6 +188,31 @@ SStreamStateCur* streamStateGetCur(SStreamState* pState, const SWinKey* key) { return pCur; } +SStreamStateCur* streamStateFillGetCur(SStreamState* pState, const SWinKey* key) { + SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur)); + if (pCur == NULL) return NULL; + tdbTbcOpen(pState->pFillStateDb, &pCur->pCur, NULL); + + int32_t c; + tdbTbcMoveTo(pCur->pCur, key, sizeof(SWinKey), &c); + if (c != 0) { + taosMemoryFree(pCur); + return NULL; + } + return pCur; +} + +SStreamStateCur* streamStateGetAndCheckCur(SStreamState* pState, SWinKey* key) { + SStreamStateCur* pCur = streamStateFillGetCur(pState, key); + if (pCur) { + int32_t code = streamStateGetGroupKVByCur(pCur, key, NULL, 0); + if (code == 0) { + return pCur; + } + } + return NULL; +} + int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) { const SWinKey* pKTmp = NULL; int32_t kLen; @@ -175,6 +223,17 @@ int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** return 0; } +int32_t streamStateGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) { + uint64_t groupId = pKey->groupId; + int32_t code = streamStateGetKVByCur(pCur, pKey, pVal, pVLen); + if (code == 0) { + if (pKey->groupId == groupId) { + return 0; + } + } + return -1; +} + int32_t streamStateSeekFirst(SStreamState* pState, SStreamStateCur* pCur) { // return tdbTbcMoveToFirst(pCur->pCur); @@ -185,12 +244,12 @@ int32_t streamStateSeekLast(SStreamState* pState, SStreamStateCur* pCur) { return tdbTbcMoveToLast(pCur->pCur); } -SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key) { +SStreamStateCur* streamStateFillSeekKeyNext(SStreamState* pState, const SWinKey* key) { SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur)); if (pCur == NULL) { return NULL; } - if (tdbTbcOpen(pState->pStateDb, &pCur->pCur, NULL) < 0) { + if (tdbTbcOpen(pState->pFillStateDb, &pCur->pCur, NULL) < 0) { taosMemoryFree(pCur); return NULL; } @@ -211,12 +270,12 @@ SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key return pCur; } -SStreamStateCur* streamStateSeekKeyPrev(SStreamState* pState, const SWinKey* key) { +SStreamStateCur* streamStateFillSeekKeyPrev(SStreamState* pState, const SWinKey* key) { SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur)); if (pCur == NULL) { return NULL; } - if (tdbTbcOpen(pState->pStateDb, &pCur->pCur, NULL) < 0) { + if (tdbTbcOpen(pState->pFillStateDb, &pCur->pCur, NULL) < 0) { taosMemoryFree(pCur); return NULL; } diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c index 9085873036..29f78b582f 100644 --- a/source/libs/sync/src/syncRaftStore.c +++ b/source/libs/sync/src/syncRaftStore.c @@ -46,7 +46,7 @@ SRaftStore *raftStoreOpen(const char *path) { ASSERT(pRaftStore->pFile != NULL); int len = taosReadFile(pRaftStore->pFile, storeBuf, RAFT_STORE_BLOCK_SIZE); - ASSERT(len == RAFT_STORE_BLOCK_SIZE); + ASSERT(len > 0); ret = raftStoreDeserialize(pRaftStore, storeBuf, len); ASSERT(ret == 0); diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 15e94baee4..325073f366 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/os/src/osDir.c b/source/os/src/osDir.c index 418e86a40a..cf74525543 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 5baba5af1e..310804da8d 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 f34032056c..b34d071773 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 db3aaa49a6..3619e95847 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 6867c1373b..a57bd4ee63 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 2ce2033a00..34a09c3e6c 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/source/util/src/tqueue.c b/source/util/src/tqueue.c index eb70002680..eb62e12a19 100644 --- a/source/util/src/tqueue.c +++ b/source/util/src/tqueue.c @@ -151,15 +151,15 @@ int64_t taosQueueMemorySize(STaosQueue *queue) { void *taosAllocateQitem(int32_t size, EQItype itype) { STaosQnode *pNode = taosMemoryCalloc(1, sizeof(STaosQnode) + size); - pNode->size = size; - pNode->itype = itype; - pNode->timestamp = taosGetTimestampUs(); - if (pNode == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } + pNode->size = size; + pNode->itype = itype; + pNode->timestamp = taosGetTimestampUs(); + if (itype == RPC_QITEM) { int64_t alloced = atomic_add_fetch_64(&tsRpcQueueMemoryUsed, size); if (alloced > tsRpcQueueMemoryAllowed) { diff --git a/source/util/src/tuuid.c b/source/util/src/tuuid.c index 7460ccbc82..d192b1229d 100644 --- a/source/util/src/tuuid.c +++ b/source/util/src/tuuid.c @@ -20,8 +20,8 @@ static int32_t tUUIDSerialNo = 0; int32_t tGenIdPI32(void) { if (tUUIDHashId == 0) { - char uid[64]; - int32_t code = taosGetSystemUUID(uid, tListLen(uid)); + char uid[65] = {0}; + int32_t code = taosGetSystemUUID(uid, sizeof(uid)); if (code != TSDB_CODE_SUCCESS) { terrno = TAOS_SYSTEM_ERROR(errno); } else { diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 1f0731812c..d9ded20070 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -46,7 +46,7 @@ int32_t tQWorkerInit(SQWorkerPool *pool) { void tQWorkerCleanup(SQWorkerPool *pool) { for (int32_t i = 0; i < pool->max; ++i) { SQWorker *worker = pool->workers + i; - if (worker == NULL) continue; + // if (worker == NULL) continue; if (taosCheckPthreadValid(worker->thread)) { taosQsetThreadResume(pool->qset); } @@ -54,7 +54,7 @@ void tQWorkerCleanup(SQWorkerPool *pool) { for (int32_t i = 0; i < pool->max; ++i) { SQWorker *worker = pool->workers + i; - if (worker == NULL) continue; + // if (worker == NULL) continue; if (taosCheckPthreadValid(worker->thread)) { taosThreadJoin(worker->thread, NULL); taosThreadClear(&worker->thread); @@ -138,8 +138,8 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) { } void tQWorkerFreeQueue(SQWorkerPool *pool, STaosQueue *queue) { - taosCloseQueue(queue); uDebug("worker:%s, queue:%p is freed", pool->name, queue); + taosCloseQueue(queue); } int32_t tWWorkerInit(SWWorkerPool *pool) { @@ -283,8 +283,8 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) { } void tWWorkerFreeQueue(SWWorkerPool *pool, STaosQueue *queue) { - taosCloseQueue(queue); uDebug("worker:%s, queue:%p is freed", pool->name, queue); + taosCloseQueue(queue); } int32_t tSingleWorkerInit(SSingleWorker *pWorker, const SSingleWorkerCfg *pCfg) { diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 89b7fe00eb..4bcbe190d5 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/stream/deleteInterval.sim b/tests/script/tsim/stream/deleteInterval.sim index 00d10afad9..7532b2d5de 100644 --- a/tests/script/tsim/stream/deleteInterval.sim +++ b/tests/script/tsim/stream/deleteInterval.sim @@ -413,13 +413,8 @@ if $data12 != 3 then goto loop14 endi -return 1 -sql drop stream if exists streams3; -sql drop database if exists test3; -sql drop database if exists test; sql create database test3 vgroups 4; -sql create database test vgroups 1; sql use test3; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); @@ -435,7 +430,7 @@ sql delete from t1; loop15: sleep 200 -sql select * from test.streamt2 order by c1, c2, c3; +sql select * from test.streamt3 order by c1, c2, c3; $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -453,7 +448,7 @@ sql delete from t1 where ts > 100; loop16: sleep 200 -sql select * from test.streamt2 order by c1, c2, c3; +sql select * from test.streamt3 order by c1, c2, c3; $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -471,7 +466,7 @@ sql delete from st; loop17: sleep 200 -sql select * from test.streamt2 order by c1, c2, c3; +sql select * from test.streamt3 order by c1, c2, c3; $loop_count = $loop_count + 1 if $loop_count == 10 then diff --git a/tests/script/tsim/stream/fillIntervalDelete0.sim b/tests/script/tsim/stream/fillIntervalDelete0.sim new file mode 100644 index 0000000000..77d09d5ae8 --- /dev/null +++ b/tests/script/tsim/stream/fillIntervalDelete0.sim @@ -0,0 +1,375 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop database if exists test1; +sql create database test1 vgroups 1; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql insert into t1 values(1648791213000,1,1,1,1.0,'aaa'); +sleep 200 + +$loop_count = 0 + +loop0: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 1 then + print =====rows=$rows + goto loop0 +endi + +sql delete from t1; + +$loop_count = 0 + +loop1: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 0 then + print =====rows1=$rows + goto loop1 +endi + +sql select * from streamt2 order by ts; + +if $rows != 0 then + print =====rows2=$rows + goto loop1 +endi + +sql select * from streamt3 order by ts; + +if $rows != 0 then + print =====rows3=$rows + goto loop1 +endi + +sql select * from streamt4 order by ts; + +if $rows != 0 then + print =====rows4=$rows + goto loop1 +endi + +sql select * from streamt5 order by ts; + +if $rows != 0 then + print =====rows5=$rows + goto loop1 +endi + +sql insert into t1 values(1648791210000,4,4,4,4.0,'ddd'); +sql insert into t1 values(1648791215000,2,2,2,2.0,'bbb'); +sql insert into t1 values(1648791217000,3,3,3,3.0,'ccc'); +sql insert into t1 values(1648791219000,5,5,5,5.0,'eee'); + +$loop_count = 0 + +loop2: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 10 then + print =====rows=$rows + goto loop2 +endi + +#temp +system sh/stop_dnodes.sh +return 1 + +sql delete from t1 where ts >= 1648791214000; + +$loop_count = 0 + +loop3: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 1 then + print =====rows1=$rows + goto loop3 +endi + +sql select * from streamt2 order by ts; + +if $rows != 1 then + print =====rows2=$rows + goto loop3 +endi + +sql select * from streamt3 order by ts; + +if $rows != 1 then + print =====rows3=$rows + goto loop3 +endi + +sql select * from streamt4 order by ts; + +if $rows != 1 then + print =====rows4=$rows + goto loop3 +endi + +sql select * from streamt5 order by ts; + +if $rows != 1 then + print =====rows5=$rows + goto loop3 +endi + +if $data01 != 4 then + print =====data01=$data01 + return -1 +endi + + + +sql insert into t1 values(1648791213000,5,5,5,5.0,'eee'); +sql insert into t1 values(1648791215000,5,5,5,5.0,'eee'); +sql insert into t1 values(1648791219000,6,6,6,6.0,'fff'); + +$loop_count = 0 + +loop4: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 4 then + print =====rows=$rows + goto loop4 +endi + + +sql delete from t1 where ts <= 1648791216000; + +$loop_count = 0 + +loop5: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 1 then + print =====rows1=$rows + goto loop5 +endi + +sql select * from streamt2 order by ts; + +if $rows != 1 then + print =====rows2=$rows + goto loop5 +endi + +sql select * from streamt3 order by ts; + +if $rows != 1 then + print =====rows3=$rows + goto loop5 +endi + +sql select * from streamt4 order by ts; + +if $rows != 1 then + print =====rows4=$rows + goto loop5 +endi + +sql select * from streamt5 order by ts; + +if $rows != 1 then + print =====rows5=$rows + goto loop5 +endi + +if $data01 != 6 then + print =====data01=$data01 + return -1 +endi + + + + +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; +sql drop stream if exists streams9; +sql drop stream if exists streams10; +sql drop database if exists test6; +sql create database test6 vgroups 1; +sql use test6; +sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(1,1,1); +sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); + +sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); +sql insert into t1 values(1648791217000,1,1,1,1.0,'aaa'); + +sql insert into t2 values(1648791215000,1,1,1,1.0,'aaa'); + +sleep 200 + +$loop_count = 0 + +loop7: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by ts; + +if $rows != 8 then + print =====rows=$rows + goto loop7 +endi + +sql delete from t1; + +$loop_count = 0 + +loop8: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by ts; + +if $rows != 0 then + print =====rows6=$rows + goto loop8 +endi + +sql select * from streamt7 order by ts; + +if $rows != 0 then + print =====rows7=$rows + goto loop8 +endi + +sql select * from streamt8 order by ts; + +if $rows != 0 then + print =====rows8=$rows + goto loop8 +endi + +sql select * from streamt9 order by ts; + +if $rows != 0 then + print =====rows9=$rows + goto loop8 +endi + +sql select * from streamt10 order by ts; + +if $rows != 0 then + print =====rows10=$rows + goto loop8 +endi + + + + + + + + + + + + + + + + + + + + + +sql drop stream if exists streams0; +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; + +sql use test1; +sql select * from t1; +print $data00 + +$loop_all = $loop_all + 1 +print ============loop_all=$loop_all + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/fillIntervalDelete1.sim b/tests/script/tsim/stream/fillIntervalDelete1.sim new file mode 100644 index 0000000000..8e6972975e --- /dev/null +++ b/tests/script/tsim/stream/fillIntervalDelete1.sim @@ -0,0 +1,379 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop database if exists test1; +sql create database test1 vgroups 1; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); + +sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); +sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); +sql insert into t1 values(1648791215000,5,5,5,5.0,'ccc'); +sql insert into t1 values(1648791217000,6,6,6,6.0,'ddd'); + +$loop_count = 0 + +loop0: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 8 then + print =====rows=$rows + goto loop0 +endi + + +sql delete from t1 where ts = 1648791213000; + +$loop_count = 0 + +loop2: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +sql select * from streamt1 order by ts; + +if $rows != 8 then + print ====streamt1=rows1=$rows + goto loop2 +endi +if $data31 != NULL then + print ====streamt1=data31=$data31 + goto loop2 +endi + +sql select * from streamt2 order by ts; + +if $rows != 8 then + print ====streamt2=rows2=$rows + goto loop2 +endi +if $data31 != 100 then + print ====streamt2=data31=$data31 + goto loop2 +endi + +sql select * from streamt3 order by ts; + +if $rows != 8 then + print ====streamt3=rows3=$rows + goto loop2 +endi +if $data31 != 5 then + print ====streamt3=data31=$data31 + goto loop2 +endi + +sql select * from streamt4 order by ts; + +if $rows != 8 then + print ====streamt4=rows4=$rows + goto loop2 +endi +if $data31 != 0 then + print ====streamt4=data31=$data31 + goto loop2 +endi + +sql select * from streamt5 order by ts; + +if $rows != 8 then + print ====streamt5=rows5=$rows + goto loop2 +endi +if $data31 != 3 then + print ====streamt5=data31=$data31 + goto loop2 +endi + + +sql insert into t1 values(1648791212000,5,5,5,5.0,'eee'); +sql insert into t1 values(1648791213000,6,6,6,6.0,'fff'); + +$loop_count = 0 + +loop3: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $data21 != 5 then + print ====133=rows=$rows + goto loop3 +endi +if $data31 != 6 then + print ====137=rows=$rows + goto loop3 +endi + + +sql delete from t1 where ts >= 1648791211000 and ts <= 1648791214000; + +$loop_count = 0 + +loop4: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by ts; + +if $rows != 8 then + print ====streamt1=rows1=$rows + goto loop4 +endi +if $data31 != NULL then + print ====streamt1=data31=$data31 + goto loop4 +endi + +sql select * from streamt2 order by ts; + +if $rows != 8 then + print ====streamt2=rows2=$rows + goto loop4 +endi +if $data31 != 100 then + print ====streamt2=data31=$data31 + goto loop4 +endi + +sql select * from streamt3 order by ts; + +if $rows != 8 then + print ====streamt3=rows3=$rows + goto loop4 +endi +if $data31 != 5 then + print ====streamt3=data31=$data31 + goto loop4 +endi + +sql select * from streamt4 order by ts; + +if $rows != 8 then + print ====streamt4=rows4=$rows + goto loop4 +endi +if $data31 != 0 then + print ====streamt4=data31=$data31 + goto loop4 +endi + +sql select * from streamt5 order by ts; + +if $rows != 8 then + print ====streamt5=rows5=$rows + goto loop4 +endi +if $data31 != 3 then + print ====streamt5=data31=$data31 + goto loop4 +endi + + + +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; +sql drop stream if exists streams9; +sql drop stream if exists streams10; +sql drop database if exists test6; +sql create database test6 vgroups 1; +sql use test6; +sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(1,1,1); +sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); + +sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); +sql insert into t1 values(1648791215000,6,8,8,8.0,'bbb'); +sql insert into t1 values(1648791220000,11,10,10,10.0,'ccc'); +sql insert into t1 values(1648791221000,6,6,6,6.0,'fff'); + +sql insert into t2 values(1648791212000,4,4,4,4.0,'ddd'); +sql insert into t2 values(1648791214000,5,5,5,5.0,'eee'); +sql insert into t2 values(1648791216000,2,2,2,2.0,'bbb'); +sql insert into t2 values(1648791222000,6,6,6,6.0,'fff'); + +$loop_count = 0 + +loop5: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by ts; + +if $rows != 13 then + print ====streamt6=rows1=$rows + goto loop5 +endi +if $data21 != 4 then + print ====streamt6=data21=$data21 + goto loop5 +endi + +sql delete from t2; +print delete from t2; + +$loop_count = 0 + +loop6: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt6 order by ts; + +if $rows != 12 then + print ====streamt6=rows2=$rows + goto loop6 +endi +if $data31 != NULL then + print ====streamt6=data31=$data31 + goto loop6 +endi + + +sql select * from streamt7 order by ts; + +if $rows != 12 then + print ====streamt7=rows2=$rows + goto loop6 +endi +if $data31 != 100 then + print ====streamt7=data31=$data31 + goto loop6 +endi + +sql select * from streamt8 order by ts; + +if $rows != 12 then + print ====streamt8=rows3=$rows + goto loop6 +endi +if $data31 != 6 then + print ====streamt8=data31=$data31 + goto loop6 +endi + +sql select * from streamt9 order by ts; + +if $rows != 12 then + print ====streamt9=rows4=$rows + goto loop6 +endi +if $data31 != 1 then + print ====streamt9=data31=$data31 + goto loop6 +endi + +sql select * from streamt10 order by ts; + +if $rows != 12 then + print ====streamt10=rows5=$rows + goto loop6 +endi +if $data21 != 3 then + print ====streamt10=data21=$data21 + return -1 +endi +if $data31 != 4 then + print ====streamt10=data31=$data31 + return -1 +endi +if $data71 != 8 then + print ====streamt10=data71=$data71 + return -1 +endi +if $data91 != 10 then + print ====streamt10=data91=$data91 + return -1 +endi + + + + + + + + + + + + + + + + + + +sql drop stream if exists streams0; +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; +sql drop stream if exists streams9; +sql drop stream if exists streams10; + +sql use test1; +sql select * from t1; +print $data00 + +$loop_all = $loop_all + 1 +print ============loop_all=$loop_all + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/fillIntervalLinear.sim b/tests/script/tsim/stream/fillIntervalLinear.sim new file mode 100644 index 0000000000..46ff785fd3 --- /dev/null +++ b/tests/script/tsim/stream/fillIntervalLinear.sim @@ -0,0 +1,695 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +sql drop stream if exists streams1; +sql drop database if exists test1; +sql create database test1 vgroups 1; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); +sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); + + +$loop_count = 0 + +loop1: +sleep 200 +sql use test1; +sql select * from streamt1 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 13 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 2.000000000 then + print =====data01=$data01 + return -1 +endi +if $data02 != 1.000000000 then + print =====data02=$data02 + return -1 +endi +if $data03 != ccc then + print =====data03=$data03 + return -1 +endi +if $data04 != 1 then + print =====data04=$data04 + return -1 +endi + + +if $data11 != 4.000000000 then + print =====data11=$data11 + return -1 +endi +if $data12 != 2.000000000 then + print =====data12=$data12 + return -1 +endi +if $data13 != NULL then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 6.000000000 then + print =====data21=$data21 + return -1 +endi +if $data22 != 3.000000000 then + print =====data22=$data22 + return -1 +endi +if $data23 != NULL then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 8.000000000 then + print =====data31=$data31 + return -1 +endi +if $data32 != 4.000000000 then + print =====data32=$data32 + return -1 +endi +if $data33 != aaa then + print =====data33=$data33 + return -1 +endi + + +if $data41 != 8.666666667 then + print =====data41=$data41 + return -1 +endi +if $data42 != 4.333333333 then + print =====data42=$data42 + return -1 +endi +if $data43 != NULL then + print =====data43=$data43 + return -1 +endi + + +if $data51 != 9.333333333 then + print =====data01=$data01 + return -1 +endi +if $data52 != 4.666666667 then + print =====data52=$data52 + return -1 +endi +if $data53 != NULL then + print =====data53=$data53 + return -1 +endi + + +if $data61 != 10.000000000 then + print =====data61=$data61 + return -1 +endi +if $data62 != 5.000000000 then + print =====data62=$data62 + return -1 +endi + + +if $data71 != 8.000000000 then + print =====data71=$data71 + return -1 +endi +if $data72 != 4.000000000 then + print =====data72=$data72 + return -1 +endi + + +if $data81 != 6.000000000 then + print =====data81=$data81 + return -1 +endi +if $data82 != 3.000000000 then + print =====data82=$data82 + return -1 +endi + + +if $data91 != 4.000000000 then + print =====data91=$data91 + return -1 +endi +if $data92 != 2.000000000 then + print =====data92=$data92 + return -1 +endi + +if $data[10][1] != 4.666666667 then + print =====data[10][1]=$data[10][1] + return -1 +endi +if $data[10][2] != 2.333333333 then + print =====data[10][2]=$data[10][2] + return -1 +endi + + +if $data[11][1] != 5.333333333 then + print =====data[11][1]=$data[11][1] + return -1 +endi +if $data[11][2] != 2.666666667 then + print =====data[11][2]=$data[11][2] + return -1 +endi + + +if $data[12][1] != 6.000000000 then + print =====data[12][1]=$data[12][1] + return -1 +endi +if $data[12][2] != 3.000000000 then + print =====data[12][2]=$data[12][2] + return -1 +endi + + + +sql drop stream if exists streams2; +sql drop database if exists test2; +sql create database test2 vgroups 1; +sql use test2; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); +sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); + + +$loop_count = 0 + +loop2: + +sleep 200 + +sql select * from streamt2 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 13 then + print =====rows=$rows + goto loop2 +endi + +if $data01 != 2.000000000 then + print =====data01=$data01 + return -1 +endi +if $data02 != 1.000000000 then + print =====data02=$data02 + return -1 +endi +if $data03 != ccc then + print =====data03=$data03 + return -1 +endi +if $data04 != 1 then + print =====data04=$data04 + return -1 +endi + + +if $data11 != 4.000000000 then + print =====data11=$data11 + return -1 +endi +if $data12 != 2.000000000 then + print =====data12=$data12 + return -1 +endi +if $data13 != NULL then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 6.000000000 then + print =====data21=$data21 + return -1 +endi +if $data22 != 3.000000000 then + print =====data22=$data22 + return -1 +endi +if $data23 != NULL then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 8.000000000 then + print =====data31=$data31 + return -1 +endi +if $data32 != 4.000000000 then + print =====data32=$data32 + return -1 +endi +if $data33 != aaa then + print =====data33=$data33 + return -1 +endi + + +if $data41 != 8.666666667 then + print =====data41=$data41 + return -1 +endi +if $data42 != 4.333333333 then + print =====data42=$data42 + return -1 +endi +if $data43 != NULL then + print =====data43=$data43 + return -1 +endi + + +if $data51 != 9.333333333 then + print =====data01=$data01 + return -1 +endi +if $data52 != 4.666666667 then + print =====data52=$data52 + return -1 +endi +if $data53 != NULL then + print =====data53=$data53 + return -1 +endi + + +if $data61 != 10.000000000 then + print =====data61=$data61 + return -1 +endi +if $data62 != 5.000000000 then + print =====data62=$data62 + return -1 +endi + + +if $data71 != 8.000000000 then + print =====data71=$data71 + return -1 +endi +if $data72 != 4.000000000 then + print =====data72=$data72 + return -1 +endi + + +if $data81 != 6.000000000 then + print =====data81=$data81 + return -1 +endi +if $data82 != 3.000000000 then + print =====data82=$data82 + return -1 +endi + + +if $data91 != 4.000000000 then + print =====data91=$data91 + return -1 +endi +if $data92 != 2.000000000 then + print =====data92=$data92 + return -1 +endi + +if $data[10][1] != 4.666666667 then + print =====data[10][1]=$data[10][1] + return -1 +endi +if $data[10][2] != 2.333333333 then + print =====data[10][2]=$data[10][2] + return -1 +endi + + +if $data[11][1] != 5.333333333 then + print =====data[11][1]=$data[11][1] + return -1 +endi +if $data[11][2] != 2.666666667 then + print =====data[11][2]=$data[11][2] + return -1 +endi + + +if $data[12][1] != 6.000000000 then + print =====data[12][1]=$data[12][1] + return -1 +endi +if $data[12][2] != 3.000000000 then + print =====data[12][2]=$data[12][2] + return -1 +endi + + + +sql drop stream if exists streams3; +sql drop database if exists test3; +sql create database test3 vgroups 1; +sql use test3; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear); +sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); +sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); +sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); +sql insert into t1 values(1648791213000,4,4,4,4.0,'ddd'); + + +$loop_count = 0 + +loop3: +sleep 300 +sql select * from streamt3 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +if $rows != 7 then + print =====rows=$rows + goto loop3 +endi + + +if $data01 != 3 then + print =====data01=$data01 + return -1 +endi +if $data02 != 6.000000000 then + print =====data02=$data02 + return -1 +endi +if $data03 != ccc then + print =====data03=$data03 + return -1 +endi + +if $data11 != 3 then + print =====data11=$data11 + return -1 +endi +if $data12 != 7.000000000 then + print =====data12=$data12 + return -1 +endi +if $data13 != NULL then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 4 then + print =====data21=$data21 + return -1 +endi +if $data22 != 8.000000000 then + print =====data22=$data22 + return -1 +endi +if $data23 != ddd then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 2 then + print =====data31=$data31 + return -1 +endi +if $data32 != 5.000000000 then + print =====data32=$data32 + return -1 +endi +if $data33 != NULL then + print =====data33=$data33 + return -1 +endi + + +if $data41 != 1 then + print =====data41=$data41 + return -1 +endi +if $data42 != 2.000000000 then + print =====data42=$data42 + return -1 +endi +if $data43 != aaa then + print =====data43=$data43 + return -1 +endi + + +if $data51 != 1 then + print =====data51=$data51 + return -1 +endi +if $data52 != 3.000000000 then + print =====data52=$data52 + return -1 +endi +if $data53 != NULL then + print =====data53=$data53 + return -1 +endi + + +if $data61 != 2 then + print =====data61=$data61 + return -1 +endi +if $data62 != 4.000000000 then + print =====data62=$data62 + return -1 +endi +if $data63 != bbb then + print =====data63=$data63 + return -1 +endi + + +sql insert into t1 values(1648791212000,5,5,5,5.0,'eee'); +sql insert into t1 values(1648791207000,6,6,6,6.0,'fff') (1648791209000,7,7,7,7.0,'ggg') (1648791219000,8,8,8,8.0,'hhh') (1648791221000,9,9,9,9.0,'iii'); + + + +$loop_count = 0 + +loop4: + +sleep 200 + +sql select * from test3.streamt3 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +if $rows != 15 then + print =====rows=$rows + goto loop4 +endi + + +if $data01 != 6 then + print =====data01=$data01 + return -1 +endi +if $data02 != 12.000000000 then + print =====data02=$data02 + return -1 +endi +if $data03 != fff then + print =====data03=$data03 + return -1 +endi + +if $data11 != 6 then + print =====data11=$data11 + return -1 +endi +if $data12 != 13.000000000 then + print =====data12=$data12 + return -1 +endi +if $data13 != NULL then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 7 then + print =====data21=$data21 + return -1 +endi +if $data22 != 14.000000000 then + print =====data22=$data22 + return -1 +endi +if $data23 != ggg then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 5 then + print =====data31=$data31 + return -1 +endi +if $data32 != 10.000000000 then + print =====data32=$data32 + return -1 +endi +if $data33 != NULL then + print =====data33=$data33 + return -1 +endi + +if $data51 != 5 then + print =====data51=$data51 + return -1 +endi +if $data52 != 10.000000000 then + print =====data52=$data52 + return -1 +endi +if $data53 != eee then + print =====data53=$data53 + return -1 +endi + + +if $data[11][1] != 5 then + print =====data[11][1]=$data[11][1] + return -1 +endi +if $data[11][2] != 10.000000000 then + print =====data[11][2]=$data[11][2] + return -1 +endi +if $data[11][3] != NULL then + print =====data[11][3]=$data[11][3] + return -1 +endi + +if $data[12][1] != 8 then + print =====data[12][1]=$data[12][1] + return -1 +endi +if $data[12][2] != 16.000000000 then + print =====data[12][2]=$data[12][2] + return -1 +endi +if $data[12][3] != hhh then + print =====data[12][3]=$data[12][3] + return -1 +endi + +if $data[13][1] != 8 then + print =====data[13][1]=$data[13][1] + return -1 +endi +if $data[13][2] != 17.000000000 then + print =====data[13][2]=$data[13][2] + return -1 +endi +if $data[13][3] != NULL then + print =====data[13][3]=$data[13][3] + return -1 +endi + +if $data[14][1] != 9 then + print =====data[14][1]=$data[14][1] + return -1 +endi +if $data[14][2] != 18.000000000 then + print =====data[14][2]=$data[14][2] + return -1 +endi +if $data[14][3] != iii then + print =====data[14][3]=$data[14][3] + return -1 +endi + + + + + + + + + + + + + + + + + + + + + + + + +sql drop stream if exists streams0; +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; + +sql use test1; +sql select * from t1; +print $data00 + +$loop_all = $loop_all + 1 +print ============loop_all=$loop_all + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/fillIntervalPartitionBy.sim b/tests/script/tsim/stream/fillIntervalPartitionBy.sim new file mode 100644 index 0000000000..384aa2c8e4 --- /dev/null +++ b/tests/script/tsim/stream/fillIntervalPartitionBy.sim @@ -0,0 +1,171 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop database if exists test1; +sql create database test1 vgroups 1; +sql use test1; +sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL); +sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next); +sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev); +sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear); + +sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); +sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); +sql insert into t1 values(1648791215000,5,5,5,5.0,'ccc'); +sql insert into t1 values(1648791216000,6,6,6,6.0,'ddd'); +sql insert into t2 values(1648791210000,7,0,0,0.0,'aaa'); +sql insert into t2 values(1648791213000,8,1,1,1.0,'bbb'); +sql insert into t2 values(1648791215000,9,5,5,5.0,'ccc'); +sql insert into t2 values(1648791216000,10,6,6,6.0,'ddd'); + +$loop_count = 0 + +loop2: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +sql select * from streamt1 order by group_id, ts; + +if $rows != 14 then + print ====streamt1=rows1=$rows + goto loop2 +endi + +sql select * from streamt2 order by group_id, ts; + +if $rows != 14 then + print ====streamt2=rows2=$rows + goto loop2 +endi + +sql select * from streamt3 order by group_id, ts; + +if $rows != 14 then + print ====streamt3=rows3=$rows + goto loop2 +endi + +sql select * from streamt4 order by group_id, ts; + +if $rows != 14 then + print ====streamt4=rows4=$rows + goto loop2 +endi + +sql select * from streamt5 order by group_id, ts; + +if $rows != 14 then + print ====streamt5=rows5=$rows + goto loop2 +endi + +sql delete from t1 where ts = 1648791216000; +print ======delete from t1 where ts = 1648791216000; + +$loop_count = 0 + +loop3: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt1 order by group_id, ts; + +if $rows != 13 then + print ====streamt1=rows1=$rows + goto loop3 +endi + +sql select * from streamt2 order by group_id, ts; + +if $rows != 13 then + print ====streamt2=rows2=$rows + goto loop3 +endi + +sql select * from streamt3 order by group_id, ts; + +if $rows != 13 then + print ====streamt3=rows3=$rows + goto loop3 +endi + +sql select * from streamt4 order by group_id, ts; + +if $rows != 13 then + print ====streamt4=rows4=$rows + goto loop3 +endi + +sql select * from streamt5 order by group_id, ts; + +if $rows != 13 then + print ====streamt5=rows5=$rows + goto loop3 +endi + + + + + + + + + + + + + + + + + + + + + +sql drop stream if exists streams0; +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; +sql drop stream if exists streams9; +sql drop stream if exists streams10; + +sql use test1; +sql select * from t1; +print $data00 + +$loop_all = $loop_all + 1 +print ============loop_all=$loop_all + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/fillIntervalPrevNext.sim b/tests/script/tsim/stream/fillIntervalPrevNext.sim new file mode 100644 index 0000000000..5eab5fdac1 --- /dev/null +++ b/tests/script/tsim/stream/fillIntervalPrevNext.sim @@ -0,0 +1,1036 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop database if exists test1; +sql create database test1 vgroups 1; +sql use test1; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); +sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); + + +$loop_count = 0 + +loop1: +sleep 200 +sql use test1; +sql select * from streamt1 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 10 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 2.000000000 then + print =====data02=$data02 + goto loop1 +endi + + +if $data11 != 1 then + print =====data11=$data11 + goto loop1 +endi + +if $data12 != 2.000000000 then + print =====data12=$data12 + goto loop1 +endi + + +if $data21 != 1 then + print =====data21=$data21 + goto loop1 +endi + +if $data22 != 8.000000000 then + print =====data22=$data22 + goto loop1 +endi + + +if $data31 != 1 then + print =====data31=$data31 + goto loop1 +endi + +if $data32 != 8.000000000 then + print =====data32=$data32 + goto loop1 +endi + + +if $data41 != 1 then + print =====data41=$data41 + goto loop1 +endi + +if $data42 != 10.000000000 then + print =====data42=$data42 + goto loop1 +endi + + +if $data51 != 1 then + print =====data01=$data01 + goto loop1 +endi + +if $data52 != 10.000000000 then + print =====data52=$data52 + goto loop1 +endi + + +if $data61 != 1 then + print =====data61=$data61 + goto loop1 +endi + +if $data62 != 4.000000000 then + print =====data62=$data62 + goto loop1 +endi + + +if $data71 != 1 then + print =====data71=$data71 + goto loop1 +endi + +if $data72 != 4.000000000 then + print =====data72=$data72 + goto loop1 +endi + + +if $data81 != 1 then + print =====data81=$data81 + goto loop1 +endi + +if $data82 != 4.000000000 then + print =====data82=$data82 + goto loop1 +endi + + +if $data91 != 1 then + print =====data91=$data91 + goto loop1 +endi + +if $data92 != 6.000000000 then + print =====data92=$data92 + goto loop1 +endi + +sql use test1; +sql select * from streamt2 order by ts; + +print next----------------------151 + +if $rows != 10 then + print =====rows=$rows + goto loop1 +endi + +if $data02 != 2.000000000 then + print =====data02=$data02 + goto loop1 +endi +if $data03 != 1.000000000 then + print =====data03=$data03 + goto loop1 +endi + +if $data12 != 8.000000000 then + print =====data12=$data12 + goto loop1 +endi +if $data13 != 4.000000000 then + print =====data13=$data13 + goto loop1 +endi + + +if $data22 != 8.000000000 then + print =====data22=$data22 + goto loop1 +endi +if $data23 != 4.000000000 then + print =====data23=$data23 + goto loop1 +endi + + +if $data32 != 10.000000000 then + print =====data32=$data32 + goto loop1 +endi +if $data33 != 5.000000000 then + print =====data33=$data33 + goto loop1 +endi + + +if $data42 != 10.000000000 then + print =====data42=$data42 + goto loop1 +endi +if $data43 != 5.000000000 then + print =====data43=$data43 + goto loop1 +endi + + +if $data52 != 4.000000000 then + print =====data52=$data52 + goto loop1 +endi +if $data53 != 2.000000000 then + print =====data53=$data53 + goto loop1 +endi + + +if $data62 != 4.000000000 then + print =====data62=$data62 + goto loop1 +endi +if $data63 != 2.000000000 then + print =====data63=$data63 + goto loop1 +endi + + +if $data72 != 6.000000000 then + print =====data72=$data72 + return -1 +endi +if $data73 != 3.000000000 then + print =====data73=$data73 + return -1 +endi + + +if $data82 != 6.000000000 then + print =====data82=$data82 + return -1 +endi +if $data83 != 3.000000000 then + print =====data83=$data83 + return -1 +endi + + +if $data92 != 6.000000000 then + print =====data92=$data92 + return -1 +endi +if $data93 != 3.000000000 then + print =====data93=$data93 + return -1 +endi + + + +sql drop stream if exists streams5; +sql drop stream if exists streams6; +sql drop database if exists test5; +sql create database test5 vgroups 1; +sql use test5; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); +sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); + +$loop_count = 0 + +loop5: +sleep 200 +sql select * from streamt5 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 10 then + print =====rows=$rows + goto loop5 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop5 +endi + +if $data02 != 2.000000000 then + print =====data02=$data02 + goto loop5 +endi + + +if $data11 != 1 then + print =====data11=$data11 + goto loop5 +endi + +if $data12 != 2.000000000 then + print =====data12=$data12 + goto loop5 +endi + + +if $data21 != 1 then + print =====data21=$data21 + goto loop5 +endi + +if $data22 != 8.000000000 then + print =====data22=$data22 + goto loop5 +endi + + +if $data31 != 1 then + print =====data31=$data31 + goto loop5 +endi + +if $data32 != 8.000000000 then + print =====data32=$data32 + goto loop5 +endi + + +if $data41 != 1 then + print =====data41=$data41 + goto loop5 +endi + +if $data42 != 10.000000000 then + print =====data42=$data42 + goto loop5 +endi + + +if $data51 != 1 then + print =====data01=$data01 + goto loop5 +endi + +if $data52 != 10.000000000 then + print =====data52=$data52 + goto loop5 +endi + + +if $data61 != 1 then + print =====data61=$data61 + goto loop5 +endi + +if $data62 != 4.000000000 then + print =====data62=$data62 + goto loop5 +endi + + +if $data71 != 1 then + print =====data71=$data71 + goto loop5 +endi + +if $data72 != 4.000000000 then + print =====data72=$data72 + goto loop5 +endi + + +if $data81 != 1 then + print =====data81=$data81 + goto loop5 +endi + +if $data82 != 4.000000000 then + print =====data82=$data82 + goto loop5 +endi + + +if $data91 != 1 then + print =====data91=$data91 + goto loop5 +endi + +if $data92 != 6.000000000 then + print =====data92=$data92 + goto loop5 +endi + + +$loop_count = 0 + +loop6: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 200 + +sql select * from streamt6 order by ts; + +if $rows != 10 then + print =====rows=$rows + goto loop6 +endi + +if $data02 != 2.000000000 then + print =====data02=$data02 + goto loop6 +endi +if $data03 != 1.000000000 then + print =====data03=$data03 + goto loop6 +endi + +if $data12 != 8.000000000 then + print =====data12=$data12 + goto loop6 +endi +if $data13 != 4.000000000 then + print =====data13=$data13 + goto loop6 +endi + + +if $data22 != 8.000000000 then + print =====data22=$data22 + goto loop6 +endi +if $data23 != 4.000000000 then + print =====data23=$data23 + goto loop6 +endi + + +if $data32 != 10.000000000 then + print =====data32=$data32 + goto loop6 +endi +if $data33 != 5.000000000 then + print =====data33=$data33 + goto loop6 +endi + + +if $data42 != 10.000000000 then + print =====data42=$data42 + goto loop6 +endi +if $data43 != 5.000000000 then + print =====data43=$data43 + goto loop6 +endi + + +if $data52 != 4.000000000 then + print =====data52=$data52 + goto loop6 +endi +if $data53 != 2.000000000 then + print =====data53=$data53 + goto loop6 +endi + + +if $data62 != 4.000000000 then + print =====data62=$data62 + goto loop6 +endi +if $data63 != 2.000000000 then + print =====data63=$data63 + goto loop6 +endi + + +if $data72 != 6.000000000 then + print =====data72=$data72 + return -1 +endi +if $data73 != 3.000000000 then + print =====data73=$data73 + return -1 +endi + + +if $data82 != 6.000000000 then + print =====data82=$data82 + return -1 +endi +if $data83 != 3.000000000 then + print =====data83=$data83 + return -1 +endi + + +if $data92 != 6.000000000 then + print =====data92=$data92 + return -1 +endi +if $data93 != 3.000000000 then + print =====data93=$data93 + return -1 +endi + + + +sql drop stream if exists streams7; +sql drop stream if exists streams8; +sql drop database if exists test7; +sql create database test7 vgroups 1; +sql use test7; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), b+c, s from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), 1, b+1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(next); +sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); +sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); +sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); +sql insert into t1 values(1648791213000,4,4,4,4.0,'ddd'); + + +$loop_count = 0 + +loop7: +sleep 300 +sql select * from streamt7 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +if $rows != 7 then + print =====rows=$rows + goto loop7 +endi + + +if $data01 != 3 then + print =====data01=$data01 + return -1 +endi +if $data02 != 6.000000000 then + print =====data02=$data02 + return -1 +endi +if $data03 != ccc then + print =====data03=$data03 + return -1 +endi + +if $data11 != 3 then + print =====data11=$data11 + return -1 +endi +if $data12 != 6.000000000 then + print =====data12=$data12 + return -1 +endi +if $data13 != ccc then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 4 then + print =====data21=$data21 + return -1 +endi +if $data22 != 8.000000000 then + print =====data22=$data22 + return -1 +endi +if $data23 != ddd then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 4 then + print =====data31=$data31 + return -1 +endi +if $data32 != 8.000000000 then + print =====data32=$data32 + return -1 +endi +if $data33 != ddd then + print =====data33=$data33 + return -1 +endi + + +if $data41 != 1 then + print =====data41=$data41 + return -1 +endi +if $data42 != 2.000000000 then + print =====data42=$data42 + return -1 +endi +if $data43 != aaa then + print =====data43=$data43 + return -1 +endi + + +if $data51 != 1 then + print =====data51=$data51 + return -1 +endi +if $data52 != 2.000000000 then + print =====data52=$data52 + return -1 +endi +if $data53 != aaa then + print =====data53=$data53 + return -1 +endi + + +if $data61 != 2 then + print =====data61=$data61 + return -1 +endi +if $data62 != 4.000000000 then + print =====data62=$data62 + return -1 +endi +if $data63 != bbb then + print =====data63=$data63 + return -1 +endi + +#-------------- + +sleep 200 +sql select * from streamt8 order by ts; + + +if $rows != 7 then + print =====rows=$rows + return -1 +endi + + +if $data01 != 3 then + print =====data01=$data01 + return -1 +endi +if $data02 != 1 then + print =====data02=$data02 + return -1 +endi +if $data03 != 4.000000000 then + print =====data03=$data03 + return -1 +endi + +if $data11 != 4 then + print =====data11=$data11 + return -1 +endi +if $data12 != 1 then + print =====data12=$data12 + return -1 +endi +if $data13 != 5.000000000 then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 4 then + print =====data21=$data21 + return -1 +endi +if $data22 != 1 then + print =====data22=$data22 + return -1 +endi +if $data23 != 5.000000000 then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 1 then + print =====data31=$data31 + return -1 +endi +if $data32 != 1 then + print =====data32=$data32 + return -1 +endi +if $data33 != 2.000000000 then + print =====data33=$data33 + return -1 +endi + + +if $data41 != 1 then + print =====data41=$data41 + return -1 +endi +if $data42 != 1 then + print =====data42=$data42 + return -1 +endi +if $data43 != 2.000000000 then + print =====data43=$data43 + return -1 +endi + + +if $data51 != 2 then + print =====data51=$data51 + return -1 +endi +if $data52 != 1 then + print =====data52=$data52 + return -1 +endi +if $data53 != 3.000000000 then + print =====data53=$data53 + return -1 +endi + + +if $data61 != 2 then + print =====data61=$data61 + return -1 +endi +if $data62 != 1 then + print =====data62=$data62 + return -1 +endi +if $data63 != 3.000000000 then + print =====data63=$data63 + return -1 +endi + +sql insert into t1 values(1648791212000,5,5,5,5.0,'eee'); +sql insert into t1 values(1648791207000,6,6,6,6.0,'fff') (1648791209000,7,7,7,7.0,'ggg') (1648791219000,8,8,8,8.0,'hhh') (1648791221000,9,9,9,9.0,'iii'); + + + +$loop_count = 0 + +loop8: +sleep 200 +sql select * from streamt7 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + + +if $rows != 15 then + print =====rows=$rows + goto loop8 +endi + + +if $data01 != 6 then + print =====data01=$data01 + return -1 +endi +if $data02 != 12.000000000 then + print =====data02=$data02 + return -1 +endi +if $data03 != fff then + print =====data03=$data03 + return -1 +endi + +if $data11 != 6 then + print =====data11=$data11 + return -1 +endi +if $data12 != 12.000000000 then + print =====data12=$data12 + return -1 +endi +if $data13 != fff then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 7 then + print =====data21=$data21 + return -1 +endi +if $data22 != 14.000000000 then + print =====data22=$data22 + return -1 +endi +if $data23 != ggg then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 7 then + print =====data31=$data31 + return -1 +endi +if $data32 != 14.000000000 then + print =====data32=$data32 + return -1 +endi +if $data33 != ggg then + print =====data33=$data33 + return -1 +endi + +if $data51 != 5 then + print =====data51=$data51 + return -1 +endi +if $data52 != 10.000000000 then + print =====data52=$data52 + return -1 +endi +if $data53 != eee then + print =====data53=$data53 + return -1 +endi + + +if $data[11][1] != 2 then + print =====data[11][1]=$data[11][1] + return -1 +endi +if $data[11][2] != 4.000000000 then + print =====data[11][2]=$data[11][2] + return -1 +endi +if $data[11][3] != bbb then + print =====data[11][3]=$data[11][3] + return -1 +endi + +if $data[12][1] != 8 then + print =====data[12][1]=$data[12][1] + return -1 +endi +if $data[12][2] != 16.000000000 then + print =====data[12][2]=$data[12][2] + return -1 +endi +if $data[12][3] != hhh then + print =====data[12][3]=$data[12][3] + return -1 +endi + +if $data[13][1] != 8 then + print =====data[13][1]=$data[13][1] + return -1 +endi +if $data[13][2] != 16.000000000 then + print =====data[13][2]=$data[13][2] + return -1 +endi +if $data[13][3] != hhh then + print =====data[13][3]=$data[13][3] + return -1 +endi + +if $data[14][1] != 9 then + print =====data[14][1]=$data[14][1] + return -1 +endi +if $data[14][2] != 18.000000000 then + print =====data[14][2]=$data[14][2] + return -1 +endi +if $data[14][3] != iii then + print =====data[14][3]=$data[14][3] + return -1 +endi + +print fill next-----------------890 +sql use test7; +sql select * from streamt8 order by ts; + +if $rows != 15 then + print =====rows=$rows + goto loop8 +endi + + +if $data01 != 6 then + print =====data01=$data01 + return -1 +endi +if $data02 != 1 then + print =====data02=$data02 + return -1 +endi +if $data03 != 7.000000000 then + print =====data03=$data03 + return -1 +endi + +if $data11 != 7 then + print =====data11=$data11 + return -1 +endi +if $data13 != 8.000000000 then + print =====data13=$data13 + return -1 +endi + + +if $data21 != 7 then + print =====data21=$data21 + return -1 +endi +if $data23 != 8.000000000 then + print =====data23=$data23 + return -1 +endi + + +if $data31 != 3 then + print =====data31=$data31 + return -1 +endi +if $data33 != 4.000000000 then + print =====data33=$data33 + return -1 +endi + +if $data51 != 5 then + print =====data51=$data51 + return -1 +endi +if $data53 != 6.000000000 then + print =====data53=$data53 + return -1 +endi + + +if $data[11][1] != 8 then + print =====data[11][1]=$data[11][1] + return -1 +endi +if $data[11][2] != 1 then + print =====data[11][2]=$data[11][2] + return -1 +endi +if $data[11][3] != 9.000000000 then + print =====data[11][3]=$data[11][3] + return -1 +endi + +if $data[12][1] != 8 then + print =====data[12][1]=$data[12][1] + return -1 +endi +if $data[12][3] != 9.000000000 then + print =====data[12][3]=$data[12][3] + return -1 +endi + +if $data[13][1] != 9 then + print =====data[13][1]=$data[13][1] + return -1 +endi +if $data[13][3] != 10.000000000 then + print =====data[13][3]=$data[13][3] + return -1 +endi + +if $data[14][1] != 9 then + print =====data[14][1]=$data[14][1] + return -1 +endi +if $data[14][3] != 10.000000000 then + print =====data[14][3]=$data[14][3] + return -1 +endi + + + + + + + + + + + + + + + + + + + + + + + + +sql drop stream if exists streams0; +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; + +sql use test1; +sql select * from t1; +print $data00 + +$loop_all = $loop_all + 1 +print ============loop_all=$loop_all + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/fillIntervalValue.sim b/tests/script/tsim/stream/fillIntervalValue.sim new file mode 100644 index 0000000000..113eae9270 --- /dev/null +++ b/tests/script/tsim/stream/fillIntervalValue.sim @@ -0,0 +1,488 @@ +$loop_all = 0 +looptest: + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 200 +sql connect + +sql drop database if exists test; +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; +sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); +sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); +sleep 100 +sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); +sql insert into t1 values(1648791223000,1,2,3,1.0,'aaa'); +sql insert into t1 values(1648791283000,1,2,3,1.0,'aaa'); +sql insert into t1 values(1648791253000,1,2,3,1.0,'aaa'); + +$loop_count = 0 + +loop0: +sleep 200 +sql select * from streamt order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 8 then + print =====rows=$rows + goto loop0 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop0 +endi + +if $data11 != 1 then + print =====data11=$data11 + goto loop0 +endi + +if $data21 != 1 then + print =====data21=$data21 + goto loop0 +endi + +if $data31 != 100 then + print =====data31=$data31 + goto loop0 +endi + +if $data41 != 1 then + print =====data41=$data41 + goto loop0 +endi + +if $data51 != 100 then + print =====data01=$data01 + goto loop0 +endi + +if $data61 != 100 then + print =====data61=$data61 + goto loop0 +endi + +if $data71 != 1 then + print =====data71=$data71 + goto loop0 +endi + +sql drop stream if exists streams2; +sql drop database if exists test2; +sql create database test2 vgroups 1; +sql use test2; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value, 100,200); +sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); +sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); + +$loop_count = 0 + +loop1: +sleep 200 +sql select * from streamt2 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 10 then + print =====rows=$rows + goto loop1 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 2.000000000 then + print =====data02=$data02 + goto loop1 +endi + + +if $data11 != 100 then + print =====data11=$data11 + goto loop1 +endi + +if $data12 != 200.000000000 then + print =====data12=$data12 + goto loop1 +endi + + +if $data21 != 1 then + print =====data21=$data21 + goto loop1 +endi + +if $data22 != 8.000000000 then + print =====data22=$data22 + goto loop1 +endi + + +if $data31 != 100 then + print =====data31=$data31 + goto loop1 +endi + +if $data32 != 200.000000000 then + print =====data32=$data32 + goto loop1 +endi + + +if $data41 != 1 then + print =====data41=$data41 + goto loop1 +endi + +if $data42 != 10.000000000 then + print =====data42=$data42 + goto loop1 +endi + + +if $data51 != 100 then + print =====data01=$data01 + goto loop1 +endi + +if $data52 != 200.000000000 then + print =====data52=$data52 + goto loop1 +endi + + +if $data61 != 1 then + print =====data61=$data61 + goto loop1 +endi + +if $data62 != 4.000000000 then + print =====data62=$data62 + goto loop1 +endi + + +if $data71 != 100 then + print =====data71=$data71 + goto loop1 +endi + +if $data72 != 200.000000000 then + print =====data72=$data72 + goto loop1 +endi + + +if $data81 != 100 then + print =====data81=$data81 + goto loop1 +endi + +if $data82 != 200.000000000 then + print =====data82=$data82 + goto loop1 +endi + + +if $data91 != 1 then + print =====data91=$data91 + goto loop1 +endi + +if $data92 != 6.000000000 then + print =====data92=$data92 + goto loop1 +endi + +sql drop stream if exists streams3; +sql drop database if exists test3; +sql create database test3 vgroups 1; +sql use test3; +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); +sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(b), a+b, c from t1 where ts >= 1648791200000 and ts < 1648791261000 interval(10s) sliding(3s) fill(value, 100,200,300); + +sql insert into t1 values(1648791220000,1,1,1,1.0,'aaa'); +sleep 100 +sql insert into t1 values(1648791260000,1,1,1,1.0,'aaa'); +sleep 100 +sql insert into t1 values(1648791200000,1,1,1,1.0,'aaa'); + +$loop_count = 0 + +loop3: +sleep 200 +sql select * from streamt3 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 23 then + print =====rows=$rows + goto loop3 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop3 +endi + +if $data02 != 2.000000000 then + print =====data02=$data02 + goto loop3 +endi + +if $data03 != 1 then + print =====data03=$data03 + goto loop3 +endi + + +if $data21 != 1 then + print =====data21=$data21 + goto loop3 +endi + +if $data22 != 2.000000000 then + print =====data22=$data22 + goto loop3 +endi + +if $data23 != 1 then + print =====data23=$data23 + goto loop3 +endi + + +if $data31 != 100 then + print =====data31=$data31 + goto loop3 +endi + +if $data32 != 200.000000000 then + print =====data32=$data32 + goto loop3 +endi + +if $data33 != 300 then + print =====data33=$data33 + goto loop3 +endi + +if $data61 != 100 then + print =====data61=$data61 + goto loop3 +endi + +if $data62 != 200.000000000 then + print =====data62=$data62 + goto loop3 +endi + +if $data63 != 300 then + print =====data63=$data63 + goto loop3 +endi + + +if $data71 != 1 then + print =====data71=$data71 + goto loop3 +endi + +if $data72 != 2.000000000 then + print =====data72=$data72 + goto loop3 +endi + +if $data73 != 1 then + print =====data73=$data73 + goto loop3 +endi + + +if $data91 != 1 then + print =====data91=$data91 + goto loop3 +endi + +if $data92 != 2.000000000 then + print =====data92=$data92 + goto loop3 +endi + +if $data93 != 1 then + print =====data93=$data93 + goto loop3 +endi + + +if $data[10][1] != 100 then + print =====data[10][1]=$data[10][1] + goto loop3 +endi + +if $data[10][2] != 200.000000000 then + print =====data[10][2]=$data[10][2] + goto loop3 +endi + +if $data[10][3] != 300 then + print =====data[10][3]=$data[10][3] + goto loop3 +endi + +if $data[19][1] != 100 then + print =====data[19][1]=$data[19][1] + goto loop3 +endi + +if $data[19][2] != 200.000000000 then + print =====data[19][2]=$data[19][2] + goto loop3 +endi + +if $data[19][3] != 300 then + print =====data[19][3]=$data[19][3] + goto loop3 +endi + + +if $data[20][1] != 1 then + print =====data[20][1]=$data[20][1] + goto loop3 +endi + +if $data[20][2] != 2.000000000 then + print =====data[20][2]=$data[20][2] + goto loop3 +endi + +if $data[20][3] != 1 then + print =====data[20][3]=$data[20][3] + goto loop3 +endi + + +if $data[22][1] != 1 then + print =====data[22][1]=$data[22][1] + goto loop3 +endi + +if $data[22][2] != 2.000000000 then + print =====data[22][2]=$data[22][2] + goto loop3 +endi + +if $data[22][3] != 1 then + print =====data[22][3]=$data[22][3] + goto loop3 +endi + + +sql drop stream if exists streams4; +sql drop database if exists test4; +sql create database test4 vgroups 1; +sql use test4; + +sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; +sql create stream streams4 trigger at_once into streamt4 as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(NULL); +sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); +sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); + +$loop_count = 0 + +loop4: +sleep 200 +sql select * from streamt4 order by ts; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 3 then + print =====rows=$rows + goto loop4 +endi + +if $data11 != NULL then + print =====data11=$data11 + goto loop4 +endi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +sql drop stream if exists streams0; +sql drop stream if exists streams1; +sql drop stream if exists streams2; +sql drop stream if exists streams3; +sql drop stream if exists streams4; +sql drop stream if exists streams5; +sql drop stream if exists streams6; +sql drop stream if exists streams7; +sql drop stream if exists streams8; + +sql use test; +sql select * from t1; +print $data00 + +$loop_all = $loop_all + 1 +print ============loop_all=$loop_all + +system sh/stop_dnodes.sh + +#goto looptest \ No newline at end of file diff --git a/tests/script/tsim/stream/partitionby.sim b/tests/script/tsim/stream/partitionby.sim index e5e02c3873..bc2c07b951 100644 --- a/tests/script/tsim/stream/partitionby.sim +++ b/tests/script/tsim/stream/partitionby.sim @@ -5,13 +5,14 @@ sleep 50 sql connect sql create database test vgroups 4; +sql create database test0 vgroups 1; sql use test; sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); +sql create stream stream_t1 trigger at_once into test0.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -22,7 +23,7 @@ $loop_count = 0 loop0: sleep 300 -sql select * from streamtST1; +sql select * from test0.streamtST1; $loop_count = $loop_count + 1 if $loop_count == 10 then @@ -34,6 +35,29 @@ print =====rows=$rows goto loop0 endi +sql insert into ts1 values(1648791223001,1,12,3,1.0); +sql insert into ts2 values(1648791223001,1,12,3,1.0); + +sql insert into ts3 values(1648791223001,1,12,3,1.0); +sql insert into ts4 values(1648791223001,1,12,3,1.0); +sleep 300 +sql delete from st where ts = 1648791223001; + +loop00: +sleep 300 +sql select * from test0.streamtST1; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 4 then + print =====rows=$rows + goto loop00 +endi + + print =====loop0 sql create database test1 vgroups 1; diff --git a/tests/script/tsim/stream/partitionbyColumnInterval.sim b/tests/script/tsim/stream/partitionbyColumnInterval.sim index 24fdb9c994..fd1d796fdb 100644 --- a/tests/script/tsim/stream/partitionbyColumnInterval.sim +++ b/tests/script/tsim/stream/partitionbyColumnInterval.sim @@ -562,6 +562,53 @@ if $data21 != 1 then goto loop14 endi +sql drop stream if exists streams5; +sql drop database if exists test5; +sql create database test5 vgroups 4; +sql use test5; +sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); +sql create table t4 using st tags(2,2,2); +sql create stream streams5 trigger at_once into test.streamt5 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); + +sql insert into t1 values(1648791213000,1,2,3,1.0); +sql insert into t2 values(1648791213000,2,2,3,1.0); +sql insert into t3 values(1648791213000,3,2,3,1.0); +sql insert into t4 values(1648791213000,4,2,3,1.0); + +sql insert into t1 values(1648791223000,1,2,3,1.0); +sql insert into t2 values(1648791223000,2,2,3,1.0); +sql insert into t3 values(1648791223000,3,2,3,1.0); +sql insert into t4 values(1648791223000,4,2,3,1.0); + +sleep 300 + +sql delete from st where ts = 1648791223000; + +sql select * from test.streamt5; + +$loop_count = 0 + +loop15: +sleep 50 +sql select * from test.streamt5 order by c1, c2, c3; + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +if $rows != 4 then + print =====rows=$rows + print =====rows=$rows + print =====rows=$rows +# goto loop15 +endi + + + $loop_all = $loop_all + 1 print ============loop_all=$loop_all diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 93f8b8a23b..eedb6d7295 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -358,7 +358,7 @@ static int32_t shellCheckArgs() { return -1; } - if (pArgs->password != NULL && (strlen(pArgs->password) <= 0)) { + if (/*pArgs->password != NULL && */ (strlen(pArgs->password) <= 0)) { printf("Invalid password\r\n"); return -1; } diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt index 839c65b633..b048b79e9b 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/createTable.c b/utils/test/c/createTable.c index 6a0f8e244e..783ed85adc 100644 --- a/utils/test/c/createTable.c +++ b/utils/test/c/createTable.c @@ -201,7 +201,7 @@ void *threadFunc(void *param) { int64_t t = pInfo->tableBeginIndex; for (; t <= pInfo->tableEndIndex;) { // int64_t batch = (pInfo->tableEndIndex - t); - // batch = MIN(batch, batchNum); + // batch = TMIN(batch, batchNum); int32_t len = sprintf(qstr, "create table"); for (int32_t i = 0; i < batchNumOfTbl;) { diff --git a/utils/test/c/sdbDump.c b/utils/test/c/sdbDump.c deleted file mode 100644 index b056fe58a3..0000000000 --- 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 diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 16732ff9a1..5bb53287db 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -224,10 +224,24 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) { } int32_t simExecuteExpression(SScript *script, char *exp) { - char *op1, *op2, *var1, *var2, *var3, *rest; - int32_t op1Len, op2Len, var1Len, var2Len, var3Len, val0, val1; - char t0[1024], t1[1024], t2[1024], t3[2048]; - int32_t result; + char *op1 = NULL; + char *op2 = NULL; + char *var1 = NULL; + char *var2 = NULL; + char *var3 = NULL; + char *rest = NULL; + int32_t op1Len = 0; + int32_t op2Len = 0; + int32_t var1Len = 0; + int32_t var2Len = 0; + int32_t var3Len = 0; + int32_t val0 = 0; + int32_t val1 = 0; + char t0[1024] = {0}; + char t1[1024] = {0}; + char t2[1024] = {0}; + char t3[2048] = {0}; + int32_t result = 0; rest = paGetToken(exp, &var1, &var1Len); rest = paGetToken(rest, &op1, &op1Len); @@ -241,9 +255,9 @@ int32_t simExecuteExpression(SScript *script, char *exp) { t0[var1Len] = 0; } - if (var2[0] == '$') - strcpy(t1, simGetVariable(script, var2 + 1, var2Len - 1)); - else { + if (var2[0] == '$') { + tstrncpy(t1, simGetVariable(script, var2 + 1, var2Len - 1), 1024); + } else { memcpy(t1, var2, var2Len); t1[var2Len] = 0; } @@ -258,14 +272,21 @@ int32_t simExecuteExpression(SScript *script, char *exp) { t2[var3Len] = 0; } + int64_t t1l = atoll(t1); + int64_t t2l = atoll(t2); + if (op2[0] == '+') { - sprintf(t3, "%lld", atoll(t1) + atoll(t2)); + sprintf(t3, "%" PRId64, t1l + t2l); } else if (op2[0] == '-') { - sprintf(t3, "%lld", atoll(t1) - atoll(t2)); + sprintf(t3, "%" PRId64, t1l - t2l); } else if (op2[0] == '*') { - sprintf(t3, "%lld", atoll(t1) * atoll(t2)); + sprintf(t3, "%" PRId64, t1l * t2l); } else if (op2[0] == '/') { - sprintf(t3, "%lld", atoll(t1) / atoll(t2)); + if (t2l == 0) { + sprintf(t3, "%" PRId64, INT64_MAX); + } else { + sprintf(t3, "%" PRId64, t1l / t2l); + } } else if (op2[0] == '.') { sprintf(t3, "%s%s", t1, t2); } @@ -636,7 +657,7 @@ bool simCreateTaosdConnect(SScript *script, char *rest) { } bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { - char timeStr[30] = {0}; + char timeStr[80] = {0}; time_t tt; struct tm tp; SCmdLine *line = &script->lines[script->linePos]; @@ -943,7 +964,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) { return true; } - TAOS_RES *pSql = pSql = taos_query(script->taos, rest); + TAOS_RES *pSql = taos_query(script->taos, rest); int32_t ret = taos_errno(pSql); taos_free_result(pSql); @@ -961,7 +982,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) { } bool simExecuteLineInsertCmd(SScript *script, char *rest) { - char buf[TSDB_MAX_BINARY_LEN]; + char buf[TSDB_MAX_BINARY_LEN] = {0}; simVisuallizeOption(script, rest, buf); rest = buf; @@ -973,10 +994,7 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) { char *lines[] = {rest}; #if 0 int32_t ret = taos_insert_lines(script->taos, lines, 1); -#else - int32_t ret = 0; -#endif - if (ret == TSDB_CODE_SUCCESS) { + if (ret == TSDB_CODE_SUCCESS) { simDebug("script:%s, taos:%p, %s executed. success.", script->fileName, script->taos, rest); script->linePos++; return true; @@ -985,6 +1003,11 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) { tstrerror(ret)); return false; } +#else + simDebug("script:%s, taos:%p, %s executed. success.", script->fileName, script->taos, rest); + script->linePos++; + return true; +#endif } bool simExecuteLineInsertErrorCmd(SScript *script, char *rest) { diff --git a/utils/tsim/src/simMain.c b/utils/tsim/src/simMain.c index 713e46df58..e58a22cf68 100644 --- a/utils/tsim/src/simMain.c +++ b/utils/tsim/src/simMain.c @@ -33,7 +33,7 @@ int32_t main(int32_t argc, char *argv[]) { if (strcmp(argv[i], "-c") == 0 && i < argc - 1) { tstrncpy(configDir, argv[++i], 128); } else if (strcmp(argv[i], "-f") == 0 && i < argc - 1) { - strcpy(scriptFile, argv[++i]); + tstrncpy(scriptFile, argv[++i], MAX_FILE_NAME_LEN); } else if (strcmp(argv[i], "-m") == 0) { useMultiProcess = true; } else if (strcmp(argv[i], "-v") == 0) { diff --git a/utils/tsim/src/simParse.c b/utils/tsim/src/simParse.c index b9f7610be8..14be10bc8a 100644 --- a/utils/tsim/src/simParse.c +++ b/utils/tsim/src/simParse.c @@ -175,14 +175,17 @@ SScript *simBuildScriptObj(char *fileName) { SScript *simParseScript(char *fileName) { TdFilePtr pFile; int32_t tokenLen, lineNum = 0; - char buffer[10*1024], name[128], *token, *rest; - SCommand *pCmd; - SScript *script; + char buffer[10 * 1024] = {0}; + char name[PATH_MAX] = {9}; + char *token = NULL; + char *rest = NULL; + SCommand *pCmd = NULL; + SScript *script = NULL; if ((fileName[0] == '.') || (fileName[0] == '/')) { - strcpy(name, fileName); + tstrncpy(name, fileName, PATH_MAX); } else { - sprintf(name, "%s" TD_DIRSEP "%s", simScriptDir, fileName); + snprintf(name, PATH_MAX, "%s" TD_DIRSEP "%s", simScriptDir, fileName); taosRealPath(name, NULL, sizeof(name)); }